mirror of
https://github.com/blupi-games/planetblupi
synced 2024-12-30 10:15:36 +01:00
Open config.json file with SDL functions
It's not possible to use the usual c++ functions because it's not supported by android assets directory.
This commit is contained in:
parent
a1f5c49fbd
commit
dcadfe1c38
@ -115,12 +115,16 @@ ReadConfig ()
|
||||
{
|
||||
const auto config = GetBaseDir () + "data/config.json";
|
||||
|
||||
std::ifstream file (config, std::ifstream::in);
|
||||
SDL_RWops * file = SDL_RWFromFile (config.c_str (), "rb");
|
||||
if (!file)
|
||||
return false;
|
||||
|
||||
nlohmann::json j;
|
||||
file >> j;
|
||||
Sint64 size = SDL_RWsize (file);
|
||||
char * buffer = (char *) calloc (sizeof (char), size + 1);
|
||||
SDL_RWread (file, buffer, size, 1);
|
||||
nlohmann::json j = buffer;
|
||||
SDL_RWclose (file);
|
||||
free (buffer);
|
||||
|
||||
if (
|
||||
!(g_settingsOverload & SETTING_SPEEDRATE) &&
|
||||
|
Loading…
x
Reference in New Issue
Block a user