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

@ -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;
} }

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,7 +55,6 @@ 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);
}; };

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; };
@ -68,6 +60,8 @@ 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

@ -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

@ -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

@ -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];