strat: don't force fs globals to link into every process

This commit is contained in:
Michael Scire
2021-10-11 22:16:12 -07:00
parent bd1bcdf52b
commit 82d07e04aa
2 changed files with 54 additions and 28 deletions

View File

@@ -59,23 +59,6 @@ namespace ams::hos {
}
}
settings::FirmwareVersion GetSettingsFirmwareVersion() {
/* Mount the system version title. */
R_ABORT_UNLESS(ams::fs::MountSystemData("sysver", ncm::SystemDataId::SystemVersion));
ON_SCOPE_EXIT { ams::fs::Unmount("sysver"); };
/* Read the firmware version file. */
ams::fs::FileHandle file;
R_ABORT_UNLESS(ams::fs::OpenFile(std::addressof(file), "sysver:/file", fs::OpenMode_Read));
ON_SCOPE_EXIT { ams::fs::CloseFile(file); };
/* Must be possible to read firmware version from file. */
settings::FirmwareVersion firmware_version;
R_ABORT_UNLESS(ams::fs::ReadFile(file, 0, std::addressof(firmware_version), sizeof(firmware_version)));
return firmware_version;
}
}
void InitializeVersionInternal(bool allow_approximate) {
@@ -134,17 +117,6 @@ namespace ams::hos {
}
}
void SetNonApproximateVersionInternal() {
/* Get the settings . */
const auto firmware_version = GetSettingsFirmwareVersion();
/* Set the exosphere api version. */
R_ABORT_UNLESS(spl::SetConfig(spl::ConfigItem::ExosphereApiVersion, (static_cast<u32>(firmware_version.major) << 24) | (static_cast<u32>(firmware_version.minor) << 16) | (static_cast<u32>(firmware_version.micro) << 8)));
/* Update our own version value. */
InitializeVersionInternal(false);
}
::ams::hos::Version GetVersion() {
return g_hos_version;
}