diff --git a/source/Globals.h b/source/Globals.h index 2980aa0..3d9850d 100755 --- a/source/Globals.h +++ b/source/Globals.h @@ -89,6 +89,8 @@ //WARNING: Having this set to different values in different clients will break multiplayer! #define TESTGODMODE false +bool paused; + u32 localUID; int loadedtp; diff --git a/source/Ingame.c b/source/Ingame.c index d4e82e5..825342b 100644 --- a/source/Ingame.c +++ b/source/Ingame.c @@ -368,7 +368,6 @@ void renderGame() { } void exitGame() { - romfsExit(); networkDisconnect(); synchronizerReset(); diff --git a/source/main.c b/source/main.c index deef430..4c0afb1 100755 --- a/source/main.c +++ b/source/main.c @@ -25,6 +25,8 @@ //TODO: Something still causes desyncs very rarely +static aptHookCookie cookie; + void setupGame() { synchronizerInit(rand(), 1, 0); synchronizerSetPlayerUID(0, localUID); @@ -77,6 +79,16 @@ void setupBGMap() { initBGMap = 0; } +static void task_apt_hook(APT_HookType hook, void* param) { + switch(hook) { + case APTHOOK_ONSUSPEND: + paused = true; + stopMusic(); + break; + default: + break; + } +} //for rendering -> move to a better place @@ -188,7 +200,9 @@ int main() { initPlayers(); initRecipes(); initTrades(); + aptHook(&cookie, task_apt_hook, NULL); while (aptMainLoop()) { + if (paused == true) playMusic(&music_menu); if (quitGame) break; if (initGame > 0 && --initGame==0) setupGame();