summaryrefslogtreecommitdiffstats
path: root/src/skel
diff options
context:
space:
mode:
authorshfil <filip.gawin@zoho.com>2020-07-22 23:02:11 +0200
committerGitHub <noreply@github.com>2020-07-22 23:02:11 +0200
commit98dd771d6cf3adb7153700040f122cd0916d5eeb (patch)
tree5578c27b5739341d34def86586a68f1f1129e1bb /src/skel
parentREADME 64-bit preparation (diff)
parent64-bit on Windows (diff)
downloadre3-98dd771d6cf3adb7153700040f122cd0916d5eeb.tar
re3-98dd771d6cf3adb7153700040f122cd0916d5eeb.tar.gz
re3-98dd771d6cf3adb7153700040f122cd0916d5eeb.tar.bz2
re3-98dd771d6cf3adb7153700040f122cd0916d5eeb.tar.lz
re3-98dd771d6cf3adb7153700040f122cd0916d5eeb.tar.xz
re3-98dd771d6cf3adb7153700040f122cd0916d5eeb.tar.zst
re3-98dd771d6cf3adb7153700040f122cd0916d5eeb.zip
Diffstat (limited to 'src/skel')
-rw-r--r--src/skel/crossplatform.h2
-rw-r--r--src/skel/glfw/glfw.cpp2
-rw-r--r--src/skel/win/win.cpp47
-rw-r--r--src/skel/win/win.h8
4 files changed, 46 insertions, 13 deletions
diff --git a/src/skel/crossplatform.h b/src/skel/crossplatform.h
index a21877c1..678d3ec4 100644
--- a/src/skel/crossplatform.h
+++ b/src/skel/crossplatform.h
@@ -4,7 +4,7 @@
// Functions that's different on glfw and win but have same signature, should be located on platform.h.
#ifdef _WIN32
-// This only has <windef.h> as Win header.
+// This only has <windef.h> as Windows header, which is lighter (as long as WITHWINDOWS isn't defined / <Windows.h> isn't included).
#include "win.h"
extern DWORD _dwOperatingSystemVersion;
#else
diff --git a/src/skel/glfw/glfw.cpp b/src/skel/glfw/glfw.cpp
index 630b3345..47dc9e4c 100644
--- a/src/skel/glfw/glfw.cpp
+++ b/src/skel/glfw/glfw.cpp
@@ -63,7 +63,7 @@ static psGlobalType PsGlobal;
#undef MAKEPOINTS
#define MAKEPOINTS(l) (*((POINTS /*FAR*/ *)&(l)))
-unsigned long _dwMemAvailPhys;
+size_t _dwMemAvailPhys;
RwUInt32 gGameState;
#ifdef _WIN32
diff --git a/src/skel/win/win.cpp b/src/skel/win/win.cpp
index 9795bde9..9fde9d32 100644
--- a/src/skel/win/win.cpp
+++ b/src/skel/win/win.cpp
@@ -19,7 +19,12 @@
#pragma warning( push )
#pragma warning( disable : 4005)
+
+#ifdef USE_D3D9
+#include <d3d9.h>
+#else
#include <d3d8.h>
+#endif
#include <ddraw.h>
#include <dinput.h>
#include <DShow.h>
@@ -27,7 +32,9 @@
#define WM_GRAPHNOTIFY WM_USER+13
+#ifndef USE_D3D9
#pragma comment( lib, "d3d8.lib" )
+#endif
#pragma comment( lib, "ddraw.lib" )
#pragma comment( lib, "Winmm.lib" )
#pragma comment( lib, "dxguid.lib" )
@@ -102,7 +109,7 @@ IMediaSeeking *pMS = nil;
DWORD dwDXVersion;
SIZE_T _dwMemTotalPhys;
-SIZE_T _dwMemAvailPhys;
+size_t _dwMemAvailPhys;
SIZE_T _dwMemTotalVirtual;
SIZE_T _dwMemAvailVirtual;
DWORD _dwMemTotalVideo;
@@ -449,6 +456,16 @@ DWORD GetDXVersion()
dwDXVersion = 0x700;
pDD7->Release();
+#ifdef USE_D3D9
+ HINSTANCE hD3D9DLL = LoadLibrary("D3D9.DLL");
+ if (hD3D9DLL != nil) {
+ FreeLibrary(hDDrawDLL);
+ FreeLibrary(hD3D9DLL);
+
+ dwDXVersion = 0x900;
+ return dwDXVersion;
+ }
+#endif
//-------------------------------------------------------------------------
// DirectX 8.0 Checks
@@ -498,6 +515,7 @@ DWORD GetDXVersion()
/*
*****************************************************************************
*/
+#ifndef _WIN64
static char cpuvendor[16] = "UnknownVendr";
__declspec(naked) const char * _psGetCpuVendr()
{
@@ -571,6 +589,7 @@ void _psPrintCpuInfo()
if ( FeaturesEx & 0x80000000 )
debug("with 3DNow");
}
+#endif
/*
*****************************************************************************
@@ -646,9 +665,9 @@ psInitialize(void)
gGameState = GS_START_UP;
TRACE("gGameState = GS_START_UP");
-
+#ifndef _WIN64
_psPrintCpuInfo();
-
+#endif
OSVERSIONINFO verInfo;
verInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
@@ -1284,8 +1303,11 @@ RwBool IsForegroundApp()
UINT GetBestRefreshRate(UINT width, UINT height, UINT depth)
{
+#ifdef USE_D3D9
+ LPDIRECT3D9 d3d = Direct3DCreate9(D3D_SDK_VERSION);
+#else
LPDIRECT3D8 d3d = Direct3DCreate8(D3D_SDK_VERSION);
-
+#endif
ASSERT(d3d != nil);
UINT refreshRate = INT_MAX;
@@ -1298,14 +1320,21 @@ UINT GetBestRefreshRate(UINT width, UINT height, UINT depth)
else
format = D3DFMT_R5G6B5;
+#ifdef USE_D3D9
+ UINT modeCount = d3d->GetAdapterModeCount(GcurSel, format);
+#else
UINT modeCount = d3d->GetAdapterModeCount(GcurSel);
-
+#endif
+
for ( UINT i = 0; i < modeCount; i++ )
{
D3DDISPLAYMODE mode;
+#ifdef USE_D3D9
+ d3d->EnumAdapterModes(GcurSel, format, i, &mode);
+#else
d3d->EnumAdapterModes(GcurSel, i, &mode);
-
+#endif
if ( mode.Width == width && mode.Height == height && mode.Format == format )
{
if ( mode.RefreshRate == 0 )
@@ -1599,7 +1628,7 @@ CommandLineToArgv(RwChar *cmdLine, RwInt32 *argCount)
RwInt32 i, len;
RwChar *res, *str, **aptr;
- len = strlen(cmdLine);
+ len = (int)strlen(cmdLine);
/*
* Count the number of arguments...
@@ -1687,11 +1716,11 @@ void InitialiseLanguage()
{
WORD primUserLCID = PRIMARYLANGID(GetSystemDefaultLCID());
WORD primSystemLCID = PRIMARYLANGID(GetUserDefaultLCID());
- WORD primLayout = PRIMARYLANGID((DWORD)GetKeyboardLayout(0));
+ WORD primLayout = PRIMARYLANGID((DWORD_PTR)GetKeyboardLayout(0));
WORD subUserLCID = SUBLANGID(GetSystemDefaultLCID());
WORD subSystemLCID = SUBLANGID(GetUserDefaultLCID());
- WORD subLayout = SUBLANGID((DWORD)GetKeyboardLayout(0));
+ WORD subLayout = SUBLANGID((DWORD_PTR)GetKeyboardLayout(0));
if ( primUserLCID == LANG_GERMAN
|| primSystemLCID == LANG_GERMAN
diff --git a/src/skel/win/win.h b/src/skel/win/win.h
index 444e0760..d19c4e0e 100644
--- a/src/skel/win/win.h
+++ b/src/skel/win/win.h
@@ -9,8 +9,12 @@
#endif /* (!defined(RSREGSETBREAKALLOC)) */
#ifndef _INC_WINDOWS
-#define _X86_
-#include <windef.h>
+ #ifdef _WIN64
+ #define _AMD64_
+ #else
+ #define _X86_
+ #endif
+ #include <windef.h>
#endif
enum eWinVersion