mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-09 04:16:34 +00:00
3DS: Log all messages to a file
This commit is contained in:
parent
322f2386de
commit
3c5d806894
@ -84,7 +84,8 @@ OSystem_3DS::OSystem_3DS():
|
||||
_screenChangeId(0),
|
||||
_magnifyMode(MODE_MAGOFF),
|
||||
exiting(false),
|
||||
sleeping(false)
|
||||
sleeping(false),
|
||||
_logger(0)
|
||||
{
|
||||
chdir("sdmc:/");
|
||||
|
||||
@ -116,6 +117,9 @@ OSystem_3DS::~OSystem_3DS() {
|
||||
destroyAudio();
|
||||
destroy3DSGraphics();
|
||||
|
||||
delete _logger;
|
||||
_logger = 0;
|
||||
|
||||
delete _timerManager;
|
||||
_timerManager = 0;
|
||||
}
|
||||
@ -125,6 +129,15 @@ void OSystem_3DS::quit() {
|
||||
}
|
||||
|
||||
void OSystem_3DS::initBackend() {
|
||||
if (!_logger)
|
||||
_logger = new Backends::Log::Log(this);
|
||||
|
||||
if (_logger) {
|
||||
Common::WriteStream *logFile = createLogFile();
|
||||
if (logFile)
|
||||
_logger->open(logFile);
|
||||
}
|
||||
|
||||
loadConfig();
|
||||
ConfMan.registerDefault("fullscreen", true);
|
||||
ConfMan.registerDefault("aspect_ratio", true);
|
||||
@ -157,6 +170,10 @@ Common::String OSystem_3DS::getDefaultConfigFileName() {
|
||||
return "sdmc:/3ds/scummvm/scummvm.ini";
|
||||
}
|
||||
|
||||
Common::String OSystem_3DS::getDefaultLogFileName() {
|
||||
return "sdmc:/3ds/scummvm/scummvm.log";
|
||||
}
|
||||
|
||||
void OSystem_3DS::addSysArchivesToSearchSet(Common::SearchSet &s, int priority) {
|
||||
s.add("RomFS", new Common::FSDirectory(DATA_PATH"/"), priority);
|
||||
}
|
||||
@ -222,6 +239,30 @@ void OSystem_3DS::fatalError() {
|
||||
|
||||
void OSystem_3DS::logMessage(LogMessageType::Type type, const char *message) {
|
||||
printf("%s", message);
|
||||
|
||||
// Then log into file (via the logger)
|
||||
if (_logger)
|
||||
_logger->print(message);
|
||||
}
|
||||
|
||||
Common::WriteStream *OSystem_3DS::createLogFile() {
|
||||
// Start out by resetting _logFilePath, so that in case
|
||||
// of a failure, we know that no log file is open.
|
||||
_logFilePath.clear();
|
||||
|
||||
Common::String logFile;
|
||||
if (ConfMan.hasKey("logfile"))
|
||||
logFile = ConfMan.get("logfile");
|
||||
else
|
||||
logFile = getDefaultLogFileName();
|
||||
if (logFile.empty())
|
||||
return nullptr;
|
||||
|
||||
Common::FSNode file(logFile);
|
||||
Common::WriteStream *stream = file.createWriteStream();
|
||||
if (stream)
|
||||
_logFilePath = logFile;
|
||||
return stream;
|
||||
}
|
||||
|
||||
} // namespace N3DS
|
||||
|
@ -31,6 +31,7 @@
|
||||
#include "base/main.h"
|
||||
#include "audio/mixer_intern.h"
|
||||
#include "backends/graphics/graphics.h"
|
||||
#include "backends/log/log.h"
|
||||
#include "backends/platform/3ds/sprite.h"
|
||||
#include "common/rect.h"
|
||||
#include "common/queue.h"
|
||||
@ -201,8 +202,12 @@ private:
|
||||
void flushGameScreen();
|
||||
void flushCursor();
|
||||
|
||||
virtual Common::String getDefaultLogFileName();
|
||||
virtual Common::WriteStream *createLogFile();
|
||||
|
||||
protected:
|
||||
Audio::MixerImpl *_mixer;
|
||||
Backends::Log::Log *_logger;
|
||||
|
||||
private:
|
||||
u16 _gameWidth, _gameHeight;
|
||||
@ -287,6 +292,8 @@ private:
|
||||
u16 _magWidth, _magHeight;
|
||||
u16 _magCenterX, _magCenterY;
|
||||
|
||||
Common::String _logFilePath;
|
||||
|
||||
public:
|
||||
// Pause
|
||||
PauseToken _sleepPauseToken;
|
||||
|
Loading…
x
Reference in New Issue
Block a user