mirror of
https://github.com/AppleWin/AppleWin.git
synced 2024-06-13 02:29:40 +00:00
Cmd line: -m and -no-mb: fix crash
This commit is contained in:
parent
5792107dce
commit
d92eca5068
|
@ -1447,6 +1447,11 @@ void MB_InitializeForLoadingSnapshot() // GH#609
|
||||||
{
|
{
|
||||||
MB_Reset();
|
MB_Reset();
|
||||||
InitSoundcardType();
|
InitSoundcardType();
|
||||||
|
|
||||||
|
if (g_bDisableDirectSound || g_bDisableDirectSoundMockingboard)
|
||||||
|
return;
|
||||||
|
|
||||||
|
_ASSERT(MockingboardVoice.lpDSBvoice);
|
||||||
MockingboardVoice.lpDSBvoice->Stop(); // Reason: 'MB voice is playing' then loading a save-state where 'no MB present'
|
MockingboardVoice.lpDSBvoice->Stop(); // Reason: 'MB voice is playing' then loading a save-state where 'no MB present'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1701,6 +1706,9 @@ void MB_InitializeIO(LPBYTE pCxRomPeripheral, UINT uSlot4, UINT uSlot5)
|
||||||
|
|
||||||
MB_SetSoundcardType(g_Slot[4]);
|
MB_SetSoundcardType(g_Slot[4]);
|
||||||
|
|
||||||
|
if (g_bDisableDirectSound || g_bDisableDirectSoundMockingboard)
|
||||||
|
return;
|
||||||
|
|
||||||
// Sound buffer may have been stopped by MB_InitializeForLoadingSnapshot().
|
// Sound buffer may have been stopped by MB_InitializeForLoadingSnapshot().
|
||||||
// NB. DSZeroVoiceBuffer() also zeros the sound buffer, so it's better than directly calling IDirectSoundBuffer::Play():
|
// NB. DSZeroVoiceBuffer() also zeros the sound buffer, so it's better than directly calling IDirectSoundBuffer::Play():
|
||||||
// - without zeroing, then the previous sound buffer can be heard for a fraction of a second
|
// - without zeroing, then the previous sound buffer can be heard for a fraction of a second
|
||||||
|
|
|
@ -235,6 +235,7 @@ bool DSZeroVoiceBuffer(PVOICE Voice, char* pszDevName, DWORD dwBufferSize)
|
||||||
DWORD dwDSLockedBufferSize = 0; // Size of the locked DirectSound buffer
|
DWORD dwDSLockedBufferSize = 0; // Size of the locked DirectSound buffer
|
||||||
SHORT* pDSLockedBuffer;
|
SHORT* pDSLockedBuffer;
|
||||||
|
|
||||||
|
_ASSERT(Voice->lpDSBvoice);
|
||||||
HRESULT hr = Voice->lpDSBvoice->Stop();
|
HRESULT hr = Voice->lpDSBvoice->Stop();
|
||||||
if(FAILED(hr))
|
if(FAILED(hr))
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue
Block a user