[scummvm-tools] 01/01: Imported Upstream version 1.8.0
Stephen Kitt
skitt at moszumanska.debian.org
Fri Mar 18 12:45:10 UTC 2016
This is an automated email from the git hooks/post-receive script.
skitt pushed a commit to branch upstream
in repository scummvm-tools.
commit b728186f83a1a5348971c52f63374c63cfec4bcb
Author: Stephen Kitt <steve at sk2.org>
Date: Fri Mar 18 13:35:14 2016 +0100
Imported Upstream version 1.8.0
---
COPYRIGHT | 2 +-
Makefile | 52 +-
Makefile.common | 4 +
NEWS | 6 +
common/scummsys.h | 43 +-
common/util.cpp | 4 -
compress.cpp | 8 +-
configure | 33 +-
convert_dxa.bat | 2 +-
convert_dxa.sh | 2 +-
create_sjisfnt.cpp | 2 +-
dists/macosx/Info.plist | 8 +-
dists/macosx/Info.plist.in | 4 +-
dists/msvc10/toolscli.vcxproj | 6 +-
dists/msvc10/toolscli.vcxproj.filters | 14 +-
dists/msvc9/ScummVMTools_Global.vsprops | 18 +
dists/msvc9/degob.vcproj | 10 +-
dists/msvc9/tools.sln | 2 +-
dists/msvc9/toolscli.vcproj | 84 +-
dists/msvc9/toolsgui.vcproj | 180 ++--
dists/scummvmtools.rc | 10 +-
dists/scummvmtools.rc.in | 2 +-
dists/win32/ScummVM Tools.iss | 2 +-
dists/win32/scummvm-tools.nsi | 6 +-
dists/win32/scummvm-tools.nsi.in | 2 +-
engines/gob/degob_script.cpp | 4 -
engines/gob/degob_script_littlered.cpp | 13 +-
engines/gob/extract_gob_stk.cpp | 14 +-
engines/gob/extract_gob_stk.h | 2 +
engines/kyra/dekyra.cpp | 4 +-
engines/mohawk/utils/file.cpp | 9 +-
engines/mohawk/utils/file.h | 9 +-
engines/mohawk/utils/stream.h | 11 +-
engines/prince/extract_prince.cpp | 794 ++++++++++++++++++
.../compress_sword1.h => prince/extract_prince.h} | 69 +-
engines/prince/pack_prince.cpp | 932 +++++++++++++++++++++
.../extract_gob_stk.h => prince/pack_prince.h} | 52 +-
engines/scumm/descumm.cpp | 2 +
engines/sword1/compress_sword1.cpp | 80 +-
engines/sword1/compress_sword1.h | 6 +-
engines/tony/compress_tony.cpp | 226 +++++
.../extract_gob_stk.h => tony/compress_tony.h} | 32 +-
engines/tony/compress_tony_vdb.cpp | 251 ++++++
.../extract_gob_stk.h => tony/compress_tony_vdb.h} | 38 +-
gui/main.cpp | 2 +-
gui/pages.cpp | 4 +-
internal_version.h | 2 +-
sound/audiostream.h | 2 +-
tool.cpp | 6 +
tools.cpp | 8 +
50 files changed, 2768 insertions(+), 310 deletions(-)
diff --git a/COPYRIGHT b/COPYRIGHT
index 6bcf7dd..ebeb385 100644
--- a/COPYRIGHT
+++ b/COPYRIGHT
@@ -1,5 +1,5 @@
ScummVM Tools
-Copyright (C) 2001-2014 by the following:
+Copyright (C) 2001-2016 by the following:
If you have contributed to this project then you deserve to be on this
list. Contact us and we'll add you.
diff --git a/Makefile b/Makefile
index cc56f59..afc4473 100644
--- a/Makefile
+++ b/Makefile
@@ -172,36 +172,36 @@ endif
#
# Special target to create an AmigaOS snapshot installation
-aos4dist: all
- mkdir -p $(AOS4PATH)
- mkdir -p $(AOS4PATH)/graphics
- mkdir -p $(AOS4PATH)/tools
- mkdir -p $(AOS4PATH)/tools/media
- cp $(srcdir)/gui/media/detaillogo.jpg $(AOS4PATH)/tools/media/
- cp $(srcdir)/gui/media/logo.jpg $(AOS4PATH)/tools/media/
- cp $(srcdir)/gui/media/tile.gif $(AOS4PATH)/tools/media/
- $(STRIP) construct_mohawk$(EXEEXT) -o $(AOS4PATH)/tools/construct_mohawk$(EXEEXT)
+amigaos4dist: all
+ mkdir -p $(AMIGAOS4PATH)
+ mkdir -p $(AMIGAOS4PATH)/graphics
+ mkdir -p $(AMIGAOS4PATH)/tools
+ mkdir -p $(AMIGAOS4PATH)/tools/media
+ cp $(srcdir)/gui/media/detaillogo.jpg $(AMIGAOS4PATH)/tools/media/
+ cp $(srcdir)/gui/media/logo.jpg $(AMIGAOS4PATH)/tools/media/
+ cp $(srcdir)/gui/media/tile.gif $(AMIGAOS4PATH)/tools/media/
+ $(STRIP) construct_mohawk$(EXEEXT) -o $(AMIGAOS4PATH)/tools/construct_mohawk$(EXEEXT)
ifeq "$(USE_FREETYPE)" "1"
ifeq "$(USE_ICONV)" "1"
- $(STRIP) create_sjisfnt$(EXEEXT) -o $(AOS4PATH)/tools/create_sjisfnt$(EXEEXT)
+ $(STRIP) create_sjisfnt$(EXEEXT) -o $(AMIGAOS4PATH)/tools/create_sjisfnt$(EXEEXT)
endif
endif
- $(STRIP) decine$(EXEEXT) -o $(AOS4PATH)/tools/decine$(EXEEXT)
+ $(STRIP) decine$(EXEEXT) -o $(AMIGAOS4PATH)/tools/decine$(EXEEXT)
ifeq "$(USE_BOOST)" "1"
- $(STRIP) decompile$(EXEEXT) -o $(AOS4PATH)/tools/decompile$(EXEEXT)
-endif
- $(STRIP) degob$(EXEEXT) -o $(AOS4PATH)/tools/degob$(EXEEXT)
- $(STRIP) dekyra$(EXEEXT) -o $(AOS4PATH)/tools/dekyra$(EXEEXT)
- $(STRIP) deriven$(EXEEXT) -o $(AOS4PATH)/tools/deriven$(EXEEXT)
- $(STRIP) descumm$(EXEEXT) -o $(AOS4PATH)/tools/descumm$(EXEEXT)
- $(STRIP) desword2$(EXEEXT) -o $(AOS4PATH)/tools/desword2$(EXEEXT)
- $(STRIP) extract_mohawk$(EXEEXT) -o $(AOS4PATH)/tools/extract_mohawk$(EXEEXT)
- $(STRIP) gob_loadcalc$(EXEEXT) -o $(AOS4PATH)/tools/gob_loadcalc$(EXEEXT)
+ $(STRIP) decompile$(EXEEXT) -o $(AMIGAOS4PATH)/tools/decompile$(EXEEXT)
+endif
+ $(STRIP) degob$(EXEEXT) -o $(AMIGAOS4PATH)/tools/degob$(EXEEXT)
+ $(STRIP) dekyra$(EXEEXT) -o $(AMIGAOS4PATH)/tools/dekyra$(EXEEXT)
+ $(STRIP) deriven$(EXEEXT) -o $(AMIGAOS4PATH)/tools/deriven$(EXEEXT)
+ $(STRIP) descumm$(EXEEXT) -o $(AMIGAOS4PATH)/tools/descumm$(EXEEXT)
+ $(STRIP) desword2$(EXEEXT) -o $(AMIGAOS4PATH)/tools/desword2$(EXEEXT)
+ $(STRIP) extract_mohawk$(EXEEXT) -o $(AMIGAOS4PATH)/tools/extract_mohawk$(EXEEXT)
+ $(STRIP) gob_loadcalc$(EXEEXT) -o $(AMIGAOS4PATH)/tools/gob_loadcalc$(EXEEXT)
ifeq "$(USE_WXWIDGETS)" "1"
- $(STRIP) scummvm-tools$(EXEEXT) -o $(AOS4PATH)/tools/scummvm-tools$(EXEEXT)
+ $(STRIP) scummvm-tools$(EXEEXT) -o $(AMIGAOS4PATH)/tools/scummvm-tools$(EXEEXT)
endif
- $(STRIP) scummvm-tools-cli$(EXEEXT) -o $(AOS4PATH)/tools/scummvm-tools-cli$(EXEEXT)
- #cp ${srcdir}/icons/scummvm-tools.info $(AOS4PATH)/scummvm-tools.info
- cp $(srcdir)/COPYING $(AOS4PATH)/tools/COPYING.txt
- cp $(srcdir)/README $(AOS4PATH)/tools/README.txt
- cp $(srcdir)/NEWS $(AOS4PATH)/tools/NEWS.txt
+ $(STRIP) scummvm-tools-cli$(EXEEXT) -o $(AMIGAOS4PATH)/tools/scummvm-tools-cli$(EXEEXT)
+ #cp ${srcdir}/icons/scummvm-tools.info $(AMIGAOS4PATH)/scummvm-tools.info
+ cp $(srcdir)/COPYING $(AMIGAOS4PATH)/tools/COPYING.txt
+ cp $(srcdir)/README $(AMIGAOS4PATH)/tools/README.txt
+ cp $(srcdir)/NEWS $(AMIGAOS4PATH)/tools/NEWS.txt
diff --git a/Makefile.common b/Makefile.common
index 81d9f10..ce2e9e5 100644
--- a/Makefile.common
+++ b/Makefile.common
@@ -188,6 +188,8 @@ tools_OBJS := \
engines/sword1/compress_sword1.o \
engines/sword2/compress_sword2.o \
engines/tinsel/compress_tinsel.o \
+ engines/tony/compress_tony.o \
+ engines/tony/compress_tony_vdb.o \
engines/touche/compress_touche.o \
engines/tucker/compress_tucker.o \
engines/agos/extract_agos.o \
@@ -197,6 +199,8 @@ tools_OBJS := \
engines/cruise/extract_cruise_pc.o \
engines/gob/extract_gob_stk.o \
engines/kyra/extract_kyra.o \
+ engines/prince/extract_prince.o \
+ engines/prince/pack_prince.o \
engines/parallaction/extract_parallaction.o \
engines/scumm/extract_loom_tg16.o \
engines/scumm/extract_mm_apple.o \
diff --git a/NEWS b/NEWS
index 5ee2d7e..edeb8ca 100644
--- a/NEWS
+++ b/NEWS
@@ -1,6 +1,12 @@
For a more comprehensive changelog of the latest experimental code, see:
https://github.com/scummvm/scummvm-tools/commits/
+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.
+ - Fix detection and decoding of BS1 big endian speech data in compress_sword1.
+ - Fix inputs handling for extract_gob_stk.
+
1.7.0 (2014-07-21)
- Add support for CGE 2 (Sfinx) in extract_cge and pack_cge tools.
- Add option to run some of the tools in the GUI on all the files with the same
diff --git a/common/scummsys.h b/common/scummsys.h
index 09524e4..558f6dd 100644
--- a/common/scummsys.h
+++ b/common/scummsys.h
@@ -33,7 +33,6 @@
#endif
#if defined(NONSTANDARD_PORT)
-
// Ports which need to perform #includes and #defines visible in
// virtually all the source of ScummVM should do so by providing a
// "portdefs.h" header file (and not by directly modifying this
@@ -42,12 +41,44 @@
#else // defined(NONSTANDARD_PORT)
#if defined(WIN32)
-
- #ifdef _MSC_VER
// vsnprintf is already defined in Visual Studio 2008
- #if (_MSC_VER < 1500)
- #define vsnprintf _vsnprintf
- #endif
+ #if defined(_MSC_VER) && _MSC_VER <= 1800
+ // FIXME: The placement of the workaround functions for MSVC below
+ // require us to include stdio.h and stdarg.h for MSVC here. This
+ // is not exactly nice...
+ // We should think of a better way of doing this.
+ #include <stdio.h>
+ #include <stdarg.h>
+
+ // MSVC's vsnprintf is either non-existent (2003) or bugged since it
+ // does not always include a terminating NULL (2005+). To work around
+ // that we fix up the _vsnprintf included. Note that the return value
+ // will still not match C99's specs!
+ inline int vsnprintf_msvc(char *str, size_t size, const char *format, va_list args) {
+ // We do not pass size - 1 here, to ensure we would get the same
+ // return value as when we would use _vsnprintf directly, since
+ // for example Common::String::format relies on this.
+ int retValue = _vsnprintf(str, size, format, args);
+ str[size - 1] = 0;
+ return retValue;
+ }
+
+
+ #define vsnprintf vsnprintf_msvc
+
+ // Visual Studio does not include snprintf in its standard C library.
+ // Instead it includes a function called _snprintf with somewhat
+ // similar semantics. The minor difference is that the return value in
+ // case the formatted string exceeds the buffer size is different.
+ // A much more dangerous one is that _snprintf does not always include
+ // a terminating null (Whoops!). Instead we map to our fixed vsnprintf.
+ inline int snprintf(char *str, size_t size, const char *format, ...) {
+ va_list args;
+ va_start(args, format);
+ int len = vsnprintf(str, size, format, args);
+ va_end(args);
+ return len;
+ }
#endif
#if !defined(_WIN32_WCE)
diff --git a/common/util.cpp b/common/util.cpp
index b9c59dd..2b6a7a6 100644
--- a/common/util.cpp
+++ b/common/util.cpp
@@ -30,10 +30,6 @@
#include <stdio.h>
#include <stdlib.h>
-#ifdef _MSC_VER
- #define vsnprintf _vsnprintf
-#endif
-
void error(const char *s, ...) {
char buf[1024];
va_list va;
diff --git a/compress.cpp b/compress.cpp
index 71eee40..f62e6e0 100644
--- a/compress.cpp
+++ b/compress.cpp
@@ -529,14 +529,12 @@ void CompressionTool::encodeRaw(const char *rawData, int length, int samplerate,
if (rawAudioType.bitsPerSample == 8) {
for (i = 0; i < samplesPerChannel * numChannels; i++) {
- FLAC__uint8 *rawDataUnsigned;
- rawDataUnsigned = (FLAC__uint8 *)rawData;
+ const FLAC__uint8 *rawDataUnsigned = (const FLAC__uint8 *)rawData;
flacData[i] = (FLAC__int32)rawDataUnsigned[i] - 0x80;
}
} else if (rawAudioType.bitsPerSample == 16) {
/* The rawData pointer is an 8-bit char so we must create a new pointer to access 16-bit samples */
- FLAC__int16 *rawData16;
- rawData16 = (FLAC__int16 *)rawData;
+ const FLAC__int16 *rawData16 = (const FLAC__int16 *)rawData;
for (i = 0; i < samplesPerChannel * numChannels; i++) {
flacData[i] = (FLAC__int32)rawData16[i];
}
@@ -1163,7 +1161,7 @@ std::string CompressionTool::getHelp() const {
if (_supportedFormats & AUDIO_MP3) {
os << "\nMP3 mode params:\n";
- os << " --lame-path <path> Path to the lame excutable to use (default:lame)\n";
+ os << " --lame-path <path> Path to the lame executable to use (default:lame)\n";
os << " -b <rate> <rate> is the minimal bitrate (default:unset)\n";
os << " -B <rate> <rate> is the maximum bitrate (default:unset)\n";
os << " --vbr LAME uses the VBR mode (default)\n";
diff --git a/configure b/configure
index b962fc3..08fb8e9 100755
--- a/configure
+++ b/configure
@@ -98,7 +98,7 @@ _wxincludes=""
_wxlibs=""
_freetypeincludes=""
_freetypelibs=""
-_aos4path="Games:ScummVM-Tools"
+_amigaos4path="Games:ScummVM-Tools"
# For cross compiling
_host=""
@@ -1373,7 +1373,7 @@ echo "$_zlib"
#
# Check for FreeType
#
-echocheck "freetype"
+echocheck "FreeType"
if test "$_freetype" = auto ; then
_freetype=no
if type freetype-config > /dev/null 2>&1 ; then
@@ -1382,10 +1382,35 @@ if test "$_freetype" = auto ; then
fi
if test "$_freetype" = yes ; then
- freetype_version=`freetype-config --ftversion 2>/dev/null`
+ _freetype=no
+
+ cat > $TMPC << EOF
+#include <ft2build.h>
+#include FT_FREETYPE_H
+
+int main(int argc, char *argv[]) {
+ FT_Library library;
+ FT_Error error = FT_Init_FreeType(&library);
+ FT_Done_FreeType(library);
+}
+EOF
_freetypelibs=`freetype-config --libs`
_freetypeincludes=`freetype-config --cflags`
+
+ cc_check_no_clean $_freetypelibs $_freetypeincludes && _freetype=yes
+ # Modern freetype-config scripts accept --static to get all
+ # required flags for static linking. We abuse this to detect
+ # FreeType2 builds which are static themselves.
+ if test "$_freetype" != "yes"; then
+ _freetypelibs=`freetype-config --static --libs 2>/dev/null`
+ cc_check_no_clean $_freetypeincludes $_freetypelibs && _freetype=yes
+ fi
+ cc_check_clean
+fi
+
+if test "$_freetype" = yes ; then
+ freetype_version=`freetype-config --ftversion 2>/dev/null`
else
freetype_version="no"
fi
@@ -1622,7 +1647,7 @@ ASFLAGS := $ASFLAGS
WINDRES := $_windres
WINDRESFLAGS := $WINDRESFLAGS
WIN32PATH=$_win32path
-AOS4PATH=$_aos4path
+AMIGAOS4PATH=$_amigaos4path
STATICLIBPATH=$_staticlibpath
EXEEXT := $HOSTEXEEXT
diff --git a/convert_dxa.bat b/convert_dxa.bat
index 131f905..c631e6d 100755
--- a/convert_dxa.bat
+++ b/convert_dxa.bat
@@ -4,7 +4,7 @@
:: This script will search for all SMK files in all subtree directories,
:: and encode them as DXA files next to the original files.
::
-:: (c) 2006-2012 ScummVM Team
+:: (c) 2006-2016 ScummVM Team
:: (c) 2006 oduverne
:: (c) 2008 NoiZe
::
diff --git a/convert_dxa.sh b/convert_dxa.sh
index 5d4d62e..dc117c0 100755
--- a/convert_dxa.sh
+++ b/convert_dxa.sh
@@ -5,7 +5,7 @@
# This script will search for all SMK files in all subtree directories,
# and encode them as DXA files next to the original files.
#
-# (c) 2006-2012 ScummVM Team
+# (c) 2006-2016 ScummVM Team
# (c) 2006 crowley
#
diff --git a/create_sjisfnt.cpp b/create_sjisfnt.cpp
index bd31acc..9c411f3 100644
--- a/create_sjisfnt.cpp
+++ b/create_sjisfnt.cpp
@@ -450,7 +450,7 @@ bool TrueTypeFont::renderGlyph(uint32 unicode, Glyph &glyph) {
if (glyph.pitch < 0)
dst += (glyph.height - 1) * (-glyph.pitch);
- for (int i = 0; i < bitmap.rows; ++i) {
+ for (int i = 0; i < (int)bitmap.rows; ++i) {
memcpy(dst, src, abs(glyph.pitch));
src += bitmap.pitch;
dst += glyph.pitch;
diff --git a/dists/macosx/Info.plist b/dists/macosx/Info.plist
index 36189fa..73f4596 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.7.0, Copyright 2001-2012 The ScummVM team</string>
+ <string>1.8.0, Copyright 2001-2016 The ScummVM team</string>
<key>CFBundleIconFile</key>
<string>scummvmtools.icns</string>
<key>CFBundleIdentifier</key>
@@ -21,12 +21,12 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
- <string>1.7.0</string>
+ <string>1.8.0</string>
<key>CFBundleVersion</key>
- <string>1.7.0</string>
+ <string>1.8.0</string>
<key>NSAppleScriptEnabled</key>
<false/>
<key>NSHumanReadableCopyright</key>
- <string>Copyright 2001-2012 The ScummVM team</string>
+ <string>Copyright 2001-2016 The ScummVM team</string>
</dict>
</plist>
diff --git a/dists/macosx/Info.plist.in b/dists/macosx/Info.plist.in
index 5cd0c61..68d9241 100644
--- a/dists/macosx/Info.plist.in
+++ b/dists/macosx/Info.plist.in
@@ -9,7 +9,7 @@
<key>CFBundleExecutable</key>
<string>scummvm-tools</string>
<key>CFBundleGetInfoString</key>
- <string>@VERSION@, Copyright 2001-2012 The ScummVM team</string>
+ <string>@VERSION@, Copyright 2001-2016 The ScummVM team</string>
<key>CFBundleIconFile</key>
<string>scummvmtools.icns</string>
<key>CFBundleIdentifier</key>
@@ -27,6 +27,6 @@
<key>NSAppleScriptEnabled</key>
<false/>
<key>NSHumanReadableCopyright</key>
- <string>Copyright 2001-2012 The ScummVM team</string>
+ <string>Copyright 2001-2016 The ScummVM team</string>
</dict>
</plist>
diff --git a/dists/msvc10/toolscli.vcxproj b/dists/msvc10/toolscli.vcxproj
index 616616d..ebecc74 100644
--- a/dists/msvc10/toolscli.vcxproj
+++ b/dists/msvc10/toolscli.vcxproj
@@ -97,6 +97,8 @@
<ClCompile Include="..\..\engines\gob\compress_gob.cpp" />
<ClCompile Include="..\..\engines\gob\extract_fascination_cd.cpp" />
<ClCompile Include="..\..\engines\kyra\compress_kyra.cpp" />
+ <ClCompile Include="..\..\engines\prince\extract_prince.cpp" />
+ <ClCompile Include="..\..\engines\prince\pack_prince.cpp" />
<ClCompile Include="..\..\engines\queen\compress_queen.cpp" />
<ClCompile Include="..\..\engines\saga\compress_saga.cpp" />
<ClCompile Include="..\..\engines\sci\compress_sci.cpp" />
@@ -144,6 +146,8 @@
<ClInclude Include="..\..\engines\gob\compress_gob.h" />
<ClInclude Include="..\..\engines\gob\extract_fascination_cd.h" />
<ClInclude Include="..\..\engines\kyra\compress_kyra.h" />
+ <ClInclude Include="..\..\engines\prince\extract_prince.h" />
+ <ClInclude Include="..\..\engines\prince\pack_prince.h" />
<ClInclude Include="..\..\engines\queen\compress_queen.h" />
<ClInclude Include="..\..\engines\saga\compress_saga.h" />
<ClInclude Include="..\..\engines\sci\compress_sci.h" />
@@ -198,4 +202,4 @@
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
-</Project>
+</Project>
\ No newline at end of file
diff --git a/dists/msvc10/toolscli.vcxproj.filters b/dists/msvc10/toolscli.vcxproj.filters
index 4de1d72..e8a82d0 100644
--- a/dists/msvc10/toolscli.vcxproj.filters
+++ b/dists/msvc10/toolscli.vcxproj.filters
@@ -153,6 +153,12 @@
<ClCompile Include="..\..\engines\gob\extract_fascination_cd.cpp">
<Filter>tools</Filter>
</ClCompile>
+ <ClCompile Include="..\..\engines\prince\extract_prince.cpp">
+ <Filter>tools</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\engines\prince\pack_prince.cpp">
+ <Filter>tools</Filter>
+ </ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\engines\agos\compress_agos.h">
@@ -299,6 +305,12 @@
<ClInclude Include="..\..\engines\gob\extract_fascination_cd.h">
<Filter>tools</Filter>
</ClInclude>
+ <ClInclude Include="..\..\engines\prince\extract_prince.h">
+ <Filter>tools</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\engines\prince\pack_prince.h">
+ <Filter>tools</Filter>
+ </ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="..\..\gui\media\scummvmtools.ico">
@@ -310,4 +322,4 @@
<Filter>cli</Filter>
</ResourceCompile>
</ItemGroup>
-</Project>
+</Project>
\ No newline at end of file
diff --git a/dists/msvc9/ScummVMTools_Global.vsprops b/dists/msvc9/ScummVMTools_Global.vsprops
new file mode 100644
index 0000000..4d784fd
--- /dev/null
+++ b/dists/msvc9/ScummVMTools_Global.vsprops
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioPropertySheet
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="ScummVMTools_Global"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="..\.."
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE"
+ DisableSpecificWarnings="4068;4100;4103;4127;4244;4250;4310;4345;4351;4512;4702;4706;4800;4996;6204;6211;6385;6386"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="zlib.lib libogg_static.lib libvorbis_static.lib libvorbisenc_static.lib libFLAC_static.lib libpng.lib comctl32.lib Rpcrt4.lib"
+ IgnoreDefaultLibraryNames="MSVCRT;LIBCMT"
+ />
+</VisualStudioPropertySheet>
diff --git a/dists/msvc9/degob.vcproj b/dists/msvc9/degob.vcproj
index a4b4608..6cc4171 100644
--- a/dists/msvc9/degob.vcproj
+++ b/dists/msvc9/degob.vcproj
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="windows-1250"?>
<VisualStudioProject
ProjectType="Visual C++"
- Version="9.00"
+ Version="9,00"
Name="degob"
ProjectGUID="{C151022B-EAC8-4680-9018-C0A897F7F9C6}"
RootNamespace="degob"
@@ -256,6 +256,14 @@
>
</File>
<File
+ RelativePath="..\..\engines\gob\degob_script_geisha.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\engines\gob\degob_script_littlered.cpp"
+ >
+ </File>
+ <File
RelativePath="..\..\engines\gob\degob_script_v1.cpp"
>
</File>
diff --git a/dists/msvc9/tools.sln b/dists/msvc9/tools.sln
index 612b8b5..76cfd3b 100644
--- a/dists/msvc9/tools.sln
+++ b/dists/msvc9/tools.sln
@@ -1,6 +1,6 @@
Microsoft Visual Studio Solution File, Format Version 10.00
-# Visual Studio 2008
+# Visual C++ Express 2008
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "degob", "degob.vcproj", "{C151022B-EAC8-4680-9018-C0A897F7F9C6}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dekyra", "dekyra.vcproj", "{0B9A669F-83C2-4AE4-841F-3B015713605C}"
diff --git a/dists/msvc9/toolscli.vcproj b/dists/msvc9/toolscli.vcproj
index 4b8a29f..940816f 100644
--- a/dists/msvc9/toolscli.vcproj
+++ b/dists/msvc9/toolscli.vcproj
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
- Version="9.00"
+ Version="9,00"
Name="toolscli"
ProjectGUID="{5204B306-8D89-4A66-8656-8E8F3F759250}"
RootNamespace="toolscli"
@@ -21,6 +21,7 @@
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
+ InheritedPropertySheets=".\ScummVMTools_Global.vsprops"
CharacterSet="1"
>
<Tool
@@ -42,7 +43,6 @@
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="../.."
- PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
@@ -61,9 +61,8 @@
/>
<Tool
Name="VCLinkerTool"
- AdditionalDependencies="zlib.lib libpng.lib libogg_static.lib libvorbis_static.lib libvorbisenc_static.lib libFLAC_static.lib"
LinkIncremental="2"
- IgnoreDefaultLibraryNames="LIBCMT;MSVCRT"
+ IgnoreDefaultLibraryNames=""
GenerateDebugInformation="true"
SubSystem="1"
TargetMachine="1"
@@ -95,6 +94,7 @@
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
+ InheritedPropertySheets=".\ScummVMTools_Global.vsprops"
CharacterSet="1"
WholeProgramOptimization="1"
>
@@ -117,8 +117,9 @@
Name="VCCLCompilerTool"
Optimization="2"
EnableIntrinsicFunctions="true"
- PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
- RuntimeLibrary="2"
+ AdditionalIncludeDirectories="../.."
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE"
+ RuntimeLibrary="0"
EnableFunctionLevelLinking="true"
UsePrecompiledHeader="0"
WarningLevel="3"
@@ -135,9 +136,8 @@
/>
<Tool
Name="VCLinkerTool"
- AdditionalDependencies="zlib.lib libogg_static.lib libvorbis_static.lib libvorbisenc_static.lib libFLAC_static.lib comctl32.lib Rpcrt4.lib"
LinkIncremental="1"
- IgnoreDefaultLibraryNames="LIBCMT"
+ IgnoreDefaultLibraryNames=""
GenerateDebugInformation="true"
SubSystem="1"
OptimizeReferences="2"
@@ -272,6 +272,22 @@
>
</File>
<File
+ RelativePath="..\..\engines\tony\compress_tony.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\engines\tony\compress_tony.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\engines\tony\compress_tony_vdb.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\engines\tony\compress_tony_vdb.h"
+ >
+ </File>
+ <File
RelativePath="..\..\engines\touche\compress_touche.cpp"
>
</File>
@@ -303,22 +319,14 @@
RelativePath="..\..\engines\agos\extract_agos.h"
>
</File>
- <File
- RelativePath="..\..\engines\cge\extract_cge.cpp"
- >
- </File>
- <File
- RelativePath="..\..\engines\cge\extract_cge.h"
- >
- </File>
- <File
- RelativePath="..\..\engines\cge\pack_cge.cpp"
- >
- </File>
- <File
- RelativePath="..\..\engines\cge\pack_cge.h"
- >
- </File>
+ <File
+ RelativePath="..\..\engines\cge\extract_cge.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\engines\cge\extract_cge.h"
+ >
+ </File>
<File
RelativePath="..\..\engines\cine\extract_cine.cpp"
>
@@ -336,6 +344,10 @@
>
</File>
<File
+ RelativePath="..\..\engines\gob\extract_fascination_cd.cpp"
+ >
+ </File>
+ <File
RelativePath="..\..\engines\gob\extract_gob_stk.cpp"
>
</File>
@@ -392,6 +404,10 @@
>
</File>
<File
+ RelativePath="..\..\engines\prince\extract_prince.cpp"
+ >
+ </File>
+ <File
RelativePath="..\..\engines\scumm\extract_scumm_mac.cpp"
>
</File>
@@ -407,6 +423,18 @@
RelativePath="..\..\engines\scumm\extract_zak_c64.h"
>
</File>
+ <File
+ RelativePath="..\..\engines\cge\pack_cge.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\engines\cge\pack_cge.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\engines\prince\pack_prince.cpp"
+ >
+ </File>
</Filter>
<Filter
Name="util"
@@ -454,19 +482,19 @@
>
</File>
<File
- RelativePath="..\..\version.cpp"
+ RelativePath="..\..\common\util.cpp"
>
</File>
<File
- RelativePath="..\..\version.h"
+ RelativePath="..\..\common\util.h"
>
</File>
<File
- RelativePath="..\..\common\util.cpp"
+ RelativePath="..\..\version.cpp"
>
</File>
<File
- RelativePath="..\..\common\util.h"
+ RelativePath="..\..\version.h"
>
</File>
<Filter
diff --git a/dists/msvc9/toolsgui.vcproj b/dists/msvc9/toolsgui.vcproj
index 7f171c9..8ca2b71 100644
--- a/dists/msvc9/toolsgui.vcproj
+++ b/dists/msvc9/toolsgui.vcproj
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
- Version="9.00"
+ Version="9,00"
Name="toolsgui"
ProjectGUID="{54BB26F4-16F1-4522-B6F8-E189D6921497}"
RootNamespace="toolsgui"
@@ -20,6 +20,7 @@
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
+ InheritedPropertySheets=".\ScummVMTools_Global.vsprops"
CharacterSet="2"
>
<Tool
@@ -40,6 +41,7 @@
<Tool
Name="VCCLCompilerTool"
Optimization="0"
+ AdditionalIncludeDirectories="..\.."
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
@@ -57,8 +59,7 @@
/>
<Tool
Name="VCLinkerTool"
- AdditionalDependencies="zlib.lib ogg_static.lib vorbis_static.lib vorbisenc_static.lib libFLAC_static.lib comctl32.lib Rpcrt4.lib"
- IgnoreDefaultLibraryNames="MSVCRT;LIBCMT"
+ IgnoreDefaultLibraryNames=""
GenerateDebugInformation="true"
TargetMachine="1"
/>
@@ -89,6 +90,7 @@
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
+ InheritedPropertySheets=".\ScummVMTools_Global.vsprops"
CharacterSet="2"
WholeProgramOptimization="1"
>
@@ -111,6 +113,8 @@
Name="VCCLCompilerTool"
Optimization="2"
EnableIntrinsicFunctions="true"
+ AdditionalIncludeDirectories="..\.."
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE"
RuntimeLibrary="2"
EnableFunctionLevelLinking="true"
WarningLevel="3"
@@ -204,19 +208,19 @@
>
</File>
<File
- RelativePath="..\..\kyra_ins.cpp"
+ RelativePath="..\..\engines\kyra\kyra_ins.cpp"
>
</File>
<File
- RelativePath="..\..\kyra_ins.h"
+ RelativePath="..\..\engines\kyra\kyra_ins.h"
>
</File>
<File
- RelativePath="..\..\kyra_pak.cpp"
+ RelativePath="..\..\engines\kyra\kyra_pak.cpp"
>
</File>
<File
- RelativePath="..\..\kyra_pak.h"
+ RelativePath="..\..\engines\kyra\kyra_pak.h"
>
</File>
<File
@@ -236,11 +240,11 @@
>
</File>
<File
- RelativePath="..\..\util.cpp"
+ RelativePath="..\..\common\util.cpp"
>
</File>
<File
- RelativePath="..\..\util.h"
+ RelativePath="..\..\common\util.h"
>
</File>
<File
@@ -255,67 +259,59 @@
Name="utils"
>
<File
- RelativePath="..\..\utils\adpcm.cpp"
- >
- </File>
- <File
- RelativePath="..\..\utils\adpcm.h"
- >
- </File>
- <File
- RelativePath="..\..\utils\audiostream.cpp"
+ RelativePath="..\..\sound\adpcm.cpp"
>
</File>
<File
- RelativePath="..\..\utils\audiostream.h"
+ RelativePath="..\..\sound\adpcm.h"
>
</File>
<File
- RelativePath="..\..\utils\file.cpp"
+ RelativePath="..\..\sound\audiostream.cpp"
>
</File>
<File
- RelativePath="..\..\utils\file.h"
+ RelativePath="..\..\sound\audiostream.h"
>
</File>
<File
- RelativePath="..\..\utils\md5.cpp"
+ RelativePath="..\..\common\file.cpp"
>
</File>
<File
- RelativePath="..\..\utils\md5.h"
+ RelativePath="..\..\common\file.h"
>
</File>
<File
- RelativePath="..\..\utils\pack-end.h"
+ RelativePath="..\..\common\md5.cpp"
>
</File>
<File
- RelativePath="..\..\utils\pack-start.h"
+ RelativePath="..\..\common\md5.h"
>
</File>
<File
- RelativePath="..\..\utils\stream.h"
+ RelativePath="..\..\common\pack-end.h"
>
</File>
<File
- RelativePath="..\..\utils\util.h"
+ RelativePath="..\..\common\pack-start.h"
>
</File>
<File
- RelativePath="..\..\utils\voc.cpp"
+ RelativePath="..\..\sound\voc.cpp"
>
</File>
<File
- RelativePath="..\..\utils\voc.h"
+ RelativePath="..\..\sound\voc.h"
>
</File>
<File
- RelativePath="..\..\utils\wave.cpp"
+ RelativePath="..\..\sound\wave.cpp"
>
</File>
<File
- RelativePath="..\..\utils\wave.h"
+ RelativePath="..\..\sound\wave.h"
>
</File>
</Filter>
@@ -324,223 +320,223 @@
Name="tools"
>
<File
- RelativePath="..\..\compress_agos.cpp"
+ RelativePath="..\..\engines\agos\compress_agos.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\engines\agos\compress_agos.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\engines\gob\compress_gob.cpp"
>
</File>
<File
- RelativePath="..\..\compress_agos.h"
+ RelativePath="..\..\engines\gob\compress_gob.h"
>
</File>
<File
- RelativePath="..\..\compress_gob.cpp"
+ RelativePath="..\..\engines\kyra\compress_kyra.cpp"
>
</File>
<File
- RelativePath="..\..\compress_gob.h"
+ RelativePath="..\..\engines\kyra\compress_kyra.h"
>
</File>
<File
- RelativePath="..\..\compress_kyra.cpp"
+ RelativePath="..\..\engines\queen\compress_queen.cpp"
>
</File>
<File
- RelativePath="..\..\compress_kyra.h"
+ RelativePath="..\..\engines\queen\compress_queen.h"
>
</File>
<File
- RelativePath="..\..\compress_queen.cpp"
+ RelativePath="..\..\engines\saga\compress_saga.cpp"
>
</File>
<File
- RelativePath="..\..\compress_queen.h"
+ RelativePath="..\..\engines\saga\compress_saga.h"
>
</File>
<File
- RelativePath="..\..\compress_saga.cpp"
+ RelativePath="..\..\engines\sci\compress_sci.cpp"
>
</File>
<File
- RelativePath="..\..\compress_saga.h"
+ RelativePath="..\..\engines\sci\compress_sci.h"
>
</File>
<File
- RelativePath="..\..\compress_sci.cpp"
+ RelativePath="..\..\engines\scumm\compress_scumm_bun.cpp"
>
</File>
<File
- RelativePath="..\..\compress_sci.h"
+ RelativePath="..\..\engines\scumm\compress_scumm_bun.h"
>
</File>
<File
- RelativePath="..\..\compress_scumm_bun.cpp"
+ RelativePath="..\..\engines\scumm\compress_scumm_san.cpp"
>
</File>
<File
- RelativePath="..\..\compress_scumm_bun.h"
+ RelativePath="..\..\engines\scumm\compress_scumm_san.h"
>
</File>
<File
- RelativePath="..\..\compress_scumm_san.cpp"
+ RelativePath="..\..\engines\scumm\compress_scumm_sou.cpp"
>
</File>
<File
- RelativePath="..\..\compress_scumm_san.h"
+ RelativePath="..\..\engines\scumm\compress_scumm_sou.h"
>
</File>
<File
- RelativePath="..\..\compress_scumm_sou.cpp"
+ RelativePath="..\..\engines\sword1\compress_sword1.cpp"
>
</File>
<File
- RelativePath="..\..\compress_scumm_sou.h"
+ RelativePath="..\..\engines\sword1\compress_sword1.h"
>
</File>
<File
- RelativePath="..\..\compress_sword1.cpp"
+ RelativePath="..\..\engines\sword2\compress_sword2.cpp"
>
</File>
<File
- RelativePath="..\..\compress_sword1.h"
+ RelativePath="..\..\engines\sword2\compress_sword2.h"
>
</File>
<File
- RelativePath="..\..\compress_sword2.cpp"
+ RelativePath="..\..\engines\tinsel\compress_tinsel.cpp"
>
</File>
<File
- RelativePath="..\..\compress_sword2.h"
+ RelativePath="..\..\engines\tinsel\compress_tinsel.h"
>
</File>
<File
- RelativePath="..\..\compress_tinsel.cpp"
+ RelativePath="..\..\engines\tony\compress_tony.cpp"
>
</File>
<File
- RelativePath="..\..\compress_tinsel.h"
+ RelativePath="..\..\engines\tony\compress_tony.h"
>
</File>
<File
- RelativePath="..\..\compress_touche.cpp"
+ RelativePath="..\..\engines\tony\compress_tony_vdb.cpp"
>
</File>
<File
- RelativePath="..\..\compress_touche.h"
+ RelativePath="..\..\engines\tony\compress_tony_vdb.h"
>
</File>
<File
- RelativePath="..\..\compress_tucker.cpp"
+ RelativePath="..\..\engines\touche\compress_touche.cpp"
>
</File>
<File
- RelativePath="..\..\compress_tucker.h"
+ RelativePath="..\..\engines\touche\compress_touche.h"
>
</File>
<File
- RelativePath="..\..\encode_dxa.cpp"
+ RelativePath="..\..\engines\tucker\compress_tucker.cpp"
>
</File>
<File
- RelativePath="..\..\encode_dxa.h"
+ RelativePath="..\..\engines\tucker\compress_tucker.h"
>
</File>
<File
- RelativePath="..\..\example_tool.cpp"
+ RelativePath="..\..\engines\agos\extract_agos.cpp"
>
</File>
<File
- RelativePath="..\..\extract_agos.cpp"
+ RelativePath="..\..\engines\agos\extract_agos.h"
>
</File>
<File
- RelativePath="..\..\extract_agos.h"
+ RelativePath="..\..\engines\cge\extract_cge.cpp"
>
</File>
- <File
- RelativePath="..\..\extract_cge.cpp"
- >
- </File>
- <File
- RelativePath="..\..\extract_cge.h"
- >
- </File>
<File
- RelativePath="..\..\extract_cine.cpp"
+ RelativePath="..\..\engines\cge\extract_cge.h"
>
</File>
<File
- RelativePath="..\..\extract_cine.h"
+ RelativePath="..\..\engines\cine\extract_cine.cpp"
>
</File>
<File
- RelativePath="..\..\extract_gob_stk.cpp"
+ RelativePath="..\..\engines\cine\extract_cine.h"
>
</File>
<File
- RelativePath="..\..\extract_gob_stk.h"
+ RelativePath="..\..\engines\scumm\extract_loom_tg16.cpp"
>
</File>
<File
- RelativePath="..\..\extract_kyra.cpp"
+ RelativePath="..\..\engines\scumm\extract_loom_tg16.h"
>
</File>
<File
- RelativePath="..\..\extract_kyra.h"
+ RelativePath="..\..\engines\scumm\extract_mm_apple.cpp"
>
</File>
<File
- RelativePath="..\..\extract_loom_tg16.cpp"
+ RelativePath="..\..\engines\scumm\extract_mm_apple.h"
>
</File>
<File
- RelativePath="..\..\extract_loom_tg16.h"
+ RelativePath="..\..\engines\scumm\extract_mm_c64.cpp"
>
</File>
<File
- RelativePath="..\..\extract_mm_apple.cpp"
+ RelativePath="..\..\engines\scumm\extract_mm_c64.h"
>
</File>
<File
- RelativePath="..\..\extract_mm_apple.h"
+ RelativePath="..\..\engines\scumm\extract_mm_nes.cpp"
>
</File>
<File
- RelativePath="..\..\extract_mm_c64.cpp"
+ RelativePath="..\..\engines\scumm\extract_mm_nes.h"
>
</File>
<File
- RelativePath="..\..\extract_mm_c64.h"
+ RelativePath="..\..\engines\mohawk\extract_mohawk.cpp"
>
</File>
<File
- RelativePath="..\..\extract_mm_nes.cpp"
+ RelativePath="..\..\engines\parallaction\extract_parallaction.cpp"
>
</File>
<File
- RelativePath="..\..\extract_mm_nes.h"
+ RelativePath="..\..\engines\parallaction\extract_parallaction.h"
>
</File>
<File
- RelativePath="..\..\extract_parallaction.cpp"
+ RelativePath="..\..\engines\prince\extract_prince.cpp"
>
</File>
<File
- RelativePath="..\..\extract_parallaction.h"
+ RelativePath="..\..\engines\prince\extract_prince.h"
>
</File>
<File
- RelativePath="..\..\extract_scumm_mac.cpp"
+ RelativePath="..\..\engines\scumm\extract_scumm_mac.cpp"
>
</File>
<File
- RelativePath="..\..\extract_scumm_mac.h"
+ RelativePath="..\..\engines\scumm\extract_scumm_mac.h"
>
</File>
<File
- RelativePath="..\..\extract_zak_c64.cpp"
+ RelativePath="..\..\engines\scumm\extract_zak_c64.cpp"
>
</File>
<File
- RelativePath="..\..\extract_zak_c64.h"
+ RelativePath="..\..\engines\scumm\extract_zak_c64.h"
>
</File>
</Filter>
diff --git a/dists/scummvmtools.rc b/dists/scummvmtools.rc
index f02281a..e9422d6 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,7,0,0
- PRODUCTVERSION 1,7,0,0
+ FILEVERSION 1,8,0,0
+ PRODUCTVERSION 1,8,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.7.0\0"
+ VALUE "FileVersion", "1.8.0\0"
VALUE "InternalName", "scummvm\0"
- VALUE "LegalCopyright", "Copyright � 2001-2012 The ScummVM Team\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.7.0\0"
+ VALUE "ProductVersion", "1.8.0\0"
END
END
diff --git a/dists/scummvmtools.rc.in b/dists/scummvmtools.rc.in
index 7c17a03..67fb030 100644
--- a/dists/scummvmtools.rc.in
+++ b/dists/scummvmtools.rc.in
@@ -30,7 +30,7 @@ BEGIN
VALUE "FileDescription", "http://www.scummvm.org/\0"
VALUE "FileVersion", "@VERSION@\0"
VALUE "InternalName", "scummvm\0"
- VALUE "LegalCopyright", "Copyright � 2001-2012 The ScummVM Team\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"
diff --git a/dists/win32/ScummVM Tools.iss b/dists/win32/ScummVM Tools.iss
index 2bded35..d022fd8 100755
--- a/dists/win32/ScummVM Tools.iss
+++ b/dists/win32/ScummVM Tools.iss
@@ -1,5 +1,5 @@
[Setup]
-AppCopyright=2012
+AppCopyright=2016
AppName=ScummVM Tools
AppVerName=ScummVM Tools Git
AppPublisher=The ScummVM Team
diff --git a/dists/win32/scummvm-tools.nsi b/dists/win32/scummvm-tools.nsi
index 5e00ecc..5691c69 100644
--- a/dists/win32/scummvm-tools.nsi
+++ b/dists/win32/scummvm-tools.nsi
@@ -61,11 +61,11 @@ Name "ScummVM Tools"
# General Symbol Definitions
#########################################################################################
!define REGKEY "Software\ScummVM\$(^Name)"
-!define VERSION "1.7.0"
+!define VERSION "1.8.0"
!define COMPANY "ScummVM Team"
!define URL "http://scummvm.org/"
!define DESCRIPTION "ScummVM Tools Installer. Look! A three headed monkey (TM)!"
-!define COPYRIGHT "Copyright � 2001-2012 The ScummVM Team"
+!define COPYRIGHT "Copyright � 2001-2016 The ScummVM Team"
#########################################################################################
# Installer configuration
@@ -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.7.0.0
+VIProductVersion 1.8.0.0
VIAddVersionKey ProductName $(^Name)
VIAddVersionKey ProductVersion "${VERSION}"
VIAddVersionKey CompanyName "${COMPANY}"
diff --git a/dists/win32/scummvm-tools.nsi.in b/dists/win32/scummvm-tools.nsi.in
index c6135aa..89db12d 100644
--- a/dists/win32/scummvm-tools.nsi.in
+++ b/dists/win32/scummvm-tools.nsi.in
@@ -65,7 +65,7 @@ Name "ScummVM Tools"
!define COMPANY "ScummVM Team"
!define URL "http://scummvm.org/"
!define DESCRIPTION "ScummVM Tools Installer. Look! A three headed monkey (TM)!"
-!define COPYRIGHT "Copyright � 2001-2012 The ScummVM Team"
+!define COPYRIGHT "Copyright � 2001-2016 The ScummVM Team"
#########################################################################################
# Installer configuration
diff --git a/engines/gob/degob_script.cpp b/engines/gob/degob_script.cpp
index 197cf1c..afd0a8d 100644
--- a/engines/gob/degob_script.cpp
+++ b/engines/gob/degob_script.cpp
@@ -30,10 +30,6 @@
#include "common/endian.h"
#include "common/util.h"
-#ifdef _MSC_VER
- #define vsnprintf _vsnprintf
-#endif
-
ExtTable::ExtTable(byte *data, uint32 size, byte *dataCom, uint32 sizeCom) :
_data(data), _size(size), _dataCom(dataCom), _sizeCom(sizeCom) {
diff --git a/engines/gob/degob_script_littlered.cpp b/engines/gob/degob_script_littlered.cpp
index 8d8b837..8b49665 100644
--- a/engines/gob/degob_script_littlered.cpp
+++ b/engines/gob/degob_script_littlered.cpp
@@ -477,7 +477,18 @@ void Script_LittleRed::setupOpcodes() {
{OPCODET(oLittleRed_DOSInterrupt1), {PARAM_NONE}},
{OPCODET(oLittleRed_DOSInterrupt2), {PARAM_NONE}},
{OPCODET(oLittleRed_playProtracker), {PARAM_NONE}},
- {OPCODET(o2_stopProtracker), {PARAM_NONE}}
+ {OPCODET(o2_stopProtracker), {PARAM_NONE}},
+ {TYPE_NONE, 0, 0, {PARAM_NONE}},
+ {TYPE_NONE, 0, 0, {PARAM_NONE}},
+ {TYPE_NONE, 0, 0, {PARAM_NONE}},
+ {TYPE_NONE, 0, 0, {PARAM_NONE}},
+ {TYPE_NONE, 0, 0, {PARAM_NONE}},
+ {TYPE_NONE, 0, 0, {PARAM_NONE}},
+ {TYPE_NONE, 0, 0, {PARAM_NONE}},
+ {TYPE_NONE, 0, 0, {PARAM_NONE}},
+ {TYPE_NONE, 0, 0, {PARAM_NONE}},
+ {TYPE_NONE, 0, 0, {PARAM_NONE}},
+ {TYPE_NONE, 0, 0, {PARAM_NONE}}
};
_opcodesDrawLittleRed = opcodesDraw;
diff --git a/engines/gob/extract_gob_stk.cpp b/engines/gob/extract_gob_stk.cpp
index 478f0ce..58b6e42 100644
--- a/engines/gob/extract_gob_stk.cpp
+++ b/engines/gob/extract_gob_stk.cpp
@@ -46,7 +46,7 @@ ExtractGobStk::ExtractGobStk(const std::string &name) : Tool(name, TOOLTYPE_EXTR
_chunks = NULL;
ToolInput input;
- input.format = "*.stk";
+ input.format = "*.*";
_inputPaths.push_back(input);
_shorthelp = "Extract the files from a Stick file used by 'gob' engine (.STK/.ITK/.LTK).";
@@ -57,6 +57,18 @@ ExtractGobStk::~ExtractGobStk() {
delete _chunks;
}
+InspectionMatch ExtractGobStk::inspectInput(const Common::Filename &filename) {
+ // Accept either any file with stk, itk or ltk extension
+ std::string ext = filename.getExtension();
+ if (
+ scumm_stricmp(ext.c_str(), "stk") == 0 ||
+ scumm_stricmp(ext.c_str(), "itk") == 0 ||
+ scumm_stricmp(ext.c_str(), "ltk") == 0
+ )
+ return IMATCH_PERFECT;
+ return IMATCH_AWFUL;
+}
+
void ExtractGobStk::execute() {
char signature[7];
Common::File stk;
diff --git a/engines/gob/extract_gob_stk.h b/engines/gob/extract_gob_stk.h
index c8b2df5..63f2e64 100644
--- a/engines/gob/extract_gob_stk.h
+++ b/engines/gob/extract_gob_stk.h
@@ -31,6 +31,8 @@ public:
~ExtractGobStk();
virtual void execute();
+
+ virtual InspectionMatch inspectInput(const Common::Filename &filename);
protected:
struct Chunk;
diff --git a/engines/kyra/dekyra.cpp b/engines/kyra/dekyra.cpp
index 65a411a..3387442 100644
--- a/engines/kyra/dekyra.cpp
+++ b/engines/kyra/dekyra.cpp
@@ -98,8 +98,8 @@ int main(int argc, char** argv) {
ScriptData scriptData;
memset(&scriptData, 0, sizeof(ScriptData));
- OpcodeEntry *opcodes;
- int opcodesSize;
+ OpcodeEntry *opcodes = 0;
+ int opcodesSize = 0;
if (engine == 1) {
getOpcodesV1(opcodes, opcodesSize);
diff --git a/engines/mohawk/utils/file.cpp b/engines/mohawk/utils/file.cpp
index 2567e69..5e8f526 100644
--- a/engines/mohawk/utils/file.cpp
+++ b/engines/mohawk/utils/file.cpp
@@ -1,5 +1,8 @@
/* Scumm Tools
- * Copyright (C) 2004-2006 The ScummVM Team
+ *
+ * ScummVM Tools 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
@@ -14,10 +17,6 @@
* 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/tools/branches/gsoc2009-gui/utils/file.cpp $
- * $Id: file.cpp 23138 2006-06-15 15:44:06Z h00ligan $
- *
*/
#include "common/util.h"
diff --git a/engines/mohawk/utils/file.h b/engines/mohawk/utils/file.h
index 4cd18b2..812d375 100644
--- a/engines/mohawk/utils/file.h
+++ b/engines/mohawk/utils/file.h
@@ -1,5 +1,8 @@
/* Scumm Tools
- * Copyright (C) 2004-2006 The ScummVM Team
+ *
+ * ScummVM Tools 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
@@ -14,10 +17,6 @@
* 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/tools/branches/gsoc2009-gui/utils/file.h $
- * $Id: file.h 23138 2006-06-15 15:44:06Z h00ligan $
- *
*/
#ifndef COMMON_FILE_H
diff --git a/engines/mohawk/utils/stream.h b/engines/mohawk/utils/stream.h
index 29944fd..22639f9 100644
--- a/engines/mohawk/utils/stream.h
+++ b/engines/mohawk/utils/stream.h
@@ -1,5 +1,8 @@
/* Scumm Tools
- * Copyright (C) 2004-2006 The ScummVM Team
+ *
+ * ScummVM Tools 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
@@ -14,10 +17,6 @@
* 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/tools/branches/gsoc2009-gui/utils/stream.h $
- * $Id: stream.h 40868 2009-05-24 15:19:28Z lordhoto $
- *
*/
#ifndef COMMON_STREAM_H
@@ -35,7 +34,7 @@ public:
virtual ~Stream() {}
/**
- * Returns true if any I/O failure occured.
+ * Returns true if any I/O failure occurred.
* This flag is never cleared automatically. In order to clear it,
* client code has to call clearIOFailed() explicitly.
*
diff --git a/engines/prince/extract_prince.cpp b/engines/prince/extract_prince.cpp
new file mode 100644
index 0000000..5fd49ab
--- /dev/null
+++ b/engines/prince/extract_prince.cpp
@@ -0,0 +1,794 @@
+/* ScummVM Tools
+ *
+ * ScummVM Tools 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.
+ */
+
+#include <string.h>
+#include "extract_prince.h"
+#include "common/endian.h"
+
+struct FileData;
+
+ExtractPrince::ExtractPrince(const std::string &name) : Tool(name, TOOLTYPE_EXTRACTION) {
+ ToolInput input;
+ input.format = "/";
+ _inputPaths.push_back(input);
+
+ _outputToDirectory = true;
+
+ _shorthelp = "Used to extract The Prince and the Coward text data for translation.";
+ _helptext = "\nUsage: " + getName() + " [-o /path/to/output/dir/] <inputfile>\n";
+}
+
+void ExtractPrince::execute() {
+ const int kNumberOfLocations = 61;
+
+ Common::Filename mainDir = _inputPaths[0].path;
+ // We always need to setup default output path, since there is no obligation to specify it
+ if (_outputPath.empty()) {
+ _outputPath.setFullPath("./");
+ }
+
+ char *pathBuffer = (char *)malloc(17 * sizeof(char));
+ printf("Unpacking The Prince and the Coward text data... \n");
+
+ std::string fullName = mainDir.getFullPath();
+ sprintf(pathBuffer, "all/databank.ptc");
+ fullName += pathBuffer;
+ Common::Filename filename(fullName);
+ _databank.open(filename, "rb");
+ if (!_databank.isOpen()) {
+ _fFiles.close();
+ error("Unable to open all/databank.ptc");
+ }
+ byte *fileTable = openDatabank();
+ bool mobsDE = false;
+ for (size_t i = 0; i < _items.size(); i++) {
+ if (!scumm_stricmp(_items[i]._name.c_str(), "variatxt.dat")) {
+ exportVariaTxt(loadFile(i));
+ }
+ if (!scumm_stricmp(_items[i]._name.c_str(), "invtxt.dat")) {
+ exportInvTxt(loadFile(i));
+ }
+ if (!scumm_stricmp(_items[i]._name.c_str(), "talktxt.dat")) {
+ exportTalkTxt(loadFile(i));
+ }
+ if (!scumm_stricmp(_items[i]._name.c_str(), "credits.dat")) {
+ exportCredits(loadFile(i));
+ }
+ if (!scumm_stricmp(_items[i]._name.c_str(), "mob01.lst")) {
+ // For DE game data
+ mobsDE = true;
+ _outputPath.setFullName("mob.txt");
+ _fFiles.open(_outputPath, "w");
+ if (!_fFiles.isOpen()) {
+ error("Unable to create mob.txt");
+ }
+ _fFiles.print("mob.lst\nmob_name - exam text\n");
+ int loc = 0;
+ for (int j = 1; j <= kNumberOfLocations; j++) {
+ _fFiles.print("%d.\n", j);
+ // no databanks for loc 44 and 45
+ if (j != 44 && j != 45) {
+ exportMobs(loadFile(i + loc));
+ loc++;
+ }
+ }
+ printf("mob.txt - done\n");
+ printf("All done!\n");
+ free(pathBuffer);
+ _fFiles.close();
+ }
+ }
+ free(fileTable);
+ _databank.close();
+ _items.clear();
+
+ // For PL game data
+ if (!mobsDE) {
+ _outputPath.setFullName("mob.txt");
+ _fFiles.open(_outputPath, "w");
+ if (!_fFiles.isOpen()) {
+ error("Unable to create mob.txt");
+ }
+ _fFiles.print("mob.lst\nmob_name - exam text\n");
+ for (int loc = 1; loc <= kNumberOfLocations; loc++) {
+ _fFiles.print("%d.\n", loc);
+ // no databanks for loc 44 and 45
+ if (loc != 44 && loc != 45) {
+ fullName = mainDir.getFullPath();
+ sprintf(pathBuffer, "%02d/databank.ptc", loc);
+ fullName += pathBuffer;
+ filename = Common::Filename(fullName);
+ _databank.open(filename, "rb");
+ if (!_databank.isOpen()) {
+ _fFiles.close();
+ error("Unable to open %02d/databank.ptc", loc);
+ }
+ fileTable = openDatabank();
+ for (size_t i = 0; i < _items.size(); i++) {
+ if (!scumm_stricmp(_items[i]._name.c_str(), "mob.lst")) {
+ exportMobs(loadFile(i));
+ }
+ }
+ free(fileTable);
+ _databank.close();
+ _items.clear();
+ }
+ }
+ printf("mob.txt - done\n");
+ printf("All done!\n");
+ free(pathBuffer);
+ _fFiles.close();
+ }
+}
+
+InspectionMatch ExtractPrince::inspectInput(const Common::Filename &filename) {
+ std::string file = filename.getFullName();
+ if (scumm_stricmp(file.c_str(), "databank.ptc") == 0) {
+ return IMATCH_PERFECT;
+ }
+ return IMATCH_AWFUL;
+}
+
+byte *ExtractPrince::openDatabank() {
+ _databank.readUint32LE(); // magic
+ uint32 fileTableOffset = _databank.readUint32LE() ^ 0x4D4F4B2D; // MOK-
+ uint32 fileTableSize = _databank.readUint32LE() ^ 0x534F4654; // SOFT
+
+ _databank.seek(fileTableOffset, SEEK_SET);
+
+ byte *fileTable = (byte *)malloc(fileTableSize);
+ byte *fileTableEnd = fileTable + fileTableSize;
+ _databank.read_throwsOnError(fileTable, fileTableSize);
+
+ decrypt(fileTable, fileTableSize);
+
+ for (byte *fileItem = fileTable; fileItem < fileTableEnd; fileItem += 32) {
+ FileEntry item;
+ item._name = (const char *)fileItem;
+ item._offset = READ_LE_UINT32(fileItem + 24);
+ item._size = READ_LE_UINT32(fileItem + 28);
+ _items.push_back(item);
+ }
+ return fileTable;
+}
+
+void ExtractPrince::decrypt(byte *buffer, uint32 size) {
+ uint32 key = 0xDEADF00D;
+ while (size--) {
+ *buffer++ += key & 0xFF;
+ key ^= 0x2E84299A;
+ key += 0x424C4148;
+ key = ((key & 1) << 31) | (key >> 1);
+ }
+}
+
+ExtractPrince::FileData ExtractPrince::loadFile(int itemIndex) {
+ FileData fileData;
+ fileData._fileTable = 0;
+ fileData._size = 0;
+
+ const FileEntry &entryHeader = _items[itemIndex];
+
+ if (entryHeader._size < 4) {
+ return fileData;
+ }
+
+ fileData._size = entryHeader._size;
+
+ _databank.seek(entryHeader._offset, SEEK_SET);
+
+ fileData._fileTable = (byte *)malloc(fileData._size);
+ _databank.read_throwsOnError(fileData._fileTable, fileData._size);
+
+ if (READ_BE_UINT32(fileData._fileTable) == 0x4D41534D) {
+ Decompressor dec;
+ uint32 decompLen = READ_BE_UINT32(fileData._fileTable + 14);
+ byte *decompData = (byte *)malloc(decompLen);
+ dec.decompress(fileData._fileTable + 18, decompData, decompLen);
+ free(fileData._fileTable);
+ fileData._size = decompLen;
+ fileData._fileTable = decompData;
+ }
+
+ return fileData;
+}
+
+void ExtractPrince::exportMobs(FileData fileData) {
+ if (fileData._fileTable != 0) {
+ const int kMobsStructSize = 32;
+ const int kMobsTextOffsetsPos = 24;
+ int streamPos = 0;
+
+ while (READ_LE_UINT16(fileData._fileTable + streamPos) != 0xFFFF) {
+ byte *mobTextOffset = fileData._fileTable + streamPos + kMobsTextOffsetsPos;
+
+ uint32 nameOffset = READ_LE_UINT32(mobTextOffset);
+ mobTextOffset += 4;
+ uint32 examTextOffset = READ_LE_UINT32(mobTextOffset);
+
+ std::string mobName, mobExamText;
+ byte c;
+
+ byte *namePointer = fileData._fileTable + nameOffset;
+ mobName.clear();
+ while ((c = *namePointer)) {
+ c = correctPolishLetter(c);
+ mobName += c;
+ namePointer++;
+ }
+ if (mobName.size()) {
+ _fFiles.print("%s - ", mobName.c_str());
+ }
+
+ byte *examPointer = fileData._fileTable + examTextOffset;
+ mobExamText.clear();
+ c = *examPointer;
+ if (c) {
+ examPointer++;
+ while ((c = *examPointer) != 255) {
+ mobExamText.clear();
+ do {
+ c = correctPolishLetter(c);
+ if (c == 10) {
+ c = '|';
+ }
+ mobExamText += c;
+ examPointer++;
+ } while ((c = *examPointer));
+ _fFiles.print("%s", mobExamText.c_str());
+ examPointer++;
+ if (*examPointer == 254) {
+ _fFiles.print("*"); // show that there is pause before talking
+ examPointer++;
+ }
+ if (*examPointer == 1) {
+ _fFiles.print("+"); // show that there is next line of exam text
+ examPointer++;
+ }
+ };
+ }
+ if (mobName.size()) {
+ _fFiles.print("\n");
+ }
+ streamPos += kMobsStructSize;
+ }
+ free(fileData._fileTable);
+ }
+}
+
+void ExtractPrince::exportVariaTxt(FileData fileData) {
+ if (fileData._fileTable != 0) {
+ _outputPath.setFullName("variatxt.txt");
+ _fFiles.open(_outputPath, "w");
+ if (!_fFiles.isOpen()) {
+ error("Unable to create variatxt.txt");
+ }
+ _fFiles.print("variatxt.dat\nstringId. string\n");
+ const int kVariaTxtSize = 6000;
+ for (int stringId = 0; stringId < kVariaTxtSize; stringId++) {
+ uint32 stringOffset = READ_LE_UINT32(fileData._fileTable + stringId * 4);
+ if (stringOffset > fileData._size) {
+ assert(false);
+ }
+ std::string variaTxtString;
+ byte c;
+ byte *txtPointer = fileData._fileTable + stringOffset;
+ variaTxtString.clear();
+ txtPointer++;
+ while ((c = *txtPointer)) {
+ c = correctPolishLetter(c);
+ if (c == 10) {
+ c = '|';
+ }
+ variaTxtString += c;
+ txtPointer++;
+ }
+ if (variaTxtString.size()) {
+ _fFiles.print("%d. %s\n", stringId, variaTxtString.c_str());
+ }
+ }
+ free(fileData._fileTable);
+ _fFiles.close();
+ printf("variatxt.txt - done\n");
+ }
+}
+
+void ExtractPrince::exportInvTxt(FileData fileData) {
+ if (fileData._fileTable != 0) {
+ std::string itemName, itemExamText;
+ const int kItems = 100;
+ _outputPath.setFullName("invtxt.txt");
+ _fFiles.open(_outputPath, "w");
+ if (!_fFiles.isOpen()) {
+ error("Unable to create invtxt.txt");
+ }
+ _fFiles.print("invtxt.dat\nitemNr. name - exam text\n");
+ for (int itemNr = 0; itemNr < kItems; itemNr++) {
+ int txtOffset = READ_LE_UINT32(fileData._fileTable + itemNr * 8);
+ int examTxtOffset = READ_LE_UINT32(fileData._fileTable + itemNr * 8 + 4);
+
+ byte c;
+ byte *nameTxt = fileData._fileTable + txtOffset;
+ itemName.clear();
+ while ((c = *nameTxt)) {
+ c = correctPolishLetter(c);
+ itemName += c;
+ nameTxt++;
+ }
+
+ byte *examTxt = fileData._fileTable + examTxtOffset;
+ itemExamText.clear();
+ while ((c = *examTxt)) {
+ c = correctPolishLetter(c);
+ if (c == 10) {
+ c = '|';
+ }
+ itemExamText += c;
+ examTxt++;
+ }
+
+ if (itemName.size() != 2) {
+ _fFiles.print("%d. %s - %s\n", itemNr, itemName.c_str(), itemExamText.c_str());
+ }
+ }
+ free(fileData._fileTable);
+ _fFiles.close();
+ printf("invtxt.txt - done\n");
+ }
+}
+
+void ExtractPrince::exportCredits(FileData fileData) {
+ if (fileData._fileTable != 0) {
+ _outputPath.setFullName("credits.txt");
+ _fFiles.open(_outputPath, "w");
+ if (!_fFiles.isOpen()) {
+ error("Unable to create credits.txt");
+ }
+ _fFiles.print("credits.dat\n");
+ byte c;
+ byte lastC = 10;
+ byte *creditsTxt = fileData._fileTable;
+ byte *end = fileData._fileTable + fileData._size;
+ while (creditsTxt != end) {
+ c = *creditsTxt;
+ if (c == 10) {
+ _fFiles.print("@\n");
+ }
+ if (c != 13 && c != 10) {
+ c = correctPolishLetter(c);
+ _fFiles.print("%c", c);
+ }
+ if (lastC != 10 && c == 13) {
+ _fFiles.print("\n");
+ }
+ lastC = c;
+ creditsTxt++;
+ }
+ free(fileData._fileTable);
+ _fFiles.close();
+ printf("credits.txt - done\n");
+ }
+}
+
+void ExtractPrince::exportTalkTxt(FileData fileData) {
+ if (fileData._fileTable != 0) {
+ _outputPath.setFullName("talktxt.txt");
+ _fFiles.open(_outputPath, "w");
+ if (!_fFiles.isOpen()) {
+ error("Unable to create talktxt.txt");
+ }
+ _fFiles.print("talktxt.dat\n");
+
+ byte *setStringOffsets = fileData._fileTable;
+ const int kSetStringValues = 2000;
+ int setStringOffsetsArray[kSetStringValues];
+ int setStringIdArray[kSetStringValues];
+ for (int i = 0; i < kSetStringValues; i++) {
+ setStringOffsetsArray[i] = READ_LE_UINT32(setStringOffsets);
+ setStringIdArray[i] = 0;
+ setStringOffsets += 4;
+ }
+
+ int id = 1;
+ int diff = 0;
+ const int kTextOffset = 8000;
+ byte *talkTxt = fileData._fileTable + kTextOffset;
+ byte *endOfTalkTxt = fileData._fileTable + fileData._size;
+ while (talkTxt < endOfTalkTxt) {
+ diff = talkTxt - fileData._fileTable;
+ for (int i = 0; i < kSetStringValues; i++) {
+ if (setStringOffsetsArray[i] == diff) {
+ setStringIdArray[i] = id;
+ }
+ }
+ if (*talkTxt == 0xFF) {
+ talkTxt = talkTxtWithDialog(talkTxt);
+ } else {
+ talkTxt = talkTxtNoDialog(talkTxt);
+ }
+ id++;
+ }
+ free(fileData._fileTable);
+ _fFiles.close();
+ printf("talktxt.txt - done\n");
+
+ // Additional id data for texts
+ _outputPath.setFullName("talktxt_ids.txt");
+ _fFiles.open(_outputPath, "w");
+ if (!_fFiles.isOpen()) {
+ error("Unable to create talktxt_ids.txt");
+ }
+ _fFiles.print("talktxt_ids\n");
+ for (int i = 0; i < kSetStringValues; i++) {
+ _fFiles.print("%d\n", setStringIdArray[i]);
+ }
+ _fFiles.close();
+ printf("talktxt_ids.txt - done\n");
+ }
+}
+
+byte *ExtractPrince::talkTxtWithDialog(byte *talkTxt) {
+ byte *mainString;
+ byte *dialogBoxAddr[32];
+ byte *dialogOptAddr[32];
+ byte c;
+ std::string lineString;
+
+ byte *stringCurrOff = talkTxt;
+ stringCurrOff++;
+ int32 adressOfFirstSequence = (int)READ_LE_UINT16(stringCurrOff);
+ mainString = talkTxt + adressOfFirstSequence;
+ stringCurrOff += 2;
+
+ for (int i = 0; i < 32; i++) {
+ dialogBoxAddr[i] = 0;
+ dialogOptAddr[i] = 0;
+ }
+
+ int16 off;
+ byte *line = 0;
+
+ int dialogBox = 0;
+ while ((off = (int)READ_LE_UINT16(stringCurrOff)) != -1) {
+ stringCurrOff += 2;
+ if (off) {
+ line = talkTxt + off;
+ dialogBoxAddr[dialogBox] = line;
+ dialogBox++;
+ }
+ }
+ stringCurrOff += 2;
+
+ int dialogOpt = 0;
+ while ((off = (int)READ_LE_UINT16(stringCurrOff)) != -1) {
+ stringCurrOff += 2;
+ if (off) {
+ line = talkTxt + off;
+ dialogOptAddr[dialogOpt] = line;
+ dialogOpt++;
+ }
+ }
+
+ _fFiles.print("@DIALOGBOX_LINES:\n");
+ while ((c = *mainString) != 255) {
+ if (printSpecialDialogData(c)) {
+ mainString++;
+ _fFiles.print("%d\n", *mainString);
+ }
+ mainString++;
+ }
+ _fFiles.print("#END\n");
+
+ for (int i = 0; i < dialogBox; i++) {
+ _fFiles.print("@DIALOG_BOX %d\n", i);
+ while ((c = *dialogBoxAddr[i]) != 255) {
+ _fFiles.print("$%d\n", *dialogBoxAddr[i]);
+ dialogBoxAddr[i]++;
+ lineString.clear();
+ while ((c = *dialogBoxAddr[i])) {
+ c = correctPolishLetter(c);
+ if (c == 10) {
+ c = '|';
+ }
+ dialogBoxAddr[i]++;
+ lineString += c;
+ }
+ dialogBoxAddr[i]++;
+ _fFiles.print("%s\n", lineString.c_str());
+ }
+ _fFiles.print("#END\n");
+ }
+
+ for (int i = 0; i < dialogOpt; i++) {
+ _fFiles.print("@DIALOG_OPT %d\n", i);
+ byte lastC = 0;
+ while ((c = *dialogOptAddr[i]) != 255) {
+ // WALKAROUND: fix for unnecessery '0' after PAUSE
+ // and double #HERO
+ if ((lastC != 254 || c != 0) && (lastC != 1 || c != 1)) {
+ if (printSpecialDialogData(c)) {
+ dialogOptAddr[i]++;
+ _fFiles.print("%d\n", *dialogOptAddr[i]);
+ }
+ }
+ lastC = c;
+ dialogOptAddr[i]++;
+ }
+ _fFiles.print("#END\n");
+ }
+ _fFiles.print("#ENDEND\n");
+ talkTxt = dialogOptAddr[dialogOpt - 1];
+ talkTxt++;
+ return talkTxt;
+}
+
+byte *ExtractPrince::talkTxtNoDialog(byte *talkTxt) {
+ byte c;
+ _fFiles.print("@NORMAL_LINES:\n");
+ while ((c = *talkTxt) != 255) {
+ if (printSpecialDialogData(c)) {
+ talkTxt++;
+ _fFiles.print("%d\n", *talkTxt);
+ }
+ talkTxt++;
+ }
+ _fFiles.print("#END\n");
+ talkTxt++;
+ return talkTxt;
+}
+
+// Returns 'true' if next char is a value for 'enable option',
+// 'disable option', 'show dialog box", 'flag code' or 'exit code'
+bool ExtractPrince::printSpecialDialogData(byte c) {
+ switch (c) {
+ case 0:
+ _fFiles.print("\n");
+ return false;
+ case 1:
+ _fFiles.print("#HERO\n");
+ return false;
+ case 4:
+ _fFiles.print("#OTHER\n");
+ return false;
+ case 5:
+ _fFiles.print("#OTHER2\n");
+ return false;
+ case 10:
+ _fFiles.print("|");
+ return false;
+ case 254:
+ _fFiles.print("#PAUSE\n");
+ return false;
+ case 240:
+ _fFiles.print("#ENABLE ");
+ return true;
+ case 241:
+ _fFiles.print("#DISABLE ");
+ return true;
+ case 242:
+ _fFiles.print("#BOX ");
+ return true;
+ case 243:
+ _fFiles.print("#EXIT ");
+ return true;
+ case 244:
+ _fFiles.print("#FLAG ");
+ return true;
+ default:
+ c = correctPolishLetter(c);
+ _fFiles.print("%c", c);
+ return false;
+ }
+}
+
+// Conversion from Mazovia to Windows-1250
+char ExtractPrince::correctPolishLetter(char c) {
+ switch (c) {
+ case '\x86':
+ return '\xB9';
+ case '\x92':
+ return '\xB3';
+ case '\x9E':
+ return '\x9C';
+ case '\x8D':
+ return '\xE6';
+ case '\xA4':
+ return '\xF1';
+ case '\xA6':
+ return '\x9F';
+ case '\x91':
+ return '\xEA';
+ case '\xA2':
+ return '\xF3';
+ case '\xA7':
+ return '\xBF';
+ case '\x8F':
+ return '\xA5';
+ case '\x9C':
+ return '\xA3';
+ case '\x98':
+ return '\x8C';
+ case '\x95':
+ return '\xC6';
+ case '\xA5':
+ return '\xD1';
+ case '\xA0':
+ return '\x8F';
+ case '\x90':
+ return '\xCA';
+ case '\xA3':
+ return '\xD3';
+ case '\xA1':
+ return '\xAF';
+ default:
+ return c;
+ }
+}
+
+// John_Doe's implementation
+static const uint16 table1[] = {
+ 0x8000, 0x0002,
+ 0x4000, 0x0004,
+ 0x2000, 0x0008,
+ 0x1000, 0x0010,
+ 0x0800, 0x0020,
+ 0x0400, 0x0040,
+ 0x0200, 0x0080,
+ 0x0100, 0x0100,
+ 0x0080, 0x0200,
+ 0x0040, 0x0400
+};
+
+static const uint32 table2[] = {
+ 0x0000F000,
+ 0x0020FC00,
+ 0x00A0FF00,
+ 0x02A0FF80,
+ 0x06A0FFC0,
+ 0x0EA0FFE0,
+ 0x1EA0FFF0,
+ 0x3EA0FFF8
+};
+
+static const uint16 table3[] = {
+ 0x8000, 0x0000,
+ 0x4000, 0x0002,
+ 0x2000, 0x0006,
+ 0x1000, 0x000E,
+ 0x0800, 0x001E,
+ 0x0400, 0x003E,
+ 0x0200, 0x007E,
+ 0x0100, 0x00FE,
+ 0x0080, 0x01FE,
+ 0x0040, 0x03FE,
+ 0x0020, 0x07FE,
+ 0x0010, 0x0FFE,
+ 0x0008, 0x1FFE,
+ 0x0004, 0x3FFE,
+ 0x0002, 0x7FFE,
+ 0x0001, 0xFFFE
+};
+
+void Decompressor::decompress(byte *source, byte *dest, uint32 destSize) {
+ byte *destEnd = dest + destSize;
+ int more;
+ _src = source;
+ _dst = dest;
+ _bitBuffer = 0x80;
+ while (_dst < destEnd) {
+ uint32 ebp;
+ uint16 offset, length;
+ if (getBit()) {
+ if (getBit()) {
+ if (getBit()) {
+ if (getBit()) {
+ if (getBit()) {
+ if (getBit()) {
+ uint32 tableIndex = 0;
+ while (getBit())
+ tableIndex++;
+ length = table3[tableIndex * 2 + 0];
+ do {
+ more = !(length & 0x8000);
+ length = (length << 1) | getBit();
+ } while (more);
+ length += table3[tableIndex * 2 + 1];
+ length++;
+ memcpy(_dst, _src, length);
+ _src += length;
+ _dst += length;
+ }
+ *_dst++ = *_src++;
+ }
+ *_dst++ = *_src++;
+ }
+ *_dst++ = *_src++;
+ }
+ *_dst++ = *_src++;
+ }
+ *_dst++ = *_src++;
+ }
+ if (!getBit()) {
+ if (getBit()) {
+ uint32 tableIndex = getBit();
+ tableIndex = (tableIndex << 1) | getBit();
+ tableIndex = (tableIndex << 1) | getBit();
+ ebp = table2[tableIndex];
+ length = 1;
+ } else {
+ ebp = 0x0000FF00;
+ length = 0;
+ }
+ } else {
+ uint32 tableIndex = 0;
+ while (getBit())
+ tableIndex++;
+ length = table1[tableIndex * 2 + 0];
+ do {
+ more = !(length & 0x8000);
+ length = (length << 1) | getBit();
+ } while (more);
+ length += table1[tableIndex * 2 + 1];
+ tableIndex = getBit();
+ tableIndex = (tableIndex << 1) | getBit();
+ tableIndex = (tableIndex << 1) | getBit();
+ ebp = table2[tableIndex];
+ }
+ offset = ebp & 0xFFFF;
+ do {
+ if (_bitBuffer == 0x80) {
+ if (offset >= 0xFF00) {
+ offset = (offset << 8) | *_src++;
+ }
+ }
+ more = offset & 0x8000;
+ offset = (offset << 1) | getBit();
+ } while (more);
+ offset += (ebp >> 16);
+ length += 2;
+ while (length--) {
+ if (_dst >= destEnd) {
+ return;
+ }
+ *_dst = *(_dst - offset);
+ _dst++;
+ }
+ }
+}
+
+int Decompressor::getBit() {
+ int bit = (_bitBuffer & 0x80) >> 7;
+ _bitBuffer <<= 1;
+ if (_bitBuffer == 0) {
+ _bitBuffer = *_src++;
+ bit = (_bitBuffer & 0x80) >> 7;
+ _bitBuffer <<= 1;
+ _bitBuffer |= 1;
+ }
+ return bit;
+}
+
+#ifdef STANDALONE_MAIN
+int main(int argc, char *argv[]) {
+ ExtractPrince prince(argv[0]);
+ return prince.run(argc, argv);
+}
+#endif
diff --git a/engines/sword1/compress_sword1.h b/engines/prince/extract_prince.h
similarity index 50%
copy from engines/sword1/compress_sword1.h
copy to engines/prince/extract_prince.h
index cd7dfe3..8d677ec 100644
--- a/engines/sword1/compress_sword1.h
+++ b/engines/prince/extract_prince.h
@@ -19,44 +19,59 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-/* Compress Broken Sword I sound clusters into MP3/Ogg Vorbis */
+#ifndef EXTRACT_PRINCE_H
+#define EXTRACT_PRINCE_H
-#ifndef COMPRESS_SWORD1_H
-#define COMPRESS_SWORD1_H
+#include "tool.h"
+#include "common/array.h"
-#include "compress.h"
-
-class CompressSword1 : public CompressionTool {
+class ExtractPrince : public Tool {
public:
- CompressSword1(const std::string &name = "compress_sword1");
-
+ ExtractPrince(const std::string &name = "extract_prince");
+
virtual void execute();
-
+
virtual InspectionMatch inspectInput(const Common::Filename &filename);
-
- bool _compSpeech;
- bool _compMusic;
-
+
protected:
- void parseExtraArguments();
+ struct FileEntry {
+ std::string _name;
+ uint32 _offset;
+ uint32 _size;
+ };
- std::string _audioOuputFilename;
+ struct FileData {
+ byte *_fileTable;
+ uint32 _size;
+ };
- int16 *uncompressSpeech(Common::File &clu, uint32 idx, uint32 cSize, uint32 *returnSize);
- 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);
- void compressMusic(const Common::Filename *inpath, const Common::Filename *outpath);
- void checkFilesExist(bool checkSpeech, bool checkMusic, const Common::Filename *inpath);
- void guessEndianness(int16 *data, int16 length);
+ byte *openDatabank();
+ static void decrypt(byte *buffer, uint32 size);
-private:
- bool _useOutputMusicSubdir;
+ FileData loadFile(int itemIndex);
+ char correctPolishLetter(char c);
- bool _macVersion;
+ void exportMobs(FileData fileData);
+ void exportVariaTxt(FileData fileData);
+ void exportInvTxt(FileData fileData);
+ void exportCredits(FileData fileData);
+ void exportTalkTxt(FileData fileData);
+ byte *talkTxtWithDialog(byte *talkTxt);
+ byte *talkTxtNoDialog(byte *talkTxt);
+ bool printSpecialDialogData(byte c);
- enum Endianness { BigEndian , LittleEndian , UnknownEndian } ;
- Endianness _speechEndianness;
+ Common::Array<FileEntry> _items;
+ Common::File _databank, _fFiles;
+};
+
+class Decompressor {
+public:
+ void decompress(byte *source, byte *dest, uint32 destSize);
+protected:
+ byte *_src, *_dst;
+ byte _bitBuffer;
+ int _bitsLeft;
+ int getBit();
};
#endif
diff --git a/engines/prince/pack_prince.cpp b/engines/prince/pack_prince.cpp
new file mode 100644
index 0000000..f1547f7
--- /dev/null
+++ b/engines/prince/pack_prince.cpp
@@ -0,0 +1,932 @@
+/* ScummVM Tools
+ *
+ * ScummVM Tools 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.
+ */
+
+#include <string.h>
+#include "pack_prince.h"
+#include "common/endian.h"
+
+PackPrince::PackPrince(const std::string &name) : Tool(name, TOOLTYPE_EXTRACTION) {
+ ToolInput input;
+ input.format = "/";
+ _inputPaths.push_back(input);
+
+ _outputToDirectory = true;
+
+ _shorthelp = "Used to repackage The Prince and the Coward text data for translation.";
+ _helptext = "\nUsage: " + getName() + " [-o /path/to/output/dir/] /path/to/inputfiles\n";
+}
+
+void PackPrince::execute() {
+ Common::Filename mainDir = _inputPaths[0].path;
+ // We always need to setup default output path, since there is no obligation to specify it
+ if (_outputPath.empty()) {
+ _outputPath.setFullPath("./");
+ }
+
+ _outputPath.setFullName("prince_translation.dat");
+ _fFiles.open(_outputPath, "wb");
+ if (!_fFiles.isOpen()) {
+ error("Unable to create prince_translation.dat");
+ }
+
+ // Export names of files
+ _fFiles.print("variatxt_translate.dat\n");
+ _fFiles.print("invtxt_translate.dat\n");
+ _fFiles.print("talktxt_translate.dat\n");
+ _fFiles.print("mob_translate.dat\n");
+ _fFiles.print("credits_translate.dat\n");
+
+
+ // Export files infomation
+ int posOfFilesInformation = _fFiles.pos();
+ FileEntry filesInfo[5];
+ int fileNr = 0;
+ for (int i = 0; i < 5; i++) {
+ _fFiles.writeUint32LE(0); // place for files offsets
+ _fFiles.writeUint32LE(0); // and size of files
+ }
+
+ printf("Packing The Prince and the Coward text data...\n");
+
+ filesInfo[fileNr]._offset = _fFiles.pos();
+ mainDir.setFullName("variatxt.txt");
+ _databank.open(mainDir, "rb");
+ if (!_databank.isOpen()) {
+ error("Unable to open variatxt.txt");
+ }
+ packVariaTxt();
+ filesInfo[fileNr]._size = _fFiles.pos() - filesInfo[fileNr]._offset;
+ fileNr++;
+ _databank.close();
+ printf("variatxt_translate.dat - done\n");
+
+ filesInfo[fileNr]._offset = _fFiles.pos();
+ mainDir.setFullName("invtxt.txt");
+ _databank.open(mainDir, "rb");
+ if (!_databank.isOpen()) {
+ error("Unable to open invtxt.txt");
+ }
+ packInvTxt();
+ filesInfo[fileNr]._size = _fFiles.pos() - filesInfo[fileNr]._offset;
+ fileNr++;
+ _databank.close();
+ printf("invtxt_translate.dat - done\n");
+
+ filesInfo[fileNr]._offset = _fFiles.pos();
+ mainDir.setFullName("talktxt.txt");
+ _databank.open(mainDir, "rb");
+ if (!_databank.isOpen()) {
+ error("Unable to open talktxt.txt");
+ }
+ packTalkTxt();
+ filesInfo[fileNr]._size = _fFiles.pos() - filesInfo[fileNr]._offset;
+ fileNr++;
+ _databank.close();
+ printf("talktxt_translate.dat - done\n");
+
+ filesInfo[fileNr]._offset = _fFiles.pos();
+ mainDir.setFullName("mob.txt");
+ _databank.open(mainDir, "rb");
+ if (!_databank.isOpen()) {
+ error("Unable to open mob.txt");
+ }
+ packMobs();
+ filesInfo[fileNr]._size = _fFiles.pos() - filesInfo[fileNr]._offset;
+ fileNr++;
+ _databank.close();
+ printf("mob_translate.dat - done\n");
+
+ filesInfo[fileNr]._offset = _fFiles.pos();
+ mainDir.setFullName("credits.txt");
+ _databank.open(mainDir, "rb");
+ if (!_databank.isOpen()) {
+ error("Unable to open credits.txt");
+ }
+ packCredits();
+ filesInfo[fileNr]._size = _fFiles.pos() - filesInfo[fileNr]._offset;
+ fileNr++;
+ _databank.close();
+ printf("credits_translate.dat - done\n");
+
+ // Files offset and size setting
+ _fFiles.seek(posOfFilesInformation, SEEK_SET);
+ for (int i = 0; i < fileNr; i++) {
+ _fFiles.writeUint32LE(filesInfo[i]._offset);
+ _fFiles.writeUint32LE(filesInfo[i]._size);
+ }
+ _fFiles.close();
+ printf("All done!\n");
+ printf("File is created in %s\n", _outputPath.getFullPath().c_str());
+}
+
+void PackPrince::packVariaTxt() {
+ // File size
+ uint fileSize = _databank.size();
+
+ // Header test
+ byte c;
+ std::string name, examTxt;
+ while ((c = _databank.readByte()) != '\r') {
+ name += c;
+ }
+ if (name.compare("variatxt.dat")) {
+ error("Wrong header in variatxt.txt");
+ }
+
+ // Skip comment until first number
+ while ((c = _databank.readByte()) != '\r');
+ _databank.readByte(); // skip '\n'
+
+ // Loading to array:
+ const int kVariaTxtSize = 6000;
+ Common::Array<VariaTxt> variaTxtList; // list of all txt
+ VariaTxt newVariaTxt; // temp varia txt
+ newVariaTxt._txt = "";
+ for (int i = 0; i < kVariaTxtSize; i++) {
+ variaTxtList.push_back(newVariaTxt);
+ }
+
+ while (1) {
+ // Id:
+ int id = 0;
+ while ((c = _databank.readByte()) != '.') {
+ id *= 10;
+ id += c - 48;
+ }
+ _databank.readByte(); // skip space
+
+ // Text:
+ newVariaTxt._txt.clear();
+ while ((c = _databank.readByte()) != '\r') {
+ c = correctPolishLetter(c); // temporary
+ if (c == '|') {
+ c = 10;
+ }
+ newVariaTxt._txt += c;
+ }
+
+ // Set VariaTxt in array
+ variaTxtList[id]._txt = newVariaTxt._txt;
+
+ // Skip '\n' and test eof
+ _databank.readByte();
+ if ((uint)_databank.pos() == fileSize) {
+ break;
+ }
+ }
+
+ int textOffset = kVariaTxtSize * 4;
+ // Offset counting and packing:
+ for (int i = 0; i < kVariaTxtSize; i++) {
+ if (variaTxtList[i]._txt.size()) {
+ _fFiles.writeUint32LE(textOffset);
+ textOffset += variaTxtList[i]._txt.size() + 3;
+ } else {
+ _fFiles.writeUint32LE(0);
+ }
+ }
+ for (uint i = 0; i < variaTxtList.size(); i++) {
+ if (variaTxtList[i]._txt.size()) {
+ _fFiles.writeByte(1);
+ for (uint j = 0; j < variaTxtList[i]._txt.size(); j++) {
+ _fFiles.writeByte(variaTxtList[i]._txt[j]);
+ }
+ _fFiles.writeByte(0);
+ _fFiles.writeByte(255);
+ }
+ }
+}
+
+void PackPrince::packInvTxt() {
+ // File size
+ uint fileSize = _databank.size();
+
+ // Header test
+ byte c;
+ std::string name, examTxt;
+ while ((c = _databank.readByte()) != '\r') {
+ name += c;
+ }
+ if (name.compare("invtxt.dat")) {
+ error("Wrong header in invtxt.txt");
+ }
+
+ // Skip comments until first inventory item nr
+ while ((c = _databank.readByte()) != '0');
+
+ // Skip first dot and space
+ _databank.readByte();
+ _databank.readByte();
+
+ // Loading to an array:
+ const int kItems = 100;
+ Common::Array<InvTxt> invTxtList; // list of all invTxt
+ InvTxt newInvTxt; // temp invTxt
+ for (int i = 0; i < kItems; i++) {
+ invTxtList.push_back(newInvTxt);
+ }
+
+ int id = 0;
+ while (1) {
+ newInvTxt._name.clear();
+ newInvTxt._examTxt.clear();
+ // Name:
+ while ((c = _databank.readByte()) != '-') {
+ c = correctPolishLetter(c); // temporary
+ newInvTxt._name += c;
+ }
+ newInvTxt._name.erase(newInvTxt._name.size() - 1); // remove first space
+ _databank.readByte(); // skip second space
+
+ // Exam text:
+ while ((c = _databank.readByte()) != '\r') {
+ c = correctPolishLetter(c); // temporary
+ if (c == '|') {
+ c = 10;
+ }
+ newInvTxt._examTxt += c;
+ }
+
+ // Add new item to list
+ invTxtList[id] = newInvTxt;
+
+ // Skip '\n' and test eof
+ _databank.readByte();
+ if ((uint)_databank.pos() == fileSize) {
+ break;
+ } else {
+ while ((c = _databank.readByte()) != ' '); // skip item nr, space and dot
+ }
+ id++;
+ }
+
+ // Offset counting and packing:
+ int nameOffset = kItems * 4 * 2;
+ for (int i = 0; i < kItems; i++) {
+ if (invTxtList[i]._name.size()) {
+ int examTextOffset = nameOffset + invTxtList[i]._name.size() + 1;
+ _fFiles.writeUint32LE(nameOffset);
+ _fFiles.writeUint32LE(examTextOffset);
+ nameOffset += invTxtList[i]._name.size() + invTxtList[i]._examTxt.size() + 2;
+ } else {
+ _fFiles.writeUint32LE(0);
+ _fFiles.writeUint32LE(0);
+ }
+ }
+ for (uint i = 0; i < invTxtList.size(); i++) {
+ if (invTxtList[i]._name.size()) {
+ // Names
+ for (uint j = 0; j < invTxtList[i]._name.size(); j++) {
+ _fFiles.writeByte(invTxtList[i]._name[j]);
+ }
+ _fFiles.writeByte(0);
+ // Exam texts
+ for (uint j = 0; j < invTxtList[i]._examTxt.size(); j++) {
+ _fFiles.writeByte(invTxtList[i]._examTxt[j]);
+ }
+ _fFiles.writeByte(0);
+ }
+ }
+}
+
+void PackPrince::packCredits() {
+ // File size
+ uint fileSize = _databank.size();
+
+ // Header test
+ byte c;
+ std::string line;
+ while ((c = _databank.readByte()) != '\r') {
+ line += c;
+ }
+ if (line.compare("credits.dat")) {
+ error("Wrong header in credits.txt");
+ }
+ _databank.readByte(); // skip '\n'
+
+ // Packing:
+ while (1) {
+ c = _databank.readByte();
+ if (c != 13 && c != 10) {
+ if (c == '@') {
+ _fFiles.writeByte(13);
+ _fFiles.writeByte(10);
+ } else {
+ c = correctPolishLetter(c);
+ _fFiles.writeByte(c);
+ }
+ }
+ if ((uint)_databank.pos() == fileSize) {
+ break;
+ }
+ }
+}
+
+void PackPrince::packTalkTxt() {
+ // IDs array for first 2000 offsets calculation
+ const int kSetStringValues = 2000;
+ int setStringIdArray[kSetStringValues];
+ Common::Filename mainDir = _inputPaths[0].path;
+ Common::File idsFile;
+ mainDir.setFullName("talktxt_ids.txt");
+ idsFile.open(mainDir, "rb");
+ if (!idsFile.isOpen()) {
+ error("Unable to open talktxt_ids.txt");
+ }
+
+ // Header test
+ byte c;
+ std::string line;
+ while ((c = idsFile.readByte()) != '\r') {
+ line += c;
+ }
+ if (line.compare("talktxt_ids")) {
+ error("Wrong header in talktxt_ids.txt");
+ }
+ idsFile.readByte(); // skip '\n'
+
+ // IDs loading
+ for (int i = 0; i < kSetStringValues; i++) {
+ int value = 0;
+ while ((c = idsFile.readByte()) != '\r') {
+ value *= 10;
+ value += c - 48;
+ }
+ idsFile.readByte(); // skip '\n'
+ setStringIdArray[i] = value;
+ }
+ idsFile.close();
+
+ // Main file
+ // File size
+ uint fileSize = _databank.size();
+
+ // Header test
+ line.clear();
+ while ((c = _databank.readByte()) != '\r') {
+ line += c;
+ }
+ if (line.compare("talktxt.dat")) {
+ error("Wrong header in talktxt.txt");
+ }
+ _databank.readByte(); // skip '\n'
+
+ // Start pos of talkTxt file for later offset setting
+ int startTalkTxtPos = _fFiles.pos();
+
+ // Making space for main offsets
+ for (int i = 0; i < kSetStringValues; i++) {
+ _fFiles.writeUint32LE(0);
+ }
+
+ int id = 1;
+ int setStringOffsetsArray[kSetStringValues];
+ for (int i = 0; i < kSetStringValues; i++) {
+ setStringOffsetsArray[i] = 0;
+ }
+
+ while (1) {
+ line.clear();
+ while ((c = _databank.readByte()) != '\r') {
+ line += c;
+ }
+ _databank.readByte(); // skip '\n'
+
+ for (int i = 0; i < kSetStringValues; i++) {
+ if (id == setStringIdArray[i]) {
+ setStringOffsetsArray[i] = _fFiles.pos() - startTalkTxtPos;
+ }
+ }
+
+ if (!line.compare("@DIALOGBOX_LINES:")) {
+ talkTxtWithDialog();
+ } else if (!line.compare("@NORMAL_LINES:")) {
+ talkTxtNoDialog();
+ }
+
+ id++;
+
+ if ((uint)_databank.pos() == fileSize) {
+ break;
+ }
+ }
+ // End of talkTxt file
+ int endTalkTxtPos = _fFiles.pos();
+
+ // Back to start of talkTxt file for offsets setting
+ _fFiles.seek(startTalkTxtPos, SEEK_SET);
+ for (int i = 0; i < kSetStringValues; i++) {
+ _fFiles.writeUint32LE(setStringOffsetsArray[i]);
+ }
+
+ // Back to the end of talkTxt file
+ _fFiles.seek(endTalkTxtPos, SEEK_SET);
+}
+
+void PackPrince::talkTxtWithDialog() {
+ byte c;
+ std::string line;
+ Common::Array<TalkTxt> beforeDialogBoxArray;
+ Common::Array<Common::Array<TalkTxt> > allDialogBoxesArray;
+ Common::Array<Common::Array<TalkTxt> > allDialogOptionsArray;
+
+ // Intro talk before dialog box:
+ TalkTxt tempTalkBeforeBox;
+ while (1) {
+ // Special dialog data
+ line.clear();
+ while ((c = _databank.readByte()) != '\r') {
+ line += c;
+ }
+ _databank.readByte(); // skip '\n'
+
+ if (!line.compare("#HERO")) {
+ tempTalkBeforeBox._dialogData = 1;
+ } else if (!line.compare("#OTHER")) {
+ tempTalkBeforeBox._dialogData = 4;
+ } else if (!line.compare("#OTHER2")) {
+ tempTalkBeforeBox._dialogData = 5;
+ } else if (!line.compare("#PAUSE")) {
+ tempTalkBeforeBox._dialogData = 254;
+ tempTalkBeforeBox._txt.clear();
+ beforeDialogBoxArray.push_back(tempTalkBeforeBox);
+ continue;
+ } else if (!line.compare("#BOX 0")) {
+ while (_databank.readByte() != '\n'); // skip #END
+ break;
+ }
+
+ // Line of text
+ tempTalkBeforeBox._txt.clear();
+ while ((c = _databank.readByte()) != '\r') {
+ c = correctPolishLetter(c); // temporary
+ if (c == '|') {
+ c = 10;
+ }
+ tempTalkBeforeBox._txt += c;
+ }
+ c = 0;
+ tempTalkBeforeBox._txt += c;
+ _databank.readByte(); // skip '\n'
+
+ beforeDialogBoxArray.push_back(tempTalkBeforeBox);
+ }
+
+ // All dialog boxes:
+ int dbNr = 0;
+ Common::Array<TalkTxt> tempDialogBoxArray;
+ TalkTxt tempDialogBoxLine;
+
+ while (1) {
+ // Check if @DIALOG_BOX
+ line.clear();
+ while ((c = _databank.readByte()) != ' ') {
+ line += c;
+ }
+ while (_databank.readByte() != '\n'); // skip " %d\r\n"
+ if (line.compare("@DIALOG_BOX")) {
+ break;
+ }
+
+ tempDialogBoxArray.clear();
+ allDialogBoxesArray.push_back(tempDialogBoxArray);
+
+ // Lines of dialog box
+ while (1) {
+ // Skip $, check if #END
+ c = _databank.readByte();
+ if (c == '#') {
+ while (_databank.readByte() != '\n'); // skip "END\r\n"
+ break;
+ }
+
+ // Text number
+ int textNr = 0;
+ while ((c = _databank.readByte()) != '\r') {
+ textNr *= 10;
+ textNr += c - 48;
+ }
+ tempDialogBoxLine._dialogData = textNr;
+ _databank.readByte(); // skip '\n'
+
+ // Line of text
+ tempDialogBoxLine._txt.clear();
+ while ((c = _databank.readByte()) != '\r') {
+ c = correctPolishLetter(c); // temporary
+ if (c == '|') {
+ c = 10;
+ }
+ tempDialogBoxLine._txt += c;
+ }
+ c = 0;
+ tempDialogBoxLine._txt += c;
+ _databank.readByte(); // skip '\n'
+
+ allDialogBoxesArray[dbNr].push_back(tempDialogBoxLine);
+ }
+
+ dbNr++;
+ }
+
+ // All dialog options:
+ int dbOptNr = 0;
+ Common::Array<TalkTxt> tempDialogOptionsArray;
+ TalkTxt tempDialogOptionsLine;
+
+ while (1) {
+ tempDialogOptionsArray.clear();
+ allDialogOptionsArray.push_back(tempDialogOptionsArray);
+
+ // Lines of dialog opt
+ while (1) {
+ // Special dialog data
+ line.clear();
+ while ((c = _databank.readByte()) != '\r' && c != ' ') {
+ line += c;
+ }
+ // Check if #END
+ if (!line.compare("#END")) {
+ _databank.readByte(); // skip '\n'
+ break;
+ }
+ if (!line.compare("#HERO")) {
+ tempDialogOptionsLine._dialogData = 1;
+ } else if (!line.compare("#OTHER")) {
+ tempDialogOptionsLine._dialogData = 4;
+ } else if (!line.compare("#OTHER2")) {
+ tempDialogOptionsLine._dialogData = 5;
+ } else if (!line.compare("#PAUSE")) {
+ tempDialogOptionsLine._dialogData = 254;
+ tempDialogOptionsLine._txt.clear();
+ _databank.readByte(); // skip '\n'
+ allDialogOptionsArray[dbOptNr].push_back(tempDialogOptionsLine);
+ continue;
+ } else {
+ if (!line.compare("#ENABLE")) { // 0 - 15
+ tempDialogOptionsLine._dialogData = 240;
+ uint8 value = 0;
+ while ((c = _databank.readByte()) != '\r') {
+ value *= 10;
+ value += c - 48;
+ }
+ tempDialogOptionsLine._txt.clear();
+ tempDialogOptionsLine._txt += value;
+ } else {
+ if (!line.compare("#DISABLE")) { // 1
+ tempDialogOptionsLine._dialogData = 241;
+ } else if (!line.compare("#BOX")) { // 0, 1, 2, 3, 4
+ tempDialogOptionsLine._dialogData = 242;
+ } else if (!line.compare("#EXIT")) { // 0, 1, 2, 3, 4
+ tempDialogOptionsLine._dialogData = 243;
+ } else if (!line.compare("#FLAG")) { // 1
+ tempDialogOptionsLine._dialogData = 244;
+ }
+ tempDialogOptionsLine._txt.clear();
+ tempDialogOptionsLine._txt += _databank.readByte() - 48;
+ _databank.readByte(); // skip '\r'
+ }
+ _databank.readByte(); // skip '\n'
+ allDialogOptionsArray[dbOptNr].push_back(tempDialogOptionsLine);
+ continue;
+ }
+
+ _databank.readByte(); // skip '\n'
+
+ // Line of text
+ tempDialogOptionsLine._txt.clear();
+ while ((c = _databank.readByte()) != '\r') {
+ c = correctPolishLetter(c); // temporary
+ if (c == '|') {
+ c = 10;
+ }
+ tempDialogOptionsLine._txt += c;
+ }
+ c = 0;
+ tempDialogOptionsLine._txt += c;
+ _databank.readByte(); // skip '\n'
+ allDialogOptionsArray[dbOptNr].push_back(tempDialogOptionsLine);
+ }
+ dbOptNr++;
+ // Check if #ENDEND, skip @DIALOG_OPT %d
+ line.clear();
+ while ((c = _databank.readByte()) != '\r') {
+ line += c;
+ }
+ _databank.readByte(); // skip '\n'
+ if (!line.compare("#ENDEND")) {
+ break;
+ }
+ }
+
+ // Offset counting and packing:
+ _fFiles.writeByte(255); // show that this is dialog box
+
+ // Offset of init dialog texts
+ int offset = 3 + allDialogBoxesArray.size() * 2 + 2 + allDialogOptionsArray.size() * 2 + 2;
+ _fFiles.writeUint16LE(offset);
+ for (uint i = 0; i < beforeDialogBoxArray.size(); i++) {
+ offset += beforeDialogBoxArray[i]._txt.size() + 1; // data and text
+ }
+ offset += 3; // always BOX 0 and 255 at the end
+
+ // Dialog boxes texts offsets:
+ for (uint i = 0; i < allDialogBoxesArray.size(); i++) {
+ _fFiles.writeUint16LE(offset);
+ for (uint j = 0; j < allDialogBoxesArray[i].size(); j++) {
+ offset += allDialogBoxesArray[i][j]._txt.size() + 1; // data and text
+ }
+ offset++; // 255 at the end
+ }
+ _fFiles.writeByte(255);
+ _fFiles.writeByte(255);
+ // Dialog opts texts offsets:
+ for (uint i = 0; i < allDialogOptionsArray.size(); i++) {
+ _fFiles.writeUint16LE(offset);
+ for (uint j = 0; j < allDialogOptionsArray[i].size(); j++) {
+ offset += allDialogOptionsArray[i][j]._txt.size() + 1;
+ }
+ offset++; // 255 at the end
+ }
+ _fFiles.writeByte(255);
+ _fFiles.writeByte(255);
+
+ // Init texts:
+ for (uint i = 0; i < beforeDialogBoxArray.size(); i++) {
+ _fFiles.writeByte(beforeDialogBoxArray[i]._dialogData);
+ for (uint j = 0; j < beforeDialogBoxArray[i]._txt.size(); j++) {
+ _fFiles.writeByte(beforeDialogBoxArray[i]._txt[j]);
+ }
+ }
+ _fFiles.writeByte(242);
+ _fFiles.writeByte(0);
+ _fFiles.writeByte(255);
+
+ // Dialog boxes:
+ for (uint i = 0; i < allDialogBoxesArray.size(); i++) {
+ for (uint j = 0; j < allDialogBoxesArray[i].size(); j++) {
+ _fFiles.writeByte(allDialogBoxesArray[i][j]._dialogData);
+ for (uint k = 0; k < allDialogBoxesArray[i][j]._txt.size(); k++) {
+ _fFiles.writeByte(allDialogBoxesArray[i][j]._txt[k]);
+ }
+ }
+ _fFiles.writeByte(255);
+ }
+
+ // Dialog opts:
+ for (uint i = 0; i < allDialogOptionsArray.size(); i++) {
+ for (uint j = 0; j < allDialogOptionsArray[i].size(); j++) {
+ _fFiles.writeByte(allDialogOptionsArray[i][j]._dialogData);
+ for (uint k = 0; k < allDialogOptionsArray[i][j]._txt.size(); k++) {
+ _fFiles.writeByte(allDialogOptionsArray[i][j]._txt[k]);
+ }
+ }
+ _fFiles.writeByte(255);
+ }
+}
+
+void PackPrince::talkTxtNoDialog() {
+ byte c;
+ std::string line;
+ Common::Array<TalkTxt> normalLinesArray;
+ TalkTxt tempNormalLine;
+ while (1) {
+ // Special dialog data
+ line.clear();
+ while ((c = _databank.readByte()) != '\r') {
+ line += c;
+ }
+ _databank.readByte(); // skip '\n'
+
+ if (!line.compare("#HERO")) {
+ tempNormalLine._dialogData = 1;
+ } else if (!line.compare("#OTHER")) {
+ tempNormalLine._dialogData = 4;
+ } else if (!line.compare("#OTHER2")) {
+ tempNormalLine._dialogData = 5;
+ } else if (!line.compare("#PAUSE")) {
+ tempNormalLine._dialogData = 254;
+ tempNormalLine._txt.clear();
+ normalLinesArray.push_back(tempNormalLine);
+ continue;
+ } else if (!line.compare("#END")) {
+ break;
+ }
+
+ // Line of text
+ tempNormalLine._txt.clear();
+ while ((c = _databank.readByte()) != '\r') {
+ c = correctPolishLetter(c); // temporary
+ if (c == '|') {
+ c = 10;
+ }
+ tempNormalLine._txt += c;
+ }
+ c = 0;
+ tempNormalLine._txt += c;
+ _databank.readByte(); // skip '\n'
+
+ normalLinesArray.push_back(tempNormalLine);
+ }
+
+ // Offset counting and packing:
+ for (uint i = 0; i < normalLinesArray.size(); i++) {
+ _fFiles.writeByte(normalLinesArray[i]._dialogData);
+ for (uint j = 0; j < normalLinesArray[i]._txt.size(); j++) {
+ _fFiles.writeByte(normalLinesArray[i]._txt[j]);
+ }
+ }
+ _fFiles.writeByte(255);
+}
+
+void PackPrince::packMobs() {
+ // File size
+ uint fileSize = _databank.size();
+
+ // Header test
+ byte c;
+ std::string name, examTxt;
+ while ((c = _databank.readByte()) != '\r') {
+ name += c;
+ }
+ if (name.compare("mob.lst")) {
+ error("Wrong header in mob.txt");
+ }
+ _databank.readByte(); // skip '\n'
+
+ // Skip comment until first location nr
+ while ((c = _databank.readByte()) != '\n');
+
+ // Loading to an array:
+ Common::Array<Common::Array<Mob> > allLocations; // array of locations of all Mobs
+ Common::Array<Mob> tempLocation; // temp array of Mobs in one location
+ Mob newMob; // temp Mob
+ const int kLocations = 61; // max nr of location
+ int nr = 0; // number of current location
+
+ for (int i = 0; i < kLocations; i++) {
+ allLocations.push_back(tempLocation);
+ }
+
+ while (1) {
+ newMob._name.clear();
+ newMob._examTxt.clear();
+
+ // Test if end of location - next number
+ if ((c = _databank.readByte()) > 47 && c < 58) {
+ // Set location nr:
+ nr = c - 48;
+ while ((c = _databank.readByte()) != '.') {
+ nr *= 10;
+ nr += c - 48;
+ }
+ nr--;
+ _databank.readByte(); // skip '\r'
+ _databank.readByte(); // skip '\n'
+ } else {
+ c = correctPolishLetter(c); // temporary
+ newMob._name += c; // first letter of name
+ }
+
+ // Test for eof
+ if ((uint)_databank.pos() == fileSize) {
+ break;
+ }
+
+ // No mobs in this location
+ if ((c = _databank.readByte()) > 47 && c < 58) {
+ _databank.seek(-1, SEEK_CUR);
+ continue;
+ } else {
+ c = correctPolishLetter(c); // temporary
+ newMob._name += c;
+ }
+
+ // Name:
+ while ((c = _databank.readByte()) != '-') {
+ c = correctPolishLetter(c); // temporary
+ newMob._name += c;
+ }
+ newMob._name.erase(newMob._name.size() - 1); // remove first space
+ _databank.readByte(); // skip second space
+
+ // Exam text:
+ while ((c = _databank.readByte()) != '\r') {
+ c = correctPolishLetter(c); // temporary
+ if (c == '|') {
+ c = 10;
+ }
+ if (c == '*') {
+ c = 254;
+ }
+ if (c == '+') {
+ c = 0;
+ newMob._examTxt += c;
+ c = 1;
+ }
+ newMob._examTxt += c;
+ }
+
+ // Skip '\n'
+ _databank.readByte();
+
+ // Add new item to list
+ allLocations[nr].push_back(newMob);
+ }
+ // Offset counting and packing:
+ int locationOffset = allLocations.size() * 2;
+ for (uint i = 0; i < allLocations.size(); i++) {
+ if (allLocations[i].size()) {
+ _fFiles.writeUint16LE(locationOffset);
+ for (uint j = 0; j < allLocations[i].size(); j++) {
+ locationOffset += allLocations[i][j]._name.size() + allLocations[i][j]._examTxt.size() + 5;
+ }
+ } else {
+ _fFiles.writeUint16LE(0);
+ }
+ }
+ for (uint i = 0; i < allLocations.size(); i++) {
+ for (uint j = 0; j < allLocations[i].size(); j++) {
+ _fFiles.writeByte(1);
+ for (uint k = 0; k < allLocations[i][j]._name.size(); k++) {
+ _fFiles.writeByte(allLocations[i][j]._name[k]);
+ }
+ _fFiles.writeByte(0);
+ _fFiles.writeByte(1);
+ for (uint k = 0; k < allLocations[i][j]._examTxt.size(); k++) {
+ _fFiles.writeByte(allLocations[i][j]._examTxt[k]);
+ }
+ _fFiles.writeByte(0);
+ _fFiles.writeByte(255);
+ }
+ }
+}
+
+// Conversion from Windows-1250 to Mazovia
+// temporary for not complete translation
+char PackPrince::correctPolishLetter(char c) {
+ switch (c) {
+ case '\xB9':
+ return '\x86';
+ case '\xB3':
+ return '\x92';
+ case '\x9C':
+ return '\x9E';
+ case '\xE6':
+ return '\x8D';
+ case '\xF1':
+ return '\xA4';
+ case '\x9F':
+ return '\xA6';
+ case '\xEA':
+ return '\x91';
+ case '\xF3':
+ return '\xA2';
+ case '\xBF':
+ return '\xA7';
+ case '\xA5':
+ return '\x8F';
+ case '\xA3':
+ return '\x9C';
+ case '\x8C':
+ return '\x98';
+ case '\xC6':
+ return '\x95';
+ case '\xD1':
+ return '\xA5';
+ case '\x8F':
+ return '\xA0';
+ case '\xCA':
+ return '\x90';
+ case '\xD3':
+ return '\xA3';
+ case '\xAF':
+ return '\xA1';
+ default:
+ return c;
+ }
+}
+
+#ifdef STANDALONE_MAIN
+int main(int argc, char *argv[]) {
+ PackPrince prince(argv[0]);
+ return prince.run(argc, argv);
+}
+#endif
diff --git a/engines/gob/extract_gob_stk.h b/engines/prince/pack_prince.h
similarity index 60%
copy from engines/gob/extract_gob_stk.h
copy to engines/prince/pack_prince.h
index c8b2df5..b55b7d7 100644
--- a/engines/gob/extract_gob_stk.h
+++ b/engines/prince/pack_prince.h
@@ -19,29 +19,53 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-/* Extractor for Coktel Vision game's .stk/.itk archives */
-
-#ifndef EXTRACT_GOB_STK_H
-#define EXTRACT_GOB_STK_H
+#ifndef PACK_PRINCE_H
+#define PACK_PRINCE_H
#include "tool.h"
-class ExtractGobStk : public Tool {
+#include "common/array.h"
+
+class PackPrince : public Tool {
public:
- ExtractGobStk(const std::string &name = "extract_gob_stk");
- ~ExtractGobStk();
+ PackPrince(const std::string &name = "pack_prince");
virtual void execute();
protected:
- struct Chunk;
+ struct FileEntry {
+ uint32 _offset;
+ uint32 _size;
+ };
+
+ struct InvTxt {
+ std::string _name;
+ std::string _examTxt;
+ };
+
+ struct VariaTxt {
+ std::string _txt;
+ };
+
+ struct Mob {
+ std::string _name;
+ std::string _examTxt;
+ };
+
+ struct TalkTxt {
+ int _dialogData;
+ std::string _txt;
+ };
- Chunk *_chunks;
+ void packMobs();
+ void packVariaTxt();
+ void packInvTxt();
+ void packCredits();
+ void packTalkTxt();
+ char correctPolishLetter(char c);
+ void talkTxtWithDialog();
+ void talkTxtNoDialog();
- void readChunkList(Common::File &stk, Common::File &gobConf);
- void readChunkListV2(Common::File &stk, Common::File &gobConf);
- void extractChunks(Common::Filename &outpath, Common::File &stk);
- byte *unpackData(byte *src, uint32 &size);
- byte *unpackPreGobData(byte *src, uint32 &size, uint32 &compSize);
+ Common::File _databank, _fFiles;
};
#endif
diff --git a/engines/scumm/descumm.cpp b/engines/scumm/descumm.cpp
index 35b081a..749c55b 100644
--- a/engines/scumm/descumm.cpp
+++ b/engines/scumm/descumm.cpp
@@ -2598,6 +2598,8 @@ void next_line_V0(char *buf) {
do_tok(buf, "loadRoomWithEgo", A1B | A2B);
break;
case 0x6E:
+ do_tok(buf, "screenPrepare", 0);
+ break;
case 0xEE:
//dummy
sprintf(buf, "dummy%.2X();", opcode);
diff --git a/engines/sword1/compress_sword1.cpp b/engines/sword1/compress_sword1.cpp
index b422c49..ef8bd73 100644
--- a/engines/sword1/compress_sword1.cpp
+++ b/engines/sword1/compress_sword1.cpp
@@ -312,6 +312,33 @@ MusicFile musicNames[TOTAL_TUNES] = {
};
int16 *CompressSword1::uncompressSpeech(Common::File &clu, uint32 idx, uint32 cSize, uint32 *returnSize) {
+ if (_speechEndianness == UnknownEndian) {
+ uint32 leSize, beSize;
+ _speechEndianness = LittleEndian;
+ int16* leData = uncompressSpeech(clu, idx, cSize, &leSize);
+ _speechEndianness = BigEndian;
+ int16* beData = uncompressSpeech(clu, idx, cSize, &beSize);
+ _speechEndianness = guessEndianness(leData, leSize / 2, beData, beSize / 2);
+ switch (_speechEndianness) {
+ case LittleEndian:
+ free(beData);
+ setRawAudioType(true, false, 16);
+ *returnSize = leSize;
+ return leData;
+ case BigEndian:
+ free(leData);
+ setRawAudioType(false, false, 16);
+ *returnSize = beSize;
+ return beData;
+ case UnknownEndian:
+ free(leData);
+ free(beData);
+ error("Sound::uncompressSpeech(): cannot determine data endianness");
+ *returnSize = 0;
+ return NULL;
+ }
+ }
+
uint32 resSize, srcPos;
int16 *srcData, *dstData, *dstPos;
uint32 headerPos = 0;
@@ -330,7 +357,10 @@ int16 *CompressSword1::uncompressSpeech(Common::File &clu, uint32 idx, uint32 cS
dstPos = dstData;
cSize = (cSize - (headerPos + 8)) / 2;
while (srcPos < cSize) {
- length = (int16)READ_LE_UINT16(srcData + srcPos);
+ if (_speechEndianness == LittleEndian)
+ length = (int16)READ_LE_UINT16(srcData + srcPos);
+ else
+ length = (int16)READ_BE_UINT16(srcData + srcPos);
srcPos++;
if (length < 0) {
length = -length;
@@ -345,8 +375,6 @@ int16 *CompressSword1::uncompressSpeech(Common::File &clu, uint32 idx, uint32 cS
}
free(fBuf);
*returnSize = resSize * 2;
- if (_speechEndianness == UnknownEndian)
- guessEndianness(dstData, length);
return dstData;
} else {
free(fBuf);
@@ -356,26 +384,44 @@ int16 *CompressSword1::uncompressSpeech(Common::File &clu, uint32 idx, uint32 cS
}
}
-void CompressSword1::guessEndianness(int16 *data, int16 length) {
+CompressSword1::Endianness CompressSword1::guessEndianness(int16 *leData, uint32 leSize, int16 *beData, uint32 beSize) {
+ if (leData == NULL && beData == NULL)
+ return UnknownEndian;
+ else if (leData == NULL)
+ return BigEndian;
+ else if (beData == NULL)
+ return LittleEndian;
+
// Compute average of difference between two consecutive samples for both the given
// data array and the byte swapped array.
- double bs_diff_sum = 0., diff_sum = 0.;
+ uint32 length = leSize > beSize ? beSize : leSize;
if (length > 2000)
length = 2000;
+ double le_diff = endiannessHeuristicValue(leData, leSize, length, LittleEndian);
+ double be_diff = endiannessHeuristicValue(beData, beSize, length, BigEndian);
+ print("Speech endianness heuristic: average = %f for BE and %f for LE (%d samples)", be_diff, le_diff, length);
+ if (be_diff < le_diff)
+ return BigEndian;
+ else if (le_diff < be_diff)
+ return LittleEndian;
+ return UnknownEndian;
+}
- int16 prev_bs_value = (int16)SWAP_16(*((uint16*)data));
- for (int16 i = 1 ; i < length ; ++i) {
- diff_sum += data[i] > data[i-1] ? data[i] - data[i-1] : data[i-1] - data[i];
- int16 bs_value = (int16)SWAP_16(*((uint16*)(data + i)));
- bs_diff_sum += bs_value > prev_bs_value ? bs_value - prev_bs_value : prev_bs_value - bs_value;
- prev_bs_value = bs_value;
+double CompressSword1::endiannessHeuristicValue(int16* data, uint32 dataSize, uint32 maxSamples, Endianness dataEndianness) {
+ double diff_sum = 0.;
+ uint32 cpt = 0;
+ int16 prev_value = dataEndianness == BigEndian ? (int16)READ_BE_UINT16(data) : (int16)READ_LE_UINT16(data);
+ for (uint32 i = 1; i < dataSize && cpt < maxSamples; ++i) {
+ int16 value = dataEndianness == BigEndian ? (int16)READ_BE_UINT16(data + i) : (int16)READ_LE_UINT16(data + i);
+ if (value != prev_value) {
+ diff_sum += fabs((double)(value - prev_value));
+ ++cpt;
+ prev_value = value;
+ }
}
- // Set the little/big endian flags
- if (diff_sum < bs_diff_sum)
- _speechEndianness = LittleEndian;
- else
- _speechEndianness = BigEndian;
- setRawAudioType(_speechEndianness == LittleEndian, false, 16);
+ if (cpt == 0)
+ return 50000.;
+ return diff_sum / cpt;
}
uint8 *CompressSword1::convertData(uint8 *rawData, uint32 rawSize, uint32 *resSize) {
diff --git a/engines/sword1/compress_sword1.h b/engines/sword1/compress_sword1.h
index cd7dfe3..7321d50 100644
--- a/engines/sword1/compress_sword1.h
+++ b/engines/sword1/compress_sword1.h
@@ -48,14 +48,16 @@ protected:
void compressSpeech(const Common::Filename *inpath, const Common::Filename *outpath);
void compressMusic(const Common::Filename *inpath, const Common::Filename *outpath);
void checkFilesExist(bool checkSpeech, bool checkMusic, const Common::Filename *inpath);
- void guessEndianness(int16 *data, int16 length);
+
+ enum Endianness { BigEndian , LittleEndian , UnknownEndian } ;
+ Endianness guessEndianness(int16 *leData, uint32 leSize, int16 *beData, uint32 beSize);
+ double endiannessHeuristicValue(int16* data, uint32 dataSize, uint32 maxSamples, Endianness dataEndianness);
private:
bool _useOutputMusicSubdir;
bool _macVersion;
- enum Endianness { BigEndian , LittleEndian , UnknownEndian } ;
Endianness _speechEndianness;
};
diff --git a/engines/tony/compress_tony.cpp b/engines/tony/compress_tony.cpp
new file mode 100644
index 0000000..483db4f
--- /dev/null
+++ b/engines/tony/compress_tony.cpp
@@ -0,0 +1,226 @@
+/* ScummVM Tools
+ *
+ * ScummVM Tools 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.
+ */
+
+#include <stdlib.h>
+
+#include "compress.h"
+#include "common/endian.h"
+#include "compress_tony.h"
+
+#define TEMP_RAW "tempfile.raw"
+#define TEMP_ENC "tempfile.enc"
+
+template<typename T> inline T CLIP (T v, T amin, T amax) {
+ if (v < amin)
+ return amin;
+ else if (v > amax)
+ return amax;
+ else
+ return v;
+}
+
+CompressTony::CompressTony(const std::string &name) : CompressionTool(name, TOOLTYPE_COMPRESSION) {
+ _supportsProgressBar = false;
+
+ ToolInput input1;
+ input1.format = "*.adp";
+ _inputPaths.push_back(input1);
+
+ _shorthelp = "Used to compress Tony Tough's .adp files.";
+ _helptext = "\nUsage: " + getName() + " [mode-params] [-o outputname] <infile.adp>\n";
+}
+
+// This table is used to adjust the step for use on the next sample.
+// We could half the table, but since the lookup index used is always
+// a 4-bit nibble, it's more efficient to just keep it as it is.
+const int16 _stepAdjustTable[16] = {
+ -1, -1, -1, -1, 2, 4, 6, 8,
+ -1, -1, -1, -1, 2, 4, 6, 8
+};
+
+const int16 _imaTable[89] = {
+ 7, 8, 9, 10, 11, 12, 13, 14,
+ 16, 17, 19, 21, 23, 25, 28, 31,
+ 34, 37, 41, 45, 50, 55, 60, 66,
+ 73, 80, 88, 97, 107, 118, 130, 143,
+ 157, 173, 190, 209, 230, 253, 279, 307,
+ 337, 371, 408, 449, 494, 544, 598, 658,
+ 724, 796, 876, 963, 1060, 1166, 1282, 1411,
+ 1552, 1707, 1878, 2066, 2272, 2499, 2749, 3024,
+ 3327, 3660, 4026, 4428, 4871, 5358, 5894, 6484,
+ 7132, 7845, 8630, 9493,10442,11487,12635,13899,
+ 15289,16818,18500,20350,22385,24623,27086,29794,
+ 32767
+};
+
+int16 CompressTony::decodeIMA(byte code, int channel) {
+ int32 E = (2 * (code & 0x7) + 1) * _imaTable[_status.ima_ch[channel].stepIndex] / 8;
+ int32 diff = (code & 0x08) ? -E : E;
+ int32 samp = CLIP<int32>(_status.ima_ch[channel].last + diff, -32768, 32767);
+
+ _status.ima_ch[channel].last = samp;
+ _status.ima_ch[channel].stepIndex += _stepAdjustTable[code];
+ _status.ima_ch[channel].stepIndex = CLIP<int32>(_status.ima_ch[channel].stepIndex, 0, 88);
+
+ return samp;
+}
+
+/* Converts ADPCM-data sample in input_adp to requested dataformat and writes to output_smp */
+/* Quick hack together from adpcm.cpp */
+void CompressTony::convertTonyADPCMSample() {
+ byte *inBuffer;
+ int16 *outBuffer;
+
+ uint32 doneRead = 0;
+ char buffer[2048];
+ Common::File curFileHandle;
+
+ uint32 rate = _input_adp.readUint32LE();
+ uint32 channels = _input_adp.readUint32LE();
+
+ printf("rate %d channels %d\n", rate, channels);
+ printf("original size %d\n", _input_adp.size());
+
+ int sampleSize = _input_adp.size() - 12; // 4 (signature) + 4 (rate) + 4 (channels)
+
+ // Allocate buffer for the ADPCM-compressed sample
+ inBuffer = (byte *)malloc(sampleSize);
+ if (!inBuffer) {
+ print("malloc failed!");
+ return;
+ }
+ _input_adp.read_throwsOnError(inBuffer, sampleSize);
+
+ // Allocate buffer for uncompressed sample data (3 bytes will be uncompressed to 8 bytes)
+ uint32 uncompressedSize = sampleSize * 2;
+ printf("uncompressed %d bytes\n", uncompressedSize * 2);
+
+ outBuffer = (int16 *)malloc(uncompressedSize * sizeof(int16));
+ if (!outBuffer) {
+ print("malloc failed!");
+ free(inBuffer);
+ return;
+ }
+
+ int decodedSampleCount = 0;
+ int16 decodedSamples[2];
+ uint32 samples;
+ byte data;
+ memset(&_status, 0, sizeof(_status));
+
+ for (samples = 0; samples < uncompressedSize; samples++) {
+ if (decodedSampleCount == 0) {
+ data = inBuffer[samples >> 1];
+ decodedSamples[0] = decodeIMA((data >> 4) & 0x0f, 0);
+ decodedSamples[1] = decodeIMA((data >> 0) & 0x0f, channels == 2 ? 1 : 0);
+ decodedSampleCount = 2;
+ }
+ // (1 - (count - 1)) ensures that _decodedSamples acts as a FIFO of depth 2
+ outBuffer[samples] = decodedSamples[1 - (decodedSampleCount - 1)];
+ decodedSampleCount--;
+ }
+
+ Common::removeFile("TEMP.RAW");
+ Common::removeFile(TEMP_RAW);
+ Common::removeFile(TEMP_ENC);
+
+ curFileHandle.open(TEMP_RAW, "wb");
+ for (uint32 i = 0; i < uncompressedSize; i++)
+ curFileHandle.writeUint16LE(outBuffer[i]);
+ curFileHandle.close();
+
+ free(inBuffer);
+ free(outBuffer);
+
+ // Encode this raw data...
+ setRawAudioType(true, true, 16); // LE, stereo, 16-bit
+ encodeAudio(TEMP_RAW, true, rate, TEMP_ENC, _format);
+
+ // Append compressed data to output_smp
+ curFileHandle.open(TEMP_ENC, "rb");
+ curFileHandle.seek(0, SEEK_END);
+ uint32 copyLeft = curFileHandle.pos();
+ curFileHandle.seek(0, SEEK_SET);
+
+ // Write size of compressed data
+ // Write actual data
+ while (copyLeft > 0) {
+ doneRead = curFileHandle.read_noThrow(buffer, copyLeft > sizeof(buffer) ? sizeof(buffer) : copyLeft);
+ if (doneRead <= 0)
+ break;
+ copyLeft -= (int)doneRead;
+ _output_enc.write(buffer, doneRead);
+ }
+}
+
+static const char f_hdr[] = {
+ 'A', 'D', 'P', 0x10, 0
+};
+
+void CompressTony::execute() {
+ Common::Filename inpath_adp = _inputPaths[0].path;
+ Common::Filename &outpath = _outputPath;
+
+ if (outpath.empty())
+ outpath = inpath_adp.getPath();
+
+
+ char buf[2048];
+ _input_adp.open(inpath_adp, "rb");
+ _input_adp.read_throwsOnError(buf, 4);
+ if (strncmp(buf, f_hdr, 4)) {
+ error("Bad ADP");
+ }
+
+ Common::Filename outpath_enc = outpath;
+ outpath_enc.setFullName(inpath_adp.getFullName());
+ switch(_format) {
+ case AUDIO_MP3:
+ outpath_enc.setExtension(".MP3");
+ break;
+ case AUDIO_VORBIS:
+ outpath_enc.setExtension(".OGG");
+ break;
+ case AUDIO_FLAC:
+ outpath_enc.setExtension(".FLA");
+ break;
+ default:
+ throw ToolException("Unknown audio format");
+ break;
+ }
+
+ Common::removeFile(outpath_enc.getFullPath().c_str());
+ _output_enc.open(outpath_enc, "wb");
+
+ convertTonyADPCMSample();
+
+ /* And some clean-up :-) */
+ Common::removeFile(TEMP_RAW);
+ Common::removeFile(TEMP_ENC);
+}
+
+
+#ifdef STANDALONE_MAIN
+int main(int argc, char *argv[]) {
+ CompressTony tony(argv[0]);
+ return tony.run(argc, argv);
+}
+#endif
diff --git a/engines/gob/extract_gob_stk.h b/engines/tony/compress_tony.h
similarity index 62%
copy from engines/gob/extract_gob_stk.h
copy to engines/tony/compress_tony.h
index c8b2df5..472169a 100644
--- a/engines/gob/extract_gob_stk.h
+++ b/engines/tony/compress_tony.h
@@ -19,29 +19,31 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-/* Extractor for Coktel Vision game's .stk/.itk archives */
+#ifndef COMPRESS_TONY_H
+#define COMPRESS_TONY_H
-#ifndef EXTRACT_GOB_STK_H
-#define EXTRACT_GOB_STK_H
+#include "compress.h"
-#include "tool.h"
-class ExtractGobStk : public Tool {
+struct ADPCMStatus {
+ // OKI/IMA
+ struct {
+ int32 last;
+ int32 stepIndex;
+ } ima_ch[2];
+};
+
+class CompressTony : public CompressionTool {
public:
- ExtractGobStk(const std::string &name = "extract_gob_stk");
- ~ExtractGobStk();
+ CompressTony(const std::string &name = "compress_tony");
virtual void execute();
protected:
- struct Chunk;
-
- Chunk *_chunks;
+ Common::File _input_adp, _output_enc;
+ ADPCMStatus _status;
- void readChunkList(Common::File &stk, Common::File &gobConf);
- void readChunkListV2(Common::File &stk, Common::File &gobConf);
- void extractChunks(Common::Filename &outpath, Common::File &stk);
- byte *unpackData(byte *src, uint32 &size);
- byte *unpackPreGobData(byte *src, uint32 &size, uint32 &compSize);
+ int16 decodeIMA(byte code, int channel);
+ void convertTonyADPCMSample();
};
#endif
diff --git a/engines/tony/compress_tony_vdb.cpp b/engines/tony/compress_tony_vdb.cpp
new file mode 100644
index 0000000..d8f59b6
--- /dev/null
+++ b/engines/tony/compress_tony_vdb.cpp
@@ -0,0 +1,251 @@
+/* ScummVM Tools
+ *
+ * ScummVM Tools 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.
+ */
+
+#include <stdlib.h>
+
+#include "compress.h"
+#include "common/endian.h"
+#include "common/str.h"
+#include "compress_tony_vdb.h"
+
+#define TEMP_RAW "tempfile.raw"
+#define TEMP_ENC "tempfile.enc"
+
+template<typename T> inline T CLIP (T v, T amin, T amax) {
+ if (v < amin)
+ return amin;
+ else if (v > amax)
+ return amax;
+ else
+ return v;
+}
+
+CompressTonyVDB::CompressTonyVDB(const std::string &name) : CompressionTool(name, TOOLTYPE_COMPRESSION) {
+ _supportsProgressBar = true;
+
+ ToolInput input1;
+ input1.format = "*.vdb";
+ _inputPaths.push_back(input1);
+
+ _shorthelp = "Used to compress Tony Tough's .vdb files.";
+ _helptext = "\nUsage: " + getName() + " [mode-params] <infile.vdb>\n";
+}
+
+// This table is used to adjust the step for use on the next sample.
+// We could half the table, but since the lookup index used is always
+// a 4-bit nibble, it's more efficient to just keep it as it is.
+const int16 _stepAdjustTable[16] = {
+ -1, -1, -1, -1, 2, 4, 6, 8,
+ -1, -1, -1, -1, 2, 4, 6, 8
+};
+
+const int16 _imaTable[89] = {
+ 7, 8, 9, 10, 11, 12, 13, 14,
+ 16, 17, 19, 21, 23, 25, 28, 31,
+ 34, 37, 41, 45, 50, 55, 60, 66,
+ 73, 80, 88, 97, 107, 118, 130, 143,
+ 157, 173, 190, 209, 230, 253, 279, 307,
+ 337, 371, 408, 449, 494, 544, 598, 658,
+ 724, 796, 876, 963, 1060, 1166, 1282, 1411,
+ 1552, 1707, 1878, 2066, 2272, 2499, 2749, 3024,
+ 3327, 3660, 4026, 4428, 4871, 5358, 5894, 6484,
+ 7132, 7845, 8630, 9493,10442,11487,12635,13899,
+ 15289,16818,18500,20350,22385,24623,27086,29794,
+ 32767
+};
+
+int16 CompressTonyVDB::decodeIMA(byte code, int channel) {
+ int32 E = (2 * (code & 0x7) + 1) * _imaTable[_status.ima_ch[channel].stepIndex] / 8;
+ int32 diff = (code & 0x08) ? -E : E;
+ int32 samp = CLIP<int32>(_status.ima_ch[channel].last + diff, -32768, 32767);
+
+ _status.ima_ch[channel].last = samp;
+ _status.ima_ch[channel].stepIndex += _stepAdjustTable[code];
+ _status.ima_ch[channel].stepIndex = CLIP<int32>(_status.ima_ch[channel].stepIndex, 0, 88);
+
+ return samp;
+}
+
+/* Converts ADPCM-data sample in input_adp to requested dataformat and writes to output_smp */
+/* Quick hack together from adpcm.cpp */
+bool CompressTonyVDB::convertTonyADPCMSample() {
+ Common::File curFileHandle;
+
+ int decodedSampleCount = 0;
+ int16 decodedSamples[2];
+ uint32 samples;
+ byte data;
+ memset(&_status, 0, sizeof(_status));
+
+ for (samples = 0; samples < _uncompressedSize; samples++) {
+ if (decodedSampleCount == 0) {
+ data = _inBuffer[samples >> 1];
+ decodedSamples[0] = decodeIMA((data >> 4) & 0x0f, 0);
+ decodedSamples[1] = decodeIMA((data >> 0) & 0x0f, 0); // 1 channel, hardcoded
+ decodedSampleCount = 2;
+ }
+ // (1 - (count - 1)) ensures that _decodedSamples acts as a FIFO of depth 2
+ _outBuffer[samples] = decodedSamples[1 - (decodedSampleCount - 1)];
+ decodedSampleCount--;
+ }
+
+ Common::removeFile(TEMP_RAW);
+ Common::removeFile(TEMP_ENC);
+
+ curFileHandle.open(TEMP_RAW, "wb");
+ for (uint32 i = 0; i < _uncompressedSize; i++)
+ curFileHandle.writeUint16LE(_outBuffer[i]);
+ curFileHandle.close();
+
+ // Encode this raw data...
+ setRawAudioType(true, false, 16); // LE, stereo, 16-bit
+ encodeAudio(TEMP_RAW, true, _rate, TEMP_ENC, _format);
+
+ return true;
+}
+
+static const char vdb_hdr[] = {
+ 'V', 'D', 'B', '1', 0
+};
+
+void CompressTonyVDB::execute() {
+ Common::Filename inpath_adp = _inputPaths[0].path;
+ Common::Filename &outpath = _outputPath;
+
+ if (outpath.empty())
+ outpath = inpath_adp.getPath();
+
+ char buf[2048];
+ _input_vdb.open(inpath_adp, "rb");
+ _input_vdb.seek(-8, SEEK_END);
+ int numFiles = _input_vdb.readUint32LE();
+ _input_vdb.read_throwsOnError(buf, 4);
+
+ if (strncmp(buf, vdb_hdr, 4)) {
+ error("Unexpected file signature\n");
+ }
+
+ _input_vdb.seek(-8 - (numFiles * 12), SEEK_END);
+ VoiceHeader *vh = new VoiceHeader[numFiles];
+
+ for (int i = 0; i < numFiles; i++) {
+ vh[i]._offset = _input_vdb.readUint32LE();
+ vh[i]._code = _input_vdb.readUint32LE();
+ vh[i]._parts = _input_vdb.readUint32LE();
+ }
+
+ Common::Filename outpath_enc = outpath;
+ outpath_enc.setFullName(inpath_adp.getFullName());
+ switch(_format) {
+ case AUDIO_MP3:
+ outpath_enc.setExtension(".MDB");
+ break;
+ case AUDIO_VORBIS:
+ outpath_enc.setExtension(".ODB");
+ break;
+ case AUDIO_FLAC:
+ outpath_enc.setExtension(".FDB");
+ break;
+ default:
+ throw ToolException("Unknown audio format");
+ break;
+ }
+
+ Common::removeFile(outpath_enc.getFullPath().c_str());
+ _output_enc.open(outpath_enc, "wb");
+
+ for (int i = 0; i < numFiles; i++) {
+ // Update progress
+ updateProgress(i, numFiles);
+
+ _input_vdb.seek(vh[i]._offset, SEEK_SET);
+
+ for (int j = 0; j < vh[i]._parts; j++) {
+ _sampleSize = _input_vdb.readUint32LE();
+ _rate = _input_vdb.readUint32LE();
+ _inBuffer = new byte[_sampleSize];
+ printf("%d\t%d\t%d/%d\n", _input_vdb.pos() - 8, _sampleSize + 8, j + 1, vh[i]._parts);
+ _input_vdb.read_throwsOnError(_inBuffer, _sampleSize);
+ _uncompressedSize = _sampleSize * 2;
+ _outBuffer = new int16[_uncompressedSize];
+ if (convertTonyADPCMSample()) {
+ if (j == 0)
+ vh[i]._offset = _output_enc.pos();
+
+ Common::File curFileHandle;
+ curFileHandle.open(TEMP_ENC, "rb");
+ curFileHandle.seek(0, SEEK_END);
+ uint32 copyLeft = curFileHandle.pos();
+ curFileHandle.seek(0, SEEK_SET);
+ _output_enc.writeUint32LE(copyLeft);
+ uint32 doneRead = 0;
+ char buffer[2048];
+ while (copyLeft > 0) {
+ doneRead = curFileHandle.read_noThrow(buffer, copyLeft > sizeof(buffer) ? sizeof(buffer) : copyLeft);
+ if (doneRead <= 0)
+ break;
+ copyLeft -= (int)doneRead;
+ _output_enc.write(buffer, doneRead);
+ }
+ curFileHandle.close();
+ }
+ delete[](_inBuffer);
+ delete[](_outBuffer);
+ }
+ }
+ for (int i = 0; i < numFiles; i++) {
+ _output_enc.writeUint32LE(vh[i]._offset);
+ _output_enc.writeUint32LE(vh[i]._code);
+ _output_enc.writeUint32LE(vh[i]._parts);
+ }
+
+ _output_enc.writeUint32LE(numFiles);
+ switch(_format) {
+ case AUDIO_MP3:
+ _output_enc.writeByte('M');
+ break;
+ case AUDIO_VORBIS:
+ _output_enc.writeByte('O');
+ break;
+ case AUDIO_FLAC:
+ _output_enc.writeByte('F');
+ break;
+ default:
+ break;
+ }
+
+ for (int i = 1; i < 4; i++)
+ _output_enc.writeByte(vdb_hdr[i]);
+
+ _output_enc.close();
+
+ /* And some clean-up :-) */
+ Common::removeFile(TEMP_RAW);
+ Common::removeFile(TEMP_ENC);
+}
+
+
+#ifdef STANDALONE_MAIN
+int main(int argc, char *argv[]) {
+ CompressTonyVDB tony(argv[0]);
+ return tony.run(argc, argv);
+}
+#endif
diff --git a/engines/gob/extract_gob_stk.h b/engines/tony/compress_tony_vdb.h
similarity index 62%
copy from engines/gob/extract_gob_stk.h
copy to engines/tony/compress_tony_vdb.h
index c8b2df5..258db32 100644
--- a/engines/gob/extract_gob_stk.h
+++ b/engines/tony/compress_tony_vdb.h
@@ -19,29 +19,35 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-/* Extractor for Coktel Vision game's .stk/.itk archives */
+#ifndef COMPRESS_TONY_VDB_H
+#define COMPRESS_TONY_VDB_H
-#ifndef EXTRACT_GOB_STK_H
-#define EXTRACT_GOB_STK_H
+#include "compress_tony.h"
+#include "compress.h"
-#include "tool.h"
-class ExtractGobStk : public Tool {
+struct VoiceHeader {
+ int _offset;
+ int _code;
+ int _parts;
+};
+
+class CompressTonyVDB : public CompressionTool {
public:
- ExtractGobStk(const std::string &name = "extract_gob_stk");
- ~ExtractGobStk();
+ CompressTonyVDB(const std::string &name = "compress_tony_vdb");
virtual void execute();
protected:
- struct Chunk;
-
- Chunk *_chunks;
-
- void readChunkList(Common::File &stk, Common::File &gobConf);
- void readChunkListV2(Common::File &stk, Common::File &gobConf);
- void extractChunks(Common::Filename &outpath, Common::File &stk);
- byte *unpackData(byte *src, uint32 &size);
- byte *unpackPreGobData(byte *src, uint32 &size, uint32 &compSize);
+ Common::File _input_vdb, _output_enc;
+ ADPCMStatus _status;
+ uint32 _sampleSize;
+ uint32 _rate;
+ byte *_inBuffer;
+ int16 *_outBuffer;
+ uint32 _uncompressedSize;
+
+ int16 decodeIMA(byte code, int channel);
+ bool convertTonyADPCMSample();
};
#endif
diff --git a/gui/main.cpp b/gui/main.cpp
index 848bd05..4f28ba3 100644
--- a/gui/main.cpp
+++ b/gui/main.cpp
@@ -125,7 +125,7 @@ void ScummVMToolsApp::OnAbout() {
wxHyperlinkCtrl *websitetext = new wxHyperlinkCtrl(dialog, wxID_ANY, wxT("http://www.scummvm.org"), wxT("http://www.scummvm.org"));
sizer->Add(websitetext, wxSizerFlags().Border(wxTOP, 5));
- wxStaticText *copyrighttext = new wxStaticText(dialog, wxID_ANY, wxT("Copyright ScummVM Team 2009-2012"));
+ wxStaticText *copyrighttext = new wxStaticText(dialog, wxID_ANY, wxT("Copyright ScummVM Team 2009-2016"));
copyrighttext->SetFont(wxFont(8, wxSWISS, wxNORMAL, wxNORMAL, false, wxT("Arial")));
sizer->Add(copyrighttext, wxSizerFlags());
diff --git a/gui/pages.cpp b/gui/pages.cpp
index 9a0b74d..025fa50 100644
--- a/gui/pages.cpp
+++ b/gui/pages.cpp
@@ -888,7 +888,7 @@ wxWindow *ChooseAudioOptionsMp3Page::CreatePanel(wxWindow *parent) {
/*
"\nMP3 mode params:\n"
- " --lame-path <path> Path to the lame excutable to use (default: lame)\n"
+ " --lame-path <path> Path to the lame executable to use (default: lame)\n"
" -b <rate> <rate> is the target bitrate(ABR)/minimal bitrate(VBR) (default:" minBitrDef_str "%d)\n"
" -B <rate> <rate> is the maximum VBR/ABR bitrate (default:%" maxBitrDef_str ")\n"
" --vbr LAME uses the VBR mode (default)\n"
@@ -1522,7 +1522,7 @@ wxThread::ExitCode ProcessToolThread::Entry() {
_success = true;
} catch (ToolException &err) {
wxMutexLocker lock(_output.mutex);
- _output.buffer = _output.buffer + "\nFatal Error Occured: " + err.what() + "\n";
+ _output.buffer = _output.buffer + "\nFatal Error Occurred: " + err.what() + "\n";
}
_finished = true;
return NULL;
diff --git a/internal_version.h b/internal_version.h
index 6d40fee..ab7f855 100644
--- a/internal_version.h
+++ b/internal_version.h
@@ -2,4 +2,4 @@
#define SCUMMVM_TOOLS_SVN_REVISION
#endif
-#define SCUMMVM_TOOLS_VERSION "1.7.0" SCUMMVM_TOOLS_SVN_REVISION
+#define SCUMMVM_TOOLS_VERSION "1.8.0" SCUMMVM_TOOLS_SVN_REVISION
diff --git a/sound/audiostream.h b/sound/audiostream.h
index 9c47417..0ff87e5 100644
--- a/sound/audiostream.h
+++ b/sound/audiostream.h
@@ -62,7 +62,7 @@ public:
/**
* Fill the given buffer with up to numSamples samples.
* Returns the actual number of samples read, or -1 if
- * a critical error occured (note: you *must* check if
+ * a critical error occurred (note: you *must* check if
* this value is less than what you requested, this can
* happen when the stream is fully used up).
*
diff --git a/tool.cpp b/tool.cpp
index 15f09e8..e34fc2c 100644
--- a/tool.cpp
+++ b/tool.cpp
@@ -142,6 +142,12 @@ void Tool::clearInputPaths() {
}
bool Tool::addInputPath(const std::string& in) {
+ // Check the input is acceptable. Usually this is done when calling inspectInput(filename, format),
+ // but inspectInput(filename) might be reimplemented to be more restrictive (especially when the
+ // format is "*.*").
+ if (inspectInput(in) == IMATCH_AWFUL)
+ return false;
+ // Now we know it matches. Look for the best match.
int bestMatchIndex = -1;
InspectionMatch bestMatch = IMATCH_AWFUL;
for (ToolInputs::iterator iter = _inputPaths.begin(); iter != _inputPaths.end(); ++iter) {
diff --git a/tools.cpp b/tools.cpp
index af80aca..48aa65a 100644
--- a/tools.cpp
+++ b/tools.cpp
@@ -37,6 +37,8 @@
#include "engines/sword2/compress_sword2.h"
#include "engines/touche/compress_touche.h"
#include "engines/tinsel/compress_tinsel.h"
+#include "engines/tony/compress_tony.h"
+#include "engines/tony/compress_tony_vdb.h"
#include "engines/touche/compress_touche.h"
#include "engines/tucker/compress_tucker.h"
@@ -52,6 +54,8 @@
#include "engines/gob/extract_gob_stk.h"
#include "engines/gob/extract_fascination_cd.h"
#include "engines/kyra/extract_kyra.h"
+#include "engines/prince/extract_prince.h"
+#include "engines/prince/pack_prince.h"
#include "engines/scumm/extract_loom_tg16.h"
#include "engines/scumm/extract_mm_apple.h"
#include "engines/scumm/extract_mm_c64.h"
@@ -74,6 +78,8 @@ Tools::Tools() {
_tools.push_back(new CompressSword1());
_tools.push_back(new CompressSword2());
_tools.push_back(new CompressTinsel());
+ _tools.push_back(new CompressTony());
+ _tools.push_back(new CompressTonyVDB());
_tools.push_back(new CompressTouche());
_tools.push_back(new CompressTucker());
@@ -89,6 +95,8 @@ Tools::Tools() {
_tools.push_back(new ExtractGobStk());
_tools.push_back(new ExtractFascinationCD());
_tools.push_back(new ExtractKyra());
+ _tools.push_back(new ExtractPrince());
+ _tools.push_back(new PackPrince());
_tools.push_back(new ExtractLoomTG16());
_tools.push_back(new ExtractMMApple());
_tools.push_back(new ExtractMMC64());
--
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