libretro / fuse-libretro

A port of the Fuse Unix Spectrum Emulator to libretro
GNU General Public License v3.0
36 stars 47 forks source link

Change default for TRDOS files to Pentagon 512K #59

Closed 2xtime closed 5 years ago

2xtime commented 5 years ago

Currently in lr-fuse you cannot change the Spectrum model without loading a file, so when loading a TR-DOS .scl or .trd it will always use Pentagon 128K mode. This means it will take you to the TR-DOS prompt and you have to manually list the disk contents to find the filename you want and then have to type RUN"filename". This can be a long and tiresome task particularly when only using a joypad !

The patch will change the default model to Pentagon 512K when loading .scl and .trd files. This enables the GLUCK menu system where you can simple press Enter/Space to list the disk contents and then press Enter/Space again to load the first file on the disk. Much easier when you only have a joypad, plus you can boot other files that are on the disk like demos etc.

You can also go back to the TR-DOS prompt by selecting 'trdos' in the menu, and reset to 48k basic mode or open the 128K menu all from the GLUCK menu system.

leiradel commented 5 years ago

Thanks, sounds like an useful change.

Could you check the return codes of machine_select, beta_disk_insert, and machine_reset, like the other code paths do?

2xtime commented 5 years ago

Sorry, I don't really understand what you're saying ! I manually compiled this change on the Raspberry Pi version of lr-fuse and it works fine.

leiradel commented 5 years ago

I mean you're calling these functions without checking if they're returning errors:

machine_select( LIBSPECTRUM_MACHINE_PENT512 );
beta_disk_insert( BETA_DRIVE_A, filename, autoload );
machine_reset( 1 );

These functions can return errors that should be checked, i.e. this is line 115 of the same file:

error = machine_select( LIBSPECTRUM_MACHINE_PLUS3 ); if( error ) break;
2xtime commented 5 years ago

The error check line was checking if the previously selected machine had a Beta128 device enabled (e.g. Scorpion), if yes then it could load the inserted disk and if not, then it would change the machine to Pentagon and then load the disk. You can't do this on lr-fuse because it won't change the machine type until content is loaded, so the patch boots straight into Pentagon 512K which has the Beta128 device (and GLUCK menu).

A few of those error check lines aren't really needed on lr-fuse because you can't change the machine type on the fly and so doesn't need to check what peripherals are activated. (Only needed for the regular version of FUSE).