1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2025-12-22 15:23:01 +01:00

Use IPlatformEnvironment for loading g1.dat

This commit is contained in:
Ted John
2017-07-11 20:54:21 +01:00
parent 33fd31d802
commit ac6da51dbb
3 changed files with 9 additions and 5 deletions

View File

@@ -264,7 +264,7 @@ namespace OpenRCT2
private: private:
bool LoadBaseGraphics() bool LoadBaseGraphics()
{ {
if (!gfx_load_g1()) if (!gfx_load_g1(_env))
{ {
return false; return false;
} }

View File

@@ -311,7 +311,7 @@ void gfx_fill_rect_inset(rct_drawpixelinfo* dpi, sint16 left, sint16 top, sint16
void gfx_filter_rect(rct_drawpixelinfo *dpi, sint32 left, sint32 top, sint32 right, sint32 bottom, FILTER_PALETTE_ID palette); void gfx_filter_rect(rct_drawpixelinfo *dpi, sint32 left, sint32 top, sint32 right, sint32 bottom, FILTER_PALETTE_ID palette);
// sprite // sprite
bool gfx_load_g1(); bool gfx_load_g1(void * platformEnvironment);
bool gfx_load_g2(); bool gfx_load_g2();
bool gfx_load_csg(); bool gfx_load_csg();
void gfx_unload_g1(); void gfx_unload_g1();

View File

@@ -24,6 +24,7 @@
#include "../core/Path.hpp" #include "../core/Path.hpp"
#include "../core/Util.hpp" #include "../core/Util.hpp"
#include "../OpenRCT2.h" #include "../OpenRCT2.h"
#include "../PlatformEnvironment.h"
#include "../sprites.h" #include "../sprites.h"
#include "../ui/UiContext.h" #include "../ui/UiContext.h"
@@ -88,12 +89,15 @@ extern "C"
* *
* rct2: 0x00678998 * rct2: 0x00678998
*/ */
bool gfx_load_g1() bool gfx_load_g1(void * platformEnvironment)
{ {
log_verbose("gfx_load_g1()"); auto env = (IPlatformEnvironment *)platformEnvironment;
log_verbose("gfx_load_g1(...)");
try try
{ {
auto fs = FileStream(get_file_path(PATH_ID_G1), FILE_MODE_OPEN); auto path = Path::Combine(env->GetDirectoryPath(DIRBASE::RCT2, DIRID::DATA), "g1.dat");
auto fs = FileStream(path, FILE_MODE_OPEN);
rct_g1_header header = fs.ReadValue<rct_g1_header>(); rct_g1_header header = fs.ReadValue<rct_g1_header>();
/* number of elements is stored in g1.dat, but because the entry /* number of elements is stored in g1.dat, but because the entry