Skip to content

Commit e338fa6

Browse files
fix: arm64 compatibility issues
1 parent 6cca6b9 commit e338fa6

2 files changed

Lines changed: 24 additions & 2 deletions

File tree

import.h

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,9 +303,30 @@ extern struct shared_ptr *_ZN17storeservicescore16PurchaseResponse5errorEv(void
303303
extern struct std_vector _ZNK17storeservicescore16PurchaseResponse5itemsEv(void *);
304304
extern struct std_vector _ZNK17storeservicescore12PurchaseItem6assetsEv(void *);
305305
extern union std_string *_ZNK17storeservicescore13PurchaseAsset3URLEv(void *, void *);
306+
void _ZNK17storeservicescore13PurchaseAsset3URLEvASM(void *buf, void *assetObj) {
307+
asm volatile(
308+
"mov x8, %0\n" // 将接收返回值的内存地址放入 x8
309+
"mov x0, %1\n" // 将 this 指针放入 x0
310+
"bl _ZNK17storeservicescore13PurchaseAsset3URLEv\n" // 调用目标函数
311+
:
312+
: "r" (buf), "r" (assetObj)
313+
: "x8", "x0", "lr", "memory"
314+
);
315+
}
306316
extern int _ZNK17storeservicescore19StoreErrorCondition9errorCodeEv(void *);
307317

308318
extern void *_ZN17storeservicescore14RequestContext8fairPlayEv(void *, void *);
319+
void _ZN17storeservicescore14RequestContext8fairPlayEvASM(void *buf, void *reqCtxObj) {
320+
asm volatile(
321+
"mov x8, %0\n"
322+
"mov x0, %1\n"
323+
"bl _ZN17storeservicescore14RequestContext8fairPlayEv\n"
324+
:
325+
: "r" (buf), "r" (reqCtxObj)
326+
: "x8", "x0", "lr", "memory"
327+
);
328+
}
329+
309330
extern struct std_vector _ZN17storeservicescore8FairPlay21getSubscriptionStatusEv(void *);
310331

311332

main.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -512,14 +512,15 @@ const char* get_m3u8_method_download(struct shared_ptr reqCtx, unsigned long ada
512512
struct std_vector assets = _ZNK17storeservicescore12PurchaseItem6assetsEv(firstItem->obj);
513513
struct shared_ptr *lastAsset = (struct shared_ptr *)assets.end - 1;
514514
union std_string *url_str = malloc(sizeof(union std_string));
515-
_ZNK17storeservicescore13PurchaseAsset3URLEv(url_str, lastAsset->obj);
515+
_ZNK17storeservicescore13PurchaseAsset3URLEvASM(url_str, lastAsset->obj);
516516
const char *url = std_string_data(url_str);
517517
if (url) {
518518
char *result = strdup(url); // Make a copy
519519
free(url_str);
520520
return result;
521521
}
522522
}
523+
printf("14\n");
523524
return NULL;
524525
}
525526

@@ -910,7 +911,7 @@ void write_music_token(void) {
910911

911912
int offline_available() {
912913
struct shared_ptr *fairplay = malloc(16);
913-
_ZN17storeservicescore14RequestContext8fairPlayEv(fairplay, reqCtx.obj);
914+
_ZN17storeservicescore14RequestContext8fairPlayEvASM(fairplay, reqCtx.obj);
914915
struct std_vector fairplay_status = _ZN17storeservicescore8FairPlay21getSubscriptionStatusEv(fairplay->obj);
915916
char *begin_ptr = (char*)fairplay_status.begin;
916917
char *second_item_ptr = begin_ptr + 16;

0 commit comments

Comments
 (0)