Skip to content

Commit bdda344

Browse files
committed
ADL: Add support for an early hires1 version
1 parent a063184 commit bdda344

File tree

9 files changed

+145
-72
lines changed

9 files changed

+145
-72
lines changed

engines/adl/adl.cpp

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,6 @@ AdlEngine::AdlEngine(OSystem *syst, const AdlGameDescription *gd) :
7474
DebugMan.addDebugChannel(kDebugChannelScript, "Script", "Trace script execution");
7575
}
7676

77-
Common::String AdlEngine::getDiskImageName(byte volume) const {
78-
return Adl::getDiskImageName(_gameDescription->desc, volume);
79-
}
80-
8177
bool AdlEngine::pollEvent(Common::Event &event) const {
8278
_console->onFrame();
8379

@@ -256,15 +252,15 @@ void AdlEngine::loadWords(Common::ReadStream &stream, WordMap &map, Common::Stri
256252
break;
257253

258254
// WORKAROUND: Missing verb list terminator in hires3
259-
if (_gameDescription->gameType == GAME_TYPE_HIRES3 && index == 72 && synonyms == 0)
255+
if (getGameType() == GAME_TYPE_HIRES3 && index == 72 && synonyms == 0)
260256
return;
261257

262258
// WORKAROUND: Missing noun list terminator in hires3
263-
if (_gameDescription->gameType == GAME_TYPE_HIRES3 && index == 113)
259+
if (getGameType() == GAME_TYPE_HIRES3 && index == 113)
264260
return;
265261

266262
// WORKAROUND: Missing noun list terminator in hires5 region 15
267-
if (_gameDescription->gameType == GAME_TYPE_HIRES5 && _state.region == 15 && index == 81)
263+
if (getGameType() == GAME_TYPE_HIRES5 && _state.region == 15 && index == 81)
268264
return;
269265

270266
for (uint i = 0; i < synonyms; ++i) {

engines/adl/adl.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
#include "adl/console.h"
4141
#include "adl/disk.h"
4242
#include "adl/sound.h"
43+
#include "adl/detection.h"
4344

4445
namespace Common {
4546
class ReadStream;
@@ -241,7 +242,9 @@ friend class Console;
241242
Common::Error saveGameState(int slot, const Common::String &desc);
242243
bool canSaveGameStateCurrently();
243244

244-
Common::String getDiskImageName(byte volume) const;
245+
Common::String getDiskImageName(byte volume) const { return Adl::getDiskImageName(*_gameDescription, volume); }
246+
GameType getGameType() const { return Adl::getGameType(*_gameDescription); }
247+
GameVersion getGameVersion() const { return Adl::getGameVersion(*_gameDescription); }
245248
virtual void gameLoop();
246249
virtual void loadState(Common::ReadStream &stream);
247250
virtual void saveState(Common::WriteStream &stream);

engines/adl/detection.cpp

Lines changed: 72 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,30 @@ static const PlainGameDescriptor adlGames[] = {
8787
{ 0, 0 }
8888
};
8989

90+
struct AdlGameDescription {
91+
ADGameDescription desc;
92+
GameType gameType;
93+
GameVersion version;
94+
};
95+
9096
static const AdlGameDescription gameFileDescriptions[] = {
91-
{ // Hi-Res Adventure #1: Mystery House - Apple II - 1987 PD release
97+
{ // Hi-Res Adventure #1: Mystery House - Apple II - 2nd release
98+
{
99+
"hires1", 0,
100+
{
101+
{ "ADVENTURE", 0, "22d9e63a11d69fa033ba1738715ad09a", 29952 },
102+
{ "AUTO LOAD OBJ", 0, "f6a6ac60c04c6ba6dff68b92cc279ba2", 12291 },
103+
AD_LISTEND
104+
},
105+
Common::EN_ANY,
106+
Common::kPlatformApple2,
107+
ADGF_NO_FLAGS,
108+
GUIO2(GAMEOPTION_COLOR_DEFAULT_OFF, GAMEOPTION_SCANLINES)
109+
},
110+
GAME_TYPE_HIRES1,
111+
GAME_VER_HR1_COARSE
112+
},
113+
{ // Hi-Res Adventure #1: Mystery House - Apple II - Roberta Williams Anthology
92114
{
93115
"hires1", 0,
94116
{
@@ -102,9 +124,10 @@ static const AdlGameDescription gameFileDescriptions[] = {
102124
ADGF_NO_FLAGS,
103125
GUIO2(GAMEOPTION_COLOR_DEFAULT_OFF, GAMEOPTION_SCANLINES)
104126
},
105-
GAME_TYPE_HIRES1
127+
GAME_TYPE_HIRES1,
128+
GAME_VER_HR1_PD
106129
},
107-
{ AD_TABLE_END_MARKER, GAME_TYPE_NONE }
130+
{ AD_TABLE_END_MARKER, GAME_TYPE_NONE, GAME_VER_NONE }
108131
};
109132

110133
static const AdlGameDescription gameDiskDescriptions[] = {
@@ -120,7 +143,23 @@ static const AdlGameDescription gameDiskDescriptions[] = {
120143
ADGF_NO_FLAGS,
121144
GUIO2(GAMEOPTION_COLOR_DEFAULT_OFF, GAMEOPTION_SCANLINES)
122145
},
123-
GAME_TYPE_HIRES1
146+
GAME_TYPE_HIRES1,
147+
GAME_VER_HR1_PD
148+
},
149+
{ // Hi-Res Adventure #1: Mystery House - Apple II - 2nd release
150+
{
151+
"hires1", 0,
152+
{
153+
{ "mysthous", 0, "8df0b3b3e609a2e40237e2419c1cb767", 116480 },
154+
AD_LISTEND
155+
},
156+
Common::EN_ANY,
157+
Common::kPlatformApple2,
158+
ADGF_NO_FLAGS,
159+
GUIO2(GAMEOPTION_COLOR_DEFAULT_OFF, GAMEOPTION_SCANLINES)
160+
},
161+
GAME_TYPE_HIRES1,
162+
GAME_VER_HR1_COARSE
124163
},
125164
{ // Hi-Res Adventure #2: Wizard and the Princess - Apple II - Roberta Williams Anthology
126165
{
@@ -134,7 +173,8 @@ static const AdlGameDescription gameDiskDescriptions[] = {
134173
ADGF_NO_FLAGS,
135174
GUIO2(GAMEOPTION_COLOR_DEFAULT_ON, GAMEOPTION_SCANLINES)
136175
},
137-
GAME_TYPE_HIRES2
176+
GAME_TYPE_HIRES2,
177+
GAME_VER_NONE
138178
},
139179
{ // Hi-Res Adventure #0: Mission Asteroid - Apple II - Roberta Williams Anthology
140180
{
@@ -148,7 +188,8 @@ static const AdlGameDescription gameDiskDescriptions[] = {
148188
ADGF_NO_FLAGS,
149189
GUIO2(GAMEOPTION_COLOR_DEFAULT_ON, GAMEOPTION_SCANLINES)
150190
},
151-
GAME_TYPE_HIRES0
191+
GAME_TYPE_HIRES0,
192+
GAME_VER_NONE
152193
},
153194
{ // Hi-Res Adventure #3: Cranston Manor - Apple II
154195
{
@@ -162,7 +203,8 @@ static const AdlGameDescription gameDiskDescriptions[] = {
162203
ADGF_NO_FLAGS,
163204
GUIO2(GAMEOPTION_COLOR_DEFAULT_ON, GAMEOPTION_SCANLINES)
164205
},
165-
GAME_TYPE_HIRES3
206+
GAME_TYPE_HIRES3,
207+
GAME_VER_NONE
166208
},
167209
{ // Hi-Res Adventure #4: Ulysses and the Golden Fleece - Apple II - Load 'N' Go
168210
{
@@ -177,7 +219,8 @@ static const AdlGameDescription gameDiskDescriptions[] = {
177219
ADGF_NO_FLAGS,
178220
GUIO2(GAMEOPTION_COLOR_DEFAULT_ON, GAMEOPTION_SCANLINES)
179221
},
180-
GAME_TYPE_HIRES4
222+
GAME_TYPE_HIRES4,
223+
GAME_VER_NONE
181224
},
182225
{ // Hi-Res Adventure #4: Ulysses and the Golden Fleece - Atari 8-bit - Re-release
183226
{
@@ -194,7 +237,8 @@ static const AdlGameDescription gameDiskDescriptions[] = {
194237
ADGF_UNSTABLE,
195238
GUIO2(GAMEOPTION_COLOR_DEFAULT_ON, GAMEOPTION_SCANLINES)
196239
},
197-
GAME_TYPE_HIRES4
240+
GAME_TYPE_HIRES4,
241+
GAME_VER_NONE
198242
},
199243
{ // Hi-Res Adventure #5: Time Zone - Apple II - Version 1.1 - Roberta Williams Anthology
200244
{
@@ -219,7 +263,8 @@ static const AdlGameDescription gameDiskDescriptions[] = {
219263
ADGF_NO_FLAGS,
220264
GUIO2(GAMEOPTION_COLOR_DEFAULT_ON, GAMEOPTION_SCANLINES)
221265
},
222-
GAME_TYPE_HIRES5
266+
GAME_TYPE_HIRES5,
267+
GAME_VER_NONE
223268
},
224269
{ // Hi-Res Adventure #6: The Dark Crystal - Apple II - Roberta Williams Anthology
225270
{
@@ -236,9 +281,10 @@ static const AdlGameDescription gameDiskDescriptions[] = {
236281
ADGF_NO_FLAGS,
237282
GUIO2(GAMEOPTION_COLOR_DEFAULT_ON, GAMEOPTION_SCANLINES)
238283
},
239-
GAME_TYPE_HIRES6
284+
GAME_TYPE_HIRES6,
285+
GAME_VER_NONE
240286
},
241-
{ AD_TABLE_END_MARKER, GAME_TYPE_NONE }
287+
{ AD_TABLE_END_MARKER, GAME_TYPE_NONE, GAME_VER_NONE }
242288
};
243289

244290
struct DiskImageExt {
@@ -392,7 +438,8 @@ void AdlMetaEngine::removeSaveState(const char *target, int slot) const {
392438
g_system->getSavefileManager()->removeSavefile(fileName);
393439
}
394440

395-
Common::String getDiskImageName(const ADGameDescription &desc, byte volume) {
441+
Common::String getDiskImageName(const AdlGameDescription &adlDesc, byte volume) {
442+
const ADGameDescription &desc = adlDesc.desc;
396443
for (uint i = 0; desc.filesDescriptions[i].fileName; ++i) {
397444
const ADGameFileDescription &fDesc = desc.filesDescriptions[i];
398445

@@ -413,6 +460,18 @@ Common::String getDiskImageName(const ADGameDescription &desc, byte volume) {
413460
error("Disk volume %d not found", volume);
414461
}
415462

463+
GameType getGameType(const AdlGameDescription &adlDesc) {
464+
return adlDesc.gameType;
465+
}
466+
467+
GameVersion getGameVersion(const AdlGameDescription &adlDesc) {
468+
return adlDesc.version;
469+
}
470+
471+
Common::Platform getPlatform(const AdlGameDescription &adlDesc) {
472+
return adlDesc.desc.platform;
473+
}
474+
416475
bool AdlMetaEngine::addFileProps(const FileMap &allFiles, Common::String fname, ADFilePropertiesMap &filePropsMap) const {
417476
if (filePropsMap.contains(fname))
418477
return true;

engines/adl/detection.h

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@
2323
#ifndef ADL_DETECTION_H
2424
#define ADL_DETECTION_H
2525

26-
#include "engines/advancedDetector.h"
27-
2826
namespace Adl {
2927

3028
#define SAVEGAME_VERSION 0
@@ -41,12 +39,19 @@ enum GameType {
4139
GAME_TYPE_HIRES6
4240
};
4341

44-
struct AdlGameDescription {
45-
ADGameDescription desc;
46-
GameType gameType;
42+
enum GameVersion {
43+
GAME_VER_NONE = 0,
44+
GAME_VER_HR1_SIMI = 0, // On-Line Systems (Simi Valley)
45+
GAME_VER_HR1_COARSE, // On-Line Systems (Coarsegold)
46+
GAME_VER_HR1_PD // Sierra On-Line PD release
4747
};
4848

49-
Common::String getDiskImageName(const ADGameDescription &desc, byte volume);
49+
struct AdlGameDescription;
50+
51+
Common::String getDiskImageName(const AdlGameDescription &adlDesc, byte volume);
52+
GameType getGameType(const AdlGameDescription &desc);
53+
GameVersion getGameVersion(const AdlGameDescription &desc);
54+
Common::Platform getPlatform(const AdlGameDescription &desc);
5055

5156
} // End of namespace Adl
5257

engines/adl/disk.cpp

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -405,15 +405,15 @@ Common::SeekableReadStream *Files_Plain::createReadStream(const Common::String &
405405
return new Common::SeekableSubReadStream(f, offset, f->size(), DisposeAfterUse::YES);
406406
}
407407

408-
Files_DOS33::~Files_DOS33() {
408+
Files_AppleDOS::~Files_AppleDOS() {
409409
delete _disk;
410410
}
411411

412-
Files_DOS33::Files_DOS33() :
412+
Files_AppleDOS::Files_AppleDOS() :
413413
_disk(nullptr) {
414414
}
415415

416-
void Files_DOS33::readSectorList(TrackSector start, Common::Array<TrackSector> &list) {
416+
void Files_AppleDOS::readSectorList(TrackSector start, Common::Array<TrackSector> &list) {
417417
TrackSector index = start;
418418

419419
while (index.track != 0) {
@@ -445,8 +445,8 @@ void Files_DOS33::readSectorList(TrackSector start, Common::Array<TrackSector> &
445445
}
446446
}
447447

448-
void Files_DOS33::readVTOC() {
449-
Common::ScopedPtr<Common::SeekableReadStream> stream(_disk->createReadStream(0x11, 0x00));
448+
void Files_AppleDOS::readVTOC(uint trackVTOC) {
449+
Common::ScopedPtr<Common::SeekableReadStream> stream(_disk->createReadStream(trackVTOC, 0x00));
450450
stream->readByte();
451451
byte track = stream->readByte();
452452
byte sector = stream->readByte();
@@ -491,11 +491,11 @@ void Files_DOS33::readVTOC() {
491491
}
492492
}
493493

494-
const DataBlockPtr Files_DOS33::getDataBlock(const Common::String &filename, uint offset) const {
494+
const DataBlockPtr Files_AppleDOS::getDataBlock(const Common::String &filename, uint offset) const {
495495
return Common::SharedPtr<Files::DataBlock>(new Files::DataBlock(this, filename, offset));
496496
}
497497

498-
Common::SeekableReadStream *Files_DOS33::createReadStreamText(const TOCEntry &entry) const {
498+
Common::SeekableReadStream *Files_AppleDOS::createReadStreamText(const TOCEntry &entry) const {
499499
byte *buf = (byte *)malloc(entry.sectors.size() * kSectorSize);
500500
byte *p = buf;
501501

@@ -520,7 +520,7 @@ Common::SeekableReadStream *Files_DOS33::createReadStreamText(const TOCEntry &en
520520
return new Common::MemoryReadStream(buf, p - buf, DisposeAfterUse::YES);
521521
}
522522

523-
Common::SeekableReadStream *Files_DOS33::createReadStreamBinary(const TOCEntry &entry) const {
523+
Common::SeekableReadStream *Files_AppleDOS::createReadStreamBinary(const TOCEntry &entry) const {
524524
byte *buf = (byte *)malloc(entry.sectors.size() * kSectorSize);
525525

526526
Common::ScopedPtr<Common::SeekableReadStream> stream(_disk->createReadStream(entry.sectors[0].track, entry.sectors[0].sector));
@@ -553,7 +553,7 @@ Common::SeekableReadStream *Files_DOS33::createReadStreamBinary(const TOCEntry &
553553
return new Common::MemoryReadStream(buf, size, DisposeAfterUse::YES);
554554
}
555555

556-
Common::SeekableReadStream *Files_DOS33::createReadStream(const Common::String &filename, uint offset) const {
556+
Common::SeekableReadStream *Files_AppleDOS::createReadStream(const Common::String &filename, uint offset) const {
557557
if (!_toc.contains(filename))
558558
error("Failed to locate '%s'", filename.c_str());
559559

@@ -576,12 +576,12 @@ Common::SeekableReadStream *Files_DOS33::createReadStream(const Common::String &
576576
return new Common::SeekableSubReadStream(stream, offset, stream->size(), DisposeAfterUse::YES);
577577
}
578578

579-
bool Files_DOS33::open(const Common::String &filename) {
579+
bool Files_AppleDOS::open(const Common::String &filename, uint trackVTOC) {
580580
_disk = new DiskImage();
581581
if (!_disk->open(filename))
582582
return false;
583583

584-
readVTOC();
584+
readVTOC(trackVTOC);
585585
return true;
586586
}
587587

engines/adl/disk.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -128,12 +128,12 @@ class Files_Plain : public Files {
128128
};
129129

130130
// Data in files contained in Apple DOS 3.3 disk image
131-
class Files_DOS33 : public Files {
131+
class Files_AppleDOS : public Files {
132132
public:
133-
Files_DOS33();
134-
~Files_DOS33();
133+
Files_AppleDOS();
134+
~Files_AppleDOS();
135135

136-
bool open(const Common::String &filename);
136+
bool open(const Common::String &filename, uint trackVTOC = 17);
137137
const DataBlockPtr getDataBlock(const Common::String &filename, uint offset = 0) const;
138138
Common::SeekableReadStream *createReadStream(const Common::String &filename, uint offset = 0) const;
139139

@@ -160,7 +160,7 @@ class Files_DOS33 : public Files {
160160
Common::Array<TrackSector> sectors;
161161
};
162162

163-
void readVTOC();
163+
void readVTOC(uint trackVTOC);
164164
void readSectorList(TrackSector start, Common::Array<TrackSector> &list);
165165
Common::SeekableReadStream *createReadStreamText(const TOCEntry &entry) const;
166166
Common::SeekableReadStream *createReadStreamBinary(const TOCEntry &entry) const;

0 commit comments

Comments
 (0)