Compare commits
2 Commits
__refs_pul
...
__refs_pul
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
de8f7e1250 | ||
|
|
2898be69f4 |
@@ -9,7 +9,7 @@ parameters:
|
||||
steps:
|
||||
- script: choco install vulkan-sdk
|
||||
displayName: 'Install vulkan-sdk'
|
||||
- script: refreshenv && mkdir build && cd build && cmake -G "Visual Studio 17 2022" -A x64 -DYUZU_USE_BUNDLED_QT=1 -DYUZU_USE_BUNDLED_SDL2=1 -DYUZU_USE_QT_WEB_ENGINE=ON -DENABLE_COMPATIBILITY_LIST_DOWNLOAD=ON -DYUZU_ENABLE_COMPATIBILITY_REPORTING=${COMPAT} -DYUZU_TESTS=OFF -DUSE_DISCORD_PRESENCE=ON -DENABLE_QT_TRANSLATION=ON -DDISPLAY_VERSION=${{ parameters['version'] }} -DCMAKE_BUILD_TYPE=Release .. && cd ..
|
||||
- script: refreshenv && mkdir build && cd build && cmake -G "Visual Studio 16 2019" -A x64 -DYUZU_USE_BUNDLED_QT=1 -DYUZU_USE_BUNDLED_SDL2=1 -DYUZU_USE_QT_WEB_ENGINE=ON -DENABLE_COMPATIBILITY_LIST_DOWNLOAD=ON -DYUZU_ENABLE_COMPATIBILITY_REPORTING=${COMPAT} -DYUZU_TESTS=OFF -DUSE_DISCORD_PRESENCE=ON -DENABLE_QT_TRANSLATION=ON -DDISPLAY_VERSION=${{ parameters['version'] }} -DCMAKE_BUILD_TYPE=Release .. && cd ..
|
||||
displayName: 'Configure CMake'
|
||||
- task: MSBuild@1
|
||||
displayName: 'Build'
|
||||
|
||||
@@ -50,7 +50,7 @@ stages:
|
||||
timeoutInMinutes: 120
|
||||
displayName: 'msvc'
|
||||
pool:
|
||||
vmImage: windows-2022
|
||||
vmImage: windows-2019
|
||||
steps:
|
||||
- template: ./templates/sync-source.yml
|
||||
parameters:
|
||||
|
||||
@@ -15,7 +15,7 @@ stages:
|
||||
timeoutInMinutes: 120
|
||||
displayName: 'windows-msvc'
|
||||
pool:
|
||||
vmImage: windows-2022
|
||||
vmImage: windows-2019
|
||||
steps:
|
||||
- template: ./templates/sync-source.yml
|
||||
parameters:
|
||||
|
||||
2
.github/workflows/verify.yml
vendored
2
.github/workflows/verify.yml
vendored
@@ -71,7 +71,7 @@ jobs:
|
||||
build-msvc:
|
||||
name: 'test build (windows, msvc)'
|
||||
needs: format
|
||||
runs-on: windows-2022
|
||||
runs-on: windows-2019
|
||||
steps:
|
||||
- name: Set up cache
|
||||
uses: actions/cache@v3
|
||||
|
||||
@@ -16,7 +16,6 @@ namespace AnnounceMultiplayerRoom {
|
||||
struct GameInfo {
|
||||
std::string name{""};
|
||||
u64 id{0};
|
||||
std::string version{""};
|
||||
};
|
||||
|
||||
struct Member {
|
||||
|
||||
@@ -102,6 +102,8 @@ struct AnalogProperties {
|
||||
float offset{};
|
||||
// Invert direction of the sensor data
|
||||
bool inverted{};
|
||||
// Press once to activate, press again to release
|
||||
bool toggle{};
|
||||
};
|
||||
|
||||
// Single analog sensor data
|
||||
@@ -115,8 +117,11 @@ struct AnalogStatus {
|
||||
struct ButtonStatus {
|
||||
Common::UUID uuid{};
|
||||
bool value{};
|
||||
// Invert value of the button
|
||||
bool inverted{};
|
||||
// Press once to activate, press again to release
|
||||
bool toggle{};
|
||||
// Internal lock for the toggle status
|
||||
bool locked{};
|
||||
};
|
||||
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
add_library(core STATIC
|
||||
announce_multiplayer_session.cpp
|
||||
announce_multiplayer_session.h
|
||||
arm/arm_interface.h
|
||||
arm/arm_interface.cpp
|
||||
arm/dynarmic/arm_dynarmic_32.cpp
|
||||
@@ -538,14 +540,14 @@ add_library(core STATIC
|
||||
hle/service/npns/npns.cpp
|
||||
hle/service/npns/npns.h
|
||||
hle/service/ns/errors.h
|
||||
hle/service/ns/iplatform_service_manager.cpp
|
||||
hle/service/ns/iplatform_service_manager.h
|
||||
hle/service/ns/language.cpp
|
||||
hle/service/ns/language.h
|
||||
hle/service/ns/ns.cpp
|
||||
hle/service/ns/ns.h
|
||||
hle/service/ns/pdm_qry.cpp
|
||||
hle/service/ns/pdm_qry.h
|
||||
hle/service/ns/pl_u.cpp
|
||||
hle/service/ns/pl_u.h
|
||||
hle/service/nvdrv/devices/nvdevice.h
|
||||
hle/service/nvdrv/devices/nvdisp_disp0.cpp
|
||||
hle/service/nvdrv/devices/nvdisp_disp0.h
|
||||
|
||||
@@ -319,19 +319,10 @@ struct System::Impl {
|
||||
if (app_loader->ReadTitle(name) != Loader::ResultStatus::Success) {
|
||||
LOG_ERROR(Core, "Failed to read title for ROM (Error {})", load_result);
|
||||
}
|
||||
|
||||
std::string title_version;
|
||||
const FileSys::PatchManager pm(program_id, system.GetFileSystemController(),
|
||||
system.GetContentProvider());
|
||||
const auto metadata = pm.GetControlMetadata();
|
||||
if (metadata.first != nullptr) {
|
||||
title_version = metadata.first->GetVersionString();
|
||||
}
|
||||
if (auto room_member = room_network.GetRoomMember().lock()) {
|
||||
Network::GameInfo game_info;
|
||||
game_info.name = name;
|
||||
game_info.id = program_id;
|
||||
game_info.version = title_version;
|
||||
room_member->SendGameInfo(game_info);
|
||||
}
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#include "core/file_sys/system_archive/data/font_standard.h"
|
||||
#include "core/file_sys/system_archive/shared_font.h"
|
||||
#include "core/file_sys/vfs_vector.h"
|
||||
#include "core/hle/service/ns/iplatform_service_manager.h"
|
||||
#include "core/hle/service/ns/pl_u.h"
|
||||
|
||||
namespace FileSys::SystemArchive {
|
||||
|
||||
|
||||
@@ -52,6 +52,9 @@ Common::Input::ButtonStatus TransformToButton(const Common::Input::CallbackStatu
|
||||
Common::Input::ButtonStatus status{};
|
||||
switch (callback.type) {
|
||||
case Common::Input::InputType::Analog:
|
||||
status.value = TransformToTrigger(callback).pressed.value;
|
||||
status.toggle = callback.analog_status.properties.toggle;
|
||||
break;
|
||||
case Common::Input::InputType::Trigger:
|
||||
status.value = TransformToTrigger(callback).pressed.value;
|
||||
break;
|
||||
|
||||
@@ -534,7 +534,7 @@ public:
|
||||
|
||||
private:
|
||||
void CheckAvailability(Kernel::HLERequestContext& ctx) {
|
||||
LOG_DEBUG(Service_ACC, "(STUBBED) called");
|
||||
LOG_WARNING(Service_ACC, "(STUBBED) called");
|
||||
IPC::ResponseBuilder rb{ctx, 3};
|
||||
rb.Push(ResultSuccess);
|
||||
rb.Push(false); // TODO: Check when this is supposed to return true and when not
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
#include "core/hle/service/am/am.h"
|
||||
#include "core/hle/service/am/applets/applet_web_browser.h"
|
||||
#include "core/hle/service/filesystem/filesystem.h"
|
||||
#include "core/hle/service/ns/iplatform_service_manager.h"
|
||||
#include "core/hle/service/ns/pl_u.h"
|
||||
#include "core/loader/loader.h"
|
||||
|
||||
namespace Service::AM::Applets {
|
||||
|
||||
@@ -113,7 +113,7 @@ enum class LinkLevel : s8 {
|
||||
Bad,
|
||||
Low,
|
||||
Good,
|
||||
Excellent,
|
||||
Excelent,
|
||||
};
|
||||
|
||||
struct NodeLatestUpdate {
|
||||
@@ -145,19 +145,11 @@ struct NetworkId {
|
||||
static_assert(sizeof(NetworkId) == 0x20, "NetworkId is an invalid size");
|
||||
|
||||
struct Ssid {
|
||||
u8 length{};
|
||||
std::array<char, SsidLengthMax + 1> raw{};
|
||||
|
||||
Ssid() = default;
|
||||
|
||||
explicit Ssid(std::string_view data) {
|
||||
length = static_cast<u8>(std::min(data.size(), SsidLengthMax));
|
||||
data.copy(raw.data(), length);
|
||||
raw[length] = 0;
|
||||
}
|
||||
u8 length;
|
||||
std::array<char, SsidLengthMax + 1> raw;
|
||||
|
||||
std::string GetStringValue() const {
|
||||
return std::string(raw.data());
|
||||
return std::string(raw.data(), length);
|
||||
}
|
||||
};
|
||||
static_assert(sizeof(Ssid) == 0x22, "Ssid is an invalid size");
|
||||
|
||||
@@ -9,10 +9,10 @@
|
||||
#include "core/file_sys/vfs.h"
|
||||
#include "core/hle/ipc_helpers.h"
|
||||
#include "core/hle/service/ns/errors.h"
|
||||
#include "core/hle/service/ns/iplatform_service_manager.h"
|
||||
#include "core/hle/service/ns/language.h"
|
||||
#include "core/hle/service/ns/ns.h"
|
||||
#include "core/hle/service/ns/pdm_qry.h"
|
||||
#include "core/hle/service/ns/pl_u.h"
|
||||
#include "core/hle/service/set/set.h"
|
||||
|
||||
namespace Service::NS {
|
||||
@@ -764,8 +764,7 @@ void InstallInterfaces(SM::ServiceManager& service_manager, Core::System& system
|
||||
|
||||
std::make_shared<PDM_QRY>(system)->InstallAsService(service_manager);
|
||||
|
||||
std::make_shared<IPlatformServiceManager>(system, "pl:s")->InstallAsService(service_manager);
|
||||
std::make_shared<IPlatformServiceManager>(system, "pl:u")->InstallAsService(service_manager);
|
||||
std::make_shared<PL_U>(system)->InstallAsService(service_manager);
|
||||
}
|
||||
|
||||
} // namespace Service::NS
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
#include "core/hle/kernel/kernel.h"
|
||||
#include "core/hle/kernel/physical_memory.h"
|
||||
#include "core/hle/service/filesystem/filesystem.h"
|
||||
#include "core/hle/service/ns/iplatform_service_manager.h"
|
||||
#include "core/hle/service/ns/pl_u.h"
|
||||
|
||||
namespace Service::NS {
|
||||
|
||||
@@ -99,7 +99,7 @@ static u32 GetU32Swapped(const u8* data) {
|
||||
return Common::swap32(value);
|
||||
}
|
||||
|
||||
struct IPlatformServiceManager::Impl {
|
||||
struct PL_U::Impl {
|
||||
const FontRegion& GetSharedFontRegion(std::size_t index) const {
|
||||
if (index >= shared_font_regions.size() || shared_font_regions.empty()) {
|
||||
// No font fallback
|
||||
@@ -134,16 +134,16 @@ struct IPlatformServiceManager::Impl {
|
||||
std::vector<FontRegion> shared_font_regions;
|
||||
};
|
||||
|
||||
IPlatformServiceManager::IPlatformServiceManager(Core::System& system_, const char* service_name_)
|
||||
: ServiceFramework{system_, service_name_}, impl{std::make_unique<Impl>()} {
|
||||
PL_U::PL_U(Core::System& system_)
|
||||
: ServiceFramework{system_, "pl:u"}, impl{std::make_unique<Impl>()} {
|
||||
// clang-format off
|
||||
static const FunctionInfo functions[] = {
|
||||
{0, &IPlatformServiceManager::RequestLoad, "RequestLoad"},
|
||||
{1, &IPlatformServiceManager::GetLoadState, "GetLoadState"},
|
||||
{2, &IPlatformServiceManager::GetSize, "GetSize"},
|
||||
{3, &IPlatformServiceManager::GetSharedMemoryAddressOffset, "GetSharedMemoryAddressOffset"},
|
||||
{4, &IPlatformServiceManager::GetSharedMemoryNativeHandle, "GetSharedMemoryNativeHandle"},
|
||||
{5, &IPlatformServiceManager::GetSharedFontInOrderOfPriority, "GetSharedFontInOrderOfPriority"},
|
||||
{0, &PL_U::RequestLoad, "RequestLoad"},
|
||||
{1, &PL_U::GetLoadState, "GetLoadState"},
|
||||
{2, &PL_U::GetSize, "GetSize"},
|
||||
{3, &PL_U::GetSharedMemoryAddressOffset, "GetSharedMemoryAddressOffset"},
|
||||
{4, &PL_U::GetSharedMemoryNativeHandle, "GetSharedMemoryNativeHandle"},
|
||||
{5, &PL_U::GetSharedFontInOrderOfPriority, "GetSharedFontInOrderOfPriority"},
|
||||
{6, nullptr, "GetSharedFontInOrderOfPriorityForSystem"},
|
||||
{100, nullptr, "RequestApplicationFunctionAuthorization"},
|
||||
{101, nullptr, "RequestApplicationFunctionAuthorizationByProcessId"},
|
||||
@@ -206,9 +206,9 @@ IPlatformServiceManager::IPlatformServiceManager(Core::System& system_, const ch
|
||||
}
|
||||
}
|
||||
|
||||
IPlatformServiceManager::~IPlatformServiceManager() = default;
|
||||
PL_U::~PL_U() = default;
|
||||
|
||||
void IPlatformServiceManager::RequestLoad(Kernel::HLERequestContext& ctx) {
|
||||
void PL_U::RequestLoad(Kernel::HLERequestContext& ctx) {
|
||||
IPC::RequestParser rp{ctx};
|
||||
const u32 shared_font_type{rp.Pop<u32>()};
|
||||
// Games don't call this so all fonts should be loaded
|
||||
@@ -218,7 +218,7 @@ void IPlatformServiceManager::RequestLoad(Kernel::HLERequestContext& ctx) {
|
||||
rb.Push(ResultSuccess);
|
||||
}
|
||||
|
||||
void IPlatformServiceManager::GetLoadState(Kernel::HLERequestContext& ctx) {
|
||||
void PL_U::GetLoadState(Kernel::HLERequestContext& ctx) {
|
||||
IPC::RequestParser rp{ctx};
|
||||
const u32 font_id{rp.Pop<u32>()};
|
||||
LOG_DEBUG(Service_NS, "called, font_id={}", font_id);
|
||||
@@ -228,7 +228,7 @@ void IPlatformServiceManager::GetLoadState(Kernel::HLERequestContext& ctx) {
|
||||
rb.Push<u32>(static_cast<u32>(LoadState::Done));
|
||||
}
|
||||
|
||||
void IPlatformServiceManager::GetSize(Kernel::HLERequestContext& ctx) {
|
||||
void PL_U::GetSize(Kernel::HLERequestContext& ctx) {
|
||||
IPC::RequestParser rp{ctx};
|
||||
const u32 font_id{rp.Pop<u32>()};
|
||||
LOG_DEBUG(Service_NS, "called, font_id={}", font_id);
|
||||
@@ -238,7 +238,7 @@ void IPlatformServiceManager::GetSize(Kernel::HLERequestContext& ctx) {
|
||||
rb.Push<u32>(impl->GetSharedFontRegion(font_id).size);
|
||||
}
|
||||
|
||||
void IPlatformServiceManager::GetSharedMemoryAddressOffset(Kernel::HLERequestContext& ctx) {
|
||||
void PL_U::GetSharedMemoryAddressOffset(Kernel::HLERequestContext& ctx) {
|
||||
IPC::RequestParser rp{ctx};
|
||||
const u32 font_id{rp.Pop<u32>()};
|
||||
LOG_DEBUG(Service_NS, "called, font_id={}", font_id);
|
||||
@@ -248,7 +248,7 @@ void IPlatformServiceManager::GetSharedMemoryAddressOffset(Kernel::HLERequestCon
|
||||
rb.Push<u32>(impl->GetSharedFontRegion(font_id).offset);
|
||||
}
|
||||
|
||||
void IPlatformServiceManager::GetSharedMemoryNativeHandle(Kernel::HLERequestContext& ctx) {
|
||||
void PL_U::GetSharedMemoryNativeHandle(Kernel::HLERequestContext& ctx) {
|
||||
// Map backing memory for the font data
|
||||
LOG_DEBUG(Service_NS, "called");
|
||||
|
||||
@@ -261,7 +261,7 @@ void IPlatformServiceManager::GetSharedMemoryNativeHandle(Kernel::HLERequestCont
|
||||
rb.PushCopyObjects(&kernel.GetFontSharedMem());
|
||||
}
|
||||
|
||||
void IPlatformServiceManager::GetSharedFontInOrderOfPriority(Kernel::HLERequestContext& ctx) {
|
||||
void PL_U::GetSharedFontInOrderOfPriority(Kernel::HLERequestContext& ctx) {
|
||||
IPC::RequestParser rp{ctx};
|
||||
const u64 language_code{rp.Pop<u64>()}; // TODO(ogniK): Find out what this is used for
|
||||
LOG_DEBUG(Service_NS, "called, language_code={:X}", language_code);
|
||||
@@ -36,10 +36,10 @@ constexpr std::array<std::pair<FontArchives, const char*>, 7> SHARED_FONTS{
|
||||
void DecryptSharedFontToTTF(const std::vector<u32>& input, std::vector<u8>& output);
|
||||
void EncryptSharedFont(const std::vector<u32>& input, std::vector<u8>& output, std::size_t& offset);
|
||||
|
||||
class IPlatformServiceManager final : public ServiceFramework<IPlatformServiceManager> {
|
||||
class PL_U final : public ServiceFramework<PL_U> {
|
||||
public:
|
||||
explicit IPlatformServiceManager(Core::System& system_, const char* service_name_);
|
||||
~IPlatformServiceManager() override;
|
||||
explicit PL_U(Core::System& system_);
|
||||
~PL_U() override;
|
||||
|
||||
private:
|
||||
void RequestLoad(Kernel::HLERequestContext& ctx);
|
||||
@@ -933,11 +933,7 @@ BSD::BSD(Core::System& system_, const char* name)
|
||||
}
|
||||
}
|
||||
|
||||
BSD::~BSD() {
|
||||
if (auto room_member = room_network.GetRoomMember().lock()) {
|
||||
room_member->Unbind(proxy_packet_received);
|
||||
}
|
||||
}
|
||||
BSD::~BSD() = default;
|
||||
|
||||
BSDCFG::BSDCFG(Core::System& system_) : ServiceFramework{system_, "bsdcfg"} {
|
||||
// clang-format off
|
||||
|
||||
@@ -26,12 +26,6 @@ void ProxySocket::HandleProxyPacket(const ProxyPacket& packet) {
|
||||
closed) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!broadcast && packet.broadcast) {
|
||||
LOG_INFO(Network, "Received broadcast packet, but not configured for broadcast mode");
|
||||
return;
|
||||
}
|
||||
|
||||
std::lock_guard guard(packets_mutex);
|
||||
received_packets.push(packet);
|
||||
}
|
||||
@@ -209,7 +203,7 @@ std::pair<s32, Errno> ProxySocket::SendTo(u32 flags, const std::vector<u8>& mess
|
||||
packet.local_endpoint = local_endpoint;
|
||||
packet.remote_endpoint = *addr;
|
||||
packet.protocol = protocol;
|
||||
packet.broadcast = broadcast && packet.remote_endpoint.ip[3] == 255;
|
||||
packet.broadcast = broadcast;
|
||||
|
||||
auto& ip = local_endpoint.ip;
|
||||
auto ipv4 = Network::GetHostIPv4Address();
|
||||
|
||||
@@ -10,13 +10,13 @@ add_executable(yuzu-room
|
||||
|
||||
create_target_directory_groups(yuzu-room)
|
||||
|
||||
target_link_libraries(yuzu-room PRIVATE common network)
|
||||
target_link_libraries(yuzu-room PRIVATE common core 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)
|
||||
target_link_libraries(yuzu-room PRIVATE mbedtls)
|
||||
if (MSVC)
|
||||
target_link_libraries(yuzu-room PRIVATE getopt)
|
||||
endif()
|
||||
|
||||
@@ -27,8 +27,8 @@
|
||||
#include "common/scm_rev.h"
|
||||
#include "common/settings.h"
|
||||
#include "common/string_util.h"
|
||||
#include "core/announce_multiplayer_session.h"
|
||||
#include "core/core.h"
|
||||
#include "network/announce_multiplayer_session.h"
|
||||
#include "network/network.h"
|
||||
#include "network/room.h"
|
||||
#include "network/verify_user.h"
|
||||
@@ -75,12 +75,6 @@ static constexpr char BanListMagic[] = "YuzuRoom-BanList-1";
|
||||
|
||||
static constexpr char token_delimiter{':'};
|
||||
|
||||
static void PadToken(std::string& token) {
|
||||
while (token.size() % 4 != 0) {
|
||||
token.push_back('=');
|
||||
}
|
||||
}
|
||||
|
||||
static std::string UsernameFromDisplayToken(const std::string& display_token) {
|
||||
std::size_t outlen;
|
||||
|
||||
@@ -306,7 +300,6 @@ int main(int argc, char** argv) {
|
||||
if (username.empty()) {
|
||||
LOG_INFO(Network, "Hosting a public room");
|
||||
Settings::values.web_api_url = web_api_url;
|
||||
PadToken(token);
|
||||
Settings::values.yuzu_username = UsernameFromDisplayToken(token);
|
||||
username = Settings::values.yuzu_username.GetValue();
|
||||
Settings::values.yuzu_token = TokenFromDisplayToken(token);
|
||||
|
||||
@@ -40,13 +40,13 @@ public:
|
||||
void EnableMotion() {
|
||||
if (sdl_controller) {
|
||||
SDL_GameController* controller = sdl_controller.get();
|
||||
has_accel = SDL_GameControllerHasSensor(controller, SDL_SENSOR_ACCEL);
|
||||
has_gyro = SDL_GameControllerHasSensor(controller, SDL_SENSOR_GYRO);
|
||||
if (has_accel) {
|
||||
if (SDL_GameControllerHasSensor(controller, SDL_SENSOR_ACCEL) && !has_accel) {
|
||||
SDL_GameControllerSetSensorEnabled(controller, SDL_SENSOR_ACCEL, SDL_TRUE);
|
||||
has_accel = true;
|
||||
}
|
||||
if (has_gyro) {
|
||||
if (SDL_GameControllerHasSensor(controller, SDL_SENSOR_GYRO) && !has_gyro) {
|
||||
SDL_GameControllerSetSensorEnabled(controller, SDL_SENSOR_GYRO, SDL_TRUE);
|
||||
has_gyro = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -305,7 +305,6 @@ void SDLDriver::InitJoystick(int joystick_index) {
|
||||
auto joystick = std::make_shared<SDLJoystick>(guid, 0, sdl_joystick, sdl_gamecontroller);
|
||||
PreSetController(joystick->GetPadIdentifier());
|
||||
SetBattery(joystick->GetPadIdentifier(), joystick->GetBatteryLevel());
|
||||
joystick->EnableMotion();
|
||||
joystick_map[guid].emplace_back(std::move(joystick));
|
||||
return;
|
||||
}
|
||||
@@ -317,7 +316,6 @@ void SDLDriver::InitJoystick(int joystick_index) {
|
||||
|
||||
if (joystick_it != joystick_guid_list.end()) {
|
||||
(*joystick_it)->SetSDLJoystick(sdl_joystick, sdl_gamecontroller);
|
||||
(*joystick_it)->EnableMotion();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -325,7 +323,6 @@ void SDLDriver::InitJoystick(int joystick_index) {
|
||||
auto joystick = std::make_shared<SDLJoystick>(guid, port, sdl_joystick, sdl_gamecontroller);
|
||||
PreSetController(joystick->GetPadIdentifier());
|
||||
SetBattery(joystick->GetPadIdentifier(), joystick->GetBatteryLevel());
|
||||
joystick->EnableMotion();
|
||||
joystick_guid_list.emplace_back(std::move(joystick));
|
||||
}
|
||||
|
||||
|
||||
@@ -824,6 +824,7 @@ std::unique_ptr<Common::Input::InputDevice> InputFactory::CreateAnalogDevice(
|
||||
.threshold = std::clamp(params.Get("threshold", 0.5f), 0.0f, 1.0f),
|
||||
.offset = std::clamp(params.Get("offset", 0.0f), -1.0f, 1.0f),
|
||||
.inverted = params.Get("invert", "+") == "-",
|
||||
.toggle = static_cast<bool>(params.Get("toggle", false)),
|
||||
};
|
||||
input_engine->PreSetController(identifier);
|
||||
input_engine->PreSetAxis(identifier, axis);
|
||||
|
||||
@@ -2,8 +2,6 @@
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
add_library(network STATIC
|
||||
announce_multiplayer_session.cpp
|
||||
announce_multiplayer_session.h
|
||||
network.cpp
|
||||
network.h
|
||||
packet.cpp
|
||||
@@ -19,7 +17,3 @@ add_library(network STATIC
|
||||
create_target_directory_groups(network)
|
||||
|
||||
target_link_libraries(network PRIVATE common enet Boost::boost)
|
||||
if (ENABLE_WEB_SERVICE)
|
||||
target_compile_definitions(network PRIVATE -DENABLE_WEB_SERVICE)
|
||||
target_link_libraries(network PRIVATE web_service)
|
||||
endif()
|
||||
|
||||
@@ -221,7 +221,7 @@ public:
|
||||
* Extracts the game name from a received ENet packet and broadcasts it.
|
||||
* @param event The ENet event that was received.
|
||||
*/
|
||||
void HandleGameInfoPacket(const ENetEvent* event);
|
||||
void HandleGameNamePacket(const ENetEvent* event);
|
||||
|
||||
/**
|
||||
* Removes the client from the members list if it was in it and announces the change
|
||||
@@ -234,7 +234,7 @@ public:
|
||||
void Room::RoomImpl::ServerLoop() {
|
||||
while (state != State::Closed) {
|
||||
ENetEvent event;
|
||||
if (enet_host_service(server, &event, 5) > 0) {
|
||||
if (enet_host_service(server, &event, 50) > 0) {
|
||||
switch (event.type) {
|
||||
case ENET_EVENT_TYPE_RECEIVE:
|
||||
switch (event.packet->data[0]) {
|
||||
@@ -242,7 +242,7 @@ void Room::RoomImpl::ServerLoop() {
|
||||
HandleJoinRequest(&event);
|
||||
break;
|
||||
case IdSetGameInfo:
|
||||
HandleGameInfoPacket(&event);
|
||||
HandleGameNamePacket(&event);
|
||||
break;
|
||||
case IdProxyPacket:
|
||||
HandleProxyPacket(&event);
|
||||
@@ -778,7 +778,6 @@ void Room::RoomImpl::BroadcastRoomInformation() {
|
||||
packet.Write(member.fake_ip);
|
||||
packet.Write(member.game_info.name);
|
||||
packet.Write(member.game_info.id);
|
||||
packet.Write(member.game_info.version);
|
||||
packet.Write(member.user_data.username);
|
||||
packet.Write(member.user_data.display_name);
|
||||
packet.Write(member.user_data.avatar_url);
|
||||
@@ -818,7 +817,6 @@ void Room::RoomImpl::HandleProxyPacket(const ENetEvent* event) {
|
||||
in_packet.IgnoreBytes(sizeof(u16)); // Port
|
||||
|
||||
in_packet.IgnoreBytes(sizeof(u8)); // Protocol
|
||||
|
||||
bool broadcast;
|
||||
in_packet.Read(broadcast); // Broadcast
|
||||
|
||||
@@ -911,7 +909,7 @@ void Room::RoomImpl::HandleChatPacket(const ENetEvent* event) {
|
||||
}
|
||||
}
|
||||
|
||||
void Room::RoomImpl::HandleGameInfoPacket(const ENetEvent* event) {
|
||||
void Room::RoomImpl::HandleGameNamePacket(const ENetEvent* event) {
|
||||
Packet in_packet;
|
||||
in_packet.Append(event->packet->data, event->packet->dataLength);
|
||||
|
||||
@@ -919,7 +917,6 @@ void Room::RoomImpl::HandleGameInfoPacket(const ENetEvent* event) {
|
||||
GameInfo game_info;
|
||||
in_packet.Read(game_info.name);
|
||||
in_packet.Read(game_info.id);
|
||||
in_packet.Read(game_info.version);
|
||||
|
||||
{
|
||||
std::lock_guard lock(member_mutex);
|
||||
@@ -938,8 +935,7 @@ void Room::RoomImpl::HandleGameInfoPacket(const ENetEvent* event) {
|
||||
if (game_info.name.empty()) {
|
||||
LOG_INFO(Network, "{} is not playing", display_name);
|
||||
} else {
|
||||
LOG_INFO(Network, "{} is playing {} ({})", display_name, game_info.name,
|
||||
game_info.version);
|
||||
LOG_INFO(Network, "{} is playing {}", display_name, game_info.name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -103,7 +103,7 @@ public:
|
||||
|
||||
/**
|
||||
* Extracts a ProxyPacket from a received ENet packet.
|
||||
* @param event The ENet event that was received.
|
||||
* @param event The ENet event that was received.
|
||||
*/
|
||||
void HandleProxyPackets(const ENetEvent* event);
|
||||
|
||||
@@ -159,7 +159,7 @@ void RoomMember::RoomMemberImpl::MemberLoop() {
|
||||
while (IsConnected()) {
|
||||
std::lock_guard lock(network_mutex);
|
||||
ENetEvent event;
|
||||
if (enet_host_service(client, &event, 5) > 0) {
|
||||
if (enet_host_service(client, &event, 100) > 0) {
|
||||
switch (event.type) {
|
||||
case ENET_EVENT_TYPE_RECEIVE:
|
||||
switch (event.packet->data[0]) {
|
||||
@@ -315,7 +315,6 @@ void RoomMember::RoomMemberImpl::HandleRoomInformationPacket(const ENetEvent* ev
|
||||
packet.Read(member.fake_ip);
|
||||
packet.Read(member.game_info.name);
|
||||
packet.Read(member.game_info.id);
|
||||
packet.Read(member.game_info.version);
|
||||
packet.Read(member.username);
|
||||
packet.Read(member.display_name);
|
||||
packet.Read(member.avatar_url);
|
||||
@@ -623,7 +622,6 @@ void RoomMember::SendGameInfo(const GameInfo& game_info) {
|
||||
packet.Write(static_cast<u8>(IdSetGameInfo));
|
||||
packet.Write(game_info.name);
|
||||
packet.Write(game_info.id);
|
||||
packet.Write(game_info.version);
|
||||
room_member_impl->Send(std::move(packet));
|
||||
}
|
||||
|
||||
|
||||
@@ -146,7 +146,7 @@ public:
|
||||
const std::string& password = "", const std::string& token = "");
|
||||
|
||||
/**
|
||||
* Sends a Proxy packet to the room.
|
||||
* Sends a WiFi packet to the room.
|
||||
* @param packet The WiFi packet to send.
|
||||
*/
|
||||
void SendProxyPacket(const ProxyPacket& packet);
|
||||
|
||||
@@ -415,11 +415,11 @@ void TexturePass(Environment& env, IR::Program& program) {
|
||||
inst->SetFlags(flags);
|
||||
break;
|
||||
case IR::Opcode::ImageSampleImplicitLod:
|
||||
if (flags.type != TextureType::Color2D) {
|
||||
break;
|
||||
}
|
||||
if (ReadTextureType(env, cbuf) == TextureType::Color2DRect) {
|
||||
PatchImageSampleImplicitLod(*texture_inst.block, *texture_inst.inst);
|
||||
if (flags.type == TextureType::Color2D) {
|
||||
auto texture_type = ReadTextureType(env, cbuf);
|
||||
if (texture_type == TextureType::Color2DRect) {
|
||||
PatchImageSampleImplicitLod(*texture_inst.block, *texture_inst.inst);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case IR::Opcode::ImageFetch:
|
||||
|
||||
@@ -49,7 +49,7 @@ using VideoCommon::LoadPipelines;
|
||||
using VideoCommon::SerializePipeline;
|
||||
using Context = ShaderContext::Context;
|
||||
|
||||
constexpr u32 CACHE_VERSION = 6;
|
||||
constexpr u32 CACHE_VERSION = 5;
|
||||
|
||||
template <typename Container>
|
||||
auto MakeSpan(Container& container) {
|
||||
|
||||
@@ -53,7 +53,7 @@ using VideoCommon::FileEnvironment;
|
||||
using VideoCommon::GenericEnvironment;
|
||||
using VideoCommon::GraphicsEnvironment;
|
||||
|
||||
constexpr u32 CACHE_VERSION = 6;
|
||||
constexpr u32 CACHE_VERSION = 5;
|
||||
|
||||
template <typename Container>
|
||||
auto MakeSpan(Container& container) {
|
||||
|
||||
@@ -39,8 +39,11 @@ static Shader::TextureType ConvertType(const Tegra::Texture::TICEntry& entry) {
|
||||
return Shader::TextureType::Color1D;
|
||||
case Tegra::Texture::TextureType::Texture2D:
|
||||
case Tegra::Texture::TextureType::Texture2DNoMipmap:
|
||||
return entry.normalized_coords ? Shader::TextureType::Color2D
|
||||
: Shader::TextureType::Color2DRect;
|
||||
if (entry.normalized_coords) {
|
||||
return Shader::TextureType::Color2D;
|
||||
} else {
|
||||
return Shader::TextureType::Color2DRect;
|
||||
}
|
||||
case Tegra::Texture::TextureType::Texture3D:
|
||||
return Shader::TextureType::Color3D;
|
||||
case Tegra::Texture::TextureType::TextureCubemap:
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
#include "yuzu/uisettings.h"
|
||||
|
||||
ConfigureDebug::ConfigureDebug(const Core::System& system_, QWidget* parent)
|
||||
: QScrollArea(parent), ui{std::make_unique<Ui::ConfigureDebug>()}, system{system_} {
|
||||
: QWidget(parent), ui{std::make_unique<Ui::ConfigureDebug>()}, system{system_} {
|
||||
ui->setupUi(this);
|
||||
SetConfiguration();
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
#include <QScrollArea>
|
||||
#include <QWidget>
|
||||
|
||||
namespace Core {
|
||||
class System;
|
||||
@@ -14,7 +14,7 @@ namespace Ui {
|
||||
class ConfigureDebug;
|
||||
}
|
||||
|
||||
class ConfigureDebug : public QScrollArea {
|
||||
class ConfigureDebug : public QWidget {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
|
||||
@@ -1,11 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>ConfigureDebug</class>
|
||||
<widget class="QScrollArea" name="ConfigureDebug">
|
||||
<property name="widgetResizable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<widget class="QWidget">
|
||||
<widget class="QWidget" name="ConfigureDebug">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_1">
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
@@ -326,7 +322,6 @@
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
<tabstops>
|
||||
<tabstop>log_filter_edit</tabstop>
|
||||
<tabstop>toggle_console</tabstop>
|
||||
|
||||
@@ -161,6 +161,7 @@ QString ConfigureInputPlayer::ButtonToText(const Common::ParamPackage& param) {
|
||||
|
||||
const QString toggle = QString::fromStdString(param.Get("toggle", false) ? "~" : "");
|
||||
const QString inverted = QString::fromStdString(param.Get("inverted", false) ? "!" : "");
|
||||
const QString invert = QString::fromStdString(param.Get("invert", "+") == "-" ? "-" : "");
|
||||
const auto common_button_name = input_subsystem->GetButtonName(param);
|
||||
|
||||
// Retrieve the names from Qt
|
||||
@@ -184,7 +185,7 @@ QString ConfigureInputPlayer::ButtonToText(const Common::ParamPackage& param) {
|
||||
}
|
||||
if (param.Has("axis")) {
|
||||
const QString axis = QString::fromStdString(param.Get("axis", ""));
|
||||
return QObject::tr("%1%2Axis %3").arg(toggle, inverted, axis);
|
||||
return QObject::tr("%1%2Axis %3").arg(toggle, invert, axis);
|
||||
}
|
||||
if (param.Has("axis_x") && param.Has("axis_y") && param.Has("axis_z")) {
|
||||
const QString axis_x = QString::fromStdString(param.Get("axis_x", ""));
|
||||
@@ -362,18 +363,18 @@ ConfigureInputPlayer::ConfigureInputPlayer(QWidget* parent, std::size_t player_i
|
||||
button_map[button_id]->setText(tr("[not set]"));
|
||||
});
|
||||
if (param.Has("code") || param.Has("button") || param.Has("hat")) {
|
||||
context_menu.addAction(tr("Toggle button"), [&] {
|
||||
const bool toggle_value = !param.Get("toggle", false);
|
||||
param.Set("toggle", toggle_value);
|
||||
button_map[button_id]->setText(ButtonToText(param));
|
||||
emulated_controller->SetButtonParam(button_id, param);
|
||||
});
|
||||
context_menu.addAction(tr("Invert button"), [&] {
|
||||
const bool invert_value = !param.Get("inverted", false);
|
||||
param.Set("inverted", invert_value);
|
||||
button_map[button_id]->setText(ButtonToText(param));
|
||||
emulated_controller->SetButtonParam(button_id, param);
|
||||
});
|
||||
context_menu.addAction(tr("Toggle button"), [&] {
|
||||
const bool toggle_value = !param.Get("toggle", false);
|
||||
param.Set("toggle", toggle_value);
|
||||
button_map[button_id]->setText(ButtonToText(param));
|
||||
emulated_controller->SetButtonParam(button_id, param);
|
||||
});
|
||||
}
|
||||
if (param.Has("axis")) {
|
||||
context_menu.addAction(tr("Invert axis"), [&] {
|
||||
@@ -398,6 +399,12 @@ ConfigureInputPlayer::ConfigureInputPlayer(QWidget* parent, std::size_t player_i
|
||||
}
|
||||
emulated_controller->SetButtonParam(button_id, param);
|
||||
});
|
||||
context_menu.addAction(tr("Toggle axis"), [&] {
|
||||
const bool toggle_value = !param.Get("toggle", false);
|
||||
param.Set("toggle", toggle_value);
|
||||
button_map[button_id]->setText(ButtonToText(param));
|
||||
emulated_controller->SetButtonParam(button_id, param);
|
||||
});
|
||||
}
|
||||
context_menu.exec(button_map[button_id]->mapToGlobal(menu_location));
|
||||
});
|
||||
|
||||
@@ -860,7 +860,7 @@ void GMainWindow::InitializeWidgets() {
|
||||
});
|
||||
|
||||
multiplayer_state = new MultiplayerState(this, game_list->GetModel(), ui->action_Leave_Room,
|
||||
ui->action_Show_Room, *system);
|
||||
ui->action_Show_Room, system->GetRoomNetwork());
|
||||
multiplayer_state->setVisible(false);
|
||||
|
||||
// Create status bar
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
#include <QUrl>
|
||||
#include <QtConcurrent/QtConcurrentRun>
|
||||
#include "common/logging/log.h"
|
||||
#include "network/announce_multiplayer_session.h"
|
||||
#include "core/announce_multiplayer_session.h"
|
||||
#include "ui_chat_room.h"
|
||||
#include "yuzu/game_list_p.h"
|
||||
#include "yuzu/multiplayer/chat_room.h"
|
||||
@@ -122,22 +122,19 @@ public:
|
||||
static const int UsernameRole = Qt::UserRole + 2;
|
||||
static const int AvatarUrlRole = Qt::UserRole + 3;
|
||||
static const int GameNameRole = Qt::UserRole + 4;
|
||||
static const int GameVersionRole = Qt::UserRole + 5;
|
||||
|
||||
PlayerListItem() = default;
|
||||
explicit PlayerListItem(const std::string& nickname, const std::string& username,
|
||||
const std::string& avatar_url,
|
||||
const AnnounceMultiplayerRoom::GameInfo& game_info) {
|
||||
const std::string& avatar_url, const std::string& game_name) {
|
||||
setEditable(false);
|
||||
setData(QString::fromStdString(nickname), NicknameRole);
|
||||
setData(QString::fromStdString(username), UsernameRole);
|
||||
setData(QString::fromStdString(avatar_url), AvatarUrlRole);
|
||||
if (game_info.name.empty()) {
|
||||
if (game_name.empty()) {
|
||||
setData(QObject::tr("Not playing a game"), GameNameRole);
|
||||
} else {
|
||||
setData(QString::fromStdString(game_info.name), GameNameRole);
|
||||
setData(QString::fromStdString(game_name), GameNameRole);
|
||||
}
|
||||
setData(QString::fromStdString(game_info.version), GameVersionRole);
|
||||
}
|
||||
|
||||
QVariant data(int role) const override {
|
||||
@@ -152,13 +149,7 @@ public:
|
||||
} else {
|
||||
name = QStringLiteral("%1 (%2)").arg(nickname, username);
|
||||
}
|
||||
const QString version = data(GameVersionRole).toString();
|
||||
QString version_string;
|
||||
if (!version.isEmpty()) {
|
||||
version_string = QStringLiteral("(%1)").arg(version);
|
||||
}
|
||||
return QStringLiteral("%1\n %2 %3")
|
||||
.arg(name, data(GameNameRole).toString(), version_string);
|
||||
return QStringLiteral("%1\n %2").arg(name, data(GameNameRole).toString());
|
||||
}
|
||||
};
|
||||
|
||||
@@ -176,10 +167,6 @@ ChatRoom::ChatRoom(QWidget* parent) : QWidget(parent), ui(std::make_unique<Ui::C
|
||||
|
||||
ui->chat_history->document()->setMaximumBlockCount(max_chat_lines);
|
||||
|
||||
auto font = ui->chat_history->font();
|
||||
font.setPointSizeF(10);
|
||||
ui->chat_history->setFont(font);
|
||||
|
||||
// register the network structs to use in slots and signals
|
||||
qRegisterMetaType<Network::ChatEntry>();
|
||||
qRegisterMetaType<Network::StatusMessageEntry>();
|
||||
@@ -379,7 +366,7 @@ void ChatRoom::SetPlayerList(const Network::RoomMember::MemberList& member_list)
|
||||
if (member.nickname.empty())
|
||||
continue;
|
||||
QStandardItem* name_item = new PlayerListItem(member.nickname, member.username,
|
||||
member.avatar_url, member.game_info);
|
||||
member.avatar_url, member.game_info.name);
|
||||
|
||||
#ifdef ENABLE_WEB_SERVICE
|
||||
if (!icon_cache.count(member.avatar_url) && !member.avatar_url.empty()) {
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#include <QTime>
|
||||
#include <QtConcurrent/QtConcurrentRun>
|
||||
#include "common/logging/log.h"
|
||||
#include "network/announce_multiplayer_session.h"
|
||||
#include "core/announce_multiplayer_session.h"
|
||||
#include "ui_client_room.h"
|
||||
#include "yuzu/game_list_p.h"
|
||||
#include "yuzu/multiplayer/client_room.h"
|
||||
|
||||
@@ -8,8 +8,6 @@
|
||||
#include <QString>
|
||||
#include <QtConcurrent/QtConcurrentRun>
|
||||
#include "common/settings.h"
|
||||
#include "core/core.h"
|
||||
#include "core/internal_network/network_interface.h"
|
||||
#include "network/network.h"
|
||||
#include "ui_direct_connect.h"
|
||||
#include "yuzu/main.h"
|
||||
@@ -22,10 +20,9 @@
|
||||
|
||||
enum class ConnectionType : u8 { TraversalServer, IP };
|
||||
|
||||
DirectConnectWindow::DirectConnectWindow(Core::System& system_, QWidget* parent)
|
||||
DirectConnectWindow::DirectConnectWindow(Network::RoomNetwork& room_network_, QWidget* parent)
|
||||
: QDialog(parent, Qt::WindowTitleHint | Qt::WindowCloseButtonHint | Qt::WindowSystemMenuHint),
|
||||
ui(std::make_unique<Ui::DirectConnect>()), system{system_}, room_network{
|
||||
system.GetRoomNetwork()} {
|
||||
ui(std::make_unique<Ui::DirectConnect>()), room_network{room_network_} {
|
||||
|
||||
ui->setupUi(this);
|
||||
|
||||
@@ -56,20 +53,10 @@ void DirectConnectWindow::RetranslateUi() {
|
||||
}
|
||||
|
||||
void DirectConnectWindow::Connect() {
|
||||
if (!Network::GetSelectedNetworkInterface()) {
|
||||
NetworkMessage::ErrorManager::ShowError(
|
||||
NetworkMessage::ErrorManager::NO_INTERFACE_SELECTED);
|
||||
return;
|
||||
}
|
||||
if (!ui->nickname->hasAcceptableInput()) {
|
||||
NetworkMessage::ErrorManager::ShowError(NetworkMessage::ErrorManager::USERNAME_NOT_VALID);
|
||||
return;
|
||||
}
|
||||
if (system.IsPoweredOn()) {
|
||||
if (!NetworkMessage::WarnGameRunning()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (const auto member = room_network.GetRoomMember().lock()) {
|
||||
// Prevent the user from trying to join a room while they are already joining.
|
||||
if (member->GetState() == Network::RoomMember::State::Joining) {
|
||||
|
||||
@@ -12,15 +12,11 @@ namespace Ui {
|
||||
class DirectConnect;
|
||||
}
|
||||
|
||||
namespace Core {
|
||||
class System;
|
||||
}
|
||||
|
||||
class DirectConnectWindow : public QDialog {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit DirectConnectWindow(Core::System& system_, QWidget* parent = nullptr);
|
||||
explicit DirectConnectWindow(Network::RoomNetwork& room_network_, QWidget* parent = nullptr);
|
||||
~DirectConnectWindow();
|
||||
|
||||
void RetranslateUi();
|
||||
@@ -43,6 +39,5 @@ private:
|
||||
QFutureWatcher<void>* watcher;
|
||||
std::unique_ptr<Ui::DirectConnect> ui;
|
||||
Validation validation;
|
||||
Core::System& system;
|
||||
Network::RoomNetwork& room_network;
|
||||
};
|
||||
|
||||
@@ -12,9 +12,7 @@
|
||||
#include <QtConcurrent/QtConcurrentRun>
|
||||
#include "common/logging/log.h"
|
||||
#include "common/settings.h"
|
||||
#include "core/core.h"
|
||||
#include "core/internal_network/network_interface.h"
|
||||
#include "network/announce_multiplayer_session.h"
|
||||
#include "core/announce_multiplayer_session.h"
|
||||
#include "ui_host_room.h"
|
||||
#include "yuzu/game_list_p.h"
|
||||
#include "yuzu/main.h"
|
||||
@@ -29,11 +27,10 @@
|
||||
|
||||
HostRoomWindow::HostRoomWindow(QWidget* parent, QStandardItemModel* list,
|
||||
std::shared_ptr<Core::AnnounceMultiplayerSession> session,
|
||||
Core::System& system_)
|
||||
Network::RoomNetwork& room_network_)
|
||||
: QDialog(parent, Qt::WindowTitleHint | Qt::WindowCloseButtonHint | Qt::WindowSystemMenuHint),
|
||||
ui(std::make_unique<Ui::HostRoom>()),
|
||||
announce_multiplayer_session(session), system{system_}, room_network{
|
||||
system.GetRoomNetwork()} {
|
||||
announce_multiplayer_session(session), room_network{room_network_} {
|
||||
ui->setupUi(this);
|
||||
|
||||
// set up validation for all of the fields
|
||||
@@ -108,11 +105,6 @@ std::unique_ptr<Network::VerifyUser::Backend> HostRoomWindow::CreateVerifyBacken
|
||||
}
|
||||
|
||||
void HostRoomWindow::Host() {
|
||||
if (!Network::GetSelectedNetworkInterface()) {
|
||||
NetworkMessage::ErrorManager::ShowError(
|
||||
NetworkMessage::ErrorManager::NO_INTERFACE_SELECTED);
|
||||
return;
|
||||
}
|
||||
if (!ui->username->hasAcceptableInput()) {
|
||||
NetworkMessage::ErrorManager::ShowError(NetworkMessage::ErrorManager::USERNAME_NOT_VALID);
|
||||
return;
|
||||
@@ -129,11 +121,6 @@ void HostRoomWindow::Host() {
|
||||
NetworkMessage::ErrorManager::ShowError(NetworkMessage::ErrorManager::GAME_NOT_SELECTED);
|
||||
return;
|
||||
}
|
||||
if (system.IsPoweredOn()) {
|
||||
if (!NetworkMessage::WarnGameRunning()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (auto member = room_network.GetRoomMember().lock()) {
|
||||
if (member->GetState() == Network::RoomMember::State::Joining) {
|
||||
return;
|
||||
|
||||
@@ -17,9 +17,8 @@ class HostRoom;
|
||||
}
|
||||
|
||||
namespace Core {
|
||||
class System;
|
||||
class AnnounceMultiplayerSession;
|
||||
} // namespace Core
|
||||
}
|
||||
|
||||
class ConnectionError;
|
||||
class ComboBoxProxyModel;
|
||||
@@ -36,7 +35,7 @@ class HostRoomWindow : public QDialog {
|
||||
public:
|
||||
explicit HostRoomWindow(QWidget* parent, QStandardItemModel* list,
|
||||
std::shared_ptr<Core::AnnounceMultiplayerSession> session,
|
||||
Core::System& system_);
|
||||
Network::RoomNetwork& room_network_);
|
||||
~HostRoomWindow();
|
||||
|
||||
/**
|
||||
@@ -55,7 +54,6 @@ private:
|
||||
QStandardItemModel* game_list;
|
||||
ComboBoxProxyModel* proxy;
|
||||
Validation validation;
|
||||
Core::System& system;
|
||||
Network::RoomNetwork& room_network;
|
||||
};
|
||||
|
||||
|
||||
@@ -6,8 +6,6 @@
|
||||
#include <QtConcurrent/QtConcurrentRun>
|
||||
#include "common/logging/log.h"
|
||||
#include "common/settings.h"
|
||||
#include "core/core.h"
|
||||
#include "core/internal_network/network_interface.h"
|
||||
#include "network/network.h"
|
||||
#include "ui_lobby.h"
|
||||
#include "yuzu/game_list_p.h"
|
||||
@@ -24,11 +22,11 @@
|
||||
#endif
|
||||
|
||||
Lobby::Lobby(QWidget* parent, QStandardItemModel* list,
|
||||
std::shared_ptr<Core::AnnounceMultiplayerSession> session, Core::System& system_)
|
||||
std::shared_ptr<Core::AnnounceMultiplayerSession> session,
|
||||
Network::RoomNetwork& room_network_)
|
||||
: QDialog(parent, Qt::WindowTitleHint | Qt::WindowCloseButtonHint | Qt::WindowSystemMenuHint),
|
||||
ui(std::make_unique<Ui::Lobby>()),
|
||||
announce_multiplayer_session(session), system{system_}, room_network{
|
||||
system.GetRoomNetwork()} {
|
||||
announce_multiplayer_session(session), room_network{room_network_} {
|
||||
ui->setupUi(this);
|
||||
|
||||
// setup the watcher for background connections
|
||||
@@ -116,18 +114,6 @@ void Lobby::OnExpandRoom(const QModelIndex& index) {
|
||||
}
|
||||
|
||||
void Lobby::OnJoinRoom(const QModelIndex& source) {
|
||||
if (!Network::GetSelectedNetworkInterface()) {
|
||||
NetworkMessage::ErrorManager::ShowError(
|
||||
NetworkMessage::ErrorManager::NO_INTERFACE_SELECTED);
|
||||
return;
|
||||
}
|
||||
|
||||
if (system.IsPoweredOn()) {
|
||||
if (!NetworkMessage::WarnGameRunning()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (const auto member = room_network.GetRoomMember().lock()) {
|
||||
// Prevent the user from trying to join a room while they are already joining.
|
||||
if (member->GetState() == Network::RoomMember::State::Joining) {
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#include <QSortFilterProxyModel>
|
||||
#include <QStandardItemModel>
|
||||
#include "common/announce_multiplayer_room.h"
|
||||
#include "network/announce_multiplayer_session.h"
|
||||
#include "core/announce_multiplayer_session.h"
|
||||
#include "network/network.h"
|
||||
#include "yuzu/multiplayer/validation.h"
|
||||
|
||||
@@ -20,10 +20,6 @@ class Lobby;
|
||||
class LobbyModel;
|
||||
class LobbyFilterProxyModel;
|
||||
|
||||
namespace Core {
|
||||
class System;
|
||||
}
|
||||
|
||||
/**
|
||||
* Listing of all public games pulled from services. The lobby should be simple enough for users to
|
||||
* find the game they want to play, and join it.
|
||||
@@ -34,7 +30,7 @@ class Lobby : public QDialog {
|
||||
public:
|
||||
explicit Lobby(QWidget* parent, QStandardItemModel* list,
|
||||
std::shared_ptr<Core::AnnounceMultiplayerSession> session,
|
||||
Core::System& system_);
|
||||
Network::RoomNetwork& room_network_);
|
||||
~Lobby() override;
|
||||
|
||||
/**
|
||||
@@ -98,7 +94,6 @@ private:
|
||||
std::weak_ptr<Core::AnnounceMultiplayerSession> announce_multiplayer_session;
|
||||
QFutureWatcher<void>* watcher;
|
||||
Validation validation;
|
||||
Core::System& system;
|
||||
Network::RoomNetwork& room_network;
|
||||
};
|
||||
|
||||
|
||||
@@ -49,9 +49,6 @@ const ConnectionError ErrorManager::PERMISSION_DENIED(
|
||||
QT_TR_NOOP("You do not have enough permission to perform this action."));
|
||||
const ConnectionError ErrorManager::NO_SUCH_USER(QT_TR_NOOP(
|
||||
"The user you are trying to kick/ban could not be found.\nThey may have left the room."));
|
||||
const ConnectionError ErrorManager::NO_INTERFACE_SELECTED(
|
||||
QT_TR_NOOP("No network interface is selected.\nPlease go to Configure -> System -> Network and "
|
||||
"make a selection."));
|
||||
|
||||
static bool WarnMessage(const std::string& title, const std::string& text) {
|
||||
return QMessageBox::Ok == QMessageBox::warning(nullptr, QObject::tr(title.c_str()),
|
||||
@@ -63,13 +60,6 @@ void ErrorManager::ShowError(const ConnectionError& e) {
|
||||
QMessageBox::critical(nullptr, tr("Error"), tr(e.GetString().c_str()));
|
||||
}
|
||||
|
||||
bool WarnGameRunning() {
|
||||
return WarnMessage(
|
||||
QT_TR_NOOP("Game already running"),
|
||||
QT_TR_NOOP("Joining a room when the game is already running is discouraged "
|
||||
"and can cause the room feature not to work correctly.\nProceed anyway?"));
|
||||
}
|
||||
|
||||
bool WarnCloseRoom() {
|
||||
return WarnMessage(
|
||||
QT_TR_NOOP("Leave Room"),
|
||||
|
||||
@@ -43,20 +43,11 @@ public:
|
||||
static const ConnectionError IP_COLLISION;
|
||||
static const ConnectionError PERMISSION_DENIED;
|
||||
static const ConnectionError NO_SUCH_USER;
|
||||
static const ConnectionError NO_INTERFACE_SELECTED;
|
||||
/**
|
||||
* Shows a standard QMessageBox with a error message
|
||||
*/
|
||||
static void ShowError(const ConnectionError& e);
|
||||
};
|
||||
|
||||
/**
|
||||
* Show a standard QMessageBox with a warning message about joining a room when
|
||||
* the game is already running
|
||||
* return true if the user wants to close the network connection
|
||||
*/
|
||||
bool WarnGameRunning();
|
||||
|
||||
/**
|
||||
* Show a standard QMessageBox with a warning message about leaving the room
|
||||
* return true if the user wants to close the network connection
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
#include <QStandardItemModel>
|
||||
#include "common/announce_multiplayer_room.h"
|
||||
#include "common/logging/log.h"
|
||||
#include "core/core.h"
|
||||
#include "yuzu/game_list.h"
|
||||
#include "yuzu/multiplayer/client_room.h"
|
||||
#include "yuzu/multiplayer/direct_connect.h"
|
||||
@@ -20,9 +19,10 @@
|
||||
#include "yuzu/util/clickable_label.h"
|
||||
|
||||
MultiplayerState::MultiplayerState(QWidget* parent, QStandardItemModel* game_list_model_,
|
||||
QAction* leave_room_, QAction* show_room_, Core::System& system_)
|
||||
QAction* leave_room_, QAction* show_room_,
|
||||
Network::RoomNetwork& room_network_)
|
||||
: QWidget(parent), game_list_model(game_list_model_), leave_room(leave_room_),
|
||||
show_room(show_room_), system{system_}, room_network{system.GetRoomNetwork()} {
|
||||
show_room(show_room_), room_network{room_network_} {
|
||||
if (auto member = room_network.GetRoomMember().lock()) {
|
||||
// register the network structs to use in slots and signals
|
||||
state_callback_handle = member->BindOnStateChanged(
|
||||
@@ -208,14 +208,15 @@ static void BringWidgetToFront(QWidget* widget) {
|
||||
|
||||
void MultiplayerState::OnViewLobby() {
|
||||
if (lobby == nullptr) {
|
||||
lobby = new Lobby(this, game_list_model, announce_multiplayer_session, system);
|
||||
lobby = new Lobby(this, game_list_model, announce_multiplayer_session, room_network);
|
||||
}
|
||||
BringWidgetToFront(lobby);
|
||||
}
|
||||
|
||||
void MultiplayerState::OnCreateRoom() {
|
||||
if (host_room == nullptr) {
|
||||
host_room = new HostRoomWindow(this, game_list_model, announce_multiplayer_session, system);
|
||||
host_room =
|
||||
new HostRoomWindow(this, game_list_model, announce_multiplayer_session, room_network);
|
||||
}
|
||||
BringWidgetToFront(host_room);
|
||||
}
|
||||
@@ -278,7 +279,7 @@ void MultiplayerState::OnOpenNetworkRoom() {
|
||||
|
||||
void MultiplayerState::OnDirectConnectToRoom() {
|
||||
if (direct_connect == nullptr) {
|
||||
direct_connect = new DirectConnectWindow(system, this);
|
||||
direct_connect = new DirectConnectWindow(room_network, this);
|
||||
}
|
||||
BringWidgetToFront(direct_connect);
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <QWidget>
|
||||
#include "network/announce_multiplayer_session.h"
|
||||
#include "core/announce_multiplayer_session.h"
|
||||
#include "network/network.h"
|
||||
|
||||
class QStandardItemModel;
|
||||
@@ -14,16 +14,12 @@ class ClientRoomWindow;
|
||||
class DirectConnectWindow;
|
||||
class ClickableLabel;
|
||||
|
||||
namespace Core {
|
||||
class System;
|
||||
}
|
||||
|
||||
class MultiplayerState : public QWidget {
|
||||
Q_OBJECT;
|
||||
|
||||
public:
|
||||
explicit MultiplayerState(QWidget* parent, QStandardItemModel* game_list, QAction* leave_room,
|
||||
QAction* show_room, Core::System& system_);
|
||||
QAction* show_room, Network::RoomNetwork& room_network_);
|
||||
~MultiplayerState();
|
||||
|
||||
/**
|
||||
@@ -90,7 +86,6 @@ private:
|
||||
Network::RoomMember::CallbackHandle<Network::RoomMember::Error> error_callback_handle;
|
||||
|
||||
bool show_notification = false;
|
||||
Core::System& system;
|
||||
Network::RoomNetwork& room_network;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user