ams: support building unit test programs on windows/linux/macos

This commit is contained in:
Michael Scire
2022-03-06 12:08:20 -08:00
committed by SciresM
parent 9a38be201a
commit 64a97576d0
756 changed files with 33359 additions and 9372 deletions

View File

@@ -19,8 +19,13 @@
namespace ams::settings::impl {
Result GetConfigurationId1(settings::factory::ConfigurationId1 *out) {
#if defined(ATMOSPHERE_OS_HORIZON)
static_assert(sizeof(*out) == sizeof(::SetCalConfigurationId1));
return ::setcalGetConfigurationId1(reinterpret_cast<::SetCalConfigurationId1 *>(out));
#else
AMS_UNUSED(out);
AMS_ABORT("TODO");
#endif
}
}

View File

@@ -19,8 +19,13 @@
namespace ams::settings::impl {
Result GetErrorReportSharePermission(s32 *out) {
#if defined(ATMOSPHERE_OS_HORIZON)
static_assert(sizeof(*out) == sizeof(::SetSysErrorReportSharePermission));
return ::setsysGetErrorReportSharePermission(reinterpret_cast<::SetSysErrorReportSharePermission *>(out));
#else
AMS_UNUSED(out);
AMS_ABORT("TODO");
#endif
}
}

View File

@@ -19,8 +19,13 @@
namespace ams::settings::impl {
Result GetFirmwareVersion(settings::system::FirmwareVersion *out) {
#if defined(ATMOSPHERE_OS_HORIZON)
static_assert(sizeof(*out) == sizeof(::SetSysFirmwareVersion));
return ::setsysGetFirmwareVersion(reinterpret_cast<::SetSysFirmwareVersion *>(out));
#else
AMS_UNUSED(out);
AMS_ABORT("TODO");
#endif
}
}

View File

@@ -646,7 +646,6 @@ namespace ams::settings::impl {
Result LoadKeyValueStoreMapEntries(Map *out, T &data, F load) {
/* Check pre-conditions. */
AMS_ASSERT(out != nullptr);
AMS_ASSERT(load != nullptr);
/* Read the number of entries. */
s64 offset = 0;
@@ -665,7 +664,6 @@ namespace ams::settings::impl {
Result LoadKeyValueStoreMapEntry(Map *out, T &data, s64 &offset, F load) {
/* Check pre-conditions. */
AMS_ASSERT(out != nullptr);
AMS_ASSERT(load != nullptr);
/* Read the size of the key. */
u32 key_size = 0;
@@ -892,9 +890,6 @@ namespace ams::settings::impl {
template<typename T, typename F>
Result SaveKeyValueStoreMap(T &data, const Map &map, F test) {
/* Check preconditions. */
AMS_ASSERT(test != nullptr);
/* Create the save data if necessary. */
R_TRY_CATCH(data.Create(HeapMemorySize)) {
R_CATCH(fs::ResultPathAlreadyExists) { /* It's okay if the save data already exists. */ }
@@ -1114,7 +1109,7 @@ namespace ams::settings::impl {
Result KeyValueStore::GetValueSize(u64 *out_value_size, const SettingsItemKey &item_key) {
/* Check preconditions. */
AMS_ASSERT(out_count != nullptr);
AMS_ASSERT(out_value_size != nullptr);
/* Acquire exclusive access to global state. */
std::scoped_lock lk(g_key_value_store_mutex);
@@ -1380,7 +1375,7 @@ namespace ams::settings::impl {
Result GetKeyValueStoreItemCountForDebug(u64 *out_count) {
/* Check preconditions. */
AMS_ASSERT(out != nullptr);
AMS_ASSERT(out_count != nullptr);
/* Acquire exclusive access to global state. */
std::scoped_lock lk(g_key_value_store_mutex);

View File

@@ -19,8 +19,13 @@
namespace ams::settings::impl {
Result GetPlatformRegion(s32 *out) {
#if defined(ATMOSPHERE_OS_HORIZON)
static_assert(sizeof(*out) == sizeof(::SetSysPlatformRegion));
return ::setsysGetPlatformRegion(reinterpret_cast<::SetSysPlatformRegion *>(out));
#else
AMS_UNUSED(out);
AMS_ABORT("TODO");
#endif
}
}

View File

@@ -19,8 +19,13 @@
namespace ams::settings::impl {
Result GetProductModel(s32 *out) {
#if defined(ATMOSPHERE_OS_HORIZON)
static_assert(sizeof(*out) == sizeof(::SetSysProductModel));
return ::setsysGetProductModel(reinterpret_cast<::SetSysProductModel *>(out));
#else
AMS_UNUSED(out);
AMS_ABORT("TODO");
#endif
}
}

View File

@@ -19,8 +19,13 @@
namespace ams::settings::impl {
Result GetRegionCode(s32 *out) {
#if defined(ATMOSPHERE_OS_HORIZON)
static_assert(sizeof(*out) == sizeof(::SetRegion));
return ::setGetRegionCode(reinterpret_cast<::SetRegion *>(out));
#else
AMS_UNUSED(out);
AMS_ABORT("TODO");
#endif
}
}

View File

@@ -19,13 +19,23 @@
namespace ams::settings::impl {
Result GetSerialNumber(settings::factory::SerialNumber *out) {
#if defined(ATMOSPHERE_OS_HORIZON)
static_assert(sizeof(*out) == sizeof(::SetCalSerialNumber));
return ::setcalGetSerialNumber(reinterpret_cast<::SetCalSerialNumber *>(out));
#else
AMS_UNUSED(out);
AMS_ABORT("TODO");
#endif
}
Result GetSerialNumber(settings::system::SerialNumber *out) {
#if defined(ATMOSPHERE_OS_HORIZON)
static_assert(sizeof(*out) == sizeof(::SetSysSerialNumber));
return ::setsysGetSerialNumber(reinterpret_cast<::SetSysSerialNumber *>(out));
#else
AMS_UNUSED(out);
AMS_ABORT("TODO");
#endif
}
}