From 72f4c03b0b9a6918a359b967ebc400a2701981d9 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Tue, 10 May 2005 23:17:38 +0000 Subject: Moved (In/Out)SaveFile(Manager) and Timer to namespace Common svn-id: r18038 --- backends/PalmOS/Src/palm.h | 2 +- backends/PalmOS/Src/palmsave.cpp | 18 +++++++++--------- backends/dc/dc.h | 2 +- backends/dc/vmsave.cpp | 12 ++++++------ backends/ps2/savefile.h | 6 +++--- backends/ps2/systemps2.h | 2 +- base/engine.cpp | 2 +- base/engine.h | 10 ++++++---- base/main.cpp | 4 ++-- common/savefile.cpp | 5 +++++ common/savefile.h | 4 ++++ common/system.cpp | 4 ++-- common/system.h | 10 ++++++---- common/timer.cpp | 12 ++++++++---- common/timer.h | 6 +++++- queen/queen.cpp | 10 +++++----- queen/queen.h | 6 ++++-- saga/render.cpp | 2 +- scumm/saveload.cpp | 8 ++++---- scumm/saveload.h | 12 +++++++----- scumm/script_v5.cpp | 4 ++-- scumm/scumm.h | 10 ++++++---- scumm/smush/smush_player.cpp | 2 +- scumm/thumbnail.cpp | 4 ++-- simon/saveload.cpp | 8 ++++---- sky/control.cpp | 14 +++++++------- sky/control.h | 8 +++++--- sound/mididrv.h | 2 +- sound/mpu401.cpp | 8 ++++---- sound/mpu401.h | 4 ++-- sound/softsynth/emumidi.h | 4 ++-- sword1/control.cpp | 12 ++++++------ sword1/control.h | 8 +++++--- sword2/save_rest.cpp | 8 ++++---- 34 files changed, 132 insertions(+), 101 deletions(-) diff --git a/backends/PalmOS/Src/palm.h b/backends/PalmOS/Src/palm.h index 6735c50973..490e0c3a7b 100644 --- a/backends/PalmOS/Src/palm.h +++ b/backends/PalmOS/Src/palm.h @@ -180,7 +180,7 @@ public: void ColorToRGB(byte color, uint8 &r, uint8 &g, uint8 &b); // Savefile management - SaveFileManager *getSavefileManager(); + Common::SaveFileManager *getSavefileManager(); static OSystem *create(); diff --git a/backends/PalmOS/Src/palmsave.cpp b/backends/PalmOS/Src/palmsave.cpp index 760460f369..a13a112e0f 100644 --- a/backends/PalmOS/Src/palmsave.cpp +++ b/backends/PalmOS/Src/palmsave.cpp @@ -28,7 +28,7 @@ // SaveFile class -class PalmSaveFile : public SaveFile { +class PalmSaveFile : public Common::SaveFile { public: PalmSaveFile(const char *filename, bool saveOrLoad); ~PalmSaveFile(); @@ -126,27 +126,27 @@ uint32 PalmSaveFile::write(const void *buf, uint32 size) { class PalmSaveFileManager : public SaveFileManager { public: - virtual OutSaveFile *openForSaving(const char *filename) { + virtual Common::OutSaveFile *openForSaving(const char *filename) { return openSavefile(filename, true); } - virtual InSaveFile *openForLoading(const char *filename) { + virtual Common::InSaveFile *openForLoading(const char *filename) { return openSavefile(filename, false); } - SaveFile *openSavefile(const char *filename, bool saveOrLoad); + Common::SaveFile *openSavefile(const char *filename, bool saveOrLoad); void listSavefiles(const char *prefix, bool *marks, int num); protected: - SaveFile *makeSaveFile(const char *filename, bool saveOrLoad); + Common::SaveFile *makeSaveFile(const char *filename, bool saveOrLoad); }; -SaveFile *PalmSaveFileManager::openSavefile(const char *filename, bool saveOrLoad) { +Common::SaveFile *PalmSaveFileManager::openSavefile(const char *filename, bool saveOrLoad) { char buf[256]; strncpy(buf, getSavePath(), sizeof(buf)); strncat(buf, filename, sizeof(buf)); - SaveFile *sf = makeSaveFile(buf, saveOrLoad); + Common::SaveFile *sf = makeSaveFile(buf, saveOrLoad); if (!sf->isOpen()) { delete sf; sf = NULL; @@ -194,11 +194,11 @@ void PalmSaveFileManager::listSavefiles(const char *prefix, bool *marks, int num VFSFileClose(fileRef); } -SaveFile *PalmSaveFileManager::makeSaveFile(const char *filename, bool saveOrLoad) { +Common::SaveFile *PalmSaveFileManager::makeSaveFile(const char *filename, bool saveOrLoad) { return new PalmSaveFile(filename, saveOrLoad); } // OSystem -SaveFileManager *OSystem_PALMOS::getSavefileManager() { +Common::SaveFileManager *OSystem_PALMOS::getSavefileManager() { return new PalmSaveFileManager(); } diff --git a/backends/dc/dc.h b/backends/dc/dc.h index 3b7c0ae31f..d95c6f7f37 100644 --- a/backends/dc/dc.h +++ b/backends/dc/dc.h @@ -161,7 +161,7 @@ class OSystem_Dreamcast : public OSystem { void setWindowCaption(const char *caption); // Savefile handling - SaveFileManager *getSavefileManager(); + Common::SaveFileManager *getSavefileManager(); // Extra SoftKbd support diff --git a/backends/dc/vmsave.cpp b/backends/dc/vmsave.cpp index cf6ead1100..63710a0344 100644 --- a/backends/dc/vmsave.cpp +++ b/backends/dc/vmsave.cpp @@ -216,7 +216,7 @@ bool readSaveGame(char *&buffer, int &size, const char *filename) } -class InVMSave : public InSaveFile { +class InVMSave : public Common::InSaveFile { private: char *buffer; int pos, size; @@ -254,7 +254,7 @@ public: } }; -class OutVMSave : public OutSaveFile { +class OutVMSave : public Common::OutSaveFile { private: char *buffer; int pos, size; @@ -273,14 +273,14 @@ public: ~OutVMSave(); }; -class VMSaveManager : public SaveFileManager { +class VMSaveManager : public Common::SaveFileManager { public: - virtual OutSaveFile *openForSaving(const char *filename) { + virtual Common::OutSaveFile *openForSaving(const char *filename) { return new OutVMSave(filename); } - virtual InSaveFile *openForLoading(const char *filename) { + virtual Common::InSaveFile *openForLoading(const char *filename) { InVMSave *s = new InVMSave(); if(s->readSaveGame(filename)) { s->tryUncompress(); @@ -349,7 +349,7 @@ void VMSaveManager::listSavefiles(const char *prefix, bool *marks, int num) tryList(prefix, marks, num, i); } -SaveFileManager *OSystem_Dreamcast::getSavefileManager() +Common::SaveFileManager *OSystem_Dreamcast::getSavefileManager() { return new VMSaveManager(); } diff --git a/backends/ps2/savefile.h b/backends/ps2/savefile.h index 66d27f1bbb..364a80dbed 100644 --- a/backends/ps2/savefile.h +++ b/backends/ps2/savefile.h @@ -34,13 +34,13 @@ enum SaveMode { class Gs2dScreen; class OSystem_PS2; -class Ps2SaveFileManager : public SaveFileManager { +class Ps2SaveFileManager : public Common::SaveFileManager { public: Ps2SaveFileManager(OSystem_PS2 *system, Gs2dScreen *screen); virtual ~Ps2SaveFileManager(); - virtual InSaveFile *openForLoading(const char *filename); - virtual OutSaveFile *openForSaving(const char *filename); + virtual Common::InSaveFile *openForLoading(const char *filename); + virtual Common::OutSaveFile *openForSaving(const char *filename); virtual void listSavefiles(const char *prefix, bool *marks, int num); /** Get the path to the save game directory. */ diff --git a/backends/ps2/systemps2.h b/backends/ps2/systemps2.h index 942cf1b851..20c97da085 100644 --- a/backends/ps2/systemps2.h +++ b/backends/ps2/systemps2.h @@ -85,7 +85,7 @@ public: virtual void colorToRGB(OverlayColor color, uint8 &r, uint8 &g, uint8 &b); - virtual SaveFileManager *getSavefileManager(); + virtual Common::SaveFileManager *getSavefileManager(); void timerThread(void); void soundThread(void); diff --git a/base/engine.cpp b/base/engine.cpp index 081fd27b4f..5905e7e598 100644 --- a/base/engine.cpp +++ b/base/engine.cpp @@ -39,7 +39,7 @@ Engine::Engine(OSystem *syst) g_engine = this; _mixer = GameDetector::createMixer(); - _timer = g_timer; + _timer = Common::g_timer; // Add default file directory Common::File::addDefaultDirectory(_gameDataPath); diff --git a/base/engine.h b/base/engine.h index b8d0e06f77..1aa2a07084 100644 --- a/base/engine.h +++ b/base/engine.h @@ -26,19 +26,21 @@ class GameDetector; class OSystem; -class SaveFileManager; class SoundMixer; -class Timer; +namespace Common { + class SaveFileManager; + class Timer; +} class Engine { public: OSystem *_system; SoundMixer *_mixer; - Timer * _timer; + Common::Timer * _timer; protected: const Common::String _gameDataPath; - SaveFileManager *_saveFileMan; + Common::SaveFileManager *_saveFileMan; public: Engine(OSystem *syst); diff --git a/base/main.cpp b/base/main.cpp index 32e63c9f74..95681740b8 100644 --- a/base/main.cpp +++ b/base/main.cpp @@ -405,7 +405,7 @@ extern "C" int main(int argc, char *argv[]) { system.initBackend(); // Create the timer services - g_timer = new Timer(&system); + Common::g_timer = new Common::Timer(&system); // Set initial window caption system.setWindowCaption(gScummVMFullVersion); @@ -446,7 +446,7 @@ extern "C" int main(int argc, char *argv[]) { } // ...and quit (the return 0 should never be reached) - delete g_timer; + delete Common::g_timer; system.quit(); error("If you are seeing this, your OSystem backend is not working properly"); diff --git a/common/savefile.cpp b/common/savefile.cpp index e5b7a3501c..72a855972c 100644 --- a/common/savefile.cpp +++ b/common/savefile.cpp @@ -32,6 +32,8 @@ #endif +namespace Common { + const char *SaveFileManager::getSavePath() const { #if defined(__PALM_OS__) @@ -195,3 +197,6 @@ SaveFile *DefaultSaveFileManager::makeSaveFile(const char *filename, bool saveOr } return sf; } + + +} // End of namespace Common diff --git a/common/savefile.h b/common/savefile.h index e8496a8a4c..06f1a03f24 100644 --- a/common/savefile.h +++ b/common/savefile.h @@ -27,6 +27,8 @@ #include "common/stream.h" +namespace Common { + /** * A class which allows game engines to load game state data. * That typically means "save games", but also includes things like the @@ -94,4 +96,6 @@ protected: SaveFile *makeSaveFile(const char *filename, bool saveOrLoad); }; +} // End of namespace Common + #endif diff --git a/common/system.cpp b/common/system.cpp index b40e30185f..16b707e79e 100644 --- a/common/system.cpp +++ b/common/system.cpp @@ -89,6 +89,6 @@ void OSystem::displayMessageOnOSD(const char *msg) { dialog.runModal(); } -SaveFileManager *OSystem::getSavefileManager() { - return new DefaultSaveFileManager(); +Common::SaveFileManager *OSystem::getSavefileManager() { + return new Common::DefaultSaveFileManager(); } diff --git a/common/system.h b/common/system.h index 0be620b788..3566f5ea14 100644 --- a/common/system.h +++ b/common/system.h @@ -29,10 +29,12 @@ #include "common/singleton.h" namespace Graphics { -struct Surface; -} // end of namespace Graphics + struct Surface; +} -class SaveFileManager; +namespace Common { + class SaveFileManager; +} /** * Interface for ScummVM backends. If you want to port ScummVM to a system @@ -897,7 +899,7 @@ public: virtual void displayMessageOnOSD(const char *msg); /** Savefile management. */ - virtual SaveFileManager *getSavefileManager(); + virtual Common::SaveFileManager *getSavefileManager(); //@} }; diff --git a/common/timer.cpp b/common/timer.cpp index 2075243106..6c298bde77 100644 --- a/common/timer.cpp +++ b/common/timer.cpp @@ -26,6 +26,8 @@ #include "common/util.h" #include "common/system.h" +namespace Common { + Timer *g_timer = NULL; Timer::Timer(OSystem *system) : @@ -55,7 +57,7 @@ Timer::~Timer() { _system->setTimerCallback(0, 0); { - Common::StackLock lock(_mutex); + StackLock lock(_mutex); for (int i = 0; i < MAX_TIMERS; i++) { _timerSlots[i].procedure = NULL; _timerSlots[i].interval = 0; @@ -71,7 +73,7 @@ int Timer::timer_handler(int t) { } int Timer::handler(int t) { - Common::StackLock lock(_mutex); + StackLock lock(_mutex); uint32 interval, l; _lastTime = _thisTime; @@ -96,7 +98,7 @@ int Timer::handler(int t) { bool Timer::installTimerProc(TimerProc procedure, int32 interval, void *refCon) { assert(interval > 0); - Common::StackLock lock(_mutex); + StackLock lock(_mutex); for (int l = 0; l < MAX_TIMERS; l++) { if (!_timerSlots[l].procedure) { @@ -113,7 +115,7 @@ bool Timer::installTimerProc(TimerProc procedure, int32 interval, void *refCon) } void Timer::removeTimerProc(TimerProc procedure) { - Common::StackLock lock(_mutex); + StackLock lock(_mutex); for (int l = 0; l < MAX_TIMERS; l++) { if (_timerSlots[l].procedure == procedure) { @@ -125,4 +127,6 @@ void Timer::removeTimerProc(TimerProc procedure) { } } +} // End of namespace Common + #endif diff --git a/common/timer.h b/common/timer.h index d509402314..8e79c3e2bc 100644 --- a/common/timer.h +++ b/common/timer.h @@ -33,13 +33,15 @@ class OSystem; +namespace Common { + class Timer { public: typedef void (*TimerProc)(void *refCon); private: OSystem *_system; - Common::Mutex _mutex; + Mutex _mutex; void *_timerHandler; int32 _thisTime; int32 _lastTime; @@ -81,6 +83,8 @@ protected: extern Timer *g_timer; +} // End of namespace Common + #endif #endif diff --git a/queen/queen.cpp b/queen/queen.cpp index 67b28f8308..a1d1ecae67 100644 --- a/queen/queen.cpp +++ b/queen/queen.cpp @@ -252,7 +252,7 @@ void QueenEngine::saveGameState(uint16 slot, const char *desc) { debug(3, "Saving game to slot %d", slot); char name[20]; makeGameStateName(slot, name); - OutSaveFile *file = _saveFileMan->openForSaving(name); + Common::OutSaveFile *file = _saveFileMan->openForSaving(name); if (file) { // save data byte *saveData = new byte[30000]; @@ -287,7 +287,7 @@ void QueenEngine::saveGameState(uint16 slot, const char *desc) { void QueenEngine::loadGameState(uint16 slot) { debug(3, "Loading game from slot %d", slot); GameStateHeader header; - InSaveFile *file = readGameStateHeader(slot, &header); + Common::InSaveFile *file = readGameStateHeader(slot, &header); if (file && header.dataSize != 0) { byte *saveData = new byte[header.dataSize]; byte *p = saveData; @@ -308,10 +308,10 @@ void QueenEngine::loadGameState(uint16 slot) { } } -InSaveFile *QueenEngine::readGameStateHeader(uint16 slot, GameStateHeader *gsh) { +Common::InSaveFile *QueenEngine::readGameStateHeader(uint16 slot, GameStateHeader *gsh) { char name[20]; makeGameStateName(slot, name); - InSaveFile *file = _saveFileMan->openForLoading(name); + Common::InSaveFile *file = _saveFileMan->openForLoading(name); if (file && file->readUint32BE() == 'SCVM') { gsh->version = file->readUint32BE(); gsh->flags = file->readUint32BE(); @@ -340,7 +340,7 @@ void QueenEngine::findGameStateDescriptions(char descriptions[100][32]) { for (int i = 0; i < SAVESTATE_MAX; ++i) { if (marks[i]) { GameStateHeader header; - InSaveFile *f = readGameStateHeader(i, &header); + Common::InSaveFile *f = readGameStateHeader(i, &header); strcpy(descriptions[i], header.description); delete f; } diff --git a/queen/queen.h b/queen/queen.h index d947469ae8..f6e614885e 100644 --- a/queen/queen.h +++ b/queen/queen.h @@ -25,7 +25,9 @@ #include "base/engine.h" class GameDetector; -class InSaveFile; +namespace Common { + class InSaveFile; +} #if defined(_WIN32_WCE) && (_WIN32_WCE <= 300) @@ -114,7 +116,7 @@ public: void loadGameState(uint16 slot); void makeGameStateName(uint16 slot, char *buf); void findGameStateDescriptions(char descriptions[100][32]); - InSaveFile *readGameStateHeader(uint16 slot, GameStateHeader *gsh); + Common::InSaveFile *readGameStateHeader(uint16 slot, GameStateHeader *gsh); enum { SAVESTATE_CUR_VER = 1, diff --git a/saga/render.cpp b/saga/render.cpp index eab1884729..35b5013246 100644 --- a/saga/render.cpp +++ b/saga/render.cpp @@ -51,7 +51,7 @@ Render::Render(SagaEngine *vm, OSystem *system) { // Initialize FPS timer callback - g_timer->installTimerProc(&fpsTimerCallback, 1000000, this); + Common::g_timer->installTimerProc(&fpsTimerCallback, 1000000, this); // Create background buffer _bg_buf_w = _vm->getDisplayWidth(); diff --git a/scumm/saveload.cpp b/scumm/saveload.cpp index 8dc0039969..af9cfaf26c 100644 --- a/scumm/saveload.cpp +++ b/scumm/saveload.cpp @@ -68,7 +68,7 @@ void ScummEngine::requestLoad(int slot) { bool ScummEngine::saveState(int slot, bool compat) { char filename[256]; - OutSaveFile *out; + Common::OutSaveFile *out; SaveGameHeader hdr; makeSavegameName(filename, slot, compat); @@ -94,7 +94,7 @@ bool ScummEngine::saveState(int slot, bool compat) { bool ScummEngine::loadState(int slot, bool compat) { char filename[256]; - InSaveFile *in; + Common::InSaveFile *in; int i, j; SaveGameHeader hdr; int sb, sh; @@ -365,7 +365,7 @@ void ScummEngine::listSavegames(bool *marks, int num) { bool ScummEngine::getSavegameName(int slot, char *desc) { char filename[256]; - InSaveFile *in; + Common::InSaveFile *in; SaveGameHeader hdr; int len; @@ -402,7 +402,7 @@ bool ScummEngine::getSavegameName(int slot, char *desc) { Graphics::Surface *ScummEngine::loadThumbnailFromSlot(int slot) { char filename[256]; - InSaveFile *in; + Common::InSaveFile *in; SaveGameHeader hdr; int len; diff --git a/scumm/saveload.h b/scumm/saveload.h index 79cfb43cef..51df8865be 100644 --- a/scumm/saveload.h +++ b/scumm/saveload.h @@ -24,8 +24,10 @@ #include "common/scummsys.h" -class InSaveFile; -class OutSaveFile; +namespace Common { + class InSaveFile; + class OutSaveFile; +} namespace Scumm { @@ -126,7 +128,7 @@ typedef void *SerializerLoadReference(void *me, byte type, int ref); class Serializer { public: - Serializer(InSaveFile *in, OutSaveFile *out, uint32 savegameVersion) + Serializer(Common::InSaveFile *in, Common::OutSaveFile *out, uint32 savegameVersion) : _loadStream(in), _saveStream(out), _save_ref(0), _load_ref(0), _ref_me(0), _savegameVersion(savegameVersion) { } @@ -155,8 +157,8 @@ public: void loadBytes(void *b, int len); protected: - InSaveFile *_loadStream; - OutSaveFile *_saveStream; + Common::InSaveFile *_loadStream; + Common::OutSaveFile *_saveStream; uint32 _savegameVersion; void saveArrayOf(void *b, int len, int datasize, byte filetype); diff --git a/scumm/script_v5.cpp b/scumm/script_v5.cpp index fd35a7117e..b868cf2420 100644 --- a/scumm/script_v5.cpp +++ b/scumm/script_v5.cpp @@ -1948,7 +1948,7 @@ void ScummEngine_v5::o5_roomOps() { case 13: // SO_SAVE_STRING { - OutSaveFile *file; + Common::OutSaveFile *file; char filename[256], *s; a = getVarOrDirectByte(PARAM_1); @@ -1967,7 +1967,7 @@ void ScummEngine_v5::o5_roomOps() { } case 14: // SO_LOAD_STRING { - InSaveFile *file; + Common::InSaveFile *file; char filename[256], *s; a = getVarOrDirectByte(PARAM_1); diff --git a/scumm/scumm.h b/scumm/scumm.h index 53ae24ab94..c5b341a393 100644 --- a/scumm/scumm.h +++ b/scumm/scumm.h @@ -37,8 +37,10 @@ namespace GUI { } using GUI::Dialog; class GameDetector; -class InSaveFile; -class OutSaveFile; +namespace Common { + class InSaveFile; + class OutSaveFile; +} namespace Scumm { @@ -593,8 +595,8 @@ public: Graphics::Surface *loadThumbnailFromSlot(int slot); protected: - Graphics::Surface *loadThumbnail(InSaveFile *file); - void saveThumbnail(OutSaveFile *file); + Graphics::Surface *loadThumbnail(Common::InSaveFile *file); + void saveThumbnail(Common::OutSaveFile *file); protected: /* Script VM - should be in Script class */ diff --git a/scumm/smush/smush_player.cpp b/scumm/smush/smush_player.cpp index bfce7499e9..e49cf081bc 100644 --- a/scumm/smush/smush_player.cpp +++ b/scumm/smush/smush_player.cpp @@ -283,7 +283,7 @@ void SmushPlayer::init() { _vm->gdi._numStrips = _vm->virtscr[0].w / 8; _smixer = new SmushMixer(_vm->_mixer); - g_timer->installTimerProc(&timerCallback, _speed, this); + Common::g_timer->installTimerProc(&timerCallback, _speed, this); _initDone = true; } diff --git a/scumm/thumbnail.cpp b/scumm/thumbnail.cpp index dbe21698ed..81aa830ce4 100644 --- a/scumm/thumbnail.cpp +++ b/scumm/thumbnail.cpp @@ -54,7 +54,7 @@ inline void colorToRGB(uint16 color, uint8 &r, uint8 &g, uint8 &b) { b = ((color&0x1F) << 3); } -Graphics::Surface *ScummEngine::loadThumbnail(InSaveFile *file) { +Graphics::Surface *ScummEngine::loadThumbnail(Common::InSaveFile *file) { ThumbnailHeader header; header.type = file->readUint32BE(); if (header.type != MKID('THMB')) @@ -97,7 +97,7 @@ Graphics::Surface *ScummEngine::loadThumbnail(InSaveFile *file) { return thumb; } -void ScummEngine::saveThumbnail(OutSaveFile *file) { +void ScummEngine::saveThumbnail(Common::OutSaveFile *file) { Graphics::Surface thumb; if (!createThumbnailFromScreen(&thumb)) diff --git a/simon/saveload.cpp b/simon/saveload.cpp index f55f7d2fe8..b4cb94f104 100644 --- a/simon/saveload.cpp +++ b/simon/saveload.cpp @@ -41,7 +41,7 @@ void SimonEngine::o_load_game() { } int SimonEngine::count_savegames() { - InSaveFile *f; + Common::InSaveFile *f; uint i = 1; bool marks[256]; @@ -62,7 +62,7 @@ int SimonEngine::count_savegames() { int SimonEngine::display_savegame_list(int curpos, bool load, char *dst) { int slot, last_slot; - InSaveFile *in; + Common::InSaveFile *in; showMessageFormat("\xC"); @@ -400,7 +400,7 @@ loop:; } bool SimonEngine::save_game(uint slot, char *caption) { - OutSaveFile *f; + Common::OutSaveFile *f; uint item_index, num_item, i, j; TimeEvent *te; @@ -497,7 +497,7 @@ char *SimonEngine::gen_savename(int slot) { bool SimonEngine::load_game(uint slot) { char ident[18]; - InSaveFile *f; + Common::InSaveFile *f; uint num, item_index, i, j; _lockWord |= 0x100; diff --git a/sky/control.cpp b/sky/control.cpp index 4272ffe558..2ddb0639bb 100644 --- a/sky/control.cpp +++ b/sky/control.cpp @@ -194,7 +194,7 @@ void ControlStatus::drawToScreen(void) { _statusText->drawToScreen(WITH_MASK); } -Control::Control(SaveFileManager *saveFileMan, Screen *screen, Disk *disk, Mouse *mouse, Text *text, MusicBase *music, Logic *logic, Sound *sound, SkyCompact *skyCompact, OSystem *system) { +Control::Control(Common::SaveFileManager *saveFileMan, Screen *screen, Disk *disk, Mouse *mouse, Text *text, MusicBase *music, Logic *logic, Sound *sound, SkyCompact *skyCompact, OSystem *system) { _saveFileMan = saveFileMan; _skyScreen = screen; @@ -784,7 +784,7 @@ uint16 Control::shiftUp(uint8 speed) { bool Control::autoSaveExists(void) { bool test = false; - InSaveFile *f; + Common::InSaveFile *f; char fName[20]; if (SkyEngine::isCDVersion()) strcpy(fName, "SKY-VM-CD.ASD"); @@ -1012,7 +1012,7 @@ void Control::loadDescriptions(uint8 *destBuf) { memset(destBuf, 0, MAX_SAVE_GAMES * MAX_TEXT_LEN); - InSaveFile *inf; + Common::InSaveFile *inf; inf = _saveFileMan->openForLoading("SKY-VM.SAV"); if (inf != NULL) { uint8 *tmpBuf = (uint8 *)malloc(MAX_SAVE_GAMES * MAX_TEXT_LEN); @@ -1084,7 +1084,7 @@ void Control::saveDescriptions(uint8 *srcBuf) { tmpPos++; srcPos += MAX_TEXT_LEN; } - OutSaveFile *outf; + Common::OutSaveFile *outf; outf = _saveFileMan->openForSaving("SKY-VM.SAV"); if (outf != NULL) { @@ -1100,7 +1100,7 @@ void Control::doAutoSave(void) { strcpy(fName, "SKY-VM-CD.ASD"); else sprintf(fName, "SKY-VM%03d.ASD", SkyEngine::_systemVars.gameVersion); - OutSaveFile *outf; + Common::OutSaveFile *outf; outf = _saveFileMan->openForSaving(fName); if (outf == NULL) { @@ -1121,7 +1121,7 @@ uint16 Control::saveGameToFile(void) { char fName[20]; sprintf(fName,"SKY-VM.%03d", _selectedGame); - OutSaveFile *outf; + Common::OutSaveFile *outf; outf = _saveFileMan->openForSaving(fName); if (outf == NULL) { return NO_DISK_SPACE; @@ -1396,7 +1396,7 @@ uint16 Control::restoreGameFromFile(bool autoSave) { } else sprintf(fName,"SKY-VM.%03d", _selectedGame); - InSaveFile *inf; + Common::InSaveFile *inf; inf = _saveFileMan->openForLoading(fName); if (inf == NULL) { return RESTORE_FAILED; diff --git a/sky/control.h b/sky/control.h index 85edbea191..68edf85c00 100644 --- a/sky/control.h +++ b/sky/control.h @@ -26,7 +26,9 @@ #include "common/scummsys.h" class OSystem; -class SaveFileManager; +namespace Common { + class SaveFileManager; +} namespace Sky { @@ -175,7 +177,7 @@ private: class Control { public: - Control(SaveFileManager *saveFileMan, Screen *screen, Disk *disk, Mouse *mouse, Text *text, MusicBase *music, Logic *logic, Sound *sound, SkyCompact *skyCompact, OSystem *system); + Control(Common::SaveFileManager *saveFileMan, Screen *screen, Disk *disk, Mouse *mouse, Text *text, MusicBase *music, Logic *logic, Sound *sound, SkyCompact *skyCompact, OSystem *system); void doControlPanel(void); void doLoadSavePanel(void); void restartGame(void); @@ -226,7 +228,7 @@ private: void importOldCompact(Compact* destCpt, uint8 **srcPos, uint16 numElems, uint16 type, char *name); uint16 parseSaveData(uint8 *srcBuf); - SaveFileManager *_saveFileMan; + Common::SaveFileManager *_saveFileMan; SkyCompact *_skyCompact; Screen *_skyScreen; Disk *_skyDisk; diff --git a/sound/mididrv.h b/sound/mididrv.h index af538d096a..98b29747d2 100644 --- a/sound/mididrv.h +++ b/sound/mididrv.h @@ -146,7 +146,7 @@ public: virtual void metaEvent (byte type, byte*data, uint16 length) { } // Timing functions - MidiDriver now operates timers - virtual void setTimerCallback (void *timer_param, Timer::TimerProc timer_proc) = 0; + virtual void setTimerCallback (void *timer_param, Common::Timer::TimerProc timer_proc) = 0; /** The time in microseconds between invocations of the timer callback. */ virtual uint32 getBaseTempo (void) = 0; diff --git a/sound/mpu401.cpp b/sound/mpu401.cpp index 88a1afd32f..00e867cf3a 100644 --- a/sound/mpu401.cpp +++ b/sound/mpu401.cpp @@ -99,7 +99,7 @@ MidiDriver_MPU401::MidiDriver_MPU401() : void MidiDriver_MPU401::close() { if (_timer_proc) - g_timer->removeTimerProc(_timer_proc); + Common::g_timer->removeTimerProc(_timer_proc); _timer_proc = 0; for (int i = 0; i < 16; ++i) send (0x7B << 8 | 0xB0 | i); @@ -130,12 +130,12 @@ MidiChannel *MidiDriver_MPU401::allocateChannel() { return NULL; } -void MidiDriver_MPU401::setTimerCallback(void *timer_param, Timer::TimerProc timer_proc) { +void MidiDriver_MPU401::setTimerCallback(void *timer_param, Common::Timer::TimerProc timer_proc) { if (!_timer_proc || !timer_proc) { if (_timer_proc) - g_timer->removeTimerProc(_timer_proc); + Common::g_timer->removeTimerProc(_timer_proc); _timer_proc = timer_proc; if (timer_proc) - g_timer->installTimerProc(timer_proc, 10000, timer_param); + Common::g_timer->installTimerProc(timer_proc, 10000, timer_param); } } diff --git a/sound/mpu401.h b/sound/mpu401.h index 7b722df7c9..6dc391aaca 100644 --- a/sound/mpu401.h +++ b/sound/mpu401.h @@ -70,14 +70,14 @@ public: class MidiDriver_MPU401 : public MidiDriver { private: MidiChannel_MPU401 _midi_channels [16]; - Timer::TimerProc _timer_proc; + Common::Timer::TimerProc _timer_proc; uint16 _channel_mask; public: MidiDriver_MPU401(); virtual void close(); - void setTimerCallback(void *timer_param, Timer::TimerProc timer_proc); + void setTimerCallback(void *timer_param, Common::Timer::TimerProc timer_proc); uint32 getBaseTempo(void) { return 10000; } uint32 property(int prop, uint32 param); diff --git a/sound/softsynth/emumidi.h b/sound/softsynth/emumidi.h index 160a4fa83b..19e2e86476 100644 --- a/sound/softsynth/emumidi.h +++ b/sound/softsynth/emumidi.h @@ -31,7 +31,7 @@ protected: SoundMixer *_mixer; private: - Timer::TimerProc _timerProc; + Common::Timer::TimerProc _timerProc; void *_timerParam; int _nextTick; @@ -69,7 +69,7 @@ public: return 0; } - void setTimerCallback(void *timer_param, Timer::TimerProc timer_proc) { + void setTimerCallback(void *timer_param, Common::Timer::TimerProc timer_proc) { _timerProc = timer_proc; _timerParam = timer_param; } diff --git a/sword1/control.cpp b/sword1/control.cpp index a572aaee4a..616a03db0a 100644 --- a/sword1/control.cpp +++ b/sword1/control.cpp @@ -157,7 +157,7 @@ void ControlButton::setSelected(uint8 selected) { draw(); } -Control::Control(SaveFileManager *saveFileMan, ResMan *pResMan, ObjectMan *pObjMan, OSystem *system, Mouse *pMouse, Sound *pSound, Music *pMusic) { +Control::Control(Common::SaveFileManager *saveFileMan, ResMan *pResMan, ObjectMan *pObjMan, OSystem *system, Mouse *pMouse, Sound *pSound, Music *pMusic) { _saveFileMan = saveFileMan; _resMan = pResMan; _objMan = pObjMan; @@ -669,7 +669,7 @@ bool Control::restoreFromFile(void) { } void Control::readSavegameDescriptions(void) { - InSaveFile *inf; + Common::InSaveFile *inf; inf = _saveFileMan->openForLoading("SAVEGAME.INF"); _saveScrollPos = _saveFiles = 0; _selectedSavegame = 255; @@ -712,7 +712,7 @@ int Control::displayMessage(const char *altButton, const char *message, ...) { } void Control::writeSavegameDescriptions(void) { - OutSaveFile *outf; + Common::OutSaveFile *outf; outf = _saveFileMan->openForSaving("SAVEGAME.INF"); if (!outf) { @@ -737,7 +737,7 @@ void Control::writeSavegameDescriptions(void) { bool Control::savegamesExist(void) { bool retVal = false; - InSaveFile *inf; + Common::InSaveFile *inf; inf = _saveFileMan->openForLoading("SAVEGAME.INF"); if (inf) retVal = true; @@ -894,7 +894,7 @@ void Control::saveGameToFile(uint8 slot) { uint16 cnt; sprintf(fName, "SAVEGAME.%03d", slot); uint16 liveBuf[TOTAL_SECTIONS]; - OutSaveFile *outf; + Common::OutSaveFile *outf; outf = _saveFileMan->openForSaving(fName); if (!outf) { // Display an error message, and do nothing @@ -927,7 +927,7 @@ bool Control::restoreGameFromFile(uint8 slot) { char fName[15]; uint16 cnt; sprintf(fName, "SAVEGAME.%03d", slot); - InSaveFile *inf; + Common::InSaveFile *inf; inf = _saveFileMan->openForLoading(fName); if (!inf) { // Display an error message, and do nothing diff --git a/sword1/control.h b/sword1/control.h index 68bf176326..cda29b5ae2 100644 --- a/sword1/control.h +++ b/sword1/control.h @@ -26,7 +26,9 @@ #include "sword1/sworddefs.h" class OSystem; -class SaveFileManager; +namespace Common { + class SaveFileManager; +} namespace Sword1 { @@ -68,7 +70,7 @@ struct ButtonInfo { class Control { public: - Control(SaveFileManager *saveFileMan, ResMan *pResMan, ObjectMan *pObjMan, OSystem *system, Mouse *pMouse, Sound *pSound, Music *pMusic); + Control(Common::SaveFileManager *saveFileMan, ResMan *pResMan, ObjectMan *pObjMan, OSystem *system, Mouse *pMouse, Sound *pSound, Music *pMusic); uint8 runPanel(void); void doRestore(void); void askForCd(void); @@ -119,7 +121,7 @@ private: static const ButtonInfo _deathButtons[3], _panelButtons[7], _saveButtons[16], _volumeButtons[4]; static const uint8 _languageStrings[8 * 20][43]; const uint8 (*_lStrings)[43]; - SaveFileManager *_saveFileMan; + Common::SaveFileManager *_saveFileMan; ObjectMan *_objMan; ResMan *_resMan; OSystem *_system; diff --git a/sword2/save_rest.cpp b/sword2/save_rest.cpp index c8e27ee53c..366d519f46 100644 --- a/sword2/save_rest.cpp +++ b/sword2/save_rest.cpp @@ -183,7 +183,7 @@ uint32 Sword2Engine::saveData(uint16 slotNo, byte *buffer, uint32 bufferSize) { sprintf(saveFileName, "%s.%.3d", _targetName.c_str(), slotNo); - OutSaveFile *out; + Common::OutSaveFile *out; if (!(out = _saveFileMan->openForSaving(saveFileName))) { return SR_ERR_FILEOPEN; @@ -261,7 +261,7 @@ uint32 Sword2Engine::restoreData(uint16 slotNo, byte *buffer, uint32 bufferSize) sprintf(saveFileName, "%s.%.3d", _targetName.c_str(), slotNo); - InSaveFile *in; + Common::InSaveFile *in; if (!(in = _saveFileMan->openForLoading(saveFileName))) { // error: couldn't open file @@ -405,7 +405,7 @@ uint32 Sword2Engine::getSaveDescription(uint16 slotNo, byte *description) { sprintf(saveFileName, "%s.%.3d", _targetName.c_str(), slotNo); - InSaveFile *in; + Common::InSaveFile *in; if (!(in = _saveFileMan->openForLoading(saveFileName))) { return SR_ERR_FILEOPEN; @@ -432,7 +432,7 @@ bool Sword2Engine::saveExists(uint16 slotNo) { sprintf(saveFileName, "%s.%.3d", _targetName.c_str(), slotNo); - InSaveFile *in; + Common::InSaveFile *in; if (!(in = _saveFileMan->openForLoading(saveFileName))) { return false; -- cgit v1.2.3