mirror of
https://github.com/mkxp-z/mkxp-z.git
synced 2025-04-22 06:02:04 +02:00
Fix files in archives not loading for no good reason
This commit is contained in:
parent
e2d9741b6f
commit
3ab0a2a430
2 changed files with 17 additions and 2 deletions
|
@ -79,7 +79,7 @@ RB_METHOD(fileIntRead)
|
||||||
{
|
{
|
||||||
|
|
||||||
int length = -1;
|
int length = -1;
|
||||||
rb_get_args(argc, argv, "i", &length RB_ARG_END);
|
rb_get_args(argc, argv, "|i", &length RB_ARG_END);
|
||||||
|
|
||||||
SDL_RWops *ops = getPrivateData<SDL_RWops>(self);
|
SDL_RWops *ops = getPrivateData<SDL_RWops>(self);
|
||||||
|
|
||||||
|
@ -87,6 +87,12 @@ RB_METHOD(fileIntRead)
|
||||||
{
|
{
|
||||||
Sint64 cur = SDL_RWtell(ops);
|
Sint64 cur = SDL_RWtell(ops);
|
||||||
Sint64 end = SDL_RWseek(ops, 0, SEEK_END);
|
Sint64 end = SDL_RWseek(ops, 0, SEEK_END);
|
||||||
|
|
||||||
|
// Sometimes SDL_RWseek will fail for no reason
|
||||||
|
// with encrypted archives, so let's just ask
|
||||||
|
// for the size up front
|
||||||
|
if (end < 0) end = ops->size(ops);
|
||||||
|
|
||||||
length = end - cur;
|
length = end - cur;
|
||||||
SDL_RWseek(ops, cur, SEEK_SET);
|
SDL_RWseek(ops, cur, SEEK_SET);
|
||||||
}
|
}
|
||||||
|
|
|
@ -689,7 +689,16 @@ void FileSystem::openReadRaw(SDL_RWops &ops,
|
||||||
bool freeOnClose)
|
bool freeOnClose)
|
||||||
{
|
{
|
||||||
PHYSFS_File *handle = PHYSFS_openRead(filename);
|
PHYSFS_File *handle = PHYSFS_openRead(filename);
|
||||||
// assert(handle); // Ruby exceptions are a little more helpful
|
|
||||||
|
// Not sure what to do with this assert, I feel like
|
||||||
|
// I should throw an exception for the binding but
|
||||||
|
// Essentials pings for files that don't exist
|
||||||
|
|
||||||
|
// I'll have to look at it later, but it works fine
|
||||||
|
// like this so I'll leave it commented out for now
|
||||||
|
|
||||||
|
// assert(handle);
|
||||||
|
|
||||||
|
|
||||||
initReadOps(handle, ops, freeOnClose);
|
initReadOps(handle, ops, freeOnClose);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue