From 02ecb0ad24e3de855020fbec2d38647b8f63ef72 Mon Sep 17 00:00:00 2001 From: Asnivor Date: Thu, 5 Sep 2024 15:13:35 +0100 Subject: [PATCH] Enhance the IDriveLight interface so that custom tooltip text can be displayed --- src/BizHawk.Client.EmuHawk/MainForm.cs | 1 + .../Interfaces/Services/IDriveLight.cs | 5 +++++ .../Calculators/Emu83/Emu83.IDriveLight.cs | 2 ++ .../Computers/AmstradCPC/AmstradCPC.cs | 2 ++ src/BizHawk.Emulation.Cores/Computers/AppleII/AppleII.cs | 2 ++ .../Computers/Commodore64/C64.IDriveLight.cs | 2 ++ .../Computers/Commodore64/Cartridge/CartridgeDevice.cs | 2 ++ .../Computers/Commodore64/Cartridge/CartridgePort.cs | 2 ++ .../Computers/Commodore64/Serial/SerialPort.cs | 2 ++ .../Computers/SinclairSpectrum/ZXSpectrum.cs | 2 ++ .../Consoles/Atari/jaguar/VirtualJaguar.cs | 2 ++ .../Consoles/Fairchild/ChannelF/ChannelF.cs | 2 ++ .../Consoles/Nintendo/NES/NES.IDriveLight.cs | 2 ++ .../Consoles/PC Engine/PCEngine.IDriveLight.cs | 2 ++ .../Consoles/Sega/PicoDrive/PicoDrive.cs | 2 ++ .../Consoles/Sega/gpgx64/GPGX.IDriveLight.cs | 2 ++ src/BizHawk.Emulation.Cores/Consoles/Sony/PSX/Octoshock.cs | 1 + src/BizHawk.Emulation.Cores/Waterbox/NymaCore.Cd.cs | 2 ++ 18 files changed, 37 insertions(+) diff --git a/src/BizHawk.Client.EmuHawk/MainForm.cs b/src/BizHawk.Client.EmuHawk/MainForm.cs index 3c9e80bdd6..c717b774a8 100644 --- a/src/BizHawk.Client.EmuHawk/MainForm.cs +++ b/src/BizHawk.Client.EmuHawk/MainForm.cs @@ -2679,6 +2679,7 @@ namespace BizHawk.Client.EmuHawk if (Emulator.HasDriveLight() && Emulator.AsDriveLight() is { DriveLightEnabled: true } diskLEDCore) { LedLightStatusLabel.Image = diskLEDCore.DriveLightOn ? _statusBarDiskLightOnImage : _statusBarDiskLightOffImage; + LedLightStatusLabel.ToolTipText = Emulator.AsDriveLight().DriveLightIconDescription; LedLightStatusLabel.Visible = true; } else diff --git a/src/BizHawk.Emulation.Common/Interfaces/Services/IDriveLight.cs b/src/BizHawk.Emulation.Common/Interfaces/Services/IDriveLight.cs index 122e414589..766d54ee2f 100644 --- a/src/BizHawk.Emulation.Common/Interfaces/Services/IDriveLight.cs +++ b/src/BizHawk.Emulation.Common/Interfaces/Services/IDriveLight.cs @@ -15,5 +15,10 @@ /// Gets a value indicating whether the light is currently lit /// bool DriveLightOn { get; } + + /// + /// Gets a value indicating the description of the drive light icon (that will be displayed as a ToolTip on MainForm + /// + string DriveLightIconDescription { get; } } } diff --git a/src/BizHawk.Emulation.Cores/Calculators/Emu83/Emu83.IDriveLight.cs b/src/BizHawk.Emulation.Cores/Calculators/Emu83/Emu83.IDriveLight.cs index 5789c458ce..0873167762 100644 --- a/src/BizHawk.Emulation.Cores/Calculators/Emu83/Emu83.IDriveLight.cs +++ b/src/BizHawk.Emulation.Cores/Calculators/Emu83/Emu83.IDriveLight.cs @@ -6,5 +6,7 @@ namespace BizHawk.Emulation.Cores.Calculators.Emu83 { public bool DriveLightEnabled => true; public bool DriveLightOn => LibEmu83.TI83_GetLinkActive(Context); + + public string DriveLightIconDescription => "Link Activity"; } } diff --git a/src/BizHawk.Emulation.Cores/Computers/AmstradCPC/AmstradCPC.cs b/src/BizHawk.Emulation.Cores/Computers/AmstradCPC/AmstradCPC.cs index 7088179efc..dbb170e68e 100644 --- a/src/BizHawk.Emulation.Cores/Computers/AmstradCPC/AmstradCPC.cs +++ b/src/BizHawk.Emulation.Cores/Computers/AmstradCPC/AmstradCPC.cs @@ -189,5 +189,7 @@ namespace BizHawk.Emulation.Cores.Computers.AmstradCPC public bool DriveLightOn => (_machine?.TapeDevice != null && _machine.TapeDevice.TapeIsPlaying) || (_machine?.UPDDiskDevice != null && _machine.UPDDiskDevice.DriveLight); + + public string DriveLightIconDescription => "Disc Drive Activity"; } } diff --git a/src/BizHawk.Emulation.Cores/Computers/AppleII/AppleII.cs b/src/BizHawk.Emulation.Cores/Computers/AppleII/AppleII.cs index 529ba05084..e90b8ef0c6 100644 --- a/src/BizHawk.Emulation.Cores/Computers/AppleII/AppleII.cs +++ b/src/BizHawk.Emulation.Cores/Computers/AppleII/AppleII.cs @@ -130,6 +130,8 @@ namespace BizHawk.Emulation.Cores.Computers.AppleII public bool DriveLightEnabled => true; public bool DriveLightOn => _machine.DiskIIController.DriveLight; + public string DriveLightIconDescription => "Disk Drive Activity LED"; + private bool _nextPressed; private bool _prevPressed; diff --git a/src/BizHawk.Emulation.Cores/Computers/Commodore64/C64.IDriveLight.cs b/src/BizHawk.Emulation.Cores/Computers/Commodore64/C64.IDriveLight.cs index 7a20bdd9a5..d3335e6950 100644 --- a/src/BizHawk.Emulation.Cores/Computers/Commodore64/C64.IDriveLight.cs +++ b/src/BizHawk.Emulation.Cores/Computers/Commodore64/C64.IDriveLight.cs @@ -6,5 +6,7 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64 { public bool DriveLightEnabled => _board != null && (_board.CartPort.DriveLightEnabled || _board.Serial.DriveLightEnabled); public bool DriveLightOn => _board != null && (_board.CartPort.DriveLightOn || _board.Serial.DriveLightOn); + + public string DriveLightIconDescription => "Cart or Disk Activity LED"; } } diff --git a/src/BizHawk.Emulation.Cores/Computers/Commodore64/Cartridge/CartridgeDevice.cs b/src/BizHawk.Emulation.Cores/Computers/Commodore64/Cartridge/CartridgeDevice.cs index 97aefdca09..693dfc36a8 100644 --- a/src/BizHawk.Emulation.Cores/Computers/Commodore64/Cartridge/CartridgeDevice.cs +++ b/src/BizHawk.Emulation.Cores/Computers/Commodore64/Cartridge/CartridgeDevice.cs @@ -270,5 +270,7 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64.Cartridge get => _driveLightOn; protected set => _driveLightOn = value; } + + public string DriveLightIconDescription => "Cart Activity"; } } diff --git a/src/BizHawk.Emulation.Cores/Computers/Commodore64/Cartridge/CartridgePort.cs b/src/BizHawk.Emulation.Cores/Computers/Commodore64/Cartridge/CartridgePort.cs index 0c2163df5f..8c1e0c27e3 100644 --- a/src/BizHawk.Emulation.Cores/Computers/Commodore64/Cartridge/CartridgePort.cs +++ b/src/BizHawk.Emulation.Cores/Computers/Commodore64/Cartridge/CartridgePort.cs @@ -135,5 +135,7 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64.Cartridge public bool DriveLightEnabled => _connected && _cartridgeDevice.DriveLightEnabled; public bool DriveLightOn => _connected && _cartridgeDevice.DriveLightOn; + + public string DriveLightIconDescription => "Cart Activity"; } } diff --git a/src/BizHawk.Emulation.Cores/Computers/Commodore64/Serial/SerialPort.cs b/src/BizHawk.Emulation.Cores/Computers/Commodore64/Serial/SerialPort.cs index 352c0bfbd4..c845f80e2a 100644 --- a/src/BizHawk.Emulation.Cores/Computers/Commodore64/Serial/SerialPort.cs +++ b/src/BizHawk.Emulation.Cores/Computers/Commodore64/Serial/SerialPort.cs @@ -75,5 +75,7 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64.Serial public bool DriveLightEnabled => true; public bool DriveLightOn => ReadDeviceLight(); public bool IsConnected => _connected; + + public string DriveLightIconDescription => "Serial Activity"; } } diff --git a/src/BizHawk.Emulation.Cores/Computers/SinclairSpectrum/ZXSpectrum.cs b/src/BizHawk.Emulation.Cores/Computers/SinclairSpectrum/ZXSpectrum.cs index e30a19c7fb..9795d4d9be 100644 --- a/src/BizHawk.Emulation.Cores/Computers/SinclairSpectrum/ZXSpectrum.cs +++ b/src/BizHawk.Emulation.Cores/Computers/SinclairSpectrum/ZXSpectrum.cs @@ -280,5 +280,7 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum public bool DriveLightOn => _machine?.TapeDevice?.TapeIsPlaying == true || _machine?.UPDDiskDevice?.DriveLight == true; + + public string DriveLightIconDescription => "Disc Drive Activity"; } } diff --git a/src/BizHawk.Emulation.Cores/Consoles/Atari/jaguar/VirtualJaguar.cs b/src/BizHawk.Emulation.Cores/Consoles/Atari/jaguar/VirtualJaguar.cs index 735920f814..edd0072b0d 100644 --- a/src/BizHawk.Emulation.Cores/Consoles/Atari/jaguar/VirtualJaguar.cs +++ b/src/BizHawk.Emulation.Cores/Consoles/Atari/jaguar/VirtualJaguar.cs @@ -243,6 +243,8 @@ namespace BizHawk.Emulation.Cores.Atari.Jaguar public bool DriveLightEnabled => IsJaguarCD; public bool DriveLightOn { get; private set; } + public string DriveLightIconDescription => "CD Drive Activity"; + private readonly LibVirtualJaguar.CDTOCCallback _cdTocCallback; private readonly LibVirtualJaguar.CDReadCallback _cdReadCallback; diff --git a/src/BizHawk.Emulation.Cores/Consoles/Fairchild/ChannelF/ChannelF.cs b/src/BizHawk.Emulation.Cores/Consoles/Fairchild/ChannelF/ChannelF.cs index f15b103b96..789d71f0f4 100644 --- a/src/BizHawk.Emulation.Cores/Consoles/Fairchild/ChannelF/ChannelF.cs +++ b/src/BizHawk.Emulation.Cores/Consoles/Fairchild/ChannelF/ChannelF.cs @@ -80,5 +80,7 @@ namespace BizHawk.Emulation.Cores.Consoles.ChannelF public bool DriveLightEnabled => Cartridge.HasActivityLED; public bool DriveLightOn => Cartridge.ActivityLED; + + public string DriveLightIconDescription => "Computer thinking activity"; } } diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/NES.IDriveLight.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/NES.IDriveLight.cs index f3068a795c..f80b414e94 100644 --- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/NES.IDriveLight.cs +++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/NES.IDriveLight.cs @@ -7,5 +7,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES public bool DriveLightEnabled { get; } public bool DriveLightOn { get; private set; } + + public string DriveLightIconDescription => "Disk Drive Activity"; } } diff --git a/src/BizHawk.Emulation.Cores/Consoles/PC Engine/PCEngine.IDriveLight.cs b/src/BizHawk.Emulation.Cores/Consoles/PC Engine/PCEngine.IDriveLight.cs index fb9a2ec739..6579569125 100644 --- a/src/BizHawk.Emulation.Cores/Consoles/PC Engine/PCEngine.IDriveLight.cs +++ b/src/BizHawk.Emulation.Cores/Consoles/PC Engine/PCEngine.IDriveLight.cs @@ -7,5 +7,7 @@ namespace BizHawk.Emulation.Cores.PCEngine public bool DriveLightEnabled { get; } = true; public bool DriveLightOn { get; internal set; } + + public string DriveLightIconDescription => "CD Drive Activity"; } } diff --git a/src/BizHawk.Emulation.Cores/Consoles/Sega/PicoDrive/PicoDrive.cs b/src/BizHawk.Emulation.Cores/Consoles/Sega/PicoDrive/PicoDrive.cs index 7ea7b48855..081e6ce71f 100644 --- a/src/BizHawk.Emulation.Cores/Consoles/Sega/PicoDrive/PicoDrive.cs +++ b/src/BizHawk.Emulation.Cores/Consoles/Sega/PicoDrive/PicoDrive.cs @@ -281,6 +281,8 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.PicoDrive public bool DriveLightEnabled { get; } public bool DriveLightOn { get; private set; } + public string DriveLightIconDescription => "CD Drive Activity"; + public DisplayType Region => _isPal ? DisplayType.PAL : DisplayType.NTSC; } } diff --git a/src/BizHawk.Emulation.Cores/Consoles/Sega/gpgx64/GPGX.IDriveLight.cs b/src/BizHawk.Emulation.Cores/Consoles/Sega/gpgx64/GPGX.IDriveLight.cs index ed2b66b178..db35e96041 100644 --- a/src/BizHawk.Emulation.Cores/Consoles/Sega/gpgx64/GPGX.IDriveLight.cs +++ b/src/BizHawk.Emulation.Cores/Consoles/Sega/gpgx64/GPGX.IDriveLight.cs @@ -7,6 +7,8 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.gpgx public bool DriveLightEnabled { get; } public bool DriveLightOn { get; private set; } + public string DriveLightIconDescription => "CD Drive Activity"; + private bool _driveLight; } } diff --git a/src/BizHawk.Emulation.Cores/Consoles/Sony/PSX/Octoshock.cs b/src/BizHawk.Emulation.Cores/Consoles/Sony/PSX/Octoshock.cs index c63abf5bf5..31a8c88ade 100644 --- a/src/BizHawk.Emulation.Cores/Consoles/Sony/PSX/Octoshock.cs +++ b/src/BizHawk.Emulation.Cores/Consoles/Sony/PSX/Octoshock.cs @@ -453,6 +453,7 @@ namespace BizHawk.Emulation.Cores.Sony.PSX public bool DriveLightEnabled { get; private set; } public bool DriveLightOn { get; private set; } + public string DriveLightIconDescription => "CD Drive Activity"; private void Attach() { diff --git a/src/BizHawk.Emulation.Cores/Waterbox/NymaCore.Cd.cs b/src/BizHawk.Emulation.Cores/Waterbox/NymaCore.Cd.cs index 56d0e7a150..489d94e67f 100644 --- a/src/BizHawk.Emulation.Cores/Waterbox/NymaCore.Cd.cs +++ b/src/BizHawk.Emulation.Cores/Waterbox/NymaCore.Cd.cs @@ -47,5 +47,7 @@ namespace BizHawk.Emulation.Cores.Waterbox public bool DriveLightEnabled => _disks?.Length > 0; public bool DriveLightOn { get; private set; } + + public string DriveLightIconDescription => "CD Drive Activity"; } }