N64: Use OSystem's 'slots' for timer/savefile manager

This commit is contained in:
Max Horn 2011-06-07 10:55:58 +02:00
parent 14f0a0c682
commit 9e1ed9ee6a
3 changed files with 6 additions and 23 deletions

View file

@ -27,8 +27,6 @@
#include "common/config-manager.h" #include "common/config-manager.h"
#include "backends/base-backend.h" #include "backends/base-backend.h"
#include "backends/saves/default/default-saves.h"
#include "backends/timer/default/default-timer.h"
#include "base/main.h" #include "base/main.h"
@ -75,9 +73,7 @@ enum GraphicModeID {
class OSystem_N64 : public BaseBackend, public PaletteManager { class OSystem_N64 : public BaseBackend, public PaletteManager {
protected: protected:
Common::SaveFileManager *_savefile;
Audio::MixerImpl *_mixer; Audio::MixerImpl *_mixer;
Common::TimerManager *_timer;
FilesystemFactory *_fsFactory; FilesystemFactory *_fsFactory;
struct display_context * _dc; // Display context for N64 on screen buffer switching struct display_context * _dc; // Display context for N64 on screen buffer switching
@ -201,10 +197,8 @@ public:
virtual void quit(); virtual void quit();
virtual Common::SaveFileManager *getSavefileManager();
virtual Audio::Mixer *getMixer(); virtual Audio::Mixer *getMixer();
virtual void getTimeAndDate(TimeDate &t) const; virtual void getTimeAndDate(TimeDate &t) const;
virtual Common::TimerManager *getTimerManager();
virtual void setTimerCallback(TimerProc callback, int interval); virtual void setTimerCallback(TimerProc callback, int interval);
FilesystemFactory *getFilesystemFactory(); FilesystemFactory *getFilesystemFactory();

View file

@ -30,6 +30,8 @@
#include "pakfs_save_manager.h" #include "pakfs_save_manager.h"
#include "framfs_save_manager.h" #include "framfs_save_manager.h"
#include "backends/fs/n64/n64-fs-factory.h" #include "backends/fs/n64/n64-fs-factory.h"
#include "backends/saves/default/default-saves.h"
#include "backends/timer/default/default-timer.h"
typedef unsigned long long uint64; typedef unsigned long long uint64;
@ -137,9 +139,7 @@ OSystem_N64::OSystem_N64() {
_mouseMaxX = _overlayWidth; _mouseMaxX = _overlayWidth;
_mouseMaxY = _overlayHeight; _mouseMaxY = _overlayHeight;
_savefile = 0;
_mixer = 0; _mixer = 0;
_timer = 0;
_dirtyOffscreen = false; _dirtyOffscreen = false;
@ -154,9 +154,7 @@ OSystem_N64::OSystem_N64() {
} }
OSystem_N64::~OSystem_N64() { OSystem_N64::~OSystem_N64() {
delete _savefile;
delete _mixer; delete _mixer;
delete _timer;
delete _fsFactory; delete _fsFactory;
} }
@ -170,7 +168,7 @@ void OSystem_N64::initBackend() {
if (FRAM_Detect()) { // Use FlashRAM if (FRAM_Detect()) { // Use FlashRAM
initFramFS(); initFramFS();
_savefile = new FRAMSaveManager(); _savefileManager = new FRAMSaveManager();
} else { // Use PakFS } else { // Use PakFS
// Init Controller Pak // Init Controller Pak
initPakFs(); initPakFs();
@ -185,10 +183,10 @@ void OSystem_N64::initBackend() {
} }
} }
_savefile = new PAKSaveManager(); _savefileManager = new PAKSaveManager();
} }
_timer = new DefaultTimerManager(); _timerManager = new DefaultTimerManager();
setTimerCallback(&timer_handler, 10); setTimerCallback(&timer_handler, 10);
@ -851,21 +849,11 @@ void OSystem_N64::quit() {
return; return;
} }
Common::SaveFileManager *OSystem_N64::getSavefileManager() {
assert(_savefile);
return _savefile;
}
Audio::Mixer *OSystem_N64::getMixer() { Audio::Mixer *OSystem_N64::getMixer() {
assert(_mixer); assert(_mixer);
return _mixer; return _mixer;
} }
Common::TimerManager *OSystem_N64::getTimerManager() {
assert(_timer);
return _timer;
}
void OSystem_N64::getTimeAndDate(TimeDate &t) const { void OSystem_N64::getTimeAndDate(TimeDate &t) const {
// No RTC inside the N64, read mips timer to simulate // No RTC inside the N64, read mips timer to simulate
// passing of time, not a perfect solution, but can't think // passing of time, not a perfect solution, but can't think

View file

@ -21,6 +21,7 @@
*/ */
#include "osys_n64.h" #include "osys_n64.h"
#include "backends/timer/default/default-timer.h"
void checkTimers(void) { void checkTimers(void) {
OSystem_N64 *osys = (OSystem_N64 *)g_system; OSystem_N64 *osys = (OSystem_N64 *)g_system;