From 97c85a3640644d72f3ae3617311f45e52c781df9 Mon Sep 17 00:00:00 2001 From: Toni Wilen Date: Wed, 19 Jun 2024 18:13:59 +0300 Subject: [PATCH] Support Picmatic Tierras Salvajes and Marbella Vice (100Hz TV) --- arcadia.cpp | 55 +++++++++++++++++++++++++++++++----- od-win32/win32_videograb.cpp | 3 ++ rommgr.cpp | 11 +++++++- 3 files changed, 61 insertions(+), 8 deletions(-) diff --git a/arcadia.cpp b/arcadia.cpp index 0cb75a5f..0bd5c878 100644 --- a/arcadia.cpp +++ b/arcadia.cpp @@ -4,8 +4,9 @@ * Arcadia * American Laser games * Cubo +* Picmatic * -* Copyright 2005-2017 Toni Wilen +* Copyright 2005-2024 Toni Wilen * * */ @@ -609,7 +610,7 @@ static int algmemory_modified; static int algmemory_initialized; static int alg_game_id; static int alg_picmatic_nova; -static uae_u8 picmatic_io; +static uae_u8 picmatic_io, picmatic_ply; static void alg_nvram_write (void) { @@ -650,8 +651,36 @@ static uae_u32 REGPARAM2 alg_wget (uaecptr addr) static uae_u32 REGPARAM2 alg_bget (uaecptr addr) { - if (alg_picmatic_nova == 1 && (addr & 0xffff0000) == 0xf60000) { - return 0; + if ((addr & 0xffff0001) == 0xf60001) { + if (alg_picmatic_nova == 1) { + // Picmatic 100Hz games + int reg = (addr >> 12) & 15; + uae_u8 v = 0; + uae_u16 x = lightpen_x[1 - picmatic_ply]; + uae_u16 y = lightpen_y[1 - picmatic_ply] >> currprefs.gfx_vresolution; + if (reg == 3) { + v = 0xff; + // left trigger + if (alg_flag & 64) + v &= ~0x20; + // right trigger + if (alg_flag & 128) + v &= ~0x10; + // left holster + if (alg_flag & 256) + v &= ~0x80; + // right holster + if (alg_flag & 512) + v &= ~0x40; + } else if (reg == 0) { + v = y & 0xff; + } else if (reg == 1) { + v = x & 0xff; + } else if (reg == 2) { + v = ((x >> 8) << 4) | (y >> 8); + } + return v; + } } uaecptr addr2 = addr; addr >>= 1; @@ -671,9 +700,17 @@ static void REGPARAM2 alg_wput (uaecptr addr, uae_u32 w) static void REGPARAM2 alg_bput (uaecptr addr, uae_u32 b) { if (alg_picmatic_nova == 1 && (addr & 0xffff0000) == 0xf60000) { - if (!(addr & 0xffff)) { + int reg = (addr >> 12) & 15; + if (reg == 0) { picmatic_io = b; + } if (reg == 5) { + // Picmatic 100Hz games + picmatic_ply = 0; + } else if (reg == 6) { + // Picmatic 100Hz games + picmatic_ply = 1; } + //write_log(_T("ALG BPUT %08X %02X %08X\n"), addr, b & 255, M68K_GETPC); return; } uaecptr addr2 = addr; @@ -1483,7 +1520,7 @@ void alg_map_banks(void) algmemory_initialized = 1; } struct romdata *rd = get_alg_rom(currprefs.romextfile); - if (rd->id == 198 || rd->id == 301 || rd->id == 302) { + if (rd->id == 198 || rd->id == 301 || rd->id == 302 || rd->id == 315 || rd->id == 314) { map_banks(&alg_ram_bank, 0xf4, 1, 0); } else if (rd->id == 182 || rd->id == 273 || rd->size < 0x40000) { map_banks(&alg_ram_bank, 0xf5, 1, 0); @@ -1491,7 +1528,7 @@ void alg_map_banks(void) map_banks(&alg_ram_bank, 0xf7, 1, 0); } alg_game_id = rd->id; - alg_picmatic_nova = rd->id == 198 || rd->id == 301 || rd->id == 302 ? 1 : (rd->id == 197 ? 2 : 0); + alg_picmatic_nova = rd->id == 198 || rd->id == 301 || rd->id == 302 || rd->id == 315 || rd->id == 314 ? 1 : (rd->id == 197 ? 2 : 0); if (alg_picmatic_nova == 1) { map_banks(&alg_ram_bank, 0xf6, 1, 0); } @@ -1511,6 +1548,7 @@ void alg_map_banks(void) } } else { picmatic_io = 0; + picmatic_ply = 0; ld_repcnt = -1; ld_mark = -1; ld_audio = 0; @@ -1571,6 +1609,8 @@ uae_u8 *restore_alg(uae_u8 *src) for (int i = 0; i < 32; i++) { ld_uidx_data[i] = restore_u8(); } + picmatic_ply = restore_u8(); + return src; } @@ -1617,6 +1657,7 @@ uae_u8 *save_alg(size_t *len) for (int i = 0; i < 32; i++) { save_u8(ld_uidx_data[i]); } + save_u8(picmatic_ply); *len = dst - dstbak; return dstbak; } diff --git a/od-win32/win32_videograb.cpp b/od-win32/win32_videograb.cpp index ebc96b41..3d42c623 100644 --- a/od-win32/win32_videograb.cpp +++ b/od-win32/win32_videograb.cpp @@ -339,6 +339,9 @@ bool initvideograb(const TCHAR *filename) uae_s64 getdurationvideograb(void) { LONGLONG dura; + if (!mediaSeeking) { + return 0; + } HRESULT hr = mediaSeeking->GetDuration(&dura); if (FAILED(hr)) { return 0; diff --git a/rommgr.cpp b/rommgr.cpp index fa22a3ea..161ae1d1 100644 --- a/rommgr.cpp +++ b/rommgr.cpp @@ -97,7 +97,7 @@ struct romdata *getromdatabypath (const TCHAR *path) return NULL; } -#define NEXT_ROM_ID 314 +#define NEXT_ROM_ID 316 #if NEXT_ROM_ID >= MAX_ROMMGR_ROMS #error Increase MAX_ROMMGR_ROMS! @@ -1026,6 +1026,15 @@ static struct romdata roms[] = { 0xf78c8fa2, 0x07656cbf,0xdb6135f2,0x6add3b5f,0xa4ce5d46,0xdda706f9, NULL, NULL, 10 }, ALTROMPN(302, 1, 1, 65536, ROMTYPE_EVEN | ROMTYPE_8BIT, NULL, 0x01c9a503, 0xf61ec2cd,0x241b2bf8,0xa982e81e,0x5a181786,0x01f0a0a0) ALTROMPN(302, 1, 2, 65536, ROMTYPE_ODD | ROMTYPE_8BIT, NULL, 0x78eb6fd6, 0xe4048180,0x95f03b6e,0x0746620f,0x5ce48c3f,0x7149b8a0) + { _T("Picmatic Marbella Vice (100Hz TV)"), 0, 0, 0, 0, _T("ALG\0"), 131072, 315, 0, 0, ROMTYPE_ALG, 0, 0, NULL, + 0xae2d2805, 0x0e392b46,0x15777fe5,0x24ed27ab,0xf8539d4b,0xb1e3ba9d, NULL, NULL, 10 }, + ALTROMPN(315, 1, 1, 65536, ROMTYPE_EVEN | ROMTYPE_8BIT, NULL, 0xd2b5e5ca, 0xde765039,0x61076aca,0xd405db9e,0x83bd5334,0xb02bf908) + ALTROMPN(315, 1, 2, 65536, ROMTYPE_ODD | ROMTYPE_8BIT, NULL, 0x2c9ebccb, 0x4e8dcb85,0x26a8debb,0x70f3f567,0x13903ba8,0xbfbb3ed5) + // spilz0d4-odd-27-9-95-salvajes-displays-27c512.u4, spilz0d4-even-27-9-95-salvajes-displays-27c512.u5 + { _T("Picmatic Tierras Salvajes (100Hz TV)"), 0, 0, 0, 0, _T("ALG\0"), 131072, 314, 0, 0, ROMTYPE_ALG, 0, 0, NULL, + 0xe6c539ec, 0xa5f70818,0xd93ab33c,0xa4149a50,0xc38b2a13,0x0ee5d7ab, NULL, NULL, 10 }, + ALTROMPN(314, 1, 1, 65536, ROMTYPE_EVEN | ROMTYPE_8BIT, NULL, 0x730e4696, 0x4db0cc7d,0x160de5e7,0x0f1d1842,0xfa94adb8,0xee7f954f) + ALTROMPN(314, 1, 2, 65536, ROMTYPE_ODD | ROMTYPE_8BIT, NULL, 0xd46dd5e0, 0x7d808c6e,0xd88bf9a9,0x8cdb468c,0xe71c0952,0xb0b5d7b2) { NULL } -- 2.47.3