- Cleanup
- [JVM args] Not allow line break.
- Added GL4ES 1.1.5
This commit is contained in:
khanhduytran0 2020-11-22 08:04:47 +07:00
parent 82dad38de0
commit cbd0783e94
11 changed files with 323 additions and 408 deletions

View File

@ -1,19 +1,19 @@
package net.kdt.pojavlaunch;
import android.app.*;
import android.content.*;
import android.support.v4.app.*;
import android.support.v7.app.*;
import android.text.*;
import android.view.*;
import android.widget.*;
import com.kdt.filerapi.*;
import java.io.*;
import java.util.*;
import net.kdt.pojavlaunch.*;
import net.kdt.pojavlaunch.fragments.*;
import net.kdt.pojavlaunch.prefs.*;
import net.kdt.pojavlaunch.tasks.*;
import android.support.v7.app.AlertDialog;
public abstract class BaseLauncherActivity extends BaseActivity {
public Button mPlayButton;
public ConsoleFragment mConsoleView;
@ -28,11 +28,34 @@ public abstract class BaseLauncherActivity extends BaseActivity {
public String[] mAvailableVersions;
public boolean mIsAssetsProcessing = false;
protected boolean canBack = false;
public abstract void statusIsLaunching(boolean isLaunching);
public void launcherMenu(View view)
{
public void mcaccSwitchUser(View view) {
showProfileInfo();
}
public void mcaccLogout(View view) {
//PojavProfile.reset();
finish();
}
private void showProfileInfo() {
/*
new AlertDialog.Builder(this)
.setTitle("Info player")
.setMessage(
"AccessToken=" + profile.getAccessToken() + "\n" +
"ClientID=" + profile.getClientID() + "\n" +
"ProfileID=" + profile.getProfileID() + "\n" +
"Username=" + profile.getUsername() + "\n" +
"Version=" + profile.getVersion()
).show();
*/
}
public void launcherMenu(View view) {
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle(R.string.mcl_options);
builder.setItems(R.array.mcl_options, new DialogInterface.OnClickListener(){
@ -115,4 +138,101 @@ public abstract class BaseLauncherActivity extends BaseActivity {
}
dialog.show();
}
public void launchGame(View v) {
if (!canBack && mIsAssetsProcessing) {
mIsAssetsProcessing = false;
statusIsLaunching(false);
} else if (canBack) {
v.setEnabled(false);
mTask = new MinecraftDownloaderTask(this);
mTask.execute(mProfile.getVersion());
mCrashView.resetCrashLog = true;
}
}
@Override
public void onBackPressed() {
if (canBack) {
super.onBackPressed();
}
}
@Override
protected void onPostResume() {
super.onPostResume();
Tools.updateWindowSize(this);
}
@Override
protected void onResume(){
super.onResume();
final int uiOptions = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION;
final View decorView = getWindow().getDecorView();
decorView.setSystemUiVisibility(uiOptions);
}
@Override
protected void onResumeFragments() {
super.onResumeFragments();
new RefreshVersionListTask(this).execute();
try{
final ProgressDialog barrier = new ProgressDialog(this);
barrier.setMessage("Waiting");
barrier.setProgressStyle(barrier.STYLE_SPINNER);
barrier.setCancelable(false);
barrier.show();
new Thread(new Runnable(){
@Override
public void run()
{
while (mConsoleView == null) {
try {
Thread.sleep(20);
} catch (Throwable th) {}
}
try {
Thread.sleep(100);
} catch (Throwable th) {}
runOnUiThread(new Runnable() {
@Override
public void run()
{
try {
mConsoleView.putLog("");
barrier.dismiss();
} catch (Throwable th) {
startActivity(getIntent());
finish();
}
}
});
}
}).start();
File lastCrashFile = Tools.lastFileModified(Tools.crashPath);
if(CrashFragment.isNewCrash(lastCrashFile) || !mCrashView.getLastCrash().isEmpty()){
mCrashView.resetCrashLog = false;
selectTabPage(2);
} else throw new Exception();
} catch(Throwable e) {
e.printStackTrace();
// selectTabPage(tabLayout.getSelectedTabPosition());
}
}
// Catching touch exception
@Override
public boolean onTouchEvent(MotionEvent event) {
return super.onTouchEvent(event);
}
protected abstract void selectTabPage(int pageIndex);
protected abstract float updateWidthHeight();
}

View File

@ -38,295 +38,148 @@ import android.support.design.widget.VerticalTabLayout.*;
public class MCLauncherActivity extends BaseLauncherActivity
{
//private FragmentTabHost mTabHost;
private LinearLayout fullTab;
//private FragmentTabHost mTabHost;
private LinearLayout fullTab;
/*
private PojavLauncherViewPager viewPager;
private VerticalTabLayout tabLayout;
*/
private PojavLauncherViewPager viewPager;
private VerticalTabLayout tabLayout;
*/
private ViewPager viewPager;
private TabLayout tabLayout;
private TabLayout tabLayout;
private TextView tvUsernameView;
private String profilePath = null;
private ViewPagerAdapter viewPageAdapter;
private TextView tvUsernameView;
private String profilePath = null;
private ViewPagerAdapter viewPageAdapter;
private Button switchUsrBtn, logoutBtn; // MineButtons
private ViewGroup leftView, rightView;
private Button switchUsrBtn, logoutBtn; // MineButtons
private ViewGroup leftView, rightView;
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (BuildConfig.DEBUG) {
Toast.makeText(this, "Launcher process id: " + android.os.Process.myPid(), Toast.LENGTH_LONG).show();
}
setContentView(R.layout.launcher_main);
fullTab = findViewById(R.id.launchermainFragmentTabView);
tabLayout = findViewById(R.id.launchermainTabLayout);
viewPager = findViewById(R.id.launchermainTabPager);
mConsoleView = new ConsoleFragment();
mCrashView = new CrashFragment();
viewPageAdapter = new ViewPagerAdapter(getSupportFragmentManager());
viewPageAdapter.addFragment(new LauncherFragment(), 0, getStr(R.string.mcl_tab_news));
viewPageAdapter.addFragment(mConsoleView, 0, getStr(R.string.mcl_tab_console));
viewPageAdapter.addFragment(mCrashView, 0, getStr(R.string.mcl_tab_crash));
viewPager.setAdapter(viewPageAdapter);
tabLayout.setupWithViewPager(viewPager);
tvUsernameView = (TextView) findViewById(R.id.launcherMainUsernameView);
mTextVersion = (TextView) findViewById(R.id.launcherMainVersionView);
try {
profilePath = PojavProfile.getCurrentProfilePath(this);
mProfile = PojavProfile.getCurrentProfileContent(this);
tvUsernameView.setText(mProfile.getUsername());
} catch(Exception e) {
//Tools.throwError(this, e);
e.printStackTrace();
Toast.makeText(this, getStr(R.string.toast_login_error, e.getMessage()), Toast.LENGTH_LONG).show();
finish();
}
viewInit();
//showProfileInfo();
if (BuildConfig.DEBUG) {
Toast.makeText(this, "Launcher process id: " + android.os.Process.myPid(), Toast.LENGTH_LONG).show();
}
}
// DEBUG
//new android.support.design.widget.NavigationView(this);
List<String> versions = new ArrayList<String>();
final File fVers = new File(Tools.versnDir);
private String getStr(int id, Object... val) {
if (val != null && val.length > 0) {
return getResources().getString(id, val);
} else {
return getResources().getString(id);
}
}
private void viewInit() {
// setContentView(R.layout.launcher_main_v3);
setContentView(R.layout.launcher_main);
fullTab = findViewById(R.id.launchermainFragmentTabView);
tabLayout = findViewById(R.id.launchermainTabLayout);
viewPager = findViewById(R.id.launchermainTabPager);
mConsoleView = new ConsoleFragment();
mCrashView = new CrashFragment();
viewPageAdapter = new ViewPagerAdapter(getSupportFragmentManager());
viewPageAdapter.addFragment(new LauncherFragment(), 0, getStr(R.string.mcl_tab_news));
viewPageAdapter.addFragment(mConsoleView, 0, getStr(R.string.mcl_tab_console));
viewPageAdapter.addFragment(mCrashView, 0, getStr(R.string.mcl_tab_crash));
viewPager.setAdapter(viewPageAdapter);
tabLayout.setupWithViewPager(viewPager);
tvUsernameView = (TextView) findViewById(R.id.launcherMainUsernameView);
mTextVersion = (TextView) findViewById(R.id.launcherMainVersionView);
try {
profilePath = PojavProfile.getCurrentProfilePath(this);
mProfile = PojavProfile.getCurrentProfileContent(this);
tvUsernameView.setText(mProfile.getUsername());
} catch(Exception e) {
//Tools.throwError(this, e);
e.printStackTrace();
Toast.makeText(this, getStr(R.string.toast_login_error, e.getMessage()), Toast.LENGTH_LONG).show();
finish();
}
/*
File logFile = new File(Tools.MAIN_PATH, "latestlog.txt");
if (logFile.exists() && logFile.length() < 20480) {
String errMsg = "Error occurred during initialization of ";
try {
String logContent = Tools.read(logFile.getAbsolutePath());
if (logContent.contains(errMsg + "VM") &&
logContent.contains("Could not reserve enough space for")) {
OutOfMemoryError ex = new OutOfMemoryError("Java error: " + logContent);
ex.setStackTrace(null);
Tools.showError(MCLauncherActivity.this, ex);
// Do it so dialog will not shown for second time
Tools.write(logFile.getAbsolutePath(), logContent.replace(errMsg + "VM", errMsg + "JVM"));
}
} catch (Throwable th) {
System.err.println("Could not detect java crash");
th.printStackTrace();
try {
if (fVers.listFiles().length < 1) {
throw new Exception(getStr(R.string.error_no_version));
}
}
*/
//showProfileInfo();
List<String> versions = new ArrayList<String>();
final File fVers = new File(Tools.versnDir);
try {
if (fVers.listFiles().length < 1) {
throw new Exception(getStr(R.string.error_no_version));
}
for (File fVer : fVers.listFiles()) {
for (File fVer : fVers.listFiles()) {
if (fVer.isDirectory())
versions.add(fVer.getName());
}
} catch (Exception e) {
versions.add(getStr(R.string.global_error) + ":");
versions.add(e.getMessage());
versions.add(fVer.getName());
}
} catch (Exception e) {
versions.add(getStr(R.string.global_error) + ":");
versions.add(e.getMessage());
} finally {
mAvailableVersions = versions.toArray(new String[0]);
}
} finally {
mAvailableVersions = versions.toArray(new String[0]);
}
//availableVersions;
//availableVersions;
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, mAvailableVersions);
adapter.setDropDownViewResource(android.R.layout.simple_list_item_single_choice);
mVersionSelector = (Spinner) findViewById(R.id.launcherMainSelectVersion);
mVersionSelector.setAdapter(adapter);
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, mAvailableVersions);
adapter.setDropDownViewResource(android.R.layout.simple_list_item_single_choice);
mVersionSelector = (Spinner) findViewById(R.id.launcherMainSelectVersion);
mVersionSelector.setAdapter(adapter);
mLaunchProgress = (ProgressBar) findViewById(R.id.progressDownloadBar);
mLaunchTextStatus = (TextView) findViewById(R.id.progressDownloadText);
LinearLayout exitLayout = (LinearLayout) findViewById(R.id.launcherMainExitbtns);
switchUsrBtn = (Button) exitLayout.getChildAt(0);
logoutBtn = (Button) exitLayout.getChildAt(1);
mLaunchProgress = (ProgressBar) findViewById(R.id.progressDownloadBar);
mLaunchTextStatus = (TextView) findViewById(R.id.progressDownloadText);
LinearLayout exitLayout = (LinearLayout) findViewById(R.id.launcherMainExitbtns);
switchUsrBtn = (Button) exitLayout.getChildAt(0);
logoutBtn = (Button) exitLayout.getChildAt(1);
leftView = (LinearLayout) findViewById(R.id.launcherMainLeftLayout);
mPlayButton = (Button) findViewById(R.id.launcherMainPlayButton);
rightView = (ViewGroup) findViewById(R.id.launcherMainRightLayout);
leftView = (LinearLayout) findViewById(R.id.launcherMainLeftLayout);
mPlayButton = (Button) findViewById(R.id.launcherMainPlayButton);
rightView = (ViewGroup) findViewById(R.id.launcherMainRightLayout);
statusIsLaunching(false);
}
statusIsLaunching(false);
}
// DEBUG
//new android.support.design.widget.NavigationView(this);
@Override
protected void onPostResume() {
super.onPostResume();
Tools.updateWindowSize(this);
}
private String getStr(int id, Object... val) {
if (val != null && val.length > 0) {
return getResources().getString(id, val);
} else {
return getResources().getString(id);
}
}
@Override
protected float updateWidthHeight() {
float leftRightWidth = (float) CallbackBridge.windowWidth / 100f * 32f;
float mPlayButtonWidth = CallbackBridge.windowWidth - leftRightWidth * 2f;
LinearLayout.LayoutParams leftRightParams = new LinearLayout.LayoutParams((int) leftRightWidth, (int) Tools.dpToPx(this, CallbackBridge.windowHeight / 9));
LinearLayout.LayoutParams mPlayButtonParams = new LinearLayout.LayoutParams((int) mPlayButtonWidth, (int) Tools.dpToPx(this, CallbackBridge.windowHeight / 9));
leftView.setLayoutParams(leftRightParams);
rightView.setLayoutParams(leftRightParams);
mPlayButton.setLayoutParams(mPlayButtonParams);
private float updateWidthHeight() {
float leftRightWidth = (float) CallbackBridge.windowWidth / 100f * 32f;
float mPlayButtonWidth = CallbackBridge.windowWidth - leftRightWidth * 2f;
LinearLayout.LayoutParams leftRightParams = new LinearLayout.LayoutParams((int) leftRightWidth, (int) Tools.dpToPx(this, CallbackBridge.windowHeight / 9));
LinearLayout.LayoutParams mPlayButtonParams = new LinearLayout.LayoutParams((int) mPlayButtonWidth, (int) Tools.dpToPx(this, CallbackBridge.windowHeight / 9));
leftView.setLayoutParams(leftRightParams);
rightView.setLayoutParams(leftRightParams);
mPlayButton.setLayoutParams(mPlayButtonParams);
return leftRightWidth;
}
return leftRightWidth;
}
@Override
protected void selectTabPage(int pageIndex) {
if (tabLayout.getSelectedTabPosition() != pageIndex) {
tabLayout.setScrollPosition(pageIndex,0f,true);
viewPager.setCurrentItem(pageIndex);
}
}
public void mcaccSwitchUser(View view)
{
showProfileInfo();
}
public void statusIsLaunching(boolean isLaunching) {
LinearLayout.LayoutParams reparam = new LinearLayout.LayoutParams((int) updateWidthHeight(), LinearLayout.LayoutParams.WRAP_CONTENT);
ViewGroup.MarginLayoutParams lmainTabParam = (ViewGroup.MarginLayoutParams) fullTab.getLayoutParams();
int launchVisibility = isLaunching ? View.VISIBLE : View.GONE;
mLaunchProgress.setVisibility(launchVisibility);
mLaunchTextStatus.setVisibility(launchVisibility);
lmainTabParam.bottomMargin = reparam.height;
leftView.setLayoutParams(reparam);
public void mcaccLogout(View view)
{
//PojavProfile.reset();
finish();
}
private void showProfileInfo()
{
/*
new AlertDialog.Builder(this)
.setTitle("Info player")
.setMessage(
"AccessToken=" + profile.getAccessToken() + "\n" +
"ClientID=" + profile.getClientID() + "\n" +
"ProfileID=" + profile.getProfileID() + "\n" +
"Username=" + profile.getUsername() + "\n" +
"Version=" + profile.getVersion()
).show();
*/
}
private void selectTabPage(int pageIndex){
if (tabLayout.getSelectedTabPosition() != pageIndex) {
tabLayout.setScrollPosition(pageIndex,0f,true);
viewPager.setCurrentItem(pageIndex);
}
}
@Override
protected void onResumeFragments()
{
super.onResumeFragments();
new RefreshVersionListTask(this).execute();
try{
final ProgressDialog barrier = new ProgressDialog(this);
barrier.setMessage("Waiting");
barrier.setProgressStyle(barrier.STYLE_SPINNER);
barrier.setCancelable(false);
barrier.show();
new Thread(new Runnable(){
@Override
public void run()
{
while (mConsoleView == null) {
try {
Thread.sleep(20);
} catch (Throwable th) {}
}
try {
Thread.sleep(100);
} catch (Throwable th) {}
runOnUiThread(new Runnable() {
@Override
public void run()
{
try {
mConsoleView.putLog("");
barrier.dismiss();
} catch (Throwable th) {
startActivity(getIntent());
finish();
}
}
});
}
}).start();
File lastCrashFile = Tools.lastFileModified(Tools.crashPath);
if(CrashFragment.isNewCrash(lastCrashFile) || !mCrashView.getLastCrash().isEmpty()){
mCrashView.resetCrashLog = false;
selectTabPage(2);
} else throw new Exception();
} catch(Throwable e){
selectTabPage(tabLayout.getSelectedTabPosition());
}
}
@Override
protected void onResume(){
super.onResume();
final int uiOptions = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION;
final View decorView = getWindow().getDecorView();
decorView.setSystemUiVisibility(uiOptions);
}
private boolean canBack = false;
public void statusIsLaunching(boolean isLaunching)
{
LinearLayout.LayoutParams reparam = new LinearLayout.LayoutParams((int) updateWidthHeight(), LinearLayout.LayoutParams.WRAP_CONTENT);
ViewGroup.MarginLayoutParams lmainTabParam = (ViewGroup.MarginLayoutParams) fullTab.getLayoutParams();
int launchVisibility = isLaunching ? View.VISIBLE : View.GONE;
mLaunchProgress.setVisibility(launchVisibility);
mLaunchTextStatus.setVisibility(launchVisibility);
lmainTabParam.bottomMargin = reparam.height;
leftView.setLayoutParams(reparam);
switchUsrBtn.setEnabled(!isLaunching);
logoutBtn.setEnabled(!isLaunching);
mVersionSelector.setEnabled(!isLaunching);
canBack = !isLaunching;
}
@Override
public void onBackPressed()
{
if (canBack) {
super.onBackPressed();
}
}
// Catching touch exception
@Override
public boolean onTouchEvent(MotionEvent event) {
return super.onTouchEvent(event);
}
public void launchGame(View v)
{
if (!canBack && mIsAssetsProcessing) {
mIsAssetsProcessing = false;
statusIsLaunching(false);
} else if (canBack) {
v.setEnabled(false);
mTask = new MinecraftDownloaderTask(this);
mTask.execute(mProfile.getVersion());
mCrashView.resetCrashLog = true;
}
}
switchUsrBtn.setEnabled(!isLaunching);
logoutBtn.setEnabled(!isLaunching);
mVersionSelector.setEnabled(!isLaunching);
canBack = !isLaunching;
}
}

