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);
|
void ColorToRGB(byte color, uint8 &r, uint8 &g, uint8 &b);
|
||||||
|
|
||||||
// Savefile management
|
// Savefile management
|
||||||
SaveFileManager *getSavefileManager();
|
Common::SaveFileManager *getSavefileManager();
|
||||||
|
|
||||||
static OSystem *create();
|
static OSystem *create();
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
|
|
||||||
// SaveFile class
|
// SaveFile class
|
||||||
|
|
||||||
class PalmSaveFile : public SaveFile {
|
class PalmSaveFile : public Common::SaveFile {
|
||||||
public:
|
public:
|
||||||
PalmSaveFile(const char *filename, bool saveOrLoad);
|
PalmSaveFile(const char *filename, bool saveOrLoad);
|
||||||
~PalmSaveFile();
|
~PalmSaveFile();
|
||||||
|
@ -126,27 +126,27 @@ uint32 PalmSaveFile::write(const void *buf, uint32 size) {
|
||||||
|
|
||||||
class PalmSaveFileManager : public SaveFileManager {
|
class PalmSaveFileManager : public SaveFileManager {
|
||||||
public:
|
public:
|
||||||
virtual OutSaveFile *openForSaving(const char *filename) {
|
virtual Common::OutSaveFile *openForSaving(const char *filename) {
|
||||||
return openSavefile(filename, true);
|
return openSavefile(filename, true);
|
||||||
}
|
}
|
||||||
virtual InSaveFile *openForLoading(const char *filename) {
|
virtual Common::InSaveFile *openForLoading(const char *filename) {
|
||||||
return openSavefile(filename, false);
|
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);
|
void listSavefiles(const char *prefix, bool *marks, int num);
|
||||||
|
|
||||||
protected:
|
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];
|
char buf[256];
|
||||||
|
|
||||||
strncpy(buf, getSavePath(), sizeof(buf));
|
strncpy(buf, getSavePath(), sizeof(buf));
|
||||||
strncat(buf, filename, sizeof(buf));
|
strncat(buf, filename, sizeof(buf));
|
||||||
|
|
||||||
SaveFile *sf = makeSaveFile(buf, saveOrLoad);
|
Common::SaveFile *sf = makeSaveFile(buf, saveOrLoad);
|
||||||
if (!sf->isOpen()) {
|
if (!sf->isOpen()) {
|
||||||
delete sf;
|
delete sf;
|
||||||
sf = NULL;
|
sf = NULL;
|
||||||
|
@ -194,11 +194,11 @@ void PalmSaveFileManager::listSavefiles(const char *prefix, bool *marks, int num
|
||||||
VFSFileClose(fileRef);
|
VFSFileClose(fileRef);
|
||||||
}
|
}
|
||||||
|
|
||||||
SaveFile *PalmSaveFileManager::makeSaveFile(const char *filename, bool saveOrLoad) {
|
Common::SaveFile *PalmSaveFileManager::makeSaveFile(const char *filename, bool saveOrLoad) {
|
||||||
return new PalmSaveFile(filename, saveOrLoad);
|
return new PalmSaveFile(filename, saveOrLoad);
|
||||||
}
|
}
|
||||||
|
|
||||||
// OSystem
|
// OSystem
|
||||||
SaveFileManager *OSystem_PALMOS::getSavefileManager() {
|
Common::SaveFileManager *OSystem_PALMOS::getSavefileManager() {
|
||||||
return new PalmSaveFileManager();
|
return new PalmSaveFileManager();
|
||||||
}
|
}
|
||||||
|
|
|
@ -161,7 +161,7 @@ class OSystem_Dreamcast : public OSystem {
|
||||||
void setWindowCaption(const char *caption);
|
void setWindowCaption(const char *caption);
|
||||||
|
|
||||||
// Savefile handling
|
// Savefile handling
|
||||||
SaveFileManager *getSavefileManager();
|
Common::SaveFileManager *getSavefileManager();
|
||||||
|
|
||||||
|
|
||||||
// Extra SoftKbd support
|
// 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:
|
private:
|
||||||
char *buffer;
|
char *buffer;
|
||||||
int pos, size;
|
int pos, size;
|
||||||
|
@ -254,7 +254,7 @@ public:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class OutVMSave : public OutSaveFile {
|
class OutVMSave : public Common::OutSaveFile {
|
||||||
private:
|
private:
|
||||||
char *buffer;
|
char *buffer;
|
||||||
int pos, size;
|
int pos, size;
|
||||||
|
@ -273,14 +273,14 @@ public:
|
||||||
~OutVMSave();
|
~OutVMSave();
|
||||||
};
|
};
|
||||||
|
|
||||||
class VMSaveManager : public SaveFileManager {
|
class VMSaveManager : public Common::SaveFileManager {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
virtual OutSaveFile *openForSaving(const char *filename) {
|
virtual Common::OutSaveFile *openForSaving(const char *filename) {
|
||||||
return new OutVMSave(filename);
|
return new OutVMSave(filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual InSaveFile *openForLoading(const char *filename) {
|
virtual Common::InSaveFile *openForLoading(const char *filename) {
|
||||||
InVMSave *s = new InVMSave();
|
InVMSave *s = new InVMSave();
|
||||||
if(s->readSaveGame(filename)) {
|
if(s->readSaveGame(filename)) {
|
||||||
s->tryUncompress();
|
s->tryUncompress();
|
||||||
|
@ -349,7 +349,7 @@ void VMSaveManager::listSavefiles(const char *prefix, bool *marks, int num)
|
||||||
tryList(prefix, marks, num, i);
|
tryList(prefix, marks, num, i);
|
||||||
}
|
}
|
||||||
|
|
||||||
SaveFileManager *OSystem_Dreamcast::getSavefileManager()
|
Common::SaveFileManager *OSystem_Dreamcast::getSavefileManager()
|
||||||
{
|
{
|
||||||
return new VMSaveManager();
|
return new VMSaveManager();
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,13 +34,13 @@ enum SaveMode {
|
||||||
class Gs2dScreen;
|
class Gs2dScreen;
|
||||||
class OSystem_PS2;
|
class OSystem_PS2;
|
||||||
|
|
||||||
class Ps2SaveFileManager : public SaveFileManager {
|
class Ps2SaveFileManager : public Common::SaveFileManager {
|
||||||
public:
|
public:
|
||||||
Ps2SaveFileManager(OSystem_PS2 *system, Gs2dScreen *screen);
|
Ps2SaveFileManager(OSystem_PS2 *system, Gs2dScreen *screen);
|
||||||
virtual ~Ps2SaveFileManager();
|
virtual ~Ps2SaveFileManager();
|
||||||
|
|
||||||
virtual InSaveFile *openForLoading(const char *filename);
|
virtual Common::InSaveFile *openForLoading(const char *filename);
|
||||||
virtual OutSaveFile *openForSaving(const char *filename);
|
virtual Common::OutSaveFile *openForSaving(const char *filename);
|
||||||
virtual void listSavefiles(const char *prefix, bool *marks, int num);
|
virtual void listSavefiles(const char *prefix, bool *marks, int num);
|
||||||
|
|
||||||
/** Get the path to the save game directory. */
|
/** 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 void colorToRGB(OverlayColor color, uint8 &r, uint8 &g, uint8 &b);
|
||||||
|
|
||||||
virtual SaveFileManager *getSavefileManager();
|
virtual Common::SaveFileManager *getSavefileManager();
|
||||||
|
|
||||||
void timerThread(void);
|
void timerThread(void);
|
||||||
void soundThread(void);
|
void soundThread(void);
|
||||||
|
|
|
@ -39,7 +39,7 @@ Engine::Engine(OSystem *syst)
|
||||||
g_engine = this;
|
g_engine = this;
|
||||||
_mixer = GameDetector::createMixer();
|
_mixer = GameDetector::createMixer();
|
||||||
|
|
||||||
_timer = g_timer;
|
_timer = Common::g_timer;
|
||||||
|
|
||||||
// Add default file directory
|
// Add default file directory
|
||||||
Common::File::addDefaultDirectory(_gameDataPath);
|
Common::File::addDefaultDirectory(_gameDataPath);
|
||||||
|
|
|
@ -26,19 +26,21 @@
|
||||||
|
|
||||||
class GameDetector;
|
class GameDetector;
|
||||||
class OSystem;
|
class OSystem;
|
||||||
class SaveFileManager;
|
|
||||||
class SoundMixer;
|
class SoundMixer;
|
||||||
class Timer;
|
namespace Common {
|
||||||
|
class SaveFileManager;
|
||||||
|
class Timer;
|
||||||
|
}
|
||||||
|
|
||||||
class Engine {
|
class Engine {
|
||||||
public:
|
public:
|
||||||
OSystem *_system;
|
OSystem *_system;
|
||||||
SoundMixer *_mixer;
|
SoundMixer *_mixer;
|
||||||
Timer * _timer;
|
Common::Timer * _timer;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
const Common::String _gameDataPath;
|
const Common::String _gameDataPath;
|
||||||
SaveFileManager *_saveFileMan;
|
Common::SaveFileManager *_saveFileMan;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Engine(OSystem *syst);
|
Engine(OSystem *syst);
|
||||||
|
|
|
@ -405,7 +405,7 @@ extern "C" int main(int argc, char *argv[]) {
|
||||||
system.initBackend();
|
system.initBackend();
|
||||||
|
|
||||||
// Create the timer services
|
// Create the timer services
|
||||||
g_timer = new Timer(&system);
|
Common::g_timer = new Common::Timer(&system);
|
||||||
|
|
||||||
// Set initial window caption
|
// Set initial window caption
|
||||||
system.setWindowCaption(gScummVMFullVersion);
|
system.setWindowCaption(gScummVMFullVersion);
|
||||||
|
@ -446,7 +446,7 @@ extern "C" int main(int argc, char *argv[]) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// ...and quit (the return 0 should never be reached)
|
// ...and quit (the return 0 should never be reached)
|
||||||
delete g_timer;
|
delete Common::g_timer;
|
||||||
system.quit();
|
system.quit();
|
||||||
|
|
||||||
error("If you are seeing this, your OSystem backend is not working properly");
|
error("If you are seeing this, your OSystem backend is not working properly");
|
||||||
|
|
|
@ -32,6 +32,8 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
namespace Common {
|
||||||
|
|
||||||
const char *SaveFileManager::getSavePath() const {
|
const char *SaveFileManager::getSavePath() const {
|
||||||
|
|
||||||
#if defined(__PALM_OS__)
|
#if defined(__PALM_OS__)
|
||||||
|
@ -195,3 +197,6 @@ SaveFile *DefaultSaveFileManager::makeSaveFile(const char *filename, bool saveOr
|
||||||
}
|
}
|
||||||
return sf;
|
return sf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
} // End of namespace Common
|
||||||
|
|
|
@ -27,6 +27,8 @@
|
||||||
#include "common/stream.h"
|
#include "common/stream.h"
|
||||||
|
|
||||||
|
|
||||||
|
namespace Common {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A class which allows game engines to load game state data.
|
* A class which allows game engines to load game state data.
|
||||||
* That typically means "save games", but also includes things like the
|
* That typically means "save games", but also includes things like the
|
||||||
|
@ -94,4 +96,6 @@ protected:
|
||||||
SaveFile *makeSaveFile(const char *filename, bool saveOrLoad);
|
SaveFile *makeSaveFile(const char *filename, bool saveOrLoad);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
} // End of namespace Common
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -89,6 +89,6 @@ void OSystem::displayMessageOnOSD(const char *msg) {
|
||||||
dialog.runModal();
|
dialog.runModal();
|
||||||
}
|
}
|
||||||
|
|
||||||
SaveFileManager *OSystem::getSavefileManager() {
|
Common::SaveFileManager *OSystem::getSavefileManager() {
|
||||||
return new DefaultSaveFileManager();
|
return new Common::DefaultSaveFileManager();
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,10 +29,12 @@
|
||||||
#include "common/singleton.h"
|
#include "common/singleton.h"
|
||||||
|
|
||||||
namespace Graphics {
|
namespace Graphics {
|
||||||
struct Surface;
|
struct Surface;
|
||||||
} // end of namespace Graphics
|
}
|
||||||
|
|
||||||
class SaveFileManager;
|
namespace Common {
|
||||||
|
class SaveFileManager;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Interface for ScummVM backends. If you want to port ScummVM to a system
|
* Interface for ScummVM backends. If you want to port ScummVM to a system
|
||||||
|
@ -897,7 +899,7 @@ public:
|
||||||
virtual void displayMessageOnOSD(const char *msg);
|
virtual void displayMessageOnOSD(const char *msg);
|
||||||
|
|
||||||
/** Savefile management. */
|
/** Savefile management. */
|
||||||
virtual SaveFileManager *getSavefileManager();
|
virtual Common::SaveFileManager *getSavefileManager();
|
||||||
|
|
||||||
//@}
|
//@}
|
||||||
};
|
};
|
||||||
|
|
|
@ -26,6 +26,8 @@
|
||||||
#include "common/util.h"
|
#include "common/util.h"
|
||||||
#include "common/system.h"
|
#include "common/system.h"
|
||||||
|
|
||||||
|
namespace Common {
|
||||||
|
|
||||||
Timer *g_timer = NULL;
|
Timer *g_timer = NULL;
|
||||||
|
|
||||||
Timer::Timer(OSystem *system) :
|
Timer::Timer(OSystem *system) :
|
||||||
|
@ -55,7 +57,7 @@ Timer::~Timer() {
|
||||||
_system->setTimerCallback(0, 0);
|
_system->setTimerCallback(0, 0);
|
||||||
|
|
||||||
{
|
{
|
||||||
Common::StackLock lock(_mutex);
|
StackLock lock(_mutex);
|
||||||
for (int i = 0; i < MAX_TIMERS; i++) {
|
for (int i = 0; i < MAX_TIMERS; i++) {
|
||||||
_timerSlots[i].procedure = NULL;
|
_timerSlots[i].procedure = NULL;
|
||||||
_timerSlots[i].interval = 0;
|
_timerSlots[i].interval = 0;
|
||||||
|
@ -71,7 +73,7 @@ int Timer::timer_handler(int t) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int Timer::handler(int t) {
|
int Timer::handler(int t) {
|
||||||
Common::StackLock lock(_mutex);
|
StackLock lock(_mutex);
|
||||||
uint32 interval, l;
|
uint32 interval, l;
|
||||||
|
|
||||||
_lastTime = _thisTime;
|
_lastTime = _thisTime;
|
||||||
|
@ -96,7 +98,7 @@ int Timer::handler(int t) {
|
||||||
|
|
||||||
bool Timer::installTimerProc(TimerProc procedure, int32 interval, void *refCon) {
|
bool Timer::installTimerProc(TimerProc procedure, int32 interval, void *refCon) {
|
||||||
assert(interval > 0);
|
assert(interval > 0);
|
||||||
Common::StackLock lock(_mutex);
|
StackLock lock(_mutex);
|
||||||
|
|
||||||
for (int l = 0; l < MAX_TIMERS; l++) {
|
for (int l = 0; l < MAX_TIMERS; l++) {
|
||||||
if (!_timerSlots[l].procedure) {
|
if (!_timerSlots[l].procedure) {
|
||||||
|
@ -113,7 +115,7 @@ bool Timer::installTimerProc(TimerProc procedure, int32 interval, void *refCon)
|
||||||
}
|
}
|
||||||
|
|
||||||
void Timer::removeTimerProc(TimerProc procedure) {
|
void Timer::removeTimerProc(TimerProc procedure) {
|
||||||
Common::StackLock lock(_mutex);
|
StackLock lock(_mutex);
|
||||||
|
|
||||||
for (int l = 0; l < MAX_TIMERS; l++) {
|
for (int l = 0; l < MAX_TIMERS; l++) {
|
||||||
if (_timerSlots[l].procedure == procedure) {
|
if (_timerSlots[l].procedure == procedure) {
|
||||||
|
@ -125,4 +127,6 @@ void Timer::removeTimerProc(TimerProc procedure) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // End of namespace Common
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -33,13 +33,15 @@
|
||||||
|
|
||||||
class OSystem;
|
class OSystem;
|
||||||
|
|
||||||
|
namespace Common {
|
||||||
|
|
||||||
class Timer {
|
class Timer {
|
||||||
public:
|
public:
|
||||||
typedef void (*TimerProc)(void *refCon);
|
typedef void (*TimerProc)(void *refCon);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
OSystem *_system;
|
OSystem *_system;
|
||||||
Common::Mutex _mutex;
|
Mutex _mutex;
|
||||||
void *_timerHandler;
|
void *_timerHandler;
|
||||||
int32 _thisTime;
|
int32 _thisTime;
|
||||||
int32 _lastTime;
|
int32 _lastTime;
|
||||||
|
@ -81,6 +83,8 @@ protected:
|
||||||
|
|
||||||
extern Timer *g_timer;
|
extern Timer *g_timer;
|
||||||
|
|
||||||
|
} // End of namespace Common
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -252,7 +252,7 @@ void QueenEngine::saveGameState(uint16 slot, const char *desc) {
|
||||||
debug(3, "Saving game to slot %d", slot);
|
debug(3, "Saving game to slot %d", slot);
|
||||||
char name[20];
|
char name[20];
|
||||||
makeGameStateName(slot, name);
|
makeGameStateName(slot, name);
|
||||||
OutSaveFile *file = _saveFileMan->openForSaving(name);
|
Common::OutSaveFile *file = _saveFileMan->openForSaving(name);
|
||||||
if (file) {
|
if (file) {
|
||||||
// save data
|
// save data
|
||||||
byte *saveData = new byte[30000];
|
byte *saveData = new byte[30000];
|
||||||
|
@ -287,7 +287,7 @@ void QueenEngine::saveGameState(uint16 slot, const char *desc) {
|
||||||
void QueenEngine::loadGameState(uint16 slot) {
|
void QueenEngine::loadGameState(uint16 slot) {
|
||||||
debug(3, "Loading game from slot %d", slot);
|
debug(3, "Loading game from slot %d", slot);
|
||||||
GameStateHeader header;
|
GameStateHeader header;
|
||||||
InSaveFile *file = readGameStateHeader(slot, &header);
|
Common::InSaveFile *file = readGameStateHeader(slot, &header);
|
||||||
if (file && header.dataSize != 0) {
|
if (file && header.dataSize != 0) {
|
||||||
byte *saveData = new byte[header.dataSize];
|
byte *saveData = new byte[header.dataSize];
|
||||||
byte *p = saveData;
|
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];
|
char name[20];
|
||||||
makeGameStateName(slot, name);
|
makeGameStateName(slot, name);
|
||||||
InSaveFile *file = _saveFileMan->openForLoading(name);
|
Common::InSaveFile *file = _saveFileMan->openForLoading(name);
|
||||||
if (file && file->readUint32BE() == 'SCVM') {
|
if (file && file->readUint32BE() == 'SCVM') {
|
||||||
gsh->version = file->readUint32BE();
|
gsh->version = file->readUint32BE();
|
||||||
gsh->flags = 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) {
|
for (int i = 0; i < SAVESTATE_MAX; ++i) {
|
||||||
if (marks[i]) {
|
if (marks[i]) {
|
||||||
GameStateHeader header;
|
GameStateHeader header;
|
||||||
InSaveFile *f = readGameStateHeader(i, &header);
|
Common::InSaveFile *f = readGameStateHeader(i, &header);
|
||||||
strcpy(descriptions[i], header.description);
|
strcpy(descriptions[i], header.description);
|
||||||
delete f;
|
delete f;
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,9 @@
|
||||||
#include "base/engine.h"
|
#include "base/engine.h"
|
||||||
|
|
||||||
class GameDetector;
|
class GameDetector;
|
||||||
class InSaveFile;
|
namespace Common {
|
||||||
|
class InSaveFile;
|
||||||
|
}
|
||||||
|
|
||||||
#if defined(_WIN32_WCE) && (_WIN32_WCE <= 300)
|
#if defined(_WIN32_WCE) && (_WIN32_WCE <= 300)
|
||||||
|
|
||||||
|
@ -114,7 +116,7 @@ public:
|
||||||
void loadGameState(uint16 slot);
|
void loadGameState(uint16 slot);
|
||||||
void makeGameStateName(uint16 slot, char *buf);
|
void makeGameStateName(uint16 slot, char *buf);
|
||||||
void findGameStateDescriptions(char descriptions[100][32]);
|
void findGameStateDescriptions(char descriptions[100][32]);
|
||||||
InSaveFile *readGameStateHeader(uint16 slot, GameStateHeader *gsh);
|
Common::InSaveFile *readGameStateHeader(uint16 slot, GameStateHeader *gsh);
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
SAVESTATE_CUR_VER = 1,
|
SAVESTATE_CUR_VER = 1,
|
||||||
|
|
|
@ -51,7 +51,7 @@ Render::Render(SagaEngine *vm, OSystem *system) {
|
||||||
|
|
||||||
|
|
||||||
// Initialize FPS timer callback
|
// Initialize FPS timer callback
|
||||||
g_timer->installTimerProc(&fpsTimerCallback, 1000000, this);
|
Common::g_timer->installTimerProc(&fpsTimerCallback, 1000000, this);
|
||||||
|
|
||||||
// Create background buffer
|
// Create background buffer
|
||||||
_bg_buf_w = _vm->getDisplayWidth();
|
_bg_buf_w = _vm->getDisplayWidth();
|
||||||
|
|
|
@ -68,7 +68,7 @@ void ScummEngine::requestLoad(int slot) {
|
||||||
|
|
||||||
bool ScummEngine::saveState(int slot, bool compat) {
|
bool ScummEngine::saveState(int slot, bool compat) {
|
||||||
char filename[256];
|
char filename[256];
|
||||||
OutSaveFile *out;
|
Common::OutSaveFile *out;
|
||||||
SaveGameHeader hdr;
|
SaveGameHeader hdr;
|
||||||
|
|
||||||
makeSavegameName(filename, slot, compat);
|
makeSavegameName(filename, slot, compat);
|
||||||
|
@ -94,7 +94,7 @@ bool ScummEngine::saveState(int slot, bool compat) {
|
||||||
|
|
||||||
bool ScummEngine::loadState(int slot, bool compat) {
|
bool ScummEngine::loadState(int slot, bool compat) {
|
||||||
char filename[256];
|
char filename[256];
|
||||||
InSaveFile *in;
|
Common::InSaveFile *in;
|
||||||
int i, j;
|
int i, j;
|
||||||
SaveGameHeader hdr;
|
SaveGameHeader hdr;
|
||||||
int sb, sh;
|
int sb, sh;
|
||||||
|
@ -365,7 +365,7 @@ void ScummEngine::listSavegames(bool *marks, int num) {
|
||||||
|
|
||||||
bool ScummEngine::getSavegameName(int slot, char *desc) {
|
bool ScummEngine::getSavegameName(int slot, char *desc) {
|
||||||
char filename[256];
|
char filename[256];
|
||||||
InSaveFile *in;
|
Common::InSaveFile *in;
|
||||||
SaveGameHeader hdr;
|
SaveGameHeader hdr;
|
||||||
int len;
|
int len;
|
||||||
|
|
||||||
|
@ -402,7 +402,7 @@ bool ScummEngine::getSavegameName(int slot, char *desc) {
|
||||||
|
|
||||||
Graphics::Surface *ScummEngine::loadThumbnailFromSlot(int slot) {
|
Graphics::Surface *ScummEngine::loadThumbnailFromSlot(int slot) {
|
||||||
char filename[256];
|
char filename[256];
|
||||||
InSaveFile *in;
|
Common::InSaveFile *in;
|
||||||
SaveGameHeader hdr;
|
SaveGameHeader hdr;
|
||||||
int len;
|
int len;
|
||||||
|
|
||||||
|
|
|
@ -24,8 +24,10 @@
|
||||||
|
|
||||||
#include "common/scummsys.h"
|
#include "common/scummsys.h"
|
||||||
|
|
||||||
class InSaveFile;
|
namespace Common {
|
||||||
class OutSaveFile;
|
class InSaveFile;
|
||||||
|
class OutSaveFile;
|
||||||
|
}
|
||||||
|
|
||||||
namespace Scumm {
|
namespace Scumm {
|
||||||
|
|
||||||
|
@ -126,7 +128,7 @@ typedef void *SerializerLoadReference(void *me, byte type, int ref);
|
||||||
|
|
||||||
class Serializer {
|
class Serializer {
|
||||||
public:
|
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),
|
: _loadStream(in), _saveStream(out), _save_ref(0), _load_ref(0), _ref_me(0),
|
||||||
_savegameVersion(savegameVersion)
|
_savegameVersion(savegameVersion)
|
||||||
{ }
|
{ }
|
||||||
|
@ -155,8 +157,8 @@ public:
|
||||||
void loadBytes(void *b, int len);
|
void loadBytes(void *b, int len);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
InSaveFile *_loadStream;
|
Common::InSaveFile *_loadStream;
|
||||||
OutSaveFile *_saveStream;
|
Common::OutSaveFile *_saveStream;
|
||||||
uint32 _savegameVersion;
|
uint32 _savegameVersion;
|
||||||
|
|
||||||
void saveArrayOf(void *b, int len, int datasize, byte filetype);
|
void saveArrayOf(void *b, int len, int datasize, byte filetype);
|
||||||
|
|
|
@ -1948,7 +1948,7 @@ void ScummEngine_v5::o5_roomOps() {
|
||||||
|
|
||||||
case 13: // SO_SAVE_STRING
|
case 13: // SO_SAVE_STRING
|
||||||
{
|
{
|
||||||
OutSaveFile *file;
|
Common::OutSaveFile *file;
|
||||||
char filename[256], *s;
|
char filename[256], *s;
|
||||||
|
|
||||||
a = getVarOrDirectByte(PARAM_1);
|
a = getVarOrDirectByte(PARAM_1);
|
||||||
|
@ -1967,7 +1967,7 @@ void ScummEngine_v5::o5_roomOps() {
|
||||||
}
|
}
|
||||||
case 14: // SO_LOAD_STRING
|
case 14: // SO_LOAD_STRING
|
||||||
{
|
{
|
||||||
InSaveFile *file;
|
Common::InSaveFile *file;
|
||||||
char filename[256], *s;
|
char filename[256], *s;
|
||||||
|
|
||||||
a = getVarOrDirectByte(PARAM_1);
|
a = getVarOrDirectByte(PARAM_1);
|
||||||
|
|
|
@ -37,8 +37,10 @@ namespace GUI {
|
||||||
}
|
}
|
||||||
using GUI::Dialog;
|
using GUI::Dialog;
|
||||||
class GameDetector;
|
class GameDetector;
|
||||||
class InSaveFile;
|
namespace Common {
|
||||||
class OutSaveFile;
|
class InSaveFile;
|
||||||
|
class OutSaveFile;
|
||||||
|
}
|
||||||
|
|
||||||
namespace Scumm {
|
namespace Scumm {
|
||||||
|
|
||||||
|
@ -593,8 +595,8 @@ public:
|
||||||
Graphics::Surface *loadThumbnailFromSlot(int slot);
|
Graphics::Surface *loadThumbnailFromSlot(int slot);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
Graphics::Surface *loadThumbnail(InSaveFile *file);
|
Graphics::Surface *loadThumbnail(Common::InSaveFile *file);
|
||||||
void saveThumbnail(OutSaveFile *file);
|
void saveThumbnail(Common::OutSaveFile *file);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/* Script VM - should be in Script class */
|
/* Script VM - should be in Script class */
|
||||||
|
|
|
@ -283,7 +283,7 @@ void SmushPlayer::init() {
|
||||||
_vm->gdi._numStrips = _vm->virtscr[0].w / 8;
|
_vm->gdi._numStrips = _vm->virtscr[0].w / 8;
|
||||||
|
|
||||||
_smixer = new SmushMixer(_vm->_mixer);
|
_smixer = new SmushMixer(_vm->_mixer);
|
||||||
g_timer->installTimerProc(&timerCallback, _speed, this);
|
Common::g_timer->installTimerProc(&timerCallback, _speed, this);
|
||||||
|
|
||||||
_initDone = true;
|
_initDone = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,7 +54,7 @@ inline void colorToRGB(uint16 color, uint8 &r, uint8 &g, uint8 &b) {
|
||||||
b = ((color&0x1F) << 3);
|
b = ((color&0x1F) << 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
Graphics::Surface *ScummEngine::loadThumbnail(InSaveFile *file) {
|
Graphics::Surface *ScummEngine::loadThumbnail(Common::InSaveFile *file) {
|
||||||
ThumbnailHeader header;
|
ThumbnailHeader header;
|
||||||
header.type = file->readUint32BE();
|
header.type = file->readUint32BE();
|
||||||
if (header.type != MKID('THMB'))
|
if (header.type != MKID('THMB'))
|
||||||
|
@ -97,7 +97,7 @@ Graphics::Surface *ScummEngine::loadThumbnail(InSaveFile *file) {
|
||||||
return thumb;
|
return thumb;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScummEngine::saveThumbnail(OutSaveFile *file) {
|
void ScummEngine::saveThumbnail(Common::OutSaveFile *file) {
|
||||||
Graphics::Surface thumb;
|
Graphics::Surface thumb;
|
||||||
|
|
||||||
if (!createThumbnailFromScreen(&thumb))
|
if (!createThumbnailFromScreen(&thumb))
|
||||||
|
|
|
@ -41,7 +41,7 @@ void SimonEngine::o_load_game() {
|
||||||
}
|
}
|
||||||
|
|
||||||
int SimonEngine::count_savegames() {
|
int SimonEngine::count_savegames() {
|
||||||
InSaveFile *f;
|
Common::InSaveFile *f;
|
||||||
uint i = 1;
|
uint i = 1;
|
||||||
bool marks[256];
|
bool marks[256];
|
||||||
|
|
||||||
|
@ -62,7 +62,7 @@ int SimonEngine::count_savegames() {
|
||||||
|
|
||||||
int SimonEngine::display_savegame_list(int curpos, bool load, char *dst) {
|
int SimonEngine::display_savegame_list(int curpos, bool load, char *dst) {
|
||||||
int slot, last_slot;
|
int slot, last_slot;
|
||||||
InSaveFile *in;
|
Common::InSaveFile *in;
|
||||||
|
|
||||||
showMessageFormat("\xC");
|
showMessageFormat("\xC");
|
||||||
|
|
||||||
|
@ -400,7 +400,7 @@ loop:;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SimonEngine::save_game(uint slot, char *caption) {
|
bool SimonEngine::save_game(uint slot, char *caption) {
|
||||||
OutSaveFile *f;
|
Common::OutSaveFile *f;
|
||||||
uint item_index, num_item, i, j;
|
uint item_index, num_item, i, j;
|
||||||
TimeEvent *te;
|
TimeEvent *te;
|
||||||
|
|
||||||
|
@ -497,7 +497,7 @@ char *SimonEngine::gen_savename(int slot) {
|
||||||
|
|
||||||
bool SimonEngine::load_game(uint slot) {
|
bool SimonEngine::load_game(uint slot) {
|
||||||
char ident[18];
|
char ident[18];
|
||||||
InSaveFile *f;
|
Common::InSaveFile *f;
|
||||||
uint num, item_index, i, j;
|
uint num, item_index, i, j;
|
||||||
|
|
||||||
_lockWord |= 0x100;
|
_lockWord |= 0x100;
|
||||||
|
|
|
@ -194,7 +194,7 @@ void ControlStatus::drawToScreen(void) {
|
||||||
_statusText->drawToScreen(WITH_MASK);
|
_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;
|
_saveFileMan = saveFileMan;
|
||||||
|
|
||||||
_skyScreen = screen;
|
_skyScreen = screen;
|
||||||
|
@ -784,7 +784,7 @@ uint16 Control::shiftUp(uint8 speed) {
|
||||||
bool Control::autoSaveExists(void) {
|
bool Control::autoSaveExists(void) {
|
||||||
|
|
||||||
bool test = false;
|
bool test = false;
|
||||||
InSaveFile *f;
|
Common::InSaveFile *f;
|
||||||
char fName[20];
|
char fName[20];
|
||||||
if (SkyEngine::isCDVersion())
|
if (SkyEngine::isCDVersion())
|
||||||
strcpy(fName, "SKY-VM-CD.ASD");
|
strcpy(fName, "SKY-VM-CD.ASD");
|
||||||
|
@ -1012,7 +1012,7 @@ void Control::loadDescriptions(uint8 *destBuf) {
|
||||||
|
|
||||||
memset(destBuf, 0, MAX_SAVE_GAMES * MAX_TEXT_LEN);
|
memset(destBuf, 0, MAX_SAVE_GAMES * MAX_TEXT_LEN);
|
||||||
|
|
||||||
InSaveFile *inf;
|
Common::InSaveFile *inf;
|
||||||
inf = _saveFileMan->openForLoading("SKY-VM.SAV");
|
inf = _saveFileMan->openForLoading("SKY-VM.SAV");
|
||||||
if (inf != NULL) {
|
if (inf != NULL) {
|
||||||
uint8 *tmpBuf = (uint8 *)malloc(MAX_SAVE_GAMES * MAX_TEXT_LEN);
|
uint8 *tmpBuf = (uint8 *)malloc(MAX_SAVE_GAMES * MAX_TEXT_LEN);
|
||||||
|
@ -1084,7 +1084,7 @@ void Control::saveDescriptions(uint8 *srcBuf) {
|
||||||
tmpPos++;
|
tmpPos++;
|
||||||
srcPos += MAX_TEXT_LEN;
|
srcPos += MAX_TEXT_LEN;
|
||||||
}
|
}
|
||||||
OutSaveFile *outf;
|
Common::OutSaveFile *outf;
|
||||||
|
|
||||||
outf = _saveFileMan->openForSaving("SKY-VM.SAV");
|
outf = _saveFileMan->openForSaving("SKY-VM.SAV");
|
||||||
if (outf != NULL) {
|
if (outf != NULL) {
|
||||||
|
@ -1100,7 +1100,7 @@ void Control::doAutoSave(void) {
|
||||||
strcpy(fName, "SKY-VM-CD.ASD");
|
strcpy(fName, "SKY-VM-CD.ASD");
|
||||||
else
|
else
|
||||||
sprintf(fName, "SKY-VM%03d.ASD", SkyEngine::_systemVars.gameVersion);
|
sprintf(fName, "SKY-VM%03d.ASD", SkyEngine::_systemVars.gameVersion);
|
||||||
OutSaveFile *outf;
|
Common::OutSaveFile *outf;
|
||||||
|
|
||||||
outf = _saveFileMan->openForSaving(fName);
|
outf = _saveFileMan->openForSaving(fName);
|
||||||
if (outf == NULL) {
|
if (outf == NULL) {
|
||||||
|
@ -1121,7 +1121,7 @@ uint16 Control::saveGameToFile(void) {
|
||||||
char fName[20];
|
char fName[20];
|
||||||
sprintf(fName,"SKY-VM.%03d", _selectedGame);
|
sprintf(fName,"SKY-VM.%03d", _selectedGame);
|
||||||
|
|
||||||
OutSaveFile *outf;
|
Common::OutSaveFile *outf;
|
||||||
outf = _saveFileMan->openForSaving(fName);
|
outf = _saveFileMan->openForSaving(fName);
|
||||||
if (outf == NULL) {
|
if (outf == NULL) {
|
||||||
return NO_DISK_SPACE;
|
return NO_DISK_SPACE;
|
||||||
|
@ -1396,7 +1396,7 @@ uint16 Control::restoreGameFromFile(bool autoSave) {
|
||||||
} else
|
} else
|
||||||
sprintf(fName,"SKY-VM.%03d", _selectedGame);
|
sprintf(fName,"SKY-VM.%03d", _selectedGame);
|
||||||
|
|
||||||
InSaveFile *inf;
|
Common::InSaveFile *inf;
|
||||||
inf = _saveFileMan->openForLoading(fName);
|
inf = _saveFileMan->openForLoading(fName);
|
||||||
if (inf == NULL) {
|
if (inf == NULL) {
|
||||||
return RESTORE_FAILED;
|
return RESTORE_FAILED;
|
||||||
|
|
|
@ -26,7 +26,9 @@
|
||||||
#include "common/scummsys.h"
|
#include "common/scummsys.h"
|
||||||
|
|
||||||
class OSystem;
|
class OSystem;
|
||||||
class SaveFileManager;
|
namespace Common {
|
||||||
|
class SaveFileManager;
|
||||||
|
}
|
||||||
|
|
||||||
namespace Sky {
|
namespace Sky {
|
||||||
|
|
||||||
|
@ -175,7 +177,7 @@ private:
|
||||||
|
|
||||||
class Control {
|
class Control {
|
||||||
public:
|
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 doControlPanel(void);
|
||||||
void doLoadSavePanel(void);
|
void doLoadSavePanel(void);
|
||||||
void restartGame(void);
|
void restartGame(void);
|
||||||
|
@ -226,7 +228,7 @@ private:
|
||||||
void importOldCompact(Compact* destCpt, uint8 **srcPos, uint16 numElems, uint16 type, char *name);
|
void importOldCompact(Compact* destCpt, uint8 **srcPos, uint16 numElems, uint16 type, char *name);
|
||||||
uint16 parseSaveData(uint8 *srcBuf);
|
uint16 parseSaveData(uint8 *srcBuf);
|
||||||
|
|
||||||
SaveFileManager *_saveFileMan;
|
Common::SaveFileManager *_saveFileMan;
|
||||||
SkyCompact *_skyCompact;
|
SkyCompact *_skyCompact;
|
||||||
Screen *_skyScreen;
|
Screen *_skyScreen;
|
||||||
Disk *_skyDisk;
|
Disk *_skyDisk;
|
||||||
|
|
|
@ -146,7 +146,7 @@ public:
|
||||||
virtual void metaEvent (byte type, byte*data, uint16 length) { }
|
virtual void metaEvent (byte type, byte*data, uint16 length) { }
|
||||||
|
|
||||||
// Timing functions - MidiDriver now operates timers
|
// 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. */
|
/** The time in microseconds between invocations of the timer callback. */
|
||||||
virtual uint32 getBaseTempo (void) = 0;
|
virtual uint32 getBaseTempo (void) = 0;
|
||||||
|
|
|
@ -99,7 +99,7 @@ MidiDriver_MPU401::MidiDriver_MPU401() :
|
||||||
|
|
||||||
void MidiDriver_MPU401::close() {
|
void MidiDriver_MPU401::close() {
|
||||||
if (_timer_proc)
|
if (_timer_proc)
|
||||||
g_timer->removeTimerProc(_timer_proc);
|
Common::g_timer->removeTimerProc(_timer_proc);
|
||||||
_timer_proc = 0;
|
_timer_proc = 0;
|
||||||
for (int i = 0; i < 16; ++i)
|
for (int i = 0; i < 16; ++i)
|
||||||
send (0x7B << 8 | 0xB0 | i);
|
send (0x7B << 8 | 0xB0 | i);
|
||||||
|
@ -130,12 +130,12 @@ MidiChannel *MidiDriver_MPU401::allocateChannel() {
|
||||||
return NULL;
|
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 || !timer_proc) {
|
||||||
if (_timer_proc)
|
if (_timer_proc)
|
||||||
g_timer->removeTimerProc(_timer_proc);
|
Common::g_timer->removeTimerProc(_timer_proc);
|
||||||
_timer_proc = timer_proc;
|
_timer_proc = timer_proc;
|
||||||
if (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 {
|
class MidiDriver_MPU401 : public MidiDriver {
|
||||||
private:
|
private:
|
||||||
MidiChannel_MPU401 _midi_channels [16];
|
MidiChannel_MPU401 _midi_channels [16];
|
||||||
Timer::TimerProc _timer_proc;
|
Common::Timer::TimerProc _timer_proc;
|
||||||
uint16 _channel_mask;
|
uint16 _channel_mask;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
MidiDriver_MPU401();
|
MidiDriver_MPU401();
|
||||||
|
|
||||||
virtual void close();
|
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 getBaseTempo(void) { return 10000; }
|
||||||
uint32 property(int prop, uint32 param);
|
uint32 property(int prop, uint32 param);
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,7 @@ protected:
|
||||||
SoundMixer *_mixer;
|
SoundMixer *_mixer;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Timer::TimerProc _timerProc;
|
Common::Timer::TimerProc _timerProc;
|
||||||
void *_timerParam;
|
void *_timerParam;
|
||||||
|
|
||||||
int _nextTick;
|
int _nextTick;
|
||||||
|
@ -69,7 +69,7 @@ public:
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setTimerCallback(void *timer_param, Timer::TimerProc timer_proc) {
|
void setTimerCallback(void *timer_param, Common::Timer::TimerProc timer_proc) {
|
||||||
_timerProc = timer_proc;
|
_timerProc = timer_proc;
|
||||||
_timerParam = timer_param;
|
_timerParam = timer_param;
|
||||||
}
|
}
|
||||||
|
|
|
@ -157,7 +157,7 @@ void ControlButton::setSelected(uint8 selected) {
|
||||||
draw();
|
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;
|
_saveFileMan = saveFileMan;
|
||||||
_resMan = pResMan;
|
_resMan = pResMan;
|
||||||
_objMan = pObjMan;
|
_objMan = pObjMan;
|
||||||
|
@ -669,7 +669,7 @@ bool Control::restoreFromFile(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Control::readSavegameDescriptions(void) {
|
void Control::readSavegameDescriptions(void) {
|
||||||
InSaveFile *inf;
|
Common::InSaveFile *inf;
|
||||||
inf = _saveFileMan->openForLoading("SAVEGAME.INF");
|
inf = _saveFileMan->openForLoading("SAVEGAME.INF");
|
||||||
_saveScrollPos = _saveFiles = 0;
|
_saveScrollPos = _saveFiles = 0;
|
||||||
_selectedSavegame = 255;
|
_selectedSavegame = 255;
|
||||||
|
@ -712,7 +712,7 @@ int Control::displayMessage(const char *altButton, const char *message, ...) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Control::writeSavegameDescriptions(void) {
|
void Control::writeSavegameDescriptions(void) {
|
||||||
OutSaveFile *outf;
|
Common::OutSaveFile *outf;
|
||||||
outf = _saveFileMan->openForSaving("SAVEGAME.INF");
|
outf = _saveFileMan->openForSaving("SAVEGAME.INF");
|
||||||
|
|
||||||
if (!outf) {
|
if (!outf) {
|
||||||
|
@ -737,7 +737,7 @@ void Control::writeSavegameDescriptions(void) {
|
||||||
|
|
||||||
bool Control::savegamesExist(void) {
|
bool Control::savegamesExist(void) {
|
||||||
bool retVal = false;
|
bool retVal = false;
|
||||||
InSaveFile *inf;
|
Common::InSaveFile *inf;
|
||||||
inf = _saveFileMan->openForLoading("SAVEGAME.INF");
|
inf = _saveFileMan->openForLoading("SAVEGAME.INF");
|
||||||
if (inf)
|
if (inf)
|
||||||
retVal = true;
|
retVal = true;
|
||||||
|
@ -894,7 +894,7 @@ void Control::saveGameToFile(uint8 slot) {
|
||||||
uint16 cnt;
|
uint16 cnt;
|
||||||
sprintf(fName, "SAVEGAME.%03d", slot);
|
sprintf(fName, "SAVEGAME.%03d", slot);
|
||||||
uint16 liveBuf[TOTAL_SECTIONS];
|
uint16 liveBuf[TOTAL_SECTIONS];
|
||||||
OutSaveFile *outf;
|
Common::OutSaveFile *outf;
|
||||||
outf = _saveFileMan->openForSaving(fName);
|
outf = _saveFileMan->openForSaving(fName);
|
||||||
if (!outf) {
|
if (!outf) {
|
||||||
// Display an error message, and do nothing
|
// Display an error message, and do nothing
|
||||||
|
@ -927,7 +927,7 @@ bool Control::restoreGameFromFile(uint8 slot) {
|
||||||
char fName[15];
|
char fName[15];
|
||||||
uint16 cnt;
|
uint16 cnt;
|
||||||
sprintf(fName, "SAVEGAME.%03d", slot);
|
sprintf(fName, "SAVEGAME.%03d", slot);
|
||||||
InSaveFile *inf;
|
Common::InSaveFile *inf;
|
||||||
inf = _saveFileMan->openForLoading(fName);
|
inf = _saveFileMan->openForLoading(fName);
|
||||||
if (!inf) {
|
if (!inf) {
|
||||||
// Display an error message, and do nothing
|
// Display an error message, and do nothing
|
||||||
|
|
|
@ -26,7 +26,9 @@
|
||||||
#include "sword1/sworddefs.h"
|
#include "sword1/sworddefs.h"
|
||||||
|
|
||||||
class OSystem;
|
class OSystem;
|
||||||
class SaveFileManager;
|
namespace Common {
|
||||||
|
class SaveFileManager;
|
||||||
|
}
|
||||||
|
|
||||||
namespace Sword1 {
|
namespace Sword1 {
|
||||||
|
|
||||||
|
@ -68,7 +70,7 @@ struct ButtonInfo {
|
||||||
|
|
||||||
class Control {
|
class Control {
|
||||||
public:
|
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);
|
uint8 runPanel(void);
|
||||||
void doRestore(void);
|
void doRestore(void);
|
||||||
void askForCd(void);
|
void askForCd(void);
|
||||||
|
@ -119,7 +121,7 @@ private:
|
||||||
static const ButtonInfo _deathButtons[3], _panelButtons[7], _saveButtons[16], _volumeButtons[4];
|
static const ButtonInfo _deathButtons[3], _panelButtons[7], _saveButtons[16], _volumeButtons[4];
|
||||||
static const uint8 _languageStrings[8 * 20][43];
|
static const uint8 _languageStrings[8 * 20][43];
|
||||||
const uint8 (*_lStrings)[43];
|
const uint8 (*_lStrings)[43];
|
||||||
SaveFileManager *_saveFileMan;
|
Common::SaveFileManager *_saveFileMan;
|
||||||
ObjectMan *_objMan;
|
ObjectMan *_objMan;
|
||||||
ResMan *_resMan;
|
ResMan *_resMan;
|
||||||
OSystem *_system;
|
OSystem *_system;
|
||||||
|
|
|
@ -183,7 +183,7 @@ uint32 Sword2Engine::saveData(uint16 slotNo, byte *buffer, uint32 bufferSize) {
|
||||||
|
|
||||||
sprintf(saveFileName, "%s.%.3d", _targetName.c_str(), slotNo);
|
sprintf(saveFileName, "%s.%.3d", _targetName.c_str(), slotNo);
|
||||||
|
|
||||||
OutSaveFile *out;
|
Common::OutSaveFile *out;
|
||||||
|
|
||||||
if (!(out = _saveFileMan->openForSaving(saveFileName))) {
|
if (!(out = _saveFileMan->openForSaving(saveFileName))) {
|
||||||
return SR_ERR_FILEOPEN;
|
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);
|
sprintf(saveFileName, "%s.%.3d", _targetName.c_str(), slotNo);
|
||||||
|
|
||||||
InSaveFile *in;
|
Common::InSaveFile *in;
|
||||||
|
|
||||||
if (!(in = _saveFileMan->openForLoading(saveFileName))) {
|
if (!(in = _saveFileMan->openForLoading(saveFileName))) {
|
||||||
// error: couldn't open file
|
// error: couldn't open file
|
||||||
|
@ -405,7 +405,7 @@ uint32 Sword2Engine::getSaveDescription(uint16 slotNo, byte *description) {
|
||||||
|
|
||||||
sprintf(saveFileName, "%s.%.3d", _targetName.c_str(), slotNo);
|
sprintf(saveFileName, "%s.%.3d", _targetName.c_str(), slotNo);
|
||||||
|
|
||||||
InSaveFile *in;
|
Common::InSaveFile *in;
|
||||||
|
|
||||||
if (!(in = _saveFileMan->openForLoading(saveFileName))) {
|
if (!(in = _saveFileMan->openForLoading(saveFileName))) {
|
||||||
return SR_ERR_FILEOPEN;
|
return SR_ERR_FILEOPEN;
|
||||||
|
@ -432,7 +432,7 @@ bool Sword2Engine::saveExists(uint16 slotNo) {
|
||||||
|
|
||||||
sprintf(saveFileName, "%s.%.3d", _targetName.c_str(), slotNo);
|
sprintf(saveFileName, "%s.%.3d", _targetName.c_str(), slotNo);
|
||||||
|
|
||||||
InSaveFile *in;
|
Common::InSaveFile *in;
|
||||||
|
|
||||||
if (!(in = _saveFileMan->openForLoading(saveFileName))) {
|
if (!(in = _saveFileMan->openForLoading(saveFileName))) {
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue