Fix `[RequiredService]`s checked for `null`
This commit is contained in:
parent
5f77a310c5
commit
59562d8930
|
@ -54,7 +54,10 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
|
||||
[RequiredService]
|
||||
private ICodeDataLogger CodeDataLogger { get; set; }
|
||||
public ICodeDataLogger/*?*/ _cdlCore { get; set; }
|
||||
|
||||
private ICodeDataLogger CodeDataLogger
|
||||
=> _cdlCore!;
|
||||
|
||||
private string _currentFilename;
|
||||
private CodeDataLog _cdl;
|
||||
|
@ -458,7 +461,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
private void ShutdownCDL()
|
||||
{
|
||||
_cdl = null;
|
||||
CodeDataLogger?.SetCDL(null);
|
||||
CodeDataLogger.SetCDL(null);
|
||||
}
|
||||
|
||||
protected override void OnClosing(System.ComponentModel.CancelEventArgs e)
|
||||
|
@ -479,9 +482,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
|
||||
protected override void OnClosed(EventArgs e)
|
||||
{
|
||||
CodeDataLogger?.SetCDL(null);
|
||||
}
|
||||
=> CodeDataLogger.SetCDL(null);
|
||||
|
||||
private void CDL_Load(object sender, EventArgs e)
|
||||
{
|
||||
|
|
|
@ -17,7 +17,10 @@ namespace BizHawk.Client.EmuHawk
|
|||
=> Properties.Resources.GambatteIcon;
|
||||
|
||||
[RequiredService]
|
||||
public IGameboyCommon Gb { get; private set; }
|
||||
public IGameboyCommon/*?*/ _gbCore { get; set; }
|
||||
|
||||
private IGameboyCommon Gb
|
||||
=> _gbCore!;
|
||||
|
||||
// TODO: freeze semantics are a bit weird: details for a mouseover or freeze are taken from the current
|
||||
// state, not the state at the last callback (and so can be quite different when update is set to manual).
|
||||
|
@ -560,9 +563,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
|
||||
private void GbGpuView_FormClosed(object sender, FormClosedEventArgs e)
|
||||
{
|
||||
Gb?.SetScanlineCallback(null, 0);
|
||||
}
|
||||
=> _gbCore?.SetScanlineCallback(null, 0);
|
||||
|
||||
private void radioButtonRefreshFrame_CheckedChanged(object sender, EventArgs e) { ComputeRefreshValues(); }
|
||||
private void radioButtonRefreshScanline_CheckedChanged(object sender, EventArgs e) { ComputeRefreshValues(); }
|
||||
|
@ -619,29 +620,17 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (Gb != null)
|
||||
if (!Visible)
|
||||
{
|
||||
if (!Visible)
|
||||
{
|
||||
if (_cbScanlineEmu != -2)
|
||||
{
|
||||
_cbScanlineEmu = -2;
|
||||
Gb.SetScanlineCallback(null, 0);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_cbScanline != _cbScanlineEmu)
|
||||
{
|
||||
_cbScanlineEmu = _cbScanline;
|
||||
if (_cbScanline == -2)
|
||||
Gb.SetScanlineCallback(null, 0);
|
||||
else
|
||||
Gb.SetScanlineCallback(ScanlineCallback, _cbScanline);
|
||||
}
|
||||
}
|
||||
if (_cbScanlineEmu is -2) return;
|
||||
_cbScanlineEmu = -2;
|
||||
Gb.SetScanlineCallback(null, 0);
|
||||
return;
|
||||
}
|
||||
if (_cbScanline == _cbScanlineEmu) return;
|
||||
_cbScanlineEmu = _cbScanline;
|
||||
if (_cbScanline is -2) Gb.SetScanlineCallback(null, 0);
|
||||
else Gb.SetScanlineCallback(ScanlineCallback, _cbScanline);
|
||||
}
|
||||
|
||||
private string _freezeLabel;
|
||||
|
|
|
@ -22,7 +22,10 @@ namespace BizHawk.Client.EmuHawk
|
|||
private readonly ColorMatrix _paperAdjustment;
|
||||
|
||||
[RequiredService]
|
||||
public IGameboyCommon Gb { get; private set; }
|
||||
public IGameboyCommon/*?*/ _gbCore { get; set; }
|
||||
|
||||
private IGameboyCommon Gb
|
||||
=> _gbCore!;
|
||||
|
||||
[RequiredService]
|
||||
public IEmulator Emulator { get; set; }
|
||||
|
@ -57,9 +60,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
|
||||
private void GBPrinterView_FormClosed(object sender, FormClosedEventArgs e)
|
||||
{
|
||||
Gb?.SetPrinterCallback(null);
|
||||
}
|
||||
=> Gb.SetPrinterCallback(null);
|
||||
|
||||
public override void Restart()
|
||||
{
|
||||
|
|
|
@ -18,7 +18,10 @@ namespace BizHawk.Client.EmuHawk
|
|||
=> Properties.Resources.GbaIcon.Value;
|
||||
|
||||
[RequiredService]
|
||||
private IGBAGPUViewable GBA { get; set; }
|
||||
public IGBAGPUViewable/*?*/ _gbaCore { get; set; }
|
||||
|
||||
private IGBAGPUViewable GBA
|
||||
=> _gbaCore!;
|
||||
|
||||
// emulator memory areas
|
||||
private IntPtr _vram;
|
||||
|
@ -797,9 +800,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
|
||||
private void GbaGpuView_FormClosed(object sender, FormClosedEventArgs e)
|
||||
{
|
||||
GBA?.SetScanlineCallback(null, 0);
|
||||
}
|
||||
=> GBA.SetScanlineCallback(null, 0);
|
||||
|
||||
private void timerMessage_Tick(object sender, EventArgs e)
|
||||
{
|
||||
|
|
|
@ -18,9 +18,16 @@ namespace BizHawk.Client.EmuHawk
|
|||
=> Properties.Resources.NesControllerIcon;
|
||||
|
||||
[RequiredService]
|
||||
private INESPPUViewable _ppu { get; set; }
|
||||
public INESPPUViewable _nesCore { get; set; }
|
||||
|
||||
private INESPPUViewable _ppu
|
||||
=> _nesCore!;
|
||||
|
||||
[RequiredService]
|
||||
private IEmulator _emu { get; set; }
|
||||
public IEmulator _core { get; set; }
|
||||
|
||||
private IEmulator _emu
|
||||
=> _core!;
|
||||
|
||||
[ConfigPersist]
|
||||
private int RefreshRateConfig
|
||||
|
@ -221,9 +228,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
|
||||
private void NESNameTableViewer_FormClosed(object sender, FormClosedEventArgs e)
|
||||
{
|
||||
_ppu?.RemoveCallback1();
|
||||
}
|
||||
=> _ppu.RemoveCallback1();
|
||||
|
||||
private void ScanlineTextBox_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
|
|
|
@ -29,9 +29,16 @@ namespace BizHawk.Client.EmuHawk
|
|||
private bool _forceChange;
|
||||
|
||||
[RequiredService]
|
||||
private INESPPUViewable _ppu { get; set; }
|
||||
public INESPPUViewable _nesCore { get; set; }
|
||||
|
||||
private INESPPUViewable _ppu
|
||||
=> _nesCore!;
|
||||
|
||||
[RequiredService]
|
||||
private IEmulator _emu { get; set; }
|
||||
public IEmulator _core { get; set; }
|
||||
|
||||
private IEmulator _emu
|
||||
=> _core!;
|
||||
|
||||
[ConfigPersist]
|
||||
private int RefreshRateConfig
|
||||
|
@ -792,9 +799,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
|
||||
private void NesPPU_FormClosed(object sender, FormClosedEventArgs e)
|
||||
{
|
||||
_ppu?.RemoveCallback2();
|
||||
}
|
||||
=> _ppu.RemoveCallback2();
|
||||
|
||||
private MemoryDomain _chrRom;
|
||||
private readonly byte[] _chrRomCache = new byte[8192];
|
||||
|
|
|
@ -22,7 +22,10 @@ namespace BizHawk.Client.EmuHawk
|
|||
FilesystemFilter.TextFiles);
|
||||
|
||||
[RequiredService]
|
||||
private ITraceable Tracer { get; set; }
|
||||
public ITraceable _tracerCore { get; set; }
|
||||
|
||||
private ITraceable Tracer
|
||||
=> _tracerCore!;
|
||||
|
||||
[ConfigPersist]
|
||||
private int MaxLines { get; set; }
|
||||
|
@ -82,11 +85,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
Closing += (o, e) =>
|
||||
{
|
||||
SaveConfigSettings();
|
||||
if (Tracer != null)
|
||||
{
|
||||
Tracer.Sink = null;
|
||||
}
|
||||
|
||||
Tracer.Sink = null;
|
||||
CloseFile();
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue