diff --git a/Minecraft.Client/Windows64/Windows64_App.cpp b/Minecraft.Client/Windows64/Windows64_App.cpp index 41fefd7e..078f4d5b 100644 --- a/Minecraft.Client/Windows64/Windows64_App.cpp +++ b/Minecraft.Client/Windows64/Windows64_App.cpp @@ -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() diff --git a/Minecraft.Client/Windows64/Windows64_Minecraft.cpp b/Minecraft.Client/Windows64/Windows64_Minecraft.cpp index 056557b4..dd81bb57 100644 --- a/Minecraft.Client/Windows64/Windows64_Minecraft.cpp +++ b/Minecraft.Client/Windows64/Windows64_Minecraft.cpp @@ -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; }