From 495d943d00ccd645b68a7a1703f44730b98f5103 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Sat, 8 Oct 2016 23:31:21 +0200 Subject: CRYO: Replace long with portable int32 --- engines/cryo/clhnm.cpp | 8 ++++---- engines/cryo/cryolib.cpp | 14 +++++++------- engines/cryo/cryolib.h | 16 ++++++++-------- engines/cryo/defs.h | 4 ++-- engines/cryo/eden.cpp | 36 ++++++++++++++++++------------------ engines/cryo/eden.h | 4 ++-- 6 files changed, 41 insertions(+), 41 deletions(-) diff --git a/engines/cryo/clhnm.cpp b/engines/cryo/clhnm.cpp index db42b1d3c3..03f971d79d 100644 --- a/engines/cryo/clhnm.cpp +++ b/engines/cryo/clhnm.cpp @@ -316,8 +316,8 @@ void CLHNM_DeallocMemory(hnm_t *hnm) { } void CLHNM_Read(hnm_t *hnm, int size) { - long _size = size; - CLFile_Read(*hnm->_file, hnm->_readBuffer, &_size); + int32 size_ = size; + CLFile_Read(*hnm->_file, hnm->_readBuffer, &size_); } void CLHNM_GiveTime(hnm_t *hnm) { @@ -608,7 +608,7 @@ bool CLHNM_NextElement(hnm_t *hnm) { } void CLHNM_ReadHeader(hnm_t *hnm) { - long size = sizeof(hnm->_header); + int32 size = sizeof(hnm->_header); CLFile_Read(*hnm->_file, &hnm->_header, &size); hnm->_header._width = LE16(hnm->_header._width); @@ -639,7 +639,7 @@ void CLHNM_DeactivatePreloadBuffer() { void CLHNM_Prepare2Read(hnm_t *hnm, int mode) { } -void CLHNM_SetPosIntoFile(hnm_t *hnm, long pos) { +void CLHNM_SetPosIntoFile(hnm_t *hnm, int32 pos) { CLFile_SetPosition(*hnm->_file, 1, pos); } diff --git a/engines/cryo/cryolib.cpp b/engines/cryo/cryolib.cpp index 415ac18a9f..9705bc22ed 100644 --- a/engines/cryo/cryolib.cpp +++ b/engines/cryo/cryolib.cpp @@ -37,11 +37,11 @@ typedef int16 OSErr; void SysBeep(int x) { } -OSErr SetFPos(int16 handle, int16 mode, long pos) { +OSErr SetFPos(int16 handle, int16 mode, int32 pos) { return 0; } -OSErr FSRead(int16 handle, long *size, void *buffer) { +OSErr FSRead(int16 handle, int32 *size, void *buffer) { return 0; } @@ -49,12 +49,12 @@ void FlushEvents(int16 arg1, int16 arg2) { } // from mw lib??? -long TickCount() { +int32 TickCount() { return g_system->getMillis(); } ///// CLTimer -volatile long TimerTicks = 0; // incremented in realtime +volatile int32 TimerTicks = 0; // incremented in realtime ///// CLView void CLView_SetSrcZoomValues(View *view, int x, int y) { @@ -371,14 +371,14 @@ void CLFile_Open(filespec_t *fs, int16 mode, file_t &handle) { void CLFile_Close(file_t &handle) { handle.close(); } -void CLFile_SetPosition(file_t &handle, int16 mode, long pos) { +void CLFile_SetPosition(file_t &handle, int16 mode, int32 pos) { assert(mode == 1); handle.seek(pos, 0); } -void CLFile_Read(file_t &handle, void *buffer, long *size) { +void CLFile_Read(file_t &handle, void *buffer, int32 *size) { handle.read(buffer, *size); } -void CLFile_Write(file_t &handle, void *buffer, long *size) { +void CLFile_Write(file_t &handle, void *buffer, int32 *size) { assert(0); } diff --git a/engines/cryo/cryolib.h b/engines/cryo/cryolib.h index 139f864d4e..028f71c29b 100644 --- a/engines/cryo/cryolib.h +++ b/engines/cryo/cryolib.h @@ -127,7 +127,7 @@ typedef struct hnm_t hnm_t; struct sound_t { char *sndHandle; int16 _headerLen; - long _headerOffset; + int32 _headerOffset; int16 ff_A; char *_buffer; @@ -138,7 +138,7 @@ struct sound_t { int _length; int16 _mode; volatile int16 _locked; - long _loopStart; + int32 _loopStart; int16 _loopTimes; bool _reversed; int16 ff_32; @@ -173,7 +173,7 @@ struct soundchannel_t { }; typedef struct soundchannel_t soundchannel_t; -extern volatile long TimerTicks; +extern volatile int32 TimerTicks; extern View ScreenView; @@ -190,7 +190,7 @@ void CLSoundRaw_Free(sound_t *sound); void CLSoundRaw_AssignBuffer(sound_t *sound, void *buffer, int bufferOffs, int length); void SysBeep(int x); -long TickCount(); +int32 TickCount(); void FlushEvents(int16 arg1, int16 arg2); void CLBlitter_CopyViewRect(View *view1, View *view2, Common::Rect *rect1, Common::Rect *rect2); @@ -222,9 +222,9 @@ void CLFile_MakeStruct(int a3, int a4, const char *name, filespec_t *fs); void CLFile_Create(filespec_t *fs); void CLFile_Open(filespec_t *fs, int16 mode, file_t &handle); void CLFile_Close(file_t &handle); -void CLFile_SetPosition(file_t &handle, int16 mode, long pos); -void CLFile_Read(file_t &handle, void *buffer, long *size); -void CLFile_Write(file_t &handle, void *buffer, long *size); +void CLFile_SetPosition(file_t &handle, int16 mode, int32 pos); +void CLFile_Read(file_t &handle, void *buffer, int32 *size); +void CLFile_Write(file_t &handle, void *buffer, int32 *size); void CLSound_PrepareSample(sound_t *sound, int16 mode); void CLSound_SetWantsDesigned(int16 designed); @@ -316,7 +316,7 @@ void CLHNM_ReadHeader(hnm_t *hnm); int16 CLHNM_GetVersion(hnm_t *hnm); int CLHNM_GetFrameNum(hnm_t *hnm); void CLHNM_Prepare2Read(hnm_t *hnm, int mode); -void CLHNM_SetPosIntoFile(hnm_t *hnm, long pos); +void CLHNM_SetPosIntoFile(hnm_t *hnm, int32 pos); void CLHNM_Desentrelace320(byte *frame_buffer, byte *final_buffer, uint16 height); diff --git a/engines/cryo/defs.h b/engines/cryo/defs.h index 1e391762ff..0b340f1e9a 100644 --- a/engines/cryo/defs.h +++ b/engines/cryo/defs.h @@ -769,8 +769,8 @@ typedef struct global_t global_t; struct pakfile_t { char name[16]; - long size; - long offs; + int32 size; + int32 offs; char flag; }; typedef struct pakfile_t pakfile_t; diff --git a/engines/cryo/eden.cpp b/engines/cryo/eden.cpp index 3dcc8d54e2..e6f23a8976 100644 --- a/engines/cryo/eden.cpp +++ b/engines/cryo/eden.cpp @@ -4637,7 +4637,7 @@ void EdenGame::verifh(void *ptr) { void EdenGame::openbigfile() { assert(sizeof(pakfile_t) == 25); - long size = 0x10000; + int32 size = 0x10000; CLFile_MakeStruct(0, 0, "EDEN.DAT", &bigfilespec); CLFile_Open(&bigfilespec, 1, h_bigfile); CLFile_Read(h_bigfile, bigfile_header, &size); @@ -4652,9 +4652,9 @@ void EdenGame::closebigfile() { void EdenGame::loadFile(uint16 num, void *buffer) { assert(num < bigfile_header->count); pakfile_t *file = &bigfile_header->files[num]; - long size = PLE32(&file->size); - long offs = PLE32(&file->offs); - debug("* Loading resource %d (%s) at 0x%lX, %ld bytes", num, file->name, offs, size); + int32 size = PLE32(&file->size); + int32 offs = PLE32(&file->offs); + debug("* Loading resource %d (%s) at 0x%X, %d bytes", num, file->name, offs, size); CLFile_SetPosition(h_bigfile, fsFromStart, offs); CLFile_Read(h_bigfile, buffer, &size); } @@ -4671,8 +4671,8 @@ void EdenGame::shnmfl(uint16 num) { int EdenGame::ssndfl(uint16 num) { assert(num + 660 < bigfile_header->count); pakfile_t *file = &bigfile_header->files[num + 660]; - long size = PLE32(&file->size); - long offs = PLE32(&file->offs); + int32 size = PLE32(&file->size); + int32 offs = PLE32(&file->offs); if (_soundAllocated) { free(voiceSamplesBuffer); voiceSamplesBuffer = nullptr; @@ -4734,7 +4734,7 @@ void EdenGame::loadpermfiles() { } char EdenGame::ReadDataSync(uint16 num) { - long pos, len; + int32 pos, len; pos = PLE32(gameLipsync + num * 4); len = 1024; if (pos != -1) { @@ -4744,11 +4744,11 @@ char EdenGame::ReadDataSync(uint16 num) { return 0; } -void EdenGame::loadpartoffile(uint16 num, void *buffer, long pos, long len) { +void EdenGame::loadpartoffile(uint16 num, void *buffer, int32 pos, int32 len) { assert(num < bigfile_header->count); pakfile_t *file = &bigfile_header->files[num]; - long offs = PLE32(&file->offs); - debug("* Loading partial resource %d (%s) at 0x%lX(+0x%lX), %ld bytes", num, file->name, offs, pos, len); + int32 offs = PLE32(&file->offs); + debug("* Loading partial resource %d (%s) at 0x%X(+0x%X), %d bytes", num, file->name, offs, pos, len); CLFile_SetPosition(h_bigfile, 1, offs + pos); CLFile_Read(h_bigfile, buffer, &len); } @@ -6404,10 +6404,10 @@ void EdenGame::musicspy() { int EdenGame::loadmusicfile(int16 num) { pakfile_t *file = &bigfile_header->files[num + 435]; - long size = PLE32(&file->size); - long offs = PLE32(&file->offs); + int32 size = PLE32(&file->size); + int32 offs = PLE32(&file->offs); CLFile_SetPosition(h_bigfile, 1, offs); - long numread = size; + int32 numread = size; if (numread > 0x140000) //TODO: const numread = 0x140000; CLFile_Read(h_bigfile, music_buf, &numread); @@ -7984,7 +7984,7 @@ void EdenGame::phase560() { void EdenGame::savegame(char *name) { // filespec_t fs; // file_t handle; - long size; + int32 size; // CLFile_MakeStruct(0, 0, name, &fs); // CLFile_Create(&fs); // CLFile_SetFinderInfos(&fs, 'EDNS', 'LEDN'); @@ -7995,7 +7995,7 @@ void EdenGame::savegame(char *name) { return; #define CLFile_Write(h, ptr, size) \ -debug("writing 0x%lX bytes", *size); \ +debug("writing 0x%X bytes", *size); \ h->write(ptr, *size); vavaoffsetout(); @@ -8039,8 +8039,8 @@ h->write(ptr, *size); void EdenGame::loadrestart() { assert(0); //TODO: this won't work atm - all snapshots are BE - long offs = 0; - long size; + int32 offs = 0; + int32 size; size = (char *)(&p_global->save_end) - (char *)(p_global); loadpartoffile(2495, p_global, offs, size); offs += size; @@ -8082,7 +8082,7 @@ void EdenGame::loadrestart() { void EdenGame::loadgame(char *name) { // filespec_t fs; // file_t handle; - long size; + int32 size; // CLFile_MakeStruct(0, 0, name, &fs); // CLFile_Open(&fs, 3, handle); diff --git a/engines/cryo/eden.h b/engines/cryo/eden.h index 02ce8a7617..f99a8667ef 100644 --- a/engines/cryo/eden.h +++ b/engines/cryo/eden.h @@ -282,7 +282,7 @@ private: void ConvertMacToPC(); void loadpermfiles(); char ReadDataSync(uint16 num); - void loadpartoffile(uint16 num, void *buffer, long pos, long len); + void loadpartoffile(uint16 num, void *buffer, int32 pos, int32 len); void Expand_hsq(void *input, void *output); void ajouinfo(byte info); void unlockinfo(); @@ -682,7 +682,7 @@ private: int16 lines[200 * 8]; byte cube_texture[0x4000]; int cube_faces; - long curs_old_tick, curs_new_tick; + int32 curs_old_tick, curs_new_tick; }; -- cgit v1.2.3