Skip to content

Commit

Permalink
PRISONER: Added support for GOG version
Browse files Browse the repository at this point in the history
  • Loading branch information
ricardosabino committed Jun 19, 2024
1 parent 6411434 commit 9e430ec
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 5 deletions.
10 changes: 10 additions & 0 deletions engines/prisoner/detection_tables.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,16 @@ const PlainGameDescriptor prisonerGames[] = {
};

const ADGameDescription gameDescriptions[] = {
// Prisoner GOG version
{
"prisoner",
0,
AD_ENTRY1s("a_klang.bin", "f20001d885aee4e6320052a4368bf8cf", 561),
Common::EN_ANY,
Common::kPlatformDOS,
ADGF_NO_FLAGS,
GUIO1(GUIO_NONE)},

// Prisoner English version
{
"prisoner",
Expand Down
11 changes: 9 additions & 2 deletions engines/prisoner/prisoner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ namespace Prisoner {
PrisonerEngine::PrisonerEngine(OSystem *syst, const ADGameDescription *gameDesc) : Engine(syst), _gameDescription(gameDesc) {
const Common::FSNode gameDataDir(ConfMan.getPath("path"));
SearchMan.addSubDirectoryMatching(gameDataDir, "e_video");
SearchMan.addSubDirectoryMatching(gameDataDir, "video");

// Setup mixer
if (!_mixer->isReady()) {
Expand All @@ -79,7 +80,13 @@ PrisonerEngine::~PrisonerEngine() {
Common::Error PrisonerEngine::run() {
initGraphics(640, 480);

_languageChar = 'E';
// TODO: try to find a better way of doing this maybe after implementing loading of other
// languages (which I currently don't have access to)
_languageChar = 'A';
if (Common::File::exists("e_klang.bin")) {
_languageChar = 'E';
}

_currModuleIndex = 2;

_isSaveAllowed = true;
Expand All @@ -88,7 +95,7 @@ Common::Error PrisonerEngine::run() {
_cameraY = 0;

_screen = new Screen(this);
_resLoader = new PrisonerResourceLoader();
_resLoader = new PrisonerResourceLoader(_languageChar);
_res = new ResourceManager(_resLoader);
_scriptOpcodes = new ScriptOpcodes(this);
_scriptOpcodes->setupOpcodes();
Expand Down
8 changes: 6 additions & 2 deletions engines/prisoner/resourcemgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ namespace Prisoner {

/* PrisonerResourceLoader */

PrisonerResourceLoader::PrisonerResourceLoader() {
PrisonerResourceLoader::PrisonerResourceLoader(char languageChar) {

// NOTE: An alternative to hardcoding the data would be to load it from the game Exe
// (The file-based loadDirectory supports this already.)
Expand Down Expand Up @@ -132,7 +132,11 @@ PrisonerResourceLoader::PrisonerResourceLoader() {

addArchive("KSVGA.KRO", kPrisonerKSVGADirectory, kPrisonerKSVGAResourceTypes);
addArchive("KSOUND.KRO", kPrisonerDOSKSOUNDDirectory, kPrisonerKSOUNDResourceTypes);
addArchive("E_KLANG.KRO", "E_KLANG.BIN", 0, true, kPrisonerKLANGResourceTypes);

Common::String kroName = Common::String::format("%c_KLANG.KRO", languageChar);
Common::String binName = Common::String::format("%c_KLANG.BIN", languageChar);

addArchive(kroName.c_str(), binName.c_str(), 0, true, kPrisonerKLANGResourceTypes);

}

Expand Down
2 changes: 1 addition & 1 deletion engines/prisoner/resourcemgr.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class ResourceLoader {

class PrisonerResourceLoader : public ResourceLoader {
public:
PrisonerResourceLoader();
PrisonerResourceLoader(char languageChar);
~PrisonerResourceLoader();
byte *load(Common::String &pakName, int16 pakSlot, int16 type, uint32 &dataSize);
KroArchive *getArchiveForType(int16 type);
Expand Down

0 comments on commit 9e430ec

Please sign in to comment.