From 91146b8d476494842326dc4d45f4b4d83d379c15 Mon Sep 17 00:00:00 2001 From: Toni Wilen Date: Thu, 11 Mar 2021 18:18:16 +0200 Subject: [PATCH] ALG Platoon and Space Pirates ROM descrambling. Implemented LD drive command that Platoon requires. --- arcadia.cpp | 8 ++++++++ rommgr.cpp | 26 ++++++++++++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/arcadia.cpp b/arcadia.cpp index 42387735..f7202528 100644 --- a/arcadia.cpp +++ b/arcadia.cpp @@ -828,6 +828,14 @@ static void sony_serial_read(uae_u16 w) if (log_ld) write_log(_T("LD: INDEX OFF\n")); break; + case 0x56: // CL + ld_mode = LD_MODE_STILL; + ld_direction = 0; + pausevideograb(1); + ack(); + if (log_ld) + write_log(_T("LD: CL\n")); + break; case 0x60: // ADDR INQ '`' { if (isvideograb() && ld_direction == 0) { diff --git a/rommgr.cpp b/rommgr.cpp index 78383d06..b4aa84cf 100644 --- a/rommgr.cpp +++ b/rommgr.cpp @@ -1916,6 +1916,32 @@ struct zfile *read_rom (struct romdata *prd) if (!ok) byteswap(buf, size); } + if (ok) { + if (rd->id == 197) { + // ALG Platoon + uae_u8 *tmp = xmalloc(uae_u8, size); + if (tmp) { + memcpy(tmp, buf, size); + static const int platoon[] = { 0,8,4,12,2,10,6,14,1,9,5,13,3,11,7,15,16,24,20,28,18,26,22,30,17,25,21,29,19,27,23,31 }; + for (int i = 0; i < 32; i++) { + memcpy(buf + i * 0x2000, tmp + platoon[i] * 0x2000, 0x2000); + } + xfree(tmp); + } + } else if (rd->id == 182 || rd->id == 183) { + // ALG Space Pirates + uae_u8 *tmp = xmalloc(uae_u8, size); + if (tmp) { + memcpy(tmp, buf, size); + static const int sp[] = { 33,32,34,35,49,48,50,51,45,44,46,47,61,60,62,63,37,36,38,39,53,52,54,55,41,40,42,43,57,56,58,59, + 33,32,34,35,49,48,50,51,45,44,46,47,61,60,62,63,37,36,38,39,53,52,54,55,41,40,42,43,57,56,58,59 }; + for (int i = 0; i < 64; i++) { + memcpy(buf + i * 0x1000, tmp + sp[i] * 0x1000, 0x1000); + } + xfree(tmp); + } + } + } if (ok) { struct zfile *zf = zfile_fopen_empty (NULL, name, size); if (zf) { -- 2.47.3