mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2024-12-29 11:06:07 +00:00
rtc errors (#485)
* rtc errors * add system libs to cmakelists * this.[func] * fix errors * declaration * log handle addr * missed --------- Co-authored-by: microsoftv <6063922+microsoftv@users.noreply.github.com>
This commit is contained in:
parent
c60bfbe2a5
commit
32cb3649d3
|
@ -193,6 +193,7 @@ set(SYSTEM_LIBS src/core/libraries/system/commondialog.cpp
|
||||||
src/core/libraries/app_content/app_content.h
|
src/core/libraries/app_content/app_content.h
|
||||||
src/core/libraries/rtc/rtc.cpp
|
src/core/libraries/rtc/rtc.cpp
|
||||||
src/core/libraries/rtc/rtc.h
|
src/core/libraries/rtc/rtc.h
|
||||||
|
src/core/libraries/rtc/rtc_error.h
|
||||||
src/core/libraries/disc_map/disc_map.cpp
|
src/core/libraries/disc_map/disc_map.cpp
|
||||||
src/core/libraries/disc_map/disc_map.h
|
src/core/libraries/disc_map/disc_map.h
|
||||||
src/core/libraries/disc_map/disc_map_codes.h
|
src/core/libraries/disc_map/disc_map_codes.h
|
||||||
|
@ -208,6 +209,11 @@ set(SYSTEM_LIBS src/core/libraries/system/commondialog.cpp
|
||||||
src/core/libraries/avplayer/avplayer_state.h
|
src/core/libraries/avplayer/avplayer_state.h
|
||||||
src/core/libraries/avplayer/avplayer.cpp
|
src/core/libraries/avplayer/avplayer.cpp
|
||||||
src/core/libraries/avplayer/avplayer.h
|
src/core/libraries/avplayer/avplayer.h
|
||||||
|
src/core/libraries/ngs2/ngs2.cpp
|
||||||
|
src/core/libraries/ngs2/ngs2.h
|
||||||
|
src/core/libraries/ngs2/ngs2_error.h
|
||||||
|
src/core/libraries/ngs2/ngs2_impl.cpp
|
||||||
|
src/core/libraries/ngs2/ngs2_impl.h
|
||||||
)
|
)
|
||||||
|
|
||||||
set(VIDEOOUT_LIB src/core/libraries/videoout/buffer.h
|
set(VIDEOOUT_LIB src/core/libraries/videoout/buffer.h
|
||||||
|
|
|
@ -12,22 +12,23 @@ using namespace Libraries::Kernel;
|
||||||
|
|
||||||
namespace Libraries::Ngs2 {
|
namespace Libraries::Ngs2 {
|
||||||
|
|
||||||
s32 Ngs2::ReportInvalid(u32 handle_type) const {
|
s32 Ngs2::ReportInvalid(Ngs2Handle* handle, u32 handle_type) const {
|
||||||
|
uintptr_t hAddress = reinterpret_cast<uintptr_t>(handle);
|
||||||
switch (handle_type) {
|
switch (handle_type) {
|
||||||
case 1:
|
case 1:
|
||||||
LOG_ERROR(Lib_Ngs2, "Invalid system handle {}", this);
|
LOG_ERROR(Lib_Ngs2, "Invalid system handle {}", hAddress);
|
||||||
return ORBIS_NGS2_ERROR_INVALID_SYSTEM_HANDLE;
|
return ORBIS_NGS2_ERROR_INVALID_SYSTEM_HANDLE;
|
||||||
case 2:
|
case 2:
|
||||||
LOG_ERROR(Lib_Ngs2, "Invalid rack handle {}", this);
|
LOG_ERROR(Lib_Ngs2, "Invalid rack handle {}", hAddress);
|
||||||
return ORBIS_NGS2_ERROR_INVALID_RACK_HANDLE;
|
return ORBIS_NGS2_ERROR_INVALID_RACK_HANDLE;
|
||||||
case 4:
|
case 4:
|
||||||
LOG_ERROR(Lib_Ngs2, "Invalid voice handle {}", this);
|
LOG_ERROR(Lib_Ngs2, "Invalid voice handle {}", hAddress);
|
||||||
return ORBIS_NGS2_ERROR_INVALID_VOICE_HANDLE;
|
return ORBIS_NGS2_ERROR_INVALID_VOICE_HANDLE;
|
||||||
case 8:
|
case 8:
|
||||||
LOG_ERROR(Lib_Ngs2, "Invalid report handle {}", this);
|
LOG_ERROR(Lib_Ngs2, "Invalid report handle {}", hAddress);
|
||||||
return ORBIS_NGS2_ERROR_INVALID_REPORT_HANDLE;
|
return ORBIS_NGS2_ERROR_INVALID_REPORT_HANDLE;
|
||||||
default:
|
default:
|
||||||
LOG_ERROR(Lib_Ngs2, "Invalid handle {}", this);
|
LOG_ERROR(Lib_Ngs2, "Invalid handle {}", hAddress);
|
||||||
return ORBIS_NGS2_ERROR_INVALID_HANDLE;
|
return ORBIS_NGS2_ERROR_INVALID_HANDLE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -58,24 +59,24 @@ s32 Ngs2::HandleCleanup(Ngs2Handle* handle, u32 hType, void* dataOut) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return HandleReportInvalid(handle, hType);
|
return this->ReportInvalid(handle, hType);
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 Ngs2::HandleEnter(Ngs2Handle* handle, u32 hType, Ngs2Handle* handleOut) {
|
s32 Ngs2::HandleEnter(Ngs2Handle* handle, u32 hType, Ngs2Handle* handleOut) {
|
||||||
if (!handle) {
|
if (!handle) {
|
||||||
return HandleReportInvalid(handle, 0);
|
return this->ReportInvalid(handle, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (handle->selfPointer != handle || !handle->atomicPtr || !handle->dataPointer ||
|
if (handle->selfPointer != handle || !handle->atomicPtr || !handle->dataPointer ||
|
||||||
(~hType & handle->handleType)) {
|
(~hType & handle->handleType)) {
|
||||||
return HandleReportInvalid(handle, handle->handleType);
|
return this->ReportInvalid(handle, handle->handleType);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::atomic<u32>* atomic = handle->atomicPtr;
|
std::atomic<u32>* atomic = handle->atomicPtr;
|
||||||
while (true) {
|
while (true) {
|
||||||
u32 i = atomic->load();
|
u32 i = atomic->load();
|
||||||
if (i == 0) {
|
if (i == 0) {
|
||||||
return HandleReportInvalid(handle, handle->handleType);
|
return this->ReportInvalid(handle, handle->handleType);
|
||||||
}
|
}
|
||||||
if (atomic->compare_exchange_strong(i, i + 1)) {
|
if (atomic->compare_exchange_strong(i, i + 1)) {
|
||||||
break;
|
break;
|
||||||
|
@ -83,7 +84,7 @@ s32 Ngs2::HandleEnter(Ngs2Handle* handle, u32 hType, Ngs2Handle* handleOut) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (handleOut) {
|
if (handleOut) {
|
||||||
*handleOut = handle;
|
handleOut = handle;
|
||||||
}
|
}
|
||||||
return ORBIS_OK;
|
return ORBIS_OK;
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,7 @@ namespace Libraries::Ngs2 {
|
||||||
|
|
||||||
class Ngs2 {
|
class Ngs2 {
|
||||||
public:
|
public:
|
||||||
s32 ReportInvalid(u32 handle_type) const;
|
s32 ReportInvalid(Ngs2Handle* handle, u32 handle_type) const;
|
||||||
s32 HandleSetup(Ngs2Handle* handle, void* data, std::atomic<u32>* atomic, u32 type, u32 flags);
|
s32 HandleSetup(Ngs2Handle* handle, void* data, std::atomic<u32>* atomic, u32 type, u32 flags);
|
||||||
s32 HandleCleanup(Ngs2Handle* handle, u32 hType, void* dataOut);
|
s32 HandleCleanup(Ngs2Handle* handle, u32 hType, void* dataOut);
|
||||||
s32 HandleEnter(Ngs2Handle* handle, u32 hType, Ngs2Handle* handleOut);
|
s32 HandleEnter(Ngs2Handle* handle, u32 hType, Ngs2Handle* handleOut);
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
#include "core/libraries/error_codes.h"
|
#include "core/libraries/error_codes.h"
|
||||||
#include "core/libraries/libs.h"
|
#include "core/libraries/libs.h"
|
||||||
#include "rtc.h"
|
#include "rtc.h"
|
||||||
|
#include "rtc_error.h"
|
||||||
|
|
||||||
namespace Libraries::Rtc {
|
namespace Libraries::Rtc {
|
||||||
|
|
||||||
|
@ -123,8 +124,7 @@ int PS4_SYSV_ABI sceRtcGetTick() {
|
||||||
}
|
}
|
||||||
|
|
||||||
int PS4_SYSV_ABI sceRtcGetTickResolution() {
|
int PS4_SYSV_ABI sceRtcGetTickResolution() {
|
||||||
LOG_ERROR(Lib_Rtc, "(STUBBED) called");
|
return 1000000;
|
||||||
return ORBIS_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int PS4_SYSV_ABI sceRtcGetTime_t() {
|
int PS4_SYSV_ABI sceRtcGetTime_t() {
|
||||||
|
|
17
src/core/libraries/rtc/rtc_error.h
Normal file
17
src/core/libraries/rtc/rtc_error.h
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||||
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
constexpr int ORBIS_RTC_ERROR_INVALID_PARAMETER = 0x80010602;
|
||||||
|
constexpr int ORBIS_RTC_ERROR_INVALID_TICK_PARAMETER = 0x80010603;
|
||||||
|
constexpr int ORBIS_RTC_ERROR_INVALID_DATE_PARAMETER = 0x80010604;
|
||||||
|
constexpr int ORBIS_RTC_ERROR_NOT_IMPLEMENTED = 0x80010605;
|
||||||
|
constexpr int ORBIS_RTC_ERROR_INVALID_TIMEZONE_FORMAT = 0x80010607;
|
||||||
|
constexpr int ORBIS_RTC_ERROR_INVALID_YEARS_PARAMETER = 0x80010621;
|
||||||
|
constexpr int ORBIS_RTC_ERROR_INVALID_MONTHS_PARAMETER = 0x80010622;
|
||||||
|
constexpr int ORBIS_RTC_ERROR_INVALID_DAYS_PARAMETER = 0x80010623;
|
||||||
|
constexpr int ORBIS_RTC_ERROR_INVALID_HOURS_PARAMETER = 0x80010624;
|
||||||
|
constexpr int ORBIS_RTC_ERROR_INVALID_MINUTES_PARAMETER = 0x80010625;
|
||||||
|
constexpr int ORBIS_RTC_ERROR_INVALID_SECONDS_PARAMETER = 0x80010626;
|
||||||
|
constexpr int ORBIS_RTC_ERROR_INVALID_MILLISECONDS_PARAMETER = 0x80010627;
|
Loading…
Reference in a new issue