summaryrefslogtreecommitdiffstats
path: root/src/skel
diff options
context:
space:
mode:
authoreray orçunus <erayorcunus@gmail.com>2020-07-21 04:59:31 +0200
committereray orçunus <erayorcunus@gmail.com>2020-07-22 14:19:22 +0200
commitf40f44b14e028c4bb2bee2e898c210e3f41b20bb (patch)
treef66810ab48dc09fd116db6d7e81822c6f760444f /src/skel
parentfixed COcclusion (diff)
downloadre3-f40f44b14e028c4bb2bee2e898c210e3f41b20bb.tar
re3-f40f44b14e028c4bb2bee2e898c210e3f41b20bb.tar.gz
re3-f40f44b14e028c4bb2bee2e898c210e3f41b20bb.tar.bz2
re3-f40f44b14e028c4bb2bee2e898c210e3f41b20bb.tar.lz
re3-f40f44b14e028c4bb2bee2e898c210e3f41b20bb.tar.xz
re3-f40f44b14e028c4bb2bee2e898c210e3f41b20bb.tar.zst
re3-f40f44b14e028c4bb2bee2e898c210e3f41b20bb.zip
Diffstat (limited to 'src/skel')
-rw-r--r--src/skel/glfw/glfw.cpp9
-rw-r--r--src/skel/platform.h1
-rw-r--r--src/skel/win/win.cpp24
-rw-r--r--src/skel/win/win.h3
4 files changed, 26 insertions, 11 deletions
diff --git a/src/skel/glfw/glfw.cpp b/src/skel/glfw/glfw.cpp
index e1860179..f49f0d42 100644
--- a/src/skel/glfw/glfw.cpp
+++ b/src/skel/glfw/glfw.cpp
@@ -64,10 +64,6 @@ static psGlobalType PsGlobal;
#undef MAKEPOINTS
#define MAKEPOINTS(l) (*((POINTS /*FAR*/ *)&(l)))
-#define SAFE_RELEASE(x) { if (x) x->Release(); x = NULL; }
-#define JIF(x) if (FAILED(hr=(x))) \
- {debug(TEXT("FAILED(hr=0x%x) in ") TEXT(#x) TEXT("\n"), hr); return;}
-
unsigned long _dwMemAvailPhys;
RwUInt32 gGameState;
@@ -830,9 +826,10 @@ void _InputInitialiseJoys()
}
}
-void _InputInitialiseMouse()
+long _InputInitialiseMouse(bool exclusive)
{
glfwSetInputMode(PSGLOBAL(window), GLFW_CURSOR, GLFW_CURSOR_HIDDEN);
+ return 0;
}
void psPostRWinit(void)
@@ -847,7 +844,7 @@ void psPostRWinit(void)
glfwSetJoystickCallback(joysChangeCB);
_InputInitialiseJoys();
- _InputInitialiseMouse();
+ _InputInitialiseMouse(false);
if(!(vm.flags & rwVIDEOMODEEXCLUSIVE))
glfwSetWindowSize(PSGLOBAL(window), RsGlobal.maximumWidth, RsGlobal.maximumHeight);
diff --git a/src/skel/platform.h b/src/skel/platform.h
index cbb1be28..7f36d8b7 100644
--- a/src/skel/platform.h
+++ b/src/skel/platform.h
@@ -35,6 +35,7 @@ extern RwBool psInstallFileSystem(void);
extern RwBool psNativeTextureSupport(void);
extern void _InputTranslateShiftKeyUpDown(RsKeyCodes* rs);
+extern long _InputInitialiseMouse(bool exclusive); // returns HRESULT on Windows actually
extern void HandleExit();
diff --git a/src/skel/win/win.cpp b/src/skel/win/win.cpp
index ed423f30..cd75236c 100644
--- a/src/skel/win/win.cpp
+++ b/src/skel/win/win.cpp
@@ -1602,7 +1602,6 @@ RwBool _psSetVideoMode(RwInt32 subSystem, RwInt32 videoMode)
return TRUE;
}
-
/*
*****************************************************************************
*/
@@ -2003,7 +2002,7 @@ WinMain(HINSTANCE instance,
if ( _InputInitialise() == S_OK )
{
- _InputInitialiseMouse();
+ _InputInitialiseMouse(false);
_InputInitialiseJoys();
}
@@ -2542,7 +2541,7 @@ HRESULT _InputInitialise()
return S_OK;
}
-HRESULT _InputInitialiseMouse()
+HRESULT _InputInitialiseMouse(bool exclusive)
{
HRESULT hr;
@@ -2560,7 +2559,7 @@ HRESULT _InputInitialiseMouse()
if( FAILED( hr = PSGLOBAL(mouse)->SetDataFormat( &c_dfDIMouse2 ) ) )
return hr;
- if( FAILED( hr = PSGLOBAL(mouse)->SetCooperativeLevel( PSGLOBAL(window), DISCL_NONEXCLUSIVE | DISCL_FOREGROUND ) ) )
+ if( FAILED( hr = PSGLOBAL(mouse)->SetCooperativeLevel( PSGLOBAL(window), (exclusive ? DISCL_EXCLUSIVE : DISCL_NONEXCLUSIVE) | DISCL_FOREGROUND ) ) )
return hr;
// Acquire the newly created device
@@ -2848,6 +2847,23 @@ void _InputShutdown()
SAFE_RELEASE(PSGLOBAL(dinterface));
}
+void _InputShutdownMouse()
+{
+ if (PSGLOBAL(mouse) == nil)
+ return;
+
+ PSGLOBAL(mouse)->Unacquire();
+ SAFE_RELEASE(PSGLOBAL(mouse));
+}
+
+BOOL _InputMouseNeedsExclusive(void)
+{
+ RwVideoMode vm;
+ RwEngineGetVideoModeInfo(&vm, GcurSelVM);
+
+ return vm.flags & rwVIDEOMODEEXCLUSIVE;
+}
+
BOOL CALLBACK _InputEnumDevicesCallback( const DIDEVICEINSTANCE* pdidInstance, VOID* pContext )
{
HRESULT hr;
diff --git a/src/skel/win/win.h b/src/skel/win/win.h
index 444e0760..eb32cb72 100644
--- a/src/skel/win/win.h
+++ b/src/skel/win/win.h
@@ -88,13 +88,14 @@ extern LRESULT CALLBACK
MainWndProc(HWND window, UINT message, WPARAM wParam, LPARAM lParam);
HRESULT _InputInitialise();
-HRESULT _InputInitialiseMouse();
HRESULT CapturePad(RwInt32 padID);
void _InputInitialiseJoys();
void _InputAddJoyStick(LPDIRECTINPUTDEVICE8 lpDevice, INT num);
HRESULT _InputAddJoys();
HRESULT _InputGetMouseState(DIMOUSESTATE2 *state);
void _InputShutdown();
+void _InputShutdownMouse();
+BOOL _InputMouseNeedsExclusive();
BOOL CALLBACK _InputEnumDevicesCallback( const DIDEVICEINSTANCE* pdidInstance, VOID* pContext );
BOOL _InputTranslateKey(RsKeyCodes *rs, UINT flag, UINT key);
BOOL _InputTranslateShiftKey(RsKeyCodes *rs, UINT key, BOOLEAN bDown);