mirror of https://github.com/stella-emu/stella.git
improved joystick and genesis detection
This commit is contained in:
parent
2bc87ae51e
commit
2ad206eac1
|
@ -111,7 +111,7 @@ bool ControllerDetector::usesJoystickButton(const uInt8* image, uInt32 size, Con
|
|||
if(port == Controller::Jack::Left)
|
||||
{
|
||||
// check for INPT4 access
|
||||
const int NUM_SIGS_0 = 17;
|
||||
const int NUM_SIGS_0 = 20;
|
||||
const int SIG_SIZE_0 = 3;
|
||||
uInt8 signature_0[NUM_SIGS_0][SIG_SIZE_0] = {
|
||||
{ 0x24, 0x0c, 0x10 }, // bit INPT4; bpl (joystick games only)
|
||||
|
@ -131,6 +131,9 @@ bool ControllerDetector::usesJoystickButton(const uInt8* image, uInt32 size, Con
|
|||
{ 0xa6, 0x3c, 0x8e }, // ldx INPT4|$30; stx (joystick games only)
|
||||
{ 0xa4, 0x0c, 0x30 }, // ldy INPT4|; bmi (only Game of Concentration)
|
||||
{ 0xa4, 0x3c, 0x30 }, // ldy INPT4|$30; bmi (only Game of Concentration)
|
||||
{ 0xa5, 0x0c, 0x25 }, // lda INPT4; and (joystick games only)
|
||||
{ 0xa6, 0x3c, 0x30 }, // ldx INPT4; bmi (joystick games only)
|
||||
{ 0xa5, 0x0c, 0x0a }, // lda INPT4; asl (joystick games only)
|
||||
};
|
||||
const int NUM_SIGS_1 = 5;
|
||||
const int SIG_SIZE_1 = 4;
|
||||
|
@ -168,7 +171,7 @@ bool ControllerDetector::usesJoystickButton(const uInt8* image, uInt32 size, Con
|
|||
else if(port == Controller::Jack::Right)
|
||||
{
|
||||
// check for INPT5 and indexed INPT4 access
|
||||
const int NUM_SIGS_0 = 13;
|
||||
const int NUM_SIGS_0 = 15;
|
||||
const int SIG_SIZE_0 = 3;
|
||||
uInt8 signature_0[NUM_SIGS_0][SIG_SIZE_0] = {
|
||||
{ 0x24, 0x0d, 0x10 }, // bit INPT5; bpl (joystick games only)
|
||||
|
@ -184,6 +187,8 @@ bool ControllerDetector::usesJoystickButton(const uInt8* image, uInt32 size, Con
|
|||
{ 0xb5, 0x3c, 0x10 }, // lda INPT4|$30,x; bpl (joystick, keyboard and driving games)
|
||||
{ 0xb5, 0x3c, 0x30 }, // lda INPT4|$30,x; bmi (joystick and keyboard games)
|
||||
{ 0xa4, 0x3d, 0x30 }, // ldy INPT5; bmi (only Game of Concentration)
|
||||
{ 0xa5, 0x0d, 0x25 }, // lda INPT4; and (joystick games only)
|
||||
{ 0xa6, 0x3d, 0x30 }, // ldx INPT4; bmi (joystick games only)
|
||||
};
|
||||
const int NUM_SIGS_1 = 4;
|
||||
const int SIG_SIZE_1 = 4;
|
||||
|
@ -351,7 +356,7 @@ bool ControllerDetector::usesGenesisButton(const uInt8* image, uInt32 size, Cont
|
|||
if(port == Controller::Jack::Left)
|
||||
{
|
||||
// check for INPT1 access
|
||||
const int NUM_SIGS_0 = 13;
|
||||
const int NUM_SIGS_0 = 16;
|
||||
const int SIG_SIZE_0 = 3;
|
||||
uInt8 signature_0[NUM_SIGS_0][SIG_SIZE_0] = {
|
||||
{ 0x24, 0x09, 0x10 }, // bit INPT1; bpl (Genesis only)
|
||||
|
@ -364,9 +369,12 @@ bool ControllerDetector::usesGenesisButton(const uInt8* image, uInt32 size, Cont
|
|||
{ 0x24, 0x39, 0x30 }, // bit INPT1|$30; bmi (keyboard and paddle ROMS too)
|
||||
{ 0xa5, 0x39, 0x10 }, // lda INPT1|$30; bpl (keyboard ROMS too)
|
||||
{ 0xa5, 0x39, 0x30 }, // lda INPT1|$30; bmi (keyboard and paddle ROMS too)
|
||||
{ 0xa4, 0x39, 0x30 }, // ldy INPT1|$30; bmi (keyboard ROMS too)
|
||||
{ 0xa5, 0x39, 0x6a }, // lda INPT1|$30; ror (Genesis only)
|
||||
{ 0xa6, 0x39, 0x8e }, // ldx INPT1|$30; stx (Genesis only)
|
||||
{ 0xa5, 0x09, 0x29 }, // lda INPT1; and (Genesis only)
|
||||
{ 0x25, 0x39, 0x30 }, // and INPT1|$30; bmi (Genesis only)
|
||||
{ 0x25, 0x09, 0x10 }, // and INPT1; bpl (Genesis only)
|
||||
};
|
||||
for(uInt32 i = 0; i < NUM_SIGS_0; ++i)
|
||||
if(searchForBytes(image, size, signature_0[i], SIG_SIZE_0))
|
||||
|
@ -375,7 +383,7 @@ bool ControllerDetector::usesGenesisButton(const uInt8* image, uInt32 size, Cont
|
|||
else if(port == Controller::Jack::Right)
|
||||
{
|
||||
// check for INPT3 access
|
||||
const int NUM_SIGS_0 = 9;
|
||||
const int NUM_SIGS_0 = 10;
|
||||
const int SIG_SIZE_0 = 3;
|
||||
uInt8 signature_0[NUM_SIGS_0][SIG_SIZE_0] = {
|
||||
{ 0x24, 0x0b, 0x10 }, // bit INPT3; bpl
|
||||
|
@ -387,6 +395,7 @@ bool ControllerDetector::usesGenesisButton(const uInt8* image, uInt32 size, Cont
|
|||
{ 0xa5, 0x3b, 0x10 }, // lda INPT3|$30; bpl
|
||||
{ 0xa5, 0x3b, 0x30 }, // lda INPT3|$30; bmi
|
||||
{ 0xa6, 0x3b, 0x8e }, // ldx INPT3|$30; stx
|
||||
{ 0x25, 0x0b, 0x10 }, // and INPT3; bpl (Genesis only)
|
||||
};
|
||||
for(uInt32 i = 0; i < NUM_SIGS_0; ++i)
|
||||
if(searchForBytes(image, size, signature_0[i], SIG_SIZE_0))
|
||||
|
|
Loading…
Reference in New Issue