mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-13 04:28:37 +00:00
FREESCAPE: read data from Driller Amstrad CPC release directly from a edsk file
This commit is contained in:
parent
cd5dffdce8
commit
b327ebf4eb
@ -63,7 +63,7 @@ static const ADGameDescription gameDescriptions[] = {
|
||||
"driller",
|
||||
"",
|
||||
{
|
||||
{"DRILLER.CPC.EXTRACTED", 0, "4e4b2fa20f96cea9c19ea3940ae76956", 204032},
|
||||
{"DRILLER.CPC.EDSK", 0, "05df84207b5373e145ef90a3e4b98ae0", 215073},
|
||||
AD_LISTEND
|
||||
},
|
||||
Common::EN_ANY,
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include "common/config-manager.h"
|
||||
#include "common/events.h"
|
||||
#include "common/file.h"
|
||||
#include "common/memstream.h"
|
||||
#include "common/random.h"
|
||||
|
||||
#include "freescape/freescape.h"
|
||||
@ -351,6 +352,53 @@ void DrillerEngine::loadAssetsDemo() {
|
||||
_angleRotationIndex = 0;
|
||||
}
|
||||
|
||||
|
||||
Common::SeekableReadStream *parseEDSK(const Common::String filename) {
|
||||
debugC(1, kFreescapeDebugParser, "Trying to parse edsk file: %s", filename.c_str());
|
||||
Common::File file;
|
||||
file.open(filename);
|
||||
if (!file.isOpen())
|
||||
error("Failed to open %s", filename.c_str());
|
||||
|
||||
int size = file.size();
|
||||
byte *edskBuffer = (byte *)malloc(size);
|
||||
file.read(edskBuffer, size);
|
||||
file.close();
|
||||
|
||||
// We don't know the final size, but we allocate enough
|
||||
byte *memBuffer = (byte *)malloc(size);
|
||||
|
||||
byte ntracks = edskBuffer[48] - 2;
|
||||
byte nsides = edskBuffer[49];
|
||||
assert(nsides == 1);
|
||||
int i = 256;
|
||||
int j = 0;
|
||||
while (ntracks > 0) {
|
||||
ntracks--;
|
||||
|
||||
byte ssize = edskBuffer[i + 0x14];
|
||||
int start = i + 0x100;
|
||||
|
||||
if (ssize == 2) {
|
||||
i = i + 9 * 512 + 256;
|
||||
} else if (ssize == 5) {
|
||||
i = i + 8 * 512 + 256;
|
||||
} else if (ssize == 0) {
|
||||
i = i + 0x8400;
|
||||
} else {
|
||||
assert(ntracks == 0);
|
||||
}
|
||||
int osize = i - start;
|
||||
debugC(1, kFreescapeDebugParser, "copying start: %x size: %x", start, osize);
|
||||
memcpy(memBuffer + j, edskBuffer + start, osize);
|
||||
j = j + osize;
|
||||
|
||||
}
|
||||
free(edskBuffer);
|
||||
return (new Common::MemoryReadStream(memBuffer, size));
|
||||
}
|
||||
|
||||
|
||||
void DrillerEngine::loadAssetsFullGame() {
|
||||
Common::File file;
|
||||
if (isAmiga()) {
|
||||
@ -453,17 +501,13 @@ void DrillerEngine::loadAssetsFullGame() {
|
||||
else
|
||||
error("Unknown ZX spectrum variant");
|
||||
} else if (isCPC()) {
|
||||
file.open("driller.cpc.extracted");
|
||||
|
||||
if (!file.isOpen())
|
||||
error("Failed to open driller.cpc.extracted");
|
||||
|
||||
Common::SeekableReadStream *stream = parseEDSK("driller.cpc.edsk");
|
||||
//loadMessagesFixedSize(&file, 0x20e4, 14, 20);
|
||||
|
||||
//loadFonts(&file, 0x62ca);
|
||||
//loadGlobalObjects(&file, 0x1c93);
|
||||
|
||||
load8bitBinary(&file, 0xec76, 4);
|
||||
load8bitBinary(stream, 0xec76, 4);
|
||||
} else if (_renderMode == Common::kRenderEGA) {
|
||||
loadBundledImages();
|
||||
file.open("DRILLE.EXE");
|
||||
|
Loading…
Reference in New Issue
Block a user