3737#include "menus/miscellaneous.h"
3838#include "menus/screen_filters.h"
3939
40- static Result stealFsReg (void )
41- {
42- Result ret = 0 ;
43-
44- ret = svcControlService (SERVICEOP_STEAL_CLIENT_SESSION , fsRegGetSessionHandle (), "fs:REG" );
45- while (ret == 0x9401BFE )
46- {
47- svcSleepThread (500 * 1000LL );
48- ret = svcControlService (SERVICEOP_STEAL_CLIENT_SESSION , fsRegGetSessionHandle (), "fs:REG" );
49- }
50-
51- return ret ;
52- }
53-
54- static Result fsRegSetupPermissions (void )
55- {
56- u32 pid ;
57- Result res ;
58- FS_ProgramInfo info ;
59-
60- ExHeader_Arm11StorageInfo storageInfo = {
61- .fs_access_info = FSACCESS_NANDRO_RW | FSACCESS_NANDRW | FSACCESS_SDMC_RW ,
62- };
63-
64- info .programId = 0x0004013000006902LL ; // Rosalina TID
65- info .mediaType = MEDIATYPE_NAND ;
66-
67- if (R_SUCCEEDED (res = svcGetProcessId (& pid , CUR_PROCESS_HANDLE )))
68- res = FSREG_Register (pid , 0xFFFF000000000000LL , & info , & storageInfo );
69-
70- return res ;
71- }
72-
7340// this is called before main
7441bool isN3DS ;
7542void __appInit ()
@@ -82,7 +49,12 @@ void __appInit()
8249 svcBreak (USERBREAK_PANIC );
8350 }
8451
85- if (R_FAILED (stealFsReg ()) || R_FAILED (fsRegSetupPermissions ()) || R_FAILED (fsInit ()))
52+ // Wait for pm to call fs:REG Register on us
53+ bool registered = false;
54+ while (srvIsServiceRegistered (& registered , "pm:app" ), registered )
55+ svcSleepThread (500 * 1000LL );
56+
57+ if (R_FAILED (fsInit ()))
8658 svcBreak (USERBREAK_PANIC );
8759}
8860
0 commit comments