summaryrefslogtreecommitdiffstats
path: root/src/core
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/core/arm/dynarmic/arm_dynarmic_64.cpp2
-rw-r--r--src/core/core.cpp100
-rw-r--r--src/core/core.h61
-rw-r--r--src/core/hle/kernel/k_page_table.cpp2
-rw-r--r--src/core/hle/kernel/k_scheduler.h5
-rw-r--r--src/core/hle/kernel/svc.cpp17
-rw-r--r--src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp14
-rw-r--r--src/core/hle/service/nvdrv/devices/nvhost_nvdec_common.cpp17
-rw-r--r--src/core/hle/service/nvdrv/devices/nvhost_nvdec_common.h13
-rw-r--r--src/core/hle/service/nvdrv/nvdrv.h2
-rw-r--r--src/core/hle/service/time/time_manager.cpp13
-rw-r--r--src/core/hle/service/vi/vi.cpp12
12 files changed, 156 insertions, 102 deletions
diff --git a/src/core/arm/dynarmic/arm_dynarmic_64.cpp b/src/core/arm/dynarmic/arm_dynarmic_64.cpp
index bf27ffe71..4fd15f111 100644
--- a/src/core/arm/dynarmic/arm_dynarmic_64.cpp
+++ b/src/core/arm/dynarmic/arm_dynarmic_64.cpp
@@ -263,7 +263,7 @@ void ARM_Dynarmic_64::Run() {
}
void ARM_Dynarmic_64::Step() {
- cb->InterpreterFallback(jit->GetPC(), 1);
+ jit->Step();
}
ARM_Dynarmic_64::ARM_Dynarmic_64(System& system_, CPUInterrupts& interrupt_handlers_,
diff --git a/src/core/core.cpp b/src/core/core.cpp
index bb268a319..3c75f42ae 100644
--- a/src/core/core.cpp
+++ b/src/core/core.cpp
@@ -139,27 +139,47 @@ struct System::Impl {
: kernel{system}, fs_controller{system}, memory{system},
cpu_manager{system}, reporter{system}, applet_manager{system}, time_manager{system} {}
- ResultStatus Run() {
- status = ResultStatus::Success;
+ SystemResultStatus Run() {
+ std::unique_lock<std::mutex> lk(suspend_guard);
+ status = SystemResultStatus::Success;
kernel.Suspend(false);
core_timing.SyncPause(false);
cpu_manager.Pause(false);
+ is_paused = false;
return status;
}
- ResultStatus Pause() {
- status = ResultStatus::Success;
+ SystemResultStatus Pause() {
+ std::unique_lock<std::mutex> lk(suspend_guard);
+ status = SystemResultStatus::Success;
core_timing.SyncPause(true);
kernel.Suspend(true);
cpu_manager.Pause(true);
+ is_paused = true;
return status;
}
- ResultStatus Init(System& system, Frontend::EmuWindow& emu_window) {
+ std::unique_lock<std::mutex> StallCPU() {
+ std::unique_lock<std::mutex> lk(suspend_guard);
+ kernel.Suspend(true);
+ core_timing.SyncPause(true);
+ cpu_manager.Pause(true);
+ return lk;
+ }
+
+ void UnstallCPU() {
+ if (!is_paused) {
+ core_timing.SyncPause(false);
+ kernel.Suspend(false);
+ cpu_manager.Pause(false);
+ }
+ }
+
+ SystemResultStatus Init(System& system, Frontend::EmuWindow& emu_window) {
LOG_DEBUG(Core, "initialized OK");
device_memory = std::make_unique<Core::DeviceMemory>();
@@ -176,8 +196,9 @@ struct System::Impl {
cpu_manager.Initialize();
core_timing.Initialize([&system]() { system.RegisterHostThread(); });
- const auto current_time = std::chrono::duration_cast<std::chrono::seconds>(
- std::chrono::system_clock::now().time_since_epoch());
+ const auto posix_time = std::chrono::system_clock::now().time_since_epoch();
+ const auto current_time =
+ std::chrono::duration_cast<std::chrono::seconds>(posix_time).count();
Settings::values.custom_rtc_differential =
Settings::values.custom_rtc.value_or(current_time) - current_time;
@@ -197,7 +218,7 @@ struct System::Impl {
gpu_core = VideoCore::CreateGPU(emu_window, system);
if (!gpu_core) {
- return ResultStatus::ErrorVideoCore;
+ return SystemResultStatus::ErrorVideoCore;
}
service_manager = std::make_shared<Service::SM::ServiceManager>(kernel);
@@ -217,21 +238,22 @@ struct System::Impl {
LOG_DEBUG(Core, "Initialized OK");
- return ResultStatus::Success;
+ return SystemResultStatus::Success;
}
- ResultStatus Load(System& system, Frontend::EmuWindow& emu_window, const std::string& filepath,
- u64 program_id, std::size_t program_index) {
+ SystemResultStatus Load(System& system, Frontend::EmuWindow& emu_window,
+ const std::string& filepath, u64 program_id,
+ std::size_t program_index) {
app_loader = Loader::GetLoader(system, GetGameFileFromPath(virtual_filesystem, filepath),
program_id, program_index);
if (!app_loader) {
LOG_CRITICAL(Core, "Failed to obtain loader for {}!", filepath);
- return ResultStatus::ErrorGetLoader;
+ return SystemResultStatus::ErrorGetLoader;
}
- ResultStatus init_result{Init(system, emu_window)};
- if (init_result != ResultStatus::Success) {
+ SystemResultStatus init_result{Init(system, emu_window)};
+ if (init_result != SystemResultStatus::Success) {
LOG_CRITICAL(Core, "Failed to initialize system (Error {})!",
static_cast<int>(init_result));
Shutdown();
@@ -249,8 +271,8 @@ struct System::Impl {
LOG_CRITICAL(Core, "Failed to load ROM (Error {})!", load_result);
Shutdown();
- return static_cast<ResultStatus>(static_cast<u32>(ResultStatus::ErrorLoader) +
- static_cast<u32>(load_result));
+ return static_cast<SystemResultStatus>(
+ static_cast<u32>(SystemResultStatus::ErrorLoader) + static_cast<u32>(load_result));
}
AddGlueRegistrationForProcess(*app_loader, *main_process);
kernel.MakeCurrentProcess(main_process.get());
@@ -282,7 +304,7 @@ struct System::Impl {
GetAndResetPerfStats();
perf_stats->BeginSystemFrame();
- status = ResultStatus::Success;
+ status = SystemResultStatus::Success;
return status;
}
@@ -355,7 +377,7 @@ struct System::Impl {
arp_manager.Register(launch.title_id, launch, std::move(nacp_data));
}
- void SetStatus(ResultStatus new_status, const char* details = nullptr) {
+ void SetStatus(SystemResultStatus new_status, const char* details = nullptr) {
status = new_status;
if (details) {
status_details = details;
@@ -366,6 +388,9 @@ struct System::Impl {
return perf_stats->GetAndResetStats(core_timing.GetGlobalTimeUs());
}
+ std::mutex suspend_guard;
+ bool is_paused{};
+
Timing::CoreTiming core_timing;
Kernel::KernelCore kernel;
/// RealVfsFilesystem instance
@@ -411,7 +436,7 @@ struct System::Impl {
/// Network instance
Network::NetworkInstance network_instance;
- ResultStatus status = ResultStatus::Success;
+ SystemResultStatus status = SystemResultStatus::Success;
std::string status_details = "";
std::unique_ptr<Core::PerfStats> perf_stats;
@@ -428,21 +453,8 @@ struct System::Impl {
};
System::System() : impl{std::make_unique<Impl>(*this)} {}
-System::~System() = default;
-System& System::GetInstance() {
- if (!s_instance) {
- throw std::runtime_error("Using System instance before its initialization");
- }
- return *s_instance;
-}
-
-void System::InitializeGlobalInstance() {
- if (s_instance) {
- throw std::runtime_error("Reinitializing Global System instance.");
- }
- s_instance = std::unique_ptr<System>(new System);
-}
+System::~System() = default;
CpuManager& System::GetCpuManager() {
return impl->cpu_manager;
@@ -452,16 +464,16 @@ const CpuManager& System::GetCpuManager() const {
return impl->cpu_manager;
}
-System::ResultStatus System::Run() {
+SystemResultStatus System::Run() {
return impl->Run();
}
-System::ResultStatus System::Pause() {
+SystemResultStatus System::Pause() {
return impl->Pause();
}
-System::ResultStatus System::SingleStep() {
- return ResultStatus::Success;
+SystemResultStatus System::SingleStep() {
+ return SystemResultStatus::Success;
}
void System::InvalidateCpuInstructionCaches() {
@@ -476,8 +488,16 @@ void System::Shutdown() {
impl->Shutdown();
}
-System::ResultStatus System::Load(Frontend::EmuWindow& emu_window, const std::string& filepath,
- u64 program_id, std::size_t program_index) {
+std::unique_lock<std::mutex> System::StallCPU() {
+ return impl->StallCPU();
+}
+
+void System::UnstallCPU() {
+ impl->UnstallCPU();
+}
+
+SystemResultStatus System::Load(Frontend::EmuWindow& emu_window, const std::string& filepath,
+ u64 program_id, std::size_t program_index) {
return impl->Load(*this, emu_window, filepath, program_id, program_index);
}
@@ -637,7 +657,7 @@ Loader::ResultStatus System::GetGameName(std::string& out) const {
return impl->GetGameName(out);
}
-void System::SetStatus(ResultStatus new_status, const char* details) {
+void System::SetStatus(SystemResultStatus new_status, const char* details) {
impl->SetStatus(new_status, details);
}
diff --git a/src/core/core.h b/src/core/core.h
index a796472b2..1cfe1bba6 100644
--- a/src/core/core.h
+++ b/src/core/core.h
@@ -7,6 +7,7 @@
#include <cstddef>
#include <functional>
#include <memory>
+#include <mutex>
#include <string>
#include <vector>
@@ -104,55 +105,49 @@ struct PerfStatsResults;
FileSys::VirtualFile GetGameFileFromPath(const FileSys::VirtualFilesystem& vfs,
const std::string& path);
+/// Enumeration representing the return values of the System Initialize and Load process.
+enum class SystemResultStatus : u32 {
+ Success, ///< Succeeded
+ ErrorNotInitialized, ///< Error trying to use core prior to initialization
+ ErrorGetLoader, ///< Error finding the correct application loader
+ ErrorSystemFiles, ///< Error in finding system files
+ ErrorSharedFont, ///< Error in finding shared font
+ ErrorVideoCore, ///< Error in the video core
+ ErrorUnknown, ///< Any other error
+ ErrorLoader, ///< The base for loader errors (too many to repeat)
+};
+
class System {
public:
using CurrentBuildProcessID = std::array<u8, 0x20>;
+ explicit System();
+
+ ~System();
+
System(const System&) = delete;
System& operator=(const System&) = delete;
System(System&&) = delete;
System& operator=(System&&) = delete;
- ~System();
-
- /**
- * Gets the instance of the System singleton class.
- * @returns Reference to the instance of the System singleton class.
- */
- [[deprecated("Use of the global system instance is deprecated")]] static System& GetInstance();
-
- static void InitializeGlobalInstance();
-
- /// Enumeration representing the return values of the System Initialize and Load process.
- enum class ResultStatus : u32 {
- Success, ///< Succeeded
- ErrorNotInitialized, ///< Error trying to use core prior to initialization
- ErrorGetLoader, ///< Error finding the correct application loader
- ErrorSystemFiles, ///< Error in finding system files
- ErrorSharedFont, ///< Error in finding shared font
- ErrorVideoCore, ///< Error in the video core
- ErrorUnknown, ///< Any other error
- ErrorLoader, ///< The base for loader errors (too many to repeat)
- };
-
/**
* Run the OS and Application
* This function will start emulation and run the relevant devices
*/
- [[nodiscard]] ResultStatus Run();
+ [[nodiscard]] SystemResultStatus Run();
/**
* Pause the OS and Application
* This function will pause emulation and stop the relevant devices
*/
- [[nodiscard]] ResultStatus Pause();
+ [[nodiscard]] SystemResultStatus Pause();
/**
* Step the CPU one instruction
* @return Result status, indicating whether or not the operation succeeded.
*/
- [[nodiscard]] ResultStatus SingleStep();
+ [[nodiscard]] SystemResultStatus SingleStep();
/**
* Invalidate the CPU instruction caches
@@ -166,16 +161,20 @@ public:
/// Shutdown the emulated system.
void Shutdown();
+ std::unique_lock<std::mutex> StallCPU();
+ void UnstallCPU();
+
/**
* Load an executable application.
* @param emu_window Reference to the host-system window used for video output and keyboard
* input.
* @param filepath String path to the executable application to load on the host file system.
* @param program_index Specifies the index within the container of the program to launch.
- * @returns ResultStatus code, indicating if the operation succeeded.
+ * @returns SystemResultStatus code, indicating if the operation succeeded.
*/
- [[nodiscard]] ResultStatus Load(Frontend::EmuWindow& emu_window, const std::string& filepath,
- u64 program_id = 0, std::size_t program_index = 0);
+ [[nodiscard]] SystemResultStatus Load(Frontend::EmuWindow& emu_window,
+ const std::string& filepath, u64 program_id = 0,
+ std::size_t program_index = 0);
/**
* Indicates if the emulated system is powered on (all subsystems initialized and able to run an
@@ -301,7 +300,7 @@ public:
/// Gets the name of the current game
[[nodiscard]] Loader::ResultStatus GetGameName(std::string& out) const;
- void SetStatus(ResultStatus new_status, const char* details);
+ void SetStatus(SystemResultStatus new_status, const char* details);
[[nodiscard]] const std::string& GetStatusDetails() const;
@@ -403,12 +402,8 @@ public:
void ApplySettings();
private:
- System();
-
struct Impl;
std::unique_ptr<Impl> impl;
-
- inline static std::unique_ptr<System> s_instance{};
};
} // namespace Core
diff --git a/src/core/hle/kernel/k_page_table.cpp b/src/core/hle/kernel/k_page_table.cpp
index 701268545..5e0b620c2 100644
--- a/src/core/hle/kernel/k_page_table.cpp
+++ b/src/core/hle/kernel/k_page_table.cpp
@@ -363,6 +363,8 @@ ResultCode KPageTable::UnmapProcessCodeMemory(VAddr dst_addr, VAddr src_addr, st
block_manager->Update(src_addr, num_pages, KMemoryState::Normal,
KMemoryPermission::ReadAndWrite);
+ system.InvalidateCpuInstructionCacheRange(dst_addr, size);
+
return ResultSuccess;
}
diff --git a/src/core/hle/kernel/k_scheduler.h b/src/core/hle/kernel/k_scheduler.h
index c8ccc1ae4..7df288438 100644
--- a/src/core/hle/kernel/k_scheduler.h
+++ b/src/core/hle/kernel/k_scheduler.h
@@ -49,6 +49,11 @@ public:
/// Gets the current running thread
[[nodiscard]] KThread* GetCurrentThread() const;
+ /// Gets the idle thread
+ [[nodiscard]] KThread* GetIdleThread() const {
+ return idle_thread;
+ }
+
/// Returns true if the scheduler is idle
[[nodiscard]] bool IsIdle() const {
return GetCurrentThread() == idle_thread;
diff --git a/src/core/hle/kernel/svc.cpp b/src/core/hle/kernel/svc.cpp
index f98f24a60..7f38ade1c 100644
--- a/src/core/hle/kernel/svc.cpp
+++ b/src/core/hle/kernel/svc.cpp
@@ -886,7 +886,24 @@ static ResultCode GetInfo(Core::System& system, u64* result, u64 info_id, Handle
*result = out_ticks;
return ResultSuccess;
}
+ case GetInfoType::IdleTickCount: {
+ if (handle == 0) {
+ LOG_ERROR(Kernel_SVC, "Thread handle does not exist, handle=0x{:08X}",
+ static_cast<Handle>(handle));
+ return ResultInvalidHandle;
+ }
+ if (info_sub_id != 0xFFFFFFFFFFFFFFFF && info_sub_id != system.CurrentCoreIndex()) {
+ LOG_ERROR(Kernel_SVC, "Core is not the current core, got {}", info_sub_id);
+ return ResultInvalidCombination;
+ }
+
+ const auto& scheduler = *system.Kernel().CurrentScheduler();
+ const auto* const idle_thread = scheduler.GetIdleThread();
+
+ *result = idle_thread->GetCpuTime();
+ return ResultSuccess;
+ }
default:
LOG_ERROR(Kernel_SVC, "Unimplemented svcGetInfo id=0x{:016X}", info_id);
return ResultInvalidEnumValue;
diff --git a/src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp b/src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp
index 8b4867ca7..f9b82b504 100644
--- a/src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp
+++ b/src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp
@@ -92,6 +92,7 @@ NvResult nvhost_ctrl::IocCtrlEventWait(const std::vector<u8>& input, std::vector
if (syncpoint_manager.IsSyncpointExpired(params.syncpt_id, params.threshold)) {
params.value = syncpoint_manager.GetSyncpointMin(params.syncpt_id);
std::memcpy(output.data(), &params, sizeof(params));
+ events_interface.failed[event_id] = false;
return NvResult::Success;
}
@@ -99,6 +100,7 @@ NvResult nvhost_ctrl::IocCtrlEventWait(const std::vector<u8>& input, std::vector
syncpoint_manager.IsSyncpointExpired(params.syncpt_id, params.threshold)) {
params.value = new_value;
std::memcpy(output.data(), &params, sizeof(params));
+ events_interface.failed[event_id] = false;
return NvResult::Success;
}
@@ -117,6 +119,7 @@ NvResult nvhost_ctrl::IocCtrlEventWait(const std::vector<u8>& input, std::vector
event.event->GetWritableEvent().Signal();
params.value = current_syncpoint_value;
std::memcpy(output.data(), &params, sizeof(params));
+ events_interface.failed[event_id] = false;
return NvResult::Success;
}
const u32 target_value = current_syncpoint_value - diff;
@@ -146,6 +149,16 @@ NvResult nvhost_ctrl::IocCtrlEventWait(const std::vector<u8>& input, std::vector
}
params.value |= event_id;
event.event->GetWritableEvent().Clear();
+ if (events_interface.failed[event_id]) {
+ {
+ auto lk = system.StallCPU();
+ gpu.WaitFence(params.syncpt_id, target_value);
+ system.UnstallCPU();
+ }
+ std::memcpy(output.data(), &params, sizeof(params));
+ events_interface.failed[event_id] = false;
+ return NvResult::Success;
+ }
gpu.RegisterSyncptInterrupt(params.syncpt_id, target_value);
std::memcpy(output.data(), &params, sizeof(params));
return NvResult::Timeout;
@@ -201,6 +214,7 @@ NvResult nvhost_ctrl::IocCtrlClearEventWait(const std::vector<u8>& input, std::v
if (events_interface.status[event_id] == EventState::Waiting) {
events_interface.LiberateEvent(event_id);
}
+ events_interface.failed[event_id] = true;
syncpoint_manager.RefreshSyncpoint(events_interface.events[event_id].fence.id);
diff --git a/src/core/hle/service/nvdrv/devices/nvhost_nvdec_common.cpp b/src/core/hle/service/nvdrv/devices/nvhost_nvdec_common.cpp
index 845de724d..e61261f98 100644
--- a/src/core/hle/service/nvdrv/devices/nvhost_nvdec_common.cpp
+++ b/src/core/hle/service/nvdrv/devices/nvhost_nvdec_common.cpp
@@ -69,8 +69,7 @@ NvResult nvhost_nvdec_common::Submit(const std::vector<u8>& input, std::vector<u
std::vector<Reloc> relocs(params.relocation_count);
std::vector<u32> reloc_shifts(params.relocation_count);
std::vector<SyncptIncr> syncpt_increments(params.syncpoint_count);
- std::vector<SyncptIncr> wait_checks(params.syncpoint_count);
- std::vector<Fence> fences(params.fence_count);
+ std::vector<u32> fence_thresholds(params.fence_count);
// Slice input into their respective buffers
std::size_t offset = sizeof(IoctlSubmit);
@@ -78,15 +77,13 @@ NvResult nvhost_nvdec_common::Submit(const std::vector<u8>& input, std::vector<u
offset += SliceVectors(input, relocs, params.relocation_count, offset);
offset += SliceVectors(input, reloc_shifts, params.relocation_count, offset);
offset += SliceVectors(input, syncpt_increments, params.syncpoint_count, offset);
- offset += SliceVectors(input, wait_checks, params.syncpoint_count, offset);
- offset += SliceVectors(input, fences, params.fence_count, offset);
+ offset += SliceVectors(input, fence_thresholds, params.fence_count, offset);
auto& gpu = system.GPU();
if (gpu.UseNvdec()) {
for (std::size_t i = 0; i < syncpt_increments.size(); i++) {
const SyncptIncr& syncpt_incr = syncpt_increments[i];
- fences[i].id = syncpt_incr.id;
- fences[i].value =
+ fence_thresholds[i] =
syncpoint_manager.IncreaseSyncpoint(syncpt_incr.id, syncpt_incr.increments);
}
}
@@ -98,11 +95,6 @@ NvResult nvhost_nvdec_common::Submit(const std::vector<u8>& input, std::vector<u
cmdlist.size() * sizeof(u32));
gpu.PushCommandBuffer(cmdlist);
}
- if (gpu.UseNvdec()) {
- fences[0].value = syncpoint_manager.IncreaseSyncpoint(fences[0].id, 1);
- Tegra::ChCommandHeaderList cmdlist{{(4 << 28) | fences[0].id}};
- gpu.PushCommandBuffer(cmdlist);
- }
std::memcpy(output.data(), &params, sizeof(IoctlSubmit));
// Some games expect command_buffers to be written back
offset = sizeof(IoctlSubmit);
@@ -110,8 +102,7 @@ NvResult nvhost_nvdec_common::Submit(const std::vector<u8>& input, std::vector<u
offset += WriteVectors(output, relocs, offset);
offset += WriteVectors(output, reloc_shifts, offset);
offset += WriteVectors(output, syncpt_increments, offset);
- offset += WriteVectors(output, wait_checks, offset);
- offset += WriteVectors(output, fences, offset);
+ offset += WriteVectors(output, fence_thresholds, offset);
return NvResult::Success;
}
diff --git a/src/core/hle/service/nvdrv/devices/nvhost_nvdec_common.h b/src/core/hle/service/nvdrv/devices/nvhost_nvdec_common.h
index af59f00d2..ae4199b79 100644
--- a/src/core/hle/service/nvdrv/devices/nvhost_nvdec_common.h
+++ b/src/core/hle/service/nvdrv/devices/nvhost_nvdec_common.h
@@ -56,19 +56,16 @@ protected:
s32 target{};
s32 target_offset{};
};
- static_assert(sizeof(Reloc) == 0x10, "CommandBuffer has incorrect size");
+ static_assert(sizeof(Reloc) == 0x10, "Reloc has incorrect size");
struct SyncptIncr {
u32 id{};
u32 increments{};
+ u32 unk0{};
+ u32 unk1{};
+ u32 unk2{};
};
- static_assert(sizeof(SyncptIncr) == 0x8, "CommandBuffer has incorrect size");
-
- struct Fence {
- u32 id{};
- u32 value{};
- };
- static_assert(sizeof(Fence) == 0x8, "CommandBuffer has incorrect size");
+ static_assert(sizeof(SyncptIncr) == 0x14, "SyncptIncr has incorrect size");
struct IoctlGetSyncpoint {
// Input
diff --git a/src/core/hle/service/nvdrv/nvdrv.h b/src/core/hle/service/nvdrv/nvdrv.h
index e2a1dde5b..a5af5b785 100644
--- a/src/core/hle/service/nvdrv/nvdrv.h
+++ b/src/core/hle/service/nvdrv/nvdrv.h
@@ -49,6 +49,8 @@ struct EventInterface {
std::array<EventState, MaxNvEvents> status{};
// Tells if an NVEvent is registered or not
std::array<bool, MaxNvEvents> registered{};
+ // Tells the NVEvent that it has failed.
+ std::array<bool, MaxNvEvents> failed{};
// When an NVEvent is waiting on GPU interrupt, this is the sync_point
// associated with it.
std::array<u32, MaxNvEvents> assigned_syncpt{};
diff --git a/src/core/hle/service/time/time_manager.cpp b/src/core/hle/service/time/time_manager.cpp
index 4bbc606a1..9c4c960ef 100644
--- a/src/core/hle/service/time/time_manager.cpp
+++ b/src/core/hle/service/time/time_manager.cpp
@@ -13,18 +13,19 @@
#include "core/hle/service/time/time_manager.h"
namespace Service::Time {
-
+namespace {
constexpr Clock::TimeSpanType standard_network_clock_accuracy{0x0009356907420000ULL};
-static std::chrono::seconds GetSecondsSinceEpoch() {
- return std::chrono::duration_cast<std::chrono::seconds>(
- std::chrono::system_clock::now().time_since_epoch()) +
+s64 GetSecondsSinceEpoch() {
+ const auto time_since_epoch = std::chrono::system_clock::now().time_since_epoch();
+ return std::chrono::duration_cast<std::chrono::seconds>(time_since_epoch).count() +
Settings::values.custom_rtc_differential;
}
-static s64 GetExternalRtcValue() {
- return GetSecondsSinceEpoch().count() + TimeManager::GetExternalTimeZoneOffset();
+s64 GetExternalRtcValue() {
+ return GetSecondsSinceEpoch() + TimeManager::GetExternalTimeZoneOffset();
}
+} // Anonymous namespace
struct TimeManager::Impl final {
explicit Impl(Core::System& system)
diff --git a/src/core/hle/service/vi/vi.cpp b/src/core/hle/service/vi/vi.cpp
index be3d52d54..439e7e472 100644
--- a/src/core/hle/service/vi/vi.cpp
+++ b/src/core/hle/service/vi/vi.cpp
@@ -524,7 +524,9 @@ private:
Disconnect = 11,
AllocateBuffers = 13,
- SetPreallocatedBuffer = 14
+ SetPreallocatedBuffer = 14,
+
+ GetBufferHistory = 17
};
void TransactParcel(Kernel::HLERequestContext& ctx) {
@@ -641,6 +643,14 @@ private:
ctx.WriteBuffer(response.Serialize());
break;
}
+ case TransactionId::GetBufferHistory: {
+ LOG_WARNING(Service_VI, "(STUBBED) called, transaction=GetBufferHistory");
+ [[maybe_unused]] const auto buffer = ctx.ReadBuffer();
+
+ IGBPEmptyResponseParcel response{};
+ ctx.WriteBuffer(response.Serialize());
+ break;
+ }
default:
ASSERT_MSG(false, "Unimplemented");
}