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++)
{
if(g_Channels[i].isCausingInterrupt())
if(g_Channels[i].IsCausingInterrupt())
{
CPeripheralInterface::SetInterrupt(CPeripheralInterface::INT_CAUSE_EXI, true);
return;

View File

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

View File

@ -48,7 +48,7 @@ CEXIChannel::~CEXIChannel()
void CEXIChannel::RemoveDevices()
{
for (int i=0; i<NUM_DEVICES; i++)
for (int i = 0; i < NUM_DEVICES; i++)
{
if (m_pDevices[i] != NULL)
{
@ -79,14 +79,16 @@ void CEXIChannel::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_pDevices[0]->IsInterruptSet())
if (m_pDevices[0]->IsInterruptSet())
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())
m_Status.EXIINT = 1;
}
@ -117,7 +119,7 @@ IEXIDevice* CEXIChannel::GetDevice(u8 _CHIP_SELECT)
void CEXIChannel::Update()
{
// start the transfer
for(int i=0; i<NUM_DEVICES; i++)
for (int i = 0; i < NUM_DEVICES; i++)
{
m_pDevices[i]->Update();
}
@ -132,9 +134,9 @@ void CEXIChannel::Read32(u32& _uReturnValue, const u32 _iRegister)
case EXI_STATUS:
{
// 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;
break;
@ -184,7 +186,7 @@ void CEXIChannel::Write32(const u32 _iValue, const u32 _iRegister)
// Device
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;
IEXIDevice* pDevice = GetDevice(dwDeviceMask);

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -23,12 +23,12 @@ namespace WII_IOBridge
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)
{
_dbg_assert_(WII_IOB,0);
_dbg_assert_(WII_IOB, 0);
}
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)
{
_dbg_assert_(WII_IOB,0);
_dbg_assert_(WII_IOB, 0);
}
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)
{
_dbg_assert_(WII_IOB,0);
_dbg_assert_(WII_IOB, 0);
}
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_Config g_IPC_Config;
UIPC_Control g_IPC_Control;
@ -91,6 +92,7 @@ u32 g_Address = 0;
u32 g_Reply = 0;
u32 g_SensorBarPower = 0;
void UpdateInterrupts();
// Init

View File

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

View File

@ -54,11 +54,11 @@ protected:
SIOCtlVBuffer(u32 _Address)
: m_Address(_Address)
{
Parameter = Memory::Read_U32(m_Address +0x0C);
NumberInBuffer = Memory::Read_U32(m_Address +0x10);
NumberPayloadBuffer = Memory::Read_U32(m_Address +0x14);
BufferVector = Memory::Read_U32(m_Address +0x18);
BufferSize = Memory::Read_U32(m_Address +0x1C);
Parameter = Memory::Read_U32(m_Address + 0x0C);
NumberInBuffer = Memory::Read_U32(m_Address + 0x10);
NumberPayloadBuffer = Memory::Read_U32(m_Address + 0x14);
BufferVector = Memory::Read_U32(m_Address + 0x18);
BufferSize = Memory::Read_U32(m_Address + 0x1C);
u32 BufferVectorOffset = BufferVector;
for (u32 i=0; i<NumberInBuffer; i++)
@ -77,6 +77,7 @@ protected:
}
}
// STATE_TO_SAVE
const u32 m_Address;
u32 Parameter;
@ -141,6 +142,7 @@ protected:
private:
// STATE_TO_SAVE
std::string m_Name;
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.bsize = Memory::Read_U32(_BufferIn + 20);
req.addr = Memory::Read_U32(_BufferIn + 24);
switch (req.command)
//switch (req.command)
{
}
return 1;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -37,7 +37,7 @@ void InitLUTs()
lut6to8[i] = (i*255) / 63;
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;
luts8tosfloat[i] = ((float)(signed char)(char)i) / 127.0f;
}

View File

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

View File

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