forked from cafeberry/cafeberry
fix: game always closing with exitcode 0
This commit is contained in:
@@ -28,15 +28,10 @@ void CConsoleMinecraftApp::StoreLaunchData()
|
||||
|
||||
void CConsoleMinecraftApp::ExitGame()
|
||||
{
|
||||
if (g_pd3dDevice != NULL)
|
||||
{
|
||||
g_pd3dDevice->Release();
|
||||
g_pd3dDevice = NULL;
|
||||
}
|
||||
app.DebugPrintf("CConsoleMinecraftApp::ExitGame\n");
|
||||
|
||||
CleanupDevice();
|
||||
|
||||
ExitProcess(0);
|
||||
//str1k3r - since ExitGame is always ran by the user, it should always be 0
|
||||
PostQuitMessage(0);
|
||||
}
|
||||
|
||||
void CConsoleMinecraftApp::FatalLoadError()
|
||||
|
||||
@@ -386,6 +386,9 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
pMinecraft->soundEngine->playMusicTick();
|
||||
}
|
||||
break;
|
||||
case WM_CLOSE:
|
||||
app.ExitGame();
|
||||
break;
|
||||
case WM_DESTROY:
|
||||
PostQuitMessage(0);
|
||||
break;
|
||||
@@ -1283,10 +1286,18 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance,
|
||||
// A memory leak was caused because the icon renderer kept creating new Vec3's because the pool wasn't reset
|
||||
Vec3::resetPool();
|
||||
}
|
||||
|
||||
//str1k3r - Safely exit the game
|
||||
app.ExitGame();
|
||||
|
||||
//str1k3r - unregister the minecraft window class
|
||||
UnregisterClass("MinecraftClass", g_hInst);
|
||||
|
||||
//str1k3r - shutdown Iggy
|
||||
ui.shutdown();
|
||||
IggyShutdown();
|
||||
|
||||
//str1k3r - cleanup DirectX stuff
|
||||
CleanupDevice();
|
||||
|
||||
//str1k3r - pass exitcode to OS, removed app.ExitGame() as that made it always exit with 0
|
||||
return (int)msg.wParam;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user