-
-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PRIVATE: New engine for Private Eye #2771
Merged
Merged
Changes from all commits
Commits
Show all changes
147 commits
Select commit
Hold shift + click to select a range
be490b9
PRIVATE: private-eye skeleton engine
515d156
PRIVATE: some code to decode videos
1a15db6
PRIVATE: fixed palette
3de3627
PRIVATE: fixes
d8ac303
PRIVATE: improved detection
e3d7ac4
PRIVATE: added flex/bison grammar
cd741f1
PRIVATE: grammar fixes
dd7161d
PRIVATE: removed old grammar code
59c7a61
PRIVATE: new prototype for code generation using hoc
323e6ec
PRIVATE: more code
4f38de8
PRIVATE: moved more files to c++
b3c220a
PRIVATE: fixed linking
d84111f
PRIVATE: use Private namespace
cd08481
PRIVATE: allocate a new stack for every setting
9b38b8e
PRIVATE: code to compare expr
56d12ed
PRIVATE: reorganized lexer and grammar code
fa8d357
PRIVATE: handled all defines
91dda64
PRIVATE: more code
c0b6b6a
PRIVATE: fixes + more functiions
3f79e9f
PRIVATE: some more functions implemented
e0f38c5
PRIVATE: fixed pallete colors with a hack
cd23483
PRIVATE: simplified grammar and added some code for conditional handling
3ba38a1
PRIVATE: more functions and fixes
73c866e
PRIVATE: improved data structures
4cdb0b8
PRIVATE: grammar fixes
1ccbe0a
PRIVATE: some fixes and added debug functions
24625b4
PRIVATE: added some data structure to hold exit information
da385bd
PRIVATE: clean-up
348a073
PRIVATE: used astyle to improve code formatting
6863ad4
PRIVATE: more code
ed24934
PRIVATE: more code
55ae9d9
PRIVATE: remove stuff from the event loop
bdf6ff7
PRIVATE: astyled the code again
7b3e139
PRIVATE: clean-up
863f44b
PRIVATE: implemented original cursors
eb9b6e2
PRIVATE: more stuff
6ada072
PRIVATE: more functions
ab8efcc
PRIVATE: fixed detection from assets without installing
6dedb06
PRIVATE: added lex/bison generated files
c69807b
PRIVATE: astyled the code again
ad1db2b
PRIVATE: clean up and reorganization
ccf72d0
PRIVATE: basic save game support
664fd62
PRIVTE: more fixes
bff2238
PRIVATE: more fixes
4500a00
PRIVATE: more fixes
0ed506d
PRIVATE: adjusted origin point
94a0cdb
PRIVATE: more code
2199851
PRIVATE: phone calls + fixes
7775b64
PRIVATE: improved save/load
a690fbe
PRIVATE: fixes + astyle
2fa96ea
PRIVATE: more astyle
06c1afa
PRIVATE: better detection tables + fixes
a812821
PRIVATE: fixed frame memory leak
06b3749
PRIVATE: more fixes
cf94db5
PRIVATE: started to implement police bust
db34100
PRIVATE: police bust changes
1391a1b
PRIVATE: partial dossier browsing implementation
c2b2211
PRIVATE: new features
6cc5626
PRIVATE: fixes in sounds and memory management
57bf748
PRIVATE: fixes and new stuff
e03889e
PRIVATE: implemented NoStopSounds
d2427b9
PRIVATE: astyle
028c747
PRIVATE: fixes and new stuff
b27b69d
PRIVATE: fixes
3b4f7d3
PRIVATE: more fixes
7bb3c0c
PRIVATE: astyle
97052b9
PRIVATE: fixes
ad5235b
PRIVATE: missing snprinft
62978b2
PRIVATE: added copyright headers
ba5dd8a
PRIVATE: fixes and renamed installer_archive
2c3602f
PRIVATE: optimized use of screen
dd963e8
PRIVATE: fixes
003a205
PRIVATE: fixes
b5d04b4
PRIVATE: removed tabs
076bbff
PRIVATE: fixed code convetions
4223c04
PRIVATE: added proper debug channels and fixed type assertions
a1792e7
PRIVATE: removed old debug code
99f4d30
PRIVATE: explicit conversion to bool
d088344
PRIVATE: clean up grammar.l to remove unused code and imports
683034e
PRIVATE: reorganized bison and yacc files and removed tabs from them
d248318
PRIVATE: change detection tables to use PVTEYE.Z
1550232
PRIVATE: avoid name collisions using a prefix in the lexer and grammar
137bd46
PRIVATE: code convention on type casting
1da6ffe
PRIVATE: code convention on type casting
2506fb1
PRIVATE: avoid global constructors in initCursors
b430445
PRIVATE: code convention on type casting
b3e4f33
PRIVATE: fixed in formating of module.mk
da994a8
PRIVATE: avoid confusion in nested if
08bec7b
PRIVATE: code convention on type casting
f045503
PRIVATE: code convention on function names
d38348d
PRIVATE: removed useless empty lines
948162a
PRIVATE: removed useless empty lines
fd1994c
PRIVATE: arithmetic code refactor
6b4861b
PRIVATE: removed unused variables and refactor
3a7c8c0
PRIVATE: optimize screen drawing
6b47b14
PRIVATE: refactor to avoid global constructors
3fbccd5
PRIVATE: code convention fixes
558f959
PRIVATE: missing line at the end
efaa7e2
PRIVATE: removed old file
418a724
PRIVATE: code convention fixes
12709df
PRIVATE: fixed load game code to avoid leaking memory
7995500
PRIVATE: refactor sound handling to avoid leaking memory
2594e38
PRIVATE: refactor sound handling to avoid leaking memory
9e4c747
PRIVATE: refactor sound handling to avoid leaking memory
3880cba
PRIVATE: removed console
f1760a7
PRIVATE: simplified code
1aac477
PRIVATE: use const string in getRandomPhoneClip
85c5c0e
PRIVATE: refactor _diaryLocPrefix
1571b3c
PRIVATE: refactoring to avoid global constructors
bb39b4b
PRIVATE: refactor string cmp handling to avoid leaking memory
d210fc9
PRIVATE: refactor string cmp handling to avoid leaking memory
ff58407
PRIVATE: missing new line
cb6556e
PRIVATE: refactor mask handling to avoid leaking memory
9eca28f
PRIVATE: refactor headers
1d38768
PRIVATE: refactor headers
78d1b5f
PRIVATE: added makefile rule to build lexer/grammar
5a67755
PRIVATE: correct detection thanks to @sev
5de9d92
PRIVATE: code convention fixes
eae8cd3
PRIVATE: added hoc copyright
faaf9e0
PRIVATE: removed policeVideoIndex
e40c19b
PRIVATE: refactored more strings code
b020cc8
PRIVATE: documented some code
b1613ff
PRIVATE: first step to use classes and avoid external
2020ead
PRIVATE: second step to use classes and avoid external
2c78103
PRIVATE: removed more extern
1ba2d64
PRIVATE: use more classes and avoid external
b9c13bc
PRIVATE: fix memory leaks
c8293a9
PRIVATE: fix memory leaks
112b7bd
PRIVATE: stop all sounds when a game is loaded
ff4d84b
PRIVATE: code convention fixes
c1001f9
PRIVATE: fix memory leaks and added more stuff into the main class
4e2220d
PRIVATE: remove pointers
1710ea9
PRIVATE: remove pointers
b3ad4c3
PRIVATE: remove pointers
7d48545
PRIVATE: remove pointers
d42fe36
PRIVATE: remove more pointers
fcbc635
PRIVATE: fixes
8ba27e4
PRIVATE: remove more pointers
e7d24a9
COMMON: moved include guard to the top
d1a79f5
PRIVATE: removed screen locking
65e27bc
PRIVATE: code convention fixes
ebb80bb
PRIVATE: remove more pointers
4adb596
PRIVATE: class re-organization
1ae19a6
PRIVATE: class re-organization
d8d8ffa
COMMON: renamed include guard in installshieldv3
1b23dc1
PRIVATE: fixes
6a3f966
PRIVATE: added more detection rules
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,136 @@ | ||
/* 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 "common/installshieldv3_archive.h" | ||
|
||
#include "common/dcl.h" | ||
#include "common/debug.h" | ||
|
||
namespace Common { | ||
|
||
InstallShieldV3::InstallShieldV3() : Common::Archive() { | ||
_stream = nullptr; | ||
} | ||
|
||
InstallShieldV3::~InstallShieldV3() { | ||
close(); | ||
} | ||
|
||
bool InstallShieldV3::open(const Common::String &filename) { | ||
close(); | ||
|
||
_stream = SearchMan.createReadStreamForMember(filename); | ||
|
||
if (!_stream) | ||
return false; | ||
|
||
// Check for the magic uint32 | ||
// No idea what it means, but it's how "file" recognizes them | ||
if (_stream->readUint32BE() != 0x135D658C) { | ||
close(); | ||
return false; | ||
} | ||
|
||
// Let's pull some relevant data from the header | ||
_stream->seek(41); | ||
uint32 directoryTableOffset = _stream->readUint32LE(); | ||
/* uint32 directoryTableSize = */ _stream->readUint32LE(); | ||
uint16 directoryCount = _stream->readUint16LE(); | ||
uint32 fileTableOffset = _stream->readUint32LE(); | ||
/* uint32 fileTableSize = */ _stream->readUint32LE(); | ||
|
||
// We need to have at least one directory in order for the archive to be valid | ||
if (directoryCount == 0) { | ||
close(); | ||
return false; | ||
} | ||
|
||
// TODO: Currently, we only support getting files from the first directory | ||
// To that end, get the number of files from that entry | ||
_stream->seek(directoryTableOffset); | ||
uint16 fileCount = _stream->readUint16LE(); | ||
debug(2, "File count = %d", fileCount); | ||
|
||
// Following the directory table is the file table with files stored recursively | ||
// by directory. Since we're only using the first directory, we can just go | ||
// right to that one. | ||
_stream->seek(fileTableOffset); | ||
|
||
for (uint16 i = 0; i < fileCount; i++) { | ||
FileEntry entry; | ||
|
||
_stream->skip(3); // Unknown | ||
|
||
entry.uncompressedSize = _stream->readUint32LE(); | ||
entry.compressedSize = _stream->readUint32LE(); | ||
entry.offset = _stream->readUint32LE(); | ||
|
||
_stream->skip(14); // Unknown | ||
|
||
byte nameLength = _stream->readByte(); | ||
Common::String name; | ||
while (nameLength--) | ||
name += _stream->readByte(); | ||
|
||
_stream->skip(13); // Unknown | ||
|
||
_map[name] = entry; | ||
|
||
debug(3, "Found file '%s' at 0x%08x (Comp: 0x%08x, Uncomp: 0x%08x)", name.c_str(), | ||
entry.offset, entry.compressedSize, entry.uncompressedSize); | ||
} | ||
|
||
return true; | ||
} | ||
|
||
void InstallShieldV3::close() { | ||
delete _stream; _stream = nullptr; | ||
_map.clear(); | ||
} | ||
|
||
bool InstallShieldV3::hasFile(const Common::String &name) const { | ||
return _map.contains(name); | ||
} | ||
|
||
int InstallShieldV3::listMembers(Common::ArchiveMemberList &list) const { | ||
for (FileMap::const_iterator it = _map.begin(); it != _map.end(); it++) | ||
list.push_back(getMember(it->_key)); | ||
|
||
return _map.size(); | ||
} | ||
|
||
const Common::ArchiveMemberPtr InstallShieldV3::getMember(const Common::String &name) const { | ||
return Common::ArchiveMemberPtr(new Common::GenericArchiveMember(name, this)); | ||
} | ||
|
||
Common::SeekableReadStream *InstallShieldV3::createReadStreamForMember(const Common::String &name) const { | ||
if (!_stream || !_map.contains(name)) | ||
return nullptr; | ||
|
||
const FileEntry &entry = _map[name]; | ||
|
||
// Seek to our offset and then send it off to the decompressor | ||
_stream->seek(entry.offset); | ||
return Common::decompressDCL(_stream, entry.compressedSize, entry.uncompressedSize); | ||
} | ||
|
||
} // End of namespace Common |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
/* 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 COMMON_INSTALLSHIELDV3_ARCHIVE_H | ||
#define COMMON_INSTALLSHIELDV3_ARCHIVE_H | ||
|
||
#include "common/archive.h" | ||
#include "common/scummsys.h" | ||
#include "common/endian.h" | ||
#include "common/file.h" | ||
#include "common/hash-str.h" | ||
#include "common/hashmap.h" | ||
#include "common/str.h" | ||
|
||
namespace Common { | ||
|
||
class InstallShieldV3 : public Common::Archive { | ||
public: | ||
InstallShieldV3(); | ||
~InstallShieldV3() override; | ||
|
||
bool open(const Common::String &filename); | ||
void close(); | ||
bool isOpen() const { return _stream != nullptr; } | ||
|
||
// Common::Archive API implementation | ||
bool hasFile(const Common::String &name) const override; | ||
int listMembers(Common::ArchiveMemberList &list) const override; | ||
const Common::ArchiveMemberPtr getMember(const Common::String &name) const override; | ||
Common::SeekableReadStream *createReadStreamForMember(const Common::String &name) const override; | ||
|
||
private: | ||
struct FileEntry { | ||
uint32 uncompressedSize; | ||
uint32 compressedSize; | ||
uint32 offset; | ||
}; | ||
|
||
Common::SeekableReadStream *_stream; | ||
|
||
typedef Common::HashMap<Common::String, FileEntry, Common::IgnoreCase_Hash, Common::IgnoreCase_EqualTo> FileMap; | ||
FileMap _map; | ||
}; | ||
|
||
} // End of namespace Common | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
HashMap::size() return uint, thus, it makes sense to return uint here as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This code was an exact copy from the one in Riven but I will change it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, it seems it overrides a specific class function: