Fix MAX VOLUME bug when doubling-clicking a .dsk image to execute with AppleWin

Fix support for 141KB .dsk images (introduced when supporting 160KB .dsks)
This commit is contained in:
tomch 2009-04-20 21:53:20 +00:00
parent 957c7cbf5d
commit c9177ed1ae
4 changed files with 20 additions and 2 deletions

View File

@ -435,9 +435,9 @@ static bool IsValidImageSize(DWORD uImageSize)
bool bValidSize = false;
if (uImageSize >= TRACKS_STANDARD*TRACK_DENIBBLIZED_SIZE)
if (uImageSize >= (TRACKS_STANDARD+1)*TRACK_DENIBBLIZED_SIZE)
{
// Is uImageSize == 140KB + n*4K?
// Is uImageSize == 140KB + n*4K? (where n>=1)
bValidSize = (((uImageSize - TRACKS_STANDARD*TRACK_DENIBBLIZED_SIZE) % TRACK_DENIBBLIZED_SIZE) == 0);
}
else

View File

@ -711,6 +711,8 @@ LRESULT CALLBACK FrameWndProc (
if (!g_bIsFullScreen)
DrawButton((HDC)0,BTN_DRIVE1);
SetForegroundWindow(window);
Sleep(500); // Wait for SetForegroundWindow() to take affect (400ms seems OK, so use 500ms to be sure)
SoundCore_TweakVolumes();
ProcessButtonClick(BTN_RUN);
}
else

View File

@ -421,6 +421,7 @@ void SoundCore_SetFade(eFADE FadeType)
{
// Note: Kludge for fading speaker if curr/last g_nAppMode is/was MODE_LOGO:
// . Bug in DirectSound? SpeakerVoice.lpDSBvoice->SetVolume() doesn't work without this!
// . See SoundCore_TweakVolumes() - could be this?
if((g_pVoices[i]->bIsSpeaker) && (g_nAppMode != MODE_LOGO) && (nLastMode != MODE_LOGO))
{
g_pVoices[i]->lpDSBvoice->GetVolume(&g_pVoices[i]->nFadeVolume);
@ -454,6 +455,20 @@ void SoundCore_SetFade(eFADE FadeType)
//-----------------------------------------------------------------------------
// If AppleWin started by double-clicking a .dsk, the our window won't have focus when volumes are set (so gets ignored).
// Subsequent setting (to the same volume) will get ignores, as DirectSound thinks that volume is already set.
void SoundCore_TweakVolumes()
{
for (UINT i=0; i<g_uNumVoices; i++)
{
g_pVoices[i]->lpDSBvoice->SetVolume(g_pVoices[i]->nVolume-1);
g_pVoices[i]->lpDSBvoice->SetVolume(g_pVoices[i]->nVolume);
}
}
//-----------------------------------------------------------------------------
static UINT g_uDSInitRefCount = 0;
bool DSInit()

View File

@ -33,6 +33,7 @@ bool DSZeroVoiceWritableBuffer(PVOICE Voice, char* pszDevName, DWORD dwBufferSiz
enum eFADE {FADE_NONE, FADE_IN, FADE_OUT};
void SoundCore_SetFade(eFADE FadeType);
bool SoundCore_GetTimerState();
void SoundCore_TweakVolumes();
bool DSInit();
void DSUninit();