Moved (In/Out)SaveFile(Manager) and Timer to namespace Common
svn-id: r18038
This commit is contained in:
parent
b75c969e66
commit
72f4c03b0b
34 changed files with 132 additions and 101 deletions
|
@ -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();
|
||||
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -161,7 +161,7 @@ class OSystem_Dreamcast : public OSystem {
|
|||
void setWindowCaption(const char *caption);
|
||||
|
||||
// Savefile handling
|
||||
SaveFileManager *getSavefileManager();
|
||||
Common::SaveFileManager *getSavefileManager();
|
||||
|
||||
|
||||
// Extra SoftKbd support
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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. */
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
|
||||
//@}
|
||||
};
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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))
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue