Work towards issue 1229; initial framework for including exi devices in savestates.
Another Unicode fix :( - exporting gci works again git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@3999 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
f2c561f4d0
commit
86e585a66a
|
@ -64,7 +64,12 @@ void Shutdown()
|
||||||
|
|
||||||
void DoState(PointerWrap &p)
|
void DoState(PointerWrap &p)
|
||||||
{
|
{
|
||||||
// TODO: descend all the devices recursively.
|
// TODO: Complete DoState for each IEXIDevice
|
||||||
|
g_Channels[0].GetDevice(1)->DoState(p);
|
||||||
|
g_Channels[0].GetDevice(2)->DoState(p);
|
||||||
|
g_Channels[0].GetDevice(4)->DoState(p);
|
||||||
|
g_Channels[1].GetDevice(1)->DoState(p);
|
||||||
|
g_Channels[2].GetDevice(1)->DoState(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChangeDeviceCallback(u64 userdata, int cyclesLate)
|
void ChangeDeviceCallback(u64 userdata, int cyclesLate)
|
||||||
|
|
|
@ -82,9 +82,6 @@ private:
|
||||||
u32 m_DMALength;
|
u32 m_DMALength;
|
||||||
u32 m_ImmData;
|
u32 m_ImmData;
|
||||||
|
|
||||||
// get device
|
|
||||||
IEXIDevice* GetDevice(u8 _CHIP_SELECT);
|
|
||||||
|
|
||||||
// Devices
|
// Devices
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
|
@ -94,6 +91,8 @@ private:
|
||||||
IEXIDevice* m_pDevices[NUM_DEVICES];
|
IEXIDevice* m_pDevices[NUM_DEVICES];
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
// get device
|
||||||
|
IEXIDevice* GetDevice(u8 _CHIP_SELECT);
|
||||||
// channelId for debugging
|
// channelId for debugging
|
||||||
u32 m_ChannelId;
|
u32 m_ChannelId;
|
||||||
|
|
||||||
|
|
|
@ -74,24 +74,6 @@ void IEXIDevice::DMARead(u32 _uAddr, u32 _uSize)
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
bool IEXIDevice::IsPresent()
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void IEXIDevice::Update()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
bool IEXIDevice::IsInterruptSet()
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void IEXIDevice::SetCS(int _iCS)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
// --- class CEXIDummy ---
|
// --- class CEXIDummy ---
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
|
|
@ -19,12 +19,13 @@
|
||||||
#define _EXIDEVICE_H
|
#define _EXIDEVICE_H
|
||||||
|
|
||||||
#include "Common.h"
|
#include "Common.h"
|
||||||
|
#include "ChunkFile.h"
|
||||||
|
|
||||||
class IEXIDevice
|
class IEXIDevice
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
// Byte transfer function for this device
|
// Byte transfer function for this device
|
||||||
virtual void TransferByte(u8&) {};
|
virtual void TransferByte(u8&) {}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// Immediate copy functions
|
// Immediate copy functions
|
||||||
|
@ -35,16 +36,16 @@ 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);
|
||||||
|
|
||||||
virtual bool IsPresent();
|
virtual bool IsPresent() {return false;}
|
||||||
virtual void SetCS(int _iCS);
|
virtual void SetCS(int) {}
|
||||||
|
virtual void DoState(PointerWrap&) {}
|
||||||
|
|
||||||
// Update
|
// Update
|
||||||
virtual void Update();
|
virtual void Update() {}
|
||||||
|
|
||||||
// Is generating interrupt ?
|
// Is generating interrupt ?
|
||||||
virtual bool IsInterruptSet();
|
virtual bool IsInterruptSet() {return false;}
|
||||||
|
|
||||||
virtual ~IEXIDevice() {};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
enum TEXIDevices
|
enum TEXIDevices
|
||||||
|
|
|
@ -120,6 +120,12 @@ CEXIIPL::~CEXIIPL()
|
||||||
fclose(file);
|
fclose(file);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
void CEXIIPL::DoState(PointerWrap &p)
|
||||||
|
{
|
||||||
|
// commented out to not break current savestates
|
||||||
|
// TODO: uncomment when adding the next savestate change
|
||||||
|
//p.DoArray(m_RTC, 4);
|
||||||
|
}
|
||||||
|
|
||||||
void CEXIIPL::LoadFileToIPL(const char* filename, u32 offset)
|
void CEXIIPL::LoadFileToIPL(const char* filename, u32 offset)
|
||||||
{
|
{
|
||||||
|
@ -164,7 +170,7 @@ void CEXIIPL::TransferByte(u8& _uByte)
|
||||||
if (m_uPosition < 4)
|
if (m_uPosition < 4)
|
||||||
{
|
{
|
||||||
m_uAddress <<= 8;
|
m_uAddress <<= 8;
|
||||||
m_uAddress |= _uByte;
|
m_uAddress |= _uByte;
|
||||||
m_uRWOffset = 0;
|
m_uRWOffset = 0;
|
||||||
_uByte = 0xFF;
|
_uByte = 0xFF;
|
||||||
|
|
||||||
|
@ -296,7 +302,7 @@ void CEXIIPL::TransferByte(u8& _uByte)
|
||||||
}
|
}
|
||||||
m_uRWOffset++;
|
m_uRWOffset++;
|
||||||
}
|
}
|
||||||
m_uPosition++;
|
m_uPosition++;
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 CEXIIPL::GetGCTime()
|
u32 CEXIIPL::GetGCTime()
|
||||||
|
@ -307,7 +313,7 @@ u32 CEXIIPL::GetGCTime()
|
||||||
// (mb2): I think we can get rid of the IPL bias.
|
// (mb2): I think we can get rid of the IPL bias.
|
||||||
// I know, it's another hack so I let the previous code for a while.
|
// I know, it's another hack so I let the previous code for a while.
|
||||||
#if 0
|
#if 0
|
||||||
// Get SRAM bias
|
// Get SRAM bias
|
||||||
u32 Bias;
|
u32 Bias;
|
||||||
|
|
||||||
for (int i=0; i<4; i++)
|
for (int i=0; i<4; i++)
|
||||||
|
@ -315,7 +321,7 @@ u32 CEXIIPL::GetGCTime()
|
||||||
((u8*)&Bias)[i] = sram_dump[0xc + (i^3)];
|
((u8*)&Bias)[i] = sram_dump[0xc + (i^3)];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the time ...
|
// Get the time ...
|
||||||
u64 ltime = Common::Timer::GetTimeSinceJan1970();
|
u64 ltime = Common::Timer::GetTimeSinceJan1970();
|
||||||
return ((u32)ltime - cJanuary2000 - Bias);
|
return ((u32)ltime - cJanuary2000 - Bias);
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -28,7 +28,8 @@ public:
|
||||||
virtual ~CEXIIPL();
|
virtual ~CEXIIPL();
|
||||||
virtual void SetCS(int _iCS);
|
virtual void SetCS(int _iCS);
|
||||||
bool IsPresent();
|
bool IsPresent();
|
||||||
static u32 GetGCTime();
|
static u32 GetGCTime();
|
||||||
|
void DoState(PointerWrap &p);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
|
|
@ -21,6 +21,8 @@
|
||||||
#include "../Core.h"
|
#include "../Core.h"
|
||||||
#include "../CoreTiming.h"
|
#include "../CoreTiming.h"
|
||||||
|
|
||||||
|
#include "../ConfigManager.h"
|
||||||
|
#include "EXI.h"
|
||||||
#include "EXI_Device.h"
|
#include "EXI_Device.h"
|
||||||
#include "EXI_DeviceMemoryCard.h"
|
#include "EXI_DeviceMemoryCard.h"
|
||||||
|
|
||||||
|
@ -179,7 +181,6 @@ CEXIMemoryCard::~CEXIMemoryCard()
|
||||||
|
|
||||||
bool CEXIMemoryCard::IsPresent()
|
bool CEXIMemoryCard::IsPresent()
|
||||||
{
|
{
|
||||||
//return false;
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -419,3 +420,11 @@ void CEXIMemoryCard::TransferByte(u8 &byte)
|
||||||
m_uPosition++;
|
m_uPosition++;
|
||||||
DEBUG_LOG(EXPANSIONINTERFACE, "EXI MEMCARD: < %02x", byte);
|
DEBUG_LOG(EXPANSIONINTERFACE, "EXI MEMCARD: < %02x", byte);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CEXIMemoryCard::DoState(PointerWrap &p)
|
||||||
|
{
|
||||||
|
int slot = 0;
|
||||||
|
if (GetFileName() == SConfig::GetInstance().m_strMemoryCardA)
|
||||||
|
slot = 1;
|
||||||
|
ExpansionInterface::ChangeDevice(slot, slot ? EXIDEVICE_MEMORYCARD_B : EXIDEVICE_MEMORYCARD_A, 0);
|
||||||
|
}
|
|
@ -38,6 +38,7 @@ public:
|
||||||
void Update();
|
void Update();
|
||||||
bool IsInterruptSet();
|
bool IsInterruptSet();
|
||||||
bool IsPresent();
|
bool IsPresent();
|
||||||
|
void DoState(PointerWrap &p);
|
||||||
|
|
||||||
inline const std::string &GetFileName() const { return m_strFilename; };
|
inline const std::string &GetFileName() const { return m_strFilename; };
|
||||||
|
|
||||||
|
|
|
@ -595,7 +595,7 @@ void CMemcardManager::CopyDeleteClick(wxCommandEvent& event)
|
||||||
memoryCard[slot]->DEntry_GameCode(index,tempC);
|
memoryCard[slot]->DEntry_GameCode(index,tempC);
|
||||||
memoryCard[slot]->DEntry_FileName(index,tempC2);
|
memoryCard[slot]->DEntry_FileName(index,tempC2);
|
||||||
sprintf(tempC, "%s_%s.gci", tempC, tempC2);
|
sprintf(tempC, "%s_%s.gci", tempC, tempC2);
|
||||||
wxString temp = wxFileSelector(wxT("Export save as.."), wxString::FromAscii(DefaultIOPath.c_str()),
|
wxString fileName = wxFileSelector(wxT("Export save as.."), wxString::FromAscii(DefaultIOPath.c_str()),
|
||||||
wxString::FromAscii(tempC), wxT(".gci"), wxString::Format
|
wxString::FromAscii(tempC), wxT(".gci"), wxString::Format
|
||||||
(
|
(
|
||||||
wxT("Native GCI files (*.gci)|*.gci|")
|
wxT("Native GCI files (*.gci)|*.gci|")
|
||||||
|
@ -606,12 +606,11 @@ void CMemcardManager::CopyDeleteClick(wxCommandEvent& event)
|
||||||
),
|
),
|
||||||
wxFD_OVERWRITE_PROMPT|wxFD_SAVE);
|
wxFD_OVERWRITE_PROMPT|wxFD_SAVE);
|
||||||
|
|
||||||
if (temp.length() > 0)
|
if (fileName.length() > 0)
|
||||||
{
|
{
|
||||||
const char * fileName = temp.mb_str();
|
if (!CopyDeleteSwitch(memoryCard[slot]->ExportGci(index, fileName.mb_str(), NULL), -1))
|
||||||
if (!CopyDeleteSwitch(memoryCard[slot]->ExportGci(index, fileName, NULL), -1))
|
|
||||||
{
|
{
|
||||||
File::Delete(temp.mb_str());
|
File::Delete(fileName.mb_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue