Bug fix for hex editor crashing when changing view to PPU or ROM with no game loaded. Fixes part of #332.
This commit is contained in:
parent
e7e6aac71d
commit
32e897479c
|
@ -239,6 +239,10 @@ static int getRAM( unsigned int i )
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
static int getPPU( unsigned int i )
|
static int getPPU( unsigned int i )
|
||||||
{
|
{
|
||||||
|
if (GameInfo == NULL )
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
i &= 0x3FFF;
|
i &= 0x3FFF;
|
||||||
if (i < 0x2000)return VPage[(i) >> 10][(i)];
|
if (i < 0x2000)return VPage[(i) >> 10][(i)];
|
||||||
//NSF PPU Viewer crash here (UGETAB) (Also disabled by 'MaxSize = 0x2000')
|
//NSF PPU Viewer crash here (UGETAB) (Also disabled by 'MaxSize = 0x2000')
|
||||||
|
@ -260,6 +264,10 @@ static int getOAM( unsigned int i )
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
static int getROM( unsigned int offset)
|
static int getROM( unsigned int offset)
|
||||||
{
|
{
|
||||||
|
if (GameInfo == NULL )
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
if (offset < 16)
|
if (offset < 16)
|
||||||
{
|
{
|
||||||
return *((unsigned char *)&head+offset);
|
return *((unsigned char *)&head+offset);
|
||||||
|
@ -2953,7 +2961,14 @@ int QHexEdit::getRomAddrColor( int addr, QColor &fg, QColor &bg )
|
||||||
{
|
{
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
if ( memAccessFunc )
|
||||||
|
{
|
||||||
mb.buf[addr].data = memAccessFunc(addr);
|
mb.buf[addr].data = memAccessFunc(addr);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mb.buf[addr].data = 0;
|
||||||
|
}
|
||||||
|
|
||||||
if ( (txtHlgtStartAddr != txtHlgtEndAddr) && (addr >= txtHlgtStartAddr) && (addr <= txtHlgtEndAddr) )
|
if ( (txtHlgtStartAddr != txtHlgtEndAddr) && (addr >= txtHlgtStartAddr) && (addr <= txtHlgtEndAddr) )
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue