resolve TODO regarding bsnes settings

This commit is contained in:
Morilli 2023-03-10 02:17:35 +01:00
parent eef190d332
commit cb785c4cdb
3 changed files with 22 additions and 20 deletions

View File

@ -44,29 +44,10 @@ namespace BizHawk.Emulation.Cores.Nintendo.BSNES
{
_controller = controller;
var enables = new BsnesApi.LayerEnables
{
BG1_Prio0 = _settings.ShowBG1_0,
BG1_Prio1 = _settings.ShowBG1_1,
BG2_Prio0 = _settings.ShowBG2_0,
BG2_Prio1 = _settings.ShowBG2_1,
BG3_Prio0 = _settings.ShowBG3_0,
BG3_Prio1 = _settings.ShowBG3_1,
BG4_Prio0 = _settings.ShowBG4_0,
BG4_Prio1 = _settings.ShowBG4_1,
Obj_Prio0 = _settings.ShowOBJ_0,
Obj_Prio1 = _settings.ShowOBJ_1,
Obj_Prio2 = _settings.ShowOBJ_2,
Obj_Prio3 = _settings.ShowOBJ_3
};
// TODO: I really don't think stuff like this should be set every single frame (only on change)
Api.core.snes_set_layer_enables(ref enables);
Api.core.snes_set_hooks_enabled(MemoryCallbacks.HasReads, MemoryCallbacks.HasWrites, MemoryCallbacks.HasExecutes);
Api.core.snes_set_trace_enabled(_tracer.IsEnabled());
Api.core.snes_set_video_enabled(render);
Api.core.snes_set_audio_enabled(renderSound);
Api.core.snes_set_ppu_sprite_limit_enabled(!_settings.NoPPUSpriteLimit);
Api.core.snes_set_overscan_enabled(_settings.ShowOverscan);
}
internal void FrameAdvancePost()

View File

@ -19,6 +19,27 @@ namespace BizHawk.Emulation.Cores.Nintendo.BSNES
public PutSettingsDirtyBits PutSettings(SnesSettings o)
{
if (o != _settings)
{
var enables = new BsnesApi.LayerEnables
{
BG1_Prio0 = o.ShowBG1_0,
BG1_Prio1 = o.ShowBG1_1,
BG2_Prio0 = o.ShowBG2_0,
BG2_Prio1 = o.ShowBG2_1,
BG3_Prio0 = o.ShowBG3_0,
BG3_Prio1 = o.ShowBG3_1,
BG4_Prio0 = o.ShowBG4_0,
BG4_Prio1 = o.ShowBG4_1,
Obj_Prio0 = o.ShowOBJ_0,
Obj_Prio1 = o.ShowOBJ_1,
Obj_Prio2 = o.ShowOBJ_2,
Obj_Prio3 = o.ShowOBJ_3
};
Api.core.snes_set_layer_enables(ref enables);
Api.core.snes_set_ppu_sprite_limit_enabled(!o.NoPPUSpriteLimit);
Api.core.snes_set_overscan_enabled(o.ShowOverscan);
}
_settings = o;
return PutSettingsDirtyBits.None;

View File

@ -25,7 +25,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.BSNES
this._romPath = Path.ChangeExtension(loadParameters.Roms[0].RomPath, null);
CoreComm = loadParameters.Comm;
_settings = loadParameters.Settings ?? new SnesSettings();
_syncSettings = loadParameters.SyncSettings ?? new SnesSyncSettings();
SystemId = loadParameters.Game.System;
_isSGB = SystemId == VSystemID.Raw.SGB;
@ -80,6 +79,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.BSNES
};
Api.core.snes_init(ref snesInitData);
Api.SetCallbacks(callbacks);
PutSettings(loadParameters.Settings ?? new SnesSettings());
// start up audio resampler
InitAudio();