Cleanup and sceNgs2 things

This commit is contained in:
igor725 2024-04-03 23:27:25 +03:00
parent 708bcf09e4
commit bab260d068
No known key found for this signature in database
GPG Key ID: 46F13BBE46F8569D
16 changed files with 396 additions and 143 deletions

View File

@ -73,7 +73,7 @@ enum class SceAudioOutSystemDebugStateElement { NULL_ = 0, LOUDNESS, MAX };
enum SceAudioOutSystemDebugStateLoudness { LOUDNESS_STOP = 0, LOUDNESS_START, LOUDNESS_START_QUIET, LOUDNESS_MAX };
typedef struct SceAudioOutSystemDebugStateParam {
struct SceAudioOutSystemDebugStateParam {
uint32_t value;
uint32_t reserved[3]; // reserved
} SceAudioOutSystemDebugStateParam;
};

View File

@ -158,19 +158,19 @@ enum class SceImePanelPriority {
ACCENT = 3,
};
typedef enum SceImeCaretMovementDirection {
MOVE_STILL = 0,
MOVE_LEFT = 1,
MOVE_RIGHT = 2,
MOVE_UP = 3,
MOVE_DOWN = 4,
MOVE_HOME = 5,
MOVE_END = 6,
MOVE_PAGE_UP = 7,
MOVE_PAGE_DOWN = 8,
MOVE_TOP = 9,
MOVE_BOTTOM = 10,
} SceImeCaretMovementDirection;
enum class SceImeCaretMovementDirection {
STILL = 0,
LEFT = 1,
RIGHT = 2,
UP = 3,
DOWN = 4,
HOME = 5,
END = 6,
PAGE_UP = 7,
PAGE_DOWN = 8,
TOP = 9,
BOTTOM = 10,
};
enum class SceImeTextAreaMode {
DISABLE = 0,

View File

@ -11,7 +11,7 @@ enum class MouseButton : uint32_t {
};
typedef struct SceMouseData {
struct SceMouseData {
uint64_t timestamp = 0; /*E System timestamp of this data(micro seconds). */
bool connected = false; /*E Mouse connection status. true:connected false:removed */
uint32_t buttons = 0; /*E Mouse buttons information */
@ -20,9 +20,9 @@ typedef struct SceMouseData {
int32_t wheel = 0; /*E Amount of wheel movement */
int32_t tilt = 0; /*E Amount of tilt movement (only for a mouse that supports a tilt wheel) */
uint8_t reserve[8]; /*E Reserved */
} SceMouseData;
};
typedef struct SceMouseOpenParam {
struct SceMouseOpenParam {
uint8_t behaviorFlag; /*E Behavior flag */
uint8_t reserve[7]; /*E Reserved */
} SceMouseOpenParam;
};

View File

@ -2,76 +2,80 @@
#include "..\libSceCommonDialog\types.h"
#include "codes.h"
typedef enum SceMsgDialogMode { SCE_MSG_DIALOG_MODE_USER_MSG = 1, SCE_MSG_DIALOG_MODE_PROGRESS_BAR, SCE_MSG_DIALOG_MODE_SYSTEM_MSG } SceMsgDialogMode;
enum class SceMsgDialogMode {
SCE_MSG_DIALOG_MODE_USER_MSG = 1,
SCE_MSG_DIALOG_MODE_PROGRESS_BAR,
SCE_MSG_DIALOG_MODE_SYSTEM_MSG,
};
typedef enum SceMsgDialogButton: int32_t {
SCE_MSG_DIALOG_BUTTON_ID_INVALID = 0,
SCE_MSG_DIALOG_BUTTON_ID_OK = 1,
SCE_MSG_DIALOG_BUTTON_ID_YES = 1,
SCE_MSG_DIALOG_BUTTON_ID_NO = 2,
SCE_MSG_DIALOG_BUTTON_ID_BUTTON1 = 1,
SCE_MSG_DIALOG_BUTTON_ID_BUTTON2 = 2,
} SceMsgDialogButton;
enum class SceMsgDialogButton: int32_t {
ID_INVALID = 0,
ID_OK = 1,
ID_YES = 1,
ID_NO = 2,
ID_BUTTON1 = 1,
ID_BUTTON2 = 2,
};
typedef enum SceMsgDialogSystemMessageType {
SCE_MSG_DIALOG_SYSMSG_TYPE_TRC_EMPTY_STORE = 0,
SCE_MSG_DIALOG_SYSMSG_TYPE_TRC_PSN_CHAT_RESTRICTION = 1,
SCE_MSG_DIALOG_SYSMSG_TYPE_TRC_PSN_UGC_RESTRICTION = 2,
SCE_MSG_DIALOG_SYSMSG_TYPE_CAMERA_NOT_CONNECTED = 4,
SCE_MSG_DIALOG_SYSMSG_TYPE_WARNING_PROFILE_PICTURE_AND_NAME_NOT_SHARED = 5,
} SceMsgDialogSystemMessageType;
enum class SceMsgDialogSystemMessageType {
TRC_EMPTY_STORE = 0,
TRC_PSN_CHAT_RESTRICTION = 1,
TRC_PSN_UGC_RESTRICTION = 2,
CAMERA_NOT_CONNECTED = 4,
WARNING_PROFILE_PICTURE_AND_NAME_NOT_SHARED = 5,
};
typedef struct SceMsgDialogResult {
struct SceMsgDialogResult {
SceMsgDialogMode mode;
int32_t result;
SceMsgDialogButton buttonId;
char pad[32];
} SceMsgDialogResult;
};
typedef enum SceMsgDialogButtonType {
SCE_MSG_DIALOG_BUTTON_TYPE_OK = 0,
SCE_MSG_DIALOG_BUTTON_TYPE_YESNO = 1,
SCE_MSG_DIALOG_BUTTON_TYPE_NONE = 2,
SCE_MSG_DIALOG_BUTTON_TYPE_OK_CANCEL = 3,
SCE_MSG_DIALOG_BUTTON_TYPE_WAIT = 5,
SCE_MSG_DIALOG_BUTTON_TYPE_WAIT_CANCEL = 6,
SCE_MSG_DIALOG_BUTTON_TYPE_YESNO_FOCUS_NO = 7,
SCE_MSG_DIALOG_BUTTON_TYPE_OK_CANCEL_FOCUS_CANCEL = 8,
SCE_MSG_DIALOG_BUTTON_TYPE_2BUTTONS = 9,
} SceMsgDialogButtonType;
enum class SceMsgDialogButtonType {
TYPE_OK = 0,
TYPE_YESNO = 1,
TYPE_NONE = 2,
TYPE_OK_CANCEL = 3,
TYPE_WAIT = 5,
TYPE_WAIT_CANCEL = 6,
TYPE_YESNO_FOCUS_NO = 7,
TYPE_OK_CANCEL_FOCUS_CANCEL = 8,
TYPE_2BUTTONS = 9,
};
typedef enum SceMsgDialogProgressBarType {
SCE_MSG_DIALOG_PROGRESSBAR_TYPE_PERCENTAGE,
SCE_MSG_DIALOG_PROGRESSBAR_TYPE_PERCENTAGE_CANCEL,
} SceMsgDialogProgressBarType;
enum class SceMsgDialogProgressBarType {
PERCENTAGE,
PERCENTAGE_CANCEL,
};
typedef struct SceMsgDialogButtonsParam {
struct SceMsgDialogButtonsParam {
const char* msg1;
const char* msg2;
char pad[32];
} SceMsgDialogButtonsParam;
};
typedef struct SceMsgDialogUserMessageParam {
struct SceMsgDialogUserMessageParam {
SceMsgDialogButtonType buttonType;
int32_t : 32;
const char* msg;
SceMsgDialogButtonsParam* buttonsParam;
char pad[24];
} SceMsgDialogUserMessageParam;
};
typedef struct SceMsgDialogProgressBarParam {
struct SceMsgDialogProgressBarParam {
SceMsgDialogProgressBarType barType;
int32_t : 32;
const char* msg;
char pad[64];
} SceMsgDialogProgressBarParam;
};
typedef struct SceMsgDialogSystemMessageParam {
struct SceMsgDialogSystemMessageParam {
SceMsgDialogSystemMessageType sysMsgType;
char pad[32];
} SceMsgDialogSystemMessageParam;
};
typedef struct SceMsgDialogParam {
struct SceMsgDialogParam {
SceCommonDialogBaseParam baseParam;
size_t size;
SceMsgDialogMode mode;
@ -82,4 +86,4 @@ typedef struct SceMsgDialogParam {
SceUserServiceUserId userId;
char pad[40];
int32_t : 32;
} SceMsgDialogParam;
};

View File

@ -42,11 +42,11 @@ struct SceNetMsghdr {
int msg_flags;
};
typedef struct SceNetUdpSndOnSuspend {
struct SceNetUdpSndOnSuspend {
int onoff;
SceNetSockaddr* addr;
SceNetSocklen_t addrlen;
#define SCE_NET_UDP_SND_ON_SUSPEND_DATALEN_MAX (512)
void* data;
SceNetSocklen_t datalen;
} SceNetUdpSndOnSuspend;
};

View File

@ -107,6 +107,6 @@ struct SceNetMemoryPoolStats {
size_t currentInuseSize;
};
typedef struct SceNetEtherAddr {
struct SceNetEtherAddr {
uint8_t data[SCE_NET_ETHER_ADDR_LEN];
} SceNetEtherAddr;
};

View File

@ -6,7 +6,23 @@ project(${libName})
add_library(${libName} SHARED entry.cpp)
target_include_directories(${libName} PRIVATE
${PRJ_SRC_DIR}/third_party/ffmpeg/include
)
target_link_directories(${libName} PRIVATE
${PRJ_SRC_DIR}/third_party/ffmpeg/lib
)
set(FFMPEG_LIBS
avformat
avcodec
avutil
swscale
swresample
)
add_dependencies(${libName} core)
target_link_libraries(${libName} PRIVATE core.lib)
target_link_libraries(${libName} PRIVATE core.lib ${FFMPEG_LIBS})
setupModule(${libName})

View File

@ -15,3 +15,5 @@ constexpr int32_t INVALID_NUM_CHANNELS = -2142633902;
constexpr int32_t INVALID_MAX_GRAIN_SAMPLES = -2142633904;
constexpr int32_t FAIL = -2142633983;
} // namespace Err
constexpr int32_t SCE_NGS2_RACK_NAME_LENGTH = 16;

View File

@ -1,5 +1,8 @@
#include "codes.h"
#include "common.h"
extern "C" {
#include "libavformat/avformat.h"
}
#include "core/kernel/filesystem.h"
#include "core/kernel/pthread.h"
#include "logging.h"
@ -37,14 +40,139 @@ EXPORT SYSV_ABI int32_t sceNgs2CalcWaveformBlock(SceNgs2WaveformFormat* wf, uint
return Ok;
}
static int32_t ProcessWaveData(WaveformInfo* wi, SceNgs2WaveformFormat* wf) {
/* todo: Deal with WAV/VAG files */
static SceNgs2ChannelsCount ParseChanCount(int num) {
LOG_USE_MODULE(libSceNgs2);
switch (num) {
case 1: return SceNgs2ChannelsCount::CH_1_0;
case 2: return SceNgs2ChannelsCount::CH_2_0;
case 6: return SceNgs2ChannelsCount::CH_5_1;
case 8: return SceNgs2ChannelsCount::CH_7_1;
}
LOG_CRIT(L"Invalid channels count sent to ParseChanCount!");
return SceNgs2ChannelsCount::INVALID;
}
static SceNgs2WaveFormType ParseWaveType(AVCodecID codec) {
switch (codec) {
case AVCodecID::AV_CODEC_ID_PCM_S8: return SceNgs2WaveFormType::PCM_I8;
case AVCodecID::AV_CODEC_ID_PCM_U8: return SceNgs2WaveFormType::PCM_U8;
case AVCodecID::AV_CODEC_ID_ATRAC9: return SceNgs2WaveFormType::ATRAC9;
default: return SceNgs2WaveFormType::NONE;
}
}
struct RIFFBuf {
const uint8_t* data;
size_t size;
uint64_t offset;
};
static int readbuf(void* op, uint8_t* buf, int bufsz) {
auto rb = (RIFFBuf*)op;
int read = std::min(int(rb->size - rb->offset), bufsz);
if (read == 0) return AVERROR_EOF;
::memcpy(buf, rb->data + rb->offset, read);
return read;
}
static int64_t seekbuf(void* op, int64_t offset, int whence) {
auto rb = (RIFFBuf*)op;
if (whence == AVSEEK_SIZE) return rb->size;
if (rb->data == nullptr || rb->size == 0) return -1;
if (whence == SEEK_SET)
rb->offset = offset;
else if (whence == SEEK_CUR)
rb->offset += offset;
else if (whence == SEEK_END)
rb->offset = rb->size - offset;
return offset;
}
static int32_t ParseRIFF(const uint8_t* data, size_t size, SceNgs2WaveformFormat* wf) {
LOG_USE_MODULE(libSceNgs2);
AVFormatContext* fmtctx = avformat_alloc_context();
auto aBufferIo = (uint8_t*)av_malloc(4096 + AV_INPUT_BUFFER_PADDING_SIZE);
RIFFBuf rb {
.data = data,
.size = size,
.offset = 0,
};
AVIOContext* avioctx = avio_alloc_context(aBufferIo, 4096, 0, &rb, &readbuf, nullptr, &seekbuf);
fmtctx->pb = avioctx;
fmtctx->flags |= AVFMT_FLAG_CUSTOM_IO;
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;
}
AVStream* astream = nullptr;
for (int i = 0; fmtctx->nb_streams; i++) {
if (fmtctx->streams[i]->codecpar->codec_type == AVMediaType::AVMEDIA_TYPE_AUDIO) {
astream = fmtctx->streams[i];
break;
}
}
if (astream == nullptr) {
LOG_ERR(L"ParseRIFF: no audio stream detected!");
return Err::FAIL;
}
wf->info.type = ParseWaveType(astream->codecpar->codec_id);
wf->info.sampleRate = astream->codecpar->sample_rate;
wf->info.channelsCount = ParseChanCount(astream->codecpar->ch_layout.nb_channels);
// These are unknown for now
wf->loopBeginPos = wf->loopEndPos = 0;
wf->samplesCount = 0;
wf->offset = 0;
wf->size = 0;
wf->numBlocks = 0;
av_free(avioctx);
avformat_close_input(&fmtctx);
return Ok;
}
static int32_t ProcessWaveData(WaveformInfo* wi, SceNgs2WaveformFormat* wf) {
LOG_USE_MODULE(libSceNgs2);
switch (wi->type) {
case WAVEFORM_DATA:
switch (auto ftype = *(uint32_t*)wi->ud.dataPtr) {
case 0x46464952: // RIFF audio
return ParseRIFF((const uint8_t*)wi->ud.dataPtr, wi->size, wf);
default: LOG_CRIT(L"Unimplemented filetype: %08x", ftype);
}
break;
default: LOG_ERR(L"Unimplemented waveform reader: %d", wi->type);
}
/* todo: Deal with WAV/VAG files */
return Err::INVALID_WAVEFORM_DATA;
}
EXPORT SYSV_ABI int32_t sceNgs2ParseWaveformData(const void* ptr, size_t size, SceNgs2WaveformFormat* wf) {
LOG_USE_MODULE(libSceNgs2);
LOG_ERR(L"todo %S", __FUNCTION__);
LOG_TRACE(L"todo %S", __FUNCTION__);
if (ptr == nullptr) {
return Err::INVALID_WAVEFORM_DATA;
@ -97,7 +225,7 @@ EXPORT SYSV_ABI int32_t sceNgs2ParseWaveformUser(SceWaveformUserFunc* user, size
return ProcessWaveData(&wi, wf);
}
EXPORT SYSV_ABI int32_t sceNgs2RackCreateWithAllocator(SceNgs2Handle* sh, uint32_t, void*, SceNgs2BufferAllocator* alloc, SceNgs2Handle* outh) {
EXPORT SYSV_ABI int32_t sceNgs2RackCreateWithAllocator(SceNgs2Handle* sysh, uint32_t, void*, SceNgs2BufferAllocator* alloc, SceNgs2Handle** outh) {
LOG_USE_MODULE(libSceNgs2);
LOG_TRACE(L"todo %S", __FUNCTION__);
return Ok;
@ -109,7 +237,7 @@ EXPORT SYSV_ABI int32_t sceNgs2RackDestroy(SceNgs2Handle* rh, void*) {
return Ok;
}
EXPORT SYSV_ABI int32_t sceNgs2RackGetVoiceHandle() {
EXPORT SYSV_ABI int32_t sceNgs2RackGetVoiceHandle(SceNgs2Handle* rh, uint32_t voiceId, SceNgs2Handle** outh) {
LOG_USE_MODULE(libSceNgs2);
LOG_TRACE(L"todo %S", __FUNCTION__);
return Ok;
@ -122,23 +250,23 @@ EXPORT SYSV_ABI int32_t sceNgs2SystemCreateWithAllocator(SceNgs2SystemOption* sy
if (outh == nullptr) return Err::INVALID_OUT_ADDRESS;
if (sysopt != nullptr && sysopt->size != sizeof(SceNgs2SystemOption)) return Err::INVALID_OPTION_SIZE;
// todo: dealloc if (*outh) != nullptr
return (*outh = new SceNgs2Handle) != nullptr ? 0 : Err::FAIL;
return (*outh = new SceNgs2Handle) != nullptr ? Ok : Err::FAIL;
}
EXPORT SYSV_ABI int32_t sceNgs2SystemDestroy(SceNgs2Handle* sh, SceNgs2ContextBufferInfo* cbi) {
EXPORT SYSV_ABI int32_t sceNgs2SystemDestroy(SceNgs2Handle* sysh, SceNgs2ContextBufferInfo* cbi) {
LOG_USE_MODULE(libSceNgs2);
LOG_ERR(L"todo %S", __FUNCTION__);
return Ok;
}
EXPORT SYSV_ABI int32_t sceNgs2SystemRender(SceNgs2Handle* sh, SceNgs2RenderBufferInfo* rbi, int32_t count) {
EXPORT SYSV_ABI int32_t sceNgs2SystemRender(SceNgs2Handle* sysh, SceNgs2RenderBufferInfo* rbi, int32_t count) {
LOG_USE_MODULE(libSceNgs2);
LOG_TRACE(L"todo %S", __FUNCTION__);
if (sh == nullptr) return Err::INVALID_SYSTEM_HANDLE;
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 >= MAX_TYPES) return Err::INVALID_WAVEFORM_TYPE;
if (rbi->channelsCount > 8) return Err::INVALID_NUM_CHANNELS;
if (rbi->waveType >= SceNgs2WaveFormType::MAX_TYPES) return Err::INVALID_WAVEFORM_TYPE;
if (rbi->channelsCount > SceNgs2ChannelsCount::CH_7_1) return Err::INVALID_NUM_CHANNELS;
for (int32_t i = 0; i < count; i++) {
if (rbi[i].bufferPtr != nullptr) {
@ -149,25 +277,25 @@ EXPORT SYSV_ABI int32_t sceNgs2SystemRender(SceNgs2Handle* sh, SceNgs2RenderBuff
return Ok;
}
EXPORT SYSV_ABI int32_t sceNgs2SystemSetGrainSamples(SceNgs2Handle* sh, uint32_t samplesCount) {
EXPORT SYSV_ABI int32_t sceNgs2SystemSetGrainSamples(SceNgs2Handle* sysh, uint32_t samplesCount) {
LOG_USE_MODULE(libSceNgs2);
LOG_ERR(L"todo %S", __FUNCTION__);
return Ok;
}
EXPORT SYSV_ABI int32_t sceNgs2VoiceControl() {
EXPORT SYSV_ABI int32_t sceNgs2VoiceControl(SceNgs2Handle* sysh, const SceNgs2VoiceParamHead* phead) {
LOG_USE_MODULE(libSceNgs2);
LOG_TRACE(L"todo %S", __FUNCTION__);
return Ok;
}
EXPORT SYSV_ABI int32_t sceNgs2VoiceGetState() {
EXPORT SYSV_ABI int32_t sceNgs2VoiceGetState(SceNgs2Handle* vh, SceNgs2VoiceState* state, size_t size) {
LOG_USE_MODULE(libSceNgs2);
LOG_ERR(L"todo %S", __FUNCTION__);
return Ok;
}
EXPORT SYSV_ABI int32_t sceNgs2VoiceGetStateFlags() {
EXPORT SYSV_ABI int32_t sceNgs2VoiceGetStateFlags(SceNgs2Handle* vh, uint32_t* flags) {
LOG_USE_MODULE(libSceNgs2);
LOG_TRACE(L"todo %S", __FUNCTION__);
return Ok;
@ -197,13 +325,14 @@ EXPORT SYSV_ABI int32_t sceNgs2GeomResetSourceParam(SceNgs2GeomSourceParam* para
return Ok;
}
EXPORT SYSV_ABI int32_t sceNgs2RackCreate() {
EXPORT SYSV_ABI int32_t sceNgs2RackCreate(SceNgs2Handle* sysh, uint32_t rackId, const SceNgs2RackOption* ro, const SceNgs2ContextBufferInfo* cbi,
SceNgs2Handle** outh) {
LOG_USE_MODULE(libSceNgs2);
LOG_ERR(L"todo %S", __FUNCTION__);
return Ok;
}
EXPORT SYSV_ABI int32_t sceNgs2RackQueryBufferSize() {
EXPORT SYSV_ABI int32_t sceNgs2RackQueryBufferSize(uint32_t rackId, const SceNgs2RackOption* ro, SceNgs2ContextBufferInfo* cbi) {
LOG_USE_MODULE(libSceNgs2);
LOG_ERR(L"todo %S", __FUNCTION__);
return Ok;
@ -219,7 +348,7 @@ EXPORT SYSV_ABI int32_t sceNgs2SystemCreate(SceNgs2SystemOption* sysopt, SceNgs2
return Ok;
}
EXPORT SYSV_ABI int32_t sceNgs2SystemQueryBufferSize() {
EXPORT SYSV_ABI int32_t sceNgs2SystemQueryBufferSize(const SceNgs2SystemOption* sysopt, SceNgs2ContextBufferInfo* cbi) {
LOG_USE_MODULE(libSceNgs2);
LOG_ERR(L"todo %S", __FUNCTION__);
return Ok;

View File

@ -2,7 +2,7 @@
#include "..\libSceCommonDialog\types.h"
#include "codes.h"
enum SceNgs2WaveFormType : uint32_t {
enum class SceNgs2WaveFormType : uint32_t {
NONE = 0,
PCM_I8 = 0x10,
@ -25,16 +25,30 @@ enum SceNgs2WaveFormType : uint32_t {
VAG = 0x1C,
ATRAC9 = 0x40,
MAX_TYPES
/* More? */
};
enum SceNgs2ChannelsCount : uint32_t {
enum class SceNgs2ChannelsCount : uint32_t {
CH_1_0 = 1,
CH_2_0 = 2,
CH_5_1 = 6,
CH_7_1 = 8,
INVALID = 0xFFFFFFFF
};
enum class SceNgs2VoiceParam : uint32_t {
SET_MATRIX_LEVELS = 1,
SET_PORT_VOLUME,
SET_PORT_MATRIX,
SET_PORT_DELAY,
PATCH,
KICK_EVENT,
SET_CALLBACK,
};
struct SceNgs2ContextBufferInfo {
@ -47,7 +61,7 @@ struct SceNgs2ContextBufferInfo {
struct SceNgs2BufferAllocator {
int32_t (*allocHandler)(SceNgs2ContextBufferInfo*);
int32_t (*freeHandler)(SceNgs2ContextBufferInfo*);
void* userData;
void* userData;
};
struct SceNgs2Handle {
@ -65,34 +79,35 @@ struct SceNgs2WaveformInfo {
SceNgs2WaveFormType type;
SceNgs2ChannelsCount channelsCount;
uint32_t sampleRate;
uint32_t : 32;
uint32_t : 32;
uint32_t : 32;
uint32_t configData;
uint32_t frameOffset;
uint32_t frameMargin;
};
struct SceNgs2WaveformBlock {
uint32_t offset;
uint32_t size;
uint32_t : 32;
uint32_t : 32;
uint32_t : 32;
uintptr_t : 64;
uint32_t : 32;
uint32_t : 32;
uint32_t : 32;
uint32_t : 32;
uintptr_t userData;
};
struct SceNgs2WaveformFormat {
SceNgs2WaveformInfo info;
uint32_t offset;
uint32_t size;
uint32_t : 32;
uint32_t : 32;
uint32_t samplesCount;
uint32_t : 32;
uint32_t loopBeginPos;
uint32_t loopEndPos;
uint32_t samplesCount;
uint32_t : 32;
uint32_t : 32;
uint32_t : 32;
uint32_t : 32;
uint32_t : 32;
uint32_t : 32;
uint32_t numBlocks;
SceNgs2WaveformBlock block[4];
};
@ -121,3 +136,90 @@ struct SceNgs2GeomSourceParam {
SceNgs2GeomVector dir;
/* todo */
};
struct SceNgs2VoiceParamHead {
uint16_t size;
int16_t next;
SceNgs2VoiceParam id;
};
struct SceNgs2VoiceMatrixLevelsParam {
SceNgs2VoiceParamHead header;
uint32_t matrixId;
uint32_t numLevels;
const float* aLevel;
};
struct SceNgs2VoicePortMatrixParam {
SceNgs2VoiceParamHead header;
uint32_t port;
int32_t matrixId;
};
struct SceNgs2VoicePortVolumeParam {
SceNgs2VoiceParamHead header;
uint32_t port;
float level;
};
struct SceNgs2VoicePortDelayParam {
SceNgs2VoiceParamHead header;
uint32_t port;
uint32_t numSamples;
};
struct SceNgs2VoicePatchParam {
SceNgs2VoiceParamHead header;
uint32_t port;
uint32_t destInputId;
SceNgs2Handle destHandle;
};
struct SceNgs2VoiceEventParam {
SceNgs2VoiceParamHead header;
uint32_t eventId;
};
struct SceNgs2VoiceCallbackInfo {
uintptr_t callbackData;
SceNgs2Handle voiceHandle;
uint32_t flag;
uint32_t reserved;
union {
struct {
uintptr_t userData;
const void* data;
uint32_t dataSize;
uint32_t repeatedCount;
uint32_t attributeFlags;
uint32_t reserved2;
} waveformBlock;
} param;
};
typedef void (*SceNgs2VoiceCallbackHandler)(const SceNgs2VoiceCallbackInfo* info);
struct SceNgs2VoiceCallbackParam {
SceNgs2VoiceParamHead header;
SceNgs2VoiceCallbackHandler callbackHandler;
uintptr_t callbackData;
uint32_t flags;
uint32_t reserved;
};
struct SceNgs2VoiceState {
uint32_t stateFlags;
};
struct SceNgs2RackOption {
size_t size;
char name[SCE_NGS2_RACK_NAME_LENGTH];
uint32_t flags;
uint32_t maxGrainSamples;
uint32_t maxVoices;
uint32_t maxInputDelayBlocks;
uint32_t maxMatrices;
uint32_t maxPorts;
uint32_t aReserved[20];
};

View File

@ -5,15 +5,15 @@ constexpr uint32_t SCE_NP_ONLINEID_MIN_LENGTH = 3;
constexpr uint32_t SCE_NP_ONLINEID_MAX_LENGTH = 16;
/* Online ID */
typedef struct SceNpOnlineId {
struct SceNpOnlineId {
char data[SCE_NP_ONLINEID_MAX_LENGTH];
char term;
char dummy[3];
} SceNpOnlineId;
};
/* NP ID */
typedef struct SceNpId {
struct SceNpId {
SceNpOnlineId handle;
uint8_t opt[8];
uint8_t reserved[8];
} SceNpId;
};

View File

@ -8,17 +8,17 @@ typedef int64_t SceNpScoreValue;
typedef uint32_t SceNpScoreRankNumber;
typedef int32_t SceNpScorePcId;
typedef struct SceNpScoreGameInfo {
struct SceNpScoreGameInfo {
size_t infoSize;
uint8_t data[SCE_NP_SCORE_GAMEINFO_MAXSIZE];
uint8_t pad2[3];
} SceNpScoreGameInfo;
};
typedef struct SceNpScoreComment {
struct SceNpScoreComment {
char utf8Comment[SCE_NP_SCORE_COMMENT_MAXLEN + 1];
} SceNpScoreComment;
};
typedef struct SceNpScoreRankDataA {
struct SceNpScoreRankDataA {
SceNpOnlineId onlineId;
uint8_t reserved0[16];
uint8_t reserved[49];
@ -33,9 +33,9 @@ typedef struct SceNpScoreRankDataA {
SceRtcTick recordDate;
SceNpAccountId accountId;
uint8_t pad2[8];
} SceNpScoreRankDataA;
};
typedef struct SceNpScoreRankDataForCrossSave {
struct SceNpScoreRankDataForCrossSave {
SceNpId npId;
uint8_t reserved[49];
uint8_t pad0[3];
@ -49,36 +49,36 @@ typedef struct SceNpScoreRankDataForCrossSave {
SceRtcTick recordDate;
SceNpAccountId accountId;
uint8_t pad2[8];
} SceNpScoreRankDataForCrossSave;
};
typedef struct SceNpScorePlayerRankDataA {
struct SceNpScorePlayerRankDataA {
int32_t hasData;
uint8_t pad0[4];
SceNpScoreRankDataA rankData;
} SceNpScorePlayerRankDataA;
};
typedef struct SceNpScorePlayerRankDataForCrossSave {
struct SceNpScorePlayerRankDataForCrossSave {
int32_t hasData;
uint8_t pad0[4];
SceNpScoreRankDataForCrossSave rankData;
} SceNpScorePlayerRankDataForCrossSave;
};
typedef struct SceNpScoreBoardInfo {
struct SceNpScoreBoardInfo {
uint32_t rankLimit;
uint32_t updateMode;
uint32_t sortMode;
SceNpScoreRankNumber uploadNumLimit;
size_t uploadSizeLimit;
} SceNpScoreBoardInfo;
};
typedef struct SceNpScoreAccountIdPcId {
struct SceNpScoreAccountIdPcId {
SceNpAccountId accountId;
SceNpScorePcId pcId;
uint8_t pad[4];
} SceNpScoreAccountIdPcId;
};
typedef struct SceNpScoreGetFriendRankingOptParam {
struct SceNpScoreGetFriendRankingOptParam {
size_t size;
SceNpScoreRankNumber* startSerialRank;
SceNpScoreRankNumber* hits;
} SceNpScoreGetFriendRankingOptParam;
};

View File

@ -24,9 +24,9 @@ constexpr uint32_t SCE_NP_TROPHY_FLAG_BITS_SHIFT = (5);
constexpr uint32_t SCE_NP_TROPHY_FLAG_BITS_MASK = (SCE_NP_TROPHY_FLAG_BITS - 1);
constexpr uint32_t SCE_NP_TROPHY_FLAG_BITS_MAX = (SCE_NP_TROPHY_FLAG_SETSIZE - 1);
typedef struct SceNpTrophyFlagArray {
struct SceNpTrophyFlagArray {
SceNpTrophyFlagMask flagBits[SCE_NP_TROPHY_FLAG_SETSIZE >> SCE_NP_TROPHY_FLAG_BITS_SHIFT];
} SceNpTrophyFlagArray;
};
#define SCE_NP_TROPHY_FLAG_SET(n, p) ((p)->flagBits[(n) >> SCE_NP_TROPHY_FLAG_BITS_SHIFT] |= (1 << ((n) & SCE_NP_TROPHY_FLAG_BITS_MASK)))
#define SCE_NP_TROPHY_FLAG_CLR(n, p) ((p)->flagBits[(n) >> SCE_NP_TROPHY_FLAG_BITS_SHIFT] &= ~(1 << ((n) & SCE_NP_TROPHY_FLAG_BITS_MASK)))
@ -46,7 +46,7 @@ typedef struct SceNpTrophyFlagArray {
__fa->flagBits[__i] = SCE_NP_TROPHY_FLAG_BITS_ALL; \
} while (0)
typedef struct SceNpTrophyGameDetails {
struct SceNpTrophyGameDetails {
size_t size;
uint32_t numGroups;
uint32_t numTrophies;
@ -56,9 +56,9 @@ typedef struct SceNpTrophyGameDetails {
uint32_t numBronze;
char title[SCE_NP_TROPHY_GAME_TITLE_MAX_SIZE];
char description[SCE_NP_TROPHY_GAME_DESCR_MAX_SIZE];
} SceNpTrophyGameDetails;
};
typedef struct SceNpTrophyGameData {
struct SceNpTrophyGameData {
size_t size;
uint32_t unlockedTrophies;
uint32_t unlockedPlatinum;
@ -66,9 +66,9 @@ typedef struct SceNpTrophyGameData {
uint32_t unlockedSilver;
uint32_t unlockedBronze;
uint32_t progressPercentage;
} SceNpTrophyGameData;
};
typedef struct SceNpTrophyGroupDetails {
struct SceNpTrophyGroupDetails {
size_t size;
SceNpTrophyGroupId groupId;
uint32_t numTrophies;
@ -78,9 +78,9 @@ typedef struct SceNpTrophyGroupDetails {
uint32_t numBronze;
char title[SCE_NP_TROPHY_GROUP_TITLE_MAX_SIZE];
char description[SCE_NP_TROPHY_GROUP_DESCR_MAX_SIZE];
} SceNpTrophyGroupDetails;
};
typedef struct SceNpTrophyGroupData {
struct SceNpTrophyGroupData {
size_t size;
SceNpTrophyGroupId groupId;
uint32_t unlockedTrophies;
@ -90,9 +90,9 @@ typedef struct SceNpTrophyGroupData {
uint32_t unlockedBronze;
uint32_t progressPercentage;
uint8_t reserved[4];
} SceNpTrophyGroupData;
};
typedef struct SceNpTrophyDetails {
struct SceNpTrophyDetails {
size_t size;
SceNpTrophyId trophyId;
SceNpTrophyGrade trophyGrade;
@ -101,17 +101,17 @@ typedef struct SceNpTrophyDetails {
uint8_t reserved[3];
char name[SCE_NP_TROPHY_NAME_MAX_SIZE];
char description[SCE_NP_TROPHY_DESCR_MAX_SIZE];
} SceNpTrophyDetails;
};
typedef struct SceNpTrophyData {
struct SceNpTrophyData {
size_t size;
SceNpTrophyId trophyId;
bool unlocked;
uint8_t reserved[3];
uint64_t timestamp;
} SceNpTrophyData;
};
typedef struct SceNpTrophyScreenshotTarget {
struct SceNpTrophyScreenshotTarget {
SceNpTrophyContext context;
SceNpTrophyId trophyId;
} SceNpTrophyScreenshotTarget;
};

View File

@ -46,7 +46,7 @@ struct SceSaveDataFingerprint {
char padding[15];
};
typedef struct _SceSaveDataInitParams3 SceSaveDataInitParams3;
struct SceSaveDataInitParams3;
struct SceSaveDataMount {
int userId;
@ -233,7 +233,7 @@ struct SceSaveDataMemorySet2 {
uint8_t reserved[24];
};
typedef struct _SceSaveDataEventParam SceSaveDataEventParam;
struct SceSaveDataEventParam;
struct SceSaveDataEvent {
SceSaveDataEventType type;

View File

@ -200,7 +200,7 @@ EXPORT SYSV_ABI int32_t sceSystemServiceDisableSuspendConfirmationDialog() {
return Ok;
}
typedef struct SceSystemServiceAbnormalTerminationInfo SceSystemServiceAbnormalTerminationInfo;
struct SceSystemServiceAbnormalTerminationInfo;
EXPORT SYSV_ABI int32_t sceSystemServiceReportAbnormalTermination(const SceSystemServiceAbnormalTerminationInfo* info) {
LOG_USE_MODULE(libSceSystemService);

View File

@ -127,12 +127,12 @@ struct SceVideoOutMode {
uint32_t _reserved[1];
};
typedef struct SceVideoOutVrViewCropAdjustment {
struct SceVideoOutVrViewCropAdjustment {
int16_t verticalOffset;
int16_t reserved0;
int32_t reserved1[3];
} SceVideoOutVrViewCropAdjustment;
};
struct SceVideoOutConfigureOptions {
SceVideoOutVrViewCropAdjustment vrViewCropAdjustment;
};
};