mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
Some work on resume/pause
This commit is contained in:
parent
851df8c519
commit
7d5a9c8566
4 changed files with 25 additions and 2 deletions
|
@ -142,6 +142,20 @@ extern "C" void Java_com_turboviking_libnative_NativeApp_init
|
|||
}
|
||||
}
|
||||
|
||||
extern "C" void Java_com_turboviking_libnative_NativeApp_resume(JNIEnv *, jclass) {
|
||||
ILOG("NativeResume");
|
||||
if (use_native_audio) {
|
||||
AndroidAudio_Resume();
|
||||
}
|
||||
}
|
||||
|
||||
extern "C" void Java_com_turboviking_libnative_NativeApp_pause(JNIEnv *, jclass) {
|
||||
ILOG("NativePause");
|
||||
if (use_native_audio) {
|
||||
AndroidAudio_Pause();
|
||||
}
|
||||
}
|
||||
|
||||
extern "C" void Java_com_turboviking_libnative_NativeApp_shutdown
|
||||
(JNIEnv *, jclass) {
|
||||
ILOG("NativeShutdown.");
|
||||
|
|
|
@ -23,7 +23,7 @@ bool AndroidAudio_Init(AndroidAudioCallback cb, std::string libraryDir) {
|
|||
}
|
||||
init_func = (OpenSLWrap_Init_T)dlsym(so, "OpenSLWrap_Init");
|
||||
shutdown_func = (OpenSLWrap_Shutdown_T)dlsym(so, "OpenSLWrap_Shutdown");
|
||||
return AndroidAudio_Resume();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool AndroidAudio_Resume() {
|
||||
|
@ -48,7 +48,9 @@ bool AndroidAudio_Pause() {
|
|||
}
|
||||
|
||||
void AndroidAudio_Shutdown() {
|
||||
AndroidAudio_Pause();
|
||||
if (playing) {
|
||||
ELOG("Should not shut down when playing! Something is wrong!");
|
||||
}
|
||||
ILOG("Returned from OpenSLWrap_Shutdown_T");
|
||||
dlclose(so);
|
||||
so = 0;
|
||||
|
|
|
@ -183,6 +183,7 @@ public class NativeActivity extends Activity {
|
|||
if (audioPlayer != null) {
|
||||
audioPlayer.stop();
|
||||
}
|
||||
NativeApp.pause();
|
||||
mGLSurfaceView.onPause();
|
||||
}
|
||||
|
||||
|
@ -194,6 +195,7 @@ public class NativeActivity extends Activity {
|
|||
if (audioPlayer != null) {
|
||||
audioPlayer.play();
|
||||
}
|
||||
NativeApp.resume();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -5,6 +5,11 @@ public class NativeApp {
|
|||
public static native void init(
|
||||
int xxres, int yyres, String apkPath,
|
||||
String dataDir, String externalDir, String libraryDir, String installID, boolean useOpenSL);
|
||||
|
||||
// These have Android semantics: Resume is always called on bootup, after init
|
||||
public static native void pause();
|
||||
public static native void resume();
|
||||
|
||||
public static native void shutdown();
|
||||
|
||||
public static native void keyDown(int key);
|
||||
|
|
Loading…
Add table
Reference in a new issue