mirror of https://github.com/mgba-emu/mgba.git
VFS: Make VFile.truncate work growing files on PSV (fixes #885)
This commit is contained in:
parent
5dfa036fa5
commit
a8f2990614
1
CHANGES
1
CHANGES
|
@ -56,6 +56,7 @@ Misc:
|
||||||
- GBA: Detect hardware for Pokémon FireRed ROM hacks
|
- GBA: Detect hardware for Pokémon FireRed ROM hacks
|
||||||
- CMake: Fix CPack dependencies for libpng 1.6
|
- CMake: Fix CPack dependencies for libpng 1.6
|
||||||
- Qt: Allow overrides to be saved before a game is loaded
|
- Qt: Allow overrides to be saved before a game is loaded
|
||||||
|
- VFS: Make VFile.truncate work growing files on PSV (fixes mgba.io/i/885)
|
||||||
|
|
||||||
0.6.0: (2017-07-16)
|
0.6.0: (2017-07-16)
|
||||||
Features:
|
Features:
|
||||||
|
|
|
@ -120,7 +120,20 @@ static void _vfsceUnmap(struct VFile* vf, void* memory, size_t size) {
|
||||||
|
|
||||||
static void _vfsceTruncate(struct VFile* vf, size_t size) {
|
static void _vfsceTruncate(struct VFile* vf, size_t size) {
|
||||||
struct VFileSce* vfsce = (struct VFileSce*) vf;
|
struct VFileSce* vfsce = (struct VFileSce*) vf;
|
||||||
// TODO
|
SceOff cur = sceIoLseek(vfsce->fd, 0, SEEK_CUR);
|
||||||
|
SceOff end = sceIoLseek(vfsce->fd, 0, SEEK_END);
|
||||||
|
if (end < size) {
|
||||||
|
uint8_t buffer[2048] = {};
|
||||||
|
size_t write = size - end;
|
||||||
|
while (write >= sizeof(buffer)) {
|
||||||
|
sceIoWrite(vfsce->fd, buffer, sizeof(buffer));
|
||||||
|
write -= sizeof(buffer);
|
||||||
|
}
|
||||||
|
if (write) {
|
||||||
|
sceIoWrite(vfsce->fd, buffer, write);
|
||||||
|
}
|
||||||
|
} // TODO: Else
|
||||||
|
sceIoLseek(vfsce->fd, cur, SEEK_SET);
|
||||||
}
|
}
|
||||||
|
|
||||||
ssize_t _vfsceSize(struct VFile* vf) {
|
ssize_t _vfsceSize(struct VFile* vf) {
|
||||||
|
|
Loading…
Reference in New Issue