-
-
Notifications
You must be signed in to change notification settings - Fork 538
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix[init]: unexpectedly preload LWJGL
Migrating token storage to keychain accidentally causes LWJGL to be preloaded, making Fabric fails to init. Add JNI library PojavAccountJNI to do the task of sending access token from keychain to JVM space.
- Loading branch information
1 parent
41a0c8d
commit f7163ce
Showing
4 changed files
with
23 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#import "BaseAuthenticator.h" | ||
#include "jni.h" | ||
|
||
JNIEXPORT jstring JNICALL Java_net_kdt_pojavlaunch_value_MinecraftAccount_getAccessTokenFromKeychain(JNIEnv *env, jclass clazz, jstring xuid) { | ||
// This function should only be called once | ||
static BOOL called = NO; | ||
if (called) { | ||
abort(); | ||
} | ||
called = YES; | ||
|
||
const char *xuidC = (*env)->GetStringUTFChars(env, xuid, 0); | ||
NSString *accessToken = [NSClassFromString(@"MicrosoftAuthenticator") tokenDataOfProfile:@(xuidC)][@"accessToken"]; | ||
(*env)->ReleaseStringUTFChars(env, xuid, xuidC); | ||
return (*env)->NewStringUTF(env, accessToken.UTF8String); | ||
} |