From: <sba...@us...> - 2023-07-19 17:46:28
|
This is an automated email from the git hooks/post-receive-user script. sbaldovi pushed a commit to branch patches-142-currah-uspeech in repository fuse. View the commit online: https://sourceforge.net/p/fuse-emulator/fuse/ci/a263ed4ddfc115476d21c25195c50eabd88f77cc/ commit a263ed4ddfc115476d21c25195c50eabd88f77cc Author: Vic Chwe <ch...@us...> AuthorDate: Wed Jul 19 19:06:27 2023 +0200 Enable snapshot support for Currah uSpeech --- peripherals/sound/uspeech.c | 36 +++++++++++++++++++++++++++++++++--- 1 file changed, 33 insertions(+), 3 deletions(-) diff --git a/peripherals/sound/uspeech.c b/peripherals/sound/uspeech.c index 9f334487..86a2d3f4 100644 --- a/peripherals/sound/uspeech.c +++ b/peripherals/sound/uspeech.c @@ -62,13 +62,17 @@ static libspectrum_byte uspeech_toggle_read( libspectrum_word port, static void uspeech_reset( int hard_reset ); static void uspeech_memory_map( void ); +static void uspeech_enabled_snapshot( libspectrum_snap *snap ); +static void uspeech_from_snapshot( libspectrum_snap *snap ); +static void uspeech_to_snapshot( libspectrum_snap *snap ); + static module_info_t uspeech_module_info = { uspeech_reset, uspeech_memory_map, - NULL, /* enabled_snapshot */ - NULL, /* from_snapshot */ - NULL, /* to_snapshot */ + uspeech_enabled_snapshot, + uspeech_from_snapshot, + uspeech_to_snapshot, }; @@ -307,3 +311,29 @@ uspeech_unittest( void ) return r; } + +static void +uspeech_enabled_snapshot( libspectrum_snap *snap ) +{ + settings_current.uspeech = libspectrum_snap_uspeech_active( snap ); +} + +static void +uspeech_from_snapshot( libspectrum_snap *snap ) +{ + if( !libspectrum_snap_uspeech_active( snap ) ) return; + + if( libspectrum_snap_uspeech_paged( snap ) ) { + uspeech_active = 0; /* Will be toggled to active next */ + uspeech_toggle(); + } +} + +static void +uspeech_to_snapshot( libspectrum_snap *snap ) +{ + if( !periph_is_active( PERIPH_TYPE_USPEECH ) ) return; + + libspectrum_snap_set_uspeech_active( snap, 1 ); + libspectrum_snap_set_uspeech_paged ( snap, uspeech_active ); +} |