fix loading of non-snes games, and try to make snes core reset a little more reliable by reconstructing more
This commit is contained in:
parent
c8aa937f4f
commit
76cfbc47c1
|
@ -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);
|
||||
|
|
|
@ -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())
|
||||
|
|
Binary file not shown.
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue