OSYSTEM: Pushed out some port specific code from common/system.cpp to the respective ports
svn-id: r34812
This commit is contained in:
parent
0cd4939110
commit
36311eefb4
9 changed files with 62 additions and 38 deletions
|
@ -171,10 +171,22 @@ Common::SaveFileManager *OSystem_PalmBase::getSavefileManager() {
|
||||||
return _saveMgr;
|
return _saveMgr;
|
||||||
}
|
}
|
||||||
|
|
||||||
Audio::Mixer * OSystem_PalmBase::getMixer() {
|
Audio::Mixer *OSystem_PalmBase::getMixer() {
|
||||||
return _mixerMgr;
|
return _mixerMgr;
|
||||||
}
|
}
|
||||||
|
|
||||||
Common::TimerManager * OSystem_PalmBase::getTimerManager() {
|
Common::TimerManager *OSystem_PalmBase::getTimerManager() {
|
||||||
return _timerMgr;
|
return _timerMgr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define PALMOS_CONFIG_FILE "/PALM/Programs/ScummVM/scummvm.ini"
|
||||||
|
|
||||||
|
Common::SeekableReadStream *OSystem_PalmBase::openConfigFileForReading() {
|
||||||
|
Common::FSNode file(PALMOS_CONFIG_FILE);
|
||||||
|
return file.openForReading();
|
||||||
|
}
|
||||||
|
|
||||||
|
Common::WriteStream *OSystem_PalmBase::openConfigFileForWriting() {
|
||||||
|
Common::FSNode file(PALMOS_CONFIG_FILE);
|
||||||
|
return file.openForWriting();
|
||||||
|
}
|
||||||
|
|
|
@ -257,6 +257,9 @@ public:
|
||||||
|
|
||||||
Common::SaveFileManager *getSavefileManager();
|
Common::SaveFileManager *getSavefileManager();
|
||||||
Common::TimerManager *getTimerManager();
|
Common::TimerManager *getTimerManager();
|
||||||
|
|
||||||
|
virtual Common::SeekableReadStream *openConfigFileForReading();
|
||||||
|
virtual Common::WriteStream *openConfigFileForWriting();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1312,8 +1312,14 @@ OSystem *OSystem_IPHONE_create() {
|
||||||
return new OSystem_IPHONE();
|
return new OSystem_IPHONE();
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* OSystem_IPHONE::getConfigPath() {
|
Common::SeekableReadStream *OSystem_IPHONE::openConfigFileForReading() {
|
||||||
return SCUMMVM_PREFS_PATH;
|
Common::FSNode file(SCUMMVM_PREFS_PATH);
|
||||||
|
return file.openForReading();
|
||||||
|
}
|
||||||
|
|
||||||
|
Common::WriteStream *OSystem_IPHONE::openConfigFileForWriting() {
|
||||||
|
Common::FSNode file(SCUMMVM_PREFS_PATH);
|
||||||
|
return file.openForWriting();
|
||||||
}
|
}
|
||||||
|
|
||||||
void iphone_main(int argc, char *argv[]) {
|
void iphone_main(int argc, char *argv[]) {
|
||||||
|
|
|
@ -177,7 +177,8 @@ public:
|
||||||
void startSoundsystem();
|
void startSoundsystem();
|
||||||
void stopSoundsystem();
|
void stopSoundsystem();
|
||||||
|
|
||||||
static const char* getConfigPath();
|
virtual Common::SeekableReadStream *openConfigFileForReading();
|
||||||
|
virtual Common::WriteStream *openConfigFileForWriting();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
inline void addDirtyRect(int16 x1, int16 y1, int16 w, int16 h);
|
inline void addDirtyRect(int16 x1, int16 y1, int16 w, int16 h);
|
||||||
|
|
|
@ -770,6 +770,7 @@ void OSystem_PS2::quit(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void OSystem_PS2::makeConfigPath(char *dest) {
|
void OSystem_PS2::makeConfigPath(char *dest) {
|
||||||
|
// FIXME: Maybe merge this method into openConfigFileForReading/openConfigFileForWriting ?
|
||||||
FILE *handle;
|
FILE *handle;
|
||||||
strcpy(dest, "cdfs:/ScummVM.ini");
|
strcpy(dest, "cdfs:/ScummVM.ini");
|
||||||
handle = ps2_fopen(dest, "r");
|
handle = ps2_fopen(dest, "r");
|
||||||
|
@ -783,6 +784,20 @@ void OSystem_PS2::makeConfigPath(char *dest) {
|
||||||
strcpy(dest, "mc0:ScummVM/scummvm.ini");
|
strcpy(dest, "mc0:ScummVM/scummvm.ini");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Common::SeekableReadStream *OSystem_PS2::openConfigFileForReading() {
|
||||||
|
char configFile[MAXPATHLEN];
|
||||||
|
makeConfigPath(configFile);
|
||||||
|
Common::FSNode file(configFile);
|
||||||
|
return file.openForReading();
|
||||||
|
}
|
||||||
|
|
||||||
|
Common::WriteStream *OSystem_PS2::openConfigFileForWriting() {
|
||||||
|
char configFile[MAXPATHLEN];
|
||||||
|
makeConfigPath(configFile);
|
||||||
|
Common::FSNode file(configFile);
|
||||||
|
return file.openForWriting();
|
||||||
|
}
|
||||||
|
|
||||||
bool OSystem_PS2::runningFromHost(void) {
|
bool OSystem_PS2::runningFromHost(void) {
|
||||||
return (_bootDevice == HOST);
|
return (_bootDevice == HOST);
|
||||||
}
|
}
|
||||||
|
|
|
@ -107,6 +107,9 @@ public:
|
||||||
|
|
||||||
virtual void quit();
|
virtual void quit();
|
||||||
|
|
||||||
|
virtual Common::SeekableReadStream *openConfigFileForReading();
|
||||||
|
virtual Common::WriteStream *openConfigFileForWriting();
|
||||||
|
|
||||||
virtual OverlayColor RGBToColor(uint8 r, uint8 g, uint8 b);
|
virtual OverlayColor RGBToColor(uint8 r, uint8 g, uint8 b);
|
||||||
|
|
||||||
virtual void colorToRGB(OverlayColor color, uint8 &r, uint8 &g, uint8 &b);
|
virtual void colorToRGB(OverlayColor color, uint8 &r, uint8 &g, uint8 &b);
|
||||||
|
|
|
@ -677,3 +677,14 @@ void OSystem_PSP::setWindowCaption(const char *caption) {
|
||||||
void OSystem_PSP::displayMessageOnOSD(const char *msg) {
|
void OSystem_PSP::displayMessageOnOSD(const char *msg) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define PSP_CONFIG_FILE "ms0:/scummvm.ini"
|
||||||
|
|
||||||
|
Common::SeekableReadStream *OSystem_PSP::openConfigFileForReading() {
|
||||||
|
Common::FSNode file(PSP_CONFIG_FILE);
|
||||||
|
return file.openForReading();
|
||||||
|
}
|
||||||
|
|
||||||
|
Common::WriteStream *OSystem_PSP::openConfigFileForWriting() {
|
||||||
|
Common::FSNode file(PSP_CONFIG_FILE);
|
||||||
|
return file.openForWriting();
|
||||||
|
}
|
||||||
|
|
|
@ -145,5 +145,7 @@ public:
|
||||||
|
|
||||||
virtual void displayMessageOnOSD(const char *msg);
|
virtual void displayMessageOnOSD(const char *msg);
|
||||||
|
|
||||||
|
virtual Common::SeekableReadStream *openConfigFileForReading();
|
||||||
|
virtual Common::WriteStream *openConfigFileForWriting();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -122,48 +122,19 @@ void OSystem::clearScreen() {
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
FIXME: The config file loading code below needs to be cleaned up.
|
FIXME: Maybe we should push the default config file loading/saving code below
|
||||||
Port specific variants should be pushed into the respective ports.
|
out to all the backends?
|
||||||
|
|
||||||
Ideally, the default OSystem::openConfigFileForReading/Writing methods
|
|
||||||
should be removed completely.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#ifdef __PLAYSTATION2__
|
|
||||||
#include "backends/platform/ps2/systemps2.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef IPHONE
|
|
||||||
#include "backends/platform/iphone/osys_iphone.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#if defined(UNIX)
|
#if defined(UNIX)
|
||||||
#define DEFAULT_CONFIG_FILE ".scummvmrc"
|
#define DEFAULT_CONFIG_FILE ".scummvmrc"
|
||||||
#else
|
#else
|
||||||
#define DEFAULT_CONFIG_FILE "scummvm.ini"
|
#define DEFAULT_CONFIG_FILE "scummvm.ini"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static Common::String getDefaultConfigFileName() {
|
|
||||||
char configFile[MAXPATHLEN];
|
|
||||||
#if defined(PALMOS_MODE)
|
|
||||||
strcpy(configFile,"/PALM/Programs/ScummVM/" DEFAULT_CONFIG_FILE);
|
|
||||||
#elif defined(IPHONE)
|
|
||||||
strcpy(configFile, OSystem_IPHONE::getConfigPath());
|
|
||||||
#elif defined(__PLAYSTATION2__)
|
|
||||||
((OSystem_PS2*)g_system)->makeConfigPath(configFile);
|
|
||||||
#elif defined(__PSP__)
|
|
||||||
strcpy(configFile, "ms0:/" DEFAULT_CONFIG_FILE);
|
|
||||||
#else
|
|
||||||
strcpy(configFile, DEFAULT_CONFIG_FILE);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return configFile;
|
|
||||||
}
|
|
||||||
|
|
||||||
Common::SeekableReadStream *OSystem::openConfigFileForReading() {
|
Common::SeekableReadStream *OSystem::openConfigFileForReading() {
|
||||||
Common::FSNode file(getDefaultConfigFileName());
|
Common::FSNode file(DEFAULT_CONFIG_FILE);
|
||||||
return file.openForReading();
|
return file.openForReading();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -171,7 +142,7 @@ Common::WriteStream *OSystem::openConfigFileForWriting() {
|
||||||
#ifdef __DC__
|
#ifdef __DC__
|
||||||
return 0;
|
return 0;
|
||||||
#else
|
#else
|
||||||
Common::FSNode file(getDefaultConfigFileName());
|
Common::FSNode file(DEFAULT_CONFIG_FILE);
|
||||||
return file.openForWriting();
|
return file.openForWriting();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue