mirror of https://github.com/OpenRCT2/OpenRCT2.git
decompile get_system_info()
This commit is contained in:
parent
d9f0225ee7
commit
0760dab657
|
@ -68,6 +68,8 @@
|
|||
#define RCT2_ADDRESS_SCREEN_DPI 0x009ABDC8
|
||||
#define RCT2_ADDRESS_SCREEN_WIDTH 0x009ABDD8
|
||||
#define RCT2_ADDRESS_SCREEN_HEIGHT 0x009ABDDA
|
||||
#define RCT2_ADDRESS_SCREEN_CAP_BPP 0x01423C10
|
||||
#define RCT2_ADDRESS_SCREEN_CAP_RASTER_STRETCH 0x01423C14
|
||||
|
||||
#define RCT2_ADDRESS_DIRTY_BLOCK_WIDTH 0x009ABDE4
|
||||
#define RCT2_ADDRESS_DIRTY_BLOCK_HEIGHT 0x009ABDE6
|
||||
|
@ -188,6 +190,23 @@
|
|||
#define RCT2_ADDRESS_OS_TIME_YEAR 0x01424320
|
||||
#define RCT2_ADDRESS_OS_TIME_DAYOFWEEK 0x01423B20
|
||||
|
||||
#define RCT2_ADDRESS_OS_PLATFORM_ID 0x01423B40
|
||||
#define RCT2_ADDRESS_OS_MAJOR_VERSION 0x01423B44
|
||||
#define RCT2_ADDRESS_OS_MINOR_VERSION 0x01423B48
|
||||
#define RCT2_ADDRESS_OS_BUILD_NUMBER 0x01423B4C
|
||||
#define RCT2_ADDRESS_OS_USER_NAME 0x01423B68
|
||||
#define RCT2_ADDRESS_OS_COMPUTER_NAME 0x01423BB8
|
||||
|
||||
#define RCT2_ADDRESS_SYS_OEM_ID 0x01423B50
|
||||
#define RCT2_ADDRESS_SYS_CPU_LEVEL 0x01423B52
|
||||
#define RCT2_ADDRESS_SYS_CPU_REVISION 0x01423B54
|
||||
#define RCT2_ADDRESS_SYS_CPU_NUMBER 0x01423B58
|
||||
|
||||
#define RCT2_ADDRESS_MEM_TOTAL_PHYSICAL 0x01423B5C
|
||||
#define RCT2_ADDRESS_MEM_TOTAL_PAGEFILE 0x01423B60
|
||||
#define RCT2_ADDRESS_MEM_TOTAL_VIRTUAL 0x01423B64
|
||||
|
||||
|
||||
static void RCT2_CALLPROC_EBPSAFE(int address)
|
||||
{
|
||||
__asm push ebp
|
||||
|
|
68
src/rct2.c
68
src/rct2.c
|
@ -66,7 +66,7 @@ __declspec(dllexport) int StartOpenRCT(HINSTANCE hInstance, HINSTANCE hPrevInsta
|
|||
{
|
||||
RCT2_GLOBAL(0x01423A08, HINSTANCE) = hInstance;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_CMDLINE, LPSTR) = lpCmdLine;
|
||||
RCT2_CALLPROC(0x004076B1); // get_system_info()
|
||||
get_system_info();
|
||||
RCT2_CALLPROC(0x0040502E); // get_dsound_devices()
|
||||
|
||||
rct2_init();
|
||||
|
@ -240,6 +240,72 @@ char *get_file_path(int pathId)
|
|||
return (char*)ebx;
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtains basic system versions and capabilities.
|
||||
* rct2: 0x004076B1
|
||||
*/
|
||||
void get_system_info()
|
||||
{
|
||||
OSVERSIONINFO versionInfo;
|
||||
SYSTEM_INFO sysInfo;
|
||||
MEMORYSTATUS memInfo;
|
||||
|
||||
versionInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
|
||||
if (GetVersionEx(&versionInfo)){
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_OS_PLATFORM_ID, uint32) = versionInfo.dwPlatformId;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_OS_MAJOR_VERSION, uint32) = versionInfo.dwMajorVersion;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_OS_MINOR_VERSION, uint32) = versionInfo.dwMinorVersion;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_OS_BUILD_NUMBER, uint32) = versionInfo.dwBuildNumber;
|
||||
}
|
||||
else{
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_OS_PLATFORM_ID, uint32) = -1;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_OS_MAJOR_VERSION, uint32) = 0;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_OS_MINOR_VERSION, uint32) = 0;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_OS_BUILD_NUMBER, uint32) = 0;
|
||||
}
|
||||
|
||||
GetSystemInfo(&sysInfo);
|
||||
// RCT2 only has 2 bytes reserved for OEM_ID even though it should be a DWORD
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_SYS_OEM_ID, uint16) = sysInfo.dwOemId;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_SYS_CPU_LEVEL, uint16) = sysInfo.wProcessorLevel;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_SYS_CPU_REVISION, uint16) = sysInfo.wProcessorRevision;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_SYS_CPU_NUMBER, uint32) = sysInfo.dwNumberOfProcessors;
|
||||
|
||||
GlobalMemoryStatus(&memInfo);
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_MEM_TOTAL_PHYSICAL, uint32) = memInfo.dwTotalPhys;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_MEM_TOTAL_PAGEFILE, uint32) = memInfo.dwTotalPageFile;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_MEM_TOTAL_VIRTUAL, uint32) = memInfo.dwTotalVirtual;
|
||||
|
||||
uint32 size = 80;
|
||||
GetUserName(RCT2_ADDRESS_OS_USER_NAME, &size);
|
||||
size = 80;
|
||||
GetComputerName(RCT2_ADDRESS_OS_COMPUTER_NAME, &size);
|
||||
|
||||
// Screen Display Width/Height but RCT_ADDRESS_SCREEN_HEIGHT/WIDTH already taken?
|
||||
RCT2_GLOBAL(0x01423C08, sint32) = GetSystemMetrics(SM_CXSCREEN);
|
||||
RCT2_GLOBAL(0x01423C0C, sint32) = GetSystemMetrics(SM_CYSCREEN);
|
||||
|
||||
HDC screenHandle = GetDC(NULL);
|
||||
if (screenHandle){
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_CAP_BPP, sint32) = GetDeviceCaps(screenHandle, BITSPIXEL);
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_CAP_RASTER_STRETCH, sint32) = GetDeviceCaps(screenHandle, RASTERCAPS) >> 8;
|
||||
ReleaseDC(NULL, screenHandle);
|
||||
}
|
||||
else{
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_CAP_BPP, sint32) = 0;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_CAP_RASTER_STRETCH, sint32) = 0;
|
||||
}
|
||||
|
||||
RCT2_GLOBAL(0x01423C1C, uint32) = (RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_CAP_BPP, sint32) >= 8);
|
||||
if (RCT2_GLOBAL(RCT2_ADDRESS_OS_MAJOR_VERSION, uint32) < 4 || RCT2_GLOBAL(0x1423C10, sint32) < 4)
|
||||
RCT2_GLOBAL(0x1423C18, sint32) = 0;
|
||||
else
|
||||
RCT2_GLOBAL(0x1423C18, sint32) = 1;
|
||||
|
||||
RCT2_GLOBAL(0x01423C20, uint32) = RCT2_CALLFUNC(0x406993, uint32); // cpu_has_mmx()
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Obtains os system time (day, month, year and day of the week).
|
||||
* rct2: 0x00407671
|
||||
|
|
|
@ -128,6 +128,7 @@ enum {
|
|||
|
||||
void rct2_endupdate();
|
||||
char *get_file_path(int pathId);
|
||||
void get_system_info();
|
||||
void get_system_time();
|
||||
void *rct2_malloc(size_t numBytes);
|
||||
void *rct2_realloc(void *block, size_t numBytes);
|
||||
|
|
Loading…
Reference in New Issue