[scummvm-tools] 15/17: New upstream version 1.9.0

Stephen Kitt skitt at moszumanska.debian.org
Mon Oct 17 10:48:11 UTC 2016


This is an automated email from the git hooks/post-receive script.

skitt pushed a commit to branch master
in repository scummvm-tools.

commit 0ceda235b20c1f179a9f7048c757c36e0ebb4d6e
Author: Stephen Kitt <skitt at debian.org>
Date:   Mon Oct 17 12:32:11 2016 +0200

    New upstream version 1.9.0
---
 Makefile                               |  77 +++++++++++++---
 NEWS                                   |   3 +
 configure                              | 155 ++++++++++++++++++++++++++++++---
 decompiler/test/codegen.h              |   2 +-
 dists/macosx/DS_Store                  | Bin 0 -> 6148 bytes
 dists/macosx/Info.plist                |   6 +-
 dists/scummvmtools.rc                  |   8 +-
 dists/win32/scummvm-tools.nsi          |   4 +-
 engines/pegasus/pegasus_save_types.cpp |   2 +-
 engines/scumm/descumm.cpp              |  67 +++++++++++++-
 engines/scumm/descumm6.cpp             |  64 +++++++-------
 engines/sword1/compress_sword1.cpp     |  48 +++++++---
 engines/sword1/compress_sword1.h       |   4 +-
 internal_version.h                     |   2 +-
 14 files changed, 355 insertions(+), 87 deletions(-)

diff --git a/Makefile b/Makefile
index afc4473..69dda95 100644
--- a/Makefile
+++ b/Makefile
@@ -77,17 +77,6 @@ else
 	$(error You need to run $(srcdir)/configure before you can run make. Check $(srcdir)/configure --help for a list of parameters)
 endif
 
