mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-06 06:32:56 +01:00
add config load
This commit is contained in:
@@ -17,6 +17,7 @@
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\src\addresses.h" />
|
||||
<ClInclude Include="..\src\audio.h" />
|
||||
<ClInclude Include="..\src\config.h" />
|
||||
<ClInclude Include="..\src\game.h" />
|
||||
<ClInclude Include="..\src\gfx.h" />
|
||||
<ClInclude Include="..\src\intro.h" />
|
||||
@@ -36,6 +37,7 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\src\audio.c" />
|
||||
<ClCompile Include="..\src\config.c" />
|
||||
<ClCompile Include="..\src\game.c" />
|
||||
<ClCompile Include="..\src\gfx.c" />
|
||||
<ClCompile Include="..\src\intro.c" />
|
||||
|
||||
@@ -72,6 +72,9 @@
|
||||
<ClInclude Include="..\src\scenario.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\src\config.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\src\game.c">
|
||||
@@ -131,6 +134,9 @@
|
||||
<ClCompile Include="..\src\strings.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\src\config.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="..\openrct2.exe">
|
||||
|
||||
@@ -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
|
||||
|
||||
66
src/config.c
Normal file
66
src/config.c
Normal file
@@ -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 <http://www.gnu.org/licenses/>.
|
||||
*****************************************************************************/
|
||||
|
||||
#include <windows.h>
|
||||
#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;
|
||||
}
|
||||
26
src/config.h
Normal file
26
src/config.h
Normal file
@@ -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 <http://www.gnu.org/licenses/>.
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef _CONFIG_H_
|
||||
#define _CONFIG_H_
|
||||
|
||||
void config_load();
|
||||
|
||||
#endif
|
||||
@@ -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
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#include <windows.h>
|
||||
#include <SDL.h>
|
||||
#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();
|
||||
|
||||
59
src/rct2.h
59
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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user