Skip to content

Commit

Permalink
puae: fix crash on switching to initially empty drive
Browse files Browse the repository at this point in the history
  • Loading branch information
vadosnaprimer committed Dec 11, 2024
1 parent 56e5105 commit b8ec340
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/BizHawk.Emulation.Cores/Computers/Amiga/PUAE.cs
Original file line number Diff line number Diff line change
Expand Up @@ -95,16 +95,20 @@ public PUAE(CoreLoadParameters<object, PUAESyncSettings> lp)
SkipMemoryConsistencyCheck = lp.Comm.CorePreferences.HasFlag(CoreComm.CorePreferencesFlags.WaterboxMemoryConsistencyCheck),
}, new Delegate[] { _ledCallback });

for (var index = 0; index < lp.Roms.Count; index++)
for (var index = 0; index < _syncSettings.FloppyDrives; index++)
{
var rom = lp.Roms[index];
_exe.AddReadonlyFile(rom.FileData, FileNames.FD + index);
if (index < _syncSettings.FloppyDrives)
if (index < lp.Roms.Count)
{
var rom = lp.Roms[index];
_exe.AddReadonlyFile(rom.FileData, FileNames.FD + index);
_drives.Add(GetFullName(rom));
AppendSetting($"floppy{index}={FileNames.FD}{index}");
AppendSetting($"floppy{index}type={(int)DriveType.DRV_35_DD}");
AppendSetting($"floppy{index}type={(int) DriveType.DRV_35_DD}");
AppendSetting("floppy_write_protect=true");
_drives.Add(GetFullName(rom));
}
else
{
_drives.Add("empty");
}
}

Expand Down

0 comments on commit b8ec340

Please sign in to comment.