mirror of https://github.com/OpenRCT2/OpenRCT2.git
change plugin.dat to be saved in user directory and stop repeated load of title screen when failed
This commit is contained in:
parent
424164523f
commit
325c5243e8
|
@ -20,10 +20,11 @@
|
|||
|
||||
#include <windows.h>
|
||||
#include "addresses.h"
|
||||
#include "object.h"
|
||||
#include "util/sawyercoding.h"
|
||||
#include "localisation/localisation.h"
|
||||
#include "object.h"
|
||||
#include "platform/osinterface.h"
|
||||
#include "ride/track.h"
|
||||
#include "util/sawyercoding.h"
|
||||
|
||||
#define OBJECT_ENTRY_GROUP_COUNT 11
|
||||
#define OBJECT_ENTRY_COUNT 721
|
||||
|
@ -80,6 +81,13 @@ struct { void **data; rct_object_entry_extended *entries; } object_entry_groups[
|
|||
(void**)(0x009ACFA4 + (720 * 4)), (rct_object_entry_extended*)(0x00F3F03C + (720 * 20)) // scenario text
|
||||
};
|
||||
|
||||
static void get_plugin_path(char *path)
|
||||
{
|
||||
char *homePath = osinterface_get_orct2_homefolder();
|
||||
sprintf(path, "%s%c%s", homePath, osinterface_get_path_separator(), "plugin.dat");
|
||||
free(homePath);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* rct2: 0x006A93CD
|
||||
|
@ -172,6 +180,9 @@ void object_list_load()
|
|||
WIN32_FIND_DATAA findFileData;
|
||||
int totalFiles = 0, totalFileSize = 0, fileDateModifiedChecksum = 0;
|
||||
|
||||
char pluginPath[MAX_PATH];
|
||||
get_plugin_path(pluginPath);
|
||||
|
||||
// Enumerate through each object in the directory
|
||||
hFindFile = FindFirstFile(RCT2_ADDRESS(RCT2_ADDRESS_OBJECT_DATA_PATH, char), &findFileData);
|
||||
if (hFindFile != INVALID_HANDLE_VALUE) {
|
||||
|
@ -192,7 +203,8 @@ void object_list_load()
|
|||
|
||||
// Read plugin header
|
||||
rct_plugin_header pluginHeader;
|
||||
FILE *file = fopen(get_file_path(PATH_ID_PLUGIN), "rb");
|
||||
|
||||
FILE *file = fopen(pluginPath, "rb");
|
||||
if (file != NULL) {
|
||||
if (fread(&pluginHeader, sizeof(pluginHeader), 1, file) == 1) {
|
||||
// Check if object repository has changed in anyway
|
||||
|
@ -458,7 +470,9 @@ void object_list_load()
|
|||
// Size of list Not used any more.
|
||||
// RCT2_GLOBAL(0xF42BA0, uint32) = current_item_offset;
|
||||
// RCT2_GLOBAL(0xF42BA4, uint32) = RCT2_GLOBAL(RCT2_ADDRESS_OBJECT_LIST_NO_ITEMS, uint32);
|
||||
FILE* obj_list_file = fopen(get_file_path(PATH_ID_PLUGIN),"wb");
|
||||
|
||||
get_plugin_path(pluginPath);
|
||||
FILE* obj_list_file = fopen(pluginPath,"wb");
|
||||
|
||||
if (obj_list_file){
|
||||
totalFiles = file_count;
|
||||
|
|
|
@ -253,6 +253,7 @@ int check_file_path(int pathId)
|
|||
case PATH_ID_GAMECFG:
|
||||
case PATH_ID_SCORES:
|
||||
case PATH_ID_TRACKSIDX:
|
||||
case PATH_ID_PLUGIN:
|
||||
// Do nothing; these will be created later if they do not exist yet
|
||||
break;
|
||||
|
||||
|
|
|
@ -160,9 +160,7 @@ int scenario_load(const char *path)
|
|||
if (!load_success){
|
||||
log_error("failed to load all entries.");
|
||||
set_load_objects_fail_reason();
|
||||
title_load();
|
||||
rct2_endupdate();
|
||||
return 0;//This never gets called
|
||||
return 0;
|
||||
}
|
||||
// Check expansion pack
|
||||
// RCT2_CALLPROC_EBPSAFE(0x006757E6);
|
||||
|
|
|
@ -167,7 +167,10 @@ static void title_update_showcase()
|
|||
_scriptWaitCounter = (*_currentScript++) * 32;
|
||||
break;
|
||||
case TITLE_SCRIPT_LOAD:
|
||||
scenario_load(get_file_path(PATH_ID_SIXFLAGS_MAGICMOUNTAIN));
|
||||
if (!scenario_load(get_file_path(PATH_ID_SIXFLAGS_MAGICMOUNTAIN))) {
|
||||
log_fatal("OpenRCT2 can not currently cope when unable to load title screen scenario.");
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
w = window_get_main();
|
||||
w->viewport_target_sprite = -1;
|
||||
|
|
Loading…
Reference in New Issue