mirror of
https://git.eden-emu.dev/eden-emu/eden
synced 2026-10-22 17:27:06 -04:00
John patch
This commit is contained in:
@@ -72,9 +72,10 @@ void ServiceFrameworkBase::ReportUnimplementedFunction(HLERequestContext& ctx, c
|
||||
}
|
||||
|
||||
[[nodiscard]] static bool VersionGateCheck(Core::System& system, u32 vg) {
|
||||
u32 const c_maj = FirmwareManager::GetFirmwareVersion(system).first.major;
|
||||
u32 const c_min = FirmwareManager::GetFirmwareVersion(system).first.minor;
|
||||
u32 const c_pat = FirmwareManager::GetFirmwareVersion(system).first.micro;
|
||||
const auto fw = FirmwareManager::GetFirmwareVersion(system).first;
|
||||
u32 const c_maj = fw.major;
|
||||
u32 const c_min = fw.minor;
|
||||
u32 const c_pat = fw.micro;
|
||||
u32 const cg = (c_pat << 0) | (c_min << 4) | (c_maj << 8);
|
||||
u32 const sg = (vg >> 16) & 0xffff;
|
||||
u32 const ug = vg & 0xffff;
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
#pragma once
|
||||
|
||||
#include "common/common_types.h"
|
||||
#include <mutex>
|
||||
|
||||
#include "core/core.h"
|
||||
#include "core/file_sys/nca_metadata.h"
|
||||
#include "core/file_sys/content_archive.h"
|
||||
@@ -95,13 +97,28 @@ FirmwareCheckResult VerifyFirmware(Core::System &system);
|
||||
*/
|
||||
inline std::pair<Service::Set::FirmwareVersionFormat, Result> GetFirmwareVersion(Core::System &system)
|
||||
{
|
||||
// The version cannot change while a session runs, and this is on the IPC dispatch path:
|
||||
// looking it up per call costs a firmware data read with firmware installed, and a
|
||||
// synthesized SystemVersion archive without one. Remember it.
|
||||
static std::mutex cache_mutex;
|
||||
static std::pair<Core::System*, std::pair<Service::Set::FirmwareVersionFormat, Result>> cache{};
|
||||
{
|
||||
std::scoped_lock lock{cache_mutex};
|
||||
if (cache.first == &system) {
|
||||
return cache.second;
|
||||
}
|
||||
}
|
||||
|
||||
Service::Set::FirmwareVersionFormat firmware_data{};
|
||||
const auto result
|
||||
= Service::Set::GetFirmwareVersionImpl(firmware_data,
|
||||
system,
|
||||
Service::Set::GetFirmwareVersionType::Version2);
|
||||
|
||||
return {firmware_data, result};
|
||||
{
|
||||
std::scoped_lock lock{cache_mutex};
|
||||
cache = {&system, {firmware_data, result}};
|
||||
return cache.second;
|
||||
}
|
||||
}
|
||||
|
||||
// TODO(crueter): GET AS STRING
|
||||
|
||||
Reference in New Issue
Block a user