From f2b8c4984e3611fd98cc0fbebbdc2082dbb08ff2 Mon Sep 17 00:00:00 2001 From: Maciek Baron Date: Sat, 3 May 2014 18:13:10 +0100 Subject: [PATCH 1/4] Adding more possible locations for config.c --- src/config.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/config.c b/src/config.c index abebb81887..b8d87fff98 100644 --- a/src/config.c +++ b/src/config.c @@ -192,6 +192,10 @@ static int config_find_rct2_path(char *resultPath) const char *searchLocations[] = { "C:\\Program Files\\Infogrames\\RollerCoaster Tycoon 2", "C:\\Program Files (x86)\\Infogrames\\RollerCoaster Tycoon 2", + "C:\\Program Files\\Infogrames Interactive\\RollerCoaster Tycoon 2", + "C:\\Program Files (x86)\\Infogrames Interactive\\RollerCoaster Tycoon 2", + "C:\\Program Files\\Atari\\RollerCoaster Tycoon 2", + "C:\\Program Files (x86)\\Atari\\RollerCoaster Tycoon 2", "C:\\GOG Games\\RollerCoaster Tycoon 2 Triple Thrill Pack" }; From 61238c70f35436bcb58d0b824950c98f0a6197e5 Mon Sep 17 00:00:00 2001 From: Maciek Baron Date: Sun, 4 May 2014 16:16:03 +0100 Subject: [PATCH 2/4] Removing dupe address, adding OS hour and minute --- src/addresses.h | 5 +++-- src/config.c | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/addresses.h b/src/addresses.h index c6a9bd19a6..1bda37ad07 100644 --- a/src/addresses.h +++ b/src/addresses.h @@ -210,9 +210,10 @@ #define RCT2_ADDRESS_VIEWPORT_LIST 0x014234BC #define RCT2_ADDRESS_NEW_VIEWPORT_PTR 0x01423570 -#define RCT2_ADDRESS_OS_TIME_MONTH 0x01423A04 -#define RCT2_ADDRESS_OS_TOTALPHYS 0x01423B5C +#define RCT2_ADDRESS_OS_TIME_MINUTE 0x01424654 +#define RCT2_ADDRESS_OS_TIME_HOUR 0x01424656 #define RCT2_ADDRESS_OS_TIME_DAY 0x01424304 +#define RCT2_ADDRESS_OS_TIME_MONTH 0x01423A04 #define RCT2_ADDRESS_OS_TIME_YEAR 0x01424320 #define RCT2_ADDRESS_OS_TIME_DAYOFWEEK 0x01423B20 diff --git a/src/config.c b/src/config.c index b8d87fff98..951630cb8d 100644 --- a/src/config.c +++ b/src/config.c @@ -109,9 +109,9 @@ void config_load() } RCT2_GLOBAL(0x009AAC77, sint8) = 0; - if (RCT2_GLOBAL(RCT2_ADDRESS_OS_TOTALPHYS, uint32) > 0x4000000) { + if (RCT2_GLOBAL(RCT2_ADDRESS_MEM_TOTAL_PHYSICAL, uint32) > 0x4000000) { RCT2_GLOBAL(0x009AAC77, sint8) = 1; - if (RCT2_GLOBAL(RCT2_ADDRESS_OS_TOTALPHYS, uint32) > 0x8000000) + if (RCT2_GLOBAL(RCT2_ADDRESS_MEM_TOTAL_PHYSICAL, uint32) > 0x8000000) RCT2_GLOBAL(0x009AAC77, sint8) = 2; } From 0477e2803b45a5ac7eef0767767aa3dda5452314 Mon Sep 17 00:00:00 2001 From: Maciek Baron Date: Sun, 4 May 2014 16:31:32 +0100 Subject: [PATCH 3/4] Implementing get_local_time() --- src/rct2.c | 16 +++++++++++++++- src/rct2.h | 1 + 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/rct2.c b/src/rct2.c index fa49f9d794..63f36fc196 100644 --- a/src/rct2.c +++ b/src/rct2.c @@ -122,7 +122,8 @@ void rct2_init() RCT2_CALLPROC_EBPSAFE(0x006BA8E0); // init_audio(); viewport_init_all(); news_item_init_queue(); - RCT2_CALLPROC_EBPSAFE(0x006C45E7); // get local time + get_local_time(); + OutputDebugString(s); RCT2_CALLPROC_EBPSAFE(0x00667104); RCT2_CALLPROC_EBPSAFE(0x006C4209); RCT2_CALLPROC_EBPSAFE(0x0069EB13); @@ -376,6 +377,19 @@ void get_system_time() RCT2_GLOBAL(RCT2_ADDRESS_OS_TIME_DAYOFWEEK, sint16) = systime.wDayOfWeek; } +/** + * Obtains os local time (hour and minute) + * rct2: 0x006C45E7; + */ +void get_local_time() +{ + SYSTEMTIME systime; + GetLocalTime(&systime); + + RCT2_GLOBAL(RCT2_ADDRESS_OS_TIME_HOUR, sint16) = systime.wHour; + RCT2_GLOBAL(RCT2_ADDRESS_OS_TIME_MINUTE, sint16) = systime.wMinute; +} + /** * RCT2 and this DLL can not free each other's allocated memory blocks. Use this to allocate memory if RCT2 is still able to * free it. diff --git a/src/rct2.h b/src/rct2.h index 2d4d479daa..d0a75a23ed 100644 --- a/src/rct2.h +++ b/src/rct2.h @@ -126,6 +126,7 @@ void rct2_endupdate(); char *get_file_path(int pathId); void get_system_info(); void get_system_time(); +void get_local_time(); void *rct2_malloc(size_t numBytes); void *rct2_realloc(void *block, size_t numBytes); void rct2_free(void *block); From cde954ba637db7b8f0b8a397780edf85da68a0ee Mon Sep 17 00:00:00 2001 From: Maciek Baron Date: Sun, 4 May 2014 16:34:35 +0100 Subject: [PATCH 4/4] Removing leftover debug code --- src/rct2.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/rct2.c b/src/rct2.c index 63f36fc196..7cffc413be 100644 --- a/src/rct2.c +++ b/src/rct2.c @@ -123,7 +123,6 @@ void rct2_init() viewport_init_all(); news_item_init_queue(); get_local_time(); - OutputDebugString(s); RCT2_CALLPROC_EBPSAFE(0x00667104); RCT2_CALLPROC_EBPSAFE(0x006C4209); RCT2_CALLPROC_EBPSAFE(0x0069EB13);