mirror of
https://github.com/melonDS-emu/melonDS.git
synced 2025-07-23 14:19:55 -06:00
SPI done
This commit is contained in:
@ -512,7 +512,7 @@ bool DoSavestate(Savestate* file)
|
|||||||
NDSCart::DoSavestate(file);
|
NDSCart::DoSavestate(file);
|
||||||
GPU::DoSavestate(file);
|
GPU::DoSavestate(file);
|
||||||
SPU::DoSavestate(file);
|
SPU::DoSavestate(file);
|
||||||
// SPI
|
SPI::DoSavestate(file);
|
||||||
// RTC
|
// RTC
|
||||||
// wifi
|
// wifi
|
||||||
|
|
||||||
|
52
src/SPI.cpp
52
src/SPI.cpp
@ -193,6 +193,22 @@ void Reset()
|
|||||||
StatusReg = 0x00;
|
StatusReg = 0x00;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DoSavestate(Savestate* file)
|
||||||
|
{
|
||||||
|
file->Section("SPFW");
|
||||||
|
|
||||||
|
// CHECKME/TODO: trust the firmware to stay the same?????
|
||||||
|
// embedding the whole firmware in the savestate would be derpo tho??
|
||||||
|
|
||||||
|
file->Var32(&Hold);
|
||||||
|
file->Var8(&CurCmd);
|
||||||
|
file->Var32(&DataPos);
|
||||||
|
file->Var8(&Data);
|
||||||
|
|
||||||
|
file->Var8(&StatusReg);
|
||||||
|
file->Var32(&Addr);
|
||||||
|
}
|
||||||
|
|
||||||
void SetupDirectBoot()
|
void SetupDirectBoot()
|
||||||
{
|
{
|
||||||
NDS::ARM9Write32(0x027FF864, 0);
|
NDS::ARM9Write32(0x027FF864, 0);
|
||||||
@ -360,6 +376,19 @@ void Reset()
|
|||||||
RegMasks[4] = 0x0F;
|
RegMasks[4] = 0x0F;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DoSavestate(Savestate* file)
|
||||||
|
{
|
||||||
|
file->Section("SPPW");
|
||||||
|
|
||||||
|
file->Var32(&Hold);
|
||||||
|
file->Var32(&DataPos);
|
||||||
|
file->Var8(&Index);
|
||||||
|
file->Var8(&Data);
|
||||||
|
|
||||||
|
file->VarArray(Registers, 8);
|
||||||
|
file->VarArray(RegMasks, 8); // is that needed??
|
||||||
|
}
|
||||||
|
|
||||||
u8 Read()
|
u8 Read()
|
||||||
{
|
{
|
||||||
return Data;
|
return Data;
|
||||||
@ -441,6 +470,17 @@ void Reset()
|
|||||||
ConvResult = 0;
|
ConvResult = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DoSavestate(Savestate* file)
|
||||||
|
{
|
||||||
|
file->Section("SPTS");
|
||||||
|
|
||||||
|
file->Var32(&DataPos);
|
||||||
|
file->Var8(&ControlByte);
|
||||||
|
file->Var8(&Data);
|
||||||
|
|
||||||
|
file->Var16(&ConvResult);
|
||||||
|
}
|
||||||
|
|
||||||
void SetTouchCoords(u16 x, u16 y)
|
void SetTouchCoords(u16 x, u16 y)
|
||||||
{
|
{
|
||||||
// scr.x = (adc.x-adc.x1) * (scr.x2-scr.x1) / (adc.x2-adc.x1) + (scr.x1-1)
|
// scr.x = (adc.x-adc.x1) * (scr.x2-scr.x1) / (adc.x2-adc.x1) + (scr.x1-1)
|
||||||
@ -526,6 +566,18 @@ void Reset()
|
|||||||
SPI_TSC::Reset();
|
SPI_TSC::Reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DoSavestate(Savestate* file)
|
||||||
|
{
|
||||||
|
file->Section("SPIG");
|
||||||
|
|
||||||
|
file->Var16(&Cnt);
|
||||||
|
file->Var32(&CurDevice);
|
||||||
|
|
||||||
|
SPI_Firmware::DoSavestate(file);
|
||||||
|
SPI_Powerman::DoSavestate(file);
|
||||||
|
SPI_TSC::DoSavestate(file);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void WriteCnt(u16 val)
|
void WriteCnt(u16 val)
|
||||||
{
|
{
|
||||||
|
@ -19,6 +19,8 @@
|
|||||||
#ifndef SPI_H
|
#ifndef SPI_H
|
||||||
#define SPI_H
|
#define SPI_H
|
||||||
|
|
||||||
|
#include "Savestate.h"
|
||||||
|
|
||||||
namespace SPI_Firmware
|
namespace SPI_Firmware
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -45,6 +47,7 @@ extern u16 Cnt;
|
|||||||
bool Init();
|
bool Init();
|
||||||
void DeInit();
|
void DeInit();
|
||||||
void Reset();
|
void Reset();
|
||||||
|
void DoSavestate(Savestate* file);
|
||||||
|
|
||||||
u16 ReadCnt();
|
u16 ReadCnt();
|
||||||
void WriteCnt(u16 val);
|
void WriteCnt(u16 val);
|
||||||
|
Reference in New Issue
Block a user