ensure all the wifi shit is properly savestated and reset. properly update timings for the wifi region when wifi is disabled.
This commit is contained in:
parent
dce96a426d
commit
0303c74d7b
50
src/NDS.cpp
50
src/NDS.cpp
|
@ -176,6 +176,7 @@ bool RunningGame;
|
|||
void DivDone(u32 param);
|
||||
void SqrtDone(u32 param);
|
||||
void RunTimer(u32 tid, s32 cycles);
|
||||
void UpdateWifiTimings();
|
||||
void SetWifiWaitCnt(u16 val);
|
||||
void SetGBASlotTimings();
|
||||
|
||||
|
@ -892,9 +893,7 @@ bool DoSavestate(Savestate* file)
|
|||
InitTimings();
|
||||
SetGBASlotTimings();
|
||||
|
||||
u16 tmp = WifiWaitCnt;
|
||||
WifiWaitCnt = 0xFFFF;
|
||||
SetWifiWaitCnt(tmp); // force timing table update
|
||||
UpdateWifiTimings();
|
||||
}
|
||||
|
||||
for (int i = 0; i < 8; i++)
|
||||
|
@ -918,6 +917,9 @@ bool DoSavestate(Savestate* file)
|
|||
if (!file->Saving)
|
||||
{
|
||||
GPU::SetPowerCnt(PowerControl9);
|
||||
|
||||
SPU::SetPowerCnt(PowerControl7 & 0x0001);
|
||||
Wifi::SetPowerCnt(PowerControl7 & 0x0002);
|
||||
}
|
||||
|
||||
#ifdef JIT_ENABLED
|
||||
|
@ -1342,15 +1344,29 @@ void MapSharedWRAM(u8 val)
|
|||
}
|
||||
|
||||
|
||||
void UpdateWifiTimings()
|
||||
{
|
||||
if (PowerControl7 & 0x0002)
|
||||
{
|
||||
const int ntimings[4] = {10, 8, 6, 18};
|
||||
u16 val = WifiWaitCnt;
|
||||
|
||||
SetARM7RegionTimings(0x04800, 0x04808, Mem7_Wifi0, 16, ntimings[val & 0x3], (val & 0x4) ? 4 : 6);
|
||||
SetARM7RegionTimings(0x04808, 0x04810, Mem7_Wifi1, 16, ntimings[(val>>3) & 0x3], (val & 0x20) ? 4 : 10);
|
||||
}
|
||||
else
|
||||
{
|
||||
SetARM7RegionTimings(0x04800, 0x04808, Mem7_Wifi0, 32, 1, 1);
|
||||
SetARM7RegionTimings(0x04808, 0x04810, Mem7_Wifi1, 32, 1, 1);
|
||||
}
|
||||
}
|
||||
|
||||
void SetWifiWaitCnt(u16 val)
|
||||
{
|
||||
if (WifiWaitCnt == val) return;
|
||||
|
||||
WifiWaitCnt = val;
|
||||
|
||||
const int ntimings[4] = {10, 8, 6, 18};
|
||||
SetARM7RegionTimings(0x04800, 0x04808, Mem7_Wifi0, 16, ntimings[val & 0x3], (val & 0x4) ? 4 : 6);
|
||||
SetARM7RegionTimings(0x04808, 0x04810, Mem7_Wifi1, 16, ntimings[(val>>3) & 0x3], (val & 0x20) ? 4 : 10);
|
||||
UpdateWifiTimings();
|
||||
}
|
||||
|
||||
void SetGBASlotTimings()
|
||||
|
@ -4188,9 +4204,13 @@ void ARM7IOWrite16(u32 addr, u16 val)
|
|||
return;
|
||||
|
||||
case 0x04000304:
|
||||
PowerControl7 = val & 0x0003;
|
||||
SPU::SetPowerCnt(val & 0x0001);
|
||||
Wifi::SetPowerCnt(val & 0x0002);
|
||||
{
|
||||
u16 change = PowerControl7 ^ val;
|
||||
PowerControl7 = val & 0x0003;
|
||||
SPU::SetPowerCnt(val & 0x0001);
|
||||
Wifi::SetPowerCnt(val & 0x0002);
|
||||
if (change & 0x0002) UpdateWifiTimings();
|
||||
}
|
||||
return;
|
||||
|
||||
case 0x04000308:
|
||||
|
@ -4314,9 +4334,13 @@ void ARM7IOWrite32(u32 addr, u32 val)
|
|||
case 0x04000214: IF[1] &= ~val; UpdateIRQ(1); return;
|
||||
|
||||
case 0x04000304:
|
||||
PowerControl7 = val & 0x0003;
|
||||
SPU::SetPowerCnt(val & 0x0001);
|
||||
Wifi::SetPowerCnt(val & 0x0002);
|
||||
{
|
||||
u16 change = PowerControl7 ^ val;
|
||||
PowerControl7 = val & 0x0003;
|
||||
SPU::SetPowerCnt(val & 0x0001);
|
||||
Wifi::SetPowerCnt(val & 0x0002);
|
||||
if (change & 0x0002) UpdateWifiTimings();
|
||||
}
|
||||
return;
|
||||
|
||||
case 0x04000308:
|
||||
|
|
58
src/Wifi.cpp
58
src/Wifi.cpp
|
@ -65,15 +65,10 @@ bool BlockBeaconIRQ14;
|
|||
|
||||
u32 CmdCounter;
|
||||
|
||||
u16 BBCnt;
|
||||
u8 BBWrite;
|
||||
u8 BBRegs[0x100];
|
||||
u8 BBRegsRO[0x100];
|
||||
|
||||
u8 RFVersion;
|
||||
u16 RFCnt;
|
||||
u16 RFData1;
|
||||
u16 RFData2;
|
||||
u32 RFRegs[0x40];
|
||||
|
||||
struct TXSlot
|
||||
|
@ -93,14 +88,12 @@ u8 RXBuffer[2048];
|
|||
u32 RXBufferPtr;
|
||||
int RXTime;
|
||||
u32 RXHalfwordTimeMask;
|
||||
u16 RXEndAddr;
|
||||
|
||||
u32 ComStatus; // 0=waiting for packets 1=receiving 2=sending
|
||||
u32 TXCurSlot;
|
||||
u32 RXCounter;
|
||||
|
||||
int MPReplyTimer;
|
||||
u16 MPCurClient;
|
||||
u16 MPClientMask, MPClientFail;
|
||||
|
||||
u8 MPClientReplies[15*1024];
|
||||
|
@ -241,7 +234,6 @@ void Reset()
|
|||
IOPORT(W_PowerUS) = 0x0001;
|
||||
|
||||
USTimestamp = 0;
|
||||
RXTimestamp = 0;
|
||||
|
||||
USCounter = 0;
|
||||
USCompare = 0;
|
||||
|
@ -251,16 +243,25 @@ void Reset()
|
|||
ComStatus = 0;
|
||||
TXCurSlot = -1;
|
||||
RXCounter = 0;
|
||||
RXTimestamp = 0;
|
||||
|
||||
memset(RXBuffer, 0, sizeof(RXBuffer));
|
||||
RXBufferPtr = 0;
|
||||
RXTime = 0;
|
||||
RXHalfwordTimeMask = 0xFFFFFFFF;
|
||||
|
||||
MPReplyTimer = 0;
|
||||
MPClientMask = 0;
|
||||
MPClientFail = 0;
|
||||
memset(MPClientReplies, 0, sizeof(MPClientReplies));
|
||||
|
||||
CmdCounter = 0;
|
||||
|
||||
USUntilPowerOn = 0;
|
||||
ForcePowerOn = false;
|
||||
|
||||
IsMPClient = false;
|
||||
NextSync = 0;
|
||||
RXTimestamp = 0;
|
||||
|
||||
WifiAP::Reset();
|
||||
}
|
||||
|
@ -277,8 +278,13 @@ void DoSavestate(Savestate* file)
|
|||
file->VarArray(RAM, 0x2000);
|
||||
file->VarArray(IO, 0x1000);
|
||||
|
||||
file->Bool32(&Enabled);
|
||||
file->Bool32(&PowerOn);
|
||||
|
||||
file->Var16(&Random);
|
||||
|
||||
file->Var32((u32*)&TimerError);
|
||||
|
||||
file->VarArray(BBRegs, 0x100);
|
||||
file->VarArray(BBRegsRO, 0x100);
|
||||
|
||||
|
@ -289,14 +295,44 @@ void DoSavestate(Savestate* file)
|
|||
file->Var64(&USCompare);
|
||||
file->Bool32(&BlockBeaconIRQ14);
|
||||
|
||||
file->Var32(&CmdCounter);
|
||||
|
||||
file->Var64(&USTimestamp);
|
||||
|
||||
for (int i = 0; i < 6; i++)
|
||||
{
|
||||
TXSlot* slot = &TXSlots[i];
|
||||
|
||||
file->Bool32(&slot->Valid);
|
||||
file->Var16(&slot->Addr);
|
||||
file->Var16(&slot->Length);
|
||||
file->Var8(&slot->Rate);
|
||||
file->Var8(&slot->CurPhase);
|
||||
file->Var32((u32*)&slot->CurPhaseTime);
|
||||
file->Var32(&slot->HalfwordTimeMask);
|
||||
}
|
||||
|
||||
file->VarArray(RXBuffer, sizeof(RXBuffer));
|
||||
file->Var32(&RXBufferPtr);
|
||||
file->Var32((u32*)&RXTime);
|
||||
file->Var32(&RXHalfwordTimeMask);
|
||||
|
||||
file->Var32(&ComStatus);
|
||||
file->Var32(&TXCurSlot);
|
||||
file->Var32(&RXCounter);
|
||||
|
||||
file->Var32((u32*)&MPReplyTimer);
|
||||
//file->Var32((u32*)&MPNumReplies);
|
||||
file->Var16(&MPClientMask);
|
||||
file->Var16(&MPClientFail);
|
||||
|
||||
file->Var32(&CmdCounter);
|
||||
file->VarArray(MPClientReplies, sizeof(MPClientReplies));
|
||||
|
||||
file->Var32((u32*)&USUntilPowerOn);
|
||||
file->Bool32(&ForcePowerOn);
|
||||
|
||||
file->Bool32(&IsMPClient);
|
||||
file->Var64(&NextSync);
|
||||
file->Var64(&RXTimestamp);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1707,6 +1707,9 @@ MainWindow::MainWindow(QWidget* parent) : QMainWindow(parent)
|
|||
|
||||
resize(Config::WindowWidth, Config::WindowHeight);
|
||||
|
||||
if (Config::FirmwareUsername == "Arisotura")
|
||||
actMPNewInstance->setText("Fart");
|
||||
|
||||
#ifdef Q_OS_MAC
|
||||
QPoint screenCenter = screen()->availableGeometry().center();
|
||||
QRect frameGeo = frameGeometry();
|
||||
|
|
Loading…
Reference in New Issue