mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-31 13:18:50 +00:00
Merge Upstream Dolphin code (#3)
* Debugger: Fix warning on Debian builder Fix "braces around scalar initializer [-Wbraced-scalar-init]" warning * Fix manual update check which was hardcoded to "dev" track * OGLRender: Log video backend info, in addition to showing it via OSD This is mainly intended for debugging fifo.ci. * FileUtil: Remove redundant statement * Qt/GeneralPane: Don't trigger config change events when populating GUI. * more stuff * buildbot from dolphin-mpn-src to dolphin-mpn-advanced-src * Fix Netplay Traversal Error * Update linux.yml * Update macos.yml * Update linux.yml * NANDImporter: Make a class variable for the NAND root * fix linux buildbot * rename binary automatically to dolphin-mpn * NANDImporter: Improve NANDFSTEntry `uid` is a u32, not a u16. Also, everything is big endian, so we can simplify the code a little bit. * NANDImporter: Reduce recursion in `ProcessEntry` It also simplifies the code flow, as it no longer goes backwards through the filesystem chain. * NANDImporter: Don't pass paths if we don't need to * NANDImporter: Make superblocks less magical Create a struct describing the superblock layout and use it directly without needing to specify offsets and such. * NANDImporter: Only read the AES key once There is no need to constantly reset the key for every file entry. * Common: Make DynamicLibrary non-copyable The default implementations of DynamicLibrary's copy and move constructors and assignment operators are unsafe. * minor fixes Co-authored-by: Dentomologist <dentomologist@gmail.com> Co-authored-by: Pierre Bourdon <delroth@gmail.com> Co-authored-by: Pokechu22 <Pokechu022@gmail.com> Co-authored-by: Admiral H. Curtiss <pikachu025@gmail.com> Co-authored-by: JosJuice <josjuice@gmail.com> Co-authored-by: Starsam80 <samraskauskas@gmail.com> Co-authored-by: Léo Lam <leo@leolam.fr>
This commit is contained in:
parent
d6098f5499
commit
b788d33717
13 changed files with 223 additions and 182 deletions
|
@ -24,6 +24,12 @@ public:
|
|||
// Closes the library.
|
||||
~DynamicLibrary();
|
||||
|
||||
DynamicLibrary(const DynamicLibrary&) = delete;
|
||||
DynamicLibrary(DynamicLibrary&&) = delete;
|
||||
|
||||
DynamicLibrary& operator=(const DynamicLibrary&) = delete;
|
||||
DynamicLibrary& operator=(DynamicLibrary&&) = delete;
|
||||
|
||||
// Returns the specified library name with the platform-specific suffix added.
|
||||
static std::string GetUnprefixedFilename(const char* filename);
|
||||
|
||||
|
|
|
@ -859,7 +859,6 @@ std::string GetExePath()
|
|||
}
|
||||
#elif defined(__APPLE__)
|
||||
result = GetBundleDirectory();
|
||||
result = result.substr(0, result.find_last_of("Dolphin.app/Contents/MacOS") + 1);
|
||||
#else
|
||||
char dolphin_exe_path[PATH_MAX];
|
||||
ssize_t len = ::readlink("/proc/self/exe", dolphin_exe_path, sizeof(dolphin_exe_path));
|
||||
|
|
|
@ -182,7 +182,7 @@ Common::Debug::Threads PPCDebugInterface::GetThreads() const
|
|||
if (!active_thread->IsValid())
|
||||
return threads;
|
||||
|
||||
std::vector<u32> visited_addrs{{active_thread->GetAddress()}};
|
||||
std::vector<u32> visited_addrs{active_thread->GetAddress()};
|
||||
const auto insert_threads = [&threads, &visited_addrs](u32 addr, auto get_next_addr) {
|
||||
while (addr != 0 && PowerPC::HostIsRAMAddress(addr))
|
||||
{
|
||||
|
|
|
@ -221,7 +221,9 @@ const mpn_board_t MP5_BOARDS[] = {{1, 0x76, {"Toy Dream"}, {"mp5-toy"}},
|
|||
{3, 0x7A, {"Pirate Dream"}, {"mp5-pirate"}},
|
||||
{4, 0x7C, {"Undersea Dream"}, {"mp5-undersea"}},
|
||||
{5, 0x7E, {"Future Dream"}, {"mp5-future"}},
|
||||
{6, 0x80, {"Bowser Nightmare"}, {"mp5-bowser"}},
|
||||
{6, 0x80, {"Sweet Dream"}, {"mp5-sweet"}},
|
||||
{7, 0x82, {"Bowser Nightmare"}, {"mp5-bowser"}},
|
||||
|
||||
|
||||
{NONE, NONE, {""}, ""}};
|
||||
|
||||
|
@ -318,7 +320,8 @@ const mpn_scene_t MP5_GAMESTATES[] = {{NONE, 0x01, {"Title Screen"}, 0},
|
|||
{NONE, 0x7A, {"Pirate Dream"}, 0},
|
||||
{NONE, 0x7C, {"Undersea Dream"}, 0},
|
||||
{NONE, 0x7E, {"Future Dream"}, 0},
|
||||
{NONE, 0x80, {"Bowser Nightmare"}, 0},
|
||||
{NONE, 0x80, {"Sweet Dream"}, 0},
|
||||
{NONE, 0x82, {"Bowser Nightmare"}, 0},
|
||||
|
||||
{NONE, NONE, {""}}};
|
||||
|
||||
|
|
|
@ -4,17 +4,13 @@
|
|||
#include "DiscIO/NANDImporter.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <array>
|
||||
#include <cstring>
|
||||
|
||||
#include <fmt/format.h>
|
||||
|
||||
#include "Common/Crypto/AES.h"
|
||||
#include "Common/FileUtil.h"
|
||||
#include "Common/IOFile.h"
|
||||
#include "Common/Logging/Log.h"
|
||||
#include "Common/MsgHandler.h"
|
||||
#include "Common/Swap.h"
|
||||
#include "Core/IOS/ES/Formats.h"
|
||||
|
||||
namespace DiscIO
|
||||
|
@ -22,7 +18,9 @@ namespace DiscIO
|
|||
constexpr size_t NAND_SIZE = 0x20000000;
|
||||
constexpr size_t NAND_KEYS_SIZE = 0x400;
|
||||
|
||||
NANDImporter::NANDImporter() = default;
|
||||
NANDImporter::NANDImporter() : m_nand_root(File::GetUserPath(D_WIIROOT_IDX))
|
||||
{
|
||||
}
|
||||
NANDImporter::~NANDImporter() = default;
|
||||
|
||||
void NANDImporter::ImportNANDBin(const std::string& path_to_bin,
|
||||
|
@ -33,15 +31,12 @@ void NANDImporter::ImportNANDBin(const std::string& path_to_bin,
|
|||
|
||||
if (!ReadNANDBin(path_to_bin, get_otp_dump_path))
|
||||
return;
|
||||
if (!FindSuperblock())
|
||||
return;
|
||||
|
||||
std::string nand_root = File::GetUserPath(D_WIIROOT_IDX);
|
||||
nand_root.pop_back(); // remove trailing path separator
|
||||
m_nand_root_length = nand_root.length();
|
||||
|
||||
FindSuperblock();
|
||||
ProcessEntry(0, nand_root);
|
||||
ExportKeys(nand_root);
|
||||
ExtractCertificates(nand_root);
|
||||
ExportKeys();
|
||||
ProcessEntry(0, "");
|
||||
ExtractCertificates();
|
||||
}
|
||||
|
||||
bool NANDImporter::ReadNANDBin(const std::string& path_to_bin,
|
||||
|
@ -93,32 +88,37 @@ bool NANDImporter::ReadNANDBin(const std::string& path_to_bin,
|
|||
return file.ReadBytes(m_nand_keys.data(), NAND_KEYS_SIZE);
|
||||
}
|
||||
|
||||
void NANDImporter::FindSuperblock()
|
||||
bool NANDImporter::FindSuperblock()
|
||||
{
|
||||
constexpr size_t NAND_SUPERBLOCK_START = 0x1fc00000;
|
||||
constexpr size_t NAND_SUPERBLOCK_SIZE = 0x40000;
|
||||
|
||||
size_t superblock = 0;
|
||||
u32 newest_version = 0;
|
||||
for (size_t pos = NAND_SUPERBLOCK_START; pos < NAND_SIZE; pos += NAND_SUPERBLOCK_SIZE)
|
||||
// There are 16 superblocks, choose the highest/newest version
|
||||
for (int i = 0; i < 16; i++)
|
||||
{
|
||||
if (!memcmp(m_nand.data() + pos, "SFFS", 4))
|
||||
auto superblock = std::make_unique<NANDSuperblock>();
|
||||
std::memcpy(superblock.get(), &m_nand[NAND_SUPERBLOCK_START + i * sizeof(NANDSuperblock)],
|
||||
sizeof(NANDSuperblock));
|
||||
|
||||
if (std::memcmp(superblock->magic, "SFFS", 4) != 0)
|
||||
{
|
||||
const u32 version = Common::swap32(&m_nand[pos + 4]);
|
||||
INFO_LOG_FMT(DISCIO, "Found superblock at {:#x} with version {:#x}", pos, version);
|
||||
if (superblock == 0 || version > newest_version)
|
||||
{
|
||||
superblock = pos;
|
||||
newest_version = version;
|
||||
}
|
||||
ERROR_LOG_FMT(DISCIO, "Superblock #{} does not exist", i);
|
||||
continue;
|
||||
}
|
||||
|
||||
INFO_LOG_FMT(DISCIO, "Superblock #{} has version {:#x}", i, superblock->version);
|
||||
|
||||
if (!m_superblock || superblock->version > m_superblock->version)
|
||||
m_superblock = std::move(superblock);
|
||||
}
|
||||
|
||||
m_nand_fat_offset = superblock + 0xC;
|
||||
m_nand_fst_offset = m_nand_fat_offset + 0x10000;
|
||||
INFO_LOG_FMT(DISCIO,
|
||||
"Using superblock version {:#x} at position {:#x}. FAT/FST offset: {:#x}/{:#x}",
|
||||
newest_version, superblock, m_nand_fat_offset, m_nand_fst_offset);
|
||||
if (!m_superblock)
|
||||
{
|
||||
PanicAlertFmtT("This file does not contain a valid Wii filesystem.");
|
||||
return false;
|
||||
}
|
||||
|
||||
INFO_LOG_FMT(DISCIO, "Using superblock version {:#x}", m_superblock->version);
|
||||
return true;
|
||||
}
|
||||
|
||||
std::string NANDImporter::GetPath(const NANDFSTEntry& entry, const std::string& parent_path)
|
||||
|
@ -131,76 +131,65 @@ std::string NANDImporter::GetPath(const NANDFSTEntry& entry, const std::string&
|
|||
return parent_path + '/' + name;
|
||||
}
|
||||
|
||||
std::string NANDImporter::FormatDebugString(const NANDFSTEntry& entry)
|
||||
{
|
||||
return fmt::format(
|
||||
"{:12.12} {:#04x} {:#04x} {:#06x} {:#06x} {:#010x} {:#06x} {:#06x} {:#06x} {:#010x}",
|
||||
entry.name, entry.mode, entry.attr, entry.sub, entry.sib, entry.size, entry.x1, entry.uid,
|
||||
entry.gid, entry.x3);
|
||||
}
|
||||
|
||||
void NANDImporter::ProcessEntry(u16 entry_number, const std::string& parent_path)
|
||||
{
|
||||
NANDFSTEntry entry;
|
||||
memcpy(&entry, &m_nand[m_nand_fst_offset + sizeof(NANDFSTEntry) * Common::swap16(entry_number)],
|
||||
sizeof(NANDFSTEntry));
|
||||
while (entry_number != 0xffff)
|
||||
{
|
||||
const NANDFSTEntry entry = m_superblock->fst[entry_number];
|
||||
|
||||
if (entry.sib != 0xffff)
|
||||
ProcessEntry(entry.sib, parent_path);
|
||||
const std::string path = GetPath(entry, parent_path);
|
||||
INFO_LOG_FMT(DISCIO, "Entry: {} Path: {}", entry, path);
|
||||
m_update_callback();
|
||||
|
||||
if ((entry.mode & 3) == 1)
|
||||
ProcessFile(entry, parent_path);
|
||||
else if ((entry.mode & 3) == 2)
|
||||
ProcessDirectory(entry, parent_path);
|
||||
else
|
||||
ERROR_LOG_FMT(DISCIO, "Unknown mode: {}", FormatDebugString(entry));
|
||||
Type type = static_cast<Type>(entry.mode & 3);
|
||||
if (type == Type::File)
|
||||
{
|
||||
std::vector<u8> data = GetEntryData(entry);
|
||||
File::IOFile file(m_nand_root + path, "wb");
|
||||
file.WriteBytes(data.data(), data.size());
|
||||
}
|
||||
else if (type == Type::Directory)
|
||||
{
|
||||
File::CreateDir(m_nand_root + path);
|
||||
ProcessEntry(entry.sub, path);
|
||||
}
|
||||
else
|
||||
{
|
||||
ERROR_LOG_FMT(DISCIO, "Ignoring unknown entry type for {}", entry);
|
||||
}
|
||||
|
||||
entry_number = entry.sib;
|
||||
}
|
||||
}
|
||||
|
||||
void NANDImporter::ProcessDirectory(const NANDFSTEntry& entry, const std::string& parent_path)
|
||||
std::vector<u8> NANDImporter::GetEntryData(const NANDFSTEntry& entry)
|
||||
{
|
||||
m_update_callback();
|
||||
INFO_LOG_FMT(DISCIO, "Path: {}", FormatDebugString(entry));
|
||||
|
||||
const std::string path = GetPath(entry, parent_path);
|
||||
File::CreateDir(path);
|
||||
|
||||
if (entry.sub != 0xffff)
|
||||
ProcessEntry(entry.sub, path);
|
||||
|
||||
INFO_LOG_FMT(DISCIO, "Path: {}", parent_path.data() + m_nand_root_length);
|
||||
}
|
||||
|
||||
void NANDImporter::ProcessFile(const NANDFSTEntry& entry, const std::string& parent_path)
|
||||
{
|
||||
constexpr size_t NAND_AES_KEY_OFFSET = 0x158;
|
||||
constexpr size_t NAND_FAT_BLOCK_SIZE = 0x4000;
|
||||
|
||||
m_update_callback();
|
||||
INFO_LOG_FMT(DISCIO, "File: {}", FormatDebugString(entry));
|
||||
|
||||
const std::string path = GetPath(entry, parent_path);
|
||||
File::IOFile file(path, "wb");
|
||||
std::array<u8, 16> key{};
|
||||
std::copy(&m_nand_keys[NAND_AES_KEY_OFFSET], &m_nand_keys[NAND_AES_KEY_OFFSET + key.size()],
|
||||
key.begin());
|
||||
u16 sub = Common::swap16(entry.sub);
|
||||
u32 remaining_bytes = Common::swap32(entry.size);
|
||||
u16 sub = entry.sub;
|
||||
size_t remaining_bytes = entry.size;
|
||||
std::vector<u8> data{};
|
||||
data.reserve(remaining_bytes);
|
||||
|
||||
while (remaining_bytes > 0)
|
||||
{
|
||||
std::array<u8, 16> iv{};
|
||||
std::vector<u8> block = Common::AES::Decrypt(
|
||||
key.data(), iv.data(), &m_nand[NAND_FAT_BLOCK_SIZE * sub], NAND_FAT_BLOCK_SIZE);
|
||||
u32 size = remaining_bytes < NAND_FAT_BLOCK_SIZE ? remaining_bytes : NAND_FAT_BLOCK_SIZE;
|
||||
file.WriteBytes(block.data(), size);
|
||||
m_aes_key.data(), iv.data(), &m_nand[NAND_FAT_BLOCK_SIZE * sub], NAND_FAT_BLOCK_SIZE);
|
||||
|
||||
size_t size = std::min(remaining_bytes, block.size());
|
||||
data.insert(data.end(), block.begin(), block.begin() + size);
|
||||
remaining_bytes -= size;
|
||||
sub = Common::swap16(&m_nand[m_nand_fat_offset + 2 * sub]);
|
||||
|
||||
sub = m_superblock->fat[sub];
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
bool NANDImporter::ExtractCertificates(const std::string& nand_root)
|
||||
bool NANDImporter::ExtractCertificates()
|
||||
{
|
||||
const std::string content_dir = nand_root + "/title/00000001/0000000d/content/";
|
||||
const std::string content_dir = m_nand_root + "/title/00000001/0000000d/content/";
|
||||
|
||||
File::IOFile tmd_file(content_dir + "title.tmd", "rb");
|
||||
std::vector<u8> tmd_bytes(tmd_file.GetSize());
|
||||
|
@ -251,7 +240,7 @@ bool NANDImporter::ExtractCertificates(const std::string& nand_root)
|
|||
return false;
|
||||
}
|
||||
|
||||
const std::string pem_file_path = nand_root + std::string(certificate.filename);
|
||||
const std::string pem_file_path = m_nand_root + std::string(certificate.filename);
|
||||
const ptrdiff_t certificate_offset = std::distance(content_bytes.begin(), search_result);
|
||||
const u16 certificate_size = Common::swap16(&content_bytes[certificate_offset - 2]);
|
||||
INFO_LOG_FMT(DISCIO, "ExtractCertificates: '{}' offset: {:#x} size: {:#x}",
|
||||
|
@ -267,9 +256,13 @@ bool NANDImporter::ExtractCertificates(const std::string& nand_root)
|
|||
return true;
|
||||
}
|
||||
|
||||
void NANDImporter::ExportKeys(const std::string& nand_root)
|
||||
void NANDImporter::ExportKeys()
|
||||
{
|
||||
const std::string file_path = nand_root + "/keys.bin";
|
||||
constexpr size_t NAND_AES_KEY_OFFSET = 0x158;
|
||||
|
||||
std::copy_n(&m_nand_keys[NAND_AES_KEY_OFFSET], m_aes_key.size(), m_aes_key.begin());
|
||||
|
||||
const std::string file_path = m_nand_root + "/keys.bin";
|
||||
File::IOFile file(file_path, "wb");
|
||||
if (!file.WriteBytes(m_nand_keys.data(), NAND_KEYS_SIZE))
|
||||
PanicAlertFmtT("Unable to write to file {0}", file_path);
|
||||
|
|
|
@ -3,11 +3,16 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <array>
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include <fmt/format.h>
|
||||
|
||||
#include "Common/CommonTypes.h"
|
||||
#include "Common/Swap.h"
|
||||
|
||||
namespace DiscIO
|
||||
{
|
||||
|
@ -22,39 +27,69 @@ public:
|
|||
// get_otp_dump_path will be called to get a path to it.
|
||||
void ImportNANDBin(const std::string& path_to_bin, std::function<void()> update_callback,
|
||||
std::function<std::string()> get_otp_dump_path);
|
||||
bool ExtractCertificates(const std::string& nand_root);
|
||||
bool ExtractCertificates();
|
||||
|
||||
enum class Type
|
||||
{
|
||||
File = 1,
|
||||
Directory = 2,
|
||||
};
|
||||
|
||||
private:
|
||||
#pragma pack(push, 1)
|
||||
struct NANDFSTEntry
|
||||
{
|
||||
char name[12];
|
||||
u8 mode; // 0x0C
|
||||
u8 attr; // 0x0D
|
||||
u16 sub; // 0x0E
|
||||
u16 sib; // 0x10
|
||||
u32 size; // 0x12
|
||||
u16 x1; // 0x16
|
||||
u16 uid; // 0x18
|
||||
u16 gid; // 0x1A
|
||||
u32 x3; // 0x1C
|
||||
u8 mode;
|
||||
u8 attr;
|
||||
Common::BigEndianValue<u16> sub;
|
||||
Common::BigEndianValue<u16> sib;
|
||||
Common::BigEndianValue<u32> size;
|
||||
Common::BigEndianValue<u32> uid;
|
||||
Common::BigEndianValue<u16> gid;
|
||||
Common::BigEndianValue<u32> x3;
|
||||
};
|
||||
static_assert(sizeof(NANDFSTEntry) == 0x20, "Wrong size");
|
||||
|
||||
struct NANDSuperblock
|
||||
{
|
||||
char magic[4]; // "SFFS"
|
||||
Common::BigEndianValue<u32> version;
|
||||
Common::BigEndianValue<u32> unknown;
|
||||
Common::BigEndianValue<u16> fat[0x8000];
|
||||
NANDFSTEntry fst[0x17FF];
|
||||
u8 pad[0x14];
|
||||
};
|
||||
static_assert(sizeof(NANDSuperblock) == 0x40000, "Wrong size");
|
||||
#pragma pack(pop)
|
||||
|
||||
private:
|
||||
bool ReadNANDBin(const std::string& path_to_bin, std::function<std::string()> get_otp_dump_path);
|
||||
void FindSuperblock();
|
||||
bool FindSuperblock();
|
||||
std::string GetPath(const NANDFSTEntry& entry, const std::string& parent_path);
|
||||
std::string FormatDebugString(const NANDFSTEntry& entry);
|
||||
void ProcessEntry(u16 entry_number, const std::string& parent_path);
|
||||
void ProcessFile(const NANDFSTEntry& entry, const std::string& parent_path);
|
||||
void ProcessDirectory(const NANDFSTEntry& entry, const std::string& parent_path);
|
||||
void ExportKeys(const std::string& nand_root);
|
||||
std::vector<u8> GetEntryData(const NANDFSTEntry& entry);
|
||||
void ExportKeys();
|
||||
|
||||
std::string m_nand_root;
|
||||
std::vector<u8> m_nand;
|
||||
std::vector<u8> m_nand_keys;
|
||||
size_t m_nand_fat_offset = 0;
|
||||
size_t m_nand_fst_offset = 0;
|
||||
std::array<u8, 16> m_aes_key;
|
||||
std::unique_ptr<NANDSuperblock> m_superblock;
|
||||
std::function<void()> m_update_callback;
|
||||
size_t m_nand_root_length = 0;
|
||||
};
|
||||
} // namespace DiscIO
|
||||
|
||||
template <>
|
||||
struct fmt::formatter<DiscIO::NANDImporter::NANDFSTEntry>
|
||||
{
|
||||
constexpr auto parse(format_parse_context& ctx) { return ctx.begin(); }
|
||||
template <typename FormatContext>
|
||||
auto format(const DiscIO::NANDImporter::NANDFSTEntry& entry, FormatContext& ctx) const
|
||||
{
|
||||
return fmt::format_to(
|
||||
ctx.out(), "{:12.12} {:#010b} {:#04x} {:#06x} {:#06x} {:#010x} {:#010x} {:#06x} {:#010x}",
|
||||
entry.name, entry.mode, entry.attr, entry.sub, entry.sib, entry.size, entry.uid, entry.gid,
|
||||
entry.x3);
|
||||
}
|
||||
};
|
||||
|
|
|
@ -279,6 +279,7 @@ add_executable(dolphin-emu
|
|||
QtUtils/PartiallyClosableTabWidget.h
|
||||
QtUtils/ImageConverter.cpp
|
||||
QtUtils/ImageConverter.h
|
||||
QtUtils/SignalBlocking.h
|
||||
QtUtils/UTF8CodePointCountValidator.cpp
|
||||
QtUtils/UTF8CodePointCountValidator.h
|
||||
QtUtils/WindowActivationEventFilter.cpp
|
||||
|
|
|
@ -231,6 +231,7 @@
|
|||
<ClInclude Include="QtUtils\ModalMessageBox.h" />
|
||||
<ClInclude Include="QtUtils\QueueOnObject.h" />
|
||||
<ClInclude Include="QtUtils\RunOnObject.h" />
|
||||
<ClInclude Include="QtUtils\SignalBlocking.h" />
|
||||
<ClInclude Include="QtUtils\WinIconHelper.h" />
|
||||
<ClInclude Include="QtUtils\WrapInScrollArea.h" />
|
||||
<ClInclude Include="ResourcePackManager.h" />
|
||||
|
|
|
@ -60,6 +60,7 @@
|
|||
|
||||
#include "UICommon/AutoUpdate.h"
|
||||
#include "UICommon/GameFile.h"
|
||||
#include <qprocess.h>
|
||||
|
||||
QPointer<MenuBar> MenuBar::s_menu_bar;
|
||||
|
||||
|
@ -541,19 +542,6 @@ void MenuBar::AddOptionsMenu()
|
|||
m_change_font = options_menu->addAction(tr("&Font..."), this, &MenuBar::ChangeDebugFont);
|
||||
}
|
||||
|
||||
void MenuBar::InstallUpdateManually()
|
||||
{
|
||||
auto* updater =
|
||||
new Updater(this->parentWidget(), "dev", Config::Get(Config::MAIN_AUTOUPDATE_HASH_OVERRIDE));
|
||||
|
||||
if (!updater->CheckForUpdate())
|
||||
{
|
||||
ModalMessageBox::information(
|
||||
this, tr("Update"),
|
||||
tr("You are running the latest version available on this update track."));
|
||||
}
|
||||
}
|
||||
|
||||
void MenuBar::AddHelpMenu()
|
||||
{
|
||||
QMenu* help_menu = addMenu(tr("&Help"));
|
||||
|
@ -575,13 +563,6 @@ void MenuBar::AddHelpMenu()
|
|||
QUrl(QStringLiteral("https://bugs.dolphin-emu.org/projects/emulator")));
|
||||
});
|
||||
|
||||
if (AutoUpdateChecker::SystemSupportsAutoUpdates())
|
||||
{
|
||||
help_menu->addSeparator();
|
||||
|
||||
help_menu->addAction(tr("&Check for Updates..."), this, &MenuBar::InstallUpdateManually);
|
||||
}
|
||||
|
||||
#ifndef __APPLE__
|
||||
help_menu->addSeparator();
|
||||
#endif
|
||||
|
@ -1170,7 +1151,7 @@ void MenuBar::CheckNAND()
|
|||
|
||||
void MenuBar::NANDExtractCertificates()
|
||||
{
|
||||
if (DiscIO::NANDImporter().ExtractCertificates(File::GetUserPath(D_WIIROOT_IDX)))
|
||||
if (DiscIO::NANDImporter().ExtractCertificates())
|
||||
{
|
||||
ModalMessageBox::information(this, tr("Success"),
|
||||
tr("Successfully extracted certificates from NAND"));
|
||||
|
|
32
Source/Core/DolphinQt/QtUtils/SignalBlocking.h
Normal file
32
Source/Core/DolphinQt/QtUtils/SignalBlocking.h
Normal file
|
@ -0,0 +1,32 @@
|
|||
// Copyright 2022 Dolphin Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QSignalBlocker>
|
||||
|
||||
// Helper class for populating a GUI element without triggering its data change signals.
|
||||
|
||||
template <typename T>
|
||||
class SignalBlockerProxy
|
||||
{
|
||||
public:
|
||||
explicit SignalBlockerProxy(T* object) : m_object(object), m_blocker(object) {}
|
||||
SignalBlockerProxy(const SignalBlockerProxy& other) = delete;
|
||||
SignalBlockerProxy(SignalBlockerProxy&& other) = default;
|
||||
SignalBlockerProxy& operator=(const SignalBlockerProxy& other) = delete;
|
||||
SignalBlockerProxy& operator=(SignalBlockerProxy&& other) = default;
|
||||
~SignalBlockerProxy() = default;
|
||||
|
||||
T* operator->() const { return m_object; }
|
||||
|
||||
private:
|
||||
T* m_object;
|
||||
QSignalBlocker m_blocker;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
SignalBlockerProxy<T> SignalBlocking(T* object)
|
||||
{
|
||||
return SignalBlockerProxy<T>(object);
|
||||
}
|
|
@ -23,14 +23,15 @@
|
|||
#include "Core/PowerPC/PowerPC.h"
|
||||
|
||||
#include "DolphinQt/QtUtils/ModalMessageBox.h"
|
||||
#include "DolphinQt/QtUtils/SignalBlocking.h"
|
||||
#include "DolphinQt/Settings.h"
|
||||
|
||||
//#include "UICommon/AutoUpdate.h"
|
||||
#include "UICommon/AutoUpdate.h"
|
||||
#ifdef USE_DISCORD_PRESENCE
|
||||
#include "UICommon/DiscordPresence.h"
|
||||
#endif
|
||||
|
||||
/* constexpr int AUTO_UPDATE_DISABLE_INDEX = 0;
|
||||
constexpr int AUTO_UPDATE_DISABLE_INDEX = 0;
|
||||
constexpr int AUTO_UPDATE_STABLE_INDEX = 1;
|
||||
constexpr int AUTO_UPDATE_BETA_INDEX = 2;
|
||||
constexpr int AUTO_UPDATE_DEV_INDEX = 3;
|
||||
|
@ -38,7 +39,7 @@ constexpr int AUTO_UPDATE_DEV_INDEX = 3;
|
|||
constexpr const char* AUTO_UPDATE_DISABLE_STRING = "";
|
||||
constexpr const char* AUTO_UPDATE_STABLE_STRING = "stable";
|
||||
constexpr const char* AUTO_UPDATE_BETA_STRING = "beta";
|
||||
constexpr const char* AUTO_UPDATE_DEV_STRING = "dev";*/
|
||||
constexpr const char* AUTO_UPDATE_DEV_STRING = "dev";
|
||||
|
||||
constexpr int FALLBACK_REGION_NTSCJ_INDEX = 0;
|
||||
constexpr int FALLBACK_REGION_NTSCU_INDEX = 1;
|
||||
|
@ -65,9 +66,6 @@ void GeneralPane::CreateLayout()
|
|||
// Create layout here
|
||||
CreateBasic();
|
||||
|
||||
/* if (AutoUpdateChecker::SystemSupportsAutoUpdates())
|
||||
CreateAutoUpdate();*/
|
||||
|
||||
CreateFallbackRegion();
|
||||
|
||||
#if defined(USE_ANALYTICS) && USE_ANALYTICS
|
||||
|
@ -83,6 +81,7 @@ void GeneralPane::OnEmulationStateChanged(Core::State state)
|
|||
const bool running = state != Core::State::Uninitialized;
|
||||
|
||||
m_checkbox_dualcore->setEnabled(!running);
|
||||
m_checkbox_cheats->setEnabled(!running);
|
||||
m_checkbox_override_region_settings->setEnabled(!running);
|
||||
#ifdef USE_DISCORD_PRESENCE
|
||||
m_checkbox_discord_presence->setEnabled(!running);
|
||||
|
@ -93,6 +92,7 @@ void GeneralPane::OnEmulationStateChanged(Core::State state)
|
|||
void GeneralPane::ConnectLayout()
|
||||
{
|
||||
connect(m_checkbox_dualcore, &QCheckBox::toggled, this, &GeneralPane::OnSaveConfig);
|
||||
connect(m_checkbox_cheats, &QCheckBox::toggled, this, &GeneralPane::OnSaveConfig);
|
||||
connect(m_checkbox_override_region_settings, &QCheckBox::stateChanged, this,
|
||||
&GeneralPane::OnSaveConfig);
|
||||
connect(m_checkbox_auto_disc_change, &QCheckBox::toggled, this, &GeneralPane::OnSaveConfig);
|
||||
|
@ -100,13 +100,13 @@ void GeneralPane::ConnectLayout()
|
|||
connect(m_checkbox_discord_presence, &QCheckBox::toggled, this, &GeneralPane::OnSaveConfig);
|
||||
#endif
|
||||
|
||||
/* if (AutoUpdateChecker::SystemSupportsAutoUpdates())
|
||||
if (AutoUpdateChecker::SystemSupportsAutoUpdates())
|
||||
{
|
||||
connect(m_combobox_update_track, qOverload<int>(&QComboBox::currentIndexChanged), this,
|
||||
&GeneralPane::OnSaveConfig);
|
||||
connect(&Settings::Instance(), &Settings::AutoUpdateTrackChanged, this,
|
||||
&GeneralPane::LoadConfig);
|
||||
}*/
|
||||
}
|
||||
|
||||
// Advanced
|
||||
connect(m_combobox_speedlimit, qOverload<int>(&QComboBox::currentIndexChanged),
|
||||
|
@ -134,6 +134,9 @@ void GeneralPane::CreateBasic()
|
|||
m_checkbox_dualcore = new QCheckBox(tr("Enable Dual Core (speedup)"));
|
||||
basic_group_layout->addWidget(m_checkbox_dualcore);
|
||||
|
||||
m_checkbox_cheats = new QCheckBox(tr("Enable Cheats"));
|
||||
basic_group_layout->addWidget(m_checkbox_cheats);
|
||||
|
||||
m_checkbox_override_region_settings = new QCheckBox(tr("Allow Mismatched Region Settings"));
|
||||
basic_group_layout->addWidget(m_checkbox_override_region_settings);
|
||||
|
||||
|
@ -167,25 +170,6 @@ void GeneralPane::CreateBasic()
|
|||
speed_limit_layout->addRow(tr("&Speed Limit:"), m_combobox_speedlimit);
|
||||
}
|
||||
|
||||
/* void GeneralPane::CreateAutoUpdate()
|
||||
{
|
||||
auto* auto_update_group = new QGroupBox(tr("Auto Update Settings"));
|
||||
auto* auto_update_group_layout = new QFormLayout;
|
||||
auto_update_group->setLayout(auto_update_group_layout);
|
||||
m_main_layout->addWidget(auto_update_group);
|
||||
|
||||
auto_update_group_layout->setFormAlignment(Qt::AlignLeft | Qt::AlignTop);
|
||||
auto_update_group_layout->setFieldGrowthPolicy(QFormLayout::AllNonFixedFieldsGrow);
|
||||
|
||||
m_combobox_update_track = new QComboBox(this);
|
||||
|
||||
auto_update_group_layout->addRow(tr("&Auto Update:"), m_combobox_update_track);
|
||||
|
||||
for (const QString& option : {tr("Don't Update"), tr("Stable (once a year)"),
|
||||
tr("Beta (once a month)"), tr("Dev (multiple times a day)")})
|
||||
m_combobox_update_track->addItem(option);
|
||||
}*/
|
||||
|
||||
void GeneralPane::CreateFallbackRegion()
|
||||
{
|
||||
auto* fallback_region_group = new QGroupBox(tr("Fallback Region"));
|
||||
|
@ -230,50 +214,52 @@ void GeneralPane::LoadConfig()
|
|||
{
|
||||
const QSignalBlocker blocker(this);
|
||||
|
||||
/* if (AutoUpdateChecker::SystemSupportsAutoUpdates())
|
||||
if (AutoUpdateChecker::SystemSupportsAutoUpdates())
|
||||
{
|
||||
const auto track = Settings::Instance().GetAutoUpdateTrack().toStdString();
|
||||
|
||||
if (track == AUTO_UPDATE_DISABLE_STRING)
|
||||
m_combobox_update_track->setCurrentIndex(AUTO_UPDATE_DISABLE_INDEX);
|
||||
SignalBlocking(m_combobox_update_track)->setCurrentIndex(AUTO_UPDATE_DISABLE_INDEX);
|
||||
else if (track == AUTO_UPDATE_STABLE_STRING)
|
||||
m_combobox_update_track->setCurrentIndex(AUTO_UPDATE_STABLE_INDEX);
|
||||
SignalBlocking(m_combobox_update_track)->setCurrentIndex(AUTO_UPDATE_STABLE_INDEX);
|
||||
else if (track == AUTO_UPDATE_BETA_STRING)
|
||||
m_combobox_update_track->setCurrentIndex(AUTO_UPDATE_BETA_INDEX);
|
||||
SignalBlocking(m_combobox_update_track)->setCurrentIndex(AUTO_UPDATE_BETA_INDEX);
|
||||
else
|
||||
m_combobox_update_track->setCurrentIndex(AUTO_UPDATE_DEV_INDEX);
|
||||
}*/
|
||||
SignalBlocking(m_combobox_update_track)->setCurrentIndex(AUTO_UPDATE_DEV_INDEX);
|
||||
}
|
||||
|
||||
#if defined(USE_ANALYTICS) && USE_ANALYTICS
|
||||
m_checkbox_enable_analytics->setChecked(Settings::Instance().IsAnalyticsEnabled());
|
||||
SignalBlocking(m_checkbox_enable_analytics)
|
||||
->setChecked(Settings::Instance().IsAnalyticsEnabled());
|
||||
#endif
|
||||
m_checkbox_dualcore->setChecked(Config::Get(Config::MAIN_CPU_THREAD));
|
||||
m_checkbox_override_region_settings->setChecked(
|
||||
Config::Get(Config::MAIN_OVERRIDE_REGION_SETTINGS));
|
||||
m_checkbox_auto_disc_change->setChecked(Config::Get(Config::MAIN_AUTO_DISC_CHANGE));
|
||||
SignalBlocking(m_checkbox_dualcore)->setChecked(Config::Get(Config::MAIN_CPU_THREAD));
|
||||
SignalBlocking(m_checkbox_cheats)->setChecked(Settings::Instance().GetCheatsEnabled());
|
||||
SignalBlocking(m_checkbox_override_region_settings)
|
||||
->setChecked(Config::Get(Config::MAIN_OVERRIDE_REGION_SETTINGS));
|
||||
SignalBlocking(m_checkbox_auto_disc_change)
|
||||
->setChecked(Config::Get(Config::MAIN_AUTO_DISC_CHANGE));
|
||||
|
||||
#ifdef USE_DISCORD_PRESENCE
|
||||
m_checkbox_discord_presence->setChecked(Config::Get(Config::MAIN_USE_DISCORD_PRESENCE));
|
||||
SignalBlocking(m_checkbox_discord_presence)
|
||||
->setChecked(Config::Get(Config::MAIN_USE_DISCORD_PRESENCE));
|
||||
#endif
|
||||
int selection = qRound(Config::Get(Config::MAIN_EMULATION_SPEED) * 10);
|
||||
if (selection < m_combobox_speedlimit->count())
|
||||
m_combobox_speedlimit->setCurrentIndex(selection);
|
||||
m_checkbox_dualcore->setChecked(Config::Get(Config::MAIN_CPU_THREAD));
|
||||
SignalBlocking(m_combobox_speedlimit)->setCurrentIndex(selection);
|
||||
|
||||
const auto fallback = Settings::Instance().GetFallbackRegion();
|
||||
|
||||
if (fallback == DiscIO::Region::NTSC_J)
|
||||
m_combobox_fallback_region->setCurrentIndex(FALLBACK_REGION_NTSCJ_INDEX);
|
||||
SignalBlocking(m_combobox_fallback_region)->setCurrentIndex(FALLBACK_REGION_NTSCJ_INDEX);
|
||||
else if (fallback == DiscIO::Region::NTSC_U)
|
||||
m_combobox_fallback_region->setCurrentIndex(FALLBACK_REGION_NTSCU_INDEX);
|
||||
SignalBlocking(m_combobox_fallback_region)->setCurrentIndex(FALLBACK_REGION_NTSCU_INDEX);
|
||||
else if (fallback == DiscIO::Region::PAL)
|
||||
m_combobox_fallback_region->setCurrentIndex(FALLBACK_REGION_PAL_INDEX);
|
||||
SignalBlocking(m_combobox_fallback_region)->setCurrentIndex(FALLBACK_REGION_PAL_INDEX);
|
||||
else if (fallback == DiscIO::Region::NTSC_K)
|
||||
m_combobox_fallback_region->setCurrentIndex(FALLBACK_REGION_NTSCK_INDEX);
|
||||
SignalBlocking(m_combobox_fallback_region)->setCurrentIndex(FALLBACK_REGION_NTSCK_INDEX);
|
||||
else
|
||||
m_combobox_fallback_region->setCurrentIndex(FALLBACK_REGION_NTSCJ_INDEX);
|
||||
SignalBlocking(m_combobox_fallback_region)->setCurrentIndex(FALLBACK_REGION_NTSCJ_INDEX);
|
||||
}
|
||||
|
||||
/* static QString UpdateTrackFromIndex(int index)
|
||||
static QString UpdateTrackFromIndex(int index)
|
||||
{
|
||||
QString value;
|
||||
|
||||
|
@ -294,7 +280,7 @@ void GeneralPane::LoadConfig()
|
|||
}
|
||||
|
||||
return value;
|
||||
}*/
|
||||
}
|
||||
|
||||
static DiscIO::Region UpdateFallbackRegionFromIndex(int index)
|
||||
{
|
||||
|
@ -326,11 +312,11 @@ void GeneralPane::OnSaveConfig()
|
|||
Config::ConfigChangeCallbackGuard config_guard;
|
||||
|
||||
auto& settings = SConfig::GetInstance();
|
||||
/* if (AutoUpdateChecker::SystemSupportsAutoUpdates())
|
||||
if (AutoUpdateChecker::SystemSupportsAutoUpdates())
|
||||
{
|
||||
Settings::Instance().SetAutoUpdateTrack(
|
||||
UpdateTrackFromIndex(m_combobox_update_track->currentIndex()));
|
||||
}*/
|
||||
}
|
||||
|
||||
#ifdef USE_DISCORD_PRESENCE
|
||||
Discord::SetDiscordPresenceEnabled(m_checkbox_discord_presence->isChecked());
|
||||
|
@ -341,9 +327,11 @@ void GeneralPane::OnSaveConfig()
|
|||
DolphinAnalytics::Instance().ReloadConfig();
|
||||
#endif
|
||||
Config::SetBaseOrCurrent(Config::MAIN_CPU_THREAD, m_checkbox_dualcore->isChecked());
|
||||
Settings::Instance().SetCheatsEnabled(m_checkbox_cheats->isChecked());
|
||||
Config::SetBaseOrCurrent(Config::MAIN_OVERRIDE_REGION_SETTINGS,
|
||||
m_checkbox_override_region_settings->isChecked());
|
||||
Config::SetBase(Config::MAIN_AUTO_DISC_CHANGE, m_checkbox_auto_disc_change->isChecked());
|
||||
Config::SetBaseOrCurrent(Config::MAIN_ENABLE_CHEATS, m_checkbox_cheats->isChecked());
|
||||
Config::SetBaseOrCurrent(Config::MAIN_EMULATION_SPEED,
|
||||
m_combobox_speedlimit->currentIndex() * 0.1f);
|
||||
Settings::Instance().SetFallbackRegion(
|
||||
|
|
|
@ -30,12 +30,12 @@ static void ShowResult(QWidget* parent, WiiUtils::UpdateResult result)
|
|||
case WiiUtils::UpdateResult::Succeeded:
|
||||
ModalMessageBox::information(parent, QObject::tr("Update completed"),
|
||||
QObject::tr("The emulated Wii console has been updated."));
|
||||
DiscIO::NANDImporter().ExtractCertificates(File::GetUserPath(D_WIIROOT_IDX));
|
||||
DiscIO::NANDImporter().ExtractCertificates();
|
||||
break;
|
||||
case WiiUtils::UpdateResult::AlreadyUpToDate:
|
||||
ModalMessageBox::information(parent, QObject::tr("Update completed"),
|
||||
QObject::tr("The emulated Wii console is already up-to-date."));
|
||||
DiscIO::NANDImporter().ExtractCertificates(File::GetUserPath(D_WIIROOT_IDX));
|
||||
DiscIO::NANDImporter().ExtractCertificates();
|
||||
break;
|
||||
case WiiUtils::UpdateResult::ServerFailed:
|
||||
ModalMessageBox::critical(parent, QObject::tr("Update failed"),
|
||||
|
|
|
@ -751,6 +751,8 @@ Renderer::Renderer(std::unique_ptr<GLContext> main_gl_context, float backbuffer_
|
|||
OSD::AddMessage("This device's performance may be poor.", 60000);
|
||||
}
|
||||
|
||||
INFO_LOG_FMT(VIDEO, "Video Info: {}, {}, {}", g_ogl_config.gl_vendor, g_ogl_config.gl_renderer,
|
||||
g_ogl_config.gl_version);
|
||||
WARN_LOG_FMT(VIDEO, "Missing OGL Extensions: {}{}{}{}{}{}{}{}{}{}{}{}{}{}",
|
||||
g_ActiveConfig.backend_info.bSupportsDualSourceBlend ? "" : "DualSourceBlend ",
|
||||
g_ActiveConfig.backend_info.bSupportsPrimitiveRestart ? "" : "PrimitiveRestart ",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue