Merge remote-tracking branch 'upstream/master'
This commit is contained in:
commit
cb166dc47f
5 changed files with 36 additions and 20 deletions
|
@ -701,7 +701,6 @@ void CpuIrqAssert(eIRQSRC Device)
|
|||
|
||||
void CpuIrqDeassert(eIRQSRC Device)
|
||||
{
|
||||
_ASSERT(g_bCritSectionValid);
|
||||
if (g_bCritSectionValid) EnterCriticalSection(&g_CriticalSection);
|
||||
g_bmIRQ &= ~(1<<Device);
|
||||
if (g_bCritSectionValid) LeaveCriticalSection(&g_CriticalSection);
|
||||
|
|
|
@ -272,11 +272,20 @@ static void StopTimer2(SY6522_AY8910* pMB)
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
static void ResetSY6522(SY6522_AY8910* pMB)
|
||||
static void SY6522_Write(BYTE nDevice, BYTE nReg, BYTE nValue);
|
||||
|
||||
static void ResetSY6522(SY6522_AY8910* pMB, const bool powerCycle)
|
||||
{
|
||||
memset(&pMB->sy6522,0,sizeof(SY6522));
|
||||
pMB->sy6522.TIMER1_LATCH.w = 0xffff; // Some random value (but pick $ffff so it's deterministic)
|
||||
// . NB. if it's too small (< ~$0007) then MB detection routines will fail!
|
||||
if (powerCycle)
|
||||
{
|
||||
memset(&pMB->sy6522,0,sizeof(SY6522));
|
||||
pMB->sy6522.TIMER1_LATCH.w = 0xffff; // Some random value (but pick $ffff so it's deterministic)
|
||||
// . NB. if it's too small (< ~$0007) then MB detection routines will fail!
|
||||
}
|
||||
|
||||
SY6522_Write(pMB->nAY8910Number, 0x0b, 0x00); // ACR = 0x00: T1 one-shot mode
|
||||
SY6522_Write(pMB->nAY8910Number, 0x0d, 0x7f); // IFR = 0x7F: de-assert any IRQs
|
||||
SY6522_Write(pMB->nAY8910Number, 0x0e, 0x7f); // IFE = 0x7F: disable all IRQs
|
||||
|
||||
StopTimer1(pMB);
|
||||
StopTimer2(pMB);
|
||||
|
@ -556,7 +565,6 @@ static void UpdateIFR(SY6522_AY8910* pMB, BYTE clr_ifr, BYTE set_ifr=0)
|
|||
{
|
||||
// Need critical section to avoid data-race: main thread & SSI263Thread can both access IFR
|
||||
// . NB. Loading a save-state just directly writes into 6522.IFR (which is fine)
|
||||
_ASSERT(g_bCritSectionValid);
|
||||
if (g_bCritSectionValid) EnterCriticalSection(&g_CriticalSection);
|
||||
{
|
||||
pMB->sy6522.IFR &= ~clr_ifr;
|
||||
|
@ -817,9 +825,13 @@ const BYTE AMPLITUDE_MASK = 0x0F;
|
|||
|
||||
#if LOG_SSI263B
|
||||
static int ssiRegs[5]={-1,-1,-1,-1,-1};
|
||||
static int totalDuration_ms = 0;
|
||||
|
||||
void SSI_Output(void)
|
||||
{
|
||||
int ssi0 = ssiRegs[SSI_DURPHON];
|
||||
int ssi2 = ssiRegs[SSI_RATEINF];
|
||||
|
||||
LogOutput("SSI: ");
|
||||
for (int i=0; i<=4; i++)
|
||||
{
|
||||
|
@ -828,6 +840,14 @@ void SSI_Output(void)
|
|||
LogOutput("%s ", r);
|
||||
ssiRegs[i] = -1;
|
||||
}
|
||||
|
||||
if (ssi0 != -1 && ssi2 != -1)
|
||||
{
|
||||
int phonemeDuration_ms = (((16-(ssi2>>4))*4096)/1023) * (4-(ssi0>>6));
|
||||
totalDuration_ms += phonemeDuration_ms;
|
||||
LogOutput("/ duration = %d (total = %d) ms", phonemeDuration_ms, totalDuration_ms);
|
||||
}
|
||||
|
||||
LogOutput("\n");
|
||||
}
|
||||
#endif
|
||||
|
@ -1726,7 +1746,7 @@ void MB_Initialize()
|
|||
g_bMBAvailable = MB_DSInit();
|
||||
LogFileOutput("MB_Initialize: MB_DSInit(), g_bMBAvailable=%d\n", g_bMBAvailable);
|
||||
|
||||
MB_Reset();
|
||||
MB_Reset(true);
|
||||
LogFileOutput("MB_Initialize: MB_Reset()\n");
|
||||
}
|
||||
|
||||
|
@ -1745,7 +1765,7 @@ static void MB_SetSoundcardType(SS_CARDTYPE NewSoundcardType);
|
|||
// . and voice will be demuted when dialog is closed
|
||||
void MB_InitializeForLoadingSnapshot() // GH#609
|
||||
{
|
||||
MB_Reset();
|
||||
MB_Reset(true);
|
||||
InitSoundcardType();
|
||||
|
||||
if (g_bDisableDirectSound || g_bDisableDirectSoundMockingboard)
|
||||
|
@ -1823,14 +1843,14 @@ static void ResetState()
|
|||
// g_bPhasorEnable = false;
|
||||
}
|
||||
|
||||
void MB_Reset() // CTRL+RESET or power-cycle
|
||||
void MB_Reset(const bool powerCycle) // CTRL+RESET or power-cycle
|
||||
{
|
||||
if(!g_bDSAvailable)
|
||||
if (!g_bDSAvailable)
|
||||
return;
|
||||
|
||||
for(int i=0; i<NUM_AY8910; i++)
|
||||
for (int i=0; i<NUM_AY8910; i++)
|
||||
{
|
||||
ResetSY6522(&g_MB[i]);
|
||||
ResetSY6522(&g_MB[i], powerCycle);
|
||||
AY8910_reset(i);
|
||||
}
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
void MB_Initialize();
|
||||
void MB_Reinitialize();
|
||||
void MB_Destroy();
|
||||
void MB_Reset();
|
||||
void MB_Reset(const bool powerCycle);
|
||||
void MB_InitializeForLoadingSnapshot(void);
|
||||
void MB_InitializeIO(LPBYTE pCxRomPeripheral, UINT uSlot4, UINT uSlot5);
|
||||
void MB_Mute();
|
||||
|
|
|
@ -540,7 +540,7 @@ void ResetMachineState()
|
|||
GetCardMgr().GetSSC()->CommReset();
|
||||
PrintReset();
|
||||
JoyReset();
|
||||
MB_Reset();
|
||||
MB_Reset(true);
|
||||
SpkrReset();
|
||||
if (GetCardMgr().IsMouseCardInstalled())
|
||||
GetCardMgr().GetMouseCard()->Reset();
|
||||
|
@ -585,7 +585,7 @@ void CtrlReset()
|
|||
KeybReset();
|
||||
if (GetCardMgr().IsSSCInstalled())
|
||||
GetCardMgr().GetSSC()->CommReset();
|
||||
MB_Reset();
|
||||
MB_Reset(false);
|
||||
if (GetCardMgr().IsMouseCardInstalled())
|
||||
GetCardMgr().GetMouseCard()->Reset(); // Deassert any pending IRQs - GH#514
|
||||
#ifdef USE_SPEECH_API
|
||||
|
|
|
@ -645,13 +645,10 @@ int APIENTRY WinMain(HINSTANCE passinstance, HINSTANCE, LPSTR lpCmdLine, int)
|
|||
{
|
||||
g_cmdLine.bSetFullScreen = g_bRestartFullScreen;
|
||||
g_bRestartFullScreen = false;
|
||||
}
|
||||
|
||||
MB_Reset();
|
||||
LogFileOutput("Main: MB_Reset()\n");
|
||||
MB_Reset(true);
|
||||
LogFileOutput("Main: MB_Reset()\n");
|
||||
|
||||
if (g_bRestart)
|
||||
{
|
||||
CMouseInterface* pMouseCard = GetCardMgr().GetMouseCard();
|
||||
if (pMouseCard)
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue