mirror of
https://github.com/id-Software/DOOM-3-BFG.git
synced 2024-12-02 08:51:57 +00:00
Merge branch 'linux' of https://github.com/RobertBeckebans/RBDOOM-3-BFG into linux
This commit is contained in:
commit
3e533d1e29
6 changed files with 139 additions and 27 deletions
|
@ -81,11 +81,14 @@ elseif(MSVC)
|
|||
-D_CRT_SECURE_NO_DEPRECATE
|
||||
-D_CRT_NONSTDC_NO_DEPRECATE
|
||||
-D_CRT_SECURE_NO_WARNINGS
|
||||
-D_USE_32BIT_TIME_T
|
||||
-D_MBCS
|
||||
#-DUSE_OPENAL
|
||||
-DUSE_EXCEPTIONS)
|
||||
|
||||
if(NOT CMAKE_CL_64)
|
||||
add_definitions(-D_USE_32BIT_TIME_T)
|
||||
endif()
|
||||
|
||||
if(USE_MFC_TOOLS)
|
||||
add_definitions(-D_AFXDLL)
|
||||
|
||||
|
|
6
neo/cmake-vs2010-64bit.bat
Normal file
6
neo/cmake-vs2010-64bit.bat
Normal file
|
@ -0,0 +1,6 @@
|
|||
cd ..
|
||||
del /s /q build
|
||||
mkdir build
|
||||
cd build
|
||||
cmake -G "Visual Studio 10 Win64" ../neo
|
||||
pause
|
6
neo/cmake-vs2012-64bit.bat
Normal file
6
neo/cmake-vs2012-64bit.bat
Normal file
|
@ -0,0 +1,6 @@
|
|||
cd ..
|
||||
del /s /q build
|
||||
mkdir build
|
||||
cd build
|
||||
cmake -G "Visual Studio 11 Win64" ../neo
|
||||
pause
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 2012 Robert Beckebans
|
||||
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
|
||||
|
@ -47,17 +48,18 @@ If you have questions concerning this license or the applicable additional terms
|
|||
Sys_GetClockTicks
|
||||
================
|
||||
*/
|
||||
double Sys_GetClockTicks() {
|
||||
#if 0
|
||||
double Sys_GetClockTicks()
|
||||
{
|
||||
// RB begin
|
||||
#if defined(_WIN64)
|
||||
|
||||
LARGE_INTEGER li;
|
||||
|
||||
QueryPerformanceCounter( &li );
|
||||
return = (double ) li.LowPart + (double) 0xFFFFFFFF * li.HighPart;
|
||||
return (double ) li.LowPart + (double) 0xFFFFFFFF * li.HighPart;
|
||||
|
||||
#else
|
||||
|
||||
// RB begin
|
||||
#if defined(_MSC_VER)
|
||||
unsigned long lo, hi;
|
||||
|
||||
|
@ -88,9 +90,9 @@ double Sys_GetClockTicks() {
|
|||
#else
|
||||
#error unsupported CPU
|
||||
#endif
|
||||
// RB end
|
||||
|
||||
#endif
|
||||
// RB end
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -151,6 +153,8 @@ double Sys_ClockTicksPerSecond() {
|
|||
HasCPUID
|
||||
================
|
||||
*/
|
||||
// RB: no checks on Win64
|
||||
#if !defined(_WIN64)
|
||||
static bool HasCPUID() {
|
||||
__asm
|
||||
{
|
||||
|
@ -182,6 +186,7 @@ err:
|
|||
good:
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
#define _REG_EAX 0
|
||||
#define _REG_EBX 1
|
||||
|
@ -193,6 +198,8 @@ good:
|
|||
CPUID
|
||||
================
|
||||
*/
|
||||
// RB: no checks on Win64
|
||||
#if !defined(_WIN64)
|
||||
static void CPUID( int func, unsigned regs[4] ) {
|
||||
unsigned regEAX, regEBX, regECX, regEDX;
|
||||
|
||||
|
@ -211,13 +218,15 @@ static void CPUID( int func, unsigned regs[4] ) {
|
|||
regs[_REG_ECX] = regECX;
|
||||
regs[_REG_EDX] = regEDX;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
================
|
||||
IsAMD
|
||||
================
|
||||
*/
|
||||
// RB: no checks on Win64
|
||||
#if !defined(_WIN64)
|
||||
static bool IsAMD() {
|
||||
char pstring[16];
|
||||
char processorString[13];
|
||||
|
@ -243,12 +252,15 @@ static bool IsAMD() {
|
|||
}
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
================
|
||||
HasCMOV
|
||||
================
|
||||
*/
|
||||
// RB: no checks on Win64
|
||||
#if !defined(_WIN64)
|
||||
static bool HasCMOV() {
|
||||
unsigned regs[4];
|
||||
|
||||
|
@ -261,12 +273,15 @@ static bool HasCMOV() {
|
|||
}
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
================
|
||||
Has3DNow
|
||||
================
|
||||
*/
|
||||
// RB: no checks on Win64
|
||||
#if !defined(_WIN64)
|
||||
static bool Has3DNow() {
|
||||
unsigned regs[4];
|
||||
|
||||
|
@ -284,12 +299,15 @@ static bool Has3DNow() {
|
|||
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
================
|
||||
HasMMX
|
||||
================
|
||||
*/
|
||||
// RB: no checks on Win64
|
||||
#if !defined(_WIN64)
|
||||
static bool HasMMX() {
|
||||
unsigned regs[4];
|
||||
|
||||
|
@ -302,12 +320,15 @@ static bool HasMMX() {
|
|||
}
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
================
|
||||
HasSSE
|
||||
================
|
||||
*/
|
||||
// RB: no checks on Win64
|
||||
#if !defined(_WIN64)
|
||||
static bool HasSSE() {
|
||||
unsigned regs[4];
|
||||
|
||||
|
@ -320,12 +341,15 @@ static bool HasSSE() {
|
|||
}
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
================
|
||||
HasSSE2
|
||||
================
|
||||
*/
|
||||
// RB: no checks on Win64
|
||||
#if !defined(_WIN64)
|
||||
static bool HasSSE2() {
|
||||
unsigned regs[4];
|
||||
|
||||
|
@ -338,12 +362,15 @@ static bool HasSSE2() {
|
|||
}
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
================
|
||||
HasSSE3
|
||||
================
|
||||
*/
|
||||
// RB: no checks on Win64
|
||||
#if !defined(_WIN64)
|
||||
static bool HasSSE3() {
|
||||
unsigned regs[4];
|
||||
|
||||
|
@ -356,12 +383,15 @@ static bool HasSSE3() {
|
|||
}
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
================
|
||||
LogicalProcPerPhysicalProc
|
||||
================
|
||||
*/
|
||||
// RB: no checks on Win64
|
||||
#if !defined(_WIN64)
|
||||
#define NUM_LOGICAL_BITS 0x00FF0000 // EBX[23:16] Bit 16-23 in ebx contains the number of logical
|
||||
// processors per physical processor when execute cpuid with
|
||||
// eax set to 1
|
||||
|
@ -374,12 +404,15 @@ static unsigned char LogicalProcPerPhysicalProc() {
|
|||
}
|
||||
return (unsigned char) ((regebx & NUM_LOGICAL_BITS) >> 16);
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
================
|
||||
GetAPIC_ID
|
||||
================
|
||||
*/
|
||||
// RB: no checks on Win64
|
||||
#if !defined(_WIN64)
|
||||
#define INITIAL_APIC_ID_BITS 0xFF000000 // EBX[31:24] Bits 24-31 (8 bits) return the 8-bit unique
|
||||
// initial APIC ID for the processor this code is running on.
|
||||
// Default value = 0xff if HT is not supported
|
||||
|
@ -392,6 +425,7 @@ static unsigned char GetAPIC_ID() {
|
|||
}
|
||||
return (unsigned char) ((regebx & INITIAL_APIC_ID_BITS) >> 24);
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
================
|
||||
|
@ -402,6 +436,8 @@ CPUCount
|
|||
returns one of the HT_* flags
|
||||
================
|
||||
*/
|
||||
// RB: no checks on Win64
|
||||
#if !defined(_WIN64)
|
||||
#define HT_NOT_CAPABLE 0
|
||||
#define HT_ENABLED 1
|
||||
#define HT_DISABLED 2
|
||||
|
@ -493,12 +529,15 @@ int CPUCount( int &logicalNum, int &physicalNum ) {
|
|||
}
|
||||
return statusFlag;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
================
|
||||
HasHTT
|
||||
================
|
||||
*/
|
||||
// RB: no checks on Win64
|
||||
#if !defined(_WIN64)
|
||||
static bool HasHTT() {
|
||||
unsigned regs[4];
|
||||
int logicalNum, physicalNum, HTStatusFlag;
|
||||
|
@ -517,12 +556,15 @@ static bool HasHTT() {
|
|||
}
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
================
|
||||
HasHTT
|
||||
HasDAZ
|
||||
================
|
||||
*/
|
||||
// RB: no checks on Win64
|
||||
#if !defined(_WIN64)
|
||||
static bool HasDAZ() {
|
||||
__declspec(align(16)) unsigned char FXSaveArea[512];
|
||||
unsigned char *FXArea = FXSaveArea;
|
||||
|
@ -547,6 +589,7 @@ static bool HasDAZ() {
|
|||
dwMask = *(DWORD *)&FXArea[28]; // Read the MXCSR Mask
|
||||
return ( ( dwMask & ( 1 << 6 ) ) == ( 1 << 6 ) ); // Return if the DAZ bit is set
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
================================================================================================
|
||||
|
@ -726,7 +769,17 @@ void Sys_CPUCount( int & numLogicalCPUCores, int & numPhysicalCPUCores, int & nu
|
|||
Sys_GetCPUId
|
||||
================
|
||||
*/
|
||||
cpuid_t Sys_GetCPUId() {
|
||||
cpuid_t Sys_GetCPUId()
|
||||
{
|
||||
// RB: we assume a modern x86 chip
|
||||
#if defined(_WIN64)
|
||||
int flags = CPUID_GENERIC;
|
||||
|
||||
flags |= CPUID_SSE;
|
||||
flags |= CPUID_SSE2;
|
||||
|
||||
return (cpuid_t)flags;
|
||||
#else
|
||||
int flags;
|
||||
|
||||
// verify we're at least a Pentium or 486 with CPUID support
|
||||
|
@ -782,6 +835,7 @@ cpuid_t Sys_GetCPUId() {
|
|||
}
|
||||
|
||||
return (cpuid_t)flags;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
@ -875,7 +929,9 @@ int Sys_FPU_PrintStateFlags( char *ptr, int ctrl, int stat, int tags, int inof,
|
|||
Sys_FPU_StackIsEmpty
|
||||
===============
|
||||
*/
|
||||
bool Sys_FPU_StackIsEmpty() {
|
||||
bool Sys_FPU_StackIsEmpty()
|
||||
{
|
||||
#if !defined(_WIN64)
|
||||
__asm {
|
||||
mov eax, statePtr
|
||||
fnstenv [eax]
|
||||
|
@ -886,6 +942,7 @@ bool Sys_FPU_StackIsEmpty() {
|
|||
}
|
||||
return false;
|
||||
empty:
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -894,7 +951,9 @@ empty:
|
|||
Sys_FPU_ClearStack
|
||||
===============
|
||||
*/
|
||||
void Sys_FPU_ClearStack() {
|
||||
void Sys_FPU_ClearStack()
|
||||
{
|
||||
#if !defined(_WIN64)
|
||||
__asm {
|
||||
mov eax, statePtr
|
||||
fnstenv [eax]
|
||||
|
@ -910,6 +969,7 @@ void Sys_FPU_ClearStack() {
|
|||
jmp emptyStack
|
||||
done:
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -919,7 +979,11 @@ Sys_FPU_GetState
|
|||
gets the FPU state without changing the state
|
||||
===============
|
||||
*/
|
||||
const char *Sys_FPU_GetState() {
|
||||
const char *Sys_FPU_GetState()
|
||||
{
|
||||
#if defined(_WIN64)
|
||||
return "TODO Sys_FPU_GetState()";
|
||||
#else
|
||||
double fpuStack[8] = { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 };
|
||||
double *fpuStackPtr = fpuStack;
|
||||
int i, numValues;
|
||||
|
@ -1016,6 +1080,7 @@ const char *Sys_FPU_GetState() {
|
|||
Sys_FPU_PrintStateFlags( ptr, ctrl, stat, tags, inof, inse, opof, opse );
|
||||
|
||||
return fpuString;
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1023,7 +1088,9 @@ const char *Sys_FPU_GetState() {
|
|||
Sys_FPU_EnableExceptions
|
||||
===============
|
||||
*/
|
||||
void Sys_FPU_EnableExceptions( int exceptions ) {
|
||||
void Sys_FPU_EnableExceptions( int exceptions )
|
||||
{
|
||||
#if !defined(_WIN64)
|
||||
__asm {
|
||||
mov eax, statePtr
|
||||
mov ecx, exceptions
|
||||
|
@ -1036,6 +1103,7 @@ void Sys_FPU_EnableExceptions( int exceptions ) {
|
|||
mov word ptr [eax], bx
|
||||
fldcw word ptr [eax]
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1043,7 +1111,9 @@ void Sys_FPU_EnableExceptions( int exceptions ) {
|
|||
Sys_FPU_SetPrecision
|
||||
===============
|
||||
*/
|
||||
void Sys_FPU_SetPrecision( int precision ) {
|
||||
void Sys_FPU_SetPrecision( int precision )
|
||||
{
|
||||
#if !defined(_WIN64)
|
||||
short precisionBitTable[4] = { 0, 1, 3, 0 };
|
||||
short precisionBits = precisionBitTable[precision & 3] << 8;
|
||||
short precisionMask = ~( ( 1 << 9 ) | ( 1 << 8 ) );
|
||||
|
@ -1058,6 +1128,7 @@ void Sys_FPU_SetPrecision( int precision ) {
|
|||
mov word ptr [eax], bx
|
||||
fldcw word ptr [eax]
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1065,7 +1136,9 @@ void Sys_FPU_SetPrecision( int precision ) {
|
|||
Sys_FPU_SetRounding
|
||||
================
|
||||
*/
|
||||
void Sys_FPU_SetRounding( int rounding ) {
|
||||
void Sys_FPU_SetRounding( int rounding )
|
||||
{
|
||||
#if !defined(_WIN64)
|
||||
short roundingBitTable[4] = { 0, 1, 2, 3 };
|
||||
short roundingBits = roundingBitTable[rounding & 3] << 10;
|
||||
short roundingMask = ~( ( 1 << 11 ) | ( 1 << 10 ) );
|
||||
|
@ -1080,6 +1153,7 @@ void Sys_FPU_SetRounding( int rounding ) {
|
|||
mov word ptr [eax], bx
|
||||
fldcw word ptr [eax]
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1087,7 +1161,9 @@ void Sys_FPU_SetRounding( int rounding ) {
|
|||
Sys_FPU_SetDAZ
|
||||
================
|
||||
*/
|
||||
void Sys_FPU_SetDAZ( bool enable ) {
|
||||
void Sys_FPU_SetDAZ( bool enable )
|
||||
{
|
||||
#if !defined(_WIN64)
|
||||
DWORD dwData;
|
||||
|
||||
_asm {
|
||||
|
@ -1101,6 +1177,7 @@ void Sys_FPU_SetDAZ( bool enable ) {
|
|||
mov dwData, eax
|
||||
LDMXCSR dword ptr dwData
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1108,7 +1185,9 @@ void Sys_FPU_SetDAZ( bool enable ) {
|
|||
Sys_FPU_SetFTZ
|
||||
================
|
||||
*/
|
||||
void Sys_FPU_SetFTZ( bool enable ) {
|
||||
void Sys_FPU_SetFTZ( bool enable )
|
||||
{
|
||||
#if !defined(_WIN64)
|
||||
DWORD dwData;
|
||||
|
||||
_asm {
|
||||
|
@ -1122,4 +1201,5 @@ void Sys_FPU_SetFTZ( bool enable ) {
|
|||
mov dwData, eax
|
||||
LDMXCSR dword ptr dwData
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -585,7 +585,9 @@ Sys_ListFiles
|
|||
int Sys_ListFiles( const char *directory, const char *extension, idStrList &list ) {
|
||||
idStr search;
|
||||
struct _finddata_t findinfo;
|
||||
int findhandle;
|
||||
// RB: 64 bit fixes, changed int to intptr_t
|
||||
intptr_t findhandle;
|
||||
// RB end
|
||||
int flag;
|
||||
|
||||
if ( !extension) {
|
||||
|
@ -862,7 +864,9 @@ DLL Loading
|
|||
Sys_DLL_Load
|
||||
=====================
|
||||
*/
|
||||
int Sys_DLL_Load( const char *dllName ) {
|
||||
// RB: 64 bit fixes, changed int to intptr_t
|
||||
intptr_t Sys_DLL_Load( const char *dllName )
|
||||
{
|
||||
HINSTANCE libHandle = LoadLibrary( dllName );
|
||||
return (int)libHandle;
|
||||
}
|
||||
|
@ -872,7 +876,8 @@ int Sys_DLL_Load( const char *dllName ) {
|
|||
Sys_DLL_GetProcAddress
|
||||
=====================
|
||||
*/
|
||||
void *Sys_DLL_GetProcAddress( int dllHandle, const char *procName ) {
|
||||
void *Sys_DLL_GetProcAddress( intptr_t dllHandle, const char *procName )
|
||||
{
|
||||
// RB: added missing cast
|
||||
return ( void* ) GetProcAddress( (HINSTANCE)dllHandle, procName );
|
||||
}
|
||||
|
@ -882,11 +887,15 @@ void *Sys_DLL_GetProcAddress( int dllHandle, const char *procName ) {
|
|||
Sys_DLL_Unload
|
||||
=====================
|
||||
*/
|
||||
void Sys_DLL_Unload( int dllHandle ) {
|
||||
if ( !dllHandle ) {
|
||||
void Sys_DLL_Unload( intptr_t dllHandle )
|
||||
{
|
||||
if( !dllHandle )
|
||||
{
|
||||
return;
|
||||
}
|
||||
if ( FreeLibrary( (HINSTANCE)dllHandle ) == 0 ) {
|
||||
|
||||
if( FreeLibrary( (HINSTANCE)dllHandle ) == 0 )
|
||||
{
|
||||
int lastError = GetLastError();
|
||||
LPVOID lpMsgBuf;
|
||||
FormatMessage(
|
||||
|
@ -898,9 +907,11 @@ void Sys_DLL_Unload( int dllHandle ) {
|
|||
0,
|
||||
NULL
|
||||
);
|
||||
|
||||
Sys_Error( "Sys_DLL_Unload: FreeLibrary failed - %s (%d)", lpMsgBuf, lastError );
|
||||
}
|
||||
}
|
||||
// RB end
|
||||
|
||||
/*
|
||||
========================================================================
|
||||
|
@ -1361,7 +1372,7 @@ void EmailCrashReport( LPSTR messageText ) {
|
|||
}
|
||||
|
||||
// RB: disabled unused FPU exception debugging
|
||||
#if !defined(__MINGW32__)
|
||||
#if !defined(__MINGW32__) && !defined(_WIN64)
|
||||
|
||||
int Sys_FPU_PrintStateFlags( char *ptr, int ctrl, int stat, int tags, int inof, int inse, int opof, int opse );
|
||||
|
||||
|
|
|
@ -426,7 +426,13 @@ void Sys_CreateConsole()
|
|||
win32.hInstance, NULL );
|
||||
SendMessage( s_wcd.hwndBuffer, WM_SETFONT, ( WPARAM ) s_wcd.hfBufferFont, 0 );
|
||||
|
||||
s_wcd.SysInputLineWndProc = ( WNDPROC ) SetWindowLong( s_wcd.hwndInputLine, GWL_WNDPROC, ( long ) InputLineWndProc );
|
||||
// RB begin
|
||||
#if defined(_WIN64)
|
||||
s_wcd.SysInputLineWndProc = ( WNDPROC ) SetWindowLong( s_wcd.hwndInputLine, GWLP_WNDPROC, ( LONG_PTR ) InputLineWndProc );
|
||||
#else
|
||||
s_wcd.SysInputLineWndProc = ( WNDPROC ) SetWindowLong( s_wcd.hwndInputLine, GWL_WNDPROC, ( LONG ) InputLineWndProc );
|
||||
#endif
|
||||
// RB end
|
||||
SendMessage( s_wcd.hwndInputLine, WM_SETFONT, ( WPARAM ) s_wcd.hfBufferFont, 0 );
|
||||
|
||||
// don't show it now that we have a splash screen up
|
||||
|
|
Loading…
Reference in a new issue