Store ClipCursor flag in EmuShared

This commit is contained in:
ergo720 2020-09-20 17:57:16 +02:00
parent 01382d7e1d
commit 4c47d5a6d9
4 changed files with 14 additions and 2 deletions

View File

@ -152,9 +152,9 @@ EmuShared::EmuShared()
m_bDebugging = false;
m_bEmulating_status = false;
m_bFirstLaunch = false;
m_bClipCursor = false;
// Reserve space (default to 0)
m_bReserved2 = false;
m_bReserved3 = false;
m_bReserved4 = false;
m_Reserved5 = 0;

View File

@ -244,6 +244,12 @@ class EmuShared : public Mutex
void GetStorageLocation(char *path) { Lock(); strncpy(path, m_core.szStorageLocation, MAX_PATH); Unlock(); }
void SetStorageLocation(const char *path) { Lock(); strncpy(m_core.szStorageLocation, path, MAX_PATH); Unlock(); }
// ******************************************************************
// * ClipCursor flag Accessors
// ******************************************************************
void GetClipCursorFlag(bool *value) { Lock(); *value = m_bClipCursor; Unlock(); }
void SetClipCursorFlag(const bool *value) { Lock(); m_bClipCursor = *value; Unlock(); }
// ******************************************************************
// * Reset specific variables to default for kernel mode.
// ******************************************************************
@ -292,7 +298,7 @@ class EmuShared : public Mutex
int m_Reserved7[4];
#endif
bool m_bFirstLaunch;
bool m_bReserved2;
bool m_bClipCursor;
bool m_bReserved3;
bool m_bReserved4;
unsigned int m_dwKrnlProcID; // Only used for kernel mode level.

View File

@ -1856,6 +1856,7 @@ static LRESULT WINAPI EmuMsgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPar
{
case WM_DESTROY:
{
CxbxReleaseCursor();
DeleteObject(g_hBgBrush);
PostQuitMessage(0);
return D3D_OK; // = 0
@ -1943,6 +1944,7 @@ static LRESULT WINAPI EmuMsgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPar
else if (wParam == VK_F3)
{
g_bClipCursor = !g_bClipCursor;
g_EmuShared->SetClipCursorFlag(&g_bClipCursor);
if (g_bClipCursor) {
CxbxClipCursor(hWnd);
@ -2037,6 +2039,7 @@ static LRESULT WINAPI EmuMsgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPar
break;
case WM_CLOSE:
CxbxReleaseCursor();
DestroyWindow(hWnd);
CxbxKrnlShutDown();
break;

View File

@ -681,6 +681,9 @@ void CxbxKrnlEmulate(unsigned int reserved_systems, blocks_reserved_t blocks_res
//g_EmuShared->SetIsReady(true);
}
/* Initialize ClipCursor flag from EmuShared */
g_EmuShared->GetClipCursorFlag(&g_bClipCursor);
/* Initialize popup message management from kernel side. */
log_init_popup_msg();