mirror of https://github.com/OpenRCT2/OpenRCT2.git
Integrate path variables used by game
This commit is contained in:
parent
199d0f03d8
commit
35676d31f7
|
@ -783,7 +783,7 @@ bool game_load_save(const utf8 *path)
|
|||
log_verbose("loading saved game, %s", path);
|
||||
|
||||
safe_strcpy((char*)0x0141EF68, path, MAX_PATH);
|
||||
safe_strcpy((char*)RCT2_ADDRESS_SAVED_GAMES_PATH_2, path, MAX_PATH);
|
||||
safe_strcpy((char*)gRCT2AddressSavedGamesPath2, path, MAX_PATH);
|
||||
|
||||
safe_strcpy(gScenarioSavePath, path, MAX_PATH);
|
||||
|
||||
|
|
|
@ -893,7 +893,7 @@ static int cc_load_object(const utf8 **argv, int argc) {
|
|||
if (argc > 0) {
|
||||
utf8 path[MAX_PATH];
|
||||
|
||||
substitute_path(path, RCT2_ADDRESS(RCT2_ADDRESS_OBJECT_DATA_PATH, char), argv[0]);
|
||||
substitute_path(path, gRCT2AddressObjectDataPath, argv[0]);
|
||||
strcat(path, ".DAT\0");
|
||||
|
||||
rct_object_entry entry;
|
||||
|
|
|
@ -57,7 +57,7 @@ int object_load_file(int groupIndex, const rct_object_entry *entry, int* chunkSi
|
|||
char path[MAX_PATH];
|
||||
SDL_RWops* rw;
|
||||
|
||||
substitute_path(path, RCT2_ADDRESS(RCT2_ADDRESS_OBJECT_DATA_PATH, char), (char*)installedObject + 16);
|
||||
substitute_path(path, gRCT2AddressObjectDataPath, (char*)installedObject + 16);
|
||||
|
||||
log_verbose("loading object, %s", path);
|
||||
|
||||
|
@ -344,7 +344,7 @@ int object_load_packed(SDL_RWops* rw)
|
|||
objectPath[i] = '\0';
|
||||
}
|
||||
|
||||
substitute_path(path, RCT2_ADDRESS(RCT2_ADDRESS_OBJECT_DATA_PATH, char), objectPath);
|
||||
substitute_path(path, gRCT2AddressObjectDataPath, objectPath);
|
||||
// Require pointer to start of filename
|
||||
char* last_char = path + strlen(path);
|
||||
strcat(path, ".DAT");
|
||||
|
@ -354,7 +354,7 @@ int object_load_packed(SDL_RWops* rw)
|
|||
for (; platform_file_exists(path);){
|
||||
for (char* curr_char = last_char - 1;; --curr_char){
|
||||
if (*curr_char == '\\'){
|
||||
substitute_path(path, RCT2_ADDRESS(RCT2_ADDRESS_OBJECT_DATA_PATH, char), "00000000.DAT");
|
||||
substitute_path(path, gRCT2AddressObjectDataPath, "00000000.DAT");
|
||||
break;
|
||||
}
|
||||
if (*curr_char < '0') *curr_char = '0';
|
||||
|
@ -1669,7 +1669,7 @@ int object_get_scenario_text(rct_object_entry *entry)
|
|||
|
||||
char path[MAX_PATH];
|
||||
char *objectPath = (char*)installedObject + 16;
|
||||
substitute_path(path, RCT2_ADDRESS(RCT2_ADDRESS_OBJECT_DATA_PATH, char), objectPath);
|
||||
substitute_path(path, gRCT2AddressObjectDataPath, objectPath);
|
||||
|
||||
rct_object_entry openedEntry;
|
||||
SDL_RWops* rw = SDL_RWFromFile(path, "rb");
|
||||
|
|
|
@ -252,7 +252,7 @@ static int object_list_query_directory(int *outTotalFiles, uint64 *outTotalFileS
|
|||
fileDateModifiedChecksum = 0;
|
||||
|
||||
// Enumerate through each object in the directory
|
||||
enumFileHandle = platform_enumerate_files_begin(RCT2_ADDRESS(RCT2_ADDRESS_OBJECT_DATA_PATH, char));
|
||||
enumFileHandle = platform_enumerate_files_begin(gRCT2AddressObjectDataPath);
|
||||
if (enumFileHandle == INVALID_HANDLE)
|
||||
return 0;
|
||||
|
||||
|
@ -320,7 +320,7 @@ void object_list_load()
|
|||
_installedObjectFilters = NULL;
|
||||
}
|
||||
|
||||
enumFileHandle = platform_enumerate_files_begin(RCT2_ADDRESS(RCT2_ADDRESS_OBJECT_DATA_PATH, char));
|
||||
enumFileHandle = platform_enumerate_files_begin(gRCT2AddressObjectDataPath);
|
||||
if (enumFileHandle != INVALID_HANDLE) {
|
||||
size_t installedObjectsCapacity = 4096;
|
||||
while (platform_enumerate_files_next(enumFileHandle, &enumFileInfo)) {
|
||||
|
@ -337,7 +337,7 @@ void object_list_load()
|
|||
}
|
||||
|
||||
char path[MAX_PATH];
|
||||
substitute_path(path, RCT2_ADDRESS(RCT2_ADDRESS_OBJECT_DATA_PATH, char), enumFileInfo.path);
|
||||
substitute_path(path, gRCT2AddressObjectDataPath, enumFileInfo.path);
|
||||
|
||||
rct_object_entry entry;
|
||||
if (object_load_entry(path, &entry)) {
|
||||
|
|
|
@ -166,10 +166,10 @@ static void openrct2_copy_original_user_files_over()
|
|||
utf8 path[MAX_PATH];
|
||||
|
||||
platform_get_user_directory(path, "save");
|
||||
openrct2_copy_files_over((utf8*)RCT2_ADDRESS_SAVED_GAMES_PATH, path, ".sv6");
|
||||
openrct2_copy_files_over((utf8*)gRCT2AddressSavedGamesPath, path, ".sv6");
|
||||
|
||||
platform_get_user_directory(path, "landscape");
|
||||
openrct2_copy_files_over((utf8*)RCT2_ADDRESS_LANDSCAPES_PATH, path, ".sc6");
|
||||
openrct2_copy_files_over((utf8*)gRCT2AddressLandscapesPath, path, ".sc6");
|
||||
}
|
||||
|
||||
bool openrct2_initialise()
|
||||
|
|
60
src/rct2.c
60
src/rct2.c
|
@ -114,6 +114,13 @@ uint8 gSavePromptMode;
|
|||
sint32 gScreenWidth;
|
||||
sint32 gScreenHeight;
|
||||
|
||||
char gRCT2AddressSavedGamesPath[MAX_PATH];
|
||||
char gRCT2AddressSavedGamesPath2[MAX_PATH];
|
||||
char gRCT2AddressScenariosPath[MAX_PATH];
|
||||
char gRCT2AddressLandscapesPath[MAX_PATH];
|
||||
char gRCT2AddressObjectDataPath[MAX_PATH];
|
||||
char gRCT2AddressTracksPath[MAX_PATH];
|
||||
|
||||
typedef struct tm tm_t;
|
||||
|
||||
void print_launch_information();
|
||||
|
@ -213,41 +220,36 @@ int rct2_init_directories()
|
|||
|
||||
char separator[] = {platform_get_path_separator(), 0};
|
||||
|
||||
strcpy(RCT2_ADDRESS(RCT2_ADDRESS_APP_PATH, char), gConfigGeneral.game_path);
|
||||
char gRCT2AddressAppPath[MAX_PATH] = { 0 };
|
||||
|
||||
strcpy(RCT2_ADDRESS(RCT2_ADDRESS_APP_PATH_SLASH, char), RCT2_ADDRESS(RCT2_ADDRESS_APP_PATH, char));
|
||||
strcat(RCT2_ADDRESS(RCT2_ADDRESS_APP_PATH_SLASH, char), separator);
|
||||
strcpy(gRCT2AddressAppPath, gConfigGeneral.game_path);
|
||||
strcat(gRCT2AddressAppPath, separator);
|
||||
|
||||
strcpy(RCT2_ADDRESS(RCT2_ADDRESS_SAVED_GAMES_PATH, char), RCT2_ADDRESS(RCT2_ADDRESS_APP_PATH, char));
|
||||
strcat(RCT2_ADDRESS(RCT2_ADDRESS_SAVED_GAMES_PATH, char), separator);
|
||||
strcat(RCT2_ADDRESS(RCT2_ADDRESS_SAVED_GAMES_PATH, char), "Saved Games");
|
||||
strcat(RCT2_ADDRESS(RCT2_ADDRESS_SAVED_GAMES_PATH, char), separator);
|
||||
strcpy(gRCT2AddressSavedGamesPath, gRCT2AddressAppPath);
|
||||
strcat(gRCT2AddressSavedGamesPath, "Saved Games");
|
||||
strcat(gRCT2AddressSavedGamesPath, separator);
|
||||
|
||||
strcpy(RCT2_ADDRESS(RCT2_ADDRESS_SCENARIOS_PATH, char), RCT2_ADDRESS(RCT2_ADDRESS_APP_PATH, char));
|
||||
strcat(RCT2_ADDRESS(RCT2_ADDRESS_SCENARIOS_PATH, char), separator);
|
||||
strcat(RCT2_ADDRESS(RCT2_ADDRESS_SCENARIOS_PATH, char), "Scenarios");
|
||||
strcat(RCT2_ADDRESS(RCT2_ADDRESS_SCENARIOS_PATH, char), separator);
|
||||
strcat(RCT2_ADDRESS(RCT2_ADDRESS_SCENARIOS_PATH, char), "*.SC6");
|
||||
strcpy(gRCT2AddressScenariosPath, gRCT2AddressAppPath);
|
||||
strcat(gRCT2AddressScenariosPath, "Scenarios");
|
||||
strcat(gRCT2AddressScenariosPath, separator);
|
||||
strcat(gRCT2AddressScenariosPath, "*.SC6");
|
||||
|
||||
strcpy(RCT2_ADDRESS(RCT2_ADDRESS_LANDSCAPES_PATH, char), RCT2_ADDRESS(RCT2_ADDRESS_APP_PATH, char));
|
||||
strcat(RCT2_ADDRESS(RCT2_ADDRESS_LANDSCAPES_PATH, char), separator);
|
||||
strcat(RCT2_ADDRESS(RCT2_ADDRESS_LANDSCAPES_PATH, char), "Landscapes");
|
||||
strcat(RCT2_ADDRESS(RCT2_ADDRESS_LANDSCAPES_PATH, char), separator);
|
||||
strcat(RCT2_ADDRESS(RCT2_ADDRESS_LANDSCAPES_PATH, char), "*.SC6");
|
||||
strcpy(gRCT2AddressLandscapesPath, gRCT2AddressAppPath);
|
||||
strcat(gRCT2AddressLandscapesPath, "Landscapes");
|
||||
strcat(gRCT2AddressLandscapesPath, separator);
|
||||
strcat(gRCT2AddressLandscapesPath, "*.SC6");
|
||||
|
||||
strcpy(RCT2_ADDRESS(RCT2_ADDRESS_OBJECT_DATA_PATH, char), RCT2_ADDRESS(RCT2_ADDRESS_APP_PATH, char));
|
||||
strcat(RCT2_ADDRESS(RCT2_ADDRESS_OBJECT_DATA_PATH, char), separator);
|
||||
strcat(RCT2_ADDRESS(RCT2_ADDRESS_OBJECT_DATA_PATH, char), "ObjData");
|
||||
strcat(RCT2_ADDRESS(RCT2_ADDRESS_OBJECT_DATA_PATH, char), separator);
|
||||
strcat(RCT2_ADDRESS(RCT2_ADDRESS_OBJECT_DATA_PATH, char), "*.DAT");
|
||||
strcpy(gRCT2AddressObjectDataPath, gRCT2AddressAppPath);
|
||||
strcat(gRCT2AddressObjectDataPath, "ObjData");
|
||||
strcat(gRCT2AddressObjectDataPath, separator);
|
||||
strcat(gRCT2AddressObjectDataPath, "*.DAT");
|
||||
|
||||
strcpy(RCT2_ADDRESS(RCT2_ADDRESS_TRACKS_PATH, char), RCT2_ADDRESS(RCT2_ADDRESS_APP_PATH, char));
|
||||
strcat(RCT2_ADDRESS(RCT2_ADDRESS_TRACKS_PATH, char), separator);
|
||||
strcat(RCT2_ADDRESS(RCT2_ADDRESS_TRACKS_PATH, char), "Tracks");
|
||||
strcat(RCT2_ADDRESS(RCT2_ADDRESS_TRACKS_PATH, char), separator);
|
||||
strcat(RCT2_ADDRESS(RCT2_ADDRESS_TRACKS_PATH, char), "*.TD?");
|
||||
strcpy(gRCT2AddressTracksPath, gRCT2AddressAppPath);
|
||||
strcat(gRCT2AddressTracksPath, "Tracks");
|
||||
strcat(gRCT2AddressTracksPath, separator);
|
||||
strcat(gRCT2AddressTracksPath, "*.TD?");
|
||||
|
||||
strcpy(RCT2_ADDRESS(RCT2_ADDRESS_SAVED_GAMES_PATH_2, char), RCT2_ADDRESS(RCT2_ADDRESS_SAVED_GAMES_PATH, char));
|
||||
strcpy(gRCT2AddressSavedGamesPath2, gRCT2AddressSavedGamesPath);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -351,7 +353,7 @@ bool rct2_open_file(const char *path)
|
|||
extension++;
|
||||
|
||||
if (_stricmp(extension, "sv6") == 0) {
|
||||
strcpy((char*)RCT2_ADDRESS_SAVED_GAMES_PATH_2, path);
|
||||
strcpy((char*)gRCT2AddressSavedGamesPath2, path);
|
||||
game_load_save(path);
|
||||
gFirstTimeSave = 0;
|
||||
return true;
|
||||
|
|
|
@ -279,6 +279,13 @@ extern uint8 gSavePromptMode;
|
|||
extern sint32 gScreenWidth;
|
||||
extern sint32 gScreenHeight;
|
||||
|
||||
extern char gRCT2AddressSavedGamesPath[];
|
||||
extern char gRCT2AddressSavedGamesPath2[];
|
||||
extern char gRCT2AddressScenariosPath[];
|
||||
extern char gRCT2AddressLandscapesPath[];
|
||||
extern char gRCT2AddressObjectDataPath[];
|
||||
extern char gRCT2AddressTracksPath[];
|
||||
|
||||
int rct2_init();
|
||||
void rct2_dispose();
|
||||
void rct2_update();
|
||||
|
|
|
@ -244,9 +244,9 @@ void scenario_begin()
|
|||
strncat(gScenarioSavePath, parkName, sizeof(gScenarioSavePath) - strlen(gScenarioSavePath) - 1);
|
||||
strncat(gScenarioSavePath, ".sv6", sizeof(gScenarioSavePath) - strlen(gScenarioSavePath) - 1);
|
||||
|
||||
strcpy((char*)RCT2_ADDRESS_SAVED_GAMES_PATH_2, (char*)RCT2_ADDRESS_SAVED_GAMES_PATH);
|
||||
strcpy((char*)RCT2_ADDRESS_SAVED_GAMES_PATH_2 + strlen((char*)RCT2_ADDRESS_SAVED_GAMES_PATH_2), gScenarioSavePath);
|
||||
strcat((char*)RCT2_ADDRESS_SAVED_GAMES_PATH_2, ".SV6");
|
||||
strcpy(gRCT2AddressSavedGamesPath2, gRCT2AddressSavedGamesPath);
|
||||
strcpy(gRCT2AddressSavedGamesPath2 + strlen(gRCT2AddressSavedGamesPath2), gScenarioSavePath);
|
||||
strcat(gRCT2AddressSavedGamesPath2, ".SV6");
|
||||
|
||||
memset((void*)0x001357848, 0, 56);
|
||||
gCurrentExpenditure = 0;
|
||||
|
@ -299,7 +299,7 @@ void scenario_end()
|
|||
|
||||
void scenario_set_filename(const char *value)
|
||||
{
|
||||
substitute_path(_scenarioPath, RCT2_ADDRESS(RCT2_ADDRESS_SCENARIOS_PATH, char), value);
|
||||
substitute_path(_scenarioPath, gRCT2AddressScenariosPath, value);
|
||||
_scenarioFileName = path_get_filename(_scenarioPath);
|
||||
}
|
||||
|
||||
|
|
|
@ -237,7 +237,7 @@ rct_window *window_loadsave_open(int type, char *defaultName)
|
|||
}
|
||||
*/
|
||||
|
||||
safe_strcpy(path, RCT2_ADDRESS(RCT2_ADDRESS_TRACKS_PATH, char), MAX_PATH);
|
||||
safe_strcpy(path, gRCT2AddressTracksPath, MAX_PATH);
|
||||
ch = strchr(path, '*');
|
||||
if (ch != NULL)
|
||||
*ch = 0;
|
||||
|
|
Loading…
Reference in New Issue