mirror of
https://github.com/id-Software/DOOM-3-BFG.git
synced 2024-12-04 01:41:40 +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_SECURE_NO_DEPRECATE
|
||||||
-D_CRT_NONSTDC_NO_DEPRECATE
|
-D_CRT_NONSTDC_NO_DEPRECATE
|
||||||
-D_CRT_SECURE_NO_WARNINGS
|
-D_CRT_SECURE_NO_WARNINGS
|
||||||
-D_USE_32BIT_TIME_T
|
|
||||||
-D_MBCS
|
-D_MBCS
|
||||||
#-DUSE_OPENAL
|
#-DUSE_OPENAL
|
||||||
-DUSE_EXCEPTIONS)
|
-DUSE_EXCEPTIONS)
|
||||||
|
|
||||||
|
if(NOT CMAKE_CL_64)
|
||||||
|
add_definitions(-D_USE_32BIT_TIME_T)
|
||||||
|
endif()
|
||||||
|
|
||||||
if(USE_MFC_TOOLS)
|
if(USE_MFC_TOOLS)
|
||||||
add_definitions(-D_AFXDLL)
|
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
|
Doom 3 BFG Edition GPL Source Code
|
||||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
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").
|
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
|
Sys_GetClockTicks
|
||||||
================
|
================
|
||||||
*/
|
*/
|
||||||
double Sys_GetClockTicks() {
|
double Sys_GetClockTicks()
|
||||||
#if 0
|
{
|
||||||
|
// RB begin
|
||||||
|
#if defined(_WIN64)
|
||||||
|
|
||||||
LARGE_INTEGER li;
|
LARGE_INTEGER li;
|
||||||
|
|
||||||
QueryPerformanceCounter( &li );
|
QueryPerformanceCounter( &li );
|
||||||
return = (double ) li.LowPart + (double) 0xFFFFFFFF * li.HighPart;
|
return (double ) li.LowPart + (double) 0xFFFFFFFF * li.HighPart;
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
// RB begin
|
|
||||||
#if defined(_MSC_VER)
|
#if defined(_MSC_VER)
|
||||||
unsigned long lo, hi;
|
unsigned long lo, hi;
|
||||||
|
|
||||||
|
@ -88,9 +90,9 @@ double Sys_GetClockTicks() {
|
||||||
#else
|
#else
|
||||||
#error unsupported CPU
|
#error unsupported CPU
|
||||||
#endif
|
#endif
|
||||||
// RB end
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
// RB end
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -151,6 +153,8 @@ double Sys_ClockTicksPerSecond() {
|
||||||
HasCPUID
|
HasCPUID
|
||||||
================
|
================
|
||||||
*/
|
*/
|
||||||
|
// RB: no checks on Win64
|
||||||
|
#if !defined(_WIN64)
|
||||||
static bool HasCPUID() {
|
static bool HasCPUID() {
|
||||||
__asm
|
__asm
|
||||||
{
|
{
|
||||||
|
@ -182,6 +186,7 @@ err:
|
||||||
good:
|
good:
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#define _REG_EAX 0
|
#define _REG_EAX 0
|
||||||
#define _REG_EBX 1
|
#define _REG_EBX 1
|
||||||
|
@ -193,6 +198,8 @@ good:
|
||||||
CPUID
|
CPUID
|
||||||
================
|
================
|
||||||
*/
|
*/
|
||||||
|
// RB: no checks on Win64
|
||||||
|
#if !defined(_WIN64)
|
||||||
static void CPUID( int func, unsigned regs[4] ) {
|
static void CPUID( int func, unsigned regs[4] ) {
|
||||||
unsigned regEAX, regEBX, regECX, regEDX;
|
unsigned regEAX, regEBX, regECX, regEDX;
|
||||||
|
|
||||||
|
@ -211,13 +218,15 @@ static void CPUID( int func, unsigned regs[4] ) {
|
||||||
regs[_REG_ECX] = regECX;
|
regs[_REG_ECX] = regECX;
|
||||||
regs[_REG_EDX] = regEDX;
|
regs[_REG_EDX] = regEDX;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
================
|
================
|
||||||
IsAMD
|
IsAMD
|
||||||
================
|
================
|
||||||
*/
|
*/
|
||||||
|
// RB: no checks on Win64
|
||||||
|
#if !defined(_WIN64)
|
||||||
static bool IsAMD() {
|
static bool IsAMD() {
|
||||||
char pstring[16];
|
char pstring[16];
|
||||||
char processorString[13];
|
char processorString[13];
|
||||||
|
@ -243,12 +252,15 @@ static bool IsAMD() {
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
================
|
================
|
||||||
HasCMOV
|
HasCMOV
|
||||||
================
|
================
|
||||||
*/
|
*/
|
||||||
|
// RB: no checks on Win64
|
||||||
|
#if !defined(_WIN64)
|
||||||
static bool HasCMOV() {
|
static bool HasCMOV() {
|
||||||
unsigned regs[4];
|
unsigned regs[4];
|
||||||
|
|
||||||
|
@ -261,12 +273,15 @@ static bool HasCMOV() {
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
================
|
================
|
||||||
Has3DNow
|
Has3DNow
|
||||||
================
|
================
|
||||||
*/
|
*/
|
||||||
|
// RB: no checks on Win64
|
||||||
|
#if !defined(_WIN64)
|
||||||
static bool Has3DNow() {
|
static bool Has3DNow() {
|
||||||
unsigned regs[4];
|
unsigned regs[4];
|
||||||
|
|
||||||
|
@ -284,12 +299,15 @@ static bool Has3DNow() {
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
================
|
================
|
||||||
HasMMX
|
HasMMX
|
||||||
================
|
================
|
||||||
*/
|
*/
|
||||||
|
// RB: no checks on Win64
|
||||||
|
#if !defined(_WIN64)
|
||||||
static bool HasMMX() {
|
static bool HasMMX() {
|
||||||
unsigned regs[4];
|
unsigned regs[4];
|
||||||
|
|
||||||
|
@ -302,12 +320,15 @@ static bool HasMMX() {
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
================
|
================
|
||||||
HasSSE
|
HasSSE
|
||||||
================
|
================
|
||||||
*/
|
*/
|
||||||
|
// RB: no checks on Win64
|
||||||
|
#if !defined(_WIN64)
|
||||||
static bool HasSSE() {
|
static bool HasSSE() {
|
||||||
unsigned regs[4];
|
unsigned regs[4];
|
||||||
|
|
||||||
|
@ -320,12 +341,15 @@ static bool HasSSE() {
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
================
|
================
|
||||||
HasSSE2
|
HasSSE2
|
||||||
================
|
================
|
||||||
*/
|
*/
|
||||||
|
// RB: no checks on Win64
|
||||||
|
#if !defined(_WIN64)
|
||||||
static bool HasSSE2() {
|
static bool HasSSE2() {
|
||||||
unsigned regs[4];
|
unsigned regs[4];
|
||||||
|
|
||||||
|
@ -338,12 +362,15 @@ static bool HasSSE2() {
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
================
|
================
|
||||||
HasSSE3
|
HasSSE3
|
||||||
================
|
================
|
||||||
*/
|
*/
|
||||||
|
// RB: no checks on Win64
|
||||||
|
#if !defined(_WIN64)
|
||||||
static bool HasSSE3() {
|
static bool HasSSE3() {
|
||||||
unsigned regs[4];
|
unsigned regs[4];
|
||||||
|
|
||||||
|
@ -356,12 +383,15 @@ static bool HasSSE3() {
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
================
|
================
|
||||||
LogicalProcPerPhysicalProc
|
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
|
#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
|
// processors per physical processor when execute cpuid with
|
||||||
// eax set to 1
|
// eax set to 1
|
||||||
|
@ -374,12 +404,15 @@ static unsigned char LogicalProcPerPhysicalProc() {
|
||||||
}
|
}
|
||||||
return (unsigned char) ((regebx & NUM_LOGICAL_BITS) >> 16);
|
return (unsigned char) ((regebx & NUM_LOGICAL_BITS) >> 16);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
================
|
================
|
||||||
GetAPIC_ID
|
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
|
#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.
|
// initial APIC ID for the processor this code is running on.
|
||||||
// Default value = 0xff if HT is not supported
|
// 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);
|
return (unsigned char) ((regebx & INITIAL_APIC_ID_BITS) >> 24);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
================
|
================
|
||||||
|
@ -402,6 +436,8 @@ CPUCount
|
||||||
returns one of the HT_* flags
|
returns one of the HT_* flags
|
||||||
================
|
================
|
||||||
*/
|
*/
|
||||||
|
// RB: no checks on Win64
|
||||||
|
#if !defined(_WIN64)
|
||||||
#define HT_NOT_CAPABLE 0
|
#define HT_NOT_CAPABLE 0
|
||||||
#define HT_ENABLED 1
|
#define HT_ENABLED 1
|
||||||
#define HT_DISABLED 2
|
#define HT_DISABLED 2
|
||||||
|
@ -493,12 +529,15 @@ int CPUCount( int &logicalNum, int &physicalNum ) {
|
||||||
}
|
}
|
||||||
return statusFlag;
|
return statusFlag;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
================
|
================
|
||||||
HasHTT
|
HasHTT
|
||||||
================
|
================
|
||||||
*/
|
*/
|
||||||
|
// RB: no checks on Win64
|
||||||
|
#if !defined(_WIN64)
|
||||||
static bool HasHTT() {
|
static bool HasHTT() {
|
||||||
unsigned regs[4];
|
unsigned regs[4];
|
||||||
int logicalNum, physicalNum, HTStatusFlag;
|
int logicalNum, physicalNum, HTStatusFlag;
|
||||||
|
@ -517,12 +556,15 @@ static bool HasHTT() {
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
================
|
================
|
||||||
HasHTT
|
HasDAZ
|
||||||
================
|
================
|
||||||
*/
|
*/
|
||||||
|
// RB: no checks on Win64
|
||||||
|
#if !defined(_WIN64)
|
||||||
static bool HasDAZ() {
|
static bool HasDAZ() {
|
||||||
__declspec(align(16)) unsigned char FXSaveArea[512];
|
__declspec(align(16)) unsigned char FXSaveArea[512];
|
||||||
unsigned char *FXArea = FXSaveArea;
|
unsigned char *FXArea = FXSaveArea;
|
||||||
|
@ -547,6 +589,7 @@ static bool HasDAZ() {
|
||||||
dwMask = *(DWORD *)&FXArea[28]; // Read the MXCSR Mask
|
dwMask = *(DWORD *)&FXArea[28]; // Read the MXCSR Mask
|
||||||
return ( ( dwMask & ( 1 << 6 ) ) == ( 1 << 6 ) ); // Return if the DAZ bit is set
|
return ( ( dwMask & ( 1 << 6 ) ) == ( 1 << 6 ) ); // Return if the DAZ bit is set
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
================================================================================================
|
================================================================================================
|
||||||
|
@ -726,11 +769,21 @@ void Sys_CPUCount( int & numLogicalCPUCores, int & numPhysicalCPUCores, int & nu
|
||||||
Sys_GetCPUId
|
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;
|
int flags;
|
||||||
|
|
||||||
// verify we're at least a Pentium or 486 with CPUID support
|
// verify we're at least a Pentium or 486 with CPUID support
|
||||||
if ( !HasCPUID() ) {
|
if ( !HasCPUID() ){
|
||||||
return CPUID_UNSUPPORTED;
|
return CPUID_UNSUPPORTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -782,6 +835,7 @@ cpuid_t Sys_GetCPUId() {
|
||||||
}
|
}
|
||||||
|
|
||||||
return (cpuid_t)flags;
|
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
|
Sys_FPU_StackIsEmpty
|
||||||
===============
|
===============
|
||||||
*/
|
*/
|
||||||
bool Sys_FPU_StackIsEmpty() {
|
bool Sys_FPU_StackIsEmpty()
|
||||||
|
{
|
||||||
|
#if !defined(_WIN64)
|
||||||
__asm {
|
__asm {
|
||||||
mov eax, statePtr
|
mov eax, statePtr
|
||||||
fnstenv [eax]
|
fnstenv [eax]
|
||||||
|
@ -886,6 +942,7 @@ bool Sys_FPU_StackIsEmpty() {
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
empty:
|
empty:
|
||||||
|
#endif
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -894,7 +951,9 @@ empty:
|
||||||
Sys_FPU_ClearStack
|
Sys_FPU_ClearStack
|
||||||
===============
|
===============
|
||||||
*/
|
*/
|
||||||
void Sys_FPU_ClearStack() {
|
void Sys_FPU_ClearStack()
|
||||||
|
{
|
||||||
|
#if !defined(_WIN64)
|
||||||
__asm {
|
__asm {
|
||||||
mov eax, statePtr
|
mov eax, statePtr
|
||||||
fnstenv [eax]
|
fnstenv [eax]
|
||||||
|
@ -910,6 +969,7 @@ void Sys_FPU_ClearStack() {
|
||||||
jmp emptyStack
|
jmp emptyStack
|
||||||
done:
|
done:
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -919,7 +979,11 @@ Sys_FPU_GetState
|
||||||
gets the FPU state without changing the state
|
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 fpuStack[8] = { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 };
|
||||||
double *fpuStackPtr = fpuStack;
|
double *fpuStackPtr = fpuStack;
|
||||||
int i, numValues;
|
int i, numValues;
|
||||||
|
@ -1016,6 +1080,7 @@ const char *Sys_FPU_GetState() {
|
||||||
Sys_FPU_PrintStateFlags( ptr, ctrl, stat, tags, inof, inse, opof, opse );
|
Sys_FPU_PrintStateFlags( ptr, ctrl, stat, tags, inof, inse, opof, opse );
|
||||||
|
|
||||||
return fpuString;
|
return fpuString;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1023,7 +1088,9 @@ const char *Sys_FPU_GetState() {
|
||||||
Sys_FPU_EnableExceptions
|
Sys_FPU_EnableExceptions
|
||||||
===============
|
===============
|
||||||
*/
|
*/
|
||||||
void Sys_FPU_EnableExceptions( int exceptions ) {
|
void Sys_FPU_EnableExceptions( int exceptions )
|
||||||
|
{
|
||||||
|
#if !defined(_WIN64)
|
||||||
__asm {
|
__asm {
|
||||||
mov eax, statePtr
|
mov eax, statePtr
|
||||||
mov ecx, exceptions
|
mov ecx, exceptions
|
||||||
|
@ -1036,6 +1103,7 @@ void Sys_FPU_EnableExceptions( int exceptions ) {
|
||||||
mov word ptr [eax], bx
|
mov word ptr [eax], bx
|
||||||
fldcw word ptr [eax]
|
fldcw word ptr [eax]
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1043,7 +1111,9 @@ void Sys_FPU_EnableExceptions( int exceptions ) {
|
||||||
Sys_FPU_SetPrecision
|
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 precisionBitTable[4] = { 0, 1, 3, 0 };
|
||||||
short precisionBits = precisionBitTable[precision & 3] << 8;
|
short precisionBits = precisionBitTable[precision & 3] << 8;
|
||||||
short precisionMask = ~( ( 1 << 9 ) | ( 1 << 8 ) );
|
short precisionMask = ~( ( 1 << 9 ) | ( 1 << 8 ) );
|
||||||
|
@ -1058,6 +1128,7 @@ void Sys_FPU_SetPrecision( int precision ) {
|
||||||
mov word ptr [eax], bx
|
mov word ptr [eax], bx
|
||||||
fldcw word ptr [eax]
|
fldcw word ptr [eax]
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1065,7 +1136,9 @@ void Sys_FPU_SetPrecision( int precision ) {
|
||||||
Sys_FPU_SetRounding
|
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 roundingBitTable[4] = { 0, 1, 2, 3 };
|
||||||
short roundingBits = roundingBitTable[rounding & 3] << 10;
|
short roundingBits = roundingBitTable[rounding & 3] << 10;
|
||||||
short roundingMask = ~( ( 1 << 11 ) | ( 1 << 10 ) );
|
short roundingMask = ~( ( 1 << 11 ) | ( 1 << 10 ) );
|
||||||
|
@ -1080,6 +1153,7 @@ void Sys_FPU_SetRounding( int rounding ) {
|
||||||
mov word ptr [eax], bx
|
mov word ptr [eax], bx
|
||||||
fldcw word ptr [eax]
|
fldcw word ptr [eax]
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1087,7 +1161,9 @@ void Sys_FPU_SetRounding( int rounding ) {
|
||||||
Sys_FPU_SetDAZ
|
Sys_FPU_SetDAZ
|
||||||
================
|
================
|
||||||
*/
|
*/
|
||||||
void Sys_FPU_SetDAZ( bool enable ) {
|
void Sys_FPU_SetDAZ( bool enable )
|
||||||
|
{
|
||||||
|
#if !defined(_WIN64)
|
||||||
DWORD dwData;
|
DWORD dwData;
|
||||||
|
|
||||||
_asm {
|
_asm {
|
||||||
|
@ -1101,6 +1177,7 @@ void Sys_FPU_SetDAZ( bool enable ) {
|
||||||
mov dwData, eax
|
mov dwData, eax
|
||||||
LDMXCSR dword ptr dwData
|
LDMXCSR dword ptr dwData
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1108,7 +1185,9 @@ void Sys_FPU_SetDAZ( bool enable ) {
|
||||||
Sys_FPU_SetFTZ
|
Sys_FPU_SetFTZ
|
||||||
================
|
================
|
||||||
*/
|
*/
|
||||||
void Sys_FPU_SetFTZ( bool enable ) {
|
void Sys_FPU_SetFTZ( bool enable )
|
||||||
|
{
|
||||||
|
#if !defined(_WIN64)
|
||||||
DWORD dwData;
|
DWORD dwData;
|
||||||
|
|
||||||
_asm {
|
_asm {
|
||||||
|
@ -1122,4 +1201,5 @@ void Sys_FPU_SetFTZ( bool enable ) {
|
||||||
mov dwData, eax
|
mov dwData, eax
|
||||||
LDMXCSR dword ptr dwData
|
LDMXCSR dword ptr dwData
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
@ -585,7 +585,9 @@ Sys_ListFiles
|
||||||
int Sys_ListFiles( const char *directory, const char *extension, idStrList &list ) {
|
int Sys_ListFiles( const char *directory, const char *extension, idStrList &list ) {
|
||||||
idStr search;
|
idStr search;
|
||||||
struct _finddata_t findinfo;
|
struct _finddata_t findinfo;
|
||||||
int findhandle;
|
// RB: 64 bit fixes, changed int to intptr_t
|
||||||
|
intptr_t findhandle;
|
||||||
|
// RB end
|
||||||
int flag;
|
int flag;
|
||||||
|
|
||||||
if ( !extension) {
|
if ( !extension) {
|
||||||
|
@ -862,7 +864,9 @@ DLL Loading
|
||||||
Sys_DLL_Load
|
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 );
|
HINSTANCE libHandle = LoadLibrary( dllName );
|
||||||
return (int)libHandle;
|
return (int)libHandle;
|
||||||
}
|
}
|
||||||
|
@ -872,7 +876,8 @@ int Sys_DLL_Load( const char *dllName ) {
|
||||||
Sys_DLL_GetProcAddress
|
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
|
// RB: added missing cast
|
||||||
return ( void* ) GetProcAddress( (HINSTANCE)dllHandle, procName );
|
return ( void* ) GetProcAddress( (HINSTANCE)dllHandle, procName );
|
||||||
}
|
}
|
||||||
|
@ -882,11 +887,15 @@ void *Sys_DLL_GetProcAddress( int dllHandle, const char *procName ) {
|
||||||
Sys_DLL_Unload
|
Sys_DLL_Unload
|
||||||
=====================
|
=====================
|
||||||
*/
|
*/
|
||||||
void Sys_DLL_Unload( int dllHandle ) {
|
void Sys_DLL_Unload( intptr_t dllHandle )
|
||||||
if ( !dllHandle ) {
|
{
|
||||||
|
if( !dllHandle )
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if ( FreeLibrary( (HINSTANCE)dllHandle ) == 0 ) {
|
|
||||||
|
if( FreeLibrary( (HINSTANCE)dllHandle ) == 0 )
|
||||||
|
{
|
||||||
int lastError = GetLastError();
|
int lastError = GetLastError();
|
||||||
LPVOID lpMsgBuf;
|
LPVOID lpMsgBuf;
|
||||||
FormatMessage(
|
FormatMessage(
|
||||||
|
@ -898,9 +907,11 @@ void Sys_DLL_Unload( int dllHandle ) {
|
||||||
0,
|
0,
|
||||||
NULL
|
NULL
|
||||||
);
|
);
|
||||||
|
|
||||||
Sys_Error( "Sys_DLL_Unload: FreeLibrary failed - %s (%d)", lpMsgBuf, lastError );
|
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
|
// 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 );
|
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 );
|
win32.hInstance, NULL );
|
||||||
SendMessage( s_wcd.hwndBuffer, WM_SETFONT, ( WPARAM ) s_wcd.hfBufferFont, 0 );
|
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 );
|
SendMessage( s_wcd.hwndInputLine, WM_SETFONT, ( WPARAM ) s_wcd.hfBufferFont, 0 );
|
||||||
|
|
||||||
// don't show it now that we have a splash screen up
|
// don't show it now that we have a splash screen up
|
||||||
|
|
Loading…
Reference in a new issue