64-bit on Windows

This commit is contained in:
eray orçunus
2020-07-22 14:56:28 +03:00
parent afc38c0d72
commit 1dc6fbda1f
51 changed files with 13355 additions and 87 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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