diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/audio_core/audio_renderer.h | 2 | ||||
-rw-r--r-- | src/core/hle/service/am/am.cpp | 42 | ||||
-rw-r--r-- | src/core/hle/service/am/am.h | 3 | ||||
-rw-r--r-- | src/core/hle/service/hid/hid.cpp | 9 | ||||
-rw-r--r-- | src/core/hle/service/hid/hid.h | 1 | ||||
-rw-r--r-- | src/core/hle/service/time/interface.cpp | 2 | ||||
-rw-r--r-- | src/core/hle/service/time/time.cpp | 29 | ||||
-rw-r--r-- | src/core/hle/service/time/time.h | 1 | ||||
-rw-r--r-- | src/video_core/engines/const_buffer_engine_interface.h | 14 | ||||
-rw-r--r-- | src/video_core/renderer_vulkan/maxwell_to_vk.cpp | 20 | ||||
-rw-r--r-- | src/yuzu/main.cpp | 15 |
11 files changed, 122 insertions, 16 deletions
diff --git a/src/audio_core/audio_renderer.h b/src/audio_core/audio_renderer.h index be1b019f1..c0fae669e 100644 --- a/src/audio_core/audio_renderer.h +++ b/src/audio_core/audio_renderer.h @@ -189,7 +189,7 @@ struct UpdateDataHeader { UpdateDataHeader() {} explicit UpdateDataHeader(const AudioRendererParameter& config) { - revision = Common::MakeMagic('R', 'E', 'V', '4'); // 5.1.0 Revision + revision = Common::MakeMagic('R', 'E', 'V', '8'); // 9.2.0 Revision behavior_size = 0xb0; memory_pools_size = (config.effect_count + (config.voice_count * 4)) * 0x10; voices_size = config.voice_count * 0x10; diff --git a/src/core/hle/service/am/am.cpp b/src/core/hle/service/am/am.cpp index d1bf13c89..557608e76 100644 --- a/src/core/hle/service/am/am.cpp +++ b/src/core/hle/service/am/am.cpp @@ -52,6 +52,11 @@ enum class LaunchParameterKind : u32 { AccountPreselectedUser = 2, }; +enum class VrMode : u8 { + Disabled = 0, + Enabled = 1, +}; + constexpr u32 LAUNCH_PARAMETER_ACCOUNT_PRESELECTED_USER_MAGIC = 0xC79497CA; struct LaunchParameterAccountPreselectedUser { @@ -605,11 +610,11 @@ ICommonStateGetter::ICommonStateGetter(Core::System& system, {30, nullptr, "GetHomeButtonReaderLockAccessor"}, {31, nullptr, "GetReaderLockAccessorEx"}, {40, nullptr, "GetCradleFwVersion"}, - {50, nullptr, "IsVrModeEnabled"}, - {51, nullptr, "SetVrModeEnabled"}, + {50, &ICommonStateGetter::IsVrModeEnabled, "IsVrModeEnabled"}, + {51, &ICommonStateGetter::SetVrModeEnabled, "SetVrModeEnabled"}, {52, &ICommonStateGetter::SetLcdBacklighOffEnabled, "SetLcdBacklighOffEnabled"}, {53, nullptr, "BeginVrModeEx"}, - {54, nullptr, "EndVrModeEx"}, + {54, &ICommonStateGetter::EndVrModeEx, "EndVrModeEx"}, {55, nullptr, "IsInControllerFirmwareUpdateSection"}, {60, &ICommonStateGetter::GetDefaultDisplayResolution, "GetDefaultDisplayResolution"}, {61, &ICommonStateGetter::GetDefaultDisplayResolutionChangeEvent, "GetDefaultDisplayResolutionChangeEvent"}, @@ -672,6 +677,30 @@ void ICommonStateGetter::GetCurrentFocusState(Kernel::HLERequestContext& ctx) { rb.Push(static_cast<u8>(FocusState::InFocus)); } +void ICommonStateGetter::IsVrModeEnabled(Kernel::HLERequestContext& ctx) { + LOG_WARNING(Service_AM, "(STUBBED) called"); + + IPC::ResponseBuilder rb{ctx, 3}; + rb.Push(RESULT_SUCCESS); + rb.PushEnum(VrMode::Disabled); +} + +void ICommonStateGetter::SetVrModeEnabled(Kernel::HLERequestContext& ctx) { + IPC::RequestParser rp{ctx}; + const auto is_vr_mode_enabled = rp.Pop<bool>(); + + LOG_WARNING(Service_AM, "(STUBBED) called. is_vr_mode_enabled={}", is_vr_mode_enabled); + + IPC::ResponseBuilder rb{ctx, 2}; + if (!is_vr_mode_enabled) { + rb.Push(RESULT_SUCCESS); + } else { + // TODO: Find better error code for this + UNIMPLEMENTED_MSG("is_vr_mode_enabled={}", is_vr_mode_enabled); + rb.Push(RESULT_UNKNOWN); + } +} + void ICommonStateGetter::SetLcdBacklighOffEnabled(Kernel::HLERequestContext& ctx) { IPC::RequestParser rp{ctx}; const auto is_lcd_backlight_off_enabled = rp.Pop<bool>(); @@ -683,6 +712,13 @@ void ICommonStateGetter::SetLcdBacklighOffEnabled(Kernel::HLERequestContext& ctx rb.Push(RESULT_SUCCESS); } +void ICommonStateGetter::EndVrModeEx(Kernel::HLERequestContext& ctx) { + LOG_WARNING(Service_AM, "(STUBBED) called"); + + IPC::ResponseBuilder rb{ctx, 2}; + rb.Push(RESULT_SUCCESS); +} + void ICommonStateGetter::GetDefaultDisplayResolutionChangeEvent(Kernel::HLERequestContext& ctx) { LOG_DEBUG(Service_AM, "called"); diff --git a/src/core/hle/service/am/am.h b/src/core/hle/service/am/am.h index 0843de781..53cfce10f 100644 --- a/src/core/hle/service/am/am.h +++ b/src/core/hle/service/am/am.h @@ -182,7 +182,10 @@ private: void GetOperationMode(Kernel::HLERequestContext& ctx); void GetPerformanceMode(Kernel::HLERequestContext& ctx); void GetBootMode(Kernel::HLERequestContext& ctx); + void IsVrModeEnabled(Kernel::HLERequestContext& ctx); + void SetVrModeEnabled(Kernel::HLERequestContext& ctx); void SetLcdBacklighOffEnabled(Kernel::HLERequestContext& ctx); + void EndVrModeEx(Kernel::HLERequestContext& ctx); void GetDefaultDisplayResolution(Kernel::HLERequestContext& ctx); void SetCpuBoostMode(Kernel::HLERequestContext& ctx); diff --git a/src/core/hle/service/hid/hid.cpp b/src/core/hle/service/hid/hid.cpp index e6b56a9f9..d6ed5f304 100644 --- a/src/core/hle/service/hid/hid.cpp +++ b/src/core/hle/service/hid/hid.cpp @@ -235,7 +235,7 @@ Hid::Hid(Core::System& system) : ServiceFramework("hid"), system(system) { {303, nullptr, "ActivateSevenSixAxisSensor"}, {304, nullptr, "StartSevenSixAxisSensor"}, {305, nullptr, "StopSevenSixAxisSensor"}, - {306, nullptr, "InitializeSevenSixAxisSensor"}, + {306, &Hid::InitializeSevenSixAxisSensor, "InitializeSevenSixAxisSensor"}, {307, nullptr, "FinalizeSevenSixAxisSensor"}, {308, nullptr, "SetSevenSixAxisSensorFusionStrength"}, {309, nullptr, "GetSevenSixAxisSensorFusionStrength"}, @@ -853,6 +853,13 @@ void Hid::SetPalmaBoostMode(Kernel::HLERequestContext& ctx) { rb.Push(RESULT_SUCCESS); } +void Hid::InitializeSevenSixAxisSensor(Kernel::HLERequestContext& ctx) { + LOG_WARNING(Service_HID, "(STUBBED) called"); + + IPC::ResponseBuilder rb{ctx, 2}; + rb.Push(RESULT_SUCCESS); +} + class HidDbg final : public ServiceFramework<HidDbg> { public: explicit HidDbg() : ServiceFramework{"hid:dbg"} { diff --git a/src/core/hle/service/hid/hid.h b/src/core/hle/service/hid/hid.h index ad20f147c..039c38b58 100644 --- a/src/core/hle/service/hid/hid.h +++ b/src/core/hle/service/hid/hid.h @@ -128,6 +128,7 @@ private: void StopSixAxisSensor(Kernel::HLERequestContext& ctx); void SetIsPalmaAllConnectable(Kernel::HLERequestContext& ctx); void SetPalmaBoostMode(Kernel::HLERequestContext& ctx); + void InitializeSevenSixAxisSensor(Kernel::HLERequestContext& ctx); std::shared_ptr<IAppletResource> applet_resource; Core::System& system; diff --git a/src/core/hle/service/time/interface.cpp b/src/core/hle/service/time/interface.cpp index 1660bbdb8..f509653a3 100644 --- a/src/core/hle/service/time/interface.cpp +++ b/src/core/hle/service/time/interface.cpp @@ -30,7 +30,7 @@ Time::Time(std::shared_ptr<Module> module, Core::System& system, const char* nam {400, &Time::GetClockSnapshot, "GetClockSnapshot"}, {401, &Time::GetClockSnapshotFromSystemClockContext, "GetClockSnapshotFromSystemClockContext"}, {500, nullptr, "CalculateStandardUserSystemClockDifferenceByUser"}, - {501, nullptr, "CalculateSpanBetween"}, + {501, &Time::CalculateSpanBetween, "CalculateSpanBetween"}, }; // clang-format on diff --git a/src/core/hle/service/time/time.cpp b/src/core/hle/service/time/time.cpp index 749b7be70..ce859f18d 100644 --- a/src/core/hle/service/time/time.cpp +++ b/src/core/hle/service/time/time.cpp @@ -308,6 +308,35 @@ void Module::Interface::GetClockSnapshotFromSystemClockContext(Kernel::HLEReques ctx.WriteBuffer(&clock_snapshot, sizeof(Clock::ClockSnapshot)); } +void Module::Interface::CalculateSpanBetween(Kernel::HLERequestContext& ctx) { + LOG_DEBUG(Service_Time, "called"); + + IPC::RequestParser rp{ctx}; + const auto snapshot_a = rp.PopRaw<Clock::ClockSnapshot>(); + const auto snapshot_b = rp.PopRaw<Clock::ClockSnapshot>(); + + Clock::TimeSpanType time_span_type{}; + s64 span{}; + if (const ResultCode result{snapshot_a.steady_clock_time_point.GetSpanBetween( + snapshot_b.steady_clock_time_point, span)}; + result != RESULT_SUCCESS) { + if (snapshot_a.network_time && snapshot_b.network_time) { + time_span_type = + Clock::TimeSpanType::FromSeconds(snapshot_b.network_time - snapshot_a.network_time); + } else { + IPC::ResponseBuilder rb{ctx, 2}; + rb.Push(ERROR_TIME_NOT_FOUND); + return; + } + } else { + time_span_type = Clock::TimeSpanType::FromSeconds(span); + } + + IPC::ResponseBuilder rb{ctx, (sizeof(s64) / 4) + 2}; + rb.Push(RESULT_SUCCESS); + rb.PushRaw(time_span_type.nanoseconds); +} + void Module::Interface::GetSharedMemoryNativeHandle(Kernel::HLERequestContext& ctx) { LOG_DEBUG(Service_Time, "called"); IPC::ResponseBuilder rb{ctx, 2, 1}; diff --git a/src/core/hle/service/time/time.h b/src/core/hle/service/time/time.h index aadc2df60..351988468 100644 --- a/src/core/hle/service/time/time.h +++ b/src/core/hle/service/time/time.h @@ -32,6 +32,7 @@ public: void CalculateMonotonicSystemClockBaseTimePoint(Kernel::HLERequestContext& ctx); void GetClockSnapshot(Kernel::HLERequestContext& ctx); void GetClockSnapshotFromSystemClockContext(Kernel::HLERequestContext& ctx); + void CalculateSpanBetween(Kernel::HLERequestContext& ctx); void GetSharedMemoryNativeHandle(Kernel::HLERequestContext& ctx); private: diff --git a/src/video_core/engines/const_buffer_engine_interface.h b/src/video_core/engines/const_buffer_engine_interface.h index 724ee0fd6..ebe139504 100644 --- a/src/video_core/engines/const_buffer_engine_interface.h +++ b/src/video_core/engines/const_buffer_engine_interface.h @@ -18,10 +18,14 @@ struct SamplerDescriptor { union { u32 raw = 0; BitField<0, 2, Tegra::Shader::TextureType> texture_type; - BitField<2, 3, Tegra::Texture::ComponentType> component_type; + BitField<2, 3, Tegra::Texture::ComponentType> r_type; BitField<5, 1, u32> is_array; BitField<6, 1, u32> is_buffer; BitField<7, 1, u32> is_shadow; + BitField<8, 3, Tegra::Texture::ComponentType> g_type; + BitField<11, 3, Tegra::Texture::ComponentType> b_type; + BitField<14, 3, Tegra::Texture::ComponentType> a_type; + BitField<17, 7, Tegra::Texture::TextureFormat> format; }; bool operator==(const SamplerDescriptor& rhs) const noexcept { @@ -36,9 +40,11 @@ struct SamplerDescriptor { using Tegra::Shader::TextureType; SamplerDescriptor result; - // This is going to be used to determine the shading language type. - // Because of that we don't care about all component types on color textures. - result.component_type.Assign(tic.r_type.Value()); + result.format.Assign(tic.format.Value()); + result.r_type.Assign(tic.r_type.Value()); + result.g_type.Assign(tic.g_type.Value()); + result.b_type.Assign(tic.b_type.Value()); + result.a_type.Assign(tic.a_type.Value()); switch (tic.texture_type.Value()) { case Tegra::Texture::TextureType::Texture1D: diff --git a/src/video_core/renderer_vulkan/maxwell_to_vk.cpp b/src/video_core/renderer_vulkan/maxwell_to_vk.cpp index f93447610..7480cb7c3 100644 --- a/src/video_core/renderer_vulkan/maxwell_to_vk.cpp +++ b/src/video_core/renderer_vulkan/maxwell_to_vk.cpp @@ -401,6 +401,26 @@ vk::Format VertexFormat(Maxwell::VertexAttribute::Type type, Maxwell::VertexAttr } break; case Maxwell::VertexAttribute::Type::SignedScaled: + switch (size) { + case Maxwell::VertexAttribute::Size::Size_8: + return vk::Format::eR8Sscaled; + case Maxwell::VertexAttribute::Size::Size_8_8: + return vk::Format::eR8G8Sscaled; + case Maxwell::VertexAttribute::Size::Size_8_8_8: + return vk::Format::eR8G8B8Sscaled; + case Maxwell::VertexAttribute::Size::Size_8_8_8_8: + return vk::Format::eR8G8B8A8Sscaled; + case Maxwell::VertexAttribute::Size::Size_16: + return vk::Format::eR16Sscaled; + case Maxwell::VertexAttribute::Size::Size_16_16: + return vk::Format::eR16G16Sscaled; + case Maxwell::VertexAttribute::Size::Size_16_16_16: + return vk::Format::eR16G16B16Sscaled; + case Maxwell::VertexAttribute::Size::Size_16_16_16_16: + return vk::Format::eR16G16B16A16Sscaled; + default: + break; + } break; case Maxwell::VertexAttribute::Type::Float: switch (size) { diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index 47615adfe..d7e59d0cd 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp @@ -1034,6 +1034,14 @@ void GMainWindow::BootGame(const QString& filename) { } void GMainWindow::ShutdownGame() { + if (!emulation_running) { + return; + } + + if (ui.action_Fullscreen->isChecked()) { + HideFullscreen(); + } + AllowOSSleep(); discord_rpc->Pause(); @@ -1716,11 +1724,6 @@ void GMainWindow::OnStartGame() { } void GMainWindow::OnPauseGame() { - Core::System& system{Core::System::GetInstance()}; - if (system.GetExitLock() && !ConfirmForceLockedExit()) { - return; - } - emu_thread->SetRunning(false); ui.action_Start->setEnabled(true); @@ -1803,7 +1806,7 @@ void GMainWindow::ToggleWindowMode() { // Render in the main window... render_window->BackupGeometry(); ui.horizontalLayout->addWidget(render_window); - render_window->setFocusPolicy(Qt::ClickFocus); + render_window->setFocusPolicy(Qt::StrongFocus); if (emulation_running) { render_window->setVisible(true); render_window->setFocus(); |