Hooked up Magical Truck Adventure controls

This commit is contained in:
Bart Trzynadlowski 2016-04-13 03:28:04 +00:00
parent d2563c035f
commit 9a2bb78add
6 changed files with 264 additions and 233 deletions

View file

@ -1059,7 +1059,7 @@ const struct GameInfo g_Model3GameList[] =
true, // 16 MB of banked CROM (Mirror) true, // 16 MB of banked CROM (Mirror)
0x4000000, // 64 MB of VROM 0x4000000, // 64 MB of VROM
0x1000000, // 16 MB of sample ROMs 0x1000000, // 16 MB of sample ROMs
GAME_INPUT_COMMON|GAME_INPUT_VEHICLE, GAME_INPUT_COMMON|GAME_INPUT_MAGTRUCK,
0, // no MPEG board 0, // no MPEG board
false, // no drive board false, // no drive board
0x29266e45, // securiry board encryption key 0x29266e45, // securiry board encryption key

View file

@ -37,27 +37,28 @@
******************************************************************************/ ******************************************************************************/
// Input flags // Input flags
#define GAME_INPUT_COMMON 0x00001 // game has common controls #define GAME_INPUT_COMMON 0x000000001 // game has common controls
#define GAME_INPUT_VEHICLE 0x00002 // game has vehicle controls #define GAME_INPUT_VEHICLE 0x000000002 // game has vehicle controls
#define GAME_INPUT_JOYSTICK1 0x00004 // game has joystick 1 #define GAME_INPUT_JOYSTICK1 0x000000004 // game has joystick 1
#define GAME_INPUT_JOYSTICK2 0x00008 // game has joystick 2 #define GAME_INPUT_JOYSTICK2 0x000000008 // game has joystick 2
#define GAME_INPUT_FIGHTING 0x00010 // game has fighting game controls #define GAME_INPUT_FIGHTING 0x000000010 // game has fighting game controls
#define GAME_INPUT_VR4 0x00020 // game has four VR view buttons #define GAME_INPUT_VR4 0x000000020 // game has four VR view buttons
#define GAME_INPUT_VIEWCHANGE 0x00040 // game has single view change button #define GAME_INPUT_VIEWCHANGE 0x000000040 // game has single view change button
#define GAME_INPUT_SHIFT4 0x00080 // game has 4-speed shifter #define GAME_INPUT_SHIFT4 0x000000080 // game has 4-speed shifter
#define GAME_INPUT_SHIFTUPDOWN 0x00100 // game has up/down shifter #define GAME_INPUT_SHIFTUPDOWN 0x000000100 // game has up/down shifter
#define GAME_INPUT_HANDBRAKE 0x00200 // game has handbrake #define GAME_INPUT_HANDBRAKE 0x000000200 // game has handbrake
#define GAME_INPUT_HARLEY 0x00400 // game has Harley Davidson controls #define GAME_INPUT_HARLEY 0x000000400 // game has Harley Davidson controls
#define GAME_INPUT_GUN1 0x00800 // game has light gun 1 #define GAME_INPUT_GUN1 0x000000800 // game has light gun 1
#define GAME_INPUT_GUN2 0x01000 // game has light gun 2 #define GAME_INPUT_GUN2 0x000001000 // game has light gun 2
#define GAME_INPUT_ANALOG_JOYSTICK 0x02000 // game has analog joystick #define GAME_INPUT_ANALOG_JOYSTICK 0x000002000 // game has analog joystick
#define GAME_INPUT_TWIN_JOYSTICKS 0x04000 // game has twin joysticks #define GAME_INPUT_TWIN_JOYSTICKS 0x000004000 // game has twin joysticks
#define GAME_INPUT_SOCCER 0x08000 // game has soccer controls #define GAME_INPUT_SOCCER 0x000008000 // game has soccer controls
#define GAME_INPUT_SPIKEOUT 0x10000 // game has Spikeout buttons #define GAME_INPUT_SPIKEOUT 0x000010000 // game has Spikeout buttons
#define GAME_INPUT_ANALOG_GUN1 0x20000 // game has analog gun 1 #define GAME_INPUT_ANALOG_GUN1 0x000020000 // game has analog gun 1
#define GAME_INPUT_ANALOG_GUN2 0x40000 // game has analog gun 2 #define GAME_INPUT_ANALOG_GUN2 0x000040000 // game has analog gun 2
#define GAME_INPUT_SKI 0x80000 // game has ski controls #define GAME_INPUT_SKI 0x000080000 // game has ski controls
#define GAME_INPUT_ALL 0xFFFFF #define GAME_INPUT_MAGTRUCK 0x000100000 // game has magical truck controls
#define GAME_INPUT_ALL 0x0001FFFFF
/****************************************************************************** /******************************************************************************
@ -78,11 +79,11 @@ struct GameInfo
const char *mfgName; // name of manufacturer const char *mfgName; // name of manufacturer
unsigned year; // year released (in decimal) unsigned year; // year released (in decimal)
int step; // Model 3 hardware stepping: 0x10 = 1.0, 0x15 = 1.5, 0x20 = 2.0, 0x21 = 2.1 int step; // Model 3 hardware stepping: 0x10 = 1.0, 0x15 = 1.5, 0x20 = 2.0, 0x21 = 2.1
unsigned cromSize; // size of fixed CROM (up to 8 MB) uint32_t cromSize; // size of fixed CROM (up to 8 MB)
bool mirrorLow64MB; // mirror low 64 MB of banked CROM space to upper 64 MB bool mirrorLow64MB; // mirror low 64 MB of banked CROM space to upper 64 MB
unsigned vromSize; // size of video ROMs (32 or 64 MB; if 32 MB, will have to be mirrored) uint32_t vromSize; // size of video ROMs (32 or 64 MB; if 32 MB, will have to be mirrored)
unsigned sampleSize; // size of sample ROMS (8 or 16 MB; if 8 MB, will have to be mirrored) uint32_t sampleSize; // size of sample ROMS (8 or 16 MB; if 8 MB, will have to be mirrored)
unsigned inputFlags; // game input types uint32_t inputFlags; // game input types
int mpegBoard; // MPEG music board type: 0 = none, 1 = DSB1 (Z80), 2 = DSB2 (68K). int mpegBoard; // MPEG music board type: 0 = none, 1 = DSB1 (Z80), 2 = DSB2 (68K).
bool driveBoard; // drive board (supported if true) bool driveBoard; // drive board (supported if true)
uint32_t encryptionKey; // security board encryption device key (or 0 if not applicable) uint32_t encryptionKey; // security board encryption device key (or 0 if not applicable)

View file

@ -104,6 +104,7 @@ const char* CInput::GetInputGroup()
case GAME_INPUT_ANALOG_GUN1: // Fall through to below case GAME_INPUT_ANALOG_GUN1: // Fall through to below
case GAME_INPUT_ANALOG_GUN2: return "Analog Guns"; case GAME_INPUT_ANALOG_GUN2: return "Analog Guns";
case GAME_INPUT_SKI: return "Ski Controls"; case GAME_INPUT_SKI: return "Ski Controls";
case GAME_INPUT_MAGTRUCK: return "Magical Truck Controls";
default: return "Misc"; default: return "Misc";
} }
} }

View file

@ -237,6 +237,17 @@ CInputs::CInputs(CInputSystem *system) : m_system(system)
skiSelect1 = AddSwitchInput("SkiSelect1", "Ski Champ Select 1", GAME_INPUT_SKI, "NONE"); skiSelect1 = AddSwitchInput("SkiSelect1", "Ski Champ Select 1", GAME_INPUT_SKI, "NONE");
skiSelect2 = AddSwitchInput("SkiSelect2", "Ski Champ Select 2", GAME_INPUT_SKI, "NONE"); skiSelect2 = AddSwitchInput("SkiSelect2", "Ski Champ Select 2", GAME_INPUT_SKI, "NONE");
skiSelect3 = AddSwitchInput("SkiSelect3", "Ski Champ Select 3", GAME_INPUT_SKI, "NONE"); skiSelect3 = AddSwitchInput("SkiSelect3", "Ski Champ Select 3", GAME_INPUT_SKI, "NONE");
// Magical truck controls
CAnalogInput *magicalLeverUp1 = AddAnalogInput("MagicalLeverUp1", "P1 Magical Lever Up", GAME_INPUT_MAGTRUCK, "NONE");
CAnalogInput *magicalLeverDown1 = AddAnalogInput("MagicalLeverDown1", "P1 Magical Lever Down", GAME_INPUT_MAGTRUCK, "NONE");
CAnalogInput *magicalLeverUp2 = AddAnalogInput("MagicalLeverUp2", "P2 Magical Lever Up", GAME_INPUT_MAGTRUCK, "NONE");
CAnalogInput *magicalLeverDown2 = AddAnalogInput("MagicalLeverDown2", "P2 Magical Lever Down", GAME_INPUT_MAGTRUCK, "NONE");
magicalLever1 = AddAxisInput( "MagicalLever1", "P1 Magical Lever Full Analog", GAME_INPUT_MAGTRUCK, "NONE", magicalLeverUp1, magicalLeverDown1, 0xFF, 0x80, 0);
magicalLever2 = AddAxisInput( "MagicalLever2", "P2 Magical Lever Full Analog", GAME_INPUT_MAGTRUCK, "NONE", magicalLeverUp2, magicalLeverDown2, 0xFF, 0x80, 0);
magicalPedal1 = AddSwitchInput( "MagicalPedal1", "P1 Magical Pedal", GAME_INPUT_MAGTRUCK, "NONE");
magicalPedal2 = AddSwitchInput( "MagicalPedal2", "P2 Magical Pedal", GAME_INPUT_MAGTRUCK, "NONE");
} }
CInputs::~CInputs() CInputs::~CInputs()

View file

@ -215,6 +215,12 @@ public:
CSwitchInput *skiSelect2; CSwitchInput *skiSelect2;
CSwitchInput *skiSelect3; CSwitchInput *skiSelect3;
// Magical Truck Adventure controls
CAxisInput *magicalLever1;
CAxisInput *magicalLever2;
CSwitchInput *magicalPedal1;
CSwitchInput *magicalPedal2;
/* /*
* Creates a set of inputs with the given input system. * Creates a set of inputs with the given input system.
*/ */

View file

@ -424,6 +424,9 @@ UINT8 CModel3::ReadInputs(unsigned reg)
data &= ~(Inputs->analogTriggerRight[0]->value<<1); data &= ~(Inputs->analogTriggerRight[0]->value<<1);
} }
if ((Game->inputFlags & GAME_INPUT_MAGTRUCK))
data &= ~(Inputs->magicalPedal1->value << 0);
return data; return data;
case 0x0C: // game-specific inputs case 0x0C: // game-specific inputs
@ -495,6 +498,9 @@ UINT8 CModel3::ReadInputs(unsigned reg)
data &= ~(Inputs->analogTriggerRight[1]->value<<1); data &= ~(Inputs->analogTriggerRight[1]->value<<1);
} }
if ((Game->inputFlags & GAME_INPUT_MAGTRUCK))
data &= ~(Inputs->magicalPedal2->value << 0);
return data; return data;
case 0x2C: // Serial FIFO 1 case 0x2C: // Serial FIFO 1
@ -539,6 +545,12 @@ UINT8 CModel3::ReadInputs(unsigned reg)
adc[1] = (UINT8)Inputs->skiX->value; adc[1] = (UINT8)Inputs->skiX->value;
} }
if ((Game->inputFlags & GAME_INPUT_MAGTRUCK))
{
adc[0] = uint8_t(Inputs->magicalLever1->value);
adc[1] = uint8_t(Inputs->magicalLever2->value);
}
// Read out appropriate channel // Read out appropriate channel
data = adc[adcChannel&7]; data = adc[adcChannel&7];
++adcChannel; ++adcChannel;