update sdk & log & try to fix version list

This commit is contained in:
Tungstend 2023-01-19 16:35:08 +08:00
parent 11a1891ab2
commit cc560637ea
13 changed files with 41 additions and 56 deletions

View File

@ -4,12 +4,12 @@ plugins {
android {
namespace 'com.tungsten.fcl'
compileSdk 32
compileSdk 33
defaultConfig {
applicationId "com.tungsten.fcl"
minSdk 26
targetSdk 32
targetSdk 33
versionCode 1
versionName "1.0.0"
@ -37,10 +37,10 @@ dependencies {
implementation 'org.apache.commons:commons-compress:1.21'
implementation 'org.tukaani:xz:1.8'
implementation 'com.google.code.gson:gson:2.10'
implementation 'androidx.appcompat:appcompat:1.5.1'
implementation 'androidx.appcompat:appcompat:1.6.0'
implementation 'com.google.android.material:material:1.7.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.4'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.0'
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
}

View File

@ -60,7 +60,7 @@
android:theme="@style/Theme.FoldCraftLauncher"
android:extractNativeLibs="true"
android:allowNativeHeapPointerTagging="false"
tools:targetApi="32">
tools:targetApi="33">
<activity
android:name=".activity.SplashActivity"
android:configChanges="keyboardHidden|orientation|screenSize|smallestScreenSize|screenLayout|keyboard|navigation"

View File

@ -8,13 +8,17 @@ import androidx.annotation.Nullable;
import com.tungsten.fcl.R;
import com.tungsten.fcllibrary.component.FCLActivity;
import com.tungsten.fcllibrary.component.theme.ThemeEngine;
import com.tungsten.fcllibrary.component.view.FCLImageView;
public class JVMCrashActivity extends FCLActivity {
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_jvm_crash);
FCLImageView contentView = new FCLImageView(this);
contentView.setBackground(ThemeEngine.getInstance().getTheme().getBackground(this));
setContentView(contentView);
}
public static void startCrashActivity(Context context, int exitCode) {

View File

@ -95,8 +95,8 @@ public class GameMenu implements MenuCallback {
if (exitCode != 0) {
JVMCrashActivity.startCrashActivity(activity, exitCode);
Logging.LOG.log(Level.INFO, "JVM crashed, start jvm crash activity to show errors now!");
android.os.Process.killProcess(android.os.Process.myPid());
}
android.os.Process.killProcess(android.os.Process.myPid());
}
static class FCLProcessListener implements FCLBridgeCallback {

View File

@ -11,8 +11,8 @@ import com.tungsten.fcl.game.FCLGameRepository;
import com.tungsten.fcl.setting.Profile;
import com.tungsten.fcl.setting.Profiles;
import com.tungsten.fcl.util.AndroidUtils;
import com.tungsten.fcl.util.WeakListenerHolder;
import com.tungsten.fclcore.download.LibraryAnalyzer;
import com.tungsten.fclcore.fakefx.beans.binding.Bindings;
import com.tungsten.fclcore.task.Schedulers;
import com.tungsten.fcllibrary.component.view.FCLButton;
import com.tungsten.fcllibrary.component.view.FCLProgressBar;
@ -44,7 +44,6 @@ public class VersionList {
progressBar.setVisibility(View.VISIBLE);
});
FCLGameRepository repository = profile.getRepository();
WeakListenerHolder listenerHolder = new WeakListenerHolder();
new Thread(() -> {
if (profile == Profiles.getSelectedProfile()) {
List<VersionListItem> children = repository.getDisplayVersions()
@ -65,7 +64,6 @@ public class VersionList {
return new VersionListItem(profile, version.getId(), libraries.toString(), repository.getVersionIconImage(version.getId()));
})
.collect(Collectors.toList());
children.forEach(VersionListItem::checkSelection);
if (profile == Profiles.getSelectedProfile()) {
Schedulers.androidUIThread().execute(() -> {
VersionListAdapter adapter = new VersionListAdapter(context, (ArrayList<VersionListItem>) children);
@ -75,13 +73,7 @@ public class VersionList {
progressBar.setVisibility(View.GONE);
});
profile.selectedVersionProperty().addListener(listenerHolder.weak((a, b, newValue) -> Schedulers.androidUIThread().execute(() -> {
children.forEach(it -> it.selectedProperty().set(false));
children.stream()
.filter(it -> it.getVersion().equals(newValue))
.findFirst()
.ifPresent(it -> it.selectedProperty().set(true));
})));
children.forEach(it -> it.selectedProperty().bind(Bindings.createBooleanBinding(() -> profile.selectedVersionProperty().get().equals(it.getVersion()), profile.selectedVersionProperty())));
}
}
}).start();

View File

@ -59,7 +59,6 @@ public class VersionListAdapter extends FCLAdapter {
viewHolder = (ViewHolder) view.getTag();
}
VersionListItem versionListItem = list.get(i);
versionListItem.checkSelection();
viewHolder.radioButton.checkProperty().unbind();
viewHolder.radioButton.checkProperty().bind(versionListItem.selectedProperty());
viewHolder.icon.setBackground(versionListItem.getDrawable());

View File

@ -45,10 +45,6 @@ public class VersionListItem {
return selected;
}
public void checkSelection() {
selected.set(version.equals(profile.getSelectedVersion()));
}
public boolean canUpdate() {
return isModpack;
}

View File

@ -4,11 +4,11 @@ plugins {
android {
namespace 'com.tungsten.fclcore'
compileSdk 32
compileSdk 33
defaultConfig {
minSdk 26
targetSdk 32
targetSdk 33
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles "consumer-rules.pro"
@ -38,9 +38,9 @@ dependencies {
implementation 'com.moandjiezana.toml:toml4j:0.7.2'
implementation 'org.jenkins-ci:constant-pool-scanner:1.2'
implementation 'com.google.code.gson:gson:2.10'
implementation 'androidx.appcompat:appcompat:1.5.1'
implementation 'androidx.appcompat:appcompat:1.6.0'
implementation 'com.google.android.material:material:1.7.0'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.4'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.0'
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
}

View File

@ -102,9 +102,9 @@ public class DefaultLauncher extends Launcher {
res.addDefault("-Dfml.ignorePatchDiscrepancies=", "true");
// Enable LWJGL debug mode
res.addDefault("-Dorg.lwjgl.util.Debug=","true");
res.addDefault("-Dorg.lwjgl.util.DebugLoader=","true");
res.addDefault("-Dorg.lwjgl.util.DebugFunctions=","true");
res.addDefault("-Dorg.lwjgl.util.Debug=", "true");
res.addDefault("-Dorg.lwjgl.util.DebugLoader=", "true");
res.addDefault("-Dorg.lwjgl.util.DebugFunctions=", "true");
// Fix RCE vulnerability of log4j2
res.addDefault("-Djava.rmi.server.useCodebaseOnly=", "true");
@ -121,8 +121,8 @@ public class DefaultLauncher extends Launcher {
res.addDefault("-Dlwjgl.platform=", "FCL");
res.addDefault("-Dorg.lwjgl.opengl.libname=", "${gl_lib_name}");
res.addDefault("-Dfml.earlyprogresswindow=", "false");
res.addDefault("-Dlwjgl2.width=",options.getWidth()+"");
res.addDefault("-Dlwjgl2.height=",options.getHeight()+"");
res.addDefault("-Dlwjgl2.width=", options.getWidth() + "");
res.addDefault("-Dlwjgl2.height=", options.getHeight() + "");
List<String> classpath = repository.getClasspath(version);
@ -327,9 +327,6 @@ public class DefaultLauncher extends Launcher {
String[] finalArgs = rawCommandLine.toArray(new String[0]);
FCLConfig.Renderer renderer = options.getRenderer();
if (version.getMinimumLauncherVersion() >= 21) {
renderer.setGlVersion("32");
}
FCLConfig config = new FCLConfig(context,
FCLPath.LOG_DIR,
options.getJava().getVersion() == 8 ? FCLPath.JAVA_8_PATH : FCLPath.JAVA_17_PATH,

View File

@ -4,11 +4,11 @@ plugins {
android {
namespace 'com.tungsten.fcllibrary'
compileSdk 32
compileSdk 33
defaultConfig {
minSdk 26
targetSdk 32
targetSdk 33
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles "consumer-rules.pro"
@ -30,10 +30,10 @@ dependencies {
implementation project(path: ':FCLauncher')
implementation project(path: ':FCLCore')
implementation 'commons-io:commons-io:2.11.0'
implementation 'androidx.appcompat:appcompat:1.5.1'
implementation 'androidx.appcompat:appcompat:1.6.0'
implementation 'com.google.android.material:material:1.7.0'
implementation 'androidx.asynclayoutinflater:asynclayoutinflater:1.0.0'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.4'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.0'
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
}

View File

@ -4,11 +4,11 @@ plugins {
android {
namespace 'com.tungsten.fclauncher'
compileSdk 32
compileSdk 33
defaultConfig {
minSdk 26
targetSdk 32
targetSdk 33
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles "consumer-rules.pro"
@ -35,9 +35,9 @@ android {
dependencies {
implementation 'com.jaredrummler:android-device-names:2.1.0'
implementation 'androidx.appcompat:appcompat:1.5.1'
implementation 'androidx.appcompat:appcompat:1.6.0'
implementation 'com.google.android.material:material:1.7.0'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.4'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.0'
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
}

View File

@ -134,7 +134,7 @@ public class FCLauncher {
envMap.put("LIBGL_NAME", renderer.getGlLibName());
envMap.put("LIBEGL_NAME", renderer.getEglLibName());
if (renderer == FCLConfig.Renderer.RENDERER_GL4ES) {
envMap.put("LIBGL_ES","2");
envMap.put("LIBGL_ES", "2");
envMap.put("LIBGL_MIPMAP", "3");
envMap.put("LIBGL_NORMALIZE", "1");
envMap.put("LIBGL_VSYNC", "1");
@ -221,7 +221,7 @@ public class FCLauncher {
}
}
private static int launch(FCLConfig config, FCLBridge bridge, String task) throws IOException {
private static void launch(FCLConfig config, FCLBridge bridge, String task) throws IOException {
printTaskTitle(bridge, task + " Arguments");
String[] args = rebaseArgs(config);
for (String arg : args) {
@ -231,8 +231,7 @@ public class FCLauncher {
bridge.setLdLibraryPath(getLibraryPath(config.getContext(), config.getJavaPath()));
bridge.getCallback().onLog("Hook exit " + (bridge.setupExitTrap(bridge) == 0 ? "success" : "failed"));
int exitCode = bridge.jliLaunch(args);
bridge.getCallback().onLog("OpenJDK exited with code : " + exitCode);
return exitCode;
bridge.onExit(exitCode);
}
public static FCLBridge launchMinecraft(FCLConfig config) {
@ -258,8 +257,7 @@ public class FCLauncher {
bridge.chdir(config.getWorkingDir());
// launch game
int code = launch(config, bridge, "Minecraft");
bridge.onExit(code);
launch(config, bridge, "Minecraft");
} catch (IOException e) {
e.printStackTrace();
}
@ -295,8 +293,7 @@ public class FCLauncher {
bridge.chdir(config.getWorkingDir());
// launch java gui
int code = launch(config, bridge, "Java GUI");
bridge.onExit(code);
launch(config, bridge, "Java GUI");
} catch (IOException e) {
e.printStackTrace();
}
@ -328,8 +325,7 @@ public class FCLauncher {
bridge.chdir(config.getWorkingDir());
// launch api installer
int code = launch(config, bridge, "API Installer");
bridge.onExit(code);
launch(config, bridge, "API Installer");
} catch (IOException e) {
e.printStackTrace();
}

View File

@ -132,6 +132,7 @@ public class FCLBridge implements Serializable {
// Loader function
public void onExit(int code) {
if (callback != null) {
callback.onLog("OpenJDK exited with code : " + code);
callback.onExit(code);
}
}