aboutsummaryrefslogtreecommitdiff
path: root/backends/platform/n64
diff options
context:
space:
mode:
Diffstat (limited to 'backends/platform/n64')
-rw-r--r--backends/platform/n64/Makefile8
-rw-r--r--backends/platform/n64/README.N647
-rw-r--r--backends/platform/n64/module.mk2
-rw-r--r--backends/platform/n64/n64.mk29
-rw-r--r--backends/platform/n64/osys_n64.h8
-rw-r--r--backends/platform/n64/osys_n64_base.cpp11
-rw-r--r--backends/platform/n64/osys_n64_utilities.cpp3
-rw-r--r--backends/platform/n64/pad_rom.sh6
8 files changed, 51 insertions, 23 deletions
diff --git a/backends/platform/n64/Makefile b/backends/platform/n64/Makefile
index b8b2e61f77..cffe277312 100644
--- a/backends/platform/n64/Makefile
+++ b/backends/platform/n64/Makefile
@@ -15,7 +15,7 @@ AR = $(GCCN64PREFIX)ar cru
RANLIB = $(GCCN64PREFIX)ranlib
DEFINES += -D__N64__ -DLIMIT_FPS -DNONSTANDARD_PORT -DDISABLE_DEFAULT_SAVEFILEMANAGER -DDISABLE_TEXT_CONSOLE -DDISABLE_COMMAND_LINE -DDISABLE_FANCY_THEMES -DDISABLE_DOSBOX_OPL -DENABLE_VKEYBD -DUSE_ZLIB
-LIBS += -lpakfs -lframfs -ln64 -ln64utils -lromfs
+LIBS += -lpakfs -lframfs -ln64 -ln64utils -lromfs
#DEFINES += -D_ENABLE_DEBUG_
@@ -31,7 +31,7 @@ DEFINES += -DUSE_VORBIS -DUSE_TREMOR
LIBS += -lvorbisidec
endif
-LIBS += -lm -lstdc++ -lc -lgcc -lz -lnosys
+LIBS += -lm -lstdc++ -lc -lgcc -lz -lnosys
CXXFLAGS = -g -mno-extern-sdata -O2 --param max-inline-insns-auto=20 -fomit-frame-pointer -march=vr4300 -mtune=vr4300 -mhard-float -fno-rtti -fno-exceptions -Wno-multichar -Wshadow -I$(LIBN64PATH) -I$(TOOLPATH)/include -I./ -I$(srcdir) -I$(srcdir)/engines
LDFLAGS = -g -march=vr4300 -mtune=vr4300 -nodefaultlibs -nostartfiles -mno-crt0 -L$(LIBN64PATH) -L$(TOOLPATH)/lib $(LIBS) -T n64ld_cpp.x -Xlinker -Map -Xlinker scummvm.map
@@ -49,7 +49,7 @@ USE_RGB_COLOR=0
ENABLED=STATIC_PLUGIN
-ENABLE_SCUMM = $(ENABLED)
+#ENABLE_SCUMM = $(ENABLED)
#ENABLE_SCI = $(ENABLED)
#ENABLE_GOB = $(ENABLED)
#ENABLE_PARALLACTION = $(ENABLED)
@@ -74,7 +74,7 @@ all: $(TARGET).v64
$(TARGET).v64: $(TARGET).bin ROMFS.img bootcode
cat bootcode $(TARGET).bin ROMFS.img > $(TARGET).v64
- ./pad_rom.sh
+ ./pad_rom.sh $(TARGET).v64
ROMFS.img:
genromfs -f ./ROMFS.img -d ./ROMFS -V romtest
diff --git a/backends/platform/n64/README.N64 b/backends/platform/n64/README.N64
index 276436b676..b47b239658 100644
--- a/backends/platform/n64/README.N64
+++ b/backends/platform/n64/README.N64
@@ -97,19 +97,20 @@ A - '.' / Skip dialogues in some games
C buttons - Numeric keypad keys
* Using a N64 Mouse:
-Used like a normal PC mouse.
+Used like a normal PC mouse.
Notes
=====
-- If virtual keyboard doesn't show up, you need to make sure you included
+- If virtual keyboard doesn't show up, you need to make sure you included
'vkeybd_default.zip' in the root of your romfs image.
-- In some games (mostly gob) cursor movement might be choppy, it's a known
+- In some games (mostly gob) cursor movement might be choppy, it's a known
problem and related on how N64 port manages screen updates.
** TODO **
==========
+
Write the rest of this README.
diff --git a/backends/platform/n64/module.mk b/backends/platform/n64/module.mk
index 429b63802e..c8ceb32701 100644
--- a/backends/platform/n64/module.mk
+++ b/backends/platform/n64/module.mk
@@ -6,7 +6,7 @@ MODULE_OBJS := \
osys_n64_events.o \
osys_n64_utilities.o \
pakfs_save_manager.o \
- framfs_save_manager.o
+ framfs_save_manager.o
# We don't use rules.mk but rather manually update OBJS and MODULE_DIRS.
MODULE_OBJS := $(addprefix $(MODULE)/, $(MODULE_OBJS))
diff --git a/backends/platform/n64/n64.mk b/backends/platform/n64/n64.mk
new file mode 100644
index 0000000000..2e383e670d
--- /dev/null
+++ b/backends/platform/n64/n64.mk
@@ -0,0 +1,29 @@
+N64_EXE_STRIPPED := scummvm_stripped$(EXEEXT)
+
+bundle_name = n64-dist/scummvm
+BASESIZE = 2097152
+
+all: $(N64_EXE_STRIPPED)
+
+$(N64_EXE_STRIPPED): $(EXECUTABLE)
+ $(STRIP) $< -o $@
+
+n64-distclean:
+ rm -rf $(bundle_name)
+ rm $(N64_EXE_STRIPPED)
+
+n64-dist: all
+ $(MKDIR) $(bundle_name)
+ $(MKDIR) $(bundle_name)/romfs
+ifdef DIST_FILES_ENGINEDATA
+ $(CP) $(DIST_FILES_ENGINEDATA) $(bundle_name)/romfs
+endif
+ $(CP) $(DIST_FILES_DOCS) $(bundle_name)/
+ $(CP) $(srcdir)/backends/vkeybd/packs/vkeybd_default.zip $(bundle_name)/romfs
+ genromfs -f $(bundle_name)/romfs.img -d $(bundle_name)/romfs -V scummvmn64
+ mips64-objcopy $(EXECUTABLE) $(bundle_name)/scummvm.elf -O binary
+ cat $(N64SDK)/hkz-libn64/bootcode $(bundle_name)/scummvm.elf $(bundle_name)/romfs.img > scummvm.v64
+ $(srcdir)/backends/platform/n64/pad_rom.sh scummvm.v64
+ rm scummvm.bak
+ mv scummvm.v64 $(bundle_name)/scummvm.v64
+
diff --git a/backends/platform/n64/osys_n64.h b/backends/platform/n64/osys_n64.h
index f7560eb4d3..707bb1b7ae 100644
--- a/backends/platform/n64/osys_n64.h
+++ b/backends/platform/n64/osys_n64.h
@@ -98,7 +98,7 @@ protected:
uint16 _gameWidth, _gameHeight;
uint16 _frameBufferWidth; // Width of framebuffer in N64 memory
uint8 _offscrPixels; // Pixels to skip on each line before start drawing, used to center image
- uint8 _maxFps;
+ uint8 _maxFps; // Max frames-per-second which can be shown on screen
int _shakeOffset;
@@ -123,7 +123,7 @@ protected:
uint8 _controllerPort;
int8 _mousePort;
- bool _controllerHasRumble;
+ bool _controllerHasRumble; // Gets enabled if rumble-pak is detected
bool _dirtyOffscreen;
@@ -133,8 +133,8 @@ public:
uint16 _audioBufferSize;
uint32 _viClockRate; // Clock rate of video system, depending on VI mode
- int _timerCallbackNext;
- int _timerCallbackTimer;
+ uint32 _timerCallbackNext;
+ uint32 _timerCallbackTimer;
TimerProc _timerCallback;
/* *** */
diff --git a/backends/platform/n64/osys_n64_base.cpp b/backends/platform/n64/osys_n64_base.cpp
index 5e4b84ba3f..8862693138 100644
--- a/backends/platform/n64/osys_n64_base.cpp
+++ b/backends/platform/n64/osys_n64_base.cpp
@@ -346,8 +346,7 @@ int16 OSystem_N64::getWidth() {
}
void OSystem_N64::setPalette(const byte *colors, uint start, uint num) {
- for (int i = 0; i < num; ++i) {
- uint8 c[4];
+ for (uint i = 0; i < num; ++i) {
_screenPalette[start + i] = colRGB888toBGR555(colors[2], colors[1], colors[0]);
colors += 4;
}
@@ -413,7 +412,7 @@ void OSystem_N64::grabPalette(byte *colors, uint start, uint num) {
}
void OSystem_N64::setCursorPalette(const byte *colors, uint start, uint num) {
- for (int i = 0; i < num; ++i) {
+ for (uint i = 0; i < num; ++i) {
_cursorPalette[start + i] = colRGB888toBGR555(colors[2], colors[1], colors[0]);
colors += 4;
}
@@ -860,7 +859,7 @@ void OSystem_N64::getTimeAndDate(TimeDate &t) const {
// No RTC inside the N64, read mips timer to simulate
// passing of time, not a perfect solution, but can't think
// of anything better.
-
+
uint32 now = getMilliTick();
t.tm_sec = (now / 1000) % 60;
@@ -868,7 +867,7 @@ void OSystem_N64::getTimeAndDate(TimeDate &t) const {
t.tm_hour = (((now / 1000) / 60) / 60) % 24;
t.tm_mday = 1;
t.tm_mon = 0;
- t.tm_year = 1900;
+ t.tm_year = 110;
return;
}
@@ -878,6 +877,8 @@ FilesystemFactory *OSystem_N64::getFilesystemFactory() {
}
void OSystem_N64::setTimerCallback(TimerProc callback, int interval) {
+ assert (interval > 0);
+
if (callback != NULL) {
_timerCallbackTimer = interval;
_timerCallbackNext = getMillis() + interval;
diff --git a/backends/platform/n64/osys_n64_utilities.cpp b/backends/platform/n64/osys_n64_utilities.cpp
index bc4661889f..88a2970d7d 100644
--- a/backends/platform/n64/osys_n64_utilities.cpp
+++ b/backends/platform/n64/osys_n64_utilities.cpp
@@ -42,9 +42,6 @@ void disableAudioPlayback(void) {
_audioEnabled = false;
- OSystem_N64 *osys = (OSystem_N64 *)g_system;
- Audio::MixerImpl *localmixer = (Audio::MixerImpl *)osys->getMixer();
-
while (AI_busy()); // Wait for audio to stop
}
diff --git a/backends/platform/n64/pad_rom.sh b/backends/platform/n64/pad_rom.sh
index 0660f6c204..085203306f 100644
--- a/backends/platform/n64/pad_rom.sh
+++ b/backends/platform/n64/pad_rom.sh
@@ -1,13 +1,13 @@
#!/bin/bash
-TARGET="scummvm"
+TARGET=$1
BASESIZE=2097152
-CARTSIZE=`ls -l $TARGET.v64 | cut -d" " -f5`
+CARTSIZE=`ls -l $1 | cut -d" " -f5`
REMAINDER=`echo $CARTSIZE % $BASESIZE | bc`
REMAINDER=`echo $BASESIZE - $REMAINDER | bc`
CARTSIZE=`echo $CARTSIZE + $REMAINDER | bc`
-ucon64 -q --n64 --v64 --chk --padn=$CARTSIZE $TARGET.v64
+ucon64 -q --n64 --v64 --chk --padn=$CARTSIZE $1