diff --git a/Source/Core/Core/Src/HW/EXI_DeviceIPL.cpp b/Source/Core/Core/Src/HW/EXI_DeviceIPL.cpp index 6b6420b875..cdbb59500b 100644 --- a/Source/Core/Core/Src/HW/EXI_DeviceIPL.cpp +++ b/Source/Core/Core/Src/HW/EXI_DeviceIPL.cpp @@ -25,26 +25,52 @@ // english 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, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xD2, 0x2B, 0x29, 0xD5, 0xC7, 0xAA, 0x12, 0xCB, - 0x21, 0x27, 0xD1, 0x53, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x86, 0x00, 0xFF, 0x4A, 0x00, 0x00, 0x00, 0x00 + 0x04, 0x6B, + 0xFB, 0x91, + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + 0xFF, 0xFF, 0xFF, 0x40, + 0x05, + 0x00, + 0x00, + 0x2C, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xD2, 0x2B, 0x29, 0xD5, 0xC7, 0xAA, 0x12, 0xCB, 0x21, 0x27, 0xD1, 0x53, + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, + 0x00, 0x00, + 0x00, 0x00, + 0x00, 0x00, + 0x86, + 0x00, + 0xFF, 0x4A, + 0x00, 0x00, + 0x00, 0x00 }}; // german 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, - 0x00, 0xFA, 0x2D, 0x33, 0x13, 0x41, 0x26, 0x03, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x84, 0xFF, 0x00, 0x00, 0x00, 0x00 + 0x1F, 0x66, + 0xE0, 0x96, + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + 0x04, 0xEA, 0x19, 0x40, + 0x00, + 0x00, + 0x01, + 0x3C, + 0x12, 0xD5, 0xEA, 0xD3, 0x00, 0xFA, 0x2D, 0x33, 0x13, 0x41, 0x26, 0x03, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, + 0x00, 0x00, + 0x00, 0x00, + 0x00, 0x00, + 0x00, + 0x00, + 0x84, 0xFF, + 0x00, 0x00, + 0x00, 0x00 }}; @@ -55,7 +81,7 @@ static const char iplverPAL[0x100] = "(C) 1999-2001 Nintendo. All rights reserv "(C) 1999 ArtX Inc. All rights reserved." "PAL Revision 1.0 "; -static const char iplverNTSC[0x100] = "(C) 1999-2001 Nintendo. All rights reserved." +static const char iplverNTSC[0x100]= "(C) 1999-2001 Nintendo. All rights reserved." "(C) 1999 ArtX Inc. All rights reserved."; // bootrom descrambler reversed by segher @@ -157,7 +183,7 @@ CEXIIPL::CEXIIPL() : m_SRAM = sram_dump; } // We Overwrite language selection here since it's possible on the GC to change the language as you please - m_SRAM.syssram.lang = SConfig::GetInstance().m_LocalCoreStartupParameter.SelectedLanguage; + m_SRAM.lang = SConfig::GetInstance().m_LocalCoreStartupParameter.SelectedLanguage; WriteProtectMemory(m_pIPL, ROM_SIZE); m_uAddress = 0; @@ -391,7 +417,7 @@ u32 CEXIIPL::GetGCTime() #else u64 ltime = Common::Timer::GetLocalTimeSinceJan1970(); if (SConfig::GetInstance().m_LocalCoreStartupParameter.bWii) - return ((u32)ltime - cJanuary2000 - cWiiBias); + return ((u32)ltime - cJanuary2000 - cWiiBias/* + 32434790*/); else return ((u32)ltime - cJanuary2000); #endif diff --git a/Source/Core/Core/Src/HW/MemmapFunctions.cpp b/Source/Core/Core/Src/HW/MemmapFunctions.cpp index 7e26e10514..b7bc9fb4d9 100644 --- a/Source/Core/Core/Src/HW/MemmapFunctions.cpp +++ b/Source/Core/Core/Src/HW/MemmapFunctions.cpp @@ -146,7 +146,7 @@ u32 EFB_Read(const u32 addr) return var; } -template +template inline void ReadFromHardware(T &_var, u32 em_address, u32 effective_address, Memory::XCheckTLBFlag flag) { // TODO: Figure out the fastest order of tests for both read and write (they are probably different). @@ -214,7 +214,7 @@ inline void ReadFromHardware(T &_var, u32 em_address, u32 effective_address, Mem } -template +template inline void WriteToHardware(u32 em_address, const T data, u32 effective_address, Memory::XCheckTLBFlag flag) { // Debugging: CheckForBadAddresses##_type(em_address, data, false); @@ -222,9 +222,9 @@ inline void WriteToHardware(u32 em_address, const T data, u32 effective_address, // reason we end up in this function: if (em_address == 0xCC008000) { switch (sizeof(T)) { - case 1: GPFifo::Write8(data, em_address); return; - case 2: GPFifo::Write16(data, em_address); return; - case 4: GPFifo::Write32(data, em_address); return; + case 1: GPFifo::Write8((u8)data, em_address); return; + case 2: GPFifo::Write16((u16)data, em_address); return; + case 4: GPFifo::Write32((u32)data, em_address); return; } } if ((em_address & 0xC8000000) == 0xC8000000) diff --git a/Source/Core/Core/Src/HW/Sram.h b/Source/Core/Core/Src/HW/Sram.h index 461ab69370..0d8a480cbd 100644 --- a/Source/Core/Core/Src/HW/Sram.h +++ b/Source/Core/Core/Src/HW/Sram.h @@ -54,12 +54,12 @@ distribution. union SRAM { u8 p_SRAM[64]; - struct _syssram { // Stored configuration value from the system SRAM area - u8 checksum[2]; // holds the block checksum. - u8 checksum_inv[2]; // holds the inverse block checksum - u8 ead0[4]; // unknown attribute - u8 ead1[4]; // unknown attribute - u8 counter_bias[4]; // bias value for the realtime clock + struct { // Stored configuration value from the system SRAM area + u16 checksum; // holds the block checksum. + u16 checksum_inv; // holds the inverse block checksum + u32 ead0; // unknown attribute + u32 ead1; // unknown attribute + u32 counter_bias; // bias value for the realtime clock s8 display_offsetH; // pixel offset for the VI u8 ntd; // unknown attribute u8 lang; // language of system @@ -67,13 +67,13 @@ union SRAM // Stored configuration value from the extended SRAM area u8 flash_id[2][12]; // flash_id[2][12] 96bit memorycard unlock flash ID - u8 wirelessKbd_id[4]; // Device ID of last connected wireless keyboard - u8 wirelessPad_id[8]; // 16bit device ID of last connected pad. + u32 wirelessKbd_id; // Device ID of last connected wireless keyboard + u16 wirelessPad_id[4]; // 16bit device ID of last connected pad. 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[2]; // padding - libogc has this as [4]? I have it as 2 to make it 64 - }syssram; + u8 __padding0; // reserved + u16 flashID_chksum[2]; // 16bit checksum of unlock flash ID + u16 __padding1; // padding + }; }; #pragma pack(pop) #endif diff --git a/Source/Core/DolphinWX/Src/MemoryCards/GCMemcard.cpp b/Source/Core/DolphinWX/Src/MemoryCards/GCMemcard.cpp index 7745996c0f..77d1f2bc43 100644 --- a/Source/Core/DolphinWX/Src/MemoryCards/GCMemcard.cpp +++ b/Source/Core/DolphinWX/Src/MemoryCards/GCMemcard.cpp @@ -1171,15 +1171,15 @@ bool GCMemcard::Format(bool sjis, bool New, int slot, u16 SizeMb, bool hdrOnly) for(int i = 0; i < 12; i++) { rand = (((rand * (u64)0x0000000041c64e6dULL) + (u64)0x0000000000003039ULL) >> 16); - hdr.serial[i] = (u8)(m_SRAM.syssram.flash_id[slot][i] + (u32)rand); + hdr.serial[i] = (u8)(m_SRAM.flash_id[slot][i] + (u32)rand); rand = (((rand * (u64)0x0000000041c64e6dULL) + (u64)0x0000000000003039ULL) >> 16); rand &= (u64)0x0000000000007fffULL; } hdr.fmtTime.high = (time >> 32) & 0xFFFFFFFF; hdr.fmtTime.low = time & 0xFFFFFFFF; - *(u32*)&(hdr.SramBias) = *(u32*)&(m_SRAM.syssram.counter_bias); - *(u32*)&(hdr.SramLang) = m_SRAM.syssram.lang; + *(u32*)&(hdr.SramBias) = m_SRAM.counter_bias; + *(u32*)&(hdr.SramLang) = m_SRAM.lang; *(u32*)&(hdr.Unk2) = Common::swap32(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;