fix bug in savestate loading

This commit is contained in:
Arisotura 2023-04-06 21:20:06 +02:00
parent 6f7a2b3413
commit e78ada50b9
2 changed files with 8 additions and 2 deletions

View File

@ -935,7 +935,9 @@ bool DoSavestate(Savestate* file)
{ {
// 'dept of redundancy dept' // 'dept of redundancy dept'
// but we do need to update the mappings // but we do need to update the mappings
MapSharedWRAM(WRAMCnt); u8 wramcnt = WRAMCnt;
WRAMCnt ^= 0xFF;
MapSharedWRAM(wramcnt);
InitTimings(); InitTimings();
SetGBASlotTimings(); SetGBASlotTimings();

View File

@ -615,7 +615,7 @@ printf("[MC] finish blob type=%d len=%d\n", type, len);
if (Blobs[Blob_CartROM]) if (Blobs[Blob_CartROM])
{ {
res = NDS::LoadCart(Blobs[Blob_CartROM], BlobLens[Blob_CartROM], res = NDS::LoadCart(Blobs[Blob_CartROM], BlobLens[Blob_CartROM],
Blobs[Blob_CartSRAM], BlobLens[Blob_CartSRAM]); Blobs[Blob_CartSRAM], BlobLens[Blob_CartSRAM]);
if (!res) if (!res)
{ {
printf("!!!! FAIL!!\n"); printf("!!!! FAIL!!\n");
@ -647,6 +647,10 @@ printf("[MC] finish blob type=%d len=%d\n", type, len);
BlobLens[i] = 0; BlobLens[i] = 0;
} }
/*Savestate* zorp = new Savestate("netplay3.mln", true);
NDS::DoSavestate(zorp);
delete zorp;*/
printf("[MC] state loaded, PC=%08X/%08X\n", NDS::GetPC(0), NDS::GetPC(1)); printf("[MC] state loaded, PC=%08X/%08X\n", NDS::GetPC(0), NDS::GetPC(1));
ENetPacket* resp = enet_packet_create(buf, 1, ENET_PACKET_FLAG_RELIABLE); ENetPacket* resp = enet_packet_create(buf, 1, ENET_PACKET_FLAG_RELIABLE);
enet_peer_send(peer, 1, resp); enet_peer_send(peer, 1, resp);