snes-support layer toggles (needs gui hookups)

This commit is contained in:
zeromus 2012-09-04 19:12:16 +00:00
parent e364353131
commit 9726b75ec4
7 changed files with 66 additions and 5 deletions

View File

@ -1,5 +1,5 @@
//TODO
//libsnes needs to be modified to support multiple instances
//libsnes needs to be modified to support multiple instances - THIS IS NECESSARY - or else loading one game and then another breaks things
//rename snes.dll so nobody thinks it's a stock snes.dll (we'll be editing it substantially at some point)
//wrap dll code around some kind of library-accessing interface so that it doesnt malfunction if the dll is unavailable
@ -82,6 +82,12 @@ namespace BizHawk.Emulation.Consoles.Nintendo.SNES
[return: MarshalAs(UnmanagedType.U1)]
[DllImport("snes.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern bool snes_unserialize(IntPtr data, int size);
[DllImport("snes.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern void snes_set_layer_enable(int layer, int priority,
[MarshalAs(UnmanagedType.U1)]
bool enable
);
public enum SNES_MEMORY : uint
{
@ -241,6 +247,19 @@ namespace BizHawk.Emulation.Consoles.Nintendo.SNES
public void FrameAdvance(bool render)
{
LibsnesDll.snes_set_layer_enable(0, 0, CoreInputComm.SNES_ShowBG1_0);
LibsnesDll.snes_set_layer_enable(0, 1, CoreInputComm.SNES_ShowBG1_1);
LibsnesDll.snes_set_layer_enable(1, 0, CoreInputComm.SNES_ShowBG2_0);
LibsnesDll.snes_set_layer_enable(1, 1, CoreInputComm.SNES_ShowBG2_1);
LibsnesDll.snes_set_layer_enable(2, 0, CoreInputComm.SNES_ShowBG3_0);
LibsnesDll.snes_set_layer_enable(2, 1, CoreInputComm.SNES_ShowBG3_1);
LibsnesDll.snes_set_layer_enable(3, 0, CoreInputComm.SNES_ShowBG4_0);
LibsnesDll.snes_set_layer_enable(3, 1, CoreInputComm.SNES_ShowBG4_1);
LibsnesDll.snes_set_layer_enable(4, 0, CoreInputComm.SNES_ShowOBJ_0);
LibsnesDll.snes_set_layer_enable(4, 1, CoreInputComm.SNES_ShowOBJ_1);
LibsnesDll.snes_set_layer_enable(4, 2, CoreInputComm.SNES_ShowOBJ_2);
LibsnesDll.snes_set_layer_enable(4, 3, CoreInputComm.SNES_ShowOBJ_3);
//apparently this is one frame?
LibsnesDll.snes_run();
}
@ -351,9 +370,9 @@ namespace BizHawk.Emulation.Consoles.Nintendo.SNES
}
// Arbitrary extensible core comm mechanism
CoreInputComm IEmulator.CoreInputComm { get; set; }
CoreOutputComm IEmulator.CoreOutputComm { get { return CoreOutputComm; } }
CoreOutputComm CoreOutputComm = new CoreOutputComm();
public CoreInputComm CoreInputComm { get; set; }
public CoreOutputComm CoreOutputComm { get { return _CoreOutputComm; } }
CoreOutputComm _CoreOutputComm = new CoreOutputComm();
// ----- Client Debugging API stuff -----
unsafe MemoryDomain MakeMemoryDomain(string name, LibsnesDll.SNES_MEMORY id, Endian endian)
@ -394,7 +413,7 @@ namespace BizHawk.Emulation.Consoles.Nintendo.SNES
{
MemoryDomains = new List<MemoryDomain>();
var romDomain = new MemoryDomain("ROM", romData.Length, Endian.Little,
var romDomain = new MemoryDomain("CARTROM", romData.Length, Endian.Little,
(addr) => romData[addr],
(addr, value) => romData[addr] = value);

View File

@ -7,6 +7,10 @@
public bool NES_ShowBG, NES_ShowOBJ;
public bool PCE_ShowBG1, PCE_ShowOBJ1, PCE_ShowBG2, PCE_ShowOBJ2;
public bool SMS_ShowBG, SMS_ShowOBJ;
public bool SNES_ShowBG1_0, SNES_ShowBG2_0, SNES_ShowBG3_0, SNES_ShowBG4_0;
public bool SNES_ShowBG1_1, SNES_ShowBG2_1, SNES_ShowBG3_1, SNES_ShowBG4_1;
public bool SNES_ShowOBJ_0, SNES_ShowOBJ_1, SNES_ShowOBJ_2, SNES_ShowOBJ_3;
}
public class CoreOutputComm

View File

@ -344,6 +344,23 @@ namespace BizHawk.MultiClient
public int NESTopLine = 8;
public int NESBottomLine = 231;
// SNES Graphics settings
//bsnes allows the layers to be enabled for each priority level.
//this may not be important for the bg (there are two priority levels)
//but it may be useful for OBJ, so we might want to control them separately
public bool SNES_ShowBG1_0 = true;
public bool SNES_ShowBG2_0 = true;
public bool SNES_ShowBG3_0 = true;
public bool SNES_ShowBG4_0 = true;
public bool SNES_ShowBG1_1 = true;
public bool SNES_ShowBG2_1 = true;
public bool SNES_ShowBG3_1 = true;
public bool SNES_ShowBG4_1 = true;
public bool SNES_ShowOBJ_0 = true;
public bool SNES_ShowOBJ_1 = true;
public bool SNES_ShowOBJ_2 = true;
public bool SNES_ShowOBJ_3 = true;
// PCE Graphics settings
public bool PCEDispBG1 = true;
public bool PCEDispOBJ1= true;

View File

@ -341,6 +341,19 @@ namespace BizHawk.MultiClient
Global.CoreInputComm.PCE_ShowOBJ2 = Global.Config.PCEDispOBJ2;
Global.CoreInputComm.SMS_ShowBG = Global.Config.SMSDispBG;
Global.CoreInputComm.SMS_ShowOBJ = Global.Config.SMSDispOBJ;
Global.CoreInputComm.SNES_ShowBG1_0 = Global.Config.SNES_ShowBG1_0;
Global.CoreInputComm.SNES_ShowBG1_1 = Global.Config.SNES_ShowBG1_1;
Global.CoreInputComm.SNES_ShowBG2_0 = Global.Config.SNES_ShowBG2_0;
Global.CoreInputComm.SNES_ShowBG2_1 = Global.Config.SNES_ShowBG2_1;
Global.CoreInputComm.SNES_ShowBG3_0 = Global.Config.SNES_ShowBG3_0;
Global.CoreInputComm.SNES_ShowBG3_1 = Global.Config.SNES_ShowBG3_1;
Global.CoreInputComm.SNES_ShowBG4_0 = Global.Config.SNES_ShowBG4_0;
Global.CoreInputComm.SNES_ShowBG4_1 = Global.Config.SNES_ShowBG4_1;
Global.CoreInputComm.SNES_ShowOBJ_0 = Global.Config.SNES_ShowOBJ_0;
Global.CoreInputComm.SNES_ShowOBJ_1 = Global.Config.SNES_ShowOBJ_1;
Global.CoreInputComm.SNES_ShowOBJ_2 = Global.Config.SNES_ShowOBJ_2;
Global.CoreInputComm.SNES_ShowOBJ_3 = Global.Config.SNES_ShowOBJ_3;
}
void SyncPresentationMode()

Binary file not shown.

View File

@ -247,3 +247,10 @@ System::System() {
}
}
//zero 04-sep-2012
extern "C" void snes_set_layer_enable(int layer, int priority, bool enable)
{
SNES::ppu.layer_enable(layer, priority, enable);
}

View File

@ -130,6 +130,7 @@ unsigned snes_get_memory_size(unsigned id);
//zeromus additions
bool snes_check_cartridge(const uint8_t *rom_data, unsigned rom_size);
void snes_set_layer_enable(int layer, int priority, bool enable);
#ifdef __cplusplus
}