Skip to content

Commit

Permalink
puae: led light
Browse files Browse the repository at this point in the history
  • Loading branch information
vadosnaprimer committed Dec 9, 2024
1 parent 6f7a1de commit 48913b4
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 8 deletions.
Binary file modified Assets/dll/puae.wbx.zst
Binary file not shown.
3 changes: 3 additions & 0 deletions src/BizHawk.Emulation.Cores/Computers/Amiga/LibPUAE.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ public abstract class LibPUAE : LibWaterboxCore
[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
{
Expand Down
21 changes: 15 additions & 6 deletions src/BizHawk.Emulation.Cores/Computers/Amiga/PUAE.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,10 @@ public partial class PUAE : WaterboxCore
DefaultFpsNumerator = LibPUAE.PUAE_VIDEO_NUMERATOR_NTSC,
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;
Expand All @@ -50,11 +51,14 @@ public partial class PUAE : WaterboxCore
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;

Check failure on line 60 in src/BizHawk.Emulation.Cores/Computers/Amiga/PUAE.cs

View workflow job for this annotation

GitHub Actions / Build solution with analyzers

The name 'DriveLightOn' does not exist in the current context

Check failure on line 60 in src/BizHawk.Emulation.Cores/Computers/Amiga/PUAE.cs

View workflow job for this annotation

GitHub Actions / Build and package output

The name 'DriveLightOn' does not exist in the current context

Check failure on line 60 in src/BizHawk.Emulation.Cores/Computers/Amiga/PUAE.cs

View workflow job for this annotation

GitHub Actions / Test (Windows, windows-latest)

The name 'DriveLightOn' does not exist in the current context
}

[CoreConstructor(VSystemID.Raw.Amiga)]
public PUAE(CoreLoadParameters<object, PUAESyncSettings> lp)
Expand All @@ -71,10 +75,12 @@ public PUAE(CoreLoadParameters<object, PUAESyncSettings> lp)
_syncSettings.ControllerPort2
];
_drives = new(_syncSettings.FloppyDrives);
DriveLightEnabled = _syncSettings.FloppyDrives > 0;

Check failure on line 78 in src/BizHawk.Emulation.Cores/Computers/Amiga/PUAE.cs

View workflow job for this annotation

GitHub Actions / Build solution with analyzers

The name 'DriveLightEnabled' does not exist in the current context

Check failure on line 78 in src/BizHawk.Emulation.Cores/Computers/Amiga/PUAE.cs

View workflow job for this annotation

GitHub Actions / Build and package output

The name 'DriveLightEnabled' does not exist in the current context

Check failure on line 78 in src/BizHawk.Emulation.Cores/Computers/Amiga/PUAE.cs

View workflow job for this annotation

GitHub Actions / Test (Windows, windows-latest)

The name 'DriveLightEnabled' does not exist in the current context

UpdateAspectRatio(_syncSettings);
CreateArguments(_syncSettings);
ControllerDefinition = CreateControllerDefinition(_syncSettings);
_ledCallback = LEDCallback;

var puae = PreInit<LibPUAE>(new WaterboxOptions
{
Expand All @@ -86,7 +92,7 @@ public PUAE(CoreLoadParameters<object, PUAESyncSettings> lp)
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++)
{
Expand Down Expand Up @@ -124,10 +130,13 @@ public PUAE(CoreLoadParameters<object, PUAESyncSettings> lp)
}

PostInit();

puae.SetLEDCallback(_syncSettings.FloppyDrives > 0 ? _ledCallback : null);
}

protected override LibWaterboxCore.FrameInfo FrameAdvancePrep(IController controller, bool render, bool rendersound)
{
DriveLightOn = false;

Check failure on line 139 in src/BizHawk.Emulation.Cores/Computers/Amiga/PUAE.cs

View workflow job for this annotation

GitHub Actions / Build solution with analyzers

The name 'DriveLightOn' does not exist in the current context

Check failure on line 139 in src/BizHawk.Emulation.Cores/Computers/Amiga/PUAE.cs

View workflow job for this annotation

GitHub Actions / Build and package output

The name 'DriveLightOn' does not exist in the current context

Check failure on line 139 in src/BizHawk.Emulation.Cores/Computers/Amiga/PUAE.cs

View workflow job for this annotation

GitHub Actions / Test (Windows, windows-latest)

The name 'DriveLightOn' does not exist in the current context
var fi = new LibPUAE.FrameInfo
{
Port1 = new LibPUAE.ControllerState
Expand Down
7 changes: 6 additions & 1 deletion waterbox/uae/bizhawk.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion waterbox/uae/libretro-uae
Submodule libretro-uae updated 1 files
+3 −0 retrodep/gui.c

0 comments on commit 48913b4

Please sign in to comment.