[Scummvm-git-logs] scummvm master -> 597a333f773ba651dae0b24362cd63f19ad5f3d1
sev-
sev at scummvm.org
Tue Jun 22 08:11:16 UTC 2021
This automated email contains information about 29 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
40f6c70841 PRIVATE: preliminary support for decompiled game assets
f10fb7fbad PRIVATE: first version of bytecode decompiler
6c80b049af PRIVATE: integrated first version of the decompiler
1f1b9baebc PRIVATE: fixes
0d5f191b7b PRIVATE: added license headers
63413b6d23 PRIVATE: better compatibility with non-US versions
297175310f PRIVATE: more fixes
a1170b44f3 PRIVATE: removed old code, commented debugs and fixes
54ace30a33 PRIVATE: fixed debug statement
252ad4cb00 PRIVATE: added german versions in the detection tables
458df46dc9 PRIVATE: clang-formatted all the code
adf77a709f PRIVATE: use Common::Language for _language
3f1fc23302 PRIVATE: improved error detail when an unknown byte is decompiled
863717b39d PRIVATE: replaced unsigned char -> byte and unsigned int -> uint
2a2cac190d PRIVATE: refactored kHeader to avoid a global constructor
e7a605f4ec PRIVATE: removed useless local variable in install
c871c1e36b PRIVATE: added a debug print to show the decompiled code
0458421ec4 PRIVATE: added a new line at the end of the decompiler sources
4edbd5a1aa PRIVATE: removed commented debug statement in SettingMaps::load
9f2fdc8775 PRIVATE: moved constants from decompiler.h to decompiler.cpp to avoid duplicated symbols
ef997be591 PRIVATE: removed extra whitespace in detection entry
b3349c6a38 PRIVATE: removed duplicated and commented detection entries
37380da875 PRIVATE: removed unnecessary Common::SeekableReadStream cast
839707f223 PRIVATE: basic support for the uncompressed/installed MacOS release
226ce849b4 PRIVATE: improved MacOS release detection to use two files
f97666b4df PRIVATE: Add initial author in decompiler.cpp and .h
9bec6e271b PRIVATE: added detection of the russian release
139230264e PRIVATE: added demo and compressed versions of the MacOS release
597a333f77 PRIVATE: avoid invalid detection of MacOS release
Commit: 40f6c70841f66d0aeebd54c1074cc733f544ab8a
https://github.com/scummvm/scummvm/commit/40f6c70841f66d0aeebd54c1074cc733f544ab8a
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2021-06-22T10:10:53+02:00
Commit Message:
PRIVATE: preliminary support for decompiled game assets
Changed paths:
engines/private/code.cpp
engines/private/cursors.cpp
engines/private/detection.cpp
engines/private/funcs.cpp
engines/private/private.cpp
engines/private/symbol.cpp
engines/private/symbol.h
diff --git a/engines/private/code.cpp b/engines/private/code.cpp
index 5aa8ba9229..a29335d36e 100644
--- a/engines/private/code.cpp
+++ b/engines/private/code.cpp
@@ -82,6 +82,7 @@ void SettingMaps::save(const char *name) {
}
void SettingMaps::load(const Common::String &name) {
+ debug("loading: %s", name.c_str());
assert(_map.contains(name));
_setting = _map.getVal(name);
@@ -164,14 +165,17 @@ int eval() {
if (d.u.sym->type == NUM) {
d.type = NUM;
d.u.val = d.u.sym->u.val;
+ debugC(1, kPrivateDebugCode, "eval NUM returned %d", d.u.val );
} else if (d.u.sym->type == STRING) {
d.type = STRING;
d.u.str = d.u.sym->u.str;
- debugC(1, kPrivateDebugCode, "eval returned %s", d.u.str );
+ debugC(1, kPrivateDebugCode, "eval STR returned %s", d.u.str );
} else if (d.u.sym->type == RECT) {
d.type = RECT;
d.u.rect = d.u.sym->u.rect;
+ debugC(1, kPrivateDebugCode, "eval RECT");
} else if (d.u.sym->type == NAME) {
+ debugC(1, kPrivateDebugCode, "eval NAME is noop");
// No evaluation until is absolutely needed
} else
assert(0);
diff --git a/engines/private/cursors.cpp b/engines/private/cursors.cpp
index 4109b07e82..f243e3b1c1 100644
--- a/engines/private/cursors.cpp
+++ b/engines/private/cursors.cpp
@@ -300,6 +300,7 @@ static const byte cursorPalette[] = {
struct CursorTable {
const char *name;
+ const char *aname;
const void *buf;
int w;
int h;
@@ -308,21 +309,21 @@ struct CursorTable {
};
static const CursorTable cursorTable[] = {
- { "kExit", MOUSECURSOR_kExit, 32, 32, 9, 0 },
- { "kInventory", MOUSECURSOR_kInventory, 32, 32, 15, 3 },
- { "kTurnLeft", MOUSECURSOR_kTurnLeft, 32, 32, 29, 16 },
- { "kTurnRight", MOUSECURSOR_kTurnRight, 32, 32, 1, 15 },
- { "kZoomIn", MOUSECURSOR_kZoomIn, 32, 32, 10, 8 },
- { "kZoomOut", MOUSECURSOR_kZoomOut, 32, 32, 13, 31 },
- { "kPhone", MOUSECURSOR_kPhone, 32, 32, 17, 19 },
- { "default", MOUSECURSOR_SCI, 11, 16, 0, 0 },
- { nullptr, nullptr, 0, 0, 0, 0 }
+ { "kExit", "k5", MOUSECURSOR_kExit, 32, 32, 9, 0 },
+ { "kInventory", "", MOUSECURSOR_kInventory, 32, 32, 15, 3 },
+ { "kTurnLeft", "", MOUSECURSOR_kTurnLeft, 32, 32, 29, 16 },
+ { "kTurnRight", "", MOUSECURSOR_kTurnRight, 32, 32, 1, 15 },
+ { "kZoomIn", "", MOUSECURSOR_kZoomIn, 32, 32, 10, 8 },
+ { "kZoomOut", "", MOUSECURSOR_kZoomOut, 32, 32, 13, 31 },
+ { "kPhone", "", MOUSECURSOR_kPhone, 32, 32, 17, 19 },
+ { "default", "", MOUSECURSOR_SCI, 11, 16, 0, 0 },
+ { nullptr, nullptr, nullptr, 0, 0, 0, 0 }
};
void PrivateEngine::changeCursor(const Common::String &cursor) {
const CursorTable *entry = cursorTable;
while (entry->name) {
- if (cursor == entry->name)
+ if (cursor == entry->name || cursor == entry->aname)
break;
entry++;
}
diff --git a/engines/private/detection.cpp b/engines/private/detection.cpp
index ab85cd184d..3010f15fe9 100644
--- a/engines/private/detection.cpp
+++ b/engines/private/detection.cpp
@@ -75,7 +75,7 @@ static const ADGameDescription gameDescriptions[] = {
"bklynlgo.bmp", "1dfb703349a46f8ec183de107992b7f5", 33118),
Common::EN_GRB,
Common::kPlatformWindows,
- ADGF_DEMO | ADGF_UNSUPPORTED,
+ ADGF_DEMO | ADGF_TESTING,
GUIO1(GUIO_NOMIDI)
},
{
diff --git a/engines/private/funcs.cpp b/engines/private/funcs.cpp
index e1de7ae041..1eb1f75dd3 100644
--- a/engines/private/funcs.cpp
+++ b/engines/private/funcs.cpp
@@ -34,14 +34,14 @@ static void fChgMode(ArgArray args) {
// assert types
assert (args.size() == 2 || args.size() == 3);
if (args.size() == 2)
- debugC(1, kPrivateDebugScript, "ChgMode(%d, %s)", args[0].u.val, args[1].u.str);
+ debugC(1, kPrivateDebugScript, "ChgMode(%d, %s)", args[0].u.val, args[1].u.sym->name->c_str());
else if (args.size() == 3)
debugC(1, kPrivateDebugScript, "ChgMode(%d, %s, %s)", args[0].u.val, args[1].u.str, args[2].u.sym->name->c_str());
else
assert(0);
g_private->_mode = args[0].u.val;
- g_private->_nextSetting = args[1].u.str;
+ g_private->_nextSetting = args[1].u.sym->name->c_str();
if (g_private->_mode == 0) {
g_private->_origin = Common::Point(kOriginZero[0], kOriginZero[1]);
@@ -407,7 +407,7 @@ static void fExit(ArgArray args) {
if (args[0].type == NUM && args[0].u.val == 0)
e.nextSetting = "";
else
- e.nextSetting = args[0].u.str;
+ e.nextSetting = args[0].u.sym->name->c_str();
if (args[1].type == NUM && args[1].u.val == 0)
e.cursor = "";
@@ -415,8 +415,9 @@ static void fExit(ArgArray args) {
e.cursor = *args[1].u.sym->name;
if (args[2].type == NAME) {
- assert(args[2].u.sym->type == RECT);
- args[2].u.rect = args[2].u.sym->u.rect;
+ Symbol *rect = g_private->maps.lookupRect(args[2].u.sym->name);
+ assert(rect->type == RECT);
+ args[2].u.rect = rect->u.rect;
}
e.rect = *args[2].u.rect;
@@ -564,7 +565,7 @@ static void _fMask(ArgArray args, bool drawn) {
int x = 0;
int y = 0;
const char *f = args[0].u.str;
- const char *e = args[1].u.str;
+ const char *e = args[1].u.sym->name->c_str();
Common::String *c = args[2].u.sym->name;
if (args.size() == 5) {
@@ -710,13 +711,13 @@ static void fTimer(ArgArray args) {
assert (args.size() == 2 || args.size() == 3);
if (args.size() == 3)
- debugC(1, kPrivateDebugScript, "Timer(%d, %s, %s)", args[0].u.val, args[1].u.str, args[2].u.str);
+ debugC(1, kPrivateDebugScript, "Timer(%d, %s, %s)", args[0].u.val, args[1].u.sym->name->c_str(), args[2].u.sym->name->c_str());
else
debugC(1, kPrivateDebugScript, "Timer(%d, %s)", args[0].u.val, args[1].u.str);
int32 delay = 1000000 * args[0].u.val;
// This pointer is necessary since installTimer needs one
- Common::String *s = new Common::String(args[1].u.str);
+ Common::String *s = new Common::String(args[1].u.sym->name->c_str());
if (delay > 0) {
assert(g_private->installTimer(delay, s));
} else if (delay == 0) {
diff --git a/engines/private/private.cpp b/engines/private/private.cpp
index f1c38d12bd..422433aacc 100644
--- a/engines/private/private.cpp
+++ b/engines/private/private.cpp
@@ -134,12 +134,14 @@ Common::Error PrivateEngine::run() {
file = _installerArchive.createReadStreamForMember("GAME.TXT");
// if the demo from the full retail CDROM is used
- else {
- if (_installerArchive.hasFile("DEMOGAME.DAT"))
+ else if (_installerArchive.hasFile("DEMOGAME.DAT"))
file = _installerArchive.createReadStreamForMember("DEMOGAME.DAT");
+ else {
+ Common::File *f = new Common::File();
+ f->open("SUPPORT/GAME.DUMP");
+ file = f;
}
- }
-
+ }
// Read assets file
assert(file != NULL);
const int32 fileSize = file->size();
@@ -184,7 +186,12 @@ Common::Error PrivateEngine::run() {
if (saveSlot >= 0) { // load the savegame
loadGameState(saveSlot);
} else {
- _nextSetting = "kGoIntro";
+ if (Private::Settings::g_setts->_map.contains("kGoIntro"))
+ _nextSetting = "kGoIntro";
+ else if (Private::Settings::g_setts->_map.contains("k58"))
+ _nextSetting = "k58";
+ else
+ error("No setting to start");
}
while (!shouldQuit()) {
@@ -275,7 +282,7 @@ Common::Error PrivateEngine::run() {
if (!_nextSetting.empty()) {
removeTimer();
- debugC(1, kPrivateDebugFunction, "Executing %s", _nextSetting.c_str());
+ debug("Executing %s", _nextSetting.c_str());
clearAreas();
_currentSetting = _nextSetting;
Settings::g_setts->load(_nextSetting);
diff --git a/engines/private/symbol.cpp b/engines/private/symbol.cpp
index bffea6447c..26f5bb0e1c 100644
--- a/engines/private/symbol.cpp
+++ b/engines/private/symbol.cpp
@@ -89,8 +89,14 @@ static Symbol *install(const Common::String &n, int t, int d, const char *s, Com
sp = (Symbol *)malloc(sizeof(Symbol));
sp->name = name;
sp->type = t;
- if (t == NUM || t == NAME)
+ if (t == NUM) {
+ sp->u.val = d;
+ debug("install NUM: %s %d", name->c_str(), d);
+ }
+ else if (t == NAME) {
sp->u.val = d;
+ debug("installing NAME: %s %d", name->c_str(), d);
+ }
else if (t == STRING)
sp->u.str = scumm_strdup(s); // FIXME: leaks a string here.
else if (t == RECT)
@@ -103,9 +109,18 @@ static Symbol *install(const Common::String &n, int t, int d, const char *s, Com
return sp;
}
+
+/* lookup some name in some symbol table */
+Symbol *SymbolMaps::lookupRect(Common::String *n) {
+ debug("looking rect up %s", n->c_str());
+
+ assert(rects.contains(*n));
+ return lookup(*n, rects);
+}
+
/* lookup some name in some symbol table */
Symbol *SymbolMaps::lookupName(const char *n) {
- //debug("looking up %s", n);
+ debug("looking up %s", n);
Common::String s(n);
if (settings.contains(s))
@@ -139,7 +154,7 @@ void SymbolMaps::installAll(const char *n) {
//debug("name %s", s.c_str());
if (strcmp(n, "settings") == 0) {
assert(r == NULL);
- install(s, STRING, 0, s.c_str(), r, &settings);
+ install(s, NAME, 0, s.c_str(), r, &settings);
} else if (strcmp(n, "variables") == 0) {
assert(r == NULL);
install(s, NAME, 0, NULL, r, &variables);
diff --git a/engines/private/symbol.h b/engines/private/symbol.h
index ae601b2e15..3e1d98abb2 100644
--- a/engines/private/symbol.h
+++ b/engines/private/symbol.h
@@ -71,6 +71,7 @@ public:
NameList locationList;
Symbol *constant(int t, int d, const char *s);
+ Symbol *lookupRect(Common::String *n);
Symbol *lookupName(const char *n);
void installAll(const char *n);
void defineSymbol(const char *, Common::Rect *);
Commit: f10fb7fbad9a78dca978f5bcd845cc0ac20d9a5c
https://github.com/scummvm/scummvm/commit/f10fb7fbad9a78dca978f5bcd845cc0ac20d9a5c
Author: Francisco Javier Diéguez Tirado (javi.dieguez at gmail.com)
Date: 2021-06-22T10:10:53+02:00
Commit Message:
PRIVATE: first version of bytecode decompiler
Meant to be compiled as standalone tool. Not yet integrated
into game engine.
Changed paths:
A engines/private/decompiler.cpp
A engines/private/decompiler.h
diff --git a/engines/private/decompiler.cpp b/engines/private/decompiler.cpp
new file mode 100644
index 0000000000..66824686c8
--- /dev/null
+++ b/engines/private/decompiler.cpp
@@ -0,0 +1,66 @@
+#include <fstream>
+#include <sstream>
+#include "decompiler.h"
+
+namespace Private {
+
+Decompiler::~Decompiler() {
+}
+
+Decompiler::Decompiler(const std::string &fileName, bool mac) {
+ std::ifstream infile(fileName);
+ if (!infile.good())
+ throw std::invalid_argument("File does not exist");
+ std::ifstream input(fileName, std::ios::binary);
+ std::vector<unsigned char> buffer(std::istreambuf_iterator<char>(input), {});
+ decompile(buffer, mac);
+}
+Decompiler::Decompiler(std::vector<unsigned char> &buffer, bool mac) {
+ decompile(buffer, mac);
+}
+
+void Decompiler::decompile(std::vector<unsigned char> &buffer, bool mac) {
+ std::vector<unsigned char>::iterator it = buffer.begin();
+
+ std::string firstBytes(it, it + kHeader.length());
+ if (firstBytes != kHeader) {
+ throw std::invalid_argument("Not a precompiled game matrix");
+ }
+
+ std::stringstream ss;
+ bool inDefineRects = false;
+ for (it += kHeader.length() ; it != buffer.end() ; ) {
+ unsigned char byte = *it++;
+ if (byte == kCodeString) {
+ unsigned char len = *it++;
+ std::string s(it,it+len);
+ it += len;
+ ss << "\"" << s << "\"";
+ } else if (byte == kCodeShortLiteral || byte == kCodeShortId) {
+ unsigned char b1 = *it++;
+ unsigned char b2 = *it++;
+ unsigned int number = mac ? b2 + (b1 << 8) : b1 + (b2 << 8);
+ if (byte == kCodeShortId) ss << "k";
+ ss << number;
+ } else if (byte == kCodeRect && inDefineRects) {
+ ss << "RECT"; // override CRect
+ } else if (byte <= kCodeShortId && kCodeTable[byte].length() > 0) {
+ ss << kCodeTable[byte];
+ } else {
+ throw std::invalid_argument("Unknown byte code");
+ }
+
+ if (byte == kCodeRects) {
+ inDefineRects = true;
+ } else if (byte == kCodeBraceClose && inDefineRects) {
+ inDefineRects = false;
+ }
+ }
+ _result = ss.str();
+}
+
+void Decompiler::getResult(std::string &result) const {
+ result = _result;
+}
+
+}
diff --git a/engines/private/decompiler.h b/engines/private/decompiler.h
new file mode 100644
index 0000000000..4d8796f07d
--- /dev/null
+++ b/engines/private/decompiler.h
@@ -0,0 +1,109 @@
+#include <vector>
+#include <string>
+
+namespace Private {
+
+const std::string kHeader("Precompiled Game Matrix");
+
+const unsigned char kCodeString = 0x01;
+const unsigned char kCodeShortLiteral = 0x02;
+const unsigned char kCodeBraceClose = 0x04;
+const unsigned char kCodeRect = 0x2e;
+const unsigned char kCodeRects = 0x4f;
+const unsigned char kCodeShortId = 0x50;
+
+const std::vector<std::string> kCodeTable = {"", //
+ "", // 0x01 (string)
+ "", // 0x02 (short literal)
+ " {\n", // 0x03
+ "}\n", // 0x04
+ "(", // 0x05
+ ")", // 0x06
+ "", //
+ "", //
+ "", //
+ ",", // 0x0a
+ "", //
+ "%", // 0x0c
+ "", //
+ ";\n", // 0x0e
+ "!", // 0x0f
+ "-", // 0x10
+ "+", // 0x11
+ "=", // 0x12
+ ">", // 0x13
+ "<", // 0x14
+ "if ", // 0x15
+ "else ", // 0x16
+ "Exit", // 0x17
+ "goto", // 0x18
+ "Mask", // 0x19
+ "MaskDrawn", // 0x1a
+ "Movie", // 0x1b
+ "Transition", // 0x1c
+ "ThumbnailMovie", // 0x1d
+ "BustMovie", // 0x1e
+ "ViewScreen", // 0x1f
+ "VSPicture", // 0x20
+ "Bitmap", // 0x21
+ "Timer", // 0x22
+ "SoundArea", // 0x23
+ "Sound", // 0x24
+ "SoundEffect", // 0x25
+ "SyncSound", // 0x26
+ "LoopedSound", // 0x27
+ "NoStopSounds", // 0x28
+ "Resume", // 0x29
+ "Inventory", // 0x2a
+ "SetFlag", // 0x2b
+ "ChgMode", // 0x2c
+ "PoliceBust", // 0x2d
+ "CRect", // 0x2e overridden with "RECT" if in "define rects" block
+ "", //
+ "Random", // 0x30
+ "SafeDigit", // 0x31
+ "LoseInventory", // 0x32
+ "", //
+ "PaperShuffleSound", // 0x34
+ "Quit", // 0x35
+ "DossierAdd", // 0x36
+ "DossierBitmap", // 0x37
+ "DossierPrevSuspect", // 0x38
+ "DossierNextSuspect", // 0x39
+ "DossierChgSheet", // 0x3a
+ "DiaryLocList", // 0x3b
+ "DiaryPage", // 0x3c
+ "DiaryInvList", // 0x3d
+ "DiaryPageTurn", // 0x3e
+ "DiaryGoLoc", // 0x3f
+ "SaveGame", // 0x40
+ "LoadGame", // 0x41
+ "RestartGame", // 0x42
+ "AskSave", // 0x43
+ "SetModifiedFlag", // 0x44
+ "PhoneClip", // 0x45
+ "PoliceClip", // 0x46
+ "AMRadioClip", // 0x47
+ "\nsetting ", // 0x48
+ "debug ", // 0x49
+ "\ndefine ", // 0x4a
+ "", //
+ "variables", // 0x4c
+ "", //
+ "", //
+ "rects", // 0x4f
+ ""}; // 0x50 (short id)
+
+
+class Decompiler {
+public:
+ Decompiler(const std::string &filename, bool mac = false);
+ Decompiler(std::vector<unsigned char> &buffer, bool mac = false);
+ virtual ~Decompiler();
+ void getResult(std::string &result) const;
+private:
+ void decompile(std::vector<unsigned char> &buffer, bool mac);
+ std::string _result;
+};
+
+}
Commit: 6c80b049af988307a82a8e5dc09e35e68995211c
https://github.com/scummvm/scummvm/commit/6c80b049af988307a82a8e5dc09e35e68995211c
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2021-06-22T10:10:53+02:00
Commit Message:
PRIVATE: integrated first version of the decompiler
Changed paths:
engines/private/decompiler.cpp
engines/private/decompiler.h
engines/private/detection.cpp
engines/private/module.mk
engines/private/private.cpp
engines/private/symbol.cpp
engines/private/symbol.h
diff --git a/engines/private/decompiler.cpp b/engines/private/decompiler.cpp
index 66824686c8..749ab8a2cc 100644
--- a/engines/private/decompiler.cpp
+++ b/engines/private/decompiler.cpp
@@ -1,53 +1,49 @@
-#include <fstream>
-#include <sstream>
-#include "decompiler.h"
+#include "private/decompiler.h"
namespace Private {
-Decompiler::~Decompiler() {
-}
+Decompiler::Decompiler(char *buf, uint32 fileSize, bool mac) {
-Decompiler::Decompiler(const std::string &fileName, bool mac) {
- std::ifstream infile(fileName);
- if (!infile.good())
- throw std::invalid_argument("File does not exist");
- std::ifstream input(fileName, std::ios::binary);
- std::vector<unsigned char> buffer(std::istreambuf_iterator<char>(input), {});
- decompile(buffer, mac);
-}
-Decompiler::Decompiler(std::vector<unsigned char> &buffer, bool mac) {
- decompile(buffer, mac);
+ Common::Array<unsigned char> array;
+ uint32 i = 0;
+ while (i < fileSize) {
+ array.push_back(buf[i]);
+ i++;
+ }
+ decompile(array, mac);
}
-void Decompiler::decompile(std::vector<unsigned char> &buffer, bool mac) {
- std::vector<unsigned char>::iterator it = buffer.begin();
+void Decompiler::decompile(Common::Array<unsigned char> &buffer, bool mac) {
+ Common::Array<unsigned char>::iterator it = buffer.begin();
+
+ Common::String firstBytes((const char *) it, (const char *) it + kHeader.size());
+ //debug("first bytes \"%s\"", firstBytes.c_str());
- std::string firstBytes(it, it + kHeader.length());
if (firstBytes != kHeader) {
- throw std::invalid_argument("Not a precompiled game matrix");
+ error("Not a precompiled game matrix");
}
-
- std::stringstream ss;
+
+ Common::String ss;
bool inDefineRects = false;
- for (it += kHeader.length() ; it != buffer.end() ; ) {
+ for (it += kHeader.size() ; it != buffer.end() ; ) {
unsigned char byte = *it++;
if (byte == kCodeString) {
unsigned char len = *it++;
- std::string s(it,it+len);
+ Common::String s((const char *)it,(const char *)it+len);
it += len;
- ss << "\"" << s << "\"";
+ ss += Common::String::format("\"%s\"", s.c_str());
} else if (byte == kCodeShortLiteral || byte == kCodeShortId) {
unsigned char b1 = *it++;
unsigned char b2 = *it++;
unsigned int number = mac ? b2 + (b1 << 8) : b1 + (b2 << 8);
- if (byte == kCodeShortId) ss << "k";
- ss << number;
+ if (byte == kCodeShortId) ss += "k";
+ ss += Common::String::format("%d", number);
} else if (byte == kCodeRect && inDefineRects) {
- ss << "RECT"; // override CRect
- } else if (byte <= kCodeShortId && kCodeTable[byte].length() > 0) {
- ss << kCodeTable[byte];
+ ss += "RECT"; // override CRect
+ } else if (byte <= kCodeShortId && strlen(kCodeTable[byte]) > 0) {
+ ss += kCodeTable[byte];
} else {
- throw std::invalid_argument("Unknown byte code");
+ error("Unknown byte code");
}
if (byte == kCodeRects) {
@@ -56,11 +52,11 @@ void Decompiler::decompile(std::vector<unsigned char> &buffer, bool mac) {
inDefineRects = false;
}
}
- _result = ss.str();
+ _result = ss;
}
-void Decompiler::getResult(std::string &result) const {
- result = _result;
+Common::String Decompiler::getResult() const {
+ return _result;
}
-}
+}
\ No newline at end of file
diff --git a/engines/private/decompiler.h b/engines/private/decompiler.h
index 4d8796f07d..ba7e657344 100644
--- a/engines/private/decompiler.h
+++ b/engines/private/decompiler.h
@@ -1,9 +1,13 @@
-#include <vector>
-#include <string>
+#ifndef PRIVATE_DECOMPILER_H
+#define PRIVATE_DECOMPILER_H
+
+#include "common/array.h"
+#include "common/str.h"
+#include "common/debug.h"
namespace Private {
-const std::string kHeader("Precompiled Game Matrix");
+const Common::String kHeader = "Precompiled Game Matrix";
const unsigned char kCodeString = 0x01;
const unsigned char kCodeShortLiteral = 0x02;
@@ -12,7 +16,7 @@ const unsigned char kCodeRect = 0x2e;
const unsigned char kCodeRects = 0x4f;
const unsigned char kCodeShortId = 0x50;
-const std::vector<std::string> kCodeTable = {"", //
+const static char *kCodeTable[] = {"", //
"", // 0x01 (string)
"", // 0x02 (short literal)
" {\n", // 0x03
@@ -92,18 +96,19 @@ const std::vector<std::string> kCodeTable = {"", //
"", //
"", //
"rects", // 0x4f
- ""}; // 0x50 (short id)
+ ""
+ }; // 0x50 (short id)
class Decompiler {
public:
- Decompiler(const std::string &filename, bool mac = false);
- Decompiler(std::vector<unsigned char> &buffer, bool mac = false);
- virtual ~Decompiler();
- void getResult(std::string &result) const;
+ Decompiler(char *buf, uint32 fileSize, bool mac = false);
+ Common::String getResult() const;
private:
- void decompile(std::vector<unsigned char> &buffer, bool mac);
- std::string _result;
+ void decompile(Common::Array<unsigned char> &buffer, bool mac);
+ Common::String _result;
};
}
+
+#endif
\ No newline at end of file
diff --git a/engines/private/detection.cpp b/engines/private/detection.cpp
index 3010f15fe9..da9a0d59df 100644
--- a/engines/private/detection.cpp
+++ b/engines/private/detection.cpp
@@ -65,7 +65,7 @@ static const ADGameDescription gameDescriptions[] = {
"bklynlgo.bmp", "1dfb703349a46f8ec183de107992b7f5", 33118),
Common::EN_GRB,
Common::kPlatformWindows,
- ADGF_UNSUPPORTED,
+ ADGF_UNSTABLE,
GUIO1(GUIO_NOMIDI)
},
{
@@ -75,7 +75,7 @@ static const ADGameDescription gameDescriptions[] = {
"bklynlgo.bmp", "1dfb703349a46f8ec183de107992b7f5", 33118),
Common::EN_GRB,
Common::kPlatformWindows,
- ADGF_DEMO | ADGF_TESTING,
+ ADGF_DEMO | ADGF_UNSTABLE,
GUIO1(GUIO_NOMIDI)
},
{
@@ -100,32 +100,32 @@ static const ADGameDescription gameDescriptions[] = {
},
{
"private-eye", // EU release (ES)
- "It uses different file format for the assest",
+ "Demo",
AD_ENTRY2s("pvteye.ex_", "f41770550ab717086b2d0c805fef4b8f", 498176,
"bklynlgo.bmp", "1dfb703349a46f8ec183de107992b7f5", 33118),
Common::ES_ESP,
Common::kPlatformWindows,
- ADGF_UNSUPPORTED,
+ ADGF_UNSTABLE,
GUIO1(GUIO_NOMIDI)
},
{
- "private-eye", // Demo from the EU release (ES)
- "It uses different file format for the assest",
+ "private-eye", // Demo from the EU release (ES)
+ "Demo",
AD_ENTRY2s("pvtdemo.ex_", "048f751acd7a0f1a87b20d6dc5229210", 497152,
"bklynlgo.bmp", "1dfb703349a46f8ec183de107992b7f5", 33118),
Common::ES_ESP,
Common::kPlatformWindows,
- ADGF_DEMO | ADGF_UNSUPPORTED,
+ ADGF_DEMO | ADGF_UNSTABLE,
GUIO1(GUIO_NOMIDI)
},
{
"private-eye", // EU release (FR)
- "It uses different file format for the assest",
+ "Demo",
AD_ENTRY2s("pvteye.ex_", "ae0dec43b2f54d45c8a1c93e97092141", 600576,
"bklynlgo.bmp", "1dfb703349a46f8ec183de107992b7f5", 33118),
Common::FR_FRA,
Common::kPlatformWindows,
- ADGF_UNSUPPORTED,
+ ADGF_UNSTABLE,
GUIO1(GUIO_NOMIDI)
},
{
@@ -139,13 +139,13 @@ static const ADGameDescription gameDescriptions[] = {
GUIO1(GUIO_NOMIDI)
},
{
- "private-eye", // Demo from the EU release
+ "private-eye", // Demo from the EU release (UK)
"Demo",
AD_ENTRY2s("Private Eye Demo", "", 284129,
"bklynlgo.bmp", "1dfb703349a46f8ec183de107992b7f5", 33118),
Common::EN_GRB,
Common::kPlatformWindows,
- ADGF_DEMO | ADGF_UNSUPPORTED,
+ ADGF_DEMO | ADGF_UNSTABLE,
GUIO1(GUIO_NOMIDI)
},
/*
diff --git a/engines/private/module.mk b/engines/private/module.mk
index 43e438a43d..245d747961 100644
--- a/engines/private/module.mk
+++ b/engines/private/module.mk
@@ -3,6 +3,7 @@ MODULE := engines/private
MODULE_OBJS := \
code.o \
cursors.o \
+ decompiler.o \
funcs.o \
grammar.o \
lexer.o \
diff --git a/engines/private/private.cpp b/engines/private/private.cpp
index 422433aacc..1e44248b9a 100644
--- a/engines/private/private.cpp
+++ b/engines/private/private.cpp
@@ -39,6 +39,7 @@
#include "private/private.h"
#include "private/tokens.h"
#include "private/grammar.h"
+#include "private/decompiler.h"
namespace Private {
@@ -122,40 +123,50 @@ void PrivateEngine::initializePath(const Common::FSNode &gamePath) {
Common::Error PrivateEngine::run() {
- assert(_installerArchive.open("SUPPORT/ASSETS.Z"));
+ Common::File *test = new Common::File();
Common::SeekableReadStream *file = NULL;
- // if the full game is used
- if (!isDemo()) {
- assert(_installerArchive.hasFile("GAME.DAT"));
- file = _installerArchive.createReadStreamForMember("GAME.DAT");
+
+ if (isDemo() && test->open("SUPPORT/ASSETS/DEMOGAME.WIN")) {
+ file = (Common::SeekableReadStream *) test;
} else {
- // if the demo from archive.org is used
- if (_installerArchive.hasFile("GAME.TXT"))
- file = _installerArchive.createReadStreamForMember("GAME.TXT");
-
- // if the demo from the full retail CDROM is used
- else if (_installerArchive.hasFile("DEMOGAME.DAT"))
- file = _installerArchive.createReadStreamForMember("DEMOGAME.DAT");
- else {
- Common::File *f = new Common::File();
- f->open("SUPPORT/GAME.DUMP");
- file = f;
+
+ assert(_installerArchive.open("SUPPORT/ASSETS.Z"));
+ // if the full game is used
+ if (!isDemo()) {
+ assert(_installerArchive.hasFile("GAME.DAT"));
+ file = _installerArchive.createReadStreamForMember("GAME.DAT");
+ } else {
+ // if the demo from archive.org is used
+ if (_installerArchive.hasFile("GAME.TXT"))
+ file = _installerArchive.createReadStreamForMember("GAME.TXT");
+
+ // if the demo from the full retail CDROM is used
+ else if (_installerArchive.hasFile("DEMOGAME.DAT"))
+ file = _installerArchive.createReadStreamForMember("DEMOGAME.DAT");
+ else {
+ debug("unknown version");
+ }
}
}
// Read assets file
assert(file != NULL);
- const int32 fileSize = file->size();
+ const uint32 fileSize = file->size();
char *buf = (char *)malloc(fileSize + 1);
file->read(buf, fileSize);
buf[fileSize] = '\0';
+ Decompiler decomp(buf, fileSize, false);
+ free(buf);
+
+ buf = (char*) decomp.getResult().c_str();
+ debug("%s", buf);
+
// Initialize stuff
Gen::g_vm = new Gen::VM();
Settings::g_setts = new Settings::SettingMaps();
initFuncs();
parse(buf);
- free(buf);
delete file;
assert(maps.constants.size() > 0);
diff --git a/engines/private/symbol.cpp b/engines/private/symbol.cpp
index 26f5bb0e1c..fcf29409d1 100644
--- a/engines/private/symbol.cpp
+++ b/engines/private/symbol.cpp
@@ -118,6 +118,14 @@ Symbol *SymbolMaps::lookupRect(Common::String *n) {
return lookup(*n, rects);
}
+Symbol *SymbolMaps::lookupVariable(Common::String *n) {
+ debug("looking variable up %s", n->c_str());
+
+ assert(variables.contains(*n));
+ return lookup(*n, variables);
+}
+
+
/* lookup some name in some symbol table */
Symbol *SymbolMaps::lookupName(const char *n) {
debug("looking up %s", n);
diff --git a/engines/private/symbol.h b/engines/private/symbol.h
index 3e1d98abb2..1a6ed304f4 100644
--- a/engines/private/symbol.h
+++ b/engines/private/symbol.h
@@ -71,6 +71,7 @@ public:
NameList locationList;
Symbol *constant(int t, int d, const char *s);
+ Symbol *lookupVariable(Common::String *n);
Symbol *lookupRect(Common::String *n);
Symbol *lookupName(const char *n);
void installAll(const char *n);
Commit: 1f1b9baebc876085e309f2cfd61fd56e5d2d3d47
https://github.com/scummvm/scummvm/commit/1f1b9baebc876085e309f2cfd61fd56e5d2d3d47
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2021-06-22T10:10:53+02:00
Commit Message:
PRIVATE: fixes
Changed paths:
engines/private/code.cpp
engines/private/cursors.cpp
engines/private/decompiler.cpp
engines/private/decompiler.h
engines/private/detection.cpp
engines/private/funcs.cpp
engines/private/grammar.cpp
engines/private/private.cpp
engines/private/symbol.cpp
diff --git a/engines/private/code.cpp b/engines/private/code.cpp
index a29335d36e..d0fea4a24c 100644
--- a/engines/private/code.cpp
+++ b/engines/private/code.cpp
@@ -189,11 +189,13 @@ int add() {
Datum d2 = pop();
Datum d1 = pop();
if (d1.type == NAME) {
+ d1.u.sym = g_private->maps.lookupVariable(d1.u.sym->name);
d1.u.val = d1.u.sym->u.val;
d1.type = NUM;
}
if (d2.type == NAME) {
+ d2.u.sym = g_private->maps.lookupVariable(d2.u.sym->name);
d2.u.val = d2.u.sym->u.val;
d2.type = NUM;
}
@@ -211,7 +213,7 @@ int negate() {
Datum d = pop();
int v = 0;
if (d.type == NAME) {
- //debug("negating %s", d.u.sym->name->c_str());
+ d.u.sym = g_private->maps.lookupVariable(d.u.sym->name);
v = d.u.sym->u.val;
d.type = NUM;
} else if (d.type == NUM) {
@@ -219,6 +221,7 @@ int negate() {
} else
assert(0);
+ debugC(1, kPrivateDebugCode, "negating %d\n", d.u.val);
d.u.val = !v;
push(d);
return 0;
@@ -230,6 +233,7 @@ int gt() {
if (d1.type == NAME) {
//char *name = d1.u.sym->name->c_str();
//debug("eval %s to %d",
+ d1.u.sym = g_private->maps.lookupVariable(d1.u.sym->name);
d1.u.val = d1.u.sym->u.val;
d1.type = NUM;
}
@@ -237,6 +241,7 @@ int gt() {
if (d2.type == NAME) {
//char *name = d1.u.sym->name->c_str();
//debug("eval %s to %d",
+ d2.u.sym = g_private->maps.lookupVariable(d2.u.sym->name);
d2.u.val = d2.u.sym->u.val;
d2.type = NUM;
}
@@ -252,6 +257,7 @@ int lt() {
if (d1.type == NAME) {
//char *name = d1.u.sym->name->c_str();
//debug("eval %s to %d",
+ d1.u.sym = g_private->maps.lookupVariable(d1.u.sym->name);
d1.u.val = d1.u.sym->u.val;
d1.type = NUM;
}
@@ -259,6 +265,7 @@ int lt() {
if (d2.type == NAME) {
//char *name = d1.u.sym->name->c_str();
//debug("eval %s to %d",
+ d2.u.sym = g_private->maps.lookupVariable(d2.u.sym->name);
d2.u.val = d2.u.sym->u.val;
d2.type = NUM;
}
@@ -274,6 +281,7 @@ int ge() {
if (d1.type == NAME) {
//char *name = d1.u.sym->name->c_str();
//debug("eval %s to %d",
+ d1.u.sym = g_private->maps.lookupVariable(d1.u.sym->name);
d1.u.val = d1.u.sym->u.val;
d1.type = NUM;
}
@@ -281,6 +289,7 @@ int ge() {
if (d2.type == NAME) {
//char *name = d1.u.sym->name->c_str();
//debug("eval %s to %d",
+ d2.u.sym = g_private->maps.lookupVariable(d2.u.sym->name);
d2.u.val = d2.u.sym->u.val;
d2.type = NUM;
}
@@ -296,6 +305,7 @@ int le() {
if (d1.type == NAME) {
//char *name = d1.u.sym->name->c_str();
//debug("eval %s to %d",
+ d1.u.sym = g_private->maps.lookupVariable(d1.u.sym->name);
d1.u.val = d1.u.sym->u.val;
d1.type = NUM;
}
@@ -303,6 +313,7 @@ int le() {
if (d2.type == NAME) {
//char *name = d1.u.sym->name->c_str();
//debug("eval %s to %d",
+ d2.u.sym = g_private->maps.lookupVariable(d2.u.sym->name);
d2.u.val = d2.u.sym->u.val;
d2.type = NUM;
}
@@ -318,6 +329,7 @@ int eq() {
if (d1.type == NAME) {
//char *name = d1.u.sym->name->c_str();
//debug("eval %s to %d",
+ d1.u.sym = g_private->maps.lookupVariable(d1.u.sym->name);
d1.u.val = d1.u.sym->u.val;
d1.type = NUM;
}
@@ -325,6 +337,7 @@ int eq() {
if (d2.type == NAME) {
//char *name = d1.u.sym->name->c_str();
//debug("eval %s to %d",
+ d2.u.sym = g_private->maps.lookupVariable(d2.u.sym->name);
d2.u.val = d2.u.sym->u.val;
d2.type = NUM;
}
@@ -338,11 +351,13 @@ int ne() {
Datum d2 = pop();
Datum d1 = pop();
if (d1.type == NAME) {
+ d1.u.sym = g_private->maps.lookupVariable(d1.u.sym->name);
d1.u.val = d1.u.sym->u.val;
d1.type = NUM;
}
if (d2.type == NAME) {
+ d2.u.sym = g_private->maps.lookupVariable(d2.u.sym->name);
d2.u.val = d2.u.sym->u.val;
d2.type = NUM;
}
@@ -372,6 +387,7 @@ int ifcode() {
if (d.type == NAME) {
debugC(1, kPrivateDebugCode, "name %s", d.u.sym->name->c_str());
+ d.u.sym = g_private->maps.lookupVariable(d.u.sym->name);
d.u.val = d.u.sym->u.val;
}
diff --git a/engines/private/cursors.cpp b/engines/private/cursors.cpp
index f243e3b1c1..3e93eb2c36 100644
--- a/engines/private/cursors.cpp
+++ b/engines/private/cursors.cpp
@@ -309,13 +309,13 @@ struct CursorTable {
};
static const CursorTable cursorTable[] = {
- { "kExit", "k5", MOUSECURSOR_kExit, 32, 32, 9, 0 },
- { "kInventory", "", MOUSECURSOR_kInventory, 32, 32, 15, 3 },
- { "kTurnLeft", "", MOUSECURSOR_kTurnLeft, 32, 32, 29, 16 },
- { "kTurnRight", "", MOUSECURSOR_kTurnRight, 32, 32, 1, 15 },
- { "kZoomIn", "", MOUSECURSOR_kZoomIn, 32, 32, 10, 8 },
- { "kZoomOut", "", MOUSECURSOR_kZoomOut, 32, 32, 13, 31 },
- { "kPhone", "", MOUSECURSOR_kPhone, 32, 32, 17, 19 },
+ { "kTurnLeft", "k1", MOUSECURSOR_kTurnLeft, 32, 32, 29, 16 },
+ { "kTurnRight", "k2", MOUSECURSOR_kTurnRight, 32, 32, 1, 15 },
+ { "kZoomIn", "k3", MOUSECURSOR_kZoomIn, 32, 32, 10, 8 },
+ { "kZoomOut", "k4", MOUSECURSOR_kZoomOut, 32, 32, 13, 31 },
+ { "kExit", "k5", MOUSECURSOR_kExit, 32, 32, 9, 0 },
+ { "kPhone", "k6", MOUSECURSOR_kPhone, 32, 32, 17, 19 },
+ { "kInventory", "k7", MOUSECURSOR_kInventory, 32, 32, 15, 3 },
{ "default", "", MOUSECURSOR_SCI, 11, 16, 0, 0 },
{ nullptr, nullptr, nullptr, 0, 0, 0, 0 }
};
diff --git a/engines/private/decompiler.cpp b/engines/private/decompiler.cpp
index 749ab8a2cc..5c307564c4 100644
--- a/engines/private/decompiler.cpp
+++ b/engines/private/decompiler.cpp
@@ -10,18 +10,20 @@ Decompiler::Decompiler(char *buf, uint32 fileSize, bool mac) {
array.push_back(buf[i]);
i++;
}
+
+ Common::String firstBytes((const char *) array.begin(), (const char *) array.begin() + kHeader.size());
+
+ if (firstBytes != kHeader) {
+ debug("Not a precompiled game matrix");
+ _result = Common::String(buf);
+ return;
+ }
+
decompile(array, mac);
}
void Decompiler::decompile(Common::Array<unsigned char> &buffer, bool mac) {
Common::Array<unsigned char>::iterator it = buffer.begin();
-
- Common::String firstBytes((const char *) it, (const char *) it + kHeader.size());
- //debug("first bytes \"%s\"", firstBytes.c_str());
-
- if (firstBytes != kHeader) {
- error("Not a precompiled game matrix");
- }
Common::String ss;
bool inDefineRects = false;
diff --git a/engines/private/decompiler.h b/engines/private/decompiler.h
index ba7e657344..715efc9ff5 100644
--- a/engines/private/decompiler.h
+++ b/engines/private/decompiler.h
@@ -40,7 +40,7 @@ const static char *kCodeTable[] = {"", //
"if ", // 0x15
"else ", // 0x16
"Exit", // 0x17
- "goto", // 0x18
+ "goto ", // 0x18
"Mask", // 0x19
"MaskDrawn", // 0x1a
"Movie", // 0x1b
diff --git a/engines/private/detection.cpp b/engines/private/detection.cpp
index da9a0d59df..d29e91fd89 100644
--- a/engines/private/detection.cpp
+++ b/engines/private/detection.cpp
@@ -100,7 +100,7 @@ static const ADGameDescription gameDescriptions[] = {
},
{
"private-eye", // EU release (ES)
- "Demo",
+ 0,
AD_ENTRY2s("pvteye.ex_", "f41770550ab717086b2d0c805fef4b8f", 498176,
"bklynlgo.bmp", "1dfb703349a46f8ec183de107992b7f5", 33118),
Common::ES_ESP,
@@ -120,7 +120,7 @@ static const ADGameDescription gameDescriptions[] = {
},
{
"private-eye", // EU release (FR)
- "Demo",
+ 0,
AD_ENTRY2s("pvteye.ex_", "ae0dec43b2f54d45c8a1c93e97092141", 600576,
"bklynlgo.bmp", "1dfb703349a46f8ec183de107992b7f5", 33118),
Common::FR_FRA,
diff --git a/engines/private/funcs.cpp b/engines/private/funcs.cpp
index 1eb1f75dd3..b79d3edfe2 100644
--- a/engines/private/funcs.cpp
+++ b/engines/private/funcs.cpp
@@ -33,6 +33,8 @@ namespace Private {
static void fChgMode(ArgArray args) {
// assert types
assert (args.size() == 2 || args.size() == 3);
+ assert(args[0].type == NUM);
+
if (args.size() == 2)
debugC(1, kPrivateDebugScript, "ChgMode(%d, %s)", args[0].u.val, args[1].u.sym->name->c_str());
else if (args.size() == 3)
@@ -62,7 +64,7 @@ static void fChgMode(ArgArray args) {
}
static void fVSPicture(ArgArray args) {
- // assert types
+ assert(args[0].type == STRING);
debugC(1, kPrivateDebugScript, "VSPicture(%s)", args[0].u.str);
g_private->_nextVS = args[0].u.str;
}
@@ -70,6 +72,10 @@ static void fVSPicture(ArgArray args) {
static void fDiaryLocList(ArgArray args) {
int x1, y1, x2, y2;
+ assert(args[0].type == NUM);
+ assert(args[1].type == NUM);
+ assert(args[2].type == NUM);
+ assert(args[3].type == NUM);
debugC(1, kPrivateDebugScript, "DiaryLocList(%d, %d, %d, %d)", args[0].u.val, args[1].u.val, args[2].u.val, args[3].u.val);
@@ -105,9 +111,10 @@ static void fgoto(ArgArray args) {
static void fSyncSound(ArgArray args) {
- // assert types
- debugC(1, kPrivateDebugScript, "SyncSound(%s, %s)", args[0].u.str, args[1].u.str);
- g_private->_nextSetting = args[1].u.str;
+ assert(args[0].type == STRING);
+ assert(args[1].type == NAME);
+ debugC(1, kPrivateDebugScript, "SyncSound(%s, %s)", args[0].u.str, args[1].u.sym->name->c_str());
+ g_private->_nextSetting = args[1].u.sym->name->c_str();
Common::String s = args[0].u.str;
if (s != "\"\"") {
@@ -128,9 +135,12 @@ static void fQuit(ArgArray args) {
}
static void fLoadGame(ArgArray args) {
- // assert types
+ assert(args[0].type == STRING);
+ assert(args[2].type == NAME);
debugC(1, kPrivateDebugScript, "LoadGame(%s, %s)", args[0].u.str, args[2].u.sym->name->c_str());
MaskInfo m;
+ if (strcmp(args[0].u.str, "\"\"") == 0) // Not sure why the game tries to load an empty mask
+ return;
m.surf = g_private->loadMask(args[0].u.str, 0, 0, true);
m.cursor = *args[2].u.sym->name;
m.nextSetting = "";
@@ -325,7 +335,7 @@ static void fInventory(ArgArray args) {
assert(v1.type == STRING || v1.type == NAME);
assert(b1.type == STRING);
- assert(e.type == STRING || e.type == NUM);
+ assert(e.type == NAME || e.type == NUM);
assert(snd.type == STRING);
assert(i.type == STRING);
@@ -341,21 +351,25 @@ static void fInventory(ArgArray args) {
MaskInfo m;
m.surf = g_private->loadMask(mask, 0, 0, true);
- if (e.type == NUM)
+ if (e.type == NUM) {
+ assert(e.u.val == 0);
m.nextSetting = "";
+ }
else
- m.nextSetting = e.u.str;
+ m.nextSetting = e.u.sym->name->c_str();
m.cursor = "kInventory";
m.point = Common::Point(0,0);
- if (v1.type == NAME)
- m.flag1 = v1.u.sym;
+ if (v1.type == NAME) {
+ m.flag1 = g_private->maps.lookupVariable(v1.u.sym->name);
+ }
else
m.flag1 = NULL;
- if (v2.type == NAME)
- m.flag2 = v2.u.sym;
+ if (v2.type == NAME) {
+ m.flag2 = g_private->maps.lookupVariable(v2.u.sym->name);
+ }
else
m.flag2 = NULL;
@@ -373,6 +387,7 @@ static void fInventory(ArgArray args) {
g_private->inventory.push_back(bmp);
} else {
if (v1.type == NAME) {
+ v1.u.sym = g_private->maps.lookupVariable(v1.u.sym->name);
if (strcmp(c.u.str, "\"REMOVE\"") == 0) {
v1.u.sym->u.val = 0;
if (inInventory(bmp))
@@ -386,8 +401,10 @@ static void fInventory(ArgArray args) {
if (!inInventory(bmp))
g_private->inventory.push_back(bmp);
}
- if (v2.type == NAME)
+ if (v2.type == NAME) {
+ v2.u.sym = g_private->maps.lookupVariable(v2.u.sym->name);
v2.u.sym->u.val = 1;
+ }
}
}
@@ -395,6 +412,7 @@ static void fSetFlag(ArgArray args) {
assert(args.size() == 2);
assert(args[0].type == NAME && args[1].type == NUM);
debugC(1, kPrivateDebugScript, "SetFlag(%s, %d)", args[0].u.sym->name->c_str(), args[1].u.val);
+ args[0].u.sym = g_private->maps.lookupVariable(args[0].u.sym->name);
args[0].u.sym->u.val = args[1].u.val;
}
@@ -490,14 +508,15 @@ static void fViewScreen(ArgArray args) {
}
static void fTransition(ArgArray args) {
- // assert types
- debugC(1, kPrivateDebugScript, "Transition(%s, %s)", args[0].u.str, args[1].u.str);
+ assert(args[0].type == STRING);
+ assert(args[1].type == NAME);
+ debugC(1, kPrivateDebugScript, "Transition(%s, %s)", args[0].u.str, args[1].u.sym->name->c_str());
g_private->_nextMovie = args[0].u.str;
- g_private->_nextSetting = args[1].u.str;
+ g_private->_nextSetting = args[1].u.sym->name->c_str();
}
static void fResume(ArgArray args) {
- // assert types
+ assert(args[0].type == NUM);
debugC(1, kPrivateDebugScript, "Resume(%d)", args[0].u.val); // this value is always 1
g_private->_nextSetting = g_private->_pausedSetting;
g_private->_pausedSetting = "";
@@ -509,9 +528,11 @@ static void fResume(ArgArray args) {
static void fMovie(ArgArray args) {
// assert types
- debugC(1, kPrivateDebugScript, "Movie(%s, %s)", args[0].u.str, args[1].u.str);
+ assert(args[0].type == STRING);
+ assert(args[1].type == NAME);
+ debugC(1, kPrivateDebugScript, "Movie(%s, %s)", args[0].u.str, args[1].u.sym->name->c_str());
Common::String movie = args[0].u.str;
- Common::String nextSetting = args[1].u.str;
+ Common::String nextSetting = *args[1].u.sym->name;
if (!g_private->_playedMovies.contains(movie) && movie != "\"\"") {
g_private->_nextMovie = movie;
@@ -652,8 +673,11 @@ static void fSoundArea(ArgArray args) {
Common::String n;
if (args[1].type == NAME)
n = *(args[1].u.sym->name);
- else if (args[1].type == STRING)
+ else if (args[1].type == STRING) {
n = Common::String(args[1].u.str);
+ Common::replace(n, "\"", "");
+ Common::replace(n, "\"", "");
+ }
else
error("Invalid input for SoundArea");
diff --git a/engines/private/grammar.cpp b/engines/private/grammar.cpp
index 0eca007294..8abef1f009 100644
--- a/engines/private/grammar.cpp
+++ b/engines/private/grammar.cpp
@@ -96,6 +96,7 @@ extern int PRIVATE_lex();
extern int PRIVATE_parse();
void PRIVATE_xerror(const char *str) {
+ assert(0);
}
int PRIVATE_wrap() {
diff --git a/engines/private/private.cpp b/engines/private/private.cpp
index 1e44248b9a..e618f2589c 100644
--- a/engines/private/private.cpp
+++ b/engines/private/private.cpp
@@ -126,15 +126,21 @@ Common::Error PrivateEngine::run() {
Common::File *test = new Common::File();
Common::SeekableReadStream *file = NULL;
- if (isDemo() && test->open("SUPPORT/ASSETS/DEMOGAME.WIN")) {
+ if (isDemo() && test->open("SUPPORT/ASSETS/DEMOGAME.WIN"))
+ file = (Common::SeekableReadStream *) test;
+ else if (test->open("SUPPORT/ASSETS/GAME.WIN")) {
file = (Common::SeekableReadStream *) test;
} else {
assert(_installerArchive.open("SUPPORT/ASSETS.Z"));
// if the full game is used
if (!isDemo()) {
- assert(_installerArchive.hasFile("GAME.DAT"));
- file = _installerArchive.createReadStreamForMember("GAME.DAT");
+ if (_installerArchive.hasFile("GAME.DAT"))
+ file = _installerArchive.createReadStreamForMember("GAME.DAT");
+ else if (_installerArchive.hasFile("GAME.WIN"))
+ file = _installerArchive.createReadStreamForMember("GAME.WIN");
+ else
+ debug("unknown version");
} else {
// if the demo from archive.org is used
if (_installerArchive.hasFile("GAME.TXT"))
@@ -143,6 +149,8 @@ Common::Error PrivateEngine::run() {
// if the demo from the full retail CDROM is used
else if (_installerArchive.hasFile("DEMOGAME.DAT"))
file = _installerArchive.createReadStreamForMember("DEMOGAME.DAT");
+ else if (_installerArchive.hasFile("DEMOGAME.WIN"))
+ file = _installerArchive.createReadStreamForMember("DEMOGAME.WIN");
else {
debug("unknown version");
}
@@ -159,7 +167,7 @@ Common::Error PrivateEngine::run() {
free(buf);
buf = (char*) decomp.getResult().c_str();
- debug("%s", buf);
+ //debug("%s", buf);
// Initialize stuff
Gen::g_vm = new Gen::VM();
@@ -199,10 +207,9 @@ Common::Error PrivateEngine::run() {
} else {
if (Private::Settings::g_setts->_map.contains("kGoIntro"))
_nextSetting = "kGoIntro";
- else if (Private::Settings::g_setts->_map.contains("k58"))
- _nextSetting = "k58";
- else
- error("No setting to start");
+ else {
+ _nextSetting = "k1";
+ }
}
while (!shouldQuit()) {
diff --git a/engines/private/symbol.cpp b/engines/private/symbol.cpp
index fcf29409d1..2ce87c36ff 100644
--- a/engines/private/symbol.cpp
+++ b/engines/private/symbol.cpp
@@ -91,11 +91,11 @@ static Symbol *install(const Common::String &n, int t, int d, const char *s, Com
sp->type = t;
if (t == NUM) {
sp->u.val = d;
- debug("install NUM: %s %d", name->c_str(), d);
+ //debug("install NUM: %s %d", name->c_str(), d);
}
else if (t == NAME) {
sp->u.val = d;
- debug("installing NAME: %s %d", name->c_str(), d);
+ //debug("installing NAME: %s %d", name->c_str(), d);
}
else if (t == STRING)
sp->u.str = scumm_strdup(s); // FIXME: leaks a string here.
@@ -128,7 +128,15 @@ Symbol *SymbolMaps::lookupVariable(Common::String *n) {
/* lookup some name in some symbol table */
Symbol *SymbolMaps::lookupName(const char *n) {
- debug("looking up %s", n);
+
+ Symbol *s = (Symbol *)malloc(sizeof(Symbol));
+ Common::String *name = new Common::String(n);
+ s->name = name;
+ s->type = NAME;
+ s->u.val = 0;
+
+ return s;
+ /*debug("looking up %s", n);
Common::String s(n);
if (settings.contains(s))
@@ -149,7 +157,8 @@ Symbol *SymbolMaps::lookupName(const char *n) {
else {
debugC(1, kPrivateDebugCode, "WARNING: %s not defined", n);
return constant(STRING, 0, n);
- }
+ }*/
+
}
void SymbolMaps::installAll(const char *n) {
@@ -161,6 +170,7 @@ void SymbolMaps::installAll(const char *n) {
//debug("name %s", s.c_str());
if (strcmp(n, "settings") == 0) {
+ debug("new setting %s", n);
assert(r == NULL);
install(s, NAME, 0, s.c_str(), r, &settings);
} else if (strcmp(n, "variables") == 0) {
Commit: 0d5f191b7b70ed1082d4a5a24e6f1cdba37aa486
https://github.com/scummvm/scummvm/commit/0d5f191b7b70ed1082d4a5a24e6f1cdba37aa486
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2021-06-22T10:10:53+02:00
Commit Message:
PRIVATE: added license headers
Changed paths:
engines/private/decompiler.cpp
engines/private/decompiler.h
diff --git a/engines/private/decompiler.cpp b/engines/private/decompiler.cpp
index 5c307564c4..0790267799 100644
--- a/engines/private/decompiler.cpp
+++ b/engines/private/decompiler.cpp
@@ -1,3 +1,25 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM 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 "private/decompiler.h"
namespace Private {
diff --git a/engines/private/decompiler.h b/engines/private/decompiler.h
index 715efc9ff5..676eaf90bb 100644
--- a/engines/private/decompiler.h
+++ b/engines/private/decompiler.h
@@ -1,3 +1,25 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM 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.
+ *
+ */
+
#ifndef PRIVATE_DECOMPILER_H
#define PRIVATE_DECOMPILER_H
Commit: 63413b6d233d0dc6a687a8cf6495d191a6515f20
https://github.com/scummvm/scummvm/commit/63413b6d233d0dc6a687a8cf6495d191a6515f20
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2021-06-22T10:10:53+02:00
Commit Message:
PRIVATE: better compatibility with non-US versions
Changed paths:
engines/private/private.cpp
engines/private/private.h
diff --git a/engines/private/private.cpp b/engines/private/private.cpp
index e618f2589c..8ace0d337a 100644
--- a/engines/private/private.cpp
+++ b/engines/private/private.cpp
@@ -121,7 +121,7 @@ void PrivateEngine::initializePath(const Common::FSNode &gamePath) {
SearchMan.addDirectory(gamePath.getPath(), gamePath, 0, 10);
}
-Common::Error PrivateEngine::run() {
+Common::SeekableReadStream *PrivateEngine::loadAssets() {
Common::File *test = new Common::File();
Common::SeekableReadStream *file = NULL;
@@ -131,7 +131,7 @@ Common::Error PrivateEngine::run() {
else if (test->open("SUPPORT/ASSETS/GAME.WIN")) {
file = (Common::SeekableReadStream *) test;
} else {
-
+ delete test;
assert(_installerArchive.open("SUPPORT/ASSETS.Z"));
// if the full game is used
if (!isDemo()) {
@@ -140,7 +140,7 @@ Common::Error PrivateEngine::run() {
else if (_installerArchive.hasFile("GAME.WIN"))
file = _installerArchive.createReadStreamForMember("GAME.WIN");
else
- debug("unknown version");
+ error("Unknown version");
} else {
// if the demo from archive.org is used
if (_installerArchive.hasFile("GAME.TXT"))
@@ -152,12 +152,19 @@ Common::Error PrivateEngine::run() {
else if (_installerArchive.hasFile("DEMOGAME.WIN"))
file = _installerArchive.createReadStreamForMember("DEMOGAME.WIN");
else {
- debug("unknown version");
+ error("Unknown version");
}
}
}
- // Read assets file
assert(file != NULL);
+ return file;
+
+}
+
+Common::Error PrivateEngine::run() {
+
+ Common::SeekableReadStream *file = loadAssets();
+ // Read assets file
const uint32 fileSize = file->size();
char *buf = (char *)malloc(fileSize + 1);
file->read(buf, fileSize);
@@ -167,7 +174,7 @@ Common::Error PrivateEngine::run() {
free(buf);
buf = (char*) decomp.getResult().c_str();
- //debug("%s", buf);
+ debug("%s", buf);
// Initialize stuff
Gen::g_vm = new Gen::VM();
@@ -200,16 +207,12 @@ Common::Error PrivateEngine::run() {
Common::Event event;
Common::Point mousePos;
_videoDecoder = nullptr;
-
+ _language = ConfMan.get("language");
int saveSlot = ConfMan.getInt("save_slot");
if (saveSlot >= 0) { // load the savegame
loadGameState(saveSlot);
} else {
- if (Private::Settings::g_setts->_map.contains("kGoIntro"))
- _nextSetting = "kGoIntro";
- else {
- _nextSetting = "k1";
- }
+ _nextSetting = getGoIntroSetting();
}
while (!shouldQuit()) {
@@ -279,7 +282,7 @@ Common::Error PrivateEngine::run() {
continue;
}
- if (!_nextVS.empty() && _currentSetting == "kMainDesktop") {
+ if (!_nextVS.empty() && (_currentSetting == getMainDesktopSetting())) {
loadImage(_nextVS, 160, 120);
drawScreen();
}
@@ -492,6 +495,37 @@ bool PrivateEngine::cursorPauseMovie(Common::Point mousePos) {
return false;
}
+Common::String PrivateEngine::getPauseMovieSetting() {
+ if (_language == "us")
+ return "kPauseMovie";
+
+ if (isDemo())
+ return "k3";
+ else
+ error("TODO: getPauseMovieSetting");
+}
+
+Common::String PrivateEngine::getGoIntroSetting() {
+ if (_language == "us")
+ return "kGoIntro";
+
+ return "k1";
+}
+
+Common::String getStartGameSetting() {
+ return "kStartGame";
+}
+
+Common::String PrivateEngine::getMainDesktopSetting() {
+ if (_language == "us")
+ return "kMainDesktop";
+
+ if (isDemo())
+ return "k45";
+
+ return "k183";
+}
+
void PrivateEngine::selectPauseMovie(Common::Point mousePos) {
if (_mode == 1) {
uint32 tol = 15;
@@ -503,7 +537,7 @@ void PrivateEngine::selectPauseMovie(Common::Point mousePos) {
else
_pausedSetting = _currentSetting;
- _nextSetting = "kPauseMovie";
+ _nextSetting = getPauseMovieSetting();
if (_videoDecoder) {
_videoDecoder->pauseVideo(true);
}
@@ -869,9 +903,9 @@ Common::Error PrivateEngine::loadGameStream(Common::SeekableReadStream *stream)
}
if (_pausedSetting.empty())
- _nextSetting = "kStartGame";
+ _nextSetting = getMainDesktopSetting();
else
- _nextSetting = "kPauseMovie";
+ _nextSetting = getPauseMovieSetting();
return Common::kNoError;
}
diff --git a/engines/private/private.h b/engines/private/private.h
index 58a7968dcf..c6b997a5c4 100644
--- a/engines/private/private.h
+++ b/engines/private/private.h
@@ -145,6 +145,7 @@ public:
const ADGameDescription *_gameDescription;
bool isDemo() const;
+ Common::String _language;
SymbolMaps maps;
@@ -157,6 +158,7 @@ public:
void restartGame();
void clearAreas();
void initializePath(const Common::FSNode &gamePath) override;
+ Common::SeekableReadStream *loadAssets();
// Functions
@@ -218,7 +220,9 @@ public:
Common::String _nextSetting;
Common::String _pausedSetting;
Common::String _currentSetting;
-
+ Common::String getPauseMovieSetting();
+ Common::String getGoIntroSetting();
+ Common::String getMainDesktopSetting();
// movies
Common::String _nextMovie;
Common::String _currentMovie;
Commit: 297175310fdc3ca712eee77ce4fc2c64b298862a
https://github.com/scummvm/scummvm/commit/297175310fdc3ca712eee77ce4fc2c64b298862a
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2021-06-22T10:10:53+02:00
Commit Message:
PRIVATE: more fixes
Changed paths:
engines/private/funcs.cpp
engines/private/private.cpp
engines/private/private.h
diff --git a/engines/private/funcs.cpp b/engines/private/funcs.cpp
index b79d3edfe2..874aab7ea8 100644
--- a/engines/private/funcs.cpp
+++ b/engines/private/funcs.cpp
@@ -38,7 +38,7 @@ static void fChgMode(ArgArray args) {
if (args.size() == 2)
debugC(1, kPrivateDebugScript, "ChgMode(%d, %s)", args[0].u.val, args[1].u.sym->name->c_str());
else if (args.size() == 3)
- debugC(1, kPrivateDebugScript, "ChgMode(%d, %s, %s)", args[0].u.val, args[1].u.str, args[2].u.sym->name->c_str());
+ debugC(1, kPrivateDebugScript, "ChgMode(%d, %s, %s)", args[0].u.val, args[1].u.sym->name->c_str(), args[2].u.sym->name->c_str());
else
assert(0);
@@ -187,7 +187,7 @@ static void fPoliceBust(ArgArray args) {
if (args[1].u.val == 2) {
// Unclear what it means
} else if (args[1].u.val == 3) {
- g_private->_nextSetting = "kMainDesktop";
+ g_private->_nextSetting = g_private->getMainDesktopSetting();
g_private->_mode = 0;
g_private->_origin = Common::Point(kOriginZero[0], kOriginZero[1]);
} else
@@ -200,8 +200,8 @@ static void fPoliceBust(ArgArray args) {
static void fBustMovie(ArgArray args) {
// assert types
assert (args.size() == 1);
- debugC(1, kPrivateDebugScript, "BustMovie(%s)", args[0].u.str);
- uint policeIndex = g_private->maps.variables.getVal("kPoliceIndex")->u.val;
+ debugC(1, kPrivateDebugScript, "BustMovie(%s)", args[0].u.sym->name->c_str());
+ uint policeIndex = g_private->maps.variables.getVal(g_private->getPoliceIndexVariable())->u.val;
int videoIndex = policeIndex/2 - 1;
if (videoIndex < 0)
videoIndex = 0;
@@ -216,7 +216,7 @@ static void fBustMovie(ArgArray args) {
}
g_private->_nextMovie = pv;
- g_private->_nextSetting = args[0].u.str;
+ g_private->_nextSetting = args[0].u.sym->name->c_str();
}
static void fDossierAdd(ArgArray args) {
@@ -278,7 +278,7 @@ static void fDossierPrevSuspect(ArgArray args) {
int y = args[2].u.val;
m.surf = g_private->loadMask(s, x, y, true);
- m.cursor = "kExit";
+ m.cursor = g_private->getExitCursor();
m.nextSetting = "";
m.flag1 = NULL;
m.flag2 = NULL;
@@ -295,7 +295,7 @@ static void fDossierNextSuspect(ArgArray args) {
int y = args[2].u.val;
m.surf = g_private->loadMask(s, x, y, true);
- m.cursor = "kExit";
+ m.cursor = g_private->getExitCursor();
m.nextSetting = "";
m.flag1 = NULL;
m.flag2 = NULL;
@@ -358,7 +358,7 @@ static void fInventory(ArgArray args) {
else
m.nextSetting = e.u.sym->name->c_str();
- m.cursor = "kInventory";
+ m.cursor = g_private->getInventoryCursor();
m.point = Common::Point(0,0);
if (v1.type == NAME) {
diff --git a/engines/private/private.cpp b/engines/private/private.cpp
index 8ace0d337a..f699b71118 100644
--- a/engines/private/private.cpp
+++ b/engines/private/private.cpp
@@ -385,7 +385,7 @@ void PrivateEngine::clearAreas() {
void PrivateEngine::startPoliceBust() {
// This logic was extracted from the binary
- int policeIndex = maps.variables.getVal("kPoliceIndex")->u.val;
+ int policeIndex = maps.variables.getVal(getPoliceIndexVariable())->u.val;
int r = _rnd->getRandomNumber(0xc);
if (policeIndex > 0x14) {
policeIndex = 0x15;
@@ -412,12 +412,12 @@ void PrivateEngine::checkPoliceBust() {
}
if (_numberClicks == _maxNumberClicks+1) {
- uint policeIndex = maps.variables.getVal("kPoliceIndex")->u.val;
+ uint policeIndex = maps.variables.getVal(getPoliceIndexVariable())->u.val;
_policeBustSetting = _currentSetting;
if (policeIndex <= 13) {
- _nextSetting = "kPOGoBustMovie";
+ _nextSetting = getPOGoBustMovieSetting();
} else {
- _nextSetting = "kPoliceBustFromMO";
+ _nextSetting = getPoliceBustFromMOSetting();
}
clearAreas();
_policeBustEnabled = false;
@@ -499,10 +499,7 @@ Common::String PrivateEngine::getPauseMovieSetting() {
if (_language == "us")
return "kPauseMovie";
- if (isDemo())
- return "k3";
- else
- error("TODO: getPauseMovieSetting");
+ return "k3";
}
Common::String PrivateEngine::getGoIntroSetting() {
@@ -512,8 +509,11 @@ Common::String PrivateEngine::getGoIntroSetting() {
return "k1";
}
-Common::String getStartGameSetting() {
- return "kStartGame";
+Common::String PrivateEngine::getAlternateGameVariable() {
+ if (_language == "us")
+ return "kAlternateGame";
+
+ return "k2";
}
Common::String PrivateEngine::getMainDesktopSetting() {
@@ -526,6 +526,43 @@ Common::String PrivateEngine::getMainDesktopSetting() {
return "k183";
}
+Common::String PrivateEngine::getPoliceIndexVariable() {
+ if (_language == "us")
+ return "kPoliceIndex";
+
+ return "k0";
+}
+
+
+Common::String PrivateEngine::getPOGoBustMovieSetting() {
+ if (_language == "us")
+ return "kPOGoBustMovie";
+
+ return "k7";
+}
+
+Common::String PrivateEngine::getPoliceBustFromMOSetting() {
+ if (_language == "us")
+ return "kPoliceBustFromMO";
+
+ return "k6";
+}
+
+Common::String PrivateEngine::getExitCursor() {
+ if (_language == "us")
+ return "kExit";
+
+ return "k5";
+}
+
+
+Common::String PrivateEngine::getInventoryCursor() {
+ if (_language == "us")
+ return "kInventory";
+
+ return "k7";
+}
+
void PrivateEngine::selectPauseMovie(Common::Point mousePos) {
if (_mode == 1) {
uint32 tol = 15;
@@ -779,7 +816,7 @@ void PrivateEngine::restartGame() {
for (NameList::iterator it = maps.variableList.begin(); it != maps.variableList.end(); ++it) {
Private::Symbol *sym = maps.variables.getVal(*it);
- if (*(sym->name) != "kAlternateGame")
+ if (*(sym->name) != getAlternateGameVariable())
sym->u.val = 0;
}
diff --git a/engines/private/private.h b/engines/private/private.h
index c6b997a5c4..e509ccd2ee 100644
--- a/engines/private/private.h
+++ b/engines/private/private.h
@@ -201,7 +201,10 @@ public:
void loadImage(const Common::String &file, int x, int y);
void drawScreenFrame();
+ // Cursors
void changeCursor(const Common::String &);
+ Common::String getInventoryCursor();
+ Common::String getExitCursor();
// Rendering
Graphics::ManagedSurface *_compositeSurface;
@@ -223,6 +226,11 @@ public:
Common::String getPauseMovieSetting();
Common::String getGoIntroSetting();
Common::String getMainDesktopSetting();
+ Common::String getPOGoBustMovieSetting();
+ Common::String getPoliceBustFromMOSetting();
+ Common::String getAlternateGameVariable();
+ Common::String getPoliceIndexVariable();
+
// movies
Common::String _nextMovie;
Common::String _currentMovie;
Commit: a1170b44f30b059530e54c8dc194d3810253579b
https://github.com/scummvm/scummvm/commit/a1170b44f30b059530e54c8dc194d3810253579b
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2021-06-22T10:10:53+02:00
Commit Message:
PRIVATE: removed old code, commented debugs and fixes
Changed paths:
engines/private/code.cpp
engines/private/decompiler.cpp
engines/private/decompiler.h
engines/private/funcs.cpp
engines/private/private.cpp
engines/private/symbol.cpp
diff --git a/engines/private/code.cpp b/engines/private/code.cpp
index d0fea4a24c..6f05ee0003 100644
--- a/engines/private/code.cpp
+++ b/engines/private/code.cpp
@@ -82,7 +82,7 @@ void SettingMaps::save(const char *name) {
}
void SettingMaps::load(const Common::String &name) {
- debug("loading: %s", name.c_str());
+ //debug("loading: %s", name.c_str());
assert(_map.contains(name));
_setting = _map.getVal(name);
diff --git a/engines/private/decompiler.cpp b/engines/private/decompiler.cpp
index 0790267799..dd839e1f9c 100644
--- a/engines/private/decompiler.cpp
+++ b/engines/private/decompiler.cpp
@@ -19,6 +19,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
+// Heavily based on code by X
#include "private/decompiler.h"
diff --git a/engines/private/decompiler.h b/engines/private/decompiler.h
index 676eaf90bb..cade79d341 100644
--- a/engines/private/decompiler.h
+++ b/engines/private/decompiler.h
@@ -19,6 +19,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
+// Heavily based on code by X
#ifndef PRIVATE_DECOMPILER_H
#define PRIVATE_DECOMPILER_H
diff --git a/engines/private/funcs.cpp b/engines/private/funcs.cpp
index 874aab7ea8..d05a458070 100644
--- a/engines/private/funcs.cpp
+++ b/engines/private/funcs.cpp
@@ -255,7 +255,7 @@ static void fDossierChgSheet(ArgArray args) {
int y = args[3].u.val;
m.surf = g_private->loadMask(s, x, y, true);
- m.cursor = "kExit";
+ m.cursor = g_private->getExitCursor();
m.nextSetting = "";
m.flag1 = NULL;
m.flag2 = NULL;
diff --git a/engines/private/private.cpp b/engines/private/private.cpp
index f699b71118..15b154b028 100644
--- a/engines/private/private.cpp
+++ b/engines/private/private.cpp
@@ -174,7 +174,7 @@ Common::Error PrivateEngine::run() {
free(buf);
buf = (char*) decomp.getResult().c_str();
- debug("%s", buf);
+ //debug("%s", buf);
// Initialize stuff
Gen::g_vm = new Gen::VM();
@@ -303,7 +303,7 @@ Common::Error PrivateEngine::run() {
if (!_nextSetting.empty()) {
removeTimer();
- debug("Executing %s", _nextSetting.c_str());
+ //debug("Executing %s", _nextSetting.c_str());
clearAreas();
_currentSetting = _nextSetting;
Settings::g_setts->load(_nextSetting);
diff --git a/engines/private/symbol.cpp b/engines/private/symbol.cpp
index 2ce87c36ff..ddc6b5a07e 100644
--- a/engines/private/symbol.cpp
+++ b/engines/private/symbol.cpp
@@ -112,14 +112,14 @@ static Symbol *install(const Common::String &n, int t, int d, const char *s, Com
/* lookup some name in some symbol table */
Symbol *SymbolMaps::lookupRect(Common::String *n) {
- debug("looking rect up %s", n->c_str());
+ //debug("looking rect up %s", n->c_str());
assert(rects.contains(*n));
return lookup(*n, rects);
}
Symbol *SymbolMaps::lookupVariable(Common::String *n) {
- debug("looking variable up %s", n->c_str());
+ //debug("looking variable up %s", n->c_str());
assert(variables.contains(*n));
return lookup(*n, variables);
@@ -136,29 +136,6 @@ Symbol *SymbolMaps::lookupName(const char *n) {
s->u.val = 0;
return s;
- /*debug("looking up %s", n);
- Common::String s(n);
-
- if (settings.contains(s))
- return lookup(s, settings);
-
- else if (variables.contains(s))
- return lookup(s, variables);
-
- else if (cursors.contains(s))
- return lookup(s, cursors);
-
- else if (locations.contains(s))
- return lookup(s, locations);
-
- else if (rects.contains(s))
- return lookup(s, rects);
-
- else {
- debugC(1, kPrivateDebugCode, "WARNING: %s not defined", n);
- return constant(STRING, 0, n);
- }*/
-
}
void SymbolMaps::installAll(const char *n) {
@@ -170,7 +147,7 @@ void SymbolMaps::installAll(const char *n) {
//debug("name %s", s.c_str());
if (strcmp(n, "settings") == 0) {
- debug("new setting %s", n);
+ //debug("new setting %s", n);
assert(r == NULL);
install(s, NAME, 0, s.c_str(), r, &settings);
} else if (strcmp(n, "variables") == 0) {
Commit: 54ace30a338e1e6a3a8cef663875ee33653d1042
https://github.com/scummvm/scummvm/commit/54ace30a338e1e6a3a8cef663875ee33653d1042
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2021-06-22T10:10:53+02:00
Commit Message:
PRIVATE: fixed debug statement
Changed paths:
engines/private/private.cpp
diff --git a/engines/private/private.cpp b/engines/private/private.cpp
index 15b154b028..092058b21b 100644
--- a/engines/private/private.cpp
+++ b/engines/private/private.cpp
@@ -303,7 +303,7 @@ Common::Error PrivateEngine::run() {
if (!_nextSetting.empty()) {
removeTimer();
- //debug("Executing %s", _nextSetting.c_str());
+ debugC(1, kPrivateDebugFunction, "Executing %s", _nextSetting.c_str());
clearAreas();
_currentSetting = _nextSetting;
Settings::g_setts->load(_nextSetting);
Commit: 252ad4cb00152e6b60d39b6b9e6c39a504273c99
https://github.com/scummvm/scummvm/commit/252ad4cb00152e6b60d39b6b9e6c39a504273c99
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2021-06-22T10:10:53+02:00
Commit Message:
PRIVATE: added german versions in the detection tables
Changed paths:
engines/private/detection.cpp
diff --git a/engines/private/detection.cpp b/engines/private/detection.cpp
index d29e91fd89..e146ec45f0 100644
--- a/engines/private/detection.cpp
+++ b/engines/private/detection.cpp
@@ -59,7 +59,7 @@ static const ADGameDescription gameDescriptions[] = {
GUIO1(GUIO_NOMIDI)
},
{
- "private-eye", // EU release
+ "private-eye", // EU release (UK)
0,
AD_ENTRY2s("pvteye.z", "d9ce391395701615e8b5d04bc4bf7ec3", 284699,
"bklynlgo.bmp", "1dfb703349a46f8ec183de107992b7f5", 33118),
@@ -67,7 +67,7 @@ static const ADGameDescription gameDescriptions[] = {
Common::kPlatformWindows,
ADGF_UNSTABLE,
GUIO1(GUIO_NOMIDI)
- },
+ },
{
"private-eye", // Demo from the EU release
"Demo",
@@ -139,15 +139,27 @@ static const ADGameDescription gameDescriptions[] = {
GUIO1(GUIO_NOMIDI)
},
{
- "private-eye", // Demo from the EU release (UK)
- "Demo",
- AD_ENTRY2s("Private Eye Demo", "", 284129,
+ "private-eye", // EU release (DE)
+ 0,
+ AD_ENTRY2s("pvteye.ex_", "5ca171c4e8d804c7277887277d049f03", 600576,
"bklynlgo.bmp", "1dfb703349a46f8ec183de107992b7f5", 33118),
- Common::EN_GRB,
+ Common::DE_DEU,
+ Common::kPlatformWindows,
+ ADGF_UNSTABLE,
+ GUIO1(GUIO_NOMIDI)
+ },
+ {
+ "private-eye", // Demo from the EU release (DE)
+ "Demo",
+ AD_ENTRY2s("pvtdemo.ex_", "17156cbac7d14b08f4e351ac0e16a889", 599040,
+ "bklynlgo.bmp", "1dfb703349a46f8ec183de107992b7f5", 33118),
+ Common::DE_DEU,
Common::kPlatformWindows,
ADGF_DEMO | ADGF_UNSTABLE,
GUIO1(GUIO_NOMIDI)
},
+
+
/*
{
"private-eye", // Demo from the EU release
Commit: 458df46dc9dddd15a223a9b5fae21627734afe87
https://github.com/scummvm/scummvm/commit/458df46dc9dddd15a223a9b5fae21627734afe87
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2021-06-22T10:10:53+02:00
Commit Message:
PRIVATE: clang-formatted all the code
Changed paths:
engines/private/code.cpp
engines/private/decompiler.cpp
engines/private/decompiler.h
engines/private/funcs.cpp
engines/private/private.cpp
engines/private/symbol.cpp
diff --git a/engines/private/code.cpp b/engines/private/code.cpp
index 6f05ee0003..8dd8c43074 100644
--- a/engines/private/code.cpp
+++ b/engines/private/code.cpp
@@ -43,13 +43,13 @@
// ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
// THIS SOFTWARE.
-#include "common/str.h"
#include "common/debug.h"
#include "common/hash-ptr.h"
+#include "common/str.h"
#include "private/grammar.h"
-#include "private/tokens.h"
#include "private/private.h"
+#include "private/tokens.h"
namespace Private {
@@ -101,13 +101,13 @@ namespace Gen {
/* pop and return top elem from stack */
Datum pop() {
- assert (!(g_vm->_stackp <= g_vm->_stack));
+ assert(!(g_vm->_stackp <= g_vm->_stack));
return *--g_vm->_stackp;
}
/* push d onto stack */
int push(const Datum &d) {
- assert (!(g_vm->_stackp >= &g_vm->_stack[NSTACK]));
+ assert(!(g_vm->_stackp >= &g_vm->_stack[NSTACK]));
*g_vm->_stackp++ = d;
return 0;
}
@@ -152,7 +152,7 @@ int funcpush() {
debugC(1, kPrivateDebugCode, "executing %s with %d params", s.u.str, n.u.val);
for (int i = 0; i < n.u.val; i++) {
Datum arg = pop();
- args.insert(args.begin(), arg) ;
+ args.insert(args.begin(), arg);
}
call(s.u.str, args);
@@ -165,11 +165,11 @@ int eval() {
if (d.u.sym->type == NUM) {
d.type = NUM;
d.u.val = d.u.sym->u.val;
- debugC(1, kPrivateDebugCode, "eval NUM returned %d", d.u.val );
+ debugC(1, kPrivateDebugCode, "eval NUM returned %d", d.u.val);
} else if (d.u.sym->type == STRING) {
d.type = STRING;
d.u.str = d.u.sym->u.str;
- debugC(1, kPrivateDebugCode, "eval STR returned %s", d.u.str );
+ debugC(1, kPrivateDebugCode, "eval STR returned %s", d.u.str);
} else if (d.u.sym->type == RECT) {
d.type = RECT;
d.u.rect = d.u.sym->u.rect;
@@ -371,16 +371,16 @@ int ne() {
Inst *code(const Inst &f) {
//debugC(1, kPrivateDebugCode, "pushing code at %x", progp);
Inst *oprogp = g_vm->_progp;
- assert (!(g_vm->_progp >= &g_vm->_prog[NPROG]));
+ assert(!(g_vm->_progp >= &g_vm->_prog[NPROG]));
*g_vm->_progp++ = f;
return oprogp;
}
int ifcode() {
- Inst *savepc = g_vm->_pc; /* then part */
+ Inst *savepc = g_vm->_pc; /* then part */
debugC(1, kPrivateDebugCode, "ifcode: evaluating condition");
- execute(savepc+3); /* condition */
+ execute(savepc + 3); /* condition */
Datum d = pop();
debugC(1, kPrivateDebugCode, "ifcode: selecting branch");
@@ -394,12 +394,12 @@ int ifcode() {
if (d.u.val) {
debugC(1, kPrivateDebugCode, "ifcode: true branch");
execute(*((Inst **)(savepc)));
- } else if (*((Inst **)(savepc+1))) { /* else part? */
+ } else if (*((Inst **)(savepc + 1))) { /* else part? */
debugC(1, kPrivateDebugCode, "ifcode: false branch");
- execute(*((Inst **)(savepc+1)));
+ execute(*((Inst **)(savepc + 1)));
}
debugC(1, kPrivateDebugCode, "ifcode finished");
- g_vm->_pc = *((Inst **)(savepc+2)); /* next stmt */
+ g_vm->_pc = *((Inst **)(savepc + 2)); /* next stmt */
return 0;
}
@@ -420,7 +420,7 @@ int fail() {
/* run the machine */
void execute(Inst *p) {
- for (g_vm->_pc = p; *(g_vm->_pc) != STOP; ) {
+ for (g_vm->_pc = p; *(g_vm->_pc) != STOP;) {
(*(*(g_vm->_pc++)))();
}
}
diff --git a/engines/private/decompiler.cpp b/engines/private/decompiler.cpp
index dd839e1f9c..6ab5854ad9 100644
--- a/engines/private/decompiler.cpp
+++ b/engines/private/decompiler.cpp
@@ -27,15 +27,15 @@ namespace Private {
Decompiler::Decompiler(char *buf, uint32 fileSize, bool mac) {
- Common::Array<unsigned char> array;
+ Common::Array<unsigned char> array;
uint32 i = 0;
while (i < fileSize) {
array.push_back(buf[i]);
i++;
}
- Common::String firstBytes((const char *) array.begin(), (const char *) array.begin() + kHeader.size());
-
+ Common::String firstBytes((const char *)array.begin(), (const char *)array.begin() + kHeader.size());
+
if (firstBytes != kHeader) {
debug("Not a precompiled game matrix");
_result = Common::String(buf);
@@ -47,22 +47,23 @@ Decompiler::Decompiler(char *buf, uint32 fileSize, bool mac) {
void Decompiler::decompile(Common::Array<unsigned char> &buffer, bool mac) {
Common::Array<unsigned char>::iterator it = buffer.begin();
-
+
Common::String ss;
bool inDefineRects = false;
- for (it += kHeader.size() ; it != buffer.end() ; ) {
+ for (it += kHeader.size(); it != buffer.end();) {
unsigned char byte = *it++;
if (byte == kCodeString) {
unsigned char len = *it++;
- Common::String s((const char *)it,(const char *)it+len);
+ Common::String s((const char *)it, (const char *)it + len);
it += len;
- ss += Common::String::format("\"%s\"", s.c_str());
+ ss += Common::String::format("\"%s\"", s.c_str());
} else if (byte == kCodeShortLiteral || byte == kCodeShortId) {
unsigned char b1 = *it++;
unsigned char b2 = *it++;
unsigned int number = mac ? b2 + (b1 << 8) : b1 + (b2 << 8);
- if (byte == kCodeShortId) ss += "k";
- ss += Common::String::format("%d", number);
+ if (byte == kCodeShortId)
+ ss += "k";
+ ss += Common::String::format("%d", number);
} else if (byte == kCodeRect && inDefineRects) {
ss += "RECT"; // override CRect
} else if (byte <= kCodeShortId && strlen(kCodeTable[byte]) > 0) {
@@ -84,4 +85,4 @@ Common::String Decompiler::getResult() const {
return _result;
}
-}
\ No newline at end of file
+} // namespace Private
\ No newline at end of file
diff --git a/engines/private/decompiler.h b/engines/private/decompiler.h
index cade79d341..d60be032c6 100644
--- a/engines/private/decompiler.h
+++ b/engines/private/decompiler.h
@@ -25,8 +25,8 @@
#define PRIVATE_DECOMPILER_H
#include "common/array.h"
-#include "common/str.h"
#include "common/debug.h"
+#include "common/str.h"
namespace Private {
@@ -39,99 +39,98 @@ const unsigned char kCodeRect = 0x2e;
const unsigned char kCodeRects = 0x4f;
const unsigned char kCodeShortId = 0x50;
-const static char *kCodeTable[] = {"", //
- "", // 0x01 (string)
- "", // 0x02 (short literal)
- " {\n", // 0x03
- "}\n", // 0x04
- "(", // 0x05
- ")", // 0x06
- "", //
- "", //
- "", //
- ",", // 0x0a
- "", //
- "%", // 0x0c
- "", //
- ";\n", // 0x0e
- "!", // 0x0f
- "-", // 0x10
- "+", // 0x11
- "=", // 0x12
- ">", // 0x13
- "<", // 0x14
- "if ", // 0x15
- "else ", // 0x16
- "Exit", // 0x17
- "goto ", // 0x18
- "Mask", // 0x19
- "MaskDrawn", // 0x1a
- "Movie", // 0x1b
- "Transition", // 0x1c
- "ThumbnailMovie", // 0x1d
- "BustMovie", // 0x1e
- "ViewScreen", // 0x1f
- "VSPicture", // 0x20
- "Bitmap", // 0x21
- "Timer", // 0x22
- "SoundArea", // 0x23
- "Sound", // 0x24
- "SoundEffect", // 0x25
- "SyncSound", // 0x26
- "LoopedSound", // 0x27
- "NoStopSounds", // 0x28
- "Resume", // 0x29
- "Inventory", // 0x2a
- "SetFlag", // 0x2b
- "ChgMode", // 0x2c
- "PoliceBust", // 0x2d
- "CRect", // 0x2e overridden with "RECT" if in "define rects" block
- "", //
- "Random", // 0x30
- "SafeDigit", // 0x31
- "LoseInventory", // 0x32
- "", //
- "PaperShuffleSound", // 0x34
- "Quit", // 0x35
- "DossierAdd", // 0x36
- "DossierBitmap", // 0x37
- "DossierPrevSuspect", // 0x38
- "DossierNextSuspect", // 0x39
- "DossierChgSheet", // 0x3a
- "DiaryLocList", // 0x3b
- "DiaryPage", // 0x3c
- "DiaryInvList", // 0x3d
- "DiaryPageTurn", // 0x3e
- "DiaryGoLoc", // 0x3f
- "SaveGame", // 0x40
- "LoadGame", // 0x41
- "RestartGame", // 0x42
- "AskSave", // 0x43
- "SetModifiedFlag", // 0x44
- "PhoneClip", // 0x45
- "PoliceClip", // 0x46
- "AMRadioClip", // 0x47
- "\nsetting ", // 0x48
- "debug ", // 0x49
- "\ndefine ", // 0x4a
- "", //
- "variables", // 0x4c
- "", //
- "", //
- "rects", // 0x4f
- ""
- }; // 0x50 (short id)
-
+const static char *kCodeTable[] = {"", //
+ "", // 0x01 (string)
+ "", // 0x02 (short literal)
+ " {\n", // 0x03
+ "}\n", // 0x04
+ "(", // 0x05
+ ")", // 0x06
+ "", //
+ "", //
+ "", //
+ ",", // 0x0a
+ "", //
+ "%", // 0x0c
+ "", //
+ ";\n", // 0x0e
+ "!", // 0x0f
+ "-", // 0x10
+ "+", // 0x11
+ "=", // 0x12
+ ">", // 0x13
+ "<", // 0x14
+ "if ", // 0x15
+ "else ", // 0x16
+ "Exit", // 0x17
+ "goto ", // 0x18
+ "Mask", // 0x19
+ "MaskDrawn", // 0x1a
+ "Movie", // 0x1b
+ "Transition", // 0x1c
+ "ThumbnailMovie", // 0x1d
+ "BustMovie", // 0x1e
+ "ViewScreen", // 0x1f
+ "VSPicture", // 0x20
+ "Bitmap", // 0x21
+ "Timer", // 0x22
+ "SoundArea", // 0x23
+ "Sound", // 0x24
+ "SoundEffect", // 0x25
+ "SyncSound", // 0x26
+ "LoopedSound", // 0x27
+ "NoStopSounds", // 0x28
+ "Resume", // 0x29
+ "Inventory", // 0x2a
+ "SetFlag", // 0x2b
+ "ChgMode", // 0x2c
+ "PoliceBust", // 0x2d
+ "CRect", // 0x2e overridden with "RECT" if in "define rects" block
+ "", //
+ "Random", // 0x30
+ "SafeDigit", // 0x31
+ "LoseInventory", // 0x32
+ "", //
+ "PaperShuffleSound", // 0x34
+ "Quit", // 0x35
+ "DossierAdd", // 0x36
+ "DossierBitmap", // 0x37
+ "DossierPrevSuspect", // 0x38
+ "DossierNextSuspect", // 0x39
+ "DossierChgSheet", // 0x3a
+ "DiaryLocList", // 0x3b
+ "DiaryPage", // 0x3c
+ "DiaryInvList", // 0x3d
+ "DiaryPageTurn", // 0x3e
+ "DiaryGoLoc", // 0x3f
+ "SaveGame", // 0x40
+ "LoadGame", // 0x41
+ "RestartGame", // 0x42
+ "AskSave", // 0x43
+ "SetModifiedFlag", // 0x44
+ "PhoneClip", // 0x45
+ "PoliceClip", // 0x46
+ "AMRadioClip", // 0x47
+ "\nsetting ", // 0x48
+ "debug ", // 0x49
+ "\ndefine ", // 0x4a
+ "", //
+ "variables", // 0x4c
+ "", //
+ "", //
+ "rects", // 0x4f
+ ""}; // 0x50 (short id)
class Decompiler {
public:
Decompiler(char *buf, uint32 fileSize, bool mac = false);
Common::String getResult() const;
+
private:
void decompile(Common::Array<unsigned char> &buffer, bool mac);
Common::String _result;
};
-}
+} // namespace Private
#endif
\ No newline at end of file
diff --git a/engines/private/funcs.cpp b/engines/private/funcs.cpp
index d05a458070..5369961619 100644
--- a/engines/private/funcs.cpp
+++ b/engines/private/funcs.cpp
@@ -21,18 +21,18 @@
*/
#include "common/str.h"
-#include "common/timer.h"
#include "common/system.h"
+#include "common/timer.h"
#include "private/grammar.h"
-#include "private/tokens.h"
#include "private/private.h"
+#include "private/tokens.h"
namespace Private {
static void fChgMode(ArgArray args) {
// assert types
- assert (args.size() == 2 || args.size() == 3);
+ assert(args.size() == 2 || args.size() == 3);
assert(args[0].type == NUM);
if (args.size() == 2)
@@ -69,7 +69,6 @@ static void fVSPicture(ArgArray args) {
g_private->_nextVS = args[0].u.str;
}
-
static void fDiaryLocList(ArgArray args) {
int x1, y1, x2, y2;
assert(args[0].type == NUM);
@@ -87,7 +86,6 @@ static void fDiaryLocList(ArgArray args) {
Common::Rect rect(x1, y1, x2, y2);
g_private->loadLocations(rect);
-
}
static void fDiaryGoLoc(ArgArray args) {
@@ -109,7 +107,6 @@ static void fgoto(ArgArray args) {
g_private->_nextSetting = args[0].u.str;
}
-
static void fSyncSound(ArgArray args) {
assert(args[0].type == STRING);
assert(args[1].type == NAME);
@@ -123,9 +120,8 @@ static void fSyncSound(ArgArray args) {
g_private->ignoreEvents();
uint32 i = 100;
- while(i--) // one second extra
+ while (i--) // one second extra
g_private->ignoreEvents();
-
}
}
@@ -176,7 +172,7 @@ static void fRestartGame(ArgArray args) {
static void fPoliceBust(ArgArray args) {
// assert types
- assert (args.size() == 1 || args.size() == 2);
+ assert(args.size() == 1 || args.size() == 2);
g_private->_policeBustEnabled = args[0].u.val;
//debug("Number of clicks %d", g_private->computePoliceIndex());
@@ -199,16 +195,16 @@ static void fPoliceBust(ArgArray args) {
static void fBustMovie(ArgArray args) {
// assert types
- assert (args.size() == 1);
+ assert(args.size() == 1);
debugC(1, kPrivateDebugScript, "BustMovie(%s)", args[0].u.sym->name->c_str());
uint policeIndex = g_private->maps.variables.getVal(g_private->getPoliceIndexVariable())->u.val;
- int videoIndex = policeIndex/2 - 1;
+ int videoIndex = policeIndex / 2 - 1;
if (videoIndex < 0)
videoIndex = 0;
assert(videoIndex <= 5);
Common::String pv =
- Common::String::format("po/animatio/spoc%02dxs.smk",
- kPoliceBustVideos[videoIndex]);
+ Common::String::format("po/animatio/spoc%02dxs.smk",
+ kPoliceBustVideos[videoIndex]);
if (kPoliceBustVideos[videoIndex] == 2) {
Common::String s("global/transiti/audio/spoc02VO.wav");
@@ -221,7 +217,7 @@ static void fBustMovie(ArgArray args) {
static void fDossierAdd(ArgArray args) {
- assert (args.size() == 2);
+ assert(args.size() == 2);
Common::String s1 = args[0].u.str;
Common::String s2 = args[1].u.str;
DossierInfo m;
@@ -237,7 +233,7 @@ static void fDossierAdd(ArgArray args) {
}
static void fDossierBitmap(ArgArray args) {
- assert (args.size() == 2);
+ assert(args.size() == 2);
int x = args[0].u.val;
int y = args[1].u.val;
assert(x == 40 && y == 30);
@@ -270,7 +266,7 @@ static void fDossierChgSheet(ArgArray args) {
}
static void fDossierPrevSuspect(ArgArray args) {
- assert (args.size() == 3);
+ assert(args.size() == 3);
Common::String s(args[0].u.str);
MaskInfo m;
@@ -287,7 +283,7 @@ static void fDossierPrevSuspect(ArgArray args) {
}
static void fDossierNextSuspect(ArgArray args) {
- assert (args.size() == 3);
+ assert(args.size() == 3);
Common::String s(args[0].u.str);
MaskInfo m;
@@ -354,23 +350,20 @@ static void fInventory(ArgArray args) {
if (e.type == NUM) {
assert(e.u.val == 0);
m.nextSetting = "";
- }
- else
+ } else
m.nextSetting = e.u.sym->name->c_str();
m.cursor = g_private->getInventoryCursor();
- m.point = Common::Point(0,0);
+ m.point = Common::Point(0, 0);
if (v1.type == NAME) {
m.flag1 = g_private->maps.lookupVariable(v1.u.sym->name);
- }
- else
+ } else
m.flag1 = NULL;
if (v2.type == NAME) {
m.flag2 = g_private->maps.lookupVariable(v2.u.sym->name);
- }
- else
+ } else
m.flag2 = NULL;
g_private->_masks.push_front(m);
@@ -387,7 +380,7 @@ static void fInventory(ArgArray args) {
g_private->inventory.push_back(bmp);
} else {
if (v1.type == NAME) {
- v1.u.sym = g_private->maps.lookupVariable(v1.u.sym->name);
+ v1.u.sym = g_private->maps.lookupVariable(v1.u.sym->name);
if (strcmp(c.u.str, "\"REMOVE\"") == 0) {
v1.u.sym->u.val = 0;
if (inInventory(bmp))
@@ -402,7 +395,7 @@ static void fInventory(ArgArray args) {
g_private->inventory.push_back(bmp);
}
if (v2.type == NAME) {
- v2.u.sym = g_private->maps.lookupVariable(v2.u.sym->name);
+ v2.u.sym = g_private->maps.lookupVariable(v2.u.sym->name);
v2.u.sym->u.val = 1;
}
}
@@ -603,9 +596,8 @@ static void _fMask(ArgArray args, bool drawn) {
m.cursor = *c;
m.flag1 = NULL;
m.flag2 = NULL;
- m.point = Common::Point(x,y);
+ m.point = Common::Point(x, y);
g_private->_masks.push_front(m);
-
}
static void fMask(ArgArray args) {
@@ -677,8 +669,7 @@ static void fSoundArea(ArgArray args) {
n = Common::String(args[1].u.str);
Common::replace(n, "\"", "");
Common::replace(n, "\"", "");
- }
- else
+ } else
error("Invalid input for SoundArea");
debugC(1, kPrivateDebugScript, "SoundArea(%s, %s, ..)", args[0].u.str, n.c_str());
@@ -732,7 +723,7 @@ static void fAskSave(ArgArray args) {
}
static void fTimer(ArgArray args) {
- assert (args.size() == 2 || args.size() == 3);
+ assert(args.size() == 2 || args.size() == 3);
if (args.size() == 3)
debugC(1, kPrivateDebugScript, "Timer(%d, %s, %s)", args[0].u.val, args[1].u.sym->name->c_str(), args[2].u.sym->name->c_str());
@@ -756,72 +747,71 @@ static void fTimer(ArgArray args) {
const FuncTable funcTable[] = {
// Control flow
- { fChgMode, "ChgMode"},
- { fResume, "Resume"},
- { fgoto, "goto"},
- { fTimer, "Timer"},
+ {fChgMode, "ChgMode"},
+ {fResume, "Resume"},
+ {fgoto, "goto"},
+ {fTimer, "Timer"},
// Variables
- { fSetFlag, "SetFlag"},
- { fSetModifiedFlag, "SetModifiedFlag"},
+ {fSetFlag, "SetFlag"},
+ {fSetModifiedFlag, "SetModifiedFlag"},
// Sounds
- { fSound, "Sound"},
- { fSoundEffect, "SoundEffect"},
- { fLoopedSound, "LoopedSound"},
- { fNoStopSounds, "NoStopSounds"},
- { fSyncSound, "SyncSound"},
- { fAMRadioClip, "AMRadioClip"},
- { fPoliceClip, "PoliceClip"},
- { fPhoneClip, "PhoneClip"},
- { fSoundArea, "SoundArea"},
- { fPaperShuffleSound, "PaperShuffleSound"},
+ {fSound, "Sound"},
+ {fSoundEffect, "SoundEffect"},
+ {fLoopedSound, "LoopedSound"},
+ {fNoStopSounds, "NoStopSounds"},
+ {fSyncSound, "SyncSound"},
+ {fAMRadioClip, "AMRadioClip"},
+ {fPoliceClip, "PoliceClip"},
+ {fPhoneClip, "PhoneClip"},
+ {fSoundArea, "SoundArea"},
+ {fPaperShuffleSound, "PaperShuffleSound"},
// Images
- { fBitmap, "Bitmap"},
- { fMask, "Mask"},
- { fMaskDrawn, "MaskDrawn"},
- { fVSPicture, "VSPicture"},
- { fViewScreen, "ViewScreen"},
- { fExit, "Exit"},
+ {fBitmap, "Bitmap"},
+ {fMask, "Mask"},
+ {fMaskDrawn, "MaskDrawn"},
+ {fVSPicture, "VSPicture"},
+ {fViewScreen, "ViewScreen"},
+ {fExit, "Exit"},
// Video
- { fTransition, "Transition"},
- { fMovie, "Movie"},
+ {fTransition, "Transition"},
+ {fMovie, "Movie"},
// Diary
- { fDiaryLocList, "DiaryLocList"},
- { fDiaryInvList, "DiaryInvList"},
- { fDiaryGoLoc, "DiaryGoLoc"},
+ {fDiaryLocList, "DiaryLocList"},
+ {fDiaryInvList, "DiaryInvList"},
+ {fDiaryGoLoc, "DiaryGoLoc"},
// Main menu
- { fQuit, "Quit"},
- { fLoadGame, "LoadGame"},
- { fSaveGame, "SaveGame"},
- { fAskSave, "AskSave"},
- { fRestartGame, "RestartGame"},
+ {fQuit, "Quit"},
+ {fLoadGame, "LoadGame"},
+ {fSaveGame, "SaveGame"},
+ {fAskSave, "AskSave"},
+ {fRestartGame, "RestartGame"},
// Dossiers
- { fDossierAdd, "DossierAdd"},
- { fDossierChgSheet, "DossierChgSheet"},
- { fDossierBitmap, "DossierBitmap"},
- { fDossierPrevSuspect, "DossierPrevSuspect"},
- { fDossierNextSuspect, "DossierNextSuspect"},
+ {fDossierAdd, "DossierAdd"},
+ {fDossierChgSheet, "DossierChgSheet"},
+ {fDossierBitmap, "DossierBitmap"},
+ {fDossierPrevSuspect, "DossierPrevSuspect"},
+ {fDossierNextSuspect, "DossierNextSuspect"},
// Inventory
- { fLoseInventory, "LoseInventory"},
- { fInventory, "Inventory"},
+ {fLoseInventory, "LoseInventory"},
+ {fInventory, "Inventory"},
// PoliceBust
- { fPoliceBust, "PoliceBust"},
- { fBustMovie, "BustMovie"},
+ {fPoliceBust, "PoliceBust"},
+ {fBustMovie, "BustMovie"},
// Others
- { fSafeDigit, "SafeDigit"},
- { fCRect, "CRect"},
+ {fSafeDigit, "SafeDigit"},
+ {fCRect, "CRect"},
- { 0, 0}
-};
+ {0, 0}};
void call(const char *name, const ArgArray &args) {
Common::String n(name);
@@ -829,7 +819,7 @@ void call(const char *name, const ArgArray &args) {
error("I don't know how to execute %s", name);
}
- void (*func)(ArgArray) = (void (*)(ArgArray)) g_private->_functions.getVal(n);
+ void (*func)(ArgArray) = (void (*)(ArgArray))g_private->_functions.getVal(n);
func(args);
}
diff --git a/engines/private/private.cpp b/engines/private/private.cpp
index 092058b21b..06bcbe7c72 100644
--- a/engines/private/private.cpp
+++ b/engines/private/private.cpp
@@ -20,26 +20,26 @@
*
*/
-#include "audio/decoders/wave.h"
#include "audio/audiostream.h"
+#include "audio/decoders/wave.h"
#include "common/archive.h"
#include "common/config-manager.h"
-#include "common/debug.h"
#include "common/debug-channels.h"
+#include "common/debug.h"
#include "common/error.h"
#include "common/events.h"
#include "common/file.h"
#include "common/savefile.h"
-#include "common/system.h"
#include "common/str.h"
+#include "common/system.h"
#include "common/timer.h"
#include "engines/util.h"
#include "image/bmp.h"
+#include "private/decompiler.h"
+#include "private/grammar.h"
#include "private/private.h"
#include "private/tokens.h"
-#include "private/grammar.h"
-#include "private/decompiler.h"
namespace Private {
@@ -127,9 +127,9 @@ Common::SeekableReadStream *PrivateEngine::loadAssets() {
Common::SeekableReadStream *file = NULL;
if (isDemo() && test->open("SUPPORT/ASSETS/DEMOGAME.WIN"))
- file = (Common::SeekableReadStream *) test;
+ file = (Common::SeekableReadStream *)test;
else if (test->open("SUPPORT/ASSETS/GAME.WIN")) {
- file = (Common::SeekableReadStream *) test;
+ file = (Common::SeekableReadStream *)test;
} else {
delete test;
assert(_installerArchive.open("SUPPORT/ASSETS.Z"));
@@ -137,7 +137,7 @@ Common::SeekableReadStream *PrivateEngine::loadAssets() {
if (!isDemo()) {
if (_installerArchive.hasFile("GAME.DAT"))
file = _installerArchive.createReadStreamForMember("GAME.DAT");
- else if (_installerArchive.hasFile("GAME.WIN"))
+ else if (_installerArchive.hasFile("GAME.WIN"))
file = _installerArchive.createReadStreamForMember("GAME.WIN");
else
error("Unknown version");
@@ -148,17 +148,16 @@ Common::SeekableReadStream *PrivateEngine::loadAssets() {
// if the demo from the full retail CDROM is used
else if (_installerArchive.hasFile("DEMOGAME.DAT"))
- file = _installerArchive.createReadStreamForMember("DEMOGAME.DAT");
+ file = _installerArchive.createReadStreamForMember("DEMOGAME.DAT");
else if (_installerArchive.hasFile("DEMOGAME.WIN"))
- file = _installerArchive.createReadStreamForMember("DEMOGAME.WIN");
+ file = _installerArchive.createReadStreamForMember("DEMOGAME.WIN");
else {
error("Unknown version");
}
}
- }
+ }
assert(file != NULL);
return file;
-
}
Common::Error PrivateEngine::run() {
@@ -173,7 +172,7 @@ Common::Error PrivateEngine::run() {
Decompiler decomp(buf, fileSize, false);
free(buf);
- buf = (char*) decomp.getResult().c_str();
+ buf = (char *)decomp.getResult().c_str();
//debug("%s", buf);
// Initialize stuff
@@ -260,9 +259,10 @@ Common::Error PrivateEngine::run() {
changeCursor("default");
// The following functions will return true
// if the cursor is changed
- if (cursorPauseMovie(mousePos)) {}
- else if (cursorMask(mousePos)) {}
- else cursorExit(mousePos);
+ if (cursorPauseMovie(mousePos)) {
+ } else if (cursorMask(mousePos)) {
+ } else
+ cursorExit(mousePos);
break;
default:
@@ -411,7 +411,7 @@ void PrivateEngine::checkPoliceBust() {
return;
}
- if (_numberClicks == _maxNumberClicks+1) {
+ if (_numberClicks == _maxNumberClicks + 1) {
uint policeIndex = maps.variables.getVal(getPoliceIndexVariable())->u.val;
_policeBustSetting = _currentSetting;
if (policeIndex <= 13) {
@@ -435,7 +435,7 @@ bool PrivateEngine::cursorExit(Common::Point mousePos) {
for (ExitList::const_iterator it = _exits.begin(); it != _exits.end(); ++it) {
const ExitInfo &e = *it;
- cs = e.rect.width()*e.rect.height();
+ cs = e.rect.width() * e.rect.height();
if (e.rect.contains(mousePos)) {
if (cs < rs && !e.cursor.empty()) {
@@ -467,7 +467,6 @@ bool PrivateEngine::inMask(Graphics::Surface *surf, Common::Point mousePos) {
return (surf->getPixel(mousePos.x, mousePos.y) != _transparentColor);
}
-
bool PrivateEngine::cursorMask(Common::Point mousePos) {
bool inside = false;
for (MaskList::const_iterator it = _masks.begin(); it != _masks.end(); ++it) {
@@ -533,7 +532,6 @@ Common::String PrivateEngine::getPoliceIndexVariable() {
return "k0";
}
-
Common::String PrivateEngine::getPOGoBustMovieSetting() {
if (_language == "us")
return "kPOGoBustMovie";
@@ -555,7 +553,6 @@ Common::String PrivateEngine::getExitCursor() {
return "k5";
}
-
Common::String PrivateEngine::getInventoryCursor() {
if (_language == "us")
return "kInventory";
@@ -574,7 +571,7 @@ void PrivateEngine::selectPauseMovie(Common::Point mousePos) {
else
_pausedSetting = _currentSetting;
- _nextSetting = getPauseMovieSetting();
+ _nextSetting = getPauseMovieSetting();
if (_videoDecoder) {
_videoDecoder->pauseVideo(true);
}
@@ -593,7 +590,7 @@ void PrivateEngine::selectExit(Common::Point mousePos) {
int cs = 0;
for (ExitList::const_iterator it = _exits.begin(); it != _exits.end(); ++it) {
const ExitInfo &e = *it;
- cs = e.rect.width()*e.rect.height();
+ cs = e.rect.width() * e.rect.height();
//debug("Testing exit %s %d", e.nextSetting->c_str(), cs);
if (e.rect.contains(mousePos)) {
//debug("Inside! %d %d", cs, rs);
@@ -903,8 +900,8 @@ Common::Error PrivateEngine::loadGameStream(Common::SeekableReadStream *stream)
PhoneInfo p;
for (uint32 j = 0; j < size; ++j) {
p.sound = stream->readString();
- p.flag = maps.variables.getVal(stream->readString());
- p.val = stream->readUint32LE();
+ p.flag = maps.variables.getVal(stream->readString());
+ p.val = stream->readUint32LE();
_phone.push_back(p);
}
@@ -1132,7 +1129,7 @@ Graphics::Surface *PrivateEngine::decodeImage(const Common::String &name) {
void PrivateEngine::loadImage(const Common::String &name, int x, int y) {
debugC(1, kPrivateDebugFunction, "%s(%s,%d,%d)", __FUNCTION__, name.c_str(), x, y);
Graphics::Surface *surf = decodeImage(name);
- _compositeSurface->transBlitFrom(*surf, _origin + Common::Point(x,y), _transparentColor);
+ _compositeSurface->transBlitFrom(*surf, _origin + Common::Point(x, y), _transparentColor);
surf->free();
delete surf;
_image->destroy();
@@ -1142,7 +1139,6 @@ void PrivateEngine::drawScreenFrame() {
g_system->copyRectToScreen(_frame->getPixels(), _frame->pitch, 0, 0, _screenW, _screenH);
}
-
Graphics::Surface *PrivateEngine::loadMask(const Common::String &name, int x, int y, bool drawn) {
debugC(1, kPrivateDebugFunction, "%s(%s,%d,%d,%d)", __FUNCTION__, name.c_str(), x, y, drawn);
Graphics::Surface *surf = new Graphics::Surface();
@@ -1153,10 +1149,10 @@ Graphics::Surface *PrivateEngine::loadMask(const Common::String &name, int x, in
uint32 hdiff = 0;
uint32 wdiff = 0;
- if (x+csurf->h > _screenH)
- hdiff = x+csurf->h - _screenH;
- if (y+csurf->w > _screenW)
- wdiff = y+csurf->w - _screenW;
+ if (x + csurf->h > _screenH)
+ hdiff = x + csurf->h - _screenH;
+ if (y + csurf->w > _screenW)
+ wdiff = y + csurf->w - _screenW;
Common::Rect crect(csurf->w - wdiff, csurf->h - hdiff);
surf->copyRectToSurface(*csurf, x, y, crect);
@@ -1181,7 +1177,7 @@ void PrivateEngine::drawScreen() {
if (_videoDecoder && !_videoDecoder->isPaused()) {
const Graphics::Surface *frame = _videoDecoder->decodeNextFrame();
Graphics::Surface *cframe = frame->convertTo(_pixelFormat, _videoDecoder->getPalette());
- Common::Point center((_screenW - _videoDecoder->getWidth())/2, (_screenH - _videoDecoder->getHeight())/2);
+ Common::Point center((_screenW - _videoDecoder->getWidth()) / 2, (_screenH - _videoDecoder->getHeight()) / 2);
surface->blitFrom(*cframe, center);
cframe->free();
delete cframe;
@@ -1197,7 +1193,6 @@ void PrivateEngine::drawScreen() {
//if (_image->getPalette() != nullptr)
// g_system->getPaletteManager()->setPalette(_image->getPalette(), _image->getPaletteStartIndex(), _image->getPaletteColorCount());
g_system->updateScreen();
-
}
bool PrivateEngine::getRandomBool(uint p) {
@@ -1265,7 +1260,7 @@ void PrivateEngine::loadLocations(const Common::Rect &rect) {
if (sym->u.val) {
offset = offset + 22;
Common::String s =
- Common::String::format("%sdryloc%d.bmp", _diaryLocPrefix.c_str(), i);
+ Common::String::format("%sdryloc%d.bmp", _diaryLocPrefix.c_str(), i);
loadMask(s, rect.left + 120, rect.top + offset, true);
}
diff --git a/engines/private/symbol.cpp b/engines/private/symbol.cpp
index ddc6b5a07e..bfef15e2a0 100644
--- a/engines/private/symbol.cpp
+++ b/engines/private/symbol.cpp
@@ -20,7 +20,6 @@
*
*/
-
// Heavily inspired by hoc
// Copyright (C) AT&T 1995
// All Rights Reserved
@@ -44,10 +43,10 @@
// ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
// THIS SOFTWARE.
+#include "common/str.h"
#include "private/grammar.h"
#include "private/private.h"
#include "private/tokens.h"
-#include "common/str.h"
namespace Private {
@@ -90,14 +89,12 @@ static Symbol *install(const Common::String &n, int t, int d, const char *s, Com
sp->name = name;
sp->type = t;
if (t == NUM) {
- sp->u.val = d;
+ sp->u.val = d;
//debug("install NUM: %s %d", name->c_str(), d);
- }
- else if (t == NAME) {
+ } else if (t == NAME) {
sp->u.val = d;
//debug("installing NAME: %s %d", name->c_str(), d);
- }
- else if (t == STRING)
+ } else if (t == STRING)
sp->u.str = scumm_strdup(s); // FIXME: leaks a string here.
else if (t == RECT)
sp->u.rect = r;
@@ -109,7 +106,6 @@ static Symbol *install(const Common::String &n, int t, int d, const char *s, Com
return sp;
}
-
/* lookup some name in some symbol table */
Symbol *SymbolMaps::lookupRect(Common::String *n) {
//debug("looking rect up %s", n->c_str());
@@ -125,7 +121,6 @@ Symbol *SymbolMaps::lookupVariable(Common::String *n) {
return lookup(*n, variables);
}
-
/* lookup some name in some symbol table */
Symbol *SymbolMaps::lookupName(const char *n) {
Commit: adf77a709fcc57da2ff8d734d7d08fa5b6429b68
https://github.com/scummvm/scummvm/commit/adf77a709fcc57da2ff8d734d7d08fa5b6429b68
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2021-06-22T10:10:53+02:00
Commit Message:
PRIVATE: use Common::Language for _language
Changed paths:
engines/private/private.cpp
engines/private/private.h
diff --git a/engines/private/private.cpp b/engines/private/private.cpp
index 06bcbe7c72..1314d79245 100644
--- a/engines/private/private.cpp
+++ b/engines/private/private.cpp
@@ -206,7 +206,7 @@ Common::Error PrivateEngine::run() {
Common::Event event;
Common::Point mousePos;
_videoDecoder = nullptr;
- _language = ConfMan.get("language");
+ _language = Common::parseLanguage(ConfMan.get("language"));
int saveSlot = ConfMan.getInt("save_slot");
if (saveSlot >= 0) { // load the savegame
loadGameState(saveSlot);
@@ -495,28 +495,28 @@ bool PrivateEngine::cursorPauseMovie(Common::Point mousePos) {
}
Common::String PrivateEngine::getPauseMovieSetting() {
- if (_language == "us")
+ if (_language == Common::EN_USA)
return "kPauseMovie";
return "k3";
}
Common::String PrivateEngine::getGoIntroSetting() {
- if (_language == "us")
+ if (_language == Common::EN_USA)
return "kGoIntro";
return "k1";
}
Common::String PrivateEngine::getAlternateGameVariable() {
- if (_language == "us")
+ if (_language == Common::EN_USA)
return "kAlternateGame";
return "k2";
}
Common::String PrivateEngine::getMainDesktopSetting() {
- if (_language == "us")
+ if (_language == Common::EN_USA)
return "kMainDesktop";
if (isDemo())
@@ -526,35 +526,35 @@ Common::String PrivateEngine::getMainDesktopSetting() {
}
Common::String PrivateEngine::getPoliceIndexVariable() {
- if (_language == "us")
+ if (_language == Common::EN_USA)
return "kPoliceIndex";
return "k0";
}
Common::String PrivateEngine::getPOGoBustMovieSetting() {
- if (_language == "us")
+ if (_language == Common::EN_USA)
return "kPOGoBustMovie";
return "k7";
}
Common::String PrivateEngine::getPoliceBustFromMOSetting() {
- if (_language == "us")
+ if (_language == Common::EN_USA)
return "kPoliceBustFromMO";
return "k6";
}
Common::String PrivateEngine::getExitCursor() {
- if (_language == "us")
+ if (_language == Common::EN_USA)
return "kExit";
return "k5";
}
Common::String PrivateEngine::getInventoryCursor() {
- if (_language == "us")
+ if (_language == Common::EN_USA)
return "kInventory";
return "k7";
diff --git a/engines/private/private.h b/engines/private/private.h
index e509ccd2ee..e4709a2f6d 100644
--- a/engines/private/private.h
+++ b/engines/private/private.h
@@ -145,7 +145,7 @@ public:
const ADGameDescription *_gameDescription;
bool isDemo() const;
- Common::String _language;
+ Common::Language _language;
SymbolMaps maps;
Commit: 3f1fc233028f8fc6044958ffc1eab496be7b4c9c
https://github.com/scummvm/scummvm/commit/3f1fc233028f8fc6044958ffc1eab496be7b4c9c
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2021-06-22T10:10:53+02:00
Commit Message:
PRIVATE: improved error detail when an unknown byte is decompiled
Changed paths:
engines/private/decompiler.cpp
diff --git a/engines/private/decompiler.cpp b/engines/private/decompiler.cpp
index 6ab5854ad9..b010be4ef8 100644
--- a/engines/private/decompiler.cpp
+++ b/engines/private/decompiler.cpp
@@ -69,7 +69,7 @@ void Decompiler::decompile(Common::Array<unsigned char> &buffer, bool mac) {
} else if (byte <= kCodeShortId && strlen(kCodeTable[byte]) > 0) {
ss += kCodeTable[byte];
} else {
- error("Unknown byte code");
+ error("decompile(): Unknown byte code (%d %c)", byte, byte);
}
if (byte == kCodeRects) {
Commit: 863717b39d592d33af621cc326a056a0196ae5eb
https://github.com/scummvm/scummvm/commit/863717b39d592d33af621cc326a056a0196ae5eb
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2021-06-22T10:10:53+02:00
Commit Message:
PRIVATE: replaced unsigned char -> byte and unsigned int -> uint
Changed paths:
engines/private/decompiler.cpp
engines/private/decompiler.h
engines/private/private.h
diff --git a/engines/private/decompiler.cpp b/engines/private/decompiler.cpp
index b010be4ef8..e2c9d87212 100644
--- a/engines/private/decompiler.cpp
+++ b/engines/private/decompiler.cpp
@@ -27,7 +27,7 @@ namespace Private {
Decompiler::Decompiler(char *buf, uint32 fileSize, bool mac) {
- Common::Array<unsigned char> array;
+ Common::Array<byte> array;
uint32 i = 0;
while (i < fileSize) {
array.push_back(buf[i]);
@@ -45,36 +45,36 @@ Decompiler::Decompiler(char *buf, uint32 fileSize, bool mac) {
decompile(array, mac);
}
-void Decompiler::decompile(Common::Array<unsigned char> &buffer, bool mac) {
- Common::Array<unsigned char>::iterator it = buffer.begin();
+void Decompiler::decompile(Common::Array<byte> &buffer, bool mac) {
+ Common::Array<byte>::iterator it = buffer.begin();
Common::String ss;
bool inDefineRects = false;
for (it += kHeader.size(); it != buffer.end();) {
- unsigned char byte = *it++;
- if (byte == kCodeString) {
- unsigned char len = *it++;
+ byte b = *it++;
+ if (b == kCodeString) {
+ byte len = *it++;
Common::String s((const char *)it, (const char *)it + len);
it += len;
ss += Common::String::format("\"%s\"", s.c_str());
- } else if (byte == kCodeShortLiteral || byte == kCodeShortId) {
- unsigned char b1 = *it++;
- unsigned char b2 = *it++;
- unsigned int number = mac ? b2 + (b1 << 8) : b1 + (b2 << 8);
- if (byte == kCodeShortId)
+ } else if (b == kCodeShortLiteral || b == kCodeShortId) {
+ byte b1 = *it++;
+ byte b2 = *it++;
+ uint number = mac ? b2 + (b1 << 8) : b1 + (b2 << 8);
+ if (b == kCodeShortId)
ss += "k";
ss += Common::String::format("%d", number);
- } else if (byte == kCodeRect && inDefineRects) {
+ } else if (b == kCodeRect && inDefineRects) {
ss += "RECT"; // override CRect
- } else if (byte <= kCodeShortId && strlen(kCodeTable[byte]) > 0) {
- ss += kCodeTable[byte];
+ } else if (b <= kCodeShortId && strlen(kCodeTable[b]) > 0) {
+ ss += kCodeTable[b];
} else {
- error("decompile(): Unknown byte code (%d %c)", byte, byte);
+ error("decompile(): Unknown byte code (%d %c)", b, b);
}
- if (byte == kCodeRects) {
+ if (b == kCodeRects) {
inDefineRects = true;
- } else if (byte == kCodeBraceClose && inDefineRects) {
+ } else if (b == kCodeBraceClose && inDefineRects) {
inDefineRects = false;
}
}
diff --git a/engines/private/decompiler.h b/engines/private/decompiler.h
index d60be032c6..3e481d47a5 100644
--- a/engines/private/decompiler.h
+++ b/engines/private/decompiler.h
@@ -32,12 +32,12 @@ namespace Private {
const Common::String kHeader = "Precompiled Game Matrix";
-const unsigned char kCodeString = 0x01;
-const unsigned char kCodeShortLiteral = 0x02;
-const unsigned char kCodeBraceClose = 0x04;
-const unsigned char kCodeRect = 0x2e;
-const unsigned char kCodeRects = 0x4f;
-const unsigned char kCodeShortId = 0x50;
+const byte kCodeString = 0x01;
+const byte kCodeShortLiteral = 0x02;
+const byte kCodeBraceClose = 0x04;
+const byte kCodeRect = 0x2e;
+const byte kCodeRects = 0x4f;
+const byte kCodeShortId = 0x50;
const static char *kCodeTable[] = {"", //
"", // 0x01 (string)
@@ -127,7 +127,7 @@ public:
Common::String getResult() const;
private:
- void decompile(Common::Array<unsigned char> &buffer, bool mac);
+ void decompile(Common::Array<byte> &buffer, bool mac);
Common::String _result;
};
diff --git a/engines/private/private.h b/engines/private/private.h
index e4709a2f6d..953c809f68 100644
--- a/engines/private/private.h
+++ b/engines/private/private.h
@@ -237,8 +237,8 @@ public:
// Dossiers
DossierArray _dossiers;
- unsigned int _dossierSuspect;
- unsigned int _dossierPage;
+ uint _dossierSuspect;
+ uint _dossierPage;
MaskInfo _dossierNextSuspectMask;
MaskInfo _dossierPrevSuspectMask;
MaskInfo _dossierNextSheetMask;
Commit: 2a2cac190dcc83e076f8a0c4a9641c56a2d3bc90
https://github.com/scummvm/scummvm/commit/2a2cac190dcc83e076f8a0c4a9641c56a2d3bc90
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2021-06-22T10:10:53+02:00
Commit Message:
PRIVATE: refactored kHeader to avoid a global constructor
Changed paths:
engines/private/decompiler.cpp
engines/private/decompiler.h
diff --git a/engines/private/decompiler.cpp b/engines/private/decompiler.cpp
index e2c9d87212..c0d3dedee3 100644
--- a/engines/private/decompiler.cpp
+++ b/engines/private/decompiler.cpp
@@ -25,6 +25,9 @@
namespace Private {
+const char *kHeader = "Precompiled Game Matrix";
+const uint kHeaderSize = 23;
+
Decompiler::Decompiler(char *buf, uint32 fileSize, bool mac) {
Common::Array<byte> array;
@@ -34,7 +37,7 @@ Decompiler::Decompiler(char *buf, uint32 fileSize, bool mac) {
i++;
}
- Common::String firstBytes((const char *)array.begin(), (const char *)array.begin() + kHeader.size());
+ Common::String firstBytes((const char *)array.begin(), (const char *)array.begin() + kHeaderSize);
if (firstBytes != kHeader) {
debug("Not a precompiled game matrix");
@@ -50,7 +53,7 @@ void Decompiler::decompile(Common::Array<byte> &buffer, bool mac) {
Common::String ss;
bool inDefineRects = false;
- for (it += kHeader.size(); it != buffer.end();) {
+ for (it += kHeaderSize; it != buffer.end();) {
byte b = *it++;
if (b == kCodeString) {
byte len = *it++;
diff --git a/engines/private/decompiler.h b/engines/private/decompiler.h
index 3e481d47a5..427b82d11f 100644
--- a/engines/private/decompiler.h
+++ b/engines/private/decompiler.h
@@ -30,8 +30,6 @@
namespace Private {
-const Common::String kHeader = "Precompiled Game Matrix";
-
const byte kCodeString = 0x01;
const byte kCodeShortLiteral = 0x02;
const byte kCodeBraceClose = 0x04;
Commit: e7a605f4ecb9a1fe503373e6160958ed386bcd91
https://github.com/scummvm/scummvm/commit/e7a605f4ecb9a1fe503373e6160958ed386bcd91
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2021-06-22T10:10:53+02:00
Commit Message:
PRIVATE: removed useless local variable in install
Changed paths:
engines/private/symbol.cpp
diff --git a/engines/private/symbol.cpp b/engines/private/symbol.cpp
index bfef15e2a0..4ca25c55be 100644
--- a/engines/private/symbol.cpp
+++ b/engines/private/symbol.cpp
@@ -81,12 +81,9 @@ static Symbol *lookup(const Common::String &s, const SymbolMap &symlist) {
/* install some symbol s in a symbol table */
static Symbol *install(const Common::String &n, int t, int d, const char *s, Common::Rect *r, SymbolMap *symlist) {
- Common::String *name = new Common::String(n);
-
Symbol *sp;
-
sp = (Symbol *)malloc(sizeof(Symbol));
- sp->name = name;
+ sp->name = new Common::String(n);
sp->type = t;
if (t == NUM) {
sp->u.val = d;
Commit: c871c1e36b5a4648740a2b063e6f4e1e7ff847bd
https://github.com/scummvm/scummvm/commit/c871c1e36b5a4648740a2b063e6f4e1e7ff847bd
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2021-06-22T10:10:53+02:00
Commit Message:
PRIVATE: added a debug print to show the decompiled code
Changed paths:
engines/private/private.cpp
diff --git a/engines/private/private.cpp b/engines/private/private.cpp
index 1314d79245..2b4da3ad9c 100644
--- a/engines/private/private.cpp
+++ b/engines/private/private.cpp
@@ -173,7 +173,7 @@ Common::Error PrivateEngine::run() {
free(buf);
buf = (char *)decomp.getResult().c_str();
- //debug("%s", buf);
+ debugC(1, kPrivateDebugCode, "code:\n%s", buf);
// Initialize stuff
Gen::g_vm = new Gen::VM();
Commit: 0458421ec44dd28f858370eb36b05a8cd57f0871
https://github.com/scummvm/scummvm/commit/0458421ec44dd28f858370eb36b05a8cd57f0871
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2021-06-22T10:10:53+02:00
Commit Message:
PRIVATE: added a new line at the end of the decompiler sources
Changed paths:
engines/private/decompiler.cpp
engines/private/decompiler.h
diff --git a/engines/private/decompiler.cpp b/engines/private/decompiler.cpp
index c0d3dedee3..20bca48fee 100644
--- a/engines/private/decompiler.cpp
+++ b/engines/private/decompiler.cpp
@@ -88,4 +88,4 @@ Common::String Decompiler::getResult() const {
return _result;
}
-} // namespace Private
\ No newline at end of file
+} // namespace Private
diff --git a/engines/private/decompiler.h b/engines/private/decompiler.h
index 427b82d11f..db9b32f05f 100644
--- a/engines/private/decompiler.h
+++ b/engines/private/decompiler.h
@@ -131,4 +131,4 @@ private:
} // namespace Private
-#endif
\ No newline at end of file
+#endif
Commit: 4edbd5a1aa7777c4b861476ec3939cf180c05065
https://github.com/scummvm/scummvm/commit/4edbd5a1aa7777c4b861476ec3939cf180c05065
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2021-06-22T10:10:53+02:00
Commit Message:
PRIVATE: removed commented debug statement in SettingMaps::load
Changed paths:
engines/private/code.cpp
diff --git a/engines/private/code.cpp b/engines/private/code.cpp
index 8dd8c43074..0026f11c6e 100644
--- a/engines/private/code.cpp
+++ b/engines/private/code.cpp
@@ -82,7 +82,6 @@ void SettingMaps::save(const char *name) {
}
void SettingMaps::load(const Common::String &name) {
- //debug("loading: %s", name.c_str());
assert(_map.contains(name));
_setting = _map.getVal(name);
Commit: 9f2fdc87750c5e88944b05272b690c2874550127
https://github.com/scummvm/scummvm/commit/9f2fdc87750c5e88944b05272b690c2874550127
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2021-06-22T10:10:53+02:00
Commit Message:
PRIVATE: moved constants from decompiler.h to decompiler.cpp to avoid duplicated symbols
Changed paths:
engines/private/decompiler.cpp
engines/private/decompiler.h
diff --git a/engines/private/decompiler.cpp b/engines/private/decompiler.cpp
index 20bca48fee..988e968815 100644
--- a/engines/private/decompiler.cpp
+++ b/engines/private/decompiler.cpp
@@ -28,6 +28,95 @@ namespace Private {
const char *kHeader = "Precompiled Game Matrix";
const uint kHeaderSize = 23;
+const byte kCodeString = 0x01;
+const byte kCodeShortLiteral = 0x02;
+const byte kCodeBraceClose = 0x04;
+const byte kCodeRect = 0x2e;
+const byte kCodeRects = 0x4f;
+const byte kCodeShortId = 0x50;
+
+const static char *kCodeTable[] = {"", //
+ "", // 0x01 (string)
+ "", // 0x02 (short literal)
+ " {\n", // 0x03
+ "}\n", // 0x04
+ "(", // 0x05
+ ")", // 0x06
+ "", //
+ "", //
+ "", //
+ ",", // 0x0a
+ "", //
+ "%", // 0x0c
+ "", //
+ ";\n", // 0x0e
+ "!", // 0x0f
+ "-", // 0x10
+ "+", // 0x11
+ "=", // 0x12
+ ">", // 0x13
+ "<", // 0x14
+ "if ", // 0x15
+ "else ", // 0x16
+ "Exit", // 0x17
+ "goto ", // 0x18
+ "Mask", // 0x19
+ "MaskDrawn", // 0x1a
+ "Movie", // 0x1b
+ "Transition", // 0x1c
+ "ThumbnailMovie", // 0x1d
+ "BustMovie", // 0x1e
+ "ViewScreen", // 0x1f
+ "VSPicture", // 0x20
+ "Bitmap", // 0x21
+ "Timer", // 0x22
+ "SoundArea", // 0x23
+ "Sound", // 0x24
+ "SoundEffect", // 0x25
+ "SyncSound", // 0x26
+ "LoopedSound", // 0x27
+ "NoStopSounds", // 0x28
+ "Resume", // 0x29
+ "Inventory", // 0x2a
+ "SetFlag", // 0x2b
+ "ChgMode", // 0x2c
+ "PoliceBust", // 0x2d
+ "CRect", // 0x2e overridden with "RECT" if in "define rects" block
+ "", //
+ "Random", // 0x30
+ "SafeDigit", // 0x31
+ "LoseInventory", // 0x32
+ "", //
+ "PaperShuffleSound", // 0x34
+ "Quit", // 0x35
+ "DossierAdd", // 0x36
+ "DossierBitmap", // 0x37
+ "DossierPrevSuspect", // 0x38
+ "DossierNextSuspect", // 0x39
+ "DossierChgSheet", // 0x3a
+ "DiaryLocList", // 0x3b
+ "DiaryPage", // 0x3c
+ "DiaryInvList", // 0x3d
+ "DiaryPageTurn", // 0x3e
+ "DiaryGoLoc", // 0x3f
+ "SaveGame", // 0x40
+ "LoadGame", // 0x41
+ "RestartGame", // 0x42
+ "AskSave", // 0x43
+ "SetModifiedFlag", // 0x44
+ "PhoneClip", // 0x45
+ "PoliceClip", // 0x46
+ "AMRadioClip", // 0x47
+ "\nsetting ", // 0x48
+ "debug ", // 0x49
+ "\ndefine ", // 0x4a
+ "", //
+ "variables", // 0x4c
+ "", //
+ "", //
+ "rects", // 0x4f
+ ""}; // 0x50 (short id)
+
Decompiler::Decompiler(char *buf, uint32 fileSize, bool mac) {
Common::Array<byte> array;
diff --git a/engines/private/decompiler.h b/engines/private/decompiler.h
index db9b32f05f..b732dc384e 100644
--- a/engines/private/decompiler.h
+++ b/engines/private/decompiler.h
@@ -30,95 +30,6 @@
namespace Private {
-const byte kCodeString = 0x01;
-const byte kCodeShortLiteral = 0x02;
-const byte kCodeBraceClose = 0x04;
-const byte kCodeRect = 0x2e;
-const byte kCodeRects = 0x4f;
-const byte kCodeShortId = 0x50;
-
-const static char *kCodeTable[] = {"", //
- "", // 0x01 (string)
- "", // 0x02 (short literal)
- " {\n", // 0x03
- "}\n", // 0x04
- "(", // 0x05
- ")", // 0x06
- "", //
- "", //
- "", //
- ",", // 0x0a
- "", //
- "%", // 0x0c
- "", //
- ";\n", // 0x0e
- "!", // 0x0f
- "-", // 0x10
- "+", // 0x11
- "=", // 0x12
- ">", // 0x13
- "<", // 0x14
- "if ", // 0x15
- "else ", // 0x16
- "Exit", // 0x17
- "goto ", // 0x18
- "Mask", // 0x19
- "MaskDrawn", // 0x1a
- "Movie", // 0x1b
- "Transition", // 0x1c
- "ThumbnailMovie", // 0x1d
- "BustMovie", // 0x1e
- "ViewScreen", // 0x1f
- "VSPicture", // 0x20
- "Bitmap", // 0x21
- "Timer", // 0x22
- "SoundArea", // 0x23
- "Sound", // 0x24
- "SoundEffect", // 0x25
- "SyncSound", // 0x26
- "LoopedSound", // 0x27
- "NoStopSounds", // 0x28
- "Resume", // 0x29
- "Inventory", // 0x2a
- "SetFlag", // 0x2b
- "ChgMode", // 0x2c
- "PoliceBust", // 0x2d
- "CRect", // 0x2e overridden with "RECT" if in "define rects" block
- "", //
- "Random", // 0x30
- "SafeDigit", // 0x31
- "LoseInventory", // 0x32
- "", //
- "PaperShuffleSound", // 0x34
- "Quit", // 0x35
- "DossierAdd", // 0x36
- "DossierBitmap", // 0x37
- "DossierPrevSuspect", // 0x38
- "DossierNextSuspect", // 0x39
- "DossierChgSheet", // 0x3a
- "DiaryLocList", // 0x3b
- "DiaryPage", // 0x3c
- "DiaryInvList", // 0x3d
- "DiaryPageTurn", // 0x3e
- "DiaryGoLoc", // 0x3f
- "SaveGame", // 0x40
- "LoadGame", // 0x41
- "RestartGame", // 0x42
- "AskSave", // 0x43
- "SetModifiedFlag", // 0x44
- "PhoneClip", // 0x45
- "PoliceClip", // 0x46
- "AMRadioClip", // 0x47
- "\nsetting ", // 0x48
- "debug ", // 0x49
- "\ndefine ", // 0x4a
- "", //
- "variables", // 0x4c
- "", //
- "", //
- "rects", // 0x4f
- ""}; // 0x50 (short id)
-
class Decompiler {
public:
Decompiler(char *buf, uint32 fileSize, bool mac = false);
Commit: ef997be59154cba213240509255ec36ccda8129e
https://github.com/scummvm/scummvm/commit/ef997be59154cba213240509255ec36ccda8129e
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2021-06-22T10:10:53+02:00
Commit Message:
PRIVATE: removed extra whitespace in detection entry
Changed paths:
engines/private/detection.cpp
diff --git a/engines/private/detection.cpp b/engines/private/detection.cpp
index e146ec45f0..cdab455439 100644
--- a/engines/private/detection.cpp
+++ b/engines/private/detection.cpp
@@ -67,7 +67,7 @@ static const ADGameDescription gameDescriptions[] = {
Common::kPlatformWindows,
ADGF_UNSTABLE,
GUIO1(GUIO_NOMIDI)
- },
+ },
{
"private-eye", // Demo from the EU release
"Demo",
Commit: b3349c6a380c95a6a1c52bd7e0dbd98e89df17ce
https://github.com/scummvm/scummvm/commit/b3349c6a380c95a6a1c52bd7e0dbd98e89df17ce
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2021-06-22T10:10:53+02:00
Commit Message:
PRIVATE: removed duplicated and commented detection entries
Changed paths:
engines/private/detection.cpp
diff --git a/engines/private/detection.cpp b/engines/private/detection.cpp
index cdab455439..aaef280639 100644
--- a/engines/private/detection.cpp
+++ b/engines/private/detection.cpp
@@ -128,16 +128,6 @@ static const ADGameDescription gameDescriptions[] = {
ADGF_UNSTABLE,
GUIO1(GUIO_NOMIDI)
},
- {
- "private-eye", // EU release (DE)
- "It uses different file format for the assest",
- AD_ENTRY2s("pvteye.ex_", "5ca171c4e8d804c7277887277d049f03", 600576,
- "bklynlgo.bmp", "1dfb703349a46f8ec183de107992b7f5", 33118),
- Common::DE_DEU,
- Common::kPlatformWindows,
- ADGF_UNSUPPORTED,
- GUIO1(GUIO_NOMIDI)
- },
{
"private-eye", // EU release (DE)
0,
@@ -158,19 +148,6 @@ static const ADGameDescription gameDescriptions[] = {
ADGF_DEMO | ADGF_UNSTABLE,
GUIO1(GUIO_NOMIDI)
},
-
-
- /*
- {
- "private-eye", // Demo from the EU release
- "Demo",
- AD_ENTRY1s("PVTEYE.Z", "", 0),
- Common::EN_GRB,
- Common::kPlatformWindows,
- ADGF_DEMO | ADGF_UNSUPPORTED,
- GUIO1(GUIO_NOMIDI)
- },
- */
AD_TABLE_END_MARKER
};
} // End of namespace Private
Commit: 37380da875cc98fa36fd536613813a466246ae4c
https://github.com/scummvm/scummvm/commit/37380da875cc98fa36fd536613813a466246ae4c
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2021-06-22T10:10:53+02:00
Commit Message:
PRIVATE: removed unnecessary Common::SeekableReadStream cast
Changed paths:
engines/private/private.cpp
diff --git a/engines/private/private.cpp b/engines/private/private.cpp
index 2b4da3ad9c..9d8c578103 100644
--- a/engines/private/private.cpp
+++ b/engines/private/private.cpp
@@ -127,9 +127,9 @@ Common::SeekableReadStream *PrivateEngine::loadAssets() {
Common::SeekableReadStream *file = NULL;
if (isDemo() && test->open("SUPPORT/ASSETS/DEMOGAME.WIN"))
- file = (Common::SeekableReadStream *)test;
+ file = test;
else if (test->open("SUPPORT/ASSETS/GAME.WIN")) {
- file = (Common::SeekableReadStream *)test;
+ file = test;
} else {
delete test;
assert(_installerArchive.open("SUPPORT/ASSETS.Z"));
Commit: 839707f2233e00d3c62f3020bccf494bd1e8e9ee
https://github.com/scummvm/scummvm/commit/839707f2233e00d3c62f3020bccf494bd1e8e9ee
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2021-06-22T10:10:53+02:00
Commit Message:
PRIVATE: basic support for the uncompressed/installed MacOS release
Changed paths:
engines/private/detection.cpp
engines/private/private.cpp
engines/private/private.h
diff --git a/engines/private/detection.cpp b/engines/private/detection.cpp
index aaef280639..34a8ccde92 100644
--- a/engines/private/detection.cpp
+++ b/engines/private/detection.cpp
@@ -148,6 +148,16 @@ static const ADGameDescription gameDescriptions[] = {
ADGF_DEMO | ADGF_UNSTABLE,
GUIO1(GUIO_NOMIDI)
},
+ {
+ "private-eye", // MacOS release (US)
+ 0,
+ AD_ENTRY1s("Private Eye Demo Installer", "e7665ddc5e6d932c4a65598ecc4ec7d2", 1626393),
+ Common::EN_USA,
+ Common::kPlatformMacintosh,
+ ADGF_UNSTABLE,
+ GUIO1(GUIO_NOMIDI)
+ },
+
AD_TABLE_END_MARKER
};
} // End of namespace Private
diff --git a/engines/private/private.cpp b/engines/private/private.cpp
index 9d8c578103..af3b1a3b9d 100644
--- a/engines/private/private.cpp
+++ b/engines/private/private.cpp
@@ -130,6 +130,8 @@ Common::SeekableReadStream *PrivateEngine::loadAssets() {
file = test;
else if (test->open("SUPPORT/ASSETS/GAME.WIN")) {
file = test;
+ } else if (test->open("SUPPORT/GAME.MAC")) {
+ file = test;
} else {
delete test;
assert(_installerArchive.open("SUPPORT/ASSETS.Z"));
@@ -162,6 +164,9 @@ Common::SeekableReadStream *PrivateEngine::loadAssets() {
Common::Error PrivateEngine::run() {
+ _language = Common::parseLanguage(ConfMan.get("language"));
+ _platform = Common::parsePlatform(ConfMan.get("platform"));
+
Common::SeekableReadStream *file = loadAssets();
// Read assets file
const uint32 fileSize = file->size();
@@ -169,7 +174,7 @@ Common::Error PrivateEngine::run() {
file->read(buf, fileSize);
buf[fileSize] = '\0';
- Decompiler decomp(buf, fileSize, false);
+ Decompiler decomp(buf, fileSize, _platform == Common::kPlatformMacintosh);
free(buf);
buf = (char *)decomp.getResult().c_str();
@@ -206,7 +211,6 @@ Common::Error PrivateEngine::run() {
Common::Event event;
Common::Point mousePos;
_videoDecoder = nullptr;
- _language = Common::parseLanguage(ConfMan.get("language"));
int saveSlot = ConfMan.getInt("save_slot");
if (saveSlot >= 0) { // load the savegame
loadGameState(saveSlot);
@@ -495,28 +499,28 @@ bool PrivateEngine::cursorPauseMovie(Common::Point mousePos) {
}
Common::String PrivateEngine::getPauseMovieSetting() {
- if (_language == Common::EN_USA)
+ if (_language == Common::EN_USA && _platform != Common::kPlatformMacintosh)
return "kPauseMovie";
return "k3";
}
Common::String PrivateEngine::getGoIntroSetting() {
- if (_language == Common::EN_USA)
+ if (_language == Common::EN_USA && _platform != Common::kPlatformMacintosh)
return "kGoIntro";
return "k1";
}
Common::String PrivateEngine::getAlternateGameVariable() {
- if (_language == Common::EN_USA)
+ if (_language == Common::EN_USA && _platform != Common::kPlatformMacintosh)
return "kAlternateGame";
return "k2";
}
Common::String PrivateEngine::getMainDesktopSetting() {
- if (_language == Common::EN_USA)
+ if (_language == Common::EN_USA && _platform != Common::kPlatformMacintosh)
return "kMainDesktop";
if (isDemo())
@@ -526,35 +530,35 @@ Common::String PrivateEngine::getMainDesktopSetting() {
}
Common::String PrivateEngine::getPoliceIndexVariable() {
- if (_language == Common::EN_USA)
+ if (_language == Common::EN_USA && _platform != Common::kPlatformMacintosh)
return "kPoliceIndex";
return "k0";
}
Common::String PrivateEngine::getPOGoBustMovieSetting() {
- if (_language == Common::EN_USA)
+ if (_language == Common::EN_USA && _platform != Common::kPlatformMacintosh)
return "kPOGoBustMovie";
return "k7";
}
Common::String PrivateEngine::getPoliceBustFromMOSetting() {
- if (_language == Common::EN_USA)
+ if (_language == Common::EN_USA && _platform != Common::kPlatformMacintosh)
return "kPoliceBustFromMO";
return "k6";
}
Common::String PrivateEngine::getExitCursor() {
- if (_language == Common::EN_USA)
+ if (_language == Common::EN_USA && _platform != Common::kPlatformMacintosh)
return "kExit";
return "k5";
}
Common::String PrivateEngine::getInventoryCursor() {
- if (_language == Common::EN_USA)
+ if (_language == Common::EN_USA && _platform != Common::kPlatformMacintosh)
return "kInventory";
return "k7";
diff --git a/engines/private/private.h b/engines/private/private.h
index 953c809f68..f4610fd03b 100644
--- a/engines/private/private.h
+++ b/engines/private/private.h
@@ -146,6 +146,7 @@ public:
const ADGameDescription *_gameDescription;
bool isDemo() const;
Common::Language _language;
+ Common::Platform _platform;
SymbolMaps maps;
Commit: 226ce849b446d89e262f1668f23097bd5fff3ab1
https://github.com/scummvm/scummvm/commit/226ce849b446d89e262f1668f23097bd5fff3ab1
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2021-06-22T10:10:53+02:00
Commit Message:
PRIVATE: improved MacOS release detection to use two files
Changed paths:
engines/private/detection.cpp
diff --git a/engines/private/detection.cpp b/engines/private/detection.cpp
index 34a8ccde92..826401ca7b 100644
--- a/engines/private/detection.cpp
+++ b/engines/private/detection.cpp
@@ -151,7 +151,8 @@ static const ADGameDescription gameDescriptions[] = {
{
"private-eye", // MacOS release (US)
0,
- AD_ENTRY1s("Private Eye Demo Installer", "e7665ddc5e6d932c4a65598ecc4ec7d2", 1626393),
+ AD_ENTRY2s("Private Eye", "9fb532d8276b9b5bb7cabf9450c45ea7", 1558848,
+ "game.mac", "33553cc04813d3f658bbe9d548377878", 81894),
Common::EN_USA,
Common::kPlatformMacintosh,
ADGF_UNSTABLE,
Commit: f97666b4df63ac357330ab9ea5c1b15ad4dc23a2
https://github.com/scummvm/scummvm/commit/f97666b4df63ac357330ab9ea5c1b15ad4dc23a2
Author: Francisco Javier Diéguez Tirado (javi.dieguez at gmail.com)
Date: 2021-06-22T10:10:53+02:00
Commit Message:
PRIVATE: Add initial author in decompiler.cpp and .h
Changed paths:
engines/private/decompiler.cpp
engines/private/decompiler.h
diff --git a/engines/private/decompiler.cpp b/engines/private/decompiler.cpp
index 988e968815..08a6b4ffe7 100644
--- a/engines/private/decompiler.cpp
+++ b/engines/private/decompiler.cpp
@@ -19,7 +19,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
-// Heavily based on code by X
+// Heavily based on code by jdieguez
#include "private/decompiler.h"
diff --git a/engines/private/decompiler.h b/engines/private/decompiler.h
index b732dc384e..af897d9a88 100644
--- a/engines/private/decompiler.h
+++ b/engines/private/decompiler.h
@@ -19,7 +19,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
-// Heavily based on code by X
+// Heavily based on code by jdieguez
#ifndef PRIVATE_DECOMPILER_H
#define PRIVATE_DECOMPILER_H
Commit: 9bec6e271b30f85c519f22c555dce01c56551a32
https://github.com/scummvm/scummvm/commit/9bec6e271b30f85c519f22c555dce01c56551a32
Author: ggrieco-tob (gustavo.grieco at trailofbits.com)
Date: 2021-06-22T10:10:53+02:00
Commit Message:
PRIVATE: added detection of the russian release
Changed paths:
engines/private/detection.cpp
engines/private/private.cpp
diff --git a/engines/private/detection.cpp b/engines/private/detection.cpp
index 826401ca7b..552e70cc3f 100644
--- a/engines/private/detection.cpp
+++ b/engines/private/detection.cpp
@@ -42,7 +42,7 @@ static const ADGameDescription gameDescriptions[] = {
"private-eye", // US release
0,
AD_ENTRY2s("pvteye.z", "b682118cda6a42fa89833cae2b8824bd", 271895,
- "bklynlgo.bmp", "1dfb703349a46f8ec183de107992b7f5", 33118),
+ "intro.smk", "270a1d0a29df122fc3d1d38e655161a7", 7310984),
Common::EN_USA,
Common::kPlatformWindows,
ADGF_TESTING,
@@ -148,6 +148,16 @@ static const ADGameDescription gameDescriptions[] = {
ADGF_DEMO | ADGF_UNSTABLE,
GUIO1(GUIO_NOMIDI)
},
+ {
+ "private-eye", // RU release
+ 0,
+ AD_ENTRY2s("pvteye.z", "b682118cda6a42fa89833cae2b8824bd", 271895,
+ "intro.smk", "61cc13c9e4e2affd574087209df5c4a4", 7241368),
+ Common::RU_RUS,
+ Common::kPlatformWindows,
+ ADGF_TESTING,
+ GUIO1(GUIO_NOMIDI)
+ },
{
"private-eye", // MacOS release (US)
0,
@@ -158,7 +168,6 @@ static const ADGameDescription gameDescriptions[] = {
ADGF_UNSTABLE,
GUIO1(GUIO_NOMIDI)
},
-
AD_TABLE_END_MARKER
};
} // End of namespace Private
diff --git a/engines/private/private.cpp b/engines/private/private.cpp
index af3b1a3b9d..c04149d522 100644
--- a/engines/private/private.cpp
+++ b/engines/private/private.cpp
@@ -499,28 +499,28 @@ bool PrivateEngine::cursorPauseMovie(Common::Point mousePos) {
}
Common::String PrivateEngine::getPauseMovieSetting() {
- if (_language == Common::EN_USA && _platform != Common::kPlatformMacintosh)
+ if ((_language == Common::EN_USA || _language == Common::RU_RUS) && _platform != Common::kPlatformMacintosh)
return "kPauseMovie";
return "k3";
}
Common::String PrivateEngine::getGoIntroSetting() {
- if (_language == Common::EN_USA && _platform != Common::kPlatformMacintosh)
+ if ((_language == Common::EN_USA || _language == Common::RU_RUS) && _platform != Common::kPlatformMacintosh)
return "kGoIntro";
return "k1";
}
Common::String PrivateEngine::getAlternateGameVariable() {
- if (_language == Common::EN_USA && _platform != Common::kPlatformMacintosh)
+ if ((_language == Common::EN_USA || _language == Common::RU_RUS) && _platform != Common::kPlatformMacintosh)
return "kAlternateGame";
return "k2";
}
Common::String PrivateEngine::getMainDesktopSetting() {
- if (_language == Common::EN_USA && _platform != Common::kPlatformMacintosh)
+ if ((_language == Common::EN_USA || _language == Common::RU_RUS) && _platform != Common::kPlatformMacintosh)
return "kMainDesktop";
if (isDemo())
@@ -530,35 +530,35 @@ Common::String PrivateEngine::getMainDesktopSetting() {
}
Common::String PrivateEngine::getPoliceIndexVariable() {
- if (_language == Common::EN_USA && _platform != Common::kPlatformMacintosh)
+ if ((_language == Common::EN_USA || _language == Common::RU_RUS) && _platform != Common::kPlatformMacintosh)
return "kPoliceIndex";
return "k0";
}
Common::String PrivateEngine::getPOGoBustMovieSetting() {
- if (_language == Common::EN_USA && _platform != Common::kPlatformMacintosh)
+ if ((_language == Common::EN_USA || _language == Common::RU_RUS) && _platform != Common::kPlatformMacintosh)
return "kPOGoBustMovie";
return "k7";
}
Common::String PrivateEngine::getPoliceBustFromMOSetting() {
- if (_language == Common::EN_USA && _platform != Common::kPlatformMacintosh)
+ if ((_language == Common::EN_USA || _language == Common::RU_RUS) && _platform != Common::kPlatformMacintosh)
return "kPoliceBustFromMO";
return "k6";
}
Common::String PrivateEngine::getExitCursor() {
- if (_language == Common::EN_USA && _platform != Common::kPlatformMacintosh)
+ if ((_language == Common::EN_USA || _language == Common::RU_RUS) && _platform != Common::kPlatformMacintosh)
return "kExit";
return "k5";
}
Common::String PrivateEngine::getInventoryCursor() {
- if (_language == Common::EN_USA && _platform != Common::kPlatformMacintosh)
+ if ((_language == Common::EN_USA || _language == Common::RU_RUS) && _platform != Common::kPlatformMacintosh)
return "kInventory";
return "k7";
Commit: 139230264e1c9ca311252506f85d28c8d7374b96
https://github.com/scummvm/scummvm/commit/139230264e1c9ca311252506f85d28c8d7374b96
Author: ggrieco-tob (gustavo.grieco at trailofbits.com)
Date: 2021-06-22T10:10:53+02:00
Commit Message:
PRIVATE: added demo and compressed versions of the MacOS release
Changed paths:
A engines/private/POTFILES
engines/private/detection.cpp
engines/private/private.cpp
diff --git a/engines/private/POTFILES b/engines/private/POTFILES
new file mode 100644
index 0000000000..5c3e57518e
--- /dev/null
+++ b/engines/private/POTFILES
@@ -0,0 +1 @@
+engines/private/detection.cpp
diff --git a/engines/private/detection.cpp b/engines/private/detection.cpp
index 552e70cc3f..998733df16 100644
--- a/engines/private/detection.cpp
+++ b/engines/private/detection.cpp
@@ -21,6 +21,7 @@
*/
#include "base/plugins.h"
+#include "common/translation.h"
#include "engines/advancedDetector.h"
#include "private/private.h"
@@ -168,6 +169,34 @@ static const ADGameDescription gameDescriptions[] = {
ADGF_UNSTABLE,
GUIO1(GUIO_NOMIDI)
},
+ {
+ "private-eye", // MacOS release (US) uninstalled
+ _s("Compressed game detected. Please uncompress it as specified in the game description on our Wiki"),
+ AD_ENTRY1s("Private Eye Installer", "02533427ebdf26d5dd12cee8e9f4de4d", 1647309),
+ Common::EN_USA,
+ Common::kPlatformMacintosh,
+ ADGF_UNSUPPORTED,
+ GUIO1(GUIO_NOMIDI)
+ },
+ {
+ "private-eye", // MacOS demo (US)
+ 0,
+ AD_ENTRY2s("Private Eye Demo", "e98bac1e7570c70b0e9443913d10740c", 1556256,
+ "demogame.mac", "cfbceaa8b91f0f53c745db61d1bc9749", 6103),
+ Common::EN_USA,
+ Common::kPlatformMacintosh,
+ ADGF_DEMO,
+ GUIO1(GUIO_NOMIDI)
+ },
+ {
+ "private-eye", // MacOS demo (US) uninstalled
+ _s("Compressed game detected. Please uncompress it as specified in the game description on our Wiki"),
+ AD_ENTRY1s("Private Eye Demo Installer", "e7665ddc5e6d932c4a65598ecc4ec7d2", 1626393),
+ Common::EN_USA,
+ Common::kPlatformMacintosh,
+ ADGF_DEMO | ADGF_UNSUPPORTED,
+ GUIO1(GUIO_NOMIDI)
+ },
AD_TABLE_END_MARKER
};
} // End of namespace Private
diff --git a/engines/private/private.cpp b/engines/private/private.cpp
index c04149d522..a6a008442c 100644
--- a/engines/private/private.cpp
+++ b/engines/private/private.cpp
@@ -128,6 +128,8 @@ Common::SeekableReadStream *PrivateEngine::loadAssets() {
if (isDemo() && test->open("SUPPORT/ASSETS/DEMOGAME.WIN"))
file = test;
+ else if (isDemo() && test->open("SUPPORT/DEMOGAME.MAC"))
+ file = test;
else if (test->open("SUPPORT/ASSETS/GAME.WIN")) {
file = test;
} else if (test->open("SUPPORT/GAME.MAC")) {
Commit: 597a333f773ba651dae0b24362cd63f19ad5f3d1
https://github.com/scummvm/scummvm/commit/597a333f773ba651dae0b24362cd63f19ad5f3d1
Author: ggrieco-tob (gustavo.grieco at trailofbits.com)
Date: 2021-06-22T10:10:53+02:00
Commit Message:
PRIVATE: avoid invalid detection of MacOS release
Changed paths:
engines/private/detection.cpp
diff --git a/engines/private/detection.cpp b/engines/private/detection.cpp
index 998733df16..2e52d4bd63 100644
--- a/engines/private/detection.cpp
+++ b/engines/private/detection.cpp
@@ -162,8 +162,8 @@ static const ADGameDescription gameDescriptions[] = {
{
"private-eye", // MacOS release (US)
0,
- AD_ENTRY2s("Private Eye", "9fb532d8276b9b5bb7cabf9450c45ea7", 1558848,
- "game.mac", "33553cc04813d3f658bbe9d548377878", 81894),
+ AD_ENTRY2s("game.mac", "33553cc04813d3f658bbe9d548377878", 81894,
+ "bklynlgo.bmp", "1dfb703349a46f8ec183de107992b7f5", 33118),
Common::EN_USA,
Common::kPlatformMacintosh,
ADGF_UNSTABLE,
@@ -181,8 +181,8 @@ static const ADGameDescription gameDescriptions[] = {
{
"private-eye", // MacOS demo (US)
0,
- AD_ENTRY2s("Private Eye Demo", "e98bac1e7570c70b0e9443913d10740c", 1556256,
- "demogame.mac", "cfbceaa8b91f0f53c745db61d1bc9749", 6103),
+ AD_ENTRY2s("demogame.mac", "cfbceaa8b91f0f53c745db61d1bc9749", 6103,
+ "bklynlgo.bmp", "1dfb703349a46f8ec183de107992b7f5", 33118),
Common::EN_USA,
Common::kPlatformMacintosh,
ADGF_DEMO,
More information about the Scummvm-git-logs
mailing list