From b53dea17c675f5db7fc4f0d256533bbee31f8299 Mon Sep 17 00:00:00 2001 From: anyc Date: Sat, 24 May 2014 16:23:30 +0200 Subject: [PATCH] add GCC asm, new RCT2_ERR macro for non-variadic error reporting --- src/rct2.h | 1 + src/scenario_list.c | 6 +++--- src/window_map.c | 4 ++++ 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/rct2.h b/src/rct2.h index 64840b4816..1e81ac4d4b 100644 --- a/src/rct2.h +++ b/src/rct2.h @@ -52,6 +52,7 @@ typedef unsigned long long uint64; #else #define RCT2_ERROR(format,...) fprintf(stderr, "ERROR %s:%s():%d: " format "\n", __FILE__, __func__, __LINE__, __VA_ARGS__); #endif +#define RCT2_ERR(msg) RCT2_ERROR("%s",msg) #ifndef _MSC_VER // use similar struct packing as MSVC for our structs diff --git a/src/scenario_list.c b/src/scenario_list.c index c2e7a97df7..9d2ca8741d 100644 --- a/src/scenario_list.c +++ b/src/scenario_list.c @@ -169,7 +169,7 @@ static int scenario_scores_load() // Try and load the scores file file = fopen(get_file_path(PATH_ID_SCORES), "rb"); if (file == NULL) { - RCT2_ERROR("Unable to load scenario scores."); + RCT2_ERR("Unable to load scenario scores."); return 0; } @@ -177,7 +177,7 @@ static int scenario_scores_load() rct_scenario_scores_header header; if (fread(&header, 16, 1, file) != 1) { fclose(file); - RCT2_ERROR("Invalid header in scenario scores file."); + RCT2_ERR("Invalid header in scenario scores file."); return 0; } gScenarioListCount = header.scenario_count; @@ -210,7 +210,7 @@ int scenario_scores_save() file = fopen(get_file_path(PATH_ID_SCORES), "wb"); if (file == NULL) { - RCT2_ERROR("Unable to save scenario scores."); + RCT2_ERR("Unable to save scenario scores."); return 0; } diff --git a/src/window_map.c b/src/window_map.c index f56f9f5534..4c14fb8dd2 100644 --- a/src/window_map.c +++ b/src/window_map.c @@ -180,7 +180,11 @@ static void window_map_close() { rct_window *w; + #ifdef _MSC_VER __asm mov w, esi + #else + __asm__ ( "mov %[w], esi " : [w] "+m" (w) ); + #endif rct2_free(RCT2_GLOBAL(RCT2_ADDRESS_MAP_IMAGE_DATA, uint32*)); if ((RCT2_GLOBAL(0x009DE518, uint32) & (1 << 3)) &&