-# Special target to create a application wrapper for Mac OS X
-bundle_name = ScummVM\ Tools.app
-bundle: scummvm-tools$(EXEEXT)
-	mkdir -p $(bundle_name)
-	mkdir -p $(bundle_name)/Contents
-	mkdir -p $(bundle_name)/Contents/MacOS
-	mkdir -p $(bundle_name)/Contents/Resources
-	echo "APPL????" > $(bundle_name)/Contents/PkgInfo
-	cp $(srcdir)/dists/macosx/Info.plist $(bundle_name)/Contents/
-	cp $(srcdir)/gui/media/*.* $(bundle_name)/Contents/Resources
-	cp scummvm-tools$(EXEEXT) $(bundle_name)/Contents/MacOS/
 
 #
 # Windows specific
@@ -167,6 +156,72 @@ endif
 	$(STRIP) scummvm-tools-cli$(EXEEXT)  -o $(srcdir)/$(WIN32BUILD)/scummvm-tools-cli$(EXEEXT)
 	makensis -V2 -Dtop_srcdir="../.." -Dtext_dir="../../$(WIN32BUILD)" -Dbuild_dir="../../$(WIN32BUILD)" $(srcdir)/dists/win32/scummvm-tools.nsi
 
+
+#
+# OS X specific
+#
+
+ifdef USE_VORBIS
+OSX_STATIC_LIBS += $(STATICLIBPATH)/lib/libvorbisfile.a $(STATICLIBPATH)/lib/libvorbis.a $(STATICLIBPATH)/lib/libvorbisenc.a $(STATICLIBPATH)/lib/libogg.a
+endif
+
+ifdef USE_FLAC
+OSX_STATIC_LIBS += $(STATICLIBPATH)/lib/libFLAC.a
+endif
+
+ifdef USE_MAD
+OSX_STATIC_LIBS += $(STATICLIBPATH)/lib/libmad.a
+endif
+
+ifdef USE_PNG
+OSX_STATIC_LIBS += $(STATICLIBPATH)/lib/libpng.a
+endif
+
+ifdef USE_ZLIB
+OSX_STATIC_LIBS += $(STATICLIBPATH)/lib/libz.a
+endif
+
+
+# Special target to create a static linked binaries for Mac OS X.
+scummvm-tools-static: $(scummvm-tools_OBJS)
+	$(CXX) $(LDFLAGS) -o scummvm-tools-static $(scummvm-tools_OBJS) \
+		-framework AudioUnit -framework AudioToolbox -framework Carbon -framework CoreMIDI \
+		$(WXSTATICLIBS) $(OSX_STATIC_LIBS)
+
+scummvm-tools-cli-static: $(scummvm-tools-cli_OBJS)
+	$(CXX) $(LDFLAGS) -o scummvm-tools-cli-static $(scummvm-tools-cli_OBJS) \
+		-framework AudioUnit -framework AudioToolbox -framework Carbon -framework CoreMIDI \
+		$(OSX_STATIC_LIBS)
+
+bundle_name = ScummVM\ Tools.app
+bundle: scummvm-tools-static
+	mkdir -p $(bundle_name)
+	mkdir -p $(bundle_name)/Contents
+	mkdir -p $(bundle_name)/Contents/MacOS
+	mkdir -p $(bundle_name)/Contents/Resources
+	echo "APPL????" > $(bundle_name)/Contents/PkgInfo
+	cp $(srcdir)/dists/macosx/Info.plist $(bundle_name)/Contents/
+	cp $(srcdir)/gui/media/*.* $(bundle_name)/Contents/Resources
+	cp scummvm-tools-static $(bundle_name)/Contents/MacOS/scummvm-tools
+
+# Special target to create a snapshot disk image for Mac OS X
+osxsnap: bundle scummvm-tools-cli-static
+	mkdir ScummVM-Tools-snapshot
+	cp $(srcdir)/COPYING ./ScummVM-Tools-snapshot/License\ \(GPL\)
+	cp $(srcdir)/NEWS ./ScummVM-Tools-snapshot/News
+	cp $(srcdir)/README ./ScummVM-Tools-snapshot/ScummVM\ ReadMe
+	$(XCODETOOLSPATH)/SetFile -t ttro -c ttxt ./ScummVM-Tools-snapshot/*
+	$(XCODETOOLSPATH)/CpMac -r $(bundle_name) ./ScummVM-Tools-snapshot/
+	cp scummvm-tools-cli-static ./ScummVM-Tools-snapshot/scummvm-tools-cli
+	cp $(srcdir)/dists/macosx/DS_Store ./ScummVM-Tools-snapshot/.DS_Store
+	$(XCODETOOLSPATH)/SetFile -a V ./ScummVM-Tools-snapshot/.DS_Store
+	hdiutil create -ov -format UDZO -imagekey zlib-level=9 -fs HFS+ \
+					-srcfolder ScummVM-Tools-snapshot \
+					-volname "ScummVM Tools" \
+					ScummVM-Tools-snapshot.dmg
+	rm -rf ScummVM-snapshot
+
+
 #
 # AmigaOS specific
 #
diff --git a/NEWS b/NEWS
index edeb8ca..fa56aa6 100644
--- a/NEWS
+++ b/NEWS
@@ -1,6 +1,9 @@
 For a more comprehensive changelog of the latest experimental code, see:
         https://github.com/scummvm/scummvm-tools/commits/
 
+1.9.0 (2016-10-27)
+ - Fix random crashes in the tool to convert Broken Sword 1 speech files.
+
 1.8.0 (2016-03-04)
  - Add a tool to compress Tony Tough's ADP files.
  - Add extraction and packing tools for The Prince and the Coward.
diff --git a/configure b/configure
index 08fb8e9..abbd1e6 100755
--- a/configure
+++ b/configure
@@ -85,6 +85,7 @@ _debug_build=auto
 _release_build=auto
 _verbose_build=no
 _enable_prof=no
+_use_cxx11=yes
 # Default commands
 _ranlib=ranlib
 _strip=strip
@@ -96,8 +97,11 @@ _wxpath="$PATH"
 _prefix=/usr/local
 _wxincludes=""
 _wxlibs=""
+_wxstaticlibs=""
 _freetypeincludes=""
 _freetypelibs=""
+_staticlibpath=""
+_xcodetoolspath=""
 _amigaos4path="Games:ScummVM-Tools"
 
 # For cross compiling
@@ -332,6 +336,7 @@ Special configuration feature:
   --host=HOST             cross-compile to target HOST (arm-linux, ...)
 
 Optional Features:
+  --disable-c++11          disable building as C++11 when the compiler allows that
   --disable-debug          disable building with debugging symbols
   --enable-Werror          treat warnings as errors
   --enable-profiling       enable profiling
@@ -448,12 +453,24 @@ for ac_option in $@; do
 		BOOST_CFLAGS="-I$arg/include"
 		BOOST_LIBS="-L$arg/lib"
 		;;
+	--with-staticlib-prefix=*)
+		_staticlibpath=`echo $ac_option | cut -d '=' -f 2`
+		;;
+	--with-xcodetools-path=*)
+		_xcodetoolspath=`echo $ac_option | cut -d '=' -f 2`
+		;;
 	--enable-debug)
 		_debug_build=yes
 		;;
 	--disable-debug)
 		_debug_build=no
 		;;
+	--enable-c++11)
+		_use_cxx11=yes
+		;;
+	--disable-c++11)
+		_use_cxx11=no
+		;;
 	--enable-Werror)
 		CXXFLAGS="$CXXFLAGS -Werror"
 		;;
@@ -837,7 +854,7 @@ else
 		solaris*)
 			cxx_version=`( $CXX -V ) 2>&1`
 			cxx_version="`echo "${cxx_version}" | sed 's/.*\([0-9][0-9]*\.[0-9][0-9]*\).*/\1/'`"
-			
+
 			case $cxx_version in
 				5.1[0-2])
 					cxx_verc_fail=no
@@ -867,33 +884,64 @@ else
 fi
 
 #
+# Check whether the compiler supports C++11
+#
+have_cxx11=no
+cat > $TMPC << EOF
+int main(int argc, char *argv[]) { if (argv == nullptr) return -1; else return 0; }
+EOF
+cc_check -std=c++11 && have_cxx11=yes
+if test "$_use_cxx11" = "yes" ; then
+	_use_cxx11=$have_cxx11
+fi
+
+#
 # Setup compiler specific CXXFLAGS now that we know the compiler version.
 # Foremost, this means enabling various warnings.
 # In addition, we set CXX_UPDATE_DEP_FLAG for GCC >= 3.0 and for ICC.
 #
 if test "$have_gcc" = yes ; then
 	if test "$_cxx_major" -ge "3" ; then
-		case $_host_os in
-		# newlib-based system include files suppress non-C89 function
-		# declarations under __STRICT_ANSI__
-		amigaos* | android | dreamcast | ds | gamecube | mingw* | n64 | psp | ps2 | wii | wince )
-			;;
-		*)
-			CXXFLAGS="$CXXFLAGS -ansi"
-			;;
-		esac
+		# Try to use ANSI mode when C++11 is disabled.
+		if test "$_use_cxx11" = "no" ; then
+			case $_host_os in
+			# newlib-based system include files suppress non-C89 function
+			# declarations under __STRICT_ANSI__
+			amigaos* | android | dreamcast | ds | gamecube | mingw* | n64 | psp | ps2 | wii | wince )
+				;;
+			*)
+				CXXFLAGS="$CXXFLAGS -ansi"
+				;;
+			esac
+		fi
 		CXXFLAGS="$CXXFLAGS -W -Wno-unused-parameter"
 		add_line_to_config_mk 'HAVE_GCC3 = 1'
 		add_line_to_config_mk 'CXX_UPDATE_DEP_FLAG = -MMD -MF "$(*D)/$(DEPDIR)/$(*F).d" -MQ "$@" -MP'
-	fi;
+	fi
 
 	if test "$_cxx_major" -eq 4 && test "$_cxx_minor" -ge 3 || \
 	   test "$_cxx_major" -gt 4 ; then
 		CXXFLAGS="$CXXFLAGS -Wno-empty-body"
 	else
 		CXXFLAGS="$CXXFLAGS -Wconversion"
-	fi;
-fi;
+	fi
+fi
+
+echo_n "Building as C++11... "
+if test "$_use_cxx11" = "yes" ; then
+	case $_host_os in
+	# newlib-based system include files suppress non-C89 function
+	# declarations under __STRICT_ANSI__
+	amigaos* | android | dreamcast | ds | gamecube | mingw* | n64 | psp | ps2 | wii | wince )
+		_use_cxx11=no
+		;;
+	*)
+		CXXFLAGS="$CXXFLAGS -std=c++11"
+		;;
+	esac
+fi
+echo $_use_cxx11
+
 
 # By default, we add -pedantic to the CXXFLAGS to catch some potentially
 # non-portable constructs, like use of GNU extensions.
@@ -1044,7 +1092,6 @@ echo_n "Checking hosttype... "
 echo $_host_os
 case $_host_os in
 	amigaos*)
-		LDFLAGS="$LDFLAGS -use-dynld"
 		LDFLAGS="$LDFLAGS -L/sdk/local/newlib/lib"
 		# We have to use 'long' for our 4 byte typedef because AmigaOS already typedefs (u)int32
 		# as (unsigned) long, and consequently we'd get a compiler error otherwise.
@@ -1089,6 +1136,78 @@ case $_host_os in
 
 			LDFLAGS="-L${macport_prefix}/lib $LDFLAGS"
 			CXXFLAGS="-I${macport_prefix}/include $CXXFLAGS"
+
+			if test -z "$_staticlibpath"; then
+				_staticlibpath=${macport_prefix}
+				echo "Set staticlib-prefix to ${_staticlibpath}"
+			fi
+		fi
+
+		# Fink
+		# There is no way to get the prefix, so implementing a hack here
+		fink_version=`fink -V 2>/dev/null`
+		if test "$?" -eq 0; then
+			fink_version="`echo "${fink_version}" | sed -ne 's/Package manager version: \([0-9.]*\)/\1/gp'`"
+			echo_n "You seem to be running Fink version ${fink_version}..."
+
+			fink_prefix=`which fink`
+			# strip off /bin/fink from /sw/bin/port
+			fink_prefix=`dirname ${fink_prefix}`
+			fink_prefix=`dirname ${fink_prefix}`
+
+			echo "adding ${fink_prefix} to paths"
+
+			LDFLAGS="-L${fink_prefix}/lib $LDFLAGS"
+			CXXFLAGS="-I${fink_prefix}/include $CXXFLAGS"
+
+			if test -z "$_staticlibpath"; then
+				_staticlibpath=${fink_prefix}
+				echo "Set staticlib-prefix to ${_staticlibpath}"
+			fi
+		fi
+
+		# Homebrew
+		brew_version=`brew -v 2>/dev/null`
+		if test "$?" -eq 0; then
+			brew_version="`echo "${brew_version}" | sed -ne 's/Homebrew \([0-9.]*\)/\1/gp'`"
+			echo_n "You seem to be running Homebrew version ${brew_version}..."
+
+			brew_prefix=`brew --prefix`
+
+			echo "adding ${brew_prefix} to paths"
+
+			LDFLAGS="-L${brew_prefix}/lib $LDFLAGS"
+			CXXFLAGS="-I${brew_prefix}/include $CXXFLAGS"
+
+			if test -z "$_staticlibpath"; then
+				_staticlibpath=${brew_prefix}
+				echo "Set staticlib-prefix to ${_staticlibpath}"
+			fi
+		fi
+
+		# If _staticlibpath is not set yet try first /sw (fink) then /usr/local
+		# (the macports case is handled above).
+		if test -z "$_staticlibpath"; then
+			if test -d "/sw"; then
+				_staticlibpath=/sw
+				echo "Set staticlib-prefix to ${_staticlibpath}"
+			elif test -d "/usr/local"; then
+				_staticlibpath=/usr/local
+				echo "Set staticlib-prefix to ${_staticlibpath}"
+			else
+				echo "Could not determine prefix for static libraries"
+			fi
+		fi
+
+		# If _xcodetoolspath is not set yet use xcode-select to get the path
+		if test -z "$_xcodetoolspath"; then
+			_xcodetoolspath=`xcode-select -print-path`/Tools
+			if test -d "$_xcodetoolspath"; then
+				echo "Set xcodetools-path to ${_xcodetoolspath}"
+			else
+				_xcodetoolspath=
+				echo "Could not determine path for Xcode Tools"
+			fi
 		fi
 		;;
 	freebsd*)
