puae: led light

This commit is contained in:
feos 2024-12-09 19:42:02 +03:00
parent 6f7a1de25c
commit 48913b4653
5 changed files with 25 additions and 8 deletions

Binary file not shown.

View File

@ -57,6 +57,9 @@ namespace BizHawk.Emulation.Cores.Computers.Amiga
[BizImport(CC, Compatibility = true)]
public abstract bool Init(int argc, string[] argv);
[BizImport(CC)]
public abstract void SetLEDCallback(EmptyCallback callback);
[StructLayout(LayoutKind.Sequential)]
public new class FrameInfo : LibWaterboxCore.FrameInfo
{

View File

@ -39,8 +39,9 @@ namespace BizHawk.Emulation.Cores.Computers.Amiga
DefaultFpsDenominator = LibPUAE.PUAE_VIDEO_DENOMINATOR_NTSC
};
private string _chipsetCompatible = "";
private readonly LibWaterboxCore.EmptyCallback _ledCallback;
private readonly List<IRomAsset> _roms;
private const int _messageDuration = 4;
private List<string> _args;
private List<string> _drives;
private int _currentDrive;
@ -50,11 +51,14 @@ namespace BizHawk.Emulation.Cores.Computers.Amiga
private bool _nextSlotPressed;
private bool _nextDrivePressed;
private int _correctedWidth;
private const int _messageDuration = 4;
private string _chipsetCompatible = "";
public override int VirtualWidth => _correctedWidth;
private string GetFullName(IRomAsset rom) => rom.Game.Name + rom.Extension;
public override int VirtualWidth => _correctedWidth;
private void LEDCallback()
{
DriveLightOn = true;
}
[CoreConstructor(VSystemID.Raw.Amiga)]
public PUAE(CoreLoadParameters<object, PUAESyncSettings> lp)
@ -71,10 +75,12 @@ namespace BizHawk.Emulation.Cores.Computers.Amiga
_syncSettings.ControllerPort2
];
_drives = new(_syncSettings.FloppyDrives);
DriveLightEnabled = _syncSettings.FloppyDrives > 0;
UpdateAspectRatio(_syncSettings);
CreateArguments(_syncSettings);
ControllerDefinition = CreateControllerDefinition(_syncSettings);
_ledCallback = LEDCallback;
var puae = PreInit<LibPUAE>(new WaterboxOptions
{
@ -86,7 +92,7 @@ namespace BizHawk.Emulation.Cores.Computers.Amiga
MmapHeapSizeKB = 20 * 1024,
SkipCoreConsistencyCheck = lp.Comm.CorePreferences.HasFlag(CoreComm.CorePreferencesFlags.WaterboxCoreConsistencyCheck),
SkipMemoryConsistencyCheck = lp.Comm.CorePreferences.HasFlag(CoreComm.CorePreferencesFlags.WaterboxMemoryConsistencyCheck),
});
}, new Delegate[] { _ledCallback });
for (var index = 0; index < lp.Roms.Count; index++)
{
@ -124,10 +130,13 @@ namespace BizHawk.Emulation.Cores.Computers.Amiga
}
PostInit();
puae.SetLEDCallback(_syncSettings.FloppyDrives > 0 ? _ledCallback : null);
}
protected override LibWaterboxCore.FrameInfo FrameAdvancePrep(IController controller, bool render, bool rendersound)
{
DriveLightOn = false;
var fi = new LibPUAE.FrameInfo
{
Port1 = new LibPUAE.ControllerState

View File

@ -135,8 +135,13 @@ ECL_EXPORT void GetMemoryAreas(MemoryArea *m)
m[2].Flags = MEMORYAREA_FLAGS_WORDSIZE1 | MEMORYAREA_FLAGS_WRITABLE;
}
void (*InputCallback)();
void (*LEDCallback)();
ECL_EXPORT void SetLEDCallback(void (*callback)())
{
LEDCallback = callback;
}
void (*InputCallback)();
ECL_EXPORT void SetInputCallback(void (*callback)())
{
InputCallback = callback;

@ -1 +1 @@
Subproject commit 4f86a8dd1b222c6bad65a892f79dafe444e40776
Subproject commit ccecb1ead642c1bbe391308b88a7ffa9478b918d