7 Commits

Author SHA1 Message Date
spectranator
2184968eb4 Applied clang-format 2024-05-13 23:11:32 +02:00
spectranator
ffc907460f Removed web service reminiscents
This will be undone (except for the analytics part) once a good reimplementation is available. I will include a configuration value for the server to use.
2024-05-13 23:03:36 +02:00
spectranator
e966068fea Update README: Windows bullds now available in releases section 2024-05-10 03:44:35 +02:00
spectranator
fad5984210 Added FAQ document 2024-05-08 23:35:57 +02:00
lol
e96b877ee2 fix qlaunch on firmware 18 (from Suyu 70c52a1914) 2024-05-08 20:55:18 +02:00
spectranator
377c9bc831 Implemented safer and faster way to get current mirror URL 2024-05-08 17:47:00 +02:00
spectranator
ef6fc3e26a Updated README.md: Removed Windows build off goals list as it is done 2024-05-08 15:29:51 +02:00
28 changed files with 110 additions and 245 deletions

3
.gitmodules vendored
View File

@@ -31,9 +31,6 @@
[submodule "vcpkg"]
path = externals/vcpkg
url = https://github.com/microsoft/vcpkg.git
[submodule "cpp-jwt"]
path = externals/cpp-jwt
url = https://github.com/arun11299/cpp-jwt.git
[submodule "libadrenotools"]
path = externals/libadrenotools
url = https://github.com/bylaws/libadrenotools.git

View File

@@ -30,8 +30,6 @@ set(QT6_LOCATION "" CACHE PATH "Additional Location to search for Qt6 libraries
option(ENABLE_QT_TRANSLATION "Enable translations for the Qt frontend" OFF)
CMAKE_DEPENDENT_OPTION(YUZU_USE_BUNDLED_QT "Download bundled Qt binaries" "${MSVC}" "ENABLE_QT" OFF)
option(ENABLE_WEB_SERVICE "Enable web services (telemetry, etc.)" ON)
option(YUZU_USE_BUNDLED_FFMPEG "Download/Build bundled FFmpeg" "${WIN32}")
option(YUZU_USE_EXTERNAL_VULKAN_HEADERS "Use Vulkan-Headers from externals" ON)
@@ -143,9 +141,6 @@ if (YUZU_USE_BUNDLED_VCPKG)
if (YUZU_TESTS)
list(APPEND VCPKG_MANIFEST_FEATURES "yuzu-tests")
endif()
if (ENABLE_WEB_SERVICE)
list(APPEND VCPKG_MANIFEST_FEATURES "web-service")
endif()
if (ANDROID)
list(APPEND VCPKG_MANIFEST_FEATURES "android")
endif()
@@ -345,10 +340,7 @@ if (USE_DISCORD_PRESENCE)
find_package(DiscordRPC MODULE)
endif()
if (ENABLE_WEB_SERVICE)
find_package(cpp-jwt 1.4 CONFIG)
find_package(httplib 0.12 MODULE COMPONENTS OpenSSL)
endif()
find_package(httplib 0.12 MODULE COMPONENTS OpenSSL)
if (YUZU_TESTS)
find_package(Catch2 3.0.1 REQUIRED)

32
FAQ.md Normal file
View File

@@ -0,0 +1,32 @@
# FAQ
**Q:** Will you fix game X?<br/>
**A:** I would love to! Unfortunately my resources are severely limited as I'm a one-man team. I will give it a try, but if you can link me to a commit in any other fork fixing the game I'd be glad to cherry-pick it.
**Q:** Will you add feature X?<br/>
**A:** Most likely, no. I hesitate from adding complex features that may jeopardize stability and introduce bugs. Such features would only be added behind a settings toggle.
**Q:** You're only doing this for fame/money/...<br/>
**A:** At the moment I am not considering to take any donations. I won't need them anyways in the foreseeable future.
About the fame thing, I kind of dislike the attention. It distracts me from doing actual work, and it makes me feel pressured. Read this if you'd like to know more: [https://www.reddit.com/r/EmulationOnAndroid/comments/1ckmdh7/comment/l36hru9/?utm\_source=share&utm\_medium=web3x&utm\_name=web3xcss&utm\_term=1&utm\_content=share\_button](https://www.reddit.com/r/EmulationOnAndroid/comments/1ckmdh7/comment/l36hru9/?utm_source=share&utm_medium=web3x&utm_name=web3xcss&utm_term=1&utm_content=share_button)
**Q:** What happens if Nintendo DMCAs the repo?<br/>
**A:** The main repository is on the Tor network. That means Nintendo can do no harm to it unless they manage to deanonymize me and send me a personal letter. I'm doing my best to avoid that.
Whenever a mirror repository gets taken down, I'll just move on to another git service. Yes, they are finite but I've got enough to hopefully make them give up before I've depleted my list.
**Q:** But you're just stealing changes from other forks!<br/>
**A:** This is a pretty normal thing to do in the open source world. Yes, a lot of the changes are cherry-picked from other forks. There is no point in duplicating work unnecessarily and keeping good additions out of the project just because they are not mine. Original contributors are always credited as commit author of course.
Note however that all changes listed in the README file are my own work and other forks should feel free to cherry-pick them!
**Q:** Will there ever be an Android version?<br/>
**A:** Unfortunately I am pretty inexperienced in the Android world. This whole gradle stuff makes no sense to me and I've given up for now.
Let's say, it'd be a nice bonus but it's very low priority. If you'd like to run Yuzu on Android you'd probably be better off with Sudachi.
**Q:** This fork is going to be abandoned very soon!<br/>
**A:** I have committed myself to at the very least keep it updated enough to compile and run on modern systems for the next decade or so. If you don't see commits for a while it doesn't mean I've abandoned it.
I have ADHD and need to shift my focus between different projects sometimes to stay motivated. Also, personal life is a thing. ~~Who knows maybe I'll be run over by a car tomorrow? Joking, that's not going to happen. Hopefully.~~
Enjoy playing your favorite (and legally obtained) Nintendo games on whatever device and emulator you prefer!<br/>
Don't let Nintendo pressure you into using their kind of terrible and overpriced hardware... I'm truly sorry if no emulator can currently play the game you want to play.
Finally, enjoy life, make the most of it, don't be a ~~couch~~ office chair potato like me. Tip, even if you are, a walk around the green city areas can be incredibly refreshing!

View File

@@ -48,10 +48,10 @@ The first and foremost goal is long-term maintenance. Even if I stop commiting n
Essentially, the main goal is that you can still use this emulator on modern systems in 20 years.
It is very important to me that this project is going to be a good base to fork once grass has grown over the whole legal dilemma and people are willing to do real work on this emulator non-anonymously.
While the main platform is Linux as it is the main operating system I run on my personal and development desktops, Windows support is very near and will not be forgotten about. Android support is low priority but would be a nice bonus.
A secondary goal is the improvement of usability on low-end systems. This includes both improving the performance of the emulator as well as making games more playable below 100% speed whenever possible (the sync CPU to render speed limit option already helps with that in few cases).
Android support is low priority but would be a nice bonus.
## Development
Most of the development happens on [Dark Git](http://y2nlvhmmk5jnsvechppxnbyzmmv3vbl7dvzn6ltwcdbpgxixp3clkgqd.onion/). It's also where [our central repository](http://y2nlvhmmk5jnsvechppxnbyzmmv3vbl7dvzn6ltwcdbpgxixp3clkgqd.onion/torzu-emu/torzu) is hosted.
@@ -86,7 +86,6 @@ This project incorporates several commits from the [Suyu](https://suyu.dev) and
## Download
Precompiled build are available **in the releases section**.
Windows builds have not been released yet but will very soon.
## License

View File

@@ -125,19 +125,11 @@ endif()
add_subdirectory(sirit)
# httplib
if (ENABLE_WEB_SERVICE AND NOT TARGET httplib::httplib)
if (NOT TARGET httplib::httplib)
set(HTTPLIB_REQUIRE_OPENSSL ON)
add_subdirectory(cpp-httplib)
endif()
# cpp-jwt
if (ENABLE_WEB_SERVICE AND NOT TARGET cpp-jwt::cpp-jwt)
set(CPP_JWT_BUILD_EXAMPLES OFF)
set(CPP_JWT_BUILD_TESTS OFF)
set(CPP_JWT_USE_VENDORED_NLOHMANN_JSON OFF)
add_subdirectory(cpp-jwt)
endif()
# Opus
if (NOT TARGET Opus::opus)
set(OPUS_BUILD_TESTING OFF)

1
externals/cpp-jwt vendored

Submodule externals/cpp-jwt deleted from 10ef5735d8

View File

@@ -207,10 +207,6 @@ if (ENABLE_QT)
add_subdirectory(yuzu)
endif()
if (ENABLE_WEB_SERVICE)
add_subdirectory(web_service)
endif()
if (ANDROID)
add_subdirectory(android/app/src/main/jni)
target_include_directories(yuzu-android PRIVATE android/app/src/main)

View File

@@ -210,7 +210,8 @@ struct Values {
true,
true,
&use_speed_limit};
SwitchableSetting<bool> sync_core_speed{linkage, false, "sync_core_speed", Category::Core, Specialization::Default};
SwitchableSetting<bool> sync_core_speed{linkage, false, "sync_core_speed", Category::Core,
Specialization::Default};
// Cpu
SwitchableSetting<CpuBackend, true> cpu_backend{linkage,

View File

@@ -1165,11 +1165,6 @@ if (MINGW)
target_link_libraries(core PRIVATE ${MSWSOCK_LIBRARY})
endif()
if (ENABLE_WEB_SERVICE)
target_compile_definitions(core PRIVATE -DENABLE_WEB_SERVICE)
target_link_libraries(core PRIVATE web_service)
endif()
if (HAS_NCE)
enable_language(C ASM)
set(CMAKE_ASM_FLAGS "${CFLAGS} -x assembler-with-cpp")

View File

@@ -14,8 +14,8 @@
#include "common/x64/cpu_wait.h"
#endif
#include "common/settings.h"
#include "common/microprofile.h"
#include "common/settings.h"
#include "core/core_timing.h"
#include "core/hardware_properties.h"
@@ -194,8 +194,9 @@ u64 CoreTiming::GetClockTicks() const {
if (Settings::values.sync_core_speed.GetValue()) {
const double ticks = static_cast<double>(fres);
const double speed_limit = static_cast<double>(Settings::values.speed_limit.GetValue())*0.01;
return static_cast<u64>(ticks/speed_limit);
const double speed_limit =
static_cast<double>(Settings::values.speed_limit.GetValue()) * 0.01;
return static_cast<u64>(ticks / speed_limit);
} else {
return fres;
}

View File

@@ -172,6 +172,7 @@ Result KPageTableBase::InitializeForKernel(bool is_64_bit, KVirtualAddress start
m_mapped_unsafe_physical_memory = 0;
m_mapped_insecure_memory = 0;
m_mapped_ipc_server_memory = 0;
m_alias_region_extra_size = 0;
m_memory_block_slab_manager =
m_kernel.GetSystemSystemResource().GetMemoryBlockSlabManagerPointer();
@@ -269,6 +270,12 @@ Result KPageTableBase::InitializeForProcess(Svc::CreateProcessFlag as_type, bool
process_code_end = m_code_region_end;
}
m_alias_region_extra_size = 0;
if (as_type == Svc::CreateProcessFlag::EnableReservedRegionExtraSize) {
m_alias_region_extra_size = GetAddressSpaceSize() / 8;
alias_region_size += m_alias_region_extra_size;
}
// Set other basic fields.
m_enable_aslr = enable_aslr;
m_enable_device_address_space_merge = enable_das_merge;

View File

@@ -208,6 +208,7 @@ private:
size_t m_mapped_unsafe_physical_memory{};
size_t m_mapped_insecure_memory{};
size_t m_mapped_ipc_server_memory{};
size_t m_alias_region_extra_size{};
mutable KLightLock m_general_lock;
mutable KLightLock m_map_physical_memory_lock;
KLightLock m_device_map_lock;
@@ -682,6 +683,9 @@ public:
size_t GetAliasRegionSize() const {
return m_alias_region_end - m_alias_region_start;
}
size_t GetReservedRegionExtraSize() const {
return m_alias_region_extra_size;
}
size_t GetStackRegionSize() const {
return m_stack_region_end - m_stack_region_start;
}

View File

@@ -410,6 +410,9 @@ public:
size_t GetAliasRegionSize() const {
return m_page_table.GetAliasRegionSize();
}
size_t GetReservedRegionExtraSize() const {
return m_page_table.GetReservedRegionExtraSize();
}
size_t GetStackRegionSize() const {
return m_page_table.GetStackRegionSize();
}

View File

@@ -37,7 +37,8 @@ Result GetInfo(Core::System& system, u64* result, InfoType info_id_type, Handle
case InfoType::TotalNonSystemMemorySize:
case InfoType::UsedNonSystemMemorySize:
case InfoType::IsApplication:
case InfoType::FreeThreadCount: {
case InfoType::FreeThreadCount:
case InfoType::ReservedRegionExtraSize: {
R_UNLESS(info_sub_id == 0, ResultInvalidEnumValue);
const auto& handle_table = GetCurrentProcess(system.Kernel()).GetHandleTable();
@@ -134,6 +135,10 @@ Result GetInfo(Core::System& system, u64* result, InfoType info_id_type, Handle
}
R_SUCCEED();
case InfoType::ReservedRegionExtraSize:
*result = process->GetPageTable().GetReservedRegionExtraSize();
R_SUCCEED();
default:
break;
}

View File

@@ -153,6 +153,7 @@ enum class InfoType : u32 {
ThreadTickCount = 25,
IsSvcPermitted = 26,
IoRegionHint = 27,
ReservedRegionExtraSize = 28,
MesosphereMeta = 65000,
MesosphereCurrentProcess = 65001,
@@ -642,9 +643,12 @@ enum class CreateProcessFlag : u32 {
// 11.x+ DisableDeviceAddressSpaceMerge.
DisableDeviceAddressSpaceMerge = (1 << 12),
EnableReservedRegionExtraSize = (1 << 13),
// Mask of all flags.
All = Is64Bit | AddressSpaceMask | EnableDebug | EnableAslr | IsApplication |
PoolPartitionMask | OptimizeMemoryAllocation | DisableDeviceAddressSpaceMerge,
PoolPartitionMask | OptimizeMemoryAllocation | DisableDeviceAddressSpaceMerge |
EnableReservedRegionExtraSize,
};
DECLARE_ENUM_FLAG_OPERATORS(CreateProcessFlag);

View File

@@ -324,8 +324,8 @@ public:
{10, &IProfileCommon::GetImageSize, "GetImageSize"},
{11, &IProfileCommon::LoadImage, "LoadImage"},
{20, &IProfileCommon::GetImageSize, "GetLargeImageSize"}, // 18.0.0+
{21, &IProfileCommon::LoadImage, "LoadLargeImage"}, // 18.0.0+
{30, nullptr, "GetImageId"} // 18.0.0+
{21, &IProfileCommon::LoadImage, "LoadLargeImage"}, // 18.0.0+
{30, &IProfileCommon::Unknown, "GetImageId"} // 18.0.0+
};
RegisterHandlers(functions);
@@ -496,6 +496,13 @@ protected:
rb.Push(ResultSuccess);
}
void Unknown(HLERequestContext& ctx) {
LOG_WARNING(Service_ACC, "(STUBBED) called");
IPC::ResponseBuilder rb{ctx, 3};
rb.Push(ResultSuccess);
rb.Push(0);
}
ProfileManager& profile_manager;
Common::UUID user_id{}; ///< The user id this profile refers to.
};
@@ -511,7 +518,15 @@ class IProfileEditor final : public IProfileCommon {
public:
explicit IProfileEditor(Core::System& system_, Common::UUID user_id_,
ProfileManager& profile_manager_)
: IProfileCommon{system_, "IProfileEditor", true, user_id_, profile_manager_} {}
: IProfileCommon{system_, "IProfileEditor", true, user_id_, profile_manager_} {
// clang-format off
static const FunctionInfo functions[] = {
{30, &IProfileEditor::Unknown, "Unknown"},
};
// clang-format on
RegisterHandlers(functions);
}
};
class ISessionObject final : public ServiceFramework<ISessionObject> {

View File

@@ -8,10 +8,6 @@ add_executable(yuzu-room
)
target_link_libraries(yuzu-room PRIVATE common network)
if (ENABLE_WEB_SERVICE)
target_compile_definitions(yuzu-room PRIVATE -DENABLE_WEB_SERVICE)
target_link_libraries(yuzu-room PRIVATE web_service)
endif()
target_link_libraries(yuzu-room PRIVATE mbedtls mbedcrypto)
if (MSVC)

View File

@@ -33,10 +33,6 @@
#include "network/room.h"
#include "network/verify_user.h"
#ifdef ENABLE_WEB_SERVICE
#include "web_service/verify_user_jwt.h"
#endif
#undef _UNICODE
#include <getopt.h>
#ifndef _MSC_VER
@@ -351,14 +347,9 @@ int main(int argc, char** argv) {
std::unique_ptr<Network::VerifyUser::Backend> verify_backend;
if (announce) {
#ifdef ENABLE_WEB_SERVICE
verify_backend =
std::make_unique<WebService::VerifyUserJWT>(Settings::values.web_api_url.GetValue());
#else
LOG_INFO(Network,
"yuzu Web Services is not available with this build: validation is disabled.");
verify_backend = std::make_unique<Network::VerifyUser::NullBackend>();
#endif
} else {
verify_backend = std::make_unique<Network::VerifyUser::NullBackend>();
}

View File

@@ -20,10 +20,6 @@ add_library(network STATIC
create_target_directory_groups(network)
target_link_libraries(network PRIVATE common enet::enet Boost::headers)
if (ENABLE_WEB_SERVICE)
target_compile_definitions(network PRIVATE -DENABLE_WEB_SERVICE)
target_link_libraries(network PRIVATE web_service)
endif()
if (YUZU_USE_PRECOMPILED_HEADERS)
target_precompile_headers(network PRIVATE precompiled_headers.h)

View File

@@ -7,13 +7,8 @@
#include "announce_multiplayer_session.h"
#include "common/announce_multiplayer_room.h"
#include "common/assert.h"
#include "common/settings.h"
#include "network/network.h"
#ifdef ENABLE_WEB_SERVICE
#include "web_service/announce_room_json.h"
#endif
namespace Core {
// Time between room is announced to web_service
@@ -21,13 +16,7 @@ static constexpr std::chrono::seconds announce_time_interval(15);
AnnounceMultiplayerSession::AnnounceMultiplayerSession(Network::RoomNetwork& room_network_)
: room_network{room_network_} {
#ifdef ENABLE_WEB_SERVICE
backend = std::make_unique<WebService::RoomJson>(Settings::values.web_api_url.GetValue(),
Settings::values.yuzu_username.GetValue(),
Settings::values.yuzu_token.GetValue());
#else
backend = std::make_unique<AnnounceMultiplayerRoom::NullBackend>();
#endif
}
WebService::WebResult AnnounceMultiplayerSession::Register() {
@@ -153,12 +142,6 @@ bool AnnounceMultiplayerSession::IsRunning() const {
void AnnounceMultiplayerSession::UpdateCredentials() {
ASSERT_MSG(!IsRunning(), "Credentials can only be updated when session is not running");
#ifdef ENABLE_WEB_SERVICE
backend = std::make_unique<WebService::RoomJson>(Settings::values.web_api_url.GetValue(),
Settings::values.yuzu_username.GetValue(),
Settings::values.yuzu_token.GetValue());
#endif
}
} // namespace Core

View File

@@ -425,10 +425,6 @@ if (USE_DISCORD_PRESENCE)
target_compile_definitions(yuzu PRIVATE -DUSE_DISCORD_PRESENCE)
endif()
if (ENABLE_WEB_SERVICE)
target_compile_definitions(yuzu PRIVATE -DENABLE_WEB_SERVICE)
endif()
if (YUZU_USE_QT_MULTIMEDIA)
target_link_libraries(yuzu PRIVATE Qt${QT_MAJOR_VERSION}::Multimedia)
target_compile_definitions(yuzu PRIVATE -DYUZU_USE_QT_MULTIMEDIA)

View File

@@ -13,9 +13,6 @@
#include "input_common/drivers/virtual_amiibo.h"
#include "input_common/main.h"
#include "ui_qt_amiibo_settings.h"
#ifdef ENABLE_WEB_SERVICE
#include "web_service/web_backend.h"
#endif
#include "yuzu/applets/qt_amiibo_settings.h"
#include "yuzu/main.h"
@@ -91,55 +88,6 @@ void QtAmiiboSettingsDialog::LoadAmiiboInfo() {
ui->amiiboInfoGroup->setVisible(false);
}
void QtAmiiboSettingsDialog::LoadAmiiboApiInfo(std::string_view amiibo_id) {
#ifdef ENABLE_WEB_SERVICE
// TODO: Host this data on our website
WebService::Client client{"https://amiiboapi.com", {}, {}};
WebService::Client image_client{"https://raw.githubusercontent.com", {}, {}};
const auto url_path = fmt::format("/api/amiibo/?id={}", amiibo_id);
const auto amiibo_json = client.GetJson(url_path, true).returned_data;
if (amiibo_json.empty()) {
ui->amiiboImageLabel->setVisible(false);
ui->amiiboInfoGroup->setVisible(false);
return;
}
std::string amiibo_series{};
std::string amiibo_name{};
std::string amiibo_image_url{};
std::string amiibo_type{};
const auto parsed_amiibo_json_json = nlohmann::json::parse(amiibo_json).at("amiibo");
parsed_amiibo_json_json.at("amiiboSeries").get_to(amiibo_series);
parsed_amiibo_json_json.at("name").get_to(amiibo_name);
parsed_amiibo_json_json.at("image").get_to(amiibo_image_url);
parsed_amiibo_json_json.at("type").get_to(amiibo_type);
ui->amiiboSeriesValue->setText(QString::fromStdString(amiibo_series));
ui->amiiboNameValue->setText(QString::fromStdString(amiibo_name));
ui->amiiboTypeValue->setText(QString::fromStdString(amiibo_type));
if (amiibo_image_url.size() < 34) {
ui->amiiboImageLabel->setVisible(false);
}
const auto image_url_path = amiibo_image_url.substr(34, amiibo_image_url.size() - 34);
const auto image_data = image_client.GetImage(image_url_path, true).returned_data;
if (image_data.empty()) {
ui->amiiboImageLabel->setVisible(false);
}
QPixmap pixmap;
pixmap.loadFromData(reinterpret_cast<const u8*>(image_data.data()),
static_cast<uint>(image_data.size()));
pixmap = pixmap.scaled(250, 350, Qt::AspectRatioMode::KeepAspectRatio,
Qt::TransformationMode::SmoothTransformation);
ui->amiiboImageLabel->setPixmap(pixmap);
#endif
}
void QtAmiiboSettingsDialog::LoadAmiiboData() {
Service::NFP::RegisterInfo register_info{};
Service::NFP::CommonInfo common_info{};

View File

@@ -43,7 +43,6 @@ public:
private:
void LoadInfo();
void LoadAmiiboInfo();
void LoadAmiiboApiInfo(std::string_view amiibo_id);
void LoadAmiiboData();
void LoadAmiiboGameInfo();
void SetGameDataName(u32 application_area_id);

View File

@@ -71,11 +71,14 @@ std::unique_ptr<TranslationMap> InitializeTranslations(QWidget* parent) {
"faster or not.\n200% for a 30 FPS game is 60 FPS, and for a "
"60 FPS game it will be 120 FPS.\nDisabling it means unlocking the framerate to the "
"maximum your PC can reach."));
INSERT(Settings, sync_core_speed, tr("Synchronize core speed"),
tr("Synchronizes CPU core speed to game's maximum rendering speed, which can be useful to "
"increase FPS without increasing the actual speed of the game (animations, physics, etc.)\n"
"It's up to each game if it plays well with this or not. Most games (specially original ones) "
"simply ignore this.\nThis can help play the game stutter-free at a lower framerate."));
INSERT(
Settings, sync_core_speed, tr("Synchronize core speed"),
tr("Synchronizes CPU core speed to game's maximum rendering speed, which can be useful to "
"increase FPS without increasing the actual speed of the game (animations, physics, "
"etc.)\n"
"It's up to each game if it plays well with this or not. Most games (specially original "
"ones) "
"simply ignore this.\nThis can help play the game stutter-free at a lower framerate."));
// Cpu
INSERT(Settings, cpu_accuracy, tr("Accuracy:"),

View File

@@ -21,8 +21,8 @@
#include "common/linux/gamemode.h"
#endif
#include <httplib.h>
#include <boost/container/flat_set.hpp>
#include <httplib.h>
// VFS includes must be before glad as they will conflict with Windows file api, which uses defines.
#include "applets/qt_amiibo_settings.h"
@@ -3520,38 +3520,24 @@ void GMainWindow::OpenURL(const QUrl& url) {
}
void GMainWindow::OnOpenMirrorRepo() {
struct Mirror {
const char *host, *path;
};
const std::initializer_list<Mirror> 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;
}
httplib::Client cli("https://codeberg.org");
auto res = cli.Get("/litucks/tz-mu/raw/branch/main/mu.txt");
if (!res) {
QMessageBox::warning(
this, tr("Error locating mirror"),
tr("There has been an error finding the current mirror repository.<br/>"
"Your version may be too old or your network connectivity may be"
"limited.<br/>"
"Please either try again later, through a VPN or access the main<br/>"
"repository via the Tor Browser:<br/>"
"<a "
"href='http://y2nlvhmmk5jnsvechppxnbyzmmv3vbl7dvzn6ltwcdbpgxixp3clkgqd.onion/"
"torzu-emu/torzu'>http://"
"y2nlvhmmk5jnsvechppxnbyzmmv3vbl7dvzn6ltwcdbpgxixp3clkgqd.onion/torzu-emu/torzu</"
"a>"));
}
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"));
OpenURL(QUrl(QString::fromStdString(res->body)));
}
void GMainWindow::ToggleFullscreen() {

View File

@@ -21,9 +21,6 @@
#include "yuzu/game_list_p.h"
#include "yuzu/multiplayer/chat_room.h"
#include "yuzu/multiplayer/message.h"
#ifdef ENABLE_WEB_SERVICE
#include "web_service/web_backend.h"
#endif
class ChatMessage {
public:
@@ -387,38 +384,6 @@ void ChatRoom::SetPlayerList(const Network::RoomMember::MemberList& member_list)
QStandardItem* name_item = new PlayerListItem(member.nickname, member.username,
member.avatar_url, member.game_info);
#ifdef ENABLE_WEB_SERVICE
if (!icon_cache.count(member.avatar_url) && !member.avatar_url.empty()) {
// Start a request to get the member's avatar
const QUrl url(QString::fromStdString(member.avatar_url));
QFuture<std::string> future = QtConcurrent::run([url] {
WebService::Client client(
QStringLiteral("%1://%2").arg(url.scheme(), url.host()).toStdString(), "", "");
auto result = client.GetImage(url.path().toStdString(), true);
if (result.returned_data.empty()) {
LOG_ERROR(WebService, "Failed to get avatar");
}
return result.returned_data;
});
auto* future_watcher = new QFutureWatcher<std::string>(this);
connect(future_watcher, &QFutureWatcher<std::string>::finished, this,
[this, future_watcher, avatar_url = member.avatar_url] {
const std::string result = future_watcher->result();
if (result.empty())
return;
QPixmap pixmap;
if (!pixmap.loadFromData(reinterpret_cast<const u8*>(result.data()),
static_cast<uint>(result.size())))
return;
icon_cache[avatar_url] =
pixmap.scaled(48, 48, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
// Update all the displayed icons with the new icon_cache
UpdateIconDisplay();
});
future_watcher->setFuture(future);
}
#endif
player_list->invisibleRootItem()->appendRow(name_item);
}
UpdateIconDisplay();

View File

@@ -23,9 +23,6 @@
#include "yuzu/multiplayer/state.h"
#include "yuzu/multiplayer/validation.h"
#include "yuzu/uisettings.h"
#ifdef ENABLE_WEB_SERVICE
#include "web_service/verify_user_jwt.h"
#endif
HostRoomWindow::HostRoomWindow(QWidget* parent, QStandardItemModel* list,
std::shared_ptr<Core::AnnounceMultiplayerSession> session,
@@ -98,12 +95,7 @@ std::unique_ptr<Network::VerifyUser::Backend> HostRoomWindow::CreateVerifyBacken
bool use_validation) const {
std::unique_ptr<Network::VerifyUser::Backend> verify_backend;
if (use_validation) {
#ifdef ENABLE_WEB_SERVICE
verify_backend =
std::make_unique<WebService::VerifyUserJWT>(Settings::values.web_api_url.GetValue());
#else
verify_backend = std::make_unique<Network::VerifyUser::NullBackend>();
#endif
} else {
verify_backend = std::make_unique<Network::VerifyUser::NullBackend>();
}
@@ -201,21 +193,6 @@ void HostRoomWindow::Host() {
}
}
std::string token;
#ifdef ENABLE_WEB_SERVICE
if (is_public) {
WebService::Client client(Settings::values.web_api_url.GetValue(),
Settings::values.yuzu_username.GetValue(),
Settings::values.yuzu_token.GetValue());
if (auto room = room_network.GetRoom().lock()) {
token = client.GetExternalJWT(room->GetVerifyUID()).returned_data;
}
if (token.empty()) {
LOG_ERROR(WebService, "Could not get external JWT, verification may fail");
} else {
LOG_INFO(WebService, "Successfully requested external JWT: size={}", token.size());
}
}
#endif
// TODO: Check what to do with this
member->Join(ui->username->text().toStdString(), "127.0.0.1", port, 0,
Network::NoPreferredIP, password, token);

View File

@@ -20,9 +20,6 @@
#include "yuzu/multiplayer/state.h"
#include "yuzu/multiplayer/validation.h"
#include "yuzu/uisettings.h"
#ifdef ENABLE_WEB_SERVICE
#include "web_service/web_backend.h"
#endif
Lobby::Lobby(QWidget* parent, QStandardItemModel* list,
std::shared_ptr<Core::AnnounceMultiplayerSession> session, Core::System& system_)
@@ -186,20 +183,6 @@ void Lobby::OnJoinRoom(const QModelIndex& source) {
// attempt to connect in a different thread
QFuture<void> f = QtConcurrent::run([nickname, ip, port, password, verify_uid, this] {
std::string token;
#ifdef ENABLE_WEB_SERVICE
if (!Settings::values.yuzu_username.GetValue().empty() &&
!Settings::values.yuzu_token.GetValue().empty()) {
WebService::Client client(Settings::values.web_api_url.GetValue(),
Settings::values.yuzu_username.GetValue(),
Settings::values.yuzu_token.GetValue());
token = client.GetExternalJWT(verify_uid).returned_data;
if (token.empty()) {
LOG_ERROR(WebService, "Could not get external JWT, verification may fail");
} else {
LOG_INFO(WebService, "Successfully requested external JWT: size={}", token.size());
}
}
#endif
if (auto room_member = room_network.GetRoomMember().lock()) {
room_member->Join(nickname, ip.c_str(), port, 0, Network::NoPreferredIP, password,
token);