1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117
|
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#define FORBIDDEN_SYMBOL_EXCEPTION_getenv
#define FORBIDDEN_SYMBOL_EXCEPTION_mkdir
#define FORBIDDEN_SYMBOL_EXCEPTION_exit
#define FORBIDDEN_SYMBOL_EXCEPTION_unistd_h
#include "common/scummsys.h"
#include "backends/audiocd/default/default-audiocd.h"
#include "backends/platform/sdl/kolibrios/kolibrios.h"
#include "backends/saves/kolibrios/kolibrios-saves.h"
#include "backends/fs/kolibrios/kolibrios-fs-factory.h"
#include "backends/fs/kolibrios/kolibrios-fs.h"
#include "common/textconsole.h"
#include <stdlib.h>
#include <errno.h>
#include <unistd.h>
OSystem_KolibriOS::OSystem_KolibriOS(const char *exeName) : _exeName(exeName) {
}
void OSystem_KolibriOS::init() {
_exePath = Common::Path(_exeName).getParent();
if (KolibriOS::assureDirectoryExists("scummvm-home", _exePath.toString().c_str())) {
debug("Using <exec>/scummvm-home");
_writablePath = _exePath.join("scummvm-home");
} else {
KolibriOS::assureDirectoryExists("scummvm", "/tmp0/1");
_writablePath = "/tmp0/1/scummvm";
debug("Using /tmp0/1");
}
// Initialze File System Factory
_fsFactory = new KolibriOSFilesystemFactory();
// Invoke parent implementation of this method
OSystem_SDL::init();
}
void OSystem_KolibriOS::addSysArchivesToSearchSet(Common::SearchSet &s, int priority) {
Common::FSNode dataNode(_exePath);
s.add("exePath", new Common::FSDirectory(dataNode, 4), priority);
}
void OSystem_KolibriOS::initBackend() {
Common::Path defaultThemePath = _exePath.join("themes");
Common::Path defaultEngineData = _exePath.join("engine-data");
ConfMan.registerDefault("themepath", defaultThemePath);
ConfMan.registerDefault("extrapath", defaultEngineData);
if (!ConfMan.hasKey("themepath")) {
ConfMan.setPath("themepath", defaultThemePath);
}
if (!ConfMan.hasKey("extrapath")) {
ConfMan.setPath("extrapath", defaultEngineData);
}
// Create the savefile manager
if (_savefileManager == 0)
_savefileManager = new KolibriOSSaveFileManager(_writablePath);
// Invoke parent implementation of this method
OSystem_SDL::initBackend();
}
Common::Path OSystem_KolibriOS::getDefaultConfigFileName() {
return _writablePath.join("scummvm.ini");
}
Common::Path OSystem_KolibriOS::getDefaultIconsPath() {
return _exePath.join("icons");
}
Common::Path OSystem_KolibriOS::getScreenshotsPath() {
// If the user has configured a screenshots path, use it
const Common::Path path = OSystem_SDL::getScreenshotsPath();
if (!path.empty()) {
return path;
}
static const char *const SCREENSHOTS_DIR_NAME = "ScummVM Screenshots";
if (!KolibriOS::assureDirectoryExists(SCREENSHOTS_DIR_NAME, _writablePath.toString(Common::Path::kNativeSeparator).c_str())) {
return "";
}
return _writablePath.join(SCREENSHOTS_DIR_NAME);
}
Common::Path OSystem_KolibriOS::getDefaultLogFileName() {
return _writablePath.join("scummvm.log");
}
AudioCDManager *OSystem_KolibriOS::createAudioCDManager() {
return new DefaultAudioCDManager();
}
|