FileSystem: Allow ::openReadRaw() to break out of game directory
If PhysFS fails to open a path, fall back to simple FILE* handles. Not sure yet if this is a good idea, but from observation RMXP allows load_data() to operate on paths outside the game directory as well, so we have to support this.
This commit is contained in:
parent
7938a07539
commit
d45a400227
5 changed files with 33 additions and 40 deletions
|
@ -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;
|
||||
|
||||
shState->fileSystem().openReadRaw(ops, scriptPack.c_str());
|
||||
SDL_RWops *ops = shState->fileSystem().openReadRaw(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_RWclose(ops);
|
||||
SDL_FreeRW(ops);
|
||||
|
||||
if (!mrb_array_p(scriptArray))
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue