aboutsummaryrefslogtreecommitdiff
path: root/backends
diff options
context:
space:
mode:
Diffstat (limited to 'backends')
-rw-r--r--backends/platform/psp/Makefile3
-rw-r--r--backends/platform/psp/module.mk3
-rw-r--r--backends/platform/psp/osys_psp.cpp7
-rw-r--r--backends/platform/psp/thread.cpp52
-rw-r--r--backends/platform/psp/thread.h10
5 files changed, 69 insertions, 6 deletions
diff --git a/backends/platform/psp/Makefile b/backends/platform/psp/Makefile
index 6967973da7..7c33999b4d 100644
--- a/backends/platform/psp/Makefile
+++ b/backends/platform/psp/Makefile
@@ -148,7 +148,8 @@ OBJS := powerman.o \
trace.o \
psploader.o \
pspkeyboard.o \
- audio.o
+ audio.o \
+ thread.o
# Include common Scummvm makefile
include $(srcdir)/Makefile.common
diff --git a/backends/platform/psp/module.mk b/backends/platform/psp/module.mk
index 0e5bd8737d..4d375bcef0 100644
--- a/backends/platform/psp/module.mk
+++ b/backends/platform/psp/module.mk
@@ -13,7 +13,8 @@ MODULE_OBJS := powerman.o \
trace.o \
psploader.o \
pspkeyboard.o \
- audio.o
+ audio.o \
+ thread.o
MODULE_DIRS += \
backends/platform/psp/
diff --git a/backends/platform/psp/osys_psp.cpp b/backends/platform/psp/osys_psp.cpp
index d29196619b..ed7fb2d3cf 100644
--- a/backends/platform/psp/osys_psp.cpp
+++ b/backends/platform/psp/osys_psp.cpp
@@ -37,6 +37,7 @@
#include "backends/platform/psp/psppixelformat.h"
#include "backends/platform/psp/osys_psp.h"
#include "backends/platform/psp/powerman.h"
+#include "backends/platform/psp/thread.h"
#include "backends/saves/psp/psp-saves.h"
#include "backends/timer/default/default-timer.h"
@@ -298,17 +299,15 @@ bool OSystem_PSP::pollEvent(Common::Event &event) {
return _inputHandler.getAllInputs(event);
}
-
uint32 OSystem_PSP::getMillis() {
- return SDL_GetTicks();
+ return PspThread::getMillis();
}
void OSystem_PSP::delayMillis(uint msecs) {
- SDL_Delay(msecs);
+ PspThread::delayMillis(msecs);
}
void OSystem_PSP::setTimerCallback(TimerProc callback, int interval) {
- //SDL_SetTimer(interval, (SDL_TimerCallback)callback);
_pspTimer.setCallback((PspTimer::CallbackFunc)callback);
_pspTimer.setIntervalMs(interval);
_pspTimer.start();
diff --git a/backends/platform/psp/thread.cpp b/backends/platform/psp/thread.cpp
new file mode 100644
index 0000000000..88e7b6fe38
--- /dev/null
+++ b/backends/platform/psp/thread.cpp
@@ -0,0 +1,52 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * $URL: https://scummvm.svn.sourceforge.net/svnroot/scummvm/scummvm/trunk/backends/platform/psp/osys_psp.h $
+ * $Id: osys_psp.h 49173 2010-05-24 03:05:17Z bluddy $
+ *
+ */
+
+#include <time.h>
+#include <psptypes.h>
+#include <psprtc.h>
+#include <pspthreadman.h>
+
+#include "backends/platform/psp/thread.h"
+
+void PspThread::delayMillis(uint32 ms) {
+ sceKernelDelayThread(ms * 1000);
+}
+
+void PspThread::delayMicros(uint32 us) {
+ sceKernelDelayThread(us);
+}
+
+uint32 PspThread::getMillis() {
+ uint32 ticks[2];
+ sceRtcGetCurrentTick((u64 *)ticks);
+ return (ticks[0]/1000);
+}
+
+uint32 PspThread::getMicros() {
+ uint32 ticks[2];
+ sceRtcGetCurrentTick((u64 *)ticks);
+ return ticks[0];
+}
+
diff --git a/backends/platform/psp/thread.h b/backends/platform/psp/thread.h
index d395d6713e..9ed3a2e2dc 100644
--- a/backends/platform/psp/thread.h
+++ b/backends/platform/psp/thread.h
@@ -26,6 +26,16 @@
#ifndef PSP_THREAD_H
#define PSP_THREAD_H
+#include "common/scummsys.h"
+
+class PspThread {
+public:
+ static void delayMillis(uint32 ms);
+ static void delayMicros(uint32 us);
+ static uint32 getMillis();
+ static uint32 getMicros();
+};
+
enum ThreadPriority {
PRIORITY_MAIN_THREAD = 36,
PRIORITY_AUDIO_THREAD = 35, // We'll alternate between this and main thread priority