naomi: derbyoc JP card reader support. security pic for doa, tduno
Derby owner's club (JP) uses a Sanwa CRP-1231LR card reader. World edition uses a Sanwa CRP-1231BR. Set x76f100 security pic content for doa2, doa2a, doa2m, tduno
This commit is contained in:
parent
3aa2f922e7
commit
d29645cc49
|
@ -64,7 +64,7 @@ namespace card_reader {
|
|||
Copyright (C) 2022-2023 tugpoat (https://github.com/tugpoat)
|
||||
*/
|
||||
|
||||
class CardReader : public SerialPort::Pipe
|
||||
class SanwaCRP1231BR : public SerialPort::Pipe
|
||||
{
|
||||
public:
|
||||
void write(u8 b) override
|
||||
|
@ -130,26 +130,26 @@ public:
|
|||
INFO_LOG(NAOMI, "Card inserted");
|
||||
}
|
||||
|
||||
private:
|
||||
protected:
|
||||
enum Commands
|
||||
{
|
||||
CARD_INIT = 0x10,
|
||||
CARD_GET_CARD_STATE = 0x20,
|
||||
CARD_IS_PRESENT = 0x40, // cancel?
|
||||
CARD_CANCEL = 0x40,
|
||||
CARD_LOAD_CARD = 0xB0,
|
||||
CARD_CLEAN_CARD = 0xA0,
|
||||
CARD_READ = 0x33,
|
||||
CARD_WRITE = 0x53,
|
||||
CARD_WRITE_INFO = 0x7C,
|
||||
CARD_PRINT = 0x78,
|
||||
CARD_7A = 0x7A,
|
||||
CARD_7D = 0x7D,
|
||||
CARD_PRINT = 0x7C,
|
||||
CARD_PRINT_SETTINGS = 0x78,
|
||||
CARD_REGISTER_FONT = 0x7A,
|
||||
CARD_ERASE_PRINT = 0x7D,
|
||||
CARD_DOOR = 0xD0,
|
||||
CARD_EJECT = 0x80,
|
||||
CARD_NEW = 0xB0,
|
||||
};
|
||||
|
||||
u8 getStatus1()
|
||||
virtual u8 getStatus1()
|
||||
{
|
||||
return ((doorOpen ? 2 : 1) << 6) | 0x20 | (cardInserted ? 0x18 : 0);
|
||||
}
|
||||
|
@ -167,10 +167,12 @@ private:
|
|||
{
|
||||
case CARD_DOOR:
|
||||
doorOpen = rxCommand[4] == '1';
|
||||
INFO_LOG(NAOMI, "Door %s", doorOpen ? "open" : "closed");
|
||||
status1 = getStatus1();
|
||||
break;
|
||||
|
||||
case CARD_NEW:
|
||||
INFO_LOG(NAOMI, "New card");
|
||||
cardInserted = true;
|
||||
doorOpen = false;
|
||||
status1 = getStatus1();
|
||||
|
@ -222,16 +224,17 @@ private:
|
|||
break;
|
||||
|
||||
case CARD_EJECT:
|
||||
INFO_LOG(NAOMI, "Card ejected");
|
||||
cardInserted = false;
|
||||
status1 = getStatus1();
|
||||
break;
|
||||
|
||||
case CARD_IS_PRESENT:
|
||||
case CARD_CANCEL:
|
||||
case CARD_GET_CARD_STATE:
|
||||
case CARD_INIT:
|
||||
case CARD_7A:
|
||||
case CARD_REGISTER_FONT:
|
||||
case CARD_PRINT_SETTINGS:
|
||||
case CARD_PRINT:
|
||||
case CARD_WRITE_INFO:
|
||||
case CARD_CLEAN_CARD:
|
||||
break;
|
||||
|
||||
|
@ -342,8 +345,21 @@ private:
|
|||
bool cardInserted = false;
|
||||
};
|
||||
|
||||
class SanwaCRP1231LR : public SanwaCRP1231BR
|
||||
{
|
||||
u8 getStatus1() override
|
||||
{
|
||||
// '0' no card
|
||||
// '1' pos magnetic read/write
|
||||
// '2' pos thermal printer
|
||||
// '3' pos thermal dispenser
|
||||
// '4' ejected not removed
|
||||
return cardInserted ? '1' : '0';
|
||||
}
|
||||
};
|
||||
|
||||
// Hooked to the SH4 SCIF serial port
|
||||
class InitialDCardReader final : public CardReader
|
||||
class InitialDCardReader final : public SanwaCRP1231BR
|
||||
{
|
||||
public:
|
||||
InitialDCardReader() {
|
||||
|
@ -356,28 +372,44 @@ public:
|
|||
};
|
||||
|
||||
// Hooked to the MIE via a 838-13661 RS232/RS422 converter board
|
||||
class DerbyCardReader final : public CardReader
|
||||
class DerbyBRCardReader final : public SanwaCRP1231BR
|
||||
{
|
||||
public:
|
||||
DerbyCardReader() {
|
||||
DerbyBRCardReader() {
|
||||
getMieDevice()->setPipe(this);
|
||||
}
|
||||
|
||||
~DerbyCardReader() {
|
||||
~DerbyBRCardReader() {
|
||||
getMieDevice()->setPipe(nullptr);
|
||||
}
|
||||
};
|
||||
|
||||
static std::unique_ptr<CardReader> cardReader;
|
||||
class DerbyLRCardReader final : public SanwaCRP1231LR
|
||||
{
|
||||
public:
|
||||
DerbyLRCardReader() {
|
||||
getMieDevice()->setPipe(this);
|
||||
}
|
||||
|
||||
~DerbyLRCardReader() {
|
||||
getMieDevice()->setPipe(nullptr);
|
||||
}
|
||||
};
|
||||
|
||||
static std::unique_ptr<SanwaCRP1231BR> cardReader;
|
||||
|
||||
void initdInit() {
|
||||
term();
|
||||
cardReader = std::make_unique<InitialDCardReader>();
|
||||
}
|
||||
|
||||
void derbyInit() {
|
||||
void derbyInit()
|
||||
{
|
||||
term();
|
||||
cardReader = std::make_unique<DerbyCardReader>();
|
||||
if (settings.content.gameId == " DERBY OWNERS CLUB WE ---------")
|
||||
cardReader = std::make_unique<DerbyBRCardReader>();
|
||||
else
|
||||
cardReader = std::make_unique<DerbyLRCardReader>();
|
||||
}
|
||||
|
||||
void term() {
|
||||
|
|
|
@ -1,6 +1,19 @@
|
|||
/*
|
||||
This file is a mix of my code, Zezu's, and duno wtf-else (most likely ElSemi's ?)
|
||||
*/
|
||||
This file is part of Flycast.
|
||||
|
||||
Flycast is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Flycast is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Flycast. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "types.h"
|
||||
#include "hw/holly/sb.h"
|
||||
#include "hw/sh4/sh4_mem.h"
|
||||
|
@ -28,16 +41,6 @@ Multiboard *multiboard;
|
|||
|
||||
static X76F100SerialFlash mainSerialId;
|
||||
static X76F100SerialFlash romSerialId;
|
||||
/*
|
||||
El numero de serie solo puede contener:
|
||||
0-9 (0x30-0x39)
|
||||
A-H (0x41-0x48)
|
||||
J-N (0x4A-0x4E)
|
||||
P-Z (0x50-0x5A)
|
||||
*/
|
||||
//static u8 BSerial[]="\xB7"/*CRC1*/"\x19"/*CRC2*/"0123234437897584372973927387463782196719782697849162342198671923649";
|
||||
//static u8 BSerial[]="\x09\xa1 0000000000000000\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"; // default from mame
|
||||
//static u8 GSerial[]="\xB7"/*CRC1*/"\x19"/*CRC2*/"0123234437897584372973927387463782196719782697849162342198671923649";
|
||||
|
||||
static u8 midiTxBuf[4];
|
||||
static u32 midiTxBufIndex;
|
||||
|
@ -56,7 +59,7 @@ void NaomiBoardIDWrite(const u16 data)
|
|||
|
||||
u16 NaomiBoardIDRead()
|
||||
{
|
||||
// bit 0 indicates the eeprom is a X76F100, otherwise the BIOS expects a AT93C46
|
||||
// bit 0 indicates the eeprom is a X76F100, otherwise the BIOS expects an AT93C46
|
||||
// bit 3 is xf76f100 SDA
|
||||
// bit 4 is at93c46 DO
|
||||
return (mainSerialId.readSDA() << 3) | 1;
|
||||
|
|
|
@ -1619,10 +1619,7 @@ const Game Games[] =
|
|||
{ "mpr-22120.ic21s", 0xa800000, 0x0800000 },
|
||||
|
||||
// on-cart X76F100 eeprom contents
|
||||
//ROM_REGION( 0x84, "naomibd_eeprom", 0 )
|
||||
//ROM_LOAD( "841-0003.sf", 0x000000, 0x000084, CRC(3a119a17) SHA1(d37a092cca7c9cfc5f2637b355af90a65d04013e) )
|
||||
|
||||
{ NULL, 0, 0 },
|
||||
{ "841-0003.sf", 0x000000, 0x000084, 0x3a119a17, Eeprom },
|
||||
},
|
||||
nullptr,
|
||||
&doa2_inputs,
|
||||
|
@ -1663,10 +1660,7 @@ const Game Games[] =
|
|||
{ "mpr-22120.ic21s", 0xa800000, 0x0800000 },
|
||||
|
||||
// on-cart X76F100 eeprom contents
|
||||
//ROM_REGION( 0x84, "naomibd_eeprom", 0 )
|
||||
//ROM_LOAD( "841-0003.sf", 0x000000, 0x000084, CRC(3a119a17) SHA1(d37a092cca7c9cfc5f2637b355af90a65d04013e) )
|
||||
|
||||
{ NULL, 0, 0 },
|
||||
{ "841-0003.sf", 0x000000, 0x000084, 0x3a119a17, Eeprom },
|
||||
},
|
||||
nullptr,
|
||||
&doa2_inputs,
|
||||
|
@ -1707,9 +1701,7 @@ const Game Games[] =
|
|||
{ "mpr-22120.ic21s",0xa800000, 0x0800000 },
|
||||
|
||||
// on-cart X76F100 eeprom contents
|
||||
//ROM_REGION( 0x84, "naomibd_eeprom", 0 )
|
||||
//ROM_LOAD( "841-0003.sf", 0x000000, 0x000084, CRC(3a119a17) SHA1(d37a092cca7c9cfc5f2637b355af90a65d04013e) )
|
||||
{ NULL, 0, 0 },
|
||||
{ "841-0003.sf", 0x000000, 0x000084, 0x3a119a17, Eeprom },
|
||||
},
|
||||
nullptr,
|
||||
&doa2_inputs,
|
||||
|
@ -3589,10 +3581,7 @@ const Game Games[] =
|
|||
{ "mpr-22077.ic4", 0x2000000, 0x400000 },
|
||||
|
||||
// on-cart X76F100 eeprom contents
|
||||
//ROM_REGION( 0x84, "naomibd_eeprom", 0 )
|
||||
//ROM_LOAD( "x76f100.ic37", 0x000000, 0x000084, CRC(c79251d5) SHA1(3e70bbbb6d28bade7eec7e27d716463045656f98) )
|
||||
|
||||
{ NULL, 0, 0 },
|
||||
{ "x76f100.ic37", 0x000000, 0x000084, 0xc79251d5, Eeprom },
|
||||
},
|
||||
nullptr,
|
||||
nullptr,
|
||||
|
|
Loading…
Reference in New Issue