Revert "FileSystem: Allow ::openReadRaw() to break out of game directory"

This reverts commit d45a400227.
Causes memory corruption in its current state.
This commit is contained in:
Ancurio 2021-09-27 18:23:16 +02:00
parent ddde452544
commit 3d6b7d3b75
5 changed files with 39 additions and 32 deletions

View file

@ -273,23 +273,23 @@ runRMXPScripts(mrb_state *mrb, mrbc_context *ctx)
/* We use a secondary util state to unmarshal the scripts */
mrb_state *scriptMrb = mrb_open();
SDL_RWops ops;
SDL_RWops *ops = shState->fileSystem().openReadRaw(scriptPack.c_str());
shState->fileSystem().openReadRaw(ops, scriptPack.c_str());
mrb_value scriptArray = mrb_nil_value();
std::string readError;
try
{
scriptArray = marshalLoadInt(scriptMrb, ops);
scriptArray = marshalLoadInt(scriptMrb, &ops);
}
catch (const Exception &e)
{
readError = std::string(": ") + e.msg;
}
SDL_RWclose(ops);
SDL_FreeRW(ops);
SDL_RWclose(&ops);
if (!mrb_array_p(scriptArray))
{