mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2024-11-15 05:47:56 -07:00
update EXI_DeviceIPL to use Sram.h
remove a few panicalerts git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@2512 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
78a62cc72a
commit
8ec6c0eea4
@ -20,11 +20,10 @@
|
||||
#include "EXI_DeviceIPL.h"
|
||||
#include "../Core.h"
|
||||
#include "../ConfigManager.h"
|
||||
|
||||
#include "MemoryUtil.h"
|
||||
|
||||
// english
|
||||
const unsigned char sram_dump[64] = {
|
||||
SRAM sram_dump = {
|
||||
0x04, 0x6B, 0xFB, 0x91, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0x40,
|
||||
0x05, 0x00, 0x00, 0x2C, 0x00, 0x00, 0x00, 0x00,
|
||||
@ -36,7 +35,7 @@ const unsigned char sram_dump[64] = {
|
||||
};
|
||||
|
||||
// german
|
||||
const unsigned char sram_dump_german[64] ={
|
||||
SRAM sram_dump_german = {
|
||||
0x1F, 0x66, 0xE0, 0x96, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x04, 0xEA, 0x19, 0x40,
|
||||
0x00, 0x00, 0x01, 0x3C, 0x12, 0xD5, 0xEA, 0xD3,
|
||||
@ -114,15 +113,15 @@ CEXIIPL::CEXIIPL() :
|
||||
pStream = fopen(SConfig::GetInstance().m_LocalCoreStartupParameter.m_strSRAM.c_str(), "rb");
|
||||
if (pStream != NULL)
|
||||
{
|
||||
fread(m_SRAM, 1, 64, pStream);
|
||||
fread(&m_SRAM, 1, 64, pStream);
|
||||
fclose(pStream);
|
||||
}
|
||||
else
|
||||
{
|
||||
memcpy(m_SRAM, sram_dump, sizeof(m_SRAM));
|
||||
m_SRAM = sram_dump;
|
||||
}
|
||||
// We Overwrite it here since it's possible on the GC to change the language as you please
|
||||
m_SRAM[0x12] = SConfig::GetInstance().m_LocalCoreStartupParameter.SelectedLanguage;
|
||||
m_SRAM.syssram.lang = SConfig::GetInstance().m_LocalCoreStartupParameter.SelectedLanguage;
|
||||
|
||||
WriteProtectMemory(m_pIPL, ROM_SIZE);
|
||||
m_uAddress = 0;
|
||||
@ -145,7 +144,7 @@ CEXIIPL::~CEXIIPL()
|
||||
FILE *file = fopen(SConfig::GetInstance().m_LocalCoreStartupParameter.m_strSRAM.c_str(), "wb");
|
||||
if (file)
|
||||
{
|
||||
fwrite(m_SRAM, 1, 64, file);
|
||||
fwrite(&m_SRAM, 1, 64, file);
|
||||
fclose(file);
|
||||
}
|
||||
}
|
||||
@ -249,9 +248,9 @@ void CEXIIPL::TransferByte(u8& _uByte)
|
||||
else if ((m_uAddress & 0x7FFFFF00) == 0x20000100)
|
||||
{
|
||||
if (m_uAddress & 0x80000000)
|
||||
m_SRAM[(m_uAddress & 0x3F) + m_uRWOffset] = _uByte;
|
||||
m_SRAM.p_SRAM[(m_uAddress & 0x3F) + m_uRWOffset] = _uByte;
|
||||
else
|
||||
_uByte = m_SRAM[(m_uAddress & 0x3F) + m_uRWOffset];
|
||||
_uByte = m_SRAM.p_SRAM[(m_uAddress & 0x3F) + m_uRWOffset];
|
||||
}
|
||||
//
|
||||
// --- UART ---
|
||||
|
@ -19,6 +19,7 @@
|
||||
#define _EXIDEVICE_IPL_H
|
||||
|
||||
#include "EXI_Device.h"
|
||||
#include "Sram.h"
|
||||
|
||||
class CEXIIPL : public IEXIDevice
|
||||
{
|
||||
@ -45,7 +46,7 @@ private:
|
||||
u8 m_RTC[4];
|
||||
|
||||
//! SRam
|
||||
u8 m_SRAM[64];
|
||||
SRAM m_SRAM;
|
||||
|
||||
//! Helper
|
||||
u32 m_uPosition;
|
||||
|
@ -50,7 +50,8 @@ distribution.
|
||||
|
||||
#include "Common.h"
|
||||
|
||||
struct SRAM
|
||||
#pragma pack(push,1)
|
||||
union SRAM
|
||||
{
|
||||
struct _syssram { // Stored configuration value from the system SRAM area
|
||||
u8 checksum[2]; // holds the block checksum.
|
||||
@ -62,9 +63,8 @@ struct SRAM
|
||||
u8 ntd; // unknown attribute
|
||||
u8 lang; // language of system
|
||||
u8 flags; // device and operations flag
|
||||
}syssram;
|
||||
|
||||
struct _syssramex { // Stored configuration value from the extended SRAM area
|
||||
// Stored configuration value from the extended SRAM area
|
||||
u8 flash_id_1[12]; // flash_id[2][12] 96bit memorycard unlock flash ID
|
||||
u8 flash_id_2[12];
|
||||
u8 wirelessKbd_id[4]; // Device ID of last connected wireless keyboard
|
||||
@ -72,7 +72,9 @@ struct SRAM
|
||||
u8 dvderr_code; // last non-recoverable error from DVD interface
|
||||
u8 __padding0; // padding
|
||||
u8 flashID_chksum[4]; // 16bit checksum of unlock flash ID
|
||||
u8 __padding1[4]; // padding
|
||||
}syssramex;
|
||||
u8 __padding1[2]; // padding - libogc has this as [4]? I have it as 2 to make it 64
|
||||
}syssram;
|
||||
u8 p_SRAM[64];
|
||||
};
|
||||
#pragma pack(pop)
|
||||
#endif
|
||||
|
@ -1156,7 +1156,7 @@ bool GCMemcard::format(bool New)
|
||||
}
|
||||
|
||||
bool GCMemcard::formatWIP(int slot, bool New, bool sjis)
|
||||
{//slot = 1;
|
||||
{
|
||||
u32 data_size = 0x2000 * (0x80 * 0x10 - 5);
|
||||
u16 size = (((data_size / 0x2000) + 5) / 0x10);
|
||||
SRAM m_SRAM;
|
||||
@ -1176,37 +1176,10 @@ bool GCMemcard::formatWIP(int slot, bool New, bool sjis)
|
||||
}
|
||||
fread(&m_SRAM, 1, 64, pStream);
|
||||
fclose(pStream);
|
||||
rand = time = 0XFAB12B2D9FD80700ULL;//0x500;//gettime();
|
||||
|
||||
//////////////////////////////////////
|
||||
|
||||
PanicAlert("%2x,%2x,%4x,%4x,%4x,%x,%x,lang%x,flahs%x",BE16(m_SRAM.syssram.checksum),
|
||||
BE16(m_SRAM.syssram.checksum_inv),
|
||||
BE32(m_SRAM.syssram.ead0),
|
||||
BE32(m_SRAM.syssram.ead1),
|
||||
BE32(m_SRAM.syssram.counter_bias),
|
||||
m_SRAM.syssram.display_offsetH,
|
||||
m_SRAM.syssram.ntd,
|
||||
m_SRAM.syssram.lang,
|
||||
m_SRAM.syssram.flags);
|
||||
|
||||
PanicAlert("%4x%4x%4x,%4x%4x%4x,%4x,%4x,%4x,%x,%x,%4x,%4x",
|
||||
BE32(m_SRAM.syssramex.flash_id_1),
|
||||
BE32(&(m_SRAM.syssramex.flash_id_1[4])),
|
||||
BE32(&(m_SRAM.syssramex.flash_id_1[8])),
|
||||
BE32(m_SRAM.syssramex.flash_id_2),
|
||||
BE32(&(m_SRAM.syssramex.flash_id_2[4])),
|
||||
BE32(&(m_SRAM.syssramex.flash_id_2[8])),
|
||||
BE32(m_SRAM.syssramex.wirelessKbd_id),
|
||||
BE32(m_SRAM.syssramex.wirelessPad_id),
|
||||
BE32(&(m_SRAM.syssramex.wirelessPad_id[4])),
|
||||
m_SRAM.syssramex.dvderr_code,
|
||||
m_SRAM.syssramex.__padding0,
|
||||
BE32(m_SRAM.syssramex.flashID_chksum),
|
||||
BE32(m_SRAM.syssramex.__padding1));
|
||||
|
||||
// TODO: change this to whatever your target format is until this function works with any time
|
||||
rand = time = 0XFAB12B2D9FD80700ULL;//gettime();
|
||||
memset(&hdr, 0xFF, 0x2000);
|
||||
u8 * flash_id = slot ? m_SRAM.syssramex.flash_id_2 : m_SRAM.syssramex.flash_id_1;
|
||||
u8 * flash_id = slot ? m_SRAM.syssram.flash_id_2 : m_SRAM.syssram.flash_id_1;
|
||||
|
||||
for(int i = 0; i < 12; i++)
|
||||
{
|
||||
@ -1224,7 +1197,9 @@ PanicAlert("%4x%4x%4x,%4x%4x%4x,%4x,%4x,%4x,%x,%x,%4x,%4x",
|
||||
hdr.fmtTime.low = time & 0xFFFFFFFF;
|
||||
*(u32*)&(hdr.SramBias) = *(u32*)&(m_SRAM.syssram.counter_bias);
|
||||
*(u32*)&(hdr.SramLang) = m_SRAM.syssram.lang;
|
||||
*(u32*)&(hdr.Unk2) = 0;//tmp; tmp = _viReg[55]; static vu16* const _viReg = (u16*)0xCC002000;
|
||||
*(u32*)&(hdr.Unk2) = 1;//= _viReg[55]; static vu16* const _viReg = (u16*)0xCC002000;
|
||||
// TODO: find out why memcard cares if component cable used
|
||||
// for now set to one like main app
|
||||
*(u16*)&(hdr.deviceID) = 0;
|
||||
*(u16*)&(hdr.Size) = Common::swap16(size);
|
||||
*(u16*)&(hdr.Encoding) = Common::swap16(sjis ? 1 : 0);
|
||||
|
Loading…
Reference in New Issue
Block a user