mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-06 06:32:56 +01:00
Added error messages to loading objects
This commit is contained in:
@@ -35,9 +35,9 @@ void diagnostic_log(int diagnosticLevel, const char *format, ...);
|
||||
void diagnostic_log_with_location(int diagnosticLevel, const char *file, const char *function, int line, const char *format, ...);
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#define diagnostic_log_macro(level, format, ...) diagnostic_log(level, __FILE__, __FUNCTION__, __LINE__, format, __VA_ARGS__)
|
||||
#define diagnostic_log_macro(level, format, ...) diagnostic_log_with_location(level, __FILE__, __FUNCTION__, __LINE__, format, __VA_ARGS__)
|
||||
#else
|
||||
#define diagnostic_log_macro(level, format, ...) diagnostic_log(level, __FILE__, __func__, __LINE__, format, ## __VA_ARGS__)
|
||||
#define diagnostic_log_macro(level, format, ...) diagnostic_log_with_location(level, __FILE__, __func__, __LINE__, format, ## __VA_ARGS__)
|
||||
#endif
|
||||
|
||||
#define log_fatal(format, ...) diagnostic_log_macro(DIAGNOSTIC_LEVEL_FATAL, format, __VA_ARGS__)
|
||||
|
||||
@@ -43,6 +43,7 @@ int object_load(int groupIndex, rct_object_entry *entry)
|
||||
|
||||
if (!(RCT2_GLOBAL(0xF42B6C, uint32))){
|
||||
RCT2_GLOBAL(0xF42BD9, uint8) = 0;
|
||||
log_error("Object Load failed due to 0xF42B6C check.");
|
||||
return 1;
|
||||
}
|
||||
for (int i = 0; i < RCT2_GLOBAL(0x00F42B6C, sint32); i++) {
|
||||
@@ -80,12 +81,14 @@ int object_load(int groupIndex, rct_object_entry *entry)
|
||||
|
||||
// Calculate and check checksum
|
||||
if (object_calculate_checksum(&openedEntry, chunk, chunkSize) != openedEntry.checksum) {
|
||||
log_error("Object Load failed due to checksum failure.");
|
||||
RCT2_GLOBAL(0x00F42BD9, uint8) = 2;
|
||||
rct2_free(chunk);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (object_paint(openedEntry.flags & 0x0F, 2, 0, openedEntry.flags & 0x0F, 0, (int)chunk, 0, 0)) {
|
||||
log_error("Object Load failed due to paint failure.");
|
||||
RCT2_GLOBAL(0x00F42BD9, uint8) = 3;
|
||||
rct2_free(chunk);
|
||||
return 0;
|
||||
@@ -94,6 +97,7 @@ int object_load(int groupIndex, rct_object_entry *entry)
|
||||
int yyy = RCT2_GLOBAL(0x009ADAF0, uint32);
|
||||
|
||||
if (yyy >= 0x4726E){
|
||||
log_error("Object Load failed due to yyy failure.");
|
||||
RCT2_GLOBAL(0x00F42BD9, uint8) = 4;
|
||||
rct2_free(chunk);
|
||||
return 0;
|
||||
@@ -105,6 +109,7 @@ int object_load(int groupIndex, rct_object_entry *entry)
|
||||
if (ecx == -1){
|
||||
for (int ecx = 0; ((sint32*)esi)[ecx] != -1; ecx++){
|
||||
if ((ecx + 1) >= object_entry_group_counts[ebp]){
|
||||
log_error("Object Load failed due to ??? failure.");
|
||||
RCT2_GLOBAL(0x00F42BD9, uint8) = 5;
|
||||
rct2_free(chunk);
|
||||
return 0;
|
||||
@@ -126,6 +131,7 @@ int object_load(int groupIndex, rct_object_entry *entry)
|
||||
}
|
||||
//6a991f
|
||||
// Installed Object can not be found.
|
||||
log_error("Object Load failed due to file not installed.");
|
||||
return 0;
|
||||
//return !(RCT2_CALLPROC_X(0x006A985D, 0, 0, groupIndex, 0, 0, 0, (int)entry) & 0x400);
|
||||
}
|
||||
|
||||
@@ -213,7 +213,7 @@ int object_read_and_load_entries(FILE *file)
|
||||
|
||||
int i, j;
|
||||
rct_object_entry *entries;
|
||||
|
||||
log_verbose("Entered object read and load entries");
|
||||
// Read all the object entries
|
||||
entries = malloc(OBJECT_ENTRY_COUNT * sizeof(rct_object_entry));
|
||||
sawyercoding_read_chunk(file, (uint8*)entries);
|
||||
@@ -235,7 +235,8 @@ int object_read_and_load_entries(FILE *file)
|
||||
if (!object_load(entryGroupIndex, &entries[i])) {
|
||||
// Failed to load the object
|
||||
//Destroy progress bar
|
||||
|
||||
log_error("failed to load entry:");
|
||||
log_error("%.8s", entries[i].name);
|
||||
memcpy((char*)0x13CE952, &entries[i], sizeof(rct_object_entry));
|
||||
free(entries);
|
||||
object_unload_all();
|
||||
|
||||
@@ -153,6 +153,7 @@ int scenario_load(const char *path)
|
||||
|
||||
fclose(file);
|
||||
if (!load_success){
|
||||
log_error("failed to load all entries.");
|
||||
set_load_objects_fail_reason();
|
||||
title_load();
|
||||
rct2_endupdate();
|
||||
@@ -170,6 +171,7 @@ int scenario_load(const char *path)
|
||||
fclose(file);
|
||||
}
|
||||
|
||||
log_error("failed to find scenario file.");
|
||||
RCT2_GLOBAL(0x009AC31B, uint8) = 255;
|
||||
RCT2_GLOBAL(0x009AC31C, uint16) = STR_FILE_CONTAINS_INVALID_DATA;
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user