Skip to content

Commit 69df3df

Browse files
Fix osage play data generation.
1 parent 2643387 commit 69df3df

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

Source/DivaModLoader/FileLoader.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ HOOK(CpkFileHandle*, __fastcall, OpenFileFromCpk, sigLoadFileFromCpk(), const ch
1616
{
1717
// I don't know what these arguments mean, but they are utilized by files
1818
// that we are interested in manually loading.
19-
if (a2 && a3)
19+
if (a2 && a3 && !strstr(fileName, "osage_play_data_tmp")) // Ignore osage_play_data_tmp because it's treated as a text file for some reason.
2020
{
2121
FILE* file = fopen(fileName, "rb");
2222
if (file)
@@ -31,10 +31,13 @@ HOOK(CpkFileHandle*, __fastcall, OpenFileFromCpk, sigLoadFileFromCpk(), const ch
3131
fseek(file, 0, SEEK_END);
3232
handle->dataSize = ftell(file);
3333
fseek(file, 0, SEEK_SET);
34-
handle->data = heapCMallocAllocate(5, handle->dataSize, "cri file extract buffer");
34+
35+
handle->data = heapCMallocAllocate(5, handle->dataSize + 1, "cri file extract buffer");
36+
3537
fread(handle->data, handle->dataSize, 1, file);
36-
fclose(file);
38+
*((uint8_t*)handle->data + handle->dataSize) = 0;
3739

40+
fclose(file);
3841
return handle;
3942
}
4043
}

0 commit comments

Comments
 (0)