diff --git a/projects/openrct2.vcxproj b/projects/openrct2.vcxproj index 7472f7d0d7..b465019dce 100644 --- a/projects/openrct2.vcxproj +++ b/projects/openrct2.vcxproj @@ -17,6 +17,7 @@ + @@ -36,6 +37,7 @@ + diff --git a/projects/openrct2.vcxproj.filters b/projects/openrct2.vcxproj.filters index 4209140061..36375bdd23 100644 --- a/projects/openrct2.vcxproj.filters +++ b/projects/openrct2.vcxproj.filters @@ -72,6 +72,9 @@ Header Files + + Header Files + @@ -131,6 +134,9 @@ Source Files + + Source Files + diff --git a/src/addresses.h b/src/addresses.h index 81b30ebdea..e80b0525d8 100644 --- a/src/addresses.h +++ b/src/addresses.h @@ -44,6 +44,9 @@ #define RCT2_ADDRESS_NUM_SCENARIOS 0x009AA008 #define RCT2_ADDRESS_APP_PATH 0x009AA214 + +#define RCT2_ADDRESS_OPTION_FAHRENHEIT 0x009AAC79 + #define RCT2_ADDRESS_APP_PATH_SLASH 0x009AB4D9 #define RCT2_ADDRESS_SAVED_GAMES_PATH 0x009AB5DA #define RCT2_ADDRESS_SCENARIOS_PATH 0x009AB6E9 diff --git a/src/config.c b/src/config.c new file mode 100644 index 0000000000..64ef5501d6 --- /dev/null +++ b/src/config.c @@ -0,0 +1,66 @@ +/***************************************************************************** + * Copyright (c) 2014 Ted John + * OpenRCT2, an open source clone of Roller Coaster Tycoon 2. + * + * This file is part of OpenRCT2. + * + * OpenRCT2 is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + *****************************************************************************/ + +#include +#include "addresses.h" +#include "config.h" +#include "rct2.h" + +void config_load() +{ + HANDLE hFile; + DWORD bytes_read; + + hFile = CreateFile(get_file_path(PATH_ID_GAMECFG), GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, + FILE_FLAG_RANDOM_ACCESS | FILE_ATTRIBUTE_NORMAL, NULL); + if (hFile != INVALID_HANDLE_VALUE) { + // Read and check magic number + ReadFile(hFile, RCT2_ADDRESS(0x013CE928, void), 4, &bytes_read, NULL); + if (RCT2_GLOBAL(0x013CE928, int) == 0x0003113A) { + // Read options + ReadFile(hFile, (void*)0x009AAC5C, 2155, &bytes_read, NULL); + CloseHandle(hFile); + if (RCT2_GLOBAL(0x009AB4C6, sint8) == 1) + return; + RCT2_GLOBAL(0x009AB4C6, sint8) = 1; + RCT2_GLOBAL(0x009AAC78, sint8) = 0; + RCT2_GLOBAL(RCT2_ADDRESS_OPTION_FAHRENHEIT, sint8) = 1; + RCT2_GLOBAL(0x009AACBB, sint8) = 1; + RCT2_GLOBAL(0x009AACBD, sint16) = 0; + if (!(RCT2_GLOBAL(0x009AAC74, uint8) & 2)) + RCT2_GLOBAL(0x009AACBD, sint16) = (RCT2_GLOBAL(0x009AAC78, sint8) + 1) * 256; + RCT2_GLOBAL(0x009AA00D, sint8) = 1; + } + } + + RCT2_GLOBAL(0x009AAC77, sint8) = 0; + if (RCT2_GLOBAL(RCT2_ADDRESS_OS_TOTALPHYS, uint32) > 0x4000000) { + RCT2_GLOBAL(0x009AAC77, sint8) = 1; + if (RCT2_GLOBAL(RCT2_ADDRESS_OS_TOTALPHYS, uint32) > 0x8000000) + RCT2_GLOBAL(0x009AAC77, sint8) = 2; + } + + RCT2_GLOBAL(0x009AAC75, sint8) = RCT2_ADDRESS(0x009AF601, sint8)[RCT2_GLOBAL(0x009AAC77, sint8)]; + RCT2_GLOBAL(0x009AAC76, sint8) = RCT2_ADDRESS(0x009AF604, sint8)[RCT2_GLOBAL(0x009AAC77, sint8)]; + RCT2_GLOBAL(0x009AACBD, sint16) = 0; + if (!(RCT2_GLOBAL(0x009AAC74, uint8) & 2)) + RCT2_GLOBAL(0x009AACBD, sint16) = (RCT2_GLOBAL(0x009AAC78, sint8) + 1) * 256; + RCT2_GLOBAL(0x009AA00D, sint8) = 1; +} \ No newline at end of file diff --git a/src/config.h b/src/config.h new file mode 100644 index 0000000000..48937583c9 --- /dev/null +++ b/src/config.h @@ -0,0 +1,26 @@ +/***************************************************************************** + * Copyright (c) 2014 Ted John + * OpenRCT2, an open source clone of Roller Coaster Tycoon 2. + * + * This file is part of OpenRCT2. + * + * OpenRCT2 is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + *****************************************************************************/ + +#ifndef _CONFIG_H_ +#define _CONFIG_H_ + +void config_load(); + +#endif \ No newline at end of file diff --git a/src/game.c b/src/game.c index 378ba4315e..cc32a7a89d 100644 --- a/src/game.c +++ b/src/game.c @@ -21,6 +21,7 @@ #include "addresses.h" #include "rct2.h" #include "game.h" +#include "news_item.h" #include "peep.h" #include "window.h" @@ -131,7 +132,7 @@ void game_logic_update() RCT2_CALLPROC_EBPSAFE(0x006BCB91); RCT2_CALLPROC_EBPSAFE(0x006BD0F8); - RCT2_CALLPROC_EBPSAFE(0x0066E252); // news_item_update_current() + news_item_update_current(); RCT2_CALLPROC_EBPSAFE(0x0067009A); // Update windows diff --git a/src/rct2.c b/src/rct2.c index 55fd78414a..43e0e3d017 100644 --- a/src/rct2.c +++ b/src/rct2.c @@ -25,6 +25,7 @@ #include #include #include "addresses.h" +#include "config.h" #include "game.h" #include "gfx.h" #include "intro.h" @@ -96,7 +97,7 @@ void rct2_init() rct2_startup_checks(); RCT2_CALLPROC_EBPSAFE(0x06E3604); // reset_keyboard_shortcuts() RCT2_GLOBAL(RCT2_ADDRESS_PLACE_OBJECT_MODIFIER, uint8) = 0; - RCT2_CALLPROC_EBPSAFE(0x006752D5); // config_load() + config_load(); // RCT2_CALLPROC_EBPSAFE(0x00674B81); // pointless expansion pack crap RCT2_CALLPROC_EBPSAFE(0x006A8B40); // object_load_list() scenario_load_list(); diff --git a/src/rct2.h b/src/rct2.h index 7d4f623984..bb71f98a5f 100644 --- a/src/rct2.h +++ b/src/rct2.h @@ -48,7 +48,64 @@ enum { PATH_ID_CSS1, PATH_ID_CSS2, PATH_ID_CSS4, - PATH_ID_CSS5 + PATH_ID_CSS5, + PATH_ID_CSS6, + PATH_ID_CSS7, + PATH_ID_CSS8, + PATH_ID_CSS9, + PATH_ID_CSS10, + PATH_ID_CSS11, + PATH_ID_CSS12, + PATH_ID_CSS13, + PATH_ID_CSS14, + PATH_ID_CSS15, + PATH_ID_CSS16, + PATH_ID_CSS3, + PATH_ID_GAMECFG, + PATH_ID_TUT640A, + PATH_ID_TUT640B, + PATH_ID_TUT640C, + PATH_ID_TUT800A, + PATH_ID_TUT800B, + PATH_ID_TUT800C, + PATH_ID_KANJI, + PATH_ID_CSS17, + PATH_ID_CSS18, + PATH_ID_CSS19, + PATH_ID_CSS20, + PATH_ID_CSS21, + PATH_ID_CSS22, + PATH_ID_SCORES, + PATH_ID_CSS23, + PATH_ID_CSS24, + PATH_ID_CSS25, + PATH_ID_CSS26, + PATH_ID_CSS27, + PATH_ID_CSS28, + PATH_ID_CSS29, + PATH_ID_CSS30, + PATH_ID_CSS31, + PATH_ID_CSS32, + PATH_ID_CSS33, + PATH_ID_CSS34, + PATH_ID_CSS35, + PATH_ID_CSS36, + PATH_ID_CSS37, + PATH_ID_CSS38, + PATH_ID_CUSTOM1, + PATH_ID_CUSTOM2, + PATH_ID_CSS39, + PATH_ID_CSS40, + PATH_ID_TRACKSIDX, + PATH_ID_CSS41, + PATH_ID_SIXFLAGS_MAGICMOUNTAIN, + PATH_ID_SIXFLAGS_BUILDYOUROWN, + PATH_ID_CSS42, + PATH_ID_CSS43, + PATH_ID_CSS44, + PATH_ID_CSS45, + PATH_ID_CSS46 + }; char *get_file_path(int pathId); diff --git a/src/scenario.c b/src/scenario.c index ba7edb435a..a5e0add04b 100644 --- a/src/scenario.c +++ b/src/scenario.c @@ -197,7 +197,7 @@ static void scenario_scores_load() } // Try and load the scores - hFile = CreateFile(get_file_path(32), GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, + hFile = CreateFile(get_file_path(PATH_ID_SCORES), GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_FLAG_RANDOM_ACCESS | FILE_ATTRIBUTE_NORMAL, NULL); if (hFile != INVALID_HANDLE_VALUE) { ReadFile(hFile, (void*)0x009A9FFC, 16, &bytes_read, NULL);