aboutsummaryrefslogtreecommitdiff
path: root/backends
diff options
context:
space:
mode:
Diffstat (limited to 'backends')
-rw-r--r--backends/audiocd/audiocd.h5
-rw-r--r--backends/audiocd/default/default-audiocd.cpp5
-rw-r--r--backends/audiocd/default/default-audiocd.h3
-rw-r--r--backends/audiocd/win32/win32-audiocd.cpp18
-rw-r--r--backends/events/default/default-events.h20
-rw-r--r--backends/events/psp2sdl/psp2sdl-events.cpp91
-rw-r--r--backends/events/psp2sdl/psp2sdl-events.h8
-rw-r--r--backends/events/sdl/sdl-events.cpp209
-rw-r--r--backends/events/sdl/sdl-events.h6
-rw-r--r--backends/fs/amigaos4/amigaos4-fs.cpp2
-rw-r--r--backends/fs/ds/ds-fs-factory.cpp2
-rw-r--r--backends/fs/ds/ds-fs.cpp2
-rw-r--r--backends/fs/posix/posix-fs.cpp23
-rw-r--r--backends/fs/psp2/psp2-fs-factory.cpp2
-rw-r--r--backends/graphics/psp2sdl/psp2sdl-graphics.cpp6
-rw-r--r--backends/graphics/windowed.h2
-rw-r--r--backends/midi/dmedia.cpp6
-rw-r--r--backends/modular-backend.h104
-rw-r--r--backends/platform/androidsdl/androidsdl-sdl.cpp8
-rw-r--r--backends/platform/dc/dc-fs.cpp2
-rw-r--r--backends/platform/dc/selector.cpp21
-rw-r--r--backends/platform/ds/arm7/source/main.cpp694
-rw-r--r--backends/platform/ds/arm9/source/cdaudio.cpp2
-rw-r--r--backends/platform/ds/arm9/source/dsmain.cpp53
-rw-r--r--backends/platform/ds/arm9/source/dsmain.h2
-rw-r--r--backends/platform/ds/arm9/source/dsoptions.cpp2
-rw-r--r--backends/platform/ds/arm9/source/fat/disc_io.c2
-rw-r--r--backends/platform/ds/arm9/source/osystem_ds.cpp3
-rw-r--r--backends/platform/ds/arm9/source/osystem_ds.h4
-rw-r--r--backends/platform/ds/arm9/source/wordcompletion.cpp2
-rw-r--r--backends/platform/ds/arm9/source/zipreader.cpp3
-rw-r--r--backends/platform/ds/ds.mk23
-rw-r--r--backends/platform/ios7/README.md127
-rw-r--r--backends/platform/ios7/ios7_osys_main.h2
-rw-r--r--backends/platform/n64/osys_n64_base.cpp2
-rw-r--r--backends/platform/n64/portdefs.h15
-rw-r--r--backends/platform/psp/display_manager.cpp2
-rw-r--r--backends/platform/psp/input.cpp2
-rw-r--r--backends/platform/sdl/macosx/macosx.cpp4
-rw-r--r--backends/platform/sdl/macosx/macosx.h1
-rw-r--r--backends/platform/sdl/macosx/macosx_wrapper.h1
-rw-r--r--backends/platform/sdl/macosx/macosx_wrapper.mm32
-rw-r--r--backends/platform/sdl/psp2/psp2-main.cpp4
-rw-r--r--backends/platform/sdl/psp2/psp2.cpp8
-rw-r--r--backends/platform/sdl/riscos/riscos-main.cpp2
-rw-r--r--backends/platform/sdl/riscos/riscos.cpp2
-rw-r--r--backends/platform/sdl/riscos/riscos.mk3
-rw-r--r--backends/platform/sdl/sdl.cpp34
-rw-r--r--backends/platform/sdl/sdl.h1
-rw-r--r--backends/platform/wii/osystem_events.cpp2
-rw-r--r--backends/plugins/ds/ds-provider.cpp4
-rw-r--r--backends/plugins/elf/version.cpp2
-rw-r--r--backends/saves/psp/psp-saves.cpp5
53 files changed, 804 insertions, 786 deletions
diff --git a/backends/audiocd/audiocd.h b/backends/audiocd/audiocd.h
index b3674f2570..1a31cd7b20 100644
--- a/backends/audiocd/audiocd.h
+++ b/backends/audiocd/audiocd.h
@@ -23,6 +23,7 @@
#ifndef BACKENDS_AUDIOCD_ABSTRACT_H
#define BACKENDS_AUDIOCD_ABSTRACT_H
+#include "audio/mixer.h"
#include "common/scummsys.h"
#include "common/noncopyable.h"
@@ -65,10 +66,12 @@ public:
* @param startFrame the frame at which playback should start (75 frames = 1 second).
* @param duration the number of frames to play.
* @param onlyEmulate determines if the track should be emulated only
+ * @param soundType What sound type to play as. By default, it's as music
* @note The @c onlyEmulate parameter is deprecated.
* @return @c true if the track started playing, @c false otherwise
*/
- virtual bool play(int track, int numLoops, int startFrame, int duration, bool onlyEmulate = false) = 0;
+ virtual bool play(int track, int numLoops, int startFrame, int duration, bool onlyEmulate = false,
+ Audio::Mixer::SoundType soundType = Audio::Mixer::kMusicSoundType) = 0;
/**
* Get if audio is being played.
diff --git a/backends/audiocd/default/default-audiocd.cpp b/backends/audiocd/default/default-audiocd.cpp
index c2ce7cedcc..003060c9a6 100644
--- a/backends/audiocd/default/default-audiocd.cpp
+++ b/backends/audiocd/default/default-audiocd.cpp
@@ -54,7 +54,8 @@ void DefaultAudioCDManager::close() {
stop();
}
-bool DefaultAudioCDManager::play(int track, int numLoops, int startFrame, int duration, bool onlyEmulate) {
+bool DefaultAudioCDManager::play(int track, int numLoops, int startFrame, int duration, bool onlyEmulate,
+ Audio::Mixer::SoundType soundType) {
stop();
if (numLoops != 0 || startFrame != 0) {
@@ -84,7 +85,7 @@ bool DefaultAudioCDManager::play(int track, int numLoops, int startFrame, int du
repetitions. Finally, -1 means infinitely many
*/
_emulating = true;
- _mixer->playStream(Audio::Mixer::kMusicSoundType, &_handle,
+ _mixer->playStream(soundType, &_handle,
Audio::makeLoopingAudioStream(stream, start, end, (numLoops < 1) ? numLoops + 1 : numLoops), -1, _cd.volume, _cd.balance);
return true;
}
diff --git a/backends/audiocd/default/default-audiocd.h b/backends/audiocd/default/default-audiocd.h
index e3fbb4b5a1..3c12560faa 100644
--- a/backends/audiocd/default/default-audiocd.h
+++ b/backends/audiocd/default/default-audiocd.h
@@ -40,7 +40,8 @@ public:
virtual bool open();
virtual void close();
- virtual bool play(int track, int numLoops, int startFrame, int duration, bool onlyEmulate = false);
+ virtual bool play(int track, int numLoops, int startFrame, int duration, bool onlyEmulate = false,
+ Audio::Mixer::SoundType soundType = Audio::Mixer::kMusicSoundType);
virtual void stop();
virtual bool isPlaying() const;
virtual void setVolume(byte volume);
diff --git a/backends/audiocd/win32/win32-audiocd.cpp b/backends/audiocd/win32/win32-audiocd.cpp
index b3cde308b9..6eff1ef0b3 100644
--- a/backends/audiocd/win32/win32-audiocd.cpp
+++ b/backends/audiocd/win32/win32-audiocd.cpp
@@ -149,13 +149,14 @@ public:
Win32AudioCDManager();
~Win32AudioCDManager();
- bool open();
- void close();
- bool play(int track, int numLoops, int startFrame, int duration, bool onlyEmulate = false);
+ virtual bool open();
+ virtual void close();
+ virtual bool play(int track, int numLoops, int startFrame, int duration, bool onlyEmulate = false,
+ Audio::Mixer::SoundType soundType = Audio::Mixer::kMusicSoundType);
protected:
- bool openCD(int drive);
- bool openCD(const Common::String &drive);
+ virtual bool openCD(int drive);
+ virtual bool openCD(const Common::String &drive);
private:
bool loadTOC();
@@ -254,9 +255,10 @@ void Win32AudioCDManager::close() {
_tocEntries.clear();
}
-bool Win32AudioCDManager::play(int track, int numLoops, int startFrame, int duration, bool onlyEmulate) {
+bool Win32AudioCDManager::play(int track, int numLoops, int startFrame, int duration, bool onlyEmulate,
+ Audio::Mixer::SoundType soundType) {
// Prefer emulation
- if (DefaultAudioCDManager::play(track, numLoops, startFrame, duration, onlyEmulate))
+ if (DefaultAudioCDManager::play(track, numLoops, startFrame, duration, onlyEmulate, soundType))
return true;
// If we're set to only emulate, or have no CD drive, return here
@@ -289,7 +291,7 @@ bool Win32AudioCDManager::play(int track, int numLoops, int startFrame, int dura
_emulating = true;
_mixer->playStream(
- Audio::Mixer::kMusicSoundType,
+ soundType,
&_handle,
Audio::makeLoopingAudioStream(audioStream, start, end, (numLoops < 1) ? numLoops + 1 : numLoops),
-1,
diff --git a/backends/events/default/default-events.h b/backends/events/default/default-events.h
index df6ebd2f14..9a85fca52a 100644
--- a/backends/events/default/default-events.h
+++ b/backends/events/default/default-events.h
@@ -49,7 +49,7 @@ class DefaultEventManager : public Common::EventManager, Common::EventObserver {
Common::ArtificialEventSource _artificialEventSource;
Common::Queue<Common::Event> _eventQueue;
- bool notifyEvent(const Common::Event &ev) {
+ bool notifyEvent(const Common::Event &ev) override {
_eventQueue.push(ev);
return true;
}
@@ -76,17 +76,17 @@ public:
DefaultEventManager(Common::EventSource *boss);
~DefaultEventManager();
- virtual void init();
- virtual bool pollEvent(Common::Event &event);
- virtual void pushEvent(const Common::Event &event);
+ virtual void init() override;
+ virtual bool pollEvent(Common::Event &event) override;
+ virtual void pushEvent(const Common::Event &event) override;
virtual void purgeMouseEvents() override;
- virtual Common::Point getMousePos() const { return _mousePos; }
- virtual int getButtonState() const { return _buttonState; }
- virtual int getModifierState() const { return _modifierState; }
- virtual int shouldQuit() const { return _shouldQuit; }
- virtual int shouldRTL() const { return _shouldRTL; }
- virtual void resetRTL() { _shouldRTL = false; }
+ virtual Common::Point getMousePos() const override { return _mousePos; }
+ virtual int getButtonState() const override { return _buttonState; }
+ virtual int getModifierState() const override { return _modifierState; }
+ virtual int shouldQuit() const override { return _shouldQuit; }
+ virtual int shouldRTL() const override { return _shouldRTL; }
+ virtual void resetRTL() override { _shouldRTL = false; }
#ifdef FORCE_RTL
virtual void resetQuit() { _shouldQuit = false; }
#endif
diff --git a/backends/events/psp2sdl/psp2sdl-events.cpp b/backends/events/psp2sdl/psp2sdl-events.cpp
index 5b0b6074fb..a342fa836b 100644
--- a/backends/events/psp2sdl/psp2sdl-events.cpp
+++ b/backends/events/psp2sdl/psp2sdl-events.cpp
@@ -44,6 +44,17 @@ PSP2EventSource::PSP2EventSource() {
}
_multiFingerDragging[port] = DRAG_NONE;
}
+
+ for (int port = 0; port < SCE_TOUCH_PORT_MAX_NUM; port++) {
+ for (int i = 0; i < 2; i++) {
+ _simulatedClickStartTime[port][i] = 0;
+ }
+ }
+}
+
+bool PSP2EventSource::pollEvent(Common::Event &event) {
+ finishSimulatedMouseClicks();
+ return SdlEventSource::pollEvent(event);
}
void PSP2EventSource::preprocessEvents(SDL_Event *event) {
@@ -107,6 +118,8 @@ void PSP2EventSource::preprocessFingerDown(SDL_Event *event) {
if (_finger[port][i].id == -1) {
_finger[port][i].id = id;
_finger[port][i].timeLastDown = event->tfinger.timestamp;
+ _finger[port][i].lastDownX = event->tfinger.x;
+ _finger[port][i].lastDownY = event->tfinger.y;
_finger[port][i].lastX = x;
_finger[port][i].lastY = y;
break;
@@ -137,28 +150,31 @@ void PSP2EventSource::preprocessFingerUp(SDL_Event *event) {
if (!_multiFingerDragging[port]) {
if ((event->tfinger.timestamp - _finger[port][i].timeLastDown) <= MAX_TAP_TIME) {
// short (<MAX_TAP_TIME ms) tap is interpreted as right/left mouse click depending on # fingers already down
- if (numFingersDown == 2 || numFingersDown == 1) {
- Uint8 simulatedButton = 0;
- if (numFingersDown == 2) {
- simulatedButton = SDL_BUTTON_RIGHT;
- } else if (numFingersDown == 1) {
- simulatedButton = SDL_BUTTON_LEFT;
- if (port == 0 && !ConfMan.getBool("frontpanel_touchpad_mode")) {
- convertTouchXYToGameXY(event->tfinger.x, event->tfinger.y, &x, &y);
+ // but only if the finger hasn't moved since it was pressed down by more than MAX_TAP_MOTION_DISTANCE pixels
+ float xrel = ((event->tfinger.x * 960.0) - (_finger[port][i].lastDownX * 960.0));
+ float yrel = ((event->tfinger.y * 544.0) - (_finger[port][i].lastDownY * 544.0));
+ float maxRSquared = (float) (MAX_TAP_MOTION_DISTANCE * MAX_TAP_MOTION_DISTANCE);
+ if ((xrel * xrel + yrel * yrel) < maxRSquared) {
+ if (numFingersDown == 2 || numFingersDown == 1) {
+ Uint8 simulatedButton = 0;
+ if (numFingersDown == 2) {
+ simulatedButton = SDL_BUTTON_RIGHT;
+ // need to raise the button later
+ _simulatedClickStartTime[port][1] = event->tfinger.timestamp;
+ } else if (numFingersDown == 1) {
+ simulatedButton = SDL_BUTTON_LEFT;
+ // need to raise the button later
+ _simulatedClickStartTime[port][0] = event->tfinger.timestamp;
+ if (port == 0 && !ConfMan.getBool("frontpanel_touchpad_mode")) {
+ convertTouchXYToGameXY(event->tfinger.x, event->tfinger.y, &x, &y);
+ }
}
- }
- event->type = SDL_MOUSEBUTTONDOWN;
- event->button.button = simulatedButton;
- event->button.x = x;
- event->button.y = y;
-
- SDL_Event ev;
- ev.type = SDL_MOUSEBUTTONUP;
- ev.button.button = simulatedButton;
- ev.button.x = x;
- ev.button.y = y;
- SDL_PushEvent(&ev);
+ event->type = SDL_MOUSEBUTTONDOWN;
+ event->button.button = simulatedButton;
+ event->button.x = x;
+ event->button.y = y;
+ }
}
}
} else if (numFingersDown == 1) {
@@ -349,6 +365,9 @@ void PSP2EventSource::convertTouchXYToGameXY(float touchX, float touchY, int *ga
int screenH = _km.y_max;
int screenW = _km.x_max;
+ int windowH = g_system->getHeight();
+ int windowW = g_system->getWidth();
+
bool fullscreen = ConfMan.getBool("fullscreen");
bool aspectRatioCorrection = ConfMan.getBool("aspect_ratio");
@@ -359,13 +378,13 @@ void PSP2EventSource::convertTouchXYToGameXY(float touchX, float touchY, int *ga
float sx, sy;
float ratio = (float)screenW / (float)screenH;
- if (aspectRatioCorrection) {
+ if (aspectRatioCorrection && (windowH == 200 || windowH == 400)) {
ratio = 4.0 / 3.0;
}
if (fullscreen || screenH >= dispH) {
h = dispH;
- if (aspectRatioCorrection) {
+ if (aspectRatioCorrection && (windowH == 200 || windowH == 400)) {
ratio = ratio * 1.1;
}
w = h * ratio;
@@ -379,7 +398,7 @@ void PSP2EventSource::convertTouchXYToGameXY(float touchX, float touchY, int *ga
h = screenH;
w = screenW;
}
- if (aspectRatioCorrection) {
+ if (aspectRatioCorrection && (windowH == 200 || windowH == 400)) {
// stretch the height only if it fits, otherwise make the width smaller
if (((float)w * (1.0 / ratio)) <= (float)dispH) {
h = w * (1.0 / ratio);
@@ -413,4 +432,30 @@ void PSP2EventSource::convertTouchXYToGameXY(float touchX, float touchY, int *ga
*gameY = _km.y_max;
}
}
+
+void PSP2EventSource::finishSimulatedMouseClicks() {
+ for (int port = 0; port < SCE_TOUCH_PORT_MAX_NUM; port++) {
+ for (int i = 0; i < 2; i++) {
+ if (_simulatedClickStartTime[port][i] != 0) {
+ Uint32 currentTime = SDL_GetTicks();
+ if (currentTime - _simulatedClickStartTime[port][i] >= SIMULATED_CLICK_DURATION) {
+ int simulatedButton;
+ if (i == 0) {
+ simulatedButton = SDL_BUTTON_LEFT;
+ } else {
+ simulatedButton = SDL_BUTTON_RIGHT;
+ }
+ SDL_Event ev;
+ ev.type = SDL_MOUSEBUTTONUP;
+ ev.button.button = simulatedButton;
+ ev.button.x = _km.x / MULTIPLIER;
+ ev.button.y = _km.y / MULTIPLIER;
+ SDL_PushEvent(&ev);
+
+ _simulatedClickStartTime[port][i] = 0;
+ }
+ }
+ }
+ }
+}
#endif
diff --git a/backends/events/psp2sdl/psp2sdl-events.h b/backends/events/psp2sdl/psp2sdl-events.h
index 2f27208f61..1d5fdf9d50 100644
--- a/backends/events/psp2sdl/psp2sdl-events.h
+++ b/backends/events/psp2sdl/psp2sdl-events.h
@@ -32,6 +32,7 @@
class PSP2EventSource : public SdlEventSource {
public:
PSP2EventSource();
+ bool pollEvent(Common::Event &event) override;
protected:
void preprocessEvents(SDL_Event *event) override;
private:
@@ -39,6 +40,8 @@ private:
enum {
MAX_NUM_FINGERS = 3, // number of fingers to track per panel
MAX_TAP_TIME = 250, // taps longer than this will not result in mouse click events
+ MAX_TAP_MOTION_DISTANCE = 10, // max distance finger motion in Vita screen pixels to be considered a tap
+ SIMULATED_CLICK_DURATION = 50, // time in ms how long simulated mouse clicks should be
}; // track three fingers per panel
typedef struct {
@@ -46,6 +49,8 @@ private:
Uint32 timeLastDown;
int lastX; // last known screen coordinates
int lastY; // last known screen coordinates
+ float lastDownX; // SDL touch coordinates when last pressed down
+ float lastDownY; // SDL touch coordinates when last pressed down
} Touch;
Touch _finger[SCE_TOUCH_PORT_MAX_NUM][MAX_NUM_FINGERS]; // keep track of finger status
@@ -58,10 +63,13 @@ private:
DraggingType _multiFingerDragging[SCE_TOUCH_PORT_MAX_NUM]; // keep track whether we are currently drag-and-dropping
+ unsigned int _simulatedClickStartTime[SCE_TOUCH_PORT_MAX_NUM][2]; // initiation time of last simulated left or right click (zero if no click)
+
void preprocessFingerDown(SDL_Event *event);
void preprocessFingerUp(SDL_Event *event);
void preprocessFingerMotion(SDL_Event *event);
void convertTouchXYToGameXY(float touchX, float touchY, int *gameX, int *gameY);
+ void finishSimulatedMouseClicks(void);
};
#endif /* BACKEND_EVENTS_PSP2_H */
diff --git a/backends/events/sdl/sdl-events.cpp b/backends/events/sdl/sdl-events.cpp
index a3c0087b94..6c4774554c 100644
--- a/backends/events/sdl/sdl-events.cpp
+++ b/backends/events/sdl/sdl-events.cpp
@@ -29,6 +29,7 @@
#include "backends/graphics/graphics.h"
#include "common/config-manager.h"
#include "common/textconsole.h"
+#include "common/fs.h"
// FIXME move joystick defines out and replace with confile file options
// we should really allow users to map any key to a joystick button
@@ -43,8 +44,14 @@
#define JOY_BUT_PERIOD 1
#define JOY_BUT_SPACE 4
#define JOY_BUT_F5 5
+#ifdef ENABLE_VKEYBD
+#define JOY_BUT_VKEYBOARD 7
+#endif
+
#if SDL_VERSION_ATLEAST(2, 0, 0)
+#define GAMECONTROLLERDB_FILE "gamecontrollerdb.txt"
+
static uint32 convUTF8ToUTF32(const char *src) {
uint32 utf32 = 0;
@@ -63,6 +70,32 @@ static uint32 convUTF8ToUTF32(const char *src) {
return utf32;
}
+
+void SdlEventSource::loadGameControllerMappingFile() {
+ bool loaded = false;
+ if (ConfMan.hasKey("controller_map_db")) {
+ Common::FSNode file = Common::FSNode(ConfMan.get("controller_map_db"));
+ if (file.exists()) {
+ if (SDL_GameControllerAddMappingsFromFile(file.getPath().c_str()) < 0)
+ error("File %s not valid: %s", file.getPath().c_str(), SDL_GetError());
+ else {
+ loaded = true;
+ debug("Game controller DB file loaded: %s", file.getPath().c_str());
+ }
+ } else
+ warning("Game controller DB file not found: %s", file.getPath().c_str());
+ }
+ if (!loaded && ConfMan.hasKey("extrapath")) {
+ Common::FSNode dir = Common::FSNode(ConfMan.get("extrapath"));
+ Common::FSNode file = dir.getChild(GAMECONTROLLERDB_FILE);
+ if (file.exists()) {
+ if (SDL_GameControllerAddMappingsFromFile(file.getPath().c_str()) < 0)
+ error("File %s not valid: %s", file.getPath().c_str(), SDL_GetError());
+ else
+ debug("Game controller DB file loaded: %s", file.getPath().c_str());
+ }
+ }
+}
#endif
SdlEventSource::SdlEventSource()
@@ -85,6 +118,7 @@ SdlEventSource::SdlEventSource()
if (SDL_InitSubSystem(SDL_INIT_GAMECONTROLLER) == -1) {
error("Could not initialize SDL: %s", SDL_GetError());
}
+ loadGameControllerMappingFile();
#endif
openJoystick(joystick_num);
@@ -164,100 +198,103 @@ bool SdlEventSource::processMouseEvent(Common::Event &event, int x, int y) {
return true;
}
-bool SdlEventSource::handleKbdMouse(Common::Event &event) {
- // returns true if an event is generated
- // Skip recording of these events
+void SdlEventSource::updateKbdMouse() {
uint32 curTime = g_system->getMillis(true);
+ if (curTime < _km.last_time + _km.delay_time) {
+ return;
+ }
- if (curTime >= _km.last_time + _km.delay_time) {
-
- int16 oldKmX = _km.x;
- int16 oldKmY = _km.y;
+ _km.last_time = curTime;
+ if (_km.x_down_count == 1) {
+ _km.x_down_time = curTime;
+ _km.x_down_count = 2;
+ }
+ if (_km.y_down_count == 1) {
+ _km.y_down_time = curTime;
+ _km.y_down_count = 2;
+ }
- _km.last_time = curTime;
- if (_km.x_down_count == 1) {
- _km.x_down_time = curTime;
- _km.x_down_count = 2;
+ if (_km.x_vel || _km.y_vel) {
+ if (_km.x_down_count) {
+ if (curTime > _km.x_down_time + 300) {
+ if (_km.x_vel > 0)
+ _km.x_vel += MULTIPLIER;
+ else
+ _km.x_vel -= MULTIPLIER;
+ } else if (curTime > _km.x_down_time + 200) {
+ if (_km.x_vel > 0)
+ _km.x_vel = 5 * MULTIPLIER;
+ else
+ _km.x_vel = -5 * MULTIPLIER;
+ }
}
- if (_km.y_down_count == 1) {
- _km.y_down_time = curTime;
- _km.y_down_count = 2;
+ if (_km.y_down_count) {
+ if (curTime > _km.y_down_time + 300) {
+ if (_km.y_vel > 0)
+ _km.y_vel += MULTIPLIER;
+ else
+ _km.y_vel -= MULTIPLIER;
+ } else if (curTime > _km.y_down_time + 200) {
+ if (_km.y_vel > 0)
+ _km.y_vel = 5 * MULTIPLIER;
+ else
+ _km.y_vel = -5 * MULTIPLIER;
+ }
}
- if (_km.x_vel || _km.y_vel) {
- if (_km.x_down_count) {
- if (curTime > _km.x_down_time + 300) {
- if (_km.x_vel > 0)
- _km.x_vel += MULTIPLIER;
- else
- _km.x_vel -= MULTIPLIER;
- } else if (curTime > _km.x_down_time + 200) {
- if (_km.x_vel > 0)
- _km.x_vel = 5 * MULTIPLIER;
- else
- _km.x_vel = -5 * MULTIPLIER;
- }
- }
- if (_km.y_down_count) {
- if (curTime > _km.y_down_time + 300) {
- if (_km.y_vel > 0)
- _km.y_vel += MULTIPLIER;
- else
- _km.y_vel -= MULTIPLIER;
- } else if (curTime > _km.y_down_time + 200) {
- if (_km.y_vel > 0)
- _km.y_vel = 5 * MULTIPLIER;
- else
- _km.y_vel = -5 * MULTIPLIER;
- }
- }
+ int16 speedFactor = computeJoystickMouseSpeedFactor();
+
+ // - The modifier key makes the mouse movement slower
+ // - The extra factor "delay/speedFactor" ensures velocities
+ // are independent of the kbdMouse update rate
+ // - all velocities were originally chosen
+ // at a delay of 25, so that is the reference used here
+ // - note: operator order is important to avoid overflow
+ if (_km.modifier) {
+ _km.x += ((_km.x_vel / 10) * ((int16)_km.delay_time)) / speedFactor;
+ _km.y += ((_km.y_vel / 10) * ((int16)_km.delay_time)) / speedFactor;
+ } else {
+ _km.x += (_km.x_vel * ((int16)_km.delay_time)) / speedFactor;
+ _km.y += (_km.y_vel * ((int16)_km.delay_time)) / speedFactor;
+ }
- int16 speedFactor = computeJoystickMouseSpeedFactor();
-
- // - The modifier key makes the mouse movement slower
- // - The extra factor "delay/speedFactor" ensures velocities
- // are independent of the kbdMouse update rate
- // - all velocities were originally chosen
- // at a delay of 25, so that is the reference used here
- // - note: operator order is important to avoid overflow
- if (_km.modifier) {
- _km.x += ((_km.x_vel / 10) * ((int16)_km.delay_time)) / speedFactor;
- _km.y += ((_km.y_vel / 10) * ((int16)_km.delay_time)) / speedFactor;
- } else {
- _km.x += (_km.x_vel * ((int16)_km.delay_time)) / speedFactor;
- _km.y += (_km.y_vel * ((int16)_km.delay_time)) / speedFactor;
- }
+ if (_km.x < 0) {
+ _km.x = 0;
+ _km.x_vel = -1 * MULTIPLIER;
+ _km.x_down_count = 1;
+ } else if (_km.x > _km.x_max * MULTIPLIER) {
+ _km.x = _km.x_max * MULTIPLIER;
+ _km.x_vel = 1 * MULTIPLIER;
+ _km.x_down_count = 1;
+ }
- if (_km.x < 0) {
- _km.x = 0;
- _km.x_vel = -1 * MULTIPLIER;
- _km.x_down_count = 1;
- } else if (_km.x > _km.x_max * MULTIPLIER) {
- _km.x = _km.x_max * MULTIPLIER;
- _km.x_vel = 1 * MULTIPLIER;
- _km.x_down_count = 1;
- }
+ if (_km.y < 0) {
+ _km.y = 0;
+ _km.y_vel = -1 * MULTIPLIER;
+ _km.y_down_count = 1;
+ } else if (_km.y > _km.y_max * MULTIPLIER) {
+ _km.y = _km.y_max * MULTIPLIER;
+ _km.y_vel = 1 * MULTIPLIER;
+ _km.y_down_count = 1;
+ }
+ }
+}
- if (_km.y < 0) {
- _km.y = 0;
- _km.y_vel = -1 * MULTIPLIER;
- _km.y_down_count = 1;
- } else if (_km.y > _km.y_max * MULTIPLIER) {
- _km.y = _km.y_max * MULTIPLIER;
- _km.y_vel = 1 * MULTIPLIER;
- _km.y_down_count = 1;
- }
+bool SdlEventSource::handleKbdMouse(Common::Event &event) {
+ int16 oldKmX = _km.x;
+ int16 oldKmY = _km.y;
- if (_graphicsManager) {
- _graphicsManager->getWindow()->warpMouseInWindow((Uint16)(_km.x / MULTIPLIER), (Uint16)(_km.y / MULTIPLIER));
- }
+ updateKbdMouse();
- if (_km.x != oldKmX || _km.y != oldKmY) {
- event.type = Common::EVENT_MOUSEMOVE;
- return processMouseEvent(event, _km.x / MULTIPLIER, _km.y / MULTIPLIER);
- }
+ if (_km.x != oldKmX || _km.y != oldKmY) {
+ if (_graphicsManager) {
+ _graphicsManager->getWindow()->warpMouseInWindow((Uint16)(_km.x / MULTIPLIER), (Uint16)(_km.y / MULTIPLIER));
}
+
+ event.type = Common::EVENT_MOUSEMOVE;
+ return processMouseEvent(event, _km.x / MULTIPLIER, _km.y / MULTIPLIER);
}
+
return false;
}
@@ -873,6 +910,11 @@ bool SdlEventSource::handleJoyButtonDown(SDL_Event &ev, Common::Event &event) {
event.kbd.keycode = Common::KEYCODE_F5;
event.kbd.ascii = mapKey(SDLK_F5, (SDLMod)ev.key.keysym.mod, 0);
break;
+#ifdef ENABLE_VKEYBD
+ case JOY_BUT_VKEYBOARD: // Toggles virtual keyboard
+ event.type = Common::EVENT_VIRTUAL_KEYBOARD;
+ break;
+#endif
}
return true;
}
@@ -904,6 +946,11 @@ bool SdlEventSource::handleJoyButtonUp(SDL_Event &ev, Common::Event &event) {
event.kbd.keycode = Common::KEYCODE_F5;
event.kbd.ascii = mapKey(SDLK_F5, (SDLMod)ev.key.keysym.mod, 0);
break;
+#ifdef ENABLE_VKEYBD
+ case JOY_BUT_VKEYBOARD: // Toggles virtual keyboard
+ // Handled in key down
+ break;
+#endif
}
return true;
}
diff --git a/backends/events/sdl/sdl-events.h b/backends/events/sdl/sdl-events.h
index c4c2ab406d..b26d4cc6bd 100644
--- a/backends/events/sdl/sdl-events.h
+++ b/backends/events/sdl/sdl-events.h
@@ -94,6 +94,11 @@ protected:
SdlGraphicsManager *_graphicsManager;
/**
+ * Search for a game controller db file and load it.
+ */
+ void loadGameControllerMappingFile();
+
+ /**
* Open the SDL joystick with the specified index
*
* After this function completes successfully, SDL sends events for the device.
@@ -135,6 +140,7 @@ protected:
virtual bool handleJoyButtonDown(SDL_Event &ev, Common::Event &event);
virtual bool handleJoyButtonUp(SDL_Event &ev, Common::Event &event);
virtual bool handleJoyAxisMotion(SDL_Event &ev, Common::Event &event);
+ virtual void updateKbdMouse();
virtual bool handleKbdMouse(Common::Event &event);
#if SDL_VERSION_ATLEAST(2, 0, 0)
diff --git a/backends/fs/amigaos4/amigaos4-fs.cpp b/backends/fs/amigaos4/amigaos4-fs.cpp
index 09ba3a1c83..134193a65b 100644
--- a/backends/fs/amigaos4/amigaos4-fs.cpp
+++ b/backends/fs/amigaos4/amigaos4-fs.cpp
@@ -266,7 +266,7 @@ bool AmigaOSFilesystemNode::getChildren(AbstractFSList &myList, ListMode mode, b
if (context) {
struct ExamineData * pExd = NULL; // NB: No need to free the value after usage, everything will be dealt with by the DirContext release
- AmigaOSFilesystemNode *entry ;
+ AmigaOSFilesystemNode *entry;
while ( (pExd = IDOS->ExamineDir(context)) ) {
if ( (EXD_IS_FILE(pExd) && ( Common::FSNode::kListFilesOnly == mode ))
|| (EXD_IS_DIRECTORY(pExd) && ( Common::FSNode::kListDirectoriesOnly == mode ))
diff --git a/backends/fs/ds/ds-fs-factory.cpp b/backends/fs/ds/ds-fs-factory.cpp
index 98c522f1d6..3ec4a40bd8 100644
--- a/backends/fs/ds/ds-fs-factory.cpp
+++ b/backends/fs/ds/ds-fs-factory.cpp
@@ -24,9 +24,9 @@
#define FORBIDDEN_SYMBOL_EXCEPTION_FILE
#if defined(__DS__)
+#include "dsmain.h" //for the isGBAMPAvailable() function
#include "backends/fs/ds/ds-fs-factory.h"
#include "backends/fs/ds/ds-fs.h"
-#include "dsmain.h" //for the isGBAMPAvailable() function
namespace Common {
DECLARE_SINGLETON(DSFilesystemFactory);
diff --git a/backends/fs/ds/ds-fs.cpp b/backends/fs/ds/ds-fs.cpp
index 035178dbb4..1df54a983d 100644
--- a/backends/fs/ds/ds-fs.cpp
+++ b/backends/fs/ds/ds-fs.cpp
@@ -23,12 +23,12 @@
// Disable symbol overrides for FILE as that is used in FLAC headers
#define FORBIDDEN_SYMBOL_EXCEPTION_FILE
+#include "dsmain.h"
#include "common/str.h"
#include "common/util.h"
//#include <NDS/ARM9/console.h> //basic print funcionality
#include "backends/fs/ds/ds-fs.h"
#include "backends/fs/stdiostream.h"
-#include "dsmain.h"
#include "fat/gba_nds_fat.h"
#include "common/bufferedstream.h"
diff --git a/backends/fs/posix/posix-fs.cpp b/backends/fs/posix/posix-fs.cpp
index 3f90fc1a19..01c2751857 100644
--- a/backends/fs/posix/posix-fs.cpp
+++ b/backends/fs/posix/posix-fs.cpp
@@ -62,6 +62,16 @@ void POSIXFilesystemNode::setFlags() {
POSIXFilesystemNode::POSIXFilesystemNode(const Common::String &p) {
assert(p.size() > 0);
+#ifdef PSP2
+ if (p == "/") {
+ _isDirectory = true;
+ _isValid = false;
+ _path = p;
+ _displayName = p;
+ return;
+ }
+#endif
+
// Expand "~/" to the value of the HOME env variable
if (p.hasPrefix("~/")) {
const char *home = getenv("HOME");
@@ -152,6 +162,15 @@ bool POSIXFilesystemNode::getChildren(AbstractFSList &myList, ListMode mode, boo
return true;
}
#endif
+#ifdef PSP2
+ if (_path == "/") {
+ POSIXFilesystemNode *entry1 = new POSIXFilesystemNode("ux0:");
+ myList.push_back(entry1);
+ POSIXFilesystemNode *entry2 = new POSIXFilesystemNode("uma0:");
+ myList.push_back(entry2);
+ return true;
+ }
+#endif
DIR *dirp = opendir(_path.c_str());
struct dirent *dp;
@@ -230,6 +249,10 @@ AbstractFSNode *POSIXFilesystemNode::getParent() const {
// This is a root directory of a drive
return makeNode("/"); // return a virtual root for a list of drives
#endif
+#ifdef PSP2
+ if (_path.hasSuffix(":"))
+ return makeNode("/");
+#endif
const char *start = _path.c_str();
const char *end = start + _path.size();
diff --git a/backends/fs/psp2/psp2-fs-factory.cpp b/backends/fs/psp2/psp2-fs-factory.cpp
index 68d91122b8..946eb10649 100644
--- a/backends/fs/psp2/psp2-fs-factory.cpp
+++ b/backends/fs/psp2/psp2-fs-factory.cpp
@@ -32,7 +32,7 @@
#include "backends/fs/psp2/psp2-fs-factory.h"
AbstractFSNode *PSP2FilesystemFactory::makeRootFileNode() const {
- return new POSIXFilesystemNode("ux0:");
+ return new POSIXFilesystemNode("/");
}
AbstractFSNode *PSP2FilesystemFactory::makeCurrentDirectoryFileNode() const {
diff --git a/backends/graphics/psp2sdl/psp2sdl-graphics.cpp b/backends/graphics/psp2sdl/psp2sdl-graphics.cpp
index 1947f8f751..5e6afc2a57 100644
--- a/backends/graphics/psp2sdl/psp2sdl-graphics.cpp
+++ b/backends/graphics/psp2sdl/psp2sdl-graphics.cpp
@@ -238,7 +238,7 @@ void PSP2SdlGraphicsManager::setAspectRatioCorrection(bool enable) {
SDL_Surface *PSP2SdlGraphicsManager::SDL_SetVideoMode(int width, int height, int bpp, Uint32 flags) {
SDL_Surface *screen = SurfaceSdlGraphicsManager::SDL_SetVideoMode(width, height, bpp, flags);
-
+
if (screen != nullptr) {
vita2d_set_vblank_wait(true);
_vitatex_hwscreen = vita2d_create_empty_texture_format(width, height, SCE_GXM_TEXTURE_FORMAT_R5G6B5);
@@ -264,7 +264,7 @@ void PSP2SdlGraphicsManager::SDL_UpdateRects(SDL_Surface *screen, int numrects,
float sx, sy;
float ratio = (float)screenW / (float)screenH;
- if (aspectRatioCorrection) {
+ if (aspectRatioCorrection && (screenH == 200 || screenH == 400)) {
ratio = 4.0 / 3.0;
}
@@ -281,7 +281,7 @@ void PSP2SdlGraphicsManager::SDL_UpdateRects(SDL_Surface *screen, int numrects,
h = screenH;
w = screenW;
}
- if (aspectRatioCorrection) {
+ if (aspectRatioCorrection && (screenH == 200 || screenH == 400)) {
// stretch the height only if it fits, otherwise make the width smaller
if (((float)w * (1.0 / ratio)) <= (float)dispH) {
h = w * (1.0 / ratio);
diff --git a/backends/graphics/windowed.h b/backends/graphics/windowed.h
index 5f89d2d233..8a0bddf5be 100644
--- a/backends/graphics/windowed.h
+++ b/backends/graphics/windowed.h
@@ -201,7 +201,7 @@ protected:
* @param x The new X position of the mouse in virtual screen coordinates.
* @param y The new Y position of the mouse in virtual screen coordinates.
*/
- void warpMouse(const int x, const int y) {
+ void warpMouse(const int x, const int y) override {
// Check active coordinate instead of window coordinate to avoid warping
// the mouse if it is still within the same virtual pixel
const Common::Point virtualCursor = convertWindowToVirtual(_cursorX, _cursorY);
diff --git a/backends/midi/dmedia.cpp b/backends/midi/dmedia.cpp
index eac2d34b58..475172c81f 100644
--- a/backends/midi/dmedia.cpp
+++ b/backends/midi/dmedia.cpp
@@ -166,7 +166,8 @@ void MidiDriver_DMEDIA::send(uint32 b) {
if (mdSend(_midiPort, &event, 1) != 1) {
warning("failed sending MIDI event (dump follows...)");
warning("MIDI Event (len=%u):", event.msglen);
- for (int i = 0; i < event.msglen; i++) warning("%02x ", (int)event.msg[i]);
+ for (int i = 0; i < event.msglen; i++)
+ warning("%02x ", (int)event.msg[i]);
}
}
@@ -186,7 +187,8 @@ void MidiDriver_DMEDIA::sysEx (const byte *msg, uint16 length) {
if (mdSend(_midiPort, &event, 1) != 1) {
fprintf(stderr, "failed sending MIDI SYSEX event (dump follows...)\n");
- for (int i = 0; i < event.msglen; i++) warning("%02x ", (int)event.msg[i]);
+ for (int i = 0; i < event.msglen; i++)
+ warning("%02x ", (int)event.msg[i]);
}
}
diff --git a/backends/modular-backend.h b/backends/modular-backend.h
index 982dbbfb02..fa34f2921f 100644
--- a/backends/modular-backend.h
+++ b/backends/modular-backend.h
@@ -52,9 +52,9 @@ public:
/** @name Features */
//@{
- virtual bool hasFeature(Feature f);
- virtual void setFeatureState(Feature f, bool enable);
- virtual bool getFeatureState(Feature f);
+ virtual bool hasFeature(Feature f) override;
+ virtual void setFeatureState(Feature f, bool enable) override;
+ virtual bool getFeatureState(Feature f) override;
//@}
@@ -62,76 +62,76 @@ public:
//@{
virtual GraphicsManager *getGraphicsManager();
- virtual const GraphicsMode *getSupportedGraphicsModes() const;
- virtual int getDefaultGraphicsMode() const;
- virtual bool setGraphicsMode(int mode);
- virtual int getGraphicsMode() const;
- virtual const GraphicsMode *getSupportedShaders() const;
- virtual int getShader() const;
- virtual bool setShader(int id);
- virtual void resetGraphicsScale();
+ virtual const GraphicsMode *getSupportedGraphicsModes() const override;
+ virtual int getDefaultGraphicsMode() const override;
+ virtual bool setGraphicsMode(int mode) override;
+ virtual int getGraphicsMode() const override;
+ virtual const GraphicsMode *getSupportedShaders() const override;
+ virtual int getShader() const override;
+ virtual bool setShader(int id) override;
+ virtual void resetGraphicsScale() override;
#ifdef USE_RGB_COLOR
- virtual Graphics::PixelFormat getScreenFormat() const;
- virtual Common::List<Graphics::PixelFormat> getSupportedFormats() const;
+ virtual Graphics::PixelFormat getScreenFormat() const override;
+ virtual Common::List<Graphics::PixelFormat> getSupportedFormats() const override;
#endif
- virtual void initSize(uint width, uint height, const Graphics::PixelFormat *format = NULL);
+ virtual void initSize(uint width, uint height, const Graphics::PixelFormat *format = NULL) override;
virtual void initSizeHint(const Graphics::ModeList &modes) override;
- virtual int getScreenChangeID() const;
-
- virtual void beginGFXTransaction();
- virtual OSystem::TransactionError endGFXTransaction();
-
- virtual int16 getHeight();
- virtual int16 getWidth();
- virtual PaletteManager *getPaletteManager();
- virtual void copyRectToScreen(const void *buf, int pitch, int x, int y, int w, int h);
- virtual Graphics::Surface *lockScreen();
- virtual void unlockScreen();
- virtual void fillScreen(uint32 col);
- virtual void updateScreen();
- virtual void setShakePos(int shakeOffset);
- virtual void setFocusRectangle(const Common::Rect& rect);
- virtual void clearFocusRectangle();
-
- virtual void showOverlay();
- virtual void hideOverlay();
- virtual Graphics::PixelFormat getOverlayFormat() const;
- virtual void clearOverlay();
- virtual void grabOverlay(void *buf, int pitch);
- virtual void copyRectToOverlay(const void *buf, int pitch, int x, int y, int w, int h);
- virtual int16 getOverlayHeight();
- virtual int16 getOverlayWidth();
-
- virtual bool showMouse(bool visible);
- virtual void warpMouse(int x, int y);
- virtual void setMouseCursor(const void *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, bool dontScale = false, const Graphics::PixelFormat *format = NULL);
- virtual void setCursorPalette(const byte *colors, uint start, uint num);
+ virtual int getScreenChangeID() const override;
+
+ virtual void beginGFXTransaction() override;
+ virtual OSystem::TransactionError endGFXTransaction() override;
+
+ virtual int16 getHeight() override;
+ virtual int16 getWidth() override;
+ virtual PaletteManager *getPaletteManager() override;
+ virtual void copyRectToScreen(const void *buf, int pitch, int x, int y, int w, int h) override;
+ virtual Graphics::Surface *lockScreen() override;
+ virtual void unlockScreen() override;
+ virtual void fillScreen(uint32 col) override;
+ virtual void updateScreen() override;
+ virtual void setShakePos(int shakeOffset) override;
+ virtual void setFocusRectangle(const Common::Rect& rect) override;
+ virtual void clearFocusRectangle() override;
+
+ virtual void showOverlay() override;
+ virtual void hideOverlay() override;
+ virtual Graphics::PixelFormat getOverlayFormat() const override;
+ virtual void clearOverlay() override;
+ virtual void grabOverlay(void *buf, int pitch) override;
+ virtual void copyRectToOverlay(const void *buf, int pitch, int x, int y, int w, int h) override;
+ virtual int16 getOverlayHeight() override;
+ virtual int16 getOverlayWidth() override;
+
+ virtual bool showMouse(bool visible) override;
+ virtual void warpMouse(int x, int y) override;
+ virtual void setMouseCursor(const void *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, bool dontScale = false, const Graphics::PixelFormat *format = NULL) override;
+ virtual void setCursorPalette(const byte *colors, uint start, uint num) override;
//@}
/** @name Mutex handling */
//@{
- virtual MutexRef createMutex();
- virtual void lockMutex(MutexRef mutex);
- virtual void unlockMutex(MutexRef mutex);
- virtual void deleteMutex(MutexRef mutex);
+ virtual MutexRef createMutex() override;
+ virtual void lockMutex(MutexRef mutex) override;
+ virtual void unlockMutex(MutexRef mutex) override;
+ virtual void deleteMutex(MutexRef mutex) override;
//@}
/** @name Sound */
//@{
- virtual Audio::Mixer *getMixer();
+ virtual Audio::Mixer *getMixer() override;
//@}
/** @name Miscellaneous */
//@{
- virtual void quit();
- virtual void displayMessageOnOSD(const char *msg);
- virtual void displayActivityIconOnOSD(const Graphics::Surface *icon);
+ virtual void quit() override;
+ virtual void displayMessageOnOSD(const char *msg) override;
+ virtual void displayActivityIconOnOSD(const Graphics::Surface *icon) override;
//@}
diff --git a/backends/platform/androidsdl/androidsdl-sdl.cpp b/backends/platform/androidsdl/androidsdl-sdl.cpp
index 697acca4d6..2ed644ecb2 100644
--- a/backends/platform/androidsdl/androidsdl-sdl.cpp
+++ b/backends/platform/androidsdl/androidsdl-sdl.cpp
@@ -44,18 +44,18 @@ void OSystem_ANDROIDSDL::initBackend() {
if (!ConfMan.hasKey("gfx_mode"))
ConfMan.set("gfx_mode", "2x");
-
+
if (!ConfMan.hasKey("swap_menu_and_back_buttons"))
ConfMan.setBool("swap_menu_and_back_buttons", true);
else
swapMenuAndBackButtons(ConfMan.getBool("swap_menu_and_back_buttons"));
-
+
if (!ConfMan.hasKey("touchpad_mouse_mode")) {
const bool enable = SDL_ANDROID_GetMouseEmulationMode();
ConfMan.setBool("touchpad_mouse_mode", enable);
} else
touchpadMode(ConfMan.getBool("touchpad_mouse_mode"));
-
+
if (!ConfMan.hasKey("onscreen_control")) {
const bool enable = SDL_ANDROID_GetScreenKeyboardShown();
ConfMan.setBool("onscreen_control", enable);
@@ -115,7 +115,7 @@ void OSystem_ANDROIDSDL::setFeatureState(Feature f, bool enable) {
swapMenuAndBackButtons(enable);
break;
}
-
+
OSystem_POSIX::setFeatureState(f, enable);
}
diff --git a/backends/platform/dc/dc-fs.cpp b/backends/platform/dc/dc-fs.cpp
index 1cc7b56710..a4d2675080 100644
--- a/backends/platform/dc/dc-fs.cpp
+++ b/backends/platform/dc/dc-fs.cpp
@@ -167,5 +167,5 @@ AbstractFSNode *OSystem_Dreamcast::makeCurrentDirectoryFileNode() const {
AbstractFSNode *OSystem_Dreamcast::makeFileNodePath(const Common::String &path) const {
AbstractFSNode *node = RoninCDFileNode::makeFileNodePath(path);
- return (node? node : new RoninCDNonexistingNode(path));
+ return (node ? node : new RoninCDNonexistingNode(path));
}
diff --git a/backends/platform/dc/selector.cpp b/backends/platform/dc/selector.cpp
index 6717ca494b..914d683334 100644
--- a/backends/platform/dc/selector.cpp
+++ b/backends/platform/dc/selector.cpp
@@ -155,11 +155,7 @@ static Game the_game;
static bool isIcon(const Common::FSNode &entry)
{
- int l = entry.getDisplayName().size();
- if (l>4 && !strcasecmp(entry.getDisplayName().c_str()+l-4, ".ICO"))
- return true;
- else
- return false;
+ return entry.getDisplayName().hasSuffixIgnoreCase(".ICO");
}
static bool loadIcon(Game &game, Dir *dirs, int num_dirs)
@@ -203,7 +199,7 @@ static bool uniqueGame(const char *base, const char *dir,
this is a workaround for the detector bug in toon... */
sameOrSubdir(dir, games->dir) &&
/*!strcmp(dir, games->dir) &&*/
- !stricmp(base, games->filename_base) &&
+ !scumm_stricmp(base, games->filename_base) &&
lang == games->language &&
plf == games->platform)
return false;
@@ -275,21 +271,22 @@ static int findGames(Game *games, int max, bool use_ini)
}
if (!use_ini) {
- GameList candidates = EngineMan.detectGames(files);
+ DetectionResults detectionResults = EngineMan.detectGames(files);
+ DetectedGames candidates = detectionResults.listRecognizedGames();
- for (GameList::const_iterator ge = candidates.begin();
+ for (DetectedGames::const_iterator ge = candidates.begin();
ge != candidates.end(); ++ge)
if (curr_game < max) {
- strcpy(games[curr_game].filename_base, ge->gameid().c_str());
+ strcpy(games[curr_game].filename_base, ge->gameId.c_str());
strcpy(games[curr_game].dir, dirs[curr_dir-1].name);
- games[curr_game].language = ge->language();
- games[curr_game].platform = ge->platform();
+ games[curr_game].language = ge->language;
+ games[curr_game].platform = ge->platform;
if (uniqueGame(games[curr_game].filename_base,
games[curr_game].dir,
games[curr_game].language,
games[curr_game].platform, games, curr_game)) {
- strcpy(games[curr_game].text, ge->description().c_str());
+ strcpy(games[curr_game].text, ge->description.c_str());
#if 0
printf("Registered game <%s> (l:%d p:%d) in <%s> <%s> because of <%s> <*>\n",
games[curr_game].text,
diff --git a/backends/platform/ds/arm7/source/main.cpp b/backends/platform/ds/arm7/source/main.cpp
index c4a22b8f68..617a1edc87 100644
--- a/backends/platform/ds/arm7/source/main.cpp
+++ b/backends/platform/ds/arm7/source/main.cpp
@@ -26,7 +26,7 @@
// -- modified by Darkain and others
//////////////////////////////////////////////////////////////////////
-//#define USE_LIBCARTRESET
+// #define USE_LIBCARTRESET
#include <nds.h>
@@ -37,7 +37,7 @@
#include <system.h>
#include <stdlib.h>
#include <string.h>
-#include <registers_alt.h> // Needed for SOUND_CR
+#include <registers_alt.h> // Needed for SOUND_CR
#include <NDS/scummvm_ipc.h>
//////////////////////////////////////////////////////////////////////
#ifdef USE_DEBUGGER
@@ -54,8 +54,8 @@
#define SCREEN_HEIGHT 192
s32 TOUCH_WIDTH = TOUCH_CAL_X2 - TOUCH_CAL_X1;
s32 TOUCH_HEIGHT = TOUCH_CAL_Y2 - TOUCH_CAL_Y1;
-s32 TOUCH_OFFSET_X = ( ((SCREEN_WIDTH -60) * TOUCH_CAL_X1) / TOUCH_WIDTH ) - 28;
-s32 TOUCH_OFFSET_Y = ( ((SCREEN_HEIGHT-60) * TOUCH_CAL_Y1) / TOUCH_HEIGHT ) - 28;
+s32 TOUCH_OFFSET_X = ( ((SCREEN_WIDTH - 60) * TOUCH_CAL_X1) / TOUCH_WIDTH ) - 28;
+s32 TOUCH_OFFSET_Y = ( ((SCREEN_HEIGHT - 60) * TOUCH_CAL_Y1) / TOUCH_HEIGHT ) - 28;
vu8 *soundData;
@@ -71,163 +71,157 @@ int temp;
int adpcmBufferNum = 0;
// those are pixel positions of the two points you click when calibrating
-#define TOUCH_CNTRL_X1 (*(vu8 *)0x027FFCDC)
-#define TOUCH_CNTRL_Y1 (*(vu8 *)0x027FFCDD)
-#define TOUCH_CNTRL_X2 (*(vu8 *)0x027FFCE2)
-#define TOUCH_CNTRL_Y2 (*(vu8 *)0x027FFCE3)
-
-
-//////////////////////////////////////////////////////////////////////
+#define TOUCH_CNTRL_X1 (*(vu8 *)0x027FFCDC)
+#define TOUCH_CNTRL_Y1 (*(vu8 *)0x027FFCDD)
+#define TOUCH_CNTRL_X2 (*(vu8 *)0x027FFCE2)
+#define TOUCH_CNTRL_Y2 (*(vu8 *)0x027FFCE3)
/*
-void startSound(int sampleRate, const void *data, uint32 bytes, u8 channel=0, u8 vol=0x7F, u8 pan=63, u8 format=0) {
- SCHANNEL_TIMER(channel) = SOUND_FREQ(sampleRate);
- SCHANNEL_SOURCE(channel) = (uint32)data;
- SCHANNEL_LENGTH(channel) = bytes;
- SCHANNEL_CR(channel) = SOUND_ENABLE | SOUND_ONE_SHOT | SOUND_VOL(vol) | SOUND_PAN(pan) | (format==1?SOUND_8BIT:SOUND_16BIT);
+void startSound(int sampleRate, const void *data, uint32 bytes, u8 channel = 0, u8 vol = 0x7F, u8 pan = 63, u8 format = 0) {
+ SCHANNEL_TIMER(channel) = SOUND_FREQ(sampleRate);
+ SCHANNEL_SOURCE(channel) = (uint32)data;
+ SCHANNEL_LENGTH(channel) = bytes;
+ SCHANNEL_CR(channel) = SOUND_ENABLE | SOUND_ONE_SHOT | SOUND_VOL(vol) | SOUND_PAN(pan) | (format==1?SOUND_8BIT:SOUND_16BIT);
}
-
s8 getFreeSoundChannel() {
- for (int i=0; i<16; i++) {
- if ( (SCHANNEL_CR(i) & SOUND_ENABLE) == 0 ) return i;
- }
- return -1;
+ for (int i = 0; i < 16; i++) {
+ if ( (SCHANNEL_CR(i) & SOUND_ENABLE) == 0 )
+ return i;
+ }
+ return -1;
}
*/
-
s8 getFreeSoundChannel() {
-// return 0;
- for (int i=0; i<16; i++) {
- if ( (SCHANNEL_CR(i) & SCHANNEL_ENABLE) == 0 ) return i;
- }
- return -1;
+ // return 0;
+ for (int i = 0; i < 16; i++) {
+ if ( (SCHANNEL_CR(i) & SCHANNEL_ENABLE) == 0 )
+ return i;
+ }
+ return -1;
}
-void startSound(int sampleRate, const void *data, uint32 bytes, u8 channel=0, u8 vol=0x7F, u8 pan=63, u8 format=0) {
-// REG_IME = IME_DISABLE;
+void startSound(int sampleRate, const void *data, uint32 bytes, u8 channel = 0, u8 vol = 0x7F, u8 pan = 63, u8 format = 0) {
+ // REG_IME = IME_DISABLE;
- channel = getFreeSoundChannel();
-/* if (format == 2) {
- channel = 1;
- } else {
- channel = 0;
- }*/
+ channel = getFreeSoundChannel();
+ /*
+ if (format == 2) {
+ channel = 1;
+ } else {
+ channel = 0;
+ }
+ */
- if (channel > 1) channel = 1;
+ if (channel > 1)
+ channel = 1;
- bytes &= ~7; // Multiple of 4 bytes!
-// bytes += 4;
+ bytes &= ~7; // Multiple of 4 bytes!
+ // bytes += 4;
- SCHANNEL_CR(channel) = 0;
- SCHANNEL_TIMER(channel) = SOUND_FREQ(sampleRate);
- SCHANNEL_SOURCE(channel) = ((uint32) (data));
- SCHANNEL_LENGTH(channel) = ((bytes & 0x7FFFFFFF) >> 2);
- SCHANNEL_REPEAT_POINT(channel) = 0;
+ SCHANNEL_CR(channel) = 0;
+ SCHANNEL_TIMER(channel) = SOUND_FREQ(sampleRate);
+ SCHANNEL_SOURCE(channel) = (uint32)data;
+ SCHANNEL_LENGTH(channel) = (bytes & 0x7FFFFFFF) >> 2;
+ SCHANNEL_REPEAT_POINT(channel) = 0;
- SCHANNEL_CR(channel + 2) = 0;
- SCHANNEL_TIMER(channel + 2) = SOUND_FREQ(sampleRate);
- SCHANNEL_SOURCE(channel + 2) = ((uint32) (data));
- SCHANNEL_LENGTH(channel + 2) = ((bytes & 0x7FFFFFFF) >> 2);
- SCHANNEL_REPEAT_POINT(channel + 2) = 0;
+ SCHANNEL_CR(channel + 2) = 0;
+ SCHANNEL_TIMER(channel + 2) = SOUND_FREQ(sampleRate);
+ SCHANNEL_SOURCE(channel + 2) = (uint32)data;
+ SCHANNEL_LENGTH(channel + 2) = (bytes & 0x7FFFFFFF) >> 2;
+ SCHANNEL_REPEAT_POINT(channel + 2) = 0;
- uint32 flags = SCHANNEL_ENABLE | SOUND_VOL(vol) | SOUND_PAN(pan);
+ uint32 flags = SCHANNEL_ENABLE | SOUND_VOL(vol) | SOUND_PAN(pan);
- switch (format) {
+ switch (format) {
case 1: {
flags |= SOUND_FORMAT_8BIT;
- flags |= SOUND_REPEAT;// | (1 << 15);
+ flags |= SOUND_REPEAT; // | (1 << 15);
break;
}
case 0: {
flags |= SOUND_FORMAT_16BIT;
- flags |= SOUND_REPEAT;// | (1 << 15);
+ flags |= SOUND_REPEAT; // | (1 << 15);
break;
}
case 2: {
flags |= SOUND_FORMAT_ADPCM;
- flags |= SOUND_ONE_SHOT;// | (1 << 15);
+ flags |= SOUND_ONE_SHOT; // | (1 << 15);
- SCHANNEL_SOURCE(channel) = (unsigned int) IPC->adpcm.buffer[0];
- //bytes += 32;
- SCHANNEL_LENGTH(channel) = (((bytes + 4) & 0x7FFFFFFF) >> 2);
+ SCHANNEL_SOURCE(channel) = (unsigned int)IPC->adpcm.buffer[0];
+ // bytes += 32;
+ SCHANNEL_LENGTH(channel) = ((bytes + 4) & 0x7FFFFFFF) >> 2;
SCHANNEL_CR(channel + 1) = 0;
- SCHANNEL_SOURCE(channel + 1) = (unsigned int) IPC->adpcm.buffer[0];
- SCHANNEL_LENGTH(channel + 1) = (((bytes + 4) & 0x7FFFFFFF) >> 2);
- SCHANNEL_TIMER(channel + 1) = SOUND_FREQ(sampleRate);
+ SCHANNEL_SOURCE(channel + 1) = (unsigned int)IPC->adpcm.buffer[0];
+ SCHANNEL_LENGTH(channel + 1) = ((bytes + 4) & 0x7FFFFFFF) >> 2;
+ SCHANNEL_TIMER(channel + 1) = SOUND_FREQ(sampleRate);
SCHANNEL_REPEAT_POINT(channel + 1) = 0;
SCHANNEL_CR(channel + 1) = flags;
temp = bytes;
adpcmBufferNum = 0;
break;
}
- }
-
-
-// if (bytes & 0x80000000) {
-// flags |= SOUND_REPEAT;
-// } else {
-// }
-
-
-
+ }
- soundData = (vu8 *) data;
+ /*
+ if (bytes & 0x80000000) {
+ flags |= SOUND_REPEAT;
+ } else {
+ }
+ */
- SCHANNEL_CR(channel) = flags;
- SCHANNEL_CR(channel + 2) = flags;
+ soundData = (vu8 *)data;
+ SCHANNEL_CR(channel) = flags;
+ SCHANNEL_CR(channel + 2) = flags;
+ if (channel == 0) {
+ for (volatile int i = 0; i < 16384 * 2; i++) {
+ // Delay loop - this makes everything stay in sync!
+ }
- if (channel == 0) {
- for (volatile int i = 0; i < 16384 * 2; i++) {
- // Delay loop - this makes everything stay in sync!
- }
+ TIMER0_CR = 0;
+ TIMER0_DATA = SOUND_FREQ(sampleRate) * 2;
+ TIMER0_CR = TIMER_ENABLE | TIMER_DIV_1;
- TIMER0_CR = 0;
- TIMER0_DATA = SOUND_FREQ(sampleRate) * 2;
- TIMER0_CR = TIMER_ENABLE | TIMER_DIV_1;
+ TIMER1_CR = 0;
+ TIMER1_DATA = 65536 - ((bytes & 0x7FFFFFFF) >> 3); // Trigger four times during the length of the buffer
+ TIMER1_CR = TIMER_ENABLE | TIMER_IRQ_REQ | TIMER_CASCADE;
- TIMER1_CR = 0;
- TIMER1_DATA = 65536 - ((bytes & 0x7FFFFFFF) >> 3); // Trigger four times during the length of the buffer
- TIMER1_CR = TIMER_ENABLE | TIMER_IRQ_REQ | TIMER_CASCADE;
+ playingSection = 0;
+ } else {
+ for (volatile int i = 0; i < 16384 * 2; i++) {
+ // Delay loop - this makes everything stay in sync!
+ }
- playingSection = 0;
- } else {
- for (volatile int i = 0; i < 16384 * 2; i++) {
- // Delay loop - this makes everything stay in sync!
- }
+ TIMER2_CR = 0;
+ TIMER2_DATA = SOUND_FREQ(sampleRate) * 2;
+ TIMER2_CR = TIMER_ENABLE | TIMER_DIV_1;
- TIMER2_CR = 0;
- TIMER2_DATA = SOUND_FREQ(sampleRate) * 2;
- TIMER2_CR = TIMER_ENABLE | TIMER_DIV_1;
+ TIMER3_CR = 0;
+ TIMER3_DATA = 65536 - ((bytes & 0x7FFFFFFF) >> 3); // Trigger four times during the length of the buffer
+ TIMER3_CR = TIMER_ENABLE | TIMER_IRQ_REQ | TIMER_CASCADE;
- TIMER3_CR = 0;
- TIMER3_DATA = 65536 - ((bytes & 0x7FFFFFFF) >> 3); // Trigger four times during the length of the buffer
- TIMER3_CR = TIMER_ENABLE | TIMER_IRQ_REQ | TIMER_CASCADE;
+ for (int r = 0; r < 4; r++) {
+ // IPC->streamFillNeeded[r] = true;
+ }
- for (int r = 0; r < 4; r++) {
-// IPC->streamFillNeeded[r] = true;
+ IPC->streamPlayingSection = 0;
}
- IPC->streamPlayingSection = 0;
- }
-
-
-
-// IPC->fillSoundFirstHalf = true;
-// IPC->fillSoundSecondHalf = true;
-// soundFirstHalf = true;
+ // IPC->fillSoundFirstHalf = true;
+ // IPC->fillSoundSecondHalf = true;
+ // soundFirstHalf = true;
-// REG_IME = IME_ENABLE;
+ // REG_IME = IME_ENABLE;
}
void stopSound(int chan) {
- SCHANNEL_CR(chan) = 0;
+ SCHANNEL_CR(chan) = 0;
}
void DummyHandler() {
@@ -235,146 +229,132 @@ void DummyHandler() {
}
void powerManagerWrite(uint32 command, u32 data, bool enable) {
-
- uint16 result;
- SerialWaitBusy();
-
- // Write the command and wait for it to complete
- REG_SPICNT = SPI_ENABLE | SPI_BAUD_1MHz | (1 << 11);
- REG_SPIDATA = command | 0x80;
- SerialWaitBusy();
-
- // Write the second command and clock in the data
- REG_SPICNT = SPI_ENABLE | SPI_BAUD_1MHz;
- REG_SPIDATA = 0;
- SerialWaitBusy();
-
- result = REG_SPIDATA & 0xFF;
-
-
-
- // Write the command and wait for it to complete
- REG_SPICNT = SPI_ENABLE | SPI_BAUD_1MHz | (1 << 11);
- REG_SPIDATA = command;
- SerialWaitBusy();
-
- // Write the second command and clock in the data
- REG_SPICNT = SPI_ENABLE | SPI_BAUD_1MHz;
- REG_SPIDATA = enable? (result | data): (result & ~data);
- SerialWaitBusy();
+ uint16 result;
+ SerialWaitBusy();
+
+ // Write the command and wait for it to complete
+ REG_SPICNT = SPI_ENABLE | SPI_BAUD_1MHz | (1 << 11);
+ REG_SPIDATA = command | 0x80;
+ SerialWaitBusy();
+
+ // Write the second command and clock in the data
+ REG_SPICNT = SPI_ENABLE | SPI_BAUD_1MHz;
+ REG_SPIDATA = 0;
+ SerialWaitBusy();
+
+ result = REG_SPIDATA & 0xFF;
+
+ // Write the command and wait for it to complete
+ REG_SPICNT = SPI_ENABLE | SPI_BAUD_1MHz | (1 << 11);
+ REG_SPIDATA = command;
+ SerialWaitBusy();
+
+ // Write the second command and clock in the data
+ REG_SPICNT = SPI_ENABLE | SPI_BAUD_1MHz;
+ REG_SPIDATA = enable ? (result | data) : (result & ~data);
+ SerialWaitBusy();
}
/*
void performSleep() {
+ powerManagerWrite(0, 0x30, true);
- powerManagerWrite(0, 0x30, true);
-
- // Here, I set up a dummy interrupt handler, then trigger all interrupts.
- // These are just aknowledged by the handler without doing anything else.
- // Why? Because without it the sleep mode will only happen once, and then
- // never again. I got the idea from reading the MoonShell source.
- IME = 0;
- u32 irq = (u32) IRQ_HANDLER;
- IRQ_HANDLER = DummyHandler;
- IF = ~0;
- IME = 1;
+ // Here, I set up a dummy interrupt handler, then trigger all interrupts.
+ // These are just aknowledged by the handler without doing anything else.
+ // Why? Because without it the sleep mode will only happen once, and then
+ // never again. I got the idea from reading the MoonShell source.
+ IME = 0;
+ u32 irq = (u32)IRQ_HANDLER;
+ IRQ_HANDLER = DummyHandler;
+ IF = ~0;
+ IME = 1;
+ // Now save which interrupts are enabled, then set only the screens unfolding
+ // interrupt to be enabled, so that the first interrupt that happens is the
+ // one I want.
+ int saveInts = IE;
- // Now save which interrupts are enabled, then set only the screens unfolding
- // interrupt to be enabled, so that the first interrupt that happens is the
- // one I want.
- int saveInts = IE;
+ IE = IRQ_TIMER0; // Screens unfolding interrupt
+ // Now call the sleep function in the bios
+ bool b;
+ do {
+ TIMER0_CR = 0;
+ TIMER0_DATA = TIMER_FREQ(20);
+ TIMER0_CR = TIMER_ENABLE | TIMER_DIV_64;
+ swiDelay(100);
- IE = IRQ_TIMER0; // Screens unfolding interrupt
+ swiSleep();
- // Now call the sleep function in the bios
- bool b;
- do {
- TIMER0_CR = 0;
- TIMER0_DATA = TIMER_FREQ(20);
- TIMER0_CR = TIMER_ENABLE | TIMER_DIV_64;
+ swiDelay(100);
- swiDelay(100);
-
- swiSleep();
-
- swiDelay(100);
-
- powerManagerWrite(0, 0x30, b = !b);
- } while (!(TIMER0_CR & TIMER_ENABLE));
-
- TIMER0_CR = 0;
-
- // We're back from sleep, now restore the interrupt state and IRQ handler
- IRQ_HANDLER = (void (*)()) irq;
- IE = saveInts;
- IF = ~0;
- IME = 1;
+ powerManagerWrite(0, 0x30, b = !b);
+ } while (!(TIMER0_CR & TIMER_ENABLE));
+ TIMER0_CR = 0;
+ // We're back from sleep, now restore the interrupt state and IRQ handler
+ IRQ_HANDLER = (void (*)())irq;
+ IE = saveInts;
+ IF = ~0;
+ IME = 1;
- powerManagerWrite(0, 0x30, false);
+ powerManagerWrite(0, 0x30, false);
}
-
*/
-void performSleep() {
- powerManagerWrite(0, 0x30, true);
- IPC->performArm9SleepMode = true; // Tell ARM9 to sleep
+void performSleep() {
+ powerManagerWrite(0, 0x30, true);
-// u32 irq = (u32) IRQ_HANDLER;
-// IRQ_HANDLER = DummyHandler;
-// POWER_CR &= ~POWER_SOUND;
+ IPC->performArm9SleepMode = true; // Tell ARM9 to sleep
-// int saveInts = REG_IE;
-// REG_IE = (1 << 22) | IRQ_VBLANK; // Lid open
-// *((u32 *) (0x0380FFF8)) = *((u32 *) (0x0380FFF8)) | (REG_IE & REG_IF);
-// VBLANK_INTR_WAIT_FLAGS = IRQ_VBLANK;
+ // u32 irq = (u32)IRQ_HANDLER;
+ // IRQ_HANDLER = DummyHandler;
+ // POWER_CR &= ~POWER_SOUND;
+ // int saveInts = REG_IE;
+ // REG_IE = (1 << 22) | IRQ_VBLANK; // Lid open
+ // *((u32 *)(0x0380FFF8)) = *((u32 *)(0x0380FFF8)) | (REG_IE & REG_IF);
+ // VBLANK_INTR_WAIT_FLAGS = IRQ_VBLANK;
- int r = 0;
- while ((REG_KEYXY & (1 << 7))) { // Wait for lid to open
- swiDelay(1000000);
- r++;
- }
+ int r = 0;
+ while ((REG_KEYXY & (1 << 7))) { // Wait for lid to open
+ swiDelay(1000000);
+ r++;
+ }
-// IRQ_HANDLER = (void (*)()) irq;
- IPC->performArm9SleepMode = false; // Tell ARM9 to wake up
-// REG_IE = saveInts;
+ // IRQ_HANDLER = (void (*)())irq;
+ IPC->performArm9SleepMode = false; // Tell ARM9 to wake up
+ // REG_IE = saveInts;
-// POWER_CR |= POWER_SOUND;
+ // POWER_CR |= POWER_SOUND;
- powerManagerWrite(0, 0x30, false);
+ powerManagerWrite(0, 0x30, false);
}
void powerOff() {
powerManagerWrite(0, 0x40, true);
}
-//////////////////////////////////////////////////////////////////////
-
-
void InterruptTimer1() {
-
IPC->fillNeeded[playingSection] = true;
soundFilled[playingSection] = false;
if (playingSection == 3) {
-// IME = IME_DISABLED;
+ // IME = IME_DISABLED;
- // while (SCHANNEL_CR(0) & SCHANNEL_ENABLE) {
- // }
-// SCHANNEL_CR(0) &= ~SCHANNEL_ENABLE;
+ // while (SCHANNEL_CR(0) & SCHANNEL_ENABLE) {
+ // }
+ // SCHANNEL_CR(0) &= ~SCHANNEL_ENABLE;
-// SCHANNEL_CR(0) |= SCHANNEL_ENABLE;
-// TIMER1_CR = 0;
-// TIMER1_CR = TIMER_ENABLE | TIMER_IRQ_REQ | TIMER_CASCADE;
+ // SCHANNEL_CR(0) |= SCHANNEL_ENABLE;
+ // TIMER1_CR = 0;
+ // TIMER1_CR = TIMER_ENABLE | TIMER_IRQ_REQ | TIMER_CASCADE;
playingSection = 0;
-// IME = IME_ENABLED;
+ // IME = IME_ENABLED;
} else {
playingSection++;
}
@@ -395,8 +375,8 @@ void InterruptTimer1() {
}
void InterruptTimer3() {
- while (IPC->adpcm.semaphore); // Wait for buffer to become free if needed
- IPC->adpcm.semaphore = true; // Lock the buffer structure to prevent clashing with the ARM7
+ while (IPC->adpcm.semaphore); // Wait for buffer to become free if needed
+ IPC->adpcm.semaphore = true; // Lock the buffer structure to prevent clashing with the ARM7
IPC->streamFillNeeded[IPC->streamPlayingSection] = true;
@@ -406,153 +386,145 @@ void InterruptTimer3() {
IPC->streamPlayingSection++;
}
-
IPC->adpcm.semaphore = false;
}
-// IPC->performArm9SleepMode = false;
-
- // precalculate some values
-// static int16 TOUCH_WIDTH = TOUCH_CAL_X2 - TOUCH_CAL_X1;
-// static int16 TOUCH_HEIGHT = TOUCH_CAL_Y2 - TOUCH_CAL_Y1;
-// static int16 CNTRL_WIDTH = TOUCH_CNTRL_X2 - (TOUCH_CNTRL_X1 - 8);
-// static int16 CNTRL_HEIGHT = TOUCH_CNTRL_Y2 - (TOUCH_CNTRL_Y1 - 8);
-
-
+// IPC->performArm9SleepMode = false;
+// precalculate some values
+// static int16 TOUCH_WIDTH = TOUCH_CAL_X2 - TOUCH_CAL_X1;
+// static int16 TOUCH_HEIGHT = TOUCH_CAL_Y2 - TOUCH_CAL_Y1;
+// static int16 CNTRL_WIDTH = TOUCH_CNTRL_X2 - (TOUCH_CNTRL_X1 - 8);
+// static int16 CNTRL_HEIGHT = TOUCH_CNTRL_Y2 - (TOUCH_CNTRL_Y1 - 8);
void InterruptVBlank() {
- uint16 but=0, x=0, y=0, xpx=0, ypx=0, z1=0, z2=0, batt=0, aux=0;
- int t1=0, t2=0;
- uint32 temp=0;
- uint8 ct[sizeof(IPC->curtime)];
+ uint16 but = 0, x = 0, y = 0, xpx = 0, ypx = 0, z1 = 0, z2 = 0, batt = 0, aux = 0;
+ int t1 = 0, t2 = 0;
+ uint32 temp = 0;
+ uint8 ct[sizeof(IPC->curtime)];
static int heartbeat = 0;
- // Update the heartbeat
- heartbeat++;
-
- // Read the X/Y buttons and the /PENIRQ line
- but = REG_KEYXY;
- if (!(but & 0x40)) {
- // Read the touch screen
- touchPosition p;
- touchReadXY(&p);
-
-// x = touchRead(TSC_MEASURE_X);
- // y = touchRead(TSC_MEASURE_Y);
+ // Update the heartbeat
+ heartbeat++;
- x = p.rawx;
- y = p.rawy;
+ // Read the X/Y buttons and the /PENIRQ line
+ but = REG_KEYXY;
+ if (!(but & 0x40)) {
+ // Read the touch screen
+ touchPosition p;
+ touchReadXY(&p);
- xpx = p.px;
- ypx = p.py;
+ // x = touchRead(TSC_MEASURE_X);
+ // y = touchRead(TSC_MEASURE_Y);
-// xpx = ( ((SCREEN_WIDTH -60) * x) / TOUCH_WIDTH ) - TOUCH_OFFSET_X;
- // ypx = ( ((SCREEN_HEIGHT-60) * y) / TOUCH_HEIGHT ) - TOUCH_OFFSET_Y;
+ x = p.rawx;
+ y = p.rawy;
-// xpx = (IPC->touchX - (int16) TOUCH_CAL_X1) * CNTRL_WIDTH / TOUCH_WIDTH + (int16) (TOUCH_CNTRL_X1 - 8);
- // ypx = (IPC->touchY - (int16) TOUCH_CAL_Y1) * CNTRL_HEIGHT / TOUCH_HEIGHT + (int16) (TOUCH_CNTRL_Y1 - 8);
+ // xpx = p.px;
+ // ypx = p.py;
+ xpx = ( ((SCREEN_WIDTH - 60) * x) / TOUCH_WIDTH ) - TOUCH_OFFSET_X;
+ ypx = ( ((SCREEN_HEIGHT - 60) * y) / TOUCH_HEIGHT ) - TOUCH_OFFSET_Y;
- z1 = touchRead(TSC_MEASURE_Z1);
- z2 = touchRead(TSC_MEASURE_Z2);
- }
+ // xpx = (IPC->touchX - (int16) TOUCH_CAL_X1) * CNTRL_WIDTH / TOUCH_WIDTH + (int16) (TOUCH_CNTRL_X1 - 8);
+ // ypx = (IPC->touchY - (int16) TOUCH_CAL_Y1) * CNTRL_HEIGHT / TOUCH_HEIGHT + (int16) (TOUCH_CNTRL_Y1 - 8);
- if (but & (1 << 7)) { // Check if screen is folded
- needSleep = true;
+ z1 = touchRead(TSC_MEASURE_Z1);
+ z2 = touchRead(TSC_MEASURE_Z2);
}
+ // Check if screen is folded
+ if (but & (1 << 7)) {
+ needSleep = true;
+ }
- batt = touchRead(TSC_MEASURE_BATTERY);
- aux = touchRead(TSC_MEASURE_AUX);
-
- // Read the time
- rtcGetTime((uint8 *)ct);
- BCDToInteger((uint8 *)&(ct[1]), 7);
-
- // Read the temperature
- temp = touchReadTemperature(&t1, &t2);
-
-
- // Update the IPC struct
- IPC->heartbeat = heartbeat;
- IPC->buttons = but;
- IPC->touchX = x;
- IPC->touchY = y;
- IPC->touchXpx = xpx;
- IPC->touchYpx = ypx;
- IPC->touchZ1 = z1;
- IPC->touchZ2 = z2;
- IPC->battery = batt;
- IPC->aux = aux;
-
- for (u32 i=0; i<sizeof(ct); i++) {
- IPC->curtime[i] = ct[i];
- }
-
- IPC->temperature = temp;
- IPC->tdiode1 = t1;
- IPC->tdiode2 = t2;
-
-
+ batt = touchRead(TSC_MEASURE_BATTERY);
+ aux = touchRead(TSC_MEASURE_AUX);
+
+ // Read the time
+ rtcGetTime((uint8 *)ct);
+ BCDToInteger((uint8 *)&(ct[1]), 7);
+
+ // Read the temperature
+ temp = touchReadTemperature(&t1, &t2);
+
+ // Update the IPC struct
+ IPC->heartbeat = heartbeat;
+ IPC->buttons = but;
+ IPC->touchX = x;
+ IPC->touchY = y;
+ IPC->touchXpx = xpx;
+ IPC->touchYpx = ypx;
+ IPC->touchZ1 = z1;
+ IPC->touchZ2 = z2;
+ IPC->battery = batt;
+ IPC->aux = aux;
+
+ for (u32 i = 0; i < sizeof(ct); i++) {
+ IPC->curtime[i] = ct[i];
+ }
- //sound code :)
- TransferSound *snd = IPC->soundData;
- IPC->soundData = 0;
- if (snd) {
- for (int i=0; i<snd->count; i++) {
- s8 chan = getFreeSoundChannel();
- if (snd->data[i].rate > 0) {
- if (chan >= 0) {
- startSound(snd->data[i].rate, snd->data[i].data, snd->data[i].len, chan, snd->data[i].vol, snd->data[i].pan, snd->data[i].format);
+ IPC->temperature = temp;
+ IPC->tdiode1 = t1;
+ IPC->tdiode2 = t2;
+
+ // sound code :)
+ TransferSound *snd = IPC->soundData;
+ IPC->soundData = 0;
+ if (snd) {
+ for (int i = 0; i < snd->count; i++) {
+ s8 chan = getFreeSoundChannel();
+ if (snd->data[i].rate > 0) {
+ if (chan >= 0) {
+ startSound(snd->data[i].rate, snd->data[i].data, snd->data[i].len, chan, snd->data[i].vol, snd->data[i].pan, snd->data[i].format);
+ }
+ } else {
+ stopSound(-snd->data[i].rate);
}
- } else {
- stopSound(-snd->data[i].rate);
}
- }
- }
-
+ }
- #ifdef USE_DEBUGGER
- Wifi_Update(); // update wireless in vblank
- #endif
+#ifdef USE_DEBUGGER
+ Wifi_Update(); // update wireless in vblank
+#endif
}
-//////////////////////////////////////////////////////////////////////
-
-
#ifdef USE_DEBUGGER
-
// callback to allow wifi library to notify arm9
void arm7_synctoarm9() { // send fifo message
- REG_IPC_FIFO_TX = 0x87654321;
+ REG_IPC_FIFO_TX = 0x87654321;
}
+
// interrupt handler to allow incoming notifications from arm9
void arm7_fifo() { // check incoming fifo messages
- u32 msg = REG_IPC_FIFO_RX;
- if (msg==0x87654321) Wifi_Sync();
+ u32 msg = REG_IPC_FIFO_RX;
+ if (msg == 0x87654321)
+ Wifi_Sync();
}
-
-
void initDebugger() {
-
// set up the wifi irq
irqSet(IRQ_WIFI, Wifi_Interrupt); // set up wifi interrupt
irqEnable(IRQ_WIFI);
- //get them talking together
+ // get them talking together
// sync with arm9 and init wifi
u32 fifo_temp;
while (1) { // wait for magic number
- while (REG_IPC_FIFO_CR&IPC_FIFO_RECV_EMPTY) swiWaitForVBlank();
- fifo_temp=REG_IPC_FIFO_RX;
- if (fifo_temp==0x12345678) break;
+ while (REG_IPC_FIFO_CR & IPC_FIFO_RECV_EMPTY)
+ swiWaitForVBlank();
+
+ fifo_temp = REG_IPC_FIFO_RX;
+
+ if (fifo_temp == 0x12345678)
+ break;
}
- while (REG_IPC_FIFO_CR&IPC_FIFO_RECV_EMPTY) swiWaitForVBlank();
- fifo_temp=REG_IPC_FIFO_RX; // give next value to wifi_init
+ while (REG_IPC_FIFO_CR & IPC_FIFO_RECV_EMPTY)
+ swiWaitForVBlank();
+
+ fifo_temp = REG_IPC_FIFO_RX; // give next value to wifi_init
Wifi_Init(fifo_temp);
irqSet(IRQ_FIFO_NOT_EMPTY,arm7_fifo); // set up fifo irq
@@ -561,7 +533,6 @@ void initDebugger() {
Wifi_SetSyncHandler(arm7_synctoarm9); // allow wifi lib to notify arm9
// arm7 wifi init complete
-
}
#endif
@@ -571,82 +542,75 @@ void reboot() {
}
#endif
-
int main(int argc, char ** argv) {
-
-
#ifdef USE_DEBUGGER
- REG_IPC_FIFO_CR = IPC_FIFO_ENABLE | IPC_FIFO_SEND_CLEAR;
+ REG_IPC_FIFO_CR = IPC_FIFO_ENABLE | IPC_FIFO_SEND_CLEAR;
#endif
- // Reset the clock if needed
- rtcReset();
-
- //enable sound
-// powerOn(POWER_SOUND);
- SOUND_CR = SOUND_ENABLE | SOUND_VOL(0x7F);
- IPC->soundData = 0;
- IPC->reset = false;
-
-
- //fifoInit();
+ // Reset the clock if needed
+ rtcReset();
- for (int r = 0; r < 8; r++) {
- IPC->adpcm.arm7Buffer[r] = (u8 *) malloc(512);
- }
+ // enable sound
+ // powerOn(POWER_SOUND);
+ SOUND_CR = SOUND_ENABLE | SOUND_VOL(0x7F);
+ IPC->soundData = 0;
+ IPC->reset = false;
- for (int r = 0; r < 4; r++) {
- soundFilled[r] = false;
- }
+ // fifoInit();
+ for (int r = 0; r < 8; r++) {
+ IPC->adpcm.arm7Buffer[r] = (u8 *)malloc(512);
+ }
- // Set up the interrupt handler
+ for (int r = 0; r < 4; r++) {
+ soundFilled[r] = false;
+ }
- irqInit();
+ // Set up the interrupt handler
- irqSet(IRQ_VBLANK, InterruptVBlank);
- irqEnable(IRQ_VBLANK);
+ irqInit();
- irqSet(IRQ_TIMER1, InterruptTimer1);
- irqEnable(IRQ_TIMER1);
+ irqSet(IRQ_VBLANK, InterruptVBlank);
+ irqEnable(IRQ_VBLANK);
- irqSet(IRQ_TIMER3, InterruptTimer3);
- irqEnable(IRQ_TIMER3);
+ irqSet(IRQ_TIMER1, InterruptTimer1);
+ irqEnable(IRQ_TIMER1);
-/* REG_IME = 0;
- IRQ_HANDLER = &InterruptHandler;
- REG_IE = IRQ_VBLANK | IRQ_TIMER1 | IRQ_TIMER3;
- REG_IF = ~0;
- DISP_SR = DISP_VBLANK_IRQ;
- REG_IME = 1;
- */
+ irqSet(IRQ_TIMER3, InterruptTimer3);
+ irqEnable(IRQ_TIMER3);
+ /*
+ REG_IME = 0;
+ IRQ_HANDLER = &InterruptHandler;
+ REG_IE = IRQ_VBLANK | IRQ_TIMER1 | IRQ_TIMER3;
+ REG_IF = ~0;
+ DISP_SR = DISP_VBLANK_IRQ;
+ REG_IME = 1;
+ */
#ifdef USE_DEBUGGER
- initDebugger();
+ initDebugger();
#endif
- // Keep the ARM7 out of main RAM
- while ((1)) {
- if (needSleep) {
- performSleep();
- needSleep = false;
- }
+ // Keep the ARM7 out of main RAM
+ while ((1)) {
+ if (needSleep) {
+ performSleep();
+ needSleep = false;
+ }
#ifdef USE_LIBCARTRESET
- if (passmeloopQuery()) {
- reboot();
- }
+ if (passmeloopQuery()) {
+ reboot();
+ }
#endif
- if (IPC->reset) {
- powerOff();
+ if (IPC->reset) {
+ powerOff();
+ }
+
+ swiWaitForVBlank();
}
- swiWaitForVBlank();
- }
- return 0;
+ return 0;
}
-
-
-//////////////////////////////////////////////////////////////////////
diff --git a/backends/platform/ds/arm9/source/cdaudio.cpp b/backends/platform/ds/arm9/source/cdaudio.cpp
index c963f4d8bd..3952eeb6ab 100644
--- a/backends/platform/ds/arm9/source/cdaudio.cpp
+++ b/backends/platform/ds/arm9/source/cdaudio.cpp
@@ -23,10 +23,10 @@
// Disable symbol overrides for FILE as that is used in FLAC headers
#define FORBIDDEN_SYMBOL_EXCEPTION_FILE
+#include "dsmain.h"
#include "cdaudio.h"
#include "backends/fs/ds/ds-fs.h"
#include "common/config-manager.h"
-#include "dsmain.h"
#include "NDS/scummvm_ipc.h"
#define WAV_FORMAT_IMA_ADPCM 0x14
diff --git a/backends/platform/ds/arm9/source/dsmain.cpp b/backends/platform/ds/arm9/source/dsmain.cpp
index b7c9c108a6..041892aed6 100644
--- a/backends/platform/ds/arm9/source/dsmain.cpp
+++ b/backends/platform/ds/arm9/source/dsmain.cpp
@@ -68,8 +68,9 @@
// - Try discworld?
-#define FORBIDDEN_SYMBOL_ALLOW_ALL
-
+// Allow use of stuff in <nds.h>
+#define FORBIDDEN_SYMBOL_EXCEPTION_printf
+#define FORBIDDEN_SYMBOL_EXCEPTION_unistd_h
#include <nds.h>
@@ -439,12 +440,12 @@ void playSound(const void *data, u32 length, bool loop, bool adpcm, int rate) {
soundControl.count = 0;
}
- soundControl.data[soundControl.count].data = data;
- soundControl.data[soundControl.count].len = length | (loop? 0x80000000: 0x00000000);
- soundControl.data[soundControl.count].rate = rate; // 367 samples per frame
- soundControl.data[soundControl.count].pan = 64;
- soundControl.data[soundControl.count].vol = 127;
- soundControl.data[soundControl.count].format = adpcm? 2: 0;
+ soundControl.data[soundControl.count].data = data;
+ soundControl.data[soundControl.count].len = length | (loop ? 0x80000000 : 0x00000000);
+ soundControl.data[soundControl.count].rate = rate; // 367 samples per frame
+ soundControl.data[soundControl.count].pan = 64;
+ soundControl.data[soundControl.count].vol = 127;
+ soundControl.data[soundControl.count].format = adpcm ? 2 : 0;
soundControl.count++;
@@ -573,7 +574,7 @@ void initGame() {
s_currentGame = &gameList[0]; // Default game
for (int r = 0; r < NUM_SUPPORTED_GAMES; r++) {
- if (!stricmp(gameName, gameList[r].gameId)) {
+ if (!scumm_stricmp(gameName, gameList[r].gameId)) {
s_currentGame = &gameList[r];
// consolePrintf("Game list num: %d\n", r);
}
@@ -640,7 +641,7 @@ void displayMode8Bit() {
displayModeIs8Bit = true;
if (isCpuScalerEnabled()) {
- videoSetMode(MODE_5_2D | (consoleEnable? DISPLAY_BG0_ACTIVE: 0) | DISPLAY_BG3_ACTIVE | DISPLAY_SPR_ACTIVE | DISPLAY_SPR_1D | DISPLAY_SPR_1D_BMP);
+ videoSetMode(MODE_5_2D | (consoleEnable ? DISPLAY_BG0_ACTIVE : 0) | DISPLAY_BG3_ACTIVE | DISPLAY_SPR_ACTIVE | DISPLAY_SPR_1D | DISPLAY_SPR_1D_BMP);
videoSetModeSub(MODE_3_2D /*| DISPLAY_BG0_ACTIVE*/ | DISPLAY_BG3_ACTIVE | DISPLAY_SPR_ACTIVE | DISPLAY_SPR_1D | DISPLAY_SPR_1D_BMP); //sub bg 0 will be used to print text
vramSetBankA(VRAM_A_MAIN_BG_0x06000000);
@@ -659,7 +660,7 @@ void displayMode8Bit() {
BG3_YDY = (int) ((200.0f / 192.0f) * 256);
} else {
- videoSetMode(MODE_5_2D | (consoleEnable? DISPLAY_BG0_ACTIVE: 0) | DISPLAY_BG3_ACTIVE | DISPLAY_SPR_ACTIVE | DISPLAY_SPR_1D | DISPLAY_SPR_1D_BMP);
+ videoSetMode(MODE_5_2D | (consoleEnable ? DISPLAY_BG0_ACTIVE : 0) | DISPLAY_BG3_ACTIVE | DISPLAY_SPR_ACTIVE | DISPLAY_SPR_1D | DISPLAY_SPR_1D_BMP);
videoSetModeSub(MODE_3_2D /*| DISPLAY_BG0_ACTIVE*/ | DISPLAY_BG3_ACTIVE | DISPLAY_SPR_ACTIVE | DISPLAY_SPR_1D | DISPLAY_SPR_1D_BMP); //sub bg 0 will be used to print text
vramSetBankA(VRAM_A_MAIN_BG_0x06000000);
@@ -690,7 +691,7 @@ void displayMode8Bit() {
consoleInit(NULL, 0, BgType_Text4bpp, BgSize_T_256x256, 2, 0, true, true);
// Set this again because consoleinit resets it
- videoSetMode(MODE_5_2D | (consoleEnable? DISPLAY_BG0_ACTIVE: 0) | DISPLAY_BG3_ACTIVE | DISPLAY_SPR_ACTIVE | DISPLAY_SPR_1D | DISPLAY_SPR_1D_BMP);
+ videoSetMode(MODE_5_2D | (consoleEnable ? DISPLAY_BG0_ACTIVE : 0) | DISPLAY_BG3_ACTIVE | DISPLAY_SPR_ACTIVE | DISPLAY_SPR_1D | DISPLAY_SPR_1D_BMP);
// Move the cursor to the bottom of the screen using ANSI escape code
consolePrintf("\033[23;0f");
@@ -970,7 +971,7 @@ void displayMode16BitFlipBuffer() {
u16 *back = get16BitBackBuffer();
// highBuffer = !highBuffer;
-// BG3_CR = BG_BMP16_512x256 | BG_BMP_RAM(highBuffer? 1: 0);
+// BG3_CR = BG_BMP16_512x256 | BG_BMP_RAM(highBuffer ? 1 : 0);
if (isCpuScalerEnabled()) {
Rescale_320x256x1555_To_256x256x1555(BG_GFX, back, 512, 512);
@@ -1805,13 +1806,13 @@ void triggerIcon(int imageNum) {
void setIcon(int num, int x, int y, int imageNum, int flags, bool enable) {
- sprites[num].attribute[0] = ATTR0_BMP | (enable? (y & 0xFF): 192) | (!enable? ATTR0_DISABLED: 0);
+ sprites[num].attribute[0] = ATTR0_BMP | (enable ? (y & 0xFF) : 192) | (!enable ? ATTR0_DISABLED : 0);
sprites[num].attribute[1] = ATTR1_SIZE_32 | (x & 0x1FF) | flags;
sprites[num].attribute[2] = ATTR2_ALPHA(1)| (imageNum * 16);
}
void setIconMain(int num, int x, int y, int imageNum, int flags, bool enable) {
- spritesMain[num].attribute[0] = ATTR0_BMP | (y & 0xFF) | (!enable? ATTR0_DISABLED: 0);
+ spritesMain[num].attribute[0] = ATTR0_BMP | (y & 0xFF) | (!enable ? ATTR0_DISABLED : 0);
spritesMain[num].attribute[1] = ATTR1_SIZE_32 | (x & 0x1FF) | flags;
spritesMain[num].attribute[2] = ATTR2_ALPHA(1)| (imageNum * 16);
}
@@ -1841,7 +1842,7 @@ void updateStatus() {
}
if (indyFightState) {
- setIcon(1, (190 - 32), 150, 3, (indyFightRight? 0: ATTR1_FLIP_X), true);
+ setIcon(1, (190 - 32), 150, 3, (indyFightRight ? 0 : ATTR1_FLIP_X), true);
// consolePrintf("%d\n", indyFightRight);
} else {
// setIcon(1, 0, 0, 0, 0, false);
@@ -2164,19 +2165,11 @@ void VBlankHandler(void) {
}
- subScTargetX = xCenter - ((subScreenWidth >> 1) << 8);
+ subScTargetX = xCenter - ((subScreenWidth >> 1) << 8);
subScTargetY = yCenter - ((subScreenHeight >> 1) << 8);
-
-
-
- if (subScTargetX < 0) subScTargetX = 0;
- if (subScTargetX > (gameWidth - subScreenWidth) << 8) subScTargetX = (gameWidth - subScreenWidth) << 8;
-
- if (subScTargetY < 0) subScTargetY = 0;
- if (subScTargetY > (gameHeight - subScreenHeight) << 8) subScTargetY = (gameHeight - subScreenHeight) << 8;
-
-
+ subScTargetX = CLIP(subScTargetX, 0, (gameWidth - subScreenWidth) << 8);
+ subScTargetY = CLIP(subScTargetY, 0, (gameHeight - subScreenHeight) << 8);
subScX += (subScTargetX - subScX) >> 2;
subScY += (subScTargetY - subScY) >> 2;
@@ -2499,7 +2492,7 @@ void penUpdate() {
// if (getKeysHeld() & KEY_L) consolePrintf("%d, %d penX=%d, penY=%d tz=%d\n", IPC->touchXpx, IPC->touchYpx, penX, penY, IPC->touchZ1);
- bool penDownThisFrame = (IPC->touchZ1 > 0) && (IPC->touchXpx > 0) && (IPC->touchYpx > 0);
+ bool penDownThisFrame = (!(IPC->buttons & 0x40)) && (IPC->touchXpx > 0) && (IPC->touchYpx > 0);
static bool moved = false;
if (( (tapScreenClicks) || getKeyboardEnable() ) && (getIsDisplayMode8Bit())) {
@@ -2626,7 +2619,7 @@ void penUpdate() {
penDownSaved = true;
}
- if ((IPC->touchZ1 > 0) && (IPC->touchXpx > 0) && (IPC->touchYpx > 0)) {
+ if ((!(IPC->buttons & 0x40)) && (IPC->touchXpx > 0) && (IPC->touchYpx > 0)) {
penX = IPC->touchXpx + touchXOffset;
penY = IPC->touchYpx + touchYOffset;
moved = true;
@@ -2648,7 +2641,7 @@ void penUpdate() {
- if ((IPC->touchZ1 > 0) || ((penDownFrames == 2)) ) {
+ if ((!(IPC->buttons & 0x40)) || ((penDownFrames == 2)) ) {
penDownLastFrame = true;
penDownFrames++;
} else {
diff --git a/backends/platform/ds/arm9/source/dsmain.h b/backends/platform/ds/arm9/source/dsmain.h
index fec97d878e..7345fc2ceb 100644
--- a/backends/platform/ds/arm9/source/dsmain.h
+++ b/backends/platform/ds/arm9/source/dsmain.h
@@ -23,6 +23,8 @@
#ifndef _DSMAIN_H
#define _DSMAIN_H
+#define FORBIDDEN_SYMBOL_ALLOW_ALL
+
#include <nds.h>
#include "osystem_ds.h"
diff --git a/backends/platform/ds/arm9/source/dsoptions.cpp b/backends/platform/ds/arm9/source/dsoptions.cpp
index 733592e958..562038166b 100644
--- a/backends/platform/ds/arm9/source/dsoptions.cpp
+++ b/backends/platform/ds/arm9/source/dsoptions.cpp
@@ -20,8 +20,8 @@
*
*/
-#include "dsoptions.h"
#include "dsmain.h"
+#include "dsoptions.h"
#include "gui/dialog.h"
#include "gui/gui-manager.h"
#include "gui/widgets/list.h"
diff --git a/backends/platform/ds/arm9/source/fat/disc_io.c b/backends/platform/ds/arm9/source/fat/disc_io.c
index 5896cbb750..74fc8fb09b 100644
--- a/backends/platform/ds/arm9/source/fat/disc_io.c
+++ b/backends/platform/ds/arm9/source/fat/disc_io.c
@@ -367,7 +367,7 @@ bool disc_setDsSlotInterface (void)
active_interface = DLDI_GetInterface();
- if (stricmp((char *)(&_dldi_driver_name), "Default (No interface)")) {
+ if (strcasecmp((char *)(&_dldi_driver_name), "Default (No interface)")) {
char name[48];
memcpy(name, &_dldi_driver_name, 48);
name[47] = '\0';
diff --git a/backends/platform/ds/arm9/source/osystem_ds.cpp b/backends/platform/ds/arm9/source/osystem_ds.cpp
index 861ee2e0c5..c35433d3fc 100644
--- a/backends/platform/ds/arm9/source/osystem_ds.cpp
+++ b/backends/platform/ds/arm9/source/osystem_ds.cpp
@@ -23,6 +23,9 @@
// Allow use of stuff in <time.h>
#define FORBIDDEN_SYMBOL_EXCEPTION_time_h
+// Allow use of stuff in <nds.h>
+#define FORBIDDEN_SYMBOL_EXCEPTION_printf
+#define FORBIDDEN_SYMBOL_EXCEPTION_unistd_h
#include "common/scummsys.h"
#include "common/system.h"
diff --git a/backends/platform/ds/arm9/source/osystem_ds.h b/backends/platform/ds/arm9/source/osystem_ds.h
index f883bd14d1..c8698ca418 100644
--- a/backends/platform/ds/arm9/source/osystem_ds.h
+++ b/backends/platform/ds/arm9/source/osystem_ds.h
@@ -24,6 +24,10 @@
#ifndef _OSYSTEM_DS_H_
#define _OSYSTEM_DS_H_
+// Allow use of stuff in <nds.h>
+#define FORBIDDEN_SYMBOL_EXCEPTION_printf
+#define FORBIDDEN_SYMBOL_EXCEPTION_unistd_h
+
#include "backends/base-backend.h"
#include "common/events.h"
#include "nds.h"
diff --git a/backends/platform/ds/arm9/source/wordcompletion.cpp b/backends/platform/ds/arm9/source/wordcompletion.cpp
index 36fa31247c..2257c49005 100644
--- a/backends/platform/ds/arm9/source/wordcompletion.cpp
+++ b/backends/platform/ds/arm9/source/wordcompletion.cpp
@@ -20,8 +20,8 @@
*
*/
-#include "wordcompletion.h"
#include "osystem_ds.h"
+#include "wordcompletion.h"
#include "engines/agi/agi.h" // Caution for #define for NUM_CHANNELS, causes problems in mixer_intern.h
#ifdef ENABLE_AGI
diff --git a/backends/platform/ds/arm9/source/zipreader.cpp b/backends/platform/ds/arm9/source/zipreader.cpp
index 0de2b0c981..2ad0a39ed2 100644
--- a/backends/platform/ds/arm9/source/zipreader.cpp
+++ b/backends/platform/ds/arm9/source/zipreader.cpp
@@ -23,6 +23,7 @@
#define FORBIDDEN_SYMBOL_ALLOW_ALL
#include "common/scummsys.h"
+#include "common/str.h"
#include "zipreader.h"
ZipFile::ZipFile() {
@@ -193,7 +194,7 @@ bool ZipFile::findFile(const char *search) {
}
- if (!stricmp(name, searchName)) {
+ if (!scumm_stricmp(name, searchName)) {
// consolePrintf("'%s'=='%s'\n", name, searchName);
return true; // Got it!
} else {
diff --git a/backends/platform/ds/ds.mk b/backends/platform/ds/ds.mk
index 78216cb9a2..18feea00c2 100644
--- a/backends/platform/ds/ds.mk
+++ b/backends/platform/ds/ds.mk
@@ -75,7 +75,7 @@ endif
# Compiler options for files which should be optimised for speed
-OPT_SPEED := -O3 -mno-thumb
+OPT_SPEED := -O3 -marm
# Compiler options for files which should be optimised for space
OPT_SIZE := -Os -mthumb
@@ -134,7 +134,8 @@ engines/teenagent/actor.o: CXXFLAGS:=$(CXXFLAGS) $(OPT_SPEED)
#
#############################################################################
-all: scummvm.nds scummvm.ds.gba
+# FIXME: Newer versions of devkitARM don't include dsbuild, which is needed to create scummvm.ds.gba
+all: scummvm.nds # scummvm.ds.gba
clean: dsclean
@@ -145,11 +146,8 @@ dsclean:
# TODO: Add a 'dsdist' target ?
-%.bin: %.elf
- $(OBJCOPY) -S -O binary $< $@
-
-%.nds: %.bin $(ndsdir)/arm7/arm7.bin
- ndstool -c $@ -9 $< -7 $(ndsdir)/arm7/arm7.bin -b $(srcdir)/$(ndsdir)/$(LOGO) "$(@F);ScummVM $(VERSION);DS Port"
+%.nds: %.elf $(ndsdir)/arm7/arm7.elf
+ ndstool -c $@ -9 $< -7 $(ndsdir)/arm7/arm7.elf -b $(srcdir)/$(ndsdir)/$(LOGO) "$(@F);ScummVM $(VERSION);DS Port"
%.ds.gba: %.nds
dsbuild $< -o $@ -l $(srcdir)/$(ndsdir)/arm9/ndsloader.bin
@@ -170,10 +168,7 @@ dsclean:
# HACK/FIXME: C compiler, for cartreset.c -- we should switch this to use CXX
# as soon as possible.
-CC := $(DEVKITPRO)/devkitARM/bin/arm-eabi-gcc
-
-# HACK/TODO: Pointer to objcopy. This should really be set by configure
-OBJCOPY := $(DEVKITPRO)/devkitARM/bin/arm-eabi-objcopy
+CC := $(DEVKITPRO)/devkitARM/bin/arm-none-eabi-gcc
#
# Set various flags
@@ -194,7 +189,7 @@ ARM7_CFLAGS := -g -Wall -O2\
ARM7_CXXFLAGS := $(ARM7_CFLAGS) -fno-exceptions -fno-rtti
-ARM7_LDFLAGS := -g $(ARM7_ARCH) -mno-fpu
+ARM7_LDFLAGS := -g $(ARM7_ARCH) -mfloat-abi=soft
# HACK/FIXME: Define a custom build rule for cartreset.c.
# We do this because it is a .c file, not a .cpp file and so is outside our
@@ -218,10 +213,6 @@ $(ndsdir)/arm7/arm7.elf: \
$(ndsdir)/arm7/source/main.o
$(CXX) $(ARM7_LDFLAGS) -specs=ds_arm7.specs $+ -L$(DEVKITPRO)/libnds/lib -lnds7 -o $@
-# Rule for creating ARM7 .bin files from .elf files
-$(ndsdir)/arm7/arm7.bin: $(ndsdir)/arm7/arm7.elf
- $(OBJCOPY) -O binary $< $@
-
diff --git a/backends/platform/ios7/README.md b/backends/platform/ios7/README.md
index f7d828ee94..48a3d3e830 100644
--- a/backends/platform/ios7/README.md
+++ b/backends/platform/ios7/README.md
@@ -6,132 +6,7 @@ I tried to use all the latest iOS features to replace the old code. For instance
## Compilation ##
-First, clone the repository:
-```
-$ git clone https://github.com/scummvm/scummvm.git
-```
-
-### Compilation from Xcode ###
-
-This is the recommended way to compile ScummVM, and the only one which makes it possible to run ScummVM on a non-jailbroken device!
-
-The next step is to compile the **create_project** tool. Open the Xcode project you'll found in the **devtools/create\_project/xcode/** directory. Once compiled, copy the binary somewhere in your *PATH*, and create a **build** directory somewhere on your harddisk. It is recommended to create this directory next to the cloned repository (they share the same parent).
-
-Execute the following commands in a terminal:
-```
-$ cd path_to_the_build_directory
-$ create_project path_to_scummvm_repository --xcode --enable-fluidsynth --disable-jpeg --disable-bink --disable-16bit --disable-mt32emu --disable-nasm --disable-opengl --disable-theora --disable-taskbar
-```
-
-This will create an Xcode project for ScummVM, for both the OS X, and the iOS target.
-
-Now, download the external libraries from http://bsr43.free.fr/scummvm/ScummVM-iOS-libraries.zip. Unzip the archive in your **build** directory. Please make sure that the **lib**, and **include** directories are at the root of the **build** directory, not in a subdirectory.
-
-Now, your **build** directory should contain:
-* a generated **engines** directory,
-* a generated **scummvm.xcodeproj** project,
-* an **include** directory,
-* a **lib** directory.
-
-You are ready to compile ScummVM: open the **scummvm.xcodeproj** project, and build it.
-
-### Compilation from command line ###
-
-For jailbroken devices, it is also possible to compile the project from command line. You'll need a working toolchain, and some tools, like **ldid**, to fake the code signature.
-
-Here is a script to download, and compile all the required tools. This script has been wrote for Debian 8.2, and should be run as root.
-
-```
-#!/bin/bash
-
-if [ $UID -ne 0 ]; then
- echo "This script should be run by the root user"
- exit 1
-fi
-
-# Install the Clang compiler
-apt-get install -y clang-3.4 libclang-3.4-dev llvm-3.4 libtool bison flex automake subversion git pkg-config wget libssl-dev uuid-dev libxml2-dev || exit 1
-
-# Add LLVM to the linker library path
-echo /usr/lib/llvm-3.4/lib > /etc/ld.so.conf.d/libllvm-3.4.conf
-ldconfig
-
-# Add symlinks for the LLVM headers
-ln -s /usr/lib/llvm-3.4/bin/llvm-config /usr/bin/llvm-config || exit 1
-ln -s /usr/include/llvm-3.4/llvm /usr/include/llvm || exit 1
-ln -s /usr/include/llvm-c-3.4/llvm-c /usr/include/llvm-c || exit 1
-ln -s /usr/bin/clang-3.4 /usr/bin/clang || exit 1
-ln -s /usr/bin/clang++-3.4 /usr/bin/clang++ || exit 1
-
-# Build the linker
-svn checkout http://ios-toolchain-based-on-clang-for-linux.googlecode.com/svn/trunk/cctools-porting || exit 1
-cd cctools-porting
-sed -i'' 's/proz -k=20 --no-curses/wget/g' cctools-ld64.sh
-./cctools-ld64.sh || exit 1
-
-cd cctools-855-ld64-236.3
-./autogen.sh || exit 1
-./configure --prefix=/usr/local --target=arm-apple-darwin11 || exit 1
-make || exit 1
-make install || exit 1
-cd ../..
-
-# Install ios-tools
-wget https://ios-toolchain-based-on-clang-for-linux.googlecode.com/files/iphonesdk-utils-2.0.tar.gz || exit 1
-tar xzf iphonesdk-utils-2.0.tar.gz
-cd iphonesdk-utils-2.0
-patch -p0 <<_EOF
-*** genLocalization2/getLocalizedStringFromFile.cpp 2015-04-02 04:45:39.309837816 +0530
---- genLocalization2/getLocalizedStringFromFile.cpp 2015-04-02 04:45:11.525700021 +0530
-***************
-*** 113,115 ****
- clang::HeaderSearch headerSearch(headerSearchOptions,
-- fileManager,
- *pDiagnosticsEngine,
---- 113,115 ----
- clang::HeaderSearch headerSearch(headerSearchOptions,
-+ sourceManager,
- *pDiagnosticsEngine,
-***************
-*** 129,134 ****
- false);
-- clang::HeaderSearch headerSearch(fileManager,
- *pDiagnosticsEngine,
- languageOptions,
-- pTargetInfo);
- ApplyHeaderSearchOptions(headerSearch, headerSearchOptions, languageOptions, pTargetInfo->getTriple());
---- 129,134 ----
- false);
-+ clang::HeaderSearch headerSearch(fileManager);/*,
- *pDiagnosticsEngine,
- languageOptions,
-+ pTargetInfo);*/
- ApplyHeaderSearchOptions(headerSearch, headerSearchOptions, languageOptio
-_EOF
-
-./autogen.sh || exit 1
-CC=clang CXX=clang++ ./configure --prefix=/usr/local || exit 1
-make || exit 1
-make install || exit 1
-
-# Install the iOS SDK 8.1
-mkdir -p /usr/share/ios-sdk
-cd /usr/share/ios-sdk
-wget http://iphone.howett.net/sdks/dl/iPhoneOS8.1.sdk.tbz2 || exit 1
-tar xjf iPhoneOS8.1.sdk.tbz2
-rm iPhoneOS8.1.sdk.tbz2
-```
-
-Now, in order to compile ScummVM, execute the following commands:
-```
-$ export SDKROOT=/usr/share/ios-sdk/iPhoneOS8.1.sdk
-$ export CC=ios-clang
-$ export CXX=ios-clang++
-$ ./configure --host=ios7 --disable-mt32emu --enable-release
-$ make ios7bundle
-```
-
-At the end of the compilation, you'll find a **ScummVM.app** application: copy it over SSH, and reboot your device.
+See http://wiki.scummvm.org/index.php/Compiling_ScummVM/iPhone
## Usage ##
diff --git a/backends/platform/ios7/ios7_osys_main.h b/backends/platform/ios7/ios7_osys_main.h
index e0ac599b1d..9b9d2bdee0 100644
--- a/backends/platform/ios7/ios7_osys_main.h
+++ b/backends/platform/ios7/ios7_osys_main.h
@@ -123,7 +123,7 @@ public:
static OSystem_iOS7 *sharedInstance();
virtual void initBackend();
-
+
virtual void engineInit();
virtual void engineDone();
diff --git a/backends/platform/n64/osys_n64_base.cpp b/backends/platform/n64/osys_n64_base.cpp
index 1282b16d47..2bde28dd62 100644
--- a/backends/platform/n64/osys_n64_base.cpp
+++ b/backends/platform/n64/osys_n64_base.cpp
@@ -227,7 +227,7 @@ int OSystem_N64::getDefaultGraphicsMode() const {
bool OSystem_N64::setGraphicsMode(const char *mode) {
int i = 0;
while (s_supportedGraphicsModes[i].name) {
- if (!strcmpi(s_supportedGraphicsModes[i].name, mode)) {
+ if (!scumm_stricmp(s_supportedGraphicsModes[i].name, mode)) {
_graphicMode = s_supportedGraphicsModes[i].id;
switchGraphicModeId(_graphicMode);
diff --git a/backends/platform/n64/portdefs.h b/backends/platform/n64/portdefs.h
index 63ec989a8d..364520803b 100644
--- a/backends/platform/n64/portdefs.h
+++ b/backends/platform/n64/portdefs.h
@@ -36,17 +36,4 @@
#undef assert
#define assert(x) ((x) ? 0 : (print_error("ASSERT TRIGGERED:\n\n("#x")\n%s\nline: %d", __FILE__, __LINE__)))
-// Typedef basic data types in a way that is compatible with the N64 SDK.
-typedef unsigned char byte;
-typedef unsigned char uint8;
-typedef signed char int8;
-typedef unsigned short int uint16;
-typedef signed short int int16;
-typedef unsigned int uint32;
-typedef signed int int32;
-
-// Define SCUMMVM_DONT_DEFINE_TYPES to prevent scummsys.h from trying to
-// re-define those data types.
-#define SCUMMVM_DONT_DEFINE_TYPES
-
-#endif
+#endif // __N64_PORTDEFS__
diff --git a/backends/platform/psp/display_manager.cpp b/backends/platform/psp/display_manager.cpp
index 33bf190d70..54ad0d3223 100644
--- a/backends/platform/psp/display_manager.cpp
+++ b/backends/platform/psp/display_manager.cpp
@@ -332,7 +332,7 @@ bool DisplayManager::setGraphicsMode(const char *name) {
int i = 0;
while (_supportedModes[i].name) {
- if (!strcmpi(_supportedModes[i].name, name)) {
+ if (!scumm_stricmp(_supportedModes[i].name, name)) {
setGraphicsMode(_supportedModes[i].id);
return true;
}
diff --git a/backends/platform/psp/input.cpp b/backends/platform/psp/input.cpp
index 7a2047f28e..8e5f170a7d 100644
--- a/backends/platform/psp/input.cpp
+++ b/backends/platform/psp/input.cpp
@@ -336,7 +336,7 @@ bool Nub::getEvent(Common::Event &event, PspEvent &pspEvent, SceCtrlData &pad) {
// keep track of remainder for true sub-pixel cursor position
_hiresX %= 1024;
_hiresY %= 1024;
-
+
int32 oldX = _cursor->getX();
int32 oldY = _cursor->getY();
diff --git a/backends/platform/sdl/macosx/macosx.cpp b/backends/platform/sdl/macosx/macosx.cpp
index 8ecbe7306c..62037200ea 100644
--- a/backends/platform/sdl/macosx/macosx.cpp
+++ b/backends/platform/sdl/macosx/macosx.cpp
@@ -124,6 +124,10 @@ Common::String OSystem_MacOSX::getTextFromClipboard() {
return getTextFromClipboardMacOSX();
}
+bool OSystem_MacOSX::setTextInClipboard(const Common::String &text) {
+ return setTextInClipboardMacOSX(text);
+}
+
bool OSystem_MacOSX::openUrl(const Common::String &url) {
CFURLRef urlRef = CFURLCreateWithBytes (NULL, (UInt8*)url.c_str(), url.size(), kCFStringEncodingASCII, NULL);
OSStatus err = LSOpenCFURLRef(urlRef, NULL);
diff --git a/backends/platform/sdl/macosx/macosx.h b/backends/platform/sdl/macosx/macosx.h
index ba07364681..5ef30baa64 100644
--- a/backends/platform/sdl/macosx/macosx.h
+++ b/backends/platform/sdl/macosx/macosx.h
@@ -35,6 +35,7 @@ public:
virtual bool hasTextInClipboard();
virtual Common::String getTextFromClipboard();
+ virtual bool setTextInClipboard(const Common::String &text);
virtual bool openUrl(const Common::String &url);
diff --git a/backends/platform/sdl/macosx/macosx_wrapper.h b/backends/platform/sdl/macosx/macosx_wrapper.h
index 84f0c1b2ba..ca4e433890 100644
--- a/backends/platform/sdl/macosx/macosx_wrapper.h
+++ b/backends/platform/sdl/macosx/macosx_wrapper.h
@@ -27,6 +27,7 @@
bool hasTextInClipboardMacOSX();
Common::String getTextFromClipboardMacOSX();
+bool setTextInClipboardMacOSX(const Common::String &text);
Common::String getDesktopPathMacOSX();
#endif
diff --git a/backends/platform/sdl/macosx/macosx_wrapper.mm b/backends/platform/sdl/macosx/macosx_wrapper.mm
index 02516e5ffe..32dfa040cc 100644
--- a/backends/platform/sdl/macosx/macosx_wrapper.mm
+++ b/backends/platform/sdl/macosx/macosx_wrapper.mm
@@ -24,11 +24,13 @@
#define FORBIDDEN_SYMBOL_ALLOW_ALL
#include "backends/platform/sdl/macosx/macosx_wrapper.h"
+#include "common/translation.h"
#include <AppKit/NSPasteboard.h>
#include <Foundation/NSArray.h>
#include <Foundation/NSPathUtilities.h>
#include <AvailabilityMacros.h>
+#include <CoreFoundation/CFString.h>
bool hasTextInClipboardMacOSX() {
return [[NSPasteboard generalPasteboard] availableTypeFromArray:[NSArray arrayWithObject:NSStringPboardType]] != nil;
@@ -40,13 +42,33 @@ Common::String getTextFromClipboardMacOSX() {
// Note: on OS X 10.6 and above it is recommanded to use NSPasteboardTypeString rather than NSStringPboardType.
// But since we still target older version use NSStringPboardType.
NSPasteboard *pb = [NSPasteboard generalPasteboard];
- NSString* str = [pb stringForType:NSStringPboardType];
+ NSString *str = [pb stringForType:NSStringPboardType];
if (str == nil)
return Common::String();
- // If the string cannot be represented using the requested encoding we get a null pointer below.
- // This is fine as ScummVM would not know what to do with non-ASCII characters (although maybe
- // we should use NSISOLatin1StringEncoding?).
- return Common::String([str cStringUsingEncoding:NSASCIIStringEncoding]);
+
+ // If translations are supported, use the current TranslationManager charset and otherwise
+ // use ASCII. If the string cannot be represented using the requested encoding we get a null
+ // pointer below, which is fine as ScummVM would not know what to do with the string anyway.
+#ifdef USE_TRANSLATION
+ NSString* encStr = [NSString stringWithCString:TransMan.getCurrentCharset().c_str() encoding:NSASCIIStringEncoding];
+ NSStringEncoding encoding = CFStringConvertEncodingToNSStringEncoding(CFStringConvertIANACharSetNameToEncoding((CFStringRef)encStr));
+#else
+ NSStringEncoding encoding = NSISOLatin1StringEncoding;
+#endif
+ return Common::String([str cStringUsingEncoding:encoding]);
+}
+
+bool setTextInClipboardMacOSX(const Common::String &text) {
+ NSPasteboard *pb = [NSPasteboard generalPasteboard];
+ [pb declareTypes:[NSArray arrayWithObject:NSStringPboardType] owner:nil];
+
+#ifdef USE_TRANSLATION
+ NSString* encStr = [NSString stringWithCString:TransMan.getCurrentCharset().c_str() encoding:NSASCIIStringEncoding];
+ NSStringEncoding encoding = CFStringConvertEncodingToNSStringEncoding(CFStringConvertIANACharSetNameToEncoding((CFStringRef)encStr));
+#else
+ NSStringEncoding encoding = NSISOLatin1StringEncoding;
+#endif
+ return [pb setString:[NSString stringWithCString:text.c_str() encoding:encoding] forType:NSStringPboardType];
}
Common::String getDesktopPathMacOSX() {
diff --git a/backends/platform/sdl/psp2/psp2-main.cpp b/backends/platform/sdl/psp2/psp2-main.cpp
index 0bdf0b34bc..70cc52388e 100644
--- a/backends/platform/sdl/psp2/psp2-main.cpp
+++ b/backends/platform/sdl/psp2/psp2-main.cpp
@@ -40,7 +40,7 @@ int main(int argc, char *argv[]) {
scePowerSetBusClockFrequency(222);
scePowerSetGpuClockFrequency(222);
scePowerSetGpuXbarClockFrequency(166);
-
+
// Create our OSystem instance
g_system = new OSystem_PSP2();
assert(g_system);
@@ -57,7 +57,7 @@ int main(int argc, char *argv[]) {
// Free OSystem
delete (OSystem_PSP2 *)g_system;
-
+
#ifdef __PSP2_DEBUG__
psp2shell_exit();
#endif
diff --git a/backends/platform/sdl/psp2/psp2.cpp b/backends/platform/sdl/psp2/psp2.cpp
index 3034b6d886..80604a69d5 100644
--- a/backends/platform/sdl/psp2/psp2.cpp
+++ b/backends/platform/sdl/psp2/psp2.cpp
@@ -55,11 +55,11 @@ OSystem_PSP2::OSystem_PSP2(Common::String baseConfigName)
}
void OSystem_PSP2::init() {
-
+
#if __PSP2_DEBUG__
gDebugLevel = 3;
#endif
-
+
// Initialze File System Factory
sceIoMkdir("ux0:data", 0755);
sceIoMkdir("ux0:data/scummvm", 0755);
@@ -71,7 +71,7 @@ void OSystem_PSP2::init() {
}
void OSystem_PSP2::initBackend() {
-
+
ConfMan.set("joystick_num", 0);
ConfMan.registerDefault("fullscreen", true);
ConfMan.registerDefault("aspect_ratio", false);
@@ -105,7 +105,7 @@ void OSystem_PSP2::initBackend() {
ConfMan.setBool("frontpanel_touchpad_mode", false);
}
-
+
// Create the savefile manager
if (_savefileManager == 0)
_savefileManager = new DefaultSaveFileManager("ux0:data/scummvm/saves");
diff --git a/backends/platform/sdl/riscos/riscos-main.cpp b/backends/platform/sdl/riscos/riscos-main.cpp
index 2ff8294c1a..3f7058e3b8 100644
--- a/backends/platform/sdl/riscos/riscos-main.cpp
+++ b/backends/platform/sdl/riscos/riscos-main.cpp
@@ -29,7 +29,7 @@
#include "base/main.h"
int main(int argc, char *argv[]) {
-
+
// Create our OSystem instance
g_system = new OSystem_RISCOS();
assert(g_system);
diff --git a/backends/platform/sdl/riscos/riscos.cpp b/backends/platform/sdl/riscos/riscos.cpp
index 0cdbceb902..73c0fdae03 100644
--- a/backends/platform/sdl/riscos/riscos.cpp
+++ b/backends/platform/sdl/riscos/riscos.cpp
@@ -101,4 +101,4 @@ Common::WriteStream *OSystem_RISCOS::createLogFile() {
}
#endif
-
+
diff --git a/backends/platform/sdl/riscos/riscos.mk b/backends/platform/sdl/riscos/riscos.mk
index 534b7aeb52..0a3061fd3a 100644
--- a/backends/platform/sdl/riscos/riscos.mk
+++ b/backends/platform/sdl/riscos/riscos.mk
@@ -21,4 +21,5 @@ ifdef DYNAMIC_MODULES
endif
mkdir -p !ScummVM/docs
cp ${srcdir}/dists/riscos/!Help,feb !ScummVM/!Help,feb
- cp $(DIST_FILES_DOCS) !ScummVM/docs \ No newline at end of file
+ cp $(DIST_FILES_DOCS) !ScummVM/docs
+ cp -r ${srcdir}/doc/* !ScummVM/docs
diff --git a/backends/platform/sdl/sdl.cpp b/backends/platform/sdl/sdl.cpp
index 3082a69ebf..72af6d592a 100644
--- a/backends/platform/sdl/sdl.cpp
+++ b/backends/platform/sdl/sdl.cpp
@@ -33,6 +33,7 @@
#include "gui/EventRecorder.h"
#include "common/taskbar.h"
#include "common/textconsole.h"
+#include "common/translation.h"
#include "backends/saves/default/default-saves.h"
@@ -502,17 +503,46 @@ Common::String OSystem_SDL::getTextFromClipboard() {
#if SDL_VERSION_ATLEAST(2, 0, 0)
char *text = SDL_GetClipboardText();
+ // The string returned by SDL is in UTF-8. Convert to the
+ // current TranslationManager encoding or ISO-8859-1.
+#ifdef USE_TRANSLATION
+ char *conv_text = SDL_iconv_string(TransMan.getCurrentCharset().c_str(), "UTF-8", text, SDL_strlen(text) + 1);
+#else
+ char *conv_text = SDL_iconv_string("ISO-8859-1", "UTF-8", text, SDL_strlen(text) + 1);
+#endif
+ if (conv_text) {
+ SDL_free(text);
+ text = conv_text;
+ }
Common::String strText = text;
SDL_free(text);
- // FIXME: The string returned by SDL is in UTF-8, it is not clear
- // what encoding should be used for the returned string.
return strText;
#else
return "";
#endif
}
+bool OSystem_SDL::setTextInClipboard(const Common::String &text) {
+#if SDL_VERSION_ATLEAST(2, 0, 0)
+ // The encoding we need to use is UTF-8. Assume we currently have the
+ // current TranslationManager encoding or ISO-8859-1.
+#ifdef USE_TRANSLATION
+ char *utf8_text = SDL_iconv_string("UTF-8", TransMan.getCurrentCharset().c_str(), text.c_str(), text.size() + 1);
+#else
+ char *utf8_text = SDL_iconv_string("UTF-8", "ISO-8859-1", text.c_str(), text.size() + 1);
+#endif
+ if (utf8_text) {
+ int status = SDL_SetClipboardText(utf8_text);
+ SDL_free(utf8_text);
+ return status == 0;
+ }
+ return SDL_SetClipboardText(text.c_str()) == 0;
+#else
+ return false;
+#endif
+}
+
uint32 OSystem_SDL::getMillis(bool skipRecord) {
uint32 millis = SDL_GetTicks();
diff --git a/backends/platform/sdl/sdl.h b/backends/platform/sdl/sdl.h
index 61513fa65f..c746d2d2dd 100644
--- a/backends/platform/sdl/sdl.h
+++ b/backends/platform/sdl/sdl.h
@@ -72,6 +72,7 @@ public:
// Clipboard
virtual bool hasTextInClipboard();
virtual Common::String getTextFromClipboard();
+ virtual bool setTextInClipboard(const Common::String &text);
virtual void setWindowCaption(const char *caption);
virtual void addSysArchivesToSearchSet(Common::SearchSet &s, int priority = 0);
diff --git a/backends/platform/wii/osystem_events.cpp b/backends/platform/wii/osystem_events.cpp
index 2499300a56..ae9c27f03b 100644
--- a/backends/platform/wii/osystem_events.cpp
+++ b/backends/platform/wii/osystem_events.cpp
@@ -228,7 +228,7 @@ bool OSystem_Wii::pollKeyboard(Common::Event &event) {
keyboard_event kbdEvent;
s32 res = KEYBOARD_GetEvent(&kbdEvent);
-
+
if (!res)
return false;
diff --git a/backends/plugins/ds/ds-provider.cpp b/backends/plugins/ds/ds-provider.cpp
index 1c9744518e..c5419a989a 100644
--- a/backends/plugins/ds/ds-provider.cpp
+++ b/backends/plugins/ds/ds-provider.cpp
@@ -20,6 +20,10 @@
*
*/
+// Allow use of stuff in <nds.h>
+#define FORBIDDEN_SYMBOL_EXCEPTION_printf
+#define FORBIDDEN_SYMBOL_EXCEPTION_unistd_h
+
#include "common/scummsys.h"
#if defined(DYNAMIC_MODULES) && defined(__DS__)
diff --git a/backends/plugins/elf/version.cpp b/backends/plugins/elf/version.cpp
index ac999e1d7c..e91ec6b172 100644
--- a/backends/plugins/elf/version.cpp
+++ b/backends/plugins/elf/version.cpp
@@ -27,6 +27,6 @@
const char *gScummVMPluginBuildDate = "Git Master"; /* ScummVM Git Master */
#else
const char *gScummVMPluginBuildDate __attribute__((visibility("hidden"))) =
- __DATE__ " " __TIME__ ;
+ __DATE__ " " __TIME__;
#endif
#endif
diff --git a/backends/saves/psp/psp-saves.cpp b/backends/saves/psp/psp-saves.cpp
index 9d9affbc1b..ba09223884 100644
--- a/backends/saves/psp/psp-saves.cpp
+++ b/backends/saves/psp/psp-saves.cpp
@@ -60,16 +60,15 @@ PSPSaveFileManager::PSPSaveFileManager(const Common::String &defaultSavepath)
*/
void PSPSaveFileManager::checkPath(const Common::FSNode &dir) {
- const char *savePath = dir.getPath().c_str();
clearError();
PowerMan.beginCriticalSection();
//check if the save directory exists
- SceUID fd = sceIoDopen(savePath);
+ SceUID fd = sceIoDopen(dir.getPath().c_str());
if (fd < 0) {
//No? then let's create it.
- sceIoMkdir(savePath, 0777);
+ sceIoMkdir(dir.getPath().c_str(), 0777);
} else {
//it exists, so close it again.
sceIoDclose(fd);