diff --git a/src/yuzu/CMakeLists.txt b/src/yuzu/CMakeLists.txt index 0259a8c293..b67df498f2 100644 --- a/src/yuzu/CMakeLists.txt +++ b/src/yuzu/CMakeLists.txt @@ -382,7 +382,7 @@ elseif(WIN32) endif() target_link_libraries(yuzu PRIVATE common core input_common frontend_common network video_core) -target_link_libraries(yuzu PRIVATE Boost::headers glad Qt${QT_MAJOR_VERSION}::Widgets) +target_link_libraries(yuzu PRIVATE Boost::headers glad Qt${QT_MAJOR_VERSION}::Widgets httplib::httplib) target_link_libraries(yuzu PRIVATE ${PLATFORM_LIBRARIES} Threads::Threads) target_link_libraries(yuzu PRIVATE Vulkan::Headers) diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index 6ff14063e7..e21c05bb80 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp @@ -21,6 +21,7 @@ #include "common/linux/gamemode.h" #endif +#include #include // VFS includes must be before glad as they will conflict with Windows file api, which uses defines. @@ -1524,6 +1525,7 @@ void GMainWindow::ConnectMenuEvents() { connect_menu(ui->action_Open_Mods_Page, &GMainWindow::OnOpenModsPage); connect_menu(ui->action_Open_Quickstart_Guide, &GMainWindow::OnOpenQuickstartGuide); connect_menu(ui->action_Open_FAQ, &GMainWindow::OnOpenFAQ); + connect_menu(ui->action_Open_Mirror_Repo, &GMainWindow::OnOpenMirrorRepo); connect_menu(ui->action_Restart, &GMainWindow::OnRestartGame); connect_menu(ui->action_Configure, &GMainWindow::OnConfigure); connect_menu(ui->action_Configure_Current_Game, &GMainWindow::OnConfigurePerGame); @@ -3566,6 +3568,41 @@ void GMainWindow::OnOpenFAQ() { OpenURL(QUrl(QStringLiteral("https://yuzu-emu.org/wiki/faq/"))); } +void GMainWindow::OnOpenMirrorRepo() { + struct Mirror { + const char *host, *path; + }; + const std::initializer_list mirrors = { + {"https://github.com", "/litucks/torzu"}, + {"https://gitlab.com", "/litucks/torzu"}, + {"https://bitbucket.org", "/litucks/torzu"}, + {"https://codeberg.org", "/litucks/torzu"}, + {"https://notabug.org", "/litucks/torzu"}, + {"https://gitea.com", "/litucks/torzu"}, + {"https://try.gitea.io", "/litucks/torzu"}, + {"https://git.math.hamburg", "/litucks/torzu"}, + {"https://gitea.sprint-pay.com", "/litucks/torzu"}, + {"https://gitea.djoe.ovh", "/litucks/torzu"}, + {"https://git.sheetjs.com", "/litucks/torzu"}, + {"https://gitea.cisetech.com", "/litucks/torzu"} + }; + + for (const auto& mirror : mirrors) { + httplib::Client cli(mirror.host); + if (cli.Get(mirror.path)) { + OpenURL(QUrl(QString::fromStdString(fmt::format("{}{}", mirror.host, mirror.path)))); + return; + } + } + + QMessageBox::warning(this, tr("Error locating mirror"), tr("There has been an error finding the current mirror repository.\n" + "Your version may be so old the list has already been depleted\n" + "or your network connectivity may be limited.\n" + "Please either try again later, through a VPN or access the main\n" + "repository via the Tor Browser:\n" + "http://y2nlvhmmk5jnsvechppxnbyzmmv3vbl7dvzn6ltwcdbpgxixp3clkgqd.onion/torzu-emu/torzu")); +} + void GMainWindow::ToggleFullscreen() { if (!emulation_running) { return; diff --git a/src/yuzu/main.h b/src/yuzu/main.h index 03a2a5dd81..2a528b1d09 100644 --- a/src/yuzu/main.h +++ b/src/yuzu/main.h @@ -337,6 +337,7 @@ private slots: void OnOpenModsPage(); void OnOpenQuickstartGuide(); void OnOpenFAQ(); + void OnOpenMirrorRepo(); /// Called whenever a user selects a game in the game list widget. void OnGameListLoadFile(QString game_path, u64 program_id); void OnGameListOpenFolder(u64 program_id, GameListOpenTarget target, diff --git a/src/yuzu/main.ui b/src/yuzu/main.ui index dfe025ca61..f958413b84 100644 --- a/src/yuzu/main.ui +++ b/src/yuzu/main.ui @@ -45,7 +45,7 @@ 0 0 1280 - 21 + 22 @@ -185,6 +185,7 @@ + @@ -481,6 +482,11 @@ Open Home Menu + + + Open current Mirror &Repo + +