diff --git a/Source/Core/Core/Src/ARDecrypt.cpp b/Source/Core/Core/Src/ARDecrypt.cpp index 04072cebcb..34772b49b7 100644 --- a/Source/Core/Core/Src/ARDecrypt.cpp +++ b/Source/Core/Core/Src/ARDecrypt.cpp @@ -16,7 +16,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #include "ARDecrypt.h" diff --git a/Source/Core/Core/Src/ARDecrypt.h b/Source/Core/Core/Src/ARDecrypt.h index 5a9fcbce88..388e09a834 100644 --- a/Source/Core/Core/Src/ARDecrypt.h +++ b/Source/Core/Core/Src/ARDecrypt.h @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #ifndef _ARDECRYPT_H_ #define _ARDECRYPT_H_ diff --git a/Source/Core/Core/Src/ActionReplay.cpp b/Source/Core/Core/Src/ActionReplay.cpp index d14414c5ef..0cbf3d4f8d 100644 --- a/Source/Core/Core/Src/ActionReplay.cpp +++ b/Source/Core/Core/Src/ActionReplay.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ // ----------------------------------------------------------------------------------------- @@ -191,14 +191,16 @@ void LoadCodes(IniFile &ini, bool forceLoad) { AREntry op; bool success_addr = TryParse(std::string("0x") + pieces[0], &op.cmd_addr); - bool success_val = TryParse(std::string("0x") + pieces[1], &op.value); + bool success_val = TryParse(std::string("0x") + pieces[1], &op.value); if (!(success_addr | success_val)) { PanicAlertT("Action Replay Error: invalid AR code line: %s", line.c_str()); if (!success_addr) PanicAlertT("The address is invalid"); if (!success_val) PanicAlertT("The value is invalid"); } else + { currentCode.ops.push_back(op); + } } else { diff --git a/Source/Core/Core/Src/ActionReplay.h b/Source/Core/Core/Src/ActionReplay.h index e9f389b591..393fbad94b 100644 --- a/Source/Core/Core/Src/ActionReplay.h +++ b/Source/Core/Core/Src/ActionReplay.h @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #ifndef _ACTIONREPLAY_H_ diff --git a/Source/Core/Core/Src/Boot/Boot.cpp b/Source/Core/Core/Src/Boot/Boot.cpp index 2af2051b3d..78cadda395 100644 --- a/Source/Core/Core/Src/Boot/Boot.cpp +++ b/Source/Core/Core/Src/Boot/Boot.cpp @@ -53,7 +53,8 @@ void CBoot::Load_FST(bool _bIsWii) { - if (!VolumeHandler::IsValid()) return; + if (!VolumeHandler::IsValid()) + return; // copy first 20 bytes of disc to start of Mem 1 VolumeHandler::ReadToPtr(Memory::GetPointer(0x80000000), 0, 0x20); @@ -108,7 +109,7 @@ std::string CBoot::GenerateMapFilename() return File::GetUserPath(D_MAPS_IDX) + _StartupPara.GetUniqueID() + ".map"; } - return std::string("unknown map"); + return std::string("unknown map"); } bool CBoot::LoadMapFromFilename(const std::string &_rFilename, const char *_gameID) @@ -119,7 +120,7 @@ bool CBoot::LoadMapFromFilename(const std::string &_rFilename, const char *_game std::string strMapFilename = GenerateMapFilename(); bool success = false; - if (!g_symbolDB.LoadMap(strMapFilename.c_str())) + if (!g_symbolDB.LoadMap(strMapFilename.c_str())) { if (_gameID != NULL) { @@ -184,7 +185,7 @@ bool CBoot::Load_BS2(const std::string& _rBootROMFilename) Memory::WriteBigEData((const u8*)data.data() + 0x100, 0x81200000, 0x700); Memory::WriteBigEData((const u8*)data.data() + 0x820, 0x81300000, 0x1AFE00); PC = 0x81200000; - return true; + return true; } @@ -321,7 +322,7 @@ bool CBoot::BootUp() if (LoadMapFromFilename(_StartupPara.m_strFilename)) HLE::PatchFunctions(); - break; + break; } // ELF diff --git a/Source/Core/Core/Src/Boot/Boot.h b/Source/Core/Core/Src/Boot/Boot.h index e1cf191672..587a83b17b 100644 --- a/Source/Core/Core/Src/Boot/Boot.h +++ b/Source/Core/Core/Src/Boot/Boot.h @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #ifndef _BOOT_H @@ -43,10 +43,10 @@ private: static bool EmulatedBS2_GC(); static bool EmulatedBS2_Wii(); static bool EmulatedBS2(bool _bIsWii); - static bool Load_BS2(const std::string& _rBootROMFilename); + static bool Load_BS2(const std::string& _rBootROMFilename); static void Load_FST(bool _bIsWii); - static bool SetupWiiMemory(unsigned int _CountryCode); + static bool SetupWiiMemory(unsigned int _CountryCode); }; #endif diff --git a/Source/Core/Core/Src/Boot/Boot_BS2Emu.cpp b/Source/Core/Core/Src/Boot/Boot_BS2Emu.cpp index 5011543448..e0730f7f22 100644 --- a/Source/Core/Core/Src/Boot/Boot_BS2Emu.cpp +++ b/Source/Core/Core/Src/Boot/Boot_BS2Emu.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #include "Common.h" @@ -187,10 +187,10 @@ bool CBoot::SetupWiiMemory(unsigned int _CountryCode) switch((DiscIO::IVolume::ECountry)_CountryCode) { case DiscIO::IVolume::COUNTRY_KOREA: - region_filename = File::GetSysDirectory() + WII_SYS_DIR + DIR_SEP + WII_KOR_SETTING; - break; + region_filename = File::GetSysDirectory() + WII_SYS_DIR + DIR_SEP + WII_KOR_SETTING; + break; case DiscIO::IVolume::COUNTRY_TAIWAN: - // TODO: Determine if Taiwan has their own specific settings. + // TODO: Determine if Taiwan has their own specific settings. case DiscIO::IVolume::COUNTRY_JAPAN: region_filename = File::GetSysDirectory() + WII_SYS_DIR + DIR_SEP + WII_JAP_SETTING; break; @@ -234,7 +234,7 @@ bool CBoot::SetupWiiMemory(unsigned int _CountryCode) 0x80000038 Start of FST 0x8000003c Size of FST Size 0x80000060 Copyright code - */ + */ DVDInterface::DVDRead(0x00000000, 0x00000000, 0x20); // Game Code Memory::Write_U32(0x0D15EA5E, 0x00000020); // Another magic word @@ -297,7 +297,7 @@ bool CBoot::SetupWiiMemory(unsigned int _CountryCode) // copy the apploader to 0x81200000 // execute the apploader bool CBoot::EmulatedBS2_Wii() -{ +{ INFO_LOG(BOOT, "Faking Wii BS2..."); // setup wii memory diff --git a/Source/Core/Core/Src/Boot/Boot_DOL.cpp b/Source/Core/Core/Src/Boot/Boot_DOL.cpp index ee0b1b3505..3ae7f4b0ad 100644 --- a/Source/Core/Core/Src/Boot/Boot_DOL.cpp +++ b/Source/Core/Core/Src/Boot/Boot_DOL.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #include "Boot_DOL.h" diff --git a/Source/Core/Core/Src/Boot/Boot_DOL.h b/Source/Core/Core/Src/Boot/Boot_DOL.h index 76a8c6d17b..e804d8e44d 100644 --- a/Source/Core/Core/Src/Boot/Boot_DOL.h +++ b/Source/Core/Core/Src/Boot/Boot_DOL.h @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #ifndef _BOOT_DOL_H diff --git a/Source/Core/Core/Src/Boot/Boot_ELF.cpp b/Source/Core/Core/Src/Boot/Boot_ELF.cpp index 9fa86a9183..b5db0d8602 100644 --- a/Source/Core/Core/Src/Boot/Boot_ELF.cpp +++ b/Source/Core/Core/Src/Boot/Boot_ELF.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #include "../PowerPC/PowerPC.h" @@ -63,7 +63,7 @@ bool CBoot::IsElfWii(const char *filename) } delete[] mem; - return isWii; + return isWii; } @@ -92,5 +92,5 @@ bool CBoot::Boot_ELF(const char *filename) PC = reader.GetEntryPoint(); delete[] mem; - return true; + return true; } diff --git a/Source/Core/Core/Src/Boot/Boot_ELF.h b/Source/Core/Core/Src/Boot/Boot_ELF.h index 0933990d5c..111c070aa5 100644 --- a/Source/Core/Core/Src/Boot/Boot_ELF.h +++ b/Source/Core/Core/Src/Boot/Boot_ELF.h @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #pragma once diff --git a/Source/Core/Core/Src/Boot/Boot_WiiWAD.cpp b/Source/Core/Core/Src/Boot/Boot_WiiWAD.cpp index a86c38286d..02579155fe 100644 --- a/Source/Core/Core/Src/Boot/Boot_WiiWAD.cpp +++ b/Source/Core/Core/Src/Boot/Boot_WiiWAD.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #include "Boot.h" diff --git a/Source/Core/Core/Src/Boot/ElfReader.cpp b/Source/Core/Core/Src/Boot/ElfReader.cpp index 30585ff553..089513b851 100644 --- a/Source/Core/Core/Src/Boot/ElfReader.cpp +++ b/Source/Core/Core/Src/Boot/ElfReader.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #include diff --git a/Source/Core/Core/Src/Boot/ElfReader.h b/Source/Core/Core/Src/Boot/ElfReader.h index 6a3c559296..66e9fa8000 100644 --- a/Source/Core/Core/Src/Boot/ElfReader.h +++ b/Source/Core/Core/Src/Boot/ElfReader.h @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #ifndef _ELFREADER_H diff --git a/Source/Core/Core/Src/Boot/ElfTypes.h b/Source/Core/Core/Src/Boot/ElfTypes.h index 941f825cb2..a7e28fba5b 100644 --- a/Source/Core/Core/Src/Boot/ElfTypes.h +++ b/Source/Core/Core/Src/Boot/ElfTypes.h @@ -189,59 +189,59 @@ typedef unsigned int Elf32_Word; // ELF file header struct Elf32_Ehdr { - unsigned char e_ident[EI_NIDENT]; - Elf32_Half e_type; - Elf32_Half e_machine; - Elf32_Word e_version; - Elf32_Addr e_entry; - Elf32_Off e_phoff; - Elf32_Off e_shoff; - Elf32_Word e_flags; - Elf32_Half e_ehsize; - Elf32_Half e_phentsize; - Elf32_Half e_phnum; - Elf32_Half e_shentsize; - Elf32_Half e_shnum; - Elf32_Half e_shstrndx; + unsigned char e_ident[EI_NIDENT]; + Elf32_Half e_type; + Elf32_Half e_machine; + Elf32_Word e_version; + Elf32_Addr e_entry; + Elf32_Off e_phoff; + Elf32_Off e_shoff; + Elf32_Word e_flags; + Elf32_Half e_ehsize; + Elf32_Half e_phentsize; + Elf32_Half e_phnum; + Elf32_Half e_shentsize; + Elf32_Half e_shnum; + Elf32_Half e_shstrndx; }; // Section header struct Elf32_Shdr { - Elf32_Word sh_name; - Elf32_Word sh_type; - Elf32_Word sh_flags; - Elf32_Addr sh_addr; - Elf32_Off sh_offset; - Elf32_Word sh_size; - Elf32_Word sh_link; - Elf32_Word sh_info; - Elf32_Word sh_addralign; - Elf32_Word sh_entsize; + Elf32_Word sh_name; + Elf32_Word sh_type; + Elf32_Word sh_flags; + Elf32_Addr sh_addr; + Elf32_Off sh_offset; + Elf32_Word sh_size; + Elf32_Word sh_link; + Elf32_Word sh_info; + Elf32_Word sh_addralign; + Elf32_Word sh_entsize; }; // Segment header struct Elf32_Phdr { - Elf32_Word p_type; - Elf32_Off p_offset; - Elf32_Addr p_vaddr; - Elf32_Addr p_paddr; - Elf32_Word p_filesz; - Elf32_Word p_memsz; - Elf32_Word p_flags; - Elf32_Word p_align; + Elf32_Word p_type; + Elf32_Off p_offset; + Elf32_Addr p_vaddr; + Elf32_Addr p_paddr; + Elf32_Word p_filesz; + Elf32_Word p_memsz; + Elf32_Word p_flags; + Elf32_Word p_align; }; // Symbol table entry struct Elf32_Sym { - Elf32_Word st_name; - Elf32_Addr st_value; - Elf32_Word st_size; - unsigned char st_info; - unsigned char st_other; - Elf32_Half st_shndx; + Elf32_Word st_name; + Elf32_Addr st_value; + Elf32_Word st_size; + unsigned char st_info; + unsigned char st_other; + Elf32_Half st_shndx; }; #define ELF32_ST_BIND(i) ((i)>>4) @@ -251,15 +251,15 @@ struct Elf32_Sym // Relocation entries struct Elf32_Rel { - Elf32_Addr r_offset; - Elf32_Word r_info; + Elf32_Addr r_offset; + Elf32_Word r_info; }; struct Elf32_Rela { - Elf32_Addr r_offset; - Elf32_Word r_info; - Elf32_Sword r_addend; + Elf32_Addr r_offset; + Elf32_Word r_info; + Elf32_Sword r_addend; }; #define ELF32_R_SYM(i) ((i)>>8) @@ -273,8 +273,8 @@ struct Elf32_Dyn union { Elf32_Word d_val; - Elf32_Addr d_ptr; - } d_un; + Elf32_Addr d_ptr; + } d_un; }; #endif diff --git a/Source/Core/Core/Src/BootManager.cpp b/Source/Core/Core/Src/BootManager.cpp index f4322c30c2..3e50a4f196 100644 --- a/Source/Core/Core/Src/BootManager.cpp +++ b/Source/Core/Core/Src/BootManager.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ // File description @@ -78,7 +78,8 @@ bool BootCore(const std::string& _rFilename) StartUp.hInstance = Host_GetInstance(); // If for example the ISO file is bad we return here - if (!StartUp.AutoSetup(SCoreStartupParameter::BOOT_DEFAULT)) return false; + if (!StartUp.AutoSetup(SCoreStartupParameter::BOOT_DEFAULT)) + return false; // Load game specific settings IniFile game_ini; diff --git a/Source/Core/Core/Src/BootManager.h b/Source/Core/Core/Src/BootManager.h index c688dd3994..8041da5f81 100644 --- a/Source/Core/Core/Src/BootManager.h +++ b/Source/Core/Core/Src/BootManager.h @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #ifndef _BOOTMANAGER_H diff --git a/Source/Core/Core/Src/ConfigManager.cpp b/Source/Core/Core/Src/ConfigManager.cpp index fa322d9205..a1a73a3e26 100644 --- a/Source/Core/Core/Src/ConfigManager.cpp +++ b/Source/Core/Core/Src/ConfigManager.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #include @@ -37,17 +37,17 @@ static const struct { { "RefreshList", 0, 0 /* wxMOD_NONE */ }, { "PlayPause", 80 /* 'P' */, 2 /* wxMOD_CMD */ }, - { "Stop", 87 /* 'W' */, 2 /* wxMOD_CMD */ }, - { "Reset", 0, 0 /* wxMOD_NONE */ }, + { "Stop", 87 /* 'W' */, 2 /* wxMOD_CMD */ }, + { "Reset", 0, 0 /* wxMOD_NONE */ }, { "FrameAdvance", 0, 0 /* wxMOD_NONE */ }, { "StartRecording", 0, 0 /* wxMOD_NONE */ }, { "PlayRecording", 0, 0 /* wxMOD_NONE */ }, - { "ExportRecording", 0, 0 /* wxMOD_NONE */ }, + { "ExportRecording", 0, 0 /* wxMOD_NONE */ }, { "Readonlymode", 0, 0 /* wxMOD_NONE */ }, { "ToggleFullscreen", 70 /* 'F' */, 2 /* wxMOD_CMD */ }, - { "Screenshot", 83 /* 'S' */, 2 /* wxMOD_CMD */ }, + { "Screenshot", 83 /* 'S' */, 2 /* wxMOD_CMD */ }, { "Wiimote1Connect", 49 /* '1' */, 2 /* wxMOD_CMD */ }, { "Wiimote2Connect", 50 /* '2' */, 2 /* wxMOD_CMD */ }, @@ -60,12 +60,12 @@ static const struct { { "PlayPause", 349 /* WXK_F10 */, 0 /* wxMOD_NONE */ }, { "Stop", 27 /* WXK_ESCAPE */, 0 /* wxMOD_NONE */ }, - { "Reset", 0, 0 /* wxMOD_NONE */ }, + { "Reset", 0, 0 /* wxMOD_NONE */ }, { "FrameAdvance", 0, 0 /* wxMOD_NONE */ }, { "StartRecording", 0, 0 /* wxMOD_NONE */ }, { "PlayRecording", 0, 0 /* wxMOD_NONE */ }, - { "ExportRecording", 0, 0 /* wxMOD_NONE */ }, + { "ExportRecording",0, 0 /* wxMOD_NONE */ }, { "Readonlymode", 0, 0 /* wxMOD_NONE */ }, { "ToggleFullscreen", 13 /* WXK_RETURN */, 1 /* wxMOD_ALT */ }, @@ -155,7 +155,7 @@ void SConfig::SaveSettings() ini.Set("General", "NANDRoot", m_NANDPath); ini.Set("General", "WirelessMac", m_WirelessMac); - // Interface + // Interface ini.Set("Interface", "ConfirmStop", m_LocalCoreStartupParameter.bConfirmStop); ini.Set("Interface", "UsePanicHandlers", m_LocalCoreStartupParameter.bUsePanicHandlers); ini.Set("Interface", "OnScreenDisplayMessages", m_LocalCoreStartupParameter.bOnScreenDisplayMessages); diff --git a/Source/Core/Core/Src/ConfigManager.h b/Source/Core/Core/Src/ConfigManager.h index f6cf6bf568..9fa2a6bffb 100644 --- a/Source/Core/Core/Src/ConfigManager.h +++ b/Source/Core/Core/Src/ConfigManager.h @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #ifndef _CONFIGMANAGER_H diff --git a/Source/Core/Core/Src/Console.cpp b/Source/Core/Core/Src/Console.cpp index 6753cb1abd..262a822f70 100644 --- a/Source/Core/Core/Src/Console.cpp +++ b/Source/Core/Core/Src/Console.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #include @@ -150,5 +150,7 @@ void Console_Submit(const char *cmd) g_symbolDB.List(); } else + { ERROR_LOG(CONSOLE, "Invalid command"); + } } diff --git a/Source/Core/Core/Src/Console.h b/Source/Core/Core/Src/Console.h index 0245eeb749..cef078f8c1 100644 --- a/Source/Core/Core/Src/Console.h +++ b/Source/Core/Core/Src/Console.h @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ diff --git a/Source/Core/Core/Src/Core.cpp b/Source/Core/Core/Src/Core.cpp index 7c0015dbbb..0ea451d4ec 100644 --- a/Source/Core/Core/Src/Core.cpp +++ b/Source/Core/Core/Src/Core.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ @@ -143,7 +143,9 @@ void DisplayMessage(const char *message, int time_in_ms) Host_UpdateStatusBar(message); } else + { Host_UpdateTitle(message); + } } void Callback_DebuggerBreak() @@ -555,7 +557,9 @@ static std::string GenerateScreenshotName() std::string name; for (int i = 1; File::Exists(name = StringFromFormat("%s-%d.png", path.c_str(), i)); ++i) - {} + { + // TODO? + } return name; } @@ -614,7 +618,8 @@ void VideoThrottle() u32 frametime = ((SConfig::GetInstance().b_UseFPS)? Common::AtomicLoad(DrawnFrame) : DrawnVideo) * 1000 / TargetVPS; u32 timeDifference = (u32)Timer.GetTimeDifference(); - if (timeDifference < frametime) { + if (timeDifference < frametime) + { Common::SleepCurrentThread(frametime - timeDifference - 1); } @@ -670,7 +675,7 @@ const char *Callback_ISOName() SConfig::GetInstance().m_LocalCoreStartupParameter; if (params.m_strName.length() > 0) return params.m_strName.c_str(); - else + else return ""; } @@ -742,10 +747,12 @@ void UpdateTitle() } if (_CoreParameter.bRenderToMain && - SConfig::GetInstance().m_InterfaceStatusbar) { + SConfig::GetInstance().m_InterfaceStatusbar) + { Host_UpdateStatusBar(SMessage.c_str()); Host_UpdateTitle(scm_rev_str); - } else + } + else Host_UpdateTitle(TMessage.c_str()); } diff --git a/Source/Core/Core/Src/Core.h b/Source/Core/Core/Src/Core.h index 2b88b16510..1fda32c6f6 100644 --- a/Source/Core/Core/Src/Core.h +++ b/Source/Core/Core/Src/Core.h @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ @@ -44,9 +44,9 @@ void Callback_VideoCopiedToXFB(bool video_update); enum EState { - CORE_UNINITIALIZED, - CORE_PAUSE, - CORE_RUN, + CORE_UNINITIALIZED, + CORE_PAUSE, + CORE_RUN, CORE_STOPPING }; @@ -69,7 +69,7 @@ void SaveScreenShot(); void Callback_WiimoteInterruptChannel(int _number, u16 _channelID, const void* _pData, u32 _Size); void* GetWindowHandle(); - + void StartTrace(bool write); // This displays messages in a user-visible way. @@ -82,7 +82,7 @@ inline void DisplayMessage(const std::string &message, int time_in_ms) std::string GetStateFileName(); void SetStateFileName(std::string val); - + int SyncTrace(); void SetBlockStart(u32 addr); void StopTrace(); diff --git a/Source/Core/Core/Src/CoreParameter.cpp b/Source/Core/Core/Src/CoreParameter.cpp index 6a06f13661..36573fb415 100644 --- a/Source/Core/Core/Src/CoreParameter.cpp +++ b/Source/Core/Core/Src/CoreParameter.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #include "Common.h" diff --git a/Source/Core/Core/Src/CoreParameter.h b/Source/Core/Core/Src/CoreParameter.h index 6cd9b4a8be..e6ad37f7ee 100644 --- a/Source/Core/Core/Src/CoreParameter.h +++ b/Source/Core/Core/Src/CoreParameter.h @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #ifndef _COREPARAMETER_H @@ -21,7 +21,8 @@ #include "IniFile.h" #include -enum Hotkey { +enum Hotkey +{ HK_OPEN, HK_CHANGE_DISC, HK_REFRESH_LIST, diff --git a/Source/Core/Core/Src/CoreTiming.cpp b/Source/Core/Core/Src/CoreTiming.cpp index ff9488b4fe..e4c05cfb20 100644 --- a/Source/Core/Core/Src/CoreTiming.cpp +++ b/Source/Core/Core/Src/CoreTiming.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #include @@ -76,36 +76,36 @@ void (*advanceCallback)(int cyclesExecuted) = NULL; Event* GetNewEvent() { - if(!eventPool) - return new Event; + if(!eventPool) + return new Event; - Event* ev = eventPool; - eventPool = ev->next; - return ev; + Event* ev = eventPool; + eventPool = ev->next; + return ev; } Event* GetNewTsEvent() { - allocatedTsEvents++; + allocatedTsEvents++; - if(!eventTsPool) - return new Event; + if(!eventTsPool) + return new Event; - Event* ev = eventTsPool; - eventTsPool = ev->next; - return ev; + Event* ev = eventTsPool; + eventTsPool = ev->next; + return ev; } void FreeEvent(Event* ev) { - ev->next = eventPool; - eventPool = ev; + ev->next = eventPool; + eventPool = ev; } void FreeTsEvent(Event* ev) { - ev->next = eventTsPool; - eventTsPool = ev; + ev->next = eventTsPool; + eventTsPool = ev; allocatedTsEvents--; } @@ -158,20 +158,20 @@ void Shutdown() ClearPendingEvents(); UnregisterAllEvents(); - while(eventPool) - { - Event *ev = eventPool; - eventPool = ev->next; - delete ev; - } + while(eventPool) + { + Event *ev = eventPool; + eventPool = ev->next; + delete ev; + } - std::lock_guard lk(externalEventSection); - while(eventTsPool) - { - Event *ev = eventTsPool; - eventTsPool = ev->next; - delete ev; - } + std::lock_guard lk(externalEventSection); + while(eventTsPool) + { + Event *ev = eventTsPool; + eventTsPool = ev->next; + delete ev; + } } void EventDoState(PointerWrap &p, BaseEvent* ev) @@ -227,7 +227,7 @@ void DoState(PointerWrap &p) u64 GetTicks() { - return (u64)globalTimer; + return (u64)globalTimer; } u64 GetIdleTicks() @@ -262,7 +262,9 @@ void ScheduleEvent_Threadsafe_Immediate(int event_type, u64 userdata) event_types[event_type].callback(userdata, 0); } else + { ScheduleEvent_Threadsafe(0, event_type, userdata); + } } void ClearPendingEvents() @@ -327,6 +329,7 @@ void RemoveEvent(int event_type) { if (!first) return; + while(first) { if (first->type == event_type) @@ -340,8 +343,10 @@ void RemoveEvent(int event_type) break; } } + if (!first) return; + Event *prev = first; Event *ptr = prev->next; while (ptr) @@ -367,6 +372,7 @@ void RemoveThreadsafeEvent(int event_type) { return; } + while(tsFirst) { if (tsFirst->type == event_type) @@ -380,16 +386,18 @@ void RemoveThreadsafeEvent(int event_type) break; } } + if (!tsFirst) { return; } + Event *prev = tsFirst; Event *ptr = prev->next; while (ptr) { if (ptr->type == event_type) - { + { prev->next = ptr->next; FreeTsEvent(ptr); ptr = prev->next; @@ -455,7 +463,7 @@ void ProcessFifoWaitEvents() void MoveEvents() { std::lock_guard lk(externalEventSection); - // Move events from async queue into main queue + // Move events from async queue into main queue while (tsFirst) { Event *next = tsFirst->next; @@ -464,20 +472,20 @@ void MoveEvents() } tsLast = NULL; - // Move free events to threadsafe pool - while(allocatedTsEvents > 0 && eventPool) - { - Event *ev = eventPool; - eventPool = ev->next; - ev->next = eventTsPool; - eventTsPool = ev; - allocatedTsEvents--; - } + // Move free events to threadsafe pool + while(allocatedTsEvents > 0 && eventPool) + { + Event *ev = eventPool; + eventPool = ev->next; + ev->next = eventTsPool; + eventTsPool = ev; + allocatedTsEvents--; + } } void Advance() { - MoveEvents(); + MoveEvents(); int cyclesExecuted = slicelength - downcount; globalTimer += cyclesExecuted; @@ -499,6 +507,7 @@ void Advance() break; } } + if (!first) { WARN_LOG(POWERPC, "WARNING - no events in queue. Setting downcount to 10000"); @@ -511,6 +520,7 @@ void Advance() slicelength = maxSliceLength; downcount = slicelength; } + if (advanceCallback) advanceCallback(cyclesExecuted); } @@ -534,7 +544,7 @@ void Idle() //while we process only the events required by the FIFO. while (g_video_backend->Video_IsPossibleWaitingSetDrawDone()) { - ProcessFifoWaitEvents(); + ProcessFifoWaitEvents(); Common::YieldCPU(); } @@ -554,9 +564,11 @@ std::string GetScheduledEventsSummary() unsigned int t = ptr->type; if (t >= event_types.size()) PanicAlertT("Invalid event type %i", t); + const char *name = event_types[ptr->type].name; if (!name) name = "[unknown]"; + text += StringFromFormat("%s : %i %08x%08x\n", event_types[ptr->type].name, ptr->time, ptr->userdata >> 32, ptr->userdata); ptr = ptr->next; } diff --git a/Source/Core/Core/Src/CoreTiming.h b/Source/Core/Core/Src/CoreTiming.h index 8e00b303f0..2da398bbc0 100644 --- a/Source/Core/Core/Src/CoreTiming.h +++ b/Source/Core/Core/Src/CoreTiming.h @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #ifndef _CORETIMING_H diff --git a/Source/Core/Core/Src/DSP/DSPAccelerator.cpp b/Source/Core/Core/Src/DSP/DSPAccelerator.cpp index 6c090bbae7..2399524445 100644 --- a/Source/Core/Core/Src/DSP/DSPAccelerator.cpp +++ b/Source/Core/Core/Src/DSP/DSPAccelerator.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #include "Common.h" @@ -60,7 +60,7 @@ static s16 ADPCM_Step(u32& _rSamplePos) _rSamplePos++; - // The advanced interpolation (linear, polyphase,...) is done by the UCode, + // The advanced interpolation (linear, polyphase,...) is done by the UCode, // so we don't need to bother with it here. return val; } @@ -78,7 +78,7 @@ u16 dsp_read_aram_d3() Address++; break; case 0x6: // u16 reads - val = (DSPHost_ReadHostMemory(Address*2) << 8) | DSPHost_ReadHostMemory(Address*2 + 1); + val = (DSPHost_ReadHostMemory(Address*2) << 8) | DSPHost_ReadHostMemory(Address*2 + 1); Address++; break; default: @@ -134,25 +134,25 @@ u16 dsp_read_accelerator() // address" and 0xd3. switch (g_dsp.ifx_regs[DSP_FORMAT]) { - case 0x00: // ADPCM audio - val = ADPCM_Step(Address); - break; - case 0x0A: // 16-bit PCM audio - val = (DSPHost_ReadHostMemory(Address*2) << 8) | DSPHost_ReadHostMemory(Address*2 + 1); - g_dsp.ifx_regs[DSP_YN2] = g_dsp.ifx_regs[DSP_YN1]; - g_dsp.ifx_regs[DSP_YN1] = val; - Address++; - break; - case 0x19: // 8-bit PCM audio - val = DSPHost_ReadHostMemory(Address) << 8; - g_dsp.ifx_regs[DSP_YN2] = g_dsp.ifx_regs[DSP_YN1]; - g_dsp.ifx_regs[DSP_YN1] = val; - Address++; + case 0x00: // ADPCM audio + val = ADPCM_Step(Address); break; - default: - ERROR_LOG(DSPLLE, "dsp_read_accelerator() - unknown format 0x%x", g_dsp.ifx_regs[DSP_FORMAT]); - Address++; - val = 0; + case 0x0A: // 16-bit PCM audio + val = (DSPHost_ReadHostMemory(Address*2) << 8) | DSPHost_ReadHostMemory(Address*2 + 1); + g_dsp.ifx_regs[DSP_YN2] = g_dsp.ifx_regs[DSP_YN1]; + g_dsp.ifx_regs[DSP_YN1] = val; + Address++; + break; + case 0x19: // 8-bit PCM audio + val = DSPHost_ReadHostMemory(Address) << 8; + g_dsp.ifx_regs[DSP_YN2] = g_dsp.ifx_regs[DSP_YN1]; + g_dsp.ifx_regs[DSP_YN1] = val; + Address++; + break; + default: + ERROR_LOG(DSPLLE, "dsp_read_accelerator() - unknown format 0x%x", g_dsp.ifx_regs[DSP_FORMAT]); + Address++; + val = 0; break; } diff --git a/Source/Core/Core/Src/DSP/DSPAccelerator.h b/Source/Core/Core/Src/DSP/DSPAccelerator.h index a64516a036..ce2464668f 100644 --- a/Source/Core/Core/Src/DSP/DSPAccelerator.h +++ b/Source/Core/Core/Src/DSP/DSPAccelerator.h @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #ifndef _DSP_ACCELERATOR_H diff --git a/Source/Core/Core/Src/DSP/DSPAnalyzer.cpp b/Source/Core/Core/Src/DSP/DSPAnalyzer.cpp index 8f6b0d4e35..3f27bb67b4 100644 --- a/Source/Core/Core/Src/DSP/DSPAnalyzer.cpp +++ b/Source/Core/Core/Src/DSP/DSPAnalyzer.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #include "DSPAnalyzer.h" diff --git a/Source/Core/Core/Src/DSP/DSPAnalyzer.h b/Source/Core/Core/Src/DSP/DSPAnalyzer.h index 9c05dae708..f6ac2a67f1 100644 --- a/Source/Core/Core/Src/DSP/DSPAnalyzer.h +++ b/Source/Core/Core/Src/DSP/DSPAnalyzer.h @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ // Basic code analysis. diff --git a/Source/Core/Core/Src/DSP/DSPBreakpoints.h b/Source/Core/Core/Src/DSP/DSPBreakpoints.h index b366e760a7..837fdbbd98 100644 --- a/Source/Core/Core/Src/DSP/DSPBreakpoints.h +++ b/Source/Core/Core/Src/DSP/DSPBreakpoints.h @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #ifndef _DSP_BREAKPOINTS @@ -21,38 +21,53 @@ #include "Common.h" // super fast breakpoints for a limited range. -// To be used interchangably with the BreakPoints class. +// To be used interchangeably with the BreakPoints class. class DSPBreakpoints { public: - DSPBreakpoints() {Clear();} + DSPBreakpoints() + { + Clear(); + } + // is address breakpoint - bool IsAddressBreakPoint(u32 addr) { + bool IsAddressBreakPoint(u32 addr) + { return b[addr] != 0; } // AddBreakPoint - bool Add(u32 addr, bool temp=false) { + bool Add(u32 addr, bool temp=false) + { bool was_one = b[addr] != 0; - if (!was_one) { + + if (!was_one) + { b[addr] = temp ? 2 : 1; return true; - } else { + } + else + { return false; } } + // Remove Breakpoint - bool Remove(u32 addr) { + bool Remove(u32 addr) + { bool was_one = b[addr] != 0; b[addr] = 0; return was_one; } - void Clear() { + + void Clear() + { for (int i = 0; i < 65536; i++) b[i] = 0; } - void DeleteByAddress(u32 addr) { + void DeleteByAddress(u32 addr) + { b[addr] = 0; } diff --git a/Source/Core/Core/Src/DSP/DSPCodeUtil.cpp b/Source/Core/Core/Src/DSP/DSPCodeUtil.cpp index 7f2cc8e2e6..5f92c40cd0 100644 --- a/Source/Core/Core/Src/DSP/DSPCodeUtil.cpp +++ b/Source/Core/Core/Src/DSP/DSPCodeUtil.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #include @@ -38,7 +38,8 @@ bool Assemble(const char *text, std::vector &code, bool force) // TODO: fix the terrible api of the assembler. DSPAssembler assembler(settings); - if (!assembler.Assemble(text, code)) { + if (!assembler.Assemble(text, code)) + { std::cerr << assembler.GetErrorString() << std::endl; return false; } @@ -77,7 +78,9 @@ bool Compare(const std::vector &code1, const std::vector &code2) for (int i = 0; i < min_size; i++) { if (code1[i] == code2[i]) + { count_equal++; + } else { std::string line1, line2; diff --git a/Source/Core/Core/Src/DSP/DSPCodeUtil.h b/Source/Core/Core/Src/DSP/DSPCodeUtil.h index 525e21a9fb..3f4b235e22 100644 --- a/Source/Core/Core/Src/DSP/DSPCodeUtil.h +++ b/Source/Core/Core/Src/DSP/DSPCodeUtil.h @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #ifndef _DSPCODEUTIL_H diff --git a/Source/Core/Core/Src/DSP/DSPCore.cpp b/Source/Core/Core/Src/DSP/DSPCore.cpp index 2594a27eef..59e5063af6 100644 --- a/Source/Core/Core/Src/DSP/DSPCore.cpp +++ b/Source/Core/Core/Src/DSP/DSPCore.cpp @@ -89,7 +89,7 @@ static bool VerifyRoms(const char *irom_filename, const char *coef_filename) { 0x9c8f593c, 0x10000001 }, // delroth's improvement on LM1234 replacement ROM (Zelda and AX only, - // IPL/Card/GBA still broken) + // IPL/Card/GBA still broken) { 0xd9907f71, 0xb019c2fb } }; @@ -220,7 +220,7 @@ void DSPCore_Shutdown() void DSPCore_Reset() { - g_dsp.pc = DSP_RESET_VECTOR; + g_dsp.pc = DSP_RESET_VECTOR; g_dsp.r.wr[0] = 0xffff; g_dsp.r.wr[1] = 0xffff; @@ -260,11 +260,13 @@ void DSPCore_CheckExceptions() if (g_dsp.exceptions == 0) return; - for (int i = 7; i > 0; i--) { + for (int i = 7; i > 0; i--) + { // Seems exp int are not masked by sr_int_enable - if (g_dsp.exceptions & (1 << i)) { - if (dsp_SR_is_flag_set(SR_INT_ENABLE) || (i == EXP_INT)) { - + if (g_dsp.exceptions & (1 << i)) + { + if (dsp_SR_is_flag_set(SR_INT_ENABLE) || (i == EXP_INT)) + { // store pc and sr until RTI dsp_reg_store_stack(DSP_STACK_C, g_dsp.pc); dsp_reg_store_stack(DSP_STACK_D, g_dsp.r.sr); @@ -276,7 +278,9 @@ void DSPCore_CheckExceptions() else g_dsp.r.sr &= ~SR_INT_ENABLE; break; - } else { + } + else + { #if defined(_DEBUG) || defined(DEBUGFAST) ERROR_LOG(DSPLLE, "Firing exception %d failed", i); #endif @@ -381,8 +385,10 @@ void CompileCurrent() } } -u16 DSPCore_ReadRegister(int reg) { - switch(reg) { +u16 DSPCore_ReadRegister(int reg) +{ + switch(reg) + { case DSP_REG_AR0: case DSP_REG_AR1: case DSP_REG_AR2: @@ -430,8 +436,10 @@ u16 DSPCore_ReadRegister(int reg) { } } -void DSPCore_WriteRegister(int reg, u16 val) { - switch(reg) { +void DSPCore_WriteRegister(int reg, u16 val) +{ + switch(reg) + { case DSP_REG_AR0: case DSP_REG_AR1: case DSP_REG_AR2: diff --git a/Source/Core/Core/Src/DSP/DSPEmitter.cpp b/Source/Core/Core/Src/DSP/DSPEmitter.cpp index 12dac52e31..fd7b455c98 100644 --- a/Source/Core/Core/Src/DSP/DSPEmitter.cpp +++ b/Source/Core/Core/Src/DSP/DSPEmitter.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #include @@ -147,28 +147,38 @@ void DSPEmitter::EmitInstruction(UDSPInstruction inst) bool ext_is_jit = false; // Call extended - if (tinst->extended) { - if ((inst >> 12) == 0x3) { - if (! extOpTable[inst & 0x7F]->jitFunc) { + if (tinst->extended) + { + if ((inst >> 12) == 0x3) + { + if (! extOpTable[inst & 0x7F]->jitFunc) + { // Fall back to interpreter gpr.pushRegs(); ABI_CallFunctionC16((void*)extOpTable[inst & 0x7F]->intFunc, inst); gpr.popRegs(); INFO_LOG(DSPLLE, "Instruction not JITed(ext part): %04x\n", inst); ext_is_jit = false; - } else { + } + else + { (this->*extOpTable[inst & 0x7F]->jitFunc)(inst); ext_is_jit = true; } - } else { - if (!extOpTable[inst & 0xFF]->jitFunc) { + } + else + { + if (!extOpTable[inst & 0xFF]->jitFunc) + { // Fall back to interpreter gpr.pushRegs(); ABI_CallFunctionC16((void*)extOpTable[inst & 0xFF]->intFunc, inst); gpr.popRegs(); INFO_LOG(DSPLLE, "Instruction not JITed(ext part): %04x\n", inst); ext_is_jit = false; - } else { + } + else + { (this->*extOpTable[inst & 0xFF]->jitFunc)(inst); ext_is_jit = true; } @@ -176,7 +186,8 @@ void DSPEmitter::EmitInstruction(UDSPInstruction inst) } // Main instruction - if (!opTable[inst]->jitFunc) { + if (!opTable[inst]->jitFunc) + { Default(inst); INFO_LOG(DSPLLE, "Instruction not JITed(main part): %04x\n", inst); } @@ -186,14 +197,18 @@ void DSPEmitter::EmitInstruction(UDSPInstruction inst) } // Backlog - if (tinst->extended) { - if (!ext_is_jit) { + if (tinst->extended) + { + if (!ext_is_jit) + { //need to call the online cleanup function because //the writeBackLog gets populated at runtime gpr.pushRegs(); ABI_CallFunction((void*)::applyWriteBackLog); gpr.popRegs(); - } else { + } + else + { popExtValueToReg(); } } @@ -322,7 +337,8 @@ void DSPEmitter::Compile(u16 start_addr) } } - if (fixup_pc) { + if (fixup_pc) + { MOV(16, M(&(g_dsp.pc)), Imm16(compilePC)); } diff --git a/Source/Core/Core/Src/DSP/DSPEmitter.h b/Source/Core/Core/Src/DSP/DSPEmitter.h index 7fcb9a74f6..114b085f19 100644 --- a/Source/Core/Core/Src/DSP/DSPEmitter.h +++ b/Source/Core/Core/Src/DSP/DSPEmitter.h @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #ifndef _DSPEMITTER_H diff --git a/Source/Core/Core/Src/DSP/DSPHWInterface.cpp b/Source/Core/Core/Src/DSP/DSPHWInterface.cpp index 8e954f8988..371bec572c 100644 --- a/Source/Core/Core/Src/DSP/DSPHWInterface.cpp +++ b/Source/Core/Core/Src/DSP/DSPHWInterface.cpp @@ -117,71 +117,76 @@ void gdsp_ifx_write(u32 addr, u32 val) { switch (addr & 0xff) { - case DSP_DIRQ: - if (val & 0x1) - DSPHost_InterruptRequest(); + case DSP_DIRQ: + if (val & 0x1) + DSPHost_InterruptRequest(); else INFO_LOG(DSPLLE, "Unknown Interrupt Request pc=%04x (%04x)", g_dsp.pc, val); - break; + break; - case DSP_DMBH: - gdsp_mbox_write_h(GDSP_MBOX_DSP, val); - break; + case DSP_DMBH: + gdsp_mbox_write_h(GDSP_MBOX_DSP, val); + break; - case DSP_DMBL: - gdsp_mbox_write_l(GDSP_MBOX_DSP, val); - break; + case DSP_DMBL: + gdsp_mbox_write_l(GDSP_MBOX_DSP, val); + break; - case DSP_CMBH: - return gdsp_mbox_write_h(GDSP_MBOX_CPU, val); + case DSP_CMBH: + return gdsp_mbox_write_h(GDSP_MBOX_CPU, val); - case DSP_CMBL: - return gdsp_mbox_write_l(GDSP_MBOX_CPU, val); + case DSP_CMBL: + return gdsp_mbox_write_l(GDSP_MBOX_CPU, val); - case DSP_DSBL: - g_dsp.ifx_regs[DSP_DSBL] = val; + case DSP_DSBL: + g_dsp.ifx_regs[DSP_DSBL] = val; g_dsp.ifx_regs[DSP_DSCR] |= 4; // Doesn't really matter since we do DMA instantly - if (!g_dsp.ifx_regs[DSP_AMDM]) + if (!g_dsp.ifx_regs[DSP_AMDM]) gdsp_do_dma(); else NOTICE_LOG(DSPLLE, "Masked DMA skipped"); - g_dsp.ifx_regs[DSP_DSCR] &= ~4; + g_dsp.ifx_regs[DSP_DSCR] &= ~4; g_dsp.ifx_regs[DSP_DSBL] = 0; - break; + break; case DSP_ACDATA1: // Accelerator write (Zelda type) - "UnkZelda" dsp_write_aram_d3(val); break; case DSP_GAIN: - if (val) { + if (val) + { INFO_LOG(DSPLLE,"Gain Written: 0x%04x", val); } - case DSP_DSPA: - case DSP_DSMAH: - case DSP_DSMAL: - case DSP_DSCR: - g_dsp.ifx_regs[addr & 0xFF] = val; - break; + case DSP_DSPA: + case DSP_DSMAH: + case DSP_DSMAL: + case DSP_DSCR: + g_dsp.ifx_regs[addr & 0xFF] = val; + break; /* case DSP_ACCAL: dsp_step_accelerator(); break; */ - default: - if ((addr & 0xff) >= 0xa0) { - if (pdlabels[(addr & 0xFF) - 0xa0].name && pdlabels[(addr & 0xFF) - 0xa0].description) { - INFO_LOG(DSPLLE, "%04x MW %s (%04x)", g_dsp.pc, pdlabels[(addr & 0xFF) - 0xa0].name, val); + default: + if ((addr & 0xff) >= 0xa0) + { + if (pdlabels[(addr & 0xFF) - 0xa0].name && pdlabels[(addr & 0xFF) - 0xa0].description) + { + INFO_LOG(DSPLLE, "%04x MW %s (%04x)", g_dsp.pc, pdlabels[(addr & 0xFF) - 0xa0].name, val); } - else { - ERROR_LOG(DSPLLE, "%04x MW %04x (%04x)", g_dsp.pc, addr, val); + else + { + ERROR_LOG(DSPLLE, "%04x MW %04x (%04x)", g_dsp.pc, addr, val); } } - else { - ERROR_LOG(DSPLLE, "%04x MW %04x (%04x)", g_dsp.pc, addr, val); + else + { + ERROR_LOG(DSPLLE, "%04x MW %04x (%04x)", g_dsp.pc, addr, val); } - g_dsp.ifx_regs[addr & 0xFF] = val; - break; + g_dsp.ifx_regs[addr & 0xFF] = val; + break; } } @@ -189,40 +194,44 @@ u16 gdsp_ifx_read(u16 addr) { switch (addr & 0xff) { - case DSP_DMBH: - return gdsp_mbox_read_h(GDSP_MBOX_DSP); + case DSP_DMBH: + return gdsp_mbox_read_h(GDSP_MBOX_DSP); - case DSP_DMBL: - return gdsp_mbox_read_l(GDSP_MBOX_DSP); + case DSP_DMBL: + return gdsp_mbox_read_l(GDSP_MBOX_DSP); - case DSP_CMBH: - return gdsp_mbox_read_h(GDSP_MBOX_CPU); + case DSP_CMBH: + return gdsp_mbox_read_h(GDSP_MBOX_CPU); - case DSP_CMBL: - return gdsp_mbox_read_l(GDSP_MBOX_CPU); + case DSP_CMBL: + return gdsp_mbox_read_l(GDSP_MBOX_CPU); - case DSP_DSCR: - return g_dsp.ifx_regs[addr & 0xFF]; + case DSP_DSCR: + return g_dsp.ifx_regs[addr & 0xFF]; - case DSP_ACCELERATOR: // ADPCM Accelerator reads - return dsp_read_accelerator(); + case DSP_ACCELERATOR: // ADPCM Accelerator reads + return dsp_read_accelerator(); - case DSP_ACDATA1: // Accelerator reads (Zelda type) - "UnkZelda" - return dsp_read_aram_d3(); + case DSP_ACDATA1: // Accelerator reads (Zelda type) - "UnkZelda" + return dsp_read_aram_d3(); - default: - if ((addr & 0xff) >= 0xa0) { - if (pdlabels[(addr & 0xFF) - 0xa0].name && pdlabels[(addr & 0xFF) - 0xa0].description) { - INFO_LOG(DSPLLE, "%04x MR %s (%04x)", g_dsp.pc, pdlabels[(addr & 0xFF) - 0xa0].name, g_dsp.ifx_regs[addr & 0xFF]); + default: + if ((addr & 0xff) >= 0xa0) + { + if (pdlabels[(addr & 0xFF) - 0xa0].name && pdlabels[(addr & 0xFF) - 0xa0].description) + { + INFO_LOG(DSPLLE, "%04x MR %s (%04x)", g_dsp.pc, pdlabels[(addr & 0xFF) - 0xa0].name, g_dsp.ifx_regs[addr & 0xFF]); } - else { - ERROR_LOG(DSPLLE, "%04x MR %04x (%04x)", g_dsp.pc, addr, g_dsp.ifx_regs[addr & 0xFF]); + else + { + ERROR_LOG(DSPLLE, "%04x MR %04x (%04x)", g_dsp.pc, addr, g_dsp.ifx_regs[addr & 0xFF]); } } - else { - ERROR_LOG(DSPLLE, "%04x MR %04x (%04x)", g_dsp.pc, addr, g_dsp.ifx_regs[addr & 0xFF]); + else + { + ERROR_LOG(DSPLLE, "%04x MR %04x (%04x)", g_dsp.pc, addr, g_dsp.ifx_regs[addr & 0xFF]); } - return g_dsp.ifx_regs[addr & 0xFF]; + return g_dsp.ifx_regs[addr & 0xFF]; } } @@ -326,20 +335,20 @@ static void gdsp_do_dma() #endif switch (ctl & 0x3) { - case (DSP_CR_DMEM | DSP_CR_TO_CPU): - gdsp_ddma_out(dsp_addr, addr, len); - break; + case (DSP_CR_DMEM | DSP_CR_TO_CPU): + gdsp_ddma_out(dsp_addr, addr, len); + break; - case (DSP_CR_DMEM | DSP_CR_FROM_CPU): - gdsp_ddma_in(dsp_addr, addr, len); - break; + case (DSP_CR_DMEM | DSP_CR_FROM_CPU): + gdsp_ddma_in(dsp_addr, addr, len); + break; - case (DSP_CR_IMEM | DSP_CR_TO_CPU): - gdsp_idma_out(dsp_addr, addr, len); - break; + case (DSP_CR_IMEM | DSP_CR_TO_CPU): + gdsp_idma_out(dsp_addr, addr, len); + break; - case (DSP_CR_IMEM | DSP_CR_FROM_CPU): - gdsp_idma_in(dsp_addr, addr, len); - break; + case (DSP_CR_IMEM | DSP_CR_FROM_CPU): + gdsp_idma_in(dsp_addr, addr, len); + break; } } diff --git a/Source/Core/Core/Src/DSP/DSPHost.h b/Source/Core/Core/Src/DSP/DSPHost.h index 8ee90477d6..ad9fa0e5fd 100644 --- a/Source/Core/Core/Src/DSP/DSPHost.h +++ b/Source/Core/Core/Src/DSP/DSPHost.h @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #ifndef _DSPHOST_H diff --git a/Source/Core/Core/Src/DSP/DSPIntCCUtil.cpp b/Source/Core/Core/Src/DSP/DSPIntCCUtil.cpp index 644ce60663..a50899069b 100644 --- a/Source/Core/Core/Src/DSP/DSPIntCCUtil.cpp +++ b/Source/Core/Core/Src/DSP/DSPIntCCUtil.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ // Additional copyrights go to Duddie and Tratax (c) 2004 diff --git a/Source/Core/Core/Src/DSP/DSPIntCCUtil.h b/Source/Core/Core/Src/DSP/DSPIntCCUtil.h index 0684cea2ba..6b6ea2e146 100644 --- a/Source/Core/Core/Src/DSP/DSPIntCCUtil.h +++ b/Source/Core/Core/Src/DSP/DSPIntCCUtil.h @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ // Additional copyrights go to Duddie and Tratax (c) 2004 diff --git a/Source/Core/Core/Src/DSP/DSPIntExtOps.cpp b/Source/Core/Core/Src/DSP/DSPIntExtOps.cpp index 76032165e1..659639c678 100644 --- a/Source/Core/Core/Src/DSP/DSPIntExtOps.cpp +++ b/Source/Core/Core/Src/DSP/DSPIntExtOps.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #include "DSPIntUtil.h" #include "DSPMemoryMap.h" @@ -56,22 +56,25 @@ inline bool IsSameMemArea(u16 a, u16 b) // DR $arR // xxxx xxxx 0000 01rr // Decrement addressing register $arR. -void dr(const UDSPInstruction opc) { +void dr(const UDSPInstruction opc) +{ writeToBackLog(0, opc & 0x3, dsp_decrement_addr_reg(opc & 0x3)); } // IR $arR // xxxx xxxx 0000 10rr // Increment addressing register $arR. -void ir(const UDSPInstruction opc) { +void ir(const UDSPInstruction opc) +{ writeToBackLog(0, opc & 0x3, dsp_increment_addr_reg(opc & 0x3)); } // NR $arR // xxxx xxxx 0000 11rr // Add corresponding indexing register $ixR to addressing register $arR. -void nr(const UDSPInstruction opc) { - u8 reg = opc & 0x3; +void nr(const UDSPInstruction opc) +{ + u8 reg = opc & 0x3; writeToBackLog(0, reg, dsp_increase_addr_reg(reg, (s16)g_dsp.r.ix[reg])); } @@ -81,10 +84,11 @@ void nr(const UDSPInstruction opc) { // Move value of $acS.S to the $axD.D. void mv(const UDSPInstruction opc) { - u8 sreg = (opc & 0x3) + DSP_REG_ACL0; + u8 sreg = (opc & 0x3) + DSP_REG_ACL0; u8 dreg = ((opc >> 2) & 0x3); - switch(sreg) { + switch(sreg) + { case DSP_REG_ACL0: case DSP_REG_ACL1: writeToBackLog(0, dreg + DSP_REG_AXL0, g_dsp.r.ac[sreg-DSP_REG_ACL0].l); @@ -105,7 +109,8 @@ void s(const UDSPInstruction opc) u8 dreg = opc & 0x3; u8 sreg = ((opc >> 3) & 0x3) + DSP_REG_ACL0; - switch(sreg) { + switch(sreg) + { case DSP_REG_ACL0: case DSP_REG_ACL1: dsp_dmem_write(g_dsp.r.ar[dreg], g_dsp.r.ac[sreg-DSP_REG_ACL0].l); @@ -115,7 +120,7 @@ void s(const UDSPInstruction opc) dsp_dmem_write(g_dsp.r.ar[dreg], dsp_op_read_reg_and_saturate(sreg-DSP_REG_ACM0)); break; } - writeToBackLog(0, dreg, dsp_increment_addr_reg(dreg)); + writeToBackLog(0, dreg, dsp_increment_addr_reg(dreg)); } // SN @$arD, $acS.S @@ -127,7 +132,8 @@ void sn(const UDSPInstruction opc) u8 dreg = opc & 0x3; u8 sreg = ((opc >> 3) & 0x3) + DSP_REG_ACL0; - switch(sreg) { + switch(sreg) + { case DSP_REG_ACL0: case DSP_REG_ACL1: dsp_dmem_write(g_dsp.r.ar[dreg], g_dsp.r.ac[sreg-DSP_REG_ACL0].l); @@ -137,7 +143,7 @@ void sn(const UDSPInstruction opc) dsp_dmem_write(g_dsp.r.ar[dreg], dsp_op_read_reg_and_saturate(sreg-DSP_REG_ACM0)); break; } - writeToBackLog(0, dreg, dsp_increase_addr_reg(dreg, (s16)g_dsp.r.ix[dreg])); + writeToBackLog(0, dreg, dsp_increase_addr_reg(dreg, (s16)g_dsp.r.ix[dreg])); } // L $axD.D, @$arS @@ -153,13 +159,13 @@ void l(const UDSPInstruction opc) { u16 val = dsp_dmem_read(g_dsp.r.ar[sreg]); writeToBackLog(0, dreg - DSP_REG_ACM0 + DSP_REG_ACH0, (val & 0x8000) ? 0xFFFF : 0x0000); - writeToBackLog(1, dreg, val); + writeToBackLog(1, dreg, val); writeToBackLog(2, dreg - DSP_REG_ACM0 + DSP_REG_ACL0, 0); writeToBackLog(3, sreg, dsp_increment_addr_reg(sreg)); } else { - writeToBackLog(0, dreg, dsp_dmem_read(g_dsp.r.ar[sreg])); + writeToBackLog(0, dreg, dsp_dmem_read(g_dsp.r.ar[sreg])); writeToBackLog(1, sreg, dsp_increment_addr_reg(sreg)); } } @@ -177,13 +183,13 @@ void ln(const UDSPInstruction opc) { u16 val = dsp_dmem_read(g_dsp.r.ar[sreg]); writeToBackLog(0, dreg - DSP_REG_ACM0 + DSP_REG_ACH0, (val & 0x8000) ? 0xFFFF : 0x0000); - writeToBackLog(1, dreg, val); + writeToBackLog(1, dreg, val); writeToBackLog(2, dreg - DSP_REG_ACM0 + DSP_REG_ACL0, 0); writeToBackLog(3, sreg, dsp_increase_addr_reg(sreg, (s16)g_dsp.r.ix[sreg])); } else { - writeToBackLog(0, dreg, dsp_dmem_read(g_dsp.r.ar[sreg])); + writeToBackLog(0, dreg, dsp_dmem_read(g_dsp.r.ar[sreg])); writeToBackLog(1, sreg, dsp_increase_addr_reg(sreg, (s16)g_dsp.r.ix[sreg])); } } @@ -200,7 +206,7 @@ void ls(const UDSPInstruction opc) dsp_dmem_write(g_dsp.r.ar[3], dsp_op_read_reg_and_saturate(sreg)); - writeToBackLog(0, dreg, dsp_dmem_read(g_dsp.r.ar[0])); + writeToBackLog(0, dreg, dsp_dmem_read(g_dsp.r.ar[0])); writeToBackLog(1, DSP_REG_AR3, dsp_increment_addr_reg(DSP_REG_AR3)); writeToBackLog(2, DSP_REG_AR0, dsp_increment_addr_reg(DSP_REG_AR0)); } @@ -219,7 +225,7 @@ void lsn(const UDSPInstruction opc) dsp_dmem_write(g_dsp.r.ar[3], dsp_op_read_reg_and_saturate(sreg)); - writeToBackLog(0, dreg, dsp_dmem_read(g_dsp.r.ar[0])); + writeToBackLog(0, dreg, dsp_dmem_read(g_dsp.r.ar[0])); writeToBackLog(1, DSP_REG_AR3, dsp_increment_addr_reg(DSP_REG_AR3)); writeToBackLog(2, DSP_REG_AR0, dsp_increase_addr_reg(DSP_REG_AR0, (s16)g_dsp.r.ix[0])); } @@ -237,7 +243,7 @@ void lsm(const UDSPInstruction opc) dsp_dmem_write(g_dsp.r.ar[3], dsp_op_read_reg_and_saturate(sreg)); - writeToBackLog(0, dreg, dsp_dmem_read(g_dsp.r.ar[0])); + writeToBackLog(0, dreg, dsp_dmem_read(g_dsp.r.ar[0])); writeToBackLog(1, DSP_REG_AR3, dsp_increase_addr_reg(DSP_REG_AR3, (s16)g_dsp.r.ix[3])); writeToBackLog(2, DSP_REG_AR0, dsp_increment_addr_reg(DSP_REG_AR0)); } @@ -256,7 +262,7 @@ void lsnm(const UDSPInstruction opc) dsp_dmem_write(g_dsp.r.ar[3], dsp_op_read_reg_and_saturate(sreg)); - writeToBackLog(0, dreg, dsp_dmem_read(g_dsp.r.ar[0])); + writeToBackLog(0, dreg, dsp_dmem_read(g_dsp.r.ar[0])); writeToBackLog(1, DSP_REG_AR3, dsp_increase_addr_reg(DSP_REG_AR3, (s16)g_dsp.r.ix[3])); writeToBackLog(2, DSP_REG_AR0, dsp_increase_addr_reg(DSP_REG_AR0, (s16)g_dsp.r.ix[0])); } @@ -273,7 +279,7 @@ void sl(const UDSPInstruction opc) dsp_dmem_write(g_dsp.r.ar[0], dsp_op_read_reg_and_saturate(sreg)); - writeToBackLog(0, dreg, dsp_dmem_read(g_dsp.r.ar[3])); + writeToBackLog(0, dreg, dsp_dmem_read(g_dsp.r.ar[3])); writeToBackLog(1, DSP_REG_AR3, dsp_increment_addr_reg(DSP_REG_AR3)); writeToBackLog(2, DSP_REG_AR0, dsp_increment_addr_reg(DSP_REG_AR0)); } @@ -291,7 +297,7 @@ void sln(const UDSPInstruction opc) dsp_dmem_write(g_dsp.r.ar[0], dsp_op_read_reg_and_saturate(sreg)); - writeToBackLog(0, dreg, dsp_dmem_read(g_dsp.r.ar[3])); + writeToBackLog(0, dreg, dsp_dmem_read(g_dsp.r.ar[3])); writeToBackLog(1, DSP_REG_AR3, dsp_increment_addr_reg(DSP_REG_AR3)); writeToBackLog(2, DSP_REG_AR0, dsp_increase_addr_reg(DSP_REG_AR0, (s16)g_dsp.r.ix[0])); } @@ -309,7 +315,7 @@ void slm(const UDSPInstruction opc) dsp_dmem_write(g_dsp.r.ar[0], dsp_op_read_reg_and_saturate(sreg)); - writeToBackLog(0, dreg, dsp_dmem_read(g_dsp.r.ar[3])); + writeToBackLog(0, dreg, dsp_dmem_read(g_dsp.r.ar[3])); writeToBackLog(1, DSP_REG_AR3, dsp_increase_addr_reg(DSP_REG_AR3, (s16)g_dsp.r.ix[3])); writeToBackLog(2, DSP_REG_AR0, dsp_increment_addr_reg(DSP_REG_AR0)); } @@ -327,7 +333,7 @@ void slnm(const UDSPInstruction opc) dsp_dmem_write(g_dsp.r.ar[0], dsp_op_read_reg_and_saturate(sreg)); - writeToBackLog(0, dreg, dsp_dmem_read(g_dsp.r.ar[3])); + writeToBackLog(0, dreg, dsp_dmem_read(g_dsp.r.ar[3])); writeToBackLog(1, DSP_REG_AR3, dsp_increase_addr_reg(DSP_REG_AR3, (s16)g_dsp.r.ix[3])); writeToBackLog(2, DSP_REG_AR0, dsp_increase_addr_reg(DSP_REG_AR0, (s16)g_dsp.r.ix[0])); } @@ -354,7 +360,7 @@ void ld(const UDSPInstruction opc) else writeToBackLog(1, (rreg << 1) + DSP_REG_AXL1, dsp_dmem_read(g_dsp.r.ar[3])); - writeToBackLog(2, sreg, dsp_increment_addr_reg(sreg)); + writeToBackLog(2, sreg, dsp_increment_addr_reg(sreg)); writeToBackLog(3, DSP_REG_AR3, dsp_increment_addr_reg(DSP_REG_AR3)); } @@ -373,7 +379,7 @@ void ldax(const UDSPInstruction opc) else writeToBackLog(1, rreg + DSP_REG_AXL0, dsp_dmem_read(g_dsp.r.ar[3])); - writeToBackLog(2, sreg, dsp_increment_addr_reg(sreg)); + writeToBackLog(2, sreg, dsp_increment_addr_reg(sreg)); writeToBackLog(3, DSP_REG_AR3, dsp_increment_addr_reg(DSP_REG_AR3)); } @@ -393,7 +399,7 @@ void ldn(const UDSPInstruction opc) else writeToBackLog(1, (rreg << 1) + DSP_REG_AXL1, dsp_dmem_read(g_dsp.r.ar[3])); - writeToBackLog(2, sreg, dsp_increase_addr_reg(sreg, (s16)g_dsp.r.ix[sreg])); + writeToBackLog(2, sreg, dsp_increase_addr_reg(sreg, (s16)g_dsp.r.ix[sreg])); writeToBackLog(3, DSP_REG_AR3, dsp_increment_addr_reg(DSP_REG_AR3)); } @@ -412,7 +418,7 @@ void ldaxn(const UDSPInstruction opc) else writeToBackLog(1, rreg + DSP_REG_AXL0, dsp_dmem_read(g_dsp.r.ar[3])); - writeToBackLog(2, sreg, dsp_increase_addr_reg(sreg, (s16)g_dsp.r.ix[sreg])); + writeToBackLog(2, sreg, dsp_increase_addr_reg(sreg, (s16)g_dsp.r.ix[sreg])); writeToBackLog(3, DSP_REG_AR3, dsp_increment_addr_reg(DSP_REG_AR3)); } @@ -432,7 +438,7 @@ void ldm(const UDSPInstruction opc) else writeToBackLog(1, (rreg << 1) + DSP_REG_AXL1, dsp_dmem_read(g_dsp.r.ar[3])); - writeToBackLog(2, sreg, dsp_increment_addr_reg(sreg)); + writeToBackLog(2, sreg, dsp_increment_addr_reg(sreg)); writeToBackLog(3, DSP_REG_AR3, dsp_increase_addr_reg(DSP_REG_AR3, (s16)g_dsp.r.ix[3])); @@ -452,7 +458,7 @@ void ldaxm(const UDSPInstruction opc) else writeToBackLog(1, rreg + DSP_REG_AXL0, dsp_dmem_read(g_dsp.r.ar[3])); - writeToBackLog(2, sreg, dsp_increment_addr_reg(sreg)); + writeToBackLog(2, sreg, dsp_increment_addr_reg(sreg)); writeToBackLog(3, DSP_REG_AR3, dsp_increase_addr_reg(DSP_REG_AR3, (s16)g_dsp.r.ix[3])); @@ -473,7 +479,7 @@ void ldnm(const UDSPInstruction opc) else writeToBackLog(1, (rreg << 1) + DSP_REG_AXL1, dsp_dmem_read(g_dsp.r.ar[3])); - writeToBackLog(2, sreg, dsp_increase_addr_reg(sreg, (s16)g_dsp.r.ix[sreg])); + writeToBackLog(2, sreg, dsp_increase_addr_reg(sreg, (s16)g_dsp.r.ix[sreg])); writeToBackLog(3, DSP_REG_AR3, dsp_increase_addr_reg(DSP_REG_AR3, (s16)g_dsp.r.ix[3])); @@ -493,7 +499,7 @@ void ldaxnm(const UDSPInstruction opc) else writeToBackLog(1, rreg + DSP_REG_AXL0, dsp_dmem_read(g_dsp.r.ar[3])); - writeToBackLog(2, sreg, dsp_increase_addr_reg(sreg, (s16)g_dsp.r.ix[sreg])); + writeToBackLog(2, sreg, dsp_increase_addr_reg(sreg, (s16)g_dsp.r.ix[sreg])); writeToBackLog(3, DSP_REG_AR3, dsp_increase_addr_reg(DSP_REG_AR3, (s16)g_dsp.r.ix[3])); @@ -520,7 +526,8 @@ void applyWriteBackLog() { // always make sure to have an extra entry at the end w/ -1 to avoid // infinitive loops - for (int i = 0; writeBackLogIdx[i] != -1; i++) { + for (int i = 0; writeBackLogIdx[i] != -1; i++) + { #ifdef PRECISE_BACKLOG dsp_op_write_reg(writeBackLogIdx[i], dsp_op_read_reg(writeBackLogIdx[i]) | writeBackLog[i]); #else @@ -543,7 +550,8 @@ void zeroWriteBackLog() #ifdef PRECISE_BACKLOG // always make sure to have an extra entry at the end w/ -1 to avoid // infinitive loops - for (int i = 0; writeBackLogIdx[i] != -1; i++) { + for (int i = 0; writeBackLogIdx[i] != -1; i++) + { dsp_op_write_reg(writeBackLogIdx[i], 0); } #endif @@ -552,8 +560,8 @@ void zeroWriteBackLog() void zeroWriteBackLogPreserveAcc(u8 acc) { #ifdef PRECISE_BACKLOG - for (int i = 0; writeBackLogIdx[i] != -1; i++) { - + for (int i = 0; writeBackLogIdx[i] != -1; i++) + { // acc0 if ((acc == 0) && ((writeBackLogIdx[i] == DSP_REG_ACL0) || (writeBackLogIdx[i] == DSP_REG_ACM0) || (writeBackLogIdx[i] == DSP_REG_ACH0))) diff --git a/Source/Core/Core/Src/DSP/DSPIntUtil.h b/Source/Core/Core/Src/DSP/DSPIntUtil.h index 49f8c209c2..7299d7e8c9 100644 --- a/Source/Core/Core/Src/DSP/DSPIntUtil.h +++ b/Source/Core/Core/Src/DSP/DSPIntUtil.h @@ -130,7 +130,9 @@ static inline u16 dsp_decrement_addr_reg(u16 reg) static inline u16 dsp_op_read_reg(int _reg) { int reg = _reg & 0x1f; - switch (reg) { + + switch (reg) + { case DSP_REG_ST0: case DSP_REG_ST1: case DSP_REG_ST2: @@ -181,7 +183,9 @@ static inline u16 dsp_op_read_reg(int _reg) static inline void dsp_op_write_reg(int _reg, u16 val) { int reg = _reg & 0x1f; - switch (reg) { + + switch (reg) + { // 8-bit sign extended registers. Should look at prod.h too... case DSP_REG_ACH0: case DSP_REG_ACH1: @@ -349,10 +353,14 @@ inline u16 dsp_op_read_reg_and_saturate(u8 _reg) return 0x8000; } else + { return g_dsp.r.ac[_reg].m; + } } else + { return g_dsp.r.ac[_reg].m; + } } // --------------------------------------------------------------------------------------- diff --git a/Source/Core/Core/Src/DSP/DSPInterpreter.h b/Source/Core/Core/Src/DSP/DSPInterpreter.h index 916d43d8b4..21814c82fe 100644 --- a/Source/Core/Core/Src/DSP/DSPInterpreter.h +++ b/Source/Core/Core/Src/DSP/DSPInterpreter.h @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #ifndef _DSPINTERPRETER_H @@ -48,9 +48,9 @@ typedef void (*DSPInterpreterFunc)(const UDSPInstruction opc); void call(const UDSPInstruction opc); void callr(const UDSPInstruction opc); void ifcc(const UDSPInstruction opc); -void jcc(const UDSPInstruction opc); +void jcc(const UDSPInstruction opc); void jmprcc(const UDSPInstruction opc); -void ret(const UDSPInstruction opc); +void ret(const UDSPInstruction opc); void halt(const UDSPInstruction opc); void loop(const UDSPInstruction opc); void loopi(const UDSPInstruction opc); diff --git a/Source/Core/Core/Src/DSP/DSPTables.cpp b/Source/Core/Core/Src/DSP/DSPTables.cpp index c8f4135bec..c8c23bb5e7 100644 --- a/Source/Core/Core/Src/DSP/DSPTables.cpp +++ b/Source/Core/Core/Src/DSP/DSPTables.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ // Additional copyrights go to Duddie (c) 2005 (duddie@walla.com) @@ -27,7 +27,8 @@ void nop(const UDSPInstruction opc) { // The real nop is 0. Anything else is bad. - if (opc) { + if (opc) + { ERROR_LOG(DSPLLE, "LLE: Unrecognized opcode 0x%04x", opc); } } @@ -536,7 +537,7 @@ void InitInstructionTable() extOpTable[i] = &cw; for (int i = 0; i < EXT_OPTABLE_SIZE; i++) - { + { for (int j = 0; j < opcodes_ext_size; j++) { u16 mask = opcodes_ext[j].opcode_mask; @@ -576,4 +577,4 @@ void InitInstructionTable() for (int i=0; i < WRITEBACKLOGSIZE; i++) writeBackLogIdx[i] = -1; -} +} diff --git a/Source/Core/Core/Src/DSP/DSPTables.h b/Source/Core/Core/Src/DSP/DSPTables.h index 56ad885d23..37730bca98 100644 --- a/Source/Core/Core/Src/DSP/DSPTables.h +++ b/Source/Core/Core/Src/DSP/DSPTables.h @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ // Additional copyrights go to Duddie (c) 2005 (duddie@walla.com) @@ -34,14 +34,14 @@ enum partype_t { P_NONE = 0x0000, - P_VAL = 0x0001, + P_VAL = 0x0001, P_IMM = 0x0002, P_MEM = 0x0003, P_STR = 0x0004, P_ADDR_I = 0x0005, P_ADDR_D = 0x0006, P_REG = 0x8000, - P_REG04 = P_REG | 0x0400, // IX + P_REG04 = P_REG | 0x0400, // IX P_REG08 = P_REG | 0x0800, P_REG18 = P_REG | 0x1800, P_REGM18 = P_REG | 0x1810, // used in multiply instructions @@ -58,8 +58,8 @@ enum partype_t P_ACC_D = P_REG | 0x2080, P_AX = P_REG | 0x2200, P_REGS_MASK = 0x03f80, // gcdsptool's value = 0x01f80 - P_REF = P_REG | 0x4000, - P_PRG = P_REF | P_REG, + P_REF = P_REG | 0x4000, + P_PRG = P_REF | P_REG, // The following seem like junk: // P_REG10 = P_REG | 0x1000, @@ -143,14 +143,18 @@ inline void ExecuteInstruction(const UDSPInstruction inst) { const DSPOPCTemplate *tinst = GetOpTemplate(inst); - if (tinst->extended) { + if (tinst->extended) + { if ((inst >> 12) == 0x3) extOpTable[inst & 0x7F]->intFunc(inst); else extOpTable[inst & 0xFF]->intFunc(inst); } + tinst->intFunc(inst); - if (tinst->extended) { + + if (tinst->extended) + { applyWriteBackLog(); } } diff --git a/Source/Core/Core/Src/DSP/DspIntArithmetic.cpp b/Source/Core/Core/Src/DSP/DspIntArithmetic.cpp index f9627f2176..bae23c6014 100644 --- a/Source/Core/Core/Src/DSP/DspIntArithmetic.cpp +++ b/Source/Core/Core/Src/DSP/DspIntArithmetic.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ // Additional copyrights go to Duddie and Tratax (c) 2004 @@ -695,7 +695,7 @@ void dec(const UDSPInstruction opc) { u8 dreg = (opc >> 8) & 0x01; - s64 acc = dsp_get_long_acc(dreg); + s64 acc = dsp_get_long_acc(dreg); s64 res = acc - 1; zeroWriteBackLog(); @@ -734,7 +734,7 @@ void abs(const UDSPInstruction opc) { u8 dreg = (opc >> 11) & 0x1; - s64 acc = dsp_get_long_acc(dreg); + s64 acc = dsp_get_long_acc(dreg); if (acc < 0) acc = 0 - acc; @@ -756,9 +756,10 @@ void movr(const UDSPInstruction opc) { u8 areg = (opc >> 8) & 0x1; u8 sreg = ((opc >> 9) & 0x3) + DSP_REG_AXL0; - + s64 ax = 0; - switch(sreg) { + switch(sreg) + { case DSP_REG_AXL0: case DSP_REG_AXL1: ax = (s16)g_dsp.r.ax[sreg-DSP_REG_AXL0].l; @@ -973,9 +974,12 @@ void lsrn(const UDSPInstruction opc) else shift = accm & 0x3f; - if (shift > 0) { + if (shift > 0) + { acc >>= shift; - } else if (shift < 0) { + } + else if (shift < 0) + { acc <<= -shift; } @@ -1002,9 +1006,12 @@ void asrn(const UDSPInstruction opc) else shift = accm & 0x3f; - if (shift > 0) { + if (shift > 0) + { acc >>= shift; - } else if (shift < 0) { + } + else if (shift < 0) + { acc <<= -shift; } @@ -1035,9 +1042,12 @@ void lsrnrx(const UDSPInstruction opc) else shift = axh & 0x3f; - if (shift > 0) { + if (shift > 0) + { acc <<= shift; - } else if (shift < 0) { + } + else if (shift < 0) + { acc >>= -shift; } @@ -1069,9 +1079,12 @@ void asrnrx(const UDSPInstruction opc) else shift = axh & 0x3f; - if (shift > 0) { + if (shift > 0) + { acc <<= shift; - } else if (shift < 0) { + } + else if (shift < 0) + { acc >>= -shift; } diff --git a/Source/Core/Core/Src/DSP/DspIntBranch.cpp b/Source/Core/Core/Src/DSP/DspIntBranch.cpp index 80809aaae6..3384ec303a 100644 --- a/Source/Core/Core/Src/DSP/DspIntBranch.cpp +++ b/Source/Core/Core/Src/DSP/DspIntBranch.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ // Additional copyrights go to Duddie and Tratax (c) 2004 @@ -194,7 +194,9 @@ void loop(const UDSPInstruction opc) dsp_reg_store_stack(3, cnt); } else + { dsp_skip_inst(); + } } // LOOPI #I @@ -217,7 +219,9 @@ void loopi(const UDSPInstruction opc) dsp_reg_store_stack(3, cnt); } else + { dsp_skip_inst(); + } } diff --git a/Source/Core/Core/Src/DSP/DspIntLoadStore.cpp b/Source/Core/Core/Src/DSP/DspIntLoadStore.cpp index 3b301277ae..00e1ac659d 100644 --- a/Source/Core/Core/Src/DSP/DspIntLoadStore.cpp +++ b/Source/Core/Core/Src/DSP/DspIntLoadStore.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ // Additional copyrights go to Duddie and Tratax (c) 2004 diff --git a/Source/Core/Core/Src/DSP/DspIntMisc.cpp b/Source/Core/Core/Src/DSP/DspIntMisc.cpp index 7db4eec1eb..6b02d5d122 100644 --- a/Source/Core/Core/Src/DSP/DspIntMisc.cpp +++ b/Source/Core/Core/Src/DSP/DspIntMisc.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ // Additional copyrights go to Duddie and Tratax (c) 2004 diff --git a/Source/Core/Core/Src/DSP/DspIntMultiplier.cpp b/Source/Core/Core/Src/DSP/DspIntMultiplier.cpp index fbde7a645c..1f18f6b445 100644 --- a/Source/Core/Core/Src/DSP/DspIntMultiplier.cpp +++ b/Source/Core/Core/Src/DSP/DspIntMultiplier.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ // Additional copyrights go to Duddie and Tratax (c) 2004 @@ -203,7 +203,7 @@ void mulaxh(const UDSPInstruction opc) zeroWriteBackLog(); - dsp_set_long_prod(prod); + dsp_set_long_prod(prod); } //---- @@ -241,7 +241,7 @@ void mulac(const UDSPInstruction opc) u16 axl = dsp_get_ax_l(sreg); u16 axh = dsp_get_ax_h(sreg); s64 prod = dsp_multiply(axl, axh); - + zeroWriteBackLog(); dsp_set_long_prod(prod); @@ -265,7 +265,7 @@ void mulmv(const UDSPInstruction opc) u16 axl = dsp_get_ax_l(sreg); u16 axh = dsp_get_ax_h(sreg); s64 prod = dsp_multiply(axl, axh); - + zeroWriteBackLog(); dsp_set_long_prod(prod); @@ -335,7 +335,7 @@ void mulxac(const UDSPInstruction opc) u16 val1 = (sreg == 0) ? dsp_get_ax_l(0) : dsp_get_ax_h(0); u16 val2 = (treg == 0) ? dsp_get_ax_l(1) : dsp_get_ax_h(1); s64 prod = dsp_multiply_mulx(sreg, treg, val1, val2); - + zeroWriteBackLog(); dsp_set_long_prod(prod); @@ -408,7 +408,7 @@ void mulc(const UDSPInstruction opc) u16 accm = dsp_get_acc_m(sreg); u16 axh = dsp_get_ax_h(treg); s64 prod = dsp_multiply(accm, axh); - + zeroWriteBackLog(); dsp_set_long_prod(prod); @@ -484,7 +484,7 @@ void mulcmvz(const UDSPInstruction opc) u16 accm = dsp_get_acc_m(sreg); u16 axh = dsp_get_ax_h(treg); s64 prod = dsp_multiply(accm, axh); - + zeroWriteBackLog(); dsp_set_long_prod(prod); @@ -582,7 +582,7 @@ void madd(const UDSPInstruction opc) u16 axl = dsp_get_ax_l(sreg); u16 axh = dsp_get_ax_h(sreg); s64 prod = dsp_multiply_add(axl, axh); - + zeroWriteBackLog(); dsp_set_long_prod(prod); @@ -600,7 +600,7 @@ void msub(const UDSPInstruction opc) u16 axl = dsp_get_ax_l(sreg); u16 axh = dsp_get_ax_h(sreg); s64 prod = dsp_multiply_sub(axl, axh); - + zeroWriteBackLog(); dsp_set_long_prod(prod); diff --git a/Source/Core/Core/Src/DSP/Jit/DSPJitArithmetic.cpp b/Source/Core/Core/Src/DSP/Jit/DSPJitArithmetic.cpp index 185ada8ba3..0774f3488a 100644 --- a/Source/Core/Core/Src/DSP/Jit/DSPJitArithmetic.cpp +++ b/Source/Core/Core/Src/DSP/Jit/DSPJitArithmetic.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ // Additional copyrights go to Duddie and Tratax (c) 2004 diff --git a/Source/Core/Core/Src/DSP/Jit/DSPJitBranch.cpp b/Source/Core/Core/Src/DSP/Jit/DSPJitBranch.cpp index 252550b84c..a8dcb5f6c4 100644 --- a/Source/Core/Core/Src/DSP/Jit/DSPJitBranch.cpp +++ b/Source/Core/Core/Src/DSP/Jit/DSPJitBranch.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #include "../DSPMemoryMap.h" @@ -29,7 +29,8 @@ template static void ReJitConditional(const UDSPInstruction opc, DSPEmitter& emitter) { u8 cond = opc & 0xf; - if (cond == 0xf) {// Always true. + if (cond == 0xf) // Always true. + { jitCode(opc,emitter); return; } diff --git a/Source/Core/Core/Src/DSP/Jit/DSPJitExtOps.cpp b/Source/Core/Core/Src/DSP/Jit/DSPJitExtOps.cpp index 40e39a89e9..26af310087 100644 --- a/Source/Core/Core/Src/DSP/Jit/DSPJitExtOps.cpp +++ b/Source/Core/Core/Src/DSP/Jit/DSPJitExtOps.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #include "../DSPMemoryMap.h" #include "../DSPEmitter.h" @@ -41,21 +41,24 @@ using namespace Gen; // DR $arR // xxxx xxxx 0000 01rr // Decrement addressing register $arR. -void DSPEmitter::dr(const UDSPInstruction opc) { +void DSPEmitter::dr(const UDSPInstruction opc) +{ decrement_addr_reg(opc & 0x3); } // IR $arR // xxxx xxxx 0000 10rr // Increment addressing register $arR. -void DSPEmitter::ir(const UDSPInstruction opc) { +void DSPEmitter::ir(const UDSPInstruction opc) +{ increment_addr_reg(opc & 0x3); } // NR $arR // xxxx xxxx 0000 11rr // Add corresponding indexing register $ixR to addressing register $arR. -void DSPEmitter::nr(const UDSPInstruction opc) { +void DSPEmitter::nr(const UDSPInstruction opc) +{ u8 reg = opc & 0x3; increase_addr_reg(reg, reg); @@ -66,7 +69,7 @@ void DSPEmitter::nr(const UDSPInstruction opc) { // Move value of $acS.S to the $axD.D. void DSPEmitter::mv(const UDSPInstruction opc) { - u8 sreg = (opc & 0x3) + DSP_REG_ACL0; + u8 sreg = (opc & 0x3) + DSP_REG_ACL0; u8 dreg = ((opc >> 2) & 0x3); if (sreg >= DSP_REG_ACM0) { dsp_op_read_reg_and_saturate(sreg, RBX, ZERO); @@ -74,7 +77,7 @@ void DSPEmitter::mv(const UDSPInstruction opc) } else pushExtValueFromReg(dreg + DSP_REG_AXL0, sreg); } - + // S @$arD, $acS.S // xxxx xxxx 001s s0dd // Store value of $acS.S in the memory pointed by register $arD. @@ -652,12 +655,14 @@ void DSPEmitter::ldaxnm(const UDSPInstruction opc) // Push value from g_dsp.r[sreg] into EBX and stores the destinationindex in // storeIndex -void DSPEmitter::pushExtValueFromReg(u16 dreg, u16 sreg) { +void DSPEmitter::pushExtValueFromReg(u16 dreg, u16 sreg) +{ dsp_op_read_reg(sreg, RBX, ZERO); storeIndex = dreg; } -void DSPEmitter::pushExtValueFromMem(u16 dreg, u16 sreg) { +void DSPEmitter::pushExtValueFromMem(u16 dreg, u16 sreg) +{ // u16 addr = g_dsp.r[addr]; X64Reg tmp1; @@ -673,7 +678,8 @@ void DSPEmitter::pushExtValueFromMem(u16 dreg, u16 sreg) { storeIndex = dreg; } -void DSPEmitter::pushExtValueFromMem2(u16 dreg, u16 sreg) { +void DSPEmitter::pushExtValueFromMem2(u16 dreg, u16 sreg) +{ // u16 addr = g_dsp.r[addr]; X64Reg tmp1; @@ -690,7 +696,8 @@ void DSPEmitter::pushExtValueFromMem2(u16 dreg, u16 sreg) { storeIndex2 = dreg; } -void DSPEmitter::popExtValueToReg() { +void DSPEmitter::popExtValueToReg() +{ // in practise, we rarely ever have a non-NX main op // with an extended op, so the OR here is either // not run (storeIndex == -1) or ends up OR'ing @@ -698,9 +705,11 @@ void DSPEmitter::popExtValueToReg() { // nakee wants to keep it clean, so lets do that. // [nakeee] the or case never happens in real // [nakeee] it's just how the hardware works so we added it - if (storeIndex != -1) { + if (storeIndex != -1) + { dsp_op_write_reg(storeIndex, RBX); - if (storeIndex >= DSP_REG_ACM0 && storeIndex2 == -1) { + if (storeIndex >= DSP_REG_ACM0 && storeIndex2 == -1) + { TEST(32, R(EBX), Imm32(SR_40_MODE_BIT << 16)); FixupBranch not_40bit = J_CC(CC_Z, true); DSPJitRegCache c(gpr); @@ -722,9 +731,11 @@ void DSPEmitter::popExtValueToReg() { storeIndex = -1; - if (storeIndex2 != -1) { + if (storeIndex2 != -1) + { SHR(32, R(EBX), Imm8(16)); dsp_op_write_reg(storeIndex2, RBX); } + storeIndex2 = -1; } diff --git a/Source/Core/Core/Src/DSP/Jit/DSPJitLoadStore.cpp b/Source/Core/Core/Src/DSP/Jit/DSPJitLoadStore.cpp index 248ed8f945..0ead23ceff 100644 --- a/Source/Core/Core/Src/DSP/Jit/DSPJitLoadStore.cpp +++ b/Source/Core/Core/Src/DSP/Jit/DSPJitLoadStore.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ // Additional copyrights go to Duddie and Tratax (c) 2004 @@ -49,7 +49,6 @@ void DSPEmitter::srs(const UDSPInstruction opc) dmem_write(tmp1); gpr.putXReg(tmp1); - } // LRS $(0x18+D), @M diff --git a/Source/Core/Core/Src/DSP/Jit/DSPJitMisc.cpp b/Source/Core/Core/Src/DSP/Jit/DSPJitMisc.cpp index d0bf7a3822..65b05df699 100644 --- a/Source/Core/Core/Src/DSP/Jit/DSPJitMisc.cpp +++ b/Source/Core/Core/Src/DSP/Jit/DSPJitMisc.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ @@ -207,7 +207,8 @@ void DSPEmitter::dsp_conditional_extend_accum_imm(int reg, u16 val) void DSPEmitter::dsp_op_read_reg(int reg, Gen::X64Reg host_dreg, DSPJitSignExtend extend) { - switch (reg & 0x1f) { + switch (reg & 0x1f) + { case DSP_REG_ST0: case DSP_REG_ST1: case DSP_REG_ST2: @@ -424,13 +425,14 @@ void DSPEmitter::addarn(const UDSPInstruction opc) // g_dsp.r[dreg] = dsp_increase_addr_reg(dreg, (s16)g_dsp.r[DSP_REG_IX0 + sreg]); // From looking around it is always called with the matching index register - increase_addr_reg(opc & 0x3, (opc >> 2) & 0x3); + increase_addr_reg(opc & 0x3, (opc >> 2) & 0x3); } //---- -void DSPEmitter::setCompileSR(u16 bit) { +void DSPEmitter::setCompileSR(u16 bit) +{ // g_dsp.r[DSP_REG_SR] |= bit OpArg sr_reg; @@ -441,7 +443,8 @@ void DSPEmitter::setCompileSR(u16 bit) { compileSR |= bit; } -void DSPEmitter::clrCompileSR(u16 bit) { +void DSPEmitter::clrCompileSR(u16 bit) +{ // g_dsp.r[DSP_REG_SR] &= bit OpArg sr_reg; @@ -498,7 +501,7 @@ void DSPEmitter::srbith(const UDSPInstruction opc) break; // Automatic 40-bit sign extension when loading ACx.M. - // SET40 changes something very important: see the LRI instruction above. + // SET40 changes something very important: see the LRI instruction above. case 0xe: // SET16 (CLR40) clrCompileSR(SR_40_MODE_BIT); break; diff --git a/Source/Core/Core/Src/DSP/Jit/DSPJitMultiplier.cpp b/Source/Core/Core/Src/DSP/Jit/DSPJitMultiplier.cpp index 0dcbf41877..ade02457f8 100644 --- a/Source/Core/Core/Src/DSP/Jit/DSPJitMultiplier.cpp +++ b/Source/Core/Core/Src/DSP/Jit/DSPJitMultiplier.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ // Additional copyrights go to Duddie and Tratax (c) 2004 diff --git a/Source/Core/Core/Src/DSP/Jit/DSPJitRegCache.cpp b/Source/Core/Core/Src/DSP/Jit/DSPJitRegCache.cpp index 687982cfb9..96d9ccafa4 100644 --- a/Source/Core/Core/Src/DSP/Jit/DSPJitRegCache.cpp +++ b/Source/Core/Core/Src/DSP/Jit/DSPJitRegCache.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #include "DSPJitRegCache.h" @@ -21,8 +21,10 @@ using namespace Gen; -static void *reg_ptr(int reg) { - switch(reg) { +static void *reg_ptr(int reg) +{ + switch(reg) + { case DSP_REG_AR0: case DSP_REG_AR1: case DSP_REG_AR2: @@ -84,11 +86,14 @@ static void *reg_ptr(int reg) { //#undef STATIC_REG_ACCS DSPJitRegCache::DSPJitRegCache(DSPEmitter &_emitter) - : emitter(_emitter), temporary(false), merged(false) { - for(unsigned int i = 0; i < NUMXREGS; i++) { + : emitter(_emitter), temporary(false), merged(false) +{ + for(unsigned int i = 0; i < NUMXREGS; i++) + { xregs[i].guest_reg = DSP_REG_STATIC; xregs[i].pushed = false; } + xregs[RAX].guest_reg = DSP_REG_STATIC;// reserved for MUL/DIV xregs[RDX].guest_reg = DSP_REG_STATIC;// reserved for MUL/DIV xregs[RCX].guest_reg = DSP_REG_STATIC;// reserved for shifts @@ -98,7 +103,7 @@ DSPJitRegCache::DSPJitRegCache(DSPEmitter &_emitter) xregs[RSP].guest_reg = DSP_REG_STATIC;//stack pointer xregs[RBP].guest_reg = DSP_REG_NONE;//definitely usable in dsplle because - //all external calls are protected + //all external calls are protected xregs[RSI].guest_reg = DSP_REG_NONE; xregs[RDI].guest_reg = DSP_REG_NONE; @@ -119,7 +124,8 @@ DSPJitRegCache::DSPJitRegCache(DSPEmitter &_emitter) xregs[R15].guest_reg = DSP_REG_NONE; #endif - for(unsigned int i = 0; i <= DSP_REG_MAX_MEM_BACKED; i++) { + for(unsigned int i = 0; i <= DSP_REG_MAX_MEM_BACKED; i++) + { regs[i].mem = reg_ptr(i); regs[i].size = 0; regs[i].dirty = false; @@ -140,7 +146,8 @@ DSPJitRegCache::DSPJitRegCache(DSPEmitter &_emitter) regs[DSP_REG_ACC0_64].host_reg = R8; regs[DSP_REG_ACC1_64].host_reg = R9; #endif - for(unsigned int i = 0; i < 2; i++) { + for(unsigned int i = 0; i < 2; i++) + { regs[i+DSP_REG_ACC0_64].size = 8; regs[i+DSP_REG_ACL0].parentReg = i+DSP_REG_ACC0_64; regs[i+DSP_REG_ACM0].parentReg = i+DSP_REG_ACC0_64; @@ -149,6 +156,7 @@ DSPJitRegCache::DSPJitRegCache(DSPEmitter &_emitter) regs[i+DSP_REG_ACM0].shift = 16; regs[i+DSP_REG_ACH0].shift = 32; } + regs[DSP_REG_PROD_64].size = 8; regs[DSP_REG_PRODL].parentReg = DSP_REG_PROD_64; regs[DSP_REG_PRODM].parentReg = DSP_REG_PROD_64; @@ -160,7 +168,8 @@ DSPJitRegCache::DSPJitRegCache(DSPEmitter &_emitter) regs[DSP_REG_PRODM2].shift = 48; #endif - for(unsigned int i = 0; i < 2; i++) { + for(unsigned int i = 0; i < 2; i++) + { regs[i+DSP_REG_AX0_32].size = 4; regs[i+DSP_REG_AXL0].parentReg = i+DSP_REG_AX0_32; regs[i+DSP_REG_AXH0].parentReg = i+DSP_REG_AX0_32; @@ -206,22 +215,25 @@ void DSPJitRegCache::flushRegs(DSPJitRegCache &cache, bool emit) unsigned int i; //drop all guest register not used by cache - for(i = 0; i <= DSP_REG_MAX_MEM_BACKED; i++) { + for(i = 0; i <= DSP_REG_MAX_MEM_BACKED; i++) + { regs[i].used = false;//used is restored later if (regs[i].loc.IsSimpleReg() && - !cache.regs[i].loc.IsSimpleReg()) + !cache.regs[i].loc.IsSimpleReg()) movToMemory(i); } //try to move guest regs in the wrong host reg to the correct one int movcnt; - do { + do + { movcnt = 0; - for(i = 0; i <= DSP_REG_MAX_MEM_BACKED; i++) { + for(i = 0; i <= DSP_REG_MAX_MEM_BACKED; i++) + { X64Reg simple = regs[i].loc.GetSimpleReg(); X64Reg simple_cache = cache.regs[i].loc.GetSimpleReg(); - if (simple_cache != simple - && xregs[simple_cache].guest_reg == DSP_REG_NONE) + + if (simple_cache != simple && xregs[simple_cache].guest_reg == DSP_REG_NONE) { movToHostReg(i, simple_cache, true); movcnt++; @@ -230,35 +242,42 @@ void DSPJitRegCache::flushRegs(DSPJitRegCache &cache, bool emit) } while (movcnt != 0); //free all host regs that are not used for the same guest reg - for(i = 0; i <= DSP_REG_MAX_MEM_BACKED; i++) { + for(i = 0; i <= DSP_REG_MAX_MEM_BACKED; i++) + { if (cache.regs[i].loc.GetSimpleReg() != - regs[i].loc.GetSimpleReg() && - regs[i].loc.IsSimpleReg()) + regs[i].loc.GetSimpleReg() && + regs[i].loc.IsSimpleReg()) movToMemory(i); } //load all guest regs that are in memory and should be in host reg - for(i = 0; i <= DSP_REG_MAX_MEM_BACKED; i++) { - if (cache.regs[i].loc.IsSimpleReg()) { - movToHostReg(i, cache.regs[i].loc.GetSimpleReg(), - true); + for(i = 0; i <= DSP_REG_MAX_MEM_BACKED; i++) + { + if (cache.regs[i].loc.IsSimpleReg()) + { + movToHostReg(i, cache.regs[i].loc.GetSimpleReg(), true); rotateHostReg(i, cache.regs[i].shift, true); - } else if(cache.regs[i].loc.IsImm()) { - //todo: immediates? } + else if(cache.regs[i].loc.IsImm()) + { + // TODO: Immediates? + } + regs[i].used = cache.regs[i].used; regs[i].dirty |= cache.regs[i].dirty; regs[i].last_use_ctr = cache.regs[i].last_use_ctr; } //consistency checks - for(i = 0; i < NUMXREGS; i++) { + for(i = 0; i < NUMXREGS; i++) + { _assert_msg_(DSPLLE, xregs[i].guest_reg == cache.xregs[i].guest_reg, "cache and current xreg guest_reg mismatch for %d", i); } - for(i = 0; i <= DSP_REG_MAX_MEM_BACKED; i++) { + for(i = 0; i <= DSP_REG_MAX_MEM_BACKED; i++) + { _assert_msg_(DSPLLE, regs[i].loc.IsImm() == cache.regs[i].loc.IsImm(), "cache and current reg loc mismatch for %x", i); @@ -285,16 +304,21 @@ void DSPJitRegCache::flushMemBackedRegs() //this should have the same effect as //merge(DSPJitRegCache(emitter)); - unsigned int i; - for(i = 0; i <= DSP_REG_MAX_MEM_BACKED; i++) { + for(unsigned int i = 0; i <= DSP_REG_MAX_MEM_BACKED; i++) + { _assert_msg_(DSPLLE, !regs[i].used, "register %x still in use", i); + if (regs[i].used) emitter.INT3(); - if (regs[i].host_reg != INVALID_REG) { + + if (regs[i].host_reg != INVALID_REG) + { movToHostReg(i,regs[i].host_reg,true); rotateHostReg(i, 0, true); - } else if (regs[i].parentReg == DSP_REG_NONE) { + } + else if (regs[i].parentReg == DSP_REG_NONE) + { movToMemory(i); } } @@ -304,12 +328,14 @@ void DSPJitRegCache::flushRegs() { flushMemBackedRegs(); - for(unsigned int i = 0; i <= DSP_REG_MAX_MEM_BACKED; i++) { + for(unsigned int i = 0; i <= DSP_REG_MAX_MEM_BACKED; i++) + { if (regs[i].host_reg != INVALID_REG) movToMemory(i); } - for(unsigned int i = 0; i <= DSP_REG_MAX_MEM_BACKED; i++) { + for(unsigned int i = 0; i <= DSP_REG_MAX_MEM_BACKED; i++) + { _assert_msg_(DSPLLE, !regs[i].loc.IsSimpleReg(), "register %x is still a simple reg", i); @@ -373,12 +399,14 @@ static u64 ebp_store; void DSPJitRegCache::loadRegs(bool emit) { - for(unsigned int i = 0; i <= DSP_REG_MAX_MEM_BACKED; i++) { + for(unsigned int i = 0; i <= DSP_REG_MAX_MEM_BACKED; i++) + { if (regs[i].host_reg != INVALID_REG) movToHostReg(i,regs[i].host_reg); } - if (emit) { + if (emit) + { #ifdef _M_X64 emitter.MOV(64, M(&ebp_store), R(RBP)); #else @@ -391,12 +419,14 @@ void DSPJitRegCache::saveRegs() { flushRegs(); - for(unsigned int i = 0; i <= DSP_REG_MAX_MEM_BACKED; i++) { + for(unsigned int i = 0; i <= DSP_REG_MAX_MEM_BACKED; i++) + { if (regs[i].host_reg != INVALID_REG) movToMemory(i); } - for(unsigned int i = 0; i <= DSP_REG_MAX_MEM_BACKED; i++) { + for(unsigned int i = 0; i <= DSP_REG_MAX_MEM_BACKED; i++) + { _assert_msg_(DSPLLE, !regs[i].loc.IsSimpleReg(), "register %x is still a simple reg", i); @@ -409,16 +439,19 @@ void DSPJitRegCache::saveRegs() #endif } -void DSPJitRegCache::pushRegs() { +void DSPJitRegCache::pushRegs() +{ flushMemBackedRegs(); - for(unsigned int i = 0; i <= DSP_REG_MAX_MEM_BACKED; i++) { + for(unsigned int i = 0; i <= DSP_REG_MAX_MEM_BACKED; i++) + { if (regs[i].host_reg != INVALID_REG) movToMemory(i); } int push_count = 0; - for(unsigned int i = 0; i < NUMXREGS; i++) { + for(unsigned int i = 0; i < NUMXREGS; i++) + { if (xregs[i].guest_reg == DSP_REG_USED) push_count++; } @@ -432,21 +465,25 @@ void DSPJitRegCache::pushRegs() { emitter.SUB(32,R(ESP),Imm32(16 - 4 * (push_count & 3))); #endif - for(unsigned int i = 0; i < NUMXREGS; i++) { - if (xregs[i].guest_reg == DSP_REG_USED) { + for(unsigned int i = 0; i < NUMXREGS; i++) + { + if (xregs[i].guest_reg == DSP_REG_USED) + { emitter.PUSH((X64Reg)i); xregs[i].pushed = true; xregs[i].guest_reg = DSP_REG_NONE; } } - for(unsigned int i = 0; i <= DSP_REG_MAX_MEM_BACKED; i++) { + for(unsigned int i = 0; i <= DSP_REG_MAX_MEM_BACKED; i++) + { _assert_msg_(DSPLLE, !regs[i].loc.IsSimpleReg(), "register %x is still a simple reg", i); } - for(unsigned int i = 0; i < NUMXREGS; i++) { + for(unsigned int i = 0; i < NUMXREGS; i++) + { _assert_msg_(DSPLLE, xregs[i].guest_reg == DSP_REG_NONE || xregs[i].guest_reg == DSP_REG_STATIC, @@ -467,13 +504,16 @@ void DSPJitRegCache::popRegs() { emitter.MOV(32, M(&ebp_store), R(EBP)); #endif int push_count = 0; - for(unsigned int i = 0; i < NUMXREGS; i++) { + for(unsigned int i = 0; i < NUMXREGS; i++) + { if (xregs[i].pushed) push_count++; } - for(int i = NUMXREGS-1; i >= 0; i--) { - if (xregs[i].pushed) { + for(int i = NUMXREGS-1; i >= 0; i--) + { + if (xregs[i].pushed) + { emitter.POP((X64Reg)i); xregs[i].pushed = false; xregs[i].guest_reg = DSP_REG_USED; @@ -489,14 +529,17 @@ void DSPJitRegCache::popRegs() { emitter.ADD(32,R(ESP),Imm32(16 - 4 * (push_count & 3))); #endif - for(unsigned int i = 0; i <= DSP_REG_MAX_MEM_BACKED; i++) { + for(unsigned int i = 0; i <= DSP_REG_MAX_MEM_BACKED; i++) + { if (regs[i].host_reg != INVALID_REG) movToHostReg(i,regs[i].host_reg); } } -X64Reg DSPJitRegCache::makeABICallSafe(X64Reg reg) { - if (reg != RBP) { +X64Reg DSPJitRegCache::makeABICallSafe(X64Reg reg) +{ + if (reg != RBP) + { return reg; } @@ -530,8 +573,10 @@ void DSPJitRegCache::movToHostReg(int reg, X64Reg host_reg, bool load) if (xregs[host_reg].guest_reg != DSP_REG_STATIC) xregs[host_reg].guest_reg = reg; - if (load) { - switch(regs[reg].size) { + if (load) + { + switch(regs[reg].size) + { case 2: emitter.MOV(16, R(host_reg), regs[reg].loc); break; case 4: @@ -545,9 +590,10 @@ void DSPJitRegCache::movToHostReg(int reg, X64Reg host_reg, bool load) break; } } + regs[reg].loc = R(host_reg); if (old_reg != INVALID_REG && - xregs[old_reg].guest_reg != DSP_REG_STATIC) + xregs[old_reg].guest_reg != DSP_REG_STATIC) xregs[old_reg].guest_reg = DSP_REG_NONE; } @@ -562,13 +608,16 @@ void DSPJitRegCache::movToHostReg(int reg, bool load) if (regs[reg].loc.IsSimpleReg()) return; + X64Reg tmp; if (regs[reg].host_reg != INVALID_REG) tmp = regs[reg].host_reg; else tmp = findSpillFreeXReg(); + if (tmp == INVALID_REG) return; + movToHostReg(reg, tmp, load); } @@ -582,37 +631,43 @@ void DSPJitRegCache::rotateHostReg(int reg, int shift, bool emit) "register %x is not a simple reg", reg); _assert_msg_(DSPLLE, !regs[reg].used, "rotating in use guest reg %x!", reg); - if (shift > regs[reg].shift && emit) { - switch(regs[reg].size) { + + if (shift > regs[reg].shift && emit) + { + switch(regs[reg].size) + { case 2: emitter.ROR(16, regs[reg].loc, - Imm8(shift - regs[reg].shift)); + Imm8(shift - regs[reg].shift)); break; case 4: emitter.ROR(32, regs[reg].loc, - Imm8(shift - regs[reg].shift)); + Imm8(shift - regs[reg].shift)); break; #ifdef _M_X64 case 8: emitter.ROR(64, regs[reg].loc, - Imm8(shift - regs[reg].shift)); + Imm8(shift - regs[reg].shift)); break; #endif } - } else if (shift < regs[reg].shift && emit) { - switch(regs[reg].size) { + } + else if (shift < regs[reg].shift && emit) + { + switch(regs[reg].size) + { case 2: emitter.ROL(16, regs[reg].loc, - Imm8(regs[reg].shift - shift)); + Imm8(regs[reg].shift - shift)); break; case 4: emitter.ROL(32, regs[reg].loc, - Imm8(regs[reg].shift - shift)); + Imm8(regs[reg].shift - shift)); break; #ifdef _M_X64 case 8: emitter.ROL(64, regs[reg].loc, - Imm8(regs[reg].shift - shift)); + Imm8(regs[reg].shift - shift)); break; #endif } @@ -638,16 +693,23 @@ void DSPJitRegCache::movToMemory(int reg) //but first, check for any needed rotations if (regs[reg].loc.IsSimpleReg()) + { rotateHostReg(reg, 0, true); - else {} //todo: immediates? + } + else + { + // TODO: Immediates? + } _assert_msg_(DSPLLE, regs[reg].shift == 0, "still shifted??"); //move to mem OpArg tmp = M(regs[reg].mem); - if (regs[reg].dirty) { - switch(regs[reg].size) { + if (regs[reg].dirty) + { + switch(regs[reg].size) + { case 2: emitter.MOV(16, tmp, regs[reg].loc); break; case 4: @@ -663,7 +725,8 @@ void DSPJitRegCache::movToMemory(int reg) regs[reg].dirty = false; } - if (regs[reg].loc.IsSimpleReg()) { + if (regs[reg].loc.IsSimpleReg()) + { X64Reg hostreg = regs[reg].loc.GetSimpleReg(); if (xregs[hostreg].guest_reg != DSP_REG_STATIC) xregs[hostreg].guest_reg = DSP_REG_NONE; @@ -677,7 +740,8 @@ void DSPJitRegCache::getReg(int reg, OpArg &oparg, bool load) { int real_reg; int shift; - if (regs[reg].parentReg != DSP_REG_NONE) { + if (regs[reg].parentReg != DSP_REG_NONE) + { real_reg = regs[reg].parentReg; // always load and rotate since we need the other @@ -685,7 +749,9 @@ void DSPJitRegCache::getReg(int reg, OpArg &oparg, bool load) load = true; shift = regs[reg].shift; - } else { + } + else + { real_reg = reg; shift = 0; } @@ -698,20 +764,24 @@ void DSPJitRegCache::getReg(int reg, OpArg &oparg, bool load) // no nead to actually emit code for load or rotate if caller doesn't // use the contents, but see above for a reason to force the load movToHostReg(real_reg, load); - //todo: actually handle INVALID_REG + + // TODO: actually handle INVALID_REG _assert_msg_(DSPLLE, regs[real_reg].loc.IsSimpleReg(), "did not get host reg for %x", reg); + rotateHostReg(real_reg, shift, load); oparg = regs[real_reg].loc; regs[real_reg].used = true; //do some register specific fixup - switch(reg) { + switch(reg) + { #ifdef _M_X64 case DSP_REG_ACC0_64: case DSP_REG_ACC1_64: { - if (load) { + if (load) + { //need to do this because interpreter only does 48 bits //(and putReg does the same) emitter.SHL(64, oparg, Imm8(64-40));//sign extend @@ -730,15 +800,20 @@ void DSPJitRegCache::putReg(int reg, bool dirty) int real_reg = reg; if (regs[reg].parentReg != DSP_REG_NONE) real_reg = regs[reg].parentReg; + OpArg oparg = regs[real_reg].loc; - switch(reg) { + + switch(reg) + { case DSP_REG_ACH0: case DSP_REG_ACH1: { - if (dirty) { + if (dirty) + { //no need to extend to full 64bit here until interpreter //uses that - if (oparg.IsSimpleReg()) { + if (oparg.IsSimpleReg()) + { //register is already shifted correctly //(if at all) @@ -747,9 +822,9 @@ void DSPJitRegCache::putReg(int reg, bool dirty) //cannot use movsx with SPL, BPL, SIL or DIL //on 32 bit if (oparg.GetSimpleReg() == RSP || - oparg.GetSimpleReg() == RBP || - oparg.GetSimpleReg() == RSI || - oparg.GetSimpleReg() == RDI) + oparg.GetSimpleReg() == RBP || + oparg.GetSimpleReg() == RSI || + oparg.GetSimpleReg() == RDI) { emitter.SHL(16,oparg,Imm8(8)); emitter.SAR(16,oparg,Imm8(8)); @@ -758,12 +833,16 @@ void DSPJitRegCache::putReg(int reg, bool dirty) #endif { emitter.MOVSX(16, 8, - oparg.GetSimpleReg(), - oparg); + oparg.GetSimpleReg(), + oparg); } - } else if (oparg.IsImm()) { - //todo: immediates? - } else { + } + else if (oparg.IsImm()) + { + // TODO: Immediates? + } + else + { //this works on the memory, so use reg instead //of real_reg, since it has the right loc X64Reg tmp; @@ -780,7 +859,8 @@ void DSPJitRegCache::putReg(int reg, bool dirty) case DSP_REG_ACC0_64: case DSP_REG_ACC1_64: { - if (dirty) { + if (dirty) + { emitter.SHL(64, oparg, Imm8(64-40));//sign extend emitter.SAR(64, oparg, Imm8(64-40)); } @@ -790,8 +870,11 @@ void DSPJitRegCache::putReg(int reg, bool dirty) default: break; } + regs[real_reg].used = false; - if (regs[real_reg].loc.IsSimpleReg()) { + + if (regs[real_reg].loc.IsSimpleReg()) + { regs[real_reg].dirty |= dirty; regs[real_reg].last_use_ctr = use_ctr; use_ctr++; @@ -802,9 +885,12 @@ void DSPJitRegCache::readReg(int sreg, X64Reg host_dreg, DSPJitSignExtend extend { OpArg reg; getReg(sreg, reg); - switch(regs[sreg].size) { + + switch(regs[sreg].size) + { case 2: - switch(extend) { + switch(extend) + { #ifdef _M_X64 case SIGN: emitter.MOVSX(64, 16, host_dreg, reg); break; case ZERO: emitter.MOVZX(64, 16, host_dreg, reg); break; @@ -817,7 +903,8 @@ void DSPJitRegCache::readReg(int sreg, X64Reg host_dreg, DSPJitSignExtend extend break; case 4: #ifdef _M_X64 - switch(extend) { + switch(extend) + { case SIGN: emitter.MOVSX(64, 32, host_dreg, reg); break; case ZERO: emitter.MOVZX(64, 32, host_dreg, reg); break; case NONE: emitter.MOV(32, R(host_dreg), reg); break; @@ -842,7 +929,9 @@ void DSPJitRegCache::writeReg(int dreg, OpArg arg) { OpArg reg; getReg(dreg, reg, false); - switch(regs[dreg].size) { + + switch(regs[dreg].size) + { case 2: emitter.MOV(16, reg, arg); break; case 4: emitter.MOV(32, reg, arg); break; #ifdef _M_X64 @@ -870,29 +959,36 @@ X64Reg DSPJitRegCache::spillXReg() unsigned int i; unsigned int max_use_ctr_diff = 0; X64Reg least_recent_use_reg = INVALID_REG; - for(i = 0; i < sizeof(alloc_order)/sizeof(alloc_order[0]); i++) { + for(i = 0; i < sizeof(alloc_order)/sizeof(alloc_order[0]); i++) + { X64Reg reg = alloc_order[i]; if (xregs[reg].guest_reg <= DSP_REG_MAX_MEM_BACKED && - !regs[xregs[reg].guest_reg].used) { + !regs[xregs[reg].guest_reg].used) + { unsigned int use_ctr_diff = use_ctr - regs[xregs[reg].guest_reg].last_use_ctr; - if (use_ctr_diff >= max_use_ctr_diff) { + + if (use_ctr_diff >= max_use_ctr_diff) + { max_use_ctr_diff = use_ctr_diff; least_recent_use_reg = reg; } } } - if (least_recent_use_reg != INVALID_REG) { + if (least_recent_use_reg != INVALID_REG) + { movToMemory(xregs[least_recent_use_reg].guest_reg); return least_recent_use_reg; } //just choose one. - for(i = 0; i < sizeof(alloc_order)/sizeof(alloc_order[0]); i++) { + for(i = 0; i < sizeof(alloc_order)/sizeof(alloc_order[0]); i++) + { X64Reg reg = alloc_order[i]; if (xregs[reg].guest_reg <= DSP_REG_MAX_MEM_BACKED && - !regs[xregs[reg].guest_reg].used) { + !regs[xregs[reg].guest_reg].used) + { movToMemory(xregs[reg].guest_reg); return reg; } @@ -903,12 +999,16 @@ X64Reg DSPJitRegCache::spillXReg() void DSPJitRegCache::spillXReg(X64Reg reg) { - if (xregs[reg].guest_reg <= DSP_REG_MAX_MEM_BACKED) { + if (xregs[reg].guest_reg <= DSP_REG_MAX_MEM_BACKED) + { _assert_msg_(DSPLLE, !regs[xregs[reg].guest_reg].used, "to be spilled host reg %x(guest reg %x) still in use!", reg, xregs[reg].guest_reg); + movToMemory(xregs[reg].guest_reg); - } else { + } + else + { _assert_msg_(DSPLLE, xregs[reg].guest_reg == DSP_REG_NONE, "to be spilled host reg %x still in use!", reg); @@ -917,9 +1017,10 @@ void DSPJitRegCache::spillXReg(X64Reg reg) X64Reg DSPJitRegCache::findFreeXReg() { - unsigned int i; - for(i = 0; i < sizeof(alloc_order)/sizeof(alloc_order[0]); i++) { - if (xregs[alloc_order[i]].guest_reg == DSP_REG_NONE) { + for(unsigned int i = 0; i < sizeof(alloc_order)/sizeof(alloc_order[0]); i++) + { + if (xregs[alloc_order[i]].guest_reg == DSP_REG_NONE) + { return alloc_order[i]; } } @@ -946,23 +1047,29 @@ void DSPJitRegCache::getFreeXReg(X64Reg ®) void DSPJitRegCache::getXReg(X64Reg reg) { - if (xregs[reg].guest_reg == DSP_REG_STATIC) { + if (xregs[reg].guest_reg == DSP_REG_STATIC) + { ERROR_LOG(DSPLLE, "Trying to get statically used XReg %d", reg); return; } + if (xregs[reg].guest_reg != DSP_REG_NONE) spillXReg(reg); + _assert_msg_(DSPLLE, xregs[reg].guest_reg != DSP_REG_NONE, "register already in use"); xregs[reg].guest_reg = DSP_REG_USED; } void DSPJitRegCache::putXReg(X64Reg reg) { - if (xregs[reg].guest_reg == DSP_REG_STATIC) { + if (xregs[reg].guest_reg == DSP_REG_STATIC) + { ERROR_LOG(DSPLLE, "Trying to put statically used XReg %d", reg); return; } + _assert_msg_(DSPLLE, xregs[reg].guest_reg == DSP_REG_USED, "putXReg without get(Free)XReg"); + xregs[reg].guest_reg = DSP_REG_NONE; } diff --git a/Source/Core/Core/Src/DSP/Jit/DSPJitRegCache.h b/Source/Core/Core/Src/DSP/Jit/DSPJitRegCache.h index e9ec61d123..0725e6fe5b 100644 --- a/Source/Core/Core/Src/DSP/Jit/DSPJitRegCache.h +++ b/Source/Core/Core/Src/DSP/Jit/DSPJitRegCache.h @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #ifndef _DSPJITREGCACHE_H @@ -22,7 +22,8 @@ class DSPEmitter; -enum DSPJitRegSpecial { +enum DSPJitRegSpecial +{ DSP_REG_AX0_32 =32, DSP_REG_AX1_32 =33, #ifdef _M_X64 @@ -39,8 +40,11 @@ enum DSPJitRegSpecial { DSP_REG_NONE =255 }; -enum DSPJitSignExtend { - SIGN, ZERO, NONE +enum DSPJitSignExtend +{ + SIGN, + ZERO, + NONE }; #ifdef _M_X64 @@ -49,14 +53,17 @@ enum DSPJitSignExtend { #define NUMXREGS 8 #endif -class DSPJitRegCache { +class DSPJitRegCache +{ private: struct X64CachedReg { int guest_reg; //including DSPJitRegSpecial bool pushed; }; - struct DynamicReg { + + struct DynamicReg + { Gen::OpArg loc; void *mem; size_t size; @@ -67,7 +74,7 @@ private: int shift;//current shift if parentReg == DSP_REG_NONE //otherwise the shift this part can be found at Gen::X64Reg host_reg; -/* todo: +/* TODO: + drop sameReg + add parentReg + add shift: diff --git a/Source/Core/Core/Src/DSP/Jit/DSPJitUtil.cpp b/Source/Core/Core/Src/DSP/Jit/DSPJitUtil.cpp index 2fb18f83da..a914f61f68 100644 --- a/Source/Core/Core/Src/DSP/Jit/DSPJitUtil.cpp +++ b/Source/Core/Core/Src/DSP/Jit/DSPJitUtil.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #include "../DSPMemoryMap.h" diff --git a/Source/Core/Core/Src/DSP/Jit/DSPJitUtil.h b/Source/Core/Core/Src/DSP/Jit/DSPJitUtil.h index 2d28b6d520..8a4c641503 100644 --- a/Source/Core/Core/Src/DSP/Jit/DSPJitUtil.h +++ b/Source/Core/Core/Src/DSP/Jit/DSPJitUtil.h @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #ifndef __DSPJITUTIL_H__ diff --git a/Source/Core/Core/Src/DSP/LabelMap.cpp b/Source/Core/Core/Src/DSP/LabelMap.cpp index bc6b8d7ba2..d1bbc69ee3 100644 --- a/Source/Core/Core/Src/DSP/LabelMap.cpp +++ b/Source/Core/Core/Src/DSP/LabelMap.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #include "LabelMap.h" @@ -68,10 +68,13 @@ bool LabelMap::GetLabelValue(const std::string &label, u16 *value, LabelType typ { if (!label.compare(labels[i].name)) { - if (type & labels[i].type) { + if (type & labels[i].type) + { *value = labels[i].addr; return true; - } else { + } + else + { printf("WARNING: Wrong label type requested. %s\n", label.c_str()); } } diff --git a/Source/Core/Core/Src/DSP/LabelMap.h b/Source/Core/Core/Src/DSP/LabelMap.h index 2bdaee9049..75b20faefd 100644 --- a/Source/Core/Core/Src/DSP/LabelMap.h +++ b/Source/Core/Core/Src/DSP/LabelMap.h @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #ifndef _LABELMAP_H diff --git a/Source/Core/Core/Src/DSP/assemble.cpp b/Source/Core/Core/Src/DSP/assemble.cpp index 248b0d8ba8..8deef98ed9 100644 --- a/Source/Core/Core/Src/DSP/assemble.cpp +++ b/Source/Core/Core/Src/DSP/assemble.cpp @@ -752,7 +752,7 @@ void DSPAssembler::InitPass(int pass) bool DSPAssembler::AssembleFile(const char *fname, int pass) { - int disable_text = 0; // modified by Hermes + int disable_text = 0; // modified by Hermes std::ifstream fsrc; OpenFStream(fsrc, fname, std::ios_base::in); diff --git a/Source/Core/Core/Src/DSPEmulator.cpp b/Source/Core/Core/Src/DSPEmulator.cpp index 907eb225b3..c5dfa096a0 100644 --- a/Source/Core/Core/Src/DSPEmulator.cpp +++ b/Source/Core/Core/Src/DSPEmulator.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #include "DSPEmulator.h" diff --git a/Source/Core/Core/Src/DSPEmulator.h b/Source/Core/Core/Src/DSPEmulator.h index b5d04e3e2a..1bdab6ba67 100644 --- a/Source/Core/Core/Src/DSPEmulator.h +++ b/Source/Core/Core/Src/DSPEmulator.h @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #ifndef _DSPEMULATOR_H_ diff --git a/Source/Core/Core/Src/Debugger/Debugger_SymbolMap.cpp b/Source/Core/Core/Src/Debugger/Debugger_SymbolMap.cpp index 3edde92883..1eadacf343 100644 --- a/Source/Core/Core/Src/Debugger/Debugger_SymbolMap.cpp +++ b/Source/Core/Core/Src/Debugger/Debugger_SymbolMap.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #include "Common.h" @@ -40,7 +40,7 @@ void AddAutoBreakpoints() { Symbol *symbol = g_symbolDB.GetSymbolFromName(bps[i]); if (symbol) - PowerPC::breakpoints.Add(symbol->address, false); + PowerPC::breakpoints.Add(symbol->address, false); } #endif #endif @@ -54,15 +54,15 @@ bool GetCallstack(std::vector &output) if (Core::GetState() == Core::CORE_UNINITIALIZED) return false; - if (!Memory::IsRAMAddress(PowerPC::ppcState.gpr[1])) - return false; + if (!Memory::IsRAMAddress(PowerPC::ppcState.gpr[1])) + return false; u32 addr = Memory::ReadUnchecked_U32(PowerPC::ppcState.gpr[1]); // SP if (LR == 0) { - CallstackEntry entry; - entry.Name = "(error: LR=0)"; - entry.vAddress = 0x0; + CallstackEntry entry; + entry.Name = "(error: LR=0)"; + entry.vAddress = 0x0; output.push_back(entry); return false; } @@ -78,31 +78,31 @@ bool GetCallstack(std::vector &output) //walk the stack chain while ((addr != 0xFFFFFFFF) && (addr != 0) && (count++ < 20) && (PowerPC::ppcState.gpr[1] != 0)) { - if (!Memory::IsRAMAddress(addr + 4)) - return false; + if (!Memory::IsRAMAddress(addr + 4)) + return false; u32 func = Memory::ReadUnchecked_U32(addr + 4); const char *str = g_symbolDB.GetDescription(func); if (!str || strlen(str) == 0 || !strcmp(str, "Invalid")) str = "(unknown)"; - entry.Name = StringFromFormat(" * %s [ addr = %08x ]\n", str, func - 4); - entry.vAddress = func - 4; + entry.Name = StringFromFormat(" * %s [ addr = %08x ]\n", str, func - 4); + entry.vAddress = func - 4; output.push_back(entry); - if (!Memory::IsRAMAddress(addr)) - return false; + if (!Memory::IsRAMAddress(addr)) + return false; - addr = Memory::ReadUnchecked_U32(addr); + addr = Memory::ReadUnchecked_U32(addr); } - return true; + return true; } void PrintCallstack() { u32 addr = Memory::ReadUnchecked_U32(PowerPC::ppcState.gpr[1]); // SP - + printf("== STACK TRACE - SP = %08x ==", PowerPC::ppcState.gpr[1]); if (LR == 0) { @@ -114,7 +114,7 @@ void PrintCallstack() printf(" * %s [ LR = %08x ]", g_symbolDB.GetDescription(LR), LR); count++; } - + //walk the stack chain while ((addr != 0xFFFFFFFF) && (addr != 0) && (count++ < 20) && (PowerPC::ppcState.gpr[1] != 0)) { diff --git a/Source/Core/Core/Src/Debugger/Debugger_SymbolMap.h b/Source/Core/Core/Src/Debugger/Debugger_SymbolMap.h index 5ce7144540..75152ddc51 100644 --- a/Source/Core/Core/Src/Debugger/Debugger_SymbolMap.h +++ b/Source/Core/Core/Src/Debugger/Debugger_SymbolMap.h @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #ifndef _DEBUGGER_SYMBOLMAP_H diff --git a/Source/Core/Core/Src/Debugger/Dump.cpp b/Source/Core/Core/Src/Debugger/Dump.cpp index 8d70c72c2b..aa2eedd939 100644 --- a/Source/Core/Core/Src/Debugger/Dump.cpp +++ b/Source/Core/Core/Src/Debugger/Dump.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #include diff --git a/Source/Core/Core/Src/Debugger/Dump.h b/Source/Core/Core/Src/Debugger/Dump.h index 6cc5dbbf4e..d8b131f300 100644 --- a/Source/Core/Core/Src/Debugger/Dump.h +++ b/Source/Core/Core/Src/Debugger/Dump.h @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ // uncompress the dumps from costis GC-Debugger tool // diff --git a/Source/Core/Core/Src/Debugger/GCELF.h b/Source/Core/Core/Src/Debugger/GCELF.h index f6325d001b..b18126f44a 100644 --- a/Source/Core/Core/Src/Debugger/GCELF.h +++ b/Source/Core/Core/Src/Debugger/GCELF.h @@ -43,12 +43,12 @@ typedef struct { - unsigned char ID[4]; - unsigned char clazz; - unsigned char data; - unsigned char version; - unsigned char pad[9]; - unsigned short e_type; // ELF file type + unsigned char ID[4]; + unsigned char clazz; + unsigned char data; + unsigned char version; + unsigned char pad[9]; + unsigned short e_type; // ELF file type unsigned short e_machine; // ELF target machine unsigned int e_version; // ELF file version number unsigned int e_entry; @@ -63,15 +63,16 @@ typedef struct unsigned short e_shtrndx; } ELF_Header; -typedef struct { - unsigned int type; - unsigned int offset; - unsigned int vaddr; - unsigned int paddr; - unsigned int filesz; - unsigned int memsz; - unsigned int flags; - unsigned int align; +typedef struct +{ + unsigned int type; + unsigned int offset; + unsigned int vaddr; + unsigned int paddr; + unsigned int filesz; + unsigned int memsz; + unsigned int flags; + unsigned int align; } Program_Header; typedef struct @@ -88,16 +89,18 @@ typedef struct unsigned int entsize; } Section_Header; -typedef struct { - unsigned int name; - unsigned int value; - unsigned int size; - unsigned char info; - unsigned char other; - unsigned short shndx; +typedef struct +{ + unsigned int name; + unsigned int value; + unsigned int size; + unsigned char info; + unsigned char other; + unsigned short shndx; } Symbol_Header; -typedef struct { +typedef struct +{ unsigned int offset; unsigned int info; signed int addend; diff --git a/Source/Core/Core/Src/Debugger/PPCDebugInterface.cpp b/Source/Core/Core/Src/Debugger/PPCDebugInterface.cpp index 30450f9ac7..0490119b12 100644 --- a/Source/Core/Core/Src/Debugger/PPCDebugInterface.cpp +++ b/Source/Core/Core/Src/Debugger/PPCDebugInterface.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #include "Debugger_SymbolMap.h" diff --git a/Source/Core/Core/Src/DolLoader.h b/Source/Core/Core/Src/DolLoader.h index 96bf3f04cc..c62e8f8db7 100644 --- a/Source/Core/Core/Src/DolLoader.h +++ b/Source/Core/Core/Src/DolLoader.h @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ // M O D U L E B E G I N diff --git a/Source/Core/Core/Src/FifoPlayer/FifoAnalyzer.cpp b/Source/Core/Core/Src/FifoPlayer/FifoAnalyzer.cpp index 383fcb555d..7999c3d68d 100644 --- a/Source/Core/Core/Src/FifoPlayer/FifoAnalyzer.cpp +++ b/Source/Core/Core/Src/FifoPlayer/FifoAnalyzer.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #include "FifoAnalyzer.h" @@ -35,21 +35,21 @@ void Init() } u8 ReadFifo8(u8 *&data) -{ +{ u8 value = data[0]; data += 1; return value; } u16 ReadFifo16(u8 *&data) -{ +{ u16 value = Common::swap16(data); data += 2; return value; } u32 ReadFifo32(u8 *&data) -{ +{ u32 value = Common::swap32(data); data += 4; return value; @@ -57,13 +57,13 @@ u32 ReadFifo32(u8 *&data) void InitBPMemory(BPMemory *bpMem) { - memset(bpMem, 0, sizeof(BPMemory)); - bpMem->bpMask = 0x00FFFFFF; + memset(bpMem, 0, sizeof(BPMemory)); + bpMem->bpMask = 0x00FFFFFF; } BPCmd DecodeBPCmd(u32 value, const BPMemory &bpMem) { - //handle the mask register + //handle the mask register int opcode = value >> 24; int oldval = ((u32*)&bpMem)[opcode]; int newval = (oldval & ~bpMem.bpMask) | (value & bpMem.bpMask); @@ -71,7 +71,7 @@ BPCmd DecodeBPCmd(u32 value, const BPMemory &bpMem) BPCmd bp = {opcode, changes, newval}; - return bp; + return bp; } void LoadBPReg(const BPCmd &bp, BPMemory &bpMem) @@ -152,23 +152,23 @@ void CalculateVertexElementSizes(int sizes[], int vatIndex, const CPMemory &cpMe const TVtxDesc &vtxDesc = cpMem.vtxDesc; const VAT &vtxAttr = cpMem.vtxAttr[vatIndex]; - // Colors + // Colors const u32 colDesc[2] = {vtxDesc.Color0, vtxDesc.Color1}; const u32 colComp[2] = {vtxAttr.g0.Color0Comp, vtxAttr.g0.Color1Comp}; - - const u32 tcElements[8] = - { - vtxAttr.g0.Tex0CoordElements, vtxAttr.g1.Tex1CoordElements, vtxAttr.g1.Tex2CoordElements, - vtxAttr.g1.Tex3CoordElements, vtxAttr.g1.Tex4CoordElements, vtxAttr.g2.Tex5CoordElements, - vtxAttr.g2.Tex6CoordElements, vtxAttr.g2.Tex7CoordElements - }; - const u32 tcFormat[8] = + const u32 tcElements[8] = { - vtxAttr.g0.Tex0CoordFormat, vtxAttr.g1.Tex1CoordFormat, vtxAttr.g1.Tex2CoordFormat, - vtxAttr.g1.Tex3CoordFormat, vtxAttr.g1.Tex4CoordFormat, vtxAttr.g2.Tex5CoordFormat, - vtxAttr.g2.Tex6CoordFormat, vtxAttr.g2.Tex7CoordFormat - }; + vtxAttr.g0.Tex0CoordElements, vtxAttr.g1.Tex1CoordElements, vtxAttr.g1.Tex2CoordElements, + vtxAttr.g1.Tex3CoordElements, vtxAttr.g1.Tex4CoordElements, vtxAttr.g2.Tex5CoordElements, + vtxAttr.g2.Tex6CoordElements, vtxAttr.g2.Tex7CoordElements + }; + + const u32 tcFormat[8] = + { + vtxAttr.g0.Tex0CoordFormat, vtxAttr.g1.Tex1CoordFormat, vtxAttr.g1.Tex2CoordFormat, + vtxAttr.g1.Tex3CoordFormat, vtxAttr.g1.Tex4CoordFormat, vtxAttr.g2.Tex5CoordFormat, + vtxAttr.g2.Tex6CoordFormat, vtxAttr.g2.Tex7CoordFormat + }; // Add position and texture matrix indices u64 vtxDescHex = cpMem.vtxDesc.Hex; @@ -178,14 +178,14 @@ void CalculateVertexElementSizes(int sizes[], int vatIndex, const CPMemory &cpMe vtxDescHex >>= 1; } - // Position + // Position sizes[9] = VertexLoader_Position::GetSize(vtxDesc.Position, vtxAttr.g0.PosFormat, vtxAttr.g0.PosElements); // Normals if (vtxDesc.Normal != NOT_PRESENT) { sizes[10] = VertexLoader_Normal::GetSize(vtxDesc.Normal, vtxAttr.g0.NormalFormat, vtxAttr.g0.NormalElements, vtxAttr.g0.NormalIndex3); - } + } else { sizes[10] = 0; @@ -212,11 +212,11 @@ void CalculateVertexElementSizes(int sizes[], int vatIndex, const CPMemory &cpMe default: _assert_(0); break; } break; - case INDEX8: - size = 1; + case INDEX8: + size = 1; break; case INDEX16: - size = 2; + size = 2; break; } @@ -229,7 +229,7 @@ void CalculateVertexElementSizes(int sizes[], int vatIndex, const CPMemory &cpMe { sizes[13 + i] = VertexLoader_TextCoord::GetSize(vtxDescHex & 3, tcFormat[i], tcElements[i]); vtxDescHex >>= 2; - } + } } } diff --git a/Source/Core/Core/Src/FifoPlayer/FifoAnalyzer.h b/Source/Core/Core/Src/FifoPlayer/FifoAnalyzer.h index ba2051f848..dd25460fd3 100644 --- a/Source/Core/Core/Src/FifoPlayer/FifoAnalyzer.h +++ b/Source/Core/Core/Src/FifoPlayer/FifoAnalyzer.h @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #ifndef _FIFOANALYZER_H diff --git a/Source/Core/Core/Src/FifoPlayer/FifoDataFile.cpp b/Source/Core/Core/Src/FifoPlayer/FifoDataFile.cpp index cf252f5f82..8d29ebf618 100644 --- a/Source/Core/Core/Src/FifoPlayer/FifoDataFile.cpp +++ b/Source/Core/Core/Src/FifoPlayer/FifoDataFile.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #include "FifoDataFile.h" @@ -38,7 +38,7 @@ FifoDataFile::~FifoDataFile() delete []frame.memoryUpdates[i].data; delete []frame.fifoData; - } + } } void FifoDataFile::SetIsWii(bool isWii) diff --git a/Source/Core/Core/Src/FifoPlayer/FifoDataFile.h b/Source/Core/Core/Src/FifoPlayer/FifoDataFile.h index d1ae9ee886..52074a2e6d 100644 --- a/Source/Core/Core/Src/FifoPlayer/FifoDataFile.h +++ b/Source/Core/Core/Src/FifoPlayer/FifoDataFile.h @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #ifndef _FIFODATAFILE_H_ diff --git a/Source/Core/Core/Src/FifoPlayer/FifoFileStruct.h b/Source/Core/Core/Src/FifoPlayer/FifoFileStruct.h index 97e84e7660..f4ae6fa6d1 100644 --- a/Source/Core/Core/Src/FifoPlayer/FifoFileStruct.h +++ b/Source/Core/Core/Src/FifoPlayer/FifoFileStruct.h @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #ifndef _FIFOFILESTRUCT_H_ @@ -37,8 +37,8 @@ union FileHeader struct { u32 fileId; - u32 file_version; - u32 min_loader_version; + u32 file_version; + u32 min_loader_version; u64 bpMemOffset; u32 bpMemSize; u64 cpMemOffset; diff --git a/Source/Core/Core/Src/FifoPlayer/FifoPlaybackAnalyzer.cpp b/Source/Core/Core/Src/FifoPlayer/FifoPlaybackAnalyzer.cpp index a8ba627019..3806570302 100644 --- a/Source/Core/Core/Src/FifoPlayer/FifoPlaybackAnalyzer.cpp +++ b/Source/Core/Core/Src/FifoPlayer/FifoPlaybackAnalyzer.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #include "FifoAnalyzer.h" @@ -57,7 +57,7 @@ void FifoPlaybackAnalyzer::AnalyzeFrames(FifoDataFile *file, std::vectorGetFrameCount()); @@ -82,7 +82,7 @@ void FifoPlaybackAnalyzer::AnalyzeFrames(FifoDataFile *file, std::vector 0) { @@ -172,50 +172,50 @@ u32 FifoPlaybackAnalyzer::DecodeCommand(u8 *data) int cmd = ReadFifo8(data); - switch(cmd) - { - case GX_NOP: + switch(cmd) + { + case GX_NOP: case 0x44: case GX_CMD_INVL_VC: - break; + break; - case GX_LOAD_CP_REG: - { - m_DrawingObject = false; + case GX_LOAD_CP_REG: + { + m_DrawingObject = false; u32 cmd2 = ReadFifo8(data); u32 value = ReadFifo32(data); - FifoAnalyzer::LoadCPReg(cmd2, value, m_CpMem); - } - break; + FifoAnalyzer::LoadCPReg(cmd2, value, m_CpMem); + } + break; - case GX_LOAD_XF_REG: - { - m_DrawingObject = false; + case GX_LOAD_XF_REG: + { + m_DrawingObject = false; u32 cmd2 = ReadFifo32(data); - u8 streamSize = ((cmd2 >> 16) & 15) + 1; + u8 streamSize = ((cmd2 >> 16) & 15) + 1; - data += streamSize * 4; - } - break; + data += streamSize * 4; + } + break; - case GX_LOAD_INDX_A: - case GX_LOAD_INDX_B: - case GX_LOAD_INDX_C: - case GX_LOAD_INDX_D: + case GX_LOAD_INDX_A: + case GX_LOAD_INDX_B: + case GX_LOAD_INDX_C: + case GX_LOAD_INDX_D: m_DrawingObject = false; - data += 4; - break; + data += 4; + break; - case GX_CMD_CALL_DL: + case GX_CMD_CALL_DL: // The recorder should have expanded display lists into the fifo stream and skipped the call to start them // That is done to make it easier to track where memory is updated _assert_(false); data += 8; - break; + break; - case GX_LOAD_BP_REG: + case GX_LOAD_BP_REG: { m_DrawingObject = false; @@ -227,11 +227,11 @@ u32 FifoPlaybackAnalyzer::DecodeCommand(u8 *data) if (bp.address == BPMEM_TRIGGER_EFB_COPY) StoreEfbCopyRegion(); } - break; + break; - default: - if (cmd & 0x80) - { + default: + if (cmd & 0x80) + { m_DrawingObject = true; u32 vtxAttrGroup = cmd & GX_VAT_MASK; @@ -239,15 +239,15 @@ u32 FifoPlaybackAnalyzer::DecodeCommand(u8 *data) u16 streamSize = ReadFifo16(data); - data += streamSize * vertexSize; - } - else - { - PanicAlert("FifoPlayer: Unknown Opcode (0x%x).\nAborting frame analysis.\n", cmd); - return 0; - } - break; - } + data += streamSize * vertexSize; + } + else + { + PanicAlert("FifoPlayer: Unknown Opcode (0x%x).\nAborting frame analysis.\n", cmd); + return 0; + } + break; + } return data - dataStart; } @@ -326,8 +326,8 @@ void FifoPlaybackAnalyzer::StoreWrittenRegion(u32 address, u32 size) used.end = std::max(used.end, range.end); // Remove this entry - iter = m_WrittenMemory.erase(iter); - } + iter = m_WrittenMemory.erase(iter); + } } else { diff --git a/Source/Core/Core/Src/FifoPlayer/FifoPlaybackAnalyzer.h b/Source/Core/Core/Src/FifoPlayer/FifoPlaybackAnalyzer.h index 7e345dd7f7..17e5505f33 100644 --- a/Source/Core/Core/Src/FifoPlayer/FifoPlaybackAnalyzer.h +++ b/Source/Core/Core/Src/FifoPlayer/FifoPlaybackAnalyzer.h @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #ifndef _FIFOPLAYBACKANALYZER_H_ @@ -43,7 +43,7 @@ private: { u32 begin; u32 end; - }; + }; void AddMemoryUpdate(MemoryUpdate memUpdate, AnalyzedFrameInfo &frameInfo); @@ -58,7 +58,7 @@ private: std::vector m_WrittenMemory; BPMemory m_BpMem; - FifoAnalyzer::CPMemory m_CpMem; + FifoAnalyzer::CPMemory m_CpMem; }; #endif diff --git a/Source/Core/Core/Src/FifoPlayer/FifoPlayer.cpp b/Source/Core/Core/Src/FifoPlayer/FifoPlayer.cpp index ff90736fec..7bf36333df 100644 --- a/Source/Core/Core/Src/FifoPlayer/FifoPlayer.cpp +++ b/Source/Core/Core/Src/FifoPlayer/FifoPlayer.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #include "FifoDataFile.h" @@ -194,7 +194,7 @@ void FifoPlayer::WriteFrame(const FifoFrameInfo &frame, const AnalyzedFrameInfo WriteFramePart(position, info.objectStarts[objectNum], memoryUpdate, frame, info); position = info.objectEnds[objectNum]; - ++objectNum; + ++objectNum; } // Write objects in draw range @@ -290,7 +290,7 @@ void FifoPlayer::WriteFifo(u8 *data, u32 start, u32 end) u32 burstEnd = std::min(written + 255, lastBurstEnd); while (written < burstEnd) - GPFifo::FastWrite8(data[written++]); + GPFifo::FastWrite8(data[written++]); GPFifo::Write8(data[written++], 0); diff --git a/Source/Core/Core/Src/FifoPlayer/FifoPlayer.h b/Source/Core/Core/Src/FifoPlayer/FifoPlayer.h index 9db6c0d980..b47e7361f1 100644 --- a/Source/Core/Core/Src/FifoPlayer/FifoPlayer.h +++ b/Source/Core/Core/Src/FifoPlayer/FifoPlayer.h @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #ifndef _FIFOPLAYER_H_ diff --git a/Source/Core/Core/Src/FifoPlayer/FifoRecordAnalyzer.cpp b/Source/Core/Core/Src/FifoPlayer/FifoRecordAnalyzer.cpp index dd94295859..666ec4ef55 100644 --- a/Source/Core/Core/Src/FifoPlayer/FifoRecordAnalyzer.cpp +++ b/Source/Core/Core/Src/FifoPlayer/FifoRecordAnalyzer.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #include "FifoAnalyzer.h" @@ -63,7 +63,7 @@ void FifoRecordAnalyzer::DecodeOpcode(u8 *data) case GX_NOP: case 0x44: case GX_CMD_INVL_VC: - break; + break; case GX_LOAD_CP_REG: { @@ -84,28 +84,28 @@ void FifoRecordAnalyzer::DecodeOpcode(u8 *data) m_DrawingObject = false; ProcessLoadIndexedXf(ReadFifo32(data), 0xc); break; - case GX_LOAD_INDX_B: + case GX_LOAD_INDX_B: m_DrawingObject = false; ProcessLoadIndexedXf(ReadFifo32(data), 0xd); break; - case GX_LOAD_INDX_C: + case GX_LOAD_INDX_C: m_DrawingObject = false; ProcessLoadIndexedXf(ReadFifo32(data), 0xe); break; - case GX_LOAD_INDX_D: + case GX_LOAD_INDX_D: m_DrawingObject = false; ProcessLoadIndexedXf(ReadFifo32(data), 0xf); - break; + break; - case GX_CMD_CALL_DL: + case GX_CMD_CALL_DL: { // The recorder should have expanded display lists into the fifo stream and skipped the call to start them // That is done to make it easier to track where memory is updated _assert_(false); } - break; + break; - case GX_LOAD_BP_REG: + case GX_LOAD_BP_REG: { m_DrawingObject = false; @@ -117,10 +117,10 @@ void FifoRecordAnalyzer::DecodeOpcode(u8 *data) if (bp.address == BPMEM_PRELOAD_MODE) ProcessPreloadTexture(); } - break; + break; - default: - if (cmd & 0x80) + default: + if (cmd & 0x80) { if (!m_DrawingObject) { @@ -131,9 +131,9 @@ void FifoRecordAnalyzer::DecodeOpcode(u8 *data) ProcessVertexArrays(data, cmd & GX_VAT_MASK); } else - { - PanicAlert("FifoRecordAnalyzer: Unknown Opcode (0x%x).\n", cmd); - } + { + PanicAlert("FifoRecordAnalyzer: Unknown Opcode (0x%x).\n", cmd); + } } } @@ -160,7 +160,7 @@ void FifoRecordAnalyzer::ProcessPreloadTexture() void FifoRecordAnalyzer::ProcessLoadIndexedXf(u32 val, int array) { int index = val >> 16; - int size = ((val >> 12) & 0xF) + 1; + int size = ((val >> 12) & 0xF) + 1; u32 address = m_CpMem.arrayBases[array] + m_CpMem.arrayStrides[array] * index; @@ -216,7 +216,7 @@ void FifoRecordAnalyzer::WriteVertexArray(int arrayIndex, u8 *vertexData, int ve if (index > maxIndex) maxIndex = index; } - } + } } else { @@ -257,8 +257,8 @@ void FifoRecordAnalyzer::ProcessTexMaps() { int stageNum2 = i >> 1; int stageOdd = i & 1; - TwoTevStageOrders &order = m_BpMem->tevorders[stageNum2]; - int texMap = order.getTexMap(stageOdd); + TwoTevStageOrders &order = m_BpMem->tevorders[stageNum2]; + int texMap = order.getTexMap(stageOdd); if (order.getEnable(stageOdd)) WriteTexMapMemory(texMap, writtenTexMaps); @@ -301,7 +301,7 @@ void FifoRecordAnalyzer::WriteTexMapMemory(int texMap, u32 &writtenTexMaps) while (mip) { width >>= 1; - height >>= 1; + height >>= 1; width = max(width, fmtWidth); height = max(height, fmtHeight); diff --git a/Source/Core/Core/Src/FifoPlayer/FifoRecordAnalyzer.h b/Source/Core/Core/Src/FifoPlayer/FifoRecordAnalyzer.h index 8ef3360ce7..84f746cebc 100644 --- a/Source/Core/Core/Src/FifoPlayer/FifoRecordAnalyzer.h +++ b/Source/Core/Core/Src/FifoPlayer/FifoRecordAnalyzer.h @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #ifndef _FIFORECORDANALYZER_H_ diff --git a/Source/Core/Core/Src/FifoPlayer/FifoRecorder.cpp b/Source/Core/Core/Src/FifoPlayer/FifoRecorder.cpp index b369823c3d..0900fddc54 100644 --- a/Source/Core/Core/Src/FifoPlayer/FifoRecorder.cpp +++ b/Source/Core/Core/Src/FifoPlayer/FifoRecorder.cpp @@ -9,7 +9,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #include "ConfigManager.h" @@ -182,11 +182,11 @@ void FifoRecorder::EndFrame(u32 fifoStart, u32 fifoEnd) m_FifoData.reserve(1024 * 1024 * 4); m_FifoData.clear(); - } + } if (m_RequestedRecordingEnd) { - // Skip data after the next time WriteFifoData is called + // Skip data after the next time WriteFifoData is called m_SkipFutureData = true; // Signal video backend that it should not call this function when the next frame ends m_IsRecording = false; diff --git a/Source/Core/Core/Src/FifoPlayer/FifoRecorder.h b/Source/Core/Core/Src/FifoPlayer/FifoRecorder.h index a07ba1fd15..c11b5a31bf 100644 --- a/Source/Core/Core/Src/FifoPlayer/FifoRecorder.h +++ b/Source/Core/Core/Src/FifoPlayer/FifoRecorder.h @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #ifndef _FIFORECORDER_H_ diff --git a/Source/Core/Core/Src/GeckoCode.cpp b/Source/Core/Core/Src/GeckoCode.cpp index a42f6629ad..38b5cc1a93 100644 --- a/Source/Core/Core/Src/GeckoCode.cpp +++ b/Source/Core/Core/Src/GeckoCode.cpp @@ -28,14 +28,14 @@ namespace Gecko enum { // Code Types - CODETYPE_WRITE_FILL = 0x0, - CODETYPE_IF = 0x1, - CODETYPE_BA_PO_OPS = 0x2, - CODETYPE_FLOW_CONTROL = 0x3, - CODETYPE_REGISTER_OPS = 0x4, - CODETYPE_SPECIAL_IF = 0x5, + CODETYPE_WRITE_FILL = 0x0, + CODETYPE_IF = 0x1, + CODETYPE_BA_PO_OPS = 0x2, + CODETYPE_FLOW_CONTROL = 0x3, + CODETYPE_REGISTER_OPS = 0x4, + CODETYPE_SPECIAL_IF = 0x5, CODETYPE_ASM_SWITCH_RANGE = 0x6, - CODETYPE_END_CODES = 0x7, + CODETYPE_END_CODES = 0x7, // Data Types DATATYPE_8BIT = 0x0, @@ -104,12 +104,14 @@ void SetActiveCodes(const std::vector& gcodes) gcodes_iter = gcodes.begin(), gcodes_end = gcodes.end(); for (; gcodes_iter!=gcodes_end; ++gcodes_iter) + { if (gcodes_iter->enabled) { // TODO: apply modifiers // TODO: don't need description or creator string, just takin up memory active_codes.push_back(*gcodes_iter); } + } inserted_asm_codes.clear(); @@ -289,7 +291,8 @@ void RunCodeHandler() } } -const std::map >& GetInsertedAsmCodes() { +const std::map >& GetInsertedAsmCodes() +{ return inserted_asm_codes; } @@ -365,7 +368,7 @@ bool RamWriteAndFill() const u8 data_type = current_code->address >> 28; const u32 data_inc = current_code->data; // amount to increment the data const u16 addr_inc = (u16)current_code->address; // amount to increment the address - count = ((current_code->address >> 16) & 0xFFF) + 1; // count is different from the other subtypes, note: +1 + count = ((current_code->address >> 16) & 0xFFF) + 1; // count is different from the other subtypes, note: +1 while (count--) { // switch inside the loop, :/ o well @@ -470,7 +473,7 @@ bool RegularIf() // CST7 : 16bits (endif, then) If lower case 0x3 : result = (read_value < data_value); - break; + break; } } @@ -591,7 +594,9 @@ bool FlowControl() current_code = target_code - 1; } else + { return false; // trying to GOTO to bad address + } } break; @@ -608,7 +613,9 @@ bool FlowControl() current_code = target_code - 1; } else + { return false; // trying to GOSUB to bad address + } } break; diff --git a/Source/Core/Core/Src/HLE/HLE.cpp b/Source/Core/Core/Src/HLE/HLE.cpp index ae25060c64..f4fd0fcfa1 100644 --- a/Source/Core/Core/Src/HLE/HLE.cpp +++ b/Source/Core/Core/Src/HLE/HLE.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #include "Common.h" diff --git a/Source/Core/Core/Src/HLE/HLE.h b/Source/Core/Core/Src/HLE/HLE.h index 9318d34197..a060a6ff71 100644 --- a/Source/Core/Core/Src/HLE/HLE.h +++ b/Source/Core/Core/Src/HLE/HLE.h @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #ifndef _HLE_H @@ -25,18 +25,18 @@ namespace HLE { enum { - HLE_HOOK_START = 0, // Hook the beginning of the function and execute the function afterwards - HLE_HOOK_END = 1, // Hook the end of the function, executing the function first before the hook - HLE_HOOK_REPLACE = 2, // Replace the function with the HLE version - HLE_HOOK_NONE = 3, // Do not hook the function + HLE_HOOK_START = 0, // Hook the beginning of the function and execute the function afterwards + HLE_HOOK_END = 1, // Hook the end of the function, executing the function first before the hook + HLE_HOOK_REPLACE = 2, // Replace the function with the HLE version + HLE_HOOK_NONE = 3, // Do not hook the function }; enum { - HLE_TYPE_GENERIC = 0, // Miscellaneous function - HLE_TYPE_MEMORY = 1, // Memory operation - HLE_TYPE_FP = 2, // Floating Point operation - HLE_TYPE_DEBUG = 3, // Debug output function + HLE_TYPE_GENERIC = 0, // Miscellaneous function + HLE_TYPE_MEMORY = 1, // Memory operation + HLE_TYPE_FP = 2, // Floating Point operation + HLE_TYPE_DEBUG = 3, // Debug output function }; void PatchFunctions(); diff --git a/Source/Core/Core/Src/HLE/HLE_Misc.cpp b/Source/Core/Core/Src/HLE/HLE_Misc.cpp index 7e23798df1..129d3fa517 100644 --- a/Source/Core/Core/Src/HLE/HLE_Misc.cpp +++ b/Source/Core/Core/Src/HLE/HLE_Misc.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #include @@ -59,33 +59,33 @@ inline void FW(u32 addr, float x) // According to the PPC ABI, the return value is always in r3. void UnimplementedFunction() { - NPC = LR; + NPC = LR; } void UnimplementedFunctionTrue() { - GPR(3) = 1; - NPC = LR; + GPR(3) = 1; + NPC = LR; } void UnimplementedFunctionFalse() { - GPR(3) = 0; - NPC = LR; + GPR(3) = 0; + NPC = LR; } void GXPeekZ() { // Just some fake Z value. - Memory::Write_U32(0xFFFFFF, GPR(5)); - NPC = LR; + Memory::Write_U32(0xFFFFFF, GPR(5)); + NPC = LR; } void GXPeekARGB() { // Just some fake color value. - Memory::Write_U32(0xFFFFFFFF, GPR(5)); - NPC = LR; + Memory::Write_U32(0xFFFFFFFF, GPR(5)); + NPC = LR; } // If you want a function to panic, you can rename it PanicAlert :p @@ -116,7 +116,7 @@ void SMB_EvilVecCosine() float dot = x1*x2 + y1*y2 + z1*z2; rPS0(1) = dot / sqrtf(s1 * s2); - NPC = LR; + NPC = LR; } // Normalizes the vector pointed at by r3. @@ -130,7 +130,7 @@ void SMB_EvilNormalize() float inv_len; if (len <= 0) inv_len = 0; - else + else inv_len = 1.0f / sqrtf(len); x *= inv_len; y *= inv_len; diff --git a/Source/Core/Core/Src/HLE/HLE_Misc.h b/Source/Core/Core/Src/HLE/HLE_Misc.h index d0d098835f..bc70038405 100644 --- a/Source/Core/Core/Src/HLE/HLE_Misc.h +++ b/Source/Core/Core/Src/HLE/HLE_Misc.h @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #ifndef HLE_MISC_H @@ -20,19 +20,19 @@ namespace HLE_Misc { - void Pass(); - void HLEPanicAlert(); - void UnimplementedFunction(); - void UnimplementedFunctionTrue(); - void UnimplementedFunctionFalse(); - void GXPeekZ(); - void GXPeekARGB(); - void SMB_EvilVecCosine(); - void SMB_EvilNormalize(); - void SMB_sqrt_internal(); - void SMB_rsqrt_internal(); - void SMB_atan2(); - void SMB_evil_vec_setlength(); + void Pass(); + void HLEPanicAlert(); + void UnimplementedFunction(); + void UnimplementedFunctionTrue(); + void UnimplementedFunctionFalse(); + void GXPeekZ(); + void GXPeekARGB(); + void SMB_EvilVecCosine(); + void SMB_EvilNormalize(); + void SMB_sqrt_internal(); + void SMB_rsqrt_internal(); + void SMB_atan2(); + void SMB_evil_vec_setlength(); void FZero_kill_infinites(); void FZero_evil_vec_normalize(); void FZ_sqrt(); diff --git a/Source/Core/Core/Src/HLE/HLE_OS.cpp b/Source/Core/Core/Src/HLE/HLE_OS.cpp index 3ced001268..b8de59ff81 100644 --- a/Source/Core/Core/Src/HLE/HLE_OS.cpp +++ b/Source/Core/Core/Src/HLE/HLE_OS.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #include "StringUtil.h" diff --git a/Source/Core/Core/Src/HLE/HLE_OS.h b/Source/Core/Core/Src/HLE/HLE_OS.h index 01ed59a667..acab4253cb 100644 --- a/Source/Core/Core/Src/HLE/HLE_OS.h +++ b/Source/Core/Core/Src/HLE/HLE_OS.h @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #ifndef HLE_OS_H @@ -22,9 +22,9 @@ namespace HLE_OS { - void HLE_GeneralDebugPrint(); + void HLE_GeneralDebugPrint(); void HLE_write_console(); - void HLE_OSPanic(); + void HLE_OSPanic(); } #endif diff --git a/Source/Core/Core/Src/HW/AudioInterface.cpp b/Source/Core/Core/Src/HW/AudioInterface.cpp index 0c121a1403..e9ef2eed03 100644 --- a/Source/Core/Core/Src/HW/AudioInterface.cpp +++ b/Source/Core/Core/Src/HW/AudioInterface.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ /* @@ -97,7 +97,7 @@ union AICR u32 AIINTVLD : 1; // This bit controls whether AIINT is affected by the Interrupt Timing register // matching the sample counter. Once set, AIINT will hold its last value u32 SCRESET : 1; // write to reset counter - u32 AIDFR : 1; // AID Frequency (0=48khz 1=32khz) + u32 AIDFR : 1; // AID Frequency (0=48khz 1=32khz) u32 :25; }; u32 hex; @@ -183,7 +183,7 @@ void Read32(u32& _rReturnValue, const u32 _Address) case AI_SAMPLE_COUNTER: Update(0, 0); - _rReturnValue = m_SampleCounter; + _rReturnValue = m_SampleCounter; break; case AI_INTERRUPT_TIMING: @@ -191,7 +191,7 @@ void Read32(u32& _rReturnValue, const u32 _Address) break; default: - ERROR_LOG(AUDIO_INTERFACE, "Unknown read 0x%08x", _Address); + ERROR_LOG(AUDIO_INTERFACE, "Unknown read 0x%08x", _Address); _dbg_assert_msg_(AUDIO_INTERFACE, 0, "AudioInterface - Read from 0x%08x", _Address); _rReturnValue = 0; return; @@ -210,18 +210,18 @@ void Write32(const u32 _Value, const u32 _Address) m_Control.AIINTMSK = tmpAICtrl.AIINTMSK; m_Control.AIINTVLD = tmpAICtrl.AIINTVLD; - // Set frequency of streaming audio - if (tmpAICtrl.AISFR != m_Control.AISFR) - { - DEBUG_LOG(AUDIO_INTERFACE, "Change AISFR to %s", tmpAICtrl.AISFR ? "48khz":"32khz"); - m_Control.AISFR = tmpAICtrl.AISFR; - } + // Set frequency of streaming audio + if (tmpAICtrl.AISFR != m_Control.AISFR) + { + DEBUG_LOG(AUDIO_INTERFACE, "Change AISFR to %s", tmpAICtrl.AISFR ? "48khz":"32khz"); + m_Control.AISFR = tmpAICtrl.AISFR; + } // Set frequency of DMA - if (tmpAICtrl.AIDFR != m_Control.AIDFR) - { - DEBUG_LOG(AUDIO_INTERFACE, "Change AIDFR to %s", tmpAICtrl.AIDFR ? "32khz":"48khz"); - m_Control.AIDFR = tmpAICtrl.AIDFR; - } + if (tmpAICtrl.AIDFR != m_Control.AIDFR) + { + DEBUG_LOG(AUDIO_INTERFACE, "Change AIDFR to %s", tmpAICtrl.AIDFR ? "32khz":"48khz"); + m_Control.AIDFR = tmpAICtrl.AIDFR; + } g_AISSampleRate = tmpAICtrl.AISFR ? 48000 : 32000; g_AIDSampleRate = tmpAICtrl.AIDFR ? 32000 : 48000; @@ -229,36 +229,36 @@ void Write32(const u32 _Value, const u32 _Address) g_CPUCyclesPerSample = SystemTimers::GetTicksPerSecond() / g_AISSampleRate; // Streaming counter - if (tmpAICtrl.PSTAT != m_Control.PSTAT) - { - DEBUG_LOG(AUDIO_INTERFACE, "%s streaming audio", tmpAICtrl.PSTAT ? "start":"stop"); - m_Control.PSTAT = tmpAICtrl.PSTAT; - g_LastCPUTime = CoreTiming::GetTicks(); + if (tmpAICtrl.PSTAT != m_Control.PSTAT) + { + DEBUG_LOG(AUDIO_INTERFACE, "%s streaming audio", tmpAICtrl.PSTAT ? "start":"stop"); + m_Control.PSTAT = tmpAICtrl.PSTAT; + g_LastCPUTime = CoreTiming::GetTicks(); // Tell Drive Interface to start/stop streaming DVDInterface::g_bStream = tmpAICtrl.PSTAT; CoreTiming::RemoveEvent(et_AI); CoreTiming::ScheduleEvent(((int)GetAIPeriod() / 2), et_AI); - } + } - // AI Interrupt + // AI Interrupt if (tmpAICtrl.AIINT) - { - DEBUG_LOG(AUDIO_INTERFACE, "Clear AIS Interrupt"); - m_Control.AIINT = 0; - } + { + DEBUG_LOG(AUDIO_INTERFACE, "Clear AIS Interrupt"); + m_Control.AIINT = 0; + } - // Sample Count Reset - if (tmpAICtrl.SCRESET) - { - DEBUG_LOG(AUDIO_INTERFACE, "Reset AIS sample counter"); - m_SampleCounter = 0; + // Sample Count Reset + if (tmpAICtrl.SCRESET) + { + DEBUG_LOG(AUDIO_INTERFACE, "Reset AIS sample counter"); + m_SampleCounter = 0; - g_LastCPUTime = CoreTiming::GetTicks(); - } + g_LastCPUTime = CoreTiming::GetTicks(); + } - UpdateInterrupts(); + UpdateInterrupts(); } break; @@ -273,7 +273,7 @@ void Write32(const u32 _Value, const u32 _Address) m_SampleCounter = _Value; break; - case AI_INTERRUPT_TIMING: + case AI_INTERRUPT_TIMING: m_InterruptTiming = _Value; CoreTiming::RemoveEvent(et_AI); CoreTiming::ScheduleEvent(((int)GetAIPeriod() / 2), et_AI); @@ -390,12 +390,12 @@ unsigned int Callback_GetStreaming(short* _pDestBuffer, unsigned int _numSamples else //1:1 no resampling { pcm_l = (((int)pcm[pos*2] * lvolume) >> 8) + (int)(*_pDestBuffer); - if (pcm_l > 32767) pcm_l = 32767; + if (pcm_l > 32767) pcm_l = 32767; else if (pcm_l < -32767) pcm_l = -32767; *_pDestBuffer++ = pcm_l; pcm_r = (((int)pcm[pos*2+1] * rvolume) >> 8) + (int)(*_pDestBuffer); - if (pcm_r > 32767) pcm_r = 32767; + if (pcm_r > 32767) pcm_r = 32767; else if (pcm_r < -32767) pcm_r = -32767; *_pDestBuffer++ = pcm_r; @@ -456,17 +456,17 @@ unsigned int GetAIDSampleRate() void Update(u64 userdata, int cyclesLate) { - if (m_Control.PSTAT) - { - const u64 Diff = CoreTiming::GetTicks() - g_LastCPUTime; - if (Diff > g_CPUCyclesPerSample) - { - const u32 Samples = static_cast(Diff / g_CPUCyclesPerSample); - g_LastCPUTime += Samples * g_CPUCyclesPerSample; + if (m_Control.PSTAT) + { + const u64 Diff = CoreTiming::GetTicks() - g_LastCPUTime; + if (Diff > g_CPUCyclesPerSample) + { + const u32 Samples = static_cast(Diff / g_CPUCyclesPerSample); + g_LastCPUTime += Samples * g_CPUCyclesPerSample; IncreaseSampleCount(Samples); - } + } CoreTiming::ScheduleEvent(((int)GetAIPeriod() / 2) - cyclesLate, et_AI); - } + } } u64 GetAIPeriod() diff --git a/Source/Core/Core/Src/HW/AudioInterface.h b/Source/Core/Core/Src/HW/AudioInterface.h index 06fd3aec79..c35688ee3c 100644 --- a/Source/Core/Core/Src/HW/AudioInterface.h +++ b/Source/Core/Core/Src/HW/AudioInterface.h @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ // See CPP file for comments. @@ -28,7 +28,7 @@ namespace AudioInterface { void Init(); -void Shutdown(); +void Shutdown(); void DoState(PointerWrap &p); void Update(u64 userdata, int cyclesLate); diff --git a/Source/Core/Core/Src/HW/BBA-TAP/TAP_Win32.cpp b/Source/Core/Core/Src/HW/BBA-TAP/TAP_Win32.cpp index 03332d3012..e1973ce454 100644 --- a/Source/Core/Core/Src/HW/BBA-TAP/TAP_Win32.cpp +++ b/Source/Core/Core/Src/HW/BBA-TAP/TAP_Win32.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #include "StringUtil.h" diff --git a/Source/Core/Core/Src/HW/CPU.cpp b/Source/Core/Core/Src/HW/CPU.cpp index 610042c66d..1b9ef666cf 100644 --- a/Source/Core/Core/Src/HW/CPU.cpp +++ b/Source/Core/Core/Src/HW/CPU.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #include "Common.h" @@ -78,7 +78,8 @@ reswitch: PowerPC::SingleStep(); //4: update disasm dialog - if (m_SyncEvent) { + if (m_SyncEvent) + { m_SyncEvent->Set(); m_SyncEvent = 0; } @@ -106,7 +107,7 @@ bool CCPU::IsStepping() void CCPU::Reset() { -} +} void CCPU::StepOpcode(Common::Event *event) { @@ -157,6 +158,7 @@ bool CCPU::PauseAndLock(bool doLock, bool unpauseOnUnlock) PowerPC::Start(); m_StepEvent.Set(); } + if (!Core::IsCPUThread()) m_csCpuOccupied.unlock(); } diff --git a/Source/Core/Core/Src/HW/CPU.h b/Source/Core/Core/Src/HW/CPU.h index 188ef2ff0f..39d9baa59a 100644 --- a/Source/Core/Core/Src/HW/CPU.h +++ b/Source/Core/Core/Src/HW/CPU.h @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #ifndef _CPU_H #define _CPU_H diff --git a/Source/Core/Core/Src/HW/DSP.cpp b/Source/Core/Core/Src/HW/DSP.cpp index 72d1eaa63c..cf754f643a 100644 --- a/Source/Core/Core/Src/HW/DSP.cpp +++ b/Source/Core/Core/Src/HW/DSP.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ // AID / AUDIO_DMA controls pushing audio out to the SRC and then the speakers. @@ -59,7 +59,7 @@ enum DSP_MAIL_FROM_DSP_HI = 0x5004, DSP_MAIL_FROM_DSP_LO = 0x5006, DSP_CONTROL = 0x500A, - DSP_INTERRUPT_CONTROL = 0x5010, + DSP_INTERRUPT_CONTROL = 0x5010, AR_INFO = 0x5012, // These names are a good guess at best AR_MODE = 0x5016, // AR_REFRESH = 0x501a, @@ -128,15 +128,15 @@ struct DSPState // Blocks are 32 bytes. union UAudioDMAControl { - u16 Hex; - struct - { - u16 NumBlocks : 15; + u16 Hex; + struct + { + u16 NumBlocks : 15; u16 Enable : 1; - }; + }; - UAudioDMAControl(u16 _Hex = 0) : Hex(_Hex) - {} + UAudioDMAControl(u16 _Hex = 0) : Hex(_Hex) + {} }; // AudioDMA @@ -160,7 +160,7 @@ struct AudioDMA struct ARAM_DMA { u32 MMAddr; - u32 ARAddr; + u32 ARAddr; UARAMCount Cnt; ARAM_DMA() @@ -180,7 +180,8 @@ struct ARAMInfo u8* ptr; // aka audio ram, auxiliary ram, MEM2, EXRAM, etc... // Default to GC mode - ARAMInfo() { + ARAMInfo() + { wii_mode = false; size = ARAM_SIZE; mask = ARAM_MASK; @@ -278,8 +279,8 @@ void Init(bool hle) memset(&g_arDMA, 0, sizeof(g_arDMA)); g_dspState.DSPControl.Hex = 0; - g_dspState.DSPControl.DSPHalt = 1; - + g_dspState.DSPControl.DSPHalt = 1; + g_ARAM_Info.Hex = 0; g_AR_MODE = 1; // ARAM Controller has init'd g_AR_REFRESH = 156; // 156MHz @@ -424,7 +425,7 @@ void Write16(const u16 _Value, const u32 _Address) g_dspState.DSPControl.DSPReset = tmpControl.DSPReset; g_dspState.DSPControl.DSPAssertInt = tmpControl.DSPAssertInt; g_dspState.DSPControl.DSPHalt = tmpControl.DSPHalt; - g_dspState.DSPControl.DSPInit = tmpControl.DSPInit; + g_dspState.DSPControl.DSPInit = tmpControl.DSPInit; // Interrupt (mask) g_dspState.DSPControl.AID_mask = tmpControl.AID_mask; @@ -438,14 +439,14 @@ void Write16(const u16 _Value, const u32 _Address) // unknown g_dspState.DSPControl.unk3 = tmpControl.unk3; - g_dspState.DSPControl.pad = tmpControl.pad; + g_dspState.DSPControl.pad = tmpControl.pad; if (g_dspState.DSPControl.pad != 0) { PanicAlert("DSPInterface (w) g_dspState.DSPControl (CC00500A) gets a value with junk in the padding %08x", _Value); } UpdateInterrupts(); - } + } break; // ARAM @@ -635,7 +636,7 @@ void GenerateDSPInterrupt(DSPInterruptType type, bool _bSet) switch (type) { case INT_DSP: g_dspState.DSPControl.DSP = _bSet ? 1 : 0; break; - case INT_ARAM: g_dspState.DSPControl.ARAM = _bSet ? 1 : 0; if (_bSet) g_dspState.DSPControl.DMAState = 0; break; + case INT_ARAM: g_dspState.DSPControl.ARAM = _bSet ? 1 : 0; if (_bSet) g_dspState.DSPControl.DMAState = 0; break; case INT_AID: g_dspState.DSPControl.AID = _bSet ? 1 : 0; break; } @@ -651,14 +652,18 @@ void GenerateDSPInterruptFromDSPEmu(DSPInterruptType type, bool _bSet) } // called whenever SystemTimers thinks the dsp deserves a few more cycles -void UpdateDSPSlice(int cycles) { - if (dsp_is_lle) { +void UpdateDSPSlice(int cycles) +{ + if (dsp_is_lle) + { //use up the rest of the slice(if any) dsp_emulator->DSP_Update(dsp_slice); dsp_slice %= 6; //note the new budget dsp_slice += cycles; - } else { + } + else + { dsp_emulator->DSP_Update(cycles); } } @@ -727,7 +732,10 @@ void Do_ARAM_DMA() Memory::Write_U64_Swap(*(u64*)&g_ARAM.ptr[g_arDMA.ARAddr & g_ARAM.mask], g_arDMA.MMAddr); } else + { Memory::Write_U64_Swap(*(u64*)&g_ARAM.ptr[g_arDMA.ARAddr & g_ARAM.mask], g_arDMA.MMAddr); + } + g_arDMA.MMAddr += 8; g_arDMA.ARAddr += 8; g_arDMA.Cnt.count -= 8; @@ -772,7 +780,9 @@ void Do_ARAM_DMA() *(u64*)&g_ARAM.ptr[g_arDMA.ARAddr & g_ARAM.mask] = Common::swap64(Memory::Read_U64(g_arDMA.MMAddr)); } else + { *(u64*)&g_ARAM.ptr[g_arDMA.ARAddr & g_ARAM.mask] = Common::swap64(Memory::Read_U64(g_arDMA.MMAddr)); + } g_arDMA.MMAddr += 8; g_arDMA.ARAddr += 8; @@ -803,7 +813,9 @@ u8 ReadARAM(u32 _iAddress) return Memory::Read_U8(_iAddress & Memory::RAM_MASK); } else + { return g_ARAM.ptr[_iAddress & g_ARAM.mask]; + } } void WriteARAM(u8 value, u32 _uAddress) diff --git a/Source/Core/Core/Src/HW/DSP.h b/Source/Core/Core/Src/HW/DSP.h index 63a8ab6a2d..7002c80dea 100644 --- a/Source/Core/Core/Src/HW/DSP.h +++ b/Source/Core/Core/Src/HW/DSP.h @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #ifndef _DSPINTERFACE_H diff --git a/Source/Core/Core/Src/HW/DSPHLE/DSPHLE.cpp b/Source/Core/Core/Src/HW/DSPHLE/DSPHLE.cpp index 7c4d2fd320..5456593750 100644 --- a/Source/Core/Core/Src/HW/DSPHLE/DSPHLE.cpp +++ b/Source/Core/Core/Src/HW/DSPHLE/DSPHLE.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #include @@ -31,7 +31,8 @@ #include "HW/SystemTimers.h" #include "HW/VideoInterface.h" -DSPHLE::DSPHLE() { +DSPHLE::DSPHLE() +{ m_InitMixer = false; soundStream = NULL; } @@ -42,7 +43,8 @@ struct DSPState u32 CPUMailbox; u32 DSPMailbox; - void Reset() { + void Reset() + { CPUMailbox = 0x00000000; DSPMailbox = 0x00000000; } @@ -195,7 +197,9 @@ void DSPHLE::DoState(PointerWrap &p) if (ucode != m_pUCode) { if (p.GetMode() != PointerWrap::MODE_READ) + { delete ucode; + } else { delete m_pUCode; @@ -205,7 +209,9 @@ void DSPHLE::DoState(PointerWrap &p) if (lastucode != m_lastUCode) { if (p.GetMode() != PointerWrap::MODE_READ) + { delete lastucode; + } else { delete m_lastUCode; diff --git a/Source/Core/Core/Src/HW/DSPHLE/DSPHLE.h b/Source/Core/Core/Src/HW/DSPHLE/DSPHLE.h index 50d65d5d52..16a3c186a6 100644 --- a/Source/Core/Core/Src/HW/DSPHLE/DSPHLE.h +++ b/Source/Core/Core/Src/HW/DSPHLE/DSPHLE.h @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #ifndef _DSPHLE_H @@ -71,7 +71,8 @@ private: u32 CPUMailbox; u32 DSPMailbox; - void Reset() { + void Reset() + { CPUMailbox = 0x00000000; DSPMailbox = 0x00000000; } diff --git a/Source/Core/Core/Src/HW/DSPHLE/HLEMixer.cpp b/Source/Core/Core/Src/HW/DSPHLE/HLEMixer.cpp index 69c4b6aee6..23ad6f906b 100644 --- a/Source/Core/Core/Src/HW/DSPHLE/HLEMixer.cpp +++ b/Source/Core/Core/Src/HW/DSPHLE/HLEMixer.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #include "DSPHLE.h" diff --git a/Source/Core/Core/Src/HW/DSPHLE/MailHandler.cpp b/Source/Core/Core/Src/HW/DSPHLE/MailHandler.cpp index 248b7b0436..5ff70fe70c 100644 --- a/Source/Core/Core/Src/HW/DSPHLE/MailHandler.cpp +++ b/Source/Core/Core/Src/HW/DSPHLE/MailHandler.cpp @@ -12,13 +12,14 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #include "MailHandler.h" CMailHandler::CMailHandler() -{} +{ +} CMailHandler::~CMailHandler() { @@ -48,7 +49,7 @@ u16 CMailHandler::ReadDSPMailboxLow() if (!m_Mails.empty()) { u16 result = m_Mails.front() & 0xFFFF; - m_Mails.pop(); + m_Mails.pop(); return result; } return 0x00; diff --git a/Source/Core/Core/Src/HW/DSPHLE/MailHandler.h b/Source/Core/Core/Src/HW/DSPHLE/MailHandler.h index 6c025fe34e..bca9f74502 100644 --- a/Source/Core/Core/Src/HW/DSPHLE/MailHandler.h +++ b/Source/Core/Core/Src/HW/DSPHLE/MailHandler.h @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #ifndef _MAILHANDLER_H @@ -41,7 +41,9 @@ public: u32 GetNextMail() { if (m_Mails.size()) + { return m_Mails.front(); + } else { // WARN_LOG(DSPHLE, "GetNextMail: No mails"); diff --git a/Source/Core/Core/Src/HW/DSPHLE/UCodes/UCode_AX.cpp b/Source/Core/Core/Src/HW/DSPHLE/UCodes/UCode_AX.cpp index cbe558c878..68e2f407f3 100644 --- a/Source/Core/Core/Src/HW/DSPHLE/UCodes/UCode_AX.cpp +++ b/Source/Core/Core/Src/HW/DSPHLE/UCodes/UCode_AX.cpp @@ -401,7 +401,9 @@ void CUCode_AX::SetupProcessing(u32 init_addr) init_idx += 3; if (!init_val) + { memset(buffers[i], 0, 5 * 32 * sizeof (int)); + } else { for (u32 j = 0; j < 32 * 5; ++j) diff --git a/Source/Core/Core/Src/HW/DSPHLE/UCodes/UCode_AXStructs.h b/Source/Core/Core/Src/HW/DSPHLE/UCodes/UCode_AXStructs.h index 1161847bc8..00ce0c91b2 100644 --- a/Source/Core/Core/Src/HW/DSPHLE/UCodes/UCode_AXStructs.h +++ b/Source/Core/Core/Src/HW/DSPHLE/UCodes/UCode_AXStructs.h @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #ifndef _UCODE_AX_STRUCTS_H @@ -325,20 +325,23 @@ struct AXPBWii }; // TODO: All these enums have changed a lot for wii -enum { - AUDIOFORMAT_ADPCM = 0, - AUDIOFORMAT_PCM8 = 0x19, +enum +{ + AUDIOFORMAT_ADPCM = 0, + AUDIOFORMAT_PCM8 = 0x19, AUDIOFORMAT_PCM16 = 0xA, }; -enum { +enum +{ SRCTYPE_POLYPHASE = 0, SRCTYPE_LINEAR = 1, SRCTYPE_NEAREST = 2, }; // Both may be used at once -enum { +enum +{ FILTER_LOWPASS = 1, FILTER_BIQUAD = 2, }; diff --git a/Source/Core/Core/Src/HW/DSPHLE/UCodes/UCode_AXWii.cpp b/Source/Core/Core/Src/HW/DSPHLE/UCodes/UCode_AXWii.cpp index 0c3714ffea..ae587d9e64 100644 --- a/Source/Core/Core/Src/HW/DSPHLE/UCodes/UCode_AXWii.cpp +++ b/Source/Core/Core/Src/HW/DSPHLE/UCodes/UCode_AXWii.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #include "StringUtil.h" @@ -138,7 +138,7 @@ void CUCode_AXWii::HandleCommandList() addr2_hi = m_cmdlist[curr_idx++]; addr2_lo = m_cmdlist[curr_idx++]; OutputSamples(HILO_TO_32(addr2), HILO_TO_32(addr), 0x8000, - cmd == CMD_OUTPUT_DPL2_OLD); + cmd == CMD_OUTPUT_DPL2_OLD); break; case CMD_WM_OUTPUT_OLD: @@ -300,7 +300,9 @@ void CUCode_AXWii::SetupProcessing(u32 init_addr) init_idx += 3; if (!init_val) + { memset(buffers[i].ptr, 0, 3 * buffers[i].samples * sizeof (int)); + } else { for (u32 j = 0; j < 3 * buffers[i].samples; ++j) diff --git a/Source/Core/Core/Src/HW/DSPHLE/UCodes/UCode_CARD.cpp b/Source/Core/Core/Src/HW/DSPHLE/UCodes/UCode_CARD.cpp index 63316caa21..b45fde3322 100644 --- a/Source/Core/Core/Src/HW/DSPHLE/UCodes/UCode_CARD.cpp +++ b/Source/Core/Core/Src/HW/DSPHLE/UCodes/UCode_CARD.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #include "../DSPHLE.h" diff --git a/Source/Core/Core/Src/HW/DSPHLE/UCodes/UCode_CARD.h b/Source/Core/Core/Src/HW/DSPHLE/UCodes/UCode_CARD.h index 163dcc3fb0..f126f6478b 100644 --- a/Source/Core/Core/Src/HW/DSPHLE/UCodes/UCode_CARD.h +++ b/Source/Core/Core/Src/HW/DSPHLE/UCodes/UCode_CARD.h @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #ifndef _UCODE_CARD_H diff --git a/Source/Core/Core/Src/HW/DSPHLE/UCodes/UCode_GBA.cpp b/Source/Core/Core/Src/HW/DSPHLE/UCodes/UCode_GBA.cpp index 86d561d395..ffdb3ef7c4 100644 --- a/Source/Core/Core/Src/HW/DSPHLE/UCodes/UCode_GBA.cpp +++ b/Source/Core/Core/Src/HW/DSPHLE/UCodes/UCode_GBA.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #include "UCodes.h" @@ -64,7 +64,8 @@ void CUCode_GBA::HandleMail(u32 _uMail) nextmail_is_mramaddr = false; u32 mramaddr = _uMail; - struct sec_params_t { + struct sec_params_t + { u16 key[2]; u16 unk1[2]; u16 unk2[2]; diff --git a/Source/Core/Core/Src/HW/DSPHLE/UCodes/UCode_GBA.h b/Source/Core/Core/Src/HW/DSPHLE/UCodes/UCode_GBA.h index 8ab66a22ec..5ffad77367 100644 --- a/Source/Core/Core/Src/HW/DSPHLE/UCodes/UCode_GBA.h +++ b/Source/Core/Core/Src/HW/DSPHLE/UCodes/UCode_GBA.h @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #pragma once diff --git a/Source/Core/Core/Src/HW/DSPHLE/UCodes/UCode_InitAudioSystem.cpp b/Source/Core/Core/Src/HW/DSPHLE/UCodes/UCode_InitAudioSystem.cpp index a874bc173d..c1030bf3f9 100644 --- a/Source/Core/Core/Src/HW/DSPHLE/UCodes/UCode_InitAudioSystem.cpp +++ b/Source/Core/Core/Src/HW/DSPHLE/UCodes/UCode_InitAudioSystem.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #include "UCodes.h" @@ -27,11 +27,13 @@ CUCode_InitAudioSystem::CUCode_InitAudioSystem(DSPHLE *dsp_hle, u32 crc) CUCode_InitAudioSystem::~CUCode_InitAudioSystem() -{} +{ +} void CUCode_InitAudioSystem::Init() -{} +{ +} void CUCode_InitAudioSystem::Update(int cycles) @@ -49,6 +51,7 @@ u32 CUCode_InitAudioSystem::GetUpdateMs() } void CUCode_InitAudioSystem::HandleMail(u32 _uMail) -{} +{ +} diff --git a/Source/Core/Core/Src/HW/DSPHLE/UCodes/UCode_InitAudioSystem.h b/Source/Core/Core/Src/HW/DSPHLE/UCodes/UCode_InitAudioSystem.h index a698df4e4c..a36aab1d76 100644 --- a/Source/Core/Core/Src/HW/DSPHLE/UCodes/UCode_InitAudioSystem.h +++ b/Source/Core/Core/Src/HW/DSPHLE/UCodes/UCode_InitAudioSystem.h @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #ifndef _UCODE_INITAUDIOSYSTEM diff --git a/Source/Core/Core/Src/HW/DSPHLE/UCodes/UCode_ROM.cpp b/Source/Core/Core/Src/HW/DSPHLE/UCodes/UCode_ROM.cpp index f4ab0ac366..fe2812c28e 100644 --- a/Source/Core/Core/Src/HW/DSPHLE/UCodes/UCode_ROM.cpp +++ b/Source/Core/Core/Src/HW/DSPHLE/UCodes/UCode_ROM.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #include "UCodes.h" @@ -57,32 +57,32 @@ void CUCode_Rom::HandleMail(u32 _uMail) { switch (m_NextParameter) { - case 0x80F3A001: - m_CurrentUCode.m_RAMAddress = _uMail; - break; + case 0x80F3A001: + m_CurrentUCode.m_RAMAddress = _uMail; + break; - case 0x80F3A002: - m_CurrentUCode.m_Length = _uMail & 0xffff; - break; + case 0x80F3A002: + m_CurrentUCode.m_Length = _uMail & 0xffff; + break; - case 0x80F3C002: - m_CurrentUCode.m_IMEMAddress = _uMail & 0xffff; - break; + case 0x80F3C002: + m_CurrentUCode.m_IMEMAddress = _uMail & 0xffff; + break; - case 0x80F3B002: - m_CurrentUCode.m_DMEMLength = _uMail & 0xffff; + case 0x80F3B002: + m_CurrentUCode.m_DMEMLength = _uMail & 0xffff; if (m_CurrentUCode.m_DMEMLength) { NOTICE_LOG(DSPHLE,"m_CurrentUCode.m_DMEMLength = 0x%04x.", m_CurrentUCode.m_DMEMLength); } - break; + break; - case 0x80F3D001: - { - m_CurrentUCode.m_StartPC = _uMail & 0xffff; - BootUCode(); + case 0x80F3D001: + { + m_CurrentUCode.m_StartPC = _uMail & 0xffff; + BootUCode(); return; // Important! BootUCode indirectly does "delete this;". Must exit immediately. - } - break; + } + break; default: break; diff --git a/Source/Core/Core/Src/HW/DSPHLE/UCodes/UCode_ROM.h b/Source/Core/Core/Src/HW/DSPHLE/UCodes/UCode_ROM.h index 5dc0ce73c1..e49e5e4178 100644 --- a/Source/Core/Core/Src/HW/DSPHLE/UCodes/UCode_ROM.h +++ b/Source/Core/Core/Src/HW/DSPHLE/UCodes/UCode_ROM.h @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #ifndef _UCODE_ROM diff --git a/Source/Core/Core/Src/HW/DSPHLE/UCodes/UCode_Zelda.cpp b/Source/Core/Core/Src/HW/DSPHLE/UCodes/UCode_Zelda.cpp index 681197703d..67ce0900f9 100644 --- a/Source/Core/Core/Src/HW/DSPHLE/UCodes/UCode_Zelda.cpp +++ b/Source/Core/Core/Src/HW/DSPHLE/UCodes/UCode_Zelda.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ // Games that uses this UCode: @@ -228,7 +228,7 @@ void CUCode_Zelda::HandleMail_SMSVersion(u32 _uMail) } return; - } + } if (m_bListInProgress) { @@ -358,7 +358,7 @@ void CUCode_Zelda::HandleMail_NormalVersion(u32 _uMail) } return; - } + } if (m_bListInProgress) { @@ -454,8 +454,8 @@ void CUCode_Zelda::ExecuteList() case 0x00: break; // DsetupTable ... zelda ww jumps to 0x0095 - case 0x01: - { + case 0x01: + { m_NumVoices = ExtraData; m_VoicePBsAddr = Read32() & 0x7FFFFFFF; m_UnkTableAddr = Read32() & 0x7FFFFFFF; @@ -472,17 +472,17 @@ void CUCode_Zelda::ExecuteList() for (int i = 0; i < 32; i++) m_AFCCoefTable[i] = (s16)Common::swap16(TempPtr[i]); - DEBUG_LOG(DSPHLE, "DsetupTable"); + DEBUG_LOG(DSPHLE, "DsetupTable"); DEBUG_LOG(DSPHLE, "Num voice param blocks: %i", m_NumVoices); DEBUG_LOG(DSPHLE, "Voice param blocks address: 0x%08x", m_VoicePBsAddr); // This points to some strange data table. Don't know yet what it's for. Reverb coefs? - DEBUG_LOG(DSPHLE, "DSPRES_FILTER (size: 0x40): 0x%08x", m_UnkTableAddr); + DEBUG_LOG(DSPHLE, "DSPRES_FILTER (size: 0x40): 0x%08x", m_UnkTableAddr); // Zelda WW: This points to a 64-byte array of coefficients, which are EXACTLY the same // as the AFC ADPCM coef array in decode.c of the in_cube winamp plugin, // which can play Zelda audio. So, these should definitely be used when decoding AFC. - DEBUG_LOG(DSPHLE, "DSPADPCM_FILTER (size: 0x500): 0x%08x", m_AFCCoefTableAddr); + DEBUG_LOG(DSPHLE, "DSPADPCM_FILTER (size: 0x500): 0x%08x", m_AFCCoefTableAddr); DEBUG_LOG(DSPHLE, "Reverb param blocks address: 0x%08x", m_ReverbPBsAddr); } break; @@ -501,11 +501,11 @@ void CUCode_Zelda::ExecuteList() m_RightBuffersAddr = Read32() & 0x7FFFFFFF; m_LeftBuffersAddr = Read32() & 0x7FFFFFFF; - DEBUG_LOG(DSPHLE, "DsyncFrame"); + DEBUG_LOG(DSPHLE, "DsyncFrame"); // These alternate between three sets of mixing buffers. They are all three fairly near, // but not at, the ADMA read addresses. - DEBUG_LOG(DSPHLE, "Right buffer address: 0x%08x", m_RightBuffersAddr); - DEBUG_LOG(DSPHLE, "Left buffer address: 0x%08x", m_LeftBuffersAddr); + DEBUG_LOG(DSPHLE, "Right buffer address: 0x%08x", m_RightBuffersAddr); + DEBUG_LOG(DSPHLE, "Left buffer address: 0x%08x", m_LeftBuffersAddr); if (IsLightVersion()) break; @@ -526,28 +526,28 @@ void CUCode_Zelda::ExecuteList() */ // DsetDolbyDelay ... zelda ww jumps to 0x00b2 - case 0x0d: - { - u32 tmp = Read32(); - DEBUG_LOG(DSPHLE, "DSetDolbyDelay"); - DEBUG_LOG(DSPHLE, "DOLBY2_DELAY_BUF (size 0x960): 0x%08x", tmp); - } - break; + case 0x0d: + { + u32 tmp = Read32(); + DEBUG_LOG(DSPHLE, "DSetDolbyDelay"); + DEBUG_LOG(DSPHLE, "DOLBY2_DELAY_BUF (size 0x960): 0x%08x", tmp); + } + break; // This opcode, in the SMG ucode, sets the base address for audio data transfers from main memory (using DMA). // In the Zelda ucode, it is dummy, because this ucode uses accelerator for audio data transfers. - case 0x0e: + case 0x0e: { m_DMABaseAddr = Read32() & 0x7FFFFFFF; DEBUG_LOG(DSPHLE, "DsetDMABaseAddr"); DEBUG_LOG(DSPHLE, "DMA base address: 0x%08x", m_DMABaseAddr); } - break; + break; // default ... zelda ww jumps to 0x0043 - default: - PanicAlert("Zelda UCode - unknown command: %x (size %i)", Command, m_numSteps); - break; + default: + PanicAlert("Zelda UCode - unknown command: %x (size %i)", Command, m_numSteps); + break; } // sync, we are ready diff --git a/Source/Core/Core/Src/HW/DSPHLE/UCodes/UCode_Zelda.h b/Source/Core/Core/Src/HW/DSPHLE/UCodes/UCode_Zelda.h index 19567fd302..a9ee046807 100644 --- a/Source/Core/Core/Src/HW/DSPHLE/UCodes/UCode_Zelda.h +++ b/Source/Core/Core/Src/HW/DSPHLE/UCodes/UCode_Zelda.h @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #ifndef _UCODE_ZELDA_H @@ -45,30 +45,30 @@ union ZeldaVoicePB u16 volumeLeft2; // 0x0A | Left Volume 2 u16 Unk0B; // 0x0B | unknown - u16 SoundType2; // 0x0C | "Sound type" 2 (not really sound type) + u16 SoundType2; // 0x0C | "Sound type" 2 (not really sound type) u16 volumeRight1; // 0x0D | Right Volume 1 u16 volumeRight2; // 0x0E | Right Volume 2 u16 Unk0F; // 0x0F | unknown - u16 SoundType3; // 0x10 | "Sound type" 3 (not really sound type) + u16 SoundType3; // 0x10 | "Sound type" 3 (not really sound type) u16 volumeUnknown1_1; // 0x11 | Unknown Volume 1 u16 volumeUnknown1_2; // 0x12 | Unknown Volume 1 u16 Unk13; // 0x13 | unknown - u16 SoundType4; // 0x14 | "Sound type" 4 (not really sound type) + u16 SoundType4; // 0x14 | "Sound type" 4 (not really sound type) u16 volumeUnknown2_1; // 0x15 | Unknown Volume 2 u16 volumeUnknown2_2; // 0x16 | Unknown Volume 2 - u16 Unk17; // 0x17 | unknown + u16 Unk17; // 0x17 | unknown - u16 Unk18[0x10]; // 0x18 | unknown - u16 Unk28; // 0x28 | unknown - u16 Unk29; // 0x29 | unknown // multiplied by 0x2a @ 0d21/ZWW - u16 Unk2a; // 0x2A | unknown // loaded at 0d2e/ZWW - u16 Unk2b; // 0x2B | unknown - u16 VolumeMode; // 0x2C | unknown // See 0337/ZWW - u16 Unk2D; // 0x2D | unknown - u16 Unk2E; // 0x2E | unknown - u16 Unk2F; // 0x2F | unknown + u16 Unk18[0x10]; // 0x18 | unknown + u16 Unk28; // 0x28 | unknown + u16 Unk29; // 0x29 | unknown // multiplied by 0x2a @ 0d21/ZWW + u16 Unk2a; // 0x2A | unknown // loaded at 0d2e/ZWW + u16 Unk2b; // 0x2B | unknown + u16 VolumeMode; // 0x2C | unknown // See 0337/ZWW + u16 Unk2D; // 0x2D | unknown + u16 Unk2E; // 0x2E | unknown + u16 Unk2F; // 0x2F | unknown u16 CurSampleFrac; // 0x30 | Fractional part of the current sample position u16 Unk31; // 0x31 | unknown / unused u16 CurBlock; // 0x32 | current block? used by zelda's AFC decoder. we don't need it. @@ -85,14 +85,14 @@ union ZeldaVoicePB u16 YN2; // 0x66 | YN2 u16 YN1; // 0x67 | YN1 u16 Unk68[0x10]; // 0x68 | Saved samples from last decode? - u16 FilterState1; // 0x78 | unknown // ZWW: 0c84_FilterBufferInPlace loads and stores. Simply, the filter state. - u16 FilterState2; // 0x79 | unknown // ZWW: same as above. these two are active if 0x04a8 != 0. - u16 Unk7A; // 0x7A | unknown - u16 Unk7B; // 0x7B | unknown - u16 Unk7C; // 0x7C | unknown - u16 Unk7D; // 0x7D | unknown - u16 Unk7E; // 0x7E | unknown - u16 Unk7F; // 0x7F | unknown + u16 FilterState1; // 0x78 | unknown // ZWW: 0c84_FilterBufferInPlace loads and stores. Simply, the filter state. + u16 FilterState2; // 0x79 | unknown // ZWW: same as above. these two are active if 0x04a8 != 0. + u16 Unk7A; // 0x7A | unknown + u16 Unk7B; // 0x7B | unknown + u16 Unk7C; // 0x7C | unknown + u16 Unk7D; // 0x7D | unknown + u16 Unk7E; // 0x7E | unknown + u16 Unk7F; // 0x7F | unknown // Read-only part u16 Format; // 0x80 | audio format @@ -109,8 +109,8 @@ union ZeldaVoicePB u32 UnkAddr; // 0x8E | ??? u16 Padding[0x10]; // 0x90 | padding u16 Padding2[0x8]; // 0xa0 | FIR filter coefs of some sort (0xa4 controls the appearance of 0xa5-0xa7 and is almost always 0x7FFF) - u16 FilterEnable; // 0xa8 | FilterBufferInPlace enable - u16 Padding3[0x7]; // 0xa9 | padding + u16 FilterEnable; // 0xa8 | FilterBufferInPlace enable + u16 Padding3[0x7]; // 0xa9 | padding u16 Padding4[0x10]; // 0xb0 | padding }; u16 raw[0xc0]; // WARNING-do not use on parts of the 32-bit values - they are swapped! @@ -143,16 +143,16 @@ public: void Update(int cycles); void MixAdd(short* buffer, int size); - void CopyPBsFromRAM(); - void CopyPBsToRAM(); + void CopyPBsFromRAM(); + void CopyPBsToRAM(); void DoState(PointerWrap &p); - int *templbuffer; - int *temprbuffer; + int *templbuffer; + int *temprbuffer; - // Simple dump ... - int DumpAFC(u8* pIn, const int size, const int srate); + // Simple dump ... + int DumpAFC(u8* pIn, const int size, const int srate); u32 Read32() { @@ -261,20 +261,20 @@ private: u32 m_readOffset; - enum EMailState - { - WaitForMail, - ReadingFrameSync, - ReadingMessage, - ReadingSystemMsg - }; + enum EMailState + { + WaitForMail, + ReadingFrameSync, + ReadingMessage, + ReadingSystemMsg + }; - EMailState m_MailState; - u16 m_PBMask[0x10]; + EMailState m_MailState; + u16 m_PBMask[0x10]; - u32 m_NumPBs; - u32 m_PBAddress; // The main param block array - u32 m_PBAddress2; // 4 smaller param blocks + u32 m_NumPBs; + u32 m_PBAddress; // The main param block array + u32 m_PBAddress2; // 4 smaller param blocks void ExecuteList(); diff --git a/Source/Core/Core/Src/HW/DSPHLE/UCodes/UCode_Zelda_ADPCM.cpp b/Source/Core/Core/Src/HW/DSPHLE/UCodes/UCode_Zelda_ADPCM.cpp index ab808003c1..174827cd4a 100644 --- a/Source/Core/Core/Src/HW/DSPHLE/UCodes/UCode_Zelda_ADPCM.cpp +++ b/Source/Core/Core/Src/HW/DSPHLE/UCodes/UCode_Zelda_ADPCM.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #include "Common.h" @@ -21,61 +21,61 @@ void CUCode_Zelda::AFCdecodebuffer(const s16 *coef, const char *src, signed short *out, short *histp, short *hist2p, int type) { // First 2 nibbles are ADPCM scale etc. - short delta = 1 << (((*src) >> 4) & 0xf); - short idx = (*src) & 0xf; - src++; + short delta = 1 << (((*src) >> 4) & 0xf); + short idx = (*src) & 0xf; + src++; short nibbles[16]; - if (type == 9) - { - for (int i = 0; i < 16; i += 2) + if (type == 9) + { + for (int i = 0; i < 16; i += 2) { - nibbles[i + 0] = *src >> 4; - nibbles[i + 1] = *src & 15; - src++; - } - for (int i = 0; i < 16; i++) { - if (nibbles[i] >= 8) - nibbles[i] = nibbles[i] - 16; + nibbles[i + 0] = *src >> 4; + nibbles[i + 1] = *src & 15; + src++; + } + for (int i = 0; i < 16; i++) { + if (nibbles[i] >= 8) + nibbles[i] = nibbles[i] - 16; nibbles[i] <<= 11; - } - } - else - { + } + } + else + { // In Pikmin, Dolphin's engine sound is using AFC type 5, even though such a sound is hard // to compare, it seems like to sound exactly like a real GC // In Super Mario Sunshine, you can get such a sound by talking to/jumping on anyone - for (int i = 0; i < 16; i += 4) - { - nibbles[i + 0] = (*src >> 6) & 0x03; - nibbles[i + 1] = (*src >> 4) & 0x03; - nibbles[i + 2] = (*src >> 2) & 0x03; - nibbles[i + 3] = (*src >> 0) & 0x03; - src++; - } + for (int i = 0; i < 16; i += 4) + { + nibbles[i + 0] = (*src >> 6) & 0x03; + nibbles[i + 1] = (*src >> 4) & 0x03; + nibbles[i + 2] = (*src >> 2) & 0x03; + nibbles[i + 3] = (*src >> 0) & 0x03; + src++; + } - for (int i = 0; i < 16; i++) - { - if (nibbles[i] >= 2) - nibbles[i] = nibbles[i] - 4; + for (int i = 0; i < 16; i++) + { + if (nibbles[i] >= 2) + nibbles[i] = nibbles[i] - 4; nibbles[i] <<= 13; - } - } + } + } short hist = *histp; - short hist2 = *hist2p; - for (int i = 0; i < 16; i++) + short hist2 = *hist2p; + for (int i = 0; i < 16; i++) { - int sample = delta * nibbles[i] + ((int)hist * coef[idx * 2]) + ((int)hist2 * coef[idx * 2 + 1]); - sample >>= 11; - if (sample > 32767) - sample = 32767; - if (sample < -32768) - sample = -32768; - out[i] = sample; - hist2 = hist; - hist = (short)sample; - } + int sample = delta * nibbles[i] + ((int)hist * coef[idx * 2]) + ((int)hist2 * coef[idx * 2 + 1]); + sample >>= 11; + if (sample > 32767) + sample = 32767; + if (sample < -32768) + sample = -32768; + out[i] = sample; + hist2 = hist; + hist = (short)sample; + } *histp = hist; - *hist2p = hist2; + *hist2p = hist2; } diff --git a/Source/Core/Core/Src/HW/DSPHLE/UCodes/UCode_Zelda_Synth.cpp b/Source/Core/Core/Src/HW/DSPHLE/UCodes/UCode_Zelda_Synth.cpp index 9b9da85492..dc65b81d1d 100644 --- a/Source/Core/Core/Src/HW/DSPHLE/UCodes/UCode_Zelda_Synth.cpp +++ b/Source/Core/Core/Src/HW/DSPHLE/UCodes/UCode_Zelda_Synth.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #include @@ -90,7 +90,9 @@ _lRestart: PB.ReachedEnd = 1; } else + { PB.RemLength -= pos[1]; + } PB.CurSampleFrac = TrueSamplePosition & 0xFFFF; } @@ -141,7 +143,9 @@ inline u16 AddValueToReg(u32 ar, s32 ix) void CUCode_Zelda::RenderSynth_WaveTable(ZeldaVoicePB &PB, s32* _Buffer, int _Size) { u16 address; - switch(PB.Format) { + + switch(PB.Format) + { default: case 0x0004: address = 0x140; diff --git a/Source/Core/Core/Src/HW/DSPHLE/UCodes/UCode_Zelda_Voice.cpp b/Source/Core/Core/Src/HW/DSPHLE/UCodes/UCode_Zelda_Voice.cpp index 67f354007e..abac6dc09e 100644 --- a/Source/Core/Core/Src/HW/DSPHLE/UCodes/UCode_Zelda_Voice.cpp +++ b/Source/Core/Core/Src/HW/DSPHLE/UCodes/UCode_Zelda_Voice.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #include @@ -130,7 +130,8 @@ void CUCode_Zelda::RenderVoice_PCM16(ZeldaVoicePB &PB, s16 *_Buffer, int _Size) { PB.ReachedEnd = 0; reached_end: - if (!PB.RepeatMode) { + if (!PB.RepeatMode) + { // One shot - play zeros the rest of the buffer. clear_buffer: for (u32 i = 0; i < rem_samples; i++) @@ -235,7 +236,8 @@ void PrintObject(const T &Obj) CompileTimeAssert ensure_zpb_size_correct; (void)ensure_zpb_size_correct; - for (size_t i = 0; i < sizeof(T); i++) { + for (size_t i = 0; i < sizeof(T); i++) + { if((i > 0) && ((i & 1) == 0)) ss << " "; @@ -256,48 +258,51 @@ void CUCode_Zelda::RenderVoice_AFC(ZeldaVoicePB &PB, s16 *_Buffer, int _Size) int _RealSize = SizeForResampling(PB, _Size, PB.RatioInt); // initialize "decoder" if the sample is played the first time - if (PB.NeedsReset != 0) - { + if (PB.NeedsReset != 0) + { // This is 0717_ReadOutPBStuff // increment 4fb - // zelda: - // perhaps init or "has played before" - PB.CurBlock = 0x00; + // zelda: + // perhaps init or "has played before" + PB.CurBlock = 0x00; PB.YN2 = 0x00; // history1 - PB.YN1 = 0x00; // history2 + PB.YN1 = 0x00; // history2 // Length in samples. - PB.RemLength = PB.Length; - // Copy ARAM addr from r to rw area. - PB.CurAddr = PB.StartAddr; + PB.RemLength = PB.Length; + // Copy ARAM addr from r to rw area. + PB.CurAddr = PB.StartAddr; PB.ReachedEnd = 0; PB.CurSampleFrac = 0; for (int i = 0; i < 4; i++) PB.ResamplerOldData[i] = 0; - } + } - if (PB.KeyOff != 0) // 0747 early out... i dunno if this can happen because we filter it above + if (PB.KeyOff != 0) // 0747 early out... i dunno if this can happen because we filter it above { for (int i = 0; i < _RealSize; i++) *_Buffer++ = 0; - return; + return; } // Round upwards how many samples we need to copy, 0759 - // u32 frac = NumberOfSamples & 0xF; - // NumberOfSamples = (NumberOfSamples + 0xf) >> 4; // i think the lower 4 are the fraction + // u32 frac = NumberOfSamples & 0xF; + // NumberOfSamples = (NumberOfSamples + 0xf) >> 4; // i think the lower 4 are the fraction const u8 *source; u32 ram_mask = 1024 * 1024 * 16 - 1; - if (IsDMAVersion()) { + if (IsDMAVersion()) + { source = Memory::GetPointer(m_DMABaseAddr); ram_mask = 1024 * 1024 * 64 - 1; } else + { source = DSP::GetARAMPtr(); + } - int sampleCount = 0; // must be above restart. + int sampleCount = 0; // must be above restart. restart: if (PB.ReachedEnd) @@ -338,17 +343,17 @@ restart: u32 prev_addr = PB.CurAddr; // Prefill the decode buffer. - AFCdecodebuffer(m_AFCCoefTable, (char*)(source + (PB.CurAddr & ram_mask)), outbuf, (short*)&PB.YN2, (short*)&PB.YN1, PB.Format); + AFCdecodebuffer(m_AFCCoefTable, (char*)(source + (PB.CurAddr & ram_mask)), outbuf, (short*)&PB.YN2, (short*)&PB.YN1, PB.Format); PB.CurAddr += PB.Format; // 9 or 5 u32 SamplePosition = PB.Length - PB.RemLength; - while (sampleCount < _RealSize) - { + while (sampleCount < _RealSize) + { _Buffer[sampleCount] = outbuf[SamplePosition & 15]; sampleCount++; SamplePosition++; - PB.RemLength--; + PB.RemLength--; if (PB.RemLength == 0) { PB.ReachedEnd = 1; @@ -356,7 +361,8 @@ restart: } // Need new samples! - if ((SamplePosition & 15) == 0) { + if ((SamplePosition & 15) == 0) + { prev_yn1 = PB.YN1; prev_yn2 = PB.YN2; prev_addr = PB.CurAddr; @@ -364,7 +370,7 @@ restart: AFCdecodebuffer(m_AFCCoefTable, (char*)(source + (PB.CurAddr & ram_mask)), outbuf, (short*)&PB.YN2, (short*)&PB.YN1, PB.Format); PB.CurAddr += PB.Format; // 9 or 5 } - } + } // Here we should back off to the previous addr/yn1/yn2, since we didn't consume the full last block. // We'll re-decode it the next time around. @@ -372,16 +378,16 @@ restart: PB.YN1 = prev_yn1; PB.CurAddr = prev_addr; - PB.NeedsReset = 0; + PB.NeedsReset = 0; // PB.CurBlock = 0x10 - (PB.LoopStartPos & 0xf); // write back - // NumberOfSamples = (NumberOfSamples << 4) | frac; // missing fraction + // NumberOfSamples = (NumberOfSamples << 4) | frac; // missing fraction - // i think pTest[0x3a] and pTest[0x3b] got an update after you have decoded some samples... - // just decrement them with the number of samples you have played - // and increase the ARAM Offset in pTest[0x38], pTest[0x39] + // i think pTest[0x3a] and pTest[0x3b] got an update after you have decoded some samples... + // just decrement them with the number of samples you have played + // and increase the ARAM Offset in pTest[0x38], pTest[0x39] - // end of block (Zelda 03b2) + // end of block (Zelda 03b2) } void Decoder21_ReadAudio(ZeldaVoicePB &PB, int size, s16 *_Buffer); @@ -513,7 +519,7 @@ void CUCode_Zelda::RenderAddVoice(ZeldaVoicePB &PB, s32* _LeftBuffer, s32* _Righ Resample(PB, _Size, m_ResampleBuffer + 4, m_VoiceBuffer, true); break; - case 0x0008: // PCM8 - normal PCM 8-bit audio. Used in Mario Kart DD + very little in Zelda WW. + case 0x0008: // PCM8 - normal PCM 8-bit audio. Used in Mario Kart DD + very little in Zelda WW. RenderVoice_PCM8(PB, m_ResampleBuffer + 4, _Size); Resample(PB, _Size, m_ResampleBuffer + 4, m_VoiceBuffer, true); break; @@ -563,12 +569,12 @@ void CUCode_Zelda::RenderAddVoice(ZeldaVoicePB &PB, s32* _LeftBuffer, s32* _Righ WARN_LOG(DSPHLE, "Synthesizing 0x0006 (constant sound)"); RenderSynth_Constant(PB, m_VoiceBuffer, _Size); break; - - // These are more "synth" formats - square wave, saw wave etc. + + // These are more "synth" formats - square wave, saw wave etc. case 0x0002: WARN_LOG(DSPHLE, "PB Format 0x02 used!"); break; - + case 0x0004: // Example: Big Pikmin onion mothership landing/building a bridge in Pikmin case 0x0007: // Example: "success" SFX in Pikmin 1, Pikmin 2 in a cave, not sure what sound it is. case 0x000b: // Example: SFX in area selection menu in Pikmin @@ -596,7 +602,7 @@ ContinueWithBlock: for (int i = 0; i < _Size; i++) { - + // TODO? } // Apply volume. There are two different modes. @@ -625,12 +631,14 @@ ContinueWithBlock: b00[2] = AX0H * AX1L >> 16; b00[3] = AX0L * AX0H >> 16; - for (int i = 0; i < 4; i++) { + for (int i = 0; i < 4; i++) + { b00[i + 4] = (s16)b00[i] * (s16)PB.raw[0x2a] >> 16; } int prod = ((s16)PB.raw[0x2a] * (s16)PB.raw[0x29] * 2) >> 16; - for (int i = 0; i < 4; i++) { + for (int i = 0; i < 4; i++) + { b00[i + 8] = (s16)b00[i + 4] * prod; } @@ -639,11 +647,13 @@ ContinueWithBlock: int diff = (s16)PB.raw[0x2b] - (s16)PB.raw[0x2a]; PB.raw[0x2a] = PB.raw[0x2b]; - for (int i = 0; i < 4; i++) { + for (int i = 0; i < 4; i++) + { b00[i + 0xc] = (unsigned short)b00[i] * diff >> 16; } - for (int i = 0; i < 4; i++) { + for (int i = 0; i < 4; i++) + { b00[i + 0x10] = (s16)b00[i + 0xc] * PB.raw[0x29]; } @@ -682,7 +692,9 @@ ContinueWithBlock: sum += value; addr += 5; } - if (sum == 0) { + + if (sum == 0) + { PB.KeyOff = 1; } } @@ -719,7 +731,9 @@ ContinueWithBlock: case 0: _LeftBuffer[i] += (u64)value * ramp >> 29; break; case 1: _RightBuffer[i] += (u64)value * ramp >> 29; break; } - if (((i & 1) == 0) && i < 64) { + + if (((i & 1) == 0) && i < 64) + { ramp += delta; } } diff --git a/Source/Core/Core/Src/HW/DSPHLE/UCodes/UCodes.cpp b/Source/Core/Core/Src/HW/DSPHLE/UCodes/UCodes.cpp index c04bf41403..1a59f16b64 100644 --- a/Source/Core/Core/Src/HW/DSPHLE/UCodes/UCodes.cpp +++ b/Source/Core/Core/Src/HW/DSPHLE/UCodes/UCodes.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #include "UCodes.h" @@ -33,7 +33,7 @@ IUCode* UCodeFactory(u32 _CRC, DSPHLE *dsp_hle, bool bWii) case UCODE_ROM: INFO_LOG(DSPHLE, "Switching to ROM ucode"); return new CUCode_Rom(dsp_hle, _CRC); - + case UCODE_INIT_AUDIO_SYSTEM: INFO_LOG(DSPHLE, "Switching to INIT ucode"); return new CUCode_InitAudioSystem(dsp_hle, _CRC); @@ -74,11 +74,11 @@ IUCode* UCodeFactory(u32 _CRC, DSPHLE *dsp_hle, bool bWii) INFO_LOG(DSPHLE, "CRC %08x: Zelda ucode chosen", _CRC); return new CUCode_Zelda(dsp_hle, _CRC); - // WII CRCs + // WII CRCs case 0xb7eb9a9c: // Wii Pikmin - PAL case 0xeaeb38cc: // Wii Pikmin 2 - PAL case 0x6c3f6f94: // Zelda TP - PAL - case 0xd643001f: // Mario Galaxy - PAL / WII DK Jungle Beat - PAL + case 0xd643001f: // Mario Galaxy - PAL / WII DK Jungle Beat - PAL INFO_LOG(DSPHLE, "CRC %08x: Zelda Wii ucode chosen\n", _CRC); return new CUCode_Zelda(dsp_hle, _CRC); @@ -87,8 +87,8 @@ IUCode* UCodeFactory(u32 _CRC, DSPHLE *dsp_hle, bool bWii) case 0x347112ba: // raving rabbits case 0xfa450138: // wii sports - PAL case 0xadbc06bd: // Elebits - case 0x4cc52064: // Bleach: Versus Crusade - case 0xd9c4bf34: // WiiMenu + case 0x4cc52064: // Bleach: Versus Crusade + case 0xd9c4bf34: // WiiMenu INFO_LOG(DSPHLE, "CRC %08x: Wii - AXWii chosen", _CRC); return new CUCode_AXWii(dsp_hle, _CRC); diff --git a/Source/Core/Core/Src/HW/DSPHLE/UCodes/UCodes.h b/Source/Core/Core/Src/HW/DSPHLE/UCodes/UCodes.h index 1b089228e0..91e3403e2c 100644 --- a/Source/Core/Core/Src/HW/DSPHLE/UCodes/UCodes.h +++ b/Source/Core/Core/Src/HW/DSPHLE/UCodes/UCodes.h @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #ifndef _UCODES_H diff --git a/Source/Core/Core/Src/HW/DSPLLE/DSPDebugInterface.cpp b/Source/Core/Core/Src/HW/DSPLLE/DSPDebugInterface.cpp index 58534f137a..41287fbbbd 100644 --- a/Source/Core/Core/Src/HW/DSPLLE/DSPDebugInterface.cpp +++ b/Source/Core/Core/Src/HW/DSPLLE/DSPDebugInterface.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #include "DSPDebugInterface.h" @@ -38,9 +38,11 @@ void DSPDebugInterface::getRawMemoryString(int memory, unsigned int address, cha return; } - switch (memory) { + switch (memory) + { case 0: // IMEM - switch (address >> 12) { + switch (address >> 12) + { case 0: case 0x8: sprintf(dest, "%04x", dsp_imem_read(address)); @@ -51,7 +53,8 @@ void DSPDebugInterface::getRawMemoryString(int memory, unsigned int address, cha } break; case 1: // DMEM - switch (address >> 12) { + switch (address >> 12) + { case 0: case 1: sprintf(dest, "%04x (DMEM)", dsp_dmem_read(address)); @@ -94,29 +97,39 @@ bool DSPDebugInterface::isBreakpoint(unsigned int address) void DSPDebugInterface::setBreakpoint(unsigned int address) { int real_addr = DSPSymbols::Line2Addr(address); - if (real_addr >= 0) { + + if (real_addr >= 0) + { if (dsp_breakpoints.Add(real_addr)) - {} + { + + } } } void DSPDebugInterface::clearBreakpoint(unsigned int address) { int real_addr = DSPSymbols::Line2Addr(address); - if (real_addr >= 0) { + + if (real_addr >= 0) + { if (dsp_breakpoints.Remove(real_addr)) - {} + { + + } } } -void DSPDebugInterface::clearAllBreakpoints() { +void DSPDebugInterface::clearAllBreakpoints() +{ dsp_breakpoints.Clear(); } void DSPDebugInterface::toggleBreakpoint(unsigned int address) { int real_addr = DSPSymbols::Line2Addr(address); - if (real_addr >= 0) { + if (real_addr >= 0) + { if (dsp_breakpoints.IsAddressBreakPoint(real_addr)) dsp_breakpoints.Remove(real_addr); else diff --git a/Source/Core/Core/Src/HW/DSPLLE/DSPHost.cpp b/Source/Core/Core/Src/HW/DSPLLE/DSPHost.cpp index c3bbeb3afb..6f1931b51c 100644 --- a/Source/Core/Core/Src/HW/DSPLLE/DSPHost.cpp +++ b/Source/Core/Core/Src/HW/DSPLLE/DSPHost.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #include "Common.h" @@ -89,7 +89,8 @@ u32 DSPHost_CodeLoaded(const u8 *ptr, int size) default: success = false; break; } - if (!success) { + if (!success) + { DSPSymbols::AutoDisassembly(0x0, 0x1000); } diff --git a/Source/Core/Core/Src/HW/DSPLLE/DSPLLE.cpp b/Source/Core/Core/Src/HW/DSPLLE/DSPLLE.cpp index ded232a9b1..4d345fc5a2 100644 --- a/Source/Core/Core/Src/HW/DSPLLE/DSPLLE.cpp +++ b/Source/Core/Core/Src/HW/DSPLLE/DSPLLE.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ @@ -74,9 +74,12 @@ void DSPLLE::DoState(PointerWrap &p) p.Do(g_dsp.reg_stack_ptr); p.Do(g_dsp.exceptions); p.Do(g_dsp.external_interrupt_waiting); - for (int i = 0; i < 4; i++) { + + for (int i = 0; i < 4; i++) + { p.Do(g_dsp.reg_stack[i]); } + p.Do(g_dsp.iram_crc); p.Do(g_dsp.step_counter); p.Do(g_dsp.ifx_regs); diff --git a/Source/Core/Core/Src/HW/DSPLLE/DSPLLE.h b/Source/Core/Core/Src/HW/DSPLLE/DSPLLE.h index 4043c95452..d6e1f05977 100644 --- a/Source/Core/Core/Src/HW/DSPLLE/DSPLLE.h +++ b/Source/Core/Core/Src/HW/DSPLLE/DSPLLE.h @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #ifndef _DSPLLE_H diff --git a/Source/Core/Core/Src/HW/DSPLLE/DSPLLEGlobals.cpp b/Source/Core/Core/Src/HW/DSPLLE/DSPLLEGlobals.cpp index fd05d069e3..103ac474d9 100644 --- a/Source/Core/Core/Src/HW/DSPLLE/DSPLLEGlobals.cpp +++ b/Source/Core/Core/Src/HW/DSPLLE/DSPLLEGlobals.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #include "Common.h" // for Common::swap @@ -37,7 +37,7 @@ void ProfilerAddDelta(int _addr, int _delta) if (g_profile) { g_profileMap[_addr] += _delta; - } + } } void ProfilerInit() diff --git a/Source/Core/Core/Src/HW/DSPLLE/DSPLLEGlobals.h b/Source/Core/Core/Src/HW/DSPLLE/DSPLLEGlobals.h index 87cb817b9e..557237f0fb 100644 --- a/Source/Core/Core/Src/HW/DSPLLE/DSPLLEGlobals.h +++ b/Source/Core/Core/Src/HW/DSPLLE/DSPLLEGlobals.h @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #ifndef _GLOBALS_H diff --git a/Source/Core/Core/Src/HW/DSPLLE/DSPLLETools.cpp b/Source/Core/Core/Src/HW/DSPLLE/DSPLLETools.cpp index 8f0899c154..5935dba6de 100644 --- a/Source/Core/Core/Src/HW/DSPLLE/DSPLLETools.cpp +++ b/Source/Core/Core/Src/HW/DSPLLE/DSPLLETools.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #include diff --git a/Source/Core/Core/Src/HW/DSPLLE/DSPLLETools.h b/Source/Core/Core/Src/HW/DSPLLE/DSPLLETools.h index 6593d0ccec..21ef7cb4ba 100644 --- a/Source/Core/Core/Src/HW/DSPLLE/DSPLLETools.h +++ b/Source/Core/Core/Src/HW/DSPLLE/DSPLLETools.h @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #ifndef _DSPLLE_TOOLS_H diff --git a/Source/Core/Core/Src/HW/DSPLLE/DSPSymbols.cpp b/Source/Core/Core/Src/HW/DSPLLE/DSPSymbols.cpp index 34d61b5ef9..c3810d413d 100644 --- a/Source/Core/Core/Src/HW/DSPLLE/DSPSymbols.cpp +++ b/Source/Core/Core/Src/HW/DSPLLE/DSPSymbols.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #include @@ -64,14 +64,19 @@ const char *GetLineText(int line) return lines[line].c_str(); } else + { return "----"; + } } Symbol *DSPSymbolDB::GetSymbolFromAddr(u32 addr) { XFuncMap::iterator it = functions.find(addr); + if (it != functions.end()) + { return &it->second; + } else { for (XFuncMap::iterator iter = functions.begin(); iter != functions.end(); ++iter) @@ -84,8 +89,10 @@ Symbol *DSPSymbolDB::GetSymbolFromAddr(u32 addr) } // lower case only -bool IsHexDigit(char c) { - switch (c) { +bool IsHexDigit(char c) +{ + switch (c) + { case '0': case '1': case '2': @@ -108,7 +115,8 @@ bool IsHexDigit(char c) { } } -bool IsAlpha(char c) { +bool IsAlpha(char c) +{ return (c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z'); } @@ -165,7 +173,9 @@ bool ReadAnnotatedAssembly(const char *filename) break; } } - } else { + } + else + { if (i - first_hex < 3) { first_hex = -1; @@ -176,10 +186,13 @@ bool ReadAnnotatedAssembly(const char *filename) } // Scan for function starts - if (!memcmp(line, "void", 4)) { + if (!memcmp(line, "void", 4)) + { char temp[256]; - for (size_t i = 6; i < len; i++) { - if (line[i] == '(') { + for (size_t i = 6; i < len; i++) + { + if (line[i] == '(') + { // Yep, got one. memcpy(temp, line + 5, i - 5); temp[i - 5] = 0; @@ -197,13 +210,15 @@ bool ReadAnnotatedAssembly(const char *filename) } // Scan for braces - for (size_t i = 0; i < len; i++) { + for (size_t i = 0; i < len; i++) + { if (line[i] == '{') brace_count++; if (line[i] == '}') { brace_count--; - if (brace_count == 0 && symbol_in_progress) { + if (brace_count == 0 && symbol_in_progress) + { // Commit this symbol. current_symbol.size = last_addr - current_symbol.address + 1; g_dsp_symbol_db.AddCompleteSymbol(current_symbol); @@ -219,7 +234,8 @@ bool ReadAnnotatedAssembly(const char *filename) sscanf(line + first_hex, "%04x", &hex); // Sanity check - if (hex > last_addr + 3 || hex < last_addr - 3) { + if (hex > last_addr + 3 || hex < last_addr - 3) + { static int errors = 0; INFO_LOG(DSPLLE, "Got Insane Hex Digit %04x (%04x) from %s", hex, last_addr, line); errors++; diff --git a/Source/Core/Core/Src/HW/DSPLLE/DSPSymbols.h b/Source/Core/Core/Src/HW/DSPLLE/DSPSymbols.h index 126bf36386..162027ef32 100644 --- a/Source/Core/Core/Src/HW/DSPLLE/DSPSymbols.h +++ b/Source/Core/Core/Src/HW/DSPLLE/DSPSymbols.h @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #ifndef _DSPSYMBOLS_H diff --git a/Source/Core/Core/Src/HW/DVDInterface.cpp b/Source/Core/Core/Src/HW/DVDInterface.cpp index dd21fd7d93..d8169261be 100644 --- a/Source/Core/Core/Src/HW/DVDInterface.cpp +++ b/Source/Core/Core/Src/HW/DVDInterface.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #include "Common.h" // Common @@ -59,7 +59,7 @@ enum DI_InterruptType INT_DEINT = 0, INT_TCINT = 1, INT_BRKINT = 2, - INT_CVRINT = 3, + INT_CVRINT = 3, }; // debug commands which may be ORd @@ -77,14 +77,14 @@ union UDISR u32 Hex; struct { - u32 BREAK : 1; // Stop the Device + Interrupt - u32 DEINITMASK : 1; // Access Device Error Int Mask - u32 DEINT : 1; // Access Device Error Int - u32 TCINTMASK : 1; // Transfer Complete Int Mask - u32 TCINT : 1; // Transfer Complete Int - u32 BRKINTMASK : 1; - u32 BRKINT : 1; // w 1: clear brkint - u32 : 25; + u32 BREAK : 1; // Stop the Device + Interrupt + u32 DEINITMASK : 1; // Access Device Error Int Mask + u32 DEINT : 1; // Access Device Error Int + u32 TCINTMASK : 1; // Transfer Complete Int Mask + u32 TCINT : 1; // Transfer Complete Int + u32 BRKINTMASK : 1; + u32 BRKINT : 1; // w 1: clear brkint + u32 : 25; }; UDISR() {Hex = 0;} UDISR(u32 _hex) {Hex = _hex;} @@ -96,10 +96,10 @@ union UDICVR u32 Hex; struct { - u32 CVR : 1; // 0: Cover closed 1: Cover open - u32 CVRINTMASK : 1; // 1: Interrupt enabled - u32 CVRINT : 1; // r 1: Interrupt requested w 1: Interrupt clear - u32 : 29; + u32 CVR : 1; // 0: Cover closed 1: Cover open + u32 CVRINTMASK : 1; // 1: Interrupt enabled + u32 CVRINT : 1; // r 1: Interrupt requested w 1: Interrupt clear + u32 : 29; }; UDICVR() {Hex = 0;} UDICVR(u32 _hex) {Hex = _hex;} @@ -409,7 +409,9 @@ bool DVDReadADPCM(u8* _pDestBuffer, u32 _iNumSamples) return true; } else + { return false; + } } void Read32(u32& _uReturnValue, const u32 _iAddress) @@ -428,7 +430,7 @@ void Read32(u32& _uReturnValue, const u32 _iAddress) case DI_CONFIG_REGISTER: _uReturnValue = m_DICFG.Hex; break; default: - _dbg_assert_(DVDINTERFACE, 0); + _dbg_assert_(DVDINTERFACE, 0); _uReturnValue = 0; break; } @@ -450,9 +452,14 @@ void Write32(const u32 _iValue, const u32 _iAddress) m_DISR.BRKINTMASK = tmpStatusReg.BRKINTMASK; m_DISR.BREAK = tmpStatusReg.BREAK; - if (tmpStatusReg.DEINT) m_DISR.DEINT = 0; - if (tmpStatusReg.TCINT) m_DISR.TCINT = 0; - if (tmpStatusReg.BRKINT) m_DISR.BRKINT = 0; + if (tmpStatusReg.DEINT) + m_DISR.DEINT = 0; + + if (tmpStatusReg.TCINT) + m_DISR.TCINT = 0; + + if (tmpStatusReg.BRKINT) + m_DISR.BRKINT = 0; if (m_DISR.BREAK) { @@ -463,21 +470,22 @@ void Write32(const u32 _iValue, const u32 _iAddress) } break; - case DI_COVER_REGISTER: + case DI_COVER_REGISTER: { UDICVR tmpCoverReg(_iValue); m_DICVR.CVRINTMASK = tmpCoverReg.CVRINTMASK; - if (tmpCoverReg.CVRINT) m_DICVR.CVRINT = 0; + if (tmpCoverReg.CVRINT) + m_DICVR.CVRINT = 0; UpdateInterrupts(); } break; - case DI_COMMAND_0: m_DICMDBUF[0].Hex = _iValue; break; - case DI_COMMAND_1: m_DICMDBUF[1].Hex = _iValue; break; - case DI_COMMAND_2: m_DICMDBUF[2].Hex = _iValue; break; + case DI_COMMAND_0: m_DICMDBUF[0].Hex = _iValue; break; + case DI_COMMAND_1: m_DICMDBUF[1].Hex = _iValue; break; + case DI_COMMAND_2: m_DICMDBUF[2].Hex = _iValue; break; case DI_DMA_ADDRESS_REGISTER: { @@ -718,11 +726,15 @@ void ExecuteCommand(UDICR& _DICR) if ((offset < 0) || ((offset + len) > 0x40) || len > 0x40) { u32 addr = m_DIMAR.Address; - if (iDVDOffset == 0x84800000) { + if (iDVDOffset == 0x84800000) + { ERROR_LOG(DVDINTERFACE, "FIRMWARE UPLOAD"); - } else { + } + else + { ERROR_LOG(DVDINTERFACE, "ILLEGAL MEDIA WRITE"); } + while (len >= 4) { ERROR_LOG(DVDINTERFACE, "GC-AM Media Board WRITE (0xAA): %08x: %08x", iDVDOffset, Memory::Read_U32(addr)); diff --git a/Source/Core/Core/Src/HW/DVDInterface.h b/Source/Core/Core/Src/HW/DVDInterface.h index 1fa4d32dec..a913555137 100644 --- a/Source/Core/Core/Src/HW/DVDInterface.h +++ b/Source/Core/Core/Src/HW/DVDInterface.h @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #ifndef _DVDINTERFACE_H diff --git a/Source/Core/Core/Src/HW/EXI.cpp b/Source/Core/Core/Src/HW/EXI.cpp index 1e86bd1b90..38be83ea80 100644 --- a/Source/Core/Core/Src/HW/EXI.cpp +++ b/Source/Core/Core/Src/HW/EXI.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #include "Common.h" diff --git a/Source/Core/Core/Src/HW/EXI.h b/Source/Core/Core/Src/HW/EXI.h index 86134eb087..c3c9067c3e 100644 --- a/Source/Core/Core/Src/HW/EXI.h +++ b/Source/Core/Core/Src/HW/EXI.h @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #ifndef _EXIINTERFACE_H #define _EXIINTERFACE_H diff --git a/Source/Core/Core/Src/HW/EXI_Channel.cpp b/Source/Core/Core/Src/HW/EXI_Channel.cpp index 45b2fbae59..9f7a60c672 100644 --- a/Source/Core/Core/Src/HW/EXI_Channel.cpp +++ b/Source/Core/Core/Src/HW/EXI_Channel.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #include "EXI_Channel.h" @@ -149,7 +149,9 @@ void CEXIChannel::Read32(u32& _uReturnValue, const u32 _iRegister) // check if external device is present // pretty sure it is memcard only, not entirely sure if (m_ChannelId == 2) + { m_Status.EXT = 0; + } else { m_Status.EXT = GetDevice(1)->IsPresent() ? 1 : 0; @@ -195,25 +197,29 @@ void CEXIChannel::Write32(const u32 _iValue, const u32 _iRegister) { UEXI_STATUS newStatus(_iValue); - m_Status.EXIINTMASK = newStatus.EXIINTMASK; - if (newStatus.EXIINT) m_Status.EXIINT = 0; + m_Status.EXIINTMASK = newStatus.EXIINTMASK; + if (newStatus.EXIINT) + m_Status.EXIINT = 0; - m_Status.TCINTMASK = newStatus.TCINTMASK; - if (newStatus.TCINT) m_Status.TCINT = 0; + m_Status.TCINTMASK = newStatus.TCINTMASK; + if (newStatus.TCINT) + m_Status.TCINT = 0; - m_Status.CLK = newStatus.CLK; + m_Status.CLK = newStatus.CLK; if (m_ChannelId == 0 || m_ChannelId == 1) { - m_Status.EXTINTMASK = newStatus.EXTINTMASK; - if (newStatus.EXTINT) m_Status.EXTINT = 0; + m_Status.EXTINTMASK = newStatus.EXTINTMASK; + + if (newStatus.EXTINT) + m_Status.EXTINT = 0; } if (m_ChannelId == 0) - m_Status.ROMDIS = newStatus.ROMDIS; + m_Status.ROMDIS = newStatus.ROMDIS; IEXIDevice* pDevice = GetDevice(m_Status.CHIP_SELECT ^ newStatus.CHIP_SELECT); - m_Status.CHIP_SELECT = newStatus.CHIP_SELECT; + m_Status.CHIP_SELECT = newStatus.CHIP_SELECT; if (pDevice != NULL) pDevice->SetCS(m_Status.CHIP_SELECT); diff --git a/Source/Core/Core/Src/HW/EXI_Channel.h b/Source/Core/Core/Src/HW/EXI_Channel.h index dfbd8558f9..5243bd6a0d 100644 --- a/Source/Core/Core/Src/HW/EXI_Channel.h +++ b/Source/Core/Core/Src/HW/EXI_Channel.h @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #ifndef _EXICHANNEL_H diff --git a/Source/Core/Core/Src/HW/EXI_Device.cpp b/Source/Core/Core/Src/HW/EXI_Device.cpp index 9fdd9a0cd0..22c968f004 100644 --- a/Source/Core/Core/Src/HW/EXI_Device.cpp +++ b/Source/Core/Core/Src/HW/EXI_Device.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #include "Memmap.h" diff --git a/Source/Core/Core/Src/HW/EXI_Device.h b/Source/Core/Core/Src/HW/EXI_Device.h index 630d6d224a..a38831d729 100644 --- a/Source/Core/Core/Src/HW/EXI_Device.h +++ b/Source/Core/Core/Src/HW/EXI_Device.h @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #ifndef _EXIDEVICE_H diff --git a/Source/Core/Core/Src/HW/EXI_DeviceAD16.cpp b/Source/Core/Core/Src/HW/EXI_DeviceAD16.cpp index f65749865b..8c28ed4ed5 100644 --- a/Source/Core/Core/Src/HW/EXI_DeviceAD16.cpp +++ b/Source/Core/Core/Src/HW/EXI_DeviceAD16.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #include "../Core.h" diff --git a/Source/Core/Core/Src/HW/EXI_DeviceAD16.h b/Source/Core/Core/Src/HW/EXI_DeviceAD16.h index 62b7da0592..14c16656da 100644 --- a/Source/Core/Core/Src/HW/EXI_DeviceAD16.h +++ b/Source/Core/Core/Src/HW/EXI_DeviceAD16.h @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #ifndef _EXIDEVICE_AD16_H diff --git a/Source/Core/Core/Src/HW/EXI_DeviceAMBaseboard.cpp b/Source/Core/Core/Src/HW/EXI_DeviceAMBaseboard.cpp index 4318379e04..8e8272bb2b 100644 --- a/Source/Core/Core/Src/HW/EXI_DeviceAMBaseboard.cpp +++ b/Source/Core/Core/Src/HW/EXI_DeviceAMBaseboard.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #include "../Core.h" @@ -70,7 +70,9 @@ void CEXIAMBaseboard::TransferByte(u8& _byte) } if ((m_position >= 2) && (m_command[0] == 0 && m_command[1] == 0)) + { _byte = "\x06\x04\x10\x00"[(m_position-2)&3]; + } else if (m_position == 3) { unsigned int checksum = (m_command[0] << 24) | (m_command[1] << 16) | (m_command[2] << 8); @@ -83,6 +85,7 @@ void CEXIAMBaseboard::TransferByte(u8& _byte) check >>= 1; bit >>= 1; } + if (m_command[3] != (checksum & 0xFF)) ERROR_LOG(SP1, "AM-BB cs: %02x, w: %02x", m_command[3], checksum & 0xFF); } @@ -92,6 +95,7 @@ void CEXIAMBaseboard::TransferByte(u8& _byte) { _byte = 4; ERROR_LOG(SP1, "AM-BB COMMAND: %02x %02x %02x", m_command[0], m_command[1], m_command[2]); + if ((m_command[0] == 0xFF) && (m_command[1] == 0) && (m_command[2] == 0)) m_have_irq = true; else if (m_command[0] == 0x82) @@ -116,7 +120,9 @@ void CEXIAMBaseboard::TransferByte(u8& _byte) } } else + { _byte = 0xFF; + } } DEBUG_LOG(SP1, "AM-BB < %02x", _byte); m_position++; diff --git a/Source/Core/Core/Src/HW/EXI_DeviceAMBaseboard.h b/Source/Core/Core/Src/HW/EXI_DeviceAMBaseboard.h index 92a2ac4a8f..2531b2c7b8 100644 --- a/Source/Core/Core/Src/HW/EXI_DeviceAMBaseboard.h +++ b/Source/Core/Core/Src/HW/EXI_DeviceAMBaseboard.h @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #ifndef _EXIDEVICE_AMBASEBOARD_H diff --git a/Source/Core/Core/Src/HW/EXI_DeviceEthernet.cpp b/Source/Core/Core/Src/HW/EXI_DeviceEthernet.cpp index ed3f591b90..cb01df3d0e 100644 --- a/Source/Core/Core/Src/HW/EXI_DeviceEthernet.cpp +++ b/Source/Core/Core/Src/HW/EXI_DeviceEthernet.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #include "Memmap.h" @@ -87,11 +87,16 @@ CEXIETHERNET::CEXIETHERNET() for (size_t i = 0; i < mac_addr_setting.size() && x < 12; i++) { char c = mac_addr_setting.at(i); - if (c >= '0' && c <= '9') { + if (c >= '0' && c <= '9') + { mac_addr[x / 2] |= (c - '0') << ((x & 1) ? 0 : 4); x++; - } else if (c >= 'A' && c <= 'F') { + } + else if (c >= 'A' && c <= 'F') + { mac_addr[x / 2] |= (c - 'A' + 10) << ((x & 1) ? 0 : 4); x++; - } else if (c >= 'a' && c <= 'f') { + } + else if (c >= 'a' && c <= 'f') + { mac_addr[x / 2] |= (c - 'a' + 10) << ((x & 1) ? 0 : 4); x++; } } @@ -496,7 +501,7 @@ inline u8 CEXIETHERNET::HashIndex(u8 *dest_eth_addr) crc <<= 1; cur_byte >>= 1; if (carry) - crc = (crc ^ 0x4c11db6) | carry; + crc = (crc ^ 0x4c11db6) | carry; } } diff --git a/Source/Core/Core/Src/HW/EXI_DeviceEthernet.h b/Source/Core/Core/Src/HW/EXI_DeviceEthernet.h index 0ee352eea5..1ae90a5bf1 100644 --- a/Source/Core/Core/Src/HW/EXI_DeviceEthernet.h +++ b/Source/Core/Core/Src/HW/EXI_DeviceEthernet.h @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #ifndef _EXIDEVICE_ETHERNET_H diff --git a/Source/Core/Core/Src/HW/EXI_DeviceGecko.cpp b/Source/Core/Core/Src/HW/EXI_DeviceGecko.cpp index bcb2c27f03..6dfe1d3d28 100644 --- a/Source/Core/Core/Src/HW/EXI_DeviceGecko.cpp +++ b/Source/Core/Core/Src/HW/EXI_DeviceGecko.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #include diff --git a/Source/Core/Core/Src/HW/EXI_DeviceGecko.h b/Source/Core/Core/Src/HW/EXI_DeviceGecko.h index da055b3c8a..d7804bf50e 100644 --- a/Source/Core/Core/Src/HW/EXI_DeviceGecko.h +++ b/Source/Core/Core/Src/HW/EXI_DeviceGecko.h @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #ifndef _EXIDEVICE_GECKO_H diff --git a/Source/Core/Core/Src/HW/EXI_DeviceIPL.cpp b/Source/Core/Core/Src/HW/EXI_DeviceIPL.cpp index ec8c29cc77..01e9b0d980 100644 --- a/Source/Core/Core/Src/HW/EXI_DeviceIPL.cpp +++ b/Source/Core/Core/Src/HW/EXI_DeviceIPL.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #include "Common.h" @@ -128,7 +128,7 @@ CEXIIPL::CEXIIPL() : memset(m_RTC, 0, sizeof(m_RTC)); - // We Overwrite language selection 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 g_SRAM.lang = SConfig::GetInstance().m_LocalCoreStartupParameter.SelectedLanguage; WriteProtectMemory(m_pIPL, ROM_SIZE); diff --git a/Source/Core/Core/Src/HW/EXI_DeviceIPL.h b/Source/Core/Core/Src/HW/EXI_DeviceIPL.h index bce8fee9ed..231c068265 100644 --- a/Source/Core/Core/Src/HW/EXI_DeviceIPL.h +++ b/Source/Core/Core/Src/HW/EXI_DeviceIPL.h @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #ifndef _EXIDEVICE_IPL_H diff --git a/Source/Core/Core/Src/HW/EXI_DeviceMemoryCard.cpp b/Source/Core/Core/Src/HW/EXI_DeviceMemoryCard.cpp index 8030eb1b57..4e9a104231 100644 --- a/Source/Core/Core/Src/HW/EXI_DeviceMemoryCard.cpp +++ b/Source/Core/Core/Src/HW/EXI_DeviceMemoryCard.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #include "Common.h" @@ -216,7 +216,9 @@ void CEXIMemoryCard::SetCS(int cs) } if (cs) // not-selected to selected + { m_uPosition = 0; + } else { switch (command) diff --git a/Source/Core/Core/Src/HW/EXI_DeviceMemoryCard.h b/Source/Core/Core/Src/HW/EXI_DeviceMemoryCard.h index 33b94ca530..c173255e82 100644 --- a/Source/Core/Core/Src/HW/EXI_DeviceMemoryCard.h +++ b/Source/Core/Core/Src/HW/EXI_DeviceMemoryCard.h @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #ifndef _EXI_DEVICEMEMORYCARD_H diff --git a/Source/Core/Core/Src/HW/EXI_DeviceMic.cpp b/Source/Core/Core/Src/HW/EXI_DeviceMic.cpp index f1266d4c45..1c34369f91 100644 --- a/Source/Core/Core/Src/HW/EXI_DeviceMic.cpp +++ b/Source/Core/Core/Src/HW/EXI_DeviceMic.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #include "Common.h" diff --git a/Source/Core/Core/Src/HW/EXI_DeviceMic.h b/Source/Core/Core/Src/HW/EXI_DeviceMic.h index b9596ba85a..44192831b8 100644 --- a/Source/Core/Core/Src/HW/EXI_DeviceMic.h +++ b/Source/Core/Core/Src/HW/EXI_DeviceMic.h @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #ifndef _EXI_DEVICEMIC_H diff --git a/Source/Core/Core/Src/HW/GCMemcard.cpp b/Source/Core/Core/Src/HW/GCMemcard.cpp index a2c9690b4e..c740ab6ad6 100644 --- a/Source/Core/Core/Src/HW/GCMemcard.cpp +++ b/Source/Core/Core/Src/HW/GCMemcard.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #include "GCMemcard.h" #include "ColorUtil.h" @@ -63,7 +63,7 @@ void decodeCI8image(u32* dst, u8* src, u16* pal, int width, int height) GCMemcard::GCMemcard(const char *filename, bool forceCreation, bool sjis) : m_valid(false) , m_fileName(filename) -{ +{ File::IOFile mcdFile(m_fileName, "r+b"); if (!mcdFile.IsOpen()) { @@ -303,19 +303,24 @@ u32 GCMemcard::TestChecksums() const u32 results = 0; calc_checksumsBE((u16*)&hdr, 0xFE , &csum, &csum_inv); - if ((hdr.Checksum != csum) || (hdr.Checksum_Inv != csum_inv)) results |= 1; + if ((hdr.Checksum != csum) || (hdr.Checksum_Inv != csum_inv)) + results |= 1; calc_checksumsBE((u16*)&dir, 0xFFE, &csum, &csum_inv); - if ((dir.Checksum != csum) || (dir.Checksum_Inv != csum_inv)) results |= 2; + if ((dir.Checksum != csum) || (dir.Checksum_Inv != csum_inv)) + results |= 2; calc_checksumsBE((u16*)&dir_backup, 0xFFE, &csum, &csum_inv); - if ((dir_backup.Checksum != csum) || (dir_backup.Checksum_Inv != csum_inv)) results |= 4; + if ((dir_backup.Checksum != csum) || (dir_backup.Checksum_Inv != csum_inv)) + results |= 4; calc_checksumsBE((u16*)(((u8*)&bat)+4), 0xFFE, &csum, &csum_inv); - if ((bat.Checksum != csum) || (bat.Checksum_Inv != csum_inv)) results |= 8; + if ((bat.Checksum != csum) || (bat.Checksum_Inv != csum_inv)) + results |= 8; calc_checksumsBE((u16*)(((u8*)&bat_backup)+4), 0xFFE, &csum, &csum_inv); - if ((bat_backup.Checksum != csum) || (bat_backup.Checksum_Inv != csum_inv)) results |= 16; + if ((bat_backup.Checksum != csum) || (bat_backup.Checksum_Inv != csum_inv)) + results |= 16; return results; } @@ -352,7 +357,6 @@ u8 GCMemcard::GetFileIndex(u8 fileNumber) const { if (m_valid) { - u8 j = 0; for (u8 i = 0; i < DIRLEN; i++) { @@ -399,6 +403,7 @@ bool GCMemcard::GCI_FileName(u8 index, std::string &filename) const { if (!m_valid || index > DIRLEN || (BE32(CurrentDir->Dir[index].Gamecode) == 0xFFFFFFFF)) return false; + filename = std::string((char*)CurrentDir->Dir[index].Gamecode, 4) + '_' + (char*)CurrentDir->Dir[index].Filename + ".gci"; return true; } @@ -410,6 +415,7 @@ std::string GCMemcard::DEntry_GameCode(u8 index) const { if (!m_valid || index > DIRLEN) return ""; + return std::string((const char*)CurrentDir->Dir[index].Gamecode, 4); } @@ -439,6 +445,7 @@ std::string GCMemcard::DEntry_FileName(u8 index) const { if (!m_valid || index > DIRLEN) return ""; + return std::string((const char*)CurrentDir->Dir[index].Filename, DENTRY_STRLEN); } @@ -446,6 +453,7 @@ u32 GCMemcard::DEntry_ModTime(u8 index) const { if (!m_valid || index > DIRLEN) return 0xFFFFFFFF; + return BE32(CurrentDir->Dir[index].ModTime); } @@ -453,6 +461,7 @@ u32 GCMemcard::DEntry_ImageOffset(u8 index) const { if (!m_valid || index > DIRLEN) return 0xFFFFFFFF; + return BE32(CurrentDir->Dir[index].ImageOffset); } @@ -460,6 +469,7 @@ std::string GCMemcard::DEntry_IconFmt(u8 index) const { if (!m_valid || index > DIRLEN) return ""; + int x = CurrentDir->Dir[index].IconFmt[0]; std::string format; for(int i = 0; i < 16; i++) @@ -475,6 +485,7 @@ std::string GCMemcard::DEntry_AnimSpeed(u8 index) const { if (!m_valid || index > DIRLEN) return ""; + int x = CurrentDir->Dir[index].AnimSpeed[0]; std::string speed; for(int i = 0; i < 16; i++) @@ -490,6 +501,7 @@ std::string GCMemcard::DEntry_Permissions(u8 index) const { if (!m_valid || index > DIRLEN) return ""; + u8 Permissions = CurrentDir->Dir[index].Permissions; std::string permissionsString; permissionsString.push_back((Permissions & 16) ? 'x' : 'M'); @@ -502,6 +514,7 @@ u8 GCMemcard::DEntry_CopyCounter(u8 index) const { if (!m_valid || index > DIRLEN) return 0xFF; + return CurrentDir->Dir[index].CopyCounter; } @@ -529,6 +542,7 @@ u32 GCMemcard::DEntry_CommentsAddress(u8 index) const { if (!m_valid || index > DIRLEN) return 0xFFFF; + return BE32(CurrentDir->Dir[index].CommentsAddr); } @@ -565,6 +579,7 @@ bool GCMemcard::GetDEntry(u8 index, DEntry &dest) const { if (!m_valid || index > DIRLEN) return false; + dest = CurrentDir->Dir[index]; return true; } @@ -573,6 +588,7 @@ u16 GCMemcard::BlockAlloc::GetNextBlock(u16 Block) const { if ((Block < MC_FST_BLOCKS) || (Block > 4091)) return 0; + return Common::swap16(Map[Block-MC_FST_BLOCKS]); } @@ -583,6 +599,7 @@ u16 GCMemcard::BlockAlloc::NextFreeBlock(u16 StartingBlock) const for (u16 i = StartingBlock; i < BAT_SIZE; ++i) if (Map[i-MC_FST_BLOCKS] == 0) return i; + for (u16 i = MC_FST_BLOCKS; i < StartingBlock; ++i) if (Map[i-MC_FST_BLOCKS] == 0) return i; @@ -1364,13 +1381,13 @@ s32 GCMemcard::FZEROGX_MakeSaveGameValid(DEntry& direntry, std::vector } // set new checksum - *(u16*)&FileBuffer[0].block[0x00] = BE16(~chksum); + *(u16*)&FileBuffer[0].block[0x00] = BE16(~chksum); return 1; } /***********************************************************/ -/* PSO_MakeSaveGameValid */ +/* PSO_MakeSaveGameValid */ /* (use just before writing a PSO system .gci file) */ /* */ /* chn: Destination memory card port */ @@ -1391,13 +1408,13 @@ s32 GCMemcard::PSO_MakeSaveGameValid(DEntry& direntry, std::vector &Fi // check for PSO3 system file if (strcmp((char*)direntry.Filename,"PSO3_SYSTEM")==0) { - // PSO3 data block size adjustment + // PSO3 data block size adjustment pso3offset = 0x10; } else { // nothing to do - return 0; + return 0; } } @@ -1410,28 +1427,30 @@ s32 GCMemcard::PSO_MakeSaveGameValid(DEntry& direntry, std::vector &Fi // generate crc32 LUT for (i=0; i < 256; i++) - { + { chksum = i; - for (j=8; j > 0; j--) + for (j=8; j > 0; j--) { - if (chksum&1) chksum = (chksum>>1)^0xEDB88320; - else chksum >>= 1; + if (chksum & 1) + chksum = (chksum>>1)^0xEDB88320; + else + chksum >>= 1; } - crc32LUT[i] = chksum; + crc32LUT[i] = chksum; } // PSO initial crc32 value - chksum = 0xDEBB20E3; + chksum = 0xDEBB20E3; // calc 32-bit checksum for (i=0x004C; i < 0x0164+pso3offset; i++) - { + { chksum = ((chksum>>8)&0xFFFFFF)^crc32LUT[(chksum^FileBuffer[1].block[i])&0xFF]; } // set new checksum - *(u32*)&FileBuffer[1].block[0x0048] = BE32(chksum^0xFFFFFFFF); + *(u32*)&FileBuffer[1].block[0x0048] = BE32(chksum^0xFFFFFFFF); return 1; } diff --git a/Source/Core/Core/Src/HW/GCMemcard.h b/Source/Core/Core/Src/HW/GCMemcard.h index 557187b384..c51ee7a86e 100644 --- a/Source/Core/Core/Src/HW/GCMemcard.h +++ b/Source/Core/Core/Src/HW/GCMemcard.h @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #ifndef __GCMEMCARD_h__ @@ -104,7 +104,8 @@ private: u8 Unused2[7680]; //0x0200 0x1e00 unused (0xff) } hdr; - struct DEntry { + struct DEntry + { u8 Gamecode[4]; //0x00 0x04 Gamecode u8 Makercode[2]; //0x04 0x02 Makercode u8 Unused1; //0x06 0x01 reserved/unused (always 0xff, has no effect) @@ -113,12 +114,12 @@ private: // 2 Icon Animation 0: forward 1: ping-pong // 1 [--0: No Banner 1: Banner present--] WRONG! YAGCD LIES! // 0 [--Banner Color 0: RGB5A3 1: CI8--] WRONG! YAGCD LIES! - // bits 0 and 1: image format + // bits 0 and 1: image format // 00 no banner // 01 CI8 banner // 10 RGB5A3 banner // 11 ? maybe ==00? Time Splitters 2 and 3 have it and don't have banner - // + // u8 Filename[DENTRY_STRLEN]; //0x08 0x20 filename u8 ModTime[4]; //0x28 0x04 Time of file's last modification in seconds since 12am, January 1st, 2000 u8 ImageOffset[4]; //0x2c 0x04 image data offset @@ -128,20 +129,20 @@ private: // 01 CI8 with a shared color palette after the last frame // 10 RGB5A3 // 11 CI8 with a unique color palette after itself - // + // u8 AnimSpeed[2]; //0x32 0x02 animation speed (2bits per icon) (*1) // bits Description // 00 no icon // 01 Icon lasts for 4 frames // 10 Icon lasts for 8 frames // 11 Icon lasts for 12 frames - // + // u8 Permissions; //0x34 0x01 file-permissions // bit permission Description // 4 no move File cannot be moved by the IPL // 3 no copy File cannot be copied by the IPL // 2 public Can be read by any game - // + // u8 CopyCounter; //0x35 0x01 copy counter (*2) u8 FirstBlock[2]; //0x36 0x02 block no of first block of file (0 == offset 0) u8 BlockCount[2]; //0x38 0x02 file-length (number of blocks in file) @@ -149,8 +150,9 @@ private: u8 CommentsAddr[4]; //0x3c 0x04 Address of the two comments within the file data (*3) }; - struct Directory { - DEntry Dir[DIRLEN]; //0x0000 Directory Entries (max 127) + struct Directory + { + DEntry Dir[DIRLEN]; //0x0000 Directory Entries (max 127) u8 Padding[0x3a]; u16 UpdateCounter; //0x1ffa 2 update Counter u16 Checksum; //0x1ffc 2 Additive Checksum @@ -158,7 +160,8 @@ private: } dir, dir_backup; Directory *CurrentDir, *PreviousDir; - struct BlockAlloc { + struct BlockAlloc + { u16 Checksum; //0x0000 2 Additive Checksum u16 Checksum_Inv; //0x0002 2 Inverse Checksum u16 UpdateCounter; //0x0004 2 update Counter diff --git a/Source/Core/Core/Src/HW/GCPad.cpp b/Source/Core/Core/Src/HW/GCPad.cpp index d764fcdf8a..afecb2b97e 100644 --- a/Source/Core/Core/Src/HW/GCPad.cpp +++ b/Source/Core/Core/Src/HW/GCPad.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #include "Common.h" diff --git a/Source/Core/Core/Src/HW/GCPad.h b/Source/Core/Core/Src/HW/GCPad.h index fb07e82ccc..daa2cbb682 100644 --- a/Source/Core/Core/Src/HW/GCPad.h +++ b/Source/Core/Core/Src/HW/GCPad.h @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #include "CommonTypes.h" diff --git a/Source/Core/Core/Src/HW/GCPadEmu.cpp b/Source/Core/Core/Src/HW/GCPadEmu.cpp index a2c0c2afa9..222dd41f6e 100644 --- a/Source/Core/Core/Src/HW/GCPadEmu.cpp +++ b/Source/Core/Core/Src/HW/GCPadEmu.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #include "GCPadEmu.h" @@ -56,11 +56,11 @@ const char* const named_triggers[] = // i18n: Left _trans("L"), // i18n: Right - _trans("R"), + _trans("R"), // i18n: Left-Analog - _trans("L-Analog"), + _trans("L-Analog"), // i18n: Right-Analog - _trans("R-Analog") + _trans("R-Analog") }; GCPad::GCPad(const unsigned int index) : m_index(index) @@ -93,7 +93,6 @@ GCPad::GCPad(const unsigned int index) : m_index(index) // options groups.push_back(m_options = new ControlGroup(_trans("Options"))); m_options->settings.push_back(new ControlGroup::Setting(_trans("Background Input"), false)); - } std::string GCPad::GetName() const diff --git a/Source/Core/Core/Src/HW/GCPadEmu.h b/Source/Core/Core/Src/HW/GCPadEmu.h index e57e6b0b68..0d8acc8c26 100644 --- a/Source/Core/Core/Src/HW/GCPadEmu.h +++ b/Source/Core/Core/Src/HW/GCPadEmu.h @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #ifndef _CONEMU_GCPAD_H_ diff --git a/Source/Core/Core/Src/HW/GPFifo.cpp b/Source/Core/Core/Src/HW/GPFifo.cpp index a7f7bd967b..26821aaad7 100644 --- a/Source/Core/Core/Src/HW/GPFifo.cpp +++ b/Source/Core/Core/Src/HW/GPFifo.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #include "Common.h" @@ -74,14 +74,14 @@ void STACKALIGN CheckGatherPipe() u32 cnt; u8* curMem = Memory::GetPointer(ProcessorInterface::Fifo_CPUWritePointer); for (cnt = 0; m_gatherPipeCount >= GATHER_PIPE_SIZE; cnt += GATHER_PIPE_SIZE) - { + { // copy the GatherPipe memcpy(curMem, m_gatherPipe + cnt, GATHER_PIPE_SIZE); m_gatherPipeCount -= GATHER_PIPE_SIZE; // increase the CPUWritePointer if (ProcessorInterface::Fifo_CPUWritePointer == ProcessorInterface::Fifo_CPUEnd) - { + { ProcessorInterface::Fifo_CPUWritePointer = ProcessorInterface::Fifo_CPUBase; curMem = Memory::GetPointer(ProcessorInterface::Fifo_CPUWritePointer); } diff --git a/Source/Core/Core/Src/HW/GPFifo.h b/Source/Core/Core/Src/HW/GPFifo.h index efd9108c3d..6bf910cf03 100644 --- a/Source/Core/Core/Src/HW/GPFifo.h +++ b/Source/Core/Core/Src/HW/GPFifo.h @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #ifndef _GPFIFO_H diff --git a/Source/Core/Core/Src/HW/HW.cpp b/Source/Core/Core/Src/HW/HW.cpp index 070c043166..c1588ae469 100644 --- a/Source/Core/Core/Src/HW/HW.cpp +++ b/Source/Core/Core/Src/HW/HW.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #include "Common.h" @@ -59,6 +59,7 @@ namespace HW ExpansionInterface::Init(); CCPU::Init(SConfig::GetInstance().m_LocalCoreStartupParameter.iCPUCore); SystemTimers::Init(); + if (SConfig::GetInstance().m_LocalCoreStartupParameter.bWii) { WII_IPCInterface::Init(); @@ -70,7 +71,7 @@ namespace HW { SystemTimers::Shutdown(); CCPU::Shutdown(); - ExpansionInterface::Shutdown(); + ExpansionInterface::Shutdown(); DVDInterface::Shutdown(); DSP::Shutdown(); Memory::Shutdown(); @@ -82,7 +83,7 @@ namespace HW WII_IPCInterface::Shutdown(); WII_IPC_HLE_Interface::Shutdown(); } - + State::Shutdown(); CoreTiming::Shutdown(); } @@ -107,6 +108,7 @@ namespace HW p.DoMarker("ExpansionInterface"); AudioInterface::DoState(p); p.DoMarker("AudioInterface"); + if (SConfig::GetInstance().m_LocalCoreStartupParameter.bWii) { WII_IPCInterface::DoState(p); @@ -114,6 +116,7 @@ namespace HW WII_IPC_HLE_Interface::DoState(p); p.DoMarker("WII_IPC_HLE_Interface"); } + p.DoMarker("WIIHW"); } } diff --git a/Source/Core/Core/Src/HW/HW.h b/Source/Core/Core/Src/HW/HW.h index cd3375d3ac..d265682863 100644 --- a/Source/Core/Core/Src/HW/HW.h +++ b/Source/Core/Core/Src/HW/HW.h @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #ifndef _HW_H diff --git a/Source/Core/Core/Src/HW/Memmap.cpp b/Source/Core/Core/Src/HW/Memmap.cpp index 6a6fb14212..41757ad563 100644 --- a/Source/Core/Core/Src/HW/Memmap.cpp +++ b/Source/Core/Core/Src/HW/Memmap.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ /* @@ -129,10 +129,13 @@ void HW_Default_Read(T _Data, const u32 _Address){ ERROR_LOG(MASTER_LOG, "Illega #define PAGE_SIZE (1 << PAGE_SHIFT) #define PAGE_MASK (PAGE_SHIFT - 1) -template void HW_Read_Memory(T &_Data, const u32 _Address) { +template void HW_Read_Memory(T &_Data, const u32 _Address) +{ _Data = *(T *)&P[_Address & PAGE_MASK]; } -template void HW_Write_Memory(T _Data, const u32 _Address) { + +template void HW_Write_Memory(T _Data, const u32 _Address) +{ *(T *)&P[_Address & PAGE_MASK] = _Data; } @@ -181,7 +184,7 @@ void InitHWMemFuncs() { hwRead16 [CP_START+i] = g_video_backend->Video_CPRead16(); hwWrite16[CP_START+i] = g_video_backend->Video_CPWrite16(); - + hwRead16 [PE_START+i] = g_video_backend->Video_PERead16(); hwWrite16[PE_START+i] = g_video_backend->Video_PEWrite16(); hwWrite32[PE_START+i] = g_video_backend->Video_PEWrite32(); @@ -254,7 +257,7 @@ void InitHWMemFuncsWii() { hwRead16 [CP_START+i] = g_video_backend->Video_CPRead16(); hwWrite16[CP_START+i] = g_video_backend->Video_CPWrite16(); - + hwRead16 [PE_START+i] = g_video_backend->Video_PERead16(); hwWrite16[PE_START+i] = g_video_backend->Video_PEWrite16(); hwWrite32[PE_START+i] = g_video_backend->Video_PEWrite32(); @@ -425,17 +428,17 @@ void WriteBigEData(const u8 *_pData, const u32 _Address, const u32 _iSize) } void Memset(const u32 _Address, const u8 _iValue, const u32 _iLength) -{ - u8 *ptr = GetPointer(_Address); - if (ptr != NULL) - { - memset(ptr,_iValue,_iLength); - } - else - { - for (u32 i = 0; i < _iLength; i++) - Write_U8(_iValue, _Address + i); - } +{ + u8 *ptr = GetPointer(_Address); + if (ptr != NULL) + { + memset(ptr,_iValue,_iLength); + } + else + { + for (u32 i = 0; i < _iLength; i++) + Write_U8(_iValue, _Address + i); + } } void DMA_LCToMemory(const u32 _MemAddr, const u32 _CacheAddr, const u32 _iNumBlocks) @@ -443,18 +446,18 @@ void DMA_LCToMemory(const u32 _MemAddr, const u32 _CacheAddr, const u32 _iNumBlo const u8 *src = GetCachePtr() + (_CacheAddr & 0x3FFFF); u8 *dst = GetPointer(_MemAddr); - if ((dst != NULL) && (src != NULL) && (_MemAddr & 3) == 0 && (_CacheAddr & 3) == 0) - { - memcpy(dst, src, 32 * _iNumBlocks); - } - else - { - for (u32 i = 0; i < 32 * _iNumBlocks; i++) - { - u8 Temp = Read_U8(_CacheAddr + i); - Write_U8(Temp, _MemAddr + i); - } - } + if ((dst != NULL) && (src != NULL) && (_MemAddr & 3) == 0 && (_CacheAddr & 3) == 0) + { + memcpy(dst, src, 32 * _iNumBlocks); + } + else + { + for (u32 i = 0; i < 32 * _iNumBlocks; i++) + { + u8 Temp = Read_U8(_CacheAddr + i); + Write_U8(Temp, _MemAddr + i); + } + } } void DMA_MemoryToLC(const u32 _CacheAddr, const u32 _MemAddr, const u32 _iNumBlocks) @@ -462,18 +465,18 @@ void DMA_MemoryToLC(const u32 _CacheAddr, const u32 _MemAddr, const u32 _iNumBlo const u8 *src = GetPointer(_MemAddr); u8 *dst = GetCachePtr() + (_CacheAddr & 0x3FFFF); - if ((dst != NULL) && (src != NULL) && (_MemAddr & 3) == 0 && (_CacheAddr & 3) == 0) - { - memcpy(dst, src, 32 * _iNumBlocks); - } - else - { - for (u32 i = 0; i < 32 * _iNumBlocks; i++) - { - u8 Temp = Read_U8(_MemAddr + i); - Write_U8(Temp, _CacheAddr + i); - } - } + if ((dst != NULL) && (src != NULL) && (_MemAddr & 3) == 0 && (_CacheAddr & 3) == 0) + { + memcpy(dst, src, 32 * _iNumBlocks); + } + else + { + for (u32 i = 0; i < 32 * _iNumBlocks; i++) + { + u8 Temp = Read_U8(_MemAddr + i); + Write_U8(Temp, _CacheAddr + i); + } + } } void ReadBigEData(u8 *data, const u32 em_address, const u32 size) diff --git a/Source/Core/Core/Src/HW/Memmap.h b/Source/Core/Core/Src/HW/Memmap.h index 8662804185..85deac8fce 100644 --- a/Source/Core/Core/Src/HW/Memmap.h +++ b/Source/Core/Core/Src/HW/Memmap.h @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #ifndef _MEMMAP_H @@ -70,11 +70,11 @@ enum FAKEVMEM_MASK = FAKEVMEM_SIZE - 1, L1_CACHE_SIZE = 0x40000, L1_CACHE_MASK = L1_CACHE_SIZE - 1, - EFB_SIZE = 0x200000, - EFB_MASK = EFB_SIZE - 1, - IO_SIZE = 0x10000, - EXRAM_SIZE = 0x4000000, - EXRAM_MASK = EXRAM_SIZE - 1, + EFB_SIZE = 0x200000, + EFB_MASK = EFB_SIZE - 1, + IO_SIZE = 0x10000, + EXRAM_SIZE = 0x4000000, + EXRAM_MASK = EXRAM_SIZE - 1, ADDR_MASK_HW_ACCESS = 0x0c000000, ADDR_MASK_MEM1 = 0x20000000, diff --git a/Source/Core/Core/Src/HW/MemmapFunctions.cpp b/Source/Core/Core/Src/HW/MemmapFunctions.cpp index e01eedaaab..39c852ec22 100644 --- a/Source/Core/Core/Src/HW/MemmapFunctions.cpp +++ b/Source/Core/Core/Src/HW/MemmapFunctions.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #include "Common.h" @@ -227,11 +227,15 @@ inline void WriteToHardware(u32 em_address, const T data, u32 effective_address, { int x = (em_address & 0xfff) >> 2; int y = (em_address >> 12) & 0x3ff; + // TODO figure out a way to send data without falling into the template trap - if (em_address & 0x00400000) { + if (em_address & 0x00400000) + { g_video_backend->Video_AccessEFB(POKE_Z, x, y, (u32)data); DEBUG_LOG(MEMMAP, "EFB Z Write %08x @ %i, %i", (u32)data, x, y); - } else { + } + else + { g_video_backend->Video_AccessEFB(POKE_COLOR, x, y,(u32)data); DEBUG_LOG(MEMMAP, "EFB Color Write %08x @ %i, %i", (u32)data, x, y); } @@ -331,18 +335,20 @@ u32 Read_Opcode(u32 _Address) return 0; } else + { _Address = tlb_addr; + } } return PowerPC::ppcState.iCache.ReadInstruction(_Address); } u8 Read_U8(const u32 _Address) -{ +{ u8 _var = 0; ReadFromHardware(_var, _Address, _Address, FLAG_READ); #ifdef ENABLE_MEM_CHECK - TMemCheck *mc = PowerPC::memchecks.GetMemCheck(_Address); + TMemCheck *mc = PowerPC::memchecks.GetMemCheck(_Address); if (mc) { mc->numHits++; @@ -369,7 +375,7 @@ u16 Read_U16(const u32 _Address) u32 Read_U32(const u32 _Address) { - u32 _var = 0; + u32 _var = 0; ReadFromHardware(_var, _Address, _Address, FLAG_READ); #ifdef ENABLE_MEM_CHECK TMemCheck *mc = PowerPC::memchecks.GetMemCheck(_Address); @@ -451,14 +457,15 @@ void Write_U32(const u32 _Data, const u32 _Address) #endif WriteToHardware(_Address, _Data, _Address, FLAG_WRITE); } -void Write_U32_Swap(const u32 _Data, const u32 _Address) { +void Write_U32_Swap(const u32 _Data, const u32 _Address) +{ Write_U32(Common::swap32(_Data), _Address); } void Write_U64(const u64 _Data, const u32 _Address) { #ifdef ENABLE_MEM_CHECK - TMemCheck *mc = PowerPC::memchecks.GetMemCheck(_Address); + TMemCheck *mc = PowerPC::memchecks.GetMemCheck(_Address); if (mc) { mc->numHits++; @@ -491,7 +498,7 @@ void WriteUnchecked_U8(const u8 _iValue, const u32 _Address) { WriteToHardware(_Address, _iValue, _Address, FLAG_NO_EXCEPTION); } - + void WriteUnchecked_U32(const u32 _iValue, const u32 _Address) { @@ -571,7 +578,7 @@ union UPTE1 u32 API : 6; u32 H : 1; u32 VSID : 24; - u32 V : 1; + u32 V : 1; }; u32 Hex; }; @@ -817,8 +824,8 @@ u32 TranslatePageAddress(const u32 _Address, const XCheckTLBFlag _Flag) u32 pteg_addr = ((hash1 & pagetable_hashmask) << 6) | pagetable_base; // hash1 - for (int i = 0; i < 8; i++) - { + for (int i = 0; i < 8; i++) + { UPTE1 PTE1; PTE1.Hex = bswap(*(u32*)&pRAM[pteg_addr]); @@ -838,7 +845,7 @@ u32 TranslatePageAddress(const u32 _Address, const XCheckTLBFlag _Flag) case FLAG_WRITE: PTE2.C = 1; break; case FLAG_NO_EXCEPTION: break; case FLAG_OPCODE: break; - } + } *(u32*)&pRAM[(pteg_addr + 4)] = bswap(PTE2.Hex); return ((PTE2.RPN << 12) | offset); @@ -851,11 +858,11 @@ u32 TranslatePageAddress(const u32 _Address, const XCheckTLBFlag _Flag) hash1 = ~hash1; pteg_addr = ((hash1 & pagetable_hashmask) << 6) | pagetable_base; for (int i = 0; i < 8; i++) - { + { u32 pte = bswap(*(u32*)&pRAM[pteg_addr]); - if ((pte & PTE1_V) && (pte & PTE1_H)) + if ((pte & PTE1_V) && (pte & PTE1_H)) { - if (VSID == PTE1_VSID(pte) && (api == PTE1_API(pte))) + if (VSID == PTE1_VSID(pte) && (api == PTE1_API(pte))) { UPTE2 PTE2; PTE2.Hex = bswap((*(u32*)&pRAM[(pteg_addr + 4)])); @@ -898,7 +905,8 @@ u32 TranslateBlockAddress(const u32 addr, const XCheckTLBFlag _Flag) // Check for enhanced mode (secondary BAT enable) using 8 BATs int bats = (Core::g_CoreStartupParameter.bWii && HID4.SBE)?8:4; - for (int i = 0; i < bats; i++) { + for (int i = 0; i < bats; i++) + { if (_Flag != FLAG_OPCODE) { u32 bl17 = ~(BATU_BL(PowerPC::ppcState.spr[SPR_DBAT0U + i * 2]) << 17); @@ -966,7 +974,9 @@ u32 TranslateAddress(const u32 _Address, const XCheckTLBFlag _Flag) } } else + { return tlb_addr; + } return 0; } diff --git a/Source/Core/Core/Src/HW/MemoryInterface.cpp b/Source/Core/Core/Src/HW/MemoryInterface.cpp index f2d298036c..cc8b5d5ee7 100644 --- a/Source/Core/Core/Src/HW/MemoryInterface.cpp +++ b/Source/Core/Core/Src/HW/MemoryInterface.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #include "Common.h" diff --git a/Source/Core/Core/Src/HW/MemoryInterface.h b/Source/Core/Core/Src/HW/MemoryInterface.h index 3b1470fcc9..992ec5a9fe 100644 --- a/Source/Core/Core/Src/HW/MemoryInterface.h +++ b/Source/Core/Core/Src/HW/MemoryInterface.h @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #ifndef _MEMORYINTERFACE_H #define _MEMORYINTERFACE_H diff --git a/Source/Core/Core/Src/HW/ProcessorInterface.cpp b/Source/Core/Core/Src/HW/ProcessorInterface.cpp index a419f2e8a2..e8d3fe4495 100644 --- a/Source/Core/Core/Src/HW/ProcessorInterface.cpp +++ b/Source/Core/Core/Src/HW/ProcessorInterface.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #include @@ -34,13 +34,13 @@ namespace ProcessorInterface enum { PI_INTERRUPT_CAUSE = 0x00, - PI_INTERRUPT_MASK = 0x04, - PI_FIFO_BASE = 0x0C, - PI_FIFO_END = 0x10, - PI_FIFO_WPTR = 0x14, - PI_FIFO_RESET = 0x18, // ??? - GXAbortFrame writes to it - PI_RESET_CODE = 0x24, - PI_FLIPPER_REV = 0x2C, + PI_INTERRUPT_MASK = 0x04, + PI_FIFO_BASE = 0x0C, + PI_FIFO_END = 0x10, + PI_FIFO_WPTR = 0x14, + PI_FIFO_RESET = 0x18, // ??? - GXAbortFrame writes to it + PI_RESET_CODE = 0x24, + PI_FLIPPER_REV = 0x2C, PI_FLIPPER_UNK = 0x30 // BS1 writes 0x0245248A to it - prolly some bootstrap thing }; @@ -74,9 +74,9 @@ void DoState(PointerWrap &p) p.Do(Fifo_CPUBase); p.Do(Fifo_CPUEnd); p.Do(Fifo_CPUWritePointer); - p.Do(m_Fifo_Reset); - p.Do(m_ResetCode); - p.Do(m_FlipperRev); + p.Do(m_Fifo_Reset); + p.Do(m_ResetCode); + p.Do(m_FlipperRev); p.Do(m_Unknown); } @@ -188,13 +188,13 @@ void Write32(const u32 _uValue, const u32 _iAddress) DEBUG_LOG(PROCESSORINTERFACE,"Fifo writeptr = %08x", _uValue); break; - case PI_FIFO_RESET: + case PI_FIFO_RESET: //Abort the actual frame //g_video_backend->Video_AbortFrame(); - //Fifo_CPUWritePointer = Fifo_CPUBase; ?? + //Fifo_CPUWritePointer = Fifo_CPUBase; ?? //PanicAlert("Unknown write to PI_FIFO_RESET (%08x)", _uValue); WARN_LOG(PROCESSORINTERFACE, "Fifo reset (%08x)", _uValue); - break; + break; case PI_RESET_CODE: DEBUG_LOG(PROCESSORINTERFACE, "Write %08x to PI_RESET_CODE", _uValue); @@ -237,9 +237,9 @@ static const char *Debug_GetInterruptName(u32 _causemask) case INT_CAUSE_PE_FINISH: return "INT_CAUSE_PE_FINISH"; case INT_CAUSE_CP: return "INT_CAUSE_CP"; case INT_CAUSE_DEBUG: return "INT_CAUSE_DEBUG"; - case INT_CAUSE_WII_IPC: return "INT_CAUSE_WII_IPC"; + case INT_CAUSE_WII_IPC: return "INT_CAUSE_WII_IPC"; case INT_CAUSE_HSP: return "INT_CAUSE_HSP"; - case INT_CAUSE_RST_BUTTON: return "INT_CAUSE_RST_BUTTON"; + case INT_CAUSE_RST_BUTTON: return "INT_CAUSE_RST_BUTTON"; default: return "!!! ERROR-unknown Interrupt !!!"; } } @@ -248,15 +248,15 @@ void SetInterrupt(u32 _causemask, bool _bSet) { // TODO(ector): add sanity check that current thread id is cpu thread - if (_bSet && !(m_InterruptCause & _causemask)) - { - DEBUG_LOG(PROCESSORINTERFACE, "Setting Interrupt %s (set)", Debug_GetInterruptName(_causemask)); - } + if (_bSet && !(m_InterruptCause & _causemask)) + { + DEBUG_LOG(PROCESSORINTERFACE, "Setting Interrupt %s (set)", Debug_GetInterruptName(_causemask)); + } if (!_bSet && (m_InterruptCause & _causemask)) - { - DEBUG_LOG(PROCESSORINTERFACE, "Setting Interrupt %s (clear)", Debug_GetInterruptName(_causemask)); - } + { + DEBUG_LOG(PROCESSORINTERFACE, "Setting Interrupt %s (clear)", Debug_GetInterruptName(_causemask)); + } if (_bSet) Common::AtomicOr(m_InterruptCause, _causemask); diff --git a/Source/Core/Core/Src/HW/ProcessorInterface.h b/Source/Core/Core/Src/HW/ProcessorInterface.h index 38301984b2..a54eda61c5 100644 --- a/Source/Core/Core/Src/HW/ProcessorInterface.h +++ b/Source/Core/Core/Src/HW/ProcessorInterface.h @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #ifndef _PROCESSORINTERFACE_H diff --git a/Source/Core/Core/Src/HW/SI.cpp b/Source/Core/Core/Src/HW/SI.cpp index 684247764c..83b9cc321f 100644 --- a/Source/Core/Core/Src/HW/SI.cpp +++ b/Source/Core/Core/Src/HW/SI.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #include "Common.h" @@ -75,8 +75,8 @@ enum union USIChannelOut { u32 Hex; - struct - { + struct + { u32 OUTPUT1 : 8; u32 OUTPUT0 : 8; u32 CMD : 8; @@ -88,8 +88,8 @@ union USIChannelOut union USIChannelIn_Hi { u32 Hex; - struct - { + struct + { u32 INPUT3 : 8; u32 INPUT2 : 8; u32 INPUT1 : 8; @@ -103,7 +103,7 @@ union USIChannelIn_Hi union USIChannelIn_Lo { u32 Hex; - struct + struct { u32 INPUT7 : 8; u32 INPUT6 : 8; @@ -115,7 +115,7 @@ union USIChannelIn_Lo // SI Channel struct SSIChannel { - USIChannelOut m_Out; + USIChannelOut m_Out; USIChannelIn_Hi m_InHi; USIChannelIn_Lo m_InLo; ISIDevice* m_pDevice; @@ -127,16 +127,16 @@ union USIPoll u32 Hex; struct { - u32 VBCPY3 : 1; // 1: write to output buffer only on vblank + u32 VBCPY3 : 1; // 1: write to output buffer only on vblank u32 VBCPY2 : 1; u32 VBCPY1 : 1; u32 VBCPY0 : 1; - u32 EN3 : 1; // Enable polling of channel - u32 EN2 : 1; // does not affect communication RAM transfers + u32 EN3 : 1; // Enable polling of channel + u32 EN2 : 1; // does not affect communication RAM transfers u32 EN1 : 1; u32 EN0 : 1; - u32 Y : 8; // Polls per frame - u32 X : 10; // Polls per X lines. begins at vsync, min 7, max depends on video mode + u32 Y : 8; // Polls per frame + u32 X : 10; // Polls per X lines. begins at vsync, min 7, max depends on video mode u32 : 6; }; }; @@ -220,12 +220,12 @@ union USIEXIClockCount }; // 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 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]; void DoState(PointerWrap &p) { @@ -318,7 +318,7 @@ void Read32(u32& _uReturnValue, const u32 _iAddress) ////////////////////////////////////////////////////////////////////////// // Channel 0 ////////////////////////////////////////////////////////////////////////// - case SI_CHANNEL_0_OUT: + case SI_CHANNEL_0_OUT: _uReturnValue = g_Channel[0].m_Out.Hex; break; @@ -337,7 +337,7 @@ void Read32(u32& _uReturnValue, const u32 _iAddress) ////////////////////////////////////////////////////////////////////////// // Channel 1 ////////////////////////////////////////////////////////////////////////// - case SI_CHANNEL_1_OUT: + case SI_CHANNEL_1_OUT: _uReturnValue = g_Channel[1].m_Out.Hex; break; @@ -356,7 +356,7 @@ void Read32(u32& _uReturnValue, const u32 _iAddress) ////////////////////////////////////////////////////////////////////////// // Channel 2 ////////////////////////////////////////////////////////////////////////// - case SI_CHANNEL_2_OUT: + case SI_CHANNEL_2_OUT: _uReturnValue = g_Channel[2].m_Out.Hex; break; @@ -375,7 +375,7 @@ void Read32(u32& _uReturnValue, const u32 _iAddress) ////////////////////////////////////////////////////////////////////////// // Channel 3 ////////////////////////////////////////////////////////////////////////// - case SI_CHANNEL_3_OUT: + case SI_CHANNEL_3_OUT: _uReturnValue = g_Channel[3].m_Out.Hex; break; @@ -402,7 +402,7 @@ void Read32(u32& _uReturnValue, const u32 _iAddress) default: INFO_LOG(SERIALINTERFACE, "(r32-unk): 0x%08x", _iAddress); - _dbg_assert_(SERIALINTERFACE,0); + _dbg_assert_(SERIALINTERFACE,0); break; } @@ -447,7 +447,7 @@ void Write32(const u32 _iValue, const u32 _iAddress) g_Poll.Hex = _iValue; break; - case SI_COM_CSR: + case SI_COM_CSR: { USIComCSR tmpComCSR(_iValue); diff --git a/Source/Core/Core/Src/HW/SI.h b/Source/Core/Core/Src/HW/SI.h index 26ec8f1218..053843d4dc 100644 --- a/Source/Core/Core/Src/HW/SI.h +++ b/Source/Core/Core/Src/HW/SI.h @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #ifndef _SERIALINTERFACE_H #define _SERIALINTERFACE_H diff --git a/Source/Core/Core/Src/HW/SI_Device.h b/Source/Core/Core/Src/HW/SI_Device.h index ee7357f84e..0f58ea1791 100644 --- a/Source/Core/Core/Src/HW/SI_Device.h +++ b/Source/Core/Core/Src/HW/SI_Device.h @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #ifndef _SIDEVICE_H diff --git a/Source/Core/Core/Src/HW/SI_DeviceAMBaseboard.cpp b/Source/Core/Core/Src/HW/SI_DeviceAMBaseboard.cpp index ec8a41e56e..b3118c6964 100644 --- a/Source/Core/Core/Src/HW/SI_DeviceAMBaseboard.cpp +++ b/Source/Core/Core/Src/HW/SI_DeviceAMBaseboard.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ @@ -76,8 +76,12 @@ public: { m_msg[m_ptr++] = 0xD0; m_msg[m_ptr++] = c - 1; - } else + } + else + { m_msg[m_ptr++] = c; + } + if (!sync) m_csum += c; sync = 0; @@ -104,7 +108,7 @@ int CSIDevice_AMBaseboard::RunBuffer(u8* _pBuffer, int _iLength) { // read the command EBufferCommands command = static_cast(_pBuffer[iPosition ^ 3]); - iPosition ++; + iPosition++; // handle it switch(command) @@ -342,7 +346,7 @@ int CSIDevice_AMBaseboard::RunBuffer(u8* _pBuffer, int _iLength) } break; } - case 0x21: // coin + case 0x21: // coin { int slots = *jvs_io++; msg.addData(1); @@ -441,7 +445,7 @@ int CSIDevice_AMBaseboard::RunBuffer(u8* _pBuffer, int _iLength) ERROR_LOG(SERIALINTERFACE, "Unknown SI command (0x%x)", command); PanicAlert("SI: Unknown command"); iPosition = _iLength; - } + } break; } } diff --git a/Source/Core/Core/Src/HW/SI_DeviceAMBaseboard.h b/Source/Core/Core/Src/HW/SI_DeviceAMBaseboard.h index f2c8b1e8a9..c5ef1dcc0a 100644 --- a/Source/Core/Core/Src/HW/SI_DeviceAMBaseboard.h +++ b/Source/Core/Core/Src/HW/SI_DeviceAMBaseboard.h @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #ifndef _SIDEVICE_AMBASEBOARD_H diff --git a/Source/Core/Core/Src/HW/SI_DeviceGBA.cpp b/Source/Core/Core/Src/HW/SI_DeviceGBA.cpp index 7a9a9a3484..6a0ac8f48e 100644 --- a/Source/Core/Core/Src/HW/SI_DeviceGBA.cpp +++ b/Source/Core/Core/Src/HW/SI_DeviceGBA.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #include "SI_Device.h" diff --git a/Source/Core/Core/Src/HW/SI_DeviceGBA.h b/Source/Core/Core/Src/HW/SI_DeviceGBA.h index 58d5a4f153..50e6c8bcbe 100644 --- a/Source/Core/Core/Src/HW/SI_DeviceGBA.h +++ b/Source/Core/Core/Src/HW/SI_DeviceGBA.h @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #ifndef _SI_DEVICEGBA_H @@ -38,7 +38,7 @@ private: CMD_RESET = 0xff, CMD_STATUS = 0x00, CMD_READ = 0x14, - CMD_WRITE = 0x15 + CMD_WRITE = 0x15 }; sf::SocketTCP client; diff --git a/Source/Core/Core/Src/HW/SI_DeviceGCController.cpp b/Source/Core/Core/Src/HW/SI_DeviceGCController.cpp index 5dc3f3031e..c62299c5df 100644 --- a/Source/Core/Core/Src/HW/SI_DeviceGCController.cpp +++ b/Source/Core/Core/Src/HW/SI_DeviceGCController.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #include @@ -153,7 +153,9 @@ bool CSIDevice_GCController::GetData(u32& _Hi, u32& _Low) Movie::InputUpdate(); } else + { Movie::CheckPadStatus(&PadStatus, ISIDevice::m_iDeviceNumber); + } // Thankfully changing mode does not change the high bits ;) _Hi = (u32)((u8)PadStatus.stickY); @@ -277,7 +279,7 @@ void CSIDevice_GCController::SendCommand(u32 _Cmd, u8 _Poll) { ERROR_LOG(SERIALINTERFACE, "Unknown direct command (0x%x)", _Cmd); PanicAlert("SI: Unknown direct command"); - } + } break; } } diff --git a/Source/Core/Core/Src/HW/SI_DeviceGCController.h b/Source/Core/Core/Src/HW/SI_DeviceGCController.h index b89f433331..694077f8db 100644 --- a/Source/Core/Core/Src/HW/SI_DeviceGCController.h +++ b/Source/Core/Core/Src/HW/SI_DeviceGCController.h @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #ifndef _SI_DEVICEGCCONTROLLER_H @@ -68,7 +68,7 @@ private: u32 : 8; }; UCommand() {Hex = 0;} - UCommand(u32 _iValue) {Hex = _iValue;} + UCommand(u32 _iValue) {Hex = _iValue;} }; enum EButtonCombo diff --git a/Source/Core/Core/Src/HW/SI_DeviceGCSteeringWheel.cpp b/Source/Core/Core/Src/HW/SI_DeviceGCSteeringWheel.cpp index 3c1b634f7b..161139a071 100644 --- a/Source/Core/Core/Src/HW/SI_DeviceGCSteeringWheel.cpp +++ b/Source/Core/Core/Src/HW/SI_DeviceGCSteeringWheel.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #include @@ -88,7 +88,7 @@ int CSIDevice_GCSteeringWheel::RunBuffer(u8* _pBuffer, int _iLength) for (int i = 0; i < (int)sizeof(SOrigin); i++) { _pBuffer[i ^ 3] = *pCalibration++; - } + } } break; @@ -100,7 +100,7 @@ int CSIDevice_GCSteeringWheel::RunBuffer(u8* _pBuffer, int _iLength) default: { ERROR_LOG(SERIALINTERFACE, "Unknown SI command (0x%x)", command); - } + } break; } @@ -143,7 +143,9 @@ bool CSIDevice_GCSteeringWheel::GetData(u32& _Hi, u32& _Low) Movie::InputUpdate(); } else + { Movie::CheckPadStatus(&PadStatus, ISIDevice::m_iDeviceNumber); + } // Thankfully changing mode does not change the high bits ;) _Hi = (u32)((u8)PadStatus.stickX); // Steering @@ -228,7 +230,9 @@ bool CSIDevice_GCSteeringWheel::GetData(u32& _Hi, u32& _Low) if ((m_TButtonCombo - m_TButtonComboStart) > SystemTimers::GetTicksPerSecond() * 3) { if (m_LastButtonCombo == COMBO_RESET) + { ProcessorInterface::ResetButton_Tap(); + } else if (m_LastButtonCombo == COMBO_ORIGIN) { m_Origin.uOriginStickX = PadStatus.stickX; @@ -298,7 +302,7 @@ void CSIDevice_GCSteeringWheel::SendCommand(u32 _Cmd, u8 _Poll) default: { ERROR_LOG(SERIALINTERFACE, "Unknown direct command (0x%x)", _Cmd); - } + } break; } } diff --git a/Source/Core/Core/Src/HW/SI_DeviceGCSteeringWheel.h b/Source/Core/Core/Src/HW/SI_DeviceGCSteeringWheel.h index 2245765863..c4fc0ffcaa 100644 --- a/Source/Core/Core/Src/HW/SI_DeviceGCSteeringWheel.h +++ b/Source/Core/Core/Src/HW/SI_DeviceGCSteeringWheel.h @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #ifndef _SI_DEVICEGCSTEERINGWHEEL_H @@ -69,7 +69,7 @@ private: u32 : 8; }; UCommand() {Hex = 0;} - UCommand(u32 _iValue) {Hex = _iValue;} + UCommand(u32 _iValue) {Hex = _iValue;} }; enum EButtonCombo diff --git a/Source/Core/Core/Src/HW/Sram.cpp b/Source/Core/Core/Src/HW/Sram.cpp index ae811b0bd1..caafd46b06 100644 --- a/Source/Core/Core/Src/HW/Sram.cpp +++ b/Source/Core/Core/Src/HW/Sram.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #include "Sram.h" diff --git a/Source/Core/Core/Src/HW/Sram.h b/Source/Core/Core/Src/HW/Sram.h index 51cbefabb6..c3dd33c5bf 100644 --- a/Source/Core/Core/Src/HW/Sram.h +++ b/Source/Core/Core/Src/HW/Sram.h @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ // Modified code taken from libogc diff --git a/Source/Core/Core/Src/HW/StreamADPCM.cpp b/Source/Core/Core/Src/HW/StreamADPCM.cpp index da0fac6868..b9465603c0 100644 --- a/Source/Core/Core/Src/HW/StreamADPCM.cpp +++ b/Source/Core/Core/Src/HW/StreamADPCM.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ // Adapted from in_cube by hcs & destop diff --git a/Source/Core/Core/Src/HW/StreamADPCM.h b/Source/Core/Core/Src/HW/StreamADPCM.h index 324ee249ae..d60617c6a3 100644 --- a/Source/Core/Core/Src/HW/StreamADPCM.h +++ b/Source/Core/Core/Src/HW/StreamADPCM.h @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ // Adapted from in_cube by hcs & destop diff --git a/Source/Core/Core/Src/HW/SystemTimers.cpp b/Source/Core/Core/Src/HW/SystemTimers.cpp index cebf4267d8..8f0b7dabc8 100644 --- a/Source/Core/Core/Src/HW/SystemTimers.cpp +++ b/Source/Core/Core/Src/HW/SystemTimers.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ diff --git a/Source/Core/Core/Src/HW/SystemTimers.h b/Source/Core/Core/Src/HW/SystemTimers.h index 629593bc1d..331dbf8c85 100644 --- a/Source/Core/Core/Src/HW/SystemTimers.h +++ b/Source/Core/Core/Src/HW/SystemTimers.h @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #ifndef _SYSTEMTIMERS_H diff --git a/Source/Core/Core/Src/HW/VideoInterface.cpp b/Source/Core/Core/Src/HW/VideoInterface.cpp index 9d025edb06..dc671bef12 100644 --- a/Source/Core/Core/Src/HW/VideoInterface.cpp +++ b/Source/Core/Core/Src/HW/VideoInterface.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #include "Common.h" @@ -304,11 +304,11 @@ void Read16(u16& _uReturnValue, const u32 _iAddress) break; case VI_VERTICAL_BEAM_POSITION: - _uReturnValue = m_VBeamPos; + _uReturnValue = m_VBeamPos; return; case VI_HORIZONTAL_BEAM_POSITION: - _uReturnValue = m_HBeamPos; + _uReturnValue = m_HBeamPos; return; // RETRACE STUFF ... @@ -748,9 +748,9 @@ void UpdateParameters() { fields = m_DisplayControlRegister.NIN ? 2 : 1; - switch (m_DisplayControlRegister.FMT) - { - case 0: // NTSC + switch (m_DisplayControlRegister.FMT) + { + case 0: // NTSC TargetRefreshRate = NTSC_FIELD_RATE; TicksPerFrame = SystemTimers::GetTicksPerSecond() / NTSC_FIELD_RATE; s_lineCount = NTSC_LINE_COUNT; @@ -758,30 +758,30 @@ void UpdateParameters() s_lowerFieldBegin = NTSC_LOWER_BEGIN; break; - case 2: // PAL-M + case 2: // PAL-M TargetRefreshRate = NTSC_FIELD_RATE; TicksPerFrame = SystemTimers::GetTicksPerSecond() / NTSC_FIELD_RATE; s_lineCount = PAL_LINE_COUNT; s_upperFieldBegin = PAL_UPPER_BEGIN; s_lowerFieldBegin = PAL_LOWER_BEGIN; - break; + break; - case 1: // PAL + case 1: // PAL TargetRefreshRate = PAL_FIELD_RATE; TicksPerFrame = SystemTimers::GetTicksPerSecond() / PAL_FIELD_RATE; s_lineCount = PAL_LINE_COUNT; s_upperFieldBegin = PAL_UPPER_BEGIN; s_lowerFieldBegin = PAL_LOWER_BEGIN; - break; + break; case 3: // Debug PanicAlert("Debug video mode not implemented"); break; - default: - PanicAlert("Unknown Video Format - CVideoInterface"); - break; - } + default: + PanicAlert("Unknown Video Format - CVideoInterface"); + break; + } } int GetNumFields() diff --git a/Source/Core/Core/Src/HW/VideoInterface.h b/Source/Core/Core/Src/HW/VideoInterface.h index a11e8d6457..869a924c76 100644 --- a/Source/Core/Core/Src/HW/VideoInterface.h +++ b/Source/Core/Core/Src/HW/VideoInterface.h @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #ifndef _VIDEOINTERFACE_H #define _VIDEOINTERFACE_H @@ -33,8 +33,8 @@ namespace VideoInterface // These line numbers indicate the beginning of the "active video" in a frame. // An NTSC frame has the lower field first followed by the upper field. // TODO: Is this true for PAL-M? Is this true for EURGB60? -#define NTSC_LOWER_BEGIN 21 -#define NTSC_UPPER_BEGIN 283 +#define NTSC_LOWER_BEGIN 21 +#define NTSC_UPPER_BEGIN 283 //#define PAL_FIELD_RATE 50.0f #define PAL_FIELD_RATE 50 @@ -48,7 +48,7 @@ namespace VideoInterface enum { VI_VERTICAL_TIMING = 0x00, - VI_CONTROL_REGISTER = 0x02, + VI_CONTROL_REGISTER = 0x02, VI_HORIZONTAL_TIMING_0_HI = 0x04, VI_HORIZONTAL_TIMING_0_LO = 0x06, VI_HORIZONTAL_TIMING_1_HI = 0x08, @@ -83,8 +83,8 @@ enum VI_DISPLAY_LATCH_0_LO = 0x42, VI_DISPLAY_LATCH_1_HI = 0x44, VI_DISPLAY_LATCH_1_LO = 0x46, - VI_HSCALEW = 0x48, - VI_HSCALER = 0x4a, + VI_HSCALEW = 0x48, + VI_HSCALER = 0x4a, VI_FILTER_COEF_0_HI = 0x4c, VI_FILTER_COEF_0_LO = 0x4e, VI_FILTER_COEF_1_HI = 0x50, @@ -340,7 +340,7 @@ union UVIDTVStatus void Read8(u8& _uReturnValue, const u32 _uAddress); void Read16(u16& _uReturnValue, const u32 _uAddress); void Read32(u32& _uReturnValue, const u32 _uAddress); - + void Write16(const u16 _uValue, const u32 _uAddress); void Write32(const u32 _uValue, const u32 _uAddress); @@ -348,14 +348,14 @@ union UVIDTVStatus u8* GetXFBPointerTop(); u8* GetXFBPointerBottom(); - // Update and draw framebuffer - void Update(); + // Update and draw framebuffer + void Update(); // UpdateInterrupts: check if we have to generate a new VI Interrupt void UpdateInterrupts(); - // Change values pertaining to video mode - void UpdateParameters(); + // Change values pertaining to video mode + void UpdateParameters(); unsigned int GetTicksPerLine(); unsigned int GetTicksPerFrame(); diff --git a/Source/Core/Core/Src/HW/WII_IOB.cpp b/Source/Core/Core/Src/HW/WII_IOB.cpp index 843c6bb24a..e8b5fd2460 100644 --- a/Source/Core/Core/Src/HW/WII_IOB.cpp +++ b/Source/Core/Core/Src/HW/WII_IOB.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #include "Common.h" @@ -36,42 +36,42 @@ void Read32(u32& _rReturnValue, const u32 _Address) { switch (_Address & 0xFFFF) { - // NAND Loader ... no idea - case 0x018: - ERROR_LOG(WII_IOB, "IOP: Read32 from 0x18 = 0x%08x (NANDLoader)", _Address); - break; - // WiiMenu... no idea - case 0x24: - ERROR_LOG(WII_IOB, "IOP: Read32 from 0x18 = 0x%08x (WiiMenu)", _Address); - break; + // NAND Loader ... no idea + case 0x018: + ERROR_LOG(WII_IOB, "IOP: Read32 from 0x18 = 0x%08x (NANDLoader)", _Address); + break; + // WiiMenu... no idea + case 0x24: + ERROR_LOG(WII_IOB, "IOP: Read32 from 0x18 = 0x%08x (WiiMenu)", _Address); + break; - case 0xc0: // __VISendI2CData + case 0xc0: // __VISendI2CData _rReturnValue = 0; INFO_LOG(WII_IOB, "IOP: Read32 from 0xc0 = 0x%08x (__VISendI2CData)", _rReturnValue); break; - case 0xc4: // __VISendI2CData + case 0xc4: // __VISendI2CData _rReturnValue = 0; INFO_LOG(WII_IOB, "IOP: Read32 from 0xc4 = 0x%08x (__VISendI2CData)", _rReturnValue); break; - case 0xc8: // __VISendI2CData + case 0xc8: // __VISendI2CData _rReturnValue = 0; INFO_LOG(WII_IOB, "IOP: Read32 from 0xc8 = 0x%08x (__VISendI2CData)", _rReturnValue); break; - case 0x180: // __AIClockInit + case 0x180: // __AIClockInit _rReturnValue = 0; INFO_LOG(WII_IOB, "IOP: Read32 from 0x180 = 0x%08x (__AIClockInit)", _rReturnValue); return; - case 0x1CC: // __AIClockInit + case 0x1CC: // __AIClockInit _rReturnValue = 0; INFO_LOG(WII_IOB, "IOP: Read32 from 0x1CC = 0x%08x (__AIClockInit)", _rReturnValue); return; - case 0x1D0: // __AIClockInit + case 0x1D0: // __AIClockInit _rReturnValue = 0; INFO_LOG(WII_IOB, "IOP: Read32 from 0x1D0 = 0x%08x (__AIClockInit)", _rReturnValue); return; @@ -79,7 +79,7 @@ void Read32(u32& _rReturnValue, const u32 _Address) default: _dbg_assert_msg_(WII_IOB, 0, "IOP: Read32 from 0x%08x", _Address); break; - } + } } void Read64(u64& _rReturnValue, const u32 _Address) @@ -101,43 +101,43 @@ void Write32(const u32 _Value, const u32 _Address) { switch(_Address & 0xFFFF) { - // NANDLoader ... no idea - case 0x18: - ERROR_LOG(WII_IOB, "IOP: Write32 0x%08x to 0x%08x (NANDLoader)", _Value, _Address); - break; - // WiiMenu... no idea - case 0x24: - ERROR_LOG(WII_IOB, "IOP: Write32 0x%08x to 0x%08x (WiiMenu)", _Value, _Address); - break; + // NANDLoader ... no idea + case 0x18: + ERROR_LOG(WII_IOB, "IOP: Write32 0x%08x to 0x%08x (NANDLoader)", _Value, _Address); + break; + // WiiMenu... no idea + case 0x24: + ERROR_LOG(WII_IOB, "IOP: Write32 0x%08x to 0x%08x (WiiMenu)", _Value, _Address); + break; - case 0xc0: // __VISendI2CData + case 0xc0: // __VISendI2CData INFO_LOG(WII_IOB, "IOP: Write32 to 0xc0 = 0x%08x (__VISendI2CData)", _Value); break; - case 0xc4: // __VISendI2CData + case 0xc4: // __VISendI2CData INFO_LOG(WII_IOB, "IOP: Write32 to 0xc4 = 0x%08x (__VISendI2CData)", _Value); break; - case 0xc8: // __VISendI2CData + case 0xc8: // __VISendI2CData INFO_LOG(WII_IOB, "IOP: Write32 to 0xc8 = 0x%08x (__VISendI2CData)", _Value); break; - case 0x180: // __AIClockInit + case 0x180: // __AIClockInit INFO_LOG(WII_IOB, "IOP: Write32 to 0x180 = 0x%08x (__AIClockInit)", _Value); return; - case 0x1CC: // __AIClockInit + case 0x1CC: // __AIClockInit INFO_LOG(WII_IOB, "IOP: Write32 to 0x1D0 = 0x%08x (__AIClockInit)", _Value); return; - case 0x1D0: // __AIClockInit + case 0x1D0: // __AIClockInit INFO_LOG(WII_IOB, "IOP: Write32 to 0x1D0 = 0x%08x (__AIClockInit)", _Value); return; default: _dbg_assert_msg_(WII_IOB, 0, "IOP: Write32 to 0x%08x", _Address); break; - } + } } void Write64(const u64 _Value, const u32 _Address) diff --git a/Source/Core/Core/Src/HW/WII_IOB.h b/Source/Core/Core/Src/HW/WII_IOB.h index 3547ea3688..ebbc49368c 100644 --- a/Source/Core/Core/Src/HW/WII_IOB.h +++ b/Source/Core/Core/Src/HW/WII_IOB.h @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #ifndef _WII_IOBRIDGE_H_ #define _WII_IOBRIDGE_H_ @@ -24,7 +24,7 @@ namespace WII_IOBridge { void Init(); -void Shutdown(); +void Shutdown(); void DoState(PointerWrap &p); void Update(); diff --git a/Source/Core/Core/Src/HW/WII_IPC.cpp b/Source/Core/Core/Src/HW/WII_IPC.cpp index 48d8eae02f..9d3ac8e9df 100644 --- a/Source/Core/Core/Src/HW/WII_IPC.cpp +++ b/Source/Core/Core/Src/HW/WII_IPC.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #include @@ -152,7 +152,7 @@ void Read32(u32& _rReturnValue, const u32 _Address) { switch(_Address & 0xFFFF) { - case IPC_PPCCTRL: + case IPC_PPCCTRL: _rReturnValue = ctrl.ppc(); DEBUG_LOG(WII_IPC, "r32 IPC_PPCCTRL %03x [R:%i A:%i E:%i]", ctrl.ppc(), ctrl.Y1, ctrl.Y2, ctrl.X1); @@ -199,7 +199,7 @@ void Write32(const u32 _Value, const u32 _Address) WII_IPC_HLE_Interface::EnqRequest(ppc_msg); } } - break; + break; case PPC_IRQFLAG: // ACR REGISTER IT IS CALLED IN DEBUG { diff --git a/Source/Core/Core/Src/HW/WII_IPC.h b/Source/Core/Core/Src/HW/WII_IPC.h index 3d4e416c42..864876309c 100644 --- a/Source/Core/Core/Src/HW/WII_IPC.h +++ b/Source/Core/Core/Src/HW/WII_IPC.h @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #ifndef _WII_IPC_H_ #define _WII_IPC_H_ @@ -46,7 +46,7 @@ enum StarletInterruptCause void Init(); void Reset(); -void Shutdown(); +void Shutdown(); void DoState(PointerWrap &p); void Read32(u32& _rReturnValue, const u32 _Address); diff --git a/Source/Core/Core/Src/HW/WiimoteEmu/EmuSubroutines.cpp b/Source/Core/Core/Src/HW/WiimoteEmu/EmuSubroutines.cpp index f9df271248..b111f93c33 100644 --- a/Source/Core/Core/Src/HW/WiimoteEmu/EmuSubroutines.cpp +++ b/Source/Core/Core/Src/HW/WiimoteEmu/EmuSubroutines.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ @@ -163,7 +163,7 @@ void Wiimote::HidOutputReport(const wm_report* const sr, const bool send_ack) case WM_IR_LOGIC: // 0x1a // comment from old plugin: // This enables or disables the IR lights, we update the global variable g_IR - // so that WmRequestStatus() knows about it + // so that WmRequestStatus() knows about it //INFO_LOG(WIIMOTE, "WM IR Enable: 0x%02x", sr->data[0]); m_status.ir = sr->enable; if (false == sr->ack) diff --git a/Source/Core/Core/Src/HW/WiimoteEmu/Encryption.cpp b/Source/Core/Core/Src/HW/WiimoteEmu/Encryption.cpp index 44ea0b3f7d..eaba7d7799 100644 --- a/Source/Core/Core/Src/HW/WiimoteEmu/Encryption.cpp +++ b/Source/Core/Core/Src/HW/WiimoteEmu/Encryption.cpp @@ -13,7 +13,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ diff --git a/Source/Core/Core/Src/HW/WiimoteEmu/Encryption.h b/Source/Core/Core/Src/HW/WiimoteEmu/Encryption.h index 92a06ad2a4..eb03466286 100644 --- a/Source/Core/Core/Src/HW/WiimoteEmu/Encryption.h +++ b/Source/Core/Core/Src/HW/WiimoteEmu/Encryption.h @@ -13,7 +13,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ diff --git a/Source/Core/Core/Src/HW/WiimoteEmu/Speaker.cpp b/Source/Core/Core/Src/HW/WiimoteEmu/Speaker.cpp index c743c80294..3ad1315438 100644 --- a/Source/Core/Core/Src/HW/WiimoteEmu/Speaker.cpp +++ b/Source/Core/Core/Src/HW/WiimoteEmu/Speaker.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #include "WiimoteEmu.h" diff --git a/Source/Core/Core/Src/HW/WiimoteEmu/WiimoteEmu.cpp b/Source/Core/Core/Src/HW/WiimoteEmu/WiimoteEmu.cpp index 1c3e306498..5857a37f99 100644 --- a/Source/Core/Core/Src/HW/WiimoteEmu/WiimoteEmu.cpp +++ b/Source/Core/Core/Src/HW/WiimoteEmu/WiimoteEmu.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #include @@ -74,27 +74,27 @@ static const u8 eeprom_data_16D0[] = { const ReportFeatures reporting_mode_features[] = { - //0x30: Core Buttons + //0x30: Core Buttons { 2, 0, 0, 0, 4 }, - //0x31: Core Buttons and Accelerometer + //0x31: Core Buttons and Accelerometer { 2, 4, 0, 0, 7 }, - //0x32: Core Buttons with 8 Extension bytes + //0x32: Core Buttons with 8 Extension bytes { 2, 0, 0, 4, 12 }, - //0x33: Core Buttons and Accelerometer with 12 IR bytes + //0x33: Core Buttons and Accelerometer with 12 IR bytes { 2, 4, 7, 0, 19 }, - //0x34: Core Buttons with 19 Extension bytes + //0x34: Core Buttons with 19 Extension bytes { 2, 0, 0, 4, 23 }, - //0x35: Core Buttons and Accelerometer with 16 Extension Bytes + //0x35: Core Buttons and Accelerometer with 16 Extension Bytes { 2, 4, 0, 7, 23 }, - //0x36: Core Buttons with 10 IR bytes and 9 Extension Bytes + //0x36: Core Buttons with 10 IR bytes and 9 Extension Bytes { 2, 0, 4, 14, 23 }, - //0x37: Core Buttons and Accelerometer with 10 IR bytes and 6 Extension Bytes + //0x37: Core Buttons and Accelerometer with 10 IR bytes and 6 Extension Bytes { 2, 4, 7, 17, 23 }, // UNSUPPORTED: - //0x3d: 21 Extension Bytes + //0x3d: 21 Extension Bytes { 0, 0, 0, 2, 23 }, - //0x3e / 0x3f: Interleaved Core Buttons and Accelerometer with 36 IR bytes + //0x3e / 0x3f: Interleaved Core Buttons and Accelerometer with 36 IR bytes { 0, 0, 0, 0, 23 }, }; @@ -478,7 +478,8 @@ void Wiimote::GetIRData(u8* const data, bool use_accel) az/=len; //normalizing the vector nsin=ax; ncos=az; - } else + } + else { nsin=0; ncos=1; @@ -486,7 +487,8 @@ void Wiimote::GetIRData(u8* const data, bool use_accel) // PanicAlert("%d %d %d\nx:%f\nz:%f\nsin:%f\ncos:%f",accel->x,accel->y,accel->z,ax,az,sin,cos); //PanicAlert("%d %d %d\n%d %d %d\n%d %d %d",accel->x,accel->y,accel->z,calib->zero_g.x,calib->zero_g.y,calib->zero_g.z, // calib->one_g.x,calib->one_g.y,calib->one_g.z); - } else + } + else { nsin=0; //m_tilt stuff here (can't figure it out yet....) ncos=1; @@ -930,14 +932,14 @@ void Wiimote::LoadDefaults(const ControllerInterface& ciface) // DPad #ifdef _WIN32 - set_control(m_dpad, 0, "UP"); // Up + set_control(m_dpad, 0, "UP"); // Up set_control(m_dpad, 1, "DOWN"); // Down set_control(m_dpad, 2, "LEFT"); // Left - set_control(m_dpad, 3, "RIGHT"); // Right + set_control(m_dpad, 3, "RIGHT"); // Right #elif __APPLE__ set_control(m_dpad, 0, "Up Arrow"); // Up - set_control(m_dpad, 1, "Down Arrow"); // Down - set_control(m_dpad, 2, "Left Arrow"); // Left + set_control(m_dpad, 1, "Down Arrow"); // Down + set_control(m_dpad, 2, "Left Arrow"); // Left set_control(m_dpad, 3, "Right Arrow"); // Right #else set_control(m_dpad, 0, "Up"); // Up diff --git a/Source/Core/Core/Src/HW/WiimoteEmu/WiimoteEmu.h b/Source/Core/Core/Src/HW/WiimoteEmu/WiimoteEmu.h index 36f0da406b..259c3a7ad5 100644 --- a/Source/Core/Core/Src/HW/WiimoteEmu/WiimoteEmu.h +++ b/Source/Core/Core/Src/HW/WiimoteEmu/WiimoteEmu.h @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #ifndef _CONEMU_WIIMOTE_H_ @@ -42,7 +42,7 @@ namespace WiimoteEmu struct ReportFeatures { - u8 core, accel, ir, ext, size; + u8 core, accel, ir, ext, size; }; struct AccelData diff --git a/Source/Core/Core/Src/HW/WiimoteEmu/WiimoteHid.h b/Source/Core/Core/Src/HW/WiimoteEmu/WiimoteHid.h index 9d1a2092a0..84593584fa 100644 --- a/Source/Core/Core/Src/HW/WiimoteEmu/WiimoteHid.h +++ b/Source/Core/Core/Src/HW/WiimoteEmu/WiimoteHid.h @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #ifndef WIIMOTE_HID_H @@ -28,7 +28,8 @@ // Source: HID_010_SPC_PFL/1.0 (official HID specification) -struct hid_packet { +struct hid_packet +{ u8 param : 4; u8 type : 4; u8 data[0]; @@ -199,7 +200,8 @@ struct wm_report #define WM_RUMBLE 0x10 #define WM_LEDS 0x11 -struct wm_leds { +struct wm_leds +{ u8 rumble : 1; // real wii also sets bit 0x2 (unknown purpose) u8 : 3; @@ -207,7 +209,8 @@ struct wm_leds { }; #define WM_REPORT_MODE 0x12 -struct wm_report_mode { +struct wm_report_mode +{ u8 rumble : 1; // unsure what "all_the_time" actually is, the real wii does set it (bit 0x2) u8 all_the_time : 1; @@ -220,13 +223,15 @@ struct wm_report_mode { #define WM_IR_LOGIC 0x1A #define WM_REQUEST_STATUS 0x15 -struct wm_request_status { +struct wm_request_status +{ u8 rumble : 1; u8 : 7; }; #define WM_STATUS_REPORT 0x20 -struct wm_status_report { +struct wm_status_report +{ wm_core buttons; u8 battery_low : 1; u8 extension : 1; @@ -257,7 +262,8 @@ struct wm_acknowledge }; #define WM_READ_DATA 0x17 -struct wm_read_data { +struct wm_read_data +{ u8 rumble : 1; u8 space : 2; //see WM_SPACE_* u8 : 5; @@ -271,7 +277,8 @@ struct wm_read_data { #define WM_SPACE_INVALID 3 #define WM_READ_DATA_REPLY 0x21 -struct wm_read_data_reply { +struct wm_read_data_reply +{ wm_core buttons; u8 error : 4; //see WM_RDERR_* u8 size : 4; @@ -286,12 +293,14 @@ struct wm_read_data_reply { // Data reports #define WM_REPORT_CORE 0x30 -struct wm_report_core { +struct wm_report_core +{ wm_core c; }; #define WM_REPORT_CORE_ACCEL 0x31 -struct wm_report_core_accel { +struct wm_report_core_accel +{ wm_core c; wm_accel a; }; @@ -299,7 +308,8 @@ struct wm_report_core_accel { #define WM_REPORT_CORE_EXT8 0x32 #define WM_REPORT_CORE_ACCEL_IR12 0x33 -struct wm_report_core_accel_ir12 { +struct wm_report_core_accel_ir12 +{ wm_core c; wm_accel a; wm_ir_extended ir[4]; @@ -341,7 +351,8 @@ struct wm_report_ext21 #define WM_SPEAKER_ENABLE 0x14 #define WM_SPEAKER_MUTE 0x19 #define WM_WRITE_SPEAKER_DATA 0x18 -struct wm_speaker_data { +struct wm_speaker_data +{ u8 unknown : 3; u8 length : 5; u8 data[20]; @@ -372,28 +383,34 @@ struct accel_cal } one_g; }; -struct nu_js { +struct nu_js +{ u8 max, min, center; }; -struct cc_trigger { + +struct cc_trigger +{ u8 neutral; }; + struct nu_cal { - wm_accel cal_zero; // zero calibratio + wm_accel cal_zero; // zero calibration wm_accel cal_g; // g size nu_js jx; // nu_js jy; // }; + struct cc_cal { nu_js Lx; // nu_js Ly; // nu_js Rx; // nu_js Ry; // - cc_trigger Tl; // - cc_trigger Tr; // + cc_trigger Tl; // + cc_trigger Tr; // }; + struct gh3_cal { nu_js Lx; diff --git a/Source/Core/Core/Src/HW/WiimoteReal/IOWin.cpp b/Source/Core/Core/Src/HW/WiimoteReal/IOWin.cpp index b86abb7ef2..b30b6bcd06 100644 --- a/Source/Core/Core/Src/HW/WiimoteReal/IOWin.cpp +++ b/Source/Core/Core/Src/HW/WiimoteReal/IOWin.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #include diff --git a/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.cpp b/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.cpp index 0b5583edaa..35f2638e30 100644 --- a/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.cpp +++ b/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #include @@ -136,7 +136,9 @@ void Wiimote::ControlChannel(const u16 channel, const void* const data, const u3 { // Check for custom communication if (99 == channel) + { EmuStop(); + } else { InterruptChannel(channel, data, size); @@ -167,14 +169,14 @@ void Wiimote::InterruptChannel(const u16 channel, const void* const _data, const // Convert output DATA packets to SET_REPORT packets. // Nintendo Wiimotes work without this translation, but 3rd // party ones don't. - if (rpt[0] == 0xa2) + if (rpt[0] == 0xa2) { rpt[0] = WM_SET_REPORT | WM_BT_OUTPUT; - } - - // Disallow games from turning off all of the LEDs. - // It makes Wiimote connection status confusing. - if (rpt[1] == WM_LEDS) + } + + // Disallow games from turning off all of the LEDs. + // It makes Wiimote connection status confusing. + if (rpt[1] == WM_LEDS) { auto& leds_rpt = *reinterpret_cast(&rpt[2]); if (0 == leds_rpt.leds) @@ -381,7 +383,9 @@ void WiimoteScanner::ThreadFunc() //NOTICE_LOG(WIIMOTE, "In loop"); if (m_want_wiimotes) + { found_wiimotes = FindWiimotes(); + } else { // Does stuff needed to detect disconnects on Windows diff --git a/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.h b/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.h index a64f2c24b5..0d24e94e58 100644 --- a/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.h +++ b/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.h @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ diff --git a/Source/Core/Core/Src/HW/WiimoteReal/WiimoteRealBase.h b/Source/Core/Core/Src/HW/WiimoteReal/WiimoteRealBase.h index e2b1a8db03..1a993d56bb 100644 --- a/Source/Core/Core/Src/HW/WiimoteReal/WiimoteRealBase.h +++ b/Source/Core/Core/Src/HW/WiimoteReal/WiimoteRealBase.h @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #ifndef WIIMOTE_COMM_H diff --git a/Source/Core/Core/Src/Host.h b/Source/Core/Core/Src/Host.h index a8e77b86ec..b1b1bc4787 100644 --- a/Source/Core/Core/Src/Host.h +++ b/Source/Core/Core/Src/Host.h @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #ifndef _HOST_H diff --git a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE.cpp b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE.cpp index a473375d20..f3774062fa 100644 --- a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE.cpp +++ b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ /* @@ -95,7 +95,7 @@ void Init() { enque_reply = CoreTiming::RegisterEvent("IPCReply", EnqueReplyCallback); - _dbg_assert_msg_(WII_IPC_HLE, g_DeviceMap.empty(), "DeviceMap isnt empty on init"); + _dbg_assert_msg_(WII_IPC_HLE, g_DeviceMap.empty(), "DeviceMap isn't empty on init"); CWII_IPC_HLE_Device_es::m_ContentFile = ""; u32 i; for (i=0; isecond) { // Force close @@ -158,7 +158,7 @@ void Reset(bool _bHard) delete itr->second; } ++itr; - } + } if (_bHard) { g_DeviceMap.erase(g_DeviceMap.begin(), g_DeviceMap.end()); @@ -170,20 +170,20 @@ void Reset(bool _bHard) void Shutdown() { - Reset(true); + Reset(true); } void SetDefaultContentFile(const std::string& _rFilename) { TDeviceMap::const_iterator itr = g_DeviceMap.begin(); - while (itr != g_DeviceMap.end()) - { - if (itr->second && itr->second->GetDeviceName().find(std::string("/dev/es")) == 0) + while (itr != g_DeviceMap.end()) + { + if (itr->second && itr->second->GetDeviceName().find(std::string("/dev/es")) == 0) { ((CWII_IPC_HLE_Device_es*)itr->second)->LoadWAD(_rFilename); } - ++itr; - } + ++itr; + } } void ES_DIVerify(u8 *_pTMD, u32 _sz) @@ -213,23 +213,23 @@ int getFreeDeviceId() IWII_IPC_HLE_Device* GetDeviceByName(const std::string& _rDeviceName) { - TDeviceMap::const_iterator itr = g_DeviceMap.begin(); - while (itr != g_DeviceMap.end()) - { - if (itr->second && itr->second->GetDeviceName() == _rDeviceName) - return itr->second; - ++itr; - } + TDeviceMap::const_iterator itr = g_DeviceMap.begin(); + while (itr != g_DeviceMap.end()) + { + if (itr->second && itr->second->GetDeviceName() == _rDeviceName) + return itr->second; + ++itr; + } - return NULL; + return NULL; } IWII_IPC_HLE_Device* AccessDeviceByID(u32 _ID) { - if (g_DeviceMap.find(_ID) != g_DeviceMap.end()) - return g_DeviceMap[_ID]; + if (g_DeviceMap.find(_ID) != g_DeviceMap.end()) + return g_DeviceMap[_ID]; - return NULL; + return NULL; } // This is called from ExecuteCommand() COMMAND_OPEN_DEVICE @@ -253,15 +253,15 @@ void DoState(PointerWrap &p) TDeviceMap::const_iterator itr; - itr = g_DeviceMap.begin(); - while (itr != g_DeviceMap.end()) - { - if (itr->second->IsHardware()) + itr = g_DeviceMap.begin(); + while (itr != g_DeviceMap.end()) + { + if (itr->second->IsHardware()) { itr->second->DoState(p); } ++itr; - } + } if (p.GetMode() == PointerWrap::MODE_READ) { @@ -333,19 +333,19 @@ void DoState(PointerWrap &p) void ExecuteCommand(u32 _Address) { - bool CmdSuccess = false; + bool CmdSuccess = false; - ECommandType Command = static_cast(Memory::Read_U32(_Address)); + ECommandType Command = static_cast(Memory::Read_U32(_Address)); volatile s32 DeviceID = Memory::Read_U32(_Address + 8); IWII_IPC_HLE_Device* pDevice = (DeviceID >= 0 && DeviceID < IPC_MAX_FDS) ? g_FdMap[DeviceID] : NULL; INFO_LOG(WII_IPC_HLE, "-->> Execute Command Address: 0x%08x (code: %x, device: %x) %p", _Address, Command, DeviceID, pDevice); - switch (Command) - { - case COMMAND_OPEN_DEVICE: - { + switch (Command) + { + case COMMAND_OPEN_DEVICE: + { u32 Mode = Memory::Read_U32(_Address + 0x10); DeviceID = getFreeDeviceId(); @@ -419,13 +419,13 @@ void ExecuteCommand(u32 _Address) Memory::Write_U32(FS_EFDEXHAUSTED, _Address + 4); CmdSuccess = true; } - break; - } - case COMMAND_CLOSE_DEVICE: + break; + } + case COMMAND_CLOSE_DEVICE: { if (pDevice) { - CmdSuccess = pDevice->Close(_Address); + CmdSuccess = pDevice->Close(_Address); u32 j; for (j=0; jIOCtl(_Address); } - break; + break; } - case COMMAND_IOCTLV: + case COMMAND_IOCTLV: { if (pDevice) { CmdSuccess = pDevice->IOCtlV(_Address); } - break; + break; } - default: + default: { - _dbg_assert_msg_(WII_IPC_HLE, 0, "Unknown IPC Command %i (0x%08x)", Command, _Address); - break; + _dbg_assert_msg_(WII_IPC_HLE, 0, "Unknown IPC Command %i (0x%08x)", Command, _Address); + break; + } } - } - // It seems that the original hardware overwrites the command after it has been + // It seems that the original hardware overwrites the command after it has been // executed. We write 8 which is not any valid command, and what IOS does Memory::Write_U32(8, _Address); // IOS seems to write back the command that was responded to Memory::Write_U32(Command, _Address + 8); - if (CmdSuccess) - { + if (CmdSuccess) + { // Ensure replies happen in order, fairly ugly // Without this, tons of games fail now that DI commands have different reply delays int reply_delay = pDevice ? pDevice->GetCmdDelay(_Address) : 0; @@ -535,7 +535,7 @@ void ExecuteCommand(u32 _Address) // Generate a reply to the IPC command EnqReply(_Address, reply_delay); - } + } else { if (pDevice) diff --git a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE.h b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE.h index 65244836cc..cd22c7ffc2 100644 --- a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE.h +++ b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE.h @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #ifndef _WII_IPC_HLE_H_ diff --git a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device.h b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device.h index d52bd4f1e3..180ab8134e 100644 --- a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device.h +++ b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device.h @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #ifndef _WII_IPC_HLE_DEVICE_H_ #define _WII_IPC_HLE_DEVICE_H_ @@ -29,23 +29,23 @@ #define FS_EINVAL (u32)-4 // Invalid argument Invalid FD #define FS_ENOENT (u32)-6 // File not found #define FS_EBUSY (u32)-8 // Resource busy -#define FS_EIO (u32)-12 // returned on ECC error -#define FS_ENOMEM (u32)-22 // Alloc failed during request +#define FS_EIO (u32)-12 // Returned on ECC error +#define FS_ENOMEM (u32)-22 // Alloc failed during request #define FS_EFATAL (u32)-101 // Fatal error #define FS_EACCESS (u32)-102 // Permission denied #define FS_ECORRUPT (u32)-103 // returned for "corrupted" NAND #define FS_EEXIST2 (u32)-105 // File exists #define FS_ENOENT2 (u32)-106 // File not found #define FS_ENFILE (u32)-107 // Too many fds open -#define FS_EFBIG (u32)-108 // max block count reached? +#define FS_EFBIG (u32)-108 // Max block count reached? #define FS_EFDEXHAUSTED (u32)-109 // Too many fds open -#define FS_ENAMELEN (u32)-110 // pathname is too long +#define FS_ENAMELEN (u32)-110 // Pathname is too long #define FS_EFDOPEN (u32)-111 // FD is already open -#define FS_EIO2 (u32)-114 // returned on ECC error +#define FS_EIO2 (u32)-114 // Returned on ECC error #define FS_ENOTEMPTY (u32)-115 // Directory not empty -#define FS_EDIRDEPTH (u32)-116 // max directory depth exceeded +#define FS_EDIRDEPTH (u32)-116 // Max directory depth exceeded #define FS_EBUSY2 (u32)-118 // Resource busy -//#define FS_EFATAL (u32)-119 // fatal error not used by IOS as fatal ERROR +//#define FS_EFATAL (u32)-119 // Fatal error not used by IOS as fatal ERROR #define FS_EESEXHAUSTED (u32)-1016 // Max of 2 ES handles at a time class IWII_IPC_HLE_Device @@ -53,13 +53,16 @@ class IWII_IPC_HLE_Device public: IWII_IPC_HLE_Device(u32 _DeviceID, const std::string& _rName, bool _Hardware = true) : - m_Name(_rName), + m_Name(_rName), m_DeviceID(_DeviceID), m_Hardware(_Hardware), m_Active(false) - {} + { + } - virtual ~IWII_IPC_HLE_Device() { } + virtual ~IWII_IPC_HLE_Device() + { + } virtual void DoState(PointerWrap& p) { @@ -70,16 +73,19 @@ public: void DoStateShared(PointerWrap& p); const std::string& GetDeviceName() const { return m_Name; } - u32 GetDeviceID() const { return m_DeviceID; } + u32 GetDeviceID() const { return m_DeviceID; } - virtual bool Open(u32 _CommandAddress, u32 _Mode) { + virtual bool Open(u32 _CommandAddress, u32 _Mode) + { (void)_Mode; WARN_LOG(WII_IPC_HLE, "%s does not support Open()", m_Name.c_str()); Memory::Write_U32(FS_ENOENT, _CommandAddress + 4); m_Active = true; return true; } - virtual bool Close(u32 _CommandAddress, bool _bForce = false) { + + virtual bool Close(u32 _CommandAddress, bool _bForce = false) + { WARN_LOG(WII_IPC_HLE, "%s does not support Close()", m_Name.c_str()); if (!_bForce) Memory::Write_U32(FS_EINVAL, _CommandAddress + 4); @@ -111,116 +117,116 @@ protected: bool m_Active; // A struct for IOS ioctlv calls - struct SIOCtlVBuffer - { - SIOCtlVBuffer(u32 _Address) : m_Address(_Address) - { + struct SIOCtlVBuffer + { + SIOCtlVBuffer(u32 _Address) : m_Address(_Address) + { // These are the Ioctlv parameters in the IOS communication. The BufferVector // is a memory address offset at where the in and out buffer addresses are // stored. - Parameter = Memory::Read_U32(m_Address + 0x0C); // command 3, arg0 - NumberInBuffer = Memory::Read_U32(m_Address + 0x10); // 4, arg1 - NumberPayloadBuffer = Memory::Read_U32(m_Address + 0x14); // 5, arg2 - BufferVector = Memory::Read_U32(m_Address + 0x18); // 6, arg3 + Parameter = Memory::Read_U32(m_Address + 0x0C); // command 3, arg0 + NumberInBuffer = Memory::Read_U32(m_Address + 0x10); // 4, arg1 + NumberPayloadBuffer = Memory::Read_U32(m_Address + 0x14); // 5, arg2 + BufferVector = Memory::Read_U32(m_Address + 0x18); // 6, arg3 // The start of the out buffer - u32 BufferVectorOffset = BufferVector; + u32 BufferVectorOffset = BufferVector; // Write the address and size for all in messages - for (u32 i = 0; i < NumberInBuffer; i++) - { - SBuffer Buffer; - Buffer.m_Address = Memory::Read_U32(BufferVectorOffset); + for (u32 i = 0; i < NumberInBuffer; i++) + { + SBuffer Buffer; + Buffer.m_Address = Memory::Read_U32(BufferVectorOffset); BufferVectorOffset += 4; - Buffer.m_Size = Memory::Read_U32(BufferVectorOffset); + Buffer.m_Size = Memory::Read_U32(BufferVectorOffset); BufferVectorOffset += 4; InBuffer.push_back(Buffer); DEBUG_LOG(WII_IPC_HLE, "SIOCtlVBuffer in%i: 0x%08x, 0x%x", - i, Buffer.m_Address, Buffer.m_Size); - } + i, Buffer.m_Address, Buffer.m_Size); + } // Write the address and size for all out or in-out messages - for (u32 i = 0; i < NumberPayloadBuffer; i++) - { - SBuffer Buffer; - Buffer.m_Address = Memory::Read_U32(BufferVectorOffset); + for (u32 i = 0; i < NumberPayloadBuffer; i++) + { + SBuffer Buffer; + Buffer.m_Address = Memory::Read_U32(BufferVectorOffset); BufferVectorOffset += 4; - Buffer.m_Size = Memory::Read_U32(BufferVectorOffset); + Buffer.m_Size = Memory::Read_U32(BufferVectorOffset); BufferVectorOffset += 4; PayloadBuffer.push_back(Buffer); DEBUG_LOG(WII_IPC_HLE, "SIOCtlVBuffer io%i: 0x%08x, 0x%x", - i, Buffer.m_Address, Buffer.m_Size); - } - } + i, Buffer.m_Address, Buffer.m_Size); + } + } - const u32 m_Address; + const u32 m_Address; - u32 Parameter; - u32 NumberInBuffer; - u32 NumberPayloadBuffer; - u32 BufferVector; + u32 Parameter; + u32 NumberInBuffer; + u32 NumberPayloadBuffer; + u32 BufferVector; - struct SBuffer { u32 m_Address, m_Size; }; - std::vector InBuffer; - std::vector PayloadBuffer; - }; + struct SBuffer { u32 m_Address, m_Size; }; + std::vector InBuffer; + std::vector PayloadBuffer; + }; // Write out the IPC struct from _CommandAddress to _NumberOfCommands numbers // of 4 byte commands. - void DumpCommands(u32 _CommandAddress, size_t _NumberOfCommands = 8, + void DumpCommands(u32 _CommandAddress, size_t _NumberOfCommands = 8, LogTypes::LOG_TYPE LogType = LogTypes::WII_IPC_HLE, LogTypes::LOG_LEVELS Verbosity = LogTypes::LDEBUG) - { + { GENERIC_LOG(LogType, Verbosity, "CommandDump of %s", GetDeviceName().c_str()); for (u32 i = 0; i < _NumberOfCommands; i++) - { + { GENERIC_LOG(LogType, Verbosity, " Command%02i: 0x%08x", i, Memory::Read_U32(_CommandAddress + i*4)); } - } + } - void DumpAsync(u32 BufferVector, u32 NumberInBuffer, u32 NumberOutBuffer, + void DumpAsync(u32 BufferVector, u32 NumberInBuffer, u32 NumberOutBuffer, LogTypes::LOG_TYPE LogType = LogTypes::WII_IPC_HLE, LogTypes::LOG_LEVELS Verbosity = LogTypes::LDEBUG) - { + { GENERIC_LOG(LogType, Verbosity, "======= DumpAsync ======"); - u32 BufferOffset = BufferVector; - for (u32 i = 0; i < NumberInBuffer; i++) - { - u32 InBuffer = Memory::Read_U32(BufferOffset); BufferOffset += 4; - u32 InBufferSize = Memory::Read_U32(BufferOffset); BufferOffset += 4; + u32 BufferOffset = BufferVector; + for (u32 i = 0; i < NumberInBuffer; i++) + { + u32 InBuffer = Memory::Read_U32(BufferOffset); BufferOffset += 4; + u32 InBufferSize = Memory::Read_U32(BufferOffset); BufferOffset += 4; - GENERIC_LOG(LogType, LogTypes::LINFO, "%s - IOCtlV InBuffer[%i]:", + GENERIC_LOG(LogType, LogTypes::LINFO, "%s - IOCtlV InBuffer[%i]:", GetDeviceName().c_str(), i); - std::string Temp; - for (u32 j = 0; j < InBufferSize; j++) - { - char Buffer[128]; - sprintf(Buffer, "%02x ", Memory::Read_U8(InBuffer+j)); - Temp.append(Buffer); - } + std::string Temp; + for (u32 j = 0; j < InBufferSize; j++) + { + char Buffer[128]; + sprintf(Buffer, "%02x ", Memory::Read_U8(InBuffer+j)); + Temp.append(Buffer); + } - GENERIC_LOG(LogType, LogTypes::LDEBUG, " Buffer: %s", Temp.c_str()); - } + GENERIC_LOG(LogType, LogTypes::LDEBUG, " Buffer: %s", Temp.c_str()); + } - for (u32 i = 0; i < NumberOutBuffer; i++) - { + for (u32 i = 0; i < NumberOutBuffer; i++) + { u32 OutBuffer = Memory::Read_U32(BufferOffset); BufferOffset += 4; u32 OutBufferSize = Memory::Read_U32(BufferOffset); BufferOffset += 4; - GENERIC_LOG(LogType, LogTypes::LINFO, "%s - IOCtlV OutBuffer[%i]:", + GENERIC_LOG(LogType, LogTypes::LINFO, "%s - IOCtlV OutBuffer[%i]:", GetDeviceName().c_str(), i); - GENERIC_LOG(LogType, LogTypes::LINFO, " OutBuffer: 0x%08x (0x%x):", + GENERIC_LOG(LogType, LogTypes::LINFO, " OutBuffer: 0x%08x (0x%x):", OutBuffer, OutBufferSize); #if defined(MAX_LOGLEVEL) && MAX_LOGLEVEL >= INFO_LEVEL DumpCommands(OutBuffer, OutBufferSize, LogType, Verbosity); #endif - } - } + } + } }; class CWII_IPC_HLE_Device_stub : public IWII_IPC_HLE_Device @@ -228,16 +234,19 @@ class CWII_IPC_HLE_Device_stub : public IWII_IPC_HLE_Device public: CWII_IPC_HLE_Device_stub(u32 DeviceID, const std::string& Name) : IWII_IPC_HLE_Device(DeviceID, Name) - {} + { + } - bool Open(u32 CommandAddress, u32 Mode) { + bool Open(u32 CommandAddress, u32 Mode) + { (void)Mode; WARN_LOG(WII_IPC_HLE, "%s faking Open()", m_Name.c_str()); Memory::Write_U32(GetDeviceID(), CommandAddress + 4); m_Active = true; return true; } - bool Close(u32 CommandAddress, bool bForce = false) { + bool Close(u32 CommandAddress, bool bForce = false) + { WARN_LOG(WII_IPC_HLE, "%s faking Close()", m_Name.c_str()); if (!bForce) Memory::Write_U32(FS_SUCCESS, CommandAddress + 4); diff --git a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_DI.cpp b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_DI.cpp index a4007a4b4c..dc0a9a06cf 100644 --- a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_DI.cpp +++ b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_DI.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #include "Common.h" @@ -39,8 +39,8 @@ using namespace DVDInterface; #define DI_COVER_REG_NO_DISC 1 CWII_IPC_HLE_Device_di::CWII_IPC_HLE_Device_di(u32 _DeviceID, const std::string& _rDeviceName ) - : IWII_IPC_HLE_Device(_DeviceID, _rDeviceName) - , m_pFileSystem(NULL) + : IWII_IPC_HLE_Device(_DeviceID, _rDeviceName) + , m_pFileSystem(NULL) , m_ErrorStatus(0) , m_CoverStatus(DI_COVER_REG_NO_DISC) {} @@ -58,13 +58,13 @@ bool CWII_IPC_HLE_Device_di::Open(u32 _CommandAddress, u32 _Mode) { if (VolumeHandler::IsValid()) { - m_pFileSystem = DiscIO::CreateFileSystem(VolumeHandler::GetVolume()); + m_pFileSystem = DiscIO::CreateFileSystem(VolumeHandler::GetVolume()); m_CoverStatus |= DI_COVER_REG_INITIALIZED; m_CoverStatus &= ~DI_COVER_REG_NO_DISC; } Memory::Write_U32(GetDeviceID(), _CommandAddress + 4); - m_Active = true; - return true; + m_Active = true; + return true; } bool CWII_IPC_HLE_Device_di::Close(u32 _CommandAddress, bool _bForce) @@ -77,29 +77,29 @@ bool CWII_IPC_HLE_Device_di::Close(u32 _CommandAddress, bool _bForce) m_ErrorStatus = 0; if (!_bForce) Memory::Write_U32(0, _CommandAddress + 4); - m_Active = false; - return true; + m_Active = false; + return true; } bool CWII_IPC_HLE_Device_di::IOCtl(u32 _CommandAddress) { u32 BufferIn = Memory::Read_U32(_CommandAddress + 0x10); u32 BufferInSize = Memory::Read_U32(_CommandAddress + 0x14); - u32 BufferOut = Memory::Read_U32(_CommandAddress + 0x18); - u32 BufferOutSize = Memory::Read_U32(_CommandAddress + 0x1C); + u32 BufferOut = Memory::Read_U32(_CommandAddress + 0x18); + u32 BufferOutSize = Memory::Read_U32(_CommandAddress + 0x1C); u32 Command = Memory::Read_U32(BufferIn) >> 24; - DEBUG_LOG(WII_IPC_DVD, "IOCtl Command(0x%08x) BufferIn(0x%08x, 0x%x) BufferOut(0x%08x, 0x%x)", + DEBUG_LOG(WII_IPC_DVD, "IOCtl Command(0x%08x) BufferIn(0x%08x, 0x%x) BufferOut(0x%08x, 0x%x)", Command, BufferIn, BufferInSize, BufferOut, BufferOutSize); u32 ReturnValue = ExecuteCommand(BufferIn, BufferInSize, BufferOut, BufferOutSize); - Memory::Write_U32(ReturnValue, _CommandAddress + 0x4); + Memory::Write_U32(ReturnValue, _CommandAddress + 0x4); - return true; + return true; } bool CWII_IPC_HLE_Device_di::IOCtlV(u32 _CommandAddress) -{ +{ SIOCtlVBuffer CommandBuffer(_CommandAddress); // Prepare the out buffer(s) with zeros as a safety precaution @@ -143,12 +143,12 @@ bool CWII_IPC_HLE_Device_di::IOCtlV(u32 _CommandAddress) } Memory::Write_U32(ReturnValue, _CommandAddress + 4); - return true; + return true; } u32 CWII_IPC_HLE_Device_di::ExecuteCommand(u32 _BufferIn, u32 _BufferInSize, u32 _BufferOut, u32 _BufferOutSize) -{ - u32 Command = Memory::Read_U32(_BufferIn) >> 24; +{ + u32 Command = Memory::Read_U32(_BufferIn) >> 24; // TATSUNOKO VS CAPCOM: Gets here with _BufferOut == 0!!! if (_BufferOut != 0) @@ -241,13 +241,13 @@ u32 CWII_IPC_HLE_Device_di::ExecuteCommand(u32 _BufferIn, u32 _BufferInSize, u32 } break; - case DVDLowWaitForCoverClose: - { + case DVDLowWaitForCoverClose: + { INFO_LOG(WII_IPC_DVD, "DVDLowWaitForCoverClose (Buffer 0x%08x, 0x%x)", _BufferOut, _BufferOutSize); return 4; // ??? - } - break; + } + break; case DVDLowGetCoverReg: Memory::Write_U32(m_CoverStatus, _BufferOut); @@ -347,7 +347,7 @@ u32 CWII_IPC_HLE_Device_di::ExecuteCommand(u32 _BufferIn, u32 _BufferInSize, u32 return 2; break; - case DVDLowSeek: + case DVDLowSeek: { u64 DVDAddress = Memory::Read_U32(_BufferIn + 0x4) << 2; const char *pFilename = NULL; @@ -364,7 +364,7 @@ u32 CWII_IPC_HLE_Device_di::ExecuteCommand(u32 _BufferIn, u32 _BufferInSize, u32 DVDAddress); } } - break; + break; case DVDLowReadDvd: ERROR_LOG(WII_IPC_DVD, "DVDLowReadDvd"); @@ -454,12 +454,12 @@ u32 CWII_IPC_HLE_Device_di::ExecuteCommand(u32 _BufferIn, u32 _BufferInSize, u32 ERROR_LOG(WII_IPC_DVD, "Unknown command 0x%08x (Buffer 0x%08x, 0x%x)", Command, _BufferOut, _BufferOutSize); - PanicAlertT("Unknown command 0x%08x", Command); + PanicAlertT("Unknown command 0x%08x", Command); break; } - // i dunno but prolly 1 is okay all the time :) - return 1; + // i dunno but prolly 1 is okay all the time :) + return 1; } int CWII_IPC_HLE_Device_di::GetCmdDelay(u32 _CommandAddress) diff --git a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_DI.h b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_DI.h index 0b62daefa3..3238dc0f73 100644 --- a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_DI.h +++ b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_DI.h @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #ifndef _WII_IPC_HLE_DEVICE_DI_H_ #define _WII_IPC_HLE_DEVICE_DI_H_ @@ -21,8 +21,8 @@ namespace DiscIO { - class IVolume; - class IFileSystem; + class IVolume; + class IFileSystem; } class CWII_IPC_HLE_Device_di : public IWII_IPC_HLE_Device @@ -33,7 +33,7 @@ public: virtual ~CWII_IPC_HLE_Device_di(); - bool Open(u32 _CommandAddress, u32 _Mode); + bool Open(u32 _CommandAddress, u32 _Mode); bool Close(u32 _CommandAddress, bool _bForce); bool IOCtl(u32 _CommandAddress); @@ -45,7 +45,7 @@ private: u32 ExecuteCommand(u32 BufferIn, u32 BufferInSize, u32 _BufferOut, u32 BufferOutSize); - DiscIO::IFileSystem* m_pFileSystem; + DiscIO::IFileSystem* m_pFileSystem; u32 m_ErrorStatus; // This flag seems to only be reset with poweron/off, not sure u32 m_CoverStatus; diff --git a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_FileIO.cpp b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_FileIO.cpp index 0b3fc5cfbb..8a06c213ba 100644 --- a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_FileIO.cpp +++ b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_FileIO.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #include "Common.h" diff --git a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_FileIO.h b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_FileIO.h index 7cdff98a95..d8f3167c68 100644 --- a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_FileIO.h +++ b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_FileIO.h @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #ifndef _WII_IPC_HLE_DEVICE_FILEIO_H_ @@ -31,11 +31,11 @@ public: virtual ~CWII_IPC_HLE_Device_FileIO(); bool Close(u32 _CommandAddress, bool _bForce); - bool Open(u32 _CommandAddress, u32 _Mode); + bool Open(u32 _CommandAddress, u32 _Mode); bool Seek(u32 _CommandAddress); bool Read(u32 _CommandAddress); bool Write(u32 _CommandAddress); - bool IOCtl(u32 _CommandAddress); + bool IOCtl(u32 _CommandAddress); void DoState(PointerWrap &p); File::IOFile OpenFile(); @@ -48,31 +48,31 @@ private: ISFS_OPEN_RW = (ISFS_OPEN_READ | ISFS_OPEN_WRITE) }; - enum - { - ISFS_FUNCNULL = 0, - ISFS_FUNCGETSTAT, - ISFS_FUNCREADDIR, - ISFS_FUNCGETATTR, - ISFS_FUNCGETUSAGE - }; + enum + { + ISFS_FUNCNULL = 0, + ISFS_FUNCGETSTAT, + ISFS_FUNCREADDIR, + ISFS_FUNCGETATTR, + ISFS_FUNCGETUSAGE + }; - enum - { - ISFS_IOCTL_FORMAT = 1, - ISFS_IOCTL_GETSTATS, - ISFS_IOCTL_CREATEDIR, - ISFS_IOCTL_READDIR, - ISFS_IOCTL_SETATTR, - ISFS_IOCTL_GETATTR, - ISFS_IOCTL_DELETE, - ISFS_IOCTL_RENAME, - ISFS_IOCTL_CREATEFILE, - ISFS_IOCTL_SETFILEVERCTRL, - ISFS_IOCTL_GETFILESTATS, - ISFS_IOCTL_GETUSAGE, - ISFS_IOCTL_SHUTDOWN - }; + enum + { + ISFS_IOCTL_FORMAT = 1, + ISFS_IOCTL_GETSTATS, + ISFS_IOCTL_CREATEDIR, + ISFS_IOCTL_READDIR, + ISFS_IOCTL_SETATTR, + ISFS_IOCTL_GETATTR, + ISFS_IOCTL_DELETE, + ISFS_IOCTL_RENAME, + ISFS_IOCTL_CREATEFILE, + ISFS_IOCTL_SETFILEVERCTRL, + ISFS_IOCTL_GETFILESTATS, + ISFS_IOCTL_GETUSAGE, + ISFS_IOCTL_SHUTDOWN + }; u32 m_Mode; u32 m_SeekPos; diff --git a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_es.cpp b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_es.cpp index 39a6c28873..1de59c03b8 100644 --- a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_es.cpp +++ b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_es.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ @@ -67,10 +67,10 @@ std::string CWII_IPC_HLE_Device_es::m_ContentFile; CWII_IPC_HLE_Device_es::CWII_IPC_HLE_Device_es(u32 _DeviceID, const std::string& _rDeviceName) - : IWII_IPC_HLE_Device(_DeviceID, _rDeviceName) - , m_pContentLoader(NULL) - , m_TitleID(-1) - , AccessIdentID(0x6000000) + : IWII_IPC_HLE_Device(_DeviceID, _rDeviceName) + , m_pContentLoader(NULL) + , m_TitleID(-1) + , AccessIdentID(0x6000000) {} CWII_IPC_HLE_Device_es::~CWII_IPC_HLE_Device_es() @@ -83,52 +83,52 @@ void CWII_IPC_HLE_Device_es::LoadWAD(const std::string& _rContentFile) bool CWII_IPC_HLE_Device_es::Open(u32 _CommandAddress, u32 _Mode) { - m_pContentLoader = &DiscIO::CNANDContentManager::Access().GetNANDLoader(m_ContentFile); + m_pContentLoader = &DiscIO::CNANDContentManager::Access().GetNANDLoader(m_ContentFile); - // check for cd ... - if (m_pContentLoader->IsValid()) - { - m_TitleID = m_pContentLoader->GetTitleID(); + // check for cd ... + if (m_pContentLoader->IsValid()) + { + m_TitleID = m_pContentLoader->GetTitleID(); m_TitleIDs.clear(); DiscIO::cUIDsys::AccessInstance().GetTitleIDs(m_TitleIDs); // uncomment if ES_GetOwnedTitlesCount / ES_GetOwnedTitles is implemented // m_TitleIDsOwned.clear(); // DiscIO::cUIDsys::AccessInstance().GetTitleIDs(m_TitleIDsOwned, true); - } - else if (VolumeHandler::IsValid()) - { + } + else if (VolumeHandler::IsValid()) + { // blindly grab the titleID from the disc - it's unencrypted at: // offset 0x0F8001DC and 0x0F80044C VolumeHandler::GetVolume()->GetTitleID((u8*)&m_TitleID); m_TitleID = Common::swap64(m_TitleID); - } - else - { - m_TitleID = ((u64)0x00010000 << 32) | 0xF00DBEEF; - } + } + else + { + m_TitleID = ((u64)0x00010000 << 32) | 0xF00DBEEF; + } - INFO_LOG(WII_IPC_ES, "Set default title to %08x/%08x", (u32)(m_TitleID>>32), (u32)m_TitleID); + INFO_LOG(WII_IPC_ES, "Set default title to %08x/%08x", (u32)(m_TitleID>>32), (u32)m_TitleID); Memory::Write_U32(GetDeviceID(), _CommandAddress+4); if (m_Active) INFO_LOG(WII_IPC_ES, "Device was re-opened."); m_Active = true; - return true; + return true; } bool CWII_IPC_HLE_Device_es::Close(u32 _CommandAddress, bool _bForce) { - // Leave deletion of the INANDContentLoader objects to CNANDContentManager, don't do it here! - m_NANDContent.clear(); + // Leave deletion of the INANDContentLoader objects to CNANDContentManager, don't do it here! + m_NANDContent.clear(); m_ContentAccessMap.clear(); m_pContentLoader = NULL; m_TitleIDs.clear(); - m_TitleID = -1; + m_TitleID = -1; AccessIdentID = 0x6000000; - INFO_LOG(WII_IPC_ES, "ES: Close"); - if (!_bForce) + INFO_LOG(WII_IPC_ES, "ES: Close"); + if (!_bForce) Memory::Write_U32(0, _CommandAddress + 4); m_Active = false; return true; @@ -136,17 +136,17 @@ bool CWII_IPC_HLE_Device_es::Close(u32 _CommandAddress, bool _bForce) bool CWII_IPC_HLE_Device_es::IOCtlV(u32 _CommandAddress) { - SIOCtlVBuffer Buffer(_CommandAddress); + SIOCtlVBuffer Buffer(_CommandAddress); - DEBUG_LOG(WII_IPC_ES, "%s (0x%x)", GetDeviceName().c_str(), Buffer.Parameter); + DEBUG_LOG(WII_IPC_ES, "%s (0x%x)", GetDeviceName().c_str(), Buffer.Parameter); - // Prepare the out buffer(s) with zeroes as a safety precaution - // to avoid returning bad values - for (u32 i = 0; i < Buffer.NumberPayloadBuffer; i++) - { - Memory::Memset(Buffer.PayloadBuffer[i].m_Address, 0, - Buffer.PayloadBuffer[i].m_Size); - } + // Prepare the out buffer(s) with zeroes as a safety precaution + // to avoid returning bad values + for (u32 i = 0; i < Buffer.NumberPayloadBuffer; i++) + { + Memory::Memset(Buffer.PayloadBuffer[i].m_Address, 0, + Buffer.PayloadBuffer[i].m_Size); + } // Uhh just put this here for now u8 keyTable[11][16] = { @@ -164,7 +164,7 @@ bool CWII_IPC_HLE_Device_es::IOCtlV(u32 _CommandAddress) }; switch (Buffer.Parameter) - { + { case IOCTL_ES_GETDEVICEID: { _dbg_assert_msg_(WII_IPC_ES, Buffer.NumberPayloadBuffer == 1, "IOCTL_ES_GETDEVICEID no out buffer"); @@ -207,10 +207,10 @@ bool CWII_IPC_HLE_Device_es::IOCtlV(u32 _CommandAddress) } break; - case IOCTL_ES_GETTITLECONTENTS: - { - _dbg_assert_msg_(WII_IPC_ES, Buffer.NumberInBuffer == 2, "IOCTL_ES_GETTITLECONTENTS bad in buffer"); - _dbg_assert_msg_(WII_IPC_ES, Buffer.NumberPayloadBuffer == 1, "IOCTL_ES_GETTITLECONTENTS bad out buffer"); + case IOCTL_ES_GETTITLECONTENTS: + { + _dbg_assert_msg_(WII_IPC_ES, Buffer.NumberInBuffer == 2, "IOCTL_ES_GETTITLECONTENTS bad in buffer"); + _dbg_assert_msg_(WII_IPC_ES, Buffer.NumberPayloadBuffer == 1, "IOCTL_ES_GETTITLECONTENTS bad out buffer"); u64 TitleID = Memory::Read_U64(Buffer.InBuffer[0].m_Address); @@ -234,32 +234,32 @@ bool CWII_IPC_HLE_Device_es::IOCtlV(u32 _CommandAddress) GetContentSize()); } - return true; - } - break; + return true; + } + break; - case IOCTL_ES_OPENTITLECONTENT: - { - _dbg_assert_(WII_IPC_ES, Buffer.NumberInBuffer == 3); - _dbg_assert_(WII_IPC_ES, Buffer.NumberPayloadBuffer == 0); - - u64 TitleID = Memory::Read_U64(Buffer.InBuffer[0].m_Address); - u32 Index = Memory::Read_U32(Buffer.InBuffer[2].m_Address); + case IOCTL_ES_OPENTITLECONTENT: + { + _dbg_assert_(WII_IPC_ES, Buffer.NumberInBuffer == 3); + _dbg_assert_(WII_IPC_ES, Buffer.NumberPayloadBuffer == 0); - u32 CFD = AccessIdentID++; - m_ContentAccessMap[CFD].m_Position = 0; - m_ContentAccessMap[CFD].m_pContent = AccessContentDevice(TitleID).GetContentByIndex(Index); - _dbg_assert_msg_(WII_IPC_ES, m_ContentAccessMap[CFD].m_pContent != NULL, "No Content for TitleID: %08x/%08x at Index %x", (u32)(TitleID>>32), (u32)TitleID, Index); + u64 TitleID = Memory::Read_U64(Buffer.InBuffer[0].m_Address); + u32 Index = Memory::Read_U32(Buffer.InBuffer[2].m_Address); + + u32 CFD = AccessIdentID++; + m_ContentAccessMap[CFD].m_Position = 0; + m_ContentAccessMap[CFD].m_pContent = AccessContentDevice(TitleID).GetContentByIndex(Index); + _dbg_assert_msg_(WII_IPC_ES, m_ContentAccessMap[CFD].m_pContent != NULL, "No Content for TitleID: %08x/%08x at Index %x", (u32)(TitleID>>32), (u32)TitleID, Index); // Fix for DLC by itsnotmailmail if (m_ContentAccessMap[CFD].m_pContent == NULL) CFD = 0xffffffff; //TODO: what is the correct error value here? - Memory::Write_U32(CFD, _CommandAddress + 0x4); + Memory::Write_U32(CFD, _CommandAddress + 0x4); - INFO_LOG(WII_IPC_ES, "IOCTL_ES_OPENTITLECONTENT: TitleID: %08x/%08x Index %i -> got CFD %x", (u32)(TitleID>>32), (u32)TitleID, Index, CFD); - return true; - } - break; + INFO_LOG(WII_IPC_ES, "IOCTL_ES_OPENTITLECONTENT: TitleID: %08x/%08x Index %i -> got CFD %x", (u32)(TitleID>>32), (u32)TitleID, Index, CFD); + return true; + } + break; case IOCTL_ES_OPENCONTENT: { @@ -282,177 +282,177 @@ bool CWII_IPC_HLE_Device_es::IOCtlV(u32 _CommandAddress) } break; - case IOCTL_ES_READCONTENT: - { - _dbg_assert_(WII_IPC_ES, Buffer.NumberInBuffer == 1); - _dbg_assert_(WII_IPC_ES, Buffer.NumberPayloadBuffer == 1); + case IOCTL_ES_READCONTENT: + { + _dbg_assert_(WII_IPC_ES, Buffer.NumberInBuffer == 1); + _dbg_assert_(WII_IPC_ES, Buffer.NumberPayloadBuffer == 1); - u32 CFD = Memory::Read_U32(Buffer.InBuffer[0].m_Address); - u32 Size = Buffer.PayloadBuffer[0].m_Size; - u32 Addr = Buffer.PayloadBuffer[0].m_Address; + u32 CFD = Memory::Read_U32(Buffer.InBuffer[0].m_Address); + u32 Size = Buffer.PayloadBuffer[0].m_Size; + u32 Addr = Buffer.PayloadBuffer[0].m_Address; - _dbg_assert_(WII_IPC_ES, m_ContentAccessMap.find(CFD) != m_ContentAccessMap.end()); - SContentAccess& rContent = m_ContentAccessMap[CFD]; + _dbg_assert_(WII_IPC_ES, m_ContentAccessMap.find(CFD) != m_ContentAccessMap.end()); + SContentAccess& rContent = m_ContentAccessMap[CFD]; - _dbg_assert_(WII_IPC_ES, rContent.m_pContent->m_pData != NULL); + _dbg_assert_(WII_IPC_ES, rContent.m_pContent->m_pData != NULL); - u8* pSrc = &rContent.m_pContent->m_pData[rContent.m_Position]; - u8* pDest = Memory::GetPointer(Addr); + u8* pSrc = &rContent.m_pContent->m_pData[rContent.m_Position]; + u8* pDest = Memory::GetPointer(Addr); - if (rContent.m_Position + Size > rContent.m_pContent->m_Size) - { - Size = rContent.m_pContent->m_Size-rContent.m_Position; - } + if (rContent.m_Position + Size > rContent.m_pContent->m_Size) + { + Size = rContent.m_pContent->m_Size-rContent.m_Position; + } - if (Size > 0) - { + if (Size > 0) + { if (pDest) { memcpy(pDest, pSrc, Size); rContent.m_Position += Size; } else { PanicAlertT("IOCTL_ES_READCONTENT - bad destination"); } - } + } - INFO_LOG(WII_IPC_ES, "IOCTL_ES_READCONTENT: CFD %x, Address 0x%x, Size %i -> stream pos %i (Index %i)", CFD, Addr, Size, rContent.m_Position, rContent.m_pContent->m_Index); + INFO_LOG(WII_IPC_ES, "IOCTL_ES_READCONTENT: CFD %x, Address 0x%x, Size %i -> stream pos %i (Index %i)", CFD, Addr, Size, rContent.m_Position, rContent.m_pContent->m_Index); - Memory::Write_U32(Size, _CommandAddress + 0x4); - return true; - } - break; + Memory::Write_U32(Size, _CommandAddress + 0x4); + return true; + } + break; - case IOCTL_ES_CLOSECONTENT: - { - _dbg_assert_(WII_IPC_ES, Buffer.NumberInBuffer == 1); - _dbg_assert_(WII_IPC_ES, Buffer.NumberPayloadBuffer == 0); + case IOCTL_ES_CLOSECONTENT: + { + _dbg_assert_(WII_IPC_ES, Buffer.NumberInBuffer == 1); + _dbg_assert_(WII_IPC_ES, Buffer.NumberPayloadBuffer == 0); - u32 CFD = Memory::Read_U32(Buffer.InBuffer[0].m_Address); + u32 CFD = Memory::Read_U32(Buffer.InBuffer[0].m_Address); - CContentAccessMap::iterator itr = m_ContentAccessMap.find(CFD); - m_ContentAccessMap.erase(itr); + CContentAccessMap::iterator itr = m_ContentAccessMap.find(CFD); + m_ContentAccessMap.erase(itr); - INFO_LOG(WII_IPC_ES, "IOCTL_ES_CLOSECONTENT: CFD %x", CFD); + INFO_LOG(WII_IPC_ES, "IOCTL_ES_CLOSECONTENT: CFD %x", CFD); - Memory::Write_U32(0, _CommandAddress + 0x4); - return true; - } - break; + Memory::Write_U32(0, _CommandAddress + 0x4); + return true; + } + break; - case IOCTL_ES_SEEKCONTENT: - { - _dbg_assert_(WII_IPC_ES, Buffer.NumberInBuffer == 3); - _dbg_assert_(WII_IPC_ES, Buffer.NumberPayloadBuffer == 0); + case IOCTL_ES_SEEKCONTENT: + { + _dbg_assert_(WII_IPC_ES, Buffer.NumberInBuffer == 3); + _dbg_assert_(WII_IPC_ES, Buffer.NumberPayloadBuffer == 0); - u32 CFD = Memory::Read_U32(Buffer.InBuffer[0].m_Address); - u32 Addr = Memory::Read_U32(Buffer.InBuffer[1].m_Address); - u32 Mode = Memory::Read_U32(Buffer.InBuffer[2].m_Address); + u32 CFD = Memory::Read_U32(Buffer.InBuffer[0].m_Address); + u32 Addr = Memory::Read_U32(Buffer.InBuffer[1].m_Address); + u32 Mode = Memory::Read_U32(Buffer.InBuffer[2].m_Address); - _dbg_assert_(WII_IPC_ES, m_ContentAccessMap.find(CFD) != m_ContentAccessMap.end()); - SContentAccess& rContent = m_ContentAccessMap[CFD]; + _dbg_assert_(WII_IPC_ES, m_ContentAccessMap.find(CFD) != m_ContentAccessMap.end()); + SContentAccess& rContent = m_ContentAccessMap[CFD]; - switch (Mode) - { - case 0: // SET - rContent.m_Position = Addr; - break; + switch (Mode) + { + case 0: // SET + rContent.m_Position = Addr; + break; - case 1: // CUR - rContent.m_Position += Addr; - break; + case 1: // CUR + rContent.m_Position += Addr; + break; - case 2: // END - rContent.m_Position = rContent.m_pContent->m_Size + Addr; - break; - } + case 2: // END + rContent.m_Position = rContent.m_pContent->m_Size + Addr; + break; + } - INFO_LOG(WII_IPC_ES, "IOCTL_ES_SEEKCONTENT: CFD %x, Address 0x%x, Mode %i -> Pos %i", CFD, Addr, Mode, rContent.m_Position); + INFO_LOG(WII_IPC_ES, "IOCTL_ES_SEEKCONTENT: CFD %x, Address 0x%x, Mode %i -> Pos %i", CFD, Addr, Mode, rContent.m_Position); - Memory::Write_U32(rContent.m_Position, _CommandAddress + 0x4); - return true; - } - break; + Memory::Write_U32(rContent.m_Position, _CommandAddress + 0x4); + return true; + } + break; - case IOCTL_ES_GETTITLEDIR: - { - _dbg_assert_(WII_IPC_ES, Buffer.NumberInBuffer == 1); - _dbg_assert_(WII_IPC_ES, Buffer.NumberPayloadBuffer == 1); + case IOCTL_ES_GETTITLEDIR: + { + _dbg_assert_(WII_IPC_ES, Buffer.NumberInBuffer == 1); + _dbg_assert_(WII_IPC_ES, Buffer.NumberPayloadBuffer == 1); - u64 TitleID = Memory::Read_U64(Buffer.InBuffer[0].m_Address); + u64 TitleID = Memory::Read_U64(Buffer.InBuffer[0].m_Address); - char* Path = (char*)Memory::GetPointer(Buffer.PayloadBuffer[0].m_Address); - sprintf(Path, "/title/%08x/%08x/data", (u32)(TitleID >> 32), (u32)TitleID); + char* Path = (char*)Memory::GetPointer(Buffer.PayloadBuffer[0].m_Address); + sprintf(Path, "/title/%08x/%08x/data", (u32)(TitleID >> 32), (u32)TitleID); - INFO_LOG(WII_IPC_ES, "IOCTL_ES_GETTITLEDIR: %s", Path); - } - break; + INFO_LOG(WII_IPC_ES, "IOCTL_ES_GETTITLEDIR: %s", Path); + } + break; - case IOCTL_ES_GETTITLEID: - { - _dbg_assert_(WII_IPC_ES, Buffer.NumberInBuffer == 0); - _dbg_assert_msg_(WII_IPC_ES, Buffer.NumberPayloadBuffer == 1, "IOCTL_ES_GETTITLEID no out buffer"); + case IOCTL_ES_GETTITLEID: + { + _dbg_assert_(WII_IPC_ES, Buffer.NumberInBuffer == 0); + _dbg_assert_msg_(WII_IPC_ES, Buffer.NumberPayloadBuffer == 1, "IOCTL_ES_GETTITLEID no out buffer"); - Memory::Write_U64(m_TitleID, Buffer.PayloadBuffer[0].m_Address); - INFO_LOG(WII_IPC_ES, "IOCTL_ES_GETTITLEID: %08x/%08x", (u32)(m_TitleID>>32), (u32)m_TitleID); - } - break; + Memory::Write_U64(m_TitleID, Buffer.PayloadBuffer[0].m_Address); + INFO_LOG(WII_IPC_ES, "IOCTL_ES_GETTITLEID: %08x/%08x", (u32)(m_TitleID>>32), (u32)m_TitleID); + } + break; - case IOCTL_ES_SETUID: - { - _dbg_assert_msg_(WII_IPC_ES, Buffer.NumberInBuffer == 1, "IOCTL_ES_SETUID no in buffer"); - _dbg_assert_(WII_IPC_ES, Buffer.NumberPayloadBuffer == 0); + case IOCTL_ES_SETUID: + { + _dbg_assert_msg_(WII_IPC_ES, Buffer.NumberInBuffer == 1, "IOCTL_ES_SETUID no in buffer"); + _dbg_assert_(WII_IPC_ES, Buffer.NumberPayloadBuffer == 0); // TODO: fs permissions based on this - u64 TitleID = Memory::Read_U64(Buffer.InBuffer[0].m_Address); - INFO_LOG(WII_IPC_ES, "IOCTL_ES_SETUID titleID: %08x/%08x", (u32)(TitleID>>32), (u32)TitleID); - } - break; + u64 TitleID = Memory::Read_U64(Buffer.InBuffer[0].m_Address); + INFO_LOG(WII_IPC_ES, "IOCTL_ES_SETUID titleID: %08x/%08x", (u32)(TitleID>>32), (u32)TitleID); + } + break; - case IOCTL_ES_GETTITLECNT: - { - _dbg_assert_msg_(WII_IPC_ES, Buffer.NumberInBuffer == 0, "IOCTL_ES_GETTITLECNT has an in buffer"); - _dbg_assert_msg_(WII_IPC_ES, Buffer.NumberPayloadBuffer == 1, "IOCTL_ES_GETTITLECNT has no out buffer"); - _dbg_assert_msg_(WII_IPC_ES, Buffer.PayloadBuffer[0].m_Size == 4, "IOCTL_ES_GETTITLECNT payload[0].size != 4"); + case IOCTL_ES_GETTITLECNT: + { + _dbg_assert_msg_(WII_IPC_ES, Buffer.NumberInBuffer == 0, "IOCTL_ES_GETTITLECNT has an in buffer"); + _dbg_assert_msg_(WII_IPC_ES, Buffer.NumberPayloadBuffer == 1, "IOCTL_ES_GETTITLECNT has no out buffer"); + _dbg_assert_msg_(WII_IPC_ES, Buffer.PayloadBuffer[0].m_Size == 4, "IOCTL_ES_GETTITLECNT payload[0].size != 4"); - Memory::Write_U32((u32)m_TitleIDs.size(), Buffer.PayloadBuffer[0].m_Address); + Memory::Write_U32((u32)m_TitleIDs.size(), Buffer.PayloadBuffer[0].m_Address); - INFO_LOG(WII_IPC_ES, "IOCTL_ES_GETTITLECNT: Number of Titles %lu", - (unsigned long)m_TitleIDs.size()); + INFO_LOG(WII_IPC_ES, "IOCTL_ES_GETTITLECNT: Number of Titles %lu", + (unsigned long)m_TitleIDs.size()); - Memory::Write_U32(0, _CommandAddress + 0x4); + Memory::Write_U32(0, _CommandAddress + 0x4); - return true; - } - break; + return true; + } + break; - case IOCTL_ES_GETTITLES: - { - _dbg_assert_msg_(WII_IPC_ES, Buffer.NumberInBuffer == 1, "IOCTL_ES_GETTITLES has an in buffer"); - _dbg_assert_msg_(WII_IPC_ES, Buffer.NumberPayloadBuffer == 1, "IOCTL_ES_GETTITLES has no out buffer"); + case IOCTL_ES_GETTITLES: + { + _dbg_assert_msg_(WII_IPC_ES, Buffer.NumberInBuffer == 1, "IOCTL_ES_GETTITLES has an in buffer"); + _dbg_assert_msg_(WII_IPC_ES, Buffer.NumberPayloadBuffer == 1, "IOCTL_ES_GETTITLES has no out buffer"); - u32 MaxCount = Memory::Read_U32(Buffer.InBuffer[0].m_Address); - u32 Count = 0; - for (int i = 0; i < (int)m_TitleIDs.size(); i++) - { - Memory::Write_U64(m_TitleIDs[i], Buffer.PayloadBuffer[0].m_Address + i*8); - INFO_LOG(WII_IPC_ES, "IOCTL_ES_GETTITLES: %08x/%08x", (u32)(m_TitleIDs[i] >> 32), (u32)m_TitleIDs[i]); - Count++; - if (Count >= MaxCount) - break; - } + u32 MaxCount = Memory::Read_U32(Buffer.InBuffer[0].m_Address); + u32 Count = 0; + for (int i = 0; i < (int)m_TitleIDs.size(); i++) + { + Memory::Write_U64(m_TitleIDs[i], Buffer.PayloadBuffer[0].m_Address + i*8); + INFO_LOG(WII_IPC_ES, "IOCTL_ES_GETTITLES: %08x/%08x", (u32)(m_TitleIDs[i] >> 32), (u32)m_TitleIDs[i]); + Count++; + if (Count >= MaxCount) + break; + } - INFO_LOG(WII_IPC_ES, "IOCTL_ES_GETTITLES: Number of titles returned %i", Count); - Memory::Write_U32(0, _CommandAddress + 0x4); - return true; - } - break; + INFO_LOG(WII_IPC_ES, "IOCTL_ES_GETTITLES: Number of titles returned %i", Count); + Memory::Write_U32(0, _CommandAddress + 0x4); + return true; + } + break; - case IOCTL_ES_GETVIEWCNT: - { - _dbg_assert_msg_(WII_IPC_ES, Buffer.NumberInBuffer == 1, "IOCTL_ES_GETVIEWCNT no in buffer"); - _dbg_assert_msg_(WII_IPC_ES, Buffer.NumberPayloadBuffer == 1, "IOCTL_ES_GETVIEWCNT no out buffer"); + case IOCTL_ES_GETVIEWCNT: + { + _dbg_assert_msg_(WII_IPC_ES, Buffer.NumberInBuffer == 1, "IOCTL_ES_GETVIEWCNT no in buffer"); + _dbg_assert_msg_(WII_IPC_ES, Buffer.NumberPayloadBuffer == 1, "IOCTL_ES_GETVIEWCNT no out buffer"); - u64 TitleID = Memory::Read_U64(Buffer.InBuffer[0].m_Address); + u64 TitleID = Memory::Read_U64(Buffer.InBuffer[0].m_Address); u32 retVal = 0; const DiscIO::INANDContentLoader& Loader = AccessContentDevice(TitleID); @@ -479,16 +479,16 @@ bool CWII_IPC_HLE_Device_es::IOCtlV(u32 _CommandAddress) //retVal = ES_NO_TICKET_INSTALLED; } } - - INFO_LOG(WII_IPC_ES, "IOCTL_ES_GETVIEWCNT for titleID: %08x/%08x (View Count = %i)", (u32)(TitleID>>32), (u32)TitleID, ViewCount); - Memory::Write_U32(ViewCount, Buffer.PayloadBuffer[0].m_Address); - Memory::Write_U32(retVal, _CommandAddress + 0x4); - return true; - } - break; + INFO_LOG(WII_IPC_ES, "IOCTL_ES_GETVIEWCNT for titleID: %08x/%08x (View Count = %i)", (u32)(TitleID>>32), (u32)TitleID, ViewCount); - case IOCTL_ES_GETVIEWS: + Memory::Write_U32(ViewCount, Buffer.PayloadBuffer[0].m_Address); + Memory::Write_U32(retVal, _CommandAddress + 0x4); + return true; + } + break; + + case IOCTL_ES_GETVIEWS: { _dbg_assert_msg_(WII_IPC_ES, Buffer.NumberInBuffer == 2, "IOCTL_ES_GETVIEWS no in buffer"); _dbg_assert_msg_(WII_IPC_ES, Buffer.NumberPayloadBuffer == 1, "IOCTL_ES_GETVIEWS no out buffer"); @@ -537,73 +537,73 @@ bool CWII_IPC_HLE_Device_es::IOCtlV(u32 _CommandAddress) Memory::Write_U32(retVal, _CommandAddress + 0x4); return true; } - break; + break; - case IOCTL_ES_GETTMDVIEWCNT: - { - _dbg_assert_msg_(WII_IPC_ES, Buffer.NumberInBuffer == 1, "IOCTL_ES_GETTMDVIEWCNT no in buffer"); - _dbg_assert_msg_(WII_IPC_ES, Buffer.NumberPayloadBuffer == 1, "IOCTL_ES_GETTMDVIEWCNT no out buffer"); + case IOCTL_ES_GETTMDVIEWCNT: + { + _dbg_assert_msg_(WII_IPC_ES, Buffer.NumberInBuffer == 1, "IOCTL_ES_GETTMDVIEWCNT no in buffer"); + _dbg_assert_msg_(WII_IPC_ES, Buffer.NumberPayloadBuffer == 1, "IOCTL_ES_GETTMDVIEWCNT no out buffer"); - u64 TitleID = Memory::Read_U64(Buffer.InBuffer[0].m_Address); + u64 TitleID = Memory::Read_U64(Buffer.InBuffer[0].m_Address); const DiscIO::INANDContentLoader& Loader = AccessContentDevice(TitleID); - u32 TMDViewCnt = 0; - if (Loader.IsValid()) - { - TMDViewCnt += DiscIO::INANDContentLoader::TMD_VIEW_SIZE; - TMDViewCnt += 2; // title version - TMDViewCnt += 2; // num entries - TMDViewCnt += (u32)Loader.GetContentSize() * (4+2+2+8); // content id, index, type, size - } - Memory::Write_U32(TMDViewCnt, Buffer.PayloadBuffer[0].m_Address); + u32 TMDViewCnt = 0; + if (Loader.IsValid()) + { + TMDViewCnt += DiscIO::INANDContentLoader::TMD_VIEW_SIZE; + TMDViewCnt += 2; // title version + TMDViewCnt += 2; // num entries + TMDViewCnt += (u32)Loader.GetContentSize() * (4+2+2+8); // content id, index, type, size + } + Memory::Write_U32(TMDViewCnt, Buffer.PayloadBuffer[0].m_Address); - Memory::Write_U32(0, _CommandAddress + 0x4); + Memory::Write_U32(0, _CommandAddress + 0x4); - INFO_LOG(WII_IPC_ES, "IOCTL_ES_GETTMDVIEWCNT: title: %08x/%08x (view size %i)", (u32)(TitleID >> 32), (u32)TitleID, TMDViewCnt); - return true; - } - break; + INFO_LOG(WII_IPC_ES, "IOCTL_ES_GETTMDVIEWCNT: title: %08x/%08x (view size %i)", (u32)(TitleID >> 32), (u32)TitleID, TMDViewCnt); + return true; + } + break; - case IOCTL_ES_GETTMDVIEWS: - { - _dbg_assert_msg_(WII_IPC_ES, Buffer.NumberInBuffer == 2, "IOCTL_ES_GETTMDVIEWCNT no in buffer"); - _dbg_assert_msg_(WII_IPC_ES, Buffer.NumberPayloadBuffer == 1, "IOCTL_ES_GETTMDVIEWCNT no out buffer"); + case IOCTL_ES_GETTMDVIEWS: + { + _dbg_assert_msg_(WII_IPC_ES, Buffer.NumberInBuffer == 2, "IOCTL_ES_GETTMDVIEWCNT no in buffer"); + _dbg_assert_msg_(WII_IPC_ES, Buffer.NumberPayloadBuffer == 1, "IOCTL_ES_GETTMDVIEWCNT no out buffer"); - u64 TitleID = Memory::Read_U64(Buffer.InBuffer[0].m_Address); - u32 MaxCount = Memory::Read_U32(Buffer.InBuffer[1].m_Address); + u64 TitleID = Memory::Read_U64(Buffer.InBuffer[0].m_Address); + u32 MaxCount = Memory::Read_U32(Buffer.InBuffer[1].m_Address); const DiscIO::INANDContentLoader& Loader = AccessContentDevice(TitleID); - INFO_LOG(WII_IPC_ES, "IOCTL_ES_GETTMDVIEWCNT: title: %08x/%08x buffer size: %i", (u32)(TitleID >> 32), (u32)TitleID, MaxCount); + INFO_LOG(WII_IPC_ES, "IOCTL_ES_GETTMDVIEWCNT: title: %08x/%08x buffer size: %i", (u32)(TitleID >> 32), (u32)TitleID, MaxCount); - if (Loader.IsValid()) - { - u32 Address = Buffer.PayloadBuffer[0].m_Address; + if (Loader.IsValid()) + { + u32 Address = Buffer.PayloadBuffer[0].m_Address; - Memory::WriteBigEData(Loader.GetTMDView(), Address, DiscIO::INANDContentLoader::TMD_VIEW_SIZE); - Address += DiscIO::INANDContentLoader::TMD_VIEW_SIZE; - - Memory::Write_U16(Loader.GetTitleVersion(), Address); Address += 2; - Memory::Write_U16(Loader.GetNumEntries(), Address); Address += 2; + Memory::WriteBigEData(Loader.GetTMDView(), Address, DiscIO::INANDContentLoader::TMD_VIEW_SIZE); + Address += DiscIO::INANDContentLoader::TMD_VIEW_SIZE; - const std::vector& rContent = Loader.GetContent(); - for (size_t i=0; i& rContent = Loader.GetContent(); + for (size_t i=0; i> 32), (u32)TitleID, MaxCount); - return true; - } - break; + _dbg_assert_(WII_IPC_ES, (Address-Buffer.PayloadBuffer[0].m_Address) == Buffer.PayloadBuffer[0].m_Size); + } + Memory::Write_U32(0, _CommandAddress + 0x4); + + INFO_LOG(WII_IPC_ES, "IOCTL_ES_GETTMDVIEWS: title: %08x/%08x (buffer size: %i)", (u32)(TitleID >> 32), (u32)TitleID, MaxCount); + return true; + } + break; case IOCTL_ES_GETCONSUMPTION: // This is at least what crediar's ES module does Memory::Write_U32(0, Buffer.PayloadBuffer[1].m_Address); @@ -641,34 +641,34 @@ bool CWII_IPC_HLE_Device_es::IOCtlV(u32 _CommandAddress) } } - case IOCTL_ES_GETSTOREDTMDSIZE: - { - _dbg_assert_msg_(WII_IPC_ES, Buffer.NumberInBuffer == 1, "IOCTL_ES_GETSTOREDTMDSIZE no in buffer"); - // _dbg_assert_msg_(WII_IPC_ES, Buffer.NumberPayloadBuffer == 1, "IOCTL_ES_ES_GETSTOREDTMDSIZE no out buffer"); + case IOCTL_ES_GETSTOREDTMDSIZE: + { + _dbg_assert_msg_(WII_IPC_ES, Buffer.NumberInBuffer == 1, "IOCTL_ES_GETSTOREDTMDSIZE no in buffer"); + // _dbg_assert_msg_(WII_IPC_ES, Buffer.NumberPayloadBuffer == 1, "IOCTL_ES_ES_GETSTOREDTMDSIZE no out buffer"); - u64 TitleID = Memory::Read_U64(Buffer.InBuffer[0].m_Address); + u64 TitleID = Memory::Read_U64(Buffer.InBuffer[0].m_Address); const DiscIO::INANDContentLoader& Loader = AccessContentDevice(TitleID); - _dbg_assert_(WII_IPC_ES, Loader.IsValid()); - u32 TMDCnt = 0; - if (Loader.IsValid()) - { + _dbg_assert_(WII_IPC_ES, Loader.IsValid()); + u32 TMDCnt = 0; + if (Loader.IsValid()) + { TMDCnt += DiscIO::INANDContentLoader::TMD_HEADER_SIZE; - TMDCnt += (u32)Loader.GetContentSize() * DiscIO::INANDContentLoader::CONTENT_HEADER_SIZE; - } - if(Buffer.NumberPayloadBuffer) + TMDCnt += (u32)Loader.GetContentSize() * DiscIO::INANDContentLoader::CONTENT_HEADER_SIZE; + } + if(Buffer.NumberPayloadBuffer) Memory::Write_U32(TMDCnt, Buffer.PayloadBuffer[0].m_Address); - Memory::Write_U32(0, _CommandAddress + 0x4); + Memory::Write_U32(0, _CommandAddress + 0x4); - INFO_LOG(WII_IPC_ES, "IOCTL_ES_GETSTOREDTMDSIZE: title: %08x/%08x (view size %i)", (u32)(TitleID >> 32), (u32)TitleID, TMDCnt); - return true; - } - break; + INFO_LOG(WII_IPC_ES, "IOCTL_ES_GETSTOREDTMDSIZE: title: %08x/%08x (view size %i)", (u32)(TitleID >> 32), (u32)TitleID, TMDCnt); + return true; + } + break; case IOCTL_ES_GETSTOREDTMD: - { - _dbg_assert_msg_(WII_IPC_ES, Buffer.NumberInBuffer > 0, "IOCTL_ES_GETSTOREDTMD no in buffer"); - // requires 1 inbuffer and no outbuffer, presumably outbuffer required when second inbuffer is used for maxcount (allocated mem?) + { + _dbg_assert_msg_(WII_IPC_ES, Buffer.NumberInBuffer > 0, "IOCTL_ES_GETSTOREDTMD no in buffer"); + // requires 1 inbuffer and no outbuffer, presumably outbuffer required when second inbuffer is used for maxcount (allocated mem?) // called with 1 inbuffer after deleting a titleid //_dbg_assert_msg_(WII_IPC_ES, Buffer.NumberPayloadBuffer == 1, "IOCTL_ES_GETSTOREDTMD no out buffer"); @@ -682,30 +682,30 @@ bool CWII_IPC_HLE_Device_es::IOCtlV(u32 _CommandAddress) const DiscIO::INANDContentLoader& Loader = AccessContentDevice(TitleID); - INFO_LOG(WII_IPC_ES, "IOCTL_ES_GETSTOREDTMD: title: %08x/%08x buffer size: %i", (u32)(TitleID >> 32), (u32)TitleID, MaxCount); + INFO_LOG(WII_IPC_ES, "IOCTL_ES_GETSTOREDTMD: title: %08x/%08x buffer size: %i", (u32)(TitleID >> 32), (u32)TitleID, MaxCount); - if (Loader.IsValid() && Buffer.NumberPayloadBuffer) - { - u32 Address = Buffer.PayloadBuffer[0].m_Address; + if (Loader.IsValid() && Buffer.NumberPayloadBuffer) + { + u32 Address = Buffer.PayloadBuffer[0].m_Address; Memory::WriteBigEData(Loader.GetTMDHeader(), Address, DiscIO::INANDContentLoader::TMD_HEADER_SIZE); - Address += DiscIO::INANDContentLoader::TMD_HEADER_SIZE; - - const std::vector& rContent = Loader.GetContent(); - for (size_t i=0; i& rContent = Loader.GetContent(); + for (size_t i=0; i> 32), (u32)TitleID, MaxCount); - return true; - } - break; + INFO_LOG(WII_IPC_ES, "IOCTL_ES_GETSTOREDTMD: title: %08x/%08x (buffer size: %i)", (u32)(TitleID >> 32), (u32)TitleID, MaxCount); + return true; + } + break; case IOCTL_ES_ENCRYPT: { @@ -741,17 +741,17 @@ bool CWII_IPC_HLE_Device_es::IOCtlV(u32 _CommandAddress) case IOCTL_ES_LAUNCH: - { - _dbg_assert_(WII_IPC_ES, Buffer.NumberInBuffer == 2); + { + _dbg_assert_(WII_IPC_ES, Buffer.NumberInBuffer == 2); bool bSuccess = false; u16 IOSv = 0xffff; - u64 TitleID = Memory::Read_U64(Buffer.InBuffer[0].m_Address); - u32 view = Memory::Read_U32(Buffer.InBuffer[1].m_Address); - u64 ticketid = Memory::Read_U64(Buffer.InBuffer[1].m_Address+4); - u32 devicetype = Memory::Read_U32(Buffer.InBuffer[1].m_Address+12); - u64 titleid = Memory::Read_U64(Buffer.InBuffer[1].m_Address+16); - u16 access = Memory::Read_U16(Buffer.InBuffer[1].m_Address+24); + u64 TitleID = Memory::Read_U64(Buffer.InBuffer[0].m_Address); + u32 view = Memory::Read_U32(Buffer.InBuffer[1].m_Address); + u64 ticketid = Memory::Read_U64(Buffer.InBuffer[1].m_Address+4); + u32 devicetype = Memory::Read_U32(Buffer.InBuffer[1].m_Address+12); + u64 titleid = Memory::Read_U64(Buffer.InBuffer[1].m_Address+16); + u16 access = Memory::Read_U16(Buffer.InBuffer[1].m_Address+24); if ((u32)(TitleID>>32) != 0x00000001 || TitleID == TITLEID_SYSMENU) @@ -826,12 +826,12 @@ bool CWII_IPC_HLE_Device_es::IOCtlV(u32 _CommandAddress) //TODO: provide correct return code when bSuccess= false Memory::Write_U32(0, _CommandAddress + 0x4); - ERROR_LOG(WII_IPC_ES, "IOCTL_ES_LAUNCH %016llx %08x %016llx %08x %016llx %04x", TitleID,view,ticketid,devicetype,titleid,access); + ERROR_LOG(WII_IPC_ES, "IOCTL_ES_LAUNCH %016llx %08x %016llx %08x %016llx %04x", TitleID,view,ticketid,devicetype,titleid,access); // IOCTL_ES_LAUNCH 0001000248414341 00000001 0001c0fef3df2cfa 00000000 0001000248414341 ffff - return true; - } - break; + return true; + } + break; case IOCTL_ES_CHECKKOREAREGION: //note by DacoTaco : name is unknown, i just tried to name it SOMETHING //IOS70 has this to let system menu 4.2 check if the console is region changed. it returns -1017 @@ -840,52 +840,52 @@ bool CWII_IPC_HLE_Device_es::IOCtlV(u32 _CommandAddress) Memory::Write_U32(ES_PARAMTER_SIZE_OR_ALIGNMENT , _CommandAddress + 0x4); return true; - // =============================================================================================== - // unsupported functions - // =============================================================================================== - case IOCTL_ES_DIGETTICKETVIEW: // (Input: none, Output: 216 bytes) bug crediar :D - WARN_LOG(WII_IPC_ES, "IOCTL_ES_DIGETTICKETVIEW: this looks really wrong..."); - break; + // =============================================================================================== + // unsupported functions + // =============================================================================================== + case IOCTL_ES_DIGETTICKETVIEW: // (Input: none, Output: 216 bytes) bug crediar :D + WARN_LOG(WII_IPC_ES, "IOCTL_ES_DIGETTICKETVIEW: this looks really wrong..."); + break; - case IOCTL_ES_GETDEVICECERT: // (Input: none, Output: 384 bytes) - WARN_LOG(WII_IPC_ES, "IOCTL_ES_GETDEVICECERT: this looks really wrong..."); - break; + case IOCTL_ES_GETDEVICECERT: // (Input: none, Output: 384 bytes) + WARN_LOG(WII_IPC_ES, "IOCTL_ES_GETDEVICECERT: this looks really wrong..."); + break; - default: - WARN_LOG(WII_IPC_ES, "CWII_IPC_HLE_Device_es: 0x%x", Buffer.Parameter); + default: + WARN_LOG(WII_IPC_ES, "CWII_IPC_HLE_Device_es: 0x%x", Buffer.Parameter); DumpCommands(_CommandAddress, 8, LogTypes::WII_IPC_ES); - INFO_LOG(WII_IPC_ES, "command.Parameter: 0x%08x", Buffer.Parameter); - break; - } + INFO_LOG(WII_IPC_ES, "command.Parameter: 0x%08x", Buffer.Parameter); + break; + } - // Write return value (0 means OK) - Memory::Write_U32(0, _CommandAddress + 0x4); + // Write return value (0 means OK) + Memory::Write_U32(0, _CommandAddress + 0x4); - return true; + return true; } const DiscIO::INANDContentLoader& CWII_IPC_HLE_Device_es::AccessContentDevice(u64 _TitleID) { - if (m_pContentLoader->IsValid() && m_pContentLoader->GetTitleID() == _TitleID) - return* m_pContentLoader; - - CTitleToContentMap::iterator itr = m_NANDContent.find(_TitleID); - if (itr != m_NANDContent.end()) - return *itr->second; + if (m_pContentLoader->IsValid() && m_pContentLoader->GetTitleID() == _TitleID) + return* m_pContentLoader; - m_NANDContent[_TitleID] = &DiscIO::CNANDContentManager::Access().GetNANDLoader(_TitleID); + CTitleToContentMap::iterator itr = m_NANDContent.find(_TitleID); + if (itr != m_NANDContent.end()) + return *itr->second; - _dbg_assert_msg_(WII_IPC_ES, ((u32)(_TitleID >> 32) == 0x00010000) || m_NANDContent[_TitleID]->IsValid(), "NandContent not valid for TitleID %08x/%08x", (u32)(_TitleID >> 32), (u32)_TitleID); - return *m_NANDContent[_TitleID]; + m_NANDContent[_TitleID] = &DiscIO::CNANDContentManager::Access().GetNANDLoader(_TitleID); + + _dbg_assert_msg_(WII_IPC_ES, ((u32)(_TitleID >> 32) == 0x00010000) || m_NANDContent[_TitleID]->IsValid(), "NandContent not valid for TitleID %08x/%08x", (u32)(_TitleID >> 32), (u32)_TitleID); + return *m_NANDContent[_TitleID]; } bool CWII_IPC_HLE_Device_es::IsValid(u64 _TitleID) const { - if (m_pContentLoader->IsValid() && m_pContentLoader->GetTitleID() == _TitleID) - return true; + if (m_pContentLoader->IsValid() && m_pContentLoader->GetTitleID() == _TitleID) + return true; - return false; + return false; } @@ -933,7 +933,7 @@ u32 CWII_IPC_HLE_Device_es::ES_DIVerify(u8* _pTMD, u32 _sz) File::DeleteDirRecursively(savePath.c_str()); #endif } - } + } } else if (File::Exists((savePath + "../backup/").c_str())) { diff --git a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_es.h b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_es.h index 58393a07a5..6194ff926c 100644 --- a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_es.h +++ b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_es.h @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #ifndef _WII_IPC_HLE_DEVICE_ES_H_ @@ -26,123 +26,123 @@ class CWII_IPC_HLE_Device_es : public IWII_IPC_HLE_Device { public: - CWII_IPC_HLE_Device_es(u32 _DeviceID, const std::string& _rDeviceName); + CWII_IPC_HLE_Device_es(u32 _DeviceID, const std::string& _rDeviceName); - virtual ~CWII_IPC_HLE_Device_es(); + virtual ~CWII_IPC_HLE_Device_es(); - void LoadWAD(const std::string& _rContentFile); + void LoadWAD(const std::string& _rContentFile); - virtual bool Open(u32 _CommandAddress, u32 _Mode); + virtual bool Open(u32 _CommandAddress, u32 _Mode); - virtual bool Close(u32 _CommandAddress, bool _bForce); + virtual bool Close(u32 _CommandAddress, bool _bForce); - virtual bool IOCtlV(u32 _CommandAddress); + virtual bool IOCtlV(u32 _CommandAddress); static u32 ES_DIVerify(u8 *_pTMD, u32 _sz); - + // This should only be cleared on power reset static std::string m_ContentFile; private: - enum - { - IOCTL_ES_ADDTICKET = 0x01, - IOCTL_ES_ADDTITLESTART = 0x02, - IOCTL_ES_ADDCONTENTSTART = 0x03, - IOCTL_ES_ADDCONTENTDATA = 0x04, - IOCTL_ES_ADDCONTENTFINISH = 0x05, - IOCTL_ES_ADDTITLEFINISH = 0x06, - IOCTL_ES_GETDEVICEID = 0x07, - IOCTL_ES_LAUNCH = 0x08, - IOCTL_ES_OPENCONTENT = 0x09, - IOCTL_ES_READCONTENT = 0x0A, - IOCTL_ES_CLOSECONTENT = 0x0B, - IOCTL_ES_GETOWNEDTITLECNT = 0x0C, - IOCTL_ES_GETOWNEDTITLES = 0x0D, - IOCTL_ES_GETTITLECNT = 0x0E, - IOCTL_ES_GETTITLES = 0x0F, - IOCTL_ES_GETTITLECONTENTSCNT = 0x10, - IOCTL_ES_GETTITLECONTENTS = 0x11, - IOCTL_ES_GETVIEWCNT = 0x12, - IOCTL_ES_GETVIEWS = 0x13, - IOCTL_ES_GETTMDVIEWCNT = 0x14, - IOCTL_ES_GETTMDVIEWS = 0x15, - IOCTL_ES_GETCONSUMPTION = 0x16, - IOCTL_ES_DELETETITLE = 0x17, - IOCTL_ES_DELETETICKET = 0x18, - // IOCTL_ES_DIGETTMDVIEWSIZE = 0x19, - // IOCTL_ES_DIGETTMDVIEW = 0x1A, - IOCTL_ES_DIGETTICKETVIEW = 0x1B, - IOCTL_ES_DIVERIFY = 0x1C, - IOCTL_ES_GETTITLEDIR = 0x1D, - IOCTL_ES_GETDEVICECERT = 0x1E, - IOCTL_ES_IMPORTBOOT = 0x1F, - IOCTL_ES_GETTITLEID = 0x20, - IOCTL_ES_SETUID = 0x21, - IOCTL_ES_DELETETITLECONTENT = 0x22, - IOCTL_ES_SEEKCONTENT = 0x23, - IOCTL_ES_OPENTITLECONTENT = 0x24, - // IOCTL_ES_LAUNCHBC = 0x25, - // IOCTL_ES_EXPORTTITLEINIT = 0x26, - // IOCTL_ES_EXPORTCONTENTBEGIN = 0x27, - // IOCTL_ES_EXPORTCONTENTDATA = 0x28, - // IOCTL_ES_EXPORTCONTENTEND = 0x29, - // IOCTL_ES_EXPORTTITLEDONE = 0x2A, - IOCTL_ES_ADDTMD = 0x2B, - IOCTL_ES_ENCRYPT = 0x2C, - IOCTL_ES_DECRYPT = 0x2D, - IOCTL_ES_GETBOOT2VERSION = 0x2E, - IOCTL_ES_ADDTITLECANCEL = 0x2F, - IOCTL_ES_SIGN = 0x30, - // IOCTL_ES_VERIFYSIGN = 0x31, - IOCTL_ES_GETSTOREDCONTENTCNT = 0x32, - IOCTL_ES_GETSTOREDCONTENTS = 0x33, - IOCTL_ES_GETSTOREDTMDSIZE = 0x34, - IOCTL_ES_GETSTOREDTMD = 0x35, - IOCTL_ES_GETSHAREDCONTENTCNT = 0x36, - IOCTL_ES_GETSHAREDCONTENTS = 0x37, + enum + { + IOCTL_ES_ADDTICKET = 0x01, + IOCTL_ES_ADDTITLESTART = 0x02, + IOCTL_ES_ADDCONTENTSTART = 0x03, + IOCTL_ES_ADDCONTENTDATA = 0x04, + IOCTL_ES_ADDCONTENTFINISH = 0x05, + IOCTL_ES_ADDTITLEFINISH = 0x06, + IOCTL_ES_GETDEVICEID = 0x07, + IOCTL_ES_LAUNCH = 0x08, + IOCTL_ES_OPENCONTENT = 0x09, + IOCTL_ES_READCONTENT = 0x0A, + IOCTL_ES_CLOSECONTENT = 0x0B, + IOCTL_ES_GETOWNEDTITLECNT = 0x0C, + IOCTL_ES_GETOWNEDTITLES = 0x0D, + IOCTL_ES_GETTITLECNT = 0x0E, + IOCTL_ES_GETTITLES = 0x0F, + IOCTL_ES_GETTITLECONTENTSCNT = 0x10, + IOCTL_ES_GETTITLECONTENTS = 0x11, + IOCTL_ES_GETVIEWCNT = 0x12, + IOCTL_ES_GETVIEWS = 0x13, + IOCTL_ES_GETTMDVIEWCNT = 0x14, + IOCTL_ES_GETTMDVIEWS = 0x15, + IOCTL_ES_GETCONSUMPTION = 0x16, + IOCTL_ES_DELETETITLE = 0x17, + IOCTL_ES_DELETETICKET = 0x18, + // IOCTL_ES_DIGETTMDVIEWSIZE = 0x19, + // IOCTL_ES_DIGETTMDVIEW = 0x1A, + IOCTL_ES_DIGETTICKETVIEW = 0x1B, + IOCTL_ES_DIVERIFY = 0x1C, + IOCTL_ES_GETTITLEDIR = 0x1D, + IOCTL_ES_GETDEVICECERT = 0x1E, + IOCTL_ES_IMPORTBOOT = 0x1F, + IOCTL_ES_GETTITLEID = 0x20, + IOCTL_ES_SETUID = 0x21, + IOCTL_ES_DELETETITLECONTENT = 0x22, + IOCTL_ES_SEEKCONTENT = 0x23, + IOCTL_ES_OPENTITLECONTENT = 0x24, + // IOCTL_ES_LAUNCHBC = 0x25, + // IOCTL_ES_EXPORTTITLEINIT = 0x26, + // IOCTL_ES_EXPORTCONTENTBEGIN = 0x27, + // IOCTL_ES_EXPORTCONTENTDATA = 0x28, + // IOCTL_ES_EXPORTCONTENTEND = 0x29, + // IOCTL_ES_EXPORTTITLEDONE = 0x2A, + IOCTL_ES_ADDTMD = 0x2B, + IOCTL_ES_ENCRYPT = 0x2C, + IOCTL_ES_DECRYPT = 0x2D, + IOCTL_ES_GETBOOT2VERSION = 0x2E, + IOCTL_ES_ADDTITLECANCEL = 0x2F, + IOCTL_ES_SIGN = 0x30, + // IOCTL_ES_VERIFYSIGN = 0x31, + IOCTL_ES_GETSTOREDCONTENTCNT = 0x32, + IOCTL_ES_GETSTOREDCONTENTS = 0x33, + IOCTL_ES_GETSTOREDTMDSIZE = 0x34, + IOCTL_ES_GETSTOREDTMD = 0x35, + IOCTL_ES_GETSHAREDCONTENTCNT = 0x36, + IOCTL_ES_GETSHAREDCONTENTS = 0x37, IOCTL_ES_DELETESHAREDCONTENT = 0x38, IOCTL_ES_CHECKKOREAREGION = 0x45, - }; + }; - enum EErrorCodes - { - ES_INVALID_TMD = -106, // or access denied - ES_READ_LESS_DATA_THAN_EXPECTED = -1009, - ES_UNK_1 = -1010, - ES_PARAMTER_SIZE_OR_ALIGNMENT = -1017, - ES_HASH_DOESNT_MATCH = -1022, - ES_MEM_ALLOC_FAILED = -1024, - ES_INCORRECT_ACCESS_RIGHT = -1026, - ES_NO_TICKET_INSTALLED = -1028, - ES_INSTALLED_TICKET_INVALID = -1029, - ES_INVALID_PARAMETR = -2008, - ES_SIGNATURE_CHECK_FAILED = -2011, - ES_HASH_SIZE_WRONG = -2014, // HASH !=20 - }; + enum EErrorCodes + { + ES_INVALID_TMD = -106, // or access denied + ES_READ_LESS_DATA_THAN_EXPECTED = -1009, + ES_UNK_1 = -1010, + ES_PARAMTER_SIZE_OR_ALIGNMENT = -1017, + ES_HASH_DOESNT_MATCH = -1022, + ES_MEM_ALLOC_FAILED = -1024, + ES_INCORRECT_ACCESS_RIGHT = -1026, + ES_NO_TICKET_INSTALLED = -1028, + ES_INSTALLED_TICKET_INVALID = -1029, + ES_INVALID_PARAMETR = -2008, + ES_SIGNATURE_CHECK_FAILED = -2011, + ES_HASH_SIZE_WRONG = -2014, // HASH !=20 + }; - struct SContentAccess - { - u32 m_Position; - const DiscIO::SNANDContent* m_pContent; - }; + struct SContentAccess + { + u32 m_Position; + const DiscIO::SNANDContent* m_pContent; + }; - typedef std::map CContentAccessMap; - CContentAccessMap m_ContentAccessMap; + typedef std::map CContentAccessMap; + CContentAccessMap m_ContentAccessMap; - typedef std::map CTitleToContentMap; - CTitleToContentMap m_NANDContent; + typedef std::map CTitleToContentMap; + CTitleToContentMap m_NANDContent; - const DiscIO::INANDContentLoader* m_pContentLoader; + const DiscIO::INANDContentLoader* m_pContentLoader; - std::vector m_TitleIDs; - u64 m_TitleID; - u32 AccessIdentID; + std::vector m_TitleIDs; + u64 m_TitleID; + u32 AccessIdentID; - u64 GetCurrentTitleID() const; + u64 GetCurrentTitleID() const; - const DiscIO::INANDContentLoader& AccessContentDevice(u64 _TitleID); + const DiscIO::INANDContentLoader& AccessContentDevice(u64 _TitleID); - bool IsValid(u64 _TitleID) const; + bool IsValid(u64 _TitleID) const; }; #endif diff --git a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_fs.cpp b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_fs.cpp index fb937b0fe0..9587173329 100644 --- a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_fs.cpp +++ b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_fs.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #include "Common.h" @@ -49,8 +49,8 @@ bool CWII_IPC_HLE_Device_fs::Open(u32 _CommandAddress, u32 _Mode) // clear tmp folder { std::string Path = File::GetUserPath(D_WIIUSER_IDX) + "tmp"; - File::DeleteDirRecursively(Path); - File::CreateDir(Path.c_str()); + File::DeleteDirRecursively(Path); + File::CreateDir(Path.c_str()); } Memory::Write_U32(GetDeviceID(), _CommandAddress+4); diff --git a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_fs.h b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_fs.h index 17a574da64..c8f44ab87e 100644 --- a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_fs.h +++ b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_fs.h @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #ifndef _WII_IPC_HLE_DEVICE_FS_H_ #define _WII_IPC_HLE_DEVICE_FS_H_ @@ -45,7 +45,7 @@ class CWII_IPC_HLE_Device_fs : public IWII_IPC_HLE_Device { public: - CWII_IPC_HLE_Device_fs(u32 _DeviceID, const std::string& _rDeviceName); + CWII_IPC_HLE_Device_fs(u32 _DeviceID, const std::string& _rDeviceName); virtual ~CWII_IPC_HLE_Device_fs(); virtual void DoState(PointerWrap& p); @@ -60,7 +60,7 @@ public: private: - enum + enum { IOCTL_GET_STATS = 0x02, IOCTL_CREATE_DIR = 0x03, diff --git a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_net.cpp b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_net.cpp index 0ac752e867..de68badf35 100644 --- a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_net.cpp +++ b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_net.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ @@ -409,26 +409,34 @@ bool CWII_IPC_HLE_Device_net_ip_top::IOCtl(u32 _CommandAddress) return true; } -struct bind_params { +struct bind_params +{ u32 socket; u32 has_name; u8 name[28]; }; -struct GC_sockaddr { + +struct GC_sockaddr +{ u8 sa_len; u8 sa_family; s8 sa_data[14]; }; -struct GC_in_addr { + +struct GC_in_addr +{ u32 s_addr_; // this cannot be named s_addr under windows - collides with some crazy define. }; -struct GC_sockaddr_in { + +struct GC_sockaddr_in +{ u8 sin_len; u8 sin_family; u16 sin_port; struct GC_in_addr sin_addr; s8 sin_zero[8]; }; + u32 CWII_IPC_HLE_Device_net_ip_top::ExecuteCommand(u32 _Command, u32 _BufferIn, u32 BufferInSize, u32 BufferOut, u32 BufferOutSize) { // Clean the location of the output buffer to zeros as a safety precaution */ diff --git a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_net.h b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_net.h index 29769e5b85..4540be7770 100644 --- a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_net.h +++ b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_net.h @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #ifndef _WII_IPC_HLE_DEVICE_NET_H_ @@ -121,31 +121,31 @@ public: virtual bool IOCtl(u32 _CommandAddress); private: - enum - { - IOCTL_NWC24_SUSPEND_SCHEDULAR = 0x01, - IOCTL_NWC24_EXEC_TRY_SUSPEND_SCHEDULAR = 0x02, - IOCTL_NWC24_UNK_3 = 0x03, - IOCTL_NWC24_UNK_4 = 0x04, - IOCTL_NWC24_UNK_5 = 0x05, - IOCTL_NWC24_STARTUP_SOCKET = 0x06, - IOCTL_NWC24_CLEANUP_SOCKET = 0x07, - IOCTL_NWC24_LOCK_SOCKET = 0x08, - IOCTL_NWC24_UNLOCK_SOCKET = 0x09, - IOCTL_NWC24_UNK_A = 0x0A, - IOCTL_NWC24_UNK_B = 0x0B, - IOCTL_NWC24_UNK_C = 0x0C, - IOCTL_NWC24_SAVE_MAIL_NOW = 0x0D, - IOCTL_NWC24_DOWNLOAD_NOW_EX = 0x0E, - IOCTL_NWC24_REQUEST_GENERATED_USER_ID = 0x0F, - IOCTL_NWC24_REQUEST_REGISTER_USER_ID = 0x10, - IOCTL_NWC24_GET_SCHEDULAR_STAT = 0x1E, - IOCTL_NWC24_UNK_1F = 0x1F, - IOCTL_NWC24_UNK_20 = 0x20, - IOCTL_NWC24_UNK_21 = 0x21, - IOCTL_NWC24_SET_SCRIPT_MODE = 0x22, - IOCTL_NWC24_REQUEST_SHUTDOWN = 0x28, - }; + enum + { + IOCTL_NWC24_SUSPEND_SCHEDULAR = 0x01, + IOCTL_NWC24_EXEC_TRY_SUSPEND_SCHEDULAR = 0x02, + IOCTL_NWC24_UNK_3 = 0x03, + IOCTL_NWC24_UNK_4 = 0x04, + IOCTL_NWC24_UNK_5 = 0x05, + IOCTL_NWC24_STARTUP_SOCKET = 0x06, + IOCTL_NWC24_CLEANUP_SOCKET = 0x07, + IOCTL_NWC24_LOCK_SOCKET = 0x08, + IOCTL_NWC24_UNLOCK_SOCKET = 0x09, + IOCTL_NWC24_UNK_A = 0x0A, + IOCTL_NWC24_UNK_B = 0x0B, + IOCTL_NWC24_UNK_C = 0x0C, + IOCTL_NWC24_SAVE_MAIL_NOW = 0x0D, + IOCTL_NWC24_DOWNLOAD_NOW_EX = 0x0E, + IOCTL_NWC24_REQUEST_GENERATED_USER_ID = 0x0F, + IOCTL_NWC24_REQUEST_REGISTER_USER_ID = 0x10, + IOCTL_NWC24_GET_SCHEDULAR_STAT = 0x1E, + IOCTL_NWC24_UNK_1F = 0x1F, + IOCTL_NWC24_UNK_20 = 0x20, + IOCTL_NWC24_UNK_21 = 0x21, + IOCTL_NWC24_SET_SCRIPT_MODE = 0x22, + IOCTL_NWC24_REQUEST_SHUTDOWN = 0x28, + }; // Max size 32 Bytes std::string m_UserID; @@ -164,14 +164,14 @@ public: virtual bool Open(u32 _CommandAddress, u32 _Mode) { - INFO_LOG(WII_IPC_NET, "NET_KD_TIME: Open"); + INFO_LOG(WII_IPC_NET, "NET_KD_TIME: Open"); Memory::Write_U32(GetDeviceID(), _CommandAddress+4); return true; } virtual bool Close(u32 _CommandAddress, bool _bForce) { - INFO_LOG(WII_IPC_NET, "NET_KD_TIME: Close"); + INFO_LOG(WII_IPC_NET, "NET_KD_TIME: Close"); if (!_bForce) Memory::Write_U32(0, _CommandAddress + 4); return true; @@ -179,45 +179,45 @@ public: virtual bool IOCtl(u32 _CommandAddress) { - u32 Parameter = Memory::Read_U32(_CommandAddress + 0x0C); - u32 BufferIn = Memory::Read_U32(_CommandAddress + 0x10); - u32 BufferInSize = Memory::Read_U32(_CommandAddress + 0x14); - u32 BufferOut = Memory::Read_U32(_CommandAddress + 0x18); - u32 BufferOutSize = Memory::Read_U32(_CommandAddress + 0x1C); + u32 Parameter = Memory::Read_U32(_CommandAddress + 0x0C); + u32 BufferIn = Memory::Read_U32(_CommandAddress + 0x10); + u32 BufferInSize = Memory::Read_U32(_CommandAddress + 0x14); + u32 BufferOut = Memory::Read_U32(_CommandAddress + 0x18); + u32 BufferOutSize = Memory::Read_U32(_CommandAddress + 0x1C); - switch (Parameter) - { - case IOCTL_NW24_SET_RTC_COUNTER: // NWC24iSetRtcCounter (but prolly just the first 4 bytes are intresting...) - _dbg_assert_msg_(WII_IPC_NET, BufferInSize==0x20, "NET_KD_TIME: Set RTC Counter BufferIn to small"); - _dbg_assert_msg_(WII_IPC_NET, BufferOutSize==0x20, "NET_KD_TIME: Set RTC Counter BufferOut to small"); + switch (Parameter) + { + case IOCTL_NW24_SET_RTC_COUNTER: // NWC24iSetRtcCounter (but prolly just the first 4 bytes are intresting...) + _dbg_assert_msg_(WII_IPC_NET, BufferInSize==0x20, "NET_KD_TIME: Set RTC Counter BufferIn to small"); + _dbg_assert_msg_(WII_IPC_NET, BufferOutSize==0x20, "NET_KD_TIME: Set RTC Counter BufferOut to small"); - for (int i=0; i<0x20; i++) - { - m_RtcCounter[i] = Memory::Read_U8(BufferIn+i); - } - - // send back for sync?? at least there is a out buffer... - for (int i=0; i<0x20; i++) - { - Memory::Write_U8(m_RtcCounter[i], BufferOut+i); - } + for (int i=0; i<0x20; i++) + { + m_RtcCounter[i] = Memory::Read_U8(BufferIn+i); + } - INFO_LOG(WII_IPC_NET, "NET_KD_TIME: Set RTC Counter"); + // send back for sync?? at least there is a out buffer... + for (int i=0; i<0x20; i++) + { + Memory::Write_U8(m_RtcCounter[i], BufferOut+i); + } - Memory::Write_U32(0, _CommandAddress + 0x4); - return true; + INFO_LOG(WII_IPC_NET, "NET_KD_TIME: Set RTC Counter"); + + Memory::Write_U32(0, _CommandAddress + 0x4); + return true; case IOCTL_NW24_GET_TIME_DIFF: // Input: none, Output: 32 - default: - ERROR_LOG(WII_IPC_NET, "%s - IOCtl:\n" - " Parameter: 0x%x (0x17 NWC24iSetRtcCounter) \n" - " BufferIn: 0x%08x\n" - " BufferInSize: 0x%08x\n" - " BufferOut: 0x%08x\n" - " BufferOutSize: 0x%08x\n", - GetDeviceName().c_str(), Parameter, BufferIn, BufferInSize, BufferOut, BufferOutSize); - break; - } + default: + ERROR_LOG(WII_IPC_NET, "%s - IOCtl:\n" + " Parameter: 0x%x (0x17 NWC24iSetRtcCounter) \n" + " BufferIn: 0x%08x\n" + " BufferInSize: 0x%08x\n" + " BufferOut: 0x%08x\n" + " BufferOutSize: 0x%08x\n", + GetDeviceName().c_str(), Parameter, BufferIn, BufferInSize, BufferOut, BufferOutSize); + break; + } // write return value Memory::Write_U32(0, _CommandAddress + 0x4); @@ -225,13 +225,13 @@ public: } private: - enum - { - IOCTL_NW24_SET_RTC_COUNTER = 0x17, - IOCTL_NW24_GET_TIME_DIFF = 0x18, - }; + enum + { + IOCTL_NW24_SET_RTC_COUNTER = 0x17, + IOCTL_NW24_GET_TIME_DIFF = 0x18, + }; - u8 m_RtcCounter[0x20]; + u8 m_RtcCounter[0x20]; }; // ********************************************************************************** @@ -248,43 +248,44 @@ public: virtual bool IOCtlV(u32 _CommandAddress); private: - enum { - IOCTL_SO_ACCEPT = 1, - IOCTL_SO_BIND, - IOCTL_SO_CLOSE, - IOCTL_SO_CONNECT, - IOCTL_SO_FCNTL, - IOCTL_SO_GETPEERNAME, - IOCTL_SO_GETSOCKNAME, - IOCTL_SO_GETSOCKOPT, - IOCTL_SO_SETSOCKOPT, - IOCTL_SO_LISTEN, - IOCTL_SO_POLL, - IOCTLV_SO_RECVFROM, - IOCTLV_SO_SENDTO, - IOCTL_SO_SHUTDOWN, - IOCTL_SO_SOCKET, - IOCTL_SO_GETHOSTID, - IOCTL_SO_GETHOSTBYNAME, - IOCTL_SO_GETHOSTBYADDR, - IOCTLV_SO_GETNAMEINFO, - IOCTL_SO_UNK14, - IOCTL_SO_INETATON, - IOCTL_SO_INETPTON, - IOCTL_SO_INETNTOP, - IOCTLV_SO_GETADDRINFO, - IOCTL_SO_SOCKATMARK, - IOCTLV_SO_UNK1A, - IOCTLV_SO_UNK1B, - IOCTLV_SO_GETINTERFACEOPT, - IOCTLV_SO_SETINTERFACEOPT, - IOCTL_SO_SETINTERFACE, - IOCTL_SO_STARTUP, - IOCTL_SO_ICMPSOCKET = 0x30, - IOCTLV_SO_ICMPPING, - IOCTL_SO_ICMPCANCEL, - IOCTL_SO_ICMPCLOSE - }; + enum + { + IOCTL_SO_ACCEPT = 1, + IOCTL_SO_BIND, + IOCTL_SO_CLOSE, + IOCTL_SO_CONNECT, + IOCTL_SO_FCNTL, + IOCTL_SO_GETPEERNAME, + IOCTL_SO_GETSOCKNAME, + IOCTL_SO_GETSOCKOPT, + IOCTL_SO_SETSOCKOPT, + IOCTL_SO_LISTEN, + IOCTL_SO_POLL, + IOCTLV_SO_RECVFROM, + IOCTLV_SO_SENDTO, + IOCTL_SO_SHUTDOWN, + IOCTL_SO_SOCKET, + IOCTL_SO_GETHOSTID, + IOCTL_SO_GETHOSTBYNAME, + IOCTL_SO_GETHOSTBYADDR, + IOCTLV_SO_GETNAMEINFO, + IOCTL_SO_UNK14, + IOCTL_SO_INETATON, + IOCTL_SO_INETPTON, + IOCTL_SO_INETNTOP, + IOCTLV_SO_GETADDRINFO, + IOCTL_SO_SOCKATMARK, + IOCTLV_SO_UNK1A, + IOCTLV_SO_UNK1B, + IOCTLV_SO_GETINTERFACEOPT, + IOCTLV_SO_SETINTERFACEOPT, + IOCTL_SO_SETINTERFACE, + IOCTL_SO_STARTUP, + IOCTL_SO_ICMPSOCKET = 0x30, + IOCTLV_SO_ICMPPING, + IOCTL_SO_ICMPCANCEL, + IOCTL_SO_ICMPCLOSE + }; u32 ExecuteCommand(u32 _Parameter, u32 _BufferIn, u32 _BufferInSize, u32 _BufferOut, u32 _BufferOutSize); }; diff --git a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_sdio_slot0.cpp b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_sdio_slot0.cpp index 1447071158..5b1a2a249e 100644 --- a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_sdio_slot0.cpp +++ b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_sdio_slot0.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #include "Common.h" diff --git a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_sdio_slot0.h b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_sdio_slot0.h index c9ef463576..ad2af37474 100644 --- a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_sdio_slot0.h +++ b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_sdio_slot0.h @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ // PRELIMINARY - seems to fully work with libogc, writing has yet to be tested @@ -28,8 +28,8 @@ public: CWII_IPC_HLE_Device_sdio_slot0(u32 _DeviceID, const std::string& _rDeviceName); - bool Open(u32 _CommandAddress, u32 _Mode); - bool Close(u32 _CommandAddress, bool _bForce); + bool Open(u32 _CommandAddress, u32 _Mode); + bool Close(u32 _CommandAddress, bool _bForce); bool IOCtl(u32 _CommandAddress); bool IOCtlV(u32 _CommandAddress); diff --git a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_stm.h b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_stm.h index e28a9d92d5..40576dbe44 100644 --- a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_stm.h +++ b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_stm.h @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #ifndef _WII_IPC_HLE_DEVICE_STM_H_ #define _WII_IPC_HLE_DEVICE_STM_H_ @@ -21,20 +21,20 @@ enum { - IOCTL_STM_EVENTHOOK = 0x1000, - IOCTL_STM_GET_IDLEMODE = 0x3001, - IOCTL_STM_RELEASE_EH = 0x3002, - IOCTL_STM_HOTRESET = 0x2001, - IOCTL_STM_HOTRESET_FOR_PD = 0x2002, - IOCTL_STM_SHUTDOWN = 0x2003, - IOCTL_STM_IDLE = 0x2004, - IOCTL_STM_WAKEUP = 0x2005, - IOCTL_STM_VIDIMMING = 0x5001, - IOCTL_STM_LEDFLASH = 0x6001, - IOCTL_STM_LEDMODE = 0x6002, - IOCTL_STM_READVER = 0x7001, - IOCTL_STM_READDDRREG = 0x4001, - IOCTL_STM_READDDRREG2 = 0x4002, + IOCTL_STM_EVENTHOOK = 0x1000, + IOCTL_STM_GET_IDLEMODE = 0x3001, + IOCTL_STM_RELEASE_EH = 0x3002, + IOCTL_STM_HOTRESET = 0x2001, + IOCTL_STM_HOTRESET_FOR_PD = 0x2002, + IOCTL_STM_SHUTDOWN = 0x2003, + IOCTL_STM_IDLE = 0x2004, + IOCTL_STM_WAKEUP = 0x2005, + IOCTL_STM_VIDIMMING = 0x5001, + IOCTL_STM_LEDFLASH = 0x6001, + IOCTL_STM_LEDMODE = 0x6002, + IOCTL_STM_READVER = 0x7001, + IOCTL_STM_READDDRREG = 0x4001, + IOCTL_STM_READDDRREG2 = 0x4002, }; // The /dev/stm/immediate @@ -66,9 +66,9 @@ public: return true; } - virtual bool IOCtl(u32 _CommandAddress) - { - u32 Parameter = Memory::Read_U32(_CommandAddress + 0x0C); + virtual bool IOCtl(u32 _CommandAddress) + { + u32 Parameter = Memory::Read_U32(_CommandAddress + 0x0C); u32 BufferIn = Memory::Read_U32(_CommandAddress + 0x10); u32 BufferInSize = Memory::Read_U32(_CommandAddress + 0x14); u32 BufferOut = Memory::Read_U32(_CommandAddress + 0x18); @@ -79,8 +79,8 @@ public: Memory::Memset(BufferOut, 0, BufferOutSize); u32 ReturnValue = 0; - switch(Parameter) - { + switch(Parameter) + { case IOCTL_STM_RELEASE_EH: INFO_LOG(WII_IPC_STM, "%s - IOCtl:", GetDeviceName().c_str()); INFO_LOG(WII_IPC_STM, " IOCTL_STM_RELEASE_EH"); @@ -91,37 +91,37 @@ public: INFO_LOG(WII_IPC_STM, " IOCTL_STM_HOTRESET"); break; - case IOCTL_STM_VIDIMMING: // (Input: 20 bytes, Output: 20 bytes) - INFO_LOG(WII_IPC_STM, "%s - IOCtl:", GetDeviceName().c_str()); - INFO_LOG(WII_IPC_STM, " IOCTL_STM_VIDIMMING"); + case IOCTL_STM_VIDIMMING: // (Input: 20 bytes, Output: 20 bytes) + INFO_LOG(WII_IPC_STM, "%s - IOCtl:", GetDeviceName().c_str()); + INFO_LOG(WII_IPC_STM, " IOCTL_STM_VIDIMMING"); //DumpCommands(BufferIn, BufferInSize / 4, LogTypes::WII_IPC_STM); //Memory::Write_U32(1, BufferOut); //ReturnValue = 1; - break; + break; - case IOCTL_STM_LEDMODE: // (Input: 20 bytes, Output: 20 bytes) - INFO_LOG(WII_IPC_STM, "%s - IOCtl:", GetDeviceName().c_str()); - INFO_LOG(WII_IPC_STM, " IOCTL_STM_LEDMODE"); - break; + case IOCTL_STM_LEDMODE: // (Input: 20 bytes, Output: 20 bytes) + INFO_LOG(WII_IPC_STM, "%s - IOCtl:", GetDeviceName().c_str()); + INFO_LOG(WII_IPC_STM, " IOCTL_STM_LEDMODE"); + break; - default: - { - _dbg_assert_msg_(WII_IPC_STM, 0, "CWII_IPC_HLE_Device_stm_immediate: 0x%x", Parameter); + default: + { + _dbg_assert_msg_(WII_IPC_STM, 0, "CWII_IPC_HLE_Device_stm_immediate: 0x%x", Parameter); - INFO_LOG(WII_IPC_STM, "%s - IOCtl:", GetDeviceName().c_str()); - DEBUG_LOG(WII_IPC_STM, " Parameter: 0x%x", Parameter); - DEBUG_LOG(WII_IPC_STM, " InBuffer: 0x%08x", BufferIn); - DEBUG_LOG(WII_IPC_STM, " InBufferSize: 0x%08x", BufferInSize); - DEBUG_LOG(WII_IPC_STM, " OutBuffer: 0x%08x", BufferOut); - DEBUG_LOG(WII_IPC_STM, " OutBufferSize: 0x%08x", BufferOutSize); - } - break; - } + INFO_LOG(WII_IPC_STM, "%s - IOCtl:", GetDeviceName().c_str()); + DEBUG_LOG(WII_IPC_STM, " Parameter: 0x%x", Parameter); + DEBUG_LOG(WII_IPC_STM, " InBuffer: 0x%08x", BufferIn); + DEBUG_LOG(WII_IPC_STM, " InBufferSize: 0x%08x", BufferInSize); + DEBUG_LOG(WII_IPC_STM, " OutBuffer: 0x%08x", BufferOut); + DEBUG_LOG(WII_IPC_STM, " OutBufferSize: 0x%08x", BufferOutSize); + } + break; + } // Write return value to the IPC call - Memory::Write_U32(ReturnValue, _CommandAddress + 0x4); - return true; - } + Memory::Write_U32(ReturnValue, _CommandAddress + 0x4); + return true; + } }; // The /dev/stm/eventhook @@ -129,20 +129,21 @@ class CWII_IPC_HLE_Device_stm_eventhook : public IWII_IPC_HLE_Device { public: - CWII_IPC_HLE_Device_stm_eventhook(u32 _DeviceID, const std::string& _rDeviceName) + CWII_IPC_HLE_Device_stm_eventhook(u32 _DeviceID, const std::string& _rDeviceName) : IWII_IPC_HLE_Device(_DeviceID, _rDeviceName) , m_EventHookAddress(0) - {} + {} - virtual ~CWII_IPC_HLE_Device_stm_eventhook() - {} + virtual ~CWII_IPC_HLE_Device_stm_eventhook() + { + } - virtual bool Open(u32 _CommandAddress, u32 _Mode) - { - Memory::Write_U32(GetDeviceID(), _CommandAddress + 4); + virtual bool Open(u32 _CommandAddress, u32 _Mode) + { + Memory::Write_U32(GetDeviceID(), _CommandAddress + 4); m_Active = true; return true; - } + } virtual bool Close(u32 _CommandAddress, bool _bForce) { @@ -155,46 +156,46 @@ public: return true; } - virtual bool IOCtl(u32 _CommandAddress) - { - u32 Parameter = Memory::Read_U32(_CommandAddress + 0x0C); - u32 BufferIn = Memory::Read_U32(_CommandAddress + 0x10); - u32 BufferInSize = Memory::Read_U32(_CommandAddress + 0x14); - u32 BufferOut = Memory::Read_U32(_CommandAddress + 0x18); - u32 BufferOutSize = Memory::Read_U32(_CommandAddress + 0x1C); + virtual bool IOCtl(u32 _CommandAddress) + { + u32 Parameter = Memory::Read_U32(_CommandAddress + 0x0C); + u32 BufferIn = Memory::Read_U32(_CommandAddress + 0x10); + u32 BufferInSize = Memory::Read_U32(_CommandAddress + 0x14); + u32 BufferOut = Memory::Read_U32(_CommandAddress + 0x18); + u32 BufferOutSize = Memory::Read_U32(_CommandAddress + 0x1C); // Prepare the out buffer(s) with zeros as a safety precaution // to avoid returning bad values Memory::Memset(BufferOut, 0, BufferOutSize); u32 ReturnValue = 0; - // write return value - switch (Parameter) - { - case IOCTL_STM_EVENTHOOK: + // write return value + switch (Parameter) + { + case IOCTL_STM_EVENTHOOK: { m_EventHookAddress = _CommandAddress; - INFO_LOG(WII_IPC_STM, "%s registers event hook:", GetDeviceName().c_str()); - DEBUG_LOG(WII_IPC_STM, "%x - IOCTL_STM_EVENTHOOK", Parameter); - DEBUG_LOG(WII_IPC_STM, "BufferIn: 0x%08x", BufferIn); - DEBUG_LOG(WII_IPC_STM, "BufferInSize: 0x%08x", BufferInSize); - DEBUG_LOG(WII_IPC_STM, "BufferOut: 0x%08x", BufferOut); - DEBUG_LOG(WII_IPC_STM, "BufferOutSize: 0x%08x", BufferOutSize); + INFO_LOG(WII_IPC_STM, "%s registers event hook:", GetDeviceName().c_str()); + DEBUG_LOG(WII_IPC_STM, "%x - IOCTL_STM_EVENTHOOK", Parameter); + DEBUG_LOG(WII_IPC_STM, "BufferIn: 0x%08x", BufferIn); + DEBUG_LOG(WII_IPC_STM, "BufferInSize: 0x%08x", BufferInSize); + DEBUG_LOG(WII_IPC_STM, "BufferOut: 0x%08x", BufferOut); + DEBUG_LOG(WII_IPC_STM, "BufferOutSize: 0x%08x", BufferOutSize); DumpCommands(BufferIn, BufferInSize/4, LogTypes::WII_IPC_STM); - } - break; + } + break; - default: + default: _dbg_assert_msg_(WII_IPC_STM, 0, "unknown %s ioctl %x", GetDeviceName().c_str(), Parameter); - break; - } + break; + } // Write return value to the IPC call, 0 means success - Memory::Write_U32(ReturnValue, _CommandAddress + 0x4); - return false; + Memory::Write_U32(ReturnValue, _CommandAddress + 0x4); + return false; } // STATE_TO_SAVE diff --git a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp index 7189e6a4e9..c1c1276745 100644 --- a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp +++ b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #include "../Core.h" @@ -117,26 +117,28 @@ void CWII_IPC_HLE_Device_usb_oh1_57e_305::DoState(PointerWrap &p) p.Do(m_EventQueue); m_acl_pool.DoState(p); - for (unsigned int i = 0; i < 4; i++) + for (unsigned int i = 0; i < 4; i++) m_WiiMotes[i].DoState(p); // Reset the connection of real and hybrid wiimotes if (p.GetMode() == PointerWrap::MODE_READ && SConfig::GetInstance().m_WiimoteReconnectOnLoad) { - for (unsigned int i = 0; i < 4; i++) - { + for (unsigned int i = 0; i < 4; i++) + { if (WIIMOTE_SRC_EMU == g_wiimote_sources[i] || WIIMOTE_SRC_NONE == g_wiimote_sources[i]) continue; // TODO: Selectively clear real wiimote messages if possible. Or create a real wiimote channel and reporting mode pre-setup to vacate the need for m_WiimoteReconnectOnLoad. m_EventQueue.clear(); if (!m_WiiMotes[i].IsInactive()) - { + { m_WiiMotes[i].Activate(false); m_WiiMotes[i].Activate(true); - } + } else + { m_WiiMotes[i].Activate(false); - } + } + } } } @@ -557,7 +559,7 @@ bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventInquiryComplete() { SQueuedEvent Event(sizeof(SHCIEventInquiryComplete), 0); - SHCIEventInquiryComplete* pInquiryComplete = (SHCIEventInquiryComplete*)Event.m_buffer; + SHCIEventInquiryComplete* pInquiryComplete = (SHCIEventInquiryComplete*)Event.m_buffer; pInquiryComplete->EventType = HCI_EVENT_INQUIRY_COMPL; pInquiryComplete->PayloadLength = sizeof(SHCIEventInquiryComplete) - 2; pInquiryComplete->EventStatus = 0x00; @@ -570,7 +572,7 @@ bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventInquiryComplete() } bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventInquiryResponse() -{ +{ if (m_WiiMotes.empty()) return false; @@ -621,7 +623,7 @@ bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventConnectionComplete(const bdad SQueuedEvent Event(sizeof(SHCIEventConnectionComplete), 0); - SHCIEventConnectionComplete* pConnectionComplete = (SHCIEventConnectionComplete*)Event.m_buffer; + SHCIEventConnectionComplete* pConnectionComplete = (SHCIEventConnectionComplete*)Event.m_buffer; pConnectionComplete->EventType = HCI_EVENT_CON_COMPL; pConnectionComplete->PayloadLength = sizeof(SHCIEventConnectionComplete) - 2; @@ -738,7 +740,7 @@ bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventAuthenticationCompleted(u16 _ } bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventRemoteNameReq(const bdaddr_t& _bd) -{ +{ CWII_IPC_HLE_WiiMote* pWiiMote = AccessWiiMote(_bd); if (pWiiMote == NULL) return false; @@ -807,7 +809,7 @@ bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventReadRemoteVerInfo(u16 _connec SQueuedEvent Event(sizeof(SHCIEventReadRemoteVerInfo), _connectionHandle); - SHCIEventReadRemoteVerInfo* pReadRemoteVerInfo = (SHCIEventReadRemoteVerInfo*)Event.m_buffer; + SHCIEventReadRemoteVerInfo* pReadRemoteVerInfo = (SHCIEventReadRemoteVerInfo*)Event.m_buffer; pReadRemoteVerInfo->EventType = HCI_EVENT_READ_REMOTE_VER_INFO_COMPL; pReadRemoteVerInfo->PayloadLength = sizeof(SHCIEventReadRemoteVerInfo) - 2; pReadRemoteVerInfo->EventStatus = 0x00; @@ -833,10 +835,10 @@ void CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventCommandComplete(u16 _OpCode, SQueuedEvent Event(sizeof(SHCIEventCommand) + _DataSize, 0); - SHCIEventCommand* pHCIEvent = (SHCIEventCommand*)Event.m_buffer; - pHCIEvent->EventType = HCI_EVENT_COMMAND_COMPL; + SHCIEventCommand* pHCIEvent = (SHCIEventCommand*)Event.m_buffer; + pHCIEvent->EventType = HCI_EVENT_COMMAND_COMPL; pHCIEvent->PayloadLength = (u8)(sizeof(SHCIEventCommand) - 2 + _DataSize); - pHCIEvent->PacketIndicator = 0x01; + pHCIEvent->PacketIndicator = 0x01; pHCIEvent->Opcode = _OpCode; // add the payload @@ -870,14 +872,14 @@ bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventCommandStatus(u16 _Opcode) } bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventRoleChange(bdaddr_t _bd, bool _master) -{ +{ CWII_IPC_HLE_WiiMote* pWiiMote = AccessWiiMote(_bd); if (pWiiMote == NULL) return false; SQueuedEvent Event(sizeof(SHCIEventRoleChange), 0); - SHCIEventRoleChange* pRoleChange = (SHCIEventRoleChange*)Event.m_buffer; + SHCIEventRoleChange* pRoleChange = (SHCIEventRoleChange*)Event.m_buffer; pRoleChange->EventType = HCI_EVENT_ROLE_CHANGE; pRoleChange->PayloadLength = sizeof(SHCIEventRoleChange) - 2; @@ -928,7 +930,9 @@ bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventNumberOfCompletedPackets() } if (acc) + { AddEventToQueue(Event); + } else { INFO_LOG(WII_IPC_WIIMOTE, "SendEventNumberOfCompletedPackets: no packets; no event"); @@ -1139,7 +1143,7 @@ void CWII_IPC_HLE_Device_usb_oh1_57e_305::ExecuteHCICommandMessage(const SHCICom break; case HCI_CMD_SET_EVENT_FILTER: - CommandSetEventFilter(pInput); + CommandSetEventFilter(pInput); break; case HCI_CMD_INQUIRY: @@ -1147,10 +1151,10 @@ void CWII_IPC_HLE_Device_usb_oh1_57e_305::ExecuteHCICommandMessage(const SHCICom break; case HCI_CMD_WRITE_INQUIRY_SCAN_TYPE: - CommandWriteInquiryScanType(pInput); + CommandWriteInquiryScanType(pInput); break; - // vendor specific... + // vendor specific... case 0xFC4C: CommandVendorSpecific_FC4C(pInput, _rHCICommandMessage.m_PayLoadSize - 3); break; @@ -1160,7 +1164,7 @@ void CWII_IPC_HLE_Device_usb_oh1_57e_305::ExecuteHCICommandMessage(const SHCICom break; case HCI_CMD_INQUIRY_CANCEL: - CommandInquiryCancel(pInput); + CommandInquiryCancel(pInput); break; case HCI_CMD_REMOTE_NAME_REQ: @@ -1190,7 +1194,7 @@ void CWII_IPC_HLE_Device_usb_oh1_57e_305::ExecuteHCICommandMessage(const SHCICom case HCI_CMD_READ_REMOTE_FEATURES: CommandReadRemoteFeatures(pInput); break; - + case HCI_CMD_WRITE_LINK_POLICY_SETTINGS: CommandWriteLinkPolicy(pInput); break; @@ -1219,9 +1223,9 @@ void CWII_IPC_HLE_Device_usb_oh1_57e_305::ExecuteHCICommandMessage(const SHCICom CommandLinkKeyRep(pInput); break; - case HCI_CMD_DELETE_STORED_LINK_KEY: - CommandDeleteStoredLinkKey(pInput); - break; + case HCI_CMD_DELETE_STORED_LINK_KEY: + CommandDeleteStoredLinkKey(pInput); + break; default: // send fake okay msg... @@ -1529,7 +1533,7 @@ void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandReadStoredLinkKey(u8* _Input) { hci_read_stored_link_key_cp* ReadStoredLinkKey = (hci_read_stored_link_key_cp*)_Input; - hci_read_stored_link_key_rp Reply; + hci_read_stored_link_key_rp Reply; Reply.status = 0x00; Reply.max_num_keys = 255; @@ -1735,7 +1739,7 @@ void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandReadLocalVer(u8* _Input) Reply.status = 0x00; Reply.hci_version = 0x03; // HCI version: 1.1 Reply.hci_revision = 0x40a7; // current revision (?) - Reply.lmp_version = 0x03; // LMP version: 1.1 + Reply.lmp_version = 0x03; // LMP version: 1.1 Reply.manufacturer = 0x000F; // manufacturer: reserved for tests Reply.lmp_subversion = 0x430e; // LMP subversion @@ -1752,7 +1756,7 @@ void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandReadLocalVer(u8* _Input) void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandReadLocalFeatures(u8* _Input) { - hci_read_local_features_rp Reply; + hci_read_local_features_rp Reply; Reply.status = 0x00; Reply.features[0] = 0xFF; Reply.features[1] = 0xFF; @@ -1885,9 +1889,9 @@ CWII_IPC_HLE_WiiMote* CWII_IPC_HLE_Device_usb_oh1_57e_305::AccessWiiMote(u16 _Co void CWII_IPC_HLE_Device_usb_oh1_57e_305::LOG_LinkKey(const u8* _pLinkKey) { DEBUG_LOG(WII_IPC_WIIMOTE, " link key: " - "0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x " - "0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x " - , _pLinkKey[0], _pLinkKey[1], _pLinkKey[2], _pLinkKey[3], _pLinkKey[4], _pLinkKey[5], _pLinkKey[6], _pLinkKey[7] - , _pLinkKey[8], _pLinkKey[9], _pLinkKey[10], _pLinkKey[11], _pLinkKey[12], _pLinkKey[13], _pLinkKey[14], _pLinkKey[15]); + "0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x " + "0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x " + , _pLinkKey[0], _pLinkKey[1], _pLinkKey[2], _pLinkKey[3], _pLinkKey[4], _pLinkKey[5], _pLinkKey[6], _pLinkKey[7] + , _pLinkKey[8], _pLinkKey[9], _pLinkKey[10], _pLinkKey[11], _pLinkKey[12], _pLinkKey[13], _pLinkKey[14], _pLinkKey[15]); } diff --git a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.h b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.h index 2883dbc61d..51c774933f 100644 --- a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.h +++ b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.h @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #pragma once @@ -102,7 +102,7 @@ private: enum USBEndpoint { - HCI_CTRL = 0x00, + HCI_CTRL = 0x00, HCI_EVENT = 0x81, ACL_DATA_IN = 0x82, ACL_DATA_OUT = 0x02 @@ -253,7 +253,7 @@ private: void CommandDisconnect(u8* _Input); void CommandLinkKeyNegRep(u8* _Input); void CommandLinkKeyRep(u8* _Input); - void CommandDeleteStoredLinkKey(u8* _Input); + void CommandDeleteStoredLinkKey(u8* _Input); void CommandChangeConPacketType(u8* _Input); // OGF 0x02 Link policy commands and return parameters diff --git a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb_kbd.cpp b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb_kbd.cpp index 7294a2bf1c..61a94b7099 100644 --- a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb_kbd.cpp +++ b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb_kbd.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #include "../ConfigManager.h" diff --git a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_WiiMote.cpp b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_WiiMote.cpp index cad66c9795..b9e8f6e438 100644 --- a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_WiiMote.cpp +++ b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_WiiMote.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #include "Common.h" // Common @@ -319,7 +319,7 @@ void CWII_IPC_HLE_WiiMote::ExecuteL2capCmd(u8* _pData, u32 _Size) } void CWII_IPC_HLE_WiiMote::SignalChannel(u8* _pData, u32 _Size) -{ +{ while (_Size >= sizeof(l2cap_cmd_hdr_t)) { l2cap_cmd_hdr_t* cmd_hdr = (l2cap_cmd_hdr_t*)_pData; @@ -333,7 +333,7 @@ void CWII_IPC_HLE_WiiMote::SignalChannel(u8* _pData, u32 _Size) "Try to replace your SYSCONF file with a new copy."); break; - case L2CAP_CONNECT_REQ: + case L2CAP_CONNECT_REQ: ReceiveConnectionReq(cmd_hdr->ident, _pData, cmd_hdr->length); break; @@ -341,7 +341,7 @@ void CWII_IPC_HLE_WiiMote::SignalChannel(u8* _pData, u32 _Size) ReceiveConnectionResponse(cmd_hdr->ident, _pData, cmd_hdr->length); break; - case L2CAP_CONFIG_REQ: + case L2CAP_CONFIG_REQ: ReceiveConfigurationReq(cmd_hdr->ident, _pData, cmd_hdr->length); break; @@ -664,8 +664,8 @@ void CWII_IPC_HLE_WiiMote::SDPSendServiceSearchResponse(u16 cid, u16 Transaction // verify block... we handle search pattern for HID service only { CBigEndianBuffer buffer(pServiceSearchPattern); - _dbg_assert_(WII_IPC_WIIMOTE, buffer.Read8(0) == SDP_SEQ8); // data sequence - _dbg_assert_(WII_IPC_WIIMOTE, buffer.Read8(1) == 0x03); // sequence size + _dbg_assert_(WII_IPC_WIIMOTE, buffer.Read8(0) == SDP_SEQ8); // data sequence + _dbg_assert_(WII_IPC_WIIMOTE, buffer.Read8(1) == 0x03); // sequence size // HIDClassID _dbg_assert_(WII_IPC_WIIMOTE, buffer.Read8(2) == 0x19); @@ -696,7 +696,7 @@ static u32 ParseCont(u8* pCont) { u32 attribOffset = 0; CBigEndianBuffer attribList(pCont); - u8 typeID = attribList.Read8(attribOffset); attribOffset++; + u8 typeID = attribList.Read8(attribOffset); attribOffset++; if (typeID == 0x02) { @@ -719,7 +719,7 @@ int ParseAttribList(u8* pAttribIDList, u16& _startID, u16& _endID) u8 sequence = attribList.Read8(attribOffset); attribOffset++; u8 seqSize = attribList.Read8(attribOffset); attribOffset++; - u8 typeID = attribList.Read8(attribOffset); attribOffset++; + u8 typeID = attribList.Read8(attribOffset); attribOffset++; #if MAX_LOGLEVEL >= DEBUG_LEVEL _dbg_assert_(WII_IPC_WIIMOTE, sequence == SDP_SEQ8); diff --git a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_WiiMote.h b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_WiiMote.h index 5373f68c0a..22ff5756dd 100644 --- a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_WiiMote.h +++ b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_WiiMote.h @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #ifndef _WII_IPC_HLE_WII_MOTE_ #define _WII_IPC_HLE_WII_MOTE_ diff --git a/Source/Core/Core/Src/IPC_HLE/WiiMote_HID_Attr.cpp b/Source/Core/Core/Src/IPC_HLE/WiiMote_HID_Attr.cpp index 90ee35c16a..ce6f336a19 100644 --- a/Source/Core/Core/Src/IPC_HLE/WiiMote_HID_Attr.cpp +++ b/Source/Core/Core/Src/IPC_HLE/WiiMote_HID_Attr.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #include "Common.h" diff --git a/Source/Core/Core/Src/IPC_HLE/WiiMote_HID_Attr.h b/Source/Core/Core/Src/IPC_HLE/WiiMote_HID_Attr.h index ff9d4ff1ad..703aae24d2 100644 --- a/Source/Core/Core/Src/IPC_HLE/WiiMote_HID_Attr.h +++ b/Source/Core/Core/Src/IPC_HLE/WiiMote_HID_Attr.h @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #ifndef WIIMOTE_HID_ATTR_H_ diff --git a/Source/Core/Core/Src/MemTools.h b/Source/Core/Core/Src/MemTools.h index 6acab1935b..2b73d74ca2 100644 --- a/Source/Core/Core/Src/MemTools.h +++ b/Source/Core/Core/Src/MemTools.h @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #ifndef _MEMTOOLS_H diff --git a/Source/Core/Core/Src/Movie.cpp b/Source/Core/Core/Src/Movie.cpp index e72163cddb..e1e1910a0e 100644 --- a/Source/Core/Core/Src/Movie.cpp +++ b/Source/Core/Core/Src/Movie.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #include "Movie.h" @@ -94,6 +94,7 @@ void EnsureTmpInputSize(size_t bound) size_t newAlloc = DTM_BASE_LENGTH; while (newAlloc < bound) newAlloc *= 2; + u8* newTmpInput = new u8[newAlloc]; tmpInputAllocated = newAlloc; if (tmpInput != NULL) @@ -118,10 +119,12 @@ std::string GetInputDisplay() g_numPads |= (1 << (i + 4)); } } + std::string inputDisplay = ""; for (int i = 0; i < 8; ++i) if ((g_numPads & (1 << i)) != 0) inputDisplay.append(g_InputDisplay[i]); + return inputDisplay; } @@ -177,6 +180,7 @@ void Init() EndPlayInput(false); } } + if (IsRecordingInput()) { GetSettings(); diff --git a/Source/Core/Core/Src/Movie.h b/Source/Core/Core/Src/Movie.h index 79b5e72f29..3942c58420 100644 --- a/Source/Core/Core/Src/Movie.h +++ b/Source/Core/Core/Src/Movie.h @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #ifndef __MOVIE_H @@ -86,19 +86,19 @@ struct DTMHeader { u8 gameID[6]; // The Game ID bool bWii; // Wii game - u8 numControllers; // The number of connected controllers (1-4) + u8 numControllers; // The number of connected controllers (1-4) - bool bFromSaveState; // false indicates that the recording started from bootup, true for savestate - u64 frameCount; // Number of frames in the recording + bool bFromSaveState; // false indicates that the recording started from bootup, true for savestate + u64 frameCount; // Number of frames in the recording u64 inputCount; // Number of input frames in recording - u64 lagCount; // Number of lag frames in the recording - u64 uniqueID; // (not implemented) A Unique ID comprised of: md5(time + Game ID) - u32 numRerecords; // Number of rerecords/'cuts' of this TAS - u8 author[32]; // Author's name (encoded in UTF-8) + u64 lagCount; // Number of lag frames in the recording + u64 uniqueID; // (not implemented) A Unique ID comprised of: md5(time + Game ID) + u32 numRerecords; // Number of rerecords/'cuts' of this TAS + u8 author[32]; // Author's name (encoded in UTF-8) - u8 videoBackend[16]; // UTF-8 representation of the video backend - u8 audioEmulator[16]; // UTF-8 representation of the audio emulator - unsigned char md5[16]; // MD5 of game iso + u8 videoBackend[16]; // UTF-8 representation of the video backend + u8 audioEmulator[16]; // UTF-8 representation of the audio emulator + unsigned char md5[16]; // MD5 of game iso u64 recordingStartTime; // seconds since 1970 that recording started (used for RTC) diff --git a/Source/Core/Core/Src/NetPlay.cpp b/Source/Core/Core/Src/NetPlay.cpp index ec4493bfd0..cac695159a 100644 --- a/Source/Core/Core/Src/NetPlay.cpp +++ b/Source/Core/Core/Src/NetPlay.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #include "NetPlay.h" diff --git a/Source/Core/Core/Src/PatchEngine.cpp b/Source/Core/Core/Src/PatchEngine.cpp index 74e778c916..cc1d3c7703 100644 --- a/Source/Core/Core/Src/PatchEngine.cpp +++ b/Source/Core/Core/Src/PatchEngine.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ // PatchEngine @@ -55,7 +55,7 @@ const char *PatchTypeStrings[] = std::vector onFrame; std::map speedHacks; std::vector discList; - + void LoadPatchSection(const char *section, std::vector &patches, IniFile &ini) { std::vector lines; @@ -113,22 +113,23 @@ void LoadPatchSection(const char *section, std::vector &patches, IniFile if (currentPatch.name.size() && currentPatch.entries.size()) patches.push_back(currentPatch); } - -static void LoadDiscList(const char *section, std::vector &_discList, IniFile &ini) { - std::vector lines; - if (!ini.GetLines(section, lines)) - return; - - for (std::vector::const_iterator iter = lines.begin(); iter != lines.end(); ++iter) +static void LoadDiscList(const char *section, std::vector &_discList, IniFile &ini) +{ + std::vector lines; + if (!ini.GetLines(section, lines)) + return; + + for (std::vector::const_iterator iter = lines.begin(); iter != lines.end(); ++iter) { - std::string line = *iter; - if (line.size()) - _discList.push_back(line); - } + std::string line = *iter; + if (line.size()) + _discList.push_back(line); + } } -static void LoadSpeedhacks(const char *section, std::map &hacks, IniFile &ini) { +static void LoadSpeedhacks(const char *section, std::map &hacks, IniFile &ini) +{ std::vector keys; ini.GetKeys(section, keys); for (std::vector::const_iterator iter = keys.begin(); iter != keys.end(); ++iter) @@ -163,7 +164,9 @@ void LoadPatches(const char *gameID) { IniFile ini; std::string filename = File::GetUserPath(D_GAMECONFIG_IDX) + gameID + ".ini"; - if (ini.Load(filename.c_str())) { + + if (ini.Load(filename.c_str())) + { LoadPatchSection("OnFrame", onFrame, ini); ActionReplay::LoadCodes(ini, false); diff --git a/Source/Core/Core/Src/PatchEngine.h b/Source/Core/Core/Src/PatchEngine.h index 9b029f943f..fe70341859 100644 --- a/Source/Core/Core/Src/PatchEngine.h +++ b/Source/Core/Core/Src/PatchEngine.h @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #ifndef _PATCHENGINE_H diff --git a/Source/Core/Core/Src/PowerPC/CPUCoreBase.h b/Source/Core/Core/Src/PowerPC/CPUCoreBase.h index d7d412701d..fd59f1ecc0 100644 --- a/Source/Core/Core/Src/PowerPC/CPUCoreBase.h +++ b/Source/Core/Core/Src/PowerPC/CPUCoreBase.h @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #ifndef _CPUCOREBASE_H diff --git a/Source/Core/Core/Src/PowerPC/Gekko.h b/Source/Core/Core/Src/PowerPC/Gekko.h index 8615acd5ed..ba3df57943 100644 --- a/Source/Core/Core/Src/PowerPC/Gekko.h +++ b/Source/Core/Core/Src/PowerPC/Gekko.h @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ // Gekko related unions, structs, ... // diff --git a/Source/Core/Core/Src/PowerPC/Interpreter/Interpreter.cpp b/Source/Core/Core/Src/PowerPC/Interpreter/Interpreter.cpp index 212a79d7ee..9f5a1b3876 100644 --- a/Source/Core/Core/Src/PowerPC/Interpreter/Interpreter.cpp +++ b/Source/Core/Core/Src/PowerPC/Interpreter/Interpreter.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #include "../../HW/Memmap.h" @@ -82,14 +82,16 @@ void Trace( UGeckoInstruction &instCode ) { char reg[25]=""; std::string regs = ""; - for (int i=0; i<32; i++) { + for (int i=0; i<32; i++) + { sprintf(reg, "r%02d: %08x ", i, PowerPC::ppcState.gpr[i]); regs.append(reg); } char freg[25]=""; std::string fregs = ""; - for (int i=0; i<32; i++) { + for (int i=0; i<32; i++) + { sprintf(freg, "f%02d: %08llx %08llx ", i, PowerPC::ppcState.ps[i][0], PowerPC::ppcState.ps[i][1]); fregs.append(freg); } @@ -182,7 +184,7 @@ int Interpreter::SingleStepInner(void) } PowerPC::ppcState.DebugCount++; #endif - patches(); + patches(); GekkoOPInfo *opinfo = GetOpInfo(instCode); return opinfo->numCyclesMinusOne + 1; diff --git a/Source/Core/Core/Src/PowerPC/Interpreter/Interpreter.h b/Source/Core/Core/Src/PowerPC/Interpreter/Interpreter.h index 41c81abe86..19a4ddc8a1 100644 --- a/Source/Core/Core/Src/PowerPC/Interpreter/Interpreter.h +++ b/Source/Core/Core/Src/PowerPC/Interpreter/Interpreter.h @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #ifndef _INTERPRETER_H @@ -27,9 +27,9 @@ class Interpreter : public CPUCoreBase public: void Init(); void Shutdown(); - void Reset(); - void SingleStep(); - int SingleStepInner(); + void Reset(); + void SingleStep(); + int SingleStepInner(); void Run(); void ClearCache(); diff --git a/Source/Core/Core/Src/PowerPC/Interpreter/Interpreter_Branch.cpp b/Source/Core/Core/Src/PowerPC/Interpreter/Interpreter_Branch.cpp index 0a14573b49..6b72f1dd2b 100644 --- a/Source/Core/Core/Src/PowerPC/Interpreter/Interpreter_Branch.cpp +++ b/Source/Core/Core/Src/PowerPC/Interpreter/Interpreter_Branch.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #include "Interpreter.h" diff --git a/Source/Core/Core/Src/PowerPC/Interpreter/Interpreter_FPUtils.h b/Source/Core/Core/Src/PowerPC/Interpreter/Interpreter_FPUtils.h index 5dd96ed6e7..e366dad7ce 100644 --- a/Source/Core/Core/Src/PowerPC/Interpreter/Interpreter_FPUtils.h +++ b/Source/Core/Core/Src/PowerPC/Interpreter/Interpreter_FPUtils.h @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #ifndef _INTERPRETER_FPUTILS_H @@ -70,8 +70,8 @@ inline void SetFI(int FI) { if (FI) { - SetFPException(FPSCR_XX); - } + SetFPException(FPSCR_XX); + } FPSCR.FI = FI; } @@ -112,13 +112,13 @@ inline double ForceDouble(double d) // also, these may be used to set flags like FR, FI, OX, UX inline double NI_mul(const double a, const double b) -{ +{ #ifdef VERY_ACCURATE_FP if (a != a) return a; if (b != b) return b; double t = a * b; if (t != t) - { + { SetFPException(FPSCR_VXIMZ); return PPC_NAN; } @@ -248,7 +248,7 @@ inline u32 ConvertToSingleFTZ(u64 x) } else { - return (x >> 32) & 0x80000000; + return (x >> 32) & 0x80000000; } } diff --git a/Source/Core/Core/Src/PowerPC/Interpreter/Interpreter_FloatingPoint.cpp b/Source/Core/Core/Src/PowerPC/Interpreter/Interpreter_FloatingPoint.cpp index ffaea0e868..a9424396a3 100644 --- a/Source/Core/Core/Src/PowerPC/Interpreter/Interpreter_FloatingPoint.cpp +++ b/Source/Core/Core/Src/PowerPC/Interpreter/Interpreter_FloatingPoint.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #include @@ -49,7 +49,7 @@ void Interpreter::Helper_UpdateCR1(double _fValue) } void Interpreter::fcmpo(UGeckoInstruction _inst) -{ +{ double fa = rPS0(_inst.FA); double fb = rPS0(_inst.FB); @@ -64,7 +64,7 @@ void Interpreter::fcmpo(UGeckoInstruction _inst) compareResult = 1; if (IsSNAN(fa) || IsSNAN(fb)) { - SetFPException(FPSCR_VXSNAN); + SetFPException(FPSCR_VXSNAN); if (FPSCR.VE == 0) SetFPException(FPSCR_VXVC); } @@ -80,7 +80,7 @@ void Interpreter::fcmpo(UGeckoInstruction _inst) } void Interpreter::fcmpu(UGeckoInstruction _inst) -{ +{ double fa = rPS0(_inst.FA); double fb = rPS0(_inst.FB); @@ -94,7 +94,7 @@ void Interpreter::fcmpu(UGeckoInstruction _inst) compareResult = 1; if (IsSNAN(fa) || IsSNAN(fb)) { - SetFPException(FPSCR_VXSNAN); + SetFPException(FPSCR_VXSNAN); } } FPSCR.FPRF = compareResult; @@ -108,7 +108,7 @@ void Interpreter::fctiwx(UGeckoInstruction _inst) u32 value; if (b > (double)0x7fffffff) { - value = 0x7fffffff; + value = 0x7fffffff; SetFPException(FPSCR_VXCVI); FPSCR.FI = 0; FPSCR.FR = 0; @@ -135,11 +135,11 @@ void Interpreter::fctiwx(UGeckoInstruction _inst) case 1: // zero i = (s32)b; break; - case 2: // +inf + case 2: // +inf i = (s32)b; if (b - i > 0) i++; break; - case 3: // -inf + case 3: // -inf i = (s32)b; if (b - i < 0) i--; break; @@ -153,7 +153,7 @@ void Interpreter::fctiwx(UGeckoInstruction _inst) } else { - SetFI(1); + SetFI(1); FPSCR.FR = fabs(di) > fabs(b); } } @@ -229,7 +229,7 @@ void Interpreter::fnabsx(UGeckoInstruction _inst) riPS0(_inst.FD) = riPS0(_inst.FB) | (1ULL << 63); // This is a binary instruction. Does not alter FPSCR if (_inst.Rc) Helper_UpdateCR1(rPS0(_inst.FD)); -} +} void Interpreter::fnegx(UGeckoInstruction _inst) { @@ -293,7 +293,7 @@ void Interpreter::fmaddsx(UGeckoInstruction _inst) rPS0(_inst.FD) = rPS1(_inst.FD) = ForceSingle(d_value); FPSCR.FI = d_value != rPS0(_inst.FD); FPSCR.FR = 0; - UpdateFPRF(rPS0(_inst.FD)); + UpdateFPRF(rPS0(_inst.FD)); if (_inst.Rc) Helper_UpdateCR1(rPS0(_inst.FD)); } @@ -301,13 +301,13 @@ void Interpreter::fmaddsx(UGeckoInstruction _inst) void Interpreter::faddx(UGeckoInstruction _inst) { rPS0(_inst.FD) = ForceDouble(NI_add(rPS0(_inst.FA), rPS0(_inst.FB))); - UpdateFPRF(rPS0(_inst.FD)); + UpdateFPRF(rPS0(_inst.FD)); if (_inst.Rc) Helper_UpdateCR1(rPS0(_inst.FD)); } void Interpreter::faddsx(UGeckoInstruction _inst) { rPS0(_inst.FD) = rPS1(_inst.FD) = ForceSingle(NI_add(rPS0(_inst.FA), rPS0(_inst.FB))); - UpdateFPRF(rPS0(_inst.FD)); + UpdateFPRF(rPS0(_inst.FD)); if (_inst.Rc) Helper_UpdateCR1(rPS0(_inst.FD)); } @@ -321,9 +321,9 @@ void Interpreter::fdivx(UGeckoInstruction _inst) { rPS0(_inst.FD) = ForceDouble(a / b); if (b == 0.0) - { + { if (a == 0.0) - { + { SetFPException(FPSCR_VXZDZ); rPS0(_inst.FD) = PPC_NAN; } @@ -338,7 +338,7 @@ void Interpreter::fdivx(UGeckoInstruction _inst) } } } - UpdateFPRF(rPS0(_inst.FD)); + UpdateFPRF(rPS0(_inst.FD)); // FR,FI,OX,UX??? if (_inst.Rc) Helper_UpdateCR1(rPS0(_inst.FD)); } @@ -353,12 +353,12 @@ void Interpreter::fdivsx(UGeckoInstruction _inst) { res = ForceSingle(a / b); if (b == 0.0) - { + { if (a == 0.0) - { + { SetFPException(FPSCR_VXZDZ); - res = PPC_NAN; - } + res = PPC_NAN; + } SetFPException(FPSCR_ZX); } else @@ -371,7 +371,7 @@ void Interpreter::fdivsx(UGeckoInstruction _inst) } } rPS0(_inst.FD) = rPS1(_inst.FD) = res; - UpdateFPRF(rPS0(_inst.FD)); + UpdateFPRF(rPS0(_inst.FD)); if (_inst.Rc) Helper_UpdateCR1(rPS0(_inst.FD)); } @@ -396,7 +396,7 @@ void Interpreter::fresx(UGeckoInstruction _inst) { SetFPException(FPSCR_ZX); } - UpdateFPRF(rPS0(_inst.FD)); + UpdateFPRF(rPS0(_inst.FD)); if (_inst.Rc) Helper_UpdateCR1(rPS0(_inst.FD)); } @@ -407,11 +407,12 @@ void Interpreter::frsqrtex(UGeckoInstruction _inst) { SetFPException(FPSCR_VXSQRT); rPS0(_inst.FD) = PPC_NAN; - } - else + } + else { #ifdef VERY_ACCURATE_FP - if (b == 0.0) { + if (b == 0.0) + { SetFPException(FPSCR_ZX); riPS0(_inst.FD) = 0x7ff0000000000000; } @@ -438,14 +439,14 @@ void Interpreter::frsqrtex(UGeckoInstruction _inst) rPS0(_inst.FD) = ForceDouble(1.0 / sqrt(b)); #endif } - UpdateFPRF(rPS0(_inst.FD)); + UpdateFPRF(rPS0(_inst.FD)); if (_inst.Rc) Helper_UpdateCR1(rPS0(_inst.FD)); } void Interpreter::fmsubx(UGeckoInstruction _inst) { rPS0(_inst.FD) = ForceDouble(NI_msub( rPS0(_inst.FA), rPS0(_inst.FC), rPS0(_inst.FB) )); - UpdateFPRF(rPS0(_inst.FD)); + UpdateFPRF(rPS0(_inst.FD)); if (_inst.Rc) Helper_UpdateCR1(rPS0(_inst.FD)); } @@ -453,28 +454,28 @@ void Interpreter::fmsubsx(UGeckoInstruction _inst) { rPS0(_inst.FD) = rPS1(_inst.FD) = ForceSingle( NI_msub(rPS0(_inst.FA), rPS0(_inst.FC), rPS0(_inst.FB) )); - UpdateFPRF(rPS0(_inst.FD)); + UpdateFPRF(rPS0(_inst.FD)); if (_inst.Rc) Helper_UpdateCR1(rPS0(_inst.FD)); } void Interpreter::fnmaddx(UGeckoInstruction _inst) { rPS0(_inst.FD) = ForceDouble(-NI_madd(rPS0(_inst.FA), rPS0(_inst.FC), rPS0(_inst.FB))); - UpdateFPRF(rPS0(_inst.FD)); + UpdateFPRF(rPS0(_inst.FD)); if (_inst.Rc) Helper_UpdateCR1(rPS0(_inst.FD)); } void Interpreter::fnmaddsx(UGeckoInstruction _inst) { rPS0(_inst.FD) = rPS1(_inst.FD) = ForceSingle(-NI_madd(rPS0(_inst.FA), rPS0(_inst.FC), rPS0(_inst.FB))); - UpdateFPRF(rPS0(_inst.FD)); + UpdateFPRF(rPS0(_inst.FD)); if (_inst.Rc) Helper_UpdateCR1(rPS0(_inst.FD)); } void Interpreter::fnmsubx(UGeckoInstruction _inst) { rPS0(_inst.FD) = ForceDouble(-NI_msub(rPS0(_inst.FA), rPS0(_inst.FC), rPS0(_inst.FB))); - UpdateFPRF(rPS0(_inst.FD)); + UpdateFPRF(rPS0(_inst.FD)); if (_inst.Rc) Helper_UpdateCR1(rPS0(_inst.FD)); } @@ -483,14 +484,14 @@ void Interpreter::fnmsubsx(UGeckoInstruction _inst) { rPS0(_inst.FD) = rPS1(_inst.FD) = ForceSingle(-NI_msub(rPS0(_inst.FA), rPS0(_inst.FC), rPS0(_inst.FB))); - UpdateFPRF(rPS0(_inst.FD)); + UpdateFPRF(rPS0(_inst.FD)); if (_inst.Rc) Helper_UpdateCR1(rPS0(_inst.FD)); } void Interpreter::fsubx(UGeckoInstruction _inst) { rPS0(_inst.FD) = ForceDouble(NI_sub(rPS0(_inst.FA), rPS0(_inst.FB))); - UpdateFPRF(rPS0(_inst.FD)); + UpdateFPRF(rPS0(_inst.FD)); if (_inst.Rc) Helper_UpdateCR1(rPS0(_inst.FD)); } @@ -510,6 +511,6 @@ void Interpreter::fsqrtx(UGeckoInstruction _inst) FPSCR.VXSQRT = 1; } rPS0(_inst.FD) = sqrt(b); - UpdateFPRF(rPS0(_inst.FD)); + UpdateFPRF(rPS0(_inst.FD)); if (_inst.Rc) Helper_UpdateCR1(rPS0(_inst.FD)); } diff --git a/Source/Core/Core/Src/PowerPC/Interpreter/Interpreter_Integer.cpp b/Source/Core/Core/Src/PowerPC/Interpreter/Interpreter_Integer.cpp index 743ff86431..9c4ef3cb06 100644 --- a/Source/Core/Core/Src/PowerPC/Interpreter/Interpreter_Integer.cpp +++ b/Source/Core/Core/Src/PowerPC/Interpreter/Interpreter_Integer.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #include "Interpreter.h" diff --git a/Source/Core/Core/Src/PowerPC/Interpreter/Interpreter_LoadStore.cpp b/Source/Core/Core/Src/PowerPC/Interpreter/Interpreter_LoadStore.cpp index 8e406dbfab..af6808b744 100644 --- a/Source/Core/Core/Src/PowerPC/Interpreter/Interpreter_LoadStore.cpp +++ b/Source/Core/Core/Src/PowerPC/Interpreter/Interpreter_LoadStore.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #include "Common.h" @@ -394,7 +394,7 @@ void Interpreter::dcbtst(UGeckoInstruction _inst) } void Interpreter::dcbz(UGeckoInstruction _inst) -{ +{ // HACK but works... we think if (!Core::g_CoreStartupParameter.bDCBZOFF) Memory::Memset(Helper_Get_EA_X(_inst) & (~31), 0, 32); @@ -457,7 +457,7 @@ void Interpreter::eieio(UGeckoInstruction _inst) } void Interpreter::icbi(UGeckoInstruction _inst) -{ +{ u32 address = Helper_Get_EA_X(_inst); PowerPC::ppcState.iCache.Invalidate(address); } @@ -730,7 +730,7 @@ void Interpreter::stswi(UGeckoInstruction _inst) EA = 0; else EA = m_GPR[_inst.RA]; - + u32 n; if (_inst.NB == 0) n = 32; @@ -792,7 +792,7 @@ void Interpreter::stwbrx(UGeckoInstruction _inst) // The following two instructions are for SMP communications. On a single // CPU, they cannot fail unless an interrupt happens in between. - + void Interpreter::lwarx(UGeckoInstruction _inst) { u32 uAddress = Helper_Get_EA_X(_inst); diff --git a/Source/Core/Core/Src/PowerPC/Interpreter/Interpreter_LoadStorePaired.cpp b/Source/Core/Core/Src/PowerPC/Interpreter/Interpreter_LoadStorePaired.cpp index ed15500260..c77319f60d 100644 --- a/Source/Core/Core/Src/PowerPC/Interpreter/Interpreter_LoadStorePaired.cpp +++ b/Source/Core/Core/Src/PowerPC/Interpreter/Interpreter_LoadStorePaired.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #include diff --git a/Source/Core/Core/Src/PowerPC/Interpreter/Interpreter_Paired.cpp b/Source/Core/Core/Src/PowerPC/Interpreter/Interpreter_Paired.cpp index 923443186c..25ddb3d808 100644 --- a/Source/Core/Core/Src/PowerPC/Interpreter/Interpreter_Paired.cpp +++ b/Source/Core/Core/Src/PowerPC/Interpreter/Interpreter_Paired.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #include diff --git a/Source/Core/Core/Src/PowerPC/Interpreter/Interpreter_SystemRegisters.cpp b/Source/Core/Core/Src/PowerPC/Interpreter/Interpreter_SystemRegisters.cpp index 7847496b6e..412c1d1fbd 100644 --- a/Source/Core/Core/Src/PowerPC/Interpreter/Interpreter_SystemRegisters.cpp +++ b/Source/Core/Core/Src/PowerPC/Interpreter/Interpreter_SystemRegisters.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #include diff --git a/Source/Core/Core/Src/PowerPC/Interpreter/Interpreter_Tables.cpp b/Source/Core/Core/Src/PowerPC/Interpreter/Interpreter_Tables.cpp index fee8ed70d8..f47f876168 100644 --- a/Source/Core/Core/Src/PowerPC/Interpreter/Interpreter_Tables.cpp +++ b/Source/Core/Core/Src/PowerPC/Interpreter/Interpreter_Tables.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #include "Interpreter_Tables.h" diff --git a/Source/Core/Core/Src/PowerPC/Interpreter/Interpreter_Tables.h b/Source/Core/Core/Src/PowerPC/Interpreter/Interpreter_Tables.h index e532345b7c..661767ee04 100644 --- a/Source/Core/Core/Src/PowerPC/Interpreter/Interpreter_Tables.h +++ b/Source/Core/Core/Src/PowerPC/Interpreter/Interpreter_Tables.h @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #ifndef INTERPRETER_TABLES_H diff --git a/Source/Core/Core/Src/PowerPC/Jit64/Jit.cpp b/Source/Core/Core/Src/PowerPC/Jit64/Jit.cpp index 6253b9b4ec..82e163ce57 100644 --- a/Source/Core/Core/Src/PowerPC/Jit64/Jit.cpp +++ b/Source/Core/Core/Src/PowerPC/Jit64/Jit.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #include diff --git a/Source/Core/Core/Src/PowerPC/Jit64/Jit.h b/Source/Core/Core/Src/PowerPC/Jit64/Jit.h index 1d856d6291..b4a9454ba2 100644 --- a/Source/Core/Core/Src/PowerPC/Jit64/Jit.h +++ b/Source/Core/Core/Src/PowerPC/Jit64/Jit.h @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ // ======================== diff --git a/Source/Core/Core/Src/PowerPC/Jit64/Jit64_Tables.cpp b/Source/Core/Core/Src/PowerPC/Jit64/Jit64_Tables.cpp index cee1f4d048..3d524956ff 100644 --- a/Source/Core/Core/Src/PowerPC/Jit64/Jit64_Tables.cpp +++ b/Source/Core/Core/Src/PowerPC/Jit64/Jit64_Tables.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #include "Jit.h" diff --git a/Source/Core/Core/Src/PowerPC/Jit64/Jit64_Tables.h b/Source/Core/Core/Src/PowerPC/Jit64/Jit64_Tables.h index c2049593c4..5bed438b88 100644 --- a/Source/Core/Core/Src/PowerPC/Jit64/Jit64_Tables.h +++ b/Source/Core/Core/Src/PowerPC/Jit64/Jit64_Tables.h @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #ifndef JIT64_TABLES_H diff --git a/Source/Core/Core/Src/PowerPC/Jit64/JitAsm.h b/Source/Core/Core/Src/PowerPC/Jit64/JitAsm.h index 19e1f41ba8..664ad8ab75 100644 --- a/Source/Core/Core/Src/PowerPC/Jit64/JitAsm.h +++ b/Source/Core/Core/Src/PowerPC/Jit64/JitAsm.h @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #ifndef _JIT64ASM_H diff --git a/Source/Core/Core/Src/PowerPC/Jit64/JitRegCache.cpp b/Source/Core/Core/Src/PowerPC/Jit64/JitRegCache.cpp index 598eaa9d0b..ec8fb6fe0a 100644 --- a/Source/Core/Core/Src/PowerPC/Jit64/JitRegCache.cpp +++ b/Source/Core/Core/Src/PowerPC/Jit64/JitRegCache.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #include "../PowerPC.h" @@ -25,7 +25,8 @@ using namespace Gen; using namespace PowerPC; -RegCache::RegCache() : emit(0) { +RegCache::RegCache() : emit(0) +{ memset(locks, 0, sizeof(locks)); memset(xlocks, 0, sizeof(xlocks)); memset(saved_locks, 0, sizeof(saved_locks)); @@ -165,9 +166,12 @@ void RegCache::FlushR(X64Reg reg) int RegCache::SanityCheck() const { - for (int i = 0; i < 32; i++) { - if (regs[i].away) { - if (regs[i].location.IsSimpleReg()) { + for (int i = 0; i < 32; i++) + { + if (regs[i].away) + { + if (regs[i].location.IsSimpleReg()) + { Gen::X64Reg simple = regs[i].location.GetSimpleReg(); if (xlocks[simple]) return 1; @@ -298,7 +302,9 @@ void GPRRegCache::BindToRegister(int i, bool doLoad, bool makeDirty) // and immediates are taken care of above. xregs[RX(i)].dirty |= makeDirty; } - if (xlocks[RX(i)]) { + + if (xlocks[RX(i)]) + { PanicAlert("Seriously WTF, this reg should have been flushed"); } } @@ -351,7 +357,9 @@ void FPURegCache::BindToRegister(int i, bool doLoad, bool makeDirty) } regs[i].location = newloc; regs[i].away = true; - } else { + } + else + { // There are no immediates in the FPR reg file, so we already had this in a register. Make dirty as necessary. xregs[RX(i)].dirty |= makeDirty; } @@ -380,10 +388,12 @@ void FPURegCache::StoreFromRegister(int i) void RegCache::Flush(FlushMode mode) { - for (int i = 0; i < NUMXREGS; i++) { + for (int i = 0; i < NUMXREGS; i++) + { if (xlocks[i]) PanicAlert("Someone forgot to unlock X64 reg %i.", i); } + for (int i = 0; i < 32; i++) { if (locks[i]) diff --git a/Source/Core/Core/Src/PowerPC/Jit64/JitRegCache.h b/Source/Core/Core/Src/PowerPC/Jit64/JitRegCache.h index cefa0e13f7..122c638fef 100644 --- a/Source/Core/Core/Src/PowerPC/Jit64/JitRegCache.h +++ b/Source/Core/Core/Src/PowerPC/Jit64/JitRegCache.h @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #ifndef _JIT64REGCACHE_H diff --git a/Source/Core/Core/Src/PowerPC/Jit64/Jit_Branch.cpp b/Source/Core/Core/Src/PowerPC/Jit64/Jit_Branch.cpp index 12c47fd41a..0d72d63e77 100644 --- a/Source/Core/Core/Src/PowerPC/Jit64/Jit_Branch.cpp +++ b/Source/Core/Core/Src/PowerPC/Jit64/Jit_Branch.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #include "Common.h" #include "Thunk.h" diff --git a/Source/Core/Core/Src/PowerPC/Jit64/Jit_FloatingPoint.cpp b/Source/Core/Core/Src/PowerPC/Jit64/Jit_FloatingPoint.cpp index fd197d0e84..0ebecacaa5 100644 --- a/Source/Core/Core/Src/PowerPC/Jit64/Jit_FloatingPoint.cpp +++ b/Source/Core/Core/Src/PowerPC/Jit64/Jit_FloatingPoint.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #include "Common.h" diff --git a/Source/Core/Core/Src/PowerPC/Jit64/Jit_Integer.cpp b/Source/Core/Core/Src/PowerPC/Jit64/Jit_Integer.cpp index 3d88d687e0..7274d20408 100644 --- a/Source/Core/Core/Src/PowerPC/Jit64/Jit_Integer.cpp +++ b/Source/Core/Core/Src/PowerPC/Jit64/Jit_Integer.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #include "../../Core.h" // include "Common.h", "CoreParameter.h", SCoreStartupParameter @@ -121,7 +121,8 @@ void Jit64::FinalizeCarryGenerateOverflowEAX(bool oe, bool inv) } // Assumes that the flags were just set through an addition. -void Jit64::GenerateCarry() { +void Jit64::GenerateCarry() +{ // USES_XER FixupBranch pNoCarry = J_CC(CC_NC); OR(32, M(&PowerPC::ppcState.spr[SPR_XER]), Imm32(XER_CA_MASK)); @@ -132,7 +133,8 @@ void Jit64::GenerateCarry() { } // Assumes that Sign and Zero flags were set by the last operation. Preserves all flags and registers. -void Jit64::GenerateRC() { +void Jit64::GenerateRC() +{ FixupBranch pZero = J_CC(CC_Z); FixupBranch pNegative = J_CC(CC_S); MOV(8, M(&PowerPC::ppcState.cr_fast[0]), Imm8(0x4)); // Result > 0 @@ -149,7 +151,8 @@ void Jit64::GenerateRC() { SetJumpTarget(continue2); } -void Jit64::ComputeRC(const Gen::OpArg & arg) { +void Jit64::ComputeRC(const Gen::OpArg & arg) +{ if( arg.IsImm() ) { s32 value = (s32)arg.offset; @@ -252,28 +255,36 @@ void Jit64::reg_imm(UGeckoInstruction inst) { case 14: // addi // occasionally used as MOV - emulate, with immediate propagation - if (gpr.R(a).IsImm() && d != a && a != 0) { + if (gpr.R(a).IsImm() && d != a && a != 0) + { gpr.SetImmediate32(d, (u32)gpr.R(a).offset + (u32)(s32)(s16)inst.SIMM_16); - } else if (inst.SIMM_16 == 0 && d != a && a != 0) { + } + else if (inst.SIMM_16 == 0 && d != a && a != 0) + { gpr.Lock(a, d); gpr.BindToRegister(d, false, true); MOV(32, gpr.R(d), gpr.R(a)); gpr.UnlockAll(); - } else { + } + else + { regimmop(d, a, false, (u32)(s32)inst.SIMM_16, Add, &XEmitter::ADD); //addi } break; case 15: if (a == 0) { // lis // Merge with next instruction if loading a 32-bits immediate value (lis + addi, lis + ori) - if (!js.isLastInstruction && !Core::g_CoreStartupParameter.bEnableDebugging) { - if ((js.next_inst.OPCD == 14) && (js.next_inst.RD == d) && (js.next_inst.RA == d)) { // addi + if (!js.isLastInstruction && !Core::g_CoreStartupParameter.bEnableDebugging) + { + if ((js.next_inst.OPCD == 14) && (js.next_inst.RD == d) && (js.next_inst.RA == d)) // addi + { gpr.SetImmediate32(d, ((u32)inst.SIMM_16 << 16) + (u32)(s32)js.next_inst.SIMM_16); js.downcountAmount++; js.skipnext = true; break; } - else if ((js.next_inst.OPCD == 24) && (js.next_inst.RA == d) && (js.next_inst.RS == d)) { // ori + else if ((js.next_inst.OPCD == 24) && (js.next_inst.RA == d) && (js.next_inst.RS == d)) // ori + { gpr.SetImmediate32(d, ((u32)inst.SIMM_16 << 16) | (u32)js.next_inst.UIMM); js.downcountAmount++; js.skipnext = true; @@ -284,7 +295,8 @@ void Jit64::reg_imm(UGeckoInstruction inst) // Not merged regimmop(d, a, false, (u32)inst.SIMM_16 << 16, Add, &XEmitter::ADD); } - else { // addis + else // addis + { regimmop(d, a, false, (u32)inst.SIMM_16 << 16, Add, &XEmitter::ADD); } break; @@ -338,17 +350,23 @@ void Jit64::cmpXX(UGeckoInstruction inst) comparand = gpr.R(b); signedCompare = (inst.SUBOP10 == 0); } - else { + else + { gpr.Lock(a); - if (inst.OPCD == 10) { + if (inst.OPCD == 10) + { //cmpli comparand = Imm32((u32)inst.UIMM); signedCompare = false; - } else if (inst.OPCD == 11) { + } + else if (inst.OPCD == 11) + { //cmpi comparand = Imm32((u32)(s32)(s16)inst.UIMM); signedCompare = true; - } else { + } + else + { signedCompare = false; // silence compiler warning PanicAlert("cmpXX"); } @@ -469,7 +487,9 @@ void Jit64::cmpXX(UGeckoInstruction inst) SetJumpTarget(continue2); // TODO: If we ever care about SO, borrow a trick from // http://maws.mameworld.info/maws/mamesrc/src/emu/cpu/powerpc/drc_ops.c : bt, adc - } else { + } + else + { js.downcountAmount++; int test_bit = 8 >> (js.next_inst.BI & 3); bool condition = (js.next_inst.BO & BO_BRANCH_IF_TRUE) ? false : true; @@ -982,10 +1002,10 @@ void Jit64::subfex(UGeckoInstruction inst) void Jit64::subfmex(UGeckoInstruction inst) { - // USES_XER - INSTRUCTION_START - JITDISABLE(Integer) - int a = inst.RA, d = inst.RD; + // USES_XER + INSTRUCTION_START + JITDISABLE(Integer) + int a = inst.RA, d = inst.RD; gpr.Lock(a, d); gpr.BindToRegister(d, d == a); @@ -1006,10 +1026,10 @@ void Jit64::subfmex(UGeckoInstruction inst) void Jit64::subfzex(UGeckoInstruction inst) { - // USES_XER - INSTRUCTION_START - JITDISABLE(Integer) - int a = inst.RA, d = inst.RD; + // USES_XER + INSTRUCTION_START + JITDISABLE(Integer) + int a = inst.RA, d = inst.RD; gpr.Lock(a, d); gpr.BindToRegister(d, d == a); @@ -1096,7 +1116,9 @@ void Jit64::mulli(UGeckoInstruction inst) gpr.Lock(a, d); gpr.BindToRegister(d, (d == a), true); if (imm == 0) + { XOR(32, gpr.R(d), gpr.R(d)); + } else if(imm == (u32)-1) { if (d != a) @@ -1117,7 +1139,10 @@ void Jit64::mulli(UGeckoInstruction inst) SHL(32, gpr.R(d), Imm8(shift)); } else + { IMUL(32, gpr.RX(d), gpr.R(a), Imm32(imm)); + } + gpr.UnlockAll(); } } @@ -1146,7 +1171,9 @@ void Jit64::mullwx(UGeckoInstruction inst) u32 imm = gpr.R(a).IsImm() ? (u32)gpr.R(a).offset : (u32)gpr.R(b).offset; int src = gpr.R(a).IsImm() ? b : a; if (imm == 0) + { XOR(32, gpr.R(d), gpr.R(d)); + } else if(imm == (u32)-1) { if (d != src) @@ -1167,16 +1194,22 @@ void Jit64::mullwx(UGeckoInstruction inst) SHL(32, gpr.R(d), Imm8(shift)); } else + { IMUL(32, gpr.RX(d), gpr.R(src), Imm32(imm)); + } } else if (d == a) + { IMUL(32, gpr.RX(d), gpr.R(b)); + } else if (d == b) + { IMUL(32, gpr.RX(d), gpr.R(a)); + } else { - MOV(32, gpr.R(d), gpr.R(b)); - IMUL(32, gpr.RX(d), gpr.R(a)); + MOV(32, gpr.R(d), gpr.R(b)); + IMUL(32, gpr.RX(d), gpr.R(a)); } if (inst.OE) { @@ -1454,9 +1487,9 @@ void Jit64::divwx(UGeckoInstruction inst) void Jit64::addx(UGeckoInstruction inst) { - INSTRUCTION_START - JITDISABLE(Integer) - int a = inst.RA, b = inst.RB, d = inst.RD; + INSTRUCTION_START + JITDISABLE(Integer) + int a = inst.RA, b = inst.RB, d = inst.RD; if (gpr.R(a).IsImm() && gpr.R(b).IsImm()) { @@ -1514,10 +1547,10 @@ void Jit64::addx(UGeckoInstruction inst) void Jit64::addex(UGeckoInstruction inst) { - // USES_XER - INSTRUCTION_START - JITDISABLE(Integer) - int a = inst.RA, b = inst.RB, d = inst.RD; + // USES_XER + INSTRUCTION_START + JITDISABLE(Integer) + int a = inst.RA, b = inst.RB, d = inst.RD; if ((d == a) || (d == b)) { @@ -1552,9 +1585,9 @@ void Jit64::addex(UGeckoInstruction inst) void Jit64::addcx(UGeckoInstruction inst) { - INSTRUCTION_START - JITDISABLE(Integer) - int a = inst.RA, b = inst.RB, d = inst.RD; + INSTRUCTION_START + JITDISABLE(Integer) + int a = inst.RA, b = inst.RB, d = inst.RD; if ((d == a) || (d == b)) { @@ -1588,10 +1621,10 @@ void Jit64::addcx(UGeckoInstruction inst) void Jit64::addmex(UGeckoInstruction inst) { - // USES_XER - INSTRUCTION_START - JITDISABLE(Integer) - int a = inst.RA, d = inst.RD; + // USES_XER + INSTRUCTION_START + JITDISABLE(Integer) + int a = inst.RA, d = inst.RD; if (d == a) { @@ -1626,10 +1659,10 @@ void Jit64::addmex(UGeckoInstruction inst) void Jit64::addzex(UGeckoInstruction inst) { - // USES_XER - INSTRUCTION_START - JITDISABLE(Integer) - int a = inst.RA, d = inst.RD; + // USES_XER + INSTRUCTION_START + JITDISABLE(Integer) + int a = inst.RA, d = inst.RD; if (d == a) { diff --git a/Source/Core/Core/Src/PowerPC/Jit64/Jit_LoadStore.cpp b/Source/Core/Core/Src/PowerPC/Jit64/Jit_LoadStore.cpp index 29d17dc875..bb07037b8d 100644 --- a/Source/Core/Core/Src/PowerPC/Jit64/Jit_LoadStore.cpp +++ b/Source/Core/Core/Src/PowerPC/Jit64/Jit_LoadStore.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ // TODO(ector): Tons of pshufb optimization of the loads/stores, for SSSE3+, possibly SSE4, only. diff --git a/Source/Core/Core/Src/PowerPC/Jit64/Jit_LoadStoreFloating.cpp b/Source/Core/Core/Src/PowerPC/Jit64/Jit_LoadStoreFloating.cpp index 5766eb3177..6ef9c74696 100644 --- a/Source/Core/Core/Src/PowerPC/Jit64/Jit_LoadStoreFloating.cpp +++ b/Source/Core/Core/Src/PowerPC/Jit64/Jit_LoadStoreFloating.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ // TODO(ector): Tons of pshufb optimization of the loads/stores, for SSSE3+, possibly SSE4, only. diff --git a/Source/Core/Core/Src/PowerPC/Jit64/Jit_LoadStorePaired.cpp b/Source/Core/Core/Src/PowerPC/Jit64/Jit_LoadStorePaired.cpp index a6f57796e4..8809fa2641 100644 --- a/Source/Core/Core/Src/PowerPC/Jit64/Jit_LoadStorePaired.cpp +++ b/Source/Core/Core/Src/PowerPC/Jit64/Jit_LoadStorePaired.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ // TODO(ector): Tons of pshufb optimization of the loads/stores, for SSSE3+, possibly SSE4, only. diff --git a/Source/Core/Core/Src/PowerPC/Jit64/Jit_Paired.cpp b/Source/Core/Core/Src/PowerPC/Jit64/Jit_Paired.cpp index fcd04f4970..6ef0c18fff 100644 --- a/Source/Core/Core/Src/PowerPC/Jit64/Jit_Paired.cpp +++ b/Source/Core/Core/Src/PowerPC/Jit64/Jit_Paired.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #include "Common.h" diff --git a/Source/Core/Core/Src/PowerPC/Jit64/Jit_SystemRegisters.cpp b/Source/Core/Core/Src/PowerPC/Jit64/Jit_SystemRegisters.cpp index 7c3766c69a..89b9fc1189 100644 --- a/Source/Core/Core/Src/PowerPC/Jit64/Jit_SystemRegisters.cpp +++ b/Source/Core/Core/Src/PowerPC/Jit64/Jit_SystemRegisters.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #include "Common.h" @@ -176,10 +176,13 @@ void Jit64::mfcr(UGeckoInstruction inst) gpr.Lock(d); gpr.KillImmediate(d, false, true); MOV(8, R(EAX), M(&PowerPC::ppcState.cr_fast[0])); - for (int i = 1; i < 8; i++) { + + for (int i = 1; i < 8; i++) + { SHL(32, R(EAX), Imm8(4)); OR(8, R(EAX), M(&PowerPC::ppcState.cr_fast[i])); } + MOV(32, gpr.R(d), R(EAX)); gpr.UnlockAll(); } diff --git a/Source/Core/Core/Src/PowerPC/Jit64IL/IR.cpp b/Source/Core/Core/Src/PowerPC/Jit64IL/IR.cpp index 2a830a03cf..52fc731578 100644 --- a/Source/Core/Core/Src/PowerPC/Jit64IL/IR.cpp +++ b/Source/Core/Core/Src/PowerPC/Jit64IL/IR.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ /* diff --git a/Source/Core/Core/Src/PowerPC/Jit64IL/IR.h b/Source/Core/Core/Src/PowerPC/Jit64IL/IR.h index 7fabd946f9..d57e0fe987 100644 --- a/Source/Core/Core/Src/PowerPC/Jit64IL/IR.h +++ b/Source/Core/Core/Src/PowerPC/Jit64IL/IR.h @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #ifndef IR_H diff --git a/Source/Core/Core/Src/PowerPC/Jit64IL/IR_X86.cpp b/Source/Core/Core/Src/PowerPC/Jit64IL/IR_X86.cpp index 7c12d613a3..c38913f2f9 100644 --- a/Source/Core/Core/Src/PowerPC/Jit64IL/IR_X86.cpp +++ b/Source/Core/Core/Src/PowerPC/Jit64IL/IR_X86.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ /* diff --git a/Source/Core/Core/Src/PowerPC/Jit64IL/JitIL.cpp b/Source/Core/Core/Src/PowerPC/Jit64IL/JitIL.cpp index a60becfad9..660c18877c 100644 --- a/Source/Core/Core/Src/PowerPC/Jit64IL/JitIL.cpp +++ b/Source/Core/Core/Src/PowerPC/Jit64IL/JitIL.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #include diff --git a/Source/Core/Core/Src/PowerPC/Jit64IL/JitIL.h b/Source/Core/Core/Src/PowerPC/Jit64IL/JitIL.h index 8c579fa4bd..2e429408f8 100644 --- a/Source/Core/Core/Src/PowerPC/Jit64IL/JitIL.h +++ b/Source/Core/Core/Src/PowerPC/Jit64IL/JitIL.h @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ // ======================== diff --git a/Source/Core/Core/Src/PowerPC/Jit64IL/JitILAsm.cpp b/Source/Core/Core/Src/PowerPC/Jit64IL/JitILAsm.cpp index aaa155072e..2dfd88320b 100644 --- a/Source/Core/Core/Src/PowerPC/Jit64IL/JitILAsm.cpp +++ b/Source/Core/Core/Src/PowerPC/Jit64IL/JitILAsm.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #include "x64ABI.h" diff --git a/Source/Core/Core/Src/PowerPC/Jit64IL/JitILAsm.h b/Source/Core/Core/Src/PowerPC/Jit64IL/JitILAsm.h index 718894e04a..e199cc038f 100644 --- a/Source/Core/Core/Src/PowerPC/Jit64IL/JitILAsm.h +++ b/Source/Core/Core/Src/PowerPC/Jit64IL/JitILAsm.h @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #ifndef _JITASM_H diff --git a/Source/Core/Core/Src/PowerPC/Jit64IL/JitIL_Branch.cpp b/Source/Core/Core/Src/PowerPC/Jit64IL/JitIL_Branch.cpp index 207ac60a5f..3f0db05039 100644 --- a/Source/Core/Core/Src/PowerPC/Jit64IL/JitIL_Branch.cpp +++ b/Source/Core/Core/Src/PowerPC/Jit64IL/JitIL_Branch.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #include "Common.h" #include "Thunk.h" diff --git a/Source/Core/Core/Src/PowerPC/Jit64IL/JitIL_FloatingPoint.cpp b/Source/Core/Core/Src/PowerPC/Jit64IL/JitIL_FloatingPoint.cpp index 81dfa96373..ea9eff24df 100644 --- a/Source/Core/Core/Src/PowerPC/Jit64IL/JitIL_FloatingPoint.cpp +++ b/Source/Core/Core/Src/PowerPC/Jit64IL/JitIL_FloatingPoint.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #include "Common.h" diff --git a/Source/Core/Core/Src/PowerPC/Jit64IL/JitIL_Integer.cpp b/Source/Core/Core/Src/PowerPC/Jit64IL/JitIL_Integer.cpp index 379aaca48a..3bbe7642c5 100644 --- a/Source/Core/Core/Src/PowerPC/Jit64IL/JitIL_Integer.cpp +++ b/Source/Core/Core/Src/PowerPC/Jit64IL/JitIL_Integer.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #ifdef _MSC_VER diff --git a/Source/Core/Core/Src/PowerPC/Jit64IL/JitIL_LoadStore.cpp b/Source/Core/Core/Src/PowerPC/Jit64IL/JitIL_LoadStore.cpp index 96902434a6..8ebd669a9c 100644 --- a/Source/Core/Core/Src/PowerPC/Jit64IL/JitIL_LoadStore.cpp +++ b/Source/Core/Core/Src/PowerPC/Jit64IL/JitIL_LoadStore.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ // TODO(ector): Tons of pshufb optimization of the loads/stores, for SSSE3+, possibly SSE4, only. diff --git a/Source/Core/Core/Src/PowerPC/Jit64IL/JitIL_LoadStoreFloating.cpp b/Source/Core/Core/Src/PowerPC/Jit64IL/JitIL_LoadStoreFloating.cpp index c74abfd8e9..9125f5533f 100644 --- a/Source/Core/Core/Src/PowerPC/Jit64IL/JitIL_LoadStoreFloating.cpp +++ b/Source/Core/Core/Src/PowerPC/Jit64IL/JitIL_LoadStoreFloating.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ // TODO(ector): Tons of pshufb optimization of the loads/stores, for SSSE3+, possibly SSE4, only. diff --git a/Source/Core/Core/Src/PowerPC/Jit64IL/JitIL_LoadStorePaired.cpp b/Source/Core/Core/Src/PowerPC/Jit64IL/JitIL_LoadStorePaired.cpp index 6e86804bec..0e9de36c60 100644 --- a/Source/Core/Core/Src/PowerPC/Jit64IL/JitIL_LoadStorePaired.cpp +++ b/Source/Core/Core/Src/PowerPC/Jit64IL/JitIL_LoadStorePaired.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #include "Common.h" diff --git a/Source/Core/Core/Src/PowerPC/Jit64IL/JitIL_Paired.cpp b/Source/Core/Core/Src/PowerPC/Jit64IL/JitIL_Paired.cpp index 628c323f95..18b3281501 100644 --- a/Source/Core/Core/Src/PowerPC/Jit64IL/JitIL_Paired.cpp +++ b/Source/Core/Core/Src/PowerPC/Jit64IL/JitIL_Paired.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #include "Common.h" diff --git a/Source/Core/Core/Src/PowerPC/Jit64IL/JitIL_SystemRegisters.cpp b/Source/Core/Core/Src/PowerPC/Jit64IL/JitIL_SystemRegisters.cpp index 4a1b26a1d6..5b0b67de28 100644 --- a/Source/Core/Core/Src/PowerPC/Jit64IL/JitIL_SystemRegisters.cpp +++ b/Source/Core/Core/Src/PowerPC/Jit64IL/JitIL_SystemRegisters.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #include "Common.h" diff --git a/Source/Core/Core/Src/PowerPC/Jit64IL/JitIL_Tables.cpp b/Source/Core/Core/Src/PowerPC/Jit64IL/JitIL_Tables.cpp index fd920c4a48..32c60a16dd 100644 --- a/Source/Core/Core/Src/PowerPC/Jit64IL/JitIL_Tables.cpp +++ b/Source/Core/Core/Src/PowerPC/Jit64IL/JitIL_Tables.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #include "JitIL_Tables.h" diff --git a/Source/Core/Core/Src/PowerPC/Jit64IL/JitIL_Tables.h b/Source/Core/Core/Src/PowerPC/Jit64IL/JitIL_Tables.h index a07adb2fb9..492a7e8e5d 100644 --- a/Source/Core/Core/Src/PowerPC/Jit64IL/JitIL_Tables.h +++ b/Source/Core/Core/Src/PowerPC/Jit64IL/JitIL_Tables.h @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #ifndef JITIL_TABLES_H diff --git a/Source/Core/Core/Src/PowerPC/JitCommon/JitAsmCommon.cpp b/Source/Core/Core/Src/PowerPC/JitCommon/JitAsmCommon.cpp index 8514450cb8..48fea0d920 100644 --- a/Source/Core/Core/Src/PowerPC/JitCommon/JitAsmCommon.cpp +++ b/Source/Core/Core/Src/PowerPC/JitCommon/JitAsmCommon.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #include "x64ABI.h" diff --git a/Source/Core/Core/Src/PowerPC/JitCommon/JitAsmCommon.h b/Source/Core/Core/Src/PowerPC/JitCommon/JitAsmCommon.h index a610a03326..a1af1c6f62 100644 --- a/Source/Core/Core/Src/PowerPC/JitCommon/JitAsmCommon.h +++ b/Source/Core/Core/Src/PowerPC/JitCommon/JitAsmCommon.h @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #ifndef _JITASMCOMMON_H diff --git a/Source/Core/Core/Src/PowerPC/JitCommon/JitBackpatch.cpp b/Source/Core/Core/Src/PowerPC/JitCommon/JitBackpatch.cpp index 4a9329540c..f24783009a 100644 --- a/Source/Core/Core/Src/PowerPC/JitCommon/JitBackpatch.cpp +++ b/Source/Core/Core/Src/PowerPC/JitCommon/JitBackpatch.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #include @@ -51,9 +51,9 @@ static void BackPatchError(const std::string &text, u8 *codePtr, u32 emAddress) disasm.disasm64(0, code_addr, codePtr, disbuf); #endif PanicAlert("%s\n\n" - "Error encountered accessing emulated address %08x.\n" - "Culprit instruction: \n%s\nat %#llx", - text.c_str(), emAddress, disbuf, code_addr); + "Error encountered accessing emulated address %08x.\n" + "Culprit instruction: \n%s\nat %#llx", + text.c_str(), emAddress, disbuf, code_addr); return; } #endif @@ -86,7 +86,8 @@ const u8 *TrampolineCache::GetReadTrampoline(const InstructionInfo &info) if (info.displacement) { ADD(32, R(ABI_PARAM1), Imm32(info.displacement)); } - switch (info.operandSize) { + switch (info.operandSize) + { case 4: CALL(thunks.ProtectFunction((void *)&Memory::Read_U32, 1)); break; @@ -98,10 +99,14 @@ const u8 *TrampolineCache::GetReadTrampoline(const InstructionInfo &info) CALL(thunks.ProtectFunction((void *)&Memory::Read_U8, 1)); break; } + ABI_PopAllCallerSavedRegsAndAdjustStack(); - if (dataReg != EAX) { + + if (dataReg != EAX) + { MOV(32, R(dataReg), R(EAX)); } + RET(); #endif return trampoline; @@ -133,17 +138,25 @@ const u8 *TrampolineCache::GetWriteTrampoline(const InstructionInfo &info) RET(); SetJumpTarget(skip_fast); ABI_PushAllCallerSavedRegsAndAdjustStack(); - if (addrReg != ABI_PARAM1) { + + if (addrReg != ABI_PARAM1) + { MOV(32, R(ABI_PARAM1), R((X64Reg)dataReg)); MOV(32, R(ABI_PARAM2), R((X64Reg)addrReg)); - } else { + } + else + { MOV(32, R(ABI_PARAM2), R((X64Reg)addrReg)); MOV(32, R(ABI_PARAM1), R((X64Reg)dataReg)); } - if (info.displacement) { + + if (info.displacement) + { ADD(32, R(ABI_PARAM2), Imm32(info.displacement)); } - switch (info.operandSize) { + + switch (info.operandSize) + { case 4: CALL(thunks.ProtectFunction((void *)&Memory::Write_U32, 2)); break; diff --git a/Source/Core/Core/Src/PowerPC/JitCommon/JitBackpatch.h b/Source/Core/Core/Src/PowerPC/JitCommon/JitBackpatch.h index 871a112c6c..a10ff61f95 100644 --- a/Source/Core/Core/Src/PowerPC/JitCommon/JitBackpatch.h +++ b/Source/Core/Core/Src/PowerPC/JitCommon/JitBackpatch.h @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #ifndef _JITBACKPATCH_H diff --git a/Source/Core/Core/Src/PowerPC/JitCommon/JitBase.h b/Source/Core/Core/Src/PowerPC/JitCommon/JitBase.h index 158171be0f..1f34f0b222 100644 --- a/Source/Core/Core/Src/PowerPC/JitCommon/JitBase.h +++ b/Source/Core/Core/Src/PowerPC/JitCommon/JitBase.h @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #ifndef _JITBASE_H diff --git a/Source/Core/Core/Src/PowerPC/JitCommon/JitCache.cpp b/Source/Core/Core/Src/PowerPC/JitCommon/JitCache.cpp index 415b37ca61..4c8015c14e 100644 --- a/Source/Core/Core/Src/PowerPC/JitCommon/JitCache.cpp +++ b/Source/Core/Core/Src/PowerPC/JitCommon/JitCache.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ // Enable define below to enable oprofile integration. For this to work, diff --git a/Source/Core/Core/Src/PowerPC/JitCommon/JitCache.h b/Source/Core/Core/Src/PowerPC/JitCommon/JitCache.h index b148cb8090..ba62fddc35 100644 --- a/Source/Core/Core/Src/PowerPC/JitCommon/JitCache.h +++ b/Source/Core/Core/Src/PowerPC/JitCommon/JitCache.h @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #ifndef _JITCACHE_H @@ -134,7 +134,7 @@ public: // Fast way to get a block. Only works on the first ppc instruction of a block. int GetBlockNumberFromStartAddress(u32 em_address); - // slower, but can get numbers from within blocks, not just the first instruction. + // slower, but can get numbers from within blocks, not just the first instruction. // WARNING! WILL NOT WORK WITH INLINING ENABLED (not yet a feature but will be soon) // Returns a list of block numbers - only one block can start at a particular address, but they CAN overlap. // This one is slow so should only be used for one-shots from the debugger UI, not for anything during runtime. diff --git a/Source/Core/Core/Src/PowerPC/JitCommon/Jit_Util.cpp b/Source/Core/Core/Src/PowerPC/JitCommon/Jit_Util.cpp index f5c4cb022b..203f39dfc0 100644 --- a/Source/Core/Core/Src/PowerPC/JitCommon/Jit_Util.cpp +++ b/Source/Core/Core/Src/PowerPC/JitCommon/Jit_Util.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #include "Common.h" @@ -57,7 +57,7 @@ void EmuCodeBlock::UnsafeLoadRegToReg(X64Reg reg_addr, X64Reg reg_value, int acc else if (signExtend) { // TODO: bake 8-bit into the original load. - MOVSX(32, accessSize, reg_value, R(reg_value)); + MOVSX(32, accessSize, reg_value, R(reg_value)); } } @@ -116,7 +116,7 @@ void EmuCodeBlock::UnsafeLoadToEAX(const Gen::OpArg & opAddress, int accessSize, else if (signExtend) { // TODO: bake 8-bit into the original load. - MOVSX(32, accessSize, EAX, R(EAX)); + MOVSX(32, accessSize, EAX, R(EAX)); } } diff --git a/Source/Core/Core/Src/PowerPC/JitCommon/Jit_Util.h b/Source/Core/Core/Src/PowerPC/JitCommon/Jit_Util.h index e151c5e914..b4e4a8bdb7 100644 --- a/Source/Core/Core/Src/PowerPC/JitCommon/Jit_Util.h +++ b/Source/Core/Core/Src/PowerPC/JitCommon/Jit_Util.h @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #ifndef _JITUTIL_H diff --git a/Source/Core/Core/Src/PowerPC/JitInterface.cpp b/Source/Core/Core/Src/PowerPC/JitInterface.cpp index 4ff979237a..34c86a5d44 100644 --- a/Source/Core/Core/Src/PowerPC/JitInterface.cpp +++ b/Source/Core/Core/Src/PowerPC/JitInterface.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #include diff --git a/Source/Core/Core/Src/PowerPC/JitInterface.h b/Source/Core/Core/Src/PowerPC/JitInterface.h index 9213072ab9..6718f5b980 100644 --- a/Source/Core/Core/Src/PowerPC/JitInterface.h +++ b/Source/Core/Core/Src/PowerPC/JitInterface.h @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #include "ChunkFile.h" diff --git a/Source/Core/Core/Src/PowerPC/LUT_frsqrtex.cpp b/Source/Core/Core/Src/PowerPC/LUT_frsqrtex.cpp index 4f4751ae18..ef7b4ebf46 100644 --- a/Source/Core/Core/Src/PowerPC/LUT_frsqrtex.cpp +++ b/Source/Core/Core/Src/PowerPC/LUT_frsqrtex.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ // Gekko related unions, structs, ... // diff --git a/Source/Core/Core/Src/PowerPC/LUT_frsqrtex.h b/Source/Core/Core/Src/PowerPC/LUT_frsqrtex.h index f987dba4a6..56aa4335dc 100644 --- a/Source/Core/Core/Src/PowerPC/LUT_frsqrtex.h +++ b/Source/Core/Core/Src/PowerPC/LUT_frsqrtex.h @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ // Gekko related unions, structs, ... // diff --git a/Source/Core/Core/Src/PowerPC/PPCAnalyst.cpp b/Source/Core/Core/Src/PowerPC/PPCAnalyst.cpp index cca3bd2e3c..4c4793cd85 100644 --- a/Source/Core/Core/Src/PowerPC/PPCAnalyst.cpp +++ b/Source/Core/Core/Src/PowerPC/PPCAnalyst.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #include @@ -264,15 +264,15 @@ bool CanSwapAdjacentOps(const CodeOp &a, const CodeOp &b) int regInA = a.regsIn[j]; int regInB = b.regsIn[j]; if (regInA >= 0 && - (b.regsOut[0] == regInA || - b.regsOut[1] == regInA)) + (b.regsOut[0] == regInA || + b.regsOut[1] == regInA)) { // reg collision! don't swap return false; } if (regInB >= 0 && - (a.regsOut[0] == regInB || - a.regsOut[1] == regInB)) + (a.regsOut[0] == regInB || + a.regsOut[1] == regInB)) { // reg collision! don't swap return false; @@ -740,7 +740,7 @@ void FindFunctions(u32 startAddr, u32 endAddr, PPCSymbolDB *func_db) if (numNice == 0) niceSize = 0; else - niceSize /= numNice; + niceSize /= numNice; if (numUnNice == 0) unniceSize = 0; diff --git a/Source/Core/Core/Src/PowerPC/PPCAnalyst.h b/Source/Core/Core/Src/PowerPC/PPCAnalyst.h index be1b6b7d6a..e74bed94f5 100644 --- a/Source/Core/Core/Src/PowerPC/PPCAnalyst.h +++ b/Source/Core/Core/Src/PowerPC/PPCAnalyst.h @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #ifndef _PPCANALYST_H diff --git a/Source/Core/Core/Src/PowerPC/PPCCache.cpp b/Source/Core/Core/Src/PowerPC/PPCCache.cpp index a0e4c666a4..536ce868d1 100644 --- a/Source/Core/Core/Src/PowerPC/PPCCache.cpp +++ b/Source/Core/Core/Src/PowerPC/PPCCache.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #include "PPCCache.h" @@ -122,11 +122,11 @@ namespace PowerPC u32 t; if (addr & ICACHE_VMEM_BIT) { - t = lookup_table_vmem[(addr>>5) & 0xfffff]; + t = lookup_table_vmem[(addr>>5) & 0xfffff]; } else if (addr & ICACHE_EXRAM_BIT) { - t = lookup_table_ex[(addr>>5) & 0x1fffff]; + t = lookup_table_ex[(addr>>5) & 0x1fffff]; } else { @@ -163,6 +163,7 @@ namespace PowerPC else lookup_table[((tags[set][t] << 7) | set) & 0xfffff] = 0xff; } + if (addr & ICACHE_VMEM_BIT) lookup_table_vmem[(addr>>5) & 0xfffff] = t; else if (addr & ICACHE_EXRAM_BIT) diff --git a/Source/Core/Core/Src/PowerPC/PPCCache.h b/Source/Core/Core/Src/PowerPC/PPCCache.h index 6d62720d43..3eadf6b56d 100644 --- a/Source/Core/Core/Src/PowerPC/PPCCache.h +++ b/Source/Core/Core/Src/PowerPC/PPCCache.h @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #ifndef _PPCCACHE_H diff --git a/Source/Core/Core/Src/PowerPC/PPCSymbolDB.cpp b/Source/Core/Core/Src/PowerPC/PPCSymbolDB.cpp index 2cfdc48e33..786dfa3e0b 100644 --- a/Source/Core/Core/Src/PowerPC/PPCSymbolDB.cpp +++ b/Source/Core/Core/Src/PowerPC/PPCSymbolDB.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #include @@ -99,9 +99,12 @@ Symbol *PPCSymbolDB::GetSymbolFromAddr(u32 addr) { if (!Memory::IsRAMAddress(addr)) return 0; + XFuncMap::iterator it = functions.find(addr); if (it != functions.end()) + { return &it->second; + } else { for (XFuncMap::iterator iter = functions.begin(); iter != functions.end(); ++iter) @@ -133,22 +136,22 @@ void PPCSymbolDB::FillInCallers() { Symbol &f = iter->second; for (size_t i = 0; i < f.calls.size(); i++) - { - SCall NewCall(iter->first, f.calls[i].callAddress); - u32 FunctionAddress = f.calls[i].function; + { + SCall NewCall(iter->first, f.calls[i].callAddress); + u32 FunctionAddress = f.calls[i].function; - XFuncMap::iterator FuncIterator = functions.find(FunctionAddress); - if (FuncIterator != functions.end()) - { - Symbol& rCalledFunction = FuncIterator->second; - rCalledFunction.callers.push_back(NewCall); - } - else - { - //LOG(OSHLE, "FillInCallers tries to fill data in an unknown function 0x%08x.", FunctionAddress); + XFuncMap::iterator FuncIterator = functions.find(FunctionAddress); + if (FuncIterator != functions.end()) + { + Symbol& rCalledFunction = FuncIterator->second; + rCalledFunction.callers.push_back(NewCall); + } + else + { + //LOG(OSHLE, "FillInCallers tries to fill data in an unknown function 0x%08x.", FunctionAddress); // TODO - analyze the function instead. - } - } + } + } } } @@ -241,27 +244,27 @@ bool PPCSymbolDB::LoadMap(const char *filename) if (!started) continue; - u32 address, vaddress, size, unknown; - char name[512]; - sscanf(line, "%08x %08x %08x %i %s", &address, &size, &vaddress, &unknown, name); + u32 address, vaddress, size, unknown; + char name[512]; + sscanf(line, "%08x %08x %08x %i %s", &address, &size, &vaddress, &unknown, name); - const char *namepos = strstr(line, name); - if (namepos != 0) //would be odd if not :P - strcpy(name, namepos); - name[strlen(name) - 1] = 0; - - // we want the function names only .... TODO: or do we really? aren't we wasting information here? - for (size_t i = 0; i < strlen(name); i++) - { - if (name[i] == ' ') name[i] = 0x00; - if (name[i] == '(') name[i] = 0x00; - } + const char *namepos = strstr(line, name); + if (namepos != 0) //would be odd if not :P + strcpy(name, namepos); + name[strlen(name) - 1] = 0; - // Check if this is a valid entry. - if (strcmp(name, ".text") != 0 || strcmp(name, ".init") != 0 || strlen(name) > 0) - { - AddKnownSymbol(vaddress | 0x80000000, size, name); // ST_FUNCTION - } + // we want the function names only .... TODO: or do we really? aren't we wasting information here? + for (size_t i = 0; i < strlen(name); i++) + { + if (name[i] == ' ') name[i] = 0x00; + if (name[i] == '(') name[i] = 0x00; + } + + // Check if this is a valid entry. + if (strcmp(name, ".text") != 0 || strcmp(name, ".init") != 0 || strlen(name) > 0) + { + AddKnownSymbol(vaddress | 0x80000000, size, name); // ST_FUNCTION + } } Index(); @@ -297,13 +300,13 @@ bool PPCSymbolDB::SaveMap(const char *filename, bool WithCodes) const // Walk through every code row // ------------------------- fprintf(f.GetHandle(), ".text\n"); // Write ".text" at the top - XFuncMap::const_iterator itr = functions.begin(); + XFuncMap::const_iterator itr = functions.begin(); u32 LastAddress = 0x80004000; std::string LastSymbolName; - while (itr != functions.end()) - { + while (itr != functions.end()) + { // Save a map file - const Symbol &rSymbol = itr->second; + const Symbol &rSymbol = itr->second; if (!WithCodes) { fprintf(f.GetHandle(),"%08x %08x %08x %i %s\n", rSymbol.address, rSymbol.size, rSymbol.address, @@ -323,7 +326,7 @@ bool PPCSymbolDB::SaveMap(const char *filename, bool WithCodes) const all names longer than 25 letters */ std::string TempSym; for (u32 i = 0; i < 25; i++) - { + { if (i < LastSymbolName.size()) TempSym += LastSymbolName[i]; else @@ -347,7 +350,7 @@ bool PPCSymbolDB::SaveMap(const char *filename, bool WithCodes) const // Write a blank line after each block fprintf(f.GetHandle(), "\n"); } - } + } // --------------- Host_UpdateStatusBar(StringFromFormat("Saved %s", mapFile.c_str()).c_str()); diff --git a/Source/Core/Core/Src/PowerPC/PPCSymbolDB.h b/Source/Core/Core/Src/PowerPC/PPCSymbolDB.h index ebd1c39d19..115e5735c7 100644 --- a/Source/Core/Core/Src/PowerPC/PPCSymbolDB.h +++ b/Source/Core/Core/Src/PowerPC/PPCSymbolDB.h @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #include "Common.h" diff --git a/Source/Core/Core/Src/PowerPC/PPCTables.cpp b/Source/Core/Core/Src/PowerPC/PPCTables.cpp index a6975f5860..efb57b69e4 100644 --- a/Source/Core/Core/Src/PowerPC/PPCTables.cpp +++ b/Source/Core/Core/Src/PowerPC/PPCTables.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #include @@ -28,12 +28,12 @@ struct op_inf { - const char *name; - int count; - bool operator < (const op_inf &o) const - { + const char *name; + int count; + bool operator < (const op_inf &o) const + { return count > o.count; - } + } }; GekkoOPInfo *m_infoTable[64]; GekkoOPInfo *m_infoTable4[1024]; @@ -212,7 +212,7 @@ void PrintInstructionRunCounts() { if (temp[i].count == 0) break; - DEBUG_LOG(POWERPC, "%s : %i", temp[i].name,temp[i].count); + DEBUG_LOG(POWERPC, "%s : %i", temp[i].name,temp[i].count); //PanicAlert("%s : %i", temp[i].name,temp[i].count); } } @@ -224,7 +224,8 @@ void LogCompiledInstructions() File::IOFile f(StringFromFormat("%sinst_log%i.txt", File::GetUserPath(D_LOGS_IDX).c_str(), time), "w"); for (int i = 0; i < m_numInstructions; i++) { - if (m_allInstructions[i]->compileCount > 0) { + if (m_allInstructions[i]->compileCount > 0) + { fprintf(f.GetHandle(), "%s\t%i\t%i\t%08x\n", m_allInstructions[i]->opname, m_allInstructions[i]->compileCount, m_allInstructions[i]->runCount, m_allInstructions[i]->lastUse); } @@ -233,7 +234,8 @@ void LogCompiledInstructions() f.Open(StringFromFormat("%sinst_not%i.txt", File::GetUserPath(D_LOGS_IDX).c_str(), time), "w"); for (int i = 0; i < m_numInstructions; i++) { - if (m_allInstructions[i]->compileCount == 0) { + if (m_allInstructions[i]->compileCount == 0) + { fprintf(f.GetHandle(), "%s\t%i\t%i\n", m_allInstructions[i]->opname, m_allInstructions[i]->compileCount, m_allInstructions[i]->runCount); } @@ -241,7 +243,8 @@ void LogCompiledInstructions() #ifdef OPLOG f.Open(StringFromFormat("%s" OP_TO_LOG "_at.txt", File::GetUserPath(D_LOGS_IDX).c_str(), time), "w"); - for (size_t i = 0; i < rsplocations.size(); i++) { + for (size_t i = 0; i < rsplocations.size(); i++) + { fprintf(f.GetHandle(), OP_TO_LOG ": %08x\n", rsplocations[i]); } #endif diff --git a/Source/Core/Core/Src/PowerPC/PPCTables.h b/Source/Core/Core/Src/PowerPC/PPCTables.h index 2e4ac0e755..d81985511b 100644 --- a/Source/Core/Core/Src/PowerPC/PPCTables.h +++ b/Source/Core/Core/Src/PowerPC/PPCTables.h @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #ifndef _PPCTABLES_H diff --git a/Source/Core/Core/Src/PowerPC/PowerPC.cpp b/Source/Core/Core/Src/PowerPC/PowerPC.cpp index d4a98be226..39f100c56b 100644 --- a/Source/Core/Core/Src/PowerPC/PowerPC.cpp +++ b/Source/Core/Core/Src/PowerPC/PowerPC.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #include diff --git a/Source/Core/Core/Src/PowerPC/PowerPC.h b/Source/Core/Core/Src/PowerPC/PowerPC.h index e0b4bfaa16..ebfafebd47 100644 --- a/Source/Core/Core/Src/PowerPC/PowerPC.h +++ b/Source/Core/Core/Src/PowerPC/PowerPC.h @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #ifndef _POWERPC_H diff --git a/Source/Core/Core/Src/PowerPC/Profiler.cpp b/Source/Core/Core/Src/PowerPC/Profiler.cpp index fc8942f09b..066cc21705 100644 --- a/Source/Core/Core/Src/PowerPC/Profiler.cpp +++ b/Source/Core/Core/Src/PowerPC/Profiler.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #include "JitInterface.h" diff --git a/Source/Core/Core/Src/PowerPC/Profiler.h b/Source/Core/Core/Src/PowerPC/Profiler.h index b8beeaae72..28a204f589 100644 --- a/Source/Core/Core/Src/PowerPC/Profiler.h +++ b/Source/Core/Core/Src/PowerPC/Profiler.h @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ diff --git a/Source/Core/Core/Src/PowerPC/SignatureDB.cpp b/Source/Core/Core/Src/PowerPC/SignatureDB.cpp index d2ff6c557c..c40efbecc6 100644 --- a/Source/Core/Core/Src/PowerPC/SignatureDB.cpp +++ b/Source/Core/Core/Src/PowerPC/SignatureDB.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #include "Common.h" @@ -45,15 +45,15 @@ bool SignatureDB::Load(const char *filename) for (size_t i = 0; i < fcount; i++) { FuncDesc temp; - memset(&temp, 0, sizeof(temp)); + memset(&temp, 0, sizeof(temp)); - f.ReadArray(&temp, 1); + f.ReadArray(&temp, 1); temp.name[sizeof(temp.name)-1] = 0; DBFunc dbf; dbf.name = temp.name; dbf.size = temp.size; - database[temp.checkSum] = dbf; + database[temp.checkSum] = dbf; } return true; diff --git a/Source/Core/Core/Src/PowerPC/SignatureDB.h b/Source/Core/Core/Src/PowerPC/SignatureDB.h index fbee2f7e63..ae15403029 100644 --- a/Source/Core/Core/Src/PowerPC/SignatureDB.h +++ b/Source/Core/Core/Src/PowerPC/SignatureDB.h @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #include "Common.h" diff --git a/Source/Core/Core/Src/State.cpp b/Source/Core/Core/Src/State.cpp index e0a9ab7858..ac79ec8255 100644 --- a/Source/Core/Core/Src/State.cpp +++ b/Source/Core/Core/Src/State.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #include "Common.h" @@ -97,7 +97,7 @@ void DoState(PointerWrap &p) { u32 version = STATE_VERSION; { - static const u32 COOKIE_BASE = 0xBAADBABE; + static const u32 COOKIE_BASE = 0xBAADBABE; u32 cookie = version + COOKIE_BASE; p.Do(cookie); version = cookie - COOKIE_BASE; @@ -204,6 +204,7 @@ void CompressAndDumpState(CompressAndDumpState_args save_args) else File::Rename(filename + ".dtm", File::GetUserPath(D_STATESAVES_IDX) + "lastState.sav.dtm"); } + if ((Movie::IsRecordingInput() || Movie::IsPlayingInput()) && !Movie::IsJustStartingRecordingInputFromSaveState()) Movie::SaveRecording((filename + ".dtm").c_str()); else if (!Movie::IsRecordingInput() && !Movie::IsPlayingInput()) @@ -551,10 +552,14 @@ void UndoLoadState() Movie::LoadInput("undo.dtm"); } else + { PanicAlert("No undo.dtm found, aborting undo load state to prevent movie desyncs"); + } } else + { PanicAlert("There is nothing to undo!"); + } } // Load the state that the last save state overwritten on diff --git a/Source/Core/Core/Src/State.h b/Source/Core/Core/Src/State.h index 0cc0fb502e..ca06cf5e86 100644 --- a/Source/Core/Core/Src/State.h +++ b/Source/Core/Core/Src/State.h @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ // Emulator state saving support. diff --git a/Source/Core/Core/Src/Tracer.cpp b/Source/Core/Core/Src/Tracer.cpp index 22098f1991..a09bd91431 100644 --- a/Source/Core/Core/Src/Tracer.cpp +++ b/Source/Core/Core/Src/Tracer.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #include @@ -101,11 +101,11 @@ int SyncTrace() LOG(GEKKO, "DIFFERENCE - PC (local %08x, remote %08x)", PowerPC::ppcState.pc, state.pc); difference = true; } - //if (PowerPC::ppcState.npc != state.npc) - ///{ - // LOG(GEKKO, "DIFFERENCE - NPC (local %08x, remote %08x)", PowerPC::ppcState.npc, state.npc); - // difference = true; - //} + if (PowerPC::ppcState.npc != state.npc) + { + LOG(GEKKO, "DIFFERENCE - NPC (local %08x, remote %08x)", PowerPC::ppcState.npc, state.npc); + difference = true; + } if (PowerPC::ppcState.msr != state.msr) { LOG(GEKKO, "DIFFERENCE - MSR (local %08x, remote %08x)", PowerPC::ppcState.msr, state.msr); diff --git a/Source/Core/Core/Src/Tracer.h b/Source/Core/Core/Src/Tracer.h index 5750b1b118..ba7b91e34f 100644 --- a/Source/Core/Core/Src/Tracer.h +++ b/Source/Core/Core/Src/Tracer.h @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #ifndef _TRACER_H_ diff --git a/Source/Core/Core/Src/VolumeHandler.cpp b/Source/Core/Core/Src/VolumeHandler.cpp index c26aaf10ec..2c70c1c7b8 100644 --- a/Source/Core/Core/Src/VolumeHandler.cpp +++ b/Source/Core/Core/Src/VolumeHandler.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #include "VolumeHandler.h" @@ -43,47 +43,47 @@ void EjectVolume() bool SetVolumeName(const std::string& _rFullPath) { - if (g_pVolume) - { - delete g_pVolume; - g_pVolume = NULL; - } + if (g_pVolume) + { + delete g_pVolume; + g_pVolume = NULL; + } - g_pVolume = DiscIO::CreateVolumeFromFilename(_rFullPath); + g_pVolume = DiscIO::CreateVolumeFromFilename(_rFullPath); return (g_pVolume != NULL); } void SetVolumeDirectory(const std::string& _rFullPath, bool _bIsWii, const std::string& _rApploader, const std::string& _rDOL) { - if (g_pVolume) - { - delete g_pVolume; - g_pVolume = NULL; - } + if (g_pVolume) + { + delete g_pVolume; + g_pVolume = NULL; + } - g_pVolume = DiscIO::CreateVolumeFromDirectory(_rFullPath, _bIsWii, _rApploader, _rDOL); + g_pVolume = DiscIO::CreateVolumeFromDirectory(_rFullPath, _bIsWii, _rApploader, _rDOL); } u32 Read32(u64 _Offset) { - if (g_pVolume != NULL) - { - u32 Temp; - g_pVolume->Read(_Offset, 4, (u8*)&Temp); - return Common::swap32(Temp); - } - return 0; + if (g_pVolume != NULL) + { + u32 Temp; + g_pVolume->Read(_Offset, 4, (u8*)&Temp); + return Common::swap32(Temp); + } + return 0; } bool ReadToPtr(u8* ptr, u64 _dwOffset, u64 _dwLength) { - if (g_pVolume != NULL && ptr) - { - g_pVolume->Read(_dwOffset, _dwLength, ptr); - return true; - } - return false; + if (g_pVolume != NULL && ptr) + { + g_pVolume->Read(_dwOffset, _dwLength, ptr); + return true; + } + return false; } bool RAWReadToPtr( u8* ptr, u64 _dwOffset, u64 _dwLength ) @@ -98,7 +98,7 @@ bool RAWReadToPtr( u8* ptr, u64 _dwOffset, u64 _dwLength ) bool IsValid() { - return (g_pVolume != NULL); + return (g_pVolume != NULL); } bool IsWii() @@ -106,7 +106,7 @@ bool IsWii() if (g_pVolume) return IsVolumeWiiDisc(g_pVolume); - return false; + return false; } } // end of namespace VolumeHandler diff --git a/Source/Core/Core/Src/VolumeHandler.h b/Source/Core/Core/Src/VolumeHandler.h index 44a002f768..0f76403189 100644 --- a/Source/Core/Core/Src/VolumeHandler.h +++ b/Source/Core/Core/Src/VolumeHandler.h @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ // Disc volume handler. It's here because Wii discs can consist of multiple volumes. diff --git a/Source/Core/Core/Src/stdafx.cpp b/Source/Core/Core/Src/stdafx.cpp index 31f734b17a..9a6f5ee1ff 100644 --- a/Source/Core/Core/Src/stdafx.cpp +++ b/Source/Core/Core/Src/stdafx.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #include "stdafx.h" diff --git a/Source/Core/Core/Src/stdafx.h b/Source/Core/Core/Src/stdafx.h index 7ec8dff5a8..0644748e52 100644 --- a/Source/Core/Core/Src/stdafx.h +++ b/Source/Core/Core/Src/stdafx.h @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #pragma once diff --git a/Source/Core/Core/Src/x64MemTools.cpp b/Source/Core/Core/Src/x64MemTools.cpp index fff26b3cb3..6b6933e39e 100644 --- a/Source/Core/Core/Src/x64MemTools.cpp +++ b/Source/Core/Core/Src/x64MemTools.cpp @@ -12,7 +12,7 @@ // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ -// Official SVN repository and contact information can be found at +// Official Git repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ @@ -79,7 +79,8 @@ LONG NTAPI Handler(PEXCEPTION_POINTERS pPtrs) PVOID codeAddr = pPtrs->ExceptionRecord->ExceptionAddress; unsigned char *codePtr = (unsigned char*)codeAddr; - if (!JitInterface::IsInCodeSpace(codePtr)) { + if (!JitInterface::IsInCodeSpace(codePtr)) + { // Let's not prevent debugging. return (DWORD)EXCEPTION_CONTINUE_SEARCH; } @@ -94,7 +95,8 @@ LONG NTAPI Handler(PEXCEPTION_POINTERS pPtrs) #else u64 memspaceTop = memspaceBottom + 0x40000000; #endif - if (badAddress < memspaceBottom || badAddress >= memspaceTop) { + if (badAddress < memspaceBottom || badAddress >= memspaceTop) + { return (DWORD)EXCEPTION_CONTINUE_SEARCH; //PanicAlert("Exception handler - access outside memory space. %08x%08x", // badAddress >> 32, badAddress); @@ -206,7 +208,8 @@ void sigsegv_handler(int signal, siginfo_t *info, void *raw_context) #else u8 *fault_instruction_ptr = (u8 *)CREG_EIP(ctx); #endif - if (!JitInterface::IsInCodeSpace(fault_instruction_ptr)) { + if (!JitInterface::IsInCodeSpace(fault_instruction_ptr)) + { // Let's not prevent debugging. return; } @@ -234,7 +237,8 @@ void sigsegv_handler(int signal, siginfo_t *info, void *raw_context) fake_ctx.Eip = CREG_EIP(ctx); #endif const u8 *new_rip = jit->BackPatch(fault_instruction_ptr, access_type, em_address, &fake_ctx); - if (new_rip) { + if (new_rip) + { #ifdef _M_X64 CREG_RAX(ctx) = fake_ctx.Rax; CREG_RIP(ctx) = fake_ctx.Rip; diff --git a/Source/Core/DiscIO/Src/FileMonitor.cpp b/Source/Core/DiscIO/Src/FileMonitor.cpp index 465784fe8f..ad83c95a22 100644 --- a/Source/Core/DiscIO/Src/FileMonitor.cpp +++ b/Source/Core/DiscIO/Src/FileMonitor.cpp @@ -46,7 +46,7 @@ bool ShowSound(std::string FileName) SplitPath(FileName, NULL, NULL, &Ending); std::transform(Ending.begin(),Ending.end(),Ending.begin(),::tolower); - if ( + if ( (Ending == ".adp") // 1080 Avalanche, Crash Bandicoot, etc || (Ending == ".afc") // Zelda WW || (Ending == ".ast") // Zelda TP, Mario Kart @@ -76,6 +76,7 @@ void ReadGC(std::string FileName) delete pFileSystem; pFileSystem = NULL; } + // GCFiles' pointers are no longer valid after pFileSystem is cleared GCFiles.clear(); OpenISO = DiscIO::CreateVolumeFromFilename(FileName); @@ -99,7 +100,9 @@ void CheckFile(std::string File, u64 Size) if (CurrentFile == File) return; - if (Size > 0) Size = (Size / 1000); + if (Size > 0) + Size = (Size / 1000); + std::string Str = StringFromFormat("%s kB %s", ThousandSeparate(Size, 7).c_str(), File.c_str()); if (ShowSound(File)) { @@ -119,10 +122,16 @@ void CheckFile(std::string File, u64 Size) void FindFilename(u64 offset) { // Don't do anything if a game is not running - if (Core::GetState() != Core::CORE_RUN) return; + if (Core::GetState() != Core::CORE_RUN) + return; + // Or if the log is unselected - if (!LogManager::GetInstance()->IsEnabled(LogTypes::FILEMON)) return; - if (!FileAccess) return; + if (!LogManager::GetInstance()->IsEnabled(LogTypes::FILEMON)) + return; + + // Or if we don't have file access + if (!FileAccess) + return; if (!pFileSystem || ISOFile != SConfig::GetInstance().m_LastFilename) { diff --git a/Source/Core/DiscIO/Src/NANDContentLoader.cpp b/Source/Core/DiscIO/Src/NANDContentLoader.cpp index b60e5ae94a..36e1e959f5 100644 --- a/Source/Core/DiscIO/Src/NANDContentLoader.cpp +++ b/Source/Core/DiscIO/Src/NANDContentLoader.cpp @@ -260,17 +260,18 @@ bool CNANDContentLoader::Initialize(const std::string& _rName) rContent.m_Size= (u32)Common::swap64(pTMD + 0x01ec + 0x24*i); memcpy(rContent.m_SHA1Hash, pTMD + 0x01f4 + 0x24*i, 20); memcpy(rContent.m_Header, pTMD + 0x01e4 + 0x24*i, 36); + if (m_isWAD) { - u32 RoundedSize = ROUND_UP(rContent.m_Size, 0x40); - rContent.m_pData = new u8[RoundedSize]; + u32 RoundedSize = ROUND_UP(rContent.m_Size, 0x40); + rContent.m_pData = new u8[RoundedSize]; - memset(IV, 0, sizeof IV); - memcpy(IV, pTMD + 0x01e8 + 0x24*i, 2); - AESDecode(DecryptTitleKey, IV, pDataApp, RoundedSize, rContent.m_pData); + memset(IV, 0, sizeof IV); + memcpy(IV, pTMD + 0x01e8 + 0x24*i, 2); + AESDecode(DecryptTitleKey, IV, pDataApp, RoundedSize, rContent.m_pData); - pDataApp += RoundedSize; - continue; + pDataApp += RoundedSize; + continue; } rContent.m_pData = NULL; @@ -282,7 +283,9 @@ bool CNANDContentLoader::Initialize(const std::string& _rName) strcpy(szFilename, Filename.c_str()); } else + { sprintf(szFilename, "%s/%08x.app", m_Path.c_str(), rContent.m_ContentID); + } INFO_LOG(DISCIO, "NANDContentLoader: load %s", szFilename); diff --git a/Source/Core/DiscIO/Src/NANDContentLoader.h b/Source/Core/DiscIO/Src/NANDContentLoader.h index a5d9e1523f..b2de34f61d 100644 --- a/Source/Core/DiscIO/Src/NANDContentLoader.h +++ b/Source/Core/DiscIO/Src/NANDContentLoader.h @@ -62,7 +62,7 @@ public: virtual const u8* GetTMDHeader() const = 0; virtual u32 GetTIKSize() const = 0; virtual const u8* GetTIK() const = 0; - virtual const std::vector& GetContent() const = 0; + virtual const std::vector& GetContent() const = 0; virtual u16 GetTitleVersion() const = 0; virtual u16 GetNumEntries() const = 0; virtual DiscIO::IVolume::ECountry GetCountry() const = 0; diff --git a/Source/Core/DiscIO/Src/VolumeCommon.cpp b/Source/Core/DiscIO/Src/VolumeCommon.cpp index 71ac85cf2c..22012e3f4a 100644 --- a/Source/Core/DiscIO/Src/VolumeCommon.cpp +++ b/Source/Core/DiscIO/Src/VolumeCommon.cpp @@ -69,7 +69,7 @@ IVolume::ECountry CountrySwitch(u8 CountryCode) case 'T': // Korea with English language case 'Q': // Korea with Japanese language return IVolume::COUNTRY_KOREA; - break; + break; case 'O': return IVolume::COUNTRY_SDK; diff --git a/Source/Core/DiscIO/Src/VolumeDirectory.cpp b/Source/Core/DiscIO/Src/VolumeDirectory.cpp index f1a33f8177..9f0fd5c4f0 100644 --- a/Source/Core/DiscIO/Src/VolumeDirectory.cpp +++ b/Source/Core/DiscIO/Src/VolumeDirectory.cpp @@ -469,7 +469,7 @@ void CVolumeDirectory::WriteEntry(const File::FSTEntry& entry, u32& fstOffset, u if(entry.isDirectory) { u32 myOffset = fstOffset; - u32 myEntryNum = myOffset / ENTRY_SIZE; + u32 myEntryNum = myOffset / ENTRY_SIZE; WriteEntryData(fstOffset, DIRECTORY_ENTRY, nameOffset, parentEntryNum, (u32)(myEntryNum + entry.size + 1)); WriteEntryName(nameOffset, entry.virtualName); diff --git a/Source/Core/DiscIO/Src/WiiWad.cpp b/Source/Core/DiscIO/Src/WiiWad.cpp index 8736071c8b..aba7efc167 100644 --- a/Source/Core/DiscIO/Src/WiiWad.cpp +++ b/Source/Core/DiscIO/Src/WiiWad.cpp @@ -112,10 +112,11 @@ bool WiiWAD::ParseWAD(DiscIO::IBlobReader& _rReader) m_TMDSize = ReaderBig.Read32(0x14); m_DataAppSize = ReaderBig.Read32(0x18); m_FooterSize = ReaderBig.Read32(0x1C); + #if MAX_LOGLEVEL >= DEBUG_LEVEL - _dbg_assert_msg_(BOOT, Reserved==0x00, "WiiWAD: Reserved must be 0x00"); + _dbg_assert_msg_(BOOT, Reserved==0x00, "WiiWAD: Reserved must be 0x00"); #else - (void)Reserved; + (void)Reserved; #endif u32 Offset = 0x40;