ResidualVM logo ResidualVM website - Forums - Contact us BuildBot - Doxygen - Wiki curved edge

ps3.cpp

Go to the documentation of this file.
00001 /* ScummVM - Graphic Adventure Engine
00002  *
00003  * ScummVM is the legal property of its developers, whose names
00004  * are too numerous to list here. Please refer to the COPYRIGHT
00005  * file distributed with this source distribution.
00006  *
00007  * This program is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU General Public License
00009  * as published by the Free Software Foundation; either version 2
00010  * of the License, or (at your option) any later version.
00011  *
00012  * This program is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU General Public License
00018  * along with this program; if not, write to the Free Software
00019  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00020  *
00021  */
00022 
00023 #define FORBIDDEN_SYMBOL_EXCEPTION_mkdir
00024 #define FORBIDDEN_SYMBOL_EXCEPTION_time_h   // sys/stat.h includes sys/time.h
00025 #define FORBIDDEN_SYMBOL_EXCEPTION_unistd_h
00026 
00027 #include "common/scummsys.h"
00028 #include "common/config-manager.h"
00029 #include "common/translation.h"
00030 #include "backends/platform/sdl/ps3/ps3.h"
00031 #include "backends/graphics/surfacesdl/surfacesdl-graphics.h"
00032 #include "backends/saves/default/default-saves.h"
00033 #include "backends/fs/ps3/ps3-fs-factory.h"
00034 #include "backends/events/ps3sdl/ps3sdl-events.h"
00035 #include "backends/keymapper/hardware-input.h"
00036 
00037 #include <dirent.h>
00038 #include <sys/stat.h>
00039 
00040 static const Common::HardwareInputTableEntry playstationJoystickButtons[] = {
00041     { "JOY_A",              Common::JOYSTICK_BUTTON_A,              _s("Cross")       },
00042     { "JOY_B",              Common::JOYSTICK_BUTTON_B,              _s("Circle")      },
00043     { "JOY_X",              Common::JOYSTICK_BUTTON_X,              _s("Square")      },
00044     { "JOY_Y",              Common::JOYSTICK_BUTTON_Y,              _s("Triangle")    },
00045     { "JOY_BACK",           Common::JOYSTICK_BUTTON_BACK,           _s("Select")      },
00046     { "JOY_GUIDE",          Common::JOYSTICK_BUTTON_GUIDE,          _s("PS")          },
00047     { "JOY_START",          Common::JOYSTICK_BUTTON_START,          _s("Start")       },
00048     { "JOY_LEFT_STICK",     Common::JOYSTICK_BUTTON_LEFT_STICK,     _s("L3")          },
00049     { "JOY_RIGHT_STICK",    Common::JOYSTICK_BUTTON_RIGHT_STICK,    _s("R3")          },
00050     { "JOY_LEFT_SHOULDER",  Common::JOYSTICK_BUTTON_LEFT_SHOULDER,  _s("L1")          },
00051     { "JOY_RIGHT_SHOULDER", Common::JOYSTICK_BUTTON_RIGHT_SHOULDER, _s("R1")          },
00052     { "JOY_UP",             Common::JOYSTICK_BUTTON_DPAD_UP,        _s("D-pad Up")    },
00053     { "JOY_DOWN",           Common::JOYSTICK_BUTTON_DPAD_DOWN,      _s("D-pad Down")  },
00054     { "JOY_LEFT",           Common::JOYSTICK_BUTTON_DPAD_LEFT,      _s("D-pad Left")  },
00055     { "JOY_RIGHT",          Common::JOYSTICK_BUTTON_DPAD_RIGHT,     _s("D-pad Right") },
00056     { nullptr,              0,                                      nullptr           }
00057 };
00058 
00059 static const Common::AxisTableEntry playstationJoystickAxes[] = {
00060     { "JOY_LEFT_TRIGGER",  Common::JOYSTICK_AXIS_LEFT_TRIGGER,  Common::kAxisTypeHalf, _s("L2")            },
00061     { "JOY_RIGHT_TRIGGER", Common::JOYSTICK_AXIS_RIGHT_TRIGGER, Common::kAxisTypeHalf, _s("R2")            },
00062     { "JOY_LEFT_STICK_X",  Common::JOYSTICK_AXIS_LEFT_STICK_X,  Common::kAxisTypeFull, _s("Left Stick X")  },
00063     { "JOY_LEFT_STICK_Y",  Common::JOYSTICK_AXIS_LEFT_STICK_Y,  Common::kAxisTypeFull, _s("Left Stick Y")  },
00064     { "JOY_RIGHT_STICK_X", Common::JOYSTICK_AXIS_RIGHT_STICK_X, Common::kAxisTypeFull, _s("Right Stick X") },
00065     { "JOY_RIGHT_STICK_Y", Common::JOYSTICK_AXIS_RIGHT_STICK_Y, Common::kAxisTypeFull, _s("Right Stick Y") },
00066     { nullptr,             0,                                   Common::kAxisTypeFull, nullptr             }
00067 };
00068 
00069 int access(const char *pathname, int mode) {
00070     struct stat sb;
00071 
00072     if (stat(pathname, &sb) == -1) {
00073         return -1;
00074     }
00075 
00076     return 0;
00077 }
00078 
00079 void OSystem_PS3::init() {
00080     // Initialze File System Factory
00081     _fsFactory = new PS3FilesystemFactory();
00082 
00083     // Invoke parent implementation of this method
00084     OSystem_SDL::init();
00085 }
00086 
00087 void OSystem_PS3::initBackend() {
00088     ConfMan.set("joystick_num", 0);
00089     ConfMan.registerDefault("fullscreen", true);
00090     ConfMan.registerDefault("aspect_ratio", true);
00091 
00092     // Create the savefile manager
00093     if (_savefileManager == 0)
00094         _savefileManager = new DefaultSaveFileManager(PREFIX "/saves");
00095 
00096     // Event source
00097     if (_eventSource == 0)
00098         _eventSource = new PS3SdlEventSource();
00099 
00100     // Invoke parent implementation of this method
00101     OSystem_SDL::initBackend();
00102 }
00103 
00104 Common::String OSystem_PS3::getDefaultConfigFileName() {
00105     return PREFIX "/residualvm.ini";
00106 }
00107 
00108 Common::String OSystem_PS3::getDefaultLogFileName() {
00109     return PREFIX "/residualvm.log";
00110 }
00111 
00112 Common::HardwareInputSet *OSystem_PS3::getHardwareInputSet() {
00113     using namespace Common;
00114 
00115     CompositeHardwareInputSet *inputSet = new CompositeHardwareInputSet();
00116 
00117     // Users may use USB / bluetooth mice and keyboards
00118     inputSet->addHardwareInputSet(new MouseHardwareInputSet(defaultMouseButtons));
00119     inputSet->addHardwareInputSet(new KeyboardHardwareInputSet(defaultKeys, defaultModifiers));
00120     inputSet->addHardwareInputSet(new JoystickHardwareInputSet(playstationJoystickButtons, playstationJoystickAxes));
00121 
00122     return inputSet;
00123 }


Generated on Sat May 23 2020 05:00:29 for ResidualVM by doxygen 1.7.1
curved edge   curved edge