From 220e4ad8a6c9cab2c012d227341e1c5b9b68975c Mon Sep 17 00:00:00 2001 From: Survanium90 Date: Sat, 18 Oct 2014 22:14:16 +0400 Subject: [PATCH 1/3] Added initialization checks in CellGem --- rpcs3/Emu/SysCalls/Modules/cellGem.cpp | 124 +++++++++++++++++++++++++ 1 file changed, 124 insertions(+) diff --git a/rpcs3/Emu/SysCalls/Modules/cellGem.cpp b/rpcs3/Emu/SysCalls/Modules/cellGem.cpp index 56c3c2ced9..d9f51ef96a 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellGem.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellGem.cpp @@ -21,36 +21,60 @@ cellGemInternal cellGemInstance; int cellGemCalibrate() { UNIMPLEMENTED_FUNC(cellGem); + + if (!cellGemInstance.m_bInitialized) + return CELL_GEM_ERROR_UNINITIALIZED; + return CELL_OK; } int cellGemClearStatusFlags() { UNIMPLEMENTED_FUNC(cellGem); + + if (!cellGemInstance.m_bInitialized) + return CELL_GEM_ERROR_UNINITIALIZED; + return CELL_OK; } int cellGemConvertVideoFinish() { UNIMPLEMENTED_FUNC(cellGem); + + if (!cellGemInstance.m_bInitialized) + return CELL_GEM_ERROR_UNINITIALIZED; + return CELL_OK; } int cellGemConvertVideoStart() { UNIMPLEMENTED_FUNC(cellGem); + + if (!cellGemInstance.m_bInitialized) + return CELL_GEM_ERROR_UNINITIALIZED; + return CELL_OK; } int cellGemEnableCameraPitchAngleCorrection() { UNIMPLEMENTED_FUNC(cellGem); + + if (!cellGemInstance.m_bInitialized) + return CELL_GEM_ERROR_UNINITIALIZED; + return CELL_OK; } int cellGemEnableMagnetometer() { UNIMPLEMENTED_FUNC(cellGem); + + if (!cellGemInstance.m_bInitialized) + return CELL_GEM_ERROR_UNINITIALIZED; + return CELL_OK; } @@ -69,60 +93,100 @@ int cellGemEnd() int cellGemFilterState() { UNIMPLEMENTED_FUNC(cellGem); + + if (!cellGemInstance.m_bInitialized) + return CELL_GEM_ERROR_UNINITIALIZED; + return CELL_OK; } int cellGemForceRGB() { UNIMPLEMENTED_FUNC(cellGem); + + if (!cellGemInstance.m_bInitialized) + return CELL_GEM_ERROR_UNINITIALIZED; + return CELL_OK; } int cellGemGetAccelerometerPositionInDevice() { UNIMPLEMENTED_FUNC(cellGem); + + if (!cellGemInstance.m_bInitialized) + return CELL_GEM_ERROR_UNINITIALIZED; + return CELL_OK; } int cellGemGetAllTrackableHues() { UNIMPLEMENTED_FUNC(cellGem); + + if (!cellGemInstance.m_bInitialized) + return CELL_GEM_ERROR_UNINITIALIZED; + return CELL_OK; } int cellGemGetCameraState() { UNIMPLEMENTED_FUNC(cellGem); + + if (!cellGemInstance.m_bInitialized) + return CELL_GEM_ERROR_UNINITIALIZED; + return CELL_OK; } int cellGemGetEnvironmentLightingColor() { UNIMPLEMENTED_FUNC(cellGem); + + if (!cellGemInstance.m_bInitialized) + return CELL_GEM_ERROR_UNINITIALIZED; + return CELL_OK; } int cellGemGetHuePixels() { UNIMPLEMENTED_FUNC(cellGem); + + if (!cellGemInstance.m_bInitialized) + return CELL_GEM_ERROR_UNINITIALIZED; + return CELL_OK; } int cellGemGetImageState() { UNIMPLEMENTED_FUNC(cellGem); + + if (!cellGemInstance.m_bInitialized) + return CELL_GEM_ERROR_UNINITIALIZED; + return CELL_OK; } int cellGemGetInertialState() { UNIMPLEMENTED_FUNC(cellGem); + + if (!cellGemInstance.m_bInitialized) + return CELL_GEM_ERROR_UNINITIALIZED; + return CELL_OK; } int cellGemGetInfo() { UNIMPLEMENTED_FUNC(cellGem); + + if (!cellGemInstance.m_bInitialized) + return CELL_GEM_ERROR_UNINITIALIZED; + return CELL_OK; } @@ -140,30 +204,50 @@ s32 cellGemGetMemorySize(be_t max_connect) int cellGemGetRGB() { UNIMPLEMENTED_FUNC(cellGem); + + if (!cellGemInstance.m_bInitialized) + return CELL_GEM_ERROR_UNINITIALIZED; + return CELL_OK; } int cellGemGetRumble() { UNIMPLEMENTED_FUNC(cellGem); + + if (!cellGemInstance.m_bInitialized) + return CELL_GEM_ERROR_UNINITIALIZED; + return CELL_OK; } int cellGemGetState() { UNIMPLEMENTED_FUNC(cellGem); + + if (!cellGemInstance.m_bInitialized) + return CELL_GEM_ERROR_UNINITIALIZED; + return CELL_OK; } int cellGemGetStatusFlags() { UNIMPLEMENTED_FUNC(cellGem); + + if (!cellGemInstance.m_bInitialized) + return CELL_GEM_ERROR_UNINITIALIZED; + return CELL_OK; } int cellGemGetTrackerHue() { UNIMPLEMENTED_FUNC(cellGem); + + if (!cellGemInstance.m_bInitialized) + return CELL_GEM_ERROR_UNINITIALIZED; + return CELL_OK; } @@ -188,6 +272,10 @@ int cellGemInit(vm::ptr attribute) int cellGemInvalidateCalibration() { UNIMPLEMENTED_FUNC(cellGem); + + if (!cellGemInstance.m_bInitialized) + return CELL_GEM_ERROR_UNINITIALIZED; + return CELL_OK; } @@ -200,54 +288,90 @@ int cellGemIsTrackableHue() int cellGemPrepareCamera() { UNIMPLEMENTED_FUNC(cellGem); + + if (!cellGemInstance.m_bInitialized) + return CELL_GEM_ERROR_UNINITIALIZED; + return CELL_OK; } int cellGemPrepareVideoConvert() { UNIMPLEMENTED_FUNC(cellGem); + + if (!cellGemInstance.m_bInitialized) + return CELL_GEM_ERROR_UNINITIALIZED; + return CELL_OK; } int cellGemReset() { UNIMPLEMENTED_FUNC(cellGem); + + if (!cellGemInstance.m_bInitialized) + return CELL_GEM_ERROR_UNINITIALIZED; + return CELL_OK; } int cellGemSetRumble() { UNIMPLEMENTED_FUNC(cellGem); + + if (!cellGemInstance.m_bInitialized) + return CELL_GEM_ERROR_UNINITIALIZED; + return CELL_OK; } int cellGemSetYaw() { UNIMPLEMENTED_FUNC(cellGem); + + if (!cellGemInstance.m_bInitialized) + return CELL_GEM_ERROR_UNINITIALIZED; + return CELL_OK; } int cellGemTrackHues() { UNIMPLEMENTED_FUNC(cellGem); + + if (!cellGemInstance.m_bInitialized) + return CELL_GEM_ERROR_UNINITIALIZED; + return CELL_OK; } int cellGemUpdateFinish() { UNIMPLEMENTED_FUNC(cellGem); + + if (!cellGemInstance.m_bInitialized) + return CELL_GEM_ERROR_UNINITIALIZED; + return CELL_OK; } int cellGemUpdateStart() { UNIMPLEMENTED_FUNC(cellGem); + + if (!cellGemInstance.m_bInitialized) + return CELL_GEM_ERROR_UNINITIALIZED; + return CELL_OK; } int cellGemWriteExternalPort() { UNIMPLEMENTED_FUNC(cellGem); + + if (!cellGemInstance.m_bInitialized) + return CELL_GEM_ERROR_UNINITIALIZED; + return CELL_OK; } From 7fd3dd9ebfab8b06d28d487a21ad474bc631d962 Mon Sep 17 00:00:00 2001 From: Survanium90 Date: Sat, 18 Oct 2014 22:20:37 +0400 Subject: [PATCH 2/3] Implemented sceNpManagerGetContentRatingFlag --- rpcs3/Emu/SysCalls/Modules/sceNp.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/rpcs3/Emu/SysCalls/Modules/sceNp.cpp b/rpcs3/Emu/SysCalls/Modules/sceNp.cpp index add879bb34..8b497070b6 100644 --- a/rpcs3/Emu/SysCalls/Modules/sceNp.cpp +++ b/rpcs3/Emu/SysCalls/Modules/sceNp.cpp @@ -962,9 +962,17 @@ int sceNpManagerGetAccountAge() return CELL_OK; } -int sceNpManagerGetContentRatingFlag() +int sceNpManagerGetContentRatingFlag(vm::ptr isRestricted, vm::ptr age) { - UNIMPLEMENTED_FUNC(sceNp); + sceNp->Warning("sceNpManagerGetContentRatingFlag(isRestricted=%d, age=%d)", isRestricted, age); + + if (!sceNpInstance.m_bSceNpInitialized) + return SCE_NP_ERROR_NOT_INITIALIZED; + + // TODO: read user's parental control information + *isRestricted = 0; + *age = 18; + return CELL_OK; } From f1168f7c596ddd769d15fec35cfbe76e09f70ae0 Mon Sep 17 00:00:00 2001 From: Survanium90 Date: Sat, 18 Oct 2014 22:22:52 +0400 Subject: [PATCH 3/3] Initial CellMic implementation --- rpcs3/Emu/SysCalls/ModuleManager.cpp | 4 +- rpcs3/Emu/SysCalls/Modules/cellMic.cpp | 157 +++++++++++++------------ rpcs3/cellMic.h | 23 ++++ rpcs3/emucore.vcxproj | 1 + rpcs3/emucore.vcxproj.filters | 9 +- 5 files changed, 117 insertions(+), 77 deletions(-) create mode 100644 rpcs3/cellMic.h diff --git a/rpcs3/Emu/SysCalls/ModuleManager.cpp b/rpcs3/Emu/SysCalls/ModuleManager.cpp index 8fa1774ef5..bb5609cbc7 100644 --- a/rpcs3/Emu/SysCalls/ModuleManager.cpp +++ b/rpcs3/Emu/SysCalls/ModuleManager.cpp @@ -24,6 +24,8 @@ extern void cellGem_unload(); extern void cellJpgDec_init(Module *pxThis); extern void cellGifDec_init(Module *pxThis); extern void cellL10n_init(Module *pxThis); +extern void cellMic_init(Module *pxThis); +extern void cellMic_unload(); extern void cellNetCtl_init(Module *pxThis); extern void cellNetCtl_unload(); extern void cellOvis_init(Module *pxThis); @@ -109,7 +111,7 @@ static const g_modules_list[] = { 0x001f, "cellResc", cellResc_init, cellResc_load, cellResc_unload }, { 0x0020, "cellDaisy", nullptr, nullptr, nullptr }, { 0x0021, "cellKey2char", nullptr, nullptr, nullptr }, - { 0x0022, "cellMic", nullptr, nullptr, nullptr }, + { 0x0022, "cellMic", cellMic_init, nullptr, cellMic_unload }, { 0x0023, "cellCamera", cellCamera_init, nullptr, cellCamera_unload }, { 0x0024, "cellVdecMpeg2", nullptr, nullptr, nullptr }, { 0x0025, "cellVdecAvc", nullptr, nullptr, nullptr }, diff --git a/rpcs3/Emu/SysCalls/Modules/cellMic.cpp b/rpcs3/Emu/SysCalls/Modules/cellMic.cpp index a3a665f55e..6841e37ccf 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellMic.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellMic.cpp @@ -1,40 +1,45 @@ #include "stdafx.h" -#if 0 +#include "Emu/Memory/Memory.h" +#include "Emu/System.h" +#include "Emu/SysCalls/Modules.h" -void cellMic_init(); -Module cellMic(0x0022, cellMic_init); +#include "cellMic.h" -// Error Codes -enum +Module *cellMic = nullptr; + +struct cellMicInternal { - CELL_MICIN_ERROR_ALREADY_INIT = 0x80140101, - CELL_MICIN_ERROR_SYSTEM = 0x80140102, - CELL_MICIN_ERROR_NOT_INIT = 0x80140103, - CELL_MICIN_ERROR_PARAM = 0x80140104, - CELL_MICIN_ERROR_PORT_FULL = 0x80140105, - CELL_MICIN_ERROR_ALREADY_OPEN = 0x80140106, - CELL_MICIN_ERROR_NOT_OPEN = 0x80140107, - CELL_MICIN_ERROR_NOT_RUN = 0x80140108, - CELL_MICIN_ERROR_TRANS_EVENT = 0x80140109, - CELL_MICIN_ERROR_OPEN = 0x8014010a, - CELL_MICIN_ERROR_SHAREDMEMORY = 0x8014010b, - CELL_MICIN_ERROR_MUTEX = 0x8014010c, - CELL_MICIN_ERROR_EVENT_QUEUE = 0x8014010d, - CELL_MICIN_ERROR_DEVICE_NOT_FOUND = 0x8014010e, - CELL_MICIN_ERROR_SYSTEM_NOT_FOUND = 0x8014010e, - CELL_MICIN_ERROR_FATAL = 0x8014010f, - CELL_MICIN_ERROR_DEVICE_NOT_SUPPORT = 0x80140110, + bool m_bCellMicInitialized;; + + cellMicInternal() + : m_bCellMicInitialized(false) + { + } }; +cellMicInternal CellMicInstance; + int cellMicInit() { - UNIMPLEMENTED_FUNC(cellMic); + cellMic->Warning("cellMicInit()"); + + if (CellMicInstance.m_bCellMicInitialized) + return CELL_MICIN_ERROR_ALREADY_INIT; + + CellMicInstance.m_bCellMicInitialized = true; + return CELL_OK; } int cellMicEnd() { - UNIMPLEMENTED_FUNC(cellMic); + cellMic->Warning("cellMicEnd()"); + + if (!CellMicInstance.m_bCellMicInitialized) + return CELL_MICIN_ERROR_NOT_INIT; + + CellMicInstance.m_bCellMicInitialized = false; + return CELL_OK; } @@ -278,54 +283,60 @@ int cellMicGetDeviceIdentifier() return CELL_OK; } -void cellMic_init() +void cellMic_unload() { - cellMic.AddFunc(0x8325e02d, cellMicInit); - cellMic.AddFunc(0xc6328caa, cellMicEnd); - cellMic.AddFunc(0xdd1b59f0, cellMicOpen); - cellMic.AddFunc(0x8d229f8e, cellMicClose); - - cellMic.AddFunc(0x017024a8, cellMicGetDeviceGUID); - cellMic.AddFunc(0xa52d2ae4, cellMicGetType); - cellMic.AddFunc(0x1b42101b, cellMicIsAttached); - cellMic.AddFunc(0x186cb1fb, cellMicIsOpen); - cellMic.AddFunc(0x6a024aa0, cellMicGetDeviceAttr); - cellMic.AddFunc(0xb2c16321, cellMicSetDeviceAttr); - cellMic.AddFunc(0xac5ba03a, cellMicGetSignalAttr); - cellMic.AddFunc(0x323deb41, cellMicSetSignalAttr); - cellMic.AddFunc(0xb30780eb, cellMicGetSignalState); - - cellMic.AddFunc(0xdd724314, cellMicStart); - cellMic.AddFunc(0x07e1b12c, cellMicRead); - cellMic.AddFunc(0xfcfaf246, cellMicStop); - cellMic.AddFunc(0x6bc46aab, cellMicReset); - - cellMic.AddFunc(0x7903400e, cellMicSetNotifyEventQueue); - cellMic.AddFunc(0x6cc7ae00, cellMicSetNotifyEventQueue2); - cellMic.AddFunc(0x65336418, cellMicRemoveNotifyEventQueue); - - cellMic.AddFunc(0x05709bbf, cellMicOpenEx); - cellMic.AddFunc(0xddd19a89, cellMicStartEx); - cellMic.AddFunc(0x4e0b69ee, cellMicGetFormatRaw); - cellMic.AddFunc(0xfda12276, cellMicGetFormatAux); - cellMic.AddFunc(0x87a08d29, cellMicGetFormatDsp); - cellMic.AddFunc(0xa42ac07a, cellMicOpenRaw); - cellMic.AddFunc(0x72165a7f, cellMicReadRaw); - cellMic.AddFunc(0x3acc118e, cellMicReadAux); - cellMic.AddFunc(0xc414faa5, cellMicReadDsp); - - cellMic.AddFunc(0x25c5723f, cellMicGetStatus); - cellMic.AddFunc(0xe839380f, cellMicStopEx); - cellMic.AddFunc(0x3ace58f3, cellMicSysShareClose); - cellMic.AddFunc(0x48108a23, cellMicGetFormat); - cellMic.AddFunc(0x891c6291, cellMicSetMultiMicNotifyEventQueue); - cellMic.AddFunc(0xad049ecf, cellMicGetFormatEx); - cellMic.AddFunc(0xbdfd51e2, cellMicSysShareStop); - cellMic.AddFunc(0xc3610dbd, cellMicSysShareOpen); - cellMic.AddFunc(0xc461563c, cellMicCommand); - cellMic.AddFunc(0xcac7e7d7, cellMicSysShareStart); - cellMic.AddFunc(0xd127cd3e, cellMicSysShareInit); - cellMic.AddFunc(0xf82bbf7c, cellMicSysShareEnd); - cellMic.AddFunc(0xfdbbe469, cellMicGetDeviceIdentifier); + CellMicInstance.m_bCellMicInitialized = false; +} + +void cellMic_init(Module *pxThis) +{ + cellMic = pxThis; + + cellMic->AddFunc(0x8325e02d, cellMicInit); + cellMic->AddFunc(0xc6328caa, cellMicEnd); + cellMic->AddFunc(0xdd1b59f0, cellMicOpen); + cellMic->AddFunc(0x8d229f8e, cellMicClose); + + cellMic->AddFunc(0x017024a8, cellMicGetDeviceGUID); + cellMic->AddFunc(0xa52d2ae4, cellMicGetType); + cellMic->AddFunc(0x1b42101b, cellMicIsAttached); + cellMic->AddFunc(0x186cb1fb, cellMicIsOpen); + cellMic->AddFunc(0x6a024aa0, cellMicGetDeviceAttr); + cellMic->AddFunc(0xb2c16321, cellMicSetDeviceAttr); + cellMic->AddFunc(0xac5ba03a, cellMicGetSignalAttr); + cellMic->AddFunc(0x323deb41, cellMicSetSignalAttr); + cellMic->AddFunc(0xb30780eb, cellMicGetSignalState); + + cellMic->AddFunc(0xdd724314, cellMicStart); + cellMic->AddFunc(0x07e1b12c, cellMicRead); + cellMic->AddFunc(0xfcfaf246, cellMicStop); + cellMic->AddFunc(0x6bc46aab, cellMicReset); + + cellMic->AddFunc(0x7903400e, cellMicSetNotifyEventQueue); + cellMic->AddFunc(0x6cc7ae00, cellMicSetNotifyEventQueue2); + cellMic->AddFunc(0x65336418, cellMicRemoveNotifyEventQueue); + + cellMic->AddFunc(0x05709bbf, cellMicOpenEx); + cellMic->AddFunc(0xddd19a89, cellMicStartEx); + cellMic->AddFunc(0x4e0b69ee, cellMicGetFormatRaw); + cellMic->AddFunc(0xfda12276, cellMicGetFormatAux); + cellMic->AddFunc(0x87a08d29, cellMicGetFormatDsp); + cellMic->AddFunc(0xa42ac07a, cellMicOpenRaw); + cellMic->AddFunc(0x72165a7f, cellMicReadRaw); + cellMic->AddFunc(0x3acc118e, cellMicReadAux); + cellMic->AddFunc(0xc414faa5, cellMicReadDsp); + + cellMic->AddFunc(0x25c5723f, cellMicGetStatus); + cellMic->AddFunc(0xe839380f, cellMicStopEx); + cellMic->AddFunc(0x3ace58f3, cellMicSysShareClose); + cellMic->AddFunc(0x48108a23, cellMicGetFormat); + cellMic->AddFunc(0x891c6291, cellMicSetMultiMicNotifyEventQueue); + cellMic->AddFunc(0xad049ecf, cellMicGetFormatEx); + cellMic->AddFunc(0xbdfd51e2, cellMicSysShareStop); + cellMic->AddFunc(0xc3610dbd, cellMicSysShareOpen); + cellMic->AddFunc(0xc461563c, cellMicCommand); + cellMic->AddFunc(0xcac7e7d7, cellMicSysShareStart); + cellMic->AddFunc(0xd127cd3e, cellMicSysShareInit); + cellMic->AddFunc(0xf82bbf7c, cellMicSysShareEnd); + cellMic->AddFunc(0xfdbbe469, cellMicGetDeviceIdentifier); } -#endif diff --git a/rpcs3/cellMic.h b/rpcs3/cellMic.h new file mode 100644 index 0000000000..4fbc695af2 --- /dev/null +++ b/rpcs3/cellMic.h @@ -0,0 +1,23 @@ +#pragma once + +// Error Codes +enum +{ + CELL_MICIN_ERROR_ALREADY_INIT = 0x80140101, + CELL_MICIN_ERROR_SYSTEM = 0x80140102, + CELL_MICIN_ERROR_NOT_INIT = 0x80140103, + CELL_MICIN_ERROR_PARAM = 0x80140104, + CELL_MICIN_ERROR_PORT_FULL = 0x80140105, + CELL_MICIN_ERROR_ALREADY_OPEN = 0x80140106, + CELL_MICIN_ERROR_NOT_OPEN = 0x80140107, + CELL_MICIN_ERROR_NOT_RUN = 0x80140108, + CELL_MICIN_ERROR_TRANS_EVENT = 0x80140109, + CELL_MICIN_ERROR_OPEN = 0x8014010a, + CELL_MICIN_ERROR_SHAREDMEMORY = 0x8014010b, + CELL_MICIN_ERROR_MUTEX = 0x8014010c, + CELL_MICIN_ERROR_EVENT_QUEUE = 0x8014010d, + CELL_MICIN_ERROR_DEVICE_NOT_FOUND = 0x8014010e, + CELL_MICIN_ERROR_SYSTEM_NOT_FOUND = 0x8014010e, + CELL_MICIN_ERROR_FATAL = 0x8014010f, + CELL_MICIN_ERROR_DEVICE_NOT_SUPPORT = 0x80140110, +}; \ No newline at end of file diff --git a/rpcs3/emucore.vcxproj b/rpcs3/emucore.vcxproj index 36fd98fa19..f8227c3c05 100644 --- a/rpcs3/emucore.vcxproj +++ b/rpcs3/emucore.vcxproj @@ -244,6 +244,7 @@ + diff --git a/rpcs3/emucore.vcxproj.filters b/rpcs3/emucore.vcxproj.filters index 5df44f8c9f..072feed492 100644 --- a/rpcs3/emucore.vcxproj.filters +++ b/rpcs3/emucore.vcxproj.filters @@ -422,9 +422,6 @@ Emu\SysCalls\currently_unused - - Emu\SysCalls\currently_unused - Emu\SysCalls\currently_unused @@ -626,6 +623,9 @@ Crypto + + Emu\SysCalls\Modules + @@ -1231,5 +1231,8 @@ Crypto + + Emu\SysCalls\Modules + \ No newline at end of file