2
0
mirror of https://github.com/rehlds/rehlds.git synced 2025-01-05 19:45:33 +03:00

Merge pull request #171 from WPMGPRoSToTeMa/master

Fixed reading and writing custom.hpk (Fixed #114)
This commit is contained in:
theAsmodai 2016-02-07 23:06:32 +03:00
commit f8643ef7b7
4 changed files with 12 additions and 4 deletions

View File

@ -2167,8 +2167,8 @@ void COM_CopyFileChunk(FileHandle_t dst, FileHandle_t src, int nSize)
while (copysize > COM_COPY_CHUNK_SIZE) while (copysize > COM_COPY_CHUNK_SIZE)
{ {
FS_Read(copybuf, 1, COM_COPY_CHUNK_SIZE, src); FS_Read(copybuf, COM_COPY_CHUNK_SIZE, 1, src);
FS_Write(copybuf, 1, COM_COPY_CHUNK_SIZE, dst); FS_Write(copybuf, COM_COPY_CHUNK_SIZE, 1, dst);
copysize -= COM_COPY_CHUNK_SIZE; copysize -= COM_COPY_CHUNK_SIZE;
} }

View File

@ -156,13 +156,21 @@ int FS_EndOfFile(FileHandle_t file)
/* <25fa9> ../engine/filesystem_internal.cpp:131 */ /* <25fa9> ../engine/filesystem_internal.cpp:131 */
int FS_Read(void *pOutput, int size, int count, FileHandle_t file) int FS_Read(void *pOutput, int size, int count, FileHandle_t file)
{ {
#ifdef REHLDS_FIXES
return g_pFileSystem->Read(pOutput, size * count, file);
#else // REHLDS_FIXES
return g_pFileSystem->Read(pOutput, size, file); return g_pFileSystem->Read(pOutput, size, file);
#endif // REHLDS_FIXES
} }
/* <2641e> ../engine/filesystem_internal.cpp:138 */ /* <2641e> ../engine/filesystem_internal.cpp:138 */
int FS_Write(const void *pInput, int size, int count, FileHandle_t file) int FS_Write(const void *pInput, int size, int count, FileHandle_t file)
{ {
#ifdef REHLDS_FIXES
return g_pFileSystem->Write(pInput, size * count, file);
#else // REHLDS_FIXES
return g_pFileSystem->Write(pInput, size, file); return g_pFileSystem->Write(pInput, size, file);
#endif // REHLDS_FIXES
} }
/* <26479> ../engine/filesystem_internal.cpp:145 */ /* <26479> ../engine/filesystem_internal.cpp:145 */

View File

@ -850,7 +850,7 @@ void HPAK_CreatePak(char *pakname, struct resource_s *pResource, void *pData, Fi
curpos = FS_Tell(fp); curpos = FS_Tell(fp);
FS_Write(&hash_pack_dir.nEntries, 4, 1, fp); FS_Write(&hash_pack_dir.nEntries, 4, 1, fp);
FS_Write(&hash_pack_dir.p_rgEntries, sizeof(hash_pack_entry_t), 1, fp); FS_Write(hash_pack_dir.p_rgEntries, sizeof(hash_pack_entry_t), 1, fp);
if (hash_pack_dir.p_rgEntries) if (hash_pack_dir.p_rgEntries)
{ {

View File

@ -651,7 +651,7 @@ NOXREF int BuildMapCycleListHints(char **hints)
if (length) if (length)
{ {
pFileList = (char *)malloc(length); pFileList = (char *)malloc(length);
if (pFileList && FS_Read(pFileList, length, 0, pFile) != 1) if (pFileList && FS_Read(pFileList, length, 1, pFile) != 1)
{ {
while (1) while (1)
{ {