1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20  *
21  */
22 
23 #define FORBIDDEN_SYMBOL_EXCEPTION_mkdir
24 #define FORBIDDEN_SYMBOL_EXCEPTION_time_h	// sys/stat.h includes sys/time.h
25 #define FORBIDDEN_SYMBOL_EXCEPTION_unistd_h
26 
27 #include "common/scummsys.h"
28 #include "common/config-manager.h"
29 #include "backends/platform/sdl/ps3/ps3.h"
30 #include "backends/graphics/surfacesdl/surfacesdl-graphics.h"
31 #include "backends/saves/default/default-saves.h"
32 #include "backends/fs/ps3/ps3-fs-factory.h"
33 #include "backends/events/ps3sdl/ps3sdl-events.h"
34 
35 #include <dirent.h>
36 #include <sys/stat.h>
37 
access(const char * pathname,int mode)38 int access(const char *pathname, int mode) {
39 	struct stat sb;
40 
41 	if (stat(pathname, &sb) == -1) {
42 		return -1;
43 	}
44 
45 	return 0;
46 }
47 
OSystem_PS3(Common::String baseConfigName)48 OSystem_PS3::OSystem_PS3(Common::String baseConfigName)
49 	: _baseConfigName(baseConfigName) {
50 }
51 
init()52 void OSystem_PS3::init() {
53 	// Initialze File System Factory
54 	_fsFactory = new PS3FilesystemFactory();
55 
56 	// Invoke parent implementation of this method
57 	OSystem_SDL::init();
58 }
59 
initBackend()60 void OSystem_PS3::initBackend() {
61 	ConfMan.set("joystick_num", 0);
62 	ConfMan.set("vkeybdpath", PREFIX "/data");
63 	ConfMan.registerDefault("fullscreen", true);
64 	ConfMan.registerDefault("aspect_ratio", true);
65 
66 	// Create the savefile manager
67 	if (_savefileManager == 0)
68 		_savefileManager = new DefaultSaveFileManager(PREFIX "/saves");
69 
70 	// Event source
71 	if (_eventSource == 0)
72 		_eventSource = new PS3SdlEventSource();
73 
74 	// Invoke parent implementation of this method
75 	OSystem_SDL::initBackend();
76 }
77 
getDefaultConfigFileName()78 Common::String OSystem_PS3::getDefaultConfigFileName() {
79 	return PREFIX "/" + _baseConfigName;
80 }
81 
createLogFile()82 Common::WriteStream *OSystem_PS3::createLogFile() {
83 	Common::FSNode file(PREFIX "/residualvm.log");
84 	return file.createWriteStream();
85 }
86