Skip to content

Commit

Permalink
fixed crash for missing environment variable w/ steam version
Browse files Browse the repository at this point in the history
  • Loading branch information
redsaurus committed Dec 20, 2013
1 parent 241bebf commit 3c9d2ba
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
3 changes: 3 additions & 0 deletions .gitignore
@@ -0,0 +1,3 @@

JKJALaunch.xcodeproj/project.xcworkspace/*
JKJALaunch.xcodeproj/xcuserdata/*
4 changes: 2 additions & 2 deletions JKJALaunch-Info.plist
Expand Up @@ -21,11 +21,11 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.2</string>
<string>1.2.1</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>9</string>
<string>10</string>
<key>LSMinimumSystemVersion</key>
<string>${MACOSX_DEPLOYMENT_TARGET}</string>
<key>NSMainNibFile</key>
Expand Down
12 changes: 9 additions & 3 deletions patchapp.c
Expand Up @@ -10,7 +10,8 @@
__attribute__ ((constructor)) void whichProgram( void )
{

unsigned char isMPText[3];
char isMPText[3];
char *envText;

int isMP = 0;

Expand All @@ -26,8 +27,13 @@ __attribute__ ((constructor)) void whichProgram( void )
mach_vm_protect(mach_task_self(), patchLocation, 2, 0, VM_PROT_EXECUTE | VM_PROT_READ);
}

strncpy(isMPText, getenv("ASPYR_JAMP"), 3);
isMP = strncasecmp(isMPText, "NO", 3);
envText = getenv("ASPYR_JAMP");

if (envText != NULL)
{
strncpy(isMPText, envText, 3);
isMP = strncasecmp(isMPText, "NO", 3);
}

//check if we're in a sandbox :/ then mess around with prefs a bit
//hacked together with stuff from https://github.com/ole/NSBundle-OBCodeSigningInfo
Expand Down

0 comments on commit 3c9d2ba

Please sign in to comment.