mirror of
https://github.com/halpz/re3.git
synced 2025-06-30 09:16:22 +00:00
90% fixes, 10% skel refactoring
This commit is contained in:
@ -3,19 +3,34 @@
|
||||
// This is the common include for platform/renderer specific skeletons(glfw.cpp, win.cpp etc.) and using cross platform things (like Windows directories wrapper, platform specific global arrays etc.)
|
||||
// Functions that's different on glfw and win but have same signature, should be located on platform.h.
|
||||
|
||||
enum eWinVersion
|
||||
{
|
||||
OS_WIN95 = 0,
|
||||
OS_WIN98,
|
||||
OS_WINNT,
|
||||
OS_WIN2000,
|
||||
OS_WINXP,
|
||||
};
|
||||
|
||||
#ifdef _WIN32
|
||||
// This only has <windef.h> as Windows header, which is lighter (as long as WITHWINDOWS isn't defined / <Windows.h> isn't included).
|
||||
|
||||
// As long as WITHWINDOWS isn't defined / <Windows.h> isn't included, include <windef.h>, which is lighter.
|
||||
#ifndef _INC_WINDOWS
|
||||
#ifdef _WIN64
|
||||
#define _ARM64_
|
||||
#else
|
||||
#define _X86_
|
||||
#endif
|
||||
#include <windef.h>
|
||||
#endif
|
||||
#if defined RW_D3D9 || defined RWLIBS
|
||||
#include "win.h"
|
||||
#endif
|
||||
extern DWORD _dwOperatingSystemVersion;
|
||||
|
||||
#else
|
||||
char *strupr(char *str);
|
||||
char *strlwr(char *str);
|
||||
enum {
|
||||
OS_WIN98,
|
||||
OS_WIN2000,
|
||||
OS_WINNT,
|
||||
OS_WINXP,
|
||||
};
|
||||
|
||||
enum {
|
||||
LANG_OTHER,
|
||||
@ -42,6 +57,7 @@ typedef struct
|
||||
RwBool fullScreen;
|
||||
RwV2d lastMousePos;
|
||||
double mouseWheel; // glfw doesn't cache it
|
||||
bool cursorIsInWindow;
|
||||
RwInt8 joy1id;
|
||||
RwInt8 joy2id;
|
||||
}
|
||||
|
@ -282,6 +282,7 @@ psInitialize(void)
|
||||
RsGlobal.ps = &PsGlobal;
|
||||
|
||||
PsGlobal.fullScreen = FALSE;
|
||||
PsGlobal.cursorIsInWindow = TRUE;
|
||||
|
||||
PsGlobal.joy1id = -1;
|
||||
PsGlobal.joy2id = -1;
|
||||
@ -790,6 +791,7 @@ void keypressCB(GLFWwindow* window, int key, int scancode, int action, int mods)
|
||||
void resizeCB(GLFWwindow* window, int width, int height);
|
||||
void scrollCB(GLFWwindow* window, double xoffset, double yoffset);
|
||||
void cursorCB(GLFWwindow* window, double xpos, double ypos);
|
||||
void cursorEnterCB(GLFWwindow* window, int entered);
|
||||
void joysChangeCB(int jid, int event);
|
||||
|
||||
bool IsThisJoystickBlacklisted(int i)
|
||||
@ -831,6 +833,17 @@ long _InputInitialiseMouse(bool exclusive)
|
||||
return 0;
|
||||
}
|
||||
|
||||
void _InputShutdownMouse()
|
||||
{
|
||||
// Not needed
|
||||
}
|
||||
|
||||
bool _InputMouseNeedsExclusive()
|
||||
{
|
||||
// That was the cause of infamous mouse bug on Win. Not supported on glfw anyway
|
||||
return false;
|
||||
}
|
||||
|
||||
void psPostRWinit(void)
|
||||
{
|
||||
RwVideoMode vm;
|
||||
@ -840,6 +853,7 @@ void psPostRWinit(void)
|
||||
glfwSetWindowSizeCallback(PSGLOBAL(window), resizeCB);
|
||||
glfwSetScrollCallback(PSGLOBAL(window), scrollCB);
|
||||
glfwSetCursorPosCallback(PSGLOBAL(window), cursorCB);
|
||||
glfwSetCursorEnterCallback(PSGLOBAL(window), cursorEnterCB);
|
||||
glfwSetJoystickCallback(joysChangeCB);
|
||||
|
||||
_InputInitialiseJoys();
|
||||
@ -1345,13 +1359,18 @@ _InputTranslateShiftKeyUpDown(RsKeyCodes *rs) {
|
||||
RsKeyboardEventHandler(rshiftStatus ? rsKEYDOWN : rsKEYUP, &(*rs = rsRSHIFT));
|
||||
}
|
||||
|
||||
// TODO this only works in frontend(and luckily only frontend use this), maybe because of glfw knows that mouse pos is > 32000 in game??
|
||||
// TODO this only works in frontend(and luckily only frontend use this). Fun fact: if I get pos manually in game, glfw reports that it's > 32000
|
||||
void
|
||||
cursorCB(GLFWwindow* window, double xpos, double ypos) {
|
||||
FrontEndMenuManager.m_nMouseTempPosX = xpos;
|
||||
FrontEndMenuManager.m_nMouseTempPosY = ypos;
|
||||
}
|
||||
|
||||
void
|
||||
cursorEnterCB(GLFWwindow* window, int entered) {
|
||||
PSGLOBAL(cursorIsInWindow) = !!entered;
|
||||
}
|
||||
|
||||
/*
|
||||
*****************************************************************************
|
||||
*/
|
||||
|
@ -1,6 +1,8 @@
|
||||
#ifndef PLATFORM_H
|
||||
#define PLATFORM_H
|
||||
|
||||
// Functions that's different on glfw/win etc. but have same signature (but if a function only used in win.cpp you can keep in win.h)
|
||||
|
||||
#include "rwcore.h"
|
||||
#include "skeleton.h"
|
||||
|
||||
@ -36,6 +38,9 @@ extern RwBool psNativeTextureSupport(void);
|
||||
|
||||
extern void _InputTranslateShiftKeyUpDown(RsKeyCodes* rs);
|
||||
extern long _InputInitialiseMouse(bool exclusive); // returns HRESULT on Windows actually
|
||||
extern void _InputShutdownMouse();
|
||||
extern bool _InputMouseNeedsExclusive();
|
||||
extern void _InputInitialiseJoys();
|
||||
|
||||
extern void HandleExit();
|
||||
|
||||
|
@ -2883,8 +2883,13 @@ void _InputShutdownMouse()
|
||||
SAFE_RELEASE(PSGLOBAL(mouse));
|
||||
}
|
||||
|
||||
BOOL _InputMouseNeedsExclusive(void)
|
||||
bool _InputMouseNeedsExclusive(void)
|
||||
{
|
||||
// FIX: I don't know why R* needed that, but it causes infamous mouse bug on modern systems.
|
||||
// Probably DirectInput bug, since Acquire() and GetDeviceState() reports everything A-OK.
|
||||
#ifdef FIX_BUGS
|
||||
return false;
|
||||
#endif
|
||||
RwVideoMode vm;
|
||||
RwEngineGetVideoModeInfo(&vm, GcurSelVM);
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
|
||||
// DON'T include directly. crossplatform.h includes this if you're on Windows.
|
||||
// DON'T include directly. crossplatform.h includes this if you're using D3D9 backend(win.cpp).
|
||||
|
||||
#if (!defined(_PLATFORM_WIN_H))
|
||||
#define _PLATFORM_WIN_H
|
||||
@ -8,25 +8,6 @@
|
||||
#define RSREGSETBREAKALLOC(_name) /* No op */
|
||||
#endif /* (!defined(RSREGSETBREAKALLOC)) */
|
||||
|
||||
#ifndef _INC_WINDOWS
|
||||
#ifdef _WIN64
|
||||
#define _AMD64_
|
||||
#else
|
||||
#define _X86_
|
||||
#endif
|
||||
#include <windef.h>
|
||||
#endif
|
||||
|
||||
enum eWinVersion
|
||||
{
|
||||
OS_WIN95 = 0,
|
||||
OS_WIN98,
|
||||
OS_WINNT,
|
||||
OS_WIN2000,
|
||||
OS_WINXP,
|
||||
};
|
||||
|
||||
|
||||
#ifdef __DINPUT_INCLUDED__
|
||||
/* platform specfic global data */
|
||||
typedef struct
|
||||
@ -87,19 +68,16 @@ extern "C"
|
||||
{
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#ifdef __DINPUT_INCLUDED__
|
||||
extern LRESULT CALLBACK
|
||||
MainWndProc(HWND window, UINT message, WPARAM wParam, LPARAM lParam);
|
||||
|
||||
#ifdef __DINPUT_INCLUDED__
|
||||
HRESULT _InputInitialise();
|
||||
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);
|
||||
|
Reference in New Issue
Block a user