View File

@ -55,16 +55,10 @@ public class PojavLauncherActivity extends BaseLauncherActivity
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
viewInit();
if (BuildConfig.DEBUG) {
Toast.makeText(this, "Launcher process id: " + android.os.Process.myPid(), Toast.LENGTH_LONG).show();
}
}
// DEBUG
//new android.support.design.widget.NavigationView(this);
private void viewInit() {
setContentView(R.layout.launcher_main_v3);
// setContentView(R.layout.launcher_main);
@ -188,12 +182,7 @@ public class PojavLauncherActivity extends BaseLauncherActivity
}
@Override
protected void onPostResume() {
super.onPostResume();
Tools.updateWindowSize(this);
}
private float updateWidthHeight() {
protected float updateWidthHeight() {
float leftRightWidth = (float) CallbackBridge.windowWidth / 100f * 32f;
float mPlayButtonWidth = CallbackBridge.windowWidth - leftRightWidth * 2f;
LinearLayout.LayoutParams leftRightParams = new LinearLayout.LayoutParams((int) leftRightWidth, (int) Tools.dpToPx(this, CallbackBridge.windowHeight / 9));
@ -205,102 +194,14 @@ public class PojavLauncherActivity extends BaseLauncherActivity
return leftRightWidth;
}
public void mcaccSwitchUser(View view)
{
showProfileInfo();
}
public void mcaccLogout(View view)
{
//PojavProfile.reset();
finish();
}
private void showProfileInfo()
{
/*
new AlertDialog.Builder(this)
.setTitle("Info player")
.setMessage(
"AccessToken=" + profile.getAccessToken() + "\n" +
"ClientID=" + profile.getClientID() + "\n" +
"ProfileID=" + profile.getProfileID() + "\n" +
"Username=" + profile.getUsername() + "\n" +
"Version=" + profile.getVersion()
).show();
*/
}
private void selectTabPage(int pageIndex){
@Override
protected void selectTabPage(int pageIndex){
if (tabLayout.getSelectedTabPosition() != pageIndex) {
tabLayout.setScrollPosition(pageIndex,0f,true);
viewPager.setCurrentItem(pageIndex);
}
}
@Override
protected void onResumeFragments()
{
super.onResumeFragments();
new RefreshVersionListTask(this).execute();
try{
final ProgressDialog barrier = new ProgressDialog(this);
barrier.setMessage("Waiting");
barrier.setProgressStyle(barrier.STYLE_SPINNER);
barrier.setCancelable(false);
barrier.show();
new Thread(new Runnable(){
@Override
public void run()
{
while (mConsoleView == null) {
try {
Thread.sleep(20);
} catch (Throwable th) {}
}
try {
Thread.sleep(100);
} catch (Throwable th) {}
runOnUiThread(new Runnable() {
@Override
public void run()
{
try {
mConsoleView.putLog("");
barrier.dismiss();
} catch (Throwable th) {
startActivity(getIntent());
finish();
}
}
});
}
}).start();
File lastCrashFile = Tools.lastFileModified(Tools.crashPath);
if(CrashFragment.isNewCrash(lastCrashFile) || !mCrashView.getLastCrash().isEmpty()){
mCrashView.resetCrashLog = false;
selectTabPage(2);
} else throw new Exception();
} catch(Throwable e){
selectTabPage(tabLayout.getSelectedTabPosition());
}
}
@Override
protected void onResume(){
super.onResume();
final int uiOptions = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION;
final View decorView = getWindow().getDecorView();
decorView.setSystemUiVisibility(uiOptions);
}
private boolean canBack = false;
public void statusIsLaunching(boolean isLaunching) {
// As preference fragment put to tab, changes without notice, so need re-load pref
if (isLaunching) LauncherPreferences.loadPreferences();
@ -318,35 +219,5 @@ public class PojavLauncherActivity extends BaseLauncherActivity
mVersionSelector.setEnabled(!isLaunching);
canBack = !isLaunching;
}
@Override
public void onBackPressed()
{
if (canBack) {
super.onBackPressed();
}
}
// Catching touch exception
@Override
public boolean onTouchEvent(MotionEvent event) {
try {
return super.onTouchEvent(event);
} catch (Throwable th) {
Tools.showError(this, th);
return false;
}
}
public void launchGame(View v)
{
if (!canBack && mIsAssetsProcessing) {
mIsAssetsProcessing = false;
statusIsLaunching(false);
} else if (canBack) {
v.setEnabled(false);
mTask = new MinecraftDownloaderTask(this);
mTask.execute(mProfile.getVersion());
mCrashView.resetCrashLog = true;
}
}
}

View File

@ -0,0 +1,14 @@
package net.kdt.pojavlaunch.installers;
import android.content.*;
import java.io.*;
public abstract class BaseInstaller {
protected File mJarFile;
public void setInput(File jarFile) {
mJarFile = jarFile;
}
public abstract void install(Context ctx) throws IOException;
}

View File

@ -0,0 +1,39 @@
package net.kdt.pojavlaunch.installers;
import android.content.*;
import java.io.*;
import java.util.jar.*;
import net.kdt.pojavlaunch.*;
import java.nio.charset.*;
import net.kdt.pojavlaunch.value.*;
import org.apache.commons.io.*;
public class ForgeInstaller extends BaseInstaller {
@Override
public void install(Context ctx) throws IOException {
JarFile file = new JarFile(mJarFile);
ForgeInstallProfile profile =
Tools.GLOBAL_GSON.fromJson(
Tools.convertStream(file.getInputStream(
file.getEntry("install_profile.json")),
Charset.forName("UTF-8")
),
ForgeInstallProfile.class
);
// Write the json file
File versionFile = new File(Tools.versnDir, profile.install.target);
versionFile.mkdir();
Tools.write(
versionFile.getAbsolutePath() + "/" + profile.install.target + ".json",
Tools.GLOBAL_GSON.toJson(profile.versionInfo)
);
// Extract Forge universal
String[] libInfos = profile.install.path.split(":");
File libraryFile = new File(Tools.libraries, Tools.artifactToPath(libInfos[0], libInfos[1], libInfos[2]));
libraryFile.mkdirs();
FileOutputStream out = new FileOutputStream(libraryFile.getAbsolutePath() + "/" + profile.install.filePath.replace("-universal", ""));
IOUtils.copy(file.getInputStream(file.getEntry(profile.install.filePath)), out);
out.close();
}
}

View File

@ -0,0 +1,17 @@
package net.kdt.pojavlaunch.value;
import net.kdt.pojavlaunch.*;
public class ForgeInstallProfile {
public ForgeInstallProperties install;
public JMinecraftVersionList.Version versionInfo;
public static class ForgeInstallProperties {
public String profileName;
public String target;
public String path;
public String version;
public String filePath; // universal file .jar
public String minecraft; // target Minecraft version
}
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -22,6 +22,7 @@
android:summary="@string/mcl_setting_subtitle_freeform"/>
<android.support.v7.preference.EditTextPreference
android:singleLine="true"
android:key="javaArgs"
android:title="@string/mcl_setting_title_javaargs"
android:summary="@string/mcl_setting_subtitle_javaargs"