diff --git a/BizHawk.Emulation/Consoles/Nintendo/SNES/LibsnesCore.cs b/BizHawk.Emulation/Consoles/Nintendo/SNES/LibsnesCore.cs index 1f243ce253..d3704b6065 100644 --- a/BizHawk.Emulation/Consoles/Nintendo/SNES/LibsnesCore.cs +++ b/BizHawk.Emulation/Consoles/Nintendo/SNES/LibsnesCore.cs @@ -18,9 +18,9 @@ namespace BizHawk.Emulation.Consoles.Nintendo.SNES [DllImport("snes.dll", CallingConvention = CallingConvention.Cdecl)] public static extern string snes_library_id(); [DllImport("snes.dll", CallingConvention = CallingConvention.Cdecl)] - public static extern uint snes_library_revision_major(); + public static extern int snes_library_revision_major(); [DllImport("snes.dll", CallingConvention = CallingConvention.Cdecl)] - public static extern uint snes_library_revision_minor(); + public static extern int snes_library_revision_minor(); [DllImport("snes.dll", CallingConvention = CallingConvention.Cdecl)] public static extern void snes_init(); @@ -138,11 +138,6 @@ namespace BizHawk.Emulation.Consoles.Nintendo.SNES public unsafe class LibsnesCore : IEmulator, IVideoProvider, ISoundProvider { - static LibsnesCore() - { - LibsnesDll.snes_init(); - } - public void Dispose() { LibsnesDll.snes_term(); @@ -154,6 +149,8 @@ namespace BizHawk.Emulation.Consoles.Nintendo.SNES public LibsnesCore(byte[] romData) { + LibsnesDll.snes_init(); + var vidcb = new LibsnesDll.snes_video_refresh_t(snes_video_refresh); _gc_snes_video_refresh = GCHandle.Alloc(vidcb); BizHawk.Emulation.Consoles.Nintendo.SNES.LibsnesDll.snes_set_video_refresh(vidcb); diff --git a/BizHawk.MultiClient/MainForm.cs b/BizHawk.MultiClient/MainForm.cs index 11068d4770..b0be55f2d5 100644 --- a/BizHawk.MultiClient/MainForm.cs +++ b/BizHawk.MultiClient/MainForm.cs @@ -1312,10 +1312,13 @@ namespace BizHawk.MultiClient //use some heuristics to figure out what game type it might be if (game.NotInDatabase) { - //try asking the snes core - if (LibsnesDll.snes_check_cartridge(rom.FileData, rom.FileData.Length)) - game.System = "SNES"; - else + //try asking the snes core - on second thought, dont. because it detects everything as snes. + //maybe we'll try improving this later, but probably not + //if (LibsnesDll.snes_check_cartridge(rom.FileData, rom.FileData.Length)) + //{ + // game.System = "SNES"; + //} + //else { //try and use the extension switch (file.Extension.ToUpper()) diff --git a/BizHawk.MultiClient/output/snes.dll b/BizHawk.MultiClient/output/snes.dll index 70ce922b53..ae399fe318 100644 Binary files a/BizHawk.MultiClient/output/snes.dll and b/BizHawk.MultiClient/output/snes.dll differ diff --git a/libsnes/bsnes/target-libsnes/libsnes.cpp b/libsnes/bsnes/target-libsnes/libsnes.cpp index b725e1225e..b6ea1e22a0 100644 --- a/libsnes/bsnes/target-libsnes/libsnes.cpp +++ b/libsnes/bsnes/target-libsnes/libsnes.cpp @@ -116,6 +116,9 @@ void snes_set_cartridge_basename(const char *basename) { } void snes_init(void) { + //zero 04-sep-2012 - reset harder + new(&interface) Interface(); + SNES::interface = &interface; SNES::system.init(); SNES::input.connect(SNES::Controller::Port1, SNES::Input::Device::Joypad); @@ -209,10 +212,11 @@ void snes_cheat_set(unsigned index, bool enable, const char *code) { SNES::cheat.synchronize(); } -//zeromus additions + +//zero 03-sep-2012 bool snes_check_cartridge(const uint8_t *rom_data, unsigned rom_size) { - //tries to determine whether this rom is a snes rom + //tries to determine whether this rom is a snes rom - BUT THIS TRIES TO ACCEPT EVERYTHING! so we cant really use it SnesCartridge temp(rom_data, rom_size); return temp.type != SnesCartridge::TypeUnknown && temp.type != SnesCartridge::TypeGameBoy; }