Skip to content

Commit

Permalink
Remove Unity (Including Wrapper Submodule)
Browse files Browse the repository at this point in the history
Still needs to have some things removed from the JNI bridge (i.e, callback to restart env if crash/close)
  • Loading branch information
CADIndie committed Dec 8, 2024
1 parent 3ea2c22 commit 65f6732
Show file tree
Hide file tree
Showing 28 changed files with 432 additions and 248 deletions.
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +0,0 @@
[submodule "wrapper"]
path = wrapper
url = https://github.com/QuestCraftPlusPlus/Wrapper-IL2CPP.git
13 changes: 12 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,13 @@ android {
}

buildToolsVersion = "30.0.3"
buildFeatures {
viewBinding true
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
}
}

build {
Expand All @@ -52,5 +59,9 @@ dependencies {
implementation("androidx.core:core:1.13.1")
implementation("com.microsoft.azure:msal4j:1.14.0")
implementation("com.github.Mathias-Boulay:android_gamepad_remapper:2.0.3")
implementation("blank:unity-classes")
implementation 'com.google.android.material:material:1.12.0'
implementation 'androidx.appcompat:appcompat:1.7.0'
implementation 'androidx.constraintlayout:constraintlayout:2.2.0'
implementation 'androidx.navigation:navigation-fragment:2.8.4'
implementation 'androidx.navigation:navigation-ui:2.8.4'
}
Binary file removed libs/unity-classes.jar
Binary file not shown.
6 changes: 1 addition & 5 deletions settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,9 @@ dependencyResolutionManagement {
maven {
url = uri("https://jitpack.io")
}
flatDir {
dirs("libs")
dirs("wrapper/unityLibrary/libs")
}
}
}

rootProject.name = "Pojlib"
include ":jre_lwjgl3glfw", ':wrapper', ':wrapper:launcher', "wrapper:unityLibrary", "wrapper:unityLibrary:xrmanifest.androidlib"
include ":jre_lwjgl3glfw"

11 changes: 10 additions & 1 deletion src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="pojlib.android">

<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<application android:allowNativeHeapPointerTagging="false"/>

<application android:allowNativeHeapPointerTagging="false">
<activity
android:name="pojlib.MainActivity"
android:exported="false"
android:theme="@style/Theme.Pojlib" />
</application>

</manifest>
2 changes: 1 addition & 1 deletion src/main/assets/lwjgl/version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1729544610054
1733683669279
12 changes: 6 additions & 6 deletions src/main/java/org/lwjgl/glfw/CallbackBridge.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import java.util.ArrayList;

import dalvik.annotation.optimization.CriticalNative;
import pojlib.UnityPlayerActivity;
import pojlib.MainActivity;
import pojlib.input.GrabListener;
import pojlib.input.LwjglGlfwKeycode;

Expand Down Expand Up @@ -108,12 +108,12 @@ public static boolean isGrabbing() {
public static @Nullable String accessAndroidClipboard(int type, String copy) {
switch (type) {
case CLIPBOARD_COPY:
UnityPlayerActivity.GLOBAL_CLIPBOARD.setPrimaryClip(ClipData.newPlainText("Copy", copy));
MainActivity.GLOBAL_CLIPBOARD.setPrimaryClip(ClipData.newPlainText("Copy", copy));
return null;

case CLIPBOARD_PASTE:
if (UnityPlayerActivity.GLOBAL_CLIPBOARD.hasPrimaryClip() && UnityPlayerActivity.GLOBAL_CLIPBOARD.getPrimaryClipDescription().hasMimeType(ClipDescription.MIMETYPE_TEXT_PLAIN)) {
return UnityPlayerActivity.GLOBAL_CLIPBOARD.getPrimaryClip().getItemAt(0).getText().toString();
if (MainActivity.GLOBAL_CLIPBOARD.hasPrimaryClip() && MainActivity.GLOBAL_CLIPBOARD.getPrimaryClipDescription().hasMimeType(ClipDescription.MIMETYPE_TEXT_PLAIN)) {
return MainActivity.GLOBAL_CLIPBOARD.getPrimaryClip().getItemAt(0).getText().toString();
} else {
return "";
}
Expand Down Expand Up @@ -179,8 +179,8 @@ private static void onGrabStateChanged(final boolean grabbing) {
}

public static void restartUnitySession(Activity activity) {
UnityPlayerActivity unity = (UnityPlayerActivity) activity;
unity.reinitUnity();
// Main unity = (UnityPlayerActivity) activity;
// unity.reinitUnity();
}

public static void addGrabListener(GrabListener listener) {
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/pojlib/API.java
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ public static void updateMods(MinecraftInstances instances, MinecraftInstances.I
*/
public static void launchInstance(Activity activity, MinecraftAccount account, MinecraftInstances.Instance instance) {
try {
UnityPlayerActivity.installLWJGL(activity);
MainActivity.installLWJGL(activity);
} catch (IOException e) {
Logger.getInstance().appendToLog("WARN! LWJGL install failed, " + e);
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/pojlib/InstanceHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ public static MinecraftInstances.Instance create(Activity activity, MinecraftIns
String clientClasspath = Installer.installClient(minecraftVersionInfo, gameDir);
String minecraftClasspath = Installer.installLibraries(minecraftVersionInfo, gameDir);
String modLoaderClasspath = Installer.installLibraries(finalModLoaderVersionInfo, gameDir);
String lwjgl = UnityPlayerActivity.installLWJGL(activity);
String lwjgl = MainActivity.installLWJGL(activity);

instance.classpath = clientClasspath + File.pathSeparator + minecraftClasspath + File.pathSeparator + modLoaderClasspath + File.pathSeparator + lwjgl;

Expand Down
Loading

0 comments on commit 65f6732

Please sign in to comment.