From 477c21e946afa7f8057dac5728194e316948f3a1 Mon Sep 17 00:00:00 2001 From: LPFaint99 Date: Sun, 18 Aug 2013 14:58:23 -0700 Subject: [PATCH 01/33] fix import/export of games with folders. remove copy protection bit from banner - should allow *some* copy protected games to be moved to a real system; ex: super smash bros brawl, mario kart games with a nocopy/nomove folder cannot be imported to a real system without using homebrew tools, warn for these saves ex: guitar hero remove some unneccessary class fields the class is still incredibly ugly :( --- Source/Core/DolphinWX/Src/FrameTools.cpp | 4 +- Source/Core/DolphinWX/Src/GameListCtrl.cpp | 3 +- .../Src/MemoryCards/WiiSaveCrypted.cpp | 178 ++++++++++-------- .../Src/MemoryCards/WiiSaveCrypted.h | 25 ++- 4 files changed, 112 insertions(+), 98 deletions(-) diff --git a/Source/Core/DolphinWX/Src/FrameTools.cpp b/Source/Core/DolphinWX/Src/FrameTools.cpp index dcca6ccf66..40bc29a1ec 100644 --- a/Source/Core/DolphinWX/Src/FrameTools.cpp +++ b/Source/Core/DolphinWX/Src/FrameTools.cpp @@ -1320,9 +1320,7 @@ void CFrame::OnImportSave(wxCommandEvent& WXUNUSED (event)) if (!path.IsEmpty()) { - // TODO: Does this actually need to be dynamically allocated for some reason? - CWiiSaveCrypted* saveFile = new CWiiSaveCrypted(WxStrToStr(path).c_str()); - delete saveFile; + CWiiSaveCrypted::ImportWiiSave(WxStrToStr(path).c_str()); } } diff --git a/Source/Core/DolphinWX/Src/GameListCtrl.cpp b/Source/Core/DolphinWX/Src/GameListCtrl.cpp index c8e2e94072..a0186fa7e0 100644 --- a/Source/Core/DolphinWX/Src/GameListCtrl.cpp +++ b/Source/Core/DolphinWX/Src/GameListCtrl.cpp @@ -969,8 +969,7 @@ void CGameListCtrl::OnExportSave(wxCommandEvent& WXUNUSED (event)) if (Iso->GetTitleID((u8*)&title)) { title = Common::swap64(title); - CWiiSaveCrypted* exportSave = new CWiiSaveCrypted("", title); - delete exportSave; + CWiiSaveCrypted::ExportWiiSave(title); } delete Iso; } diff --git a/Source/Core/DolphinWX/Src/MemoryCards/WiiSaveCrypted.cpp b/Source/Core/DolphinWX/Src/MemoryCards/WiiSaveCrypted.cpp index cfdccf26c2..641805fc1b 100644 --- a/Source/Core/DolphinWX/Src/MemoryCards/WiiSaveCrypted.cpp +++ b/Source/Core/DolphinWX/Src/MemoryCards/WiiSaveCrypted.cpp @@ -21,18 +21,28 @@ const u8 MD5_BLANKER[0x10] = {0x0E, 0x65, 0x37, 0x81, 0x99, 0xBE, 0x45, 0x17, 0xAB, 0x06, 0xEC, 0x22, 0x45, 0x1A, 0x57, 0x93}; const u32 NG_id = 0x0403AC68; +bool CWiiSaveCrypted::ImportWiiSave(const char* FileName) +{ + CWiiSaveCrypted saveFile(FileName); + return saveFile.b_valid; +} + +bool CWiiSaveCrypted::ExportWiiSave(u64 TitleID) +{ + CWiiSaveCrypted exportSave("", TitleID); + return exportSave.b_valid; +} + CWiiSaveCrypted::CWiiSaveCrypted(const char* FileName, u64 TitleID) : m_TitleID(TitleID) { Common::ReadReplacements(replacements); - strcpy(pathData_bin, FileName); + encryptedSavePath = std::string(FileName); memcpy(SD_IV, "\x21\x67\x12\xE6\xAA\x1F\x68\x9F\x95\xC5\xA2\x23\x24\xDC\x6A\x98", 0x10); if (!TitleID) // Import { AES_set_decrypt_key(SDKey, 128, &m_AES_KEY); - do - { b_valid = true; ReadHDR(); ReadBKHDR(); @@ -41,13 +51,11 @@ CWiiSaveCrypted::CWiiSaveCrypted(const char* FileName, u64 TitleID) if (b_valid) { SuccessAlertT("Successfully imported save files"); - b_tryAgain = false; } else { - b_tryAgain = AskYesNoT("Import failed, try again?"); + PanicAlertT("Import failed"); } - } while(b_tryAgain); } else { @@ -55,33 +63,29 @@ CWiiSaveCrypted::CWiiSaveCrypted(const char* FileName, u64 TitleID) if (getPaths(true)) { - do + b_valid = true; + WriteHDR(); + WriteBKHDR(); + ExportWiiSaveFiles(); + do_sig(); + if (b_valid) { - b_valid = true; - WriteHDR(); - WriteBKHDR(); - ExportWiiSaveFiles(); - do_sig(); - if (b_valid) - { - SuccessAlertT("Successfully exported file to %s", pathData_bin); - b_tryAgain = false; - } - else - { - b_tryAgain = AskYesNoT("Export failed, try again?"); - } - } while(b_tryAgain); + SuccessAlertT("Successfully exported file to %s", encryptedSavePath.c_str()); + } + else + { + PanicAlertT("Export failed"); + } } } } void CWiiSaveCrypted::ReadHDR() { - File::IOFile fpData_bin(pathData_bin, "rb"); + File::IOFile fpData_bin(encryptedSavePath, "rb"); if (!fpData_bin) { - PanicAlertT("Cannot open %s", pathData_bin); + PanicAlertT("Cannot open %s", encryptedSavePath.c_str()); b_valid = false; return; } @@ -94,16 +98,19 @@ void CWiiSaveCrypted::ReadHDR() fpData_bin.Close(); AES_cbc_encrypt((const u8*)&_encryptedHeader, (u8*)&_header, HEADER_SZ, &m_AES_KEY, SD_IV, AES_DECRYPT); - _bannerSize = Common::swap32(_header.hdr.BannerSize); - if ((_bannerSize < FULL_BNR_MIN) || (_bannerSize > FULL_BNR_MAX) || - (((_bannerSize - BNR_SZ) % ICON_SZ) != 0)) + u32 bannerSize = Common::swap32(_header.hdr.BannerSize); + if ((bannerSize < FULL_BNR_MIN) || (bannerSize > FULL_BNR_MAX) || + (((bannerSize - BNR_SZ) % ICON_SZ) != 0)) { - PanicAlertT("Not a Wii save or read failure for file header size %x", _bannerSize); + PanicAlertT("Not a Wii save or read failure for file header size %x", bannerSize); b_valid = false; return; } m_TitleID = Common::swap64(_header.hdr.SaveGameTitle); + + u8 md5_file[16], + md5_calc[16]; memcpy(md5_file, _header.hdr.Md5, 0x10); memcpy(_header.hdr.Md5, MD5_BLANKER, 0x10); md5((u8*)&_header, HEADER_SZ, md5_calc); @@ -118,11 +125,12 @@ void CWiiSaveCrypted::ReadHDR() b_valid = false; return; } + std::string BannerFilePath = WiiTitlePath + "banner.bin"; if (!File::Exists(BannerFilePath) || AskYesNoT("%s already exists, overwrite?", BannerFilePath.c_str())) { INFO_LOG(CONSOLE, "Creating file %s", BannerFilePath.c_str()); File::IOFile fpBanner_bin(BannerFilePath, "wb"); - fpBanner_bin.WriteBytes(_header.BNR, _bannerSize); + fpBanner_bin.WriteBytes(_header.BNR, bannerSize); } } @@ -131,12 +139,13 @@ void CWiiSaveCrypted::WriteHDR() if (!b_valid) return; memset(&_header, 0, HEADER_SZ); + std::string BannerFilePath = WiiTitlePath + "banner.bin"; u32 bannerSize = File::GetSize(BannerFilePath); _header.hdr.BannerSize = Common::swap32(bannerSize); _header.hdr.SaveGameTitle = Common::swap64(m_TitleID); memcpy(_header.hdr.Md5, MD5_BLANKER, 0x10); - _header.hdr.Permissions = 0x35; + _header.hdr.Permissions = 0x3C; File::IOFile fpBanner_bin(BannerFilePath, "rb"); if (!fpBanner_bin.ReadBytes(_header.BNR, bannerSize)) @@ -145,16 +154,19 @@ void CWiiSaveCrypted::WriteHDR() b_valid = false; return; } - + // remove nocopy flag + _header.BNR[7] &= ~1; + + u8 md5_calc[16]; md5((u8*)&_header, HEADER_SZ, md5_calc); memcpy(_header.hdr.Md5, md5_calc, 0x10); AES_cbc_encrypt((const unsigned char *)&_header, (u8*)&_encryptedHeader, HEADER_SZ, &m_AES_KEY, SD_IV, AES_ENCRYPT); - File::IOFile fpData_bin(pathData_bin, "wb"); + File::IOFile fpData_bin(encryptedSavePath, "wb"); if (!fpData_bin.WriteBytes(&_encryptedHeader, HEADER_SZ)) { - PanicAlertT("Failed to write header for %s", pathData_bin); + PanicAlertT("Failed to write header for %s", encryptedSavePath.c_str()); b_valid = false; } } @@ -165,10 +177,10 @@ void CWiiSaveCrypted::ReadBKHDR() { if (!b_valid) return; - File::IOFile fpData_bin(pathData_bin, "rb"); + File::IOFile fpData_bin(encryptedSavePath, "rb"); if (!fpData_bin) { - PanicAlertT("Cannot open %s", pathData_bin); + PanicAlertT("Cannot open %s", encryptedSavePath.c_str()); b_valid = false; return; } @@ -215,7 +227,7 @@ void CWiiSaveCrypted::WriteBKHDR() bkhdr.totalSize = Common::swap32(_sizeOfFiles + FULL_CERT_SZ); bkhdr.SaveGameTitle = Common::swap64(m_TitleID); - File::IOFile fpData_bin(pathData_bin, "ab"); + File::IOFile fpData_bin(encryptedSavePath, "ab"); if (!fpData_bin.WriteBytes(&bkhdr, BK_SZ)) { PanicAlertT("Failed to write bkhdr"); @@ -227,10 +239,10 @@ void CWiiSaveCrypted::ImportWiiSaveFiles() { if (!b_valid) return; - File::IOFile fpData_bin(pathData_bin, "rb"); + File::IOFile fpData_bin(encryptedSavePath, "rb"); if (!fpData_bin) { - PanicAlertT("Cannot open %s", pathData_bin); + PanicAlertT("Cannot open %s", encryptedSavePath.c_str()); b_valid = false; return; } @@ -244,11 +256,11 @@ void CWiiSaveCrypted::ImportWiiSaveFiles() { memset(&_tmpFileHDR, 0, FILE_HDR_SZ); memset(IV, 0, 0x10); - _fileSize = 0; + u32 _fileSize = 0; if (!fpData_bin.ReadBytes(&_tmpFileHDR, FILE_HDR_SZ)) { - PanicAlertT("Failed to write header for file %d", i); + PanicAlertT("Failed to read header for file %d", i); b_valid = false; } @@ -267,14 +279,15 @@ void CWiiSaveCrypted::ImportWiiSaveFiles() } std::string fullFilePath = WiiTitlePath + fileName; - File::CreateFullPath(fullFilePath); + File::CreateFullPath(fullFilePath); if (_tmpFileHDR.type == 1) { _fileSize = Common::swap32(_tmpFileHDR.size); u32 RoundedFileSize = ROUND_UP(_fileSize, BLOCK_SZ); - _encryptedData = new u8[RoundedFileSize]; - _data = new u8[RoundedFileSize]; - if (!fpData_bin.ReadBytes(_encryptedData, RoundedFileSize)) + std::vector _data,_encryptedData; + _data.reserve(RoundedFileSize); + _encryptedData.reserve(RoundedFileSize); + if (!fpData_bin.ReadBytes(&_encryptedData[0], RoundedFileSize)) { PanicAlertT("Failed to read data from file %d", i); b_valid = false; @@ -283,17 +296,15 @@ void CWiiSaveCrypted::ImportWiiSaveFiles() memcpy(IV, _tmpFileHDR.IV, 0x10); - AES_cbc_encrypt((const unsigned char *)_encryptedData, _data, RoundedFileSize, &m_AES_KEY, IV, AES_DECRYPT); - delete []_encryptedData; + AES_cbc_encrypt((const unsigned char *)&_encryptedData[0], &_data[0], RoundedFileSize, &m_AES_KEY, IV, AES_DECRYPT); if (!File::Exists(fullFilePath) || AskYesNoT("%s already exists, overwrite?", fullFilePath.c_str())) { INFO_LOG(CONSOLE, "Creating file %s", fullFilePath.c_str()); File::IOFile fpRawSaveFile(fullFilePath, "wb"); - fpRawSaveFile.WriteBytes(_data, _fileSize); + fpRawSaveFile.WriteBytes(&_data[0], _fileSize); } - delete []_data; } } } @@ -303,25 +314,29 @@ void CWiiSaveCrypted::ExportWiiSaveFiles() { if (!b_valid) return; - u8 *__ENCdata, - *__data; - for(u32 i = 0; i < _numberOfFiles; i++) { FileHDR tmpFileHDR; std::string __name, __ext; memset(&tmpFileHDR, 0, FILE_HDR_SZ); - - _fileSize = File::GetSize(FilesList[i]); - _roundedfileSize = ROUND_UP(_fileSize, BLOCK_SZ); - + + u32 _fileSize = 0; + if (File::IsDirectory(FilesList[i])) + { + tmpFileHDR.type = 2; + } + else + { + _fileSize = File::GetSize(FilesList[i]); + tmpFileHDR.type = 1; + } + + u32 _roundedfileSize = ROUND_UP(_fileSize, BLOCK_SZ); tmpFileHDR.magic = Common::swap32(FILE_HDR_MAGIC); tmpFileHDR.size = Common::swap32(_fileSize); - tmpFileHDR.Permissions = 0x35; - tmpFileHDR.type = File::IsDirectory(FilesList[i]) ? 2 : 1; + tmpFileHDR.Permissions = 0x3c; - SplitPath(FilesList[i], NULL, &__name, &__ext); - __name += __ext; + __name = FilesList[i].substr(WiiTitlePath.length()+1); for (Common::replace_v::const_iterator iter = replacements.begin(); iter != replacements.end(); ++iter) @@ -341,7 +356,7 @@ void CWiiSaveCrypted::ExportWiiSaveFiles() strncpy((char *)tmpFileHDR.name, __name.c_str(), __name.length()); { - File::IOFile fpData_bin(pathData_bin, "ab"); + File::IOFile fpData_bin(encryptedSavePath, "ab"); fpData_bin.WriteBytes(&tmpFileHDR, FILE_HDR_SZ); } @@ -359,22 +374,23 @@ void CWiiSaveCrypted::ExportWiiSaveFiles() PanicAlertT("%s failed to open", FilesList[i].c_str()); b_valid = false; } - __data = new u8[_roundedfileSize]; - __ENCdata = new u8[_roundedfileSize]; - memset(__data, 0, _roundedfileSize); - if (!fpRawSaveFile.ReadBytes(__data, _fileSize)) + + std::vector _data,_encryptedData; + _data.reserve(_roundedfileSize); + _encryptedData.reserve(_roundedfileSize); + memset(&_data[0], 0, _roundedfileSize); + if (!fpRawSaveFile.ReadBytes(&_data[0], _fileSize)) { PanicAlertT("Failed to read data from file: %s", FilesList[i].c_str()); b_valid = false; } - AES_cbc_encrypt((const u8*)__data, __ENCdata, _roundedfileSize, &m_AES_KEY, tmpFileHDR.IV, AES_ENCRYPT); + AES_cbc_encrypt((const u8*)&_data[0], &_encryptedData[0], _roundedfileSize, &m_AES_KEY, tmpFileHDR.IV, AES_ENCRYPT); - File::IOFile fpData_bin(pathData_bin, "ab"); - fpData_bin.WriteBytes(__ENCdata, _roundedfileSize); + File::IOFile fpData_bin(encryptedSavePath, "ab"); + if (!fpData_bin.WriteBytes(&_encryptedData[0], _roundedfileSize)) + PanicAlertT("Failed to write data to file: %s", encryptedSavePath.c_str()); - delete [] __data; - delete [] __ENCdata; } } @@ -424,7 +440,7 @@ void CWiiSaveCrypted::do_sig() data_size = Common::swap32(bkhdr.sizeOfFiles) + 0x80; - File::IOFile fpData_bin(pathData_bin, "rb"); + File::IOFile fpData_bin(encryptedSavePath, "rb"); if (!fpData_bin) { b_valid = false; @@ -443,7 +459,7 @@ void CWiiSaveCrypted::do_sig() sha1(hash, 20, hash); delete []data; - fpData_bin.Open(pathData_bin, "ab"); + fpData_bin.Open(encryptedSavePath, "ab"); if (!fpData_bin) { b_valid = false; @@ -478,7 +494,6 @@ bool CWiiSaveCrypted::getPaths(bool forExport) if (m_TitleID) { WiiTitlePath = Common::GetTitleDataPath(m_TitleID); - BannerFilePath = WiiTitlePath + "banner.bin"; } if (forExport) @@ -495,16 +510,16 @@ bool CWiiSaveCrypted::getPaths(bool forExport) return false; } - if(!File::Exists(BannerFilePath)) + if(!File::Exists(WiiTitlePath + "banner.bin")) { b_valid = false; PanicAlertT("No banner file found for title %s", GameID); return false; } - if (strlen(pathData_bin) == 0) - strcpy(pathData_bin, "."); // If no path was passed, use current dir - sprintf(pathData_bin, "%s/private/wii/title/%s/data.bin", pathData_bin, GameID); - File::CreateFullPath(pathData_bin); + if (encryptedSavePath.length() == 0) + encryptedSavePath = "."; // If no path was passed, use current dir + encryptedSavePath += StringFromFormat("/private/wii/title/%s/data.bin", GameID); + File::CreateFullPath(encryptedSavePath); } else { @@ -535,15 +550,20 @@ void CWiiSaveCrypted::ScanForFiles(std::string savDir, std::vector& if (strncmp(FST_Temp.children.at(j).virtualName.c_str(), "banner.bin", 10) != 0) { (*_numFiles)++; - *_sizeFiles += FILE_HDR_SZ + ROUND_UP(FST_Temp.children.at(j).size, BLOCK_SZ); - + *_sizeFiles += FILE_HDR_SZ; if (FST_Temp.children.at(j).isDirectory) { + if ((FST_Temp.children.at(j).virtualName == "nocopy") || FST_Temp.children.at(j).virtualName == "nomove") + { + PanicAlert("This save will likely require homebrew tools to copy to a real wii"); + } + Directories.push_back(FST_Temp.children.at(j).physicalName); } else { FileList.push_back(FST_Temp.children.at(j).physicalName); + *_sizeFiles += ROUND_UP(FST_Temp.children.at(j).size, BLOCK_SZ); } } } diff --git a/Source/Core/DolphinWX/Src/MemoryCards/WiiSaveCrypted.h b/Source/Core/DolphinWX/Src/MemoryCards/WiiSaveCrypted.h index c27ee58a19..e4fd67134d 100644 --- a/Source/Core/DolphinWX/Src/MemoryCards/WiiSaveCrypted.h +++ b/Source/Core/DolphinWX/Src/MemoryCards/WiiSaveCrypted.h @@ -16,6 +16,10 @@ class CWiiSaveCrypted { public: + bool static ImportWiiSave(const char* FileName); + bool static ExportWiiSave(u64 TitleID); + +private: CWiiSaveCrypted(const char* FileName, u64 TitleID = 0); ~CWiiSaveCrypted(); void ReadHDR(); @@ -30,33 +34,26 @@ public: bool getPaths(bool forExport = false); void ScanForFiles(std::string savDir, std::vector&FilesList, u32 *_numFiles, u32 *_sizeFiles); -private: + AES_KEY m_AES_KEY; u8 SD_IV[0x10]; std::vector FilesList; - char pathData_bin[2048]; + std::string encryptedSavePath; std::string BannerFilePath, WiiTitlePath; - u8 IV[0x10], - *_encryptedData, - *_data, - md5_file[16], - md5_calc[16]; - - u32 _bannerSize, + u8 IV[0x10]; + + u32 //_bannerSize, _numberOfFiles, _sizeOfFiles, - _totalSize, - _fileSize, - _roundedfileSize; + _totalSize; u64 m_TitleID; - bool b_valid, - b_tryAgain; + bool b_valid; enum { From c2d208df96b4fc839b6f32756b1836e1a127c205 Mon Sep 17 00:00:00 2001 From: LPFaint99 Date: Sun, 18 Aug 2013 14:59:05 -0700 Subject: [PATCH 02/33] add the ability to export all save files --- Source/Core/DolphinWX/Src/Frame.cpp | 1 + Source/Core/DolphinWX/Src/Frame.h | 1 + Source/Core/DolphinWX/Src/FrameTools.cpp | 8 ++++- Source/Core/DolphinWX/Src/Globals.h | 1 + .../Src/MemoryCards/WiiSaveCrypted.cpp | 36 +++++++++++++++++++ .../Src/MemoryCards/WiiSaveCrypted.h | 1 + 6 files changed, 47 insertions(+), 1 deletion(-) diff --git a/Source/Core/DolphinWX/Src/Frame.cpp b/Source/Core/DolphinWX/Src/Frame.cpp index 613cdc35ab..5d0113ef53 100644 --- a/Source/Core/DolphinWX/Src/Frame.cpp +++ b/Source/Core/DolphinWX/Src/Frame.cpp @@ -191,6 +191,7 @@ EVT_MENU(IDM_NETPLAY, CFrame::OnNetPlay) EVT_MENU(IDM_BROWSE, CFrame::OnBrowse) EVT_MENU(IDM_MEMCARD, CFrame::OnMemcard) EVT_MENU(IDM_IMPORTSAVE, CFrame::OnImportSave) +EVT_MENU(IDM_EXPORTALLSAVE, CFrame::OnExportAllSaves) EVT_MENU(IDM_CHEATS, CFrame::OnShow_CheatsWindow) EVT_MENU(IDM_CHANGEDISC, CFrame::OnChangeDisc) EVT_MENU(IDM_MENU_INSTALLWAD, CFrame::OnInstallWAD) diff --git a/Source/Core/DolphinWX/Src/Frame.h b/Source/Core/DolphinWX/Src/Frame.h index 2891d9931c..a904a7aa5f 100644 --- a/Source/Core/DolphinWX/Src/Frame.h +++ b/Source/Core/DolphinWX/Src/Frame.h @@ -324,6 +324,7 @@ private: void OnMemcard(wxCommandEvent& event); // Misc void OnImportSave(wxCommandEvent& event); + void OnExportAllSaves(wxCommandEvent& event); void OnNetPlay(wxCommandEvent& event); diff --git a/Source/Core/DolphinWX/Src/FrameTools.cpp b/Source/Core/DolphinWX/Src/FrameTools.cpp index 40bc29a1ec..6663a59665 100644 --- a/Source/Core/DolphinWX/Src/FrameTools.cpp +++ b/Source/Core/DolphinWX/Src/FrameTools.cpp @@ -190,7 +190,8 @@ void CFrame::CreateMenu() // Tools menu wxMenu* toolsMenu = new wxMenu; toolsMenu->Append(IDM_MEMCARD, _("&Memcard Manager (GC)")); - toolsMenu->Append(IDM_IMPORTSAVE, _("Wii Save Import")); + toolsMenu->Append(IDM_IMPORTSAVE, _("Import Wii Save")); + toolsMenu->Append(IDM_EXPORTALLSAVE, _("Export All Wii Saves")); toolsMenu->Append(IDM_CHEATS, _("&Cheats Manager")); toolsMenu->Append(IDM_NETPLAY, _("Start &NetPlay")); @@ -1310,6 +1311,11 @@ void CFrame::OnMemcard(wxCommandEvent& WXUNUSED (event)) MemcardManager.ShowModal(); } +void CFrame::OnExportAllSaves(wxCommandEvent& WXUNUSED (event)) +{ + CWiiSaveCrypted::ExportAllSaves(); +} + void CFrame::OnImportSave(wxCommandEvent& WXUNUSED (event)) { wxString path = wxFileSelector(_("Select the save file"), diff --git a/Source/Core/DolphinWX/Src/Globals.h b/Source/Core/DolphinWX/Src/Globals.h index 5930427620..f55a6b2b66 100644 --- a/Source/Core/DolphinWX/Src/Globals.h +++ b/Source/Core/DolphinWX/Src/Globals.h @@ -231,6 +231,7 @@ enum IDM_OPENSAVEFOLDER, IDM_EXPORTSAVE, IDM_IMPORTSAVE, + IDM_EXPORTALLSAVE, IDM_SETDEFAULTGCM, IDM_DELETEGCM, IDM_COMPRESSGCM, diff --git a/Source/Core/DolphinWX/Src/MemoryCards/WiiSaveCrypted.cpp b/Source/Core/DolphinWX/Src/MemoryCards/WiiSaveCrypted.cpp index 641805fc1b..31985f374f 100644 --- a/Source/Core/DolphinWX/Src/MemoryCards/WiiSaveCrypted.cpp +++ b/Source/Core/DolphinWX/Src/MemoryCards/WiiSaveCrypted.cpp @@ -11,6 +11,7 @@ #include "FileUtil.h" #include "MathUtil.h" #include "NandPaths.h" +#include "FileUtil.h" #include static Common::replace_v replacements; @@ -33,6 +34,41 @@ bool CWiiSaveCrypted::ExportWiiSave(u64 TitleID) return exportSave.b_valid; } +void CWiiSaveCrypted::ExportAllSaves() +{ + std::string titleFolder = File::GetUserPath(D_WIIUSER_IDX) + "title"; + std::vector titles; + u32 pathMask = 0x00010000; + for (int i = 0; i < 8; ++i) + { + File::FSTEntry FST_Temp; + std::string folder = StringFromFormat("%s/%08x/", titleFolder.c_str(), pathMask | i); + File::ScanDirectoryTree(folder, FST_Temp); + + for (u32 j = 0; j < FST_Temp.children.size(); j++) + { + if (FST_Temp.children[j].isDirectory) + { + u32 gameid; + if (AsciiToHex(FST_Temp.children[j].virtualName.c_str(), gameid)) + { + std::string bannerPath = StringFromFormat("%s%08x/data/banner.bin", folder.c_str(), gameid); + if (File::Exists(bannerPath)) + { + u64 titleID = (((u64)pathMask | i) << 32) | gameid; + titles.push_back(titleID); + } + } + } + } + } + SuccessAlertT("Found %llx save files", titles.size()); + for (u32 i = 0; i < titles.size(); ++i) + { + CWiiSaveCrypted* exportSave = new CWiiSaveCrypted("", titles[i]); + delete exportSave; + } +} CWiiSaveCrypted::CWiiSaveCrypted(const char* FileName, u64 TitleID) : m_TitleID(TitleID) { diff --git a/Source/Core/DolphinWX/Src/MemoryCards/WiiSaveCrypted.h b/Source/Core/DolphinWX/Src/MemoryCards/WiiSaveCrypted.h index e4fd67134d..e3a77b4f72 100644 --- a/Source/Core/DolphinWX/Src/MemoryCards/WiiSaveCrypted.h +++ b/Source/Core/DolphinWX/Src/MemoryCards/WiiSaveCrypted.h @@ -18,6 +18,7 @@ class CWiiSaveCrypted public: bool static ImportWiiSave(const char* FileName); bool static ExportWiiSave(u64 TitleID); + void static ExportAllSaves(); private: CWiiSaveCrypted(const char* FileName, u64 TitleID = 0); From 8bb16d8e989be8c753b95f35a9ac94bdfd7f5ff0 Mon Sep 17 00:00:00 2001 From: Ryan Houdek Date: Thu, 29 Aug 2013 22:29:33 -0500 Subject: [PATCH 03/33] [Android] Android NDK now supports full implementations of std::mutex, std::thread, and std::conditional_variable so there is no need to have our own implementations there now. --- Source/Core/Common/Src/StdConditionVariable.h | 2 +- Source/Core/Common/Src/StdMutex.h | 2 +- Source/Core/Common/Src/StdThread.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Source/Core/Common/Src/StdConditionVariable.h b/Source/Core/Common/Src/StdConditionVariable.h index 63f4551950..048a7e8975 100644 --- a/Source/Core/Common/Src/StdConditionVariable.h +++ b/Source/Core/Common/Src/StdConditionVariable.h @@ -9,7 +9,7 @@ #define __has_include(s) 0 #endif -#if GCC_VERSION >= GCC_VER(4,4,0) && __GXX_EXPERIMENTAL_CXX0X__ && !ANDROID +#if GCC_VERSION >= GCC_VER(4,4,0) && __GXX_EXPERIMENTAL_CXX0X__ // GCC 4.4 provides #include diff --git a/Source/Core/Common/Src/StdMutex.h b/Source/Core/Common/Src/StdMutex.h index f66a5d1b2e..ce46a2f591 100644 --- a/Source/Core/Common/Src/StdMutex.h +++ b/Source/Core/Common/Src/StdMutex.h @@ -9,7 +9,7 @@ #define __has_include(s) 0 #endif -#if GCC_VERSION >= GCC_VER(4,4,0) && __GXX_EXPERIMENTAL_CXX0X__ && !ANDROID +#if GCC_VERSION >= GCC_VER(4,4,0) && __GXX_EXPERIMENTAL_CXX0X__ // GCC 4.4 provides #include #elif __has_include() && !ANDROID diff --git a/Source/Core/Common/Src/StdThread.h b/Source/Core/Common/Src/StdThread.h index 134bbb2fc0..e43d283443 100644 --- a/Source/Core/Common/Src/StdThread.h +++ b/Source/Core/Common/Src/StdThread.h @@ -9,7 +9,7 @@ #define __has_include(s) 0 #endif -#if GCC_VERSION >= GCC_VER(4,4,0) && __GXX_EXPERIMENTAL_CXX0X__ && !ANDROID +#if GCC_VERSION >= GCC_VER(4,4,0) && __GXX_EXPERIMENTAL_CXX0X__ // GCC 4.4 provides #ifndef _GLIBCXX_USE_SCHED_YIELD #define _GLIBCXX_USE_SCHED_YIELD From 7cceace1ed2887464464b0e1fe05d7a55dc81c11 Mon Sep 17 00:00:00 2001 From: Ryan Houdek Date: Fri, 30 Aug 2013 06:43:06 +0000 Subject: [PATCH 04/33] [ARM] Fix Savestates. --- Source/Core/Core/Src/PowerPC/JitArm32/JitAsm.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/Source/Core/Core/Src/PowerPC/JitArm32/JitAsm.cpp b/Source/Core/Core/Src/PowerPC/JitArm32/JitAsm.cpp index 851d8b7706..0c3a73c38e 100644 --- a/Source/Core/Core/Src/PowerPC/JitArm32/JitAsm.cpp +++ b/Source/Core/Core/Src/PowerPC/JitArm32/JitAsm.cpp @@ -44,7 +44,12 @@ JitArmAsmRoutineManager asm_routines; void JitArmAsmRoutineManager::Generate() { enterCode = GetCodePtr(); - PUSH(2, R11, _LR); // R11 is frame pointer in Debug. + PUSH(9, R4, R5, R6, R7, R8, R9, R10, R11, _LR); + // Take care to 8-byte align stack for function calls. + // We are misaligned here because of an odd number of args for PUSH. + // It's not like x86 where you need to account for an extra 4 bytes + // consumed by CALL. + SUB(_SP, _SP, 4); MOVI2R(R0, (u32)&CoreTiming::downcount); MOVI2R(R9, (u32)&PowerPC::ppcState.spr[0]); @@ -129,7 +134,9 @@ void JitArmAsmRoutineManager::Generate() SetJumpTarget(Exit); - POP(2, R11, _PC); + ADD(_SP, _SP, 4); + + POP(9, R4, R5, R6, R7, R8, R9, R10, R11, _PC); // Returns FlushIcache(); } From 2ab7fc10daa8b7af2dde19c1c584a09cee79f624 Mon Sep 17 00:00:00 2001 From: Pierre Bourdon Date: Fri, 30 Aug 2013 09:14:30 +0200 Subject: [PATCH 05/33] Rollback "DSP on Thread" to only affect LLE. Keep the threading code in AX HLE in case we want/need to enable it again at some point. Not too confident about refactoring it right now. --- Source/Core/Core/Src/HW/DSPHLE/UCodes/UCode_AX.cpp | 5 ++++- Source/Core/DolphinWX/Src/ConfigMain.cpp | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) 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 411624a714..e82ce626c9 100644 --- a/Source/Core/Core/Src/HW/DSPHLE/UCodes/UCode_AX.cpp +++ b/Source/Core/Core/Src/HW/DSPHLE/UCodes/UCode_AX.cpp @@ -14,7 +14,7 @@ CUCode_AX::CUCode_AX(DSPHLE* dsp_hle, u32 crc) : IUCode(dsp_hle, crc) , m_work_available(false) , m_cmdlist_size(0) - , m_run_on_thread(SConfig::GetInstance().m_LocalCoreStartupParameter.bDSPThread) + , m_run_on_thread(false) { WARN_LOG(DSPHLE, "Instantiating CUCode_AX: crc=%08x", crc); m_rMailHandler.PushMail(DSP_INIT); @@ -22,6 +22,9 @@ CUCode_AX::CUCode_AX(DSPHLE* dsp_hle, u32 crc) LoadResamplingCoefficients(); + // DSP HLE on thread is always disabled because it causes audio + // issues/glitching (different timing characteristics). m_run_on_thread is + // always false. if (m_run_on_thread) m_axthread = std::thread(SpawnAXThread, this); } diff --git a/Source/Core/DolphinWX/Src/ConfigMain.cpp b/Source/Core/DolphinWX/Src/ConfigMain.cpp index e9da722739..0f82378f50 100644 --- a/Source/Core/DolphinWX/Src/ConfigMain.cpp +++ b/Source/Core/DolphinWX/Src/ConfigMain.cpp @@ -502,7 +502,7 @@ void CConfigMain::InitializeGUITooltips() InterfaceLang->SetToolTip(_("Change the language of the user interface.\nRequires restart.")); // Audio tooltips - DSPThread->SetToolTip(_("Run DSP HLE and LLE on a dedicated thread (not recommended: might cause audio glitches with HLE and freezes with LLE).")); + DSPThread->SetToolTip(_("Run DSP LLE on a dedicated thread (not recommended: might cause freezes).")); BackendSelection->SetToolTip(_("Changing this will have no effect while the emulator is running!")); // Gamecube - Devices @@ -643,7 +643,7 @@ void CConfigMain::CreateGUIControls() // Audio page DSPEngine = new wxRadioBox(AudioPage, ID_DSPENGINE, _("DSP Emulator Engine"), wxDefaultPosition, wxDefaultSize, arrayStringFor_DSPEngine, 0, wxRA_SPECIFY_ROWS); - DSPThread = new wxCheckBox(AudioPage, ID_DSPTHREAD, _("DSP on Dedicated Thread")); + DSPThread = new wxCheckBox(AudioPage, ID_DSPTHREAD, _("DSPLLE on Separate Thread")); DumpAudio = new wxCheckBox(AudioPage, ID_DUMP_AUDIO, _("Dump Audio"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator); DPL2Decoder = new wxCheckBox(AudioPage, ID_DPL2DECODER, _("Dolby Pro Logic II decoder")); From 2c1337eb5f89be68ed649ec66e8805055ecfca1c Mon Sep 17 00:00:00 2001 From: Ryan Houdek Date: Fri, 30 Aug 2013 09:37:57 +0000 Subject: [PATCH 06/33] [ARM] Support both hardfp and softfp with lfs and lfd. Fixes these two instructions on Android since it uses softfp calling conventions. This adds a emitter for moving from two ARM Registers to a double VFP reg. --- Source/Core/Common/Src/ArmEmitter.cpp | 5 ++++- .../Src/PowerPC/JitArm32/JitArm_LoadStoreFloating.cpp | 9 ++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/Source/Core/Common/Src/ArmEmitter.cpp b/Source/Core/Common/Src/ArmEmitter.cpp index 2788760c6d..e9102f20cf 100644 --- a/Source/Core/Common/Src/ArmEmitter.cpp +++ b/Source/Core/Common/Src/ArmEmitter.cpp @@ -1154,7 +1154,10 @@ void ARMXEmitter::VMOV(ARMReg Dest, ARMReg Src) else { // Move 64bit from Arm reg - _dbg_assert_msg_(DYNA_REC, false, "This VMOV doesn't support moving 64bit ARM to NEON"); + ARMReg Src2 = (ARMReg)(Src + 1); + Dest = (ARMReg)(Dest - S0); + Write32(condition | (0xC4 << 20) | (Src2 << 16) | (Src << 12) \ + | (0xB << 8) | ((Dest & 0x10) << 1) | (1 << 4) | ((Dest & 0xF) >> 1)); return; } } diff --git a/Source/Core/Core/Src/PowerPC/JitArm32/JitArm_LoadStoreFloating.cpp b/Source/Core/Core/Src/PowerPC/JitArm32/JitArm_LoadStoreFloating.cpp index 14a9786cc2..178007f5b3 100644 --- a/Source/Core/Core/Src/PowerPC/JitArm32/JitArm_LoadStoreFloating.cpp +++ b/Source/Core/Core/Src/PowerPC/JitArm32/JitArm_LoadStoreFloating.cpp @@ -61,6 +61,9 @@ void JitArm::lfs(UGeckoInstruction inst) ARMReg v0 = fpr.R0(inst.FD); ARMReg v1 = fpr.R1(inst.FD); +#if !defined(__ARM_PCS_VFP) // SoftFP returns in R0 + VMOV(S0, R0); +#endif VCVT(v0, S0, 0); VCVT(v1, S0, 0); @@ -98,8 +101,12 @@ void JitArm::lfd(UGeckoInstruction inst) BL(rA); ARMReg v0 = fpr.R0(inst.FD); - +#if !defined(__ARM_PCS_VFP) // SoftFP returns in R0 and R1 + VMOV(v0, R0); +#else VMOV(v0, D0); +#endif + POP(4, R0, R1, R2, R3); gpr.Unlock(rA, rB); From 710ac0408405cb85e07341699dcdc373f5a8d5f5 Mon Sep 17 00:00:00 2001 From: Ryan Houdek Date: Fri, 30 Aug 2013 05:13:43 -0500 Subject: [PATCH 07/33] [ARM] Fix the VMOV encoding to encode the destination VFP register correctly. --- Source/Core/Common/Src/ArmEmitter.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/Core/Common/Src/ArmEmitter.cpp b/Source/Core/Common/Src/ArmEmitter.cpp index e9102f20cf..03f29da8bc 100644 --- a/Source/Core/Common/Src/ArmEmitter.cpp +++ b/Source/Core/Common/Src/ArmEmitter.cpp @@ -1155,9 +1155,9 @@ void ARMXEmitter::VMOV(ARMReg Dest, ARMReg Src) { // Move 64bit from Arm reg ARMReg Src2 = (ARMReg)(Src + 1); - Dest = (ARMReg)(Dest - S0); + Dest = SubBase(Dest); Write32(condition | (0xC4 << 20) | (Src2 << 16) | (Src << 12) \ - | (0xB << 8) | ((Dest & 0x10) << 1) | (1 << 4) | ((Dest & 0xF) >> 1)); + | (0xB << 8) | ((Dest & 0x10) << 1) | (1 << 4) | (Dest & 0xF)); return; } } From 6428137ca4ab7934e6e22dc3b5497c5be347bc87 Mon Sep 17 00:00:00 2001 From: Pierre Bourdon Date: Fri, 30 Aug 2013 19:12:41 +0200 Subject: [PATCH 08/33] Set XAudio2 as the default audio backend --- Source/Core/Core/Src/ConfigManager.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Core/Core/Src/ConfigManager.cpp b/Source/Core/Core/Src/ConfigManager.cpp index c183f88c6a..a84b235b04 100644 --- a/Source/Core/Core/Src/ConfigManager.cpp +++ b/Source/Core/Core/Src/ConfigManager.cpp @@ -450,7 +450,7 @@ void SConfig::LoadSettings() #elif defined __APPLE__ ini.Get("DSP", "Backend", &sBackend, BACKEND_COREAUDIO); #elif defined _WIN32 - ini.Get("DSP", "Backend", &sBackend, BACKEND_DIRECTSOUND); + ini.Get("DSP", "Backend", &sBackend, BACKEND_XAUDIO2); #elif defined ANDROID ini.Get("DSP", "Backend", &sBackend, BACKEND_OPENSLES); #else From c633c2bb13fce4a99a025449af21d1b3f44cc19d Mon Sep 17 00:00:00 2001 From: Lioncash Date: Fri, 30 Aug 2013 15:31:25 -0400 Subject: [PATCH 09/33] [Android] Some various cleanups. Also make some class variables final. Localize some variables as well, and clean up an import. --- .../src/org/dolphinemu/dolphinemu/AboutFragment.java | 6 ++---- .../src/org/dolphinemu/dolphinemu/EmulationActivity.java | 1 - .../dolphinemu/dolphinemu/folderbrowser/FolderBrowser.java | 3 +-- .../dolphinemu/dolphinemu/gamelist/GameListActivity.java | 2 +- .../dolphinemu/dolphinemu/gamelist/GameListFragment.java | 2 +- .../dolphinemu/dolphinemu/settings/InputConfigFragment.java | 3 +-- 6 files changed, 6 insertions(+), 11 deletions(-) diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/AboutFragment.java b/Source/Android/src/org/dolphinemu/dolphinemu/AboutFragment.java index 3a41b0872e..a94a22a964 100644 --- a/Source/Android/src/org/dolphinemu/dolphinemu/AboutFragment.java +++ b/Source/Android/src/org/dolphinemu/dolphinemu/AboutFragment.java @@ -28,14 +28,12 @@ import org.dolphinemu.dolphinemu.settings.VideoSettingsFragment; public final class AboutFragment extends Fragment { private static Activity m_activity; - private ListView mMainList; - private AboutFragmentAdapter adapter; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.gamelist_listview, container, false); - mMainList = (ListView) rootView.findViewById(R.id.gamelist); + ListView mMainList = (ListView) rootView.findViewById(R.id.gamelist); String yes = getString(R.string.yes); String no = getString(R.string.no); @@ -44,7 +42,7 @@ public final class AboutFragment extends Fragment Input.add(new AboutFragmentItem(getString(R.string.build_revision), NativeLibrary.GetVersionString())); Input.add(new AboutFragmentItem(getString(R.string.supports_gles3), VideoSettingsFragment.SupportsGLES3() ? yes : no)); - adapter = new AboutFragmentAdapter(m_activity, R.layout.about_layout, Input); + AboutFragmentAdapter adapter = new AboutFragmentAdapter(m_activity, R.layout.about_layout, Input); mMainList.setAdapter(adapter); return mMainList; diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/EmulationActivity.java b/Source/Android/src/org/dolphinemu/dolphinemu/EmulationActivity.java index 7a81306468..71f896097c 100644 --- a/Source/Android/src/org/dolphinemu/dolphinemu/EmulationActivity.java +++ b/Source/Android/src/org/dolphinemu/dolphinemu/EmulationActivity.java @@ -11,7 +11,6 @@ import android.graphics.Color; import android.graphics.drawable.ColorDrawable; import android.os.Bundle; import android.util.DisplayMetrics; -import android.util.Log; import android.view.InputDevice; import android.view.KeyEvent; import android.view.Menu; diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/folderbrowser/FolderBrowser.java b/Source/Android/src/org/dolphinemu/dolphinemu/folderbrowser/FolderBrowser.java index 306802a6de..890c43f347 100644 --- a/Source/Android/src/org/dolphinemu/dolphinemu/folderbrowser/FolderBrowser.java +++ b/Source/Android/src/org/dolphinemu/dolphinemu/folderbrowser/FolderBrowser.java @@ -112,7 +112,7 @@ public final class FolderBrowser extends Fragment return mDrawerList; } - private AdapterView.OnItemClickListener mMenuItemClickListener = new AdapterView.OnItemClickListener() + private final AdapterView.OnItemClickListener mMenuItemClickListener = new AdapterView.OnItemClickListener() { public void onItemClick(AdapterView parent, View view, int position, long id) { @@ -143,7 +143,6 @@ public final class FolderBrowser extends Fragment { String Directories = NativeLibrary.GetConfig("Dolphin.ini", "General", "GCMPathes", "0"); int intDirectories = Integer.parseInt(Directories); - Directories = Integer.toString(intDirectories + 1); // Check to see if a path set in the Dolphin config // matches the one the user is trying to add. If it's diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/gamelist/GameListActivity.java b/Source/Android/src/org/dolphinemu/dolphinemu/gamelist/GameListActivity.java index 86deafdeb6..5eaa24f9de 100644 --- a/Source/Android/src/org/dolphinemu/dolphinemu/gamelist/GameListActivity.java +++ b/Source/Android/src/org/dolphinemu/dolphinemu/gamelist/GameListActivity.java @@ -178,7 +178,7 @@ public final class GameListActivity extends Activity } } - private AdapterView.OnItemClickListener mMenuItemClickListener = new AdapterView.OnItemClickListener() + private final AdapterView.OnItemClickListener mMenuItemClickListener = new AdapterView.OnItemClickListener() { public void onItemClick(AdapterView parent, View view, int position, long id) { diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/gamelist/GameListFragment.java b/Source/Android/src/org/dolphinemu/dolphinemu/gamelist/GameListFragment.java index d5739d68ed..cdb5c2a745 100644 --- a/Source/Android/src/org/dolphinemu/dolphinemu/gamelist/GameListFragment.java +++ b/Source/Android/src/org/dolphinemu/dolphinemu/gamelist/GameListFragment.java @@ -120,7 +120,7 @@ public final class GameListFragment extends Fragment return mMainList; } - private AdapterView.OnItemClickListener mGameItemClickListener = new AdapterView.OnItemClickListener() + private final AdapterView.OnItemClickListener mGameItemClickListener = new AdapterView.OnItemClickListener() { public void onItemClick(AdapterView parent, View view, int position, long id) { diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/settings/InputConfigFragment.java b/Source/Android/src/org/dolphinemu/dolphinemu/settings/InputConfigFragment.java index 132db39ce0..985fb6d45e 100644 --- a/Source/Android/src/org/dolphinemu/dolphinemu/settings/InputConfigFragment.java +++ b/Source/Android/src/org/dolphinemu/dolphinemu/settings/InputConfigFragment.java @@ -30,11 +30,10 @@ import org.dolphinemu.dolphinemu.R; * within the input control mapping config. */ public final class InputConfigFragment extends PreferenceFragment - //implements PrefsActivity.OnGameConfigListener { private Activity m_activity; private boolean firstEvent = true; - private static ArrayList m_values = new ArrayList(); + private static final ArrayList m_values = new ArrayList(); /** * Gets the descriptor for the given {@link InputDevice}. From 51c814f34e7e125b0a4890af64b7927165a68ebd Mon Sep 17 00:00:00 2001 From: Lioncash Date: Fri, 30 Aug 2013 15:47:04 -0400 Subject: [PATCH 10/33] [Android] Removed the unnecessary MainActivity generics declaration in the DolphinEmulator class. It's unused (and likely won't be used). --- .../src/org/dolphinemu/dolphinemu/DolphinEmulator.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/DolphinEmulator.java b/Source/Android/src/org/dolphinemu/dolphinemu/DolphinEmulator.java index c140f28d7f..6703c5710c 100644 --- a/Source/Android/src/org/dolphinemu/dolphinemu/DolphinEmulator.java +++ b/Source/Android/src/org/dolphinemu/dolphinemu/DolphinEmulator.java @@ -18,10 +18,8 @@ import java.io.*; /** * The main activity of this emulator. - * - * @param Main activity. */ -public final class DolphinEmulator extends Activity +public final class DolphinEmulator extends Activity { private void CopyAsset(String asset, String output) { From ae8f4a705414be2c6af7e5ed323ac7eb180d7ea2 Mon Sep 17 00:00:00 2001 From: "kostamarino@hotmail.com" Date: Fri, 30 Aug 2013 22:50:55 +0300 Subject: [PATCH 11/33] Gameini database update. Mainly updates Wiiware and VC games. --- Data/User/GameConfig/GH5D52.ini | 19 ++++++++++++++++ Data/User/GameConfig/GH5E52.ini | 20 ++++++++--------- Data/User/GameConfig/GH5F52.ini | 19 ++++++++++++++++ Data/User/GameConfig/GH5P52.ini | 19 ++++++++++++++++ Data/User/GameConfig/GXGE08.ini | 20 +++++++++-------- Data/User/GameConfig/JADE01.ini | 18 +++++++-------- Data/User/GameConfig/JAEE01.ini | 22 ++++++++++--------- Data/User/GameConfig/JBKE01.ini | 20 +++++++++++++++++ Data/User/GameConfig/JCBE01.ini | 17 ++++++++++++++ Data/User/GameConfig/JCWE01.ini | 15 +++++++++++++ Data/User/GameConfig/NABE01.ini | 20 ++++++++--------- Data/User/GameConfig/NAHE01.ini | 17 ++++++++++++++ Data/User/GameConfig/NAKE01.ini | 18 +++++++++++++++ Data/User/GameConfig/R3RE8P.ini | 20 ++++++++--------- Data/User/GameConfig/R3RP8P.ini | 21 ++++++++++-------- Data/User/GameConfig/RHOE8P.ini | 39 +++++---------------------------- Data/User/GameConfig/RHOJ8P.ini | 18 +++++++-------- Data/User/GameConfig/RHOP8P.ini | 18 +++++++-------- Data/User/GameConfig/RM8E01.ini | 20 +++++------------ Data/User/GameConfig/RM8J01.ini | 24 ++++++++++++++++++++ Data/User/GameConfig/RM8K01.ini | 24 ++++++++++++++++++++ Data/User/GameConfig/RM8P01.ini | 19 +++++----------- Data/User/GameConfig/RT3E54.ini | 18 +++++++++++++++ Data/User/GameConfig/RT3JEL.ini | 18 +++++++++++++++ Data/User/GameConfig/RT3P54.ini | 18 +++++++++++++++ Data/User/GameConfig/RUUE01.ini | 21 ++++++++++-------- Data/User/GameConfig/RUUJ01.ini | 22 +++++++++++++++++++ Data/User/GameConfig/RUUK01.ini | 22 +++++++++++++++++++ Data/User/GameConfig/RUUP01.ini | 20 ++++++++++------- Data/User/GameConfig/RZTE01.ini | 16 +++++--------- Data/User/GameConfig/RZTJ01.ini | 16 +++++--------- Data/User/GameConfig/RZTK01.ini | 16 +++++--------- Data/User/GameConfig/RZTP01.ini | 16 +++++--------- Data/User/GameConfig/RZTW01.ini | 16 +++++--------- Data/User/GameConfig/SJDE41.ini | 19 +++++----------- Data/User/GameConfig/SJDP41.ini | 18 +++++---------- Data/User/GameConfig/SJDY41.ini | 19 +++++----------- Data/User/GameConfig/SJDZ41.ini | 19 +++++----------- Data/User/GameConfig/SOUE01.ini | 17 ++++---------- Data/User/GameConfig/SOUJ01.ini | 16 ++++---------- Data/User/GameConfig/SOUK01.ini | 16 ++++---------- Data/User/GameConfig/SOUP01.ini | 16 ++++---------- Data/User/GameConfig/W2GE08.ini | 17 ++++++++++++++ Data/User/GameConfig/W3GE08.ini | 17 ++++++++++++++ Data/User/GameConfig/WB2ETL.ini | 18 +++++++++++++++ Data/User/GameConfig/WB3ETL.ini | 18 +++++++++++++++ Data/User/GameConfig/WB6EGL.ini | 18 +++++++++++++++ Data/User/GameConfig/WBXETL.ini | 18 +++++++++++++++ Data/User/GameConfig/WBYETL.ini | 18 +++++++++++++++ Data/User/GameConfig/WBZETL.ini | 18 +++++++++++++++ Data/User/GameConfig/WC6EUP.ini | 18 +++++++-------- Data/User/GameConfig/WCHEJS.ini | 22 +++++++++++++++++++ Data/User/GameConfig/WFUEQQ.ini | 18 +++++++++++++++ Data/User/GameConfig/WGSE08.ini | 20 +++++++++-------- Data/User/GameConfig/WHWEFJ.ini | 20 +++++++++++++++++ Data/User/GameConfig/WHWPFJ.ini | 20 +++++++++++++++++ Data/User/GameConfig/WPCE01.ini | 17 ++++++-------- Data/User/GameConfig/WPUEGD.ini | 18 +++++++++++++++ Data/User/GameConfig/WTEELU.ini | 21 ++++++++++++++++++ Data/User/GameConfig/WTKEGL.ini | 19 ++++++++-------- 60 files changed, 780 insertions(+), 361 deletions(-) create mode 100644 Data/User/GameConfig/GH5D52.ini create mode 100644 Data/User/GameConfig/GH5F52.ini create mode 100644 Data/User/GameConfig/GH5P52.ini create mode 100644 Data/User/GameConfig/JBKE01.ini create mode 100644 Data/User/GameConfig/JCBE01.ini create mode 100644 Data/User/GameConfig/JCWE01.ini create mode 100644 Data/User/GameConfig/NAHE01.ini create mode 100644 Data/User/GameConfig/NAKE01.ini create mode 100644 Data/User/GameConfig/RM8J01.ini create mode 100644 Data/User/GameConfig/RM8K01.ini create mode 100644 Data/User/GameConfig/RT3E54.ini create mode 100644 Data/User/GameConfig/RT3JEL.ini create mode 100644 Data/User/GameConfig/RT3P54.ini create mode 100644 Data/User/GameConfig/RUUJ01.ini create mode 100644 Data/User/GameConfig/RUUK01.ini create mode 100644 Data/User/GameConfig/W2GE08.ini create mode 100644 Data/User/GameConfig/W3GE08.ini create mode 100644 Data/User/GameConfig/WB2ETL.ini create mode 100644 Data/User/GameConfig/WB3ETL.ini create mode 100644 Data/User/GameConfig/WB6EGL.ini create mode 100644 Data/User/GameConfig/WBXETL.ini create mode 100644 Data/User/GameConfig/WBYETL.ini create mode 100644 Data/User/GameConfig/WBZETL.ini create mode 100644 Data/User/GameConfig/WCHEJS.ini create mode 100644 Data/User/GameConfig/WFUEQQ.ini create mode 100644 Data/User/GameConfig/WHWEFJ.ini create mode 100644 Data/User/GameConfig/WHWPFJ.ini create mode 100644 Data/User/GameConfig/WPUEGD.ini create mode 100644 Data/User/GameConfig/WTEELU.ini diff --git a/Data/User/GameConfig/GH5D52.ini b/Data/User/GameConfig/GH5D52.ini new file mode 100644 index 0000000000..f573b0530d --- /dev/null +++ b/Data/User/GameConfig/GH5D52.ini @@ -0,0 +1,19 @@ +# GH5D52 - Over The Hedge +[Core] +# Values set here will override the main dolphin settings. +TLBHack = 1 +[EmuState] +# The Emulation State. 1 is worst, 5 is best, 0 is not set. +EmulationStateId = 4 +EmulationIssues = +[OnLoad] +# Add memory patches to be loaded once on boot here. +[OnFrame] +[ActionReplay] +[Video] +ProjectionHack = 0 +PH_SZNear = 0 +PH_SZFar = 0 +PH_ExtraParam = 0 +PH_ZNear = +PH_ZFar = diff --git a/Data/User/GameConfig/GH5E52.ini b/Data/User/GameConfig/GH5E52.ini index fe65a456f9..1426bc6953 100644 --- a/Data/User/GameConfig/GH5E52.ini +++ b/Data/User/GameConfig/GH5E52.ini @@ -1,19 +1,19 @@ # GH5E52 - Over The Hedge - [Core] # Values set here will override the main dolphin settings. - +TLBHack = 1 [EmuState] # The Emulation State. 1 is worst, 5 is best, 0 is not set. -EmulationStateId = 3 -EmulationIssues = Black screen - +EmulationStateId = 4 +EmulationIssues = [OnLoad] # Add memory patches to be loaded once on boot here. - [OnFrame] -# Add memory patches to be applied every frame here. - [ActionReplay] -# Add action replay cheats here. - +[Video] +ProjectionHack = 0 +PH_SZNear = 0 +PH_SZFar = 0 +PH_ExtraParam = 0 +PH_ZNear = +PH_ZFar = diff --git a/Data/User/GameConfig/GH5F52.ini b/Data/User/GameConfig/GH5F52.ini new file mode 100644 index 0000000000..f4ad49a646 --- /dev/null +++ b/Data/User/GameConfig/GH5F52.ini @@ -0,0 +1,19 @@ +# GH5F52 - Over The Hedge +[Core] +# Values set here will override the main dolphin settings. +TLBHack = 1 +[EmuState] +# The Emulation State. 1 is worst, 5 is best, 0 is not set. +EmulationStateId = 4 +EmulationIssues = +[OnLoad] +# Add memory patches to be loaded once on boot here. +[OnFrame] +[ActionReplay] +[Video] +ProjectionHack = 0 +PH_SZNear = 0 +PH_SZFar = 0 +PH_ExtraParam = 0 +PH_ZNear = +PH_ZFar = diff --git a/Data/User/GameConfig/GH5P52.ini b/Data/User/GameConfig/GH5P52.ini new file mode 100644 index 0000000000..64efb53d59 --- /dev/null +++ b/Data/User/GameConfig/GH5P52.ini @@ -0,0 +1,19 @@ +# GH5P52 - Over The Hedge +[Core] +# Values set here will override the main dolphin settings. +TLBHack = 1 +[EmuState] +# The Emulation State. 1 is worst, 5 is best, 0 is not set. +EmulationStateId = 4 +EmulationIssues = +[OnLoad] +# Add memory patches to be loaded once on boot here. +[OnFrame] +[ActionReplay] +[Video] +ProjectionHack = 0 +PH_SZNear = 0 +PH_SZFar = 0 +PH_ExtraParam = 0 +PH_ZNear = +PH_ZFar = diff --git a/Data/User/GameConfig/GXGE08.ini b/Data/User/GameConfig/GXGE08.ini index dd56ca6c1a..8c65c67c22 100644 --- a/Data/User/GameConfig/GXGE08.ini +++ b/Data/User/GameConfig/GXGE08.ini @@ -1,19 +1,21 @@ # GXGE08 - MEGAMAN X COLLECTION - [Core] # Values set here will override the main dolphin settings. - [EmuState] # The Emulation State. 1 is worst, 5 is best, 0 is not set. EmulationStateId = 3 -EmulationIssues = - +EmulationIssues = [OnLoad] # Add memory patches to be loaded once on boot here. - [OnFrame] -# Add memory patches to be applied every frame here. - [ActionReplay] -# Add action replay cheats here. - +[Video] +ProjectionHack = 0 +PH_SZNear = 0 +PH_SZFar = 0 +PH_ExtraParam = 0 +PH_ZNear = +PH_ZFar = +[Gecko] +[Video_Settings] +SafeTextureCacheColorSamples = 0 diff --git a/Data/User/GameConfig/JADE01.ini b/Data/User/GameConfig/JADE01.ini index 3d6627c176..0725e57fe3 100644 --- a/Data/User/GameConfig/JADE01.ini +++ b/Data/User/GameConfig/JADE01.ini @@ -1,22 +1,20 @@ # JADE01 - The Legend of Zelda A Link to the Past - [Core] # Values set here will override the main dolphin settings. - [EmuState] # The Emulation State. 1 is worst, 5 is best, 0 is not set. -EmulationIssues = +EmulationIssues = Enable progressive scan for proper speed. EmulationStateId = 4 - [OnLoad] # Add memory patches to be loaded once on boot here. - [OnFrame] -# Add memory patches to be applied every frame here. - [ActionReplay] -# Add action replay cheats here. - [Video] ProjectionHack = 0 - +PH_SZNear = 0 +PH_SZFar = 0 +PH_ExtraParam = 0 +PH_ZNear = +PH_ZFar = +[Video_Settings] +SafeTextureCacheColorSamples = 0 diff --git a/Data/User/GameConfig/JAEE01.ini b/Data/User/GameConfig/JAEE01.ini index 37fd1a4007..d5cab7b346 100644 --- a/Data/User/GameConfig/JAEE01.ini +++ b/Data/User/GameConfig/JAEE01.ini @@ -1,19 +1,21 @@ # JAEE01 - Donkey Kong Country - [Core] # Values set here will override the main dolphin settings. - [EmuState] # The Emulation State. 1 is worst, 5 is best, 0 is not set. -EmulationStateId = 0 -EmulationIssues = - +EmulationStateId = 4 +EmulationIssues = Needs progressive scan for proper speed. [OnLoad] # Add memory patches to be loaded once on boot here. - [OnFrame] -# Add memory patches to be applied every frame here. - [ActionReplay] -# Add action replay cheats here. - +[Video] +ProjectionHack = 0 +PH_SZNear = 0 +PH_SZFar = 0 +PH_ExtraParam = 0 +PH_ZNear = +PH_ZFar = +[Gecko] +[Video_Settings] +SafeTextureCacheColorSamples = 512 diff --git a/Data/User/GameConfig/JBKE01.ini b/Data/User/GameConfig/JBKE01.ini new file mode 100644 index 0000000000..84f693cf41 --- /dev/null +++ b/Data/User/GameConfig/JBKE01.ini @@ -0,0 +1,20 @@ +# JBKE01 - Breath of Fire II +[Core] +[EmuState] +EmulationStateId = 4 +EmulationIssues = Needs progressive scan for proper speed. +[OnFrame] +[ActionReplay] +[Video] +ProjectionHack = 0 +PH_SZNear = 0 +PH_SZFar = 0 +PH_ExtraParam = 0 +PH_ZNear = +PH_ZFar = +[Gecko] +[Video_Settings] +SafeTextureCacheColorSamples = 0 +[Video_Hacks] +EFBToTextureEnable = False +EFBCopyEnable = True diff --git a/Data/User/GameConfig/JCBE01.ini b/Data/User/GameConfig/JCBE01.ini new file mode 100644 index 0000000000..d50d7125b1 --- /dev/null +++ b/Data/User/GameConfig/JCBE01.ini @@ -0,0 +1,17 @@ +# JCBE01 - Super Mario RPG +[Core] +[EmuState] +EmulationStateId = 4 +EmulationIssues = Needs progressive scan for proper speed. +[OnFrame] +[ActionReplay] +[Video] +ProjectionHack = 0 +PH_SZNear = 0 +PH_SZFar = 0 +PH_ExtraParam = 0 +PH_ZNear = +PH_ZFar = +[Gecko] +[Video_Settings] +SafeTextureCacheColorSamples = 512 diff --git a/Data/User/GameConfig/JCWE01.ini b/Data/User/GameConfig/JCWE01.ini new file mode 100644 index 0000000000..d2cc9084f5 --- /dev/null +++ b/Data/User/GameConfig/JCWE01.ini @@ -0,0 +1,15 @@ +# JCWE01 - Super Mario Kart +[Core] +[EmuState] +EmulationStateId = 4 +EmulationIssues = Enable progressive scan for proper speed. +[OnFrame] +[ActionReplay] +[Video] +ProjectionHack = 0 +PH_SZNear = 0 +PH_SZFar = 0 +PH_ExtraParam = 0 +PH_ZNear = +PH_ZFar = +[Gecko] diff --git a/Data/User/GameConfig/NABE01.ini b/Data/User/GameConfig/NABE01.ini index a4ae6a39c0..aeb4d2fd8e 100644 --- a/Data/User/GameConfig/NABE01.ini +++ b/Data/User/GameConfig/NABE01.ini @@ -1,23 +1,23 @@ # NABE01 - Mario Kart 64 - [Core] # Values set here will override the main dolphin settings. - [EmuState] # The Emulation State. 1 is worst, 5 is best, 0 is not set. -EmulationIssues = +EmulationIssues = EmulationStateId = 4 - [OnLoad] # Add memory patches to be loaded once on boot here. - [OnFrame] -# Add memory patches to be applied every frame here. - [ActionReplay] -# Add action replay cheats here. - [Video] Hack = -1 ProjectionHack = 0 - +PH_SZNear = 0 +PH_SZFar = 0 +PH_ExtraParam = 0 +PH_ZNear = +PH_ZFar = +[Gecko] +[Video_Hacks] +EFBToTextureEnable = False +EFBCopyEnable = True diff --git a/Data/User/GameConfig/NAHE01.ini b/Data/User/GameConfig/NAHE01.ini new file mode 100644 index 0000000000..413d20a790 --- /dev/null +++ b/Data/User/GameConfig/NAHE01.ini @@ -0,0 +1,17 @@ +# NAHE01 - Yoshi's Story +[Core] +[EmuState] +EmulationStateId = 4 +EmulationIssues = +[OnFrame] +[ActionReplay] +[Video] +ProjectionHack = 0 +PH_SZNear = 0 +PH_SZFar = 0 +PH_ExtraParam = 0 +PH_ZNear = +PH_ZFar = +[Gecko] +[Video_Settings] +SafeTextureCacheColorSamples = 0 diff --git a/Data/User/GameConfig/NAKE01.ini b/Data/User/GameConfig/NAKE01.ini new file mode 100644 index 0000000000..d169bc28f6 --- /dev/null +++ b/Data/User/GameConfig/NAKE01.ini @@ -0,0 +1,18 @@ +# NAKE01 - Pokémon Snap +[Core] +[EmuState] +EmulationStateId = 3 +EmulationIssues = +[OnFrame] +[ActionReplay] +[Video] +ProjectionHack = 0 +PH_SZNear = 0 +PH_SZFar = 0 +PH_ExtraParam = 0 +PH_ZNear = +PH_ZFar = +[Gecko] +[Video_Hacks] +EFBToTextureEnable = False +EFBCopyEnable = True diff --git a/Data/User/GameConfig/R3RE8P.ini b/Data/User/GameConfig/R3RE8P.ini index 9aad9d2413..92146e50c6 100644 --- a/Data/User/GameConfig/R3RE8P.ini +++ b/Data/User/GameConfig/R3RE8P.ini @@ -1,22 +1,22 @@ # R3RE8P - Sonic & Sega All-Stars Racing - [Core] # Values set here will override the main dolphin settings. - [EmuState] # The Emulation State. 1 is worst, 5 is best, 0 is not set. EmulationStateId = 4 -EmulationIssues = - +EmulationIssues = Use direct 3d 11 for less graphic glitches. [OnLoad] # Add memory patches to be loaded once on boot here. - [OnFrame] -# Add memory patches to be applied every frame here. - [ActionReplay] -# Add action replay cheats here. - [Video] ProjectionHack = 0 - +PH_SZNear = 0 +PH_SZFar = 0 +PH_ExtraParam = 0 +PH_ZNear = +PH_ZFar = +[Gecko] +[Video_Hacks] +EFBToTextureEnable = False +EFBCopyEnable = True diff --git a/Data/User/GameConfig/R3RP8P.ini b/Data/User/GameConfig/R3RP8P.ini index c4d8670718..c32c9bc7cf 100644 --- a/Data/User/GameConfig/R3RP8P.ini +++ b/Data/User/GameConfig/R3RP8P.ini @@ -1,19 +1,22 @@ # R3RP8P - Sonic & Sega All-Stars Racing - [Core] # Values set here will override the main dolphin settings. - [EmuState] # The Emulation State. 1 is worst, 5 is best, 0 is not set. EmulationStateId = 4 -EmulationIssues = - +EmulationIssues = Use direct 3d 11 for less graphic glitches. [OnLoad] # Add memory patches to be loaded once on boot here. - [OnFrame] -# Add memory patches to be applied every frame here. - [ActionReplay] -# Add action replay cheats here. - +[Video] +ProjectionHack = 0 +PH_SZNear = 0 +PH_SZFar = 0 +PH_ExtraParam = 0 +PH_ZNear = +PH_ZFar = +[Gecko] +[Video_Hacks] +EFBToTextureEnable = False +EFBCopyEnable = True diff --git a/Data/User/GameConfig/RHOE8P.ini b/Data/User/GameConfig/RHOE8P.ini index 82ff52fdad..8d8190877a 100644 --- a/Data/User/GameConfig/RHOE8P.ini +++ b/Data/User/GameConfig/RHOE8P.ini @@ -1,49 +1,20 @@ # RHOE8P - House Of The Dead: OVERKILL - [Core] # Values set here will override the main dolphin settings. - [EmuState] # The Emulation State. 1 is worst, 5 is best, 0 is not set. EmulationStateId = 5 -EmulationIssues = Use dx11 plugin (r6945) - +EmulationIssues = [OnLoad] # Add memory patches to be loaded once on boot here. - [OnFrame] -# Add memory patches to be applied every frame here. - [ActionReplay] -# Add action replay cheats here. - [Video] ProjectionHack = 0 PH_SZNear = 0 PH_SZFar = 0 PH_ExtraParam = 0 -PH_ZNear = -PH_ZFar = -$Infinte Bomb Usage after Getting 1 [g6flavor] -04159D1C 60000000 -$If Score Increase, MAX [ZiT] -C2142134 00000002 -3CA03B9B 38A5C9FF -90A60178 00000000 -$Infinite LIFE [ZiT] -04130ED4 60000000 -$Infinite Bullet [ZiT] -04159FAC 907D0720 -$CASH MAX [ZiT] -C214B118 00000002 -3CA03B9B 38A5C9FF -90A300D8 00000000 -$CASH MAX [ZiT] -C214B110 00000002 -3CA03B9B 38A5C9FF -90A300DC 00000000 -$If Score Increase, MAX [ZiT] -C2152674 00000002 -3CA03B9B 38A5C9FF -90B60178 00000000 - +PH_ZNear = +PH_ZFar = +[Video_Hacks] +EFBEmulateFormatChanges = True diff --git a/Data/User/GameConfig/RHOJ8P.ini b/Data/User/GameConfig/RHOJ8P.ini index 549574908c..bdef300ddf 100644 --- a/Data/User/GameConfig/RHOJ8P.ini +++ b/Data/User/GameConfig/RHOJ8P.ini @@ -1,22 +1,20 @@ # RHOJ8P - House Of The Dead: OVERKILL - [Core] # Values set here will override the main dolphin settings. - [EmuState] # The Emulation State. 1 is worst, 5 is best, 0 is not set. EmulationStateId = 5 -EmulationIssues = Use dx11 plugin (r6945) - +EmulationIssues = [OnLoad] # Add memory patches to be loaded once on boot here. - [OnFrame] -# Add memory patches to be applied every frame here. - [ActionReplay] -# Add action replay cheats here. - [Video] ProjectionHack = 0 - +PH_SZNear = 0 +PH_SZFar = 0 +PH_ExtraParam = 0 +PH_ZNear = +PH_ZFar = +[Video_Hacks] +EFBEmulateFormatChanges = True diff --git a/Data/User/GameConfig/RHOP8P.ini b/Data/User/GameConfig/RHOP8P.ini index 79a3206066..fa314e84e4 100644 --- a/Data/User/GameConfig/RHOP8P.ini +++ b/Data/User/GameConfig/RHOP8P.ini @@ -1,22 +1,20 @@ # RHOP8P - House Of The Dead: OVERKILL - [Core] # Values set here will override the main dolphin settings. - [EmuState] # The Emulation State. 1 is worst, 5 is best, 0 is not set. EmulationStateId = 5 -EmulationIssues = Use dx11 plugin (r6945) - +EmulationIssues = [OnLoad] # Add memory patches to be loaded once on boot here. - [OnFrame] -# Add memory patches to be applied every frame here. - [ActionReplay] -# Add action replay cheats here. - [Video] ProjectionHack = 0 - +PH_SZNear = 0 +PH_SZFar = 0 +PH_ExtraParam = 0 +PH_ZNear = +PH_ZFar = +[Video_Hacks] +EFBEmulateFormatChanges = True diff --git a/Data/User/GameConfig/RM8E01.ini b/Data/User/GameConfig/RM8E01.ini index ad0b0ae81d..608c88ae1d 100644 --- a/Data/User/GameConfig/RM8E01.ini +++ b/Data/User/GameConfig/RM8E01.ini @@ -1,34 +1,24 @@ # RM8E01 - Mario Party 8 - [Core] # Values set here will override the main dolphin settings. - [EmuState] # The Emulation State. 1 is worst, 5 is best, 0 is not set. EmulationStateId = 4 -Issues= -EmulationIssues = - +EmulationIssues = Direct 3d9 has issues with paint minigames. [OnLoad] # Add memory patches to be loaded once on boot here. - [OnFrame] -# Add memory patches to be applied every frame here. - [ActionReplay] -# Add action replay cheats here. - [Video] ProjectionHack = 0 PH_SZNear = 0 PH_SZFar = 0 PH_ExtraParam = 0 -PH_ZNear = -PH_ZFar = - +PH_ZNear = +PH_ZFar = [Video_Enhancements] ForceFiltering = False - [Video_Hacks] +EFBToTextureEnable = False +EFBCopyEnable = True DlistCachingEnable = False - diff --git a/Data/User/GameConfig/RM8J01.ini b/Data/User/GameConfig/RM8J01.ini new file mode 100644 index 0000000000..3c0fc16378 --- /dev/null +++ b/Data/User/GameConfig/RM8J01.ini @@ -0,0 +1,24 @@ +# RM8J01 - Mario Party 8 +[Core] +# Values set here will override the main dolphin settings. +[EmuState] +# The Emulation State. 1 is worst, 5 is best, 0 is not set. +EmulationStateId = 4 +EmulationIssues = Direct 3d9 has issues with paint minigames. +[OnLoad] +# Add memory patches to be loaded once on boot here. +[OnFrame] +[ActionReplay] +[Video] +ProjectionHack = 0 +PH_SZNear = 0 +PH_SZFar = 0 +PH_ExtraParam = 0 +PH_ZNear = +PH_ZFar = +[Video_Enhancements] +ForceFiltering = False +[Video_Hacks] +EFBToTextureEnable = False +EFBCopyEnable = True +DlistCachingEnable = False diff --git a/Data/User/GameConfig/RM8K01.ini b/Data/User/GameConfig/RM8K01.ini new file mode 100644 index 0000000000..eca45bf7b7 --- /dev/null +++ b/Data/User/GameConfig/RM8K01.ini @@ -0,0 +1,24 @@ +# RM8K01 - Mario Party 8 +[Core] +# Values set here will override the main dolphin settings. +[EmuState] +# The Emulation State. 1 is worst, 5 is best, 0 is not set. +EmulationStateId = 4 +EmulationIssues = Direct 3d9 has issues with paint minigames. +[OnLoad] +# Add memory patches to be loaded once on boot here. +[OnFrame] +[ActionReplay] +[Video] +ProjectionHack = 0 +PH_SZNear = 0 +PH_SZFar = 0 +PH_ExtraParam = 0 +PH_ZNear = +PH_ZFar = +[Video_Enhancements] +ForceFiltering = False +[Video_Hacks] +EFBToTextureEnable = False +EFBCopyEnable = True +DlistCachingEnable = False diff --git a/Data/User/GameConfig/RM8P01.ini b/Data/User/GameConfig/RM8P01.ini index af6b663910..1d2ecd582c 100644 --- a/Data/User/GameConfig/RM8P01.ini +++ b/Data/User/GameConfig/RM8P01.ini @@ -1,33 +1,24 @@ # RM8P01 - Mario Party 8 - [Core] # Values set here will override the main dolphin settings. - [EmuState] # The Emulation State. 1 is worst, 5 is best, 0 is not set. EmulationStateId = 4 -EmulationIssues = - +EmulationIssues = Direct 3d9 has issues with paint minigames. [OnLoad] # Add memory patches to be loaded once on boot here. - [OnFrame] -# Add memory patches to be applied every frame here. - [ActionReplay] -# Add action replay cheats here. - [Video] ProjectionHack = 0 PH_SZNear = 0 PH_SZFar = 0 PH_ExtraParam = 0 -PH_ZNear = -PH_ZFar = - +PH_ZNear = +PH_ZFar = [Video_Enhancements] ForceFiltering = False - [Video_Hacks] +EFBToTextureEnable = False +EFBCopyEnable = True DlistCachingEnable = False - diff --git a/Data/User/GameConfig/RT3E54.ini b/Data/User/GameConfig/RT3E54.ini new file mode 100644 index 0000000000..d175a9bd39 --- /dev/null +++ b/Data/User/GameConfig/RT3E54.ini @@ -0,0 +1,18 @@ +# RT3E54 - Rockstar Games presents Table Tennis +[Core] +[EmuState] +EmulationStateId = 3 +EmulationIssues = +[OnFrame] +[ActionReplay] +[Video] +ProjectionHack = 0 +PH_SZNear = 0 +PH_SZFar = 0 +PH_ExtraParam = 0 +PH_ZNear = +PH_ZFar = +[Gecko] +[Video_Settings] +UseXFB = True +UseRealXFB = False diff --git a/Data/User/GameConfig/RT3JEL.ini b/Data/User/GameConfig/RT3JEL.ini new file mode 100644 index 0000000000..036f24c3fb --- /dev/null +++ b/Data/User/GameConfig/RT3JEL.ini @@ -0,0 +1,18 @@ +# RT3JEL - Rockstar Games presents Table Tennis +[Core] +[EmuState] +EmulationStateId = 3 +EmulationIssues = +[OnFrame] +[ActionReplay] +[Video] +ProjectionHack = 0 +PH_SZNear = 0 +PH_SZFar = 0 +PH_ExtraParam = 0 +PH_ZNear = +PH_ZFar = +[Gecko] +[Video_Settings] +UseXFB = True +UseRealXFB = False diff --git a/Data/User/GameConfig/RT3P54.ini b/Data/User/GameConfig/RT3P54.ini new file mode 100644 index 0000000000..f9b6824985 --- /dev/null +++ b/Data/User/GameConfig/RT3P54.ini @@ -0,0 +1,18 @@ +# RT3P54 - Rockstar Games presents Table Tennis +[Core] +[EmuState] +EmulationStateId = 3 +EmulationIssues = +[OnFrame] +[ActionReplay] +[Video] +ProjectionHack = 0 +PH_SZNear = 0 +PH_SZFar = 0 +PH_ExtraParam = 0 +PH_ZNear = +PH_ZFar = +[Gecko] +[Video_Settings] +UseXFB = True +UseRealXFB = False diff --git a/Data/User/GameConfig/RUUE01.ini b/Data/User/GameConfig/RUUE01.ini index 1e127bd511..e8e63f861c 100644 --- a/Data/User/GameConfig/RUUE01.ini +++ b/Data/User/GameConfig/RUUE01.ini @@ -1,19 +1,22 @@ # RUUE01 - Animal Crossing Wii - [Core] # Values set here will override the main dolphin settings. - [EmuState] # The Emulation State. 1 is worst, 5 is best, 0 is not set. EmulationStateId = 4 -EmulationIssues = - +EmulationIssues = [OnLoad] # Add memory patches to be loaded once on boot here. - [OnFrame] -# Add memory patches to be applied every frame here. - [ActionReplay] -# Add action replay cheats here. - +[Video] +ProjectionHack = 0 +PH_SZNear = 0 +PH_SZFar = 0 +PH_ExtraParam = 0 +PH_ZNear = +PH_ZFar = +[Gecko] +[Video_Hacks] +EFBToTextureEnable = False +EFBCopyEnable = True diff --git a/Data/User/GameConfig/RUUJ01.ini b/Data/User/GameConfig/RUUJ01.ini new file mode 100644 index 0000000000..fdeefb5003 --- /dev/null +++ b/Data/User/GameConfig/RUUJ01.ini @@ -0,0 +1,22 @@ +# RUUJ01 - Animal Crossing Wii +[Core] +# Values set here will override the main dolphin settings. +[EmuState] +# The Emulation State. 1 is worst, 5 is best, 0 is not set. +EmulationStateId = 4 +EmulationIssues = +[OnLoad] +# Add memory patches to be loaded once on boot here. +[OnFrame] +[ActionReplay] +[Video] +ProjectionHack = 0 +PH_SZNear = 0 +PH_SZFar = 0 +PH_ExtraParam = 0 +PH_ZNear = +PH_ZFar = +[Gecko] +[Video_Hacks] +EFBToTextureEnable = False +EFBCopyEnable = True diff --git a/Data/User/GameConfig/RUUK01.ini b/Data/User/GameConfig/RUUK01.ini new file mode 100644 index 0000000000..2bb3818a31 --- /dev/null +++ b/Data/User/GameConfig/RUUK01.ini @@ -0,0 +1,22 @@ +# RUUK01 - Animal Crossing Wii +[Core] +# Values set here will override the main dolphin settings. +[EmuState] +# The Emulation State. 1 is worst, 5 is best, 0 is not set. +EmulationStateId = 4 +EmulationIssues = +[OnLoad] +# Add memory patches to be loaded once on boot here. +[OnFrame] +[ActionReplay] +[Video] +ProjectionHack = 0 +PH_SZNear = 0 +PH_SZFar = 0 +PH_ExtraParam = 0 +PH_ZNear = +PH_ZFar = +[Gecko] +[Video_Hacks] +EFBToTextureEnable = False +EFBCopyEnable = True diff --git a/Data/User/GameConfig/RUUP01.ini b/Data/User/GameConfig/RUUP01.ini index 673d8ad463..4cb31371ef 100644 --- a/Data/User/GameConfig/RUUP01.ini +++ b/Data/User/GameConfig/RUUP01.ini @@ -1,18 +1,22 @@ # RUUP01 - Animal Crossing Wii - [Core] # Values set here will override the main dolphin settings. - [EmuState] # The Emulation State. 1 is worst, 5 is best, 0 is not set. EmulationStateId = 4 - +EmulationIssues = [OnLoad] # Add memory patches to be loaded once on boot here. - [OnFrame] -# Add memory patches to be applied every frame here. - [ActionReplay] -# Add action replay cheats here. - +[Video] +ProjectionHack = 0 +PH_SZNear = 0 +PH_SZFar = 0 +PH_ExtraParam = 0 +PH_ZNear = +PH_ZFar = +[Gecko] +[Video_Hacks] +EFBToTextureEnable = False +EFBCopyEnable = True diff --git a/Data/User/GameConfig/RZTE01.ini b/Data/User/GameConfig/RZTE01.ini index c9f914d7cb..ef4e34f1f4 100644 --- a/Data/User/GameConfig/RZTE01.ini +++ b/Data/User/GameConfig/RZTE01.ini @@ -1,27 +1,21 @@ # RZTE01 - Wii Sports Resort - [Core] # Values set here will override the main dolphin settings. - [EmuState] # The Emulation State. 1 is worst, 5 is best, 0 is not set. EmulationStateId = 4 EmulationIssues = Needs real wiimote and motion plus. - [OnLoad] # Add memory patches to be loaded once on boot here. - [OnFrame] -# Add memory patches to be applied every frame here. - [ActionReplay] -# Add action replay cheats here. - [Video] ProjectionHack = 0 PH_SZNear = 0 PH_SZFar = 0 PH_ExtraParam = 0 -PH_ZNear = -PH_ZFar = - +PH_ZNear = +PH_ZFar = +[Gecko] +[Video_Hacks] +EFBEmulateFormatChanges = True diff --git a/Data/User/GameConfig/RZTJ01.ini b/Data/User/GameConfig/RZTJ01.ini index 20a6eec5d6..b416f639bd 100644 --- a/Data/User/GameConfig/RZTJ01.ini +++ b/Data/User/GameConfig/RZTJ01.ini @@ -1,27 +1,21 @@ # RZTJ01 - Wii Sports Resort - [Core] # Values set here will override the main dolphin settings. - [EmuState] # The Emulation State. 1 is worst, 5 is best, 0 is not set. EmulationStateId = 4 EmulationIssues = Needs real wiimote and motion plus. - [OnLoad] # Add memory patches to be loaded once on boot here. - [OnFrame] -# Add memory patches to be applied every frame here. - [ActionReplay] -# Add action replay cheats here. - [Video] ProjectionHack = 0 PH_SZNear = 0 PH_SZFar = 0 PH_ExtraParam = 0 -PH_ZNear = -PH_ZFar = - +PH_ZNear = +PH_ZFar = +[Gecko] +[Video_Hacks] +EFBEmulateFormatChanges = True diff --git a/Data/User/GameConfig/RZTK01.ini b/Data/User/GameConfig/RZTK01.ini index 4a009c4294..2daa37448a 100644 --- a/Data/User/GameConfig/RZTK01.ini +++ b/Data/User/GameConfig/RZTK01.ini @@ -1,27 +1,21 @@ # RZTK01 - Wii Sports Resort - [Core] # Values set here will override the main dolphin settings. - [EmuState] # The Emulation State. 1 is worst, 5 is best, 0 is not set. EmulationStateId = 4 EmulationIssues = Needs real wiimote and motion plus. - [OnLoad] # Add memory patches to be loaded once on boot here. - [OnFrame] -# Add memory patches to be applied every frame here. - [ActionReplay] -# Add action replay cheats here. - [Video] ProjectionHack = 0 PH_SZNear = 0 PH_SZFar = 0 PH_ExtraParam = 0 -PH_ZNear = -PH_ZFar = - +PH_ZNear = +PH_ZFar = +[Gecko] +[Video_Hacks] +EFBEmulateFormatChanges = True diff --git a/Data/User/GameConfig/RZTP01.ini b/Data/User/GameConfig/RZTP01.ini index 947ab0e61f..393f8b637a 100644 --- a/Data/User/GameConfig/RZTP01.ini +++ b/Data/User/GameConfig/RZTP01.ini @@ -1,27 +1,21 @@ # RZTP01 - Wii Sports Resort - [Core] # Values set here will override the main dolphin settings. - [EmuState] # The Emulation State. 1 is worst, 5 is best, 0 is not set. EmulationStateId = 4 EmulationIssues = Needs real wiimote and motion plus. - [OnLoad] # Add memory patches to be loaded once on boot here. - [OnFrame] -# Add memory patches to be applied every frame here. - [ActionReplay] -# Add action replay cheats here. - [Video] ProjectionHack = 0 PH_SZNear = 0 PH_SZFar = 0 PH_ExtraParam = 0 -PH_ZNear = -PH_ZFar = - +PH_ZNear = +PH_ZFar = +[Gecko] +[Video_Hacks] +EFBEmulateFormatChanges = True diff --git a/Data/User/GameConfig/RZTW01.ini b/Data/User/GameConfig/RZTW01.ini index 73af0701dd..bf63686d79 100644 --- a/Data/User/GameConfig/RZTW01.ini +++ b/Data/User/GameConfig/RZTW01.ini @@ -1,27 +1,21 @@ # RZTW01 - Wii Sports Resort - [Core] # Values set here will override the main dolphin settings. - [EmuState] # The Emulation State. 1 is worst, 5 is best, 0 is not set. EmulationStateId = 4 EmulationIssues = Needs real wiimote and motion plus. - [OnLoad] # Add memory patches to be loaded once on boot here. - [OnFrame] -# Add memory patches to be applied every frame here. - [ActionReplay] -# Add action replay cheats here. - [Video] ProjectionHack = 0 PH_SZNear = 0 PH_SZFar = 0 PH_ExtraParam = 0 -PH_ZNear = -PH_ZFar = - +PH_ZNear = +PH_ZFar = +[Gecko] +[Video_Hacks] +EFBEmulateFormatChanges = True diff --git a/Data/User/GameConfig/SJDE41.ini b/Data/User/GameConfig/SJDE41.ini index f9ed9f80f4..0649746328 100644 --- a/Data/User/GameConfig/SJDE41.ini +++ b/Data/User/GameConfig/SJDE41.ini @@ -1,27 +1,20 @@ # SJDE41 - Just Dance 3 - [Core] # Values set here will override the main dolphin settings. - [EmuState] # The Emulation State. 1 is worst, 5 is best, 0 is not set. -EmulationStateId = 3 -EmulationIssues = Suffers from random ingame lock ups. - +EmulationStateId = 4 +EmulationIssues = [OnLoad] # Add memory patches to be loaded once on boot here. - [OnFrame] -# Add memory patches to be applied every frame here. - [ActionReplay] -# Add action replay cheats here. - [Video] ProjectionHack = 0 PH_SZNear = 0 PH_SZFar = 0 PH_ExtraParam = 0 -PH_ZNear = -PH_ZFar = - +PH_ZNear = +PH_ZFar = +[Video_Enhancements] +MaxAnisotropy = 0 diff --git a/Data/User/GameConfig/SJDP41.ini b/Data/User/GameConfig/SJDP41.ini index 0de2883f39..56e57306c2 100644 --- a/Data/User/GameConfig/SJDP41.ini +++ b/Data/User/GameConfig/SJDP41.ini @@ -1,27 +1,21 @@ # SJDP41 - Just Dance 3 - [Core] # Values set here will override the main dolphin settings. - [EmuState] # The Emulation State. 1 is worst, 5 is best, 0 is not set. -EmulationStateId = 3 -EmulationIssues = Suffers from random ingame lock ups. - +EmulationStateId = 4 +EmulationIssues = [OnLoad] # Add memory patches to be loaded once on boot here. - [OnFrame] -# Add memory patches to be applied every frame here. - [ActionReplay] -# Add action replay cheats here. - [Video] ProjectionHack = 0 PH_SZNear = 0 PH_SZFar = 0 PH_ExtraParam = 0 -PH_ZNear = -PH_ZFar = +PH_ZNear = +PH_ZFar = +[Video_Enhancements] +MaxAnisotropy = 0 diff --git a/Data/User/GameConfig/SJDY41.ini b/Data/User/GameConfig/SJDY41.ini index c90a989c21..7fd447165a 100644 --- a/Data/User/GameConfig/SJDY41.ini +++ b/Data/User/GameConfig/SJDY41.ini @@ -1,27 +1,20 @@ # SJDY41 - Just Dance 3 - [Core] # Values set here will override the main dolphin settings. - [EmuState] # The Emulation State. 1 is worst, 5 is best, 0 is not set. -EmulationStateId = 3 -EmulationIssues = Suffers from random ingame lock ups. - +EmulationStateId = 4 +EmulationIssues = [OnLoad] # Add memory patches to be loaded once on boot here. - [OnFrame] -# Add memory patches to be applied every frame here. - [ActionReplay] -# Add action replay cheats here. - [Video] ProjectionHack = 0 PH_SZNear = 0 PH_SZFar = 0 PH_ExtraParam = 0 -PH_ZNear = -PH_ZFar = - +PH_ZNear = +PH_ZFar = +[Video_Enhancements] +MaxAnisotropy = 0 diff --git a/Data/User/GameConfig/SJDZ41.ini b/Data/User/GameConfig/SJDZ41.ini index 0de2883f39..78b32d4e92 100644 --- a/Data/User/GameConfig/SJDZ41.ini +++ b/Data/User/GameConfig/SJDZ41.ini @@ -1,27 +1,20 @@ # SJDP41 - Just Dance 3 - [Core] # Values set here will override the main dolphin settings. - [EmuState] # The Emulation State. 1 is worst, 5 is best, 0 is not set. -EmulationStateId = 3 -EmulationIssues = Suffers from random ingame lock ups. - +EmulationStateId = 4 +EmulationIssues = [OnLoad] # Add memory patches to be loaded once on boot here. - [OnFrame] -# Add memory patches to be applied every frame here. - [ActionReplay] -# Add action replay cheats here. - [Video] ProjectionHack = 0 PH_SZNear = 0 PH_SZFar = 0 PH_ExtraParam = 0 -PH_ZNear = -PH_ZFar = - +PH_ZNear = +PH_ZFar = +[Video_Enhancements] +MaxAnisotropy = 0 diff --git a/Data/User/GameConfig/SOUE01.ini b/Data/User/GameConfig/SOUE01.ini index d34b216b4e..21b2932d3e 100644 --- a/Data/User/GameConfig/SOUE01.ini +++ b/Data/User/GameConfig/SOUE01.ini @@ -1,31 +1,22 @@ # SOUE01 - The Legend of Zelda Skyward Sword - [Core] # Values set here will override the main dolphin settings. - [EmuState] # The Emulation State. 1 is worst, 5 is best, 0 is not set. EmulationStateId = 4 -EmulationIssues = Needs real wiimote and motion plus. Use direct 3d9 backend for less graphic issues. - +EmulationIssues = Needs real wiimote and motion plus. [OnLoad] # Add memory patches to be loaded once on boot here. - [OnFrame] -# Add memory patches to be applied every frame here. - [ActionReplay] -# Add action replay cheats here. - [Video] ProjectionHack = 0 PH_SZNear = 0 PH_SZFar = 0 PH_ExtraParam = 0 -PH_ZNear = -PH_ZFar = - +PH_ZNear = +PH_ZFar = [Video_Hacks] EFBAccessEnable = True DlistCachingEnable = False - +EFBEmulateFormatChanges = True diff --git a/Data/User/GameConfig/SOUJ01.ini b/Data/User/GameConfig/SOUJ01.ini index 9be2cefa22..cda850cfb3 100644 --- a/Data/User/GameConfig/SOUJ01.ini +++ b/Data/User/GameConfig/SOUJ01.ini @@ -1,31 +1,23 @@ # SOUJ01 - The Legend of Zelda Skyward Sword - [Core] # Values set here will override the main dolphin settings. - [EmuState] # The Emulation State. 1 is worst, 5 is best, 0 is not set. EmulationStateId = 4 -EmulationIssues = Needs real wiimote and motion plus. Use direct 3d9 backend for less graphic issues. - +EmulationIssues = Needs real wiimote and motion plus. [OnLoad] # Add memory patches to be loaded once on boot here. - [OnFrame] -# Add memory patches to be applied every frame here. - [ActionReplay] -# Add action replay cheats here. - [Video] ProjectionHack = 0 PH_SZNear = 0 PH_SZFar = 0 PH_ExtraParam = 0 -PH_ZNear = -PH_ZFar = - +PH_ZNear = +PH_ZFar = [Video_Hacks] EFBAccessEnable = True DlistCachingEnable = False +EFBEmulateFormatChanges = True diff --git a/Data/User/GameConfig/SOUK01.ini b/Data/User/GameConfig/SOUK01.ini index 8d332015c3..ddaf1883a9 100644 --- a/Data/User/GameConfig/SOUK01.ini +++ b/Data/User/GameConfig/SOUK01.ini @@ -1,31 +1,23 @@ # SOUK01 - The Legend of Zelda Skyward Sword - [Core] # Values set here will override the main dolphin settings. - [EmuState] # The Emulation State. 1 is worst, 5 is best, 0 is not set. EmulationStateId = 4 -EmulationIssues = Needs real wiimote and motion plus. Use direct 3d9 backend for less graphic issues. - +EmulationIssues = Needs real wiimote and motion plus. [OnLoad] # Add memory patches to be loaded once on boot here. - [OnFrame] -# Add memory patches to be applied every frame here. - [ActionReplay] -# Add action replay cheats here. - [Video] ProjectionHack = 0 PH_SZNear = 0 PH_SZFar = 0 PH_ExtraParam = 0 -PH_ZNear = -PH_ZFar = - +PH_ZNear = +PH_ZFar = [Video_Hacks] EFBAccessEnable = True DlistCachingEnable = False +EFBEmulateFormatChanges = True diff --git a/Data/User/GameConfig/SOUP01.ini b/Data/User/GameConfig/SOUP01.ini index c0db560999..bc3ade6a7b 100644 --- a/Data/User/GameConfig/SOUP01.ini +++ b/Data/User/GameConfig/SOUP01.ini @@ -1,31 +1,23 @@ # SOUP01 - The Legend of Zelda Skyward Sword - [Core] # Values set here will override the main dolphin settings. - [EmuState] # The Emulation State. 1 is worst, 5 is best, 0 is not set. EmulationStateId = 4 -EmulationIssues = Needs real wiimote and motion plus. Use direct 3d9 backend for less graphic issues. - +EmulationIssues = Needs real wiimote and motion plus. [OnLoad] # Add memory patches to be loaded once on boot here. - [OnFrame] -# Add memory patches to be applied every frame here. - [ActionReplay] -# Add action replay cheats here. - [Video] ProjectionHack = 0 PH_SZNear = 0 PH_SZFar = 0 PH_ExtraParam = 0 -PH_ZNear = -PH_ZFar = - +PH_ZNear = +PH_ZFar = [Video_Hacks] EFBAccessEnable = True DlistCachingEnable = False +EFBEmulateFormatChanges = True diff --git a/Data/User/GameConfig/W2GE08.ini b/Data/User/GameConfig/W2GE08.ini new file mode 100644 index 0000000000..6590a12227 --- /dev/null +++ b/Data/User/GameConfig/W2GE08.ini @@ -0,0 +1,17 @@ +# W2GE08 - Phoenix Wright Ace Attorney Justice For All +[Core] +[EmuState] +EmulationStateId = 4 +EmulationIssues = +[OnFrame] +[ActionReplay] +[Video] +ProjectionHack = 0 +PH_SZNear = 0 +PH_SZFar = 0 +PH_ExtraParam = 0 +PH_ZNear = +PH_ZFar = +[Gecko] +[Video_Hacks] +EFBEmulateFormatChanges = True diff --git a/Data/User/GameConfig/W3GE08.ini b/Data/User/GameConfig/W3GE08.ini new file mode 100644 index 0000000000..c21f5b73e0 --- /dev/null +++ b/Data/User/GameConfig/W3GE08.ini @@ -0,0 +1,17 @@ +# W3GE08 - Phoenix Wright Ace Attorney Trials and Tribulations +[Core] +[EmuState] +EmulationStateId = 4 +EmulationIssues = +[OnFrame] +[ActionReplay] +[Video] +ProjectionHack = 0 +PH_SZNear = 0 +PH_SZFar = 0 +PH_ExtraParam = 0 +PH_ZNear = +PH_ZFar = +[Video_Hacks] +EFBEmulateFormatChanges = True +[Gecko] diff --git a/Data/User/GameConfig/WB2ETL.ini b/Data/User/GameConfig/WB2ETL.ini new file mode 100644 index 0000000000..b7f7d48ca0 --- /dev/null +++ b/Data/User/GameConfig/WB2ETL.ini @@ -0,0 +1,18 @@ +# WB2ETL - Dangeresque 3 +[Core] +[EmuState] +EmulationStateId = 4 +EmulationIssues = +[OnFrame] +[ActionReplay] +[Video] +ProjectionHack = 0 +PH_SZNear = 0 +PH_SZFar = 0 +PH_ExtraParam = 0 +PH_ZNear = +PH_ZFar = +[Gecko] +[Video_Settings] +UseXFB = True +UseRealXFB = False diff --git a/Data/User/GameConfig/WB3ETL.ini b/Data/User/GameConfig/WB3ETL.ini new file mode 100644 index 0000000000..2954bef58e --- /dev/null +++ b/Data/User/GameConfig/WB3ETL.ini @@ -0,0 +1,18 @@ +# WB3ETL - 8-Bit Is Enough +[Core] +[EmuState] +EmulationStateId = 4 +EmulationIssues = +[OnFrame] +[ActionReplay] +[Video] +ProjectionHack = 0 +PH_SZNear = 0 +PH_SZFar = 0 +PH_ExtraParam = 0 +PH_ZNear = +PH_ZFar = +[Gecko] +[Video_Settings] +UseXFB = True +UseRealXFB = False diff --git a/Data/User/GameConfig/WB6EGL.ini b/Data/User/GameConfig/WB6EGL.ini new file mode 100644 index 0000000000..8af762c359 --- /dev/null +++ b/Data/User/GameConfig/WB6EGL.ini @@ -0,0 +1,18 @@ +# WB6EGL - TV Show King +[Core] +[EmuState] +EmulationStateId = 4 +EmulationIssues = +[OnFrame] +[ActionReplay] +[Video] +ProjectionHack = 0 +PH_SZNear = 0 +PH_SZFar = 0 +PH_ExtraParam = 0 +PH_ZNear = +PH_ZFar = +[Gecko] +[Video_Settings] +UseXFB = True +UseRealXFB = False diff --git a/Data/User/GameConfig/WBXETL.ini b/Data/User/GameConfig/WBXETL.ini new file mode 100644 index 0000000000..6520392f0c --- /dev/null +++ b/Data/User/GameConfig/WBXETL.ini @@ -0,0 +1,18 @@ +# WBXETL - Homestar Ruiner +[Core] +[EmuState] +EmulationStateId = 4 +EmulationIssues = +[OnFrame] +[ActionReplay] +[Video] +ProjectionHack = 0 +PH_SZNear = 0 +PH_SZFar = 0 +PH_ExtraParam = 0 +PH_ZNear = +PH_ZFar = +[Gecko] +[Video_Settings] +UseXFB = True +UseRealXFB = False diff --git a/Data/User/GameConfig/WBYETL.ini b/Data/User/GameConfig/WBYETL.ini new file mode 100644 index 0000000000..55bb77dbb4 --- /dev/null +++ b/Data/User/GameConfig/WBYETL.ini @@ -0,0 +1,18 @@ +# WBYETL - StrongBadia the Free +[Core] +[EmuState] +EmulationStateId = 4 +EmulationIssues = +[OnFrame] +[ActionReplay] +[Video] +ProjectionHack = 0 +PH_SZNear = 0 +PH_SZFar = 0 +PH_ExtraParam = 0 +PH_ZNear = +PH_ZFar = +[Gecko] +[Video_Settings] +UseXFB = True +UseRealXFB = False diff --git a/Data/User/GameConfig/WBZETL.ini b/Data/User/GameConfig/WBZETL.ini new file mode 100644 index 0000000000..3fb8e504d7 --- /dev/null +++ b/Data/User/GameConfig/WBZETL.ini @@ -0,0 +1,18 @@ +# WBZETL - Baddest of the Bands +[Core] +[EmuState] +EmulationStateId = 4 +EmulationIssues = +[OnFrame] +[ActionReplay] +[Video] +ProjectionHack = 0 +PH_SZNear = 0 +PH_SZFar = 0 +PH_ExtraParam = 0 +PH_ZNear = +PH_ZFar = +[Gecko] +[Video_Settings] +UseXFB = True +UseRealXFB = False diff --git a/Data/User/GameConfig/WC6EUP.ini b/Data/User/GameConfig/WC6EUP.ini index 366afca831..8996b68646 100644 --- a/Data/User/GameConfig/WC6EUP.ini +++ b/Data/User/GameConfig/WC6EUP.ini @@ -1,22 +1,22 @@ # WC6EUP - Chronos Twins DX - [Core] # Values set here will override the main dolphin settings. - [EmuState] # The Emulation State. 1 is worst, 5 is best, 0 is not set. EmulationStateId = 4 EmulationIssues = Disable EuRGB60 mode - [OnLoad] # Add memory patches to be loaded once on boot here. - [OnFrame] -# Add memory patches to be applied every frame here. - [ActionReplay] -# Add action replay cheats here. - [Video] ProjectionHack = 0 - +PH_SZNear = 0 +PH_SZFar = 0 +PH_ExtraParam = 0 +PH_ZNear = +PH_ZFar = +[Gecko] +[Video_Settings] +UseXFB = True +UseRealXFB = False diff --git a/Data/User/GameConfig/WCHEJS.ini b/Data/User/GameConfig/WCHEJS.ini new file mode 100644 index 0000000000..df3f05b26f --- /dev/null +++ b/Data/User/GameConfig/WCHEJS.ini @@ -0,0 +1,22 @@ +# WCHEJS - Chess Challenge! +[Core] +[EmuState] +EmulationStateId = 4 +EmulationIssues = +[OnFrame] +[ActionReplay] +[Video] +ProjectionHack = 0 +PH_SZNear = 0 +PH_SZFar = 0 +PH_ExtraParam = 0 +PH_ZNear = +PH_ZFar = +[Gecko] +[Video_Hacks] +EFBEmulateFormatChanges = True +EFBToTextureEnable = False +EFBCopyEnable = True +[Video_Settings] +UseXFB = True +UseRealXFB = False diff --git a/Data/User/GameConfig/WFUEQQ.ini b/Data/User/GameConfig/WFUEQQ.ini new file mode 100644 index 0000000000..fce18cf20c --- /dev/null +++ b/Data/User/GameConfig/WFUEQQ.ini @@ -0,0 +1,18 @@ +# WFUEQQ - Furry Legends +[Core] +[EmuState] +EmulationStateId = 4 +EmulationIssues = +[OnFrame] +[ActionReplay] +[Video] +ProjectionHack = 0 +PH_SZNear = 0 +PH_SZFar = 0 +PH_ExtraParam = 0 +PH_ZNear = +PH_ZFar = +[Gecko] +[Video_Settings] +UseXFB = True +UseRealXFB = False diff --git a/Data/User/GameConfig/WGSE08.ini b/Data/User/GameConfig/WGSE08.ini index 373710b074..09b38270fc 100644 --- a/Data/User/GameConfig/WGSE08.ini +++ b/Data/User/GameConfig/WGSE08.ini @@ -1,19 +1,21 @@ # WGSE08 - PWAA Ace Attorney - [Core] # Values set here will override the main dolphin settings. - [EmuState] # The Emulation State. 1 is worst, 5 is best, 0 is not set. EmulationStateId = 4 -EmulationIssues = - +EmulationIssues = [OnLoad] # Add memory patches to be loaded once on boot here. - [OnFrame] -# Add memory patches to be applied every frame here. - [ActionReplay] -# Add action replay cheats here. - +[Video] +ProjectionHack = 0 +PH_SZNear = 0 +PH_SZFar = 0 +PH_ExtraParam = 0 +PH_ZNear = +PH_ZFar = +[Gecko] +[Video_Hacks] +EFBEmulateFormatChanges = True diff --git a/Data/User/GameConfig/WHWEFJ.ini b/Data/User/GameConfig/WHWEFJ.ini new file mode 100644 index 0000000000..87fdaae304 --- /dev/null +++ b/Data/User/GameConfig/WHWEFJ.ini @@ -0,0 +1,20 @@ +# WHWEFJ - HoopWorld +[Core] +[EmuState] +EmulationStateId = 4 +EmulationIssues = +[OnFrame] +[ActionReplay] +[Video] +ProjectionHack = 0 +PH_SZNear = 0 +PH_SZFar = 0 +PH_ExtraParam = 0 +PH_ZNear = +PH_ZFar = +[Gecko] +[Video_Settings] +SafeTextureCacheColorSamples = 0 +[Video_Hacks] +EFBToTextureEnable = False +EFBCopyEnable = True diff --git a/Data/User/GameConfig/WHWPFJ.ini b/Data/User/GameConfig/WHWPFJ.ini new file mode 100644 index 0000000000..0c658b96f6 --- /dev/null +++ b/Data/User/GameConfig/WHWPFJ.ini @@ -0,0 +1,20 @@ +# WHWPFJ - HoopWorld +[Core] +[EmuState] +EmulationStateId = 4 +EmulationIssues = +[OnFrame] +[ActionReplay] +[Video] +ProjectionHack = 0 +PH_SZNear = 0 +PH_SZFar = 0 +PH_ExtraParam = 0 +PH_ZNear = +PH_ZFar = +[Gecko] +[Video_Settings] +SafeTextureCacheColorSamples = 0 +[Video_Hacks] +EFBToTextureEnable = False +EFBCopyEnable = True diff --git a/Data/User/GameConfig/WPCE01.ini b/Data/User/GameConfig/WPCE01.ini index 142c51d931..550e1424b4 100644 --- a/Data/User/GameConfig/WPCE01.ini +++ b/Data/User/GameConfig/WPCE01.ini @@ -1,22 +1,19 @@ # WPCE01 - Doc's Punch-Out!! - [Core] # Values set here will override the main dolphin settings. - [EmuState] # The Emulation State. 1 is worst, 5 is best, 0 is not set. EmulationStateId = 4 -EmulationIssues = - +EmulationIssues = Disable EuRGB60 mode [OnLoad] # Add memory patches to be loaded once on boot here. - [OnFrame] -# Add memory patches to be applied every frame here. - [ActionReplay] -# Add action replay cheats here. - [Video] ProjectionHack = 0 - +PH_SZNear = 0 +PH_SZFar = 0 +PH_ExtraParam = 0 +PH_ZNear = +PH_ZFar = +[Gecko] diff --git a/Data/User/GameConfig/WPUEGD.ini b/Data/User/GameConfig/WPUEGD.ini new file mode 100644 index 0000000000..2051ccf6eb --- /dev/null +++ b/Data/User/GameConfig/WPUEGD.ini @@ -0,0 +1,18 @@ +# WPUEGD - Bust A Move Plus +[Core] +[EmuState] +EmulationStateId = 4 +EmulationIssues = +[OnFrame] +[ActionReplay] +[Video] +ProjectionHack = 0 +PH_SZNear = 0 +PH_SZFar = 0 +PH_ExtraParam = 0 +PH_ZNear = +PH_ZFar = +[Gecko] +[Video_Settings] +UseXFB = True +UseRealXFB = False diff --git a/Data/User/GameConfig/WTEELU.ini b/Data/User/GameConfig/WTEELU.ini new file mode 100644 index 0000000000..f44112dcd3 --- /dev/null +++ b/Data/User/GameConfig/WTEELU.ini @@ -0,0 +1,21 @@ +# WTEELU - Tales of Elastic Boy Mission 1 +[Core] +[EmuState] +EmulationStateId = 4 +EmulationIssues = +[OnFrame] +[ActionReplay] +[Video] +ProjectionHack = 0 +PH_SZNear = 0 +PH_SZFar = 0 +PH_ExtraParam = 0 +PH_ZNear = +PH_ZFar = +[Gecko] +[Video_Settings] +UseXFB = True +UseRealXFB = False +[Video_Hacks] +EFBToTextureEnable = False +EFBCopyEnable = True diff --git a/Data/User/GameConfig/WTKEGL.ini b/Data/User/GameConfig/WTKEGL.ini index 532b1b5f75..7af8152062 100644 --- a/Data/User/GameConfig/WTKEGL.ini +++ b/Data/User/GameConfig/WTKEGL.ini @@ -1,22 +1,21 @@ # WTKEGL - TV Show King 2 - [Core] # Values set here will override the main dolphin settings. - [EmuState] # The Emulation State. 1 is worst, 5 is best, 0 is not set. EmulationStateId = 4 -EmulationIssues = - +EmulationIssues = [OnLoad] # Add memory patches to be loaded once on boot here. - [OnFrame] -# Add memory patches to be applied every frame here. - [ActionReplay] -# Add action replay cheats here. - [Video] ProjectionHack = 0 - +PH_SZNear = 0 +PH_SZFar = 0 +PH_ExtraParam = 0 +PH_ZNear = +PH_ZFar = +[Gecko] +[Video_Settings] +SafeTextureCacheColorSamples = 512 From b6728c1405d3a1a0ba3daa480f18e3d765a97b9f Mon Sep 17 00:00:00 2001 From: comex Date: Fri, 30 Aug 2013 01:35:43 -0400 Subject: [PATCH 12/33] Avoid unnecessary bundle copies on OS X: - Make "copy data into bundle" depend on the files actually being changed, rather than being run on every build. - postprocess_bundle depends on system files and checking the Dolphin binary and all that, and would be iffy to try to avoid rerunning; but it's only needed to produce a redistributable bundle, so add SKIP_POSTPROCESS_BUNDLE to skip it for development. --- CMakeLists.txt | 5 -- Source/Core/DolphinWX/CMakeLists.txt | 102 +++++++++++++++++++-------- 2 files changed, 71 insertions(+), 36 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7d94a79a91..dcec534409 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -773,11 +773,6 @@ if((NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin")) install(DIRECTORY Data/User/ DESTINATION ${datadir}/user PATTERN) install(DIRECTORY Data/Sys/ DESTINATION ${datadir}/sys PATTERN) endif() -include(FindGettext) -if(GETTEXT_FOUND AND NOT DISABLE_WX) - file(GLOB LINGUAS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} Languages/po/*.po) - GETTEXT_CREATE_TRANSLATIONS(Languages/po/dolphin-emu.pot ALL ${LINGUAS}) -endif() if((NOT ${CMAKE_SYSTEM_NAME} MATCHES "Linux|FreeBSD|Darwin")) install(FILES Data/license.txt DESTINATION ${datadir}) endif() diff --git a/Source/Core/DolphinWX/CMakeLists.txt b/Source/Core/DolphinWX/CMakeLists.txt index 8929b868da..eed1123066 100644 --- a/Source/Core/DolphinWX/CMakeLists.txt +++ b/Source/Core/DolphinWX/CMakeLists.txt @@ -1,3 +1,7 @@ +if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") + option(SKIP_POSTPROCESS_BUNDLE "Skip postprocessing bundle for redistributability" OFF) +endif() + set(LIBS core ${LZO} discio @@ -170,6 +174,13 @@ if(USE_UPNP) set(LIBS ${LIBS} miniupnpc) endif() +include(FindGettext) +if(GETTEXT_FOUND AND wxWidgets_FOUND) + file(GLOB LINGUAS ${CMAKE_SOURCE_DIR}/Languages/po/*.po) + add_custom_target(translations ALL) + GETTEXT_CREATE_TRANSLATIONS(${CMAKE_SOURCE_DIR}/Languages/po/dolphin-emu.pot ${LINGUAS}) +endif() + if(ANDROID) set(DOLPHIN_EXE main) add_library(${DOLPHIN_EXE} SHARED ${SRCS}) @@ -217,47 +228,76 @@ else() MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/Info.plist.in ) - # Fix up the bundle after it is finished. - # There does not seem to be an easy way to run CMake commands post-build, - # so we invoke CMake again on a generated script. - file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/postprocess_bundle.cmake " - include(BundleUtilities) - message(\"Fixing up application bundle: ${BUNDLE_PATH}\") - set(BU_CHMOD_BUNDLE_ITEMS ON) - fixup_bundle(\"${BUNDLE_PATH}\" \"\" \"\") - ") - add_custom_command(TARGET ${DOLPHIN_EXE} POST_BUILD - COMMAND ${CMAKE_COMMAND} -P postprocess_bundle.cmake - ) + if(NOT SKIP_POSTPROCESS_BUNDLE) + # Fix up the bundle after it is finished. + # There does not seem to be an easy way to run CMake commands post-build, + # so we invoke CMake again on a generated script. + file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/postprocess_bundle.cmake " + include(BundleUtilities) + message(\"Fixing up application bundle: ${BUNDLE_PATH}\") + message(\"(Note: This is only necessary to produce a redistributable binary.\") + message(\"To skip, pass -DSKIP_POSTPROCESS_BUNDLE=1 to cmake.)\") + set(BU_CHMOD_BUNDLE_ITEMS ON) + fixup_bundle(\"${BUNDLE_PATH}\" \"\" \"\") + ") + add_custom_command(TARGET ${DOLPHIN_EXE} POST_BUILD + COMMAND ${CMAKE_COMMAND} -P postprocess_bundle.cmake + ) + endif() # Copy data files into application bundle. file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/copy_data_into_bundle.cmake " file(INSTALL ${CMAKE_SOURCE_DIR}/Data/Sys ${CMAKE_SOURCE_DIR}/Data/User DESTINATION ${BUNDLE_PATH}/Contents/Resources ) - file(GLOB TRANSLATION_FILES RELATIVE ${CMAKE_BINARY_DIR} - ${CMAKE_BINARY_DIR}/*.gmo - ) - foreach(TRANSLATION_FILE \${TRANSLATION_FILES}) - string(REPLACE \".gmo\" \".lproj\" TRANSLATION_DIR - \${TRANSLATION_FILE} - ) - # It would be better to copy to the new name as a single action, - # but I can't figure out a way to let CMake do that. - file(COPY ${CMAKE_BINARY_DIR}/\${TRANSLATION_FILE} - DESTINATION ${BUNDLE_PATH}/Contents/Resources/\${TRANSLATION_DIR} - NO_SOURCE_PERMISSIONS - ) - file(RENAME - ${BUNDLE_PATH}/Contents/Resources/\${TRANSLATION_DIR}/\${TRANSLATION_FILE} - ${BUNDLE_PATH}/Contents/Resources/\${TRANSLATION_DIR}/dolphin-emu.mo - ) - endforeach(TRANSLATION_FILE) + file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/did_copy_data_into_bundle \"\") ") - add_custom_target(CopyDataIntoBundle ALL + add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/did_copy_data_into_bundle COMMAND ${CMAKE_COMMAND} -P copy_data_into_bundle.cmake + DEPENDS ${CMAKE_SOURCE_DIR}/Data/Sys ${CMAKE_SOURCE_DIR}/Data/User VERBATIM ) + add_custom_target(CopyDataIntoBundle ALL + DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/did_copy_data_into_bundle + ) + + if(GETTEXT_FOUND AND wxWidgets_FOUND) + file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/copy_translations_into_bundle.cmake " + file(GLOB TRANSLATION_FILES RELATIVE ${CMAKE_BINARY_DIR} + ${CMAKE_BINARY_DIR}/*.gmo + ) + foreach(TRANSLATION_FILE \${TRANSLATION_FILES}) + string(REPLACE \".gmo\" \".lproj\" TRANSLATION_DIR + \${TRANSLATION_FILE} + ) + # It would be better to copy to the new name as a single action, + # but I can't figure out a way to let CMake do that. + file(COPY ${CMAKE_BINARY_DIR}/\${TRANSLATION_FILE} + DESTINATION ${BUNDLE_PATH}/Contents/Resources/\${TRANSLATION_DIR} + NO_SOURCE_PERMISSIONS + ) + file(RENAME + ${BUNDLE_PATH}/Contents/Resources/\${TRANSLATION_DIR}/\${TRANSLATION_FILE} + ${BUNDLE_PATH}/Contents/Resources/\${TRANSLATION_DIR}/dolphin-emu.mo + ) + endforeach(TRANSLATION_FILE) + ") + + file(GLOB PO_FILES RELATIVE ${CMAKE_SOURCE_DIR}/Languages/po + ${CMAKE_SOURCE_DIR}/Languages/po/*.po + ) + string(REPLACE .po .gmo GMO_FILES "${PO_FILES}") + + add_custom_command(OUTPUT ${BUNDLE_PATH}/Contents/Resources/en.lproj + COMMAND ${CMAKE_COMMAND} -P copy_translations_into_bundle.cmake + DEPENDS ${GMO_FILES} + ${CMAKE_SOURCE_DIR}/Data/Sys ${CMAKE_SOURCE_DIR}/Data/User + VERBATIM + ) + add_custom_target(CopyTranslationsIntoBundle ALL + DEPENDS ${BUNDLE_PATH}/Contents/Resources/en.lproj + ) + endif() # Install bundle into systemwide /Applications directory. install(DIRECTORY ${BUNDLE_PATH} DESTINATION /Applications From 93b0f46d343adf9e47b4bd05655c9de42ebf9b96 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Fri, 30 Aug 2013 18:29:03 -0400 Subject: [PATCH 13/33] Fix a tiny bug in CodeView.cpp. If statement with more than one line was missing braces. --- Source/Core/DolphinWX/Src/Debugger/CodeView.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Source/Core/DolphinWX/Src/Debugger/CodeView.cpp b/Source/Core/DolphinWX/Src/Debugger/CodeView.cpp index 619d4a75e9..de5933d55c 100644 --- a/Source/Core/DolphinWX/Src/Debugger/CodeView.cpp +++ b/Source/Core/DolphinWX/Src/Debugger/CodeView.cpp @@ -277,9 +277,11 @@ void CCodeView::OnPopupMenu(wxCommandEvent& event) { u32 dest = AddrToBranch(selection); if (dest) + { Center(dest); RaiseEvent(); } + } break; case IDM_ADDFUNCTION: From 8b0a0daf1086fcf3587fa77cc1b2b12b4cfcf11f Mon Sep 17 00:00:00 2001 From: Ryan Houdek Date: Fri, 30 Aug 2013 21:57:17 +0000 Subject: [PATCH 14/33] Revert "[ARM] Remove Fastmem. It is buggy and may never have the potential to work correctly." This reverts commit f485d96b0ba6b2163fd4bb0beeebe96dfab8f983. --- Source/Core/Core/Src/PowerPC/JitArm32/Jit.h | 4 + .../Src/PowerPC/JitArm32/JitArm_LoadStore.cpp | 213 ++++++++++++++++++ 2 files changed, 217 insertions(+) diff --git a/Source/Core/Core/Src/PowerPC/JitArm32/Jit.h b/Source/Core/Core/Src/PowerPC/JitArm32/Jit.h index be203868e5..b8a7fdbfc8 100644 --- a/Source/Core/Core/Src/PowerPC/JitArm32/Jit.h +++ b/Source/Core/Core/Src/PowerPC/JitArm32/Jit.h @@ -122,6 +122,10 @@ public: void GetCarryAndClear(ARMReg reg); void FinalizeCarry(ARMReg reg); + // TODO: This shouldn't be here + void StoreFromReg(ARMReg dest, ARMReg value, int accessSize, s32 offset); + void LoadToReg(ARMReg dest, ARMReg addr, int accessSize, s32 offset); + // OPCODES void unknown_instruction(UGeckoInstruction _inst); void Default(UGeckoInstruction _inst); diff --git a/Source/Core/Core/Src/PowerPC/JitArm32/JitArm_LoadStore.cpp b/Source/Core/Core/Src/PowerPC/JitArm32/JitArm_LoadStore.cpp index 2efb6d5c7c..e019d3e353 100644 --- a/Source/Core/Core/Src/PowerPC/JitArm32/JitArm_LoadStore.cpp +++ b/Source/Core/Core/Src/PowerPC/JitArm32/JitArm_LoadStore.cpp @@ -31,12 +31,36 @@ #include "JitRegCache.h" #include "JitAsm.h" +#ifdef ANDROID +#define FASTMEM 0 +#else +#define FASTMEM 0 +#endif void JitArm::stb(UGeckoInstruction inst) { INSTRUCTION_START JITDISABLE(LoadStore) ARMReg RS = gpr.R(inst.RS); +#if 0 // FASTMEM + // R10 contains the dest address + ARMReg Value = R11; + ARMReg RA; + if (inst.RA) + RA = gpr.R(inst.RA); + MOV(Value, RS); + if (inst.RA) + { + MOVI2R(R10, inst.SIMM_16, false); + ADD(R10, R10, RA); + } + else + { + MOVI2R(R10, (u32)inst.SIMM_16, false); + NOP(1); + } + StoreFromReg(R10, Value, 16, 0); +#else ARMReg ValueReg = gpr.GetReg(); ARMReg Addr = gpr.GetReg(); ARMReg Function = gpr.GetReg(); @@ -58,6 +82,7 @@ void JitArm::stb(UGeckoInstruction inst) BL(Function); POP(4, R0, R1, R2, R3); gpr.Unlock(ValueReg, Addr, Function); +#endif } void JitArm::stbu(UGeckoInstruction inst) @@ -97,6 +122,25 @@ void JitArm::sth(UGeckoInstruction inst) JITDISABLE(LoadStore) ARMReg RS = gpr.R(inst.RS); +#if 0 // FASTMEM + // R10 contains the dest address + ARMReg Value = R11; + ARMReg RA; + if (inst.RA) + RA = gpr.R(inst.RA); + MOV(Value, RS); + if (inst.RA) + { + MOVI2R(R10, inst.SIMM_16, false); + ADD(R10, R10, RA); + } + else + { + MOVI2R(R10, (u32)inst.SIMM_16, false); + NOP(1); + } + StoreFromReg(R10, Value, 16, 0); +#else ARMReg ValueReg = gpr.GetReg(); ARMReg Addr = gpr.GetReg(); ARMReg Function = gpr.GetReg(); @@ -118,6 +162,7 @@ void JitArm::sth(UGeckoInstruction inst) BL(Function); POP(4, R0, R1, R2, R3); gpr.Unlock(ValueReg, Addr, Function); +#endif } void JitArm::sthu(UGeckoInstruction inst) { @@ -158,6 +203,29 @@ void JitArm::stw(UGeckoInstruction inst) JITDISABLE(LoadStore) ARMReg RS = gpr.R(inst.RS); +#if FASTMEM + // R10 contains the dest address + if (Core::g_CoreStartupParameter.bFastmem) + { + ARMReg Value = R11; + ARMReg RA; + if (inst.RA) + RA = gpr.R(inst.RA); + MOV(Value, RS); + if (inst.RA) + { + MOVI2R(R10, inst.SIMM_16, false); + ADD(R10, R10, RA); + } + else + { + MOVI2R(R10, (u32)inst.SIMM_16, false); + NOP(1); + } + StoreFromReg(R10, Value, 32, 0); + } + else +#endif { ARMReg ValueReg = gpr.GetReg(); ARMReg Addr = gpr.GetReg(); @@ -214,6 +282,79 @@ void JitArm::stwu(UGeckoInstruction inst) gpr.Unlock(ValueReg, Addr, Function); } +void JitArm::StoreFromReg(ARMReg dest, ARMReg value, int accessSize, s32 offset) +{ + ARMReg rA = gpr.GetReg(); + + // All this gets replaced on backpatch + MOVI2R(rA, Memory::MEMVIEW32_MASK, false); // 1-2 + AND(dest, dest, rA); // 3 + MOVI2R(rA, (u32)Memory::base, false); // 4-5 + ADD(dest, dest, rA); // 6 + switch (accessSize) + { + case 32: + REV(value, value); // 7 + break; + case 16: + REV16(value, value); + break; + case 8: + NOP(1); + break; + } + switch (accessSize) + { + case 32: + STR(value, dest); // 8 + break; + case 16: + STRH(value, dest); + break; + case 8: + STRB(value, dest); + break; + } + gpr.Unlock(rA); +} +void JitArm::LoadToReg(ARMReg dest, ARMReg addr, int accessSize, s32 offset) +{ + ARMReg rA = gpr.GetReg(); + MOVI2R(rA, offset, false); // -3 + ADD(addr, addr, rA); // - 1 + + // All this gets replaced on backpatch + MOVI2R(rA, Memory::MEMVIEW32_MASK, false); // 2 + AND(addr, addr, rA); // 3 + MOVI2R(rA, (u32)Memory::base, false); // 5 + ADD(addr, addr, rA); // 6 + switch (accessSize) + { + case 32: + LDR(dest, addr); // 7 + break; + case 16: + LDRH(dest, addr); + break; + case 8: + LDRB(dest, addr); + break; + } + switch (accessSize) + { + case 32: + REV(dest, dest); // 9 + break; + case 16: + REV16(dest, dest); + break; + case 8: + NOP(1); + break; + + } + gpr.Unlock(rA); +} void JitArm::lbz(UGeckoInstruction inst) { INSTRUCTION_START @@ -225,6 +366,24 @@ void JitArm::lbz(UGeckoInstruction inst) LDR(rA, R9, PPCSTATE_OFF(Exceptions)); CMP(rA, EXCEPTION_DSI); FixupBranch DoNotLoad = B_CC(CC_EQ); +#if FASTMEM + // Backpatch route + // Gets loaded in to RD + // Address is in R10 + if (Core::g_CoreStartupParameter.bFastmem) + { + gpr.Unlock(rA, rB); + if (inst.RA) + { + ARMReg RA = gpr.R(inst.RA); + MOV(R10, RA); // - 4 + } + else + MOV(R10, 0); // - 4 + LoadToReg(RD, R10, 8, inst.SIMM_16); + } + else +#endif { if (inst.RA) { @@ -258,6 +417,22 @@ void JitArm::lhz(UGeckoInstruction inst) LDR(rA, R9, PPCSTATE_OFF(Exceptions)); CMP(rA, EXCEPTION_DSI); FixupBranch DoNotLoad = B_CC(CC_EQ); +#if 0 // FASTMEM + // Backpatch route + // Gets loaded in to RD + // Address is in R10 + gpr.Unlock(rA, rB); + if (inst.RA) + { + ARMReg RA = gpr.R(inst.RA); + MOV(R10, RA); // - 4 + } + else + MOV(R10, 0); // - 4 + + LoadToReg(RD, R10, 16, (u32)inst.SIMM_16); +#else + if (inst.RA) { MOVI2R(rB, inst.SIMM_16); @@ -275,6 +450,7 @@ void JitArm::lhz(UGeckoInstruction inst) POP(4, R0, R1, R2, R3); MOV(RD, rA); gpr.Unlock(rA, rB); +#endif SetJumpTarget(DoNotLoad); } void JitArm::lha(UGeckoInstruction inst) @@ -321,6 +497,25 @@ void JitArm::lwz(UGeckoInstruction inst) LDR(rA, R9, PPCSTATE_OFF(Exceptions)); CMP(rA, EXCEPTION_DSI); FixupBranch DoNotLoad = B_CC(CC_EQ); + +#if FASTMEM + // Backpatch route + // Gets loaded in to RD + // Address is in R10 + if (Core::g_CoreStartupParameter.bFastmem) + { + gpr.Unlock(rA, rB); + if (inst.RA) + { + ARMReg RA = gpr.R(inst.RA); + MOV(R10, RA); // - 4 + } + else + MOV(R10, 0); // - 4 + LoadToReg(RD, R10, 32, (u32)inst.SIMM_16); + } + else +#endif { if (inst.RA) { @@ -381,6 +576,24 @@ void JitArm::lwzx(UGeckoInstruction inst) LDR(rA, R9, PPCSTATE_OFF(Exceptions)); CMP(rA, EXCEPTION_DSI); FixupBranch DoNotLoad = B_CC(CC_EQ); +#if FASTMEM + // Backpatch route + // Gets loaded in to RD + // Address is in R10 + if (Core::g_CoreStartupParameter.bFastmem) + { + gpr.Unlock(rA, rB); + if (inst.RA) + { + ARMReg RA = gpr.R(inst.RA); + ADD(R10, RA, RB); // - 4 + } + else + MOV(R10, RB); // -4 + LoadToReg(RD, R10, 32, 0); + } + else +#endif { if (inst.RA) { From df7b4da13b9fd33ef2c9ae18cdfbf1d16fa981b4 Mon Sep 17 00:00:00 2001 From: Ryan Houdek Date: Sat, 31 Aug 2013 02:32:57 +0000 Subject: [PATCH 15/33] [ARM] Fastmem is back. Still disabled for Android. --- Source/Core/Core/Src/PowerPC/JitArm32/Jit.h | 2 + .../PowerPC/JitArm32/JitArm_FloatingPoint.cpp | 4 +- .../Src/PowerPC/JitArm32/JitArm_LoadStore.cpp | 38 ++++++++++++++++- .../JitArm32/JitArm_LoadStoreFloating.cpp | 42 ++++++++++++++++++- .../Src/PowerPC/JitArm32/JitArm_Tables.cpp | 6 +-- 5 files changed, 82 insertions(+), 10 deletions(-) diff --git a/Source/Core/Core/Src/PowerPC/JitArm32/Jit.h b/Source/Core/Core/Src/PowerPC/JitArm32/Jit.h index b8a7fdbfc8..fc1b08905e 100644 --- a/Source/Core/Core/Src/PowerPC/JitArm32/Jit.h +++ b/Source/Core/Core/Src/PowerPC/JitArm32/Jit.h @@ -197,6 +197,7 @@ public: void sthu(UGeckoInstruction _inst); void stw(UGeckoInstruction _inst); void stwu(UGeckoInstruction _inst); + void stwx(UGeckoInstruction _inst); // Floating point void fabsx(UGeckoInstruction _inst); @@ -211,6 +212,7 @@ public: // Floating point loadStore void lfs(UGeckoInstruction _inst); void lfd(UGeckoInstruction _inst); + void stfs(UGeckoInstruction _inst); // Paired Singles void ps_add(UGeckoInstruction _inst); diff --git a/Source/Core/Core/Src/PowerPC/JitArm32/JitArm_FloatingPoint.cpp b/Source/Core/Core/Src/PowerPC/JitArm32/JitArm_FloatingPoint.cpp index 85ab5f3cae..c553397708 100644 --- a/Source/Core/Core/Src/PowerPC/JitArm32/JitArm_FloatingPoint.cpp +++ b/Source/Core/Core/Src/PowerPC/JitArm32/JitArm_FloatingPoint.cpp @@ -107,14 +107,11 @@ void JitArm::fsubx(UGeckoInstruction inst) if (inst.Rc) Helper_UpdateCR1(vD); } -// Breaks Animal Crossing void JitArm::fmulsx(UGeckoInstruction inst) { INSTRUCTION_START JITDISABLE(FloatingPoint) - Default(inst); return; - ARMReg vA = fpr.R0(inst.FA); ARMReg vC = fpr.R0(inst.FC); ARMReg vD0 = fpr.R0(inst.FD); @@ -122,6 +119,7 @@ void JitArm::fmulsx(UGeckoInstruction inst) VMUL(vD0, vA, vC); VMOV(vD1, vD0); + fpr.Flush(); // Shouldn't be needed. Missing a flush somewhere if (inst.Rc) Helper_UpdateCR1(vD0); } void JitArm::fmulx(UGeckoInstruction inst) diff --git a/Source/Core/Core/Src/PowerPC/JitArm32/JitArm_LoadStore.cpp b/Source/Core/Core/Src/PowerPC/JitArm32/JitArm_LoadStore.cpp index e019d3e353..c9d6394873 100644 --- a/Source/Core/Core/Src/PowerPC/JitArm32/JitArm_LoadStore.cpp +++ b/Source/Core/Core/Src/PowerPC/JitArm32/JitArm_LoadStore.cpp @@ -34,7 +34,7 @@ #ifdef ANDROID #define FASTMEM 0 #else -#define FASTMEM 0 +#define FASTMEM 1 #endif void JitArm::stb(UGeckoInstruction inst) { @@ -282,6 +282,40 @@ void JitArm::stwu(UGeckoInstruction inst) gpr.Unlock(ValueReg, Addr, Function); } +void JitArm::stwx(UGeckoInstruction inst) +{ + INSTRUCTION_START + JITDISABLE(LoadStore) + u32 a = inst.RA, b = inst.RB, s = inst.RB; + + if (a) { + // Doesn't work + Default(inst); return; + } + + ARMReg RB = gpr.R(b); + ARMReg RS = gpr.R(s); + ARMReg ValueReg = gpr.GetReg(); + ARMReg Addr = gpr.GetReg(); + ARMReg Function = gpr.GetReg(); + + if (a) + ADD(Addr, gpr.R(a), RB); + else + MOV(Addr, RB); + + MOV(ValueReg, RS); + fpr.Flush(); + MOVI2R(Function, (u32)&Memory::Write_U32); + PUSH(4, R0, R1, R2, R3); + MOV(R0, ValueReg); + MOV(R1, Addr); + BL(Function); + POP(4, R0, R1, R2, R3); + + gpr.Unlock(ValueReg, Addr, Function); +} + void JitArm::StoreFromReg(ARMReg dest, ARMReg value, int accessSize, s32 offset) { ARMReg rA = gpr.GetReg(); @@ -417,7 +451,7 @@ void JitArm::lhz(UGeckoInstruction inst) LDR(rA, R9, PPCSTATE_OFF(Exceptions)); CMP(rA, EXCEPTION_DSI); FixupBranch DoNotLoad = B_CC(CC_EQ); -#if 0 // FASTMEM +#if FASTMEM // Backpatch route // Gets loaded in to RD // Address is in R10 diff --git a/Source/Core/Core/Src/PowerPC/JitArm32/JitArm_LoadStoreFloating.cpp b/Source/Core/Core/Src/PowerPC/JitArm32/JitArm_LoadStoreFloating.cpp index 178007f5b3..66a0912a18 100644 --- a/Source/Core/Core/Src/PowerPC/JitArm32/JitArm_LoadStoreFloating.cpp +++ b/Source/Core/Core/Src/PowerPC/JitArm32/JitArm_LoadStoreFloating.cpp @@ -39,6 +39,9 @@ void JitArm::lfs(UGeckoInstruction inst) ARMReg rA = gpr.GetReg(); ARMReg rB = gpr.GetReg(); + + fpr.Flush(); + LDR(rA, R9, PPCSTATE_OFF(Exceptions)); CMP(rA, EXCEPTION_DSI); FixupBranch DoNotLoad = B_CC(CC_EQ); @@ -52,7 +55,6 @@ void JitArm::lfs(UGeckoInstruction inst) else MOVI2R(rB, (u32)inst.SIMM_16); - fpr.Flush(); MOVI2R(rA, (u32)&Memory::Read_F32); PUSH(4, R0, R1, R2, R3); @@ -80,6 +82,9 @@ void JitArm::lfd(UGeckoInstruction inst) ARMReg rA = gpr.GetReg(); ARMReg rB = gpr.GetReg(); + + fpr.Flush(); + LDR(rA, R9, PPCSTATE_OFF(Exceptions)); CMP(rA, EXCEPTION_DSI); FixupBranch DoNotLoad = B_CC(CC_EQ); @@ -93,7 +98,6 @@ void JitArm::lfd(UGeckoInstruction inst) else MOVI2R(rB, (u32)inst.SIMM_16); - fpr.Flush(); MOVI2R(rA, (u32)&Memory::Read_F64); PUSH(4, R0, R1, R2, R3); @@ -112,3 +116,37 @@ void JitArm::lfd(UGeckoInstruction inst) gpr.Unlock(rA, rB); SetJumpTarget(DoNotLoad); } + +void JitArm::stfs(UGeckoInstruction inst) +{ + INSTRUCTION_START + JITDISABLE(LoadStoreFloating) + + ARMReg rA = gpr.GetReg(); + ARMReg rB = gpr.GetReg(); + ARMReg v0 = fpr.R0(inst.FS); + VCVT(S0, v0, 0); + fpr.Flush(); + + if (inst.RA) + { + MOVI2R(rB, inst.SIMM_16); + ARMReg RA = gpr.R(inst.RA); + ADD(rB, rB, RA); + } + else + MOVI2R(rB, (u32)inst.SIMM_16); + + + MOVI2R(rA, (u32)&Memory::Write_U32); + PUSH(4, R0, R1, R2, R3); + VMOV(R0, S0); + MOV(R1, rB); + + BL(rA); + + POP(4, R0, R1, R2, R3); + + gpr.Unlock(rA, rB); +} + diff --git a/Source/Core/Core/Src/PowerPC/JitArm32/JitArm_Tables.cpp b/Source/Core/Core/Src/PowerPC/JitArm32/JitArm_Tables.cpp index fe822179ed..3d52bf8d16 100644 --- a/Source/Core/Core/Src/PowerPC/JitArm32/JitArm_Tables.cpp +++ b/Source/Core/Core/Src/PowerPC/JitArm32/JitArm_Tables.cpp @@ -102,7 +102,7 @@ static GekkoOPTemplate primarytable[] = {50, &JitArm::lfd}, //"lfd", OPTYPE_LOADFP, FL_IN_A}}, {51, &JitArm::Default}, //"lfdu", OPTYPE_LOADFP, FL_OUT_A | FL_IN_A}}, - {52, &JitArm::Default}, //"stfs", OPTYPE_STOREFP, FL_IN_A}}, + {52, &JitArm::stfs}, //"stfs", OPTYPE_STOREFP, FL_IN_A}}, {53, &JitArm::Default}, //"stfsu", OPTYPE_STOREFP, FL_OUT_A | FL_IN_A}}, {54, &JitArm::Default}, //"stfd", OPTYPE_STOREFP, FL_IN_A}}, {55, &JitArm::Default}, //"stfdu", OPTYPE_STOREFP, FL_OUT_A | FL_IN_A}}, @@ -249,7 +249,7 @@ static GekkoOPTemplate table31[] = {597, &JitArm::Default}, //"lswi", OPTYPE_LOAD, FL_EVIL | FL_IN_AB | FL_OUT_D}}, //store word - {151, &JitArm::Default}, //"stwx", OPTYPE_STORE, FL_IN_A0 | FL_IN_B}}, + {151, &JitArm::stwx}, //"stwx", OPTYPE_STORE, FL_IN_A0 | FL_IN_B}}, {183, &JitArm::Default}, //"stwux", OPTYPE_STORE, FL_OUT_A | FL_IN_A | FL_IN_B}}, //store halfword @@ -293,7 +293,7 @@ static GekkoOPTemplate table31[] = {659, &JitArm::Default}, //"mfsrin", OPTYPE_SYSTEM, FL_OUT_D, 2}}, {4, &JitArm::Break}, //"tw", OPTYPE_SYSTEM, FL_ENDBLOCK, 1}}, - {598, &JitArm::Default}, //"sync", OPTYPE_SYSTEM, 0, 2}}, + {598, &JitArm::DoNothing}, //"sync", OPTYPE_SYSTEM, 0, 2}}, {982, &JitArm::icbi}, //"icbi", OPTYPE_SYSTEM, FL_ENDBLOCK, 3}}, // Unused instructions on GC From 7ce3d846d56a7ab1b4cf6bc7c1f77dad693a16a8 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Sat, 31 Aug 2013 00:39:19 -0400 Subject: [PATCH 16/33] Indent the code in the previous bug fix I did. Now there aren't braces on the same level as each other. Should have initially done this along with that commit. --- .../Core/DolphinWX/Src/Debugger/CodeView.cpp | 74 +++++++++---------- 1 file changed, 37 insertions(+), 37 deletions(-) diff --git a/Source/Core/DolphinWX/Src/Debugger/CodeView.cpp b/Source/Core/DolphinWX/Src/Debugger/CodeView.cpp index de5933d55c..4080d2b564 100644 --- a/Source/Core/DolphinWX/Src/Debugger/CodeView.cpp +++ b/Source/Core/DolphinWX/Src/Debugger/CodeView.cpp @@ -216,39 +216,39 @@ void CCodeView::OnPopupMenu(wxCommandEvent& event) case IDM_COPYCODE: { - char disasm[256]; - debugger->disasm(selection, disasm, 256); - wxTheClipboard->SetData(new wxTextDataObject(StrToWxStr(disasm))); + char disasm[256]; + debugger->disasm(selection, disasm, 256); + wxTheClipboard->SetData(new wxTextDataObject(StrToWxStr(disasm))); } break; case IDM_COPYHEX: { - char temp[24]; - sprintf(temp, "%08x", debugger->readInstruction(selection)); - wxTheClipboard->SetData(new wxTextDataObject(StrToWxStr(temp))); + char temp[24]; + sprintf(temp, "%08x", debugger->readInstruction(selection)); + wxTheClipboard->SetData(new wxTextDataObject(StrToWxStr(temp))); } break; case IDM_COPYFUNCTION: { - Symbol *symbol = symbol_db->GetSymbolFromAddr(selection); - if (symbol) - { - std::string text; - text = text + symbol->name + "\r\n"; - // we got a function - u32 start = symbol->address; - u32 end = start + symbol->size; - for (u32 addr = start; addr != end; addr += 4) + Symbol *symbol = symbol_db->GetSymbolFromAddr(selection); + if (symbol) { - char disasm[256]; - debugger->disasm(addr, disasm, 256); - text = text + StringFromFormat("%08x: ", addr) + disasm + "\r\n"; + std::string text; + text = text + symbol->name + "\r\n"; + // we got a function + u32 start = symbol->address; + u32 end = start + symbol->size; + for (u32 addr = start; addr != end; addr += 4) + { + char disasm[256]; + debugger->disasm(addr, disasm, 256); + text = text + StringFromFormat("%08x: ", addr) + disasm + "\r\n"; + } + wxTheClipboard->SetData(new wxTextDataObject(StrToWxStr(text))); } - wxTheClipboard->SetData(new wxTextDataObject(StrToWxStr(text))); - } } break; #endif @@ -275,12 +275,12 @@ void CCodeView::OnPopupMenu(wxCommandEvent& event) case IDM_FOLLOWBRANCH: { - u32 dest = AddrToBranch(selection); - if (dest) - { - Center(dest); - RaiseEvent(); - } + u32 dest = AddrToBranch(selection); + if (dest) + { + Center(dest); + RaiseEvent(); + } } break; @@ -291,19 +291,19 @@ void CCodeView::OnPopupMenu(wxCommandEvent& event) case IDM_RENAMESYMBOL: { - Symbol *symbol = symbol_db->GetSymbolFromAddr(selection); - if (symbol) - { - wxTextEntryDialog input_symbol(this, StrToWxStr("Rename symbol:"), - wxGetTextFromUserPromptStr, - StrToWxStr(symbol->name)); - if (input_symbol.ShowModal() == wxID_OK) + Symbol *symbol = symbol_db->GetSymbolFromAddr(selection); + if (symbol) { - symbol->name = WxStrToStr(input_symbol.GetValue()); - Refresh(); // Redraw to show the renamed symbol + wxTextEntryDialog input_symbol(this, StrToWxStr("Rename symbol:"), + wxGetTextFromUserPromptStr, + StrToWxStr(symbol->name)); + if (input_symbol.ShowModal() == wxID_OK) + { + symbol->name = WxStrToStr(input_symbol.GetValue()); + Refresh(); // Redraw to show the renamed symbol + } + Host_NotifyMapLoaded(); } - Host_NotifyMapLoaded(); - } } break; From c497d6283668f14a12b585a0e67bde9222ba76ed Mon Sep 17 00:00:00 2001 From: Matthew Parlane Date: Sat, 31 Aug 2013 16:44:28 +1200 Subject: [PATCH 17/33] Fix sysmenu test connection bug on Windows. --- Source/Core/Core/Src/IPC_HLE/WII_Socket.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/Core/Core/Src/IPC_HLE/WII_Socket.cpp b/Source/Core/Core/Src/IPC_HLE/WII_Socket.cpp index 73fa09e485..4939499b1e 100644 --- a/Source/Core/Core/Src/IPC_HLE/WII_Socket.cpp +++ b/Source/Core/Core/Src/IPC_HLE/WII_Socket.cpp @@ -417,8 +417,8 @@ void WiiSocket::update(bool read, bool write, bool except) // Act as non blocking when SO_MSG_NONBLOCK is specified forceNonBlock = ((flags & SO_MSG_NONBLOCK) == SO_MSG_NONBLOCK); - // send/sendto only handles PEEK - flags &= SO_MSG_PEEK | SO_MSG_OOB; + // send/sendto only handles MSG_OOB + flags &= SO_MSG_OOB; u8 destaddr[28]; struct sockaddr_in* addr = (struct sockaddr_in*)&destaddr; From 4d6d4a97e4df55ae1f1ec2cb6b7961efd6d35c89 Mon Sep 17 00:00:00 2001 From: comex Date: Fri, 30 Aug 2013 00:00:06 -0400 Subject: [PATCH 18/33] Make NonCopyable use rvalue references. This is required to be able to move objects that inherit from it. (Note that this patch also #ifs out the class for the externals that include it yet are compiled in pre-C++11 mode. It shouldn't matter, since those externals don't use it.) --- Source/Core/Common/Src/Common.h | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Source/Core/Common/Src/Common.h b/Source/Core/Common/Src/Common.h index 9a1ebab8e9..eb0679d358 100644 --- a/Source/Core/Common/Src/Common.h +++ b/Source/Core/Common/Src/Common.h @@ -25,15 +25,20 @@ extern const char *netplay_dolphin_ver; #define STACKALIGN +#if __cplusplus >= 201103 || defined(_MSC_VER) || defined(__GXX_EXPERIMENTAL_CXX0X__) +#define HAVE_CXX11_SYNTAX 1 +#endif + +#if HAVE_CXX11_SYNTAX // An inheritable class to disallow the copy constructor and operator= functions class NonCopyable { protected: NonCopyable() {} -private: - NonCopyable(const NonCopyable&); - void operator=(const NonCopyable&); + NonCopyable(const NonCopyable&&) {} + void operator=(const NonCopyable&&) {} }; +#endif #include "Log.h" #include "CommonTypes.h" From 04c41c1d38261eebb1cdf462a8d836cfc504a9ac Mon Sep 17 00:00:00 2001 From: comex Date: Thu, 29 Aug 2013 18:25:12 -0400 Subject: [PATCH 19/33] Fix loading DLC using IOCTL_ES_OPENTITLECONTENT & /dev/es state save. (Intertwined enough that's it's easier to do in one patch.) (1) /dev/es did not support state save, which could cause crashes and incorrect behavior after loading. (2) NANDContentLoader tried to read all of a title's contents into memory when it was first opened. Two issues: - If any contents were missing, it bailed out. However, with DLC, only some of the contents may be downloaded, as determined by the permission bits in the ticket. Instead, return an appropriate error when a content is accessed that doesn't exist on the filesystem (don't bother checking the permission bits though). - Everything was loaded into memory - even if it consisted of 3 GB of songs, which caused Dolphin to lag out for quite a while (and would fail on 32-bit). Instead, open content on demand. --- Source/Core/Common/Src/FileUtil.h | 6 +- .../Src/IPC_HLE/WII_IPC_HLE_Device_es.cpp | 144 ++++++++++++++---- .../Core/Src/IPC_HLE/WII_IPC_HLE_Device_es.h | 11 +- Source/Core/DiscIO/Src/NANDContentLoader.cpp | 41 ++--- Source/Core/DiscIO/Src/NANDContentLoader.h | 6 +- 5 files changed, 143 insertions(+), 65 deletions(-) diff --git a/Source/Core/Common/Src/FileUtil.h b/Source/Core/Common/Src/FileUtil.h index 1147bbdaad..b0391f4b74 100644 --- a/Source/Core/Common/Src/FileUtil.h +++ b/Source/Core/Common/Src/FileUtil.h @@ -143,7 +143,7 @@ bool ReadFileToString(bool text_file, const char *filename, std::string &str); // simple wrapper for cstdlib file functions to // hopefully will make error checking easier // and make forgetting an fclose() harder -class IOFile +class IOFile : public NonCopyable { public: IOFile(); @@ -209,10 +209,6 @@ public: // clear error state void Clear() { m_good = true; std::clearerr(m_file); } -private: - IOFile(const IOFile&) /*= delete*/; - IOFile& operator=(const IOFile&) /*= delete*/; - std::FILE* m_file; bool m_good; }; 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 aa1df13536..3bbd4296e8 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 @@ -60,7 +60,7 @@ CWII_IPC_HLE_Device_es::CWII_IPC_HLE_Device_es(u32 _DeviceID, const std::string& : IWII_IPC_HLE_Device(_DeviceID, _rDeviceName) , m_pContentLoader(NULL) , m_TitleID(-1) - , AccessIdentID(0x6000000) + , m_AccessIdentID(0x6000000) { } @@ -91,7 +91,7 @@ void CWII_IPC_HLE_Device_es::LoadWAD(const std::string& _rContentFile) m_ContentFile = _rContentFile; } -bool CWII_IPC_HLE_Device_es::Open(u32 _CommandAddress, u32 _Mode) +void CWII_IPC_HLE_Device_es::OpenInternal() { m_pContentLoader = &DiscIO::CNANDContentManager::Access().GetNANDLoader(m_ContentFile); @@ -119,6 +119,57 @@ bool CWII_IPC_HLE_Device_es::Open(u32 _CommandAddress, u32 _Mode) } INFO_LOG(WII_IPC_ES, "Set default title to %08x/%08x", (u32)(m_TitleID>>32), (u32)m_TitleID); +} + +void CWII_IPC_HLE_Device_es::DoState(PointerWrap& p) +{ + IWII_IPC_HLE_Device::DoState(p); + p.Do(m_ContentFile); + OpenInternal(); + p.Do(m_AccessIdentID); + p.Do(m_TitleIDs); + + u32 Count = m_ContentAccessMap.size(); + p.Do(Count); + + u32 CFD, Position; + u64 TitleID; + u16 Index; + if (p.GetMode() == PointerWrap::MODE_READ) + { + for (u32 i = 0; i < Count; i++) + { + p.Do(CFD); + p.Do(Position); + p.Do(TitleID); + p.Do(Index); + CFD = OpenTitleContent(CFD, TitleID, Index); + if (CFD != 0xffffffff) + { + m_ContentAccessMap[CFD].m_Position = Position; + } + } + } + else + { + for (auto itr = m_ContentAccessMap.begin(); itr != m_ContentAccessMap.end(); ++itr) + { + CFD = itr->first; + SContentAccess& Access = itr->second; + Position = Access.m_Position; + TitleID = Access.m_TitleID; + Index = Access.m_pContent->m_Index; + p.Do(CFD); + p.Do(Position); + p.Do(TitleID); + p.Do(Index); + } + } +} + +bool CWII_IPC_HLE_Device_es::Open(u32 _CommandAddress, u32 _Mode) +{ + OpenInternal(); Memory::Write_U32(GetDeviceID(), _CommandAddress+4); if (m_Active) @@ -135,7 +186,7 @@ bool CWII_IPC_HLE_Device_es::Close(u32 _CommandAddress, bool _bForce) m_pContentLoader = NULL; m_TitleIDs.clear(); m_TitleID = -1; - AccessIdentID = 0x6000000; + m_AccessIdentID = 0x6000000; INFO_LOG(WII_IPC_ES, "ES: Close"); if (!_bForce) @@ -144,6 +195,37 @@ bool CWII_IPC_HLE_Device_es::Close(u32 _CommandAddress, bool _bForce) return true; } +u32 CWII_IPC_HLE_Device_es::OpenTitleContent(u32 CFD, u64 TitleID, u16 Index) +{ + const DiscIO::SNANDContent* pContent = AccessContentDevice(TitleID).GetContentByIndex(Index); + + if (pContent == NULL) + { + return 0xffffffff; //TODO: what is the correct error value here? + } + + SContentAccess Access; + Access.m_Position = 0; + Access.m_pContent = pContent; + Access.m_TitleID = TitleID; + + if (!pContent->m_pData) + { + std::string Filename = pContent->m_Filename; + INFO_LOG(WII_IPC_ES, "ES: load %s", Filename.c_str()); + + Access.m_File.Open(Filename, "rb"); + if (!Access.m_File.IsGood()) + { + WARN_LOG(WII_IPC_ES, "ES: couldn't load %s", Filename.c_str()); + return 0xffffffff; + } + } + + m_ContentAccessMap[CFD] = std::move(Access); + return CFD; +} + bool CWII_IPC_HLE_Device_es::IOCtlV(u32 _CommandAddress) { SIOCtlVBuffer Buffer(_CommandAddress); @@ -242,16 +324,11 @@ bool CWII_IPC_HLE_Device_es::IOCtlV(u32 _CommandAddress) 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? + u32 CFD = OpenTitleContent(m_AccessIdentID++, TitleID, Index); 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; @@ -260,19 +337,12 @@ bool CWII_IPC_HLE_Device_es::IOCtlV(u32 _CommandAddress) { _dbg_assert_(WII_IPC_ES, Buffer.NumberInBuffer == 1); _dbg_assert_(WII_IPC_ES, Buffer.NumberPayloadBuffer == 0); - - u32 CFD = AccessIdentID++; u32 Index = Memory::Read_U32(Buffer.InBuffer[0].m_Address); - m_ContentAccessMap[CFD].m_Position = 0; - m_ContentAccessMap[CFD].m_pContent = AccessContentDevice(m_TitleID).GetContentByIndex(Index); - - if (m_ContentAccessMap[CFD].m_pContent == NULL) - CFD = 0xffffffff; //TODO: what is the correct error value here? - + u32 CFD = OpenTitleContent(m_AccessIdentID++, m_TitleID, Index); Memory::Write_U32(CFD, _CommandAddress + 0x4); - INFO_LOG(WII_IPC_ES, "IOCTL_ES_OPENCONTENT: Index %i -> got CFD %x", Index, CFD); + return true; } break; @@ -286,12 +356,16 @@ bool CWII_IPC_HLE_Device_es::IOCtlV(u32 _CommandAddress) 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]; + auto itr = m_ContentAccessMap.find(CFD); + if (itr == m_ContentAccessMap.end()) + { + Memory::Write_U32(-1, _CommandAddress + 0x4); + return true; + } + SContentAccess& rContent = itr->second; _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); if (rContent.m_Position + Size > rContent.m_pContent->m_Size) @@ -302,7 +376,17 @@ bool CWII_IPC_HLE_Device_es::IOCtlV(u32 _CommandAddress) if (Size > 0) { if (pDest) { - memcpy(pDest, pSrc, Size); + if (rContent.m_pContent->m_pData) + { + u8* pSrc = &rContent.m_pContent->m_pData[rContent.m_Position]; + memcpy(pDest, pSrc, Size); + } + else + { + File::IOFile* pFile = &rContent.m_File; + pFile->Seek(rContent.m_Position, SEEK_SET); + pFile->ReadBytes(pDest, Size); + } rContent.m_Position += Size; } else { PanicAlertT("IOCTL_ES_READCONTENT - bad destination"); @@ -323,8 +407,7 @@ bool CWII_IPC_HLE_Device_es::IOCtlV(u32 _CommandAddress) u32 CFD = Memory::Read_U32(Buffer.InBuffer[0].m_Address); - CContentAccessMap::iterator itr = m_ContentAccessMap.find(CFD); - m_ContentAccessMap.erase(itr); + m_ContentAccessMap.erase(CFD); INFO_LOG(WII_IPC_ES, "IOCTL_ES_CLOSECONTENT: CFD %x", CFD); @@ -342,8 +425,13 @@ bool CWII_IPC_HLE_Device_es::IOCtlV(u32 _CommandAddress) 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]; + auto itr = m_ContentAccessMap.find(CFD); + if (itr == m_ContentAccessMap.end()) + { + Memory::Write_U32(-1, _CommandAddress + 0x4); + return true; + } + SContentAccess& rContent = itr->second; switch (Mode) { @@ -908,7 +996,7 @@ bool CWII_IPC_HLE_Device_es::IOCtlV(u32 _CommandAddress) const DiscIO::INANDContentLoader& CWII_IPC_HLE_Device_es::AccessContentDevice(u64 _TitleID) { if (m_pContentLoader->IsValid() && m_pContentLoader->GetTitleID() == _TitleID) - return* m_pContentLoader; + return *m_pContentLoader; CTitleToContentMap::iterator itr = m_NANDContent.find(_TitleID); if (itr != m_NANDContent.end()) 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 a407ea4742..f77cea969c 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 @@ -19,6 +19,10 @@ public: void LoadWAD(const std::string& _rContentFile); + void OpenInternal(); + + virtual void DoState(PointerWrap& p); + virtual bool Open(u32 _CommandAddress, u32 _Mode); virtual bool Close(u32 _CommandAddress, bool _bForce); @@ -108,10 +112,12 @@ private: ES_HASH_SIZE_WRONG = -2014, // HASH !=20 }; - struct SContentAccess + struct SContentAccess : public NonCopyable { u32 m_Position; + u64 m_TitleID; const DiscIO::SNANDContent* m_pContent; + File::IOFile m_File; }; typedef std::map CContentAccessMap; @@ -124,13 +130,14 @@ private: std::vector m_TitleIDs; u64 m_TitleID; - u32 AccessIdentID; + u32 m_AccessIdentID; static u8 *keyTable[11]; u64 GetCurrentTitleID() const; const DiscIO::INANDContentLoader& AccessContentDevice(u64 _TitleID); + u32 OpenTitleContent(u32 CFD, u64 TitleID, u16 Index); bool IsValid(u64 _TitleID) const; diff --git a/Source/Core/DiscIO/Src/NANDContentLoader.cpp b/Source/Core/DiscIO/Src/NANDContentLoader.cpp index 0cc71bafb8..b0dcd302f7 100644 --- a/Source/Core/DiscIO/Src/NANDContentLoader.cpp +++ b/Source/Core/DiscIO/Src/NANDContentLoader.cpp @@ -5,7 +5,7 @@ #include "NANDContentLoader.h" #include -#include +#include #include "Crypto/aes.h" #include "MathUtil.h" #include "FileUtil.h" @@ -42,7 +42,7 @@ void CSharedContent::UpdateLocation() CSharedContent::~CSharedContent() {} -std::string CSharedContent::GetFilenameFromSHA1(u8* _pHash) +std::string CSharedContent::GetFilenameFromSHA1(const u8* _pHash) { for (size_t i=0; im_Index == _Index) + { + return pContent; + } } return NULL; } @@ -262,36 +265,18 @@ bool CNANDContentLoader::Initialize(const std::string& _rName) } rContent.m_pData = NULL; - char szFilename[1024]; if (rContent.m_Type & 0x8000) // shared app { - std::string Filename = CSharedContent::AccessInstance().GetFilenameFromSHA1(rContent.m_SHA1Hash); - strcpy(szFilename, Filename.c_str()); + rContent.m_Filename = CSharedContent::AccessInstance().GetFilenameFromSHA1(rContent.m_SHA1Hash); } else { - sprintf(szFilename, "%s/%08x.app", m_Path.c_str(), rContent.m_ContentID); + rContent.m_Filename = StringFromFormat("%s/%08x.app", m_Path.c_str(), rContent.m_ContentID); } - INFO_LOG(DISCIO, "NANDContentLoader: load %s", szFilename); - - File::IOFile pFile(szFilename, "rb"); - if (pFile) - { - const u64 ContentSize = File::GetSize(szFilename); - rContent.m_pData = new u8[(u32)ContentSize]; - - _dbg_assert_msg_(BOOT, rContent.m_Size==ContentSize, "TMDLoader: Incorrect filesize (%s %i). Your NAND dump may be corrupt.", szFilename, i); - - pFile.ReadBytes(rContent.m_pData, (size_t)ContentSize); - } - else - { - ERROR_LOG(DISCIO, "NANDContentLoader: error opening %s", szFilename); - delete [] pTMD; - return false; - } + // Be graceful about incorrect tmds. + rContent.m_Size = (u32) File::GetSize(rContent.m_Filename); } delete [] pTMD; @@ -493,7 +478,7 @@ u64 CNANDContentManager::Install_WiiWAD(std::string &fileName) for (u32 i = 0; i < ContentLoader.GetContentSize(); i++) { - SNANDContent Content = ContentLoader.GetContent()[i]; + const SNANDContent& Content = ContentLoader.GetContent()[i]; pTMDFile.WriteBytes(Content.m_Header, INANDContentLoader::CONTENT_HEADER_SIZE); diff --git a/Source/Core/DiscIO/Src/NANDContentLoader.h b/Source/Core/DiscIO/Src/NANDContentLoader.h index 66d6a4880c..9172c85338 100644 --- a/Source/Core/DiscIO/Src/NANDContentLoader.h +++ b/Source/Core/DiscIO/Src/NANDContentLoader.h @@ -13,6 +13,7 @@ #include "Blob.h" #include "Volume.h" #include "NandPaths.h" +#include "FileUtil.h" namespace DiscIO { @@ -26,6 +27,7 @@ struct SNANDContent u8 m_SHA1Hash[20]; u8 m_Header[36]; //all of the above + std::string m_Filename; u8* m_pData; }; @@ -95,8 +97,8 @@ public: static CSharedContent& AccessInstance() { return m_Instance; } - std::string GetFilenameFromSHA1(u8* _pHash); - std::string AddSharedContent(u8* _pHash); + std::string GetFilenameFromSHA1(const u8* _pHash); + std::string AddSharedContent(const u8* _pHash); void UpdateLocation(); private: From 11cffddbf7755c4e050d3263153ac88db71f4708 Mon Sep 17 00:00:00 2001 From: comex Date: Sat, 31 Aug 2013 01:54:57 -0400 Subject: [PATCH 20/33] Fix a trivial bug in b6728c1405d3a1a0ba3daa480f18e3d765a97b9f. --- Source/Core/DolphinWX/CMakeLists.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Source/Core/DolphinWX/CMakeLists.txt b/Source/Core/DolphinWX/CMakeLists.txt index eed1123066..a6dcba128f 100644 --- a/Source/Core/DolphinWX/CMakeLists.txt +++ b/Source/Core/DolphinWX/CMakeLists.txt @@ -263,8 +263,8 @@ else() if(GETTEXT_FOUND AND wxWidgets_FOUND) file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/copy_translations_into_bundle.cmake " - file(GLOB TRANSLATION_FILES RELATIVE ${CMAKE_BINARY_DIR} - ${CMAKE_BINARY_DIR}/*.gmo + file(GLOB TRANSLATION_FILES RELATIVE ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_CURRENT_BINARY_DIR}/*.gmo ) foreach(TRANSLATION_FILE \${TRANSLATION_FILES}) string(REPLACE \".gmo\" \".lproj\" TRANSLATION_DIR @@ -272,7 +272,7 @@ else() ) # It would be better to copy to the new name as a single action, # but I can't figure out a way to let CMake do that. - file(COPY ${CMAKE_BINARY_DIR}/\${TRANSLATION_FILE} + file(COPY ${CMAKE_CURRENT_BINARY_DIR}/\${TRANSLATION_FILE} DESTINATION ${BUNDLE_PATH}/Contents/Resources/\${TRANSLATION_DIR} NO_SOURCE_PERMISSIONS ) From 676d78ec41455457dae0f0d45344f7b946352d63 Mon Sep 17 00:00:00 2001 From: Matthew Parlane Date: Sat, 31 Aug 2013 18:46:46 +1200 Subject: [PATCH 21/33] Fixes accept. Tested with network demo from devKitPPC :) --- .../Src/IPC_HLE/WII_IPC_HLE_Device_net.cpp | 6 ++--- Source/Core/Core/Src/IPC_HLE/WII_Socket.cpp | 23 ++++++++++++------- Source/Core/Core/Src/IPC_HLE/WII_Socket.h | 1 + 3 files changed, 19 insertions(+), 11 deletions(-) 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 be0e1a1358..cbb5b63d83 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 @@ -709,14 +709,14 @@ bool CWII_IPC_HLE_Device_net_ip_top::IOCtl(u32 _CommandAddress) } case IOCTL_SO_LISTEN: { - INFO_LOG(WII_IPC_NET, "IOCTL_SO_LISTEN " - "BufferIn: (%08x, %i), BufferOut: (%08x, %i)", - BufferIn, BufferInSize, BufferOut, BufferOutSize); u32 fd = Memory::Read_U32(BufferIn); u32 BACKLOG = Memory::Read_U32(BufferIn + 0x04); u32 ret = listen(fd, BACKLOG); ReturnValue = WiiSockMan::getNetErrorCode(ret, "SO_LISTEN", false); + INFO_LOG(WII_IPC_NET, "IOCTL_SO_LISTEN = %d " + "BufferIn: (%08x, %i), BufferOut: (%08x, %i)", + ReturnValue, BufferIn, BufferInSize, BufferOut, BufferOutSize); break; } case IOCTL_SO_GETSOCKOPT: diff --git a/Source/Core/Core/Src/IPC_HLE/WII_Socket.cpp b/Source/Core/Core/Src/IPC_HLE/WII_Socket.cpp index 4939499b1e..e8c7a5a1bd 100644 --- a/Source/Core/Core/Src/IPC_HLE/WII_Socket.cpp +++ b/Source/Core/Core/Src/IPC_HLE/WII_Socket.cpp @@ -224,7 +224,7 @@ void WiiSocket::update(bool read, bool write, bool except) WiiSockAddrIn* wii_name = (WiiSockAddrIn*)Memory::GetPointer(BufferOut); WiiSockMan::Convert(*wii_name, local_name); - socklen_t addrlen = wii_name->len; + socklen_t addrlen = sizeof(sockaddr_in); int ret = (s32)accept(fd, (sockaddr*)&local_name, &addrlen); ReturnValue = WiiSockMan::getNetErrorCode(ret, "SO_ACCEPT", false); @@ -235,7 +235,9 @@ void WiiSocket::update(bool read, bool write, bool except) int ret = (s32)accept(fd, NULL, 0); ReturnValue = WiiSockMan::getNetErrorCode(ret, "SO_ACCEPT", false); } - + + WiiSockMan::getInstance().addSocket(ReturnValue); + INFO_LOG(WII_IPC_NET, "IOCTL_SO_ACCEPT " "BufferIn: (%08x, %i), BufferOut: (%08x, %i)", BufferIn, BufferInSize, BufferOut, BufferOutSize); @@ -506,7 +508,7 @@ void WiiSocket::update(bool read, bool write, bool except) || (!it->is_ssl && ReturnValue != -SO_EAGAIN && ReturnValue != -SO_EINPROGRESS && ReturnValue != -SO_EALREADY) || (it->is_ssl && ReturnValue != SSL_ERR_WAGAIN && ReturnValue != SSL_ERR_RAGAIN)) { - DEBUG_LOG(WII_IPC_NET, "IOCTL(V) Sock: %d ioctl/v: %d returned: %d nonBlock: %d forceNonBlock: %d", + DEBUG_LOG(WII_IPC_NET, "IOCTL(V) Sock: %08x ioctl/v: %d returned: %d nonBlock: %d forceNonBlock: %d", fd, it->is_ssl ? it->ssl_type : it->net_type, ReturnValue, nonBlock, forceNonBlock); WiiSockMan::EnqueueReply(it->_CommandAddress, ReturnValue); it = pending_sockops.erase(it); @@ -532,6 +534,15 @@ void WiiSocket::doSock(u32 _CommandAddress, SSL_IOCTL type) pending_sockops.push_back(so); } +void WiiSockMan::addSocket(s32 fd) +{ + if (fd >= 0) + { + WiiSocket& sock = WiiSockets[fd]; + sock.setFd(fd); + } +} + s32 WiiSockMan::newSocket(s32 af, s32 type, s32 protocol) { if (NetPlay::IsNetPlayRunning() @@ -543,11 +554,7 @@ s32 WiiSockMan::newSocket(s32 af, s32 type, s32 protocol) s32 fd = (s32)socket(af, type, protocol); s32 ret = getNetErrorCode(fd, "newSocket", false); - if (ret >= 0) - { - WiiSocket& sock = WiiSockets[ret]; - sock.setFd(ret); - } + addSocket(ret); return ret; } diff --git a/Source/Core/Core/Src/IPC_HLE/WII_Socket.h b/Source/Core/Core/Src/IPC_HLE/WII_Socket.h index 3c2ce3bb30..717724f313 100644 --- a/Source/Core/Core/Src/IPC_HLE/WII_Socket.h +++ b/Source/Core/Core/Src/IPC_HLE/WII_Socket.h @@ -210,6 +210,7 @@ public: static void Convert(sockaddr_in const & from, WiiSockAddrIn& to, s32 addrlen=-1); // NON-BLOCKING FUNCTIONS s32 newSocket(s32 af, s32 type, s32 protocol); + void addSocket(s32 fd); s32 delSocket(s32 s); void clean() From 751c2e69f6d54d1f8e7bf204b9db537f1997629c Mon Sep 17 00:00:00 2001 From: Pierre Bourdon Date: Sat, 31 Aug 2013 10:31:34 +0200 Subject: [PATCH 22/33] Add a link to our documentations guides in Dolphin --- Source/Core/DolphinWX/Src/Frame.cpp | 1 + Source/Core/DolphinWX/Src/FrameTools.cpp | 8 ++++++-- Source/Core/DolphinWX/Src/Globals.h | 1 + 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/Source/Core/DolphinWX/Src/Frame.cpp b/Source/Core/DolphinWX/Src/Frame.cpp index 5d0113ef53..dab18a1687 100644 --- a/Source/Core/DolphinWX/Src/Frame.cpp +++ b/Source/Core/DolphinWX/Src/Frame.cpp @@ -152,6 +152,7 @@ BEGIN_EVENT_TABLE(CFrame, CRenderFrame) EVT_MENU(wxID_OPEN, CFrame::OnOpen) EVT_MENU(wxID_EXIT, CFrame::OnQuit) EVT_MENU(IDM_HELPWEBSITE, CFrame::OnHelp) +EVT_MENU(IDM_HELPONLINEDOCS, CFrame::OnHelp) EVT_MENU(IDM_HELPGOOGLECODE, CFrame::OnHelp) EVT_MENU(wxID_ABOUT, CFrame::OnHelp) EVT_MENU(wxID_REFRESH, CFrame::OnRefresh) diff --git a/Source/Core/DolphinWX/Src/FrameTools.cpp b/Source/Core/DolphinWX/Src/FrameTools.cpp index 6663a59665..711195048b 100644 --- a/Source/Core/DolphinWX/Src/FrameTools.cpp +++ b/Source/Core/DolphinWX/Src/FrameTools.cpp @@ -297,6 +297,7 @@ void CFrame::CreateMenu() // Re-enable when there's something useful to display */ // helpMenu->Append(wxID_HELP, _("&Help")); helpMenu->Append(IDM_HELPWEBSITE, _("Dolphin &Web Site")); + helpMenu->Append(IDM_HELPONLINEDOCS, _("Online &Documentation")); helpMenu->Append(IDM_HELPGOOGLECODE, _("Dolphin at &Google Code")); helpMenu->AppendSeparator(); helpMenu->Append(wxID_ABOUT, _("&About...")); @@ -1255,10 +1256,13 @@ void CFrame::OnHelp(wxCommandEvent& event) } break; case IDM_HELPWEBSITE: - WxUtils::Launch("http://dolphin-emu.org/"); + WxUtils::Launch("https://dolphin-emu.org/"); + break; + case IDM_HELPONLINEDOCS: + WxUtils::Launch("https://dolphin-emu.org/docs/guides/"); break; case IDM_HELPGOOGLECODE: - WxUtils::Launch("http://code.google.com/p/dolphin-emu/"); + WxUtils::Launch("https://code.google.com/p/dolphin-emu/"); break; } } diff --git a/Source/Core/DolphinWX/Src/Globals.h b/Source/Core/DolphinWX/Src/Globals.h index f55a6b2b66..42c0154405 100644 --- a/Source/Core/DolphinWX/Src/Globals.h +++ b/Source/Core/DolphinWX/Src/Globals.h @@ -118,6 +118,7 @@ enum IDM_PURGECACHE, IDM_HELPWEBSITE, // Help menu + IDM_HELPONLINEDOCS, IDM_HELPGOOGLECODE, IDM_CONFIG_GFX_BACKEND, From b187a384335501c95fe50fa75d4d0c118b64940b Mon Sep 17 00:00:00 2001 From: comex Date: Sat, 31 Aug 2013 14:58:19 -0400 Subject: [PATCH 23/33] Fix inability to boot NAND contents caused by 04c41c1d3826. Might be nice to refactor this code to decrease duplication, but for now just a fix. --- Source/Core/Core/Src/Boot/Boot_WiiWAD.cpp | 16 +++++++++++++--- .../Core/Src/IPC_HLE/WII_IPC_HLE_Device_es.cpp | 15 +++++++++++---- 2 files changed, 24 insertions(+), 7 deletions(-) diff --git a/Source/Core/Core/Src/Boot/Boot_WiiWAD.cpp b/Source/Core/Core/Src/Boot/Boot_WiiWAD.cpp index dd4d8e2f2f..d9d9b03021 100644 --- a/Source/Core/Core/Src/Boot/Boot_WiiWAD.cpp +++ b/Source/Core/Core/Src/Boot/Boot_WiiWAD.cpp @@ -19,6 +19,8 @@ #include "VolumeCreator.h" #include "CommonPaths.h" +#include + static u32 state_checksum(u32 *buf, int len) { u32 checksum = 0; @@ -89,9 +91,17 @@ bool CBoot::Boot_WiiWAD(const char* _pFilename) WII_IPC_HLE_Interface::SetDefaultContentFile(_pFilename); - CDolLoader DolLoader(pContent->m_pData, pContent->m_Size); - DolLoader.Load(); - PC = DolLoader.GetEntryPoint() | 0x80000000; + std::unique_ptr pDolLoader; + if (pContent->m_pData) + { + pDolLoader.reset(new CDolLoader(pContent->m_pData, pContent->m_Size)); + } + else + { + pDolLoader.reset(new CDolLoader(pContent->m_Filename.c_str())); + } + pDolLoader->Load(); + PC = pDolLoader->GetEntryPoint() | 0x80000000; // Pass the "#002 check" // Apploader should write the IOS version and revision to 0x3140, and compare it 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 3bbd4296e8..a0de1ce9c6 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 @@ -847,12 +847,19 @@ bool CWII_IPC_HLE_Device_es::IOCtlV(u32 _CommandAddress) if (pContent) { LoadWAD(Common::GetTitleContentPath(TitleID)); - CDolLoader DolLoader(pContent->m_pData, pContent->m_Size); - DolLoader.Load(); // TODO: Check why sysmenu does not load the DOL correctly - PC = DolLoader.GetEntryPoint() | 0x80000000; + std::unique_ptr pDolLoader; + if (pContent->m_pData) + { + pDolLoader.reset(new CDolLoader(pContent->m_pData, pContent->m_Size)); + } + else + { + pDolLoader.reset(new CDolLoader(pContent->m_Filename.c_str())); + } + pDolLoader->Load(); // TODO: Check why sysmenu does not load the DOL correctly + PC = pDolLoader->GetEntryPoint() | 0x80000000; IOSv = ContentLoader.GetIosVersion(); bSuccess = true; - } } } From 22f57cf07a4953da679cb3f35be184372aa37fd7 Mon Sep 17 00:00:00 2001 From: "Jasper St. Pierre" Date: Fri, 23 Aug 2013 20:24:45 -0400 Subject: [PATCH 24/33] NetPlay: Don't bother with the host's controller settings Use the pad mapping to calculate the number of devices we want, and add them on each client when we get the message. --- Source/Core/Core/Src/HW/SI.cpp | 6 ++---- Source/Core/Core/Src/NetPlayClient.cpp | 17 +++++++++++++++-- Source/Core/Core/Src/NetPlayClient.h | 1 + Source/Core/Core/Src/NetPlayProto.h | 1 - Source/Core/Core/Src/NetPlayServer.cpp | 2 -- Source/Core/DolphinWX/Src/NetWindow.cpp | 4 ---- 6 files changed, 18 insertions(+), 13 deletions(-) diff --git a/Source/Core/Core/Src/HW/SI.cpp b/Source/Core/Core/Src/HW/SI.cpp index 9142919346..5574ae536e 100644 --- a/Source/Core/Core/Src/HW/SI.cpp +++ b/Source/Core/Core/Src/HW/SI.cpp @@ -262,9 +262,7 @@ void Init() if (Movie::IsRecordingInput() || Movie::IsPlayingInput()) AddDevice(Movie::IsUsingPad(i) ? (Movie::IsUsingBongo(i) ? SIDEVICE_GC_TARUKONGA : SIDEVICE_GC_CONTROLLER) : SIDEVICE_NONE, i); - else if (NetPlay::IsNetPlayRunning()) - AddDevice((SIDevices) g_NetPlaySettings.m_Controllers[i], i); - else + else if (!NetPlay::IsNetPlayRunning()) AddDevice(SConfig::GetInstance().m_SIDevice[i], i); } @@ -567,7 +565,7 @@ void AddDevice(ISIDevice* pDevice) void AddDevice(const SIDevices _device, int _iDeviceNumber) { - ISIDevice* pDevice = SIDevice_Create(_device, _iDeviceNumber); + ISIDevice *pDevice = SIDevice_Create(_device, _iDeviceNumber); AddDevice(pDevice); } diff --git a/Source/Core/Core/Src/NetPlayClient.cpp b/Source/Core/Core/Src/NetPlayClient.cpp index fc8f005fad..46acca6b94 100644 --- a/Source/Core/Core/Src/NetPlayClient.cpp +++ b/Source/Core/Core/Src/NetPlayClient.cpp @@ -8,6 +8,7 @@ #include "IPC_HLE/WII_IPC_HLE_Device_usb.h" #include "IPC_HLE/WII_IPC_HLE_WiiMote.h" // for gcpad +#include "HW/SI.h" #include "HW/SI_DeviceGCController.h" #include "HW/SI_DeviceGCSteeringWheel.h" #include "HW/SI_DeviceDanceMat.h" @@ -187,6 +188,8 @@ unsigned int NetPlayClient::OnData(sf::Packet& packet) for (PadMapping i = 0; i < 4; i++) packet >> m_pad_map[i]; + UpdateDevices(); + m_dialog->Update(); } break; @@ -233,8 +236,6 @@ unsigned int NetPlayClient::OnData(sf::Packet& packet) packet >> g_NetPlaySettings.m_DSPEnableJIT; packet >> g_NetPlaySettings.m_DSPHLE; packet >> g_NetPlaySettings.m_WriteToMemcard; - for (unsigned int i = 0; i < 4; ++i) - packet >> g_NetPlaySettings.m_Controllers[i]; } m_dialog->OnMsgStartGame(); @@ -422,6 +423,8 @@ bool NetPlayClient::StartGame(const std::string &path) // boot game m_dialog->BootGame(path); + UpdateDevices(); + // temporary NetWiimote nw; for (unsigned int i = 0; i<4; ++i) @@ -437,6 +440,16 @@ bool NetPlayClient::ChangeGame(const std::string&) return true; } +// called from ---NETPLAY--- thread +void NetPlayClient::UpdateDevices() +{ + for (PadMapping i = 0; i < 4; i++) + { + // XXX: add support for other device types? does it matter? + SerialInterface::AddDevice(m_pad_map[i] > 0 ? SIDEVICE_GC_CONTROLLER : SIDEVICE_NONE, i); + } +} + // called from ---NETPLAY--- thread void NetPlayClient::ClearBuffers() { diff --git a/Source/Core/Core/Src/NetPlayClient.h b/Source/Core/Core/Src/NetPlayClient.h index 23529dbb95..59d5742b18 100644 --- a/Source/Core/Core/Src/NetPlayClient.h +++ b/Source/Core/Core/Src/NetPlayClient.h @@ -117,6 +117,7 @@ protected: PadMapping m_pad_map[4]; private: + void UpdateDevices(); void SendPadState(const PadMapping in_game_pad, const NetPad& np); unsigned int OnData(sf::Packet& packet); diff --git a/Source/Core/Core/Src/NetPlayProto.h b/Source/Core/Core/Src/NetPlayProto.h index 432b9766e5..02f6a2e96b 100644 --- a/Source/Core/Core/Src/NetPlayProto.h +++ b/Source/Core/Core/Src/NetPlayProto.h @@ -14,7 +14,6 @@ struct NetSettings bool m_DSPHLE; bool m_DSPEnableJIT; bool m_WriteToMemcard; - u8 m_Controllers[4]; }; struct Rpt : public std::vector diff --git a/Source/Core/Core/Src/NetPlayServer.cpp b/Source/Core/Core/Src/NetPlayServer.cpp index 0fd404ea03..d8f2a7dd09 100644 --- a/Source/Core/Core/Src/NetPlayServer.cpp +++ b/Source/Core/Core/Src/NetPlayServer.cpp @@ -441,8 +441,6 @@ bool NetPlayServer::StartGame(const std::string &path) spac << m_settings.m_DSPEnableJIT; spac << m_settings.m_DSPHLE; spac << m_settings.m_WriteToMemcard; - for (unsigned int i = 0; i < 4; ++i) - spac << m_settings.m_Controllers[i]; std::lock_guard lkp(m_crit.players); std::lock_guard lks(m_crit.send); diff --git a/Source/Core/DolphinWX/Src/NetWindow.cpp b/Source/Core/DolphinWX/Src/NetWindow.cpp index 7d50f42905..7bf3d9816d 100644 --- a/Source/Core/DolphinWX/Src/NetWindow.cpp +++ b/Source/Core/DolphinWX/Src/NetWindow.cpp @@ -107,7 +107,6 @@ NetPlaySetupDiag::NetPlaySetupDiag(wxWindow* const parent, const CGameListCtrl* " - DSP Emulator Engine Must be the same on all computers!\n" " - DSP on Dedicated Thread [OFF]\n" " - Framelimit NOT set to [Audio]\n" - " - Manually set the exact number of controllers to be used to [Standard Controller]\n" "\n" "All players should use the same Dolphin version and settings.\n" "All memory cards must be identical between players or disabled.\n" @@ -405,9 +404,6 @@ void NetPlayDiag::GetNetSettings(NetSettings &settings) settings.m_DSPHLE = instance.m_LocalCoreStartupParameter.bDSPHLE; settings.m_DSPEnableJIT = instance.m_EnableJIT; settings.m_WriteToMemcard = m_memcard_write->GetValue(); - - for (unsigned int i = 0; i < 4; ++i) - settings.m_Controllers[i] = SConfig::GetInstance().m_SIDevice[i]; } std::string NetPlayDiag::FindGame() From b11f14c6f7a80c4078485e59bdeac46a049fe169 Mon Sep 17 00:00:00 2001 From: Matthew Parlane Date: Sun, 1 Sep 2013 14:03:03 +1200 Subject: [PATCH 25/33] Fix setsockopt. --- .../Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_net.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) 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 cbb5b63d83..ab5d2225d9 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 @@ -767,14 +767,16 @@ bool CWII_IPC_HLE_Device_net_ip_top::IOCtl(u32 _CommandAddress) u8 optval[20]; Memory::ReadBigEData(optval, BufferIn + 0x10, optlen); - //TODO: bug booto about this, 0x2005 most likely timeout related, default value on wii is , 0x2001 is most likely tcpnodelay - if (level == 6 && (optname == 0x2005 || optname == 0x2001)){ - return 0; - } INFO_LOG(WII_IPC_NET, "IOCTL_SO_SETSOCKOPT(%08x, %08x, %08x, %08x) " "BufferIn: (%08x, %i), BufferOut: (%08x, %i)" "%02hhx %02hhx %02hhx %02hhx %02hhx %02hhx %02hhx %02hhx %02hhx %02hhx %02hhx %02hhx %02hhx %02hhx %02hhx %02hhx %02hhx %02hhx %02hhx %02hhx", fd, level, optname, optlen, BufferIn, BufferInSize, BufferOut, BufferOutSize, optval[0], optval[1], optval[2], optval[3], optval[4], optval[5], optval[6], optval[7], optval[8], optval[9], optval[10], optval[11], optval[12], optval[13], optval[14], optval[15], optval[16], optval[17], optval[18], optval[19]); + + //TODO: bug booto about this, 0x2005 most likely timeout related, default value on wii is , 0x2001 is most likely tcpnodelay + if (level == 6 && (optname == 0x2005 || optname == 0x2001)){ + ReturnValue = 0; + break; + } // Do the level/optname translation int nat_level = -1, nat_optname = -1; From 1c106abf13d7fbd0050d228a6f5967eaae12cd79 Mon Sep 17 00:00:00 2001 From: Matthew Parlane Date: Sun, 1 Sep 2013 14:30:07 +1200 Subject: [PATCH 26/33] Fix sendto. This fixes Opera, sorry [SS] --- Source/Core/Core/Src/IPC_HLE/WII_Socket.cpp | 34 ++++++++++----------- 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/Source/Core/Core/Src/IPC_HLE/WII_Socket.cpp b/Source/Core/Core/Src/IPC_HLE/WII_Socket.cpp index e8c7a5a1bd..5ab3b27b69 100644 --- a/Source/Core/Core/Src/IPC_HLE/WII_Socket.cpp +++ b/Source/Core/Core/Src/IPC_HLE/WII_Socket.cpp @@ -412,26 +412,25 @@ void WiiSocket::update(bool read, bool write, bool except) { case IOCTLV_SO_SENDTO: { - + + u32 flags = Memory::Read_U32(BufferIn2 + 4); + u32 has_destaddr = Memory::Read_U32(BufferIn2 + 0x08); char * data = (char*)Memory::GetPointer(BufferIn); - u32 flags = Common::swap32(BufferIn2 + 0x04); - u32 has_destaddr = Common::swap32(BufferIn2 + 0x08); + // Act as non blocking when SO_MSG_NONBLOCK is specified forceNonBlock = ((flags & SO_MSG_NONBLOCK) == SO_MSG_NONBLOCK); - // send/sendto only handles MSG_OOB flags &= SO_MSG_OOB; - u8 destaddr[28]; - struct sockaddr_in* addr = (struct sockaddr_in*)&destaddr; + sockaddr_in local_name; if (has_destaddr) - { - Memory::ReadBigEData((u8*)&destaddr, BufferIn2 + 0x0C, BufferInSize2 - 0x0C); - addr->sin_family = addr->sin_family >> 8; + { + WiiSockAddrIn* wii_name = (WiiSockAddrIn*)Memory::GetPointer(BufferIn2 + 0x0C); + WiiSockMan::Convert(*wii_name, local_name); } int ret = sendto(fd, data, BufferInSize, flags, - has_destaddr ? (struct sockaddr*)addr : NULL, + has_destaddr ? (struct sockaddr*)&local_name : NULL, has_destaddr ? sizeof(sockaddr) : 0); ReturnValue = WiiSockMan::getNetErrorCode(ret, "SO_SENDTO", true); @@ -440,16 +439,15 @@ void WiiSocket::update(bool read, bool write, bool except) has_destaddr ? "IOCTLV_SO_SENDTO " : "IOCTLV_SO_SEND ", ReturnValue, fd, BufferIn, BufferInSize, BufferIn2, BufferInSize2, - addr->sin_addr.s_addr & 0xFF, - (addr->sin_addr.s_addr >> 8) & 0xFF, - (addr->sin_addr.s_addr >> 16) & 0xFF, - (addr->sin_addr.s_addr >> 24) & 0xFF + local_name.sin_addr.s_addr & 0xFF, + (local_name.sin_addr.s_addr >> 8) & 0xFF, + (local_name.sin_addr.s_addr >> 16) & 0xFF, + (local_name.sin_addr.s_addr >> 24) & 0xFF ); break; } case IOCTLV_SO_RECVFROM: { - u32 sock = Memory::Read_U32(BufferIn); u32 flags = Memory::Read_U32(BufferIn + 4); char *buf = (char *)Memory::GetPointer(BufferOut); @@ -471,12 +469,12 @@ void WiiSocket::update(bool read, bool write, bool except) #ifdef _WIN32 if (flags & MSG_PEEK){ unsigned long totallen = 0; - ioctlsocket(sock, FIONREAD, &totallen); + ioctlsocket(fd, FIONREAD, &totallen); ReturnValue = totallen; break; } #endif - int ret = recvfrom(sock, buf, len, flags, + int ret = recvfrom(fd, buf, len, flags, fromlen ? (struct sockaddr*) &addr : NULL, fromlen ? &fromlen : 0); ReturnValue = WiiSockMan::getNetErrorCode(ret, fromlen ? "SO_RECVFROM" : "SO_RECV", true); @@ -486,7 +484,7 @@ void WiiSocket::update(bool read, bool write, bool except) "BufferIn: (%08x, %i), BufferIn2: (%08x, %i), " "BufferOut: (%08x, %i), BufferOut2: (%08x, %i)", fromlen ? "IOCTLV_SO_RECVFROM " : "IOCTLV_SO_RECV ", - ReturnValue, buf, sock, flags, + ReturnValue, buf, fd, flags, BufferIn, BufferInSize, BufferIn2, BufferInSize2, BufferOut, BufferOutSize, BufferOut2, BufferOutSize2); From ffe710b4e8e002beeb4b801d7d6f1d1febde9cb9 Mon Sep 17 00:00:00 2001 From: Matthew Parlane Date: Sun, 1 Sep 2013 15:15:55 +1200 Subject: [PATCH 27/33] Recvfrom tidy and store laste error. --- .../Src/IPC_HLE/WII_IPC_HLE_Device_net.cpp | 7 ++ Source/Core/Core/Src/IPC_HLE/WII_Socket.cpp | 77 +++++++++++-------- Source/Core/Core/Src/IPC_HLE/WII_Socket.h | 5 +- 3 files changed, 55 insertions(+), 34 deletions(-) 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 ab5d2225d9..df762a8358 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 @@ -755,6 +755,13 @@ bool CWII_IPC_HLE_Device_net_ip_top::IOCtl(u32 _CommandAddress) s32 errorcode = Memory::Read_U32(BufferOut + 0x10); INFO_LOG(WII_IPC_NET,"IOCTL_SO_GETSOCKOPT error code = %i", errorcode); } + else if (optname == SO_ERROR) + { + s32 last_error = WiiSockMan::getInstance().getLastNetError(); + + Memory::Write_U32(sizeof(s32), BufferOut + 0xC); + Memory::Write_U32(last_error, BufferOut + 0x10); + } break; } diff --git a/Source/Core/Core/Src/IPC_HLE/WII_Socket.cpp b/Source/Core/Core/Src/IPC_HLE/WII_Socket.cpp index 5ab3b27b69..864030b7f5 100644 --- a/Source/Core/Core/Src/IPC_HLE/WII_Socket.cpp +++ b/Source/Core/Core/Src/IPC_HLE/WII_Socket.cpp @@ -37,21 +37,9 @@ char* WiiSockMan::DecodeError(s32 ErrorCode) #endif } - -s32 WiiSockMan::getNetErrorCode(s32 ret, std::string caller, bool isRW) +s32 translateErrorCode(s32 native_error, bool isRW) { -#ifdef _WIN32 - s32 errorCode = WSAGetLastError(); -#else - s32 errorCode = errno; -#endif - if (ret >= 0) - return ret; - - DEBUG_LOG(WII_IPC_NET, "%s failed with error %d: %s, ret= %d", - caller.c_str(), errorCode, DecodeError(errorCode), ret); - - switch (errorCode) + switch (native_error) { case ERRORCODE(EMSGSIZE): ERROR_LOG(WII_IPC_NET, "Find out why this happened, looks like PEEK failure?"); @@ -87,7 +75,29 @@ s32 WiiSockMan::getNetErrorCode(s32 ret, std::string caller, bool isRW) default: return -1; } +} +s32 WiiSockMan::getNetErrorCode(s32 ret, std::string caller, bool isRW) +{ +#ifdef _WIN32 + s32 errorCode = WSAGetLastError(); +#else + s32 errorCode = errno; +#endif + + if (ret >= 0) + { + WiiSockMan::getInstance().setLastNetError(ret); + return ret; + } + + INFO_LOG(WII_IPC_NET, "%s failed with error %d: %s, ret= %d", + caller.c_str(), errorCode, DecodeError(errorCode), ret); + + s32 ReturnValue = translateErrorCode(errorCode, isRW); + WiiSockMan::getInstance().setLastNetError(ReturnValue); + + return ReturnValue; } WiiSocket::~WiiSocket() @@ -413,7 +423,7 @@ void WiiSocket::update(bool read, bool write, bool except) case IOCTLV_SO_SENDTO: { - u32 flags = Memory::Read_U32(BufferIn2 + 4); + u32 flags = Memory::Read_U32(BufferIn2 + 0x04); u32 has_destaddr = Memory::Read_U32(BufferIn2 + 0x08); char * data = (char*)Memory::GetPointer(BufferIn); @@ -448,50 +458,51 @@ void WiiSocket::update(bool read, bool write, bool except) } case IOCTLV_SO_RECVFROM: { - u32 flags = Memory::Read_U32(BufferIn + 4); - - char *buf = (char *)Memory::GetPointer(BufferOut); - int len = BufferOutSize; - struct sockaddr_in addr; - memset(&addr, 0, sizeof(sockaddr_in)); - socklen_t fromlen = 0; + u32 flags = Memory::Read_U32(BufferIn + 0x04); + char * data = (char *)Memory::GetPointer(BufferOut); + int data_len = BufferOutSize; + + sockaddr_in local_name; + memset(&local_name, 0, sizeof(sockaddr_in)); if (BufferOutSize2 != 0) { - fromlen = BufferOutSize2 >= sizeof(struct sockaddr) ? BufferOutSize2 : sizeof(struct sockaddr); + WiiSockAddrIn* wii_name = (WiiSockAddrIn*)Memory::GetPointer(BufferOut2); + WiiSockMan::Convert(*wii_name, local_name); } // Act as non blocking when SO_MSG_NONBLOCK is specified forceNonBlock = ((flags & SO_MSG_NONBLOCK) == SO_MSG_NONBLOCK); - // recv/recvfrom only handles PEEK + // recv/recvfrom only handles PEEK/OOB flags &= SO_MSG_PEEK | SO_MSG_OOB; #ifdef _WIN32 - if (flags & MSG_PEEK){ + if (flags & SO_MSG_PEEK){ unsigned long totallen = 0; ioctlsocket(fd, FIONREAD, &totallen); ReturnValue = totallen; break; } #endif - int ret = recvfrom(fd, buf, len, flags, - fromlen ? (struct sockaddr*) &addr : NULL, - fromlen ? &fromlen : 0); - ReturnValue = WiiSockMan::getNetErrorCode(ret, fromlen ? "SO_RECVFROM" : "SO_RECV", true); + socklen_t addrlen = sizeof(sockaddr_in); + int ret = recvfrom(fd, data, data_len, flags, + BufferOutSize2 ? (struct sockaddr*) &local_name : NULL, + BufferOutSize2 ? &addrlen : 0); + ReturnValue = WiiSockMan::getNetErrorCode(ret, BufferOutSize2 ? "SO_RECVFROM" : "SO_RECV", true); INFO_LOG(WII_IPC_NET, "%s(%d, %p) Socket: %08X, Flags: %08X, " "BufferIn: (%08x, %i), BufferIn2: (%08x, %i), " "BufferOut: (%08x, %i), BufferOut2: (%08x, %i)", - fromlen ? "IOCTLV_SO_RECVFROM " : "IOCTLV_SO_RECV ", - ReturnValue, buf, fd, flags, + BufferOutSize2 ? "IOCTLV_SO_RECVFROM " : "IOCTLV_SO_RECV ", + ReturnValue, data, fd, flags, BufferIn, BufferInSize, BufferIn2, BufferInSize2, BufferOut, BufferOutSize, BufferOut2, BufferOutSize2); if (BufferOutSize2 != 0) { - addr.sin_family = (addr.sin_family << 8) | (BufferOutSize2&0xFF); - Memory::WriteBigEData((u8*)&addr, BufferOut2, BufferOutSize2); + WiiSockAddrIn* wii_name = (WiiSockAddrIn*)Memory::GetPointer(BufferOut2); + WiiSockMan::Convert(local_name, *wii_name, addrlen); } break; } diff --git a/Source/Core/Core/Src/IPC_HLE/WII_Socket.h b/Source/Core/Core/Src/IPC_HLE/WII_Socket.h index 717724f313..cc2eb7fef8 100644 --- a/Source/Core/Core/Src/IPC_HLE/WII_Socket.h +++ b/Source/Core/Core/Src/IPC_HLE/WII_Socket.h @@ -212,6 +212,8 @@ public: s32 newSocket(s32 af, s32 type, s32 protocol); void addSocket(s32 fd); s32 delSocket(s32 s); + s32 getLastNetError() {return errono_last;} + void setLastNetError(s32 error) {errono_last = error;} void clean() { @@ -238,8 +240,9 @@ private: WiiSockMan() {}; // Constructor? (the {} brackets) are needed here. WiiSockMan(WiiSockMan const&); // Don't Implement void operator=(WiiSockMan const&); // Don't implement - std::unordered_map WiiSockets; + + s32 errono_last; }; #endif From 3e049a130b2e09846521ac5d8fc8867a24466d86 Mon Sep 17 00:00:00 2001 From: "Jasper St. Pierre" Date: Sat, 31 Aug 2013 22:38:26 -0400 Subject: [PATCH 28/33] NetPlay: bump proto As it changed with the pad mapping change. --- Source/Core/Core/Src/NetPlayProto.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Core/Core/Src/NetPlayProto.h b/Source/Core/Core/Src/NetPlayProto.h index 02f6a2e96b..550c7eb2f7 100644 --- a/Source/Core/Core/Src/NetPlayProto.h +++ b/Source/Core/Core/Src/NetPlayProto.h @@ -23,7 +23,7 @@ struct Rpt : public std::vector typedef std::vector NetWiimote; -#define NETPLAY_VERSION "Dolphin NetPlay 2013-08-23" +#define NETPLAY_VERSION "Dolphin NetPlay 2013-08-31" // messages enum From 5209abeb03a6c8ead889d92128a17b3e474fedb2 Mon Sep 17 00:00:00 2001 From: comex Date: Sat, 31 Aug 2013 23:39:26 -0400 Subject: [PATCH 29/33] Better error reporting for ES / NANDContentLoader. --- .../Src/IPC_HLE/WII_IPC_HLE_Device_es.cpp | 24 +++++++++++++++---- Source/Core/DiscIO/Src/NANDContentLoader.cpp | 12 ++++++---- 2 files changed, 27 insertions(+), 9 deletions(-) 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 a0de1ce9c6..21a9c94c82 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 @@ -197,7 +197,15 @@ bool CWII_IPC_HLE_Device_es::Close(u32 _CommandAddress, bool _bForce) u32 CWII_IPC_HLE_Device_es::OpenTitleContent(u32 CFD, u64 TitleID, u16 Index) { - const DiscIO::SNANDContent* pContent = AccessContentDevice(TitleID).GetContentByIndex(Index); + const DiscIO::INANDContentLoader& Loader = AccessContentDevice(TitleID); + + if (!Loader.IsValid()) + { + WARN_LOG(WII_IPC_ES, "ES: loader not valid for %llx", TitleID); + return 0xffffffff; + } + + const DiscIO::SNANDContent* pContent = Loader.GetContentByIndex(Index); if (pContent == NULL) { @@ -375,7 +383,8 @@ bool CWII_IPC_HLE_Device_es::IOCtlV(u32 _CommandAddress) if (Size > 0) { - if (pDest) { + if (pDest) + { if (rContent.m_pContent->m_pData) { u8* pSrc = &rContent.m_pContent->m_pData[rContent.m_Position]; @@ -384,8 +393,15 @@ bool CWII_IPC_HLE_Device_es::IOCtlV(u32 _CommandAddress) else { File::IOFile* pFile = &rContent.m_File; - pFile->Seek(rContent.m_Position, SEEK_SET); - pFile->ReadBytes(pDest, Size); + if (!pFile->Seek(rContent.m_Position, SEEK_SET)) + { + ERROR_LOG(WII_IPC_ES, "ES: couldn't seek!"); + } + WARN_LOG(WII_IPC_ES, "2 %p", pFile->GetHandle()); + if (!pFile->ReadBytes(pDest, Size)) + { + ERROR_LOG(WII_IPC_ES, "ES: short read; returning uninitialized data!"); + } } rContent.m_Position += Size; } else { diff --git a/Source/Core/DiscIO/Src/NANDContentLoader.cpp b/Source/Core/DiscIO/Src/NANDContentLoader.cpp index b0dcd302f7..974f8a9945 100644 --- a/Source/Core/DiscIO/Src/NANDContentLoader.cpp +++ b/Source/Core/DiscIO/Src/NANDContentLoader.cpp @@ -213,8 +213,8 @@ bool CNANDContentLoader::Initialize(const std::string& _rName) File::IOFile pTMDFile(TMDFileName, "rb"); if (!pTMDFile) { - DEBUG_LOG(DISCIO, "CreateFromDirectory: error opening %s", - TMDFileName.c_str()); + WARN_LOG(DISCIO, "CreateFromDirectory: error opening %s", + TMDFileName.c_str()); return false; } u32 pTMDSize = (u32)File::GetSize(TMDFileName); @@ -222,8 +222,7 @@ bool CNANDContentLoader::Initialize(const std::string& _rName) pTMDFile.ReadBytes(pTMD, (size_t)pTMDSize); pTMDFile.Close(); } - if (!pTMD) - return false; + memcpy(m_TMDView, pTMD + 0x180, TMD_VIEW_SIZE); memcpy(m_TMDHeader, pTMD, TMD_HEADER_SIZE); @@ -276,7 +275,10 @@ bool CNANDContentLoader::Initialize(const std::string& _rName) } // Be graceful about incorrect tmds. - rContent.m_Size = (u32) File::GetSize(rContent.m_Filename); + if (File::Exists(rContent.m_Filename)) + { + rContent.m_Size = (u32) File::GetSize(rContent.m_Filename); + } } delete [] pTMD; From a6f6695ecd9370fd4a0edc710fd7ac50b34c5875 Mon Sep 17 00:00:00 2001 From: comex Date: Sat, 31 Aug 2013 23:44:26 -0400 Subject: [PATCH 30/33] Work around MSVC bug, and make it less likely to happen again. Ew. MSVC insisted on using a copy assignment where a move was intended and ought to be used. This would have been caught, because the class in question inherits from NonCopyable, which declares a move assignment operator, which is supposed to delete the implicitly declared copy assignment operator, but of course MSVC didn't do that either, causing a class that should have been safe to be unsafe. --- Source/Core/Common/Src/Common.h | 3 +++ Source/Core/Common/Src/FileUtil.cpp | 2 +- Source/Core/Common/Src/FileUtil.h | 3 +++ .../Src/IPC_HLE/WII_IPC_HLE_Device_es.cpp | 24 ++++++++++++++----- .../Core/Src/IPC_HLE/WII_IPC_HLE_Device_es.h | 6 +++-- 5 files changed, 29 insertions(+), 9 deletions(-) diff --git a/Source/Core/Common/Src/Common.h b/Source/Core/Common/Src/Common.h index eb0679d358..e148b6638c 100644 --- a/Source/Core/Common/Src/Common.h +++ b/Source/Core/Common/Src/Common.h @@ -37,6 +37,9 @@ protected: NonCopyable() {} NonCopyable(const NonCopyable&&) {} void operator=(const NonCopyable&&) {} +private: + NonCopyable(NonCopyable&); + NonCopyable& operator=(NonCopyable& other); }; #endif diff --git a/Source/Core/Common/Src/FileUtil.cpp b/Source/Core/Common/Src/FileUtil.cpp index 24f853c0c4..8792321bf0 100644 --- a/Source/Core/Common/Src/FileUtil.cpp +++ b/Source/Core/Common/Src/FileUtil.cpp @@ -853,7 +853,7 @@ IOFile::IOFile(IOFile&& other) IOFile& IOFile::operator=(IOFile&& other) { - IOFile((IOFile&&)other).Swap(*this); + Swap(other); return *this; } diff --git a/Source/Core/Common/Src/FileUtil.h b/Source/Core/Common/Src/FileUtil.h index b0391f4b74..40aba0037d 100644 --- a/Source/Core/Common/Src/FileUtil.h +++ b/Source/Core/Common/Src/FileUtil.h @@ -211,6 +211,9 @@ public: std::FILE* m_file; bool m_good; +private: + IOFile(IOFile&); + IOFile& operator=(IOFile& other); }; } // namespace 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 21a9c94c82..dcad297f7d 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 @@ -182,6 +182,10 @@ 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(); + for (auto itr = m_ContentAccessMap.begin(); itr != m_ContentAccessMap.end(); ++itr) + { + delete itr->second.m_pFile; + } m_ContentAccessMap.clear(); m_pContentLoader = NULL; m_TitleIDs.clear(); @@ -222,15 +226,15 @@ u32 CWII_IPC_HLE_Device_es::OpenTitleContent(u32 CFD, u64 TitleID, u16 Index) std::string Filename = pContent->m_Filename; INFO_LOG(WII_IPC_ES, "ES: load %s", Filename.c_str()); - Access.m_File.Open(Filename, "rb"); - if (!Access.m_File.IsGood()) + Access.m_pFile = new File::IOFile(Filename, "rb"); + if (!Access.m_pFile->IsGood()) { WARN_LOG(WII_IPC_ES, "ES: couldn't load %s", Filename.c_str()); return 0xffffffff; } } - m_ContentAccessMap[CFD] = std::move(Access); + m_ContentAccessMap[CFD] = Access; return CFD; } @@ -392,7 +396,7 @@ bool CWII_IPC_HLE_Device_es::IOCtlV(u32 _CommandAddress) } else { - File::IOFile* pFile = &rContent.m_File; + auto& pFile = rContent.m_pFile; if (!pFile->Seek(rContent.m_Position, SEEK_SET)) { ERROR_LOG(WII_IPC_ES, "ES: couldn't seek!"); @@ -423,10 +427,18 @@ bool CWII_IPC_HLE_Device_es::IOCtlV(u32 _CommandAddress) u32 CFD = Memory::Read_U32(Buffer.InBuffer[0].m_Address); - m_ContentAccessMap.erase(CFD); - INFO_LOG(WII_IPC_ES, "IOCTL_ES_CLOSECONTENT: CFD %x", CFD); + auto itr = m_ContentAccessMap.find(CFD); + if (itr == m_ContentAccessMap.end()) + { + Memory::Write_U32(-1, _CommandAddress + 0x4); + return true; + } + + delete itr->second.m_pFile; + m_ContentAccessMap.erase(itr); + Memory::Write_U32(0, _CommandAddress + 0x4); return true; } 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 f77cea969c..ddc1f3613f 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 @@ -8,6 +8,7 @@ #include #include "WII_IPC_HLE_Device.h" #include "NANDContentLoader.h" +#include class CWII_IPC_HLE_Device_es : public IWII_IPC_HLE_Device { @@ -112,12 +113,13 @@ private: ES_HASH_SIZE_WRONG = -2014, // HASH !=20 }; - struct SContentAccess : public NonCopyable + struct SContentAccess { u32 m_Position; u64 m_TitleID; const DiscIO::SNANDContent* m_pContent; - File::IOFile m_File; + // This is a (raw) pointer to work around a MSVC bug. + File::IOFile* m_pFile; }; typedef std::map CContentAccessMap; From b03ff7a86b66435da4a6c65da6afaafce8e1a7bb Mon Sep 17 00:00:00 2001 From: Ryan Houdek Date: Sun, 1 Sep 2013 01:10:12 -0500 Subject: [PATCH 31/33] [Android] Fix the game thread never leaving. --- Source/Core/DolphinWX/Src/MainAndroid.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/Source/Core/DolphinWX/Src/MainAndroid.cpp b/Source/Core/DolphinWX/Src/MainAndroid.cpp index c9446acda5..8fcab598cc 100644 --- a/Source/Core/DolphinWX/Src/MainAndroid.cpp +++ b/Source/Core/DolphinWX/Src/MainAndroid.cpp @@ -200,6 +200,7 @@ JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_PauseEmulati JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_StopEmulation(JNIEnv *env, jobject obj) { PowerPC::Stop(); + updateMainFrameEvent.Set(); // Kick the waiting event } JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_onTouchEvent(JNIEnv *env, jobject obj, jint Action, jfloat X, jfloat Y) { From 440ae412b048a5686cb2197ff67f83166ec1541b Mon Sep 17 00:00:00 2001 From: Lioncash Date: Sun, 1 Sep 2013 03:07:16 -0400 Subject: [PATCH 32/33] [Android] Add the option to show the on-screen FPS counter. --- Source/Android/res/values-ja/strings.xml | 2 + Source/Android/res/values/strings.xml | 2 + Source/Android/res/xml/video_prefs.xml | 55 ++++++++++--------- .../dolphinemu/settings/UserPreferences.java | 7 ++- 4 files changed, 40 insertions(+), 26 deletions(-) diff --git a/Source/Android/res/values-ja/strings.xml b/Source/Android/res/values-ja/strings.xml index 71cdcd47b3..9e53c0a9c7 100644 --- a/Source/Android/res/values-ja/strings.xml +++ b/Source/Android/res/values-ja/strings.xml @@ -80,6 +80,8 @@ OpenGL ES 3 ビデオレンダラ 使用するビデオレンダラー + FPSを表示 + エミュレーション速度の指標として、画面左上に毎秒レンダリングされた フレーム数を表示します。 画面上のコントロールを描画 画質向上の設定 diff --git a/Source/Android/res/values/strings.xml b/Source/Android/res/values/strings.xml index 99522f5f00..bf9fd9eaa1 100644 --- a/Source/Android/res/values/strings.xml +++ b/Source/Android/res/values/strings.xml @@ -80,6 +80,8 @@ OpenGL ES 3 Video Backend Video backend to use + Show FPS + Show the number of frames rendered per second as a measure of emulation speed. Draw on-screen controls Enhancements diff --git a/Source/Android/res/xml/video_prefs.xml b/Source/Android/res/xml/video_prefs.xml index ec0c1837f7..6ec29c13a0 100644 --- a/Source/Android/res/xml/video_prefs.xml +++ b/Source/Android/res/xml/video_prefs.xml @@ -3,66 +3,66 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - + + - + - + - + - + - + + android:key="gpuPref" + android:summary="@string/video_backend_to_use" + android:title="@string/video_backend" /> + + Date: Sun, 1 Sep 2013 15:20:15 -0400 Subject: [PATCH 33/33] [Android] Disable most video preferences if Software Rendering is chosen. Since the software renderer and other renderers have little in common, it doesn't make sense to keep many of the video preferences enabled. --- .../settings/VideoSettingsFragment.java | 56 +++++++++++++++++++ 1 file changed, 56 insertions(+) diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/settings/VideoSettingsFragment.java b/Source/Android/src/org/dolphinemu/dolphinemu/settings/VideoSettingsFragment.java index b8e82f4dd0..fdaec5df01 100644 --- a/Source/Android/src/org/dolphinemu/dolphinemu/settings/VideoSettingsFragment.java +++ b/Source/Android/src/org/dolphinemu/dolphinemu/settings/VideoSettingsFragment.java @@ -16,9 +16,13 @@ import javax.microedition.khronos.opengles.GL10; import org.dolphinemu.dolphinemu.R; import android.app.Activity; +import android.content.SharedPreferences; +import android.content.SharedPreferences.OnSharedPreferenceChangeListener; import android.os.Bundle; import android.preference.ListPreference; import android.preference.PreferenceFragment; +import android.preference.PreferenceManager; +import android.preference.PreferenceScreen; /** * Responsible for handling the loading of the video preferences. @@ -195,6 +199,58 @@ public final class VideoSettingsFragment extends PreferenceFragment videoBackends.setEntries(R.array.videoBackendEntriesNoGLES3); videoBackends.setEntryValues(R.array.videoBackendValuesNoGLES3); } + + // + // Disable all options if Software Rendering is used. + // + // Note that the numeric value in 'getPreference()' + // denotes the placement on the UI. So if more elements are + // added to the video settings, these may need to change. + // + final SharedPreferences sPrefs = PreferenceManager.getDefaultSharedPreferences(getActivity()); + final PreferenceScreen mainScreen = getPreferenceScreen(); + + if (videoBackends.getValue().equals("Software Renderer")) + { + mainScreen.getPreference(0).setEnabled(false); + mainScreen.getPreference(1).setEnabled(false); + mainScreen.getPreference(3).setEnabled(false); + mainScreen.getPreference(4).setEnabled(false); + } + else if (videoBackends.getValue().equals("OGL")) + { + mainScreen.getPreference(0).setEnabled(true); + mainScreen.getPreference(1).setEnabled(true); + mainScreen.getPreference(3).setEnabled(true); + mainScreen.getPreference(4).setEnabled(true); + } + + // Also set a listener, so that if someone changes the video backend, it will disable + // the video settings, upon the user choosing "Software Rendering". + sPrefs.registerOnSharedPreferenceChangeListener(new OnSharedPreferenceChangeListener() + { + @Override + public void onSharedPreferenceChanged(SharedPreferences preference, String key) + { + if (key.equals("gpuPref")) + { + if (preference.getString(key, "Software Renderer").equals("Software Renderer")) + { + mainScreen.getPreference(0).setEnabled(false); + mainScreen.getPreference(1).setEnabled(false); + mainScreen.getPreference(3).setEnabled(false); + mainScreen.getPreference(4).setEnabled(false); + } + else if (preference.getString(key, "Software Renderer").equals("OGL")) + { + mainScreen.getPreference(0).setEnabled(true); + mainScreen.getPreference(1).setEnabled(true); + mainScreen.getPreference(3).setEnabled(true); + mainScreen.getPreference(4).setEnabled(true); + } + } + } + }); } @Override