mirror of
https://github.com/RetroDECK/Supermodel.git
synced 2025-04-10 19:15:14 +00:00
Driveboard changes:
- added notification message if drive board is disabled when loading incompatible save state - removed some superflous print statements, but have kept in printing out of force feedback commands for now (which have also been made more visual) - made sure that feedback state is reset in SendStopAll()
This commit is contained in:
parent
75d446c272
commit
e223d388eb
|
@ -156,8 +156,13 @@ void CDriveBoard::LoadState(CBlockFile *SaveState)
|
||||||
m_tmpDisabled = true;
|
m_tmpDisabled = true;
|
||||||
|
|
||||||
if (m_attached)
|
if (m_attached)
|
||||||
|
{
|
||||||
|
if (m_tmpDisabled)
|
||||||
|
printf("Disabled DriveBoard due to incompatible save state\n");
|
||||||
|
|
||||||
SendStopAll();
|
SendStopAll();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool CDriveBoard::Init(const UINT8 *romPtr)
|
bool CDriveBoard::Init(const UINT8 *romPtr)
|
||||||
{
|
{
|
||||||
|
@ -561,7 +566,7 @@ void CDriveBoard::ProcessEncoderCmd(void)
|
||||||
{
|
{
|
||||||
if (m_prev42Out != m_port42Out || m_prev46Out != m_port46Out)
|
if (m_prev42Out != m_port42Out || m_prev46Out != m_port46Out)
|
||||||
{
|
{
|
||||||
printf("46 [%02X] / 42 [%02X]\n", m_port46Out, m_port42Out);
|
//printf("46 [%02X] / 42 [%02X]\n", m_port46Out, m_port42Out);
|
||||||
switch (m_port46Out)
|
switch (m_port46Out)
|
||||||
{
|
{
|
||||||
case 0xFB:
|
case 0xFB:
|
||||||
|
@ -653,7 +658,7 @@ void CDriveBoard::ProcessEncoderCmd(void)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
printf("Unknown = 46 [%02X] / 42 [%02X]\n", m_port46Out, m_port42Out);
|
//printf("Unknown = 46 [%02X] / 42 [%02X]\n", m_port46Out, m_port42Out);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -669,6 +674,11 @@ void CDriveBoard::SendStopAll(void)
|
||||||
ForceFeedbackCmd ffCmd;
|
ForceFeedbackCmd ffCmd;
|
||||||
ffCmd.id = FFStop;
|
ffCmd.id = FFStop;
|
||||||
m_inputs->steering->SendForceFeedbackCmd(ffCmd);
|
m_inputs->steering->SendForceFeedbackCmd(ffCmd);
|
||||||
|
|
||||||
|
m_lastConstForce = 0;
|
||||||
|
m_lastSelfCenter = 0;
|
||||||
|
m_lastFriction = 0;
|
||||||
|
m_lastVibrate = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDriveBoard::SendConstantForce(INT8 val)
|
void CDriveBoard::SendConstantForce(INT8 val)
|
||||||
|
@ -676,22 +686,23 @@ void CDriveBoard::SendConstantForce(INT8 val)
|
||||||
if (val == m_lastConstForce)
|
if (val == m_lastConstForce)
|
||||||
return;
|
return;
|
||||||
if (val > 0)
|
if (val > 0)
|
||||||
printf(">> Constant Force Right %02X\n", val);
|
{
|
||||||
|
printf(">> Force Right %02X [%8s", val, "");
|
||||||
|
for (unsigned i = 0; i < 8; i++)
|
||||||
|
printf(i == 0 || i <= (val + 1) / 16 ? ">" : " ");
|
||||||
|
printf("]\n");
|
||||||
|
}
|
||||||
else if (val < 0)
|
else if (val < 0)
|
||||||
printf(">> Constant Force Left %02X\n", -val);
|
{
|
||||||
|
printf(">> Force Left %02X [", -val);
|
||||||
|
for (unsigned i = 0; i < 8; i++)
|
||||||
|
printf(i == 7 || i >= (val + 128) / 16 ? "<" : " ");
|
||||||
|
printf("%8s]\n", "");
|
||||||
|
}
|
||||||
else
|
else
|
||||||
printf(">> Stop Constant Force\n");
|
printf(">> Stop Force [%16s]\n", "");
|
||||||
|
|
||||||
ForceFeedbackCmd ffCmd;
|
ForceFeedbackCmd ffCmd;
|
||||||
|
|
||||||
// TODO - need to cancel other effects?
|
|
||||||
//ffCmd.id = FFSelfCenter;
|
|
||||||
//ffCmd.force = (val == 0.0 ? (float)m_lastSelfCenter / 255.0f : 0);
|
|
||||||
//m_inputs->steering->SendForceFeedbackCmd(ffCmd);
|
|
||||||
//ffCmd.id = FFVibrate;
|
|
||||||
//ffCmd.force = (val == 0.0 ? (float)m_lastFriction / 255.0f : 0);
|
|
||||||
//m_inputs->steering->SendForceFeedbackCmd(ffCmd);
|
|
||||||
|
|
||||||
ffCmd.id = FFConstantForce;
|
ffCmd.id = FFConstantForce;
|
||||||
ffCmd.force = (float)val / (val >= 0 ? 127.0f : 128.0f);
|
ffCmd.force = (float)val / (val >= 0 ? 127.0f : 128.0f);
|
||||||
m_inputs->steering->SendForceFeedbackCmd(ffCmd);
|
m_inputs->steering->SendForceFeedbackCmd(ffCmd);
|
||||||
|
@ -703,7 +714,10 @@ void CDriveBoard::SendSelfCenter(UINT8 val)
|
||||||
{
|
{
|
||||||
if (val == m_lastSelfCenter)
|
if (val == m_lastSelfCenter)
|
||||||
return;
|
return;
|
||||||
printf(">> Self center %02X\n", val);
|
if (val == 0)
|
||||||
|
printf(">> Stop Self-Center\n");
|
||||||
|
else
|
||||||
|
printf(">> Self-Center %02X\n", val);
|
||||||
|
|
||||||
ForceFeedbackCmd ffCmd;
|
ForceFeedbackCmd ffCmd;
|
||||||
ffCmd.id = FFSelfCenter;
|
ffCmd.id = FFSelfCenter;
|
||||||
|
@ -717,6 +731,9 @@ void CDriveBoard::SendFriction(UINT8 val)
|
||||||
{
|
{
|
||||||
if (val == m_lastFriction)
|
if (val == m_lastFriction)
|
||||||
return;
|
return;
|
||||||
|
if (val == 0)
|
||||||
|
printf(">> Stop Friction\n");
|
||||||
|
else
|
||||||
printf(">> Friction %02X\n", val);
|
printf(">> Friction %02X\n", val);
|
||||||
|
|
||||||
ForceFeedbackCmd ffCmd;
|
ForceFeedbackCmd ffCmd;
|
||||||
|
@ -731,6 +748,9 @@ void CDriveBoard::SendVibrate(UINT8 val)
|
||||||
{
|
{
|
||||||
if (val == m_lastVibrate)
|
if (val == m_lastVibrate)
|
||||||
return;
|
return;
|
||||||
|
if (val == 0)
|
||||||
|
printf(">> Stop Vibrate\n");
|
||||||
|
else
|
||||||
printf(">> Vibrate %02X\n", val);
|
printf(">> Vibrate %02X\n", val);
|
||||||
|
|
||||||
ForceFeedbackCmd ffCmd;
|
ForceFeedbackCmd ffCmd;
|
||||||
|
|
Loading…
Reference in a new issue