cleanup WonderSwan.ISettable

This commit is contained in:
adelikat 2020-02-08 11:23:58 -06:00
parent 192973dcd7
commit 9d4ef3a3af
2 changed files with 19 additions and 25 deletions

View File

@ -8,8 +8,8 @@ namespace BizHawk.Emulation.Cores.WonderSwan
{
partial class WonderSwan : ISettable<WonderSwan.Settings, WonderSwan.SyncSettings>
{
Settings _Settings;
SyncSettings _SyncSettings;
private Settings _settings;
private SyncSettings _syncSettings;
public class Settings
{
@ -41,9 +41,11 @@ namespace BizHawk.Emulation.Cores.WonderSwan
ret.BWPalette = new uint[16];
for (int i = 0; i < 16; i++)
{
ret.BWPalette[i] = (uint)BWPalette[i].ToArgb() | 0xff000000;
}
// default color algorithm from wonderswan
// default color algorithm from WonderSwan
// todo: we could give options like the gameboy cores have
ret.ColorPalette = new uint[4096];
for (int r = 0; r < 16; r++)
@ -52,12 +54,10 @@ namespace BizHawk.Emulation.Cores.WonderSwan
{
for (int b = 0; b < 16; b++)
{
uint neo_r, neo_g, neo_b;
neo_r = (uint)r * 17;
neo_g = (uint)g * 17;
neo_b = (uint)b * 17;
ret.ColorPalette[r << 8 | g << 4 | b] = 0xff000000 | neo_r << 16 | neo_g << 8 | neo_b << 0;
var neoR = (uint)r * 17;
var neoG = (uint)g * 17;
var neoB = (uint)b * 17;
ret.ColorPalette[r << 8 | g << 4 | b] = 0xff000000 | neoR << 16 | neoG << 8 | neoB << 0;
}
}
}
@ -154,28 +154,22 @@ namespace BizHawk.Emulation.Cores.WonderSwan
}
}
public Settings GetSettings()
{
return _Settings.Clone();
}
public Settings GetSettings() => _settings.Clone();
public SyncSettings GetSyncSettings()
{
return _SyncSettings.Clone();
}
public SyncSettings GetSyncSettings() => _syncSettings.Clone();
public bool PutSettings(Settings o)
{
_Settings = o;
var native = _Settings.GetNativeSettings();
_settings = o;
var native = _settings.GetNativeSettings();
BizSwan.bizswan_putsettings(Core, ref native);
return false;
}
public bool PutSyncSettings(SyncSettings o)
{
bool ret = SyncSettings.NeedsReboot(o, _SyncSettings);
_SyncSettings = o;
bool ret = SyncSettings.NeedsReboot(o, _syncSettings);
_syncSettings = o;
return ret;
}

View File

@ -16,8 +16,8 @@ namespace BizHawk.Emulation.Cores.WonderSwan
{
ServiceProvider = new BasicServiceProvider(this);
CoreComm = comm;
_Settings = (Settings)settings ?? new Settings();
_SyncSettings = (SyncSettings)syncSettings ?? new SyncSettings();
_settings = (Settings)settings ?? new Settings();
_syncSettings = (SyncSettings)syncSettings ?? new SyncSettings();
DeterministicEmulation = deterministic; // when true, remember to force the RTC flag!
Core = BizSwan.bizswan_new();
@ -25,7 +25,7 @@ namespace BizHawk.Emulation.Cores.WonderSwan
throw new InvalidOperationException($"{nameof(BizSwan.bizswan_new)}() returned NULL!");
try
{
var ss = _SyncSettings.GetNativeSettings();
var ss = _syncSettings.GetNativeSettings();
if (deterministic)
ss.userealtime = false;
@ -37,7 +37,7 @@ namespace BizHawk.Emulation.Cores.WonderSwan
InitISaveRam();
InitVideo(rotate);
PutSettings(_Settings);
PutSettings(_settings);
InitIMemoryDomains();
InitIStatable();