Revert to ac5888b6ff7b92dc03074b4f4007521085aaf35b

This commit is contained in:
khanhduytran0 2020-12-18 16:43:50 +07:00
parent 9e3fdedaff
commit d5eb4b4388
11 changed files with 35 additions and 63 deletions

View File

@ -24,7 +24,7 @@ android {
minSdkVersion 21
targetSdkVersion 29
versionCode 156236
versionName "3.3.1b_6409b_20201218"
versionName "3.3.1b_6409b_20201210"
multiDexEnabled true //important
}
@ -60,13 +60,14 @@ android {
dependencies {
implementation 'javax.annotation:javax.annotation-api:1.3.2'
implementation 'commons-codec:commons-codec:1.14'
// implementation 'com.wu-man:android-bsf-api:3.1.3'
implementation 'com.wu-man:android-bsf-api:3.1.3'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.preference:preference:1.0.0'
implementation 'androidx.appcompat:appcompat:1.0.0'
implementation 'androidx.legacy:legacy-preference-v14:1.0.0'
implementation 'com.google.android.material:material:1.0.0'
implementation 'androidx.annotation:annotation:1.0.0'
// implementation 'androidx.browser:browser:1.0.0'
implementation 'androidx.browser:browser:1.0.0'
// implementation 'com.intuit.sdp:sdp-android:1.0.5'

View File

@ -1 +1 @@
20201218:1
20201201:1

View File

@ -3,7 +3,7 @@
// This file is important to protect you against viruses/malwares that could be come from unknown Java Programs (run on mod install) or a mod.
grant {
permission java.io.FilePermission "${java.io.tmpdir}/*", "read, write, delete";
permission java.io.FilePermission "${pojav.path.cache}/*", "read, write, delete";
permission java.io.FilePermission "${pojav.path.minecraft}/*", "read, write, delete";
};

View File

@ -99,7 +99,6 @@ public class BaseMainActivity extends LoggableActivity {
private LinearLayout contentCanvas;
private AWTSurfaceView contentCanvasView;
*/
private boolean resuming;
private boolean lastEnabled = false;
private boolean lastGrab = false;
private boolean isExited = false;

View File

@ -298,17 +298,16 @@ public class PojavLoginActivity extends BaseActivity
}
private void initMain() throws Throwable {
mkdirs(Tools.DIR_ACCOUNT_NEW);
PojavMigrator.migrateAccountData(this);
mkdirs(Tools.DIR_HOME_VERSION);
mkdirs(Tools.DIR_HOME_LIBRARY);
if (!PojavMigrator.migrateGameDir()) {
mkdirs(Tools.DIR_GAME_NEW);
mkdirs(Tools.DIR_GAME_NEW + "/config");
mkdirs(Tools.DIR_GAME_NEW + "/lwjgl3");
mkdirs(Tools.DIR_GAME_NEW + "/mods");
mkdirs(Tools.DIR_HOME_VERSION);
mkdirs(Tools.DIR_HOME_LIBRARY);
}
mkdirs(Tools.DIR_GAME_NEW);
mkdirs(Tools.DIR_GAME_NEW + "/config");
mkdirs(Tools.DIR_GAME_NEW + "/lwjgl3");
mkdirs(Tools.DIR_GAME_NEW + "/mods");
PojavMigrator.migrateAccountData(this);
PojavMigrator.migrateGameDir();
File forgeSplashFile = new File(Tools.DIR_GAME_NEW, "config/splash.properties");
String forgeSplashContent = "enabled=true";
@ -331,7 +330,7 @@ public class PojavLoginActivity extends BaseActivity
Tools.copyAssetFile(this, "components/ForgeInstallerHeadless/forge-installer-headless-1.0.1.jar", Tools.DIR_GAME_NEW + "/config", "forge-installer-headless.jar", true);
Tools.copyAssetFile(this, "options.txt", Tools.DIR_GAME_NEW, false);
Tools.copyAssetFile(this, "java_sandbox.policy", Tools.DIR_GAME_HOME, true);
Tools.copyAssetFile(this, "java_sandbox.policy", Tools.DIR_GAME_NEW, true);
// TODO: Remove after implement.
Tools.copyAssetFile(this, "launcher_profiles.json", Tools.DIR_GAME_NEW, false);

View File

@ -7,6 +7,7 @@ public class PojavMigrator
{
public static void migrateAccountData(Context ctx) {
File oldAccDir = new File(Tools.DIR_ACCOUNT_OLD);
if (oldAccDir.exists() && oldAccDir.isDirectory()) {
for (String account : oldAccDir.list()) {
File oldAccFile = new File(oldAccDir, account);
@ -31,42 +32,16 @@ public class PojavMigrator
}
}
public static boolean migrateGameDir() throws IOException, InterruptedException {
public static void migrateGameDir() throws IOException, InterruptedException {
File oldGameDir = new File(Tools.DIR_GAME_OLD);
boolean moved = oldGameDir.exists() && oldGameDir.isDirectory();
if (!migrateBugFix20201217() && moved) {
command("mv " + Tools.DIR_GAME_OLD + " " + Tools.DIR_GAME_HOME + "/");
}
return moved;
}
public static boolean migrateBugFix20201217() throws IOException, InterruptedException {
File bugGameDir = new File(Tools.DIR_GAME_NEW + "/.minecraft");
File oldGameDir = new File(Tools.DIR_GAME_OLD);
boolean moved = bugGameDir.exists() && bugGameDir.isDirectory();
if (oldGameDir.exists() && oldGameDir.isDirectory() && moved) {
command("rm -rf " + oldGameDir.getAbsolutePath());
}
if (moved) {
command("mv " + bugGameDir.getAbsolutePath() + " " + Tools.DIR_GAME_OLD);
command("rm -rf " + Tools.DIR_GAME_HOME);
command("mv " + Tools.DIR_GAME_OLD + " " + Tools.DIR_GAME_HOME + "/");
}
return moved;
}
private static void command(String cmd) throws IOException, InterruptedException {
Process p = Runtime.getRuntime().exec(
new String[]{cmd});
int exitCode = p.waitFor();
if (exitCode != 0) {
throw new IOException("Exit code " + exitCode +
", message:\n" + Tools.read(p.getErrorStream()));
if (oldGameDir.exists() && oldGameDir.isDirectory()) {
Process p = Runtime.getRuntime().exec(
new String[]{"mv", Tools.DIR_GAME_OLD, Tools.DIR_GAME_NEW});
int exitCode = p.waitFor();
if (exitCode != 0) {
throw new IOException("Could not move game dir! Exit code " + exitCode +
", message:\n" + Tools.read(p.getErrorStream()));
}
}
}
}

View File

@ -35,10 +35,9 @@ public final class Tools
public static String CURRENT_ARCHITECTURE;
// New since 3.3.1
public static String DIR_ACCOUNT_NEW;
public static String DIR_ACCOUNT_OLD;
public static final String DIR_GAME_HOME = Environment.getExternalStorageDirectory().getAbsolutePath() + "/games/PojavLauncher";
public static final String DIR_GAME_NEW = DIR_GAME_NEW + "/.minecraft";
public static String DIR_ACCOUNT_NEW;
public static final String DIR_GAME_NEW = Environment.getExternalStorageDirectory().getAbsolutePath() + "/games/PojavLauncher/.minecraft";
public static final String DIR_GAME_OLD = Environment.getExternalStorageDirectory().getAbsolutePath() + "/games/.minecraft";
// New since 3.0.0
@ -85,6 +84,8 @@ public final class Tools
overrideableArgList.add("-Duser.language=" + System.getProperty("user.language"));
// overrideableArgList.add("-Duser.timezone=GMT");
// Should be compatible?
// overrideableArgList.add("-Dos.name=Android");
overrideableArgList.add("-Dos.name=Linux");
overrideableArgList.add("-Dos.version=Android-" + Build.VERSION.RELEASE);

View File

@ -196,11 +196,7 @@ public abstract class HandleView extends View implements ViewPositionListener, V
if (mActionPopupShower == null) {
mActionPopupShower = new Runnable() {
public void run() {
try {
mActionPopupWindow.show();
} catch (Throwable th) {
th.printStackTrace();
}
mActionPopupWindow.show();
}
};
} else {

View File

@ -6,7 +6,7 @@
* - Works with some bugs:
* + Modded versions gives broken stuff..
*
*
* TODO:
* - Implements glfwSetCursorPos() to handle grab camera pos correctly.
*/
@ -201,11 +201,12 @@ JNIEXPORT jboolean JNICALL Java_org_lwjgl_glfw_CallbackBridge_nativeSetInputRead
return isUseStackQueueCall;
}
JNIEXPORT void JNICALL Java_org_lwjgl_glfw_CallbackBridge_nativeSetGrabbing(JNIEnv* env, jclass clazz, jboolean grabbing, jint xset, jint yset) {
JNIEXPORT void JNICALL Java_org_lwjgl_glfw_CallbackBridge_nativeSetGrabbing(JNIEnv* env, jclass clazz, jboolean grabbing) {
isGrabbing = grabbing;
if (isGrabbing == JNI_TRUE) {
grabCursorX = xset; // savedWidth / 2;
grabCursorY = yset; // savedHeight / 2;
// Center the cursor pointer
grabCursorX = savedWidth / 2;
grabCursorY = savedHeight / 2;
isPrepareGrabPos = true;
}
}