@@ -1542,6 +1661,11 @@ fi
 if test "$_wxwidgets" = yes ; then
 	_wxincludes="`$_wxconfig --prefix="$_wxpath" --cflags`"
 	_wxlibs="`$_wxconfig --prefix="$_wxpath" --libs`"
+	_wxstaticlibs="`$_wxconfig --prefix="$_wxpath" --static --libs 2> /dev/null`"
+	_wxstaticlibs=`echo $_wxstaticlibs | sed 's|-lpng||' | sed 's|-lz||'`
+	# _wxstaticlibs may contain non-static libraries that we also have in _wxstaticlibs.
+	# remove those to avoid dependency on non-static libraries
+
 	# Use the compiler specified by wx-config. This is needed on some systems to get a working executable.
 	CXX="`$_wxconfig --cxx`"
 	LD=$CXX
@@ -1575,6 +1699,7 @@ EOF
 	if test "$has_wx_gui_dev" = no ; then
 		_wxincludes=""
 		_wxlibs=""
+		_wxstaticlibs=""
 		_wxwidgets=no
 		echo "not found"
 	else
@@ -1649,6 +1774,7 @@ WINDRESFLAGS := $WINDRESFLAGS
 WIN32PATH=$_win32path
 AMIGAOS4PATH=$_amigaos4path
 STATICLIBPATH=$_staticlibpath
+XCODETOOLSPATH=$_xcodetoolspath
 
 EXEEXT := $HOSTEXEEXT
 
@@ -1667,6 +1793,7 @@ LDFLAGS += $LDFLAGS
 
 WXINCLUDES := $_wxincludes
 WXLIBS := $_wxlibs
+WXSTATICLIBS := $_wxstaticlibs
 
 FREETYPEINCLUDES := $_freetypeincludes
 FREETYPELIBS := $_freetypelibs
diff --git a/decompiler/test/codegen.h b/decompiler/test/codegen.h
index c28aff8..4e03f39 100644
--- a/decompiler/test/codegen.h
+++ b/decompiler/test/codegen.h
@@ -51,7 +51,7 @@ public:
 	std::basic_ios<cT, traits>(&m_sbuf),
 	std::basic_ostream<cT, traits>(&m_sbuf)
 	{
-		init(&m_sbuf);
+		this->init(&m_sbuf);
 	}
 
 private:
diff --git a/dists/macosx/DS_Store b/dists/macosx/DS_Store
new file mode 100644
index 0000000..76cd99a
Binary files /dev/null and b/dists/macosx/DS_Store differ
diff --git a/dists/macosx/Info.plist b/dists/macosx/Info.plist
index 73f4596..ded451f 100644
--- a/dists/macosx/Info.plist
+++ b/dists/macosx/Info.plist
@@ -9,7 +9,7 @@
 	<key>CFBundleExecutable</key>
 	<string>scummvm-tools</string>
 	<key>CFBundleGetInfoString</key>
-	<string>1.8.0, Copyright 2001-2016 The ScummVM team</string>
+	<string>1.9.0, Copyright 2001-2016 The ScummVM team</string>
 	<key>CFBundleIconFile</key>
 	<string>scummvmtools.icns</string>
 	<key>CFBundleIdentifier</key>
@@ -21,9 +21,9 @@
 	<key>CFBundlePackageType</key>
 	<string>APPL</string>
 	<key>CFBundleShortVersionString</key>
-	<string>1.8.0</string>
+	<string>1.9.0</string>
 	<key>CFBundleVersion</key>
-	<string>1.8.0</string>
+	<string>1.9.0</string>
 	<key>NSAppleScriptEnabled</key>
 	<false/>
 	<key>NSHumanReadableCopyright</key>
diff --git a/dists/scummvmtools.rc b/dists/scummvmtools.rc
index e9422d6..87b7fe5 100644
--- a/dists/scummvmtools.rc
+++ b/dists/scummvmtools.rc
@@ -10,8 +10,8 @@
 IDI_ICON               ICON    DISCARDABLE     "gui/media/scummvmtools.ico"
 
 VS_VERSION_INFO VERSIONINFO
- FILEVERSION     1,8,0,0
- PRODUCTVERSION  1,8,0,0
+ FILEVERSION     1,9,0,0
+ PRODUCTVERSION  1,9,0,0
  FILEFLAGSMASK   VS_FFI_FILEFLAGSMASK
 #ifdef _DEBUG
  FILEFLAGS       VS_FF_DEBUG
