Small fix

This commit is contained in:
fed 2022-11-10 19:10:28 +01:00
parent 1c5a01bcf7
commit 664264259a

View File

@ -8,6 +8,7 @@
#include <utils/hook.hpp> #include <utils/hook.hpp>
#include <utils/io.hpp> #include <utils/io.hpp>
#include <utils/memory.hpp>
#define MAX_ARENAS 64 #define MAX_ARENAS 64
@ -27,16 +28,25 @@ namespace
return true; return true;
} }
char rawfile_buffer[0x18000] = {0}; if (!game::DB_XAssetExists(game::ASSET_TYPE_RAWFILE, path.data()) ||
const auto buf = game::DB_ReadRawFile(path.data(), rawfile_buffer, sizeof(rawfile_buffer)); game::DB_IsXAssetDefault(game::ASSET_TYPE_RAWFILE, path.data()))
if (buf)
{ {
*game::ui_num_arenas += game::GameInfo_ParseArenas(buf, MAX_ARENAS - *game::ui_num_arenas, return false;
&game::ui_arena_infos[*game::ui_num_arenas]);
return true;
} }
const auto rawfile = game::DB_FindXAssetHeader(game::ASSET_TYPE_RAWFILE, path.data(), 0).rawfile;
const auto len = game::DB_GetRawFileLen(rawfile);
return false; const auto rawfile_buffer = utils::memory::get_allocator()->allocate_array<char>(len);
const auto _1 = gsl::finally([&]
{
utils::memory::get_allocator()->free(rawfile_buffer);
});
game::DB_GetRawBuffer(rawfile, rawfile_buffer, len);
*game::ui_num_arenas += game::GameInfo_ParseArenas(rawfile_buffer, MAX_ARENAS - *game::ui_num_arenas,
&game::ui_arena_infos[*game::ui_num_arenas]);
return true;
} }
void load_arenas_stub() void load_arenas_stub()