mirror of
https://github.com/wheremyfoodat/Panda3DS.git
synced 2025-04-20 12:39:13 +12:00
Clean up smdh getting
This commit is contained in:
parent
74e8f7d4eb
commit
3aa977c6c5
9 changed files with 45 additions and 52 deletions
|
@ -2,11 +2,6 @@ package com.panda3ds.pandroid;
|
|||
|
||||
import android.util.Log;
|
||||
|
||||
import com.panda3ds.pandroid.data.SMDH;
|
||||
import com.panda3ds.pandroid.data.game.GameMetadata;
|
||||
import com.panda3ds.pandroid.utils.Constants;
|
||||
import com.panda3ds.pandroid.utils.GameUtils;
|
||||
|
||||
public class AlberDriver {
|
||||
AlberDriver() { super(); }
|
||||
|
||||
|
@ -23,14 +18,7 @@ public class AlberDriver {
|
|||
public static native void TouchScreenUp();
|
||||
public static native void TouchScreenDown(int x, int y);
|
||||
|
||||
public static void OnSmdhLoaded(byte[] buffer) {
|
||||
SMDH smdh = new SMDH(buffer);
|
||||
Log.i(Constants.LOG_TAG, "Loaded rom SDMH");
|
||||
Log.i(Constants.LOG_TAG, String.format("Are you playing '%s' published by '%s'", smdh.getTitle(), smdh.getPublisher()));
|
||||
GameMetadata game = GameUtils.getCurrentGame();
|
||||
GameUtils.removeGame(game);
|
||||
GameUtils.addGame(GameMetadata.applySMDH(game, smdh));
|
||||
}
|
||||
public static native byte[] GetSmdh();
|
||||
|
||||
static { System.loadLibrary("Alber"); }
|
||||
}
|
|
@ -8,9 +8,12 @@ import android.opengl.GLSurfaceView;
|
|||
import android.util.Log;
|
||||
import com.panda3ds.pandroid.AlberDriver;
|
||||
import com.panda3ds.pandroid.utils.Constants;
|
||||
import com.panda3ds.pandroid.utils.GameUtils;
|
||||
import com.panda3ds.pandroid.view.renderer.ConsoleRenderer;
|
||||
import com.panda3ds.pandroid.view.renderer.layout.ConsoleLayout;
|
||||
import com.panda3ds.pandroid.view.renderer.layout.DefaultScreenLayout;
|
||||
import com.panda3ds.pandroid.data.SMDH;
|
||||
import com.panda3ds.pandroid.data.game.GameMetadata;
|
||||
import javax.microedition.khronos.egl.EGLConfig;
|
||||
import javax.microedition.khronos.opengles.GL10;
|
||||
|
||||
|
@ -76,6 +79,19 @@ public class PandaGlRenderer implements GLSurfaceView.Renderer, ConsoleRenderer
|
|||
|
||||
AlberDriver.Initialize();
|
||||
AlberDriver.LoadRom(romPath);
|
||||
|
||||
// Load the SMDH
|
||||
byte[] smdhData = AlberDriver.GetSmdh();
|
||||
if (smdhData.length == 0) {
|
||||
Log.w(Constants.LOG_TAG, "Failed to load SMDH");
|
||||
} else {
|
||||
SMDH smdh = new SMDH(smdhData);
|
||||
Log.i(Constants.LOG_TAG, "Loaded rom SDMH");
|
||||
Log.i(Constants.LOG_TAG, String.format("Are you playing '%s' published by '%s'", smdh.getTitle(), smdh.getPublisher()));
|
||||
GameMetadata game = GameUtils.getCurrentGame();
|
||||
GameUtils.removeGame(game);
|
||||
GameUtils.addGame(GameMetadata.applySMDH(game, smdh));
|
||||
}
|
||||
}
|
||||
|
||||
public void onDrawFrame(GL10 unused) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue