From 60261408c2413176ac5dfaa00eee0605711914cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexandro=20S=C3=A1nchez=20Bach?= Date: Sat, 9 Nov 2013 02:05:58 +0100 Subject: [PATCH] Merge branch 'master' of https://github.com/AlexAltea/rpcs3 NOTE: I included some changes of the forks of O1L and Dante38490 to my fork. However, a conflict appeared while merging their sources with the ones of DH. I had to resolve this conflict manually and push all the changes like a new commit, that's why there changes weren't recorded individually and (probably) won't appear at in the commits list. I am very sorry for this, I'll try to avoid this in the future. In order to preserve the authors of those commits, I write this list here: O1L: Dummy Modules (cellAudio, cellSaveData, and more) https://github.com/O1L/rpcs3/commit/23ece01a0b6381cbbf70f87d6fa5d8d38094a1d3 https://github.com/O1L/rpcs3/commit/784fc571b3d5d7b4a59e52b27c2abba866e6f225 Dante38490: Spotted and fixed an issue in git-version-gen.cmd https://github.com/Dante38490/rpcs3/commit/44e8867125deff3cecc29c6ed42f3a6fda998e5a Regarding my changes: * New lv2 SysCalls implemented (and others improved) * SDATA unpacker implemented * Changed layout of sc_table --- Utilities/git-version-gen.cmd | 2 +- bin/dev_hdd1/.gitignore | 4 + rpcs3/Emu/FS/VFS.cpp | 5 + rpcs3/Emu/SysCalls/Modules/cellAudio.cpp | 943 ++++++++++++++++++ .../Emu/SysCalls/Modules/cellPhotoDecode.cpp | 15 + .../Emu/SysCalls/Modules/cellPhotoImport.cpp | 24 + rpcs3/Emu/SysCalls/Modules/cellSaveData.cpp | 413 ++++++++ rpcs3/Emu/SysCalls/Modules/cellScreenshot.cpp | 13 +- rpcs3/Emu/SysCalls/Modules/cellSysutil.cpp | 16 +- rpcs3/Emu/SysCalls/Modules/sys_fs.cpp | 131 +++ rpcs3/Emu/SysCalls/SysCalls.cpp | 122 ++- rpcs3/Emu/SysCalls/SysCalls.h | 55 + rpcs3/Emu/SysCalls/lv2/SC_PPU_Thread.cpp | 7 + rpcs3/Emu/SysCalls/lv2/SC_Process.cpp | 227 ++++- rpcs3/Emu/SysCalls/lv2/SC_RSX.cpp | 76 ++ rpcs3/Emu/SysCalls/lv2/SC_Rwlock.cpp | 53 + rpcs3/Emu/SysCalls/lv2/SC_Rwlock.h | 12 + rpcs3/Emu/SysCalls/lv2/SC_Time.cpp | 11 + rpcs3/Emu/SysCalls/lv2/SC_Timer.cpp | 110 ++ rpcs3/Emu/SysCalls/lv2/SC_Timer.h | 23 + rpcs3/Emu/SysCalls/lv2/SC_Trace.cpp | 64 ++ rpcs3/Gui/MainFrame.cpp | 7 +- rpcs3/rpcs3.vcxproj | 7 +- rpcs3/rpcs3.vcxproj.filters | 17 +- 24 files changed, 2323 insertions(+), 34 deletions(-) create mode 100644 bin/dev_hdd1/.gitignore create mode 100644 rpcs3/Emu/SysCalls/Modules/cellAudio.cpp create mode 100644 rpcs3/Emu/SysCalls/Modules/cellSaveData.cpp create mode 100644 rpcs3/Emu/SysCalls/lv2/SC_RSX.cpp create mode 100644 rpcs3/Emu/SysCalls/lv2/SC_Rwlock.cpp create mode 100644 rpcs3/Emu/SysCalls/lv2/SC_Rwlock.h create mode 100644 rpcs3/Emu/SysCalls/lv2/SC_Timer.cpp create mode 100644 rpcs3/Emu/SysCalls/lv2/SC_Timer.h create mode 100644 rpcs3/Emu/SysCalls/lv2/SC_Trace.cpp diff --git a/Utilities/git-version-gen.cmd b/Utilities/git-version-gen.cmd index 3cd4334b4a..d3a198846f 100644 --- a/Utilities/git-version-gen.cmd +++ b/Utilities/git-version-gen.cmd @@ -13,7 +13,7 @@ rem // A copy of the GPL 2.0 should have been included with the program. rem // If not, see http://www.gnu.org/licenses/ rem // Official git repository and contact information can be found at -rem // https://github.com/hrydgard/RPCS3 and http://www.RPCS3.org/. +rem // https://github.com/DHrpcs3/rpcs3 and http://code.google.com/p/rpcs3/. setlocal ENABLEDELAYEDEXPANSION diff --git a/bin/dev_hdd1/.gitignore b/bin/dev_hdd1/.gitignore new file mode 100644 index 0000000000..86d0cb2726 --- /dev/null +++ b/bin/dev_hdd1/.gitignore @@ -0,0 +1,4 @@ +# Ignore everything in this directory +* +# Except this file +!.gitignore \ No newline at end of file diff --git a/rpcs3/Emu/FS/VFS.cpp b/rpcs3/Emu/FS/VFS.cpp index cadc26b6a5..fb1874f5bc 100644 --- a/rpcs3/Emu/FS/VFS.cpp +++ b/rpcs3/Emu/FS/VFS.cpp @@ -170,6 +170,11 @@ void VFS::SaveLoadDevices(Array& res, bool is_load) res[idx].path = "$(EmulatorDir)\\dev_hdd0\\"; res[idx].mount = "/dev_hdd0/"; res[idx].device = vfsDevice_LocalFile; + + idx = res.Move(new VFSManagerEntry()); + res[idx].path = "$(EmulatorDir)\\dev_hdd1\\"; + res[idx].mount = "/dev_hdd1/"; + res[idx].device = vfsDevice_LocalFile; /* idx = res.Move(new VFSManagerEntry()); res[idx].path = "$(GameDir)"; diff --git a/rpcs3/Emu/SysCalls/Modules/cellAudio.cpp b/rpcs3/Emu/SysCalls/Modules/cellAudio.cpp new file mode 100644 index 0000000000..1c72cbcae2 --- /dev/null +++ b/rpcs3/Emu/SysCalls/Modules/cellAudio.cpp @@ -0,0 +1,943 @@ +#include "stdafx.h" +#include "Emu/SysCalls/SysCalls.h" +#include "Emu/SysCalls/SC_FUNC.h" + +void cellAudio_init(); +Module cellAudio(0x0011, cellAudio_init); + +enum +{ + //libaudio Error Codes + CELL_AUDIO_ERROR_ALREADY_INIT = 0x80310701, + CELL_AUDIO_ERROR_AUDIOSYSTEM = 0x80310702, + CELL_AUDIO_ERROR_NOT_INIT = 0x80310703, + CELL_AUDIO_ERROR_PARAM = 0x80310704, + CELL_AUDIO_ERROR_PORT_FULL = 0x80310705, + CELL_AUDIO_ERROR_PORT_ALREADY_RUN = 0x80310706, + CELL_AUDIO_ERROR_PORT_NOT_OPEN = 0x80310707, + CELL_AUDIO_ERROR_PORT_NOT_RUN = 0x80310708, + CELL_AUDIO_ERROR_TRANS_EVENT = 0x80310709, + CELL_AUDIO_ERROR_PORT_OPEN = 0x8031070a, + CELL_AUDIO_ERROR_SHAREDMEMORY = 0x8031070b, + CELL_AUDIO_ERROR_MUTEX = 0x8031070c, + CELL_AUDIO_ERROR_EVENT_QUEUE = 0x8031070d, + CELL_AUDIO_ERROR_AUDIOSYSTEM_NOT_FOUND = 0x8031070e, + CELL_AUDIO_ERROR_TAG_NOT_FOUND = 0x8031070f, + + //libmixer Error Codes + CELL_LIBMIXER_ERROR_NOT_INITIALIZED = 0x80310002, + CELL_LIBMIXER_ERROR_INVALID_PARAMATER = 0x80310003, + CELL_LIBMIXER_ERROR_NO_MEMORY = 0x80310005, + CELL_LIBMIXER_ERROR_ALREADY_EXIST = 0x80310006, + CELL_LIBMIXER_ERROR_FULL = 0x80310007, + CELL_LIBMIXER_ERROR_NOT_EXIST = 0x80310008, + CELL_LIBMIXER_ERROR_TYPE_MISMATCH = 0x80310009, + CELL_LIBMIXER_ERROR_NOT_FOUND = 0x8031000a, + + //libsnd3 Error Codes + CELL_SND3_ERROR_PARAM = 0x80310301, + CELL_SND3_ERROR_CREATE_MUTEX = 0x80310302, + CELL_SND3_ERROR_SYNTH = 0x80310303, + CELL_SND3_ERROR_ALREADY = 0x80310304, + CELL_SND3_ERROR_NOTINIT = 0x80310305, + CELL_SND3_ERROR_SMFFULL = 0x80310306, + CELL_SND3_ERROR_HD3ID = 0x80310307, + CELL_SND3_ERROR_SMF = 0x80310308, + CELL_SND3_ERROR_SMFCTX = 0x80310309, + CELL_SND3_ERROR_FORMAT = 0x8031030a, + CELL_SND3_ERROR_SMFID = 0x8031030b, + CELL_SND3_ERROR_SOUNDDATAFULL = 0x8031030c, + CELL_SND3_ERROR_VOICENUM = 0x8031030d, + CELL_SND3_ERROR_RESERVEDVOICE = 0x8031030e, + CELL_SND3_ERROR_REQUESTQUEFULL = 0x8031030f, + CELL_SND3_ERROR_OUTPUTMODE = 0x80310310, + + //libsynt2 Error Codes + CELL_SOUND_SYNTH2_ERROR_FATAL = 0x80310201, + CELL_SOUND_SYNTH2_ERROR_INVALID_PARAMETER = 0x80310202, + CELL_SOUND_SYNTH2_ERROR_ALREADY_INITIALIZED = 0x80310203, +}; + + +//libaudio datatypes +struct CellAudioPortParam +{ + u64 nChannel; + u64 nBlock; + u64 attr; + float level; +}; + +struct CellAudioPortConfig +{ + u32 readIndexAddr; + u32 status; + u64 nChannel; + u64 nBlock; + u32 portSize; + u32 portAddr; +}; + +CellAudioPortParam current_AudioPortParam; +CellAudioPortConfig current_AudioPortConfig; + +//libmixer datatypes +typedef void * CellAANHandle; + +struct CellSSPlayerConfig +{ + u32 channels; + u32 outputMode; +}; + +struct CellSSPlayerWaveParam +{ + void *addr; + int format; + u32 samples; + u32 loopStartOffset; + u32 startOffset; +}; + +struct CellSSPlayerCommonParam +{ + u32 loopMode; + u32 attackMode; +}; + +struct CellSurMixerPosition +{ + float x; + float y; + float z; +}; + +struct CellSSPlayerRuntimeInfo +{ + float level; + float speed; + CellSurMixerPosition position; +}; + +struct CellSurMixerConfig +{ + s32 priority; + u32 chStrips1; + u32 chStrips2; + u32 chStrips6; + u32 chStrips8; +}; + +struct CellSurMixerChStripParam +{ + u32 param; + void *attribute; + int dBSwitch; + float floatVal; + int intVal; +}; + +CellSSPlayerWaveParam current_SSPlayerWaveParam; + +//libsnd3 datatypes +struct CellSnd3DataCtx +{ + s8 system; //[CELL_SND3_DATA_CTX_SIZE], unknown identifier +}; + +struct CellSnd3SmfCtx +{ + s8 system; //[CELL_SND3_SMF_CTX_SIZE], unknown identifier +}; + +struct CellSnd3KeyOnParam +{ + u8 vel; + u8 pan; + u8 panEx; + s32 addPitch; +}; + +struct CellSnd3VoiceBitCtx +{ + u32 core; //[CELL_SND3_MAX_CORE], unknown identifier +}; + +struct CellSnd3RequestQueueCtx +{ + void *frontQueue; + u32 frontQueueSize; + void *rearQueue; + u32 rearQueueSize; +}; + +//libsynt2 datatypes +struct CellSoundSynth2EffectAttr +{ + u16 core; + u16 mode; + s16 depth_L; + s16 depth_R; + u16 delay; + u16 feedback; +}; + +// libaudio Functions +bool g_is_audio_initialized = false; + +int cellAudioInit() +{ + UNIMPLEMENTED_FUNC(cellAudio); + if(g_is_audio_initialized) return CELL_AUDIO_ERROR_ALREADY_INIT; + g_is_audio_initialized = true; + return CELL_OK; +} + +int cellAudioQuit() +{ + UNIMPLEMENTED_FUNC(cellAudio); + if (g_is_audio_initialized) return CELL_AUDIO_ERROR_NOT_INIT; + g_is_audio_initialized = false; + return CELL_OK; +} + +// Audio Ports Setting/Operation Functions +bool g_is_audio_port_open = false; +bool g_is_audio_port_start = false; + +int cellAudioPortOpen() //CellAudioPortParam *audioParam, u32 *portNum +{ + UNIMPLEMENTED_FUNC(cellAudio); + if(g_is_audio_port_open) return CELL_AUDIO_ERROR_PORT_OPEN; + g_is_audio_port_open = true; + return CELL_OK; +} + +int cellAudioPortClose(u32 portNum) +{ + UNIMPLEMENTED_FUNC(cellAudio); + if(g_is_audio_port_open) return CELL_AUDIO_ERROR_PORT_NOT_OPEN; + g_is_audio_port_open = false; + return CELL_OK; +} + +int cellAudioPortStart(u32 portNum) +{ + UNIMPLEMENTED_FUNC(cellAudio); + if(g_is_audio_port_start) return CELL_AUDIO_ERROR_PORT_ALREADY_RUN; + g_is_audio_port_start = true; + return CELL_OK; +} + +int cellAudioPortStop(u32 portNum) +{ + UNIMPLEMENTED_FUNC(cellAudio); + if(g_is_audio_port_start) return CELL_AUDIO_ERROR_PORT_NOT_RUN; + g_is_audio_port_start = false; + return CELL_OK; +} + +int cellAudioGetPortTimestamp() //u32 portNum, u64 tag, u64 *stamp +{ + UNIMPLEMENTED_FUNC(cellAudio); + return CELL_OK; +} + +int cellAudioGetPortConfig() //u32 portNum, CellAudioPortConfig *portConfig +{ + UNIMPLEMENTED_FUNC(cellAudio); + return CELL_OK; +} + +int cellAudioGetPortBlockTag() //u32 portNum, u64 blockNo, u64 *tag +{ + UNIMPLEMENTED_FUNC (cellAudio); + return CELL_OK; +} + +int cellAudioSetPortLevel(u32 portNum, float level) +{ + UNIMPLEMENTED_FUNC(cellAudio); + return CELL_OK; +} + +// Utility Functions +int cellAudioCreateNotifyEventQueue() //u32 *id, u64 *key +{ + UNIMPLEMENTED_FUNC(cellAudio); + return CELL_OK; +} + +int cellAudioCreateNotifyEventQueueEx(u32 *id, u64 *key, u32 iFlags) +{ + UNIMPLEMENTED_FUNC(cellAudio); + return CELL_OK; +} + +int cellAudioSetNotifyEventQueue(u64 key) +{ + UNIMPLEMENTED_FUNC(cellAudio); + return CELL_OK; +} + +int cellAudioSetNotifyEventQueueEx(u64 key, u32 iFlags) +{ + UNIMPLEMENTED_FUNC(cellAudio); + return CELL_OK; +} + +int cellAudioRemoveNotifyEventQueue(u64 key) +{ + UNIMPLEMENTED_FUNC(cellAudio); + return CELL_OK; +} + +int cellAudioRemoveNotifyEventQueueEx(u64 key, u32 iFlags) +{ + UNIMPLEMENTED_FUNC(cellAudio); + return CELL_OK; +} + +int cellAudioAddData() //u32 portNum, float *src, unsigned int samples, float volume +{ + UNIMPLEMENTED_FUNC(cellAudio); + return CELL_OK; +} + +int cellAudioAdd2chData() //u32 portNum, float *src, unsigned int samples, float volume +{ + UNIMPLEMENTED_FUNC(cellAudio); + return CELL_OK; +} + +int cellAudioMiscSetAccessoryVolume(u32 devNum, float volume) +{ + UNIMPLEMENTED_FUNC(cellAudio); + return CELL_OK; +} + +int cellAudioSendAck(u64 data3) +{ + UNIMPLEMENTED_FUNC(cellAudio); + return CELL_OK; +} + +int cellAudioSetPersonalDevice(int iPersonalStream, int iDevice) +{ + UNIMPLEMENTED_FUNC(cellAudio); + return CELL_OK; +} + +int cellAudioUnsetPersonalDevice(int iPersonalStream) +{ + UNIMPLEMENTED_FUNC(cellAudio); + return CELL_OK; +} + +int cellAudioAdd6chData(u32 portNum, float *src, float volume) +{ + UNIMPLEMENTED_FUNC(cellAudio); + return CELL_OK; +} + +//Callback Functions +typedef int (*CellSurMixerNotifyCallbackFunction)(void *arg, u32 counter, u32 samples); //Currently unused. + +// libmixer Functions, NOT active in this moment +int cellAANConnect(CellAANHandle receive, u32 receivePortNo, CellAANHandle source, u32 sourcePortNo) +{ + UNIMPLEMENTED_FUNC(cellAudio); + return 0; +} + +int cellAANDisconnect(CellAANHandle receive, u32 receivePortNo, CellAANHandle source, u32 sourcePortNo) +{ + UNIMPLEMENTED_FUNC(cellAudio); + return 0; +} + +int cellAANAddData(CellAANHandle handle, u32 port, u32 offset, float *addr, u32 samples) +{ + UNIMPLEMENTED_FUNC(cellAudio); + return 0; +} + +int cellSSPlayerCreate(CellAANHandle *handle, CellSSPlayerConfig *config) +{ + UNIMPLEMENTED_FUNC(cellAudio); + return 0; +} + +int cellSSPlayerRemove(CellAANHandle handle) +{ + UNIMPLEMENTED_FUNC(cellAudio); + return 0; +} + +int cellSSPlayerSetWave() //CellAANHandle handle, CellSSPlayerWaveParam *waveInfo, CellSSPlayerCommonParam *commonInfo //mem_class_t waveInfo +{ + UNIMPLEMENTED_FUNC(cellAudio); + return 0; +} + +int cellSSPlayerPlay() //CellAANHandle handle, CellSSPlayerRuntimeInfo *info +{ + UNIMPLEMENTED_FUNC(cellAudio); + return 0; +} + +int cellSSPlayerStop() //CellAANHandle handle, u32 mode +{ + UNIMPLEMENTED_FUNC(cellAudio); + return 0; +} + +int cellSSPlayerSetParam() //CellAANHandle handle, CellSSPlayerRuntimeInfo *info +{ + UNIMPLEMENTED_FUNC(cellAudio); + return 0; +} + +s32 cellSSPlayerGetState() //CellAANHandle handle +{ + UNIMPLEMENTED_FUNC(cellAudio); + return 0; +} + +int cellSurMixerCreate() //const CellSurMixerConfig *config +{ + UNIMPLEMENTED_FUNC(cellAudio); + return 0; +} + +int cellSurMixerGetAANHandle() //CellAANHandle *handle +{ + UNIMPLEMENTED_FUNC(cellAudio); + return 0; +} + +int cellSurMixerChStripGetAANPortNo() //u32 *port, u32 type, u32 index +{ + UNIMPLEMENTED_FUNC(cellAudio); + return 0; +} + +int cellSurMixerSetNotifyCallback() //CellSurMixerNotifyCallbackFunction callback, void *arg +{ + UNIMPLEMENTED_FUNC(cellAudio); + return 0; +} + +int cellSurMixerRemoveNotifyCallback() //CellSurMixerNotifyCallbackFunction callback +{ + UNIMPLEMENTED_FUNC(cellAudio); + return 0; +} + +int cellSurMixerStart() +{ + UNIMPLEMENTED_FUNC(cellAudio); + return 0; +} + +int cellSurMixerSurBusAddData() //u32 busNo, u32 offset, float *addr, u32 samples +{ + UNIMPLEMENTED_FUNC(cellAudio); + return 0; +} + +int cellSurMixerSetParameter() //u32 param, float value +{ + UNIMPLEMENTED_FUNC(cellAudio); + return 0; +} + +int cellSurMixerChStripSetParameter() //u32 type, u32 index, CellSurMixerChStripParam *param +{ + UNIMPLEMENTED_FUNC(cellAudio); + return 0; +} + +int cellSurMixerPause() //u32 switch +{ + UNIMPLEMENTED_FUNC(cellAudio); + return 0; +} + +int cellSurMixerGetCurrentBlockTag() //u64 *tag +{ + UNIMPLEMENTED_FUNC(cellAudio); + return 0; +} + +int cellSurMixerGetTimestamp() //u64 tag, u64 *stamp +{ + UNIMPLEMENTED_FUNC(cellAudio); + return 0; +} + +void cellSurMixerBeep(); //void *arg + +float cellSurMixerUtilGetLevelFromDB() //float dB +{ + UNIMPLEMENTED_FUNC(cellAudio); + return CELL_OK; //it's NOT real value + //TODO; +} + +float cellSurMixerUtilGetLevelFromDBIndex() //int index +{ + UNIMPLEMENTED_FUNC(cellAudio); + return CELL_OK; //it's NOT real value + //TODO; +} + +float cellSurMixerUtilNoteToRatio() //unsigned char refNote, unsigned char note +{ + UNIMPLEMENTED_FUNC(cellAudio); + return CELL_OK; //it's NOT real value + //TODO +} + +int cellSurMixerFinalize(); //Currently unused. Returns 0 (in the current release). + +//*libsnd3 Functions, NOT active in this moment +s32 cellSnd3Init() //u32 maxVoice, u32 samples, CellSnd3RequestQueueCtx *queue +{ + UNIMPLEMENTED_FUNC(cellAudio); + return CELL_OK; +} + +s32 cellSnd3Exit() +{ + UNIMPLEMENTED_FUNC(cellAudio); + return CELL_OK; +} + +s32 cellSnd3SetOutputMode() //u32 mode +{ + UNIMPLEMENTED_FUNC(cellAudio); + return CELL_OK; +} + +s32 cellSnd3Synthesis() //float *pOutL, float *pOutR +{ + UNIMPLEMENTED_FUNC(cellAudio); + return CELL_OK; +} + +s32 cellSnd3SynthesisEx() //float *pOutL, float *pOutR, float *pOutRL, float *pOutRR +{ + UNIMPLEMENTED_FUNC(cellAudio); + return CELL_OK; +} + +s32 cellSnd3VoiceSetReserveMode() //u32 voiceNum, u32 reserveMode +{ + UNIMPLEMENTED_FUNC(cellAudio); + return CELL_OK; +} + +s32 cellSnd3BindSoundData() //CellSnd3DataCtx *snd3Ctx, void *hd3, u32 synthMemOffset +{ + UNIMPLEMENTED_FUNC(cellAudio); + return CELL_OK; +} + +s32 cellSnd3UnbindSoundData(u32 hd3ID) +{ + UNIMPLEMENTED_FUNC(cellAudio); + return CELL_OK; +} + +s32 cellSnd3NoteOnByTone() //u32 hd3ID, u32 toneIndex, u32 note, u32 keyOnID, CellSnd3KeyOnParam *keyOnParam +{ + UNIMPLEMENTED_FUNC(cellAudio); + return CELL_OK; //it's NOT real value + //TODO +} + +s32 cellSnd3KeyOnByTone() //u32 hd3ID, u32 toneIndex, u32 pitch,u32 keyOnID,CellSnd3KeyOnParam *keyOnParam +{ + UNIMPLEMENTED_FUNC(cellAudio); + return CELL_OK; //it's NOT real value + //TODO +} + +s32 cellSnd3VoiceNoteOnByTone() //u32 hd3ID, u32 voiceNum, u32 toneIndex, u32 note, u32 keyOnID, CellSnd3KeyOnParam *keyOnParam +{ + UNIMPLEMENTED_FUNC(cellAudio); + return CELL_OK; //it's NOT real value + //TODO +} + +s32 cellSnd3VoiceKeyOnByTone() //u32 hd3ID, u32 voiceNum, u32 toneIndex, u32 pitch, u32 keyOnID, CellSnd3KeyOnParam *keyOnParam +{ + UNIMPLEMENTED_FUNC(cellAudio); + return CELL_OK; //it's NOT real value + //TODO +} + +s32 cellSnd3VoiceSetSustainHold(u32 voiceNum, u32 sustainHold) +{ + UNIMPLEMENTED_FUNC(cellAudio); + return CELL_OK; +} + +s32 cellSnd3VoiceKeyOff(u32 voiceNum) +{ + UNIMPLEMENTED_FUNC(cellAudio); + return CELL_OK; +} + +s32 cellSnd3VoiceSetPitch(u32 voiceNum, s32 addPitch) +{ + UNIMPLEMENTED_FUNC(cellAudio); + return CELL_OK; +} + +s32 cellSnd3VoiceSetVelocity(u32 voiceNum, u32 velocity) +{ + UNIMPLEMENTED_FUNC(cellAudio); + return CELL_OK; +} + +s32 cellSnd3VoiceSetPanpot(u32 voiceNum, u32 panpot) +{ + UNIMPLEMENTED_FUNC(cellAudio); + return CELL_OK; +} + +s32 cellSnd3VoiceSetPanpotEx(u32 voiceNum, u32 panpotEx) +{ + UNIMPLEMENTED_FUNC(cellAudio); + return CELL_OK; +} + +s32 cellSnd3VoiceSetPitchBend(u32 voiceNum, u32 bendValue) +{ + UNIMPLEMENTED_FUNC(cellAudio); + return CELL_OK; +} + +s32 cellSnd3VoiceAllKeyOff() +{ + UNIMPLEMENTED_FUNC(cellAudio); + return CELL_OK; +} + +s32 cellSnd3VoiceGetEnvelope(u32 voiceNum) +{ + UNIMPLEMENTED_FUNC(cellAudio); + return CELL_OK; +} + +s32 cellSnd3VoiceGetStatus() //u32 voiceNum +{ + UNIMPLEMENTED_FUNC(cellAudio); + return CELL_OK; //it's NOT real value + //TODO +} + +u32 cellSnd3KeyOffByID(u32 keyOnID) +{ + UNIMPLEMENTED_FUNC(cellAudio); + return CELL_OK; +} + +s32 cellSnd3GetVoice() //u32 midiChannel, u32 keyOnID, CellSnd3VoiceBitCtx *voiceBit +{ + UNIMPLEMENTED_FUNC(cellAudio); + return CELL_OK; +} + +s32 cellSnd3GetVoiceByID() //u32 keyOnID, CellSnd3VoiceBitCtx *voiceBit +{ + UNIMPLEMENTED_FUNC(cellAudio); + return CELL_OK; +} + +s32 cellSnd3NoteOn() //u32 hd3ID, u32 midiChannel, u32 midiProgram, u32 midiNote, u32 sustain,CellSnd3KeyOnParam *keyOnParam, u32 keyOnID +{ + UNIMPLEMENTED_FUNC(cellAudio); + return CELL_OK; +} + +s32 cellSnd3NoteOff(u32 midiChannel, u32 midiNote, u32 keyOnID) +{ + UNIMPLEMENTED_FUNC(cellAudio); + return CELL_OK; +} + +s32 cellSnd3SetSustainHold(u32 midiChannel, u32 sustainHold, u32 ID) +{ + UNIMPLEMENTED_FUNC(cellAudio); + return CELL_OK; +} + +s32 cellSnd3SetEffectType(u16 effectType, s16 returnVol, u16 delay, u16 feedback) +{ + UNIMPLEMENTED_FUNC(cellAudio); + return CELL_OK; +} + +u16 cellSnd3Note2Pitch() //u16 center_note, u16 center_fine, u16 note, s16 fine +{ + UNIMPLEMENTED_FUNC(cellAudio); + return CELL_OK; //it's NOT real value + //TODO +} + +u16 cellSnd3Pitch2Note() //u16 center_note, u16 center_fine, u16 pitch +{ + UNIMPLEMENTED_FUNC(cellAudio); + return CELL_OK; //it's NOT real value + //TODO +} + +s32 cellSnd3SMFBind() //CellSnd3SmfCtx *smfCtx, void *smf, u32 hd3ID +{ + UNIMPLEMENTED_FUNC(cellAudio); + return CELL_OK; //it's NOT real value + //TODO +} + +s32 cellSnd3SMFUnbind() //u32 smfID +{ + UNIMPLEMENTED_FUNC(cellAudio); + return CELL_OK; //it's NOT real value + //TODO +} + +s32 cellSnd3SMFPlay(u32 smfID, u32 playVelocity, u32 playPan, u32 playCount) +{ + UNIMPLEMENTED_FUNC(cellAudio); + return CELL_OK; +} + +s32 cellSnd3SMFPlayEx(u32 smfID, u32 playVelocity, u32 playPan, u32 playPanEx, u32 playCount) +{ + UNIMPLEMENTED_FUNC(cellAudio); + return CELL_OK; +} + +s32 cellSnd3SMFPause(u32 smfID) +{ + UNIMPLEMENTED_FUNC(cellAudio); + return CELL_OK; +} + +s32 cellSnd3SMFResume(u32 smfID) +{ + UNIMPLEMENTED_FUNC(cellAudio); + return CELL_OK; +} + +s32 cellSnd3SMFStop(u32 smfID) +{ + UNIMPLEMENTED_FUNC(cellAudio); + return CELL_OK; +} + +s32 cellSnd3SMFAddTempo(u32 smfID, s32 addTempo) +{ + UNIMPLEMENTED_FUNC(cellAudio); + return CELL_OK; +} + +s32 cellSnd3SMFGetTempo() //u32 smfID +{ + UNIMPLEMENTED_FUNC(cellAudio); + return CELL_OK; //it's NOT real value + //TODO +} + +s32 cellSnd3SMFSetPlayVelocity(u32 smfID, u32 playVelocity) +{ + UNIMPLEMENTED_FUNC(cellAudio); + return CELL_OK; +} + +s32 cellSnd3SMFGetPlayVelocity() //u32 smfID +{ + UNIMPLEMENTED_FUNC(cellAudio); + return CELL_OK; //it's NOT real value + //TODO +} + +s32 cellSnd3SMFSetPlayPanpot(u32 smfID, u32 playPanpot) +{ + UNIMPLEMENTED_FUNC(cellAudio); + return CELL_OK; +} + +s32 cellSnd3SMFSetPlayPanpotEx(u32 smfID, u32 playPanpotEx) +{ + UNIMPLEMENTED_FUNC(cellAudio); + return CELL_OK; +} + +s32 cellSnd3SMFGetPlayPanpot() //u32 smfID +{ + UNIMPLEMENTED_FUNC(cellAudio); + return CELL_OK; //it's NOT real value + //TODO +} + +s32 cellSnd3SMFGetPlayPanpotEx() //u32 smfID +{ + UNIMPLEMENTED_FUNC(cellAudio); + return CELL_OK; //it's NOT real value + //TODO +} + +s32 cellSnd3SMFGetPlayStatus() //u32 smfID +{ + UNIMPLEMENTED_FUNC(cellAudio); + return CELL_OK; //it's NOT real value + //TODO +} + +s32 cellSnd3SMFSetPlayChannel(u32 smfID, u32 playChannelBit) +{ + UNIMPLEMENTED_FUNC(cellAudio); + return CELL_OK; +} + +s32 cellSnd3SMFGetPlayChannel() //u32 smfID, u32 *playChannelBit +{ + UNIMPLEMENTED_FUNC(cellAudio); + return CELL_OK; +} + +s32 cellSnd3SMFGetKeyOnID() //u32 smfID, u32 midiChannel, u32 *keyOnID +{ + UNIMPLEMENTED_FUNC(cellAudio); + return CELL_OK; +} + + //*libsynth2 Functions, NON active in this moment*// + +s32 cellSoundSynth2Config(s16 param, s32 value) +{ + UNIMPLEMENTED_FUNC(cellAudio); + return 0; +} + +s32 cellSoundSynth2Init( s16 flag) +{ + UNIMPLEMENTED_FUNC(cellAudio); + return 0; +} + +s32 cellSoundSynth2Exit() +{ + UNIMPLEMENTED_FUNC(cellAudio); + return 0; +} + +void cellSoundSynth2SetParam(u16 register, u16 value) +{ + UNIMPLEMENTED_FUNC(cellAudio); + //TODO +} + +u16 cellSoundSynth2GetParam() //u16 register +{ + UNIMPLEMENTED_FUNC(cellAudio); + return CELL_OK; //it's NOT real value + //TODO +} + +void cellSoundSynth2SetSwitch(u16 register, u32 value) +{ + UNIMPLEMENTED_FUNC(cellAudio); + //TODO +} + +u32 cellSoundSynth2GetSwitch() //u16 register +{ + UNIMPLEMENTED_FUNC(cellAudio); + return CELL_OK; //it's NOT real value + //TODO +} + +u32 cellSoundSynth2SetAddr(u16 register, u32 value) +{ + UNIMPLEMENTED_FUNC(cellAudio); + return 0; +} + +u32 cellSoundSynth2GetAddr() //u16 register +{ + UNIMPLEMENTED_FUNC(cellAudio); + return CELL_OK; //it's NOT real value + //TODO +} + +s32 cellSoundSynth2SetEffectAttr() //s16 bus, CellSoundSynth2EffectAttr *attr +{ + UNIMPLEMENTED_FUNC(cellAudio); + return 0; +} + +s32 cellSoundSynth2SetEffectMode() //s16 bus, CellSoundSynth2EffectAttr *attr +{ + UNIMPLEMENTED_FUNC(cellAudio); + return 0; +} + +void cellSoundSynth2SetCoreAttr(u16 entry, u16 value) +{ + UNIMPLEMENTED_FUNC(cellAudio); + //TODO +} + +s32 cellSoundSynth2Generate() //u16 samples, float *left_buffer, float *right_buffer, float *left_rear, float *right_rear +{ + UNIMPLEMENTED_FUNC(cellAudio); + return 0; +} + +s32 cellSoundSynth2VoiceTrans() //s16 channel, u16 mode, u8 *m_addr, u32 s_addr, u32 size +{ + UNIMPLEMENTED_FUNC(cellAudio); + return 0; +} + +u16 cellSoundSynth2Note2Pitch() //u16 center_note, u16 center_fine, u16 note, s16 fine +{ + UNIMPLEMENTED_FUNC(cellAudio); + return CELL_OK; //it's NOT real value + //TODO +} + +u16 cellSoundSynth2Pitch2Note() //u16 center_note, u16 center_fine, u16 pitch +{ + UNIMPLEMENTED_FUNC(cellAudio); + return CELL_OK; //it's NOT real value + //TODO +} + + +void cellAudio_init() +{ + cellAudio.AddFunc(0x0b168f92, cellAudioInit); + cellAudio.AddFunc(0x4129fe2d, cellAudioPortClose); + cellAudio.AddFunc(0x5b1e2c73, cellAudioPortStop); + cellAudio.AddFunc(0x74a66af0, cellAudioGetPortConfig); + cellAudio.AddFunc(0x89be28f2, cellAudioPortStart); + cellAudio.AddFunc(0xca5ac370, cellAudioQuit); + cellAudio.AddFunc(0xcd7bc431, cellAudioPortOpen); + cellAudio.AddFunc(0x56dfe179, cellAudioSetPortLevel); + cellAudio.AddFunc(0x04af134e, cellAudioCreateNotifyEventQueue); + cellAudio.AddFunc(0x31211f6b, cellAudioMiscSetAccessoryVolume); + cellAudio.AddFunc(0x377e0cd9, cellAudioSetNotifyEventQueue); + cellAudio.AddFunc(0x4109d08c, cellAudioGetPortTimestamp); + cellAudio.AddFunc(0x9e4b1db8, cellAudioAdd2chData); + cellAudio.AddFunc(0xdab029aa, cellAudioAddData); + cellAudio.AddFunc(0xe4046afe, cellAudioGetPortBlockTag); + cellAudio.AddFunc(0xff3626fd, cellAudioRemoveNotifyEventQueue); + + //TODO: Find addresses for libmixer, libsnd3 and libsynth2 functions +} diff --git a/rpcs3/Emu/SysCalls/Modules/cellPhotoDecode.cpp b/rpcs3/Emu/SysCalls/Modules/cellPhotoDecode.cpp index b0973a3e55..78c5cb8673 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellPhotoDecode.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellPhotoDecode.cpp @@ -18,6 +18,21 @@ enum CELL_PHOTO_DECODE_ERROR_DECODE = 0x8002c906, }; +// Datatypes +struct CellPhotoDecodeSetParam +{ + u32 dstBuffer_addr; + u16 width; + u16 height; +}; + +struct CellPhotoDecodeReturnParam +{ + u16 width; + u16 height; +}; + +// Functions int cellPhotoDecodeInitialize() { UNIMPLEMENTED_FUNC(cellPhotoDecode); diff --git a/rpcs3/Emu/SysCalls/Modules/cellPhotoImport.cpp b/rpcs3/Emu/SysCalls/Modules/cellPhotoImport.cpp index f4f25ff488..5b072a0fcd 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellPhotoImport.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellPhotoImport.cpp @@ -18,6 +18,30 @@ enum CELL_PHOTO_IMPORT_ERROR_INITIALIZE = 0x8002c706, }; +// Datatypes +struct CellPhotoImportFileDataSub +{ + int width; + int height; + //CellPhotoImportFormatType format; + //CellPhotoImportTexRot rotate; +}; + +struct CellPhotoImportFileData +{ + char dstFileName; //[CELL_FS_MAX_FS_FILE_NAME_LENGTH]; + char photo_title; //[CELL_PHOTO_IMPORT_PHOTO_TITLE_MAX_LENGTH*3]; + char game_title; //[CELL_PHOTO_IMPORT_GAME_TITLE_MAX_SIZE]; + char game_comment; //[CELL_PHOTO_IMPORT_GAME_COMMENT_MAX_SIZE]; + CellPhotoImportFileDataSub* data_sub; +}; + +struct CellPhotoImportSetParam +{ + unsigned int fileSizeMax; +}; + +// Functions int _cellPhotoImport() { UNIMPLEMENTED_FUNC(cellPhotoImport); diff --git a/rpcs3/Emu/SysCalls/Modules/cellSaveData.cpp b/rpcs3/Emu/SysCalls/Modules/cellSaveData.cpp new file mode 100644 index 0000000000..53abf38020 --- /dev/null +++ b/rpcs3/Emu/SysCalls/Modules/cellSaveData.cpp @@ -0,0 +1,413 @@ +#include "stdafx.h" +#include "Emu/SysCalls/SysCalls.h" +#include "Emu/SysCalls/SC_FUNC.h" + +void cellSaveData_init(); +Module cellSaveData("cellSaveData", cellSaveData_init); + +// Error codes +enum +{ + CELL_SAVEDATA_RET_OK = 0, + CELL_SAVEDATA_RET_CANCEL = 1, + CELL_SAVEDATA_ERROR_CBRESULT, + CELL_SAVEDATA_ERROR_ACCESS_ERROR, + CELL_SAVEDATA_ERROR_INTERNAL, + CELL_SAVEDATA_ERROR_PARAM, + CELL_SAVEDATA_ERROR_NOSPACE, + CELL_SAVEDATA_ERROR_BROKEN, + CELL_SAVEDATA_ERROR_FAILURE, + CELL_SAVEDATA_ERROR_BUSY, + CELL_SAVEDATA_ERROR_NOUSER, +}; + +// Datatypes +struct CellSaveDataSetList +{ + unsigned int sortType; + unsigned int sortOrder; + char *dirNamePrefix; +}; + +struct CellSaveDataSetBuf +{ + unsigned int dirListMax; + unsigned int fileListMax; + unsigned int reserved[6]; + unsigned int bufSize; + void *buf; +}; + +struct CellSaveDataNewDataIcon +{ + char *title; + unsigned int iconBufSize; + void *iconBuf; +}; + +struct CellSaveDataListNewData +{ + unsigned int iconPosition; + char *dirName; + CellSaveDataNewDataIcon *icon; +}; + +struct CellSaveDataDirList +{ + char dirName; //[CELL_SAVEDATA_DIRNAME_SIZE]; + char listParam; //[CELL_SAVEDATA_SYSP_LPARAM_SIZE]; +}; + +struct CellSaveDataListGet +{ + unsigned int dirNum; + unsigned int dirListNum; + CellSaveDataDirList *dirList; +}; + +struct CellSaveDataListSet +{ + unsigned int focusPosition; + char *focusDirName; + unsigned int fixedListNum; + CellSaveDataDirList *fixedList; + CellSaveDataListNewData *newData; +}; + +struct CellSaveDataFixedSet +{ + char *dirName; + CellSaveDataNewDataIcon *newIcon; + unsigned int option; +}; + +struct CellSaveDataSystemFileParam +{ + char title; //[CELL_SAVEDATA_SYSP_TITLE_SIZE]; + char subTitle; //[CELL_SAVEDATA_SYSP_SUBTITLE_SIZE]; + char detail; //[CELL_SAVEDATA_SYSP_DETAIL_SIZE]; + unsigned int attribute; + char reserved2[4]; + char listParam; //[CELL_SAVEDATA_SYSP_LPARAM_SIZE]; + char reserved[256]; +}; + +struct CellSaveDataDirStat +{ + s64 st_atime; + s64 st_mtime; + s64 st_ctime; + char dirName; //[CELL_SAVEDATA_DIRNAME_SIZE]; +}; + +struct CellSaveDataFileStat +{ + unsigned int fileType; + char reserved1[4]; + u64 st_size; + s64 st_atime; + s64 st_mtime; + s64 st_ctime; + char fileName; //[CELL_SAVEDATA_FILENAME_SIZE]; + char reserved2[3]; +}; + +struct CellSaveDataStatGet +{ + int hddFreeSizeKB; + unsigned int isNewData; + CellSaveDataDirStat dir; + CellSaveDataSystemFileParam getParam; + unsigned int bind; + int sizeKB; + int sysSizeKB; + unsigned int fileNum; + unsigned int fileListNum; + CellSaveDataFileStat *fileList; +}; + +struct CellSaveDataAutoIndicator +{ + unsigned int dispPosition; + unsigned int dispMode; + char *dispMsg; + unsigned int picBufSize; + void *picBuf; +}; + +struct CellSaveDataStatSet +{ + CellSaveDataSystemFileParam *setParam; + unsigned int reCreateMode; + CellSaveDataAutoIndicator *indicator; +}; + +struct CellSaveDataFileGet +{ + unsigned int excSize; +}; + +struct CellSaveDataFileSet +{ + unsigned int fileOperation; + void *reserved; + unsigned int fileType; + unsigned char secureFileId; //[CELL_SAVEDATA_SECUREFILEID_SIZE]; + char *fileName; + unsigned int fileOffset; + unsigned int fileSize; + unsigned int fileBufSize; + void *fileBuf; +}; + +struct CellSaveDataCBResult +{ + int result; + unsigned int progressBarInc; + int errNeedSizeKB; + char *invalidMsg; + void *userdata; +}; + +struct CellSaveDataDoneGet +{ + int excResult; + char dirName; //[CELL_SAVEDATA_DIRNAME_SIZE]; + int sizeKB; + int hddFreeSizeKB; +}; + +// Functions +int cellSaveDataListSave2() //unsigned int version, CellSaveDataSetList *setList, CellSaveDataSetBuf *setBuf, CellSaveDataListCallback funcList, CellSaveDataStatCallback funcStat, CellSaveDataFileCallback funcFile, sys_memory_container_t container, void *userdata +{ + UNIMPLEMENTED_FUNC(cellSaveData); + return CELL_SAVEDATA_RET_OK; +} + +int cellSaveDataListLoad2() //unsigned int version, CellSaveDataSetList *setList, CellSaveDataSetBuf *setBuf, CellSaveDataListCallback funcList, CellSaveDataStatCallback funcStat, CellSaveDataFileCallback funcFile, sys_memory_container_t container, void *userdata +{ + UNIMPLEMENTED_FUNC(cellSaveData); + return CELL_SAVEDATA_RET_OK; +} + +int cellSaveDataFixedSave2() //unsigned int version, CellSaveDataSetList *setList, CellSaveDataSetBuf *setBuf, CellSaveDataFixedCallback funcFixed, CellSaveDataStatCallback funcStat, CellSaveDataFileCallback funcFile,sys_memory_container_t container, void *userdata +{ + UNIMPLEMENTED_FUNC(cellSaveData); + return CELL_SAVEDATA_RET_OK; +} + +int cellSaveDataFixedLoad2() //unsigned int version, CellSaveDataSetList *setList, CellSaveDataSetBuf *setBuf, CellSaveDataFixedCallback funcFixed, CellSaveDataStatCallback funcStat, CellSaveDataFileCallback funcFile, sys_memory_container_t container, void *userdata +{ + UNIMPLEMENTED_FUNC(cellSaveData); + return CELL_SAVEDATA_RET_OK; +} + +int cellSaveDataAutoSave2() //unsigned int version, const char *dirName, unsigned int errDialog, CellSaveDataSetBuf *setBuf, CellSaveDataStatCallback funcStat, CellSaveDataFileCallback funcFile, sys_memory_container_t container, void *userdata +{ + UNIMPLEMENTED_FUNC(cellSaveData); + return CELL_SAVEDATA_RET_OK; +} + +int cellSaveDataAutoLoad2() //unsigned int version, const char *dirName, unsigned int errDialog, CellSaveDataSetBuf *setBuf, CellSaveDataStatCallback funcStat, CellSaveDataFileCallback funcFile, sys_memory_container_t container, void *userdata +{ + UNIMPLEMENTED_FUNC(cellSaveData); + return CELL_SAVEDATA_RET_OK; +} + +int cellSaveDataListAutoSave() //unsigned int version, unsigned int errDialog, CellSaveDataSetList *setList, CellSaveDataSetBuf *setBuf, CellSaveDataFixedCallback funcFixed, CellSaveDataStatCallback funcStat, CellSaveDataFileCallback funcFile,sys_memory_container_t container, void *userdata +{ + UNIMPLEMENTED_FUNC(cellSaveData); + return CELL_SAVEDATA_RET_OK; +} + +int cellSaveDataListAutoLoad() //unsigned int version, unsigned int errDialog, CellSaveDataSetList *setList, CellSaveDataSetBuf *setBuf, CellSaveDataFixedCallback funcFixed, CellSaveDataStatCallback funcStat, CellSaveDataFileCallback funcFile, sys_memory_container_t container, void *userdata +{ + UNIMPLEMENTED_FUNC(cellSaveData); + return CELL_SAVEDATA_RET_OK; +} + +int cellSaveDataDelete2() //sys_memory_container_t container +{ + UNIMPLEMENTED_FUNC(cellSaveData); + return CELL_SAVEDATA_RET_CANCEL; +} + +int cellSaveDataFixedDelete() //CellSaveDataSetList *setList, CellSaveDataSetBuf *setBuf, CellSaveDataFixedCallback funcFixed, CellSaveDataDoneCallback funcDone, sys_memory_container_t container, void *userdata +{ + UNIMPLEMENTED_FUNC(cellSaveData); + return CELL_SAVEDATA_RET_OK; +} + +int cellSaveDataUserListSave() //unsigned int version, CellSysutilUserId userId, CellSaveDataSetList *setList, CellSaveDataSetBuf *setBuf, CellSaveDataListCallback funcList, CellSaveDataStatCallback funcStat, CellSaveDataFileCallback funcFile, sys_memory_container_t container, void *userdata +{ + UNIMPLEMENTED_FUNC(cellSaveData); + return CELL_SAVEDATA_RET_OK; +} + +int cellSaveDataUserListLoad() //unsigned int version, CellSysutilUserId userId, CellSaveDataSetList *setList, CellSaveDataSetBuf *setBuf, CellSaveDataListCallback funcList, CellSaveDataStatCallback funcStat, CellSaveDataFileCallback funcFile, sys_memory_container_t container, void *userdata +{ + UNIMPLEMENTED_FUNC(cellSaveData); + return CELL_SAVEDATA_RET_OK; +} + +int cellSaveDataUserFixedSave() //unsigned int version, CellSysutilUserId userId, CellSaveDataSetList *setList, CellSaveDataSetBuf *setBuf, CellSaveDataFixedCallback funcFixed, CellSaveDataStatCallback funcStat, CellSaveDataFileCallback funcFile, sys_memory_container_t container, void *userdata +{ + UNIMPLEMENTED_FUNC(cellSaveData); + return CELL_SAVEDATA_RET_OK; +} + +int cellSaveDataUserFixedLoad() //unsigned int version, CellSysutilUserId userId, CellSaveDataSetList *setList, CellSaveDataSetBuf *setBuf, CellSaveDataFixedCallback funcFixed, CellSaveDataStatCallback funcStat, CellSaveDataFileCallback funcFile, sys_memory_container_t container, void *userdata +{ + UNIMPLEMENTED_FUNC(cellSaveData); + return CELL_SAVEDATA_RET_OK; +} + +int cellSaveDataUserAutoSave() //unsigned int version, CellSysutilUserId userId, const char *dirName, unsigned int errDialog, CellSaveDataSetBuf *setBuf, CellSaveDataStatCallback funcStat, CellSaveDataFileCallback funcFile, sys_memory_container_t container, void *userdata +{ + UNIMPLEMENTED_FUNC(cellSaveData); + return CELL_SAVEDATA_RET_OK; +} + +int cellSaveDataUserAutoLoad() //unsigned int version, CellSysutilUserId userId, const char *dirName, unsigned int errDialog, CellSaveDataSetBuf *setBuf, CellSaveDataStatCallback funcStat, CellSaveDataFileCallback funcFile, sys_memory_container_t container, void *userdata +{ + UNIMPLEMENTED_FUNC(cellSaveData); + return CELL_SAVEDATA_RET_OK; +} + +int cellSaveDataUserListAutoSave() //unsigned int version, CellSysutilUserId userId, unsigned int errDialog, CellSaveDataSetList *setList, CellSaveDataSetBuf *setBuf, CellSaveDataFixedCallback funcFixed, CellSaveDataStatCallback funcStat, CellSaveDataFileCallback funcFile, sys_memory_container_t container, void *userdata +{ + UNIMPLEMENTED_FUNC(cellSaveData); + return CELL_SAVEDATA_RET_OK; +} + +int cellSaveDataUserListAutoLoad() //unsigned int version, CellSysutilUserId userId, unsigned int errDialog, CellSaveDataSetList *setList, CellSaveDataSetBuf *setBuf, CellSaveDataFixedCallback funcFixed, CellSaveDataStatCallback funcStat, CellSaveDataFileCallback funcFile, sys_memory_container_t container, void *userdata +{ + UNIMPLEMENTED_FUNC(cellSaveData); + return CELL_SAVEDATA_RET_OK; +} + +int cellSaveDataUserFixedDelete() //CellSysutilUserId userId, CellSaveDataSetList *setList, CellSaveDataSetBuf *setBuf, CellSaveDataFixedCallback funcFixed, CellSaveDataDoneCallback funcDone, sys_memory_container_t container, void *userdata +{ + UNIMPLEMENTED_FUNC(cellSaveData); + return CELL_SAVEDATA_RET_OK; +} + +//void cellSaveDataEnableOverlay(); //int enable + + +// Functions (Extensions) +int cellSaveDataListDelete() //CellSaveDataSetList *setList, CellSaveDataSetBuf *setBuf, CellSaveDataListCallback funcList, CellSaveDataDoneCallback funcDone, sys_memory_container_t container, void *userdata +{ + UNIMPLEMENTED_FUNC(cellSaveData); + return CELL_SAVEDATA_RET_OK; +} + +int cellSaveDataListImport() //CellSaveDataSetList *setList, unsigned int maxSizeKB, CellSaveDataDoneCallback funcDone, sys_memory_container_t container, void *userdata +{ + UNIMPLEMENTED_FUNC(cellSaveData); + return CELL_SAVEDATA_RET_OK; +} + +int cellSaveDataListExport() //CellSaveDataSetList *setList, unsigned int maxSizeKB, CellSaveDataDoneCallback funcDone, sys_memory_container_t container, void *userdata +{ + UNIMPLEMENTED_FUNC(cellSaveData); + return CELL_SAVEDATA_RET_OK; +} + +int cellSaveDataFixedImport() //const char *dirName, unsigned int maxSizeKB, CellSaveDataDoneCallback funcDone, sys_memory_container_t container, void *userdata +{ + UNIMPLEMENTED_FUNC(cellSaveData); + return CELL_SAVEDATA_RET_OK; +} + +int cellSaveDataFixedExport() //const char *dirName, unsigned int maxSizeKB, CellSaveDataDoneCallback funcDone, sys_memory_container_t container, void *userdata +{ + UNIMPLEMENTED_FUNC(cellSaveData); + return CELL_SAVEDATA_RET_OK; +} + +int cellSaveDataGetListItem() //const char *dirName, CellSaveDataDirStat *dir, CellSaveDataSystemFileParam *sysFileParam, unsigned int *bind, int *sizeKB +{ + UNIMPLEMENTED_FUNC(cellSaveData); + return CELL_SAVEDATA_RET_OK; +} + +int cellSaveDataUserListDelete() //CellSysutilUserId userId, CellSaveDataSetList *setList, CellSaveDataSetBuf *setBuf, CellSaveDataListCallback funcList, CellSaveDataDoneCallback funcDone,sys_memory_container_t container, void *userdata +{ + UNIMPLEMENTED_FUNC(cellSaveData); + return CELL_SAVEDATA_RET_OK; +} + +int cellSaveDataUserListImport() //CellSysutilUserId userId, CellSaveDataSetList *setList, unsigned int maxSizeKB, CellSaveDataDoneCallback funcDone, sys_memory_container_t container, void *userdata +{ + UNIMPLEMENTED_FUNC(cellSaveData); + return CELL_SAVEDATA_RET_OK; +} + +int cellSaveDataUserListExport() //CellSysutilUserId userId, CellSaveDataSetList *setList, unsigned int maxSizeKB, CellSaveDataDoneCallback funcDone, sys_memory_container_t container, void *userdata +{ + UNIMPLEMENTED_FUNC(cellSaveData); + return CELL_SAVEDATA_RET_OK; +} + +int cellSaveDataUserFixedImport() //CellSysutilUserId userId, const char *dirName, unsigned int maxSizeKB, CellSaveDataDoneCallback funcDone, sys_memory_container_t container, void *userdata +{ + UNIMPLEMENTED_FUNC(cellSaveData); + return CELL_SAVEDATA_RET_OK; +} + +int cellSaveDataUserFixedExport() //CellSysutilUserId userId, const char *dirName, unsigned int maxSizeKB, CellSaveDataDoneCallback funcDone, sys_memory_container_t container, void *userdata +{ + UNIMPLEMENTED_FUNC(cellSaveData); + return CELL_SAVEDATA_RET_OK; +} + +int cellSaveDataUserGetListItem() //CellSysutilUserId userId, const char *dirName, CellSaveDataDirStat *dir, CellSaveDataSystemFileParam *sysFileParam, unsigned int *bind, int *sizeKB +{ + UNIMPLEMENTED_FUNC(cellSaveData); + return CELL_SAVEDATA_RET_OK; +} + +// Callback Functions +void (*CellSaveDataFixedCallback)(); //CellSaveDataCBResult *cbResult, CellSaveDataListGet *get, CellSaveDataFixedSet *set + +void (*CellSaveDataListCallback)(); //CellSaveDataCBResult *cbResult, CellSaveDataListGet *get, CellSaveDataListSet *set + +void (*CellSaveDataStatCallback)(); //CellSaveDataCBResult *cbResult, CellSaveDataStatGet *get, CellSaveDataStatSet *set + +void (*CellSaveDataFileCallback)(); //CellSaveDataCBResult *cbResult, CellSaveDataFileGet *get, CellSaveDataFileSet *set + +void (*CellSaveDataDoneCallback)(); //CellSaveDataCBResult *cbResult, CellSaveDataDoneGet *get + +void cellSaveData_init() +{ + cellSaveData.AddFunc(0x04c06fc2, cellSaveDataGetListItem); + cellSaveData.AddFunc(0x273d116a, cellSaveDataUserListExport); + cellSaveData.AddFunc(0x27cb8bc2, cellSaveDataListDelete); + cellSaveData.AddFunc(0x39d6ee43, cellSaveDataUserListImport); + cellSaveData.AddFunc(0x46a2d878, cellSaveDataFixedExport); + cellSaveData.AddFunc(0x491cc554, cellSaveDataListExport); + cellSaveData.AddFunc(0x52541151, cellSaveDataFixedImport); + cellSaveData.AddFunc(0x529231b0, cellSaveDataUserFixedImport); + cellSaveData.AddFunc(0x6b4e0de6, cellSaveDataListImport); + cellSaveData.AddFunc(0x7048a9ba, cellSaveDataUserListDelete); + cellSaveData.AddFunc(0x95ae2cde, cellSaveDataUserFixedExport); + cellSaveData.AddFunc(0xf6482036, cellSaveDataUserGetListItem); + cellSaveData.AddFunc(0x2de0d663, cellSaveDataListSave2); + cellSaveData.AddFunc(0x1dfbfdd6, cellSaveDataListLoad2); + cellSaveData.AddFunc(0x2aae9ef5, cellSaveDataFixedSave2); + cellSaveData.AddFunc(0x2a8eada2, cellSaveDataFixedLoad2); + cellSaveData.AddFunc(0x8b7ed64b, cellSaveDataAutoSave2); + cellSaveData.AddFunc(0xfbd5c856, cellSaveDataAutoLoad2); + cellSaveData.AddFunc(0x4dd03a4e, cellSaveDataListAutoSave); + cellSaveData.AddFunc(0x21425307, cellSaveDataListAutoLoad); + cellSaveData.AddFunc(0xedadd797, cellSaveDataDelete2); + cellSaveData.AddFunc(0x0f03cfb0, cellSaveDataUserListSave); + cellSaveData.AddFunc(0x39dd8425, cellSaveDataUserListLoad); + cellSaveData.AddFunc(0x40b34847, cellSaveDataUserFixedSave); + cellSaveData.AddFunc(0x6e7264ed, cellSaveDataUserFixedLoad); + cellSaveData.AddFunc(0x52aac4fa, cellSaveDataUserAutoSave); + cellSaveData.AddFunc(0xcdc6aefd, cellSaveDataUserAutoLoad); + cellSaveData.AddFunc(0x0e091c36, cellSaveDataUserListAutoSave); + //cellSaveData.AddFunc(0xe7fa820b, cellSaveDataEnableOverlay); +} \ No newline at end of file diff --git a/rpcs3/Emu/SysCalls/Modules/cellScreenshot.cpp b/rpcs3/Emu/SysCalls/Modules/cellScreenshot.cpp index f7e3f3f503..9f00f5d99e 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellScreenshot.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellScreenshot.cpp @@ -16,13 +16,22 @@ enum CELL_SCREENSHOT_ERROR_UNSUPPORTED_COLOR_FORMAT = 0x8002d105, }; -int cellScreenShotSetParameter() +// Datatypes +struct CellScreenShotSetParam +{ + const char *photo_title; + const char *game_title; + const char *game_comment; +}; + +// Functions +int cellScreenShotSetParameter() //const CellScreenShotSetParam *param { UNIMPLEMENTED_FUNC(cellScreenshot); return CELL_OK; } -int cellScreenShotSetOverlayImage() +int cellScreenShotSetOverlayImage() //const char *srcDir, const char *srcFile, s32 offset_x, s32 offset_y { UNIMPLEMENTED_FUNC(cellScreenshot); return CELL_OK; diff --git a/rpcs3/Emu/SysCalls/Modules/cellSysutil.cpp b/rpcs3/Emu/SysCalls/Modules/cellSysutil.cpp index e6f0090ee1..f06d896fa5 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellSysutil.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellSysutil.cpp @@ -102,9 +102,21 @@ enum void cellSysutil_init(); Module cellSysutil(0x0015, cellSysutil_init); -void cellVideoOutGetDeviceInfo() +int cellVideoOutGetDeviceInfo(u32 videoOut, u32 deviceIndex, mem_struct_ptr_t info) { - UNIMPLEMENTED_FUNC(cellSysutil); + cellSysutil.Error("Unimplemented function: cellVideoOutGetDeviceInfo(videoOut=%u, deviceIndex=%u, info_addr=0x%x)", + videoOut, deviceIndex, info.GetAddr()); + + if(deviceIndex) return CELL_VIDEO_OUT_ERROR_DEVICE_NOT_FOUND; + + //info->portType = CELL_VIDEO_OUT_PORT_HDMI; + info->colorSpace = Emu.GetGSManager().GetColorSpace(); + //info->latency = ; + //info->availableModeCount = ; + //info->state = CELL_VIDEO_OUT_DEVICE_STATE_AVAILABLE; + //info->rgbOutputRange = ; + + return CELL_OK; } int cellSysutilGetSystemParamInt(int id, mem32_t value) diff --git a/rpcs3/Emu/SysCalls/Modules/sys_fs.cpp b/rpcs3/Emu/SysCalls/Modules/sys_fs.cpp index 79cf6f1cba..38bb598860 100644 --- a/rpcs3/Emu/SysCalls/Modules/sys_fs.cpp +++ b/rpcs3/Emu/SysCalls/Modules/sys_fs.cpp @@ -5,9 +5,140 @@ void sys_fs_init(); Module sys_fs(0x000e, sys_fs_init); +bool sdata_check(u32 version, u32 flags, u64 filesizeInput, u64 filesizeTmp) +{ + if (version > 4 || flags & 0x7EFFFFC0){ + printf("ERROR: unknown version"); + return false; + } + + if ((version == 1 && (flags & 0x7FFFFFFE)) || + (version == 2 && (flags & 0x7EFFFFC0))){ + printf("ERROR: unknown or unsupported type"); + return false; + } + + if (filesizeTmp > filesizeInput){ + printf("ERROR: input file size is too short."); + return false; + } + + if (!(flags & 0x80000000)){ + printf("ERROR: cannot extract finalized edata."); + return false; + } + + return true; +} + +int sdata_unpack(wxString packed_file, wxString unpacked_file) +{ + vfsStream* packed_stream = Emu.GetVFS().Open(packed_file, vfsRead); + vfsStream* unpacked_stream = Emu.GetVFS().Open(unpacked_file, vfsWrite); + + if(!packed_stream || !packed_stream->IsOpened()) + { + sys_fs.Error("'%s' not found! flags: 0x%08x", packed_file, vfsRead); + delete packed_stream; + return CELL_ENOENT; + } + + if(!unpacked_stream || !unpacked_stream->IsOpened()) + { + sys_fs.Error("'%s' couldn't be created! flags: 0x%08x", unpacked_file, vfsWrite); + delete unpacked_stream; + return CELL_ENOENT; + } + + char buffer [10200]; + packed_stream->Read(buffer, 256); + if (re32(*(u32*)&buffer[0]) != 0x4E504400) // "NPD\x00" + { + printf("ERROR: illegal format."); + return CELL_EFSSPECIFIC; + } + + u32 version = re32(*(u32*)&buffer[0x04]); + u32 flags = re32(*(u32*)&buffer[0x80]); + u32 blockSize = re32(*(u32*)&buffer[0x84]); + u64 filesizeOutput = re64(*(u64*)&buffer[0x88]); + u64 filesizeInput = packed_stream->GetSize(); + u32 blockCount = (filesizeOutput + blockSize-1) / blockSize; + + // SDATA file is compressed + if (flags & 0x1) + { + sys_fs.Warning("cellFsSdataOpen: Compressed SDATA files are not supported yet."); + return CELL_EFSSPECIFIC; + } + + // SDATA file is NOT compressed + else + { + u32 t1 = (flags & 0x20) ? 0x20 : 0x10; + u32 startOffset = (blockCount * t1) + 0x100; + u64 filesizeTmp = (filesizeOutput+0xF)&0xFFFFFFF0 + startOffset; + + if (!sdata_check(version, flags, filesizeInput, filesizeTmp)) + { + sys_fs.Error("cellFsSdataOpen: Wrong header information."); + return CELL_EFSSPECIFIC; + } + + if (flags & 0x20) + packed_stream->Seek(0x100); + else + packed_stream->Seek(startOffset); + + for (u32 i = 0; i < blockCount; i++) + { + if (flags & 0x20) + packed_stream->Seek(packed_stream->Tell() + t1); + + if (!(blockCount-i-1)) + blockSize = filesizeOutput-i*blockSize; + + packed_stream->Read(buffer+256, blockSize); + unpacked_stream->Write(buffer+256, blockSize); + } + } + + packed_stream->Close(); + unpacked_stream->Close(); + + return CELL_OK; +} + + +int cellFsSdataOpen(u32 path_addr, int flags, mem32_t fd, mem32_t arg, u64 size) +{ + const wxString& path = Memory.ReadString(path_addr); + sys_fs.Warning("cellFsSdataOpen(path: %s, flags: 0x%x, fd_addr: 0x%x, arg_addr: 0x%x, size: 0x%llx)", + path, flags, fd.GetAddr(), arg.GetAddr(), size); + + if (!fd.IsGood() || (!arg.IsGood() && size)) + return CELL_EFAULT; + + if (flags != CELL_O_RDONLY) + return CELL_EINVAL; + + if (!path.Lower().EndsWith(".sdat")) + return CELL_ENOTSDATA; + + wxString unpacked_path = "/dev_hdd1/"+path.AfterLast('/')+".unpacked"; + int ret = sdata_unpack(path, unpacked_path); + if (ret) return ret; + + vfsStream* stream = Emu.GetVFS().Open(unpacked_path, vfsRead); + fd = sys_fs.GetNewId(stream, flags); + + return CELL_OK; +} + void sys_fs_init() { sys_fs.AddFunc(0x718bf5f8, cellFsOpen); + sys_fs.AddFunc(0xb1840b53, cellFsSdataOpen); sys_fs.AddFunc(0x4d5ff8e2, cellFsRead); sys_fs.AddFunc(0xecdcf2ab, cellFsWrite); sys_fs.AddFunc(0x2cb51f0d, cellFsClose); diff --git a/rpcs3/Emu/SysCalls/SysCalls.cpp b/rpcs3/Emu/SysCalls/SysCalls.cpp index 497368a740..eff6342761 100644 --- a/rpcs3/Emu/SysCalls/SysCalls.cpp +++ b/rpcs3/Emu/SysCalls/SysCalls.cpp @@ -10,33 +10,85 @@ static func_caller* sc_table[1024] = { null_func, bind_func(sys_process_getpid), null_func, bind_func(sys_process_exit), null_func, //4 null_func, null_func, null_func, null_func, null_func, //9 - null_func, null_func, null_func, null_func, null_func, //14 - null_func, null_func, null_func, null_func, null_func, //19 + null_func, null_func, bind_func(sys_process_get_number_of_object), bind_func(sys_process_get_id), null_func, //14 + null_func, null_func, null_func, bind_func(sys_process_getppid), null_func, //19 null_func, null_func, bind_func(sys_process_exit), null_func, null_func, //24 null_func, null_func, null_func, null_func, null_func, //29 - null_func, null_func, null_func, null_func, null_func, //34 + bind_func(sys_process_get_paramsfo), null_func, null_func, null_func, null_func, //34 null_func, null_func, null_func, null_func, null_func, //39 - null_func, bind_func(sys_ppu_thread_exit), null_func, bind_func(sys_ppu_thread_yield), bind_func(sys_ppu_thread_join), //44 - bind_func(sys_ppu_thread_detach), bind_func(sys_ppu_thread_get_join_state), bind_func(sys_ppu_thread_set_priority), bind_func(sys_ppu_thread_get_priority), bind_func(sys_ppu_thread_get_stack_information), //49 - bind_func(sys_ppu_thread_stop), bind_func(sys_ppu_thread_restart), bind_func(sys_ppu_thread_create), null_func, null_func, //54 + null_func, //40 (0x028) + bind_func(sys_ppu_thread_exit), //41 (0x029) + null_func, //42 (0x02A) + bind_func(sys_ppu_thread_yield), //43 (0x02B) + bind_func(sys_ppu_thread_join), //44 (0x02C) + bind_func(sys_ppu_thread_detach), //45 (0x02D) + bind_func(sys_ppu_thread_get_join_state), //46 (0x02E) + bind_func(sys_ppu_thread_set_priority), //47 (0x02F) + bind_func(sys_ppu_thread_get_priority), //48 (0x030) + bind_func(sys_ppu_thread_get_stack_information), //49 (0x031) + bind_func(sys_ppu_thread_stop), //50 (0x032) + bind_func(sys_ppu_thread_restart), //51 (0x033) + bind_func(sys_ppu_thread_create), //52 (0x034) + null_func, //53 (0x035) + null_func, //54 (0x036) null_func, null_func, null_func, null_func, null_func, //59 - null_func, null_func, null_func, null_func, null_func, //64 - null_func, null_func, null_func, null_func, null_func, //69 - null_func, null_func, null_func, null_func, null_func, //74 - null_func, null_func, null_func, null_func, null_func, //49 + bind_func(sys_trace_create), //60 (0x03C) + bind_func(sys_trace_start), //61 (0x03D) + bind_func(sys_trace_stop), //62 (0x03E) + bind_func(sys_trace_update_top_index), //63 (0x03F) + bind_func(sys_trace_destroy), //64 (0x040) + bind_func(sys_trace_drain), //65 (0x041) + bind_func(sys_trace_attach_process), //66 (0x042) + bind_func(sys_trace_allocate_buffer), //67 (0x043) + bind_func(sys_trace_free_buffer), //68 (0x044) + bind_func(sys_trace_create2), //69 (0x045) + bind_func(sys_timer_create), //70 (0x046) + bind_func(sys_timer_destroy), //71 (0x047) + bind_func(sys_timer_get_information), //72 (0x048) + bind_func(sys_timer_start), //73 (0x049) + bind_func(sys_timer_stop), //74 (0x04A) + bind_func(sys_timer_connect_event_queue), //75 (0x04B) + bind_func(sys_timer_disconnect_event_queue), //76 (0x04C) + null_func, //77 (0x04D) + null_func, //78 (0x04E) + null_func, //79 (0x04F) null_func, null_func, null_func, null_func, null_func, //84 null_func, null_func, null_func, null_func, null_func, //89 - bind_func(sys_semaphore_create), bind_func(sys_semaphore_destroy), bind_func(sys_semaphore_wait), bind_func(sys_semaphore_trywait), bind_func(sys_semaphore_post), //94 - bind_func(sys_lwmutex_create), bind_func(sys_lwmutex_destroy), bind_func(sys_lwmutex_lock), bind_func(sys_lwmutex_trylock), bind_func(sys_lwmutex_unlock), //99 - bind_func(sys_mutex_create), bind_func(sys_mutex_destroy), bind_func(sys_mutex_lock), bind_func(sys_mutex_trylock), bind_func(sys_mutex_unlock), //104 - bind_func(sys_cond_create), bind_func(sys_cond_destroy), bind_func(sys_cond_wait), bind_func(sys_cond_signal), bind_func(sys_cond_signal_all), //109 + bind_func(sys_semaphore_create), //90 (0x05A) + bind_func(sys_semaphore_destroy), //91 (0x05B) + bind_func(sys_semaphore_wait), //92 (0x05C) + bind_func(sys_semaphore_trywait), //93 (0x05D) + bind_func(sys_semaphore_post), //94 (0x05E) + bind_func(sys_lwmutex_create), //95 (0x05F) + bind_func(sys_lwmutex_destroy), //96 (0x060) + bind_func(sys_lwmutex_lock), //97 (0x061) + bind_func(sys_lwmutex_trylock), //98 (0x062) + bind_func(sys_lwmutex_unlock), //99 (0x063) + bind_func(sys_mutex_create), //100 (0x064) + bind_func(sys_mutex_destroy), //101 (0x065) + bind_func(sys_mutex_lock), //102 (0x066) + bind_func(sys_mutex_trylock), //103 (0x067) + bind_func(sys_mutex_unlock), //104 (0x068) + bind_func(sys_cond_create), //105 (0x069) + bind_func(sys_cond_destroy), //106 (0x06A) + bind_func(sys_cond_wait), //107 (0x06B) + bind_func(sys_cond_signal), //108 (0x06C) + bind_func(sys_cond_signal_all), //109 (0x06D) null_func, null_func, null_func, null_func, null_func, //114 null_func, null_func, null_func, null_func, null_func, //119 - null_func, null_func, null_func, null_func, null_func, //124 - null_func, null_func, null_func, bind_func(sys_event_queue_create), null_func, //129 + bind_func(sys_rwlock_create), //120 (0x078) + bind_func(sys_rwlock_destroy), //121 (0x079) + bind_func(sys_rwlock_rlock), //122 (0x07A) + bind_func(sys_rwlock_tryrlock), //123 (0x07B) + bind_func(sys_rwlock_runlock), //124 (0x07C) + bind_func(sys_rwlock_wlock), //125 (0x07D) + bind_func(sys_rwlock_trywlock), //126 (0x07E) + bind_func(sys_rwlock_wunlock), //127 (0x07F) + bind_func(sys_event_queue_create), //128 (0x080) + null_func, //129 (0x081) bind_func(sys_event_queue_receive), null_func, null_func, null_func, bind_func(sys_event_port_create), //134 null_func, bind_func(sys_event_port_connect_local), null_func, bind_func(sys_event_port_send), null_func, //139 - null_func, null_func, null_func, null_func, null_func, //144 + null_func, bind_func(sys_timer_usleep), bind_func(sys_timer_sleep), null_func, bind_func(sys_time_get_timezone), //144 bind_func(sys_time_get_current_time), bind_func(sys_time_get_system_time), bind_func(sys_time_get_timebase_frequency), null_func, null_func, //149 null_func, null_func, null_func, null_func, null_func, //154 null_func, bind_func(sys_spu_image_open), null_func, null_func, null_func, //159 @@ -141,9 +193,21 @@ static func_caller* sc_table[1024] = null_func, null_func, null_func, null_func, null_func, //654 null_func, null_func, null_func, null_func, null_func, //659 null_func, null_func, null_func, null_func, null_func, //664 - null_func, null_func, null_func, null_func, null_func, //669 - null_func, null_func, null_func, null_func, null_func, //674 - null_func, null_func, null_func, null_func, null_func, //679 + null_func, //665 (0x299) + bind_func(sys_rsx_device_open), //666 (0x29A) + bind_func(sys_rsx_device_close), //667 (0x29B) + bind_func(sys_rsx_memory_allocate), //668 (0x29C) + bind_func(sys_rsx_memory_free), //669 (0x29D) + bind_func(sys_rsx_context_allocate), //670 (0x29E) + bind_func(sys_rsx_context_free), //671 (0x29F) + bind_func(sys_rsx_context_iomap), //672 (0x2A0) + bind_func(sys_rsx_context_iounmap), //673 (0x2A1) + bind_func(sys_rsx_context_attribute), //674 (0x2A2) + bind_func(sys_rsx_device_map), //675 (0x2A3) + bind_func(sys_rsx_device_unmap), //676 (0x2A4) + bind_func(sys_rsx_attribute), //677 (0x2A5) + null_func, //678 (0x2A6) + null_func, //679 (0x2A7) null_func, null_func, null_func, null_func, null_func, //684 null_func, null_func, null_func, null_func, null_func, //689 null_func, null_func, null_func, null_func, null_func, //694 @@ -168,9 +232,21 @@ static func_caller* sc_table[1024] = null_func, null_func, null_func, null_func, null_func, //789 null_func, null_func, null_func, null_func, null_func, //794 null_func, null_func, null_func, null_func, null_func, //799 - null_func, bind_func(cellFsOpen), bind_func(cellFsRead), bind_func(cellFsWrite), bind_func(cellFsClose), //804 - bind_func(cellFsOpendir), bind_func(cellFsReaddir), bind_func(cellFsClosedir), null_func, bind_func(cellFsFstat), //809 - null_func, bind_func(cellFsMkdir), bind_func(cellFsRename), bind_func(cellFsRmdir), null_func, //814 + null_func, //800 (0x320) + bind_func(cellFsOpen), //801 (0x321) + bind_func(cellFsRead), //802 (0x322) + bind_func(cellFsWrite), //803 (0x323) + bind_func(cellFsClose), //804 (0x324) + bind_func(cellFsOpendir), //805 (0x325) + bind_func(cellFsReaddir), //806 (0x326) + bind_func(cellFsClosedir), //807 (0x327) + bind_func(cellFsStat), //808 (0x328) + bind_func(cellFsFstat), //809 (0x329) + null_func, //810 (0x32A) + bind_func(cellFsMkdir), //811 (0x32B) + bind_func(cellFsRename), //812 (0x32C) + bind_func(cellFsRmdir), //813 (0x32D) + null_func, //814 (0x32E) null_func, null_func, null_func, bind_func(cellFsLseek), null_func, //819 null_func, null_func, null_func, null_func, null_func, //824 null_func, null_func, null_func, null_func, null_func, //829 diff --git a/rpcs3/Emu/SysCalls/SysCalls.h b/rpcs3/Emu/SysCalls/SysCalls.h index eb8efcf4bb..7408a91458 100644 --- a/rpcs3/Emu/SysCalls/SysCalls.h +++ b/rpcs3/Emu/SysCalls/SysCalls.h @@ -1,6 +1,8 @@ #pragma once #include "ErrorCodes.h" #include "lv2/SC_FileSystem.h" +#include "lv2/SC_Timer.h" +#include "lv2/SC_Rwlock.h" //#define SYSCALLS_DEBUG #define declCPU PPUThread& CPU = GetCurrentPPUThread @@ -109,7 +111,12 @@ public: //process extern int sys_process_getpid(); +extern int sys_process_getppid(); +extern int sys_process_get_number_of_object(u32 object, mem32_t nump); +extern int sys_process_get_id(u32 object, mem8_ptr_t buffer, u32 size, mem32_t set_size); +extern int sys_process_get_paramsfo(mem8_ptr_t buffer); extern int sys_process_exit(int errorcode); +extern int sys_process_is_stack(u32 addr); //TODO: Is this a lv2 SysCall? If so, where is its number? extern int sys_game_process_exitspawn(u32 path_addr, u32 argv_addr, u32 envp_addr, u32 data, u32 data_size, int prio, u64 flags ); @@ -272,10 +279,58 @@ extern int sys_spu_thread_read_ls(u32 id, u32 address, u32 value_addr, u32 type) extern int sys_spu_thread_write_spu_mb(u32 id, u32 value); //sys_time +extern int sys_time_get_timezone(mem32_t timezone, mem32_t summertime); extern int sys_time_get_current_time(u32 sec_addr, u32 nsec_addr); extern s64 sys_time_get_system_time(); extern u64 sys_time_get_timebase_frequency(); +//sys_timer +extern int sys_timer_create(mem32_t timer_id); +extern int sys_timer_destroy(u32 timer_id); +extern int sys_timer_get_information(u32 timer_id, mem_struct_ptr_t info); +extern int sys_timer_start(u32 timer_id, s64 basetime, u64 period); +extern int sys_timer_stop(u32 timer_id); +extern int sys_timer_connect_event_queue(u32 timer_id, u32 queue_id, u64 name, u64 data1, u64 data2); +extern int sys_timer_disconnect_event_queue(u32 timer_id); +extern int sys_timer_sleep(u32 sleep_time); +extern int sys_timer_usleep(u64 sleep_time); + +//sys_trace +extern int sys_trace_create(); +extern int sys_trace_start(); +extern int sys_trace_stop(); +extern int sys_trace_update_top_index(); +extern int sys_trace_destroy(); +extern int sys_trace_drain(); +extern int sys_trace_attach_process(); +extern int sys_trace_allocate_buffer(); +extern int sys_trace_free_buffer(); +extern int sys_trace_create2(); + +//sys_rwlock +extern int sys_rwlock_create(mem32_t rw_lock_id, mem_struct_ptr_t attr); +extern int sys_rwlock_destroy(u32 rw_lock_id); +extern int sys_rwlock_rlock(u32 rw_lock_id, u64 timeout); +extern int sys_rwlock_tryrlock(u32 rw_lock_id); +extern int sys_rwlock_runlock(u32 rw_lock_id); +extern int sys_rwlock_wlock(u32 rw_lock_id, u64 timeout); +extern int sys_rwlock_trywlock(u32 rw_lock_id); +extern int sys_rwlock_wunlock(u32 rw_lock_id); + +//sys_rsx +extern int sys_rsx_device_open(); +extern int sys_rsx_device_close(); +extern int sys_rsx_memory_allocate(); +extern int sys_rsx_memory_free(); +extern int sys_rsx_context_allocate(); +extern int sys_rsx_context_free(); +extern int sys_rsx_context_iomap(); +extern int sys_rsx_context_iounmap(); +extern int sys_rsx_context_attribute(s32 context_id, u64 a2, u64 a3, u64 a4, u64 a5, u64 a6); +extern int sys_rsx_device_map(mem32_t a1, mem32_t a2, u32 a3); +extern int sys_rsx_device_unmap(); +extern int sys_rsx_attribute(); + #define UNIMPLEMENTED_FUNC(module) module.Error("Unimplemented function: "__FUNCTION__) #define SC_ARG_0 CPU.GPR[3] diff --git a/rpcs3/Emu/SysCalls/lv2/SC_PPU_Thread.cpp b/rpcs3/Emu/SysCalls/lv2/SC_PPU_Thread.cpp index 66db9f3f4b..d4c8188d72 100644 --- a/rpcs3/Emu/SysCalls/lv2/SC_PPU_Thread.cpp +++ b/rpcs3/Emu/SysCalls/lv2/SC_PPU_Thread.cpp @@ -49,6 +49,13 @@ int sys_ppu_thread_detach(u32 thread_id) { sysPrxForUser.Error("sys_ppu_thread_detach(thread_id=%d)", thread_id); + PPCThread* thr = Emu.GetCPU().GetThread(thread_id); + if(!thr) return CELL_ESRCH; + + if(!thr->IsJoinable()) + return CELL_EINVAL; + thr->SetJoinable(false); + return CELL_OK; } diff --git a/rpcs3/Emu/SysCalls/lv2/SC_Process.cpp b/rpcs3/Emu/SysCalls/lv2/SC_Process.cpp index ed6573fc3b..daea57358c 100644 --- a/rpcs3/Emu/SysCalls/lv2/SC_Process.cpp +++ b/rpcs3/Emu/SysCalls/lv2/SC_Process.cpp @@ -3,14 +3,43 @@ SysCallBase sc_p("Process"); +//Process Local Object +enum +{ + SYS_MEM_OBJECT = (0x08UL), + SYS_MUTEX_OBJECT = (0x85UL), + SYS_COND_OBJECT = (0x86UL), + SYS_RWLOCK_OBJECT = (0x88UL), + SYS_INTR_TAG_OBJECT = (0x0AUL), + SYS_INTR_SERVICE_HANDLE_OBJECT = (0x0BUL), + SYS_EVENT_QUEUE_OBJECT = (0x8DUL), + SYS_EVENT_PORT_OBJECT = (0x0EUL), + SYS_TRACE_OBJECT = (0x21UL), + SYS_SPUIMAGE_OBJECT = (0x22UL), + SYS_PRX_OBJECT = (0x23UL), + SYS_SPUPORT_OBJECT = (0x24UL), + SYS_LWMUTEX_OBJECT = (0x95UL), + SYS_TIMER_OBJECT = (0x11UL), + SYS_SEMAPHORE_OBJECT = (0x96UL), + SYS_FS_FD_OBJECT = (0x73UL), + SYS_LWCOND_OBJECT = (0x97UL), + SYS_EVENT_FLAG_OBJECT = (0x98UL), +}; + int sys_process_getpid() { return 1; } +int sys_process_getppid() +{ + sc_p.Warning("TODO: sys_process_getppid() returns 0"); + return 0; +} + int sys_process_exit(int errorcode) { - ConLog.Warning("sys_process_exit(%d)", errorcode); + sc_p.Warning("sys_process_exit(%d)", errorcode); #ifdef _DEBUG Emu.Pause(); #else @@ -32,6 +61,199 @@ int sys_game_process_exitspawn( u32 path_addr, u32 argv_addr, u32 envp_addr, sc_p.Log("flags: %d", flags); return CELL_OK; } + +int sys_process_get_number_of_object(u32 object, mem32_t nump) +{ + sc_p.Warning("TODO: sys_process_get_number_of_object(object=%d, nump_addr=0x%x)", + object, nump.GetAddr()); + + switch(object) + { + case SYS_MEM_OBJECT: + nump = 0; + return CELL_OK; + + case SYS_MUTEX_OBJECT: + nump = 0; + return CELL_OK; + + case SYS_COND_OBJECT: + nump = 0; + return CELL_OK; + + case SYS_RWLOCK_OBJECT: + nump = 0; + return CELL_OK; + + case SYS_INTR_TAG_OBJECT: + nump = 0; + return CELL_OK; + + case SYS_INTR_SERVICE_HANDLE_OBJECT: + nump = 0; + return CELL_OK; + + case SYS_EVENT_QUEUE_OBJECT: + nump = 0; + return CELL_OK; + + case SYS_EVENT_PORT_OBJECT: + nump = 0; + return CELL_OK; + + case SYS_TRACE_OBJECT: + nump = 0; + return CELL_OK; + + case SYS_SPUIMAGE_OBJECT: + nump = 0; + return CELL_OK; + + case SYS_PRX_OBJECT: + nump = 0; + return CELL_OK; + + case SYS_SPUPORT_OBJECT: + nump = 0; + return CELL_OK; + + case SYS_LWMUTEX_OBJECT: + nump = 0; + return CELL_OK; + + case SYS_TIMER_OBJECT: + nump = 0; + return CELL_OK; + + case SYS_SEMAPHORE_OBJECT: + nump = 0; + return CELL_OK; + + case SYS_FS_FD_OBJECT: + nump = 0; + return CELL_OK; + + case SYS_LWCOND_OBJECT: + nump = 0; + return CELL_OK; + + default: + return CELL_EINVAL; + } +} + +int sys_process_get_id(u32 object, mem8_ptr_t buffer, u32 size, mem32_t set_size) +{ + sc_p.Warning("TODO: sys_process_get_id(object=%d, buffer_addr=0x%x, size=%d, set_size_addr=0x%x)", + object, buffer.GetAddr(), size, set_size.GetAddr()); + + switch(object) + { + case SYS_MEM_OBJECT: + set_size = 0; + return CELL_OK; + + case SYS_MUTEX_OBJECT: + set_size = 0; + return CELL_OK; + + case SYS_COND_OBJECT: + set_size = 0; + return CELL_OK; + + case SYS_RWLOCK_OBJECT: + set_size = 0; + return CELL_OK; + + case SYS_INTR_TAG_OBJECT: + set_size = 0; + return CELL_OK; + + case SYS_INTR_SERVICE_HANDLE_OBJECT: + set_size = 0; + return CELL_OK; + + case SYS_EVENT_QUEUE_OBJECT: + set_size = 0; + return CELL_OK; + + case SYS_EVENT_PORT_OBJECT: + set_size = 0; + return CELL_OK; + + case SYS_TRACE_OBJECT: + set_size = 0; + return CELL_OK; + + case SYS_SPUIMAGE_OBJECT: + set_size = 0; + return CELL_OK; + + case SYS_PRX_OBJECT: + set_size = 0; + return CELL_OK; + + case SYS_SPUPORT_OBJECT: + set_size = 0; + return CELL_OK; + + case SYS_LWMUTEX_OBJECT: + set_size = 0; + return CELL_OK; + + case SYS_TIMER_OBJECT: + set_size = 0; + return CELL_OK; + + case SYS_SEMAPHORE_OBJECT: + set_size = 0; + return CELL_OK; + + case SYS_FS_FD_OBJECT: + set_size = 0; + return CELL_OK; + + case SYS_LWCOND_OBJECT: + set_size = 0; + return CELL_OK; + + case SYS_EVENT_FLAG_OBJECT: + set_size = 0; + return CELL_OK; + + default: + return CELL_EINVAL; + } +} + +int sys_process_get_paramsfo(mem8_ptr_t buffer) +{ + sc_p.Warning("TODO: sys_process_get_paramsfo(buffer_addr=0x%x) returns CELL_ENOENT", buffer.GetAddr()); + return CELL_ENOENT; + + /*//Before uncommenting this code, we should check if it is actually working. + MemoryAllocator> fd; + char filePath [] = "/app_home/../PARAM.SFO"; + if (!cellFsOpen(Memory.RealToVirtualAddr(filePath), 0, fd, NULL, 0)) + return CELL_ENOENT; + + MemoryAllocator> pos, nread; + cellFsLseek(fd, 0, CELL_SEEK_SET, pos); //TODO: Move to the appropriate offset (probably 0x3F7) + cellFsRead(fd, buffer.GetAddr(), 40, nread); //WARNING: If offset==0x3F7: The file will end before the buffer (40 bytes) is filled! + cellFsClose(fd); + + return CELL_OK;*/ +} + +int sys_process_is_stack(u32 p) +{ + PPCThread* CPU = GetCurrentPPCThread(); + if (p >= CPU->GetStackAddr() && p <= CPU->GetStackAddr() + CPU->GetStackSize()) + return 1; + + return 0; +} + /* int SysCalls::lv2ProcessWaitForChild(PPUThread& CPU) { @@ -73,7 +295,6 @@ int SysCalls::lv2ProcessKill(PPUThread& CPU) CPU.Close(); return CELL_OK; } - int SysCalls::lv2ProcessWaitForChild2(PPUThread& CPU) { ConLog.Warning("lv2ProcessWaitForChild2[r3: 0x%llx, r4: 0x%llx, r5: 0x%llx, r6: 0x%llx, r7: 0x%llx, r8: 0x%llx]", @@ -86,4 +307,4 @@ int SysCalls::lv2ProcessGetSdkVersion(PPUThread& CPU) CPU.GPR[4] = 0x360001; //TODO return CELL_OK; } -*/ \ No newline at end of file +*/ diff --git a/rpcs3/Emu/SysCalls/lv2/SC_RSX.cpp b/rpcs3/Emu/SysCalls/lv2/SC_RSX.cpp new file mode 100644 index 0000000000..8ede1eaa83 --- /dev/null +++ b/rpcs3/Emu/SysCalls/lv2/SC_RSX.cpp @@ -0,0 +1,76 @@ +#include "stdafx.h" +#include "Emu/SysCalls/SysCalls.h" + +SysCallBase sys_rsx("sys_rsx"); + +int sys_rsx_device_open() +{ + sys_rsx.Warning("Unimplemented function: sys_rsx_device_open()"); + return CELL_OK; +} + +int sys_rsx_device_close() +{ + sys_rsx.Warning("Unimplemented function: sys_rsx_device_close()"); + return CELL_OK; +} + +int sys_rsx_memory_allocate() +{ + sys_rsx.Warning("Unimplemented function: sys_rsx_memory_allocate()"); + return CELL_OK; +} + +int sys_rsx_memory_free() +{ + sys_rsx.Warning("Unimplemented function: sys_rsx_memory_free()"); + return CELL_OK; +} + +int sys_rsx_context_allocate() +{ + sys_rsx.Warning("Unimplemented function: sys_rsx_context_allocate()"); + return CELL_OK; +} + +int sys_rsx_context_free() +{ + sys_rsx.Warning("Unimplemented function: sys_rsx_context_free()"); + return CELL_OK; +} + +int sys_rsx_context_iomap() +{ + sys_rsx.Warning("Unimplemented function: sys_rsx_context_iomap()"); + return CELL_OK; +} + +int sys_rsx_context_iounmap() +{ + sys_rsx.Warning("Unimplemented function: sys_rsx_context_iounmap()"); + return CELL_OK; +} + +int sys_rsx_context_attribute(s32 context_id, u64 a2, u64 a3, u64 a4, u64 a5, u64 a6) +{ + sys_rsx.Warning("Unimplemented function: sys_rsx_context_attribute(context_id=%d, a2=%llu, a3=%llu, a4=%llu, a5=%llu, a6=%llu)", context_id, a2, a3, a4, a5, a6); + return CELL_OK; +} + +int sys_rsx_device_map(mem32_t a1, mem32_t a2, u32 a3) +{ + sys_rsx.Warning("Unimplemented function: sys_rsx_device_map(a1_addr=0x%x, a2_addr=0x%x, a3=%d)", a1.GetAddr(), a2.GetAddr(), a3); + return CELL_OK; +} + +int sys_rsx_device_unmap() +{ + sys_rsx.Warning("Unimplemented function: sys_rsx_device_unmap()"); + return CELL_OK; +} + +int sys_rsx_attribute() +{ + sys_rsx.Warning("Unimplemented function: sys_rsx_attribute()"); + return CELL_OK; +} diff --git a/rpcs3/Emu/SysCalls/lv2/SC_Rwlock.cpp b/rpcs3/Emu/SysCalls/lv2/SC_Rwlock.cpp new file mode 100644 index 0000000000..3af3222627 --- /dev/null +++ b/rpcs3/Emu/SysCalls/lv2/SC_Rwlock.cpp @@ -0,0 +1,53 @@ +#include "stdafx.h" +#include "SC_Rwlock.h" +#include "Emu/SysCalls/SysCalls.h" + +SysCallBase sys_rwlock("sys_rwlock"); + +int sys_rwlock_create(mem32_t rw_lock_id, mem_struct_ptr_t attr) +{ + sys_rwlock.Warning("Unimplemented function: sys_rwlock_create(rw_lock_id_addr=0x%x, attr_addr=0x%x)", rw_lock_id.GetAddr(), attr.GetAddr()); + return CELL_OK; +} + +int sys_rwlock_destroy(u32 rw_lock_id) +{ + sys_rwlock.Warning("Unimplemented function: sys_rwlock_destroy(rw_lock_id=%d)", rw_lock_id); + return CELL_OK; +} + +int sys_rwlock_rlock(u32 rw_lock_id, u64 timeout) +{ + sys_rwlock.Warning("Unimplemented function: sys_rwlock_rlock(rw_lock_id=%d, timeout=%llu)", rw_lock_id, timeout); + return CELL_OK; +} + +int sys_rwlock_tryrlock(u32 rw_lock_id) +{ + sys_rwlock.Warning("Unimplemented function: sys_rwlock_tryrlock(rw_lock_id=%d)", rw_lock_id); + return CELL_OK; +} + +int sys_rwlock_runlock(u32 rw_lock_id) +{ + sys_rwlock.Warning("Unimplemented function: sys_rwlock_runlock(rw_lock_id=%d)", rw_lock_id); + return CELL_OK; +} + +int sys_rwlock_wlock(u32 rw_lock_id, u64 timeout) +{ + sys_rwlock.Warning("Unimplemented function: sys_rwlock_wlock(rw_lock_id=%d, timeout=%llu)", rw_lock_id, timeout); + return CELL_OK; +} + +int sys_rwlock_trywlock(u32 rw_lock_id) +{ + sys_rwlock.Warning("Unimplemented function: sys_rwlock_trywlock(rw_lock_id=%d)", rw_lock_id); + return CELL_OK; +} + +int sys_rwlock_wunlock(u32 rw_lock_id) +{ + sys_rwlock.Warning("Unimplemented function: sys_rwlock_wunlock(rw_lock_id=%d)", rw_lock_id); + return CELL_OK; +} diff --git a/rpcs3/Emu/SysCalls/lv2/SC_Rwlock.h b/rpcs3/Emu/SysCalls/lv2/SC_Rwlock.h new file mode 100644 index 0000000000..d986b59a98 --- /dev/null +++ b/rpcs3/Emu/SysCalls/lv2/SC_Rwlock.h @@ -0,0 +1,12 @@ +#pragma once + +struct sys_rwlock_attribute_t +{ + u32 attr_protocol; //sys_protocol_t + u32 attr_pshared; //sys_process_shared_t + u64 key; //sys_ipc_key_t + s32 flags; + u8 name[8]; +}; + +#pragma pack() \ No newline at end of file diff --git a/rpcs3/Emu/SysCalls/lv2/SC_Time.cpp b/rpcs3/Emu/SysCalls/lv2/SC_Time.cpp index 503e177dd3..42c384ac59 100644 --- a/rpcs3/Emu/SysCalls/lv2/SC_Time.cpp +++ b/rpcs3/Emu/SysCalls/lv2/SC_Time.cpp @@ -4,6 +4,17 @@ SysCallBase sys_time("sys_time"); static const u64 timebase_frequency = 79800000; +extern int cellSysutilGetSystemParamInt(int id, mem32_t value); + +int sys_time_get_timezone(mem32_t timezone, mem32_t summertime) +{ + int ret; + ret = cellSysutilGetSystemParamInt(0x0116, timezone); //0x0116 = CELL_SYSUTIL_SYSTEMPARAM_ID_TIMEZONE + if (ret != CELL_OK) return ret; + ret = cellSysutilGetSystemParamInt(0x0117, summertime); //0x0117 = CELL_SYSUTIL_SYSTEMPARAM_ID_TIMEZONE + if (ret != CELL_OK) return ret; + return CELL_OK; +} int sys_time_get_current_time(u32 sec_addr, u32 nsec_addr) { diff --git a/rpcs3/Emu/SysCalls/lv2/SC_Timer.cpp b/rpcs3/Emu/SysCalls/lv2/SC_Timer.cpp new file mode 100644 index 0000000000..c0262bfde1 --- /dev/null +++ b/rpcs3/Emu/SysCalls/lv2/SC_Timer.cpp @@ -0,0 +1,110 @@ +#include "stdafx.h" +#include "SC_Timer.h" +#include "Emu/SysCalls/SysCalls.h" +#include "Emu/event.h" + +SysCallBase sys_timer("sys_timer"); + +int sys_timer_create(mem32_t timer_id) +{ + sys_timer.Warning("sys_timer_create(timer_id_addr=0x%x)", timer_id.GetAddr()); + + if(!Memory.IsGoodAddr(timer_id.GetAddr())) return CELL_EFAULT; + + timer_id = sys_timer.GetNewId(new timer); + return CELL_OK; +} + +int sys_timer_destroy(u32 timer_id) +{ + sys_timer.Warning("TODO: sys_timer_destroy(timer_id=%d)", timer_id); + + if(!sys_timer.CheckId(timer_id)) return CELL_ESRCH; + + Emu.GetIdManager().RemoveID(timer_id); + return CELL_OK; +} + +int sys_timer_get_information(u32 timer_id, mem_struct_ptr_t info) +{ + sys_timer.Warning("sys_timer_get_information(timer_id=%d, info_addr=0x%x)", timer_id, info.GetAddr()); + + timer* timer_data = nullptr; + if(!sys_timer.CheckId(timer_id, timer_data)) return CELL_ESRCH; + + info = timer_data->timer_information_t; + return CELL_OK; +} + +int sys_timer_start(u32 timer_id, s64 base_time, u64 period) +{ + sys_timer.Warning("sys_timer_start_periodic_absolute(timer_id=%d, basetime=%lld, period=%llu)", timer_id, base_time, period); + + timer* timer_data = nullptr; + if(!sys_timer.CheckId(timer_id, timer_data)) return CELL_ESRCH; + + if(timer_data->timer_information_t.timer_state != SYS_TIMER_STATE_STOP) return CELL_EBUSY; + if(period < 100) return CELL_EINVAL; + //TODO: if (timer is not connected to an event queue) return CELL_ENOTCONN; + + timer_data->timer_information_t.next_expiration_time = base_time; + timer_data->timer_information_t.period = period; + timer_data->timer_information_t.timer_state = SYS_TIMER_STATE_RUN; + //TODO: ? + timer_data->tmr.Start(); + return CELL_OK; +} + +int sys_timer_stop(u32 timer_id) +{ + sys_timer.Warning("TODO: sys_timer_stop()"); + + timer* timer_data = nullptr; + if(!sys_timer.CheckId(timer_id, timer_data)) return CELL_ESRCH; + + timer_data->timer_information_t.timer_state = SYS_TIMER_STATE_STOP; + timer_data->tmr.Stop(); + return CELL_OK; +} + +int sys_timer_connect_event_queue(u32 timer_id, u32 queue_id, u64 name, u64 data1, u64 data2) +{ + sys_timer.Warning("sys_timer_connect_event_queue(timer_id=%d, queue_id=%d, name=%llu, data1=%llu, data2=%llu)", + timer_id, queue_id, name, data1, data2); + + timer* timer_data = nullptr; + EventQueue* equeue = nullptr; + if(!sys_timer.CheckId(timer_id, timer_data)) return CELL_ESRCH; + if(!sys_timer.CheckId(queue_id, equeue)) return CELL_ESRCH; + + //TODO: ? + + return CELL_OK; +} + +int sys_timer_disconnect_event_queue(u32 timer_id) +{ + sys_timer.Warning("TODO: sys_timer_disconnect_event_queue(timer_id=%d)", timer_id); + + timer* timer_data = nullptr; + if(!sys_timer.CheckId(timer_id, timer_data)) return CELL_ESRCH; + + //TODO: ? + + return CELL_OK; +} + +int sys_timer_sleep(u32 sleep_time) +{ + sys_timer.Warning("sys_timer_sleep(sleep_time=%d)", sleep_time); + wxSleep(sleep_time); + return CELL_OK; +} + +int sys_timer_usleep(u64 sleep_time) +{ + sys_timer.Warning("sys_timer_usleep(sleep_time=%lld)", sleep_time); + if (sleep_time > 0xFFFFFFFFFFFF) sleep_time = 0xFFFFFFFFFFFF; //2^48-1 + wxMicroSleep(sleep_time); //TODO: If (sleep_time >= 2^32) shit may happen + return CELL_OK; +} \ No newline at end of file diff --git a/rpcs3/Emu/SysCalls/lv2/SC_Timer.h b/rpcs3/Emu/SysCalls/lv2/SC_Timer.h new file mode 100644 index 0000000000..182008733b --- /dev/null +++ b/rpcs3/Emu/SysCalls/lv2/SC_Timer.h @@ -0,0 +1,23 @@ +#pragma once + +enum +{ + SYS_TIMER_STATE_STOP = 0x00U, + SYS_TIMER_STATE_RUN = 0x01U, +}; + +struct sys_timer_information_t +{ + s64 next_expiration_time; //system_time_t + u64 period; //usecond_t + u32 timer_state; + u32 pad; +}; + +struct timer +{ + wxTimer tmr; + sys_timer_information_t timer_information_t; +}; + +#pragma pack() \ No newline at end of file diff --git a/rpcs3/Emu/SysCalls/lv2/SC_Trace.cpp b/rpcs3/Emu/SysCalls/lv2/SC_Trace.cpp new file mode 100644 index 0000000000..56a28669f3 --- /dev/null +++ b/rpcs3/Emu/SysCalls/lv2/SC_Trace.cpp @@ -0,0 +1,64 @@ +#include "stdafx.h" +#include "Emu/SysCalls/SysCalls.h" + +SysCallBase sys_trace("sys_trace"); + +int sys_trace_create() +{ + sys_trace.Warning("Unimplemented function: sys_trace_create()"); + return CELL_OK; +} + +int sys_trace_start() +{ + sys_trace.Warning("Unimplemented function: sys_trace_start()"); + return CELL_OK; +} + +int sys_trace_stop() +{ + sys_trace.Warning("Unimplemented function: sys_trace_stop()"); + return CELL_OK; +} + +int sys_trace_update_top_index() +{ + sys_trace.Warning("Unimplemented function: sys_trace_update_top_index()"); + return CELL_OK; +} + +int sys_trace_destroy() +{ + sys_trace.Warning("Unimplemented function: sys_trace_destroy()"); + return CELL_OK; +} + +int sys_trace_drain() +{ + sys_trace.Warning("Unimplemented function: sys_trace_drain()"); + return CELL_OK; +} + +int sys_trace_attach_process() +{ + sys_trace.Warning("Unimplemented function: sys_trace_attach_process()"); + return CELL_OK; +} + +int sys_trace_allocate_buffer() +{ + sys_trace.Warning("Unimplemented function: sys_trace_allocate_buffer()"); + return CELL_OK; +} + +int sys_trace_free_buffer() +{ + sys_trace.Warning("Unimplemented function: sys_trace_free_buffer()"); + return CELL_OK; +} + +int sys_trace_create2() +{ + sys_trace.Warning("Unimplemented function: sys_trace_create2()"); + return CELL_OK; +} diff --git a/rpcs3/Gui/MainFrame.cpp b/rpcs3/Gui/MainFrame.cpp index 6255579037..d46089ac4a 100644 --- a/rpcs3/Gui/MainFrame.cpp +++ b/rpcs3/Gui/MainFrame.cpp @@ -233,7 +233,12 @@ void MainFrame::BootSelf(wxCommandEvent& WXUNUSED(event)) wxString fileIn = ctrl.GetPath(); wxString fileOut = ctrl.GetPath()+".elf"; - scetool_decrypt((scetool::s8 *)fileIn.mb_str(), (scetool::s8 *)fileOut.mb_str()); + + if (!scetool_decrypt((scetool::s8 *)fileIn.mb_str(), (scetool::s8 *)fileOut.mb_str())) + { + ConLog.Write("SELF: Could not decrypt file"); + return; + } Emu.SetPath(ctrl.GetPath()+".elf"); Emu.Load(); diff --git a/rpcs3/rpcs3.vcxproj b/rpcs3/rpcs3.vcxproj index 43549e4f5b..9d29e834a1 100644 --- a/rpcs3/rpcs3.vcxproj +++ b/rpcs3/rpcs3.vcxproj @@ -1,4 +1,4 @@ - + @@ -250,13 +250,18 @@ + + + + + diff --git a/rpcs3/rpcs3.vcxproj.filters b/rpcs3/rpcs3.vcxproj.filters index 643c4d0e77..e9500e38c2 100644 --- a/rpcs3/rpcs3.vcxproj.filters +++ b/rpcs3/rpcs3.vcxproj.filters @@ -1,4 +1,4 @@ - + @@ -325,6 +325,21 @@ Emu\ARMv7 + + Emu\SysCalls\lv2 + + + Emu\SysCalls\lv2 + + + Emu\SysCalls\lv2 + + + Emu\SysCalls\lv2 + + + Emu\SysCalls\Modules +