core: Library cleanup (#1631)

* core: Split error codes into separate files

* Reduces build times and is cleaner

* core: Bring structs and enums to codebase style

* core: More style changes
This commit is contained in:
TheTurtle 2024-11-30 22:37:36 +02:00 committed by GitHub
parent 3d0aacd43d
commit 5b6e0ab238
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
114 changed files with 2158 additions and 2509 deletions

View file

@ -3,9 +3,9 @@
#include "common/config.h"
#include "common/logging/log.h"
#include "core/libraries/error_codes.h"
#include "core/libraries/libs.h"
#include "core/libraries/system/systemservice.h"
#include "core/libraries/system/systemservice_error.h"
namespace Libraries::SystemService {
@ -1772,14 +1772,12 @@ s32 PS4_SYSV_ABI sceSystemServiceGetStatus(OrbisSystemServiceStatus* status) {
LOG_ERROR(Lib_SystemService, "OrbisSystemServiceStatus is null");
return ORBIS_SYSTEM_SERVICE_ERROR_PARAMETER;
}
OrbisSystemServiceStatus st = {};
st.eventNum = 0;
st.isSystemUiOverlaid = false;
st.isInBackgroundExecution = false;
st.isCpuMode7CpuNormal = true;
st.isGameLiveStreamingOnAir = false;
st.isOutOfVrPlayArea = false;
*status = st;
status->event_num = 0;
status->is_system_ui_overlaid = false;
status->is_in_background_execution = false;
status->is_cpu_mode7_cpu_normal = true;
status->is_game_live_streaming_on_air = false;
status->is_out_of_vr_play_area = false;
return ORBIS_OK;
}
@ -1889,39 +1887,38 @@ int PS4_SYSV_ABI sceSystemServiceNavigateToGoHome() {
return ORBIS_OK;
}
s32 PS4_SYSV_ABI sceSystemServiceParamGetInt(int param_id, int* value) {
s32 PS4_SYSV_ABI sceSystemServiceParamGetInt(OrbisSystemServiceParamId param_id, int* value) {
// TODO this probably should be stored in config for UI configuration
LOG_INFO(Lib_SystemService, "called param_id {}", param_id);
LOG_INFO(Lib_SystemService, "called param_id {}", u32(param_id));
if (value == nullptr) {
LOG_ERROR(Lib_SystemService, "value is null");
return ORBIS_SYSTEM_SERVICE_ERROR_PARAMETER;
}
switch (param_id) {
case ORBIS_SYSTEM_SERVICE_PARAM_ID_LANG:
case OrbisSystemServiceParamId::Lang:
*value = Config::GetLanguage();
break;
case ORBIS_SYSTEM_SERVICE_PARAM_ID_DATE_FORMAT:
*value = ORBIS_SYSTEM_PARAM_DATE_FORMAT_DDMMYYYY;
case OrbisSystemServiceParamId::DateFormat:
*value = u32(OrbisSystemParamDateFormat::FmtDDMMYYYY);
break;
case ORBIS_SYSTEM_SERVICE_PARAM_ID_TIME_FORMAT:
*value = ORBIS_SYSTEM_PARAM_TIME_FORMAT_24HOUR;
case OrbisSystemServiceParamId::TimeFormat:
*value = u32(OrbisSystemParamTimeFormat::Fmt24Hour);
break;
case ORBIS_SYSTEM_SERVICE_PARAM_ID_TIME_ZONE:
case OrbisSystemServiceParamId::TimeZone:
*value = +120;
break;
case ORBIS_SYSTEM_SERVICE_PARAM_ID_SUMMERTIME:
case OrbisSystemServiceParamId::Summertime:
*value = 1;
break;
case ORBIS_SYSTEM_SERVICE_PARAM_ID_GAME_PARENTAL_LEVEL:
*value = ORBIS_SYSTEM_PARAM_GAME_PARENTAL_OFF;
case OrbisSystemServiceParamId::GameParentalLevel:
*value = u32(OrbisSystemParamGameParentalLevel::Off);
break;
case ORBIS_SYSTEM_SERVICE_PARAM_ID_ENTER_BUTTON_ASSIGN:
*value = ORBIS_SYSTEM_PARAM_ENTER_BUTTON_ASSIGN_CROSS;
case OrbisSystemServiceParamId::EnterButtonAssign:
*value = u32(OrbisSystemParamEnterButtonAssign::Cross);
break;
default:
LOG_ERROR(Lib_SystemService, "param_id {} unsupported!",
param_id); // shouldn't go there but log it
*value = 0; // return a dummy value
LOG_ERROR(Lib_SystemService, "param_id {} unsupported!", u32(param_id));
*value = 0;
}
return ORBIS_OK;