@@ -28,13 +28,13 @@ BEGIN
         BEGIN
             VALUE "Comments", "Look! A three headed monkey (TM)! .. Nice use of the TM!\0"
             VALUE "FileDescription", "http://www.scummvm.org/\0"
-            VALUE "FileVersion", "1.8.0\0"
+            VALUE "FileVersion", "1.9.0\0"
             VALUE "InternalName", "scummvm\0"
             VALUE "LegalCopyright", "Copyright � 2001-2016 The ScummVM Team\0"
             VALUE "LegalTrademarks", "'SCUMM', and all SCUMM games are a TM of LucasArts. Simon The Sorcerer is a TM of AdventureSoft. Beneath a Steel Sky and Broken Sword are a TM of Revolution. Flight of the Amazon Queen is a TM of John Passfield and Steve Stamatiadis. \0"
             VALUE "OriginalFilename", "scummvm-tools.exe\0"
             VALUE "ProductName", "ScummVM Tools\0"
-            VALUE "ProductVersion", "1.8.0\0"
+            VALUE "ProductVersion", "1.9.0\0"
         END
     END
 
diff --git a/dists/win32/scummvm-tools.nsi b/dists/win32/scummvm-tools.nsi
index 5691c69..c41d50a 100644
--- a/dists/win32/scummvm-tools.nsi
+++ b/dists/win32/scummvm-tools.nsi
@@ -61,7 +61,7 @@ Name "ScummVM Tools"
 # General Symbol Definitions
 #########################################################################################
 !define REGKEY      "Software\ScummVM\$(^Name)"
-!define VERSION     "1.8.0"
+!define VERSION     "1.9.0"
 !define COMPANY     "ScummVM Team"
 !define URL         "http://scummvm.org/"
 !define DESCRIPTION "ScummVM Tools Installer. Look! A three headed monkey (TM)!"
@@ -81,7 +81,7 @@ XPStyle  on
 #TargetMinimalOS 5.0    ; Minimal version of windows for installer: Windows 2000 or more recent
                         ; (will build unicode installer with NSIS 2.50+)
 
-VIProductVersion 1.8.0.0
+VIProductVersion 1.9.0.0
 VIAddVersionKey  ProductName      $(^Name)
 VIAddVersionKey  ProductVersion  "${VERSION}"
 VIAddVersionKey  CompanyName     "${COMPANY}"
