iw4x-client/src/STDInclude.cpp

116 lines
2.9 KiB
C++
Raw Normal View History

#include "STDInclude.hpp"
2016-02-18 17:55:28 -05:00
// Rename sections
2016-06-12 06:30:48 -04:00
#ifndef DEBUG
2016-09-15 14:49:00 -04:00
#pragma comment(linker, "/merge:.text=.UPX0")
#pragma comment(linker, "/merge:.data=.UPX1")
#pragma comment(linker, "/merge:.rdata=.UPX2")
#pragma comment(linker, "/merge:.tls=.UPX3")
#pragma comment(linker, "/merge:.gfids=.UPX4")
2016-06-12 06:30:48 -04:00
#endif
2016-02-18 17:55:28 -05:00
2016-09-15 14:49:00 -04:00
#pragma comment(linker,"\"/manifestdependency:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
// Do necessary assertions here
2016-01-24 06:56:38 -05:00
// Some compilers treat them differently which causes a size mismatch
// WinAPI types
AssertSize(DWORD, 4);
AssertSize(WORD, 2);
AssertSize(BYTE, 1);
2016-09-05 15:58:59 -04:00
// 128 bit integers (only x64)
//AssertSize(__int128, 16);
//AssertSize(unsigned __int128, 16);
2016-09-05 15:58:59 -04:00
2016-01-24 06:56:38 -05:00
// 64 bit integers
AssertSize(__int64, 8);
AssertSize(unsigned __int64, 8);
AssertSize(long long, 8);
AssertSize(unsigned long long, 8);
AssertSize(int64_t, 8);
AssertSize(uint64_t, 8);
AssertSize(std::int64_t, 8);
AssertSize(std::uint64_t, 8);
2016-01-24 06:56:38 -05:00
2017-04-16 06:31:16 -04:00
// 64 bit double precision floating point numbers
AssertSize(double, 8);
2016-01-24 06:56:38 -05:00
// 32 bit integers
AssertSize(__int32, 4);
AssertSize(unsigned __int32, 4);
AssertSize(int, 4);
AssertSize(unsigned int, 4);
2017-04-16 06:31:16 -04:00
AssertSize(long, 4);
AssertSize(unsigned long, 4);
AssertSize(int32_t, 4);
AssertSize(uint32_t, 4);
AssertSize(std::int32_t, 4);
AssertSize(std::uint32_t, 4);
2016-01-24 06:56:38 -05:00
2017-04-16 06:31:16 -04:00
// 32 bit single precision floating point numbers
AssertSize(float, 4);
2016-01-24 06:56:38 -05:00
// 16 bit integers
AssertSize(__int16, 2);
AssertSize(unsigned __int16, 2);
AssertSize(short, 2);
AssertSize(unsigned short, 2);
AssertSize(int16_t, 2);
AssertSize(uint16_t, 2);
AssertSize(std::int16_t, 2);
AssertSize(std::uint16_t, 2);
2016-01-24 06:56:38 -05:00
// 8 bit integers
AssertSize(bool, 1);
AssertSize(__int8, 1);
AssertSize(unsigned __int8, 1);
AssertSize(char, 1);
AssertSize(unsigned char, 1);
AssertSize(int8_t, 1);
AssertSize(uint8_t, 1);
AssertSize(std::int8_t, 1);
AssertSize(std::uint8_t, 1);
2016-01-24 06:56:38 -05:00
// Ensure pointers are 4 bytes in size (32-bit)
2017-04-16 06:31:16 -04:00
// ReSharper disable CppRedundantBooleanExpressionArgument
2016-01-24 06:56:38 -05:00
static_assert(sizeof(intptr_t) == 4 && sizeof(void*) == 4 && sizeof(size_t) == 4, "This doesn't seem to be a 32-bit environment!");
2017-04-16 06:31:16 -04:00
// ReSharper restore CppRedundantBooleanExpressionArgument
2016-06-12 06:13:31 -04:00
2017-02-22 03:59:30 -05:00
#if !defined(_M_IX86)
#error "Invalid processor achritecture!"
#endif
2016-06-12 06:13:31 -04:00
extern "C"
{
2016-10-12 04:46:59 -04:00
// Disable telemetry data logging
2016-09-05 15:58:59 -04:00
void __cdecl __vcrt_initialize_telemetry_provider() {}
void __cdecl __telemetry_main_invoke_trigger() {}
void __cdecl __telemetry_main_return_trigger() {}
void __cdecl __vcrt_uninitialize_telemetry_provider() {}
2016-10-12 04:46:59 -04:00
// Enable 'High Performance Graphics'
__declspec(dllexport) DWORD NvOptimusEnablement = 0x00000001;
2019-12-25 13:59:20 -05:00
// Tommath fixes
int s_read_arc4random(void*, size_t)
{
return -1;
}
int s_read_getrandom(void*, size_t)
{
return -1;
}
int s_read_urandom(void*, size_t)
{
return -1;
}
int s_read_ltm_rng(void*, size_t)
{
return -1;
}
2016-06-12 06:13:31 -04:00
};