mirror of
https://github.com/wheremyfoodat/Panda3DS.git
synced 2025-06-09 12:31:40 +12:00
Use vector directly on jni_driver.cpp
This commit is contained in:
parent
c0960dcccd
commit
8b93ef76ac
3 changed files with 12 additions and 7 deletions
|
@ -42,12 +42,7 @@ void Pandroid::onSmdhLoaded(const std::vector<u8> &smdh){
|
||||||
|
|
||||||
jbyteArray result = env->NewByteArray(size);
|
jbyteArray result = env->NewByteArray(size);
|
||||||
|
|
||||||
jbyte buffer[size];
|
env->SetByteArrayRegion(result, 0, size, (jbyte*)smdh.data());
|
||||||
|
|
||||||
for(int i = 0; i < size; i++){
|
|
||||||
buffer[i] = (jbyte) smdh[i];
|
|
||||||
}
|
|
||||||
env->SetByteArrayRegion(result, 0, size, buffer);
|
|
||||||
|
|
||||||
|
|
||||||
auto clazz = env->FindClass(alberClass);
|
auto clazz = env->FindClass(alberClass);
|
||||||
|
|
|
@ -24,8 +24,9 @@ public class AlberDriver {
|
||||||
public static native void TouchScreenDown(int x, int y);
|
public static native void TouchScreenDown(int x, int y);
|
||||||
|
|
||||||
public static void OnSmdhLoaded(byte[] buffer) {
|
public static void OnSmdhLoaded(byte[] buffer) {
|
||||||
Log.i(Constants.LOG_TAG, "Loaded rom smdh");
|
|
||||||
SMDH smdh = new SMDH(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();
|
GameMetadata game = GameUtils.getCurrentGame();
|
||||||
GameUtils.removeGame(game);
|
GameUtils.removeGame(game);
|
||||||
GameUtils.addGame(GameMetadata.applySMDH(game, smdh));
|
GameUtils.addGame(GameMetadata.applySMDH(game, smdh));
|
||||||
|
|
|
@ -13,6 +13,7 @@ import android.widget.Toast;
|
||||||
|
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
|
|
||||||
|
import com.panda3ds.pandroid.AlberDriver;
|
||||||
import com.panda3ds.pandroid.R;
|
import com.panda3ds.pandroid.R;
|
||||||
import com.panda3ds.pandroid.app.game.AlberInputListener;
|
import com.panda3ds.pandroid.app.game.AlberInputListener;
|
||||||
import com.panda3ds.pandroid.input.InputHandler;
|
import com.panda3ds.pandroid.input.InputHandler;
|
||||||
|
@ -80,4 +81,12 @@ public class GameActivity extends BaseActivity {
|
||||||
|
|
||||||
return super.dispatchGenericMotionEvent(ev);
|
return super.dispatchGenericMotionEvent(ev);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onDestroy() {
|
||||||
|
if(AlberDriver.HasRomLoaded()){
|
||||||
|
AlberDriver.Finalize();
|
||||||
|
}
|
||||||
|
super.onDestroy();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue