mirror of
https://github.com/RetroDECK/Supermodel.git
synced 2025-04-10 19:15:14 +00:00
Added rumble skipad in Ski Champ game.
This is only a simulation (cmd are interpreted), not an emulation because we lack informations on the game itself and its driveboard (does it have dedicated cpu/rom ?).
This commit is contained in:
parent
f3a7ec52ba
commit
6626afc8bb
|
@ -205,7 +205,14 @@ bool CDriveBoard::Init(const UINT8 *romPtr)
|
||||||
// Check have a valid ROM
|
// Check have a valid ROM
|
||||||
m_attached = (m_rom != NULL);
|
m_attached = (m_rom != NULL);
|
||||||
if (!m_attached)
|
if (!m_attached)
|
||||||
return OKAY;
|
{
|
||||||
|
if (m_boardType == SkiPad)
|
||||||
|
{
|
||||||
|
m_attached = true;
|
||||||
|
m_simulated = true;
|
||||||
|
}
|
||||||
|
return OKAY;
|
||||||
|
}
|
||||||
|
|
||||||
// Allocate memory for RAM
|
// Allocate memory for RAM
|
||||||
m_ram = new (std::nothrow) UINT8[RAM_SIZE];
|
m_ram = new (std::nothrow) UINT8[RAM_SIZE];
|
||||||
|
@ -274,7 +281,8 @@ void CDriveBoard::Reset(void)
|
||||||
m_lastVibrate = 0;
|
m_lastVibrate = 0;
|
||||||
|
|
||||||
// Configure options (cannot be done in Init() because command line settings weren't yet parsed)
|
// Configure options (cannot be done in Init() because command line settings weren't yet parsed)
|
||||||
m_simulated = false; //TODO: make this run-time configurable when simulation mode is supported
|
if(m_boardType != SkiPad)
|
||||||
|
m_simulated = false; //TODO: make this run-time configurable when simulation mode is supported
|
||||||
SetSteeringStrength(m_config["SteeringStrength"].ValueAsDefault<unsigned>(5));
|
SetSteeringStrength(m_config["SteeringStrength"].ValueAsDefault<unsigned>(5));
|
||||||
|
|
||||||
m_z80.Reset(); // always reset to provide a valid Z80 state
|
m_z80.Reset(); // always reset to provide a valid Z80 state
|
||||||
|
@ -354,8 +362,66 @@ void CDriveBoard::SimulateWrite(UINT8 cmd)
|
||||||
// TODO - implement for Sega Rally 2
|
// TODO - implement for Sega Rally 2
|
||||||
UINT8 type = cmd>>4;
|
UINT8 type = cmd>>4;
|
||||||
UINT8 val = cmd&0xF;
|
UINT8 val = cmd&0xF;
|
||||||
switch (type)
|
|
||||||
|
// Ski Champ vibration pad
|
||||||
|
if (m_boardType == SkiPad)
|
||||||
{
|
{
|
||||||
|
switch (type)
|
||||||
|
{
|
||||||
|
case 0x00: // nothing to do ?
|
||||||
|
break;
|
||||||
|
case 0x01: // full stop ?
|
||||||
|
if (val == 0)
|
||||||
|
SendVibrate(0);
|
||||||
|
break;
|
||||||
|
case 0x04:
|
||||||
|
SendVibrate(val*0x11);
|
||||||
|
break;
|
||||||
|
case 0x08:
|
||||||
|
if (val == 0x08)
|
||||||
|
{
|
||||||
|
// test driveboard passed ?
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 0x0A: // only when test in service menu
|
||||||
|
switch (val)
|
||||||
|
{
|
||||||
|
case 3: // clutch
|
||||||
|
break;
|
||||||
|
case 5: // motor test
|
||||||
|
SendVibrate(val * 0x11);
|
||||||
|
break;
|
||||||
|
case 6: // end motor test
|
||||||
|
SendVibrate(0);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 0x0C: // game state or reset driveboard ?
|
||||||
|
switch (val)
|
||||||
|
{
|
||||||
|
case 1:
|
||||||
|
// in game
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
// game ready
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
// test mode
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 0x0D: // 0xD0-DF Set read mode
|
||||||
|
m_readMode = val & 0x7;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
//printf("Skipad unknown command %02X , val= %02X\n",type,val);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
switch (type)
|
||||||
|
{
|
||||||
case 0: // 0x00-0F Play sequence
|
case 0: // 0x00-0F Play sequence
|
||||||
/* TODO */
|
/* TODO */
|
||||||
break;
|
break;
|
||||||
|
@ -398,7 +464,7 @@ void CDriveBoard::SimulateWrite(UINT8 cmd)
|
||||||
/* TODO */
|
/* TODO */
|
||||||
break;
|
break;
|
||||||
case 8: // 0x80-8F Test Mode
|
case 8: // 0x80-8F Test Mode
|
||||||
switch (val&0x7)
|
switch (val & 0x7)
|
||||||
{
|
{
|
||||||
case 0: SendStopAll(); break; // 0x80 Stop motor
|
case 0: SendStopAll(); break; // 0x80 Stop motor
|
||||||
case 1: SendConstantForce(20); break; // 0x81 Roll wheel right
|
case 1: SendConstantForce(20); break; // 0x81 Roll wheel right
|
||||||
|
@ -430,7 +496,7 @@ void CDriveBoard::SimulateWrite(UINT8 cmd)
|
||||||
m_boardMode = val;
|
m_boardMode = val;
|
||||||
break;
|
break;
|
||||||
case 0xD: // 0xD0-DF Set read mode
|
case 0xD: // 0xD0-DF Set read mode
|
||||||
m_readMode = val&0x7;
|
m_readMode = val & 0x7;
|
||||||
break;
|
break;
|
||||||
case 0xE: // 0xE0-EF Invalid command
|
case 0xE: // 0xE0-EF Invalid command
|
||||||
/* Ignore */
|
/* Ignore */
|
||||||
|
@ -438,6 +504,7 @@ void CDriveBoard::SimulateWrite(UINT8 cmd)
|
||||||
case 0xF: // 0xF0-FF Echo test
|
case 0xF: // 0xF0-FF Echo test
|
||||||
m_echoVal = val;
|
m_echoVal = val;
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,8 @@ public:
|
||||||
enum BoardType
|
enum BoardType
|
||||||
{
|
{
|
||||||
Wheel=0,
|
Wheel=0,
|
||||||
Joystick
|
Joystick,
|
||||||
|
SkiPad
|
||||||
};
|
};
|
||||||
|
|
||||||
BoardType m_boardType;
|
BoardType m_boardType;
|
||||||
|
|
|
@ -233,7 +233,6 @@ UINT8 CModel3::ReadInputs(unsigned reg)
|
||||||
{
|
{
|
||||||
UINT8 adc[8];
|
UINT8 adc[8];
|
||||||
UINT8 data;
|
UINT8 data;
|
||||||
|
|
||||||
reg &= 0x3F;
|
reg &= 0x3F;
|
||||||
switch (reg)
|
switch (reg)
|
||||||
{
|
{
|
||||||
|
@ -532,6 +531,14 @@ UINT8 CModel3::ReadInputs(unsigned reg)
|
||||||
if ((m_game.inputs & Game::INPUT_MAGTRUCK))
|
if ((m_game.inputs & Game::INPUT_MAGTRUCK))
|
||||||
data &= ~(Inputs->magicalPedal2->value << 0);
|
data &= ~(Inputs->magicalPedal2->value << 0);
|
||||||
|
|
||||||
|
if ((m_game.inputs & Game::INPUT_SKI))
|
||||||
|
{
|
||||||
|
data = 0xff;
|
||||||
|
// foot sensor Left=0xf0 Right=0x0f Both=0xff
|
||||||
|
// rumble skipad is tested here at boot. The rom is patched to avoid driveboard error
|
||||||
|
// note : there is no driveboard error if sensor value slide slowly from 0x80 to 0xff then set to 0xff when test passed (tested with assigning an axis to this value)
|
||||||
|
}
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
|
|
||||||
case 0x18: // swtrilgy and getbass. Remove IO board error on getbass. Not sure, but may be related to device feedback ?
|
case 0x18: // swtrilgy and getbass. Remove IO board error on getbass. Not sure, but may be related to device feedback ?
|
||||||
|
@ -3054,6 +3061,11 @@ bool CModel3::LoadGame(const Game &game, const ROMSet &rom_set)
|
||||||
else
|
else
|
||||||
DriveBoard.m_boardType = DriveBoard.Joystick;
|
DriveBoard.m_boardType = DriveBoard.Joystick;
|
||||||
}
|
}
|
||||||
|
else if (game.name == "skichamp")
|
||||||
|
{
|
||||||
|
DriveBoard.m_boardType = DriveBoard.SkiPad;
|
||||||
|
DriveBoard.Init(NULL); // no external driveboard rom for skichamp, we need to simulate it
|
||||||
|
}
|
||||||
else
|
else
|
||||||
DriveBoard.Init(NULL);
|
DriveBoard.Init(NULL);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue