CDL: fix bsnes SGB cdl totally not working (fixes #1344)

This commit is contained in:
zeromus 2020-01-19 18:41:36 -05:00
parent 6377d78098
commit c2c526e84b
3 changed files with 19 additions and 19 deletions

View File

@ -29,7 +29,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES
{ {
static LibsnesApi() static LibsnesApi()
{ {
if (sizeof(CommStruct) != 232) if (sizeof(CommStruct) != 280)
{ {
throw new InvalidOperationException("sizeof(comm)"); throw new InvalidOperationException("sizeof(comm)");
} }
@ -296,19 +296,19 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES
[FieldOffset(128)] [FieldOffset(128)]
//bleck. this is a long so that it can be a 32/64bit pointer //bleck. this is a long so that it can be a 32/64bit pointer
public fixed long cdl_ptr[4]; public fixed long cdl_ptr[8];
[FieldOffset(160)] [FieldOffset(192)]
public fixed int cdl_size[4]; public fixed int cdl_size[8];
[FieldOffset(176)]
public CPURegs cpuregs;
[FieldOffset(212)]
public LayerEnables layerEnables;
[FieldOffset(224)] [FieldOffset(224)]
public CPURegs cpuregs;
[FieldOffset(260)]
public LayerEnables layerEnables;
[FieldOffset(272)]
//static configuration-type information which can be grabbed off the core at any time without even needing a QUERY command //static configuration-type information which can be grabbed off the core at any time without even needing a QUERY command
public SNES_REGION region; public SNES_REGION region;
[FieldOffset(228)] [FieldOffset(276)]
public SNES_MAPPER mapper; public SNES_MAPPER mapper;
//utilities //utilities

View File

@ -30,7 +30,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES
cdl["SGB_HRAM"] = new byte[_memoryDomains["SGB HRAM"].Size]; cdl["SGB_HRAM"] = new byte[_memoryDomains["SGB HRAM"].Size];
cdl["SGB_WRAM"] = new byte[_memoryDomains["SGB WRAM"].Size]; cdl["SGB_WRAM"] = new byte[_memoryDomains["SGB WRAM"].Size];
if (_memoryDomains.Has("SGB_CARTRAM")) if (_memoryDomains.Has("SGB CARTRAM"))
cdl["SGB_CARTRAM"] = new byte[_memoryDomains["SGB CARTRAM"].Size]; cdl["SGB_CARTRAM"] = new byte[_memoryDomains["SGB CARTRAM"].Size];
} }

View File

@ -165,8 +165,8 @@ struct CommStruct
int32 padding3; int32 padding3;
int64 cdl_ptr[4]; int64 cdl_ptr[8];
int32 cdl_size[4]; int32 cdl_size[8];
CPURegsComm cpuregs; CPURegsComm cpuregs;
LayerEnablesComm layerEnables; LayerEnablesComm layerEnables;
@ -623,13 +623,13 @@ EXPORT void* DllInit()
T(buf, 88); T(buf, 88);
T(buf_size, 112); T(buf_size, 112);
T(cdl_ptr, 128); T(cdl_ptr, 128);
T(cdl_size, 160); T(cdl_size, 192);
T(cpuregs, 176); T(cpuregs, 224);
T(layerEnables, 212); T(layerEnables, 260);
T(region, 224); T(region, 272);
T(mapper, 228); T(mapper, 276);
// start of private stuff // start of private stuff
T(privbuf, 232); T(privbuf, 280);
#undef T #undef T
memset(&comm, 0, sizeof(comm)); memset(&comm, 0, sizeof(comm));