From 80ad76aa9e8f8fa274b31f82497947f70e8b1a5f Mon Sep 17 00:00:00 2001 From: pineappleEA Date: Thu, 29 Jul 2021 21:34:06 +0200 Subject: [PATCH] early-access version 1942 --- README.md | 2 +- src/common/uuid.cpp | 2 +- src/core/hle/service/acc/acc.cpp | 22 +++++++++---------- src/core/hle/service/friend/friend.cpp | 6 ++--- src/core/hle/service/ns/language.cpp | 2 ++ src/input_common/sdl/sdl_impl.cpp | 6 ++--- src/input_common/tas/tas_input.cpp | 17 ++++++++------ src/input_common/tas/tas_input.h | 3 +++ .../renderer_vulkan/vk_blit_screen.cpp | 15 +------------ .../renderer_vulkan/vk_rasterizer.cpp | 9 ++++++-- src/yuzu/main.cpp | 9 ++------ 11 files changed, 44 insertions(+), 49 deletions(-) diff --git a/README.md b/README.md index 2886d9bbf..fc476105f 100755 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ yuzu emulator early access ============= -This is the source code for early-access 1940. +This is the source code for early-access 1942. ## Legal Notice diff --git a/src/common/uuid.cpp b/src/common/uuid.cpp index 26db03fba..18303a1e3 100755 --- a/src/common/uuid.cpp +++ b/src/common/uuid.cpp @@ -18,7 +18,7 @@ UUID UUID::Generate() { } std::string UUID::Format() const { - return fmt::format("0x{:016X}{:016X}", uuid[1], uuid[0]); + return fmt::format("{:016x}{:016x}", uuid[1], uuid[0]); } std::string UUID::FormatSwitch() const { diff --git a/src/core/hle/service/acc/acc.cpp b/src/core/hle/service/acc/acc.cpp index 2e969f2a8..882fc1492 100755 --- a/src/core/hle/service/acc/acc.cpp +++ b/src/core/hle/service/acc/acc.cpp @@ -292,7 +292,7 @@ public: protected: void Get(Kernel::HLERequestContext& ctx) { - LOG_DEBUG(Service_ACC, "called user_id={}", user_id.Format()); + LOG_DEBUG(Service_ACC, "called user_id=0x{}", user_id.Format()); ProfileBase profile_base{}; ProfileData data{}; if (profile_manager.GetProfileBaseAndData(user_id, profile_base, data)) { @@ -301,7 +301,7 @@ protected: rb.Push(ResultSuccess); rb.PushRaw(profile_base); } else { - LOG_ERROR(Service_ACC, "Failed to get profile base and data for user={}", + LOG_ERROR(Service_ACC, "Failed to get profile base and data for user=0x{}", user_id.Format()); IPC::ResponseBuilder rb{ctx, 2}; rb.Push(ResultUnknown); // TODO(ogniK): Get actual error code @@ -309,14 +309,14 @@ protected: } void GetBase(Kernel::HLERequestContext& ctx) { - LOG_DEBUG(Service_ACC, "called user_id={}", user_id.Format()); + LOG_DEBUG(Service_ACC, "called user_id=0x{}", user_id.Format()); ProfileBase profile_base{}; if (profile_manager.GetProfileBase(user_id, profile_base)) { IPC::ResponseBuilder rb{ctx, 16}; rb.Push(ResultSuccess); rb.PushRaw(profile_base); } else { - LOG_ERROR(Service_ACC, "Failed to get profile base for user={}", user_id.Format()); + LOG_ERROR(Service_ACC, "Failed to get profile base for user=0x{}", user_id.Format()); IPC::ResponseBuilder rb{ctx, 2}; rb.Push(ResultUnknown); // TODO(ogniK): Get actual error code } @@ -372,7 +372,7 @@ protected: const auto user_data = ctx.ReadBuffer(); - LOG_DEBUG(Service_ACC, "called, username='{}', timestamp={:016X}, uuid={}", + LOG_DEBUG(Service_ACC, "called, username='{}', timestamp={:016X}, uuid=0x{}", Common::StringFromFixedZeroTerminatedBuffer( reinterpret_cast(base.username.data()), base.username.size()), base.timestamp, base.user_uuid.Format()); @@ -405,7 +405,7 @@ protected: const auto user_data = ctx.ReadBuffer(); const auto image_data = ctx.ReadBuffer(1); - LOG_DEBUG(Service_ACC, "called, username='{}', timestamp={:016X}, uuid={}", + LOG_DEBUG(Service_ACC, "called, username='{}', timestamp={:016X}, uuid=0x{}", Common::StringFromFixedZeroTerminatedBuffer( reinterpret_cast(base.username.data()), base.username.size()), base.timestamp, base.user_uuid.Format()); @@ -662,7 +662,7 @@ void Module::Interface::GetUserCount(Kernel::HLERequestContext& ctx) { void Module::Interface::GetUserExistence(Kernel::HLERequestContext& ctx) { IPC::RequestParser rp{ctx}; Common::UUID user_id = rp.PopRaw(); - LOG_DEBUG(Service_ACC, "called user_id={}", user_id.Format()); + LOG_DEBUG(Service_ACC, "called user_id=0x{}", user_id.Format()); IPC::ResponseBuilder rb{ctx, 3}; rb.Push(ResultSuccess); @@ -693,7 +693,7 @@ void Module::Interface::GetLastOpenedUser(Kernel::HLERequestContext& ctx) { void Module::Interface::GetProfile(Kernel::HLERequestContext& ctx) { IPC::RequestParser rp{ctx}; Common::UUID user_id = rp.PopRaw(); - LOG_DEBUG(Service_ACC, "called user_id={}", user_id.Format()); + LOG_DEBUG(Service_ACC, "called user_id=0x{}", user_id.Format()); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(ResultSuccess); @@ -802,7 +802,7 @@ void Module::Interface::GetProfileEditor(Kernel::HLERequestContext& ctx) { IPC::RequestParser rp{ctx}; Common::UUID user_id = rp.PopRaw(); - LOG_DEBUG(Service_ACC, "called, user_id={}", user_id.Format()); + LOG_DEBUG(Service_ACC, "called, user_id=0x{}", user_id.Format()); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(ResultSuccess); @@ -844,7 +844,7 @@ void Module::Interface::StoreSaveDataThumbnailApplication(Kernel::HLERequestCont IPC::RequestParser rp{ctx}; const auto uuid = rp.PopRaw(); - LOG_WARNING(Service_ACC, "(STUBBED) called, uuid={}", uuid.Format()); + LOG_WARNING(Service_ACC, "(STUBBED) called, uuid=0x{}", uuid.Format()); // TODO(ogniK): Check if application ID is zero on acc initialize. As we don't have a reliable // way of confirming things like the TID, we're going to assume a non zero value for the time @@ -858,7 +858,7 @@ void Module::Interface::StoreSaveDataThumbnailSystem(Kernel::HLERequestContext& const auto uuid = rp.PopRaw(); const auto tid = rp.Pop(); - LOG_WARNING(Service_ACC, "(STUBBED) called, uuid={}, tid={:016X}", uuid.Format(), tid); + LOG_WARNING(Service_ACC, "(STUBBED) called, uuid=0x{}, tid={:016X}", uuid.Format(), tid); StoreSaveDataThumbnail(ctx, uuid, tid); } diff --git a/src/core/hle/service/friend/friend.cpp b/src/core/hle/service/friend/friend.cpp index a3c939c0c..b58c152ce 100755 --- a/src/core/hle/service/friend/friend.cpp +++ b/src/core/hle/service/friend/friend.cpp @@ -158,7 +158,7 @@ private: const auto local_play = rp.Pop(); const auto uuid = rp.PopRaw(); - LOG_WARNING(Service_Friend, "(STUBBED) called local_play={} uuid={}", local_play, + LOG_WARNING(Service_Friend, "(STUBBED) called, local_play={}, uuid=0x{}", local_play, uuid.Format()); IPC::ResponseBuilder rb{ctx, 2}; @@ -171,7 +171,7 @@ private: const auto uuid = rp.PopRaw(); [[maybe_unused]] const auto filter = rp.PopRaw(); const auto pid = rp.Pop(); - LOG_WARNING(Service_Friend, "(STUBBED) called, offset={}, uuid={}, pid={}", friend_offset, + LOG_WARNING(Service_Friend, "(STUBBED) called, offset={}, uuid=0x{}, pid={}", friend_offset, uuid.Format(), pid); IPC::ResponseBuilder rb{ctx, 3}; @@ -289,7 +289,7 @@ void Module::Interface::CreateNotificationService(Kernel::HLERequestContext& ctx IPC::RequestParser rp{ctx}; auto uuid = rp.PopRaw(); - LOG_DEBUG(Service_Friend, "called, uuid={}", uuid.Format()); + LOG_DEBUG(Service_Friend, "called, uuid=0x{}", uuid.Format()); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(ResultSuccess); diff --git a/src/core/hle/service/ns/language.cpp b/src/core/hle/service/ns/language.cpp index 29c4a820c..54b644830 100755 --- a/src/core/hle/service/ns/language.cpp +++ b/src/core/hle/service/ns/language.cpp @@ -344,8 +344,10 @@ std::optional ConvertToApplicationLanguage( return ApplicationLanguage::Russian; case Set::LanguageCode::KO: return ApplicationLanguage::Korean; + case Set::LanguageCode::ZH_TW: case Set::LanguageCode::ZH_HANT: return ApplicationLanguage::TraditionalChinese; + case Set::LanguageCode::ZH_CN: case Set::LanguageCode::ZH_HANS: return ApplicationLanguage::SimplifiedChinese; default: diff --git a/src/input_common/sdl/sdl_impl.cpp b/src/input_common/sdl/sdl_impl.cpp index 5a56ee72f..f1f950d8a 100755 --- a/src/input_common/sdl/sdl_impl.cpp +++ b/src/input_common/sdl/sdl_impl.cpp @@ -170,7 +170,7 @@ public: float GetAxis(int axis, float range, float offset) const { std::lock_guard lock{mutex}; const float value = static_cast(state.axes.at(axis)) / 32767.0f; - return (value + offset) * range; + return (value + offset) / range; } bool RumblePlay(u16 amp_low, u16 amp_high) { @@ -538,8 +538,8 @@ public: } std::tuple GetRawStatus() const override { - const float x = joystick->GetAxis(axis_x, 1.0f, offset_x); - const float y = joystick->GetAxis(axis_y, 1.0f, offset_y); + const float x = joystick->GetAxis(axis_x, range, offset_x); + const float y = joystick->GetAxis(axis_y, range, offset_y); return {x, -y}; } diff --git a/src/input_common/tas/tas_input.cpp b/src/input_common/tas/tas_input.cpp index 7c1fe2dd7..1598092b6 100755 --- a/src/input_common/tas/tas_input.cpp +++ b/src/input_common/tas/tas_input.cpp @@ -47,8 +47,7 @@ Tas::Tas() { } Tas::~Tas() { - SwapToStoredController(); - is_running = false; + Stop(); }; void Tas::LoadTasFiles() { @@ -189,8 +188,7 @@ std::string Tas::ButtonsToString(u32 button) const { void Tas::UpdateThread() { if (!Settings::values.tas_enable) { if (is_running) { - SwapToStoredController(); - is_running = false; + Stop(); } return; } @@ -305,14 +303,19 @@ void Tas::StartStop() { if (!Settings::values.tas_enable) { return; } - is_running = !is_running; if (is_running) { - SwapToTasController(); + Stop(); } else { - SwapToStoredController(); + is_running = true; + SwapToTasController(); } } +void Tas::Stop() { + is_running = false; + SwapToStoredController(); +} + void Tas::SwapToTasController() { if (!Settings::values.tas_swap_controllers) { return; diff --git a/src/input_common/tas/tas_input.h b/src/input_common/tas/tas_input.h index 401e51fab..3e2db8f00 100755 --- a/src/input_common/tas/tas_input.h +++ b/src/input_common/tas/tas_input.h @@ -105,6 +105,9 @@ public: // Sets the flag to start or stop the TAS command excecution and swaps controllers profiles void StartStop(); + // Stop the TAS and reverts any controller profile + void Stop(); + // Sets the flag to reload the file and start from the begining in the next update void Reset(); diff --git a/src/video_core/renderer_vulkan/vk_blit_screen.cpp b/src/video_core/renderer_vulkan/vk_blit_screen.cpp index 01a2b2b78..5c43b8acf 100755 --- a/src/video_core/renderer_vulkan/vk_blit_screen.cpp +++ b/src/video_core/renderer_vulkan/vk_blit_screen.cpp @@ -635,22 +635,9 @@ void VKBlitScreen::CreateFramebuffers() { const VkExtent2D size{swapchain.GetSize()}; framebuffers.resize(image_count); - VkFramebufferCreateInfo ci{ - .sType = VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO, - .pNext = nullptr, - .flags = 0, - .renderPass = *renderpass, - .attachmentCount = 1, - .pAttachments = nullptr, - .width = size.width, - .height = size.height, - .layers = 1, - }; - for (std::size_t i = 0; i < image_count; ++i) { const VkImageView image_view{swapchain.GetImageViewIndex(i)}; - ci.pAttachments = &image_view; - framebuffers[i] = device.GetLogical().CreateFramebuffer(ci); + framebuffers[i] = CreateFramebuffer(image_view, size); } } diff --git a/src/video_core/renderer_vulkan/vk_rasterizer.cpp b/src/video_core/renderer_vulkan/vk_rasterizer.cpp index 609f5c576..c6e093718 100755 --- a/src/video_core/renderer_vulkan/vk_rasterizer.cpp +++ b/src/video_core/renderer_vulkan/vk_rasterizer.cpp @@ -61,11 +61,16 @@ struct DrawParams { VkViewport GetViewportState(const Device& device, const Maxwell& regs, size_t index) { const auto& src = regs.viewport_transform[index]; const float width = src.scale_x * 2.0f; - const float height = src.scale_y * 2.0f; + float y = src.translate_y - src.scale_y; + float height = src.scale_y * 2.0f; + if (regs.screen_y_control.y_negate) { + y += height; + height = -height; + } const float reduce_z = regs.depth_mode == Maxwell::DepthMode::MinusOneToOne ? 1.0f : 0.0f; VkViewport viewport{ .x = src.translate_x - src.scale_x, - .y = src.translate_y - src.scale_y, + .y = y, .width = width != 0.0f ? width : 1.0f, .height = height != 0.0f ? height : 1.0f, .minDepth = src.translate_z - src.scale_z * reduce_z, diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index 7fd4b1894..972cfeb04 100755 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp @@ -1044,12 +1044,7 @@ void GMainWindow::InitializeHotkeys() { input_subsystem->GetTas()->StartStop(); }); connect(hotkey_registry.GetHotkey(main_window, QStringLiteral("TAS Reset"), this), - &QShortcut::activated, this, [&] { - if (emulation_running) { - input_subsystem->GetTas()->Reset(); - } - input_subsystem->GetTas()->Reset(); - }); + &QShortcut::activated, this, [&] { input_subsystem->GetTas()->Reset(); }); connect(hotkey_registry.GetHotkey(main_window, QStringLiteral("TAS Record"), this), &QShortcut::activated, this, [&] { if (!emulation_running) { @@ -1515,7 +1510,7 @@ void GMainWindow::ShutdownGame() { } game_list->SetFilterFocus(); tas_label->clear(); - input_subsystem->GetTas()->~Tas(); + input_subsystem->GetTas()->Stop(); render_window->removeEventFilter(render_window); render_window->setAttribute(Qt::WA_Hover, false);