diff --git a/Source/Core/Core/Core.vcproj b/Source/Core/Core/Core.vcproj index 447d09692d..3839a364c3 100644 --- a/Source/Core/Core/Core.vcproj +++ b/Source/Core/Core/Core.vcproj @@ -710,6 +710,14 @@ RelativePath=".\Src\Hw\EXI_DeviceAD16.h" > + + + + @@ -782,6 +790,14 @@ RelativePath=".\Src\HW\SI_Device.h" > + + + + @@ -1976,7 +1992,7 @@ > > 32) & 0xFFFFFFFF , (u32)TitleID & 0xFFFFFFFF ); return FULL_MAPS_DIR + std::string(tmpBuffer) + ".map"; - } - } + } + } break; case SCoreStartupParameter::BOOT_ELF: @@ -136,17 +136,23 @@ bool CBoot::LoadMapFromFilename(const std::string &_rFilename, const char *_game return success; } - - -// Load a GC or Wii BIOS file -bool CBoot::Load_BIOS(const std::string& _rBiosFilename) +// This function does *some* of what BS1 does: loading IPL(BS2) and jumping to it +// It does not initialize the hardware or anything else like BS1 does +// We should eventually just load BS1 and let it take care of everything :) +bool CBoot::Load_BS2(const std::string& _rBootROMFilename) { + // Load the whole ROM dump std::string data; - if (!File::ReadFileToString(false, _rBiosFilename.c_str(), data)) + if (!File::ReadFileToString(false, _rBootROMFilename.c_str(), data)) return false; - Memory::WriteBigEData((const u8*)data.data() + 0x820, 0x81300000, (int)data.size() - 0x820); - PC = 0x81300000; + // Run the descrambler over the encrypted section containing BS1/BS2 + CEXIIPL::Descrambler((u8*)data.data()+0x100, 0x1AFE00); + + //File::WriteStringToFile(false, data, "decrypted_bs1_bs2.bin"); + //Memory::WriteBigEData((const u8*)data.data() + 0x100, 0x81200000, 0x700); + Memory::WriteBigEData((const u8*)data.data() + 0x820, 0x81300000, 0x1AFE00); + PC = 0x81300000; return true; } @@ -189,29 +195,28 @@ bool CBoot::BootUp() DVDInterface::SetDiscInside(VolumeHandler::IsValid()); - // Use HLE BIOS or not - if (_StartupPara.bHLEBios) + // HLE BS2 or not + if (_StartupPara.bHLE_BS2) { if (!VolumeHandler::IsWii()) - EmulatedBIOS(bDebugIsoBootup); + EmulatedBS2(bDebugIsoBootup); else { _StartupPara.bWii = true; - EmulatedBIOS_Wii(bDebugIsoBootup); + EmulatedBS2_Wii(bDebugIsoBootup); } } else { - // If we can't load the BIOS file we use the HLE BIOS instead - if (!Load_BIOS(_StartupPara.m_strBios)) + // If we can't load the bootrom file we HLE it instead + if (!Load_BS2(_StartupPara.m_strBootROM)) { - // fails to load a BIOS so HLE it if (!VolumeHandler::IsWii()) - EmulatedBIOS(bDebugIsoBootup); + EmulatedBS2(bDebugIsoBootup); else { _StartupPara.bWii = true; - EmulatedBIOS_Wii(bDebugIsoBootup); + EmulatedBS2_Wii(bDebugIsoBootup); } } } @@ -237,19 +242,19 @@ bool CBoot::BootUp() PanicAlert("Warning - starting DOL in wrong console mode!"); } - // stop apploader from running when BIOS boots + // stop apploader from running when the BS2 HLE funcs run VolumeHandler::SetVolumeName(""); if (dolWii) { - EmulatedBIOS_Wii(false); + EmulatedBS2_Wii(false); } else { if (!VolumeHandler::IsWii() && !_StartupPara.m_strDefaultGCM.empty()) { VolumeHandler::SetVolumeName(_StartupPara.m_strDefaultGCM.c_str()); - EmulatedBIOS(false); + EmulatedBS2(false); } } @@ -282,19 +287,19 @@ bool CBoot::BootUp() PanicAlert("Warning - starting ELF in wrong console mode!"); } - // stop apploader from running when BIOS boots + // stop apploader from running when the BS2 HLE funcs run VolumeHandler::SetVolumeName(""); if (elfWii) { - EmulatedBIOS_Wii(false); + EmulatedBS2_Wii(false); } else { if (!VolumeHandler::IsWii() && !_StartupPara.m_strDefaultGCM.empty()) { VolumeHandler::SetVolumeName(_StartupPara.m_strDefaultGCM.c_str()); - EmulatedBIOS(false); + EmulatedBS2(false); } } @@ -342,12 +347,12 @@ bool CBoot::BootUp() break; - // BIOS + // Bootstrap 2 (AKA: Initial Program Loader, "BIOS") // =================================================================================== - case SCoreStartupParameter::BOOT_BIOS: + case SCoreStartupParameter::BOOT_BS2: { DVDInterface::SetDiscInside(VolumeHandler::IsValid()); - if (Load_BIOS(_StartupPara.m_strBios)) + if (Load_BS2(_StartupPara.m_strBootROM)) { if (LoadMapFromFilename(_StartupPara.m_strFilename)) HLE::PatchFunctions(); diff --git a/Source/Core/Core/Src/Boot/Boot.h b/Source/Core/Core/Src/Boot/Boot.h index 80fe69e6d3..5f6dea2f5b 100644 --- a/Source/Core/Core/Src/Boot/Boot.h +++ b/Source/Core/Core/Src/Boot/Boot.h @@ -36,8 +36,6 @@ public: static bool Install_WiiWAD(const char *filename); private: - enum { BIOS_SIZE = 2*1024*1024 }; - static void RunFunction(u32 _iAddr); static void UpdateDebugger_MapLoaded(const char* _gameID = NULL); @@ -46,9 +44,9 @@ private: static bool Boot_ELF(const char *filename); static bool Boot_WiiWAD(const char *filename); - static void EmulatedBIOS(bool _bDebug); - static bool EmulatedBIOS_Wii(bool _bDebug); - static bool Load_BIOS(const std::string& _rBiosFilename); + static void EmulatedBS2(bool _bDebug); + static bool EmulatedBS2_Wii(bool _bDebug); + static bool Load_BS2(const std::string& _rBootROMFilename); static void Load_FST(bool _bIsWii); static bool SetupWiiMemory(unsigned int _CountryCode); diff --git a/Source/Core/Core/Src/Boot/Boot_BIOSEmu.cpp b/Source/Core/Core/Src/Boot/Boot_BS2Emu.cpp similarity index 97% rename from Source/Core/Core/Src/Boot/Boot_BIOSEmu.cpp rename to Source/Core/Core/Src/Boot/Boot_BS2Emu.cpp index 46b57cd067..b18464d2bb 100644 --- a/Source/Core/Core/Src/Boot/Boot_BIOSEmu.cpp +++ b/Source/Core/Core/Src/Boot/Boot_BS2Emu.cpp @@ -44,13 +44,12 @@ void CBoot::RunFunction(u32 _iAddr) } // __________________________________________________________________________________________________ -// -// GameCube BIOS HLE: +// GameCube Bootstrap 2 HLE: // copy the apploader to 0x81200000 // execute the apploader, function by function, using the above utility. -void CBoot::EmulatedBIOS(bool _bDebug) +void CBoot::EmulatedBS2(bool _bDebug) { - INFO_LOG(BOOT, "Faking GC BIOS..."); + INFO_LOG(BOOT, "Faking GC BS2..."); UReg_MSR& m_MSR = ((UReg_MSR&)PowerPC::ppcState.msr); m_MSR.FP = 1; @@ -153,14 +152,14 @@ void CBoot::EmulatedBIOS(bool _bDebug) // return PC = PowerPC::ppcState.gpr[3]; - // --- preinit some stuff from bios --- + // --- preinit some stuff from IPL --- // Bus Clock Speed Memory::Write_U32(0x09a7ec80, 0x800000F8); // CPU Clock Speed Memory::Write_U32(0x1cf7c580, 0x800000FC); - // fake the VI Init of the BIOS + // fake the VI Init of the IPL Memory::Write_U32(SConfig::GetInstance().m_LocalCoreStartupParameter.bNTSC ? 0 : 1, 0x800000CC); @@ -277,7 +276,7 @@ bool CBoot::SetupWiiMemory(unsigned int _CountryCode) Memory::Write_U16(0x0000, 0x000030e0); // PADInit Memory::Write_U32(0x80000000, 0x00003184); // GameID Address - // Fake the VI Init of the BIOS + // Fake the VI Init of the IPL Memory::Write_U32(SConfig::GetInstance().m_LocalCoreStartupParameter.bNTSC ? 0 : 1, 0x000000CC); // Clear exception handler. Why? Don't we begin with only zeros? @@ -289,14 +288,12 @@ bool CBoot::SetupWiiMemory(unsigned int _CountryCode) } // __________________________________________________________________________________________________ -// -// Wii BIOS HLE: +// Wii Bootstrap 2 HLE: // copy the apploader to 0x81200000 // execute the apploader -// -bool CBoot::EmulatedBIOS_Wii(bool _bDebug) +bool CBoot::EmulatedBS2_Wii(bool _bDebug) { - INFO_LOG(BOOT, "Faking Wii BIOS..."); + INFO_LOG(BOOT, "Faking Wii BS2..."); // setup wii memory DiscIO::IVolume::ECountry CountryCode = DiscIO::IVolume::COUNTRY_UNKNOWN; diff --git a/Source/Core/Core/Src/ConfigManager.cpp b/Source/Core/Core/Src/ConfigManager.cpp index 8126e93c57..db75bf485a 100644 --- a/Source/Core/Core/Src/ConfigManager.cpp +++ b/Source/Core/Core/Src/ConfigManager.cpp @@ -96,7 +96,7 @@ void SConfig::SaveSettings() ini.Set("GameList", "ListUsa", m_ListUsa); // Core - ini.Set("Core", "HLEBios", m_LocalCoreStartupParameter.bHLEBios); + ini.Set("Core", "HLE_BS2", m_LocalCoreStartupParameter.bHLE_BS2); ini.Set("Core", "UseDynarec", m_LocalCoreStartupParameter.bUseJIT); ini.Set("Core", "UseDualCore", m_LocalCoreStartupParameter.bUseDualCore); ini.Set("Core", "DSPThread", m_LocalCoreStartupParameter.bDSPThread); @@ -208,7 +208,7 @@ void SConfig::LoadSettings() ini.Get("GameList", "ListUsa", &m_ListUsa, true); // Core - ini.Get("Core", "HLEBios", &m_LocalCoreStartupParameter.bHLEBios, true); + ini.Get("Core", "HLE_BS2", &m_LocalCoreStartupParameter.bHLE_BS2, true); ini.Get("Core", "UseDynarec", &m_LocalCoreStartupParameter.bUseJIT, true); ini.Get("Core", "DSPThread", &m_LocalCoreStartupParameter.bDSPThread, true); ini.Get("Core", "UseDualCore", &m_LocalCoreStartupParameter.bUseDualCore, false); diff --git a/Source/Core/Core/Src/CoreParameter.cpp b/Source/Core/Core/Src/CoreParameter.cpp index 2cbb14d610..ea902fc7ed 100644 --- a/Source/Core/Core/Src/CoreParameter.cpp +++ b/Source/Core/Core/Src/CoreParameter.cpp @@ -61,11 +61,11 @@ void SCoreStartupParameter::LoadDefaults() m_strUniqueID = "00000000"; } -bool SCoreStartupParameter::AutoSetup(EBootBios _BootBios) +bool SCoreStartupParameter::AutoSetup(EBootBS2 _BootBS2) { std::string Region(EUR_DIR); - switch (_BootBios) + switch (_BootBS2) { case BOOT_DEFAULT: { @@ -191,19 +191,19 @@ bool SCoreStartupParameter::AutoSetup(EBootBios _BootBios) } break; - case BOOT_BIOS_USA: + case BOOT_BS2_USA: Region = USA_DIR; m_strFilename.clear(); bNTSC = true; break; - case BOOT_BIOS_JAP: + case BOOT_BS2_JAP: Region = JAP_DIR; m_strFilename.clear(); bNTSC = true; break; - case BOOT_BIOS_EUR: + case BOOT_BS2_EUR: Region = EUR_DIR; m_strFilename.clear(); bNTSC = false; @@ -216,20 +216,20 @@ bool SCoreStartupParameter::AutoSetup(EBootBios _BootBios) m_strSRAM = GC_SRAM_FILE; if (!bWii) { - m_strBios = File::GetSysDirectory() + GC_SYS_DIR + DIR_SEP + Region + DIR_SEP GC_IPL; - if (!bHLEBios) + m_strBootROM = File::GetSysDirectory() + GC_SYS_DIR + DIR_SEP + Region + DIR_SEP GC_IPL; + if (!bHLE_BS2) { - if (!File::Exists(m_strBios.c_str())) + if (!File::Exists(m_strBootROM.c_str())) { - WARN_LOG(BOOT, "BIOS file %s not found - using HLE.", m_strBios.c_str()); - bHLEBios = true; + WARN_LOG(BOOT, "bootrom file %s not found - using HLE.", m_strBootROM.c_str()); + bHLE_BS2 = true; } } } - else if (bWii && !bHLEBios) + else if (bWii && !bHLE_BS2) { - WARN_LOG(BOOT, "GC BIOS file will not be loaded for Wii mode."); - bHLEBios = true; + WARN_LOG(BOOT, "GC bootrom file will not be loaded for Wii mode."); + bHLE_BS2 = true; } return true; diff --git a/Source/Core/Core/Src/CoreParameter.h b/Source/Core/Core/Src/CoreParameter.h index 78e479c938..f388837352 100644 --- a/Source/Core/Core/Src/CoreParameter.h +++ b/Source/Core/Core/Src/CoreParameter.h @@ -60,7 +60,7 @@ struct SCoreStartupParameter bool bDSPThread; bool bSkipIdle; bool bNTSC; - bool bHLEBios; + bool bHLE_BS2; bool bUseFastMem; bool bLockThreads; bool bOptimizeQuantizers; @@ -81,12 +81,12 @@ struct SCoreStartupParameter bool bConfirmStop, bHideCursor, bAutoHideCursor, bUsePanicHandlers; int iTheme; - enum EBootBios + enum EBootBS2 { BOOT_DEFAULT, - BOOT_BIOS_JAP, - BOOT_BIOS_USA, - BOOT_BIOS_EUR, + BOOT_BS2_JAP, + BOOT_BS2_USA, + BOOT_BS2_EUR, }; enum EBootType @@ -95,7 +95,7 @@ struct SCoreStartupParameter BOOT_ELF, BOOT_DOL, BOOT_WII_NAND, - BOOT_BIOS + BOOT_BS2 }; EBootType m_BootType; @@ -106,7 +106,7 @@ struct SCoreStartupParameter std::string m_strWiimotePlugin[MAXWIIMOTES]; std::string m_strFilename; - std::string m_strBios; + std::string m_strBootROM; std::string m_strSRAM; std::string m_strDefaultGCM; std::string m_strDVDRoot; @@ -118,7 +118,7 @@ struct SCoreStartupParameter SCoreStartupParameter(); void LoadDefaults(); - bool AutoSetup(EBootBios _BootBios); + bool AutoSetup(EBootBS2 _BootBS2); const std::string &GetUniqueID() const { return m_strUniqueID; } void CheckMemcardPath(std::string& memcardPath, std::string Region, bool isSlotA); }; diff --git a/Source/Core/Core/Src/HW/EXI_DeviceIPL.cpp b/Source/Core/Core/Src/HW/EXI_DeviceIPL.cpp index 04b784b25f..f1527caf12 100644 --- a/Source/Core/Core/Src/HW/EXI_DeviceIPL.cpp +++ b/Source/Core/Core/Src/HW/EXI_DeviceIPL.cpp @@ -58,27 +58,91 @@ static const char iplverPAL[0x100] = "(C) 1999-2001 Nintendo. All rights reserv static const char iplverNTSC[0x100] = "(C) 1999-2001 Nintendo. All rights reserved." "(C) 1999 ArtX Inc. All rights reserved."; +// segher is a supercomputer +void CEXIIPL::Descrambler(u8* data, u32 size) +{ + u8 acc = 0; + u8 nacc = 0; + + u16 t = 0x2953; + u16 u = 0xd9c2; + u16 v = 0x3ff1; + + u8 x = 1; + + for (u32 it = 0; it < size;) + { + int t0 = t & 1; + int t1 = (t >> 1) & 1; + int u0 = u & 1; + int u1 = (u >> 1) & 1; + int v0 = v & 1; + + x ^= t1 ^ v0; + x ^= (u0 | u1); + x ^= (t0 ^ u1 ^ v0) & (t0 ^ u0); + + if (t0 == u0) + { + v >>= 1; + if (v0) + v ^= 0xb3d0; + } + + if (t0 == 0) + { + u >>= 1; + if (u0) + u ^= 0xfb10; + } + + t >>= 1; + if (t0) + t ^= 0xa740; + + nacc++; + acc = 2*acc + x; + if (nacc == 8) + { + data[it++] ^= acc; + nacc = 0; + } + } +} CEXIIPL::CEXIIPL() : m_uPosition(0), m_uAddress(0), m_uRWOffset(0), - m_count(0) + m_count(0), + m_FontsLoaded(false) { // Determine region m_bNTSC = SConfig::GetInstance().m_LocalCoreStartupParameter.bNTSC; // Create the IPL m_pIPL = (u8*)AllocateMemoryPages(ROM_SIZE); + + if (SConfig::GetInstance().m_LocalCoreStartupParameter.bHLE_BS2) + { + // Copy header + memcpy(m_pIPL, m_bNTSC ? iplverNTSC : iplverPAL, sizeof(m_bNTSC ? iplverNTSC : iplverPAL)); - // Copy header - memcpy(m_pIPL, m_bNTSC ? iplverNTSC : iplverPAL, sizeof(m_bNTSC ? iplverNTSC : iplverPAL)); + // Load fonts + LoadFileToIPL((File::GetSysDirectory() + GC_SYS_DIR + DIR_SEP + FONT_SJIS), 0x1aff00); + LoadFileToIPL((File::GetSysDirectory() + GC_SYS_DIR + DIR_SEP + FONT_ANSI), 0x1fcf00); + } + else + { + m_FontsLoaded = true; + // Load whole ROM dump + LoadFileToIPL(SConfig::GetInstance().m_LocalCoreStartupParameter.m_strBootROM, 0); + // Descramble the encrypted section (contains BS1 and BS2) + Descrambler(m_pIPL + 0x100, 0x1aff00); + INFO_LOG(BOOT, "Loaded bootrom: %s", m_pIPL); // yay for null-terminated strings ;p + } - // Load fonts - LoadFileToIPL((File::GetSysDirectory() + GC_SYS_DIR + DIR_SEP + FONT_SJIS).c_str(), 0x001aff00); - LoadFileToIPL((File::GetSysDirectory() + GC_SYS_DIR + DIR_SEP + FONT_ANSI).c_str(), 0x001fcf00); - - // Clear RTC + // Clear RTC memset(m_RTC, 0, sizeof(m_RTC)); // SRAM @@ -92,7 +156,7 @@ CEXIIPL::CEXIIPL() : { m_SRAM = sram_dump; } - // We Overwrite it here since it's possible on the GC to change the language as you please + // 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; WriteProtectMemory(m_pIPL, ROM_SIZE); @@ -110,7 +174,7 @@ CEXIIPL::~CEXIIPL() { FreeMemoryPages(m_pIPL, ROM_SIZE); m_pIPL = NULL; - } + } // SRAM FILE *file = fopen(SConfig::GetInstance().m_LocalCoreStartupParameter.m_strSRAM.c_str(), "wb"); @@ -122,15 +186,12 @@ CEXIIPL::~CEXIIPL() } 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); + p.DoArray(m_RTC, 4); } -void CEXIIPL::LoadFileToIPL(const char* filename, u32 offset) +void CEXIIPL::LoadFileToIPL(std::string filename, u32 offset) { - FILE* pStream = NULL; - pStream = fopen(filename, "rb"); + FILE* pStream = fopen(filename.c_str(), "rb"); if (pStream != NULL) { fseek(pStream, 0, SEEK_END); @@ -139,13 +200,8 @@ void CEXIIPL::LoadFileToIPL(const char* filename, u32 offset) fread(m_pIPL + offset, 1, filesize, pStream); fclose(pStream); - } - else - { - // This is a poor way to handle failure. We should either not display this message unless fonts - // are actually accessed, or better yet, emulate them using a system font. -bushing - PanicAlert("Error: failed to load %s. Fonts in a few games may not work, or crash the game.", - filename); + + m_FontsLoaded = true; } } @@ -229,41 +285,34 @@ void CEXIIPL::TransferByte(u8& _uByte) } else { - // - // --- ROM --- - // + // --- Encrypted ROM --- + // atm we pre-decrypt the whole thing, see CEXIIPL ctor if ((m_uAddress & 0x60000000) == 0) { if ((m_uAddress & 0x80000000) == 0) - _uByte = m_pIPL[((m_uAddress >> 6) & ROM_MASK) + m_uRWOffset]; -#if 0 - u32 position = ((m_uAddress >> 6) & ROM_MASK) + m_uRWOffset; - char msg[5] = ""; - if (position >= 0 && position < 0x100) - sprintf(msg, "COPY"); - else if (position >= 0x00000100 && position <= 0x001aeee8) - sprintf(msg, "BIOS"); - else if (position >= 0x001AFF00 && position <= 0x001FA0E0) - sprintf(msg, "SJIS"); - else if (position >= 0x001FCF00 && position <= 0x001FF474) - sprintf(msg, "ANSI"); - WARN_LOG(EXPANSIONINTERFACE, "m_pIPL[0x%08x] = 0x%02x %s\t0x%08x 0x%08x 0x%08x", - position, _uByte, msg, m_uPosition,m_uAddress,m_uRWOffset); -#endif + { + u32 position = ((m_uAddress >> 6) & ROM_MASK) + m_uRWOffset; + + // Technically we should apply descrambling here, if it's currently enabled. + _uByte = m_pIPL[position]; + + if ((position >= 0x001AFF00) && (position <= 0x001FF474) && !m_FontsLoaded) + { + PanicAlert("Error: Trying to access %s fonts but they are not loaded. Games may not show fonts correctly, or crash.", + (position >= 0x001FCF00)?"ANSI":"SJIS"); + m_FontsLoaded = true; // Don't be a nag :p + } + } } - // // --- Real Time Clock (RTC) --- - // else if ((m_uAddress & 0x7FFFFF00) == 0x20000000) { if (m_uAddress & 0x80000000) m_RTC[(m_uAddress & 0x03) + m_uRWOffset] = _uByte; else _uByte = m_RTC[(m_uAddress & 0x03) + m_uRWOffset]; - } - // + } // --- SRAM --- - // else if ((m_uAddress & 0x7FFFFF00) == 0x20000100) { if (m_uAddress & 0x80000000) @@ -271,9 +320,7 @@ void CEXIIPL::TransferByte(u8& _uByte) else _uByte = m_SRAM.p_SRAM[(m_uAddress & 0x3F) + m_uRWOffset]; } - // // --- UART --- - // else if ((m_uAddress & 0x7FFFFF00) == 0x20010000) { if (m_uAddress & 0x80000000) diff --git a/Source/Core/Core/Src/HW/EXI_DeviceIPL.h b/Source/Core/Core/Src/HW/EXI_DeviceIPL.h index 6eb95ab34b..edabe44598 100644 --- a/Source/Core/Core/Src/HW/EXI_DeviceIPL.h +++ b/Source/Core/Core/Src/HW/EXI_DeviceIPL.h @@ -26,13 +26,15 @@ class CEXIIPL : public IEXIDevice public: CEXIIPL(); virtual ~CEXIIPL(); + virtual void SetCS(int _iCS); bool IsPresent(); - static u32 GetGCTime(); void DoState(PointerWrap &p); -private: + static u32 GetGCTime(); + static void Descrambler(u8* data, u32 size); +private: enum { ROM_SIZE = 1024*1024*2, @@ -59,10 +61,11 @@ private: char m_szBuffer[256]; int m_count; + bool m_FontsLoaded; virtual void TransferByte(u8 &_uByte); - void LoadFileToIPL(const char* filename, u32 offset); + void LoadFileToIPL(std::string filename, u32 offset); }; #endif diff --git a/Source/Core/Core/Src/HW/ProcessorInterface.cpp b/Source/Core/Core/Src/HW/ProcessorInterface.cpp index 5b8f2cf486..51c021a18d 100644 --- a/Source/Core/Core/Src/HW/ProcessorInterface.cpp +++ b/Source/Core/Core/Src/HW/ProcessorInterface.cpp @@ -36,9 +36,10 @@ enum PI_FIFO_BASE = 0x0C, PI_FIFO_END = 0x10, PI_FIFO_WPTR = 0x14, - PI_FIFO_RESET = 0x18, // ??? - GXAbortFrameWrites to it + PI_FIFO_RESET = 0x18, // ??? - GXAbortFrame writes to it PI_RESET_CODE = 0x24, PI_MB_REV = 0x2C, + PI_UNKNOWN = 0x30 // ??? - BS1 writes to it }; @@ -49,9 +50,11 @@ volatile u32 m_InterruptMask; u32 Fifo_CPUBase; u32 Fifo_CPUEnd; u32 Fifo_CPUWritePointer; + u32 m_Fifo_Reset; u32 m_ResetCode; u32 m_MBRev; +u32 m_Unknown; // ID and callback for scheduling reset button presses/releases @@ -69,10 +72,10 @@ void DoState(PointerWrap &p) p.Do(Fifo_CPUBase); p.Do(Fifo_CPUEnd); p.Do(Fifo_CPUWritePointer); -// (shuffle2) Enable sometime ;p -// p.Do(m_Fifo_Reset); -// p.Do(m_ResetCode); -// p.Do(m_MBRev); + p.Do(m_Fifo_Reset); + p.Do(m_ResetCode); + p.Do(m_MBRev); + p.Do(m_Unknown); } void Init() @@ -85,6 +88,7 @@ void Init() Fifo_CPUWritePointer = 0; m_MBRev = 2 << 28; // HW2 production board + m_Unknown = 0; // Bleh, why? //m_ResetCode |= 0x80000000; diff --git a/Source/Core/Core/Src/HW/VideoInterface.h b/Source/Core/Core/Src/HW/VideoInterface.h index 61ae81b21e..5959c325c9 100644 --- a/Source/Core/Core/Src/HW/VideoInterface.h +++ b/Source/Core/Core/Src/HW/VideoInterface.h @@ -22,7 +22,7 @@ class PointerWrap; namespace VideoInterface { - // For BIOS HLE + // For BS2 HLE void PreInit(bool _bNTSC); void SetRegionReg(char _region); diff --git a/Source/Core/Core/Src/SConscript b/Source/Core/Core/Src/SConscript index 211d0ae058..13175dcfb0 100644 --- a/Source/Core/Core/Src/SConscript +++ b/Source/Core/Core/Src/SConscript @@ -20,7 +20,7 @@ files = ["ActionReplay.cpp", "Tracer.cpp", "VolumeHandler.cpp", "Boot/Boot.cpp", - "Boot/Boot_BIOSEmu.cpp", + "Boot/Boot_BS2Emu.cpp", "Boot/Boot_DOL.cpp", "Boot/Boot_ELF.cpp", "Boot/Boot_WiiWAD.cpp", diff --git a/Source/Core/DolphinWX/Src/BootManager.cpp b/Source/Core/DolphinWX/Src/BootManager.cpp index 22d803ede6..425bd55bed 100644 --- a/Source/Core/DolphinWX/Src/BootManager.cpp +++ b/Source/Core/DolphinWX/Src/BootManager.cpp @@ -31,7 +31,7 @@ Core Core.cpp Init Thread creation EmuThread Calls CBoot::BootUp Boot.cpp CBoot::BootUp() - CBoot::EmulatedBIOS_Wii() / GC() or Load_BIOS() + CBoot::EmulatedBS2_Wii() / GC() or Load_BS2() */ // ============= diff --git a/Source/Core/DolphinWX/Src/ConfigMain.cpp b/Source/Core/DolphinWX/Src/ConfigMain.cpp index 80f11d406a..8c09443e24 100644 --- a/Source/Core/DolphinWX/Src/ConfigMain.cpp +++ b/Source/Core/DolphinWX/Src/ConfigMain.cpp @@ -47,7 +47,7 @@ EVT_CHECKBOX(ID_INTERFACE_WIIMOTE_LEDS, CConfigMain::CoreSettingsChanged) EVT_CHECKBOX(ID_INTERFACE_WIIMOTE_SPEAKERS, CConfigMain::CoreSettingsChanged) EVT_CHOICE(ID_INTERFACE_LANG, CConfigMain::CoreSettingsChanged) -EVT_CHECKBOX(ID_ALLWAYS_HLEBIOS, CConfigMain::CoreSettingsChanged) +EVT_CHECKBOX(ID_ALLWAYS_HLE_BS2, CConfigMain::CoreSettingsChanged) EVT_CHECKBOX(ID_USEDYNAREC, CConfigMain::CoreSettingsChanged) EVT_CHECKBOX(ID_USEDUALCORE, CConfigMain::CoreSettingsChanged) EVT_CHECKBOX(ID_DSPTHREAD, CConfigMain::CoreSettingsChanged) @@ -119,7 +119,7 @@ void CConfigMain::UpdateGUI() if(Core::GetState() != Core::CORE_UNINITIALIZED) { // Disable the Core stuff on GeneralPage - AlwaysUseHLEBIOS->Disable(); + AlwaysHLE_BS2->Disable(); UseDynaRec->Disable(); UseDualCore->Disable(); DSPThread->Disable(); @@ -206,8 +206,8 @@ void CConfigMain::CreateGUIControls() Framelimit->SetSelection(SConfig::GetInstance().m_Framelimit); // Core Settings - Advanced - AlwaysUseHLEBIOS = new wxCheckBox(GeneralPage, ID_ALLWAYS_HLEBIOS, wxT("HLE the BIOS all the time"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator); - AlwaysUseHLEBIOS->SetValue(SConfig::GetInstance().m_LocalCoreStartupParameter.bHLEBios); + AlwaysHLE_BS2 = new wxCheckBox(GeneralPage, ID_ALLWAYS_HLE_BS2, wxT("Always HLE the IPL"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator); + AlwaysHLE_BS2->SetValue(SConfig::GetInstance().m_LocalCoreStartupParameter.bHLE_BS2); UseDynaRec = new wxCheckBox(GeneralPage, ID_USEDYNAREC, wxT("Enable the JIT dynarec"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator); UseDynaRec->SetValue(SConfig::GetInstance().m_LocalCoreStartupParameter.bUseJIT); LockThreads = new wxCheckBox(GeneralPage, ID_LOCKTHREADS, wxT("Lock threads to cores"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator); @@ -296,7 +296,7 @@ void CConfigMain::CreateGUIControls() sbBasic->Add(sFramelimit, 0, wxALL | wxEXPAND, 5); sbAdvanced = new wxStaticBoxSizer(wxVERTICAL, GeneralPage, wxT("Advanced Settings")); - sbAdvanced->Add(AlwaysUseHLEBIOS, 0, wxALL, 5); + sbAdvanced->Add(AlwaysHLE_BS2, 0, wxALL, 5); sbAdvanced->Add(UseDynaRec, 0, wxALL, 5); sbAdvanced->Add(LockThreads, 0, wxALL, 5); sbAdvanced->Add(OptimizeQuantizers, 0, wxALL, 5); @@ -630,8 +630,8 @@ void CConfigMain::CoreSettingsChanged(wxCommandEvent& event) case ID_FRAMELIMIT: SConfig::GetInstance().m_Framelimit = (u32)Framelimit->GetSelection(); break; - case ID_ALLWAYS_HLEBIOS: // Core - SConfig::GetInstance().m_LocalCoreStartupParameter.bHLEBios = AlwaysUseHLEBIOS->IsChecked(); + case ID_ALLWAYS_HLE_BS2: // Core + SConfig::GetInstance().m_LocalCoreStartupParameter.bHLE_BS2 = AlwaysHLE_BS2->IsChecked(); break; case ID_USEDYNAREC: SConfig::GetInstance().m_LocalCoreStartupParameter.bUseJIT = UseDynaRec->IsChecked(); diff --git a/Source/Core/DolphinWX/Src/ConfigMain.h b/Source/Core/DolphinWX/Src/ConfigMain.h index fab56c3f4b..b05f28e311 100644 --- a/Source/Core/DolphinWX/Src/ConfigMain.h +++ b/Source/Core/DolphinWX/Src/ConfigMain.h @@ -62,7 +62,7 @@ private: wxBoxSizer* sCore; wxStaticBoxSizer* sbBasic, *sbAdvanced, *sbInterface; - wxCheckBox* AlwaysUseHLEBIOS; + wxCheckBox* AlwaysHLE_BS2; wxCheckBox* UseDynaRec; wxCheckBox* UseDualCore; wxCheckBox* DSPThread; @@ -153,7 +153,7 @@ private: ID_PATHSPAGE, ID_PLUGINPAGE, - ID_ALLWAYS_HLEBIOS, + ID_ALLWAYS_HLE_BS2, ID_USEDYNAREC, ID_USEDUALCORE, ID_DSPTHREAD, diff --git a/Source/Core/DolphinWX/Src/Summarize.h b/Source/Core/DolphinWX/Src/Summarize.h index b30f2dd0b3..b7ddb1b58c 100644 --- a/Source/Core/DolphinWX/Src/Summarize.h +++ b/Source/Core/DolphinWX/Src/Summarize.h @@ -51,7 +51,7 @@ std::string Summarize_Settings() { return StringFromFormat( "Dolphin Settings\n\n" - "Always HLE Bios: %s\n" + "HLE the IPL: %s\n" "Use Dynarec: %s\n" "Use Dual Core: %s\n" "DSP Thread: %s\n" @@ -74,7 +74,7 @@ std::string Summarize_Settings() "Frame Limit: %d\n" "[Wii]Widescreen: %s\n" "[Wii]Progressive Scan: %s\n", - Core::GetStartupParameter().bHLEBios?"True":"False", + Core::GetStartupParameter().bHLE_BS2?"True":"False", Core::GetStartupParameter().bUseJIT?"True":"False", Core::GetStartupParameter().bUseDualCore?"True":"False", Core::GetStartupParameter().bDSPThread?"True":"False",