modify SConstruct to handle target platform; fix track finish detect code
This commit is contained in:
parent
24fc28c8bd
commit
b38f99d7ce
|
@ -1353,12 +1353,16 @@ static void terminate_handler()
|
||||||
# inputs.
|
# inputs.
|
||||||
user_settings.max_axes_per_joystick = user_settings.max_buttons_per_joystick = user_settings.max_hats_per_joystick = 0
|
user_settings.max_axes_per_joystick = user_settings.max_buttons_per_joystick = user_settings.max_hats_per_joystick = 0
|
||||||
successflags['CPPDEFINES'] = CPPDEFINES = successflags.get('CPPDEFINES', [])[:]
|
successflags['CPPDEFINES'] = CPPDEFINES = successflags.get('CPPDEFINES', [])[:]
|
||||||
|
# use Redbook if at least one of the following applies
|
||||||
|
# 1. we are on SDL1
|
||||||
|
# 2. we are building for a platform for which we have a custom CD implementation (currently only win32)
|
||||||
|
use_redbook = int(not sdl2 or user_settings.host_platform == 'win32')
|
||||||
CPPDEFINES.extend((
|
CPPDEFINES.extend((
|
||||||
('DXX_MAX_JOYSTICKS', user_settings.max_joysticks),
|
('DXX_MAX_JOYSTICKS', user_settings.max_joysticks),
|
||||||
('DXX_MAX_AXES_PER_JOYSTICK', user_settings.max_axes_per_joystick),
|
('DXX_MAX_AXES_PER_JOYSTICK', user_settings.max_axes_per_joystick),
|
||||||
('DXX_MAX_BUTTONS_PER_JOYSTICK', user_settings.max_buttons_per_joystick),
|
('DXX_MAX_BUTTONS_PER_JOYSTICK', user_settings.max_buttons_per_joystick),
|
||||||
('DXX_MAX_HATS_PER_JOYSTICK', user_settings.max_hats_per_joystick),
|
('DXX_MAX_HATS_PER_JOYSTICK', user_settings.max_hats_per_joystick),
|
||||||
('DXX_USE_SDL_REDBOOK_AUDIO', int(not sdl2 or sys.platform in ['win32', 'msys'])), # there is a win32 rbaudio now
|
('DXX_USE_SDL_REDBOOK_AUDIO', use_redbook),
|
||||||
))
|
))
|
||||||
context.Display('%s: checking whether to enable joystick support...%s\n' % (self.msgprefix, 'yes' if user_settings.max_joysticks else 'no'))
|
context.Display('%s: checking whether to enable joystick support...%s\n' % (self.msgprefix, 'yes' if user_settings.max_joysticks else 'no'))
|
||||||
# SDL2 removed CD-rom support.
|
# SDL2 removed CD-rom support.
|
||||||
|
|
|
@ -93,6 +93,7 @@ static unsigned mci_GetTrackOffset(const int track)
|
||||||
Warning("RBAudio win32/MCI: cannot determine track %i offset (%lx)", track, mciError);
|
Warning("RBAudio win32/MCI: cannot determine track %i offset (%lx)", track, mciError);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
// dwReturn is a 32-bit value in MSF format, so DWORD_PTR > DWORD is not a problem
|
||||||
return mci_TotalFramesMsf(mciStatusParms.dwReturn);
|
return mci_TotalFramesMsf(mciStatusParms.dwReturn);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -108,6 +109,7 @@ static unsigned mci_GetTrackLength(const int track)
|
||||||
Warning("RBAudio win32/MCI: cannot determine track %i length (%lx)", track, mciError);
|
Warning("RBAudio win32/MCI: cannot determine track %i length (%lx)", track, mciError);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
// dwReturn is a 32-bit value in MSF format, so DWORD_PTR > DWORD is not a problem
|
||||||
return mci_TotalFramesMsf(mciStatusParms.dwReturn);
|
return mci_TotalFramesMsf(mciStatusParms.dwReturn);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -367,12 +369,13 @@ void RBACheckFinishedHook()
|
||||||
// and allow a bit of a leeway when checking if so.
|
// and allow a bit of a leeway when checking if so.
|
||||||
|
|
||||||
DWORD checkValue = playEnd;
|
DWORD checkValue = playEnd;
|
||||||
|
// dwReturn is a 32-bit value in MSF format, so DWORD_PTR > DWORD is not a problem
|
||||||
DWORD thisFrames = mci_TotalFramesMsf(mciStatusParms.dwReturn);
|
DWORD thisFrames = mci_TotalFramesMsf(mciStatusParms.dwReturn);
|
||||||
|
|
||||||
if (thisFrames == lastFrames)
|
if (thisFrames == lastFrames)
|
||||||
checkValue = checkValue < 64 ? 0 : checkValue - 64; // prevent underflow
|
checkValue = checkValue < 64 ? 0 : checkValue - 64; // prevent underflow
|
||||||
|
|
||||||
if (redbook_finished_hook && playEnd > 0 && lastFrames >= checkValue)
|
if (redbook_finished_hook && playEnd > 0 && thisFrames >= checkValue)
|
||||||
{
|
{
|
||||||
con_puts(CON_VERBOSE, "RBAudio win32/MCI: Playback done, calling finished-hook");
|
con_puts(CON_VERBOSE, "RBAudio win32/MCI: Playback done, calling finished-hook");
|
||||||
redbook_finished_hook();
|
redbook_finished_hook();
|
||||||
|
|
Loading…
Reference in a new issue