SaveState preparations #1 - Annotate all(?) state. (NO SCHEDULE PROMISE!)

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@257 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
hrydgard 2008-08-21 18:23:10 +00:00
parent 92031705cd
commit 9e3747e2f3
28 changed files with 71 additions and 80 deletions

View File

@ -91,7 +91,7 @@ void UpdateInterrupts()
{ {
for(int i=0; i<NUM_CHANNELS; i++) for(int i=0; i<NUM_CHANNELS; i++)
{ {
if(g_Channels[i].isCausingInterrupt()) if(g_Channels[i].IsCausingInterrupt())
{ {
CPeripheralInterface::SetInterrupt(CPeripheralInterface::INT_CAUSE_EXI, true); CPeripheralInterface::SetInterrupt(CPeripheralInterface::INT_CAUSE_EXI, true);
return; return;

View File

@ -22,16 +22,9 @@
namespace ExpansionInterface namespace ExpansionInterface
{ {
// init
void Init(); void Init();
// shutdown
void Shutdown(); void Shutdown();
// update
void Update(); void Update();
// updateInterrupts
void UpdateInterrupts(); void UpdateInterrupts();
void HWCALL Read32(u32& _uReturnValue, const u32 _iAddress); void HWCALL Read32(u32& _uReturnValue, const u32 _iAddress);

View File

@ -48,7 +48,7 @@ CEXIChannel::~CEXIChannel()
void CEXIChannel::RemoveDevices() void CEXIChannel::RemoveDevices()
{ {
for (int i=0; i<NUM_DEVICES; i++) for (int i = 0; i < NUM_DEVICES; i++)
{ {
if (m_pDevices[i] != NULL) if (m_pDevices[i] != NULL)
{ {
@ -79,14 +79,16 @@ void CEXIChannel::UpdateInterrupts()
ExpansionInterface::UpdateInterrupts(); ExpansionInterface::UpdateInterrupts();
} }
bool CEXIChannel::isCausingInterrupt() bool CEXIChannel::IsCausingInterrupt()
{ {
if (m_ChannelId != 2) /* Channels 0 and 1: Memcard slot (device 0) produces interrupt */ if (m_ChannelId != 2) /* Channels 0 and 1: Memcard slot (device 0) produces interrupt */
{ {
if(m_pDevices[0]->IsInterruptSet()) if (m_pDevices[0]->IsInterruptSet())
m_Status.EXIINT = 1; m_Status.EXIINT = 1;
} else /* Channel 2: In fact, Channel 0, Device 2 (Serial A) produces interrupt */ }
else /* Channel 2: In fact, Channel 0, Device 2 (Serial A) produces interrupt */
{ {
// WTF? this[-2]??? EVIL HACK
if (this[-2].m_pDevices[2]->IsInterruptSet()) if (this[-2].m_pDevices[2]->IsInterruptSet())
m_Status.EXIINT = 1; m_Status.EXIINT = 1;
} }
@ -117,7 +119,7 @@ IEXIDevice* CEXIChannel::GetDevice(u8 _CHIP_SELECT)
void CEXIChannel::Update() void CEXIChannel::Update()
{ {
// start the transfer // start the transfer
for(int i=0; i<NUM_DEVICES; i++) for (int i = 0; i < NUM_DEVICES; i++)
{ {
m_pDevices[i]->Update(); m_pDevices[i]->Update();
} }
@ -132,9 +134,9 @@ void CEXIChannel::Read32(u32& _uReturnValue, const u32 _iRegister)
case EXI_STATUS: case EXI_STATUS:
{ {
// check if a device is present // check if a device is present
for(int i=0; i<NUM_DEVICES; i++) for (int i = 0; i < NUM_DEVICES; i++)
{ {
if(m_pDevices[i]->IsPresent()) if (m_pDevices[i]->IsPresent())
{ {
m_Status.EXT = 1; m_Status.EXT = 1;
break; break;
@ -184,7 +186,7 @@ void CEXIChannel::Write32(const u32 _iValue, const u32 _iRegister)
// Device // Device
if (m_Status.CHIP_SELECT != newStatus.CHIP_SELECT) if (m_Status.CHIP_SELECT != newStatus.CHIP_SELECT)
{ {
for (int i=0; i<NUM_DEVICES; i++) for (int i = 0; i < NUM_DEVICES; i++)
{ {
u8 dwDeviceMask = 1 << i; u8 dwDeviceMask = 1 << i;
IEXIDevice* pDevice = GetDevice(dwDeviceMask); IEXIDevice* pDevice = GetDevice(dwDeviceMask);

View File

@ -70,6 +70,7 @@ private:
}; };
}; };
// STATE_TO_SAVE
UEXI_STATUS m_Status; UEXI_STATUS m_Status;
UEXI_CONTROL m_Control; UEXI_CONTROL m_Control;
u32 m_DMAMemoryAddress; u32 m_DMAMemoryAddress;
@ -89,34 +90,22 @@ private:
public: public:
// channeId for debugging // channelId for debugging
u32 m_ChannelId; u32 m_ChannelId;
// constructor
CEXIChannel(); CEXIChannel();
// destructor
~CEXIChannel(); ~CEXIChannel();
// Add a Device
void AddDevice(const TEXIDevices _device, const unsigned int _iSlot); void AddDevice(const TEXIDevices _device, const unsigned int _iSlot);
// Remove all devices // Remove all devices
void RemoveDevices(); void RemoveDevices();
// update
void Update();
// Read32
void Read32(u32& _uReturnValue, const u32 _iRegister); void Read32(u32& _uReturnValue, const u32 _iRegister);
// isCausingInterrupt
bool isCausingInterrupt();
// Write32
void Write32(const u32 _iValue, const u32 _iRegister); void Write32(const u32 _iValue, const u32 _iRegister);
// update interrupts void Update();
bool IsCausingInterrupt();
void UpdateInterrupts(); void UpdateInterrupts();
}; };

View File

@ -14,6 +14,7 @@
// Official SVN repository and contact information can be found at // Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#ifndef _EXIDEVICE_H #ifndef _EXIDEVICE_H
#define _EXIDEVICE_H #define _EXIDEVICE_H
@ -22,11 +23,11 @@
class IEXIDevice class IEXIDevice
{ {
private: private:
// transfer function for this function // byte transfer function for this device
virtual void TransferByte(u8& _byte) {}; virtual void TransferByte(u8& _byte) {};
public: public:
// immdeiate copy functions // immediate copy functions
virtual void ImmWrite(u32 _uData, u32 _uSize); virtual void ImmWrite(u32 _uData, u32 _uSize);
virtual u32 ImmRead(u32 _uSize); virtual u32 ImmRead(u32 _uSize);
@ -34,7 +35,6 @@ public:
virtual void DMAWrite(u32 _uAddr, u32 _uSize); virtual void DMAWrite(u32 _uAddr, u32 _uSize);
virtual void DMARead (u32 _uAddr, u32 _uSize); virtual void DMARead (u32 _uAddr, u32 _uSize);
// is the Device insert ??
virtual bool IsPresent(); virtual bool IsPresent();
virtual void SetCS(int _iCS); virtual void SetCS(int _iCS);

View File

@ -22,9 +22,7 @@ class CEXIAD16 : public IEXIDevice
{ {
public: public:
CEXIAD16(); CEXIAD16();
//! SetCS
virtual void SetCS(int _iCS); virtual void SetCS(int _iCS);
//! Is device present?
virtual bool IsPresent(); virtual bool IsPresent();
private: private:
@ -41,6 +39,7 @@ private:
u32 U8[4]; u32 U8[4];
}; };
// STATE_TO_SAVE
u32 m_uPosition; u32 m_uPosition;
u32 m_uCommand; u32 m_uCommand;
UAD16Reg m_uAD16Register; UAD16Reg m_uAD16Register;

View File

@ -25,14 +25,8 @@ class CEXIIPL : public IEXIDevice
public: public:
CEXIIPL(); CEXIIPL();
virtual ~CEXIIPL(); virtual ~CEXIIPL();
//! SetCS
virtual void SetCS(int _iCS); virtual void SetCS(int _iCS);
//! Is device present?
bool IsPresent(); bool IsPresent();
//! Get the GC Time
static u32 GetGCTime(); static u32 GetGCTime();
private: private:
@ -46,6 +40,7 @@ private:
//! IPL //! IPL
u8* m_pIPL; u8* m_pIPL;
// STATE_TO_SAVE
//! RealTimeClock //! RealTimeClock
u8 m_RTC[4]; u8 m_RTC[4];
@ -60,8 +55,7 @@ private:
char m_szBuffer[256]; char m_szBuffer[256];
int m_count; int m_count;
virtual void TransferByte(u8 &_uByte);
virtual void TransferByte(u8& _uByte);
}; };
#endif #endif

View File

@ -23,17 +23,9 @@ class CEXIMemoryCard : public IEXIDevice
public: public:
CEXIMemoryCard(const std::string& _rName, const std::string& _rFilename); CEXIMemoryCard(const std::string& _rName, const std::string& _rFilename);
virtual ~CEXIMemoryCard(); virtual ~CEXIMemoryCard();
//! SetCS
void SetCS(int cs); void SetCS(int cs);
// update
void Update(); void Update();
// is generating interrupt ?
bool IsInterruptSet(); bool IsInterruptSet();
//! Is device present?
bool IsPresent(); bool IsPresent();
inline const std::string &GetFileName() const { return m_strFilename; }; inline const std::string &GetFileName() const { return m_strFilename; };
@ -67,7 +59,9 @@ private:
std::string m_strFilename; std::string m_strFilename;
//! memory card state //! memory card state
// STATE_TO_SAVE
int interruptSwitch; int interruptSwitch;
bool m_bInterruptSet; bool m_bInterruptSet;
int command; int command;

View File

@ -44,7 +44,7 @@
namespace Memory namespace Memory
{ {
// GLOABL DEFINES // GLOBAL DEFINES
// #define NOCHECK // #define NOCHECK
@ -54,11 +54,13 @@ static const bool bFakeVMEM = false;
#define NOCHECK #define NOCHECK
#endif #endif
// END: GLOBAL DEFINES
// END: GLOABL DEFINES
u8* base = NULL; u8* base = NULL;
// STATE_TO_SAVE (applies to a lot of things in this file)
// Pointers to low memory // Pointers to low memory
u8* m_pRAM = NULL; u8* m_pRAM = NULL;
u8* m_pFakeVMEM = NULL; u8* m_pFakeVMEM = NULL;

View File

@ -44,7 +44,8 @@ struct MIMemStruct
u32 Channel_Ctrl; u32 Channel_Ctrl;
}; };
MIMemStruct miMem; // STATE_TO_SAVE
static MIMemStruct miMem;
void Read16(u16& _uReturnValue, const u32 _iAddress) void Read16(u16& _uReturnValue, const u32 _iAddress)
{ {

View File

@ -22,6 +22,7 @@
#include "PeripheralInterface.h" #include "PeripheralInterface.h"
#include "GPFifo.h" #include "GPFifo.h"
// STATE_TO_SAVE
u32 volatile CPeripheralInterface::m_InterruptMask; u32 volatile CPeripheralInterface::m_InterruptMask;
u32 volatile CPeripheralInterface::m_InterruptCause; u32 volatile CPeripheralInterface::m_InterruptCause;

View File

@ -50,11 +50,12 @@ union UPECtrlReg
UPECtrlReg(u16 _hex) {Hex = _hex; } UPECtrlReg(u16 _hex) {Hex = _hex; }
}; };
UPECtrlReg g_ctrlReg; // STATE_TO_SAVE
u16 g_token = 0; static UPECtrlReg g_ctrlReg;
static u16 g_token = 0;
bool g_bSignalTokenInterrupt; static bool g_bSignalTokenInterrupt;
bool g_bSignalFinishInterrupt; static bool g_bSignalFinishInterrupt;
void UpdateInterrupts(); void UpdateInterrupts();

View File

@ -207,12 +207,13 @@ union USIEXIClockCount
}; };
}; };
SSIChannel g_Channel[NUMBER_OF_CHANNELS]; // STATE_TO_SAVE
USIPoll g_Poll; static SSIChannel g_Channel[NUMBER_OF_CHANNELS];
USIComCSR g_ComCSR; static USIPoll g_Poll;
USIStatusReg g_StatusReg; static USIComCSR g_ComCSR;
USIEXIClockCount g_EXIClockCount; static USIStatusReg g_StatusReg;
u8 g_SIBuffer[128]; static USIEXIClockCount g_EXIClockCount;
static u8 g_SIBuffer[128];
static void GenerateSIInterrupt(SIInterruptType _SIInterrupt); static void GenerateSIInterrupt(SIInterruptType _SIInterrupt);
void RunSIBuffer(); void RunSIBuffer();

View File

@ -82,6 +82,7 @@ union UVIInterruptRegister
}; };
}; };
// STATE_TO_SAVE
UVIDisplayControlRegister m_VIDisplayControlRegister; UVIDisplayControlRegister m_VIDisplayControlRegister;
// Framebuffers // Framebuffers

View File

@ -23,12 +23,12 @@ namespace WII_IOBridge
void HWCALL Read8(u8& _rReturnValue, const u32 _Address) void HWCALL Read8(u8& _rReturnValue, const u32 _Address)
{ {
_dbg_assert_(WII_IOB,0); _dbg_assert_(WII_IOB, 0);
} }
void HWCALL Read16(u16& _rReturnValue, const u32 _Address) void HWCALL Read16(u16& _rReturnValue, const u32 _Address)
{ {
_dbg_assert_(WII_IOB,0); _dbg_assert_(WII_IOB, 0);
} }
void HWCALL Read32(u32& _rReturnValue, const u32 _Address) void HWCALL Read32(u32& _rReturnValue, const u32 _Address)
@ -73,17 +73,17 @@ void HWCALL Read32(u32& _rReturnValue, const u32 _Address)
void HWCALL Read64(u64& _rReturnValue, const u32 _Address) void HWCALL Read64(u64& _rReturnValue, const u32 _Address)
{ {
_dbg_assert_(WII_IOB,0); _dbg_assert_(WII_IOB, 0);
} }
void HWCALL Write8(const u8 _Value, const u32 _Address) void HWCALL Write8(const u8 _Value, const u32 _Address)
{ {
_dbg_assert_(WII_IOB,0); _dbg_assert_(WII_IOB, 0);
} }
void HWCALL Write16(const u16 _Value, const u32 _Address) void HWCALL Write16(const u16 _Value, const u32 _Address)
{ {
_dbg_assert_(WII_IOB,0); _dbg_assert_(WII_IOB, 0);
} }
void HWCALL Write32(const u32 _Value, const u32 _Address) void HWCALL Write32(const u32 _Value, const u32 _Address)

View File

@ -83,6 +83,7 @@ union UIPC_Config
} }
}; };
// STATE_TO_SAVE
UIPC_Status g_IPC_Status; UIPC_Status g_IPC_Status;
UIPC_Config g_IPC_Config; UIPC_Config g_IPC_Config;
UIPC_Control g_IPC_Control; UIPC_Control g_IPC_Control;
@ -91,6 +92,7 @@ u32 g_Address = 0;
u32 g_Reply = 0; u32 g_Reply = 0;
u32 g_SensorBarPower = 0; u32 g_SensorBarPower = 0;
void UpdateInterrupts(); void UpdateInterrupts();
// Init // Init

View File

@ -51,6 +51,8 @@ enum ECommandType
typedef std::map<u32, IWII_IPC_HLE_Device*> TDeviceMap; typedef std::map<u32, IWII_IPC_HLE_Device*> TDeviceMap;
TDeviceMap g_DeviceMap; TDeviceMap g_DeviceMap;
// STATE_TO_SAVE
u32 g_LastDeviceID = 0x13370000; u32 g_LastDeviceID = 0x13370000;

View File

@ -54,11 +54,11 @@ protected:
SIOCtlVBuffer(u32 _Address) SIOCtlVBuffer(u32 _Address)
: m_Address(_Address) : m_Address(_Address)
{ {
Parameter = Memory::Read_U32(m_Address +0x0C); Parameter = Memory::Read_U32(m_Address + 0x0C);
NumberInBuffer = Memory::Read_U32(m_Address +0x10); NumberInBuffer = Memory::Read_U32(m_Address + 0x10);
NumberPayloadBuffer = Memory::Read_U32(m_Address +0x14); NumberPayloadBuffer = Memory::Read_U32(m_Address + 0x14);
BufferVector = Memory::Read_U32(m_Address +0x18); BufferVector = Memory::Read_U32(m_Address + 0x18);
BufferSize = Memory::Read_U32(m_Address +0x1C); BufferSize = Memory::Read_U32(m_Address + 0x1C);
u32 BufferVectorOffset = BufferVector; u32 BufferVectorOffset = BufferVector;
for (u32 i=0; i<NumberInBuffer; i++) for (u32 i=0; i<NumberInBuffer; i++)
@ -77,6 +77,7 @@ protected:
} }
} }
// STATE_TO_SAVE
const u32 m_Address; const u32 m_Address;
u32 Parameter; u32 Parameter;
@ -141,6 +142,7 @@ protected:
private: private:
// STATE_TO_SAVE
std::string m_Name; std::string m_Name;
u32 m_DeviceID; u32 m_DeviceID;

View File

@ -135,7 +135,7 @@ u32 CWII_IPC_HLE_Device_sdio_slot0::ExecuteCommand(u32 _BufferIn, u32 _BufferInS
req.blocks = Memory::Read_U32(_BufferIn + 16); req.blocks = Memory::Read_U32(_BufferIn + 16);
req.bsize = Memory::Read_U32(_BufferIn + 20); req.bsize = Memory::Read_U32(_BufferIn + 20);
req.addr = Memory::Read_U32(_BufferIn + 24); req.addr = Memory::Read_U32(_BufferIn + 24);
switch (req.command) //switch (req.command)
{ {
} }
return 1; return 1;

View File

@ -163,6 +163,7 @@ public:
return false; return false;
} }
// STATE_TO_SAVE
u32 m_EventHookAddress; u32 m_EventHookAddress;
}; };

View File

@ -92,6 +92,7 @@ private:
}; };
// STATE_TO_SAVE
std::queue<SHCICommandMessage> m_HCICommandMessageQueue; std::queue<SHCICommandMessage> m_HCICommandMessageQueue;
bool m_ACLAnswer; bool m_ACLAnswer;

View File

@ -44,6 +44,7 @@ public:
private: private:
// STATE_TO_SAVE
bdaddr_t m_BD; bdaddr_t m_BD;
u16 m_ControllerConnectionHandle; u16 m_ControllerConnectionHandle;

View File

@ -20,4 +20,5 @@
#include "BPMemory.h" #include "BPMemory.h"
//BP state //BP state
// STATE_TO_SAVE
BPMemory bpmem; BPMemory bpmem;

View File

@ -19,6 +19,7 @@
#include "CPMemory.h" #include "CPMemory.h"
// CP state // CP state
// STATE_TO_SAVE
u32 arraybases[16]; u32 arraybases[16];
u32 arraystrides[16]; u32 arraystrides[16];
TMatrixIndexA MatrixIndexA; TMatrixIndexA MatrixIndexA;

View File

@ -26,9 +26,9 @@
#define FIFO_SIZE (1024*1024) #define FIFO_SIZE (1024*1024)
// STATE_TO_SAVE
FifoReader fifo; FifoReader fifo;
static u8 *videoBuffer; static u8 *videoBuffer;
static int size = 0; static int size = 0;
static int readptr = 0; static int readptr = 0;

View File

@ -37,7 +37,7 @@ void InitLUTs()
lut6to8[i] = (i*255) / 63; lut6to8[i] = (i*255) / 63;
for (int i = 0; i < 256; i++) for (int i = 0; i < 256; i++)
{ {
lutu8tosfloat[i] = (float)(i-128) / 127.0f; lutu8tosfloat[i] = (float)(i - 128) / 127.0f;
lutu8toufloat[i] = (float)(i) / 255.0f; lutu8toufloat[i] = (float)(i) / 255.0f;
luts8tosfloat[i] = ((float)(signed char)(char)i) / 127.0f; luts8tosfloat[i] = ((float)(signed char)(char)i) / 127.0f;
} }

View File

@ -20,7 +20,7 @@
#include "TextureDecoder.h" #include "TextureDecoder.h"
#include "LookUpTables.h" #include "LookUpTables.h"
//Uncomment this to enable Texure Format ID overlays //Uncomment this to enable Texture Format ID overlays
#define OVERLAY_TEXFMT #define OVERLAY_TEXFMT
#ifdef OVERLAY_TEXFMT #ifdef OVERLAY_TEXFMT
@ -29,6 +29,7 @@ bool TexFmt_Overlay_Center=false;
#endif #endif
// TRAM // TRAM
// STATE_TO_SAVE
u8 texMem[TMEM_SIZE]; u8 texMem[TMEM_SIZE];
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////

View File

@ -17,5 +17,6 @@
#include "XFMemory.h" #include "XFMemory.h"
// STATE_TO_SAVE
XFRegisters xfregs; XFRegisters xfregs;
u32 xfmem[XFMEM_SIZE]; u32 xfmem[XFMEM_SIZE];