jupace: fixed bug that crashes messui when snapshot used.

This commit is contained in:
Robbbert 2021-06-21 01:31:58 +10:00
parent 6fbe508236
commit 976e707ffe

View File

@ -170,11 +170,12 @@ private:
SNAPSHOT_LOAD_MEMBER(ace_state::snapshot_cb) SNAPSHOT_LOAD_MEMBER(ace_state::snapshot_cb)
{ {
std::vector<uint8_t> RAM(0x10000);
cpu_device *cpu = m_maincpu; cpu_device *cpu = m_maincpu;
uint8_t *RAM = memregion(cpu->tag())->base();
address_space &space = cpu->space(AS_PROGRAM); address_space &space = cpu->space(AS_PROGRAM);
unsigned char ace_repeat, ace_byte, loop; unsigned char ace_repeat, ace_byte;
int done=0, ace_index=0x2000; u16 ace_index=0x2000;
bool done = false;
if (m_ram->size() < 16*1024) if (m_ram->size() < 16*1024)
{ {
@ -194,7 +195,7 @@ SNAPSHOT_LOAD_MEMBER(ace_state::snapshot_cb)
{ {
case 0x00: case 0x00:
logerror("File loaded!\r\n"); logerror("File loaded!\r\n");
done = 1; done = true;
break; break;
case 0x01: case 0x01:
image.fread(&ace_byte, 1); image.fread(&ace_byte, 1);
@ -202,7 +203,7 @@ SNAPSHOT_LOAD_MEMBER(ace_state::snapshot_cb)
break; break;
default: default:
image.fread(&ace_repeat, 1); image.fread(&ace_repeat, 1);
for (loop = 0; loop < ace_byte; loop++) for (u8 loop = 0; loop < ace_byte; loop++)
RAM[ace_index++] = ace_repeat; RAM[ace_index++] = ace_repeat;
break; break;
} }