Skip to content

Commit

Permalink
fixed ios 18 trollstore
Browse files Browse the repository at this point in the history
  • Loading branch information
asdfugil committed Jul 21, 2024
1 parent 4fd1f81 commit d747920
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 0 deletions.
1 change: 1 addition & 0 deletions include/universalhooks/hooks.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@ void cfprefsdInit(void);
void pineboardInit(void);
void lsdUniversalInit(void);
void headboardInit(void);
void trollstorehelperInit(char* executablePath);

#endif
4 changes: 4 additions & 0 deletions plooshInit.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@
01F2C6172C4C4118007E932C /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 01F2C6162C4C4118007E932C /* CoreGraphics.framework */; };
01F2C6192C4C411B007E932C /* ImageIO.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 01F2C6182C4C411B007E932C /* ImageIO.framework */; };
01F2C61A2C4C4126007E932C /* IOMobileFramebuffer.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 01D3D5EE2B5C80DA007845B6 /* IOMobileFramebuffer.tbd */; };
01F2C6262C4D6091007E932C /* trollstorehelper.c in Sources */ = {isa = PBXBuildFile; fileRef = 01F2C6252C4D6091007E932C /* trollstorehelper.c */; };
01FE46A92C1AD335005E6E9D /* runcmd.c in Sources */ = {isa = PBXBuildFile; fileRef = 01FE46A82C1AD335005E6E9D /* runcmd.c */; };
/* End PBXBuildFile section */

Expand Down Expand Up @@ -560,6 +561,7 @@
01E427D32BA1F29F008BC989 /* patch_dyld-test */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = "patch_dyld-test"; sourceTree = BUILT_PRODUCTS_DIR; };
01F2C6162C4C4118007E932C /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/System/Library/Frameworks/CoreGraphics.framework; sourceTree = DEVELOPER_DIR; };
01F2C6182C4C411B007E932C /* ImageIO.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ImageIO.framework; path = Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/System/Library/Frameworks/ImageIO.framework; sourceTree = DEVELOPER_DIR; };
01F2C6252C4D6091007E932C /* trollstorehelper.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = trollstorehelper.c; sourceTree = "<group>"; };
01FE46A82C1AD335005E6E9D /* runcmd.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = runcmd.c; sourceTree = "<group>"; };
/* End PBXFileReference section */

Expand Down Expand Up @@ -802,6 +804,7 @@
017796CB2BAEDA1A00BCC2C3 /* cfprefsd.c */,
017796D22BAEF0AA00BCC2C3 /* pineboard.m */,
01D6C6112C1B3C3D00D02A79 /* headboard.c */,
01F2C6252C4D6091007E932C /* trollstorehelper.c */,
);
path = universalhooks;
sourceTree = "<group>";
Expand Down Expand Up @@ -1973,6 +1976,7 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
01F2C6262C4D6091007E932C /* trollstorehelper.c in Sources */,
017796CC2BAEDA1A00BCC2C3 /* cfprefsd.c in Sources */,
01E427C12BA1EF2B008BC989 /* securityd.c in Sources */,
017796CA2BAED7ED00BCC2C3 /* springboard.m in Sources */,
Expand Down
6 changes: 6 additions & 0 deletions src/systemhook/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -467,6 +467,12 @@ __attribute__((constructor)) static void initializer(void)
dlopen_hook("/cores/binpack/usr/lib/universalhooks.dylib", RTLD_NOW);
}
}
if (release >= 24) {
if (stringEndsWith(gExecutablePath, "/TrollStore.app/trollstorehelper")) {
if (getuid() == 0)
dlopen_hook("/cores/binpack/usr/lib/universalhooks.dylib", RTLD_NOW);
}
}
}

//fprintf(stderr, "shouldEnableTweaks(): %d\n", shouldEnableTweaks());
Expand Down
21 changes: 21 additions & 0 deletions src/universalhooks/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include <universalhooks/hooks.h>
#include <paleinfo.h>
#include <inttypes.h>
#include <unistd.h>

struct hook_info {
const char* executablePath;
Expand All @@ -24,6 +25,22 @@ struct hook_info info[] = {
{ "/Applications/HeadBoard.app/HeadBoard", NULL, NULL, headboardInit },
};

bool stringEndsWith(const char* str, const char* suffix)
{
if (!str || !suffix) {
return false;
}

size_t str_len = strlen(str);
size_t suffix_len = strlen(suffix);

if (str_len < suffix_len) {
return false;
}

return !strcmp(str + str_len - suffix_len, suffix);
}

uint64_t pflags;
bool rootful;
__attribute__((constructor))void universalhooks_main(void) {
Expand All @@ -43,4 +60,8 @@ __attribute__((constructor))void universalhooks_main(void) {

if (info[i].universalInit) info[i].universalInit();
}

if (stringEndsWith(path, "/TrollStore.app/trollstorehelper")) {
trollstorehelperInit(path);
}
}
12 changes: 12 additions & 0 deletions src/universalhooks/trollstorehelper.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#include <substrate.h>
int apply_coretrust_bypass_hook(__unused char* binaryPath) {
return 0;
}

void trollstorehelperInit(char* executablePath) {
MSImageRef trollstorehelper = MSGetImageByName(executablePath);
void* apply_coretrust_bypass = MSFindSymbol(trollstorehelper, "_apply_coretrust_bypass");
if (apply_coretrust_bypass) {
MSHookFunction(apply_coretrust_bypass, apply_coretrust_bypass_hook, NULL);
}
}

0 comments on commit d747920

Please sign in to comment.