Render: try to cleanly exit when glut window is closed
This isn't perfect, but it's better than not having it IMO. Only applies to borderless and windowed modes.
This commit is contained in:
@@ -15,6 +15,11 @@
|
|||||||
|
|
||||||
using namespace std::chrono;
|
using namespace std::chrono;
|
||||||
|
|
||||||
|
void exitGameClean(int)
|
||||||
|
{
|
||||||
|
*(bool*)0x0000000140EDA6B0 = true;
|
||||||
|
}
|
||||||
|
|
||||||
int hookedCreateWindow(const char* title, void(__cdecl* exit_function)(int))
|
int hookedCreateWindow(const char* title, void(__cdecl* exit_function)(int))
|
||||||
{
|
{
|
||||||
SetProcessDPIAware();
|
SetProcessDPIAware();
|
||||||
@@ -39,7 +44,7 @@ int hookedCreateWindow(const char* title, void(__cdecl* exit_function)(int))
|
|||||||
printf(GameModeString);
|
printf(GameModeString);
|
||||||
printf("\n");
|
printf("\n");
|
||||||
*fullScreenFlag = 1;
|
*fullScreenFlag = 1;
|
||||||
glutCreateWindow(title);
|
__glutCreateWindowWithExit(title, exitGameClean);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else // windowed or borderless
|
else // windowed or borderless
|
||||||
@@ -68,7 +73,7 @@ int hookedCreateWindow(const char* title, void(__cdecl* exit_function)(int))
|
|||||||
|
|
||||||
glutInitWindowSize(nWidth, nHeight);
|
glutInitWindowSize(nWidth, nHeight);
|
||||||
glutInitWindowPosition(wndX, wndY);
|
glutInitWindowPosition(wndX, wndY);
|
||||||
glutCreateWindow(title);
|
__glutCreateWindowWithExit(title, exitGameClean);
|
||||||
|
|
||||||
if (nDisplay == 1 || nDisplay == 3) // borderless mode
|
if (nDisplay == 1 || nDisplay == 3) // borderless mode
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user