- Fixed drive board. Now determines whether it is attached and enabled in Reset().

This commit is contained in:
Bart Trzynadlowski 2011-09-08 17:58:25 +00:00
parent 11d1d61bc2
commit b76b43cc93
5 changed files with 24 additions and 15 deletions

View file

@ -470,6 +470,7 @@ void CDSB1::Reset(void)
volume = 0x7F; // full volume
usingLoopStart = 0;
// Even if DSB emulation is disabled, must reset to establish valid Z80 state
Z80.Reset();
DebugLog("DSB1 Reset\n");
}
@ -1023,6 +1024,7 @@ void CDSB2::Reset(void)
volume[0] = 0xFF; // set to max volume in case we miss the volume commands
volume[1] = 0xFF;
// Even if DSB emulation is disabled, must reset to establish valid Z80 state
M68KSetContext(&M68K);
M68KReset();
//printf("DSB2 PC=%06X\n", M68KGetPC());

View file

@ -123,7 +123,7 @@ bool CDriveBoard::Init(const UINT8 *romPtr)
m_rom = romPtr;
// Check have a valid ROM and force feedback is enabled
m_attached = m_rom && g_Config.forceFeedback;
m_attached = (m_rom != NULL);
if (!m_attached)
return OKAY;
@ -136,10 +136,6 @@ bool CDriveBoard::Init(const UINT8 *romPtr)
}
memset(m_ram, 0, RAM_SIZE);
// Configure options
m_simulated = g_Config.simulateDrvBoard;
SetSteeringStrength(g_Config.steeringStrength);
// Initialize Z80
m_z80.Init(this, NULL);
@ -185,8 +181,14 @@ void CDriveBoard::Reset(void)
m_lastFriction = 0;
m_lastVibrate = 0;
if (!m_simulated)
m_z80.Reset();
// Configure options (cannot be done in Init() because command line settings weren't yet parsed)
m_simulated = g_Config.simulateDrvBoard;
SetSteeringStrength(g_Config.steeringStrength);
m_z80.Reset(); // always reset to provide a valid Z80 state
if (!g_Config.forceFeedback)
m_attached = false;
}
UINT8 CDriveBoard::Read(void)

View file

@ -11,7 +11,7 @@
class CDriveBoardConfig
{
public:
bool forceFeedback; // Enable drive board emulation/simulation
bool forceFeedback; // Enable drive board emulation/simulation (read only during Reset(), cannot be changed in-game)
bool simulateDrvBoard; // Simulate drive board rather than emulating it
unsigned steeringStrength; // Setting for steering strength on DIP switches of drive board

View file

@ -233,6 +233,8 @@ public:
*
* Loads a complete ROM set from the specified ZIP archive.
*
* NOTE: Command line settings will not have been applied here yet.
*
* Parameters:
* GameList List of all supported games and their ROMs.
* zipFile ZIP file to load from.
@ -269,6 +271,8 @@ public:
* One-time initialization of the context. Must be called prior to all
* other members. Allocates memory and initializes device states.
*
* NOTE: Command line settings will not have been applied here yet.
*
* Returns:
* OKAY is successful, otherwise FAILED if a non-recoverable error
* occurred. Prints own error messages.

View file

@ -116,7 +116,7 @@ UINT8 CSoundBoard::Read8(UINT32 a)
return sampleBankHi[(a&0x1FFFFF)^1];
default:
printf("68K: Unknown read8 %06X\n", a);
//printf("68K: Unknown read8 %06X\n", a);
break;
}
@ -157,7 +157,7 @@ UINT16 CSoundBoard::Read16(UINT32 a)
return *(UINT16 *) &sampleBankHi[a&0x1FFFFF];
default:
printf("68K: Unknown read16 %06X\n", a);
//printf("68K: Unknown read16 %06X\n", a);
break;
}
@ -212,7 +212,7 @@ UINT32 CSoundBoard::Read32(UINT32 a)
return (hi<<16)|lo;
default:
printf("68K: Unknown read32 %06X\n", a);
//printf("68K: Unknown read32 %06X\n", a);
break;
}
@ -245,8 +245,8 @@ void CSoundBoard::Write8(unsigned int a,unsigned char d)
ctrlReg = d;
UpdateROMBanks();
}
else
printf("68K: Unknown write8 %06X=%02X\n", a, d);
//else
// printf("68K: Unknown write8 %06X=%02X\n", a, d);
break;
}
}
@ -272,7 +272,7 @@ void CSoundBoard::Write16(unsigned int a,unsigned short d)
break;
default:
printf("68K: Unknown write16 %06X=%04X\n", a, d);
//printf("68K: Unknown write16 %06X=%04X\n", a, d);
break;
}
}
@ -300,7 +300,7 @@ void CSoundBoard::Write32(unsigned int a,unsigned int d)
break;
default:
printf("68K: Unknown write32 %06X=%08X\n", a, d);
//printf("68K: Unknown write32 %06X=%08X\n", a, d);
break;
}
}
@ -397,6 +397,7 @@ void CSoundBoard::RunFrame(void)
void CSoundBoard::Reset(void)
{
// Even if SCSP emulation is disabled, we must reset to establish a valid 68K state
memcpy(ram1, soundROM, 16); // copy 68K vector table
ctrlReg = 0; // set default banks
UpdateROMBanks();