libsnes - remove pointless registers

This commit is contained in:
zeromus 2020-12-05 23:36:52 -05:00
parent f580773342
commit 96aa3e85c0
4 changed files with 20 additions and 29 deletions

View File

@ -28,7 +28,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES
{
static LibsnesApi()
{
if (sizeof(CommStruct) != 376)
if (sizeof(CommStruct) != 368)
{
throw new InvalidOperationException("sizeof(comm)");
}
@ -208,10 +208,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES
public struct CPURegs
{
public uint pc;
public ushort a, x, y, z, s, d, vector; //7x
public byte p, nothing;
public uint aa, rd;
public byte sp, dp, db, mdr;
public ushort a, x, y, s, d, vector; //7x
public byte p, db, nothing, nothing2;
public ushort v, h;
}
@ -346,15 +344,19 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES
[FieldOffset(320)]
public CPURegs cpuregs;
[FieldOffset(356)]
[FieldOffset(344)]
public LayerEnables layerEnables;
[FieldOffset(368)]
[FieldOffset(356)]
//static configuration-type information which can be grabbed off the core at any time without even needing a QUERY command
public SNES_REGION region;
[FieldOffset(372)]
[FieldOffset(360)]
public SNES_MAPPER mapper;
[FieldOffset(364)]
uint BLANK0;
//utilities
//TODO: make internal, wrap on the API instead of the comm
public unsafe string GetAscii() { return _getAscii(str); }

View File

@ -26,17 +26,10 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES
["A"] = regs.a,
["X"] = regs.x,
["Y"] = regs.y,
["Z"] = regs.z,
["S"] = regs.s,
["D"] = regs.d,
["Vector"] = regs.vector,
["P"] = regs.p,
["AA"] = regs.aa,
["RD"] = regs.rd,
["SP"] = regs.sp,
["DP"] = regs.dp,
["DB"] = regs.db,
["MDR"] = regs.mdr,
["Flag N"] = fn,
["Flag V"] = fv,
["Flag M"] = fm,

View File

@ -134,7 +134,7 @@ void CPU::power() {
//zero 01-dec-2012
//gotta clear these to something, sometime
aa.d = rd.d = sp = dp = 0;
rd.d = sp = dp = 0;
}
void CPU::reset() {

View File

@ -109,10 +109,8 @@ enum eStatus : int32
#endif
struct CPURegsComm {
u32 pc;
u16 a, x, y, s, d, vector; //7x
u8 p, nothing;
u32 aa, rd;
u8 sp, dp, db, mdr;
u16 a, x, y, s, d, vector; //6x
u8 p, db, nothing, nothing2;
u16 v, h;
}
#ifndef _MSC_VER
@ -174,6 +172,7 @@ struct CommStruct
//static configuration-type information which can be grabbed off the core at any time without even needing a QUERY command
uint32 region;
uint32 mapper;
uint32 BLANKO;
//===========================================================
@ -527,15 +526,11 @@ void QUERY_peek_cpu_regs() {
comm.cpuregs.y = SNES::cpu.regs.y;
comm.cpuregs.s = SNES::cpu.regs.s;
comm.cpuregs.d = SNES::cpu.regs.d;
//comm.cpuregs.aa = (u32)SNES::cpu.aa;
comm.cpuregs.rd = (u32)SNES::cpu.rd;
comm.cpuregs.sp = SNES::cpu.sp;
comm.cpuregs.dp = SNES::cpu.dp;
comm.cpuregs.db = SNES::cpu.regs.db;
comm.cpuregs.mdr = SNES::cpu.regs.mdr;
comm.cpuregs.vector = SNES::cpu.regs.vector;
comm.cpuregs.p = SNES::cpu.regs.p;
comm.cpuregs.nothing = 0;
comm.cpuregs.nothing2 = 0;
comm.cpuregs.v = SNES::cpu.vcounter();
comm.cpuregs.h = SNES::cpu.hdot();
}
@ -625,11 +620,12 @@ EXPORT void* DllInit()
T(cdl_ptr, 128);
T(cdl_size, 256);
T(cpuregs, 320);
T(layerEnables, 356);
T(region, 368);
T(mapper, 372);
T(layerEnables, 344);
T(region, 356);
T(mapper, 360);
T(BLANKO, 364);
// start of private stuff
T(privbuf, 376);
T(privbuf, 368);
#undef T
memset(&comm, 0, sizeof(comm));