mirror of
https://github.com/SysRay/psOff_public.git
synced 2024-11-23 06:19:41 +00:00
Error codes cleanup + more scePad fixes
This commit is contained in:
parent
5ea4a19d61
commit
f7e7116ef7
@ -653,14 +653,14 @@ int VideoOut::registerBuffers(int handle, int startIndex, void* const* addresses
|
||||
|
||||
[[unlikely]] if (setIndex > 15) {
|
||||
LOG_CRIT(L"buffersSetsCount > 15");
|
||||
return ::Err::VIDEO_OUT_ERROR_NO_EMPTY_SLOT;
|
||||
return Err::VideoOut::NO_EMPTY_SLOT;
|
||||
}
|
||||
|
||||
auto& bufferSet = config.bufferSets[setIndex];
|
||||
bufferSet.buffers.resize(numBuffer);
|
||||
|
||||
for (int i = startIndex; i < startIndex + numBuffer; ++i) {
|
||||
if (config.buffers[i] >= 0) return ::Err::VIDEO_OUT_ERROR_SLOT_OCCUPIED;
|
||||
if (config.buffers[i] >= 0) return Err::VideoOut::SLOT_OCCUPIED;
|
||||
config.buffers[i] = setIndex;
|
||||
}
|
||||
|
||||
|
@ -2,6 +2,7 @@
|
||||
#include <stdint.h>
|
||||
|
||||
namespace Err {
|
||||
namespace AudioOut {
|
||||
constexpr int32_t NOT_OPENED = -2144993279;
|
||||
constexpr int32_t BUSY = -2144993278;
|
||||
constexpr int32_t INVALID_PORT = -2144993277;
|
||||
@ -23,6 +24,7 @@ constexpr int32_t INVALID_FLAG = -2144993261;
|
||||
constexpr int32_t INVALID_MIXLEVEL = -2144993260;
|
||||
constexpr int32_t INVALID_ARG = -2144993259;
|
||||
constexpr int32_t INVALID_PARAM = -2144993258;
|
||||
} // namespace AudioOut
|
||||
} // namespace Err
|
||||
|
||||
constexpr int PORT_OUT_MAX = 6;
|
||||
|
@ -72,7 +72,7 @@ extern "C" {
|
||||
EXPORT const char* MODULE_NAME = "libSceAudioOut";
|
||||
|
||||
EXPORT SYSV_ABI int32_t sceAudioOutInit(void) {
|
||||
if (audioInited) return Err::ALREADY_INIT;
|
||||
if (audioInited) return Err::AudioOut::ALREADY_INIT;
|
||||
|
||||
if (SDL_InitSubSystem(SDL_INIT_AUDIO) == 0) {
|
||||
audioInited = true;
|
||||
@ -80,7 +80,7 @@ EXPORT SYSV_ABI int32_t sceAudioOutInit(void) {
|
||||
return Ok;
|
||||
}
|
||||
|
||||
return Err::OUT_OF_MEMORY;
|
||||
return Err::AudioOut::OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
EXPORT SYSV_ABI int32_t sceAudioOutOpen(int32_t userId, SceAudioOutPortType type, int32_t index, uint32_t len, uint32_t freq, SceAudioOutParamFormat format) {
|
||||
@ -189,7 +189,7 @@ EXPORT SYSV_ABI int32_t sceAudioOutOpen(int32_t userId, SceAudioOutPortType type
|
||||
return id + 1;
|
||||
}
|
||||
|
||||
return Err::PORT_FULL;
|
||||
return Err::AudioOut::PORT_FULL;
|
||||
}
|
||||
|
||||
EXPORT SYSV_ABI int32_t sceAudioOutClose(int32_t handle) {
|
||||
@ -226,7 +226,7 @@ EXPORT SYSV_ABI int32_t sceAudioOutSetVolume(int32_t handle, int32_t flag, int32
|
||||
boost::unique_lock const lock(pimpl->mutexInt);
|
||||
|
||||
auto& port = pimpl->portsOut[handle - 1];
|
||||
if (!port.open) return Err::INVALID_PORT;
|
||||
if (!port.open) return Err::AudioOut::INVALID_PORT;
|
||||
|
||||
for (int i = 0; i < port.channelsNum; i++, flag >>= 1u) {
|
||||
bool const bit = flag & 0x1u;
|
||||
@ -264,7 +264,7 @@ EXPORT SYSV_ABI int32_t sceAudioOutGetLastOutputTime(int32_t handle, uint64_t* o
|
||||
boost::unique_lock const lock(pimpl->mutexInt);
|
||||
|
||||
auto& port = pimpl->portsOut[handle - 1];
|
||||
if (!port.open) return Err::INVALID_PORT;
|
||||
if (!port.open) return Err::AudioOut::INVALID_PORT;
|
||||
*outputTime = port.lastOutputTime;
|
||||
return Ok;
|
||||
}
|
||||
|
@ -2,6 +2,7 @@
|
||||
#include <stdint.h>
|
||||
|
||||
namespace Err {
|
||||
namespace AvPlayer {
|
||||
constexpr int32_t INVALID_PARAMS = -2140536831; /* 0x806A0001 */
|
||||
constexpr int32_t OPERATION_FAILED = -2140536830; /* 0x806A0002 */
|
||||
constexpr int32_t NO_MEMORY = -2140536829; /* 0x806A0003 */
|
||||
@ -13,4 +14,5 @@ constexpr int32_t INFO_MARLIN_ENCRY = -2140536656; /* 0x806A00B0 */
|
||||
constexpr int32_t INFO_PLAYREADY_ENCRY = -2140536652; /* 0x806A00B4 */
|
||||
constexpr int32_t INFO_AES_ENCRY = -2140536651; /* 0x806A00B5 */
|
||||
constexpr int32_t INFO_OTHER_ENCRY = -2140536641; /* 0x806A00BF */
|
||||
} // namespace AvPlayer
|
||||
} // namespace Err
|
@ -26,7 +26,7 @@ EXPORT SYSV_ABI int32_t sceAvPlayerClose(IAvplayer* avPlayer) {
|
||||
|
||||
EXPORT SYSV_ABI int32_t sceAvPlayerAddSource(IAvplayer* avPlayer, const char* filename) {
|
||||
if (avPlayer->setFile(filename)) return Ok;
|
||||
return Err::INVALID_PARAMS;
|
||||
return Err::AvPlayer::INVALID_PARAMS;
|
||||
}
|
||||
|
||||
EXPORT SYSV_ABI int32_t sceAvPlayerStreamCount(IAvplayer* avPlayer) {
|
||||
|
@ -19,6 +19,6 @@ EXPORT SYSV_ABI bool sceAvPlayerGetVideoDataEx(IAvplayer* avPlayer, SceAvPlayerF
|
||||
|
||||
EXPORT SYSV_ABI int32_t sceAvPlayerAddSourceEx(IAvplayer* avPlayer, SceAvPlayerUriType uriType, SceAvPlayerSourceDetails* sourceDetails) {
|
||||
if (avPlayer->setFile(sourceDetails->uri.name)) return Ok;
|
||||
return Err::INVALID_PARAMS;
|
||||
return Err::AvPlayer::INVALID_PARAMS;
|
||||
}
|
||||
}
|
24
modules/libSceCommonDialog/codes.h
Normal file
24
modules/libSceCommonDialog/codes.h
Normal file
@ -0,0 +1,24 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
namespace Err {
|
||||
namespace CommonDialog {
|
||||
constexpr int32_t NOT_SYSTEM_INITIALIZED = -2135425023; /* 0x80B80001 */
|
||||
constexpr int32_t ALREADY_SYSTEM_INITIALIZED = -2135425022; /* 0x80B80002 */
|
||||
constexpr int32_t NOT_INITIALIZED = -2135425021; /* 0x80B80003 */
|
||||
constexpr int32_t ALREADY_INITIALIZED = -2135425020; /* 0x80B80004 */
|
||||
constexpr int32_t NOT_FINISHED = -2135425019; /* 0x80B80005 */
|
||||
constexpr int32_t INVALID_STATE = -2135425018; /* 0x80B80006 */
|
||||
constexpr int32_t RESULT_NONE = -2135425017; /* 0x80B80007 */
|
||||
constexpr int32_t BUSY = -2135425016; /* 0x80B80008 */
|
||||
constexpr int32_t OUT_OF_MEMORY = -2135425015; /* 0x80B80009 */
|
||||
constexpr int32_t PARAM_INVALID = -2135425014; /* 0x80B8000A */
|
||||
constexpr int32_t NOT_RUNNING = -2135425013; /* 0x80B8000B */
|
||||
constexpr int32_t ALREADY_CLOSE = -2135425012; /* 0x80B8000C */
|
||||
constexpr int32_t ARG_NULL = -2135425011; /* 0x80B8000D */
|
||||
constexpr int32_t UNEXPECTED_FATAL = -2135425010; /* 0x80B8000E */
|
||||
constexpr int32_t NOT_SUPPORTED = -2135425009; /* 0x80B8000F */
|
||||
constexpr int32_t INHIBIT_SHAREPLAY_CLIENT = -2135425008; /* 0x80B80010 */
|
||||
} // namespace CommonDialog
|
||||
} // namespace Err
|
@ -1,5 +1,5 @@
|
||||
#include "codes.h"
|
||||
#include "common.h"
|
||||
#include "errorcodes.h"
|
||||
#include "logging.h"
|
||||
|
||||
LOG_DEFINE_MODULE(libSceCommonDialog);
|
||||
|
@ -1,20 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
namespace Err {
|
||||
constexpr int32_t ERROR_NOT_SYSTEM_INITIALIZED = -2135425023; /* 0x80B80001 */
|
||||
constexpr int32_t ERROR_ALREADY_SYSTEM_INITIALIZED = -2135425022; /* 0x80B80002 */
|
||||
constexpr int32_t ERROR_NOT_INITIALIZED = -2135425021; /* 0x80B80003 */
|
||||
constexpr int32_t ERROR_ALREADY_INITIALIZED = -2135425020; /* 0x80B80004 */
|
||||
constexpr int32_t ERROR_NOT_FINISHED = -2135425019; /* 0x80B80005 */
|
||||
constexpr int32_t ERROR_INVALID_STATE = -2135425018; /* 0x80B80006 */
|
||||
constexpr int32_t ERROR_RESULT_NONE = -2135425017; /* 0x80B80007 */
|
||||
constexpr int32_t ERROR_BUSY = -2135425016; /* 0x80B80008 */
|
||||
constexpr int32_t ERROR_OUT_OF_MEMORY = -2135425015; /* 0x80B80009 */
|
||||
constexpr int32_t ERROR_PARAM_INVALID = -2135425014; /* 0x80B8000A */
|
||||
constexpr int32_t ERROR_NOT_RUNNING = -2135425013; /* 0x80B8000B */
|
||||
constexpr int32_t ERROR_ALREADY_CLOSE = -2135425012; /* 0x80B8000C */
|
||||
constexpr int32_t ERROR_ARG_NULL = -2135425011; /* 0x80B8000D */
|
||||
constexpr int32_t ERROR_UNEXPECTED_FATAL = -2135425010; /* 0x80B8000E */
|
||||
constexpr int32_t ERROR_NOT_SUPPORTED = -2135425009; /* 0x80B8000F */
|
||||
constexpr int32_t ERROR_INHIBIT_SHAREPLAY_CLIENT = -2135425008; /* 0x80B80010 */
|
||||
} // namespace Err
|
@ -2,11 +2,13 @@
|
||||
#include <stdint.h>
|
||||
|
||||
namespace Err {
|
||||
constexpr int32_t SCE_DISC_MAP_ERROR_INVALID_ARGUMENT = -2129657855; // 0x81100001
|
||||
constexpr int32_t SCE_DISC_MAP_ERROR_LOCATION_NOT_MAPPED = -2129657854; // 0x81100002
|
||||
constexpr int32_t SCE_DISC_MAP_ERROR_FILE_NOT_FOUND = -2129657853; // 0x81100003
|
||||
constexpr int32_t SCE_DISC_MAP_ERROR_NO_BITMAP_INFO = -2129657852; // 0x81100004
|
||||
constexpr int32_t SCE_DISC_MAP_ERROR_FATAL = -2129657601; // 0x811000FF
|
||||
namespace DiscMap {
|
||||
constexpr int32_t INVALID_ARGUMENT = -2129657855; // 0x81100001
|
||||
constexpr int32_t LOCATION_NOT_MAPPED = -2129657854; // 0x81100002
|
||||
constexpr int32_t FILE_NOT_FOUND = -2129657853; // 0x81100003
|
||||
constexpr int32_t NO_BITMAP_INFO = -2129657852; // 0x81100004
|
||||
constexpr int32_t FATAL = -2129657601; // 0x811000FF
|
||||
} // namespace DiscMap
|
||||
} // namespace Err
|
||||
|
||||
constexpr int32_t DM_PATCH_FLAG = 1;
|
||||
|
@ -8,7 +8,7 @@ extern "C" {
|
||||
EXPORT const char* MODULE_NAME = "libSceDiscMap";
|
||||
|
||||
EXPORT SYSV_ABI int sceDiscMapIsRequestOnHDD(const char* file, uint64_t a2, uint64_t a3, int* retVal) {
|
||||
return Err::SCE_DISC_MAP_ERROR_NO_BITMAP_INFO;
|
||||
return Err::DiscMap::NO_BITMAP_INFO;
|
||||
}
|
||||
|
||||
EXPORT SYSV_ABI int __NID_HEX(7C980FFB0AA27E7A)() {
|
||||
@ -16,11 +16,11 @@ EXPORT SYSV_ABI int __NID_HEX(7C980FFB0AA27E7A)() {
|
||||
}
|
||||
|
||||
EXPORT SYSV_ABI int sceDiscMapGetPackageSize(int64_t fflags, void* p1, void* p2) {
|
||||
return Err::SCE_DISC_MAP_ERROR_NO_BITMAP_INFO;
|
||||
return Err::DiscMap::NO_BITMAP_INFO;
|
||||
}
|
||||
|
||||
EXPORT SYSV_ABI int __NID_HEX(8A828CAEE7EDD5E9)(const char* file, void* p1, void* p2, int64_t* pFlags, int64_t* p3, int64_t* p4) {
|
||||
return Err::SCE_DISC_MAP_ERROR_NO_BITMAP_INFO;
|
||||
return Err::DiscMap::NO_BITMAP_INFO;
|
||||
}
|
||||
|
||||
EXPORT SYSV_ABI int __NID_HEX(E7EBCE96E92F91F8)() {
|
||||
|
@ -2,7 +2,9 @@
|
||||
#include <stdint.h>
|
||||
|
||||
namespace Err {
|
||||
constexpr int VALIDATION_NOT_ENABLED = 0x80D13FFF;
|
||||
constexpr int FAILURE = 0x800EEEFF;
|
||||
constexpr int RAZOR_NOT_LOADED = 0x80D15001;
|
||||
namespace Gnm {
|
||||
constexpr int VALIDATION_NOT_ENABLED = -2133770241;
|
||||
constexpr int FAILURE = -2146504961;
|
||||
constexpr int RAZOR_NOT_LOADED = -2133766143;
|
||||
} // namespace Gnm
|
||||
} // namespace Err
|
@ -212,7 +212,7 @@ int SYSV_ABI sceGnmDrawIndexAuto(uint32_t* cmdOut, uint64_t size, uint32_t index
|
||||
|
||||
int32_t SYSV_ABI sceGnmValidateDrawCommandBuffers(uint32_t count, void* dcbGpuAddrs[], uint32_t* dcbSizesInBytes, void* ccbGpuAddrs[],
|
||||
uint32_t* ccbSizesInBytes) {
|
||||
return Err::VALIDATION_NOT_ENABLED;
|
||||
return Err::Gnm::VALIDATION_NOT_ENABLED;
|
||||
}
|
||||
|
||||
int SYSV_ABI sceGnmSubmitCommandBuffers(uint32_t count, void** dcb_gpu_addrs, const uint32_t* dcb_sizes_in_bytes, void** ccb_gpu_addrs,
|
||||
@ -443,31 +443,31 @@ void* SYSV_ABI sceGnmGetTheTessellationFactorRingBufferBaseAddress() {
|
||||
}
|
||||
|
||||
int SYSV_ABI sceGnmValidateCommandBuffers() {
|
||||
return Err::VALIDATION_NOT_ENABLED;
|
||||
return Err::Gnm::VALIDATION_NOT_ENABLED;
|
||||
}
|
||||
|
||||
int32_t SYSV_ABI sceGnmValidateDispatchCommandBuffers(uint32_t count, void* dcbGpuAddrs, uint32_t* dcbSizesInBytes) {
|
||||
return Err::VALIDATION_NOT_ENABLED;
|
||||
return Err::Gnm::VALIDATION_NOT_ENABLED;
|
||||
}
|
||||
|
||||
int32_t SYSV_ABI sceGnmValidateDisableDiagnostics(uint32_t count, void* data) {
|
||||
return Err::VALIDATION_NOT_ENABLED;
|
||||
return Err::Gnm::VALIDATION_NOT_ENABLED;
|
||||
}
|
||||
|
||||
int32_t SYSV_ABI sceGnmValidateDisableDiagnostics2(uint32_t count, uint32_t* diagList) {
|
||||
return Err::VALIDATION_NOT_ENABLED;
|
||||
return Err::Gnm::VALIDATION_NOT_ENABLED;
|
||||
}
|
||||
|
||||
int32_t SYSV_ABI sceGnmValidateGetDiagnosticInfo(int32_t query, void* diagnosticOutputs) {
|
||||
return Err::VALIDATION_NOT_ENABLED;
|
||||
return Err::Gnm::VALIDATION_NOT_ENABLED;
|
||||
}
|
||||
|
||||
int32_t SYSV_ABI sceGnmValidateGetDiagnostics(int32_t query, void* diagnosticOutputs) {
|
||||
return Err::VALIDATION_NOT_ENABLED;
|
||||
return Err::Gnm::VALIDATION_NOT_ENABLED;
|
||||
}
|
||||
|
||||
int32_t SYSV_ABI sceGnmValidateResetState() {
|
||||
return Err::VALIDATION_NOT_ENABLED;
|
||||
return Err::Gnm::VALIDATION_NOT_ENABLED;
|
||||
}
|
||||
|
||||
int32_t SYSV_ABI sceGnmValidateGetVersion() {
|
||||
@ -499,7 +499,7 @@ int SYSV_ABI sceGnmRegisterResource(uint32_t* resource_handle, uint32_t owner_ha
|
||||
*resource_handle = rhandle;
|
||||
}
|
||||
|
||||
return Err::FAILURE;
|
||||
return Err::Gnm::FAILURE;
|
||||
}
|
||||
|
||||
int SYSV_ABI sceGnmUnregisterAllResourcesForOwner(uint32_t owner_handle) {
|
||||
@ -525,7 +525,7 @@ int SYSV_ABI sceGnmDriverTraceInProgress() {
|
||||
int SYSV_ABI sceGnmDriverTriggerCapture(const char* filename) {
|
||||
LOG_USE_MODULE(libSceGraphicsDriver);
|
||||
LOG_ERR(L"CaptureStatus: Something went wrong");
|
||||
return Err::RAZOR_NOT_LOADED;
|
||||
return Err::Gnm::RAZOR_NOT_LOADED;
|
||||
}
|
||||
|
||||
void SYSV_ABI sceGnmDebugHardwareStatus(int flag) {
|
||||
|
@ -2,6 +2,7 @@
|
||||
#include <stdint.h>
|
||||
|
||||
namespace Err {
|
||||
namespace Json {
|
||||
constexpr int32_t PARSE_INVALID_CHAR = -2138799871;
|
||||
constexpr int32_t NOMEM = -2138799870;
|
||||
constexpr int32_t NOFILE = -2138799869;
|
||||
@ -9,6 +10,9 @@ constexpr int32_t NOROOT = -2138799868;
|
||||
constexpr int32_t NOBUF = -2138799867;
|
||||
constexpr int32_t NOINIT = -2138799856;
|
||||
constexpr int32_t MULTIPLEINIT = -2138799855;
|
||||
} // namespace Json
|
||||
|
||||
namespace Json2 {
|
||||
constexpr int32_t ALREADY_SET = -2138799854;
|
||||
constexpr int32_t NOT_SUPPORTED = -2138799853;
|
||||
constexpr int32_t SPECIAL_FLOAT = -2138799852;
|
||||
@ -17,4 +21,5 @@ constexpr int32_t NOT_EXIST_INDEX = -2138799850;
|
||||
constexpr int32_t NOT_A_OBJECT = -2138799849;
|
||||
constexpr int32_t NOT_A_CONTAINER = -2138799848;
|
||||
constexpr int32_t INVALID_ARGUMENT = -2138799840;
|
||||
} // namespace Json2
|
||||
} // namespace Err
|
||||
|
@ -2,6 +2,7 @@
|
||||
#include <stdint.h>
|
||||
|
||||
namespace Err {
|
||||
namespace Ngs2 {
|
||||
constexpr int32_t INVALID_WAVEFORM_DATA = -2142632952;
|
||||
constexpr int32_t INVALID_BUFFER_ADDRESS = -2142633465;
|
||||
constexpr int32_t INVALID_BUFFER_SIZE = -2142633466;
|
||||
@ -16,6 +17,7 @@ constexpr int32_t INVALID_OUT_ADDRESS = -2142633901;
|
||||
constexpr int32_t INVALID_NUM_CHANNELS = -2142633902;
|
||||
constexpr int32_t INVALID_MAX_GRAIN_SAMPLES = -2142633904;
|
||||
constexpr int32_t FAIL = -2142633983;
|
||||
} // namespace Ngs2
|
||||
} // namespace Err
|
||||
|
||||
constexpr int32_t SCE_NGS2_MAX_VOICE_CHANNELS = 8;
|
||||
|
@ -109,7 +109,7 @@ static int32_t ParseData(const uint8_t* data, size_t size, SceNgs2WaveformFormat
|
||||
int ret = avformat_open_input(&fmtctx, "nullptr", nullptr, nullptr);
|
||||
if (ret != 0) {
|
||||
LOG_ERR(L"ParseRIFF: ffmpeg failed to read passed data: %d", ret);
|
||||
return Err::FAIL;
|
||||
return Err::Ngs2::FAIL;
|
||||
}
|
||||
|
||||
AVStream* astream = nullptr;
|
||||
@ -122,7 +122,7 @@ static int32_t ParseData(const uint8_t* data, size_t size, SceNgs2WaveformFormat
|
||||
|
||||
if (astream == nullptr) {
|
||||
LOG_ERR(L"ParseRIFF: no audio stream detected!");
|
||||
return Err::FAIL;
|
||||
return Err::Ngs2::FAIL;
|
||||
}
|
||||
|
||||
wf->info.type = ParseWaveType(astream->codecpar->codec_id);
|
||||
@ -165,7 +165,7 @@ static int32_t ProcessWaveData(WaveformInfo* wi, SceNgs2WaveformFormat* wf) {
|
||||
}
|
||||
|
||||
/* todo: Deal with WAV/VAG files */
|
||||
return Err::INVALID_WAVEFORM_DATA;
|
||||
return Err::Ngs2::INVALID_WAVEFORM_DATA;
|
||||
}
|
||||
} // namespace
|
||||
|
||||
@ -202,7 +202,7 @@ EXPORT SYSV_ABI int32_t sceNgs2ParseWaveformData(const void* ptr, size_t size, S
|
||||
LOG_TRACE(L"todo %S", __FUNCTION__);
|
||||
|
||||
if (ptr == nullptr) {
|
||||
return Err::INVALID_BUFFER_ADDRESS;
|
||||
return Err::Ngs2::INVALID_BUFFER_ADDRESS;
|
||||
}
|
||||
|
||||
WaveformInfo wi {
|
||||
@ -253,7 +253,7 @@ EXPORT SYSV_ABI int32_t sceNgs2ParseWaveformFile(const char* path, long offset,
|
||||
};
|
||||
|
||||
if (wi.ud.fileHandle == 0) {
|
||||
return Err::INVALID_WAVEFORM_DATA;
|
||||
return Err::Ngs2::INVALID_WAVEFORM_DATA;
|
||||
}
|
||||
|
||||
return ProcessWaveData(&wi, wf);
|
||||
@ -264,7 +264,7 @@ EXPORT SYSV_ABI int32_t sceNgs2ParseWaveformUser(SceWaveformUserFunc* user, size
|
||||
LOG_ERR(L"todo %S", __FUNCTION__);
|
||||
|
||||
if (user == nullptr) {
|
||||
return Err::INVALID_BUFFER_ADDRESS;
|
||||
return Err::Ngs2::INVALID_BUFFER_ADDRESS;
|
||||
}
|
||||
|
||||
WaveformInfo wi {
|
||||
@ -296,8 +296,8 @@ EXPORT SYSV_ABI int32_t sceNgs2RackGetUserData(SceNgs2Handle* rh, uintptr_t* use
|
||||
}
|
||||
|
||||
EXPORT SYSV_ABI int32_t sceNgs2RackGetVoiceHandle(SceNgs2Handle* rh, uint32_t voiceId, SceNgs2Handle** outh) {
|
||||
if (rh == nullptr) return Err::INVALID_RACK_HANDLE;
|
||||
if (voiceId > 0) return Err::INVALID_VOICE_INDEX; // todo: how much indexes??
|
||||
if (rh == nullptr) return Err::Ngs2::INVALID_RACK_HANDLE;
|
||||
if (voiceId > 0) return Err::Ngs2::INVALID_VOICE_INDEX; // todo: how much indexes??
|
||||
LOG_USE_MODULE(libSceNgs2);
|
||||
LOG_TRACE(L"todo %S", __FUNCTION__);
|
||||
// todo: write to outh voice handle from rack
|
||||
@ -361,11 +361,11 @@ EXPORT SYSV_ABI int32_t sceNgs2SystemUnlock(SceNgs2Handle* sysh) {
|
||||
EXPORT SYSV_ABI int32_t sceNgs2SystemRender(SceNgs2Handle* sysh, SceNgs2RenderBufferInfo* rbi, int32_t count) {
|
||||
LOG_USE_MODULE(libSceNgs2);
|
||||
LOG_TRACE(L"todo %S", __FUNCTION__);
|
||||
if (sysh == nullptr) return Err::INVALID_SYSTEM_HANDLE;
|
||||
if (rbi->bufferPtr == nullptr) return Err::INVALID_BUFFER_ADDRESS;
|
||||
if (rbi->bufferSize == 0) return Err::INVALID_BUFFER_SIZE;
|
||||
if (rbi->waveType >= SceNgs2WaveFormType::MAX_TYPES) return Err::INVALID_WAVEFORM_TYPE;
|
||||
if (rbi->channelsCount > SceNgs2ChannelsCount::CH_7_1) return Err::INVALID_NUM_CHANNELS;
|
||||
if (sysh == nullptr) return Err::Ngs2::INVALID_SYSTEM_HANDLE;
|
||||
if (rbi->bufferPtr == nullptr) return Err::Ngs2::INVALID_BUFFER_ADDRESS;
|
||||
if (rbi->bufferSize == 0) return Err::Ngs2::INVALID_BUFFER_SIZE;
|
||||
if (rbi->waveType >= SceNgs2WaveFormType::MAX_TYPES) return Err::Ngs2::INVALID_WAVEFORM_TYPE;
|
||||
if (rbi->channelsCount > SceNgs2ChannelsCount::CH_7_1) return Err::Ngs2::INVALID_NUM_CHANNELS;
|
||||
|
||||
for (int32_t i = 0; i < count; i++) {
|
||||
if (rbi[i].bufferPtr != nullptr) {
|
||||
@ -474,7 +474,7 @@ EXPORT SYSV_ABI int32_t sceNgs2RackCreate(SceNgs2Handle* sysh, uint32_t rackId,
|
||||
|
||||
EXPORT SYSV_ABI int32_t sceNgs2RackCreateWithAllocator(SceNgs2Handle* sysh, uint32_t rackId, const SceNgs2RackOption* ro, const SceNgs2BufferAllocator* alloc,
|
||||
SceNgs2Handle** outh) {
|
||||
if (sysh == nullptr) return Err::INVALID_SYSTEM_HANDLE;
|
||||
if (sysh == nullptr) return Err::Ngs2::INVALID_SYSTEM_HANDLE;
|
||||
LOG_USE_MODULE(libSceNgs2);
|
||||
LOG_TRACE(L"todo %S", __FUNCTION__);
|
||||
|
||||
@ -510,7 +510,7 @@ EXPORT SYSV_ABI int32_t sceNgs2RackCreateWithAllocator(SceNgs2Handle* sysh, uint
|
||||
}
|
||||
|
||||
EXPORT SYSV_ABI int32_t sceNgs2RackDestroy(SceNgs2Handle* rh, SceNgs2ContextBufferInfo* cbi) {
|
||||
if (rh == nullptr) return Err::INVALID_SYSTEM_HANDLE;
|
||||
if (rh == nullptr) return Err::Ngs2::INVALID_SYSTEM_HANDLE;
|
||||
if (rh->allocSet) {
|
||||
cbi->hostBuffer = rh;
|
||||
cbi->hostBufferSize = sizeof(SceNgs2Handle);
|
||||
@ -527,9 +527,9 @@ EXPORT SYSV_ABI int32_t sceNgs2RackQueryBufferSize(uint32_t rackId, const SceNgs
|
||||
EXPORT SYSV_ABI int32_t sceNgs2SystemCreateWithAllocator(const SceNgs2SystemOption* sysopt, SceNgs2BufferAllocator* alloc, SceNgs2Handle** outh) {
|
||||
LOG_USE_MODULE(libSceNgs2);
|
||||
LOG_ERR(L"todo %S(%p, %p, %p)", __FUNCTION__, sysopt, alloc, outh);
|
||||
if (alloc == nullptr || alloc->allocHandler == nullptr) return Err::INVALID_BUFFER_ALLOCATOR;
|
||||
if (outh == nullptr) return Err::INVALID_OUT_ADDRESS;
|
||||
if (sysopt != nullptr || sysopt->size < sizeof(SceNgs2SystemOption)) return Err::INVALID_OPTION_SIZE;
|
||||
if (alloc == nullptr || alloc->allocHandler == nullptr) return Err::Ngs2::INVALID_BUFFER_ALLOCATOR;
|
||||
if (outh == nullptr) return Err::Ngs2::INVALID_OUT_ADDRESS;
|
||||
if (sysopt != nullptr || sysopt->size < sizeof(SceNgs2SystemOption)) return Err::Ngs2::INVALID_OPTION_SIZE;
|
||||
|
||||
SceNgs2ContextBufferInfo cbi = {
|
||||
.hostBuffer = nullptr,
|
||||
@ -554,19 +554,19 @@ EXPORT SYSV_ABI int32_t sceNgs2SystemCreateWithAllocator(const SceNgs2SystemOpti
|
||||
EXPORT SYSV_ABI int32_t sceNgs2SystemCreate(const SceNgs2SystemOption* sysopt, const SceNgs2ContextBufferInfo* cbi, SceNgs2Handle** outh) {
|
||||
LOG_USE_MODULE(libSceNgs2);
|
||||
LOG_ERR(L"todo %S(%p, %p, %p)", __FUNCTION__, sysopt, cbi, outh);
|
||||
if (outh == nullptr) return Err::INVALID_OUT_ADDRESS;
|
||||
if (sysopt != nullptr && sysopt->size != sizeof(SceNgs2SystemOption)) return Err::INVALID_OPTION_SIZE;
|
||||
if (cbi == nullptr || cbi->hostBuffer == nullptr || cbi->hostBufferSize < sizeof(SceNgs2Handle)) return Err::INVALID_BUFFER_ADDRESS;
|
||||
if (outh == nullptr) return Err::Ngs2::INVALID_OUT_ADDRESS;
|
||||
if (sysopt != nullptr && sysopt->size != sizeof(SceNgs2SystemOption)) return Err::Ngs2::INVALID_OPTION_SIZE;
|
||||
if (cbi == nullptr || cbi->hostBuffer == nullptr || cbi->hostBufferSize < sizeof(SceNgs2Handle)) return Err::Ngs2::INVALID_BUFFER_ADDRESS;
|
||||
|
||||
*outh = (SceNgs2Handle*)cbi->hostBuffer;
|
||||
(*outh)->allocSet = false;
|
||||
(*outh)->owner = nullptr;
|
||||
|
||||
return (*outh) != nullptr ? Ok : Err::FAIL;
|
||||
return (*outh) != nullptr ? Ok : Err::Ngs2::FAIL;
|
||||
}
|
||||
|
||||
EXPORT SYSV_ABI int32_t sceNgs2SystemDestroy(SceNgs2Handle* sysh, SceNgs2ContextBufferInfo* cbi) {
|
||||
if (sysh == nullptr) return Err::INVALID_SYSTEM_HANDLE;
|
||||
if (sysh == nullptr) return Err::Ngs2::INVALID_SYSTEM_HANDLE;
|
||||
if (sysh->allocSet) {
|
||||
cbi->hostBuffer = sysh;
|
||||
cbi->hostBufferSize = sizeof(SceNgs2Handle);
|
||||
@ -576,7 +576,7 @@ EXPORT SYSV_ABI int32_t sceNgs2SystemDestroy(SceNgs2Handle* sysh, SceNgs2Context
|
||||
}
|
||||
|
||||
EXPORT SYSV_ABI int32_t sceNgs2SystemQueryBufferSize(const SceNgs2SystemOption* sysopt, SceNgs2ContextBufferInfo* cbi) {
|
||||
if (cbi == nullptr) return Err::INVALID_BUFFER_ADDRESS;
|
||||
if (cbi == nullptr) return Err::Ngs2::INVALID_BUFFER_ADDRESS;
|
||||
cbi->hostBufferSize = sizeof(SceNgs2Handle);
|
||||
return Ok;
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
#include "codes.h"
|
||||
#include "common.h"
|
||||
#include "errorcodes.h"
|
||||
#include "logging.h"
|
||||
|
||||
LOG_DEFINE_MODULE(libSceNpGameIntent);
|
||||
|
@ -1,5 +1,5 @@
|
||||
#include "codes.h"
|
||||
#include "common.h"
|
||||
#include "errorcodes.h"
|
||||
#include "logging.h"
|
||||
|
||||
LOG_DEFINE_MODULE(libSceNpToolkit2);
|
||||
|
@ -2,6 +2,7 @@
|
||||
#include <stdint.h>
|
||||
|
||||
namespace Err {
|
||||
namespace Pad {
|
||||
constexpr int32_t INVALID_ARG = -2137915391; /* 0x80920001 */
|
||||
constexpr int32_t INVALID_PORT = -2137915390; /* 0x80920002 */
|
||||
constexpr int32_t INVALID_HANDLE = -2137915389; /* 0x80920003 */
|
||||
@ -11,7 +12,7 @@ constexpr int32_t INVALID_LIGHTBAR_SETTING = -2137915386; /* 0x80920006 */
|
||||
constexpr int32_t DEVICE_NOT_CONNECTED = -2137915385; /* 0x80920007 */
|
||||
constexpr int32_t NO_HANDLE = -2137915384; /* 0x80920008 */
|
||||
constexpr int32_t FATAL = -2137915137; /* 0x809200FF */
|
||||
|
||||
} // namespace Pad
|
||||
} // namespace Err
|
||||
|
||||
constexpr uint32_t SCE_PAD_MAX_TOUCH_NUM = 2;
|
||||
|
@ -1,16 +1,12 @@
|
||||
#include "cconfig.h"
|
||||
#include "common.h"
|
||||
#include "core/timer/timer.h"
|
||||
#include "core/videoout/videoout.h"
|
||||
#include "interfaces/ikbd.h"
|
||||
#include "interfaces/isdl.h"
|
||||
#include "interfaces/ixip.h"
|
||||
#include "logging.h"
|
||||
#include "types.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <chrono>
|
||||
|
||||
LOG_DEFINE_MODULE(libScePad);
|
||||
|
||||
namespace {
|
||||
@ -29,27 +25,18 @@ struct Pimpl {
|
||||
std::mutex m_mutexInt;
|
||||
|
||||
ControllerConfig cfg;
|
||||
std::array<Controller, MAX_CONTROLLERS_COUNT /* Define? */> controller;
|
||||
std::array<Controller, MAX_CONTROLLERS_COUNT> controller;
|
||||
};
|
||||
|
||||
static auto* getData() {
|
||||
static Pimpl obj;
|
||||
return &obj;
|
||||
}
|
||||
} // namespace
|
||||
|
||||
extern "C" {
|
||||
|
||||
EXPORT const char* MODULE_NAME = "libScePad";
|
||||
|
||||
EXPORT SYSV_ABI int scePadInit(void) {
|
||||
LOG_USE_MODULE(libScePad);
|
||||
(void)getData();
|
||||
return Ok;
|
||||
}
|
||||
|
||||
EXPORT SYSV_ABI int scePadOpen(int32_t userId, PadPortType type, int32_t index, const void* pParam) {
|
||||
if (userId < 1 || userId > 4) return Err::INVALID_ARG;
|
||||
static int _padOpen(int32_t userId, PadPortType type, int32_t index, const void* pParam) {
|
||||
if (userId < 1 || userId > 4) return Err::Pad::INVALID_ARG;
|
||||
if (type == PadPortType::REMOTE_CONTROL && userId != 0xFF) return Err::Pad::INVALID_ARG;
|
||||
if (type != PadPortType::STANDARD && type != PadPortType::SPECIAL) return Err::Pad::INVALID_ARG;
|
||||
LOG_USE_MODULE(libScePad);
|
||||
|
||||
auto pData = getData();
|
||||
@ -58,7 +45,7 @@ EXPORT SYSV_ABI int scePadOpen(int32_t userId, PadPortType type, int32_t index,
|
||||
|
||||
// Check already opened
|
||||
for (uint32_t n = 0; n < MAX_CONTROLLERS_COUNT; ++n) {
|
||||
if (pData->controller[n].userId == userId) return Err::ALREADY_OPENED;
|
||||
if (pData->controller[n].userId == userId) return Err::Pad::ALREADY_OPENED;
|
||||
}
|
||||
// - already open
|
||||
|
||||
@ -76,25 +63,37 @@ EXPORT SYSV_ABI int scePadOpen(int32_t userId, PadPortType type, int32_t index,
|
||||
|
||||
case ControllerType::Keyboard: pController = createController_keyboard(&pData->cfg, userId); break;
|
||||
|
||||
default: LOG_CRIT(L"Unimplemented controller type!"); return Err::FATAL;
|
||||
default: LOG_CRIT(L"Unimplemented controller type!"); return Err::Pad::FATAL;
|
||||
}
|
||||
|
||||
LOG_INFO(L"-> Pad[%d]: userId:%d name:%S guid:%S", n, userId, pController->getName(), pController->getGUID());
|
||||
return n;
|
||||
}
|
||||
|
||||
return Err::NO_HANDLE;
|
||||
return Err::Pad::NO_HANDLE;
|
||||
}
|
||||
} // namespace
|
||||
|
||||
EXPORT SYSV_ABI int scePadOpenExt(int userId, int type, int index, int param) {
|
||||
if (userId < 1 || userId > 4) return Err::INVALID_ARG;
|
||||
extern "C" {
|
||||
|
||||
EXPORT const char* MODULE_NAME = "libScePad";
|
||||
|
||||
EXPORT SYSV_ABI int scePadInit(void) {
|
||||
LOG_USE_MODULE(libScePad);
|
||||
LOG_DEBUG(L"todo %S", __FUNCTION__);
|
||||
(void)getData();
|
||||
return Ok;
|
||||
}
|
||||
|
||||
EXPORT SYSV_ABI int scePadOpen(int32_t userId, PadPortType type, int32_t index, const void* param) {
|
||||
return _padOpen(userId, type, index, param);
|
||||
}
|
||||
|
||||
EXPORT SYSV_ABI int scePadOpenExt(int userId, PadPortType type, int index, const void* param) {
|
||||
return _padOpen(userId, type, index, param);
|
||||
}
|
||||
|
||||
EXPORT SYSV_ABI int scePadClose(int32_t handle) {
|
||||
if (handle < 0) return Ok;
|
||||
if (handle < 0 || handle >= MAX_CONTROLLERS_COUNT) return Ok;
|
||||
|
||||
LOG_USE_MODULE(libScePad);
|
||||
|
||||
@ -111,7 +110,7 @@ EXPORT SYSV_ABI int scePadClose(int32_t handle) {
|
||||
}
|
||||
|
||||
EXPORT SYSV_ABI int scePadGetHandle(int32_t userId, PadPortType type, int32_t index) {
|
||||
if (userId < 1 || userId > 4) return Err::INVALID_ARG;
|
||||
if (userId < 1 || userId > 4) return Err::Pad::INVALID_ARG;
|
||||
auto pData = getData();
|
||||
LOG_USE_MODULE(libScePad);
|
||||
LOG_DEBUG(L"");
|
||||
@ -123,16 +122,16 @@ EXPORT SYSV_ABI int scePadGetHandle(int32_t userId, PadPortType type, int32_t in
|
||||
}
|
||||
}
|
||||
|
||||
return Err::NO_HANDLE;
|
||||
return Err::Pad::NO_HANDLE;
|
||||
}
|
||||
|
||||
EXPORT SYSV_ABI int scePadRead(int32_t handle, ScePadData* pPadData, int32_t num) {
|
||||
LOG_USE_MODULE(libScePad);
|
||||
if (handle < 0) return Err::INVALID_HANDLE;
|
||||
if (handle < 0 || handle >= MAX_CONTROLLERS_COUNT) return Err::Pad::INVALID_HANDLE;
|
||||
|
||||
auto pData = getData();
|
||||
auto& pController = pData->controller[handle].padPtr;
|
||||
if (!pController) return Err::INVALID_HANDLE;
|
||||
if (!pController) return Err::Pad::INVALID_HANDLE;
|
||||
|
||||
std::unique_lock const lock(pData->m_mutexInt);
|
||||
|
||||
@ -153,70 +152,70 @@ EXPORT SYSV_ABI int scePadReadState(int32_t handle, ScePadData* pData) {
|
||||
|
||||
EXPORT SYSV_ABI int scePadSetMotionSensorState(int32_t handle, bool bEnable) {
|
||||
LOG_USE_MODULE(libScePad);
|
||||
if (handle < 0) return Err::INVALID_HANDLE;
|
||||
if (handle < 0 || handle >= MAX_CONTROLLERS_COUNT) return Err::Pad::INVALID_HANDLE;
|
||||
|
||||
auto pData = getData();
|
||||
auto& pController = pData->controller[handle].padPtr;
|
||||
if (!pController) return Err::INVALID_HANDLE;
|
||||
if (!pController) return Err::Pad::INVALID_HANDLE;
|
||||
|
||||
pController->setMotion(bEnable);
|
||||
return Ok;
|
||||
}
|
||||
|
||||
EXPORT SYSV_ABI int scePadSetTiltCorrectionState(int32_t handle, bool bEnable) {
|
||||
if (handle < 0) return Err::INVALID_HANDLE;
|
||||
if (handle < 0 || handle >= MAX_CONTROLLERS_COUNT) return Err::Pad::INVALID_HANDLE;
|
||||
return Ok;
|
||||
}
|
||||
|
||||
EXPORT SYSV_ABI int scePadSetAngularVelocityDeadbandState(int32_t handle, bool bEnable) {
|
||||
if (handle < 0) return Err::INVALID_HANDLE;
|
||||
if (handle < 0 || handle >= MAX_CONTROLLERS_COUNT) return Err::Pad::INVALID_HANDLE;
|
||||
return Ok;
|
||||
}
|
||||
|
||||
EXPORT SYSV_ABI int scePadResetOrientation(int32_t handle) {
|
||||
if (handle < 0) return Err::INVALID_HANDLE;
|
||||
if (handle < 0 || handle >= MAX_CONTROLLERS_COUNT) return Err::Pad::INVALID_HANDLE;
|
||||
auto pData = getData();
|
||||
auto& pController = pData->controller[handle].padPtr;
|
||||
if (!pController) return Err::INVALID_HANDLE;
|
||||
if (!pController) return Err::Pad::INVALID_HANDLE;
|
||||
|
||||
return pController->resetOrientation() ? Ok : Err::FATAL;
|
||||
return pController->resetOrientation() ? Ok : Err::Pad::FATAL;
|
||||
}
|
||||
|
||||
EXPORT SYSV_ABI int scePadSetVibration(int32_t handle, const ScePadVibrationParam* pParam) {
|
||||
if (handle < 0) return Err::INVALID_HANDLE;
|
||||
if (pParam == nullptr) return Err::INVALID_ARG;
|
||||
if (handle < 0) return Err::Pad::INVALID_HANDLE;
|
||||
if (pParam == nullptr) return Err::Pad::INVALID_ARG;
|
||||
|
||||
auto pData = getData();
|
||||
auto& pController = pData->controller[handle].padPtr;
|
||||
if (!pController) return Err::INVALID_HANDLE;
|
||||
if (!pController) return Err::Pad::INVALID_HANDLE;
|
||||
|
||||
return pController->setRumble(pParam) ? Ok : Err::INVALID_ARG;
|
||||
return pController->setRumble(pParam) ? Ok : Err::Pad::INVALID_ARG;
|
||||
}
|
||||
|
||||
EXPORT SYSV_ABI int scePadSetLightBar(int32_t handle, const ScePadColor* pParam) {
|
||||
if (handle < 0) return Err::INVALID_HANDLE;
|
||||
if (pParam == nullptr) return Err::INVALID_ARG;
|
||||
if (handle < 0 || handle >= MAX_CONTROLLERS_COUNT) return Err::Pad::INVALID_HANDLE;
|
||||
if (pParam == nullptr) return Err::Pad::INVALID_ARG;
|
||||
|
||||
auto pData = getData();
|
||||
auto& pController = pData->controller[handle].padPtr;
|
||||
if (!pController) return Err::INVALID_HANDLE;
|
||||
if (!pController) return Err::Pad::INVALID_HANDLE;
|
||||
|
||||
return pController->setLED(pParam) ? Ok : Err::INVALID_LIGHTBAR_SETTING;
|
||||
return pController->setLED(pParam) ? Ok : Err::Pad::INVALID_LIGHTBAR_SETTING;
|
||||
}
|
||||
|
||||
EXPORT SYSV_ABI int scePadResetLightBar(int32_t handle) {
|
||||
if (handle < 0) return Err::INVALID_HANDLE;
|
||||
if (handle < 0 || handle >= MAX_CONTROLLERS_COUNT) return Err::Pad::INVALID_HANDLE;
|
||||
|
||||
auto pData = getData();
|
||||
auto& pController = pData->controller[handle].padPtr;
|
||||
if (!pController) return Err::INVALID_HANDLE;
|
||||
if (!pController) return Err::Pad::INVALID_HANDLE;
|
||||
|
||||
return pController->resetLED() ? Ok : Err::INVALID_LIGHTBAR_SETTING;
|
||||
return pController->resetLED() ? Ok : Err::Pad::INVALID_LIGHTBAR_SETTING;
|
||||
}
|
||||
|
||||
EXPORT SYSV_ABI int scePadGetControllerInformation(int32_t handle, ScePadControllerInformation* pInfo) {
|
||||
LOG_USE_MODULE(libScePad);
|
||||
if (handle < 0) return Err::INVALID_HANDLE;
|
||||
if (handle < 0 || handle >= MAX_CONTROLLERS_COUNT) return Err::Pad::INVALID_HANDLE;
|
||||
auto pData = getData();
|
||||
|
||||
std::unique_lock const lock(pData->m_mutexInt);
|
||||
@ -258,21 +257,21 @@ EXPORT SYSV_ABI int scePadGetControllerInformation(int32_t handle, ScePadControl
|
||||
EXPORT SYSV_ABI int scePadGetExtControllerInformation(int32_t handle, ScePadExtControllerInformation* pInfo) {
|
||||
LOG_USE_MODULE(libScePad);
|
||||
LOG_DEBUG(L"todo %S", __FUNCTION__);
|
||||
if (handle < 0) return Err::INVALID_HANDLE;
|
||||
if (handle < 0 || handle >= MAX_CONTROLLERS_COUNT) return Err::Pad::INVALID_HANDLE;
|
||||
return Ok;
|
||||
}
|
||||
|
||||
EXPORT SYSV_ABI int scePadDeviceClassParseData(int32_t handle, const ScePadData* pData, ScePadDeviceClassData* pDeviceClassData) {
|
||||
LOG_USE_MODULE(libScePad);
|
||||
LOG_DEBUG(L"todo %S", __FUNCTION__);
|
||||
if (handle < 0) return Err::INVALID_HANDLE;
|
||||
if (handle < 0 || handle >= MAX_CONTROLLERS_COUNT) return Err::Pad::INVALID_HANDLE;
|
||||
return Ok;
|
||||
}
|
||||
|
||||
EXPORT SYSV_ABI int scePadDeviceClassGetExtendedInformation(int32_t handle, ScePadDeviceClassExtendedInformation* pExtInfo) {
|
||||
LOG_USE_MODULE(libScePad);
|
||||
LOG_DEBUG(L"todo %S", __FUNCTION__);
|
||||
if (handle < 0) return Err::INVALID_HANDLE;
|
||||
if (handle < 0 || handle >= MAX_CONTROLLERS_COUNT) return Err::Pad::INVALID_HANDLE;
|
||||
return Ok;
|
||||
}
|
||||
|
||||
|
@ -79,7 +79,6 @@ uint32_t KBDController::getButtons(const uint8_t* keys) {
|
||||
#define MAP_TRIGGER(_keys, _down) (uint8_t)(resolveBindFor(_keys, _down) ? 0xFF : 0x00)
|
||||
|
||||
bool KBDController::readPadData(ScePadData& data) {
|
||||
|
||||
if (m_state == ControllerState::Closed) return false;
|
||||
|
||||
const uint8_t* keys = SDL_GetKeyboardState(nullptr);
|
||||
|
@ -16,6 +16,7 @@ class SDLPadManager {
|
||||
public:
|
||||
SDL_GameController* openNew() {
|
||||
for (int n = 0; n < SDL_NumJoysticks(); n++) {
|
||||
if (!SDL_IsGameController(n)) continue;
|
||||
auto pad = SDL_GameControllerOpen(n);
|
||||
if (std::find(m_openedPads.begin(), m_openedPads.end(), pad) != m_openedPads.end()) continue;
|
||||
m_openedPads.push_back(pad);
|
||||
@ -191,7 +192,9 @@ bool SDLController::readPadData(ScePadData& data) {
|
||||
.touchData =
|
||||
{
|
||||
.touchNum = 0,
|
||||
.touch = {{
|
||||
.touch =
|
||||
{
|
||||
{
|
||||
.x = 0,
|
||||
.y = 0,
|
||||
.id = 1,
|
||||
@ -200,11 +203,12 @@ bool SDLController::readPadData(ScePadData& data) {
|
||||
.x = 0,
|
||||
.y = 0,
|
||||
.id = 2,
|
||||
}},
|
||||
},
|
||||
},
|
||||
|
||||
},
|
||||
|
||||
.connected = m_state == ControllerState::Connected,
|
||||
.connected = IController::isConnected(),
|
||||
.timestamp = accessTimer().getTicks(),
|
||||
.connectedCount = m_connectCount,
|
||||
.deviceUniqueDataLen = 0,
|
||||
|
@ -182,7 +182,9 @@ bool XIPController::readPadData(ScePadData& data) {
|
||||
.touchData =
|
||||
{
|
||||
.touchNum = 0,
|
||||
.touch = {{
|
||||
.touch =
|
||||
{
|
||||
{
|
||||
.x = 0,
|
||||
.y = 0,
|
||||
.id = 1,
|
||||
@ -191,11 +193,12 @@ bool XIPController::readPadData(ScePadData& data) {
|
||||
.x = 0,
|
||||
.y = 0,
|
||||
.id = 2,
|
||||
}},
|
||||
},
|
||||
},
|
||||
|
||||
},
|
||||
|
||||
.connected = m_state == ControllerState::Connected,
|
||||
.connected = IController::isConnected(),
|
||||
.timestamp = accessTimer().getTicks(),
|
||||
.connectedCount = m_connectCount,
|
||||
.deviceUniqueDataLen = 0,
|
||||
|
@ -2,6 +2,7 @@
|
||||
#include <stdint.h>
|
||||
|
||||
namespace Err {
|
||||
namespace PngDec {
|
||||
constexpr int32_t INVALID_ADDR = -2140602367;
|
||||
constexpr int32_t INVALID_SIZE = -2140602366;
|
||||
constexpr int32_t INVALID_PARAM = -2140602365;
|
||||
@ -10,6 +11,7 @@ constexpr int32_t INVALID_DATA = -2140602352;
|
||||
constexpr int32_t UNSUPPORT_DATA = -2140602351;
|
||||
constexpr int32_t DECODE_ERROR = -2140602350;
|
||||
constexpr int32_t FATAL = -2140602336;
|
||||
} // namespace PngDec
|
||||
} // namespace Err
|
||||
|
||||
constexpr uint8_t SCE_PNG_DEC_IMAGE_FLAG_ADAM7_INTERLACE = 1;
|
||||
|
@ -36,12 +36,12 @@ extern "C" {
|
||||
EXPORT const char* MODULE_NAME = "libScePngDec";
|
||||
|
||||
EXPORT SYSV_ABI int32_t scePngDecCreate(const ScePngDecCreateParam* param, void* mem, uint32_t size, ScePngDecHandle* handle) {
|
||||
if (mem == nullptr) return Err::INVALID_ADDR;
|
||||
if (size < sizeof(_PngHandle)) return Err::INVALID_SIZE;
|
||||
if (mem == nullptr) return Err::PngDec::INVALID_ADDR;
|
||||
if (size < sizeof(_PngHandle)) return Err::PngDec::INVALID_SIZE;
|
||||
auto pngh = (_PngHandle*)mem;
|
||||
|
||||
pngh->png = png_create_read_struct(PNG_LIBPNG_VER_STRING, nullptr, nullptr, nullptr);
|
||||
if (pngh->png == nullptr) return Err::FATAL;
|
||||
if (pngh->png == nullptr) return Err::PngDec::FATAL;
|
||||
|
||||
pngh->info = png_create_info_struct(pngh->png);
|
||||
if (pngh->info == nullptr) {
|
||||
@ -55,10 +55,10 @@ EXPORT SYSV_ABI int32_t scePngDecCreate(const ScePngDecCreateParam* param, void*
|
||||
|
||||
EXPORT SYSV_ABI int32_t scePngDecDecode(ScePngDecHandle handle, const ScePngDecDecodeParam* param, ScePngDecImageInfo* ii) {
|
||||
LOG_USE_MODULE(libScePngDec);
|
||||
if (param->pngAddr == nullptr || param->imageAddr == nullptr) return Err::INVALID_ADDR;
|
||||
if (param->pngSize < 8) return Err::INVALID_SIZE;
|
||||
if (png_sig_cmp((png_const_bytep)param->pngAddr, 0, 8) != 0) return Err::INVALID_DATA;
|
||||
if (handle == nullptr) return Err::INVALID_HANDLE;
|
||||
if (param->pngAddr == nullptr || param->imageAddr == nullptr) return Err::PngDec::INVALID_ADDR;
|
||||
if (param->pngSize < 8) return Err::PngDec::INVALID_SIZE;
|
||||
if (png_sig_cmp((png_const_bytep)param->pngAddr, 0, 8) != 0) return Err::PngDec::INVALID_DATA;
|
||||
if (handle == nullptr) return Err::PngDec::INVALID_HANDLE;
|
||||
auto pngh = (_PngHandle*)handle;
|
||||
|
||||
struct pngreader {
|
||||
@ -95,7 +95,7 @@ EXPORT SYSV_ABI int32_t scePngDecDecode(ScePngDecHandle handle, const ScePngDecD
|
||||
if (png_get_valid(pngh->png, pngh->info, PNG_INFO_tRNS)) ii->imageFlag |= SCE_PNG_DEC_IMAGE_FLAG_TRNS_CHUNK_EXIST;
|
||||
}
|
||||
|
||||
if ((w * h * 4) > param->imageSize) return Err::INVALID_SIZE;
|
||||
if ((w * h * 4) > param->imageSize) return Err::PngDec::INVALID_SIZE;
|
||||
if (bi == 16) png_set_strip_16(pngh->png);
|
||||
if (ct == PNG_COLOR_TYPE_PALETTE) png_set_palette_to_rgb(pngh->png);
|
||||
if (ct == PNG_COLOR_TYPE_GRAY && bi < 8) png_set_expand_gray_1_2_4_to_8(pngh->png);
|
||||
@ -124,16 +124,16 @@ EXPORT SYSV_ABI int32_t scePngDecDecode(ScePngDecHandle handle, const ScePngDecD
|
||||
}
|
||||
|
||||
EXPORT SYSV_ABI int32_t scePngDecDelete(ScePngDecHandle handle) {
|
||||
if (handle == nullptr) return Err::INVALID_HANDLE;
|
||||
if (handle == nullptr) return Err::PngDec::INVALID_HANDLE;
|
||||
auto pngh = *(_PngHandle**)handle;
|
||||
png_destroy_read_struct(&pngh->png, &pngh->info, nullptr);
|
||||
return Ok;
|
||||
}
|
||||
|
||||
EXPORT SYSV_ABI int32_t scePngDecParseHeader(const ScePngDecParseParam* param, ScePngDecImageInfo* ii) {
|
||||
if (param->pngAddr == nullptr) return Err::INVALID_ADDR;
|
||||
if (param->pngSize < 8) return Err::INVALID_SIZE;
|
||||
if (png_sig_cmp((png_const_bytep)param->pngAddr, 0, 8) != 0) return Err::INVALID_DATA;
|
||||
if (param->pngAddr == nullptr) return Err::PngDec::INVALID_ADDR;
|
||||
if (param->pngSize < 8) return Err::PngDec::INVALID_SIZE;
|
||||
if (png_sig_cmp((png_const_bytep)param->pngAddr, 0, 8) != 0) return Err::PngDec::INVALID_DATA;
|
||||
|
||||
auto png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, nullptr, nullptr, nullptr);
|
||||
if (png_ptr == nullptr) return false;
|
||||
@ -177,9 +177,9 @@ EXPORT SYSV_ABI int32_t scePngDecParseHeader(const ScePngDecParseParam* param, S
|
||||
}
|
||||
|
||||
EXPORT SYSV_ABI int32_t scePngDecQueryMemorySize(const ScePngDecCreateParam* param) {
|
||||
if (param == nullptr) return Err::INVALID_ADDR;
|
||||
if (param->cbSize != sizeof(ScePngDecCreateParam)) return Err::INVALID_SIZE;
|
||||
if (param->maxImageWidth > 1000000) return Err::INVALID_PARAM;
|
||||
if (param == nullptr) return Err::PngDec::INVALID_ADDR;
|
||||
if (param->cbSize != sizeof(ScePngDecCreateParam)) return Err::PngDec::INVALID_SIZE;
|
||||
if (param->maxImageWidth > 1000000) return Err::PngDec::INVALID_PARAM;
|
||||
return sizeof(_PngHandle);
|
||||
}
|
||||
}
|
||||
|
@ -1,19 +1,22 @@
|
||||
#pragma once
|
||||
#include <stdint.h>
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
namespace Err {
|
||||
constexpr int32_t SCE_RTC_ERROR_NOT_INITIALIZED = -2135621631;
|
||||
constexpr int32_t SCE_RTC_ERROR_INVALID_POINTER = -2135621630;
|
||||
constexpr int32_t SCE_RTC_ERROR_INVALID_VALUE = -2135621629;
|
||||
constexpr int32_t SCE_RTC_ERROR_INVALID_ARG = -2135621628;
|
||||
constexpr int32_t SCE_RTC_ERROR_NOT_SUPPORTED = -2135621627;
|
||||
constexpr int32_t SCE_RTC_ERROR_NO_CLOCK = -2135621626;
|
||||
constexpr int32_t SCE_RTC_ERROR_BAD_PARSE = -2135621625;
|
||||
constexpr int32_t SCE_RTC_ERROR_INVALID_YEAR = -2135621624;
|
||||
constexpr int32_t SCE_RTC_ERROR_INVALID_MONTH = -2135621623;
|
||||
constexpr int32_t SCE_RTC_ERROR_INVALID_DAY = -2135621622;
|
||||
constexpr int32_t SCE_RTC_ERROR_INVALID_HOUR = -2135621621;
|
||||
constexpr int32_t SCE_RTC_ERROR_INVALID_MINUTE = -2135621620;
|
||||
constexpr int32_t SCE_RTC_ERROR_INVALID_SECOND = -2135621619;
|
||||
constexpr int32_t SCE_RTC_ERROR_INVALID_MICROSECOND = -2135621618;
|
||||
namespace Rtc {
|
||||
constexpr int32_t NOT_INITIALIZED = -2135621631;
|
||||
constexpr int32_t INVALID_POINTER = -2135621630;
|
||||
constexpr int32_t INVALID_VALUE = -2135621629;
|
||||
constexpr int32_t INVALID_ARG = -2135621628;
|
||||
constexpr int32_t NOT_SUPPORTED = -2135621627;
|
||||
constexpr int32_t NO_CLOCK = -2135621626;
|
||||
constexpr int32_t BAD_PARSE = -2135621625;
|
||||
constexpr int32_t INVALID_YEAR = -2135621624;
|
||||
constexpr int32_t INVALID_MONTH = -2135621623;
|
||||
constexpr int32_t INVALID_DAY = -2135621622;
|
||||
constexpr int32_t INVALID_HOUR = -2135621621;
|
||||
constexpr int32_t INVALID_MINUTE = -2135621620;
|
||||
constexpr int32_t INVALID_SECOND = -2135621619;
|
||||
constexpr int32_t INVALID_MICROSECOND = -2135621618;
|
||||
} // namespace Rtc
|
||||
} // namespace Err
|
@ -3,31 +3,31 @@
|
||||
#include <string_view>
|
||||
|
||||
namespace Err {
|
||||
|
||||
constexpr int SAVE_DATA_ERROR_PARAMETER = -2137063424;
|
||||
constexpr int SAVE_DATA_ERROR_NOT_INITIALIZED = -2137063423;
|
||||
constexpr int SAVE_DATA_ERROR_OUT_OF_MEMORY = -2137063422;
|
||||
constexpr int SAVE_DATA_ERROR_BUSY = -2137063421;
|
||||
constexpr int SAVE_DATA_ERROR_NOT_MOUNTED = -2137063420;
|
||||
constexpr int SAVE_DATA_ERROR_NO_PERMISSION = -2137063419;
|
||||
constexpr int SAVE_DATA_ERROR_FINGERPRINT_MISMATCH = -2137063418;
|
||||
constexpr int SAVE_DATA_ERROR_EXISTS = -2137063417;
|
||||
constexpr int SAVE_DATA_ERROR_NOT_FOUND = -2137063416;
|
||||
constexpr int SAVE_DATA_ERROR_NO_SPACE_FS = -2137063414;
|
||||
constexpr int SAVE_DATA_ERROR_INTERNAL = -2137063413;
|
||||
constexpr int SAVE_DATA_ERROR_MOUNT_FULL = -2137063412;
|
||||
constexpr int SAVE_DATA_ERROR_BAD_MOUNTED = -2137063411;
|
||||
constexpr int SAVE_DATA_ERROR_FILE_NOT_FOUND = -2137063410;
|
||||
constexpr int SAVE_DATA_ERROR_BROKEN = -2137063409;
|
||||
constexpr int SAVE_DATA_ERROR_INVALID_LOGIN_USER = -2137063407;
|
||||
constexpr int SAVE_DATA_ERROR_MEMORY_NOT_READY = -2137063406;
|
||||
constexpr int SAVE_DATA_ERROR_BACKUP_BUSY = -2137063405;
|
||||
constexpr int SAVE_DATA_ERROR_NOT_REGIST_CALLBACK = -2137063403;
|
||||
constexpr int SAVE_DATA_ERROR_BUSY_FOR_SAVING = -2137063402;
|
||||
constexpr int SAVE_DATA_ERROR_LIMITATION_OVER = -2137063401;
|
||||
constexpr int SAVE_DATA_ERROR_EVENT_BUSY = -2137063400;
|
||||
constexpr int SAVE_DATA_ERROR_PARAMSFO_TRANSFER_TITLE_ID_NOT_FOUND = -2137063399;
|
||||
|
||||
namespace SaveData {
|
||||
constexpr int PARAMETER = -2137063424;
|
||||
constexpr int NOT_INITIALIZED = -2137063423;
|
||||
constexpr int OUT_OF_MEMORY = -2137063422;
|
||||
constexpr int BUSY = -2137063421;
|
||||
constexpr int NOT_MOUNTED = -2137063420;
|
||||
constexpr int NO_PERMISSION = -2137063419;
|
||||
constexpr int FINGERPRINT_MISMATCH = -2137063418;
|
||||
constexpr int EXISTS = -2137063417;
|
||||
constexpr int NOT_FOUND = -2137063416;
|
||||
constexpr int NO_SPACE_FS = -2137063414;
|
||||
constexpr int INTERNAL = -2137063413;
|
||||
constexpr int MOUNT_FULL = -2137063412;
|
||||
constexpr int BAD_MOUNTED = -2137063411;
|
||||
constexpr int FILE_NOT_FOUND = -2137063410;
|
||||
constexpr int BROKEN = -2137063409;
|
||||
constexpr int INVALID_LOGIN_USER = -2137063407;
|
||||
constexpr int MEMORY_NOT_READY = -2137063406;
|
||||
constexpr int BACKUP_BUSY = -2137063405;
|
||||
constexpr int NOT_REGIST_CALLBACK = -2137063403;
|
||||
constexpr int BUSY_FOR_SAVING = -2137063402;
|
||||
constexpr int LIMITATION_OVER = -2137063401;
|
||||
constexpr int EVENT_BUSY = -2137063400;
|
||||
constexpr int PARAMSFO_TRANSFER_TITLE_ID_NOT_FOUND = -2137063399;
|
||||
} // namespace SaveData
|
||||
} // namespace Err
|
||||
|
||||
constexpr uint32_t SCE_SAVE_DATA_TITLE_ID_DATA_SIZE = 10;
|
||||
|
@ -39,7 +39,7 @@ int saveDataMount(int32_t userId, const char* dirName, SceSaveDataMountMode moun
|
||||
if (doOpen || doCreate) {
|
||||
if (!accessFileManager().getMountPoint(MountType::Save, dirSaveFiles.filename().string()).empty()) {
|
||||
LOG_DEBUG(L"Savedir already created dir:%S", dirName);
|
||||
return Err::SAVE_DATA_ERROR_BUSY;
|
||||
return Err::SaveData::BUSY;
|
||||
}
|
||||
}
|
||||
|
||||
@ -66,7 +66,7 @@ int saveDataMount(int32_t userId, const char* dirName, SceSaveDataMountMode moun
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (mountPoint.empty()) return Err::SAVE_DATA_ERROR_MOUNT_FULL;
|
||||
if (mountPoint.empty()) return Err::SaveData::MOUNT_FULL;
|
||||
}
|
||||
// - mountpoint
|
||||
|
||||
@ -74,7 +74,7 @@ int saveDataMount(int32_t userId, const char* dirName, SceSaveDataMountMode moun
|
||||
|
||||
if (!std::filesystem::exists(dirSaveFiles)) {
|
||||
LOG_DEBUG(L"Savedir doesn't exist");
|
||||
return Err::SAVE_DATA_ERROR_NOT_FOUND;
|
||||
return Err::SaveData::NOT_FOUND;
|
||||
}
|
||||
|
||||
auto const count = mountPoint.copy(mountResult->mountPoint.data, SCE_SAVE_DATA_MOUNT_POINT_DATA_MAXSIZE - 1);
|
||||
@ -176,7 +176,7 @@ EXPORT SYSV_ABI int32_t sceSaveDataUmountWithBackup(const SceSaveDataMountPoint*
|
||||
zip_close(za);
|
||||
} else {
|
||||
LOG_ERR(L"Backup failed: %d", zerr);
|
||||
return Err::SAVE_DATA_ERROR_INTERNAL;
|
||||
return Err::SaveData::INTERNAL;
|
||||
}
|
||||
|
||||
return sceSaveDataUmount(mountPoint);
|
||||
@ -452,7 +452,7 @@ EXPORT SYSV_ABI int32_t sceSaveDataRestoreBackupData(const SceSaveDataRestoreBac
|
||||
}
|
||||
|
||||
EXPORT SYSV_ABI int32_t sceSaveDataCheckBackupData(const SceSaveDataCheckBackupData* check) {
|
||||
if (check->titleId != nullptr) return Err::SAVE_DATA_ERROR_INTERNAL;
|
||||
if (check->titleId != nullptr) return Err::SaveData::INTERNAL;
|
||||
|
||||
// todo: check if savedata directory is already mounted
|
||||
|
||||
@ -470,7 +470,7 @@ EXPORT SYSV_ABI int32_t sceSaveDataCheckBackupData(const SceSaveDataCheckBackupD
|
||||
zip_close(za);
|
||||
}
|
||||
|
||||
return Err::SAVE_DATA_ERROR_NOT_FOUND;
|
||||
return Err::SaveData::NOT_FOUND;
|
||||
}
|
||||
|
||||
EXPORT SYSV_ABI int32_t sceSaveDataBackup(const SceSaveDataBackup* backup) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
#include "codes.h"
|
||||
#include "common.h"
|
||||
#include "errorcodes.h"
|
||||
#include "logging.h"
|
||||
|
||||
LOG_DEFINE_MODULE(libSceSystemGesture);
|
||||
|
@ -1,15 +1,19 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
namespace Err {
|
||||
constexpr int USER_SERVICE_ERROR_INTERNAL = -2137653247; /* 0x80960001 */
|
||||
constexpr int USER_SERVICE_ERROR_NOT_INITIALIZED = -2137653246; /* 0x80960002 */
|
||||
constexpr int USER_SERVICE_ERROR_ALREADY_INITIALIZED = -2137653245; /* 0x80960003 */
|
||||
constexpr int USER_SERVICE_ERROR_NO_MEMORY = -2137653244; /* 0x80960004 */
|
||||
constexpr int USER_SERVICE_ERROR_INVALID_ARGUMENT = -2137653243; /* 0x80960005 */
|
||||
constexpr int USER_SERVICE_ERROR_OPERATION_NOT_SUPPORTED = -2137653242; /* 0x80960006 */
|
||||
constexpr int USER_SERVICE_ERROR_NO_EVENT = -2137653241; /* 0x80960007 */
|
||||
constexpr int USER_SERVICE_ERROR_NOT_LOGGED_IN = -2137653239; /* 0x80960009 */
|
||||
constexpr int USER_SERVICE_ERROR_BUFFER_TOO_SHORT = -2137653238; /* 0x8096000A */
|
||||
namespace UserService {
|
||||
constexpr int32_t INTERNAL = -2137653247; /* 0x80960001 */
|
||||
constexpr int32_t NOT_INITIALIZED = -2137653246; /* 0x80960002 */
|
||||
constexpr int32_t ALREADY_INITIALIZED = -2137653245; /* 0x80960003 */
|
||||
constexpr int32_t NO_MEMORY = -2137653244; /* 0x80960004 */
|
||||
constexpr int32_t INVALID_ARGUMENT = -2137653243; /* 0x80960005 */
|
||||
constexpr int32_t OPERATION_NOT_SUPPORTED = -2137653242; /* 0x80960006 */
|
||||
constexpr int32_t NO_EVENT = -2137653241; /* 0x80960007 */
|
||||
constexpr int32_t NOT_LOGGED_IN = -2137653239; /* 0x80960009 */
|
||||
constexpr int32_t BUFFER_TOO_SHORT = -2137653238; /* 0x8096000A */
|
||||
} // namespace UserService
|
||||
} // namespace Err
|
||||
|
||||
constexpr size_t USER_SERVICE_MAX_USER_NAME_LENGTH = 16;
|
||||
|
@ -71,7 +71,7 @@ EXPORT SYSV_ABI int sceUserServiceGetEvent(UserServiceEvent* event) {
|
||||
}
|
||||
}
|
||||
|
||||
return Err::USER_SERVICE_ERROR_NO_EVENT;
|
||||
return Err::UserService::NO_EVENT;
|
||||
}
|
||||
|
||||
EXPORT SYSV_ABI int sceUserServiceGetLoginUserIdList(UserServiceLoginUserIdList* userId_list) {
|
||||
@ -89,7 +89,7 @@ EXPORT SYSV_ABI int sceUserServiceGetLoginUserIdList(UserServiceLoginUserIdList*
|
||||
}
|
||||
|
||||
EXPORT SYSV_ABI int sceUserServiceGetUserName(int userId, char* name, size_t size) {
|
||||
if (userId < 1 || userId > 3 || name == nullptr || size == 0) return Err::USER_SERVICE_ERROR_INVALID_ARGUMENT;
|
||||
if (userId < 1 || userId > 3 || name == nullptr || size == 0) return Err::UserService::INVALID_ARGUMENT;
|
||||
|
||||
std::string username = "Anon";
|
||||
auto [lock, jData] = accessConfig()->accessModule(ConfigModFlag::GENERAL);
|
||||
@ -101,14 +101,14 @@ EXPORT SYSV_ABI int sceUserServiceGetUserName(int userId, char* name, size_t siz
|
||||
} catch (json::exception& ex) {
|
||||
}
|
||||
|
||||
if (size < (username.size() + 1)) return Err::USER_SERVICE_ERROR_BUFFER_TOO_SHORT;
|
||||
if (size < (username.size() + 1)) return Err::UserService::BUFFER_TOO_SHORT;
|
||||
auto const count = username.copy(name, size - 1);
|
||||
name[count] = '\0';
|
||||
return Ok;
|
||||
}
|
||||
|
||||
EXPORT SYSV_ABI int32_t sceUserServiceGetUserColor(int userId, UserServiceUserColor* color) {
|
||||
if (userId < 1 || userId > 3) return Err::USER_SERVICE_ERROR_INVALID_ARGUMENT;
|
||||
if (userId < 1 || userId > 3) return Err::UserService::INVALID_ARGUMENT;
|
||||
auto [lock, jData] = accessConfig()->accessModule(ConfigModFlag::GENERAL);
|
||||
|
||||
std::string _scolor;
|
||||
|
@ -1,34 +1,37 @@
|
||||
#pragma once
|
||||
#include <stdint.h>
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
namespace Err {
|
||||
constexpr int VIDEO_OUT_ERROR_INVALID_VALUE = -2144796671; /* 0x80290001 */
|
||||
constexpr int VIDEO_OUT_ERROR_INVALID_ADDRESS = -2144796670; /* 0x80290002 */
|
||||
constexpr int VIDEO_OUT_ERROR_INVALID_PIXEL_FORMAT = -2144796669; /* 0x80290003 */
|
||||
constexpr int VIDEO_OUT_ERROR_INVALID_PITCH = -2144796668; /* 0x80290004 */
|
||||
constexpr int VIDEO_OUT_ERROR_INVALID_RESOLUTION = -2144796667; /* 0x80290005 */
|
||||
constexpr int VIDEO_OUT_ERROR_INVALID_FLIP_MODE = -2144796666; /* 0x80290006 */
|
||||
constexpr int VIDEO_OUT_ERROR_INVALID_TILING_MODE = -2144796665; /* 0x80290007 */
|
||||
constexpr int VIDEO_OUT_ERROR_INVALID_ASPECT_RATIO = -2144796664; /* 0x80290008 */
|
||||
constexpr int VIDEO_OUT_ERROR_RESOURCE_BUSY = -2144796663; /* 0x80290009 */
|
||||
constexpr int VIDEO_OUT_ERROR_INVALID_INDEX = -2144796662; /* 0x8029000A */
|
||||
constexpr int VIDEO_OUT_ERROR_INVALID_HANDLE = -2144796661; /* 0x8029000B */
|
||||
constexpr int VIDEO_OUT_ERROR_INVALID_EVENT_QUEUE = -2144796660; /* 0x8029000C */
|
||||
constexpr int VIDEO_OUT_ERROR_INVALID_EVENT = -2144796659; /* 0x8029000D */
|
||||
constexpr int VIDEO_OUT_ERROR_NO_EMPTY_SLOT = -2144796657; /* 0x8029000F */
|
||||
constexpr int VIDEO_OUT_ERROR_SLOT_OCCUPIED = -2144796656; /* 0x80290010 */
|
||||
constexpr int VIDEO_OUT_ERROR_FLIP_QUEUE_FULL = -2144796654; /* 0x80290012 */
|
||||
constexpr int VIDEO_OUT_ERROR_INVALID_MEMORY = -2144796653; /* 0x80290013 */
|
||||
constexpr int VIDEO_OUT_ERROR_MEMORY_NOT_PHYSICALLY_CONTIGUOUS = -2144796652; /* 0x80290014 */
|
||||
constexpr int VIDEO_OUT_ERROR_MEMORY_INVALID_ALIGNMENT = -2144796651; /* 0x80290015 */
|
||||
constexpr int VIDEO_OUT_ERROR_UNSUPPORTED_OUTPUT_MODE = -2144796650; /* 0x80290016 */
|
||||
constexpr int VIDEO_OUT_ERROR_OVERFLOW = -2144796649; /* 0x80290017 */
|
||||
constexpr int VIDEO_OUT_ERROR_NO_DEVICE = -2144796648; /* 0x80290018 */
|
||||
constexpr int VIDEO_OUT_ERROR_UNAVAILABLE_OUTPUT_MODE = -2144796647; /* 0x80290019 */
|
||||
constexpr int VIDEO_OUT_ERROR_INVALID_OPTION = -2144796646; /* 0x8029001A */
|
||||
constexpr int VIDEO_OUT_ERROR_PORT_UNSUPPORTED_FUNCTION = -2144796645; /* 0x8029001B */
|
||||
constexpr int VIDEO_OUT_ERROR_UNSUPPORTED_OPERATION = -2144796644; /* 0x8029001C */
|
||||
constexpr int VIDEO_OUT_ERROR_FATAL = -2144796417; /* 0x802900FF */
|
||||
constexpr int VIDEO_OUT_ERROR_UNKNOWN = -2144796418; /* 0x802900FE */
|
||||
constexpr int VIDEO_OUT_ERROR_ENOMEM = -2144792564; /* 0x8029100C */
|
||||
namespace VideoOut {
|
||||
constexpr int32_t INVALID_VALUE = -2144796671; /* 0x80290001 */
|
||||
constexpr int32_t INVALID_ADDRESS = -2144796670; /* 0x80290002 */
|
||||
constexpr int32_t INVALID_PIXEL_FORMAT = -2144796669; /* 0x80290003 */
|
||||
constexpr int32_t INVALID_PITCH = -2144796668; /* 0x80290004 */
|
||||
constexpr int32_t INVALID_RESOLUTION = -2144796667; /* 0x80290005 */
|
||||
constexpr int32_t INVALID_FLIP_MODE = -2144796666; /* 0x80290006 */
|
||||
constexpr int32_t INVALID_TILING_MODE = -2144796665; /* 0x80290007 */
|
||||
constexpr int32_t INVALID_ASPECT_RATIO = -2144796664; /* 0x80290008 */
|
||||
constexpr int32_t RESOURCE_BUSY = -2144796663; /* 0x80290009 */
|
||||
constexpr int32_t INVALID_INDEX = -2144796662; /* 0x8029000A */
|
||||
constexpr int32_t INVALID_HANDLE = -2144796661; /* 0x8029000B */
|
||||
constexpr int32_t INVALID_EVENT_QUEUE = -2144796660; /* 0x8029000C */
|
||||
constexpr int32_t INVALID_EVENT = -2144796659; /* 0x8029000D */
|
||||
constexpr int32_t NO_EMPTY_SLOT = -2144796657; /* 0x8029000F */
|
||||
constexpr int32_t SLOT_OCCUPIED = -2144796656; /* 0x80290010 */
|
||||
constexpr int32_t FLIP_QUEUE_FULL = -2144796654; /* 0x80290012 */
|
||||
constexpr int32_t INVALID_MEMORY = -2144796653; /* 0x80290013 */
|
||||
constexpr int32_t MEMORY_NOT_PHYSICALLY_CONTIGUOUS = -2144796652; /* 0x80290014 */
|
||||
constexpr int32_t MEMORY_INVALID_ALIGNMENT = -2144796651; /* 0x80290015 */
|
||||
constexpr int32_t UNSUPPORTED_OUTPUT_MODE = -2144796650; /* 0x80290016 */
|
||||
constexpr int32_t VOVERFLOW = -2144796649; /* 0x80290017 */
|
||||
constexpr int32_t NO_DEVICE = -2144796648; /* 0x80290018 */
|
||||
constexpr int32_t UNAVAILABLE_OUTPUT_MODE = -2144796647; /* 0x80290019 */
|
||||
constexpr int32_t INVALID_OPTION = -2144796646; /* 0x8029001A */
|
||||
constexpr int32_t PORT_UNSUPPORTED_FUNCTION = -2144796645; /* 0x8029001B */
|
||||
constexpr int32_t UNSUPPORTED_OPERATION = -2144796644; /* 0x8029001C */
|
||||
constexpr int32_t FATAL = -2144796417; /* 0x802900FF */
|
||||
constexpr int32_t UNKNOWN = -2144796418; /* 0x802900FE */
|
||||
constexpr int32_t NOMEM = -2144792564; /* 0x8029100C */
|
||||
} // namespace VideoOut
|
||||
} // namespace Err
|
@ -39,13 +39,11 @@ EXPORT SYSV_ABI int32_t sceVideoOutClose(int32_t handle) {
|
||||
|
||||
EXPORT SYSV_ABI int32_t sceVideoOutRegisterBuffers(int32_t handle, int32_t startIndex, void* const* addresses, int32_t bufferNum,
|
||||
const SceVideoOutBufferAttribute* attribute) {
|
||||
[[unlikely]] if (addresses == nullptr) { return Err::VIDEO_OUT_ERROR_INVALID_ADDRESS; }
|
||||
[[unlikely]] if (addresses == nullptr) { return Err::VideoOut::INVALID_ADDRESS; }
|
||||
|
||||
[[unlikely]] if (attribute == nullptr) { return Err::VIDEO_OUT_ERROR_INVALID_OPTION; }
|
||||
[[unlikely]] if (attribute == nullptr) { return Err::VideoOut::INVALID_OPTION; }
|
||||
|
||||
[[unlikely]] if (startIndex < 0 || startIndex > 15 || bufferNum < 1 || bufferNum > 16 || startIndex + bufferNum > 15) {
|
||||
return Err::VIDEO_OUT_ERROR_INVALID_VALUE;
|
||||
}
|
||||
[[unlikely]] if (startIndex < 0 || startIndex > 15 || bufferNum < 1 || bufferNum > 16 || startIndex + bufferNum > 15) { return Err::VideoOut::INVALID_VALUE; }
|
||||
|
||||
return accessVideoOut().registerBuffers(handle, startIndex, addresses, bufferNum, attribute);
|
||||
}
|
||||
@ -82,7 +80,7 @@ EXPORT SYSV_ABI int32_t sceVideoOutSetWindowModeMargins(int32_t handle, int top,
|
||||
|
||||
EXPORT SYSV_ABI int32_t sceVideoOutSubmitFlip(int32_t handle, int32_t bufferIndex, uint32_t flipMode, int64_t flipArg) {
|
||||
if (bufferIndex < 0 || bufferIndex > 15) {
|
||||
return Err::VIDEO_OUT_ERROR_INVALID_INDEX;
|
||||
return Err::VideoOut::INVALID_INDEX;
|
||||
}
|
||||
accessVideoOut().submitFlip(handle, bufferIndex, flipArg);
|
||||
return Ok;
|
||||
@ -108,7 +106,7 @@ EXPORT SYSV_ABI int32_t sceVideoOutGetResolutionStatus(int32_t handle, SceVideoO
|
||||
}
|
||||
|
||||
EXPORT SYSV_ABI int32_t sceVideoOutAddFlipEvent(Kernel::EventQueue::IKernelEqueue_t eq, int32_t handle, void* udata) {
|
||||
[[unlikely]] if (eq == nullptr) { return Err::VIDEO_OUT_ERROR_INVALID_EVENT_QUEUE; }
|
||||
[[unlikely]] if (eq == nullptr) { return Err::VideoOut::INVALID_EVENT_QUEUE; }
|
||||
|
||||
Kernel::EventQueue::KernelEqueueEvent const event = {.triggered = false,
|
||||
.event =
|
||||
@ -132,7 +130,7 @@ EXPORT SYSV_ABI int32_t sceVideoOutAddFlipEvent(Kernel::EventQueue::IKernelEqueu
|
||||
}
|
||||
|
||||
EXPORT SYSV_ABI int32_t sceVideoOutAddVblankEvent(Kernel::EventQueue::IKernelEqueue_t eq, int32_t handle, void* udata) {
|
||||
[[unlikely]] if (eq == nullptr) { return Err::VIDEO_OUT_ERROR_INVALID_EVENT_QUEUE; }
|
||||
[[unlikely]] if (eq == nullptr) { return Err::VideoOut::INVALID_EVENT_QUEUE; }
|
||||
|
||||
Kernel::EventQueue::KernelEqueueEvent const event = {.triggered = false,
|
||||
.event =
|
||||
|
Loading…
Reference in New Issue
Block a user