Consoles: WIP on supporting back to quitting back to launcher

This commit is contained in:
UnknownShadow200 2023-09-29 10:31:25 +10:00
parent 000a74932b
commit 100eae256f
12 changed files with 16 additions and 13 deletions

View File

@ -496,7 +496,7 @@
<ClCompile Include="Platform_PSP.c" /> <ClCompile Include="Platform_PSP.c" />
<ClCompile Include="Platform_PSVita.c" /> <ClCompile Include="Platform_PSVita.c" />
<ClCompile Include="Platform_Web.c" /> <ClCompile Include="Platform_Web.c" />
<ClCompile Include="Platform_WinApi.c" /> <ClCompile Include="Platform_Windows.c" />
<ClCompile Include="Platform_Xbox.c" /> <ClCompile Include="Platform_Xbox.c" />
<ClCompile Include="Protocol.c" /> <ClCompile Include="Protocol.c" />
<ClCompile Include="Physics.c" /> <ClCompile Include="Physics.c" />

View File

@ -596,7 +596,7 @@
<ClCompile Include="Platform_3DS.c"> <ClCompile Include="Platform_3DS.c">
<Filter>Source Files\Platform</Filter> <Filter>Source Files\Platform</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="Platform_WinApi.c"> <ClCompile Include="Platform_Windows.c">
<Filter>Source Files\Platform</Filter> <Filter>Source Files\Platform</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="Graphics_3DS.c"> <ClCompile Include="Graphics_3DS.c">

View File

@ -49,6 +49,7 @@ int Game_MaxViewDistance = DEFAULT_MAX_VIEWDIST;
int Game_FpsLimit, Game_Vertices; int Game_FpsLimit, Game_Vertices;
cc_bool Game_SimpleArmsAnim; cc_bool Game_SimpleArmsAnim;
static cc_bool gameRunning;
cc_bool Game_ClassicMode, Game_ClassicHacks; cc_bool Game_ClassicMode, Game_ClassicHacks;
cc_bool Game_AllowCustomBlocks; cc_bool Game_AllowCustomBlocks;
@ -615,7 +616,7 @@ static void Game_RenderFrame(double delta) {
Gfx_EndFrame(); Gfx_EndFrame();
} }
void Game_Free(void* obj) { static void Game_Free(void* obj) {
struct IGameComponent* comp; struct IGameComponent* comp;
/* Most components will call OnContextLost in their Free functions */ /* Most components will call OnContextLost in their Free functions */
/* Set to false so components will always free managed textures too */ /* Set to false so components will always free managed textures too */
@ -627,6 +628,7 @@ void Game_Free(void* obj) {
if (comp->Free) comp->Free(); if (comp->Free) comp->Free();
} }
gameRunning = false;
Logger_WarnFunc = Logger_DialogWarn; Logger_WarnFunc = Logger_DialogWarn;
Gfx_Free(); Gfx_Free();
Options_SaveIfChanged(); Options_SaveIfChanged();
@ -638,7 +640,7 @@ void Game_Free(void* obj) {
delta = Stopwatch_ElapsedMicroseconds(Game_FrameStart, render) / (1000.0 * 1000.0);\ delta = Stopwatch_ElapsedMicroseconds(Game_FrameStart, render) / (1000.0 * 1000.0);\
\ \
Window_ProcessEvents(delta);\ Window_ProcessEvents(delta);\
if (!WindowInfo.Exists) return;\ if (!gameRunning) return;\
\ \
if (delta > 1.0) delta = 1.0; /* avoid large delta with suspended process */ \ if (delta > 1.0) delta = 1.0; /* avoid large delta with suspended process */ \
if (delta > 0.0) { Game_FrameStart = render; Game_RenderFrame(delta); } if (delta > 0.0) { Game_FrameStart = render; Game_RenderFrame(delta); }
@ -681,6 +683,7 @@ void Game_Run(int width, int height, const cc_string* title) {
Window_Create3D(width, height); Window_Create3D(width, height);
Window_SetTitle(title); Window_SetTitle(title);
Window_Show(); Window_Show();
gameRunning = true;
Game_Load(); Game_Load();
Event_RaiseVoid(&WindowEvents.Resized); Event_RaiseVoid(&WindowEvents.Resized);

View File

@ -70,7 +70,7 @@ void Window_Show(void) { }
void Window_SetSize(int width, int height) { } void Window_SetSize(int width, int height) { }
void Window_Close(void) { void Window_Close(void) {
/* TODO implement */ Event_RaiseVoid(&WindowEvents.Closing);
} }
/*########################################################################################################################* /*########################################################################################################################*

View File

@ -302,7 +302,7 @@ static void RemakeWindowSurface(void) {
/* Loop until window gets created by main UI thread */ /* Loop until window gets created by main UI thread */
/* (i.e. until processSurfaceCreated is received) */ /* (i.e. until processSurfaceCreated is received) */
while (!winCreated) { while (!winCreated) {
Window_ProcessEvents(0.0); Window_ProcessEvents(0.01);
Thread_Sleep(10); Thread_Sleep(10);
} }

View File

@ -60,7 +60,7 @@ void Window_Show(void) { }
void Window_SetSize(int width, int height) { } void Window_SetSize(int width, int height) { }
void Window_Close(void) { void Window_Close(void) {
/* TODO implement */ Event_RaiseVoid(&WindowEvents.Closing);
} }
/*########################################################################################################################* /*########################################################################################################################*

View File

@ -28,8 +28,8 @@ int Display_ScaleY(int y) { return y; }
static void OnPowerOff(void) { static void OnPowerOff(void) {
Event_RaiseVoid(&WindowEvents.Closing);
WindowInfo.Exists = false; WindowInfo.Exists = false;
Window_Close();
} }
void Window_Init(void) { void Window_Init(void) {
@ -85,7 +85,7 @@ void Window_Create2D(int width, int height) { launcherMode = true; }
void Window_Create3D(int width, int height) { launcherMode = false; } void Window_Create3D(int width, int height) { launcherMode = false; }
void Window_Close(void) { void Window_Close(void) {
/* TODO implement */ Event_RaiseVoid(&WindowEvents.Closing);
} }

View File

@ -79,7 +79,7 @@ void Window_Show(void) { }
void Window_SetSize(int width, int height) { } void Window_SetSize(int width, int height) { }
void Window_Close(void) { void Window_Close(void) {
/* TODO implement */ Event_RaiseVoid(&WindowEvents.Closing);
} }

View File

@ -58,7 +58,7 @@ void Window_Show(void) { }
void Window_SetSize(int width, int height) { } void Window_SetSize(int width, int height) { }
void Window_Close(void) { void Window_Close(void) {
/* TODO implement */ Event_RaiseVoid(&WindowEvents.Closing);
} }

View File

@ -61,7 +61,7 @@ void Window_Show(void) { }
void Window_SetSize(int width, int height) { } void Window_SetSize(int width, int height) { }
void Window_Close(void) { void Window_Close(void) {
/* TODO implement */ Event_RaiseVoid(&WindowEvents.Closing);
} }

View File

@ -98,7 +98,7 @@ void Window_Show(void) { }
void Window_SetSize(int width, int height) { } void Window_SetSize(int width, int height) { }
void Window_Close(void) { void Window_Close(void) {
/* TODO implement */ Event_RaiseVoid(&WindowEvents.Closing);
} }