mirror of https://github.com/mgba-emu/mgba.git
Util: Fix loading UPS patches that affect the last byte of the file
This commit is contained in:
parent
e0db333ea3
commit
e25efac5fb
1
CHANGES
1
CHANGES
|
@ -9,6 +9,7 @@ Other fixes:
|
||||||
- Core: Fix memory leak in opening games from the library
|
- Core: Fix memory leak in opening games from the library
|
||||||
- Qt: Fix infrequent deadlock when using sync to video
|
- Qt: Fix infrequent deadlock when using sync to video
|
||||||
- Qt: Fix applying savetype-only overrides
|
- Qt: Fix applying savetype-only overrides
|
||||||
|
- Util: Fix loading UPS patches that affect the last byte of the file
|
||||||
Misc:
|
Misc:
|
||||||
- Qt: Rearrange menus some
|
- Qt: Rearrange menus some
|
||||||
|
|
||||||
|
|
|
@ -87,15 +87,16 @@ bool _UPSApplyPatch(struct Patch* patch, const void* in, size_t inSize, void* ou
|
||||||
if (patch->vf->read(patch->vf, &byte, 1) != 1) {
|
if (patch->vf->read(patch->vf, &byte, 1) != 1) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
if (!byte) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
if (offset >= outSize) {
|
if (offset >= outSize) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
buf[offset] ^= byte;
|
buf[offset] ^= byte;
|
||||||
++offset;
|
++offset;
|
||||||
if (!byte) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
++offset;
|
||||||
alreadyRead = patch->vf->seek(patch->vf, 0, SEEK_CUR);
|
alreadyRead = patch->vf->seek(patch->vf, 0, SEEK_CUR);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue