aboutsummaryrefslogtreecommitdiff
path: root/backends/gp32
diff options
context:
space:
mode:
authorWon Star2006-04-07 10:38:06 +0000
committerWon Star2006-04-07 10:38:06 +0000
commitab41c88902f45431d6fe6cfac349ead7feeb1857 (patch)
treebc1fc19a78677a7368d0aff721f757017dbcedc3 /backends/gp32
parent94f2174522aa1abcf6a2073cb4a6d59b37852d6b (diff)
downloadscummvm-rg350-ab41c88902f45431d6fe6cfac349ead7feeb1857.tar.gz
scummvm-rg350-ab41c88902f45431d6fe6cfac349ead7feeb1857.tar.bz2
scummvm-rg350-ab41c88902f45431d6fe6cfac349ead7feeb1857.zip
Disable i/o cache which is incomplete and can cause serious problem with SMC.
Fix compile by overriding typenames. Cleanup and fix ASM functions. Some of them didn't return properly to C code when called... Cleanup Makefile again. svn-id: r21663
Diffstat (limited to 'backends/gp32')
-rw-r--r--backends/gp32/Makefile100
-rw-r--r--backends/gp32/gp32_launcher.cpp2
-rw-r--r--backends/gp32/gp32_main.cpp7
-rw-r--r--backends/gp32/gp32std.cpp19
-rw-r--r--backends/gp32/gp32std_sound.cpp4
-rw-r--r--backends/gp32/gp_asmlib.s42
6 files changed, 97 insertions, 77 deletions
diff --git a/backends/gp32/Makefile b/backends/gp32/Makefile
index aa337d348b..3d5d45e313 100644
--- a/backends/gp32/Makefile
+++ b/backends/gp32/Makefile
@@ -21,7 +21,20 @@ FXETOOL := b2fxec
# Default compilation parameters. Normally don't edit these #
#######################################################################
-CXXFLAGS:= -g -O
+CFLAGS = -marm -march=armv4t -mtune=arm920 -mapcs \
+ -finline-functions \
+ -fshort-enums \
+ -mstructure-size-boundary=32 \
+ -mno-thumb-interwork \
+ -I$(GPSDK)/include \
+ -g \
+ -O2 \
+ -fomit-frame-pointer
+# -ffast-math \
+# -fshort-double
+
+CPPFLAGS:= $(CFLAGS)
+CXXFLAGS:= $(CFLAGS)
DEFINES :=
LDFLAGS :=
INCLUDES:= -I. -Icommon
@@ -34,11 +47,24 @@ CXXFLAGS+= -Wshadow -Wuninitialized -Wimplicit -Wundef
CXXFLAGS+= -Wno-long-long -Wno-multichar -Wno-unknown-pragmas -Wno-reorder
CXXFLAGS+= -Wwrite-strings -fcheck-new -Wctor-dtor-privacy -Wnon-virtual-dtor
+# Stripped Build? (Smaller ELF, Minimal debug symbol information).
+# You MUST comment this out with a # if you wish to debug your code.
+STRIP_DEBUG = -Wl,--strip-debug
+
# GPSDK (SDK, Includes and Startup Files) base dir
-GPSDK = /usr/compat/gp32/share/sdk
+GPSDK = /usr/compat/gp32/share/sdk
+
+LDSPECS = -specs=gp32_gpsdk.specs
+
+LDFLAGS = $(STRIP_DEBUG) -Wl,-Map,$(MAPFILE) $(LDSPECS) -Wl,--no-warn-mismatch
+
+LIBS += -L$(GPSDK)/lib \
+ -lgpmem -lgpos -lgpstdio -lgpstdlib -lgpsound -lgpgraphic -lgpfont \
+ -lm -lc -lgcc
+
+INCLUDES += -Ibackends/gp32 -Iengines -I$(GPSDK)/include
-GPMAD_DIR = gpmad
-GPTREMOR_DIR = gptremor
+MODULES += backends/gp32
# Outputs
EXEEXT = .elf
@@ -46,38 +72,29 @@ MAPFILE = scummvm.map
BIN = scummvm.gxb
FXE = scummvm.fxe
-# Stripped Build? (Smaller ELF, Minimal debug symbol information).
-# You MUST comment this out with a # if you wish to debug your code.
-# STRIP_DEBUG = -Wl,--strip-debug
-
# Plugins hack
srcdir = ./
-CFLAGS = -marm -march=armv4t -mtune=arm920 -mapcs \
- -finline-functions \
- -fshort-enums \
- -mstructure-size-boundary=32 \
- -mno-thumb-interwork \
- -I$(GPSDK)/include \
- -g \
- -O2 \
- -fomit-frame-pointer
-# -ffast-math \
-# -fshort-double \
-# -Wno-multichar \
-
-CPPFLAGS = $(CFLAGS)
-
DEFINES = -D__GP32__
DEFINES += -DNONSTANDARD_PORT
+# Disable new themes. GP32 has LOW memory!
+DEFINES += -DDISABLE_FANCY_THEMES
+
# Support libtremor.
-#DEFINES += -DUSE_VORBIS -DUSE_TREMOR
-#LIBS += -lgptremor
+#DEFINES += -DUSE_VORBIS -DUSE_TREMOR -DGP32_SDK
+#INCLUDES += -Ibackends/gp32/gptremor
+#LIBS += -Lbackends/gp32/gptremor -lgptremor
# Support libmad.
#DEFINES += -DUSE_MAD
-#LIBS += -lgpmad
+#INCLUDES += -Ibackends/gp32/gpmad
+#LIBS += -Lbackends/gp32/gpmad -lgpmad
+
+# Support libminilzo.
+#DEFINES += -DUSE_MINILZO
+#INCLUDES += -Ibackends/gp32/minilzo
+#LIBS += -Lbackends/gp32/minilzo -lminilzo
# Support for 8:3 save files names (The GP32 uses FAT12/16 (no vFAT) for the file system).
DEFINES += -DSHORT_SAVENAMES
@@ -89,19 +106,7 @@ DEFINES += -DOUTPUT_UNSIGNED_AUDIO
# - NOT fully implemented yet.
#DEFINES += -DUSE_GP32_FMOPL
-LDSPECS = -specs=gp32_gpsdk.specs
-
-LDFLAGS = $(STRIP_DEBUG) \
- -Wl,-Map,$(MAPFILE) \
- $(LDSPECS) -Wl,--no-warn-mismatch
-LIBS += -L$(GPSDK)/lib \
- -lgpmem -lgpos -lgpstdio -lgpstdlib -lgpsound -lgpgraphic -lgpfont \
- -lm -lc -lgcc
-
-INCLUDES += -Ibackends/gp32 -Iengines -I$(GPSDK)/include
-
-MODULES += backends/gp32
#GP32 Debug - Remove from Release builds
# This builds in the GP32 GDB USB Stub. Don't use it unless you know what your doing.
@@ -130,9 +135,6 @@ OBJS += backends/gp32/gp32_main.o \
backends/gp32/gp32_osys.o \
backends/gp32/gp-fs.o
-#install: all
- #$(EXECUTE_TOOL) $(BIN)
-
$(FXE): $(BIN)
$(FXETOOL) -f -a "The ScummVM Team" -t "ScummVM for the GP32" $< $@
# $(FXETOOL) -f -a "The ScummVM Team" -t "ScummVM for the GP32" -b scummvm.bmp $< $@
@@ -151,12 +153,18 @@ DISABLE_SCALERS = 1
DISABLE_HQ_SCALERS = 1
#DISABLE_SCUMM = 1
-#DISABLE_SCUMM_7_8 = 1
+
+# We can play The Dig with GP32 -- without any movies/musics/voices. But who would do that?
+DISABLE_SCUMM_7_8 = 1
DISABLE_HE = 1
-#DISABLE_SIMON = 1
-#DISABLE_SKY = 1
-#DISABLE_QUEEN = 1
-#DISABLE_GOB = 1
+
+# ???
+DISABLE_SIMON = 1
+DISABLE_SKY = 1
+DISABLE_QUEEN = 1
+DISABLE_GOB = 1
+DISABLE_LURE = 1
+DISABLE_CINE = 1
# In-development engines below.
# Disable for ALL release builds.
diff --git a/backends/gp32/gp32_launcher.cpp b/backends/gp32/gp32_launcher.cpp
index ef553f4e34..0ef0aa1ba6 100644
--- a/backends/gp32/gp32_launcher.cpp
+++ b/backends/gp32/gp32_launcher.cpp
@@ -68,7 +68,7 @@ void readConfigVars() {
currentSetting[0] = 2;
currentSetting[1] = 5;
currentSetting[2] = 1;
- currentSetting[3] = 0;
+ currentSetting[3] = 1;
writeConfigVars();
} else {
if (!file.open("scummvm.cfg", Common::File::kFileReadMode, "gp:\\gpetc\\")) {
diff --git a/backends/gp32/gp32_main.cpp b/backends/gp32/gp32_main.cpp
index ebada917fd..df0ed42d4b 100644
--- a/backends/gp32/gp32_main.cpp
+++ b/backends/gp32/gp32_main.cpp
@@ -65,16 +65,15 @@ void GpMain(void *arg) {
gp_setCpuSpeed(g_vars.cpuSpeed);
// FOR DEBUG PURPOSE!
- int argc = 2;
+ int argc = 1;
//char *argv[] = { "scummvm", "-enull", "-pgp:\\game\\dott\\", "tentacle" };
- char *argv[] = { "scummvm", "-enull", "-d3" };
-
- //scummvm_main(argc, argv);
+ char *argv[] = { "scummvm", "-d9" };
g_system = new OSystem_GP32_create();
assert(g_system);
// Invoke the actual ScummVM main entry point:
+ //int res = scummvm_main(argc, argv);
int res = scummvm_main(1, NULL);
g_system->quit(); // TODO: Consider removing / replacing this!
return res;
diff --git a/backends/gp32/gp32std.cpp b/backends/gp32/gp32std.cpp
index 9bdf6f4e06..e9e24edb65 100644
--- a/backends/gp32/gp32std.cpp
+++ b/backends/gp32/gp32std.cpp
@@ -25,6 +25,7 @@
#include "stdafx.h"
#include "common/scummsys.h"
+//#include "graphics/scaler.h"
#include "common/system.h"
#include "backends/intern.h"
@@ -37,6 +38,8 @@ FILE *gp_stderr = NULL;
FILE *gp_stdout = NULL;
FILE *gp_stdin = NULL;
+//#define USE_CACHE
+
#define DEBUG_MAX 4
char debline[DEBUG_MAX][256];
static int debnext = 0;
@@ -63,6 +66,8 @@ void _dprintf(const char *s, ...) {
debnext++;
if (debnext == DEBUG_MAX)
debnext = 0;
+
+ gp_delay(600);
}
//////////////////
@@ -190,10 +195,12 @@ int gp_fclose(GPFILE *stream) {
}
*/
+#ifdef USE_CACHE
if (stream->cachePos) {
GpFileWrite(stream->handle, (char *)stream->cacheData, stream->cachePos); // flush cache
stream->cachePos = 0;
}
+#endif
ERR_CODE err = GpFileClose(stream->handle);
free(stream);
@@ -233,6 +240,7 @@ size_t gp_fwrite(const void *ptr, size_t size, size_t n, GPFILE *stream) {
return 0;
}
+#ifdef USE_CACHE
if (stream->cachePos + len < FCACHE_SIZE) {
memcpy(stream->cacheData + stream->cachePos, ptr, len);
stream->cachePos += len;
@@ -242,12 +250,15 @@ size_t gp_fwrite(const void *ptr, size_t size, size_t n, GPFILE *stream) {
stream->cachePos = 0;
}
+#endif
ERR_CODE err = GpFileWrite(stream->handle, ptr, len);
if (!err)
return n;
else
return -err;
+#ifdef USE_CACHE
}
+#endif
return 0;
}
@@ -605,7 +616,7 @@ void GPDEBUG(const char *fmt, ...) {
}
void NP(const char *fmt, ...) {
- return;
+// return;
char s[256];
va_list marker;
@@ -618,7 +629,7 @@ void NP(const char *fmt, ...) {
}
void LP(const char *fmt, ...) {
- return;
+// return;
char s[256];
va_list marker;
@@ -631,7 +642,7 @@ void LP(const char *fmt, ...) {
}
void SP(const char *fmt, ...) {
- return;
+// return;
char s[256];
va_list marker;
@@ -644,7 +655,7 @@ void SP(const char *fmt, ...) {
}
void BP(const char *fmt, ...) {
- return;
+// return;
char s[256];
va_list marker;
diff --git a/backends/gp32/gp32std_sound.cpp b/backends/gp32/gp32std_sound.cpp
index a843f732e2..711a101fc8 100644
--- a/backends/gp32/gp32std_sound.cpp
+++ b/backends/gp32/gp32std_sound.cpp
@@ -153,8 +153,8 @@ int gp_soundBufStart(GPSOUNDBUF *sb) {
tmpBuf[i] = 0x8000;
// Frequency of the timer interrupt which polls the playing position
- //soundBuf.pollfreq = 4 * (2 * soundBuf.freq) / soundBuf.samples;
- soundBuf.pollfreq = (2 * soundBuf.freq) / soundBuf.samples;
+ // FIXME: This frequency should not be multiplied by 4.
+ soundBuf.pollfreq = 4 * (2 * soundBuf.freq) / soundBuf.samples;
// Set timer interrupt
if (GpTimerOptSet(GP32_TIMER_AUDIO_IDX, soundBuf.pollfreq, 0, soundTimer) == GPOS_ERR_ALREADY_USED) {
diff --git a/backends/gp32/gp_asmlib.s b/backends/gp32/gp_asmlib.s
index 7c3b03c168..3d0bfd9a2e 100644
--- a/backends/gp32/gp_asmlib.s
+++ b/backends/gp32/gp_asmlib.s
@@ -20,36 +20,38 @@ cpu_speed:
mmu_change:
stmdb r13!, {r0-r12,lr}
- swi #0x02
+ swi #0x02
ldmia r13!, {r0-r12,lr}
- bx lr
+ bx lr
nop
gp_enableIRQ:
- STMDB r13!,{r0,lr}
- MRS r0,CPSR
- BIC r0,r0,#0x80
- MSR CPSR,r0
- LDMIA r13!,{r0,pc}
- @MOV pc,lr
+ stmdb r13!, {r0,lr}
+ mrs r0, CPSR
+ bic r0, r0, #0x80
+ msr CPSR, r0
+ ldmia r13!, {r0,pc}
+ bx lr
gp_disableIRQ:
- STMDB r13!,{r0,lr}
- MRS r0,CPSR
- ORR r0,r0,#0xc0
- MSR CPSR,r0
- LDMIA r13!,{r0,pc}
- @MOV pc,lr
+ stmdb r13!, {r0,lr}
+ MRS r0, CPSR
+ ORR r0, r0, #0xc0
+ MSR CPSR, r0
+ ldmia r13!, {r0,pc}
+ bx lr
gp_installSWIIRQ:
- STMDB r13!,{r14}
- SWI 0x9
- LDMIA r13!,{pc}
+ stmdb r13!, {r14}
+ swi 0x9
+ ldmia r13!, {pc}
+ bx lr
gp_removeSWIIRQ:
- STMDB r13!,{r14}
- SWI 0xa
- LDMIA r13!,{pc}
+ stmdb r13!, {r14}
+ swi 0xa
+ ldmia r13!, {pc}
+ bx lr
@ ******** ASMFastSolidBlit(unsigned char *src4, unsigned char *dst4, int nbx, int nby, int height2, int trans, int coul) ********