aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--backends/platform/dingux/dingux.mk28
-rw-r--r--dists/gcw0/default.gcw0.desktop16
-rwxr-xr-xdists/gcw0/opk_make.sh111
-rw-r--r--dists/gcw0/scummvm.pngbin0 -> 2656 bytes
-rwxr-xr-xdists/gcw0/scummvm.sh9
-rw-r--r--dists/gcw0/scummvmrc9
-rw-r--r--engines/prince/hero.cpp2
-rw-r--r--engines/prince/prince.cpp18
-rw-r--r--engines/prince/script.cpp6
-rw-r--r--engines/zvision/fonts/truetype_font.cpp1
10 files changed, 187 insertions, 13 deletions
diff --git a/backends/platform/dingux/dingux.mk b/backends/platform/dingux/dingux.mk
index 48a9347143..f02801ea98 100644
--- a/backends/platform/dingux/dingux.mk
+++ b/backends/platform/dingux/dingux.mk
@@ -1,6 +1,7 @@
DINGUX_EXE_STRIPPED := scummvm_stripped$(EXEEXT)
bundle_name = dingux-dist/scummvm
+gcw0_bundle = gcw0-opk
all: $(DINGUX_EXE_STRIPPED)
@@ -30,3 +31,30 @@ endif
$(CP) $(srcdir)/backends/platform/dingux/scummvm.gpe $(bundle_name)/
$(CP) $(srcdir)/backends/platform/dingux/README.DINGUX $(bundle_name)/
$(CP) $(srcdir)/backends/platform/dingux/scummvm.png $(bundle_name)/
+
+# Special target for generationg GCW-Zero OPK bundle
+gcw0-opk: all
+ $(MKDIR) $(gcw0_bundle)
+ $(CP) $(DIST_FILES_DOCS) $(gcw0_bundle)/
+ $(MKDIR) $(gcw0_bundle)/themes
+ $(CP) $(DIST_FILES_THEMES) $(gcw0_bundle)/themes/
+ifdef DIST_FILES_ENGINEDATA
+ $(MKDIR) $(gcw0_bundle)/engine-data
+ $(CP) $(DIST_FILES_ENGINEDATA) $(gcw0_bundle)/engine-data/
+endif
+ifdef DYNAMIC_MODULES
+ $(MKDIR) $(gcw0_bundle)/plugins
+ $(CP) $(PLUGINS) $(gcw0_bundle)/plugins/
+ $(STRIP) $(gcw0_bundle)/plugins/*
+endif
+ $(STRIP) $(EXECUTABLE) -o $(gcw0_bundle)/scummvm
+
+ $(CP) $(srcdir)/backends/vkeybd/packs/vkeybd_default.zip $(gcw0_bundle)/
+ $(CP) $(srcdir)/backends/vkeybd/packs/vkeybd_small.zip $(gcw0_bundle)/
+
+ $(CP) $(srcdir)/dists/gcw0/scummvm.png $(gcw0_bundle)/
+ $(CP) $(srcdir)/dists/gcw0/default.gcw0.desktop $(gcw0_bundle)/
+ $(CP) $(srcdir)/dists/gcw0/scummvmrc $(gcw0_bundle)/
+ $(CP) $(srcdir)/dists/gcw0/scummvm.sh $(gcw0_bundle)/
+ ./dists/gcw0/opk_make.sh -d $(gcw0_bundle) -o scummvm
+
diff --git a/dists/gcw0/default.gcw0.desktop b/dists/gcw0/default.gcw0.desktop
new file mode 100644
index 0000000000..46bd2be092
--- /dev/null
+++ b/dists/gcw0/default.gcw0.desktop
@@ -0,0 +1,16 @@
+[Desktop Entry]
+Name=ScummVM
+Comment=Interpreter for several adventure games
+Comment[pl]=Interpreter graficznych gier przygodowych
+Comment[sv]=Tolk för flera äventyrsspel
+Comment[he]=פרשן למספר משחקי הרפתקאות
+Comment[de]=Interpreter für diverse Abenteuerspiele
+Comment[es]=Intérprete para varias aventuras gráficas
+Comment[ca]=Intèrpret per diverses aventures gràfiques
+Exec=scummvm.sh
+Icon=scummvm
+Terminal=false
+Type=Application
+Categories=games
+StartupNotify=false
+X-OD-Manual=README
diff --git a/dists/gcw0/opk_make.sh b/dists/gcw0/opk_make.sh
new file mode 100755
index 0000000000..b1bfd03efb
--- /dev/null
+++ b/dists/gcw0/opk_make.sh
@@ -0,0 +1,111 @@
+#!/bin/bash
+#
+# opk_make.sh
+#
+# This script is meant to ease generation of a opk file. Please consult the output
+# when running --help for a list of available parameters and an explaination of
+# those.
+#
+# Required tools when running the script:
+# bash
+# echo, cat, mv, rm, mksquashfs
+
+check_for_tool()
+{
+ which $1 &> /dev/null
+ if [ "$?" -ne "0" ];
+ then
+ cecho "ERROR: Could not find the program '$1'. Please make sure
+that it is available in your PATH since it is required to complete your request." $red
+ exit 1
+ fi
+}
+
+print_help()
+{
+ cat << EOSTREAM
+opk_make.sh - A script to package "something" into a OPK.
+
+Usage:
+ $(basename ${0}) {--directory|-d} <folder> {--opk|-o} <file> [{--help|-h}]
+
+
+Switches:
+ --directory / -d Sets the folder that is to be used for the resulting opk
+ to <folder>. This option is mandatory for the script to
+ function correctly.
+
+ --help / -h Displays this help text.
+
+ --opkname / -o Sets the output filename of the resulting opk to <file>.
+ This option is mandatory for the script to function
+ correctly.
+
+A version >=4.0 of squashfs is required to be available in your PATH.
+EOSTREAM
+}
+
+
+# Parse command line parameters
+while [ "${1}" != "" ]; do
+ if [ "${1}" = "--directory" ] || [ "${1}" = "-d" ];
+ then
+ FOLDER=$2
+ shift 2
+ elif [ "${1}" = "--help" ] || [ "${1}" = "-h" ];
+ then
+ print_help
+ exit 0
+ elif [ "${1}" = "--opkname" ] || [ "${1}" = "-o" ];
+ then
+ OPKNAME=$2
+ shift 2
+ else
+ echo "ERROR: '$1' is not a known argument. Printing --help and aborting."
+ print_help
+ exit 1
+ fi
+done
+
+
+# Probe if required variables were set
+echo "Checking if all required variables were set."
+if [ ! $OPKNAME ] || [ ! $FOLDER ];
+then
+ echo "ERROR: Not all required options were set! Please see the --help information below."
+ print_help
+ exit 1
+else
+ echo "OPKNAME set to '$OPKNAME'."
+fi
+# Check if the selected folder actually exists
+if [ ! -d $FOLDER ];
+then
+ echo "ERROR: '$FOLDER' doesn't exist or is not a folder."
+ exit 1
+else
+ echo "FOLDER set to '$FOLDER'."
+fi
+
+# Make iso from folder
+echo "Creating an iso file based on '$FOLDER'."
+
+check_for_tool mksquashfs
+if [ $(mksquashfs -version | awk 'BEGIN{r=0} $3>=4{r=1} END{print r}') -eq 0 ];
+then
+ echo "ERROR: Your squashfs version is older then version 4, please upgrade to 4.0 or later"
+ exit 1
+fi
+mksquashfs $FOLDER $OPKNAME.opk -noappend -no-exports -no-xattrs
+
+# Final message
+if [ -f $OPKNAME ];
+then
+ echo "Successfully finished creating the opk '$OPKNAME'."
+else
+ echo "There seems to have been a problem and '$OPKNAME' was not created. Please check
+the output above for any error messages. A possible cause for this is that there was
+not enough space available."
+ exit 1
+fi
+
diff --git a/dists/gcw0/scummvm.png b/dists/gcw0/scummvm.png
new file mode 100644
index 0000000000..128e59efc4
--- /dev/null
+++ b/dists/gcw0/scummvm.png
Binary files differ
diff --git a/dists/gcw0/scummvm.sh b/dists/gcw0/scummvm.sh
new file mode 100755
index 0000000000..5ad7a8579a
--- /dev/null
+++ b/dists/gcw0/scummvm.sh
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+cd `dirname $0`
+
+if [ ! -f $HOME/.scummvmrc ] ; then
+ cp /mnt/ScummVM/scummvmrc $HOME/.scummvmrc
+fi
+
+exec ./scummvm
diff --git a/dists/gcw0/scummvmrc b/dists/gcw0/scummvmrc
new file mode 100644
index 0000000000..1f4043b3ae
--- /dev/null
+++ b/dists/gcw0/scummvmrc
@@ -0,0 +1,9 @@
+[scummvm]
+fullscreen=true
+gfx_mode=1x
+aspect_ratio=true
+themepath=/mnt/ScummVM/themes
+browser_lastpath=/media
+extrapath=/mnt/ScummVM/engine-data
+pluginspath=/mnt/ScummVM/plugins
+joystick=0
diff --git a/engines/prince/hero.cpp b/engines/prince/hero.cpp
index 06fba25ba9..146470f6b7 100644
--- a/engines/prince/hero.cpp
+++ b/engines/prince/hero.cpp
@@ -54,7 +54,7 @@ Hero::~Hero() {
bool Hero::loadAnimSet(uint32 animSetNr) {
_animSetNr = animSetNr;
- if (animSetNr > sizeof(heroSetTable)) {
+ if (animSetNr >= ARRAYSIZE(heroSetTable)) {
return false;
}
diff --git a/engines/prince/prince.cpp b/engines/prince/prince.cpp
index 29c434e9c9..b0f2cd5056 100644
--- a/engines/prince/prince.cpp
+++ b/engines/prince/prince.cpp
@@ -730,8 +730,8 @@ bool PrinceEngine::loadSample(uint32 sampleSlot, const Common::String &streamNam
bool PrinceEngine::loadVoice(uint32 slot, uint32 sampleSlot, const Common::String &streamName) {
debugEngine("Loading wav %s slot %d", streamName.c_str(), slot);
- if (slot > kMaxTexts) {
- error("Text slot bigger than MAXTEXTS %d", kMaxTexts);
+ if (slot >= kMaxTexts) {
+ error("Text slot bigger than MAXTEXTS %d", kMaxTexts - 1);
return false;
}
@@ -1901,29 +1901,29 @@ void PrinceEngine::blackPalette() {
void PrinceEngine::setPalette(const byte *palette) {
if (palette != nullptr) {
- byte *blackPalette = (byte *)malloc(256 * 3);
+ byte *blackPalette_ = (byte *)malloc(256 * 3);
int fadeStep = 0;
for (int i = 0; i <= kFadeStep; i++) {
for (int j = 0; j < 256; j++) {
- blackPalette[3 * j] = palette[3 * j] * fadeStep / 4;
- blackPalette[3 * j + 1] = palette[3 * j + 1] * fadeStep / 4;
- blackPalette[3 * j + 2] = palette[3 * j + 2] * fadeStep / 4;
+ blackPalette_[3 * j] = palette[3 * j] * fadeStep / 4;
+ blackPalette_[3 * j + 1] = palette[3 * j + 1] * fadeStep / 4;
+ blackPalette_[3 * j + 2] = palette[3 * j + 2] * fadeStep / 4;
}
fadeStep++;
- _graph->setPalette(blackPalette);
+ _graph->setPalette(blackPalette_);
_system->updateScreen();
Common::Event event;
Common::EventManager *eventMan = _system->getEventManager();
eventMan->pollEvent(event);
if (shouldQuit()) {
_graph->setPalette(palette);
- free(blackPalette);
+ free(blackPalette_);
return;
}
pause();
}
_graph->setPalette(palette);
- free(blackPalette);
+ free(blackPalette_);
}
}
diff --git a/engines/prince/script.cpp b/engines/prince/script.cpp
index 0e9dd27877..d1a0034940 100644
--- a/engines/prince/script.cpp
+++ b/engines/prince/script.cpp
@@ -391,10 +391,10 @@ bool Script::loadAllMasks(Common::Array<Mask> &maskList, int offset) {
debug("Can't load %s", msStreamName.c_str());
delete msStream;
} else {
- uint32 dataSize = msStream->size();
+ int32 dataSize = msStream->size();
if (dataSize != -1) {
tempMask._data = (byte *)malloc(dataSize);
- if (msStream->read(tempMask._data, dataSize) != dataSize) {
+ if (msStream->read(tempMask._data, dataSize) != (uint32)dataSize) {
free(tempMask._data);
delete msStream;
return false;
@@ -477,7 +477,7 @@ uint32 Interpreter::step(uint32 opcodePC) {
// Get the current opcode
_lastOpcode = readScript16();
- if (_lastOpcode > kNumOpcodes)
+ if (_lastOpcode >= kNumOpcodes)
error(
"Trying to execute unknown opcode @0x%04X: %02d",
_currentInstruction,
diff --git a/engines/zvision/fonts/truetype_font.cpp b/engines/zvision/fonts/truetype_font.cpp
index ba4d72bde8..45eaeeb2b4 100644
--- a/engines/zvision/fonts/truetype_font.cpp
+++ b/engines/zvision/fonts/truetype_font.cpp
@@ -95,6 +95,7 @@ Graphics::Surface *TruetypeFont::drawTextToSurface(const Common::String &text, u
lines.pop_back();
}
if (lines.size() == 0) {
+ delete surface;
return nullptr;
}