diff --git a/engines/pegasus/pegasus_save_types.cpp b/engines/pegasus/pegasus_save_types.cpp
index 47af63b..b8258c1 100755
--- a/engines/pegasus/pegasus_save_types.cpp
+++ b/engines/pegasus/pegasus_save_types.cpp
@@ -76,7 +76,7 @@ int main(int argc, char **argv) {
 	FSCatalogInfo catInfo;
 	FSRef ref;
 
-	if (!FSPathMakeRef((const UInt8 *)argv[1], &ref, false)) {
+	if (!FSPathMakeRef((const UInt8 *)argv[1], &ref, 0)) {
 		FSGetCatalogInfo(&ref, kFSCatInfoFinderInfo, &catInfo, 0, 0, 0);
 		FileInfo *info = (FileInfo *)catInfo.finderInfo;
 		info->fileCreator = creator;
diff --git a/engines/scumm/descumm.cpp b/engines/scumm/descumm.cpp
index 749c55b..a7fafeb 100644
--- a/engines/scumm/descumm.cpp
+++ b/engines/scumm/descumm.cpp
@@ -1561,11 +1561,70 @@ void do_if_active_object(char *buf, byte opcode) {
 	char tmp[256];
 
 	int obj = get_byte();
+	if (opcode & 0x80)
+		obj |= 0x100;
+
 	sprintf(tmp, "activeObject2 == %d", obj);
 
 	emit_if(buf, tmp);
 }
 
+void do_walk_actor_to_object(char *buf, byte opcode) {
+	
+	buf += sprintf(buf, "walkActorToObject(");
+	buf = add_a_tok(buf, (opcode & 0x80) ? A1V : A1B);
+
+	int obj = get_byte();
+	if (opcode & 0x40)
+		obj |= 0x100;
+
+	sprintf(buf, ",%d);", obj);
+}
+
+void do_put_actor_at_object(char *buf, byte opcode) {
+
+	buf += sprintf(buf, "putActorAtObject(");
+	buf = add_a_tok(buf, (opcode & 0x80) ? A1V : A1B);
+
+	int obj = get_byte();
+	if (opcode & 0x40)
+		obj |= 0x100;
+
+	sprintf(buf, ",%d);", obj);
+}
+
+void do_sentence(char *buf, byte opcode) {
+	int verb = get_byte();
+	int obj1 = get_byte();
+	int obj2 = get_byte();
+
+	// Not _cmdObject / _cmdObject2
+	if (obj1 != 0xFF && obj1 != 0xFE) {
+		if(opcode & 0x80)
+			obj1 |= 0x100;
+	}
+	// Not _cmdObject / _cmdObject2
+	if (obj2 != 0xFF && obj2 != 0xFE) {
+		if (opcode & 0x40)
+			obj2 |= 0x100;
+	}
+
+	sprintf(buf, "doSentence(%d,%d,%d);", verb, obj1, obj2);
+}
+
+
+void do_set_object_name(char *buf, byte opcode) {
+	int obj = get_byte();
+
+	if (opcode & 0x40)
+		obj |= 0x100;
+
+	buf += sprintf(buf, "setObjectName(%d,", obj);
+	buf = add_a_tok(buf, A1B | A1ASCII);
+
+	sprintf(buf, ");", obj);
+}
+
 void do_if_state_code(char *buf, byte opcode) {
 	char var[256];
 	char tmp[256], tmp2[256];
@@ -2616,7 +2675,7 @@ void next_line_V0(char *buf) {
 	case 0x43:
 	case 0x83:
 	case 0xC3:
-		do_tok(buf, "doSentence", A1B | A2B | A3B);
+		do_sentence(buf, opcode);
 		break;
 	case 0x07:
 	case 0x87:
@@ -2791,7 +2850,7 @@ void next_line_V0(char *buf) {
 	case 0xCE:
 	case 0x0E:
 	case 0x8E:
-		do_tok(buf, "putActorAtObject", ((opcode & 0x80) ? A1V : A1B) | A2B);
+		do_put_actor_at_object(buf, opcode);
 		break;
 	case 0x0C:
 	case 0x8C:
@@ -2824,7 +2883,7 @@ void next_line_V0(char *buf) {
 
 	case 0x54:
 	case 0xD4:
-		do_tok(buf, "setObjectName", A1B | A2ASCII);
+		do_set_object_name(buf, opcode);
 		break;
 
 	case 0x29:
@@ -2891,7 +2950,7 @@ void next_line_V0(char *buf) {
 	case 0xB6:
 	case 0x76:
 	case 0xF6:
-		do_tok(buf, "walkActorToObject", ((opcode & 0x80) ? A1V : A1B) | A2B);
+		do_walk_actor_to_object(buf, opcode);
 		break;
 
 	default:
diff --git a/engines/scumm/descumm6.cpp b/engines/scumm/descumm6.cpp
index 45fc357..cfc8fad 100644
--- a/engines/scumm/descumm6.cpp
+++ b/engines/scumm/descumm6.cpp
@@ -375,8 +375,8 @@ const char *var_names72[] = {
 	/* 36 */
 	"VAR_CUTSCENE_START_SCRIPT",
 	"VAR_CUTSCENE_END_SCRIPT",
-	NULL,
-	NULL,
+	"VAR_SAVELOAD_ENTER_SCRIPT",
+	"VAR_SAVELOAD_EXIT_SCRIPT",
 	/* 40 */
 	"VAR_SAVELOAD_SCRIPT",
 	"VAR_OPTIONS_SCRIPT",
@@ -429,9 +429,9 @@ const char *var_names72[] = {
 	"VAR_PLATFORM_VERSION",
 	/* 80 */
 	"VAR_CURRENT_CHARSET",
-	NULL,
-	NULL,
-	NULL,
+	"VAR_HIDE_ALL_TEXT",
+	"VAR_NO_SPEECH",
+	"VAR_MOUSE_OVERRIDE",
 	/* 84 */
 	"VAR_SOUNDCODE_TMR",
 	"VAR_DEBUG_ENABLED",
@@ -441,20 +441,20 @@ const char *var_names72[] = {
 	"VAR_NUM_SOUND_CHANNELS",
 	"VAR_COLOR_DEPTH",
 	NULL,
-	NULL,
+	"VAR_PRINTING_ENABED",
 	/* 92 */
-	NULL,
-	NULL,
-	NULL,
+	"VAR_FADE_COLOR",
+	"VAR_BLACK_COLOR",
+	"VAR_WHITE_COLOR",
 	"VAR_REDRAW_ALL_ACTORS",
 	/* 96 */
 	"VAR_TIMER_1",
 	"VAR_TIMER_2",
-	NULL,
-	NULL,
+	"VAR_NETWORK_START_SCRIPT",
+	"VAR_NETWORK_TIMEOUT",
 	/* 100 */
-	NULL,
-	NULL,
+	"VAR_NETWORK_ENABLED",
+	"VAR_NETWORK_ARRAY_SCRIPT",
 	NULL,
 	"VAR_SCRIPT_CYCLE",
 	/* 104 */
@@ -476,7 +476,7 @@ const char *var_names72[] = {
 	"VAR_U32_ARRAY_UNK",
 	"VAR_WIZ_TCOLOR",
 	"VAR_SMACKER_ENABLED",
-	NULL,
+	"VAR_ERROR_CODE",
 	/* 120 */
 	"VAR_RESERVED_SOUND_CHANNELS",
 	NULL,
@@ -485,13 +485,13 @@ const char *var_names72[] = {
 	/* 124 */
 	"VAR_JOYSTICK_DETECTED",
 	"VAR_SKIP_RESET_TALK_ACTOR",
-	NULL,
+	"VAR_UPDATE_SCREEN_TYPE",
 	"VAR_MAIN_SCRIPT",
 	/* 128 */
 	"VAR_JOYSTICK_DISABLED",
-	NULL,
+	"VAR_BASE_NAME",
 	"VAR_NUM_PALETTES",
-	"VAR_NUM_UNK",
+	"VAR_NUM_WINDOWS",
 	/* 132 */
 	NULL,
 	NULL,
@@ -2091,21 +2091,21 @@ void next_line_HE_V100(char *output) {
 		ext(output, "p|delaySeconds");
 		break;
 	case 0x77:
-		ext(output, "x" "startSound\0"
-				"\x6p|setSoundFlag16,"
+		ext(output, "x" "soundOps\0"
+				"\x6p|setOffset,"
 				"\x2Fhp|loadSoundFromFile,"
-				"\x37|setQuickStartFlag,"
+				"\x37|setQuickStart,"
 				"\x53ppp|setSoundVar,"
 				"\x5C|start,"
-				"\x80|setForceQueueFlag,"
+				"\x80|setAppend,"
 				"\x81p|setChannel,"
-				"\x82p|setSoundFlag64,"
-				"\x83|setSoundFlag1,"
+				"\x82p|setFrequency,"
+				"\x83|setLoop,"
 				"\x84p|setMusicId,"
-				"\x85p|setSoundFlag128,"
+				"\x85p|setPan,"
 				"\x86p|setSoundId,"
-				"\x87|setSoundFlag4,"
-				"\x88p|setSoundFlag32");
+				"\x87|setSoftSound,"
+				"\x88p|setVolume");
 		break;
 	case 0x79:
 		ext(output, "x" "setSpriteInfo\0"
@@ -3276,17 +3276,17 @@ void next_line_HE_V72(char *output) {
 		jump(output);
 		break;
 	case 0x74:
-		ext(output, "x" "startSound\0"
-				"\x9|setSoundFlag4,"
+		ext(output, "x" "soundOps\0"
+				"\x9|setSoftSound,"
 				"\x17ppp|setSoundVar,"
-				"\x19pp|startWithFlag8,"
-				"\x38|setQuickStartFlag,"
-				"\xA4|setForceQueueFlag,"
+				"\x19pp|setVolume,"
+				"\x38|setQuickStart,"
+				"\xA4|setAppend,"
 				"\xDE|dummy,"
 				"\xE0p|setFrequency,"
 				"\xE6p|setChannel,"
 				"\xE7p|setOffset,"
-				"\xE8p|setId,"
+				"\xE8p|setSoundId,"
 				"\xF5|setLoop,"
 				"\xFF|start");
 		break;
diff --git a/engines/sword1/compress_sword1.cpp b/engines/sword1/compress_sword1.cpp
index ef8bd73..e454f8c 100644
--- a/engines/sword1/compress_sword1.cpp
+++ b/engines/sword1/compress_sword1.cpp
@@ -311,14 +311,15 @@ MusicFile musicNames[TOTAL_TUNES] = {
 	{ "RM3D", false }
 };
 
-int16 *CompressSword1::uncompressSpeech(Common::File &clu, uint32 idx, uint32 cSize, uint32 *returnSize) {
+int16 *CompressSword1::uncompressSpeech(Common::File &clu, uint32 idx, uint32 cSize, uint32 *returnSize, bool* ok) {
 	if (_speechEndianness == UnknownEndian) {
 		uint32 leSize, beSize;
+		bool leOk = false, beOk = false;
 		_speechEndianness = LittleEndian;
-		int16* leData = uncompressSpeech(clu, idx, cSize, &leSize);
+		int16* leData = uncompressSpeech(clu, idx, cSize, &leSize, &leOk);
 		_speechEndianness = BigEndian;
-		int16* beData = uncompressSpeech(clu, idx, cSize, &beSize);
-		_speechEndianness = guessEndianness(leData, leSize / 2, beData, beSize / 2);
+		int16* beData = uncompressSpeech(clu, idx, cSize, &beSize, &beOk);
+		_speechEndianness = guessEndianness(leData, leSize / 2, leOk, beData, beSize / 2, beOk);
 		switch (_speechEndianness) {
 		case LittleEndian:
 			free(beData);
@@ -339,8 +340,8 @@ int16 *CompressSword1::uncompressSpeech(Common::File &clu, uint32 idx, uint32 cS
 		}
 	}
 	
-	uint32 resSize, srcPos;
-	int16 *srcData, *dstData, *dstPos;
+	uint32 resSize, srcPos, dstPos;
+	int16 *srcData, *dstData;
 	uint32 headerPos = 0;
 	int16 length, cnt;
 	uint8 *fBuf = (uint8 *)malloc(cSize);
@@ -350,13 +351,15 @@ int16 *CompressSword1::uncompressSpeech(Common::File &clu, uint32 idx, uint32 cS
 	while ((READ_BE_UINT32(fBuf + headerPos) != 'data') && (headerPos < 100))
 		headerPos++;
 	if (headerPos < 100) {
+		if (ok != 0)
+			*ok = true;
 		resSize = READ_LE_UINT32(fBuf + headerPos + 4) >> 1;
 		srcData = (int16 *)(fBuf + headerPos + 8);
 		dstData = (int16 *)malloc(resSize * 2);
 		srcPos = 0;
-		dstPos = dstData;
+		dstPos = 0;
 		cSize = (cSize - (headerPos + 8)) / 2;
-		while (srcPos < cSize) {
+		while (srcPos < cSize && dstPos < resSize) {
 			if (_speechEndianness == LittleEndian)
 				length = (int16)READ_LE_UINT16(srcData + srcPos);
 			else
@@ -364,19 +367,32 @@ int16 *CompressSword1::uncompressSpeech(Common::File &clu, uint32 idx, uint32 cS
 			srcPos++;
 			if (length < 0) {
 				length = -length;
-				for (cnt = 0; cnt < (uint16)length; cnt++)
-					*dstPos++ = srcData[srcPos];
+				for (cnt = 0; cnt < (uint16)length && dstPos < resSize; cnt++)
+					dstData[dstPos++] = srcData[srcPos];
 				srcPos++;
+				if (ok != 0 && cnt < (uint16)length)
+					*ok = false;
 			} else {
-				memcpy(dstPos, srcData + srcPos, length * 2);
+				if (dstPos + length > resSize) {
+					length = resSize - dstPos;
+					if (ok != 0)
+						*ok = false;
+				}
+				memcpy(dstData + dstPos, srcData + srcPos, length * 2);
 				dstPos += length;
 				srcPos += length;
 			}
 		}
+		// The ok flag is used when detecting endianness. If the correct endianness was used then decoding cSize samples
+		// should result in the expected resSize. But when using the wrong endianness this is likely not to be the case.
+		if (ok != 0 && (srcPos < cSize || dstPos < resSize))
+			*ok = false;
 		free(fBuf);
 		*returnSize = resSize * 2;
 		return dstData;
 	} else {
+		if (ok != 0)
+			*ok = false;
 		free(fBuf);
 		error("Sound::uncompressSpeech(): DATA tag not found in wave header");
 		*returnSize = 0;
@@ -384,7 +400,7 @@ int16 *CompressSword1::uncompressSpeech(Common::File &clu, uint32 idx, uint32 cS
 	}
 }
 
-CompressSword1::Endianness CompressSword1::guessEndianness(int16 *leData, uint32 leSize, int16 *beData, uint32 beSize) {
+CompressSword1::Endianness CompressSword1::guessEndianness(int16 *leData, uint32 leSize, bool leOk, int16 *beData, uint32 beSize, bool beOk) {
 	if (leData == NULL && beData == NULL)
 		return UnknownEndian;
 	else if (leData == NULL)
@@ -392,6 +408,14 @@ CompressSword1::Endianness CompressSword1::guessEndianness(int16 *leData, uint32
 	else if (beData == NULL)
 		return LittleEndian;
 	
+	// Also decomding with the wrong endianness leads to wrong sizes when decrompressing the data. So if one of the two is wrong assume
+	// this indicates this was the wrong endianess. In the case when the two are wrong this indicate corrupetd data but try to recover
+	// from it anyway.
+	if (leOk && !beOk)
+		return LittleEndian;
+	else if (!leOk && beOk)
+		return BigEndian;
+	
 	// Compute average of difference between two consecutive samples for both the given
 	// data array and the byte swapped array.
 	uint32 length = leSize > beSize ? beSize : leSize;
diff --git a/engines/sword1/compress_sword1.h b/engines/sword1/compress_sword1.h
index 7321d50..28f091a 100644
--- a/engines/sword1/compress_sword1.h
+++ b/engines/sword1/compress_sword1.h
@@ -42,7 +42,7 @@ protected:
 
 	std::string _audioOuputFilename;
 
-	int16 *uncompressSpeech(Common::File &clu, uint32 idx, uint32 cSize, uint32 *returnSize);
+	int16 *uncompressSpeech(Common::File &clu, uint32 idx, uint32 cSize, uint32 *returnSize, bool* ok = 0);
 	uint8 *convertData(uint8 *rawData, uint32 rawSize, uint32 *resSize);
 	void convertClu(Common::File &clu, Common::File &cl3);
 	void compressSpeech(const Common::Filename *inpath, const Common::Filename *outpath);
@@ -50,7 +50,7 @@ protected:
 	void checkFilesExist(bool checkSpeech, bool checkMusic, const Common::Filename *inpath);
 
 	enum Endianness { BigEndian , LittleEndian , UnknownEndian } ;
-	Endianness guessEndianness(int16 *leData, uint32 leSize, int16 *beData, uint32 beSize);
+	Endianness guessEndianness(int16 *leData, uint32 leSize, bool leOk, int16 *beData, uint32 beSize, bool beOk);
 	double endiannessHeuristicValue(int16* data, uint32 dataSize, uint32 maxSamples, Endianness dataEndianness);
 
 private:
diff --git a/internal_version.h b/internal_version.h
index ab7f855..4bbab3d 100644
--- a/internal_version.h
+++ b/internal_version.h
@@ -2,4 +2,4 @@
 #define SCUMMVM_TOOLS_SVN_REVISION
 #endif
 
-#define SCUMMVM_TOOLS_VERSION "1.8.0" SCUMMVM_TOOLS_SVN_REVISION
+#define SCUMMVM_TOOLS_VERSION "1.9.0" SCUMMVM_TOOLS_SVN_REVISION

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/scummvm-tools.git



More information about the Pkg-games-commits mailing list