This commit is contained in:
khanhduytran0 2020-09-08 13:59:47 +07:00
parent 9e55cd329a
commit fcfc4f16cb
6 changed files with 43 additions and 52 deletions

View file

@ -58,17 +58,6 @@
android:name=".MainActivity" android:name=".MainActivity"
android:configChanges="keyboardHidden|orientation|screenSize"/> android:configChanges="keyboardHidden|orientation|screenSize"/>
<activity
android:launchMode="standard"
android:multiprocess="true"
android:screenOrientation="sensorLandscape"
android:name=".NativeMainActivity"
android:configChanges="keyboardHidden|orientation|screenSize">
<meta-data
android:name="android.app.lib_name"
android:value="pojavexec" />
</activity>
<activity <activity
android:screenOrientation="sensorLandscape" android:screenOrientation="sensorLandscape"
android:name=".prefs.LauncherPreferenceActivity" android:name=".prefs.LauncherPreferenceActivity"

View file

@ -844,8 +844,8 @@ public class MainActivity extends AppCompatActivity implements OnTouchListener,
public void onEvent(int event, String file) { public void onEvent(int event, String file) {
try { try {
if (event == FileObserver.MODIFY && currLogFile.length() > 0l) { if (event == FileObserver.MODIFY && currLogFile.length() > 0l) {
appendToLog(Tools.read(file)); appendToLog(Tools.read(currLogFile.getAbsolutePath()));
Tools.write(file, ""); Tools.write(currLogFile.getAbsolutePath(), "");
} }
} catch (Throwable th) { } catch (Throwable th) {
Tools.showError(MainActivity.this, th); Tools.showError(MainActivity.this, th);

View file

@ -1,39 +0,0 @@
package net.kdt.pojavlaunch;
import android.app.*;
import android.os.*;
import android.view.*;
// This is for test only!
public class NativeMainActivity extends NativeActivity
{
private MCProfile.Builder mProfile;
private JMinecraftVersionList.Version mVersionInfo;
@Override
public void onCreate(Bundle b) {
super.onCreate(b);
mProfile = PojavProfile.getCurrentProfileContent(this);
mVersionInfo = Tools.getVersionInfo(mProfile.getVersion());
}
@Override
public void surfaceCreated(SurfaceHolder holder)
{
super.surfaceCreated(holder);
new Thread() {
@Override
public void run() {
try {
JREUtils.redirectStdio(false);
Tools.launchMinecraft(NativeMainActivity.this, mProfile, mVersionInfo);
} catch (Throwable th) {
Tools.showError(NativeMainActivity.this, th, true);
}
}
}.start();
}
}

View file

@ -0,0 +1,23 @@
package net.kdt.pojavlaunch.jrereflect;
public class JREClass extends JRENativeObject
{
public static JREClass forName(String name) throws ClassNotFoundException {
long nativeAddr = nativeForName(name);
if (nativeAddr == 0) throw new ClassNotFoundException(name);
return new JREClass(nativeAddr);
}
private JREClass(long nativeAddr) {
super(nativeAddr);
}
private JREMethod getMethod(String name, Class... types) throws NoSuchMethodException {
long nativeAddr = nativeForName(name);
if (nativeAddr == 0) throw new NoSuchMethodException(name);
return new JREMethod(nativeAddr, name, types);
}
public static native long nativeForName(String name);
public static native long nativeGetMethod(String name);
}

View file

@ -0,0 +1,9 @@
package net.kdt.pojavlaunch.jrereflect;
public class JREMethod extends JRENativeObject
{
JREMethod(long nativeAddr, String name, Class... types) {
super(nativeAddr);
}
}

View file

@ -0,0 +1,9 @@
package net.kdt.pojavlaunch.jrereflect;
public class JRENativeObject
{
protected long mNativeAddress;
protected JRENativeObject(long nativeAddress) {
mNativeAddress = nativeAddress;
}
}