From 4ba60cbf52827df14869d4efe2f9a77ab70a80bd Mon Sep 17 00:00:00 2001 From: Ted John Date: Thu, 30 Mar 2017 18:29:22 +0100 Subject: [PATCH] Replace SDLRW with fopen in interop.c --- src/openrct2/rct2/interop.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/openrct2/rct2/interop.c b/src/openrct2/rct2/interop.c index 591b3d5f3e..e427bbb175 100644 --- a/src/openrct2/rct2/interop.c +++ b/src/openrct2/rct2/interop.c @@ -14,6 +14,8 @@ *****************************************************************************/ #pragma endregion +#include + #include "../common.h" #if defined(__WINDOWS__) @@ -179,17 +181,20 @@ bool rct2_interop_setup_segment() utf8 segmentDataPath[MAX_PATH]; rct2_interop_get_segment_data_path(segmentDataPath, sizeof(segmentDataPath)); - SDL_RWops * rw = SDL_RWFromFile(segmentDataPath, "rb"); - if (rw == NULL) + + // Warning: for Windows this will fail if given a non-ASCII path, + // but given this code is temporary - its not worth resolving. + FILE * file = fopen(segmentDataPath, "rb"); + if (file == NULL) { log_error("failed to load file"); return false; } - if (SDL_RWread(rw, segments, len, 1) != 1) { + if (fread(segments, len, 1, file) != 1) { log_error("Unable to read chunk header!"); return false; } - SDL_RWclose(rw); + fclose(file); #endif // defined(USE_MMAP) && defined(__WINDOWS__) #if !defined(NO_RCT2) && defined(USE_MMAP)