diff --git a/rpcs3/Emu/Cell/Modules/cellGcmSys.cpp b/rpcs3/Emu/Cell/Modules/cellGcmSys.cpp index e915ba9128..6b1eb26dd2 100644 --- a/rpcs3/Emu/Cell/Modules/cellGcmSys.cpp +++ b/rpcs3/Emu/Cell/Modules/cellGcmSys.cpp @@ -120,10 +120,10 @@ u64 cellGcmGetTimeStamp(u32 index) return vm::read64(0xC0000000 + index * 0x10); } -s32 cellGcmGetCurrentField() +u32 cellGcmGetCurrentField() { - UNIMPLEMENTED_FUNC(cellGcmSys); - return CELL_OK; + cellGcmSys.todo("cellGcmGetCurrentField()"); + return 0; } u32 cellGcmGetNotifyDataAddress(u32 index) @@ -166,7 +166,7 @@ u32 cellGcmGetReport(u32 type, u32 index) u32 cellGcmGetReportDataAddress(u32 index) { - cellGcmSys.warning("cellGcmGetReportDataAddress(index=%d)", index); + cellGcmSys.warning("cellGcmGetReportDataAddress(index=%d)", index); if (index >= 2048) { cellGcmSys.error("cellGcmGetReportDataAddress: Wrong local index (%d)", index); @@ -261,9 +261,10 @@ s32 cellGcmBindTile(u8 index) return CELL_OK; } -s32 cellGcmBindZcull(u8 index) +s32 cellGcmBindZcull(u8 index, u32 offset, u32 width, u32 height, u32 cullStart, u32 zFormat, u32 aaFormat, u32 zCullDir, u32 zCullFormat, u32 sFunc, u32 sRef, u32 sMask) { - cellGcmSys.warning("cellGcmBindZcull(index=%d)", index); + cellGcmSys.warning("cellGcmBindZcull(index=%d, offset=0x%x, width=%d, height=%d, cullStart=0x%x, zFormat=0x%x, aaFormat=0x%x, zCullDir=0x%x, zCullFormat=0x%x, sFunc=0x%x, sRef=0x%x, sMask=0x%x)", + index, offset, width, height, cullStart, zFormat, aaFormat, zCullDir, zCullFormat, sFunc, sRef, sMask); if (index >= rsx::limits::zculls_count) { @@ -276,18 +277,16 @@ s32 cellGcmBindZcull(u8 index) return CELL_OK; } -s32 cellGcmGetConfiguration(vm::ptr config) +void cellGcmGetConfiguration(vm::ptr config) { cellGcmSys.trace("cellGcmGetConfiguration(config=*0x%x)", config); *config = current_config; - - return CELL_OK; } -s32 cellGcmGetFlipStatus() +u32 cellGcmGetFlipStatus() { - s32 status = fxm::get()->flip_status; + u32 status = fxm::get()->flip_status; cellGcmSys.trace("cellGcmGetFlipStatus() -> %d", status); @@ -404,16 +403,14 @@ s32 _cellGcmInitBody(vm::pptr context, u32 cmdSize, u32 ioSi return CELL_OK; } -s32 cellGcmResetFlipStatus() +void cellGcmResetFlipStatus() { cellGcmSys.trace("cellGcmResetFlipStatus()"); fxm::get()->flip_status = CELL_GCM_DISPLAY_FLIP_STATUS_WAITING; - - return CELL_OK; } -s32 cellGcmSetDebugOutputLevel(s32 level) +void cellGcmSetDebugOutputLevel(s32 level) { cellGcmSys.warning("cellGcmSetDebugOutputLevel(level=%d)", level); @@ -425,20 +422,19 @@ s32 cellGcmSetDebugOutputLevel(s32 level) fxm::get()->debug_level = level; break; - default: return CELL_EINVAL; + default: + break; } - - return CELL_OK; } -s32 cellGcmSetDisplayBuffer(u32 id, u32 offset, u32 pitch, u32 width, u32 height) +s32 cellGcmSetDisplayBuffer(u8 id, u32 offset, u32 pitch, u32 width, u32 height) { - cellGcmSys.trace("cellGcmSetDisplayBuffer(id=0x%x,offset=0x%x,pitch=%d,width=%d,height=%d)", id, offset, width ? pitch / width : pitch, width, height); + cellGcmSys.trace("cellGcmSetDisplayBuffer(id=0x%x, offset=0x%x, pitch=%d, width=%d, height=%d)", id, offset, width ? pitch / width : pitch, width, height); if (id > 7) { - cellGcmSys.error("cellGcmSetDisplayBuffer: CELL_EINVAL"); - return CELL_EINVAL; + cellGcmSys.error("cellGcmSetDisplayBuffer: CELL_GCM_ERROR_FAILURE"); + return CELL_GCM_ERROR_FAILURE; } const auto render = fxm::get(); @@ -465,7 +461,7 @@ void cellGcmSetFlipHandler(vm::ptr handler) fxm::get()->flip_handler = handler; } -s32 cellGcmSetFlipMode(u32 mode) +void cellGcmSetFlipMode(u32 mode) { cellGcmSys.warning("cellGcmSetFlipMode(mode=%d)", mode); @@ -478,22 +474,20 @@ s32 cellGcmSetFlipMode(u32 mode) break; default: - return CELL_EINVAL; + break; } - - return CELL_OK; } void cellGcmSetFlipStatus() { cellGcmSys.warning("cellGcmSetFlipStatus()"); - fxm::get()->flip_status = 0; + fxm::get()->flip_status = CELL_GCM_DISPLAY_FLIP_STATUS_DONE; } s32 cellGcmSetPrepareFlip(ppu_thread& ppu, vm::ptr ctxt, u32 id) { - cellGcmSys.trace("cellGcmSetPrepareFlip(ctx=*0x%x, id=0x%x)", ctxt, id); + cellGcmSys.trace("cellGcmSetPrepareFlip(ctxt=*0x%x, id=0x%x)", ctxt, id); if (id > 7) { @@ -532,7 +526,7 @@ s32 cellGcmSetFlip(ppu_thread& ppu, vm::ptr ctxt, u32 id) return CELL_OK; } -s32 cellGcmSetSecondVFrequency(u32 freq) +void cellGcmSetSecondVFrequency(u32 freq) { cellGcmSys.warning("cellGcmSetSecondVFrequency(level=%d)", freq); @@ -552,10 +546,10 @@ s32 cellGcmSetSecondVFrequency(u32 freq) render->frequency_mode = freq; cellGcmSys.todo("Unimplemented display frequency: Disabled"); break; - default: cellGcmSys.error("Improper display frequency specified!"); return CELL_OK; + default: + cellGcmSys.error("Improper display frequency specified!"); + break; } - - return CELL_OK; } s32 cellGcmSetTileInfo(u8 index, u8 location, u32 offset, u32 size, u32 pitch, u8 comp, u16 base, u8 bank) @@ -608,9 +602,9 @@ void cellGcmSetUserHandler(vm::ptr handler) fxm::get()->user_handler = handler; } -s32 cellGcmSetUserCommand() +void cellGcmSetUserCommand(vm::ptr ctxt, u32 cause) { - fmt::throw_exception("Unimplemented" HERE); + cellGcmSys.todo("cellGcmSetUserCommand(ctxt=*0x%x, cause=0x%x)", ctxt, cause); } void cellGcmSetVBlankHandler(vm::ptr handler) @@ -620,13 +614,11 @@ void cellGcmSetVBlankHandler(vm::ptr handler) fxm::get()->vblank_handler = handler; } -s32 cellGcmSetWaitFlip(vm::ptr ctxt) +void cellGcmSetWaitFlip(vm::ptr ctxt) { - cellGcmSys.warning("cellGcmSetWaitFlip(ctx=*0x%x)", ctxt); + cellGcmSys.warning("cellGcmSetWaitFlip(ctxt=*0x%x)", ctxt); // TODO: emit RSX command for "wait flip" operation - - return CELL_OK; } s32 cellGcmSetWaitFlipUnsafe() @@ -634,7 +626,7 @@ s32 cellGcmSetWaitFlipUnsafe() fmt::throw_exception("Unimplemented" HERE); } -s32 cellGcmSetZcull(u8 index, u32 offset, u32 width, u32 height, u32 cullStart, u32 zFormat, u32 aaFormat, u32 zCullDir, u32 zCullFormat, u32 sFunc, u32 sRef, u32 sMask) +void cellGcmSetZcull(u8 index, u32 offset, u32 width, u32 height, u32 cullStart, u32 zFormat, u32 aaFormat, u32 zCullDir, u32 zCullFormat, u32 sFunc, u32 sRef, u32 sMask) { cellGcmSys.todo("cellGcmSetZcull(index=%d, offset=0x%x, width=%d, height=%d, cullStart=0x%x, zFormat=0x%x, aaFormat=0x%x, zCullDir=0x%x, zCullFormat=0x%x, sFunc=0x%x, sRef=0x%x, sMask=0x%x)", index, offset, width, height, cullStart, zFormat, aaFormat, zCullDir, zCullFormat, sFunc, sRef, sMask); @@ -642,7 +634,7 @@ s32 cellGcmSetZcull(u8 index, u32 offset, u32 width, u32 height, u32 cullStart, if (index >= rsx::limits::zculls_count) { cellGcmSys.error("cellGcmSetZcull: CELL_GCM_ERROR_INVALID_VALUE"); - return CELL_GCM_ERROR_INVALID_VALUE; + return; } const auto render = fxm::get(); @@ -661,7 +653,6 @@ s32 cellGcmSetZcull(u8 index, u32 offset, u32 width, u32 height, u32 cullStart, zcull.sMask = sMask; vm::_ptr(render->zculls_addr)[index] = zcull.pack(); - return CELL_OK; } s32 cellGcmUnbindTile(u8 index) @@ -685,8 +676,8 @@ s32 cellGcmUnbindZcull(u8 index) if (index >= 8) { - cellGcmSys.error("cellGcmUnbindZcull: CELL_EINVAL"); - return CELL_EINVAL; + cellGcmSys.error("cellGcmUnbindZcull: CELL_GCM_ERROR_INVALID_VALUE"); + return CELL_GCM_ERROR_INVALID_VALUE; } fxm::get()->zculls[index].binded = false; @@ -724,10 +715,9 @@ s32 cellGcmGetCurrentDisplayBufferId(vm::ptr id) return CELL_OK; } -s32 cellGcmSetInvalidateTile() +void cellGcmSetInvalidateTile(u8 index) { - UNIMPLEMENTED_FUNC(cellGcmSys); - return CELL_OK; + cellGcmSys.todo("cellGcmSetInvalidateTile(index=%d)", index); } s32 cellGcmTerminate() @@ -737,14 +727,14 @@ s32 cellGcmTerminate() s32 cellGcmDumpGraphicsError() { - UNIMPLEMENTED_FUNC(cellGcmSys); + cellGcmSys.todo("cellGcmDumpGraphicsError()"); return CELL_OK; } -s32 cellGcmGetDisplayBufferByFlipIndex() +s32 cellGcmGetDisplayBufferByFlipIndex(u32 qid) { - UNIMPLEMENTED_FUNC(cellGcmSys); - return CELL_OK; + cellGcmSys.todo("cellGcmGetDisplayBufferByFlipIndex(qid=%d)", qid); + return -1; } u64 cellGcmGetLastFlipTime() @@ -783,7 +773,7 @@ s32 cellGcmInitSystemMode(u64 mode) s32 cellGcmSetFlipImmediate(u8 id) { - cellGcmSys.todo("cellGcmSetFlipImmediate(fid=0x%x)", id); + cellGcmSys.todo("cellGcmSetFlipImmediate(id=0x%x)", id); if (id > 7) { @@ -796,16 +786,14 @@ s32 cellGcmSetFlipImmediate(u8 id) return CELL_OK; } -s32 cellGcmSetGraphicsHandler() +void cellGcmSetGraphicsHandler(vm::ptr handler) { - UNIMPLEMENTED_FUNC(cellGcmSys); - return CELL_OK; + cellGcmSys.todo("cellGcmSetGraphicsHandler(handler=*0x%x)", handler); } -s32 cellGcmSetQueueHandler() +void cellGcmSetQueueHandler(vm::ptr handler) { - UNIMPLEMENTED_FUNC(cellGcmSys); - return CELL_OK; + cellGcmSys.todo("cellGcmSetQueueHandler(handler=*0x%x)", handler); } s32 cellGcmSetSecondVHandler(vm::ptr handler) @@ -814,15 +802,14 @@ s32 cellGcmSetSecondVHandler(vm::ptr handler) return CELL_OK; } -s32 cellGcmSetVBlankFrequency() +void cellGcmSetVBlankFrequency(u32 freq) { - UNIMPLEMENTED_FUNC(cellGcmSys); - return CELL_OK; + cellGcmSys.todo("cellGcmSetVBlankFrequency(freq=%d)", freq); } s32 cellGcmSortRemapEaIoAddress() { - UNIMPLEMENTED_FUNC(cellGcmSys); + cellGcmSys.todo("cellGcmSortRemapEaIoAddress()"); return CELL_OK; } @@ -914,7 +901,7 @@ s32 gcmMapEaIoAddress(u32 ea, u32 io, u32 size, bool is_strict) } else { - cellGcmSys.error("cellGcmMapEaIoAddress: CELL_GCM_ERROR_FAILURE"); + cellGcmSys.error("gcmMapEaIoAddress: CELL_GCM_ERROR_FAILURE"); return CELL_GCM_ERROR_FAILURE; } @@ -1063,13 +1050,13 @@ s32 cellGcmUnreserveIoMapSize(u32 size) if (size & 0xFFFFF) { - cellGcmSys.error("cellGcmReserveIoMapSize: CELL_GCM_ERROR_INVALID_ALIGNMENT"); + cellGcmSys.error("cellGcmUnreserveIoMapSize: CELL_GCM_ERROR_INVALID_ALIGNMENT"); return CELL_GCM_ERROR_INVALID_ALIGNMENT; } if (size > RSXIOMem.GetReservedAmount()) { - cellGcmSys.error("cellGcmReserveIoMapSize: CELL_GCM_ERROR_INVALID_VALUE"); + cellGcmSys.error("cellGcmUnreserveIoMapSize: CELL_GCM_ERROR_INVALID_VALUE"); return CELL_GCM_ERROR_INVALID_VALUE; } @@ -1078,42 +1065,42 @@ s32 cellGcmUnreserveIoMapSize(u32 size) } //---------------------------------------------------------------------------- -// Cursor +// Cursor Functions //---------------------------------------------------------------------------- s32 cellGcmInitCursor() { - UNIMPLEMENTED_FUNC(cellGcmSys); + cellGcmSys.todo("cellGcmInitCursor()"); return CELL_OK; } s32 cellGcmSetCursorPosition(s32 x, s32 y) { - UNIMPLEMENTED_FUNC(cellGcmSys); + cellGcmSys.todo("cellGcmSetCursorPosition(x=%d, y=%d)", x, y); return CELL_OK; } s32 cellGcmSetCursorDisable() { - UNIMPLEMENTED_FUNC(cellGcmSys); + cellGcmSys.todo("cellGcmSetCursorDisable()"); return CELL_OK; } s32 cellGcmUpdateCursor() { - UNIMPLEMENTED_FUNC(cellGcmSys); + cellGcmSys.todo("cellGcmUpdateCursor()"); return CELL_OK; } s32 cellGcmSetCursorEnable() { - UNIMPLEMENTED_FUNC(cellGcmSys); + cellGcmSys.todo("cellGcmSetCursorEnable()"); return CELL_OK; } s32 cellGcmSetCursorImageOffset(u32 offset) { - UNIMPLEMENTED_FUNC(cellGcmSys); + cellGcmSys.todo("cellGcmSetCursorImageOffset(offset=0x%x)", offset); return CELL_OK; } @@ -1129,7 +1116,7 @@ void cellGcmSetDefaultCommandBuffer() s32 cellGcmSetDefaultCommandBufferAndSegmentWordSize(u32 bufferSize, u32 segmentSize) { - cellGcmSys.warning("cellGcmSetDefaultCommandBufferAndSegmentWordSize(bufferSize = 0x%x, segmentSize = 0x%x)", bufferSize, segmentSize); + cellGcmSys.warning("cellGcmSetDefaultCommandBufferAndSegmentWordSize(bufferSize=0x%x, segmentSize=0x%x)", bufferSize, segmentSize); const auto& put = vm::_ref(gcm_info.control_addr).put; const auto& get = vm::_ref(gcm_info.control_addr).get; @@ -1234,19 +1221,22 @@ s32 _cellGcmFunc38() fmt::throw_exception("Unimplemented" HERE); } -s32 cellGcmGpadGetStatus() +s32 cellGcmGpadGetStatus(vm::ptr status) { - fmt::throw_exception("Unimplemented" HERE); + cellGcmSys.todo("cellGcmGpadGetStatus(status=*0x%x)", status); + return CELL_OK; } -s32 cellGcmGpadNotifyCaptureSurface() +s32 cellGcmGpadNotifyCaptureSurface(vm::ptr surface) { - fmt::throw_exception("Unimplemented" HERE); + cellGcmSys.todo("cellGcmGpadNotifyCaptureSurface(surface=*0x%x)", surface); + return CELL_OK; } -s32 cellGcmGpadCaptureSnapshot() +s32 cellGcmGpadCaptureSnapshot(u32 num) { - fmt::throw_exception("Unimplemented" HERE); + cellGcmSys.todo("cellGcmGpadCaptureSnapshot(num=%d)", num); + return CELL_OK; } diff --git a/rpcs3/Emu/Cell/Modules/cellKb.cpp b/rpcs3/Emu/Cell/Modules/cellKb.cpp index ecaa46f89e..98713c7893 100644 --- a/rpcs3/Emu/Cell/Modules/cellKb.cpp +++ b/rpcs3/Emu/Cell/Modules/cellKb.cpp @@ -6,9 +6,32 @@ #include "Emu/Io/KeyboardHandler.h" #include "cellKb.h" +namespace vm { using namespace ps3; } + extern logs::channel sys_io; -s32 cellKbInit(u32 max_connect) +template<> +void fmt_class_string::format(std::string& out, u64 arg) +{ + format_enum(out, arg, [](auto error) + { + switch (error) + { + STR_CASE(CELL_KB_ERROR_FATAL); + STR_CASE(CELL_KB_ERROR_INVALID_PARAMETER); + STR_CASE(CELL_KB_ERROR_ALREADY_INITIALIZED); + STR_CASE(CELL_KB_ERROR_UNINITIALIZED); + STR_CASE(CELL_KB_ERROR_RESOURCE_ALLOCATION_FAILED); + STR_CASE(CELL_KB_ERROR_READ_FAILED); + STR_CASE(CELL_KB_ERROR_NO_DEVICE); + STR_CASE(CELL_KB_ERROR_SYS_SETTING_FAILED); + } + + return unknown; + }); +} + +error_code cellKbInit(u32 max_connect) { sys_io.warning("cellKbInit(max_connect=%d)", max_connect); @@ -25,7 +48,7 @@ s32 cellKbInit(u32 max_connect) return CELL_OK; } -s32 cellKbEnd() +error_code cellKbEnd() { sys_io.notice("cellKbEnd()"); @@ -35,7 +58,7 @@ s32 cellKbEnd() return CELL_OK; } -s32 cellKbClearBuf(u32 port_no) +error_code cellKbClearBuf(u32 port_no) { sys_io.trace("cellKbClearBuf(port_no=%d)", port_no); @@ -54,7 +77,7 @@ s32 cellKbClearBuf(u32 port_no) u16 cellKbCnvRawCode(u32 arrange, u32 mkey, u32 led, u16 rawcode) { - sys_io.trace("cellKbCnvRawCode(arrange=%d,mkey=%d,led=%d,rawcode=%d)", arrange, mkey, led, rawcode); + sys_io.trace("cellKbCnvRawCode(arrange=%d, mkey=%d, led=%d, rawcode=%d)", arrange, mkey, led, rawcode); // CELL_KB_RAWDAT if (rawcode <= 0x03 || rawcode == 0x29 || rawcode == 0x35 || (rawcode >= 0x39 && rawcode <= 0x53) || rawcode == 0x65 || rawcode == 0x88 || rawcode == 0x8A || rawcode == 0x8B) @@ -98,7 +121,7 @@ u16 cellKbCnvRawCode(u32 arrange, u32 mkey, u32 led, u16 rawcode) return 0x0000; } -s32 cellKbGetInfo(vm::ptr info) +error_code cellKbGetInfo(vm::ptr info) { sys_io.trace("cellKbGetInfo(info=*0x%x)", info); @@ -120,7 +143,7 @@ s32 cellKbGetInfo(vm::ptr info) return CELL_OK; } -s32 cellKbRead(u32 port_no, vm::ptr data) +error_code cellKbRead(u32 port_no, vm::ptr data) { sys_io.trace("cellKbRead(port_no=%d, data=*0x%x)", port_no, data); @@ -149,9 +172,9 @@ s32 cellKbRead(u32 port_no, vm::ptr data) return CELL_OK; } -s32 cellKbSetCodeType(u32 port_no, u32 type) +error_code cellKbSetCodeType(u32 port_no, u32 type) { - sys_io.trace("cellKbSetCodeType(port_no=%d,type=%d)", port_no, type); + sys_io.trace("cellKbSetCodeType(port_no=%d, type=%d)", port_no, type); const auto handler = fxm::get(); @@ -163,15 +186,15 @@ s32 cellKbSetCodeType(u32 port_no, u32 type) return CELL_OK; } -s32 cellKbSetLEDStatus(u32 port_no, u8 led) +error_code cellKbSetLEDStatus(u32 port_no, u8 led) { - UNIMPLEMENTED_FUNC(sys_io); + sys_io.todo("cellKbSetLEDStatus(port_no=%d, led=%d)", port_no, led); return CELL_OK; } -s32 cellKbSetReadMode(u32 port_no, u32 rmode) +error_code cellKbSetReadMode(u32 port_no, u32 rmode) { - sys_io.trace("cellKbSetReadMode(port_no=%d,rmode=%d)", port_no, rmode); + sys_io.trace("cellKbSetReadMode(port_no=%d, rmode=%d)", port_no, rmode); const auto handler = fxm::get(); @@ -184,7 +207,7 @@ s32 cellKbSetReadMode(u32 port_no, u32 rmode) return CELL_OK; } -s32 cellKbGetConfiguration(u32 port_no, vm::ptr config) +error_code cellKbGetConfiguration(u32 port_no, vm::ptr config) { sys_io.trace("cellKbGetConfiguration(port_no=%d, config=*0x%x)", port_no, config); diff --git a/rpcs3/Emu/Cell/Modules/cellKb.h b/rpcs3/Emu/Cell/Modules/cellKb.h index 3efe7c48c2..ad4efdc884 100644 --- a/rpcs3/Emu/Cell/Modules/cellKb.h +++ b/rpcs3/Emu/Cell/Modules/cellKb.h @@ -1,17 +1,15 @@ #pragma once -namespace vm { using namespace ps3; } - -enum +enum CellKbError : u32 { - CELL_KB_ERROR_FATAL = 0x80121001, - CELL_KB_ERROR_INVALID_PARAMETER = 0x80121002, - CELL_KB_ERROR_ALREADY_INITIALIZED = 0x80121003, - CELL_KB_ERROR_UNINITIALIZED = 0x80121004, + CELL_KB_ERROR_FATAL = 0x80121001, + CELL_KB_ERROR_INVALID_PARAMETER = 0x80121002, + CELL_KB_ERROR_ALREADY_INITIALIZED = 0x80121003, + CELL_KB_ERROR_UNINITIALIZED = 0x80121004, CELL_KB_ERROR_RESOURCE_ALLOCATION_FAILED = 0x80121005, - CELL_KB_ERROR_READ_FAILED = 0x80121006, - CELL_KB_ERROR_NO_DEVICE = 0x80121007, - CELL_KB_ERROR_SYS_SETTING_FAILED = 0x80121008, + CELL_KB_ERROR_READ_FAILED = 0x80121006, + CELL_KB_ERROR_NO_DEVICE = 0x80121007, + CELL_KB_ERROR_SYS_SETTING_FAILED = 0x80121008, }; static const u32 CELL_KB_MAX_KEYBOARDS = 127; diff --git a/rpcs3/Emu/Cell/Modules/cellKey2char.cpp b/rpcs3/Emu/Cell/Modules/cellKey2char.cpp index 9ca2554aea..a13e17b80e 100644 --- a/rpcs3/Emu/Cell/Modules/cellKey2char.cpp +++ b/rpcs3/Emu/Cell/Modules/cellKey2char.cpp @@ -1,12 +1,13 @@ #include "stdafx.h" #include "Emu/Cell/PPUModule.h" +namespace vm { using namespace ps3; } + logs::channel cellKey2char("cellKey2char", logs::level::notice); // Return Codes -enum +enum CellKey2CharError : u32 { - CELL_K2C_OK = 0x00000000, CELL_K2C_ERROR_FATAL = 0x80121301, CELL_K2C_ERROR_INVALID_HANDLE = 0x80121302, CELL_K2C_ERROR_INVALID_PARAMETER = 0x80121303, @@ -15,33 +16,59 @@ enum CELL_K2C_ERROR_OTHER = 0x80121306, }; -s32 cellKey2CharOpen() +struct CellKey2CharKeyData { - UNIMPLEMENTED_FUNC(cellKey2char); + be_t led; + be_t mkey; + be_t keycode; +}; + +template<> +void fmt_class_string::format(std::string& out, u64 arg) +{ + format_enum(out, arg, [](auto error) + { + switch (error) + { + STR_CASE(CELL_K2C_ERROR_FATAL); + STR_CASE(CELL_K2C_ERROR_INVALID_HANDLE); + STR_CASE(CELL_K2C_ERROR_INVALID_PARAMETER); + STR_CASE(CELL_K2C_ERROR_ALREADY_INITIALIZED); + STR_CASE(CELL_K2C_ERROR_UNINITIALIZED); + STR_CASE(CELL_K2C_ERROR_OTHER); + } + + return unknown; + }); +} + +error_code cellKey2CharOpen(vm::ptr handle) +{ + cellKey2char.todo("cellKey2CharOpen(handle=*0x%x)", handle); return CELL_OK; } -s32 cellKey2CharClose() +error_code cellKey2CharClose(vm::ptr handle) { - UNIMPLEMENTED_FUNC(cellKey2char); + cellKey2char.todo("cellKey2CharClose(handle=*0x%x)", handle); return CELL_OK; } -s32 cellKey2CharGetChar() +error_code cellKey2CharGetChar(vm::ptr handle, vm::ptr kdata, vm::pptr charCode, vm::ptr charNum, vm::ptr processed) { - UNIMPLEMENTED_FUNC(cellKey2char); + cellKey2char.todo("cellKey2CharGetChar(handle=*0x%x, kdata=*0x%x, charCode=**0x%x, charNum=*0x%x, processed=*0x%x)", handle, kdata, charCode, charNum, processed); return CELL_OK; } -s32 cellKey2CharSetMode() +error_code cellKey2CharSetMode(vm::ptr handle, s32 mode) { - UNIMPLEMENTED_FUNC(cellKey2char); + cellKey2char.todo("cellKey2CharSetMode(handle=*0x%x, mode=0x%x)", handle, mode); return CELL_OK; } -s32 cellKey2CharSetArrangement() +error_code cellKey2CharSetArrangement(vm::ptr handle, s32 arrange) { - UNIMPLEMENTED_FUNC(cellKey2char); + cellKey2char.todo("cellKey2CharSetArrangement(handle=*0x%x, arrange=0x%x)", handle, arrange); return CELL_OK; } diff --git a/rpcs3/Emu/Cell/Modules/cellNetCtl.cpp b/rpcs3/Emu/Cell/Modules/cellNetCtl.cpp index 2646942bc2..ebdd613528 100644 --- a/rpcs3/Emu/Cell/Modules/cellNetCtl.cpp +++ b/rpcs3/Emu/Cell/Modules/cellNetCtl.cpp @@ -3,6 +3,7 @@ #include "Emu/System.h" #include "Emu/Cell/PPUModule.h" +#include "cellGame.h" #include "cellSysutil.h" #include "cellNetCtl.h" @@ -10,6 +11,64 @@ logs::channel cellNetCtl("cellNetCtl", logs::level::notice); +template<> +void fmt_class_string::format(std::string& out, u64 arg) +{ + format_enum(out, arg, [](auto error) + { + switch (error) + { + STR_CASE(CELL_NET_CTL_ERROR_NOT_INITIALIZED); + STR_CASE(CELL_NET_CTL_ERROR_NOT_TERMINATED); + STR_CASE(CELL_NET_CTL_ERROR_HANDLER_MAX); + STR_CASE(CELL_NET_CTL_ERROR_ID_NOT_FOUND); + STR_CASE(CELL_NET_CTL_ERROR_INVALID_ID); + STR_CASE(CELL_NET_CTL_ERROR_INVALID_CODE); + STR_CASE(CELL_NET_CTL_ERROR_INVALID_ADDR); + STR_CASE(CELL_NET_CTL_ERROR_NOT_CONNECTED); + STR_CASE(CELL_NET_CTL_ERROR_NOT_AVAIL); + STR_CASE(CELL_NET_CTL_ERROR_INVALID_TYPE); + STR_CASE(CELL_NET_CTL_ERROR_INVALID_SIZE); + STR_CASE(CELL_NET_CTL_ERROR_NET_DISABLED); + STR_CASE(CELL_NET_CTL_ERROR_NET_NOT_CONNECTED); + STR_CASE(CELL_NET_CTL_ERROR_NP_NO_ACCOUNT); + STR_CASE(CELL_NET_CTL_ERROR_NP_RESERVED1); + STR_CASE(CELL_NET_CTL_ERROR_NP_RESERVED2); + STR_CASE(CELL_NET_CTL_ERROR_NET_CABLE_NOT_CONNECTED); + STR_CASE(CELL_NET_CTL_ERROR_DIALOG_CANCELED); + STR_CASE(CELL_NET_CTL_ERROR_DIALOG_ABORTED); + + STR_CASE(CELL_NET_CTL_ERROR_WLAN_DEAUTHED); + STR_CASE(CELL_NET_CTL_ERROR_WLAN_KEYINFO_EXCHNAGE_TIMEOUT); + STR_CASE(CELL_NET_CTL_ERROR_WLAN_ASSOC_FAILED); + STR_CASE(CELL_NET_CTL_ERROR_WLAN_AP_DISAPPEARED); + STR_CASE(CELL_NET_CTL_ERROR_PPPOE_SESSION_INIT); + STR_CASE(CELL_NET_CTL_ERROR_PPPOE_SESSION_NO_PADO); + STR_CASE(CELL_NET_CTL_ERROR_PPPOE_SESSION_NO_PADS); + STR_CASE(CELL_NET_CTL_ERROR_PPPOE_SESSION_GET_PADT); + STR_CASE(CELL_NET_CTL_ERROR_PPPOE_SESSION_SERVICE_NAME); + STR_CASE(CELL_NET_CTL_ERROR_PPPOE_SESSION_AC_SYSTEM); + STR_CASE(CELL_NET_CTL_ERROR_PPPOE_SESSION_GENERIC); + STR_CASE(CELL_NET_CTL_ERROR_PPPOE_STATUS_AUTH); + STR_CASE(CELL_NET_CTL_ERROR_PPPOE_STATUS_NETWORK); + STR_CASE(CELL_NET_CTL_ERROR_PPPOE_STATUS_TERMINATE); + STR_CASE(CELL_NET_CTL_ERROR_DHCP_LEASE_TIME); + + STR_CASE(CELL_GAMEUPDATE_ERROR_NOT_INITIALIZED); + STR_CASE(CELL_GAMEUPDATE_ERROR_ALREADY_INITIALIZED); + STR_CASE(CELL_GAMEUPDATE_ERROR_INVALID_ADDR); + STR_CASE(CELL_GAMEUPDATE_ERROR_INVALID_SIZE); + STR_CASE(CELL_GAMEUPDATE_ERROR_INVALID_MEMORY_CONTAINER); + STR_CASE(CELL_GAMEUPDATE_ERROR_INSUFFICIENT_MEMORY_CONTAINER); + STR_CASE(CELL_GAMEUPDATE_ERROR_BUSY); + STR_CASE(CELL_GAMEUPDATE_ERROR_NOT_START); + STR_CASE(CELL_GAMEUPDATE_ERROR_LOAD_FAILED); + } + + return unknown; + }); +} + cfg::map_entry g_cfg_net_status(cfg::root.net, "Connection status", { { "Disconnected", CELL_NET_CTL_STATE_Disconnected }, @@ -20,21 +79,21 @@ cfg::map_entry g_cfg_net_status(cfg::root.net, "Connection status", cfg::string_entry g_cfg_net_ip_address(cfg::root.net, "IP address", "192.168.1.1"); -s32 cellNetCtlInit() +error_code cellNetCtlInit() { cellNetCtl.warning("cellNetCtlInit()"); return CELL_OK; } -s32 cellNetCtlTerm() +error_code cellNetCtlTerm() { cellNetCtl.warning("cellNetCtlTerm()"); return CELL_OK; } -s32 cellNetCtlGetState(vm::ptr state) +error_code cellNetCtlGetState(vm::ptr state) { cellNetCtl.trace("cellNetCtlGetState(state=*0x%x)", state); @@ -42,21 +101,21 @@ s32 cellNetCtlGetState(vm::ptr state) return CELL_OK; } -s32 cellNetCtlAddHandler(vm::ptr handler, vm::ptr arg, vm::ptr hid) +error_code cellNetCtlAddHandler(vm::ptr handler, vm::ptr arg, vm::ptr hid) { cellNetCtl.todo("cellNetCtlAddHandler(handler=*0x%x, arg=*0x%x, hid=*0x%x)", handler, arg, hid); return CELL_OK; } -s32 cellNetCtlDelHandler(s32 hid) +error_code cellNetCtlDelHandler(s32 hid) { cellNetCtl.todo("cellNetCtlDelHandler(hid=0x%x)", hid); return CELL_OK; } -s32 cellNetCtlGetInfo(s32 code, vm::ptr info) +error_code cellNetCtlGetInfo(s32 code, vm::ptr info) { cellNetCtl.todo("cellNetCtlGetInfo(code=0x%x (%s), info=*0x%x)", code, InfoCodeToName(code), info); @@ -95,7 +154,7 @@ s32 cellNetCtlGetInfo(s32 code, vm::ptr info) return CELL_OK; } -s32 cellNetCtlNetStartDialogLoadAsync(vm::ptr param) +error_code cellNetCtlNetStartDialogLoadAsync(vm::ptr param) { cellNetCtl.error("cellNetCtlNetStartDialogLoadAsync(param=*0x%x)", param); @@ -107,14 +166,14 @@ s32 cellNetCtlNetStartDialogLoadAsync(vm::ptr par return CELL_OK; } -s32 cellNetCtlNetStartDialogAbortAsync() +error_code cellNetCtlNetStartDialogAbortAsync() { cellNetCtl.error("cellNetCtlNetStartDialogAbortAsync()"); return CELL_OK; } -s32 cellNetCtlNetStartDialogUnloadAsync(vm::ptr result) +error_code cellNetCtlNetStartDialogUnloadAsync(vm::ptr result) { cellNetCtl.warning("cellNetCtlNetStartDialogUnloadAsync(result=*0x%x)", result); @@ -124,7 +183,7 @@ s32 cellNetCtlNetStartDialogUnloadAsync(vm::ptr return CELL_OK; } -s32 cellNetCtlGetNatInfo(vm::ptr natInfo) +error_code cellNetCtlGetNatInfo(vm::ptr natInfo) { cellNetCtl.todo("cellNetCtlGetNatInfo(natInfo=*0x%x)", natInfo); @@ -137,50 +196,58 @@ s32 cellNetCtlGetNatInfo(vm::ptr natInfo) return CELL_OK; } -s32 cellGameUpdateInit() +error_code cellGameUpdateInit() { - fmt::throw_exception("Unimplemented" HERE); + cellNetCtl.todo("cellGameUpdateInit()"); + return CELL_OK; } -s32 cellGameUpdateTerm() +error_code cellGameUpdateTerm() { - fmt::throw_exception("Unimplemented" HERE); + cellNetCtl.todo("cellGameUpdateTerm()"); + return CELL_OK; } - -s32 cellGameUpdateCheckStartAsync() +error_code cellGameUpdateCheckStartAsync(vm::cptr param, vm::ptr cb_func, vm::ptr userdata) { - fmt::throw_exception("Unimplemented" HERE); + cellNetCtl.todo("cellGameUpdateCheckStartAsync(param=*0x%x, cb_func=*0x%x, userdata=*0x%x)", param, cb_func, userdata); + return CELL_OK; } -s32 cellGameUpdateCheckFinishAsync() +error_code cellGameUpdateCheckFinishAsync(vm::ptr cb_func, vm::ptr userdata) { - fmt::throw_exception("Unimplemented" HERE); + cellNetCtl.todo("cellGameUpdateCheckFinishAsync(cb_func=*0x%x, userdata=*0x%x)", cb_func, userdata); + return CELL_OK; } -s32 cellGameUpdateCheckStartWithoutDialogAsync() +error_code cellGameUpdateCheckStartWithoutDialogAsync(vm::ptr cb_func, vm::ptr userdata) { - fmt::throw_exception("Unimplemented" HERE); + cellNetCtl.todo("cellGameUpdateCheckStartWithoutDialogAsync(cb_func=*0x%x, userdata=*0x%x)", cb_func, userdata); + return CELL_OK; } -s32 cellGameUpdateCheckAbort() +error_code cellGameUpdateCheckAbort() { - fmt::throw_exception("Unimplemented" HERE); + cellNetCtl.todo("cellGameUpdateCheckAbort()"); + return CELL_OK; } -s32 cellGameUpdateCheckStartAsyncEx() +error_code cellGameUpdateCheckStartAsyncEx(vm::cptr param, vm::ptr cb_func, vm::ptr userdata) { - fmt::throw_exception("Unimplemented" HERE); + cellNetCtl.todo("cellGameUpdateCheckStartAsyncEx(param=*0x%x, cb_func=*0x%x, userdata=*0x%x)", param, cb_func, userdata); + return CELL_OK; } -s32 cellGameUpdateCheckFinishAsyncEx() +error_code cellGameUpdateCheckFinishAsyncEx(vm::ptr cb_func, vm::ptr userdata) { - fmt::throw_exception("Unimplemented" HERE); + cellNetCtl.todo("cellGameUpdateCheckFinishAsyncEx(cb_func=*0x%x, userdata=*0x%x)", cb_func, userdata); + return CELL_OK; } -s32 cellGameUpdateCheckStartWithoutDialogAsyncEx() +error_code cellGameUpdateCheckStartWithoutDialogAsyncEx(vm::ptr cb_func, vm::ptr userdata) { - fmt::throw_exception("Unimplemented" HERE); + cellNetCtl.todo("cellGameUpdateCheckStartWithoutDialogAsyncEx(cb_func=*0x%x, userdata=*0x%x)", cb_func, userdata); + return CELL_OK; } diff --git a/rpcs3/Emu/Cell/Modules/cellNetCtl.h b/rpcs3/Emu/Cell/Modules/cellNetCtl.h index 28900f7a56..4dcb74f63c 100644 --- a/rpcs3/Emu/Cell/Modules/cellNetCtl.h +++ b/rpcs3/Emu/Cell/Modules/cellNetCtl.h @@ -3,7 +3,7 @@ namespace vm { using namespace ps3; } // Error Codes -enum +enum CellNetCtlError : u32 { CELL_NET_CTL_ERROR_NOT_INITIALIZED = 0x80130101, CELL_NET_CTL_ERROR_NOT_TERMINATED = 0x80130102, @@ -40,6 +40,16 @@ enum CELL_NET_CTL_ERROR_PPPOE_STATUS_NETWORK = 0x80130413, CELL_NET_CTL_ERROR_PPPOE_STATUS_TERMINATE = 0x80130414, CELL_NET_CTL_ERROR_DHCP_LEASE_TIME = 0x80130504, + + CELL_GAMEUPDATE_ERROR_NOT_INITIALIZED = 0x8002cc01, + CELL_GAMEUPDATE_ERROR_ALREADY_INITIALIZED = 0x8002cc02, + CELL_GAMEUPDATE_ERROR_INVALID_ADDR = 0x8002cc03, + CELL_GAMEUPDATE_ERROR_INVALID_SIZE = 0x8002cc04, + CELL_GAMEUPDATE_ERROR_INVALID_MEMORY_CONTAINER = 0x8002cc05, + CELL_GAMEUPDATE_ERROR_INSUFFICIENT_MEMORY_CONTAINER = 0x8002cc06, + CELL_GAMEUPDATE_ERROR_BUSY = 0x8002cc07, + CELL_GAMEUPDATE_ERROR_NOT_START = 0x8002cc08, + CELL_GAMEUPDATE_ERROR_LOAD_FAILED = 0x8002cc09, }; // Network connection states @@ -292,3 +302,20 @@ static const char* InfoCodeToName(s32 code) default: return "???"; } } + +struct CellGameUpdateResult +{ + be_t status; // CellGameUpdateResultStatus + be_t error_code; + char app_ver[CELL_GAME_SYSP_APP_VER_SIZE]; + char padding[2]; +}; + +struct CellGameUpdateParam +{ + be_t size; + be_t cid; +}; + +using CellGameUpdateCallback = void(s32 status, s32 error_code, vm::ptr userdata); +using CellGameUpdateCallbackEx = void(vm::ptr result, vm::ptr userdata); diff --git a/rpcs3/Emu/Cell/Modules/cellSpudll.cpp b/rpcs3/Emu/Cell/Modules/cellSpudll.cpp index 80ecdef94e..62f5c3b72b 100644 --- a/rpcs3/Emu/Cell/Modules/cellSpudll.cpp +++ b/rpcs3/Emu/Cell/Modules/cellSpudll.cpp @@ -3,9 +3,31 @@ #include "cellSpudll.h" +namespace vm { using namespace ps3; } + logs::channel cellSpudll("cellSpudll", logs::level::notice); -s32 cellSpudllGetImageSize(vm::ptr psize, vm::cptr so_elf, vm::cptr config) +template<> +void fmt_class_string::format(std::string& out, u64 arg) +{ + format_enum(out, arg, [](auto error) + { + switch (error) + { + STR_CASE(CELL_SPUDLL_ERROR_INVAL); + STR_CASE(CELL_SPUDLL_ERROR_STAT); + STR_CASE(CELL_SPUDLL_ERROR_ALIGN); + STR_CASE(CELL_SPUDLL_ERROR_NULL_POINTER); + STR_CASE(CELL_SPUDLL_ERROR_SRCH); + STR_CASE(CELL_SPUDLL_ERROR_UNDEF); + STR_CASE(CELL_SPUDLL_ERROR_FATAL); + } + + return unknown; + }); +} + +error_code cellSpudllGetImageSize(vm::ptr psize, vm::cptr so_elf, vm::cptr config) { cellSpudll.todo("cellSpudllGetImageSize(psize=*0x%x, so_elf=*0x%x, config=*0x%x)", psize, so_elf, config); @@ -19,7 +41,7 @@ s32 cellSpudllGetImageSize(vm::ptr psize, vm::cptr so_elf, vm::cptr config) +error_code cellSpudllHandleConfigSetDefaultValues(vm::ptr config) { cellSpudll.trace("cellSpudllHandleConfigSetDefaultValues(config=*0x%x)", config); @@ -31,6 +53,7 @@ s32 cellSpudllHandleConfigSetDefaultValues(vm::ptr confi config->mode = 0; config->dmaTag = 0; config->numMaxReferred = 16; + config->numMaxDepend = 16; config->unresolvedSymbolValueForFunc = vm::null; config->unresolvedSymbolValueForObject = vm::null; config->unresolvedSymbolValueForOther = vm::null; diff --git a/rpcs3/Emu/Cell/Modules/cellSpudll.h b/rpcs3/Emu/Cell/Modules/cellSpudll.h index eb7bafeee8..7fd1bfa4de 100644 --- a/rpcs3/Emu/Cell/Modules/cellSpudll.h +++ b/rpcs3/Emu/Cell/Modules/cellSpudll.h @@ -1,8 +1,6 @@ #pragma once -namespace vm { using namespace ps3; } - -enum +enum CellSpudllError : u32 { CELL_SPUDLL_ERROR_INVAL = 0x80410602, CELL_SPUDLL_ERROR_STAT = 0x8041060f, @@ -19,8 +17,8 @@ struct CellSpudllHandleConfig be_t dmaTag; be_t numMaxReferred; be_t numMaxDepend; - vm::bptr unresolvedSymbolValueForFunc; - vm::bptr unresolvedSymbolValueForObject; - vm::bptr unresolvedSymbolValueForOther; + vm::ps3::bptr unresolvedSymbolValueForFunc; + vm::ps3::bptr unresolvedSymbolValueForObject; + vm::ps3::bptr unresolvedSymbolValueForOther; be_t __reserved__[9]; }; diff --git a/rpcs3/Emu/Cell/Modules/cellStorage.cpp b/rpcs3/Emu/Cell/Modules/cellStorage.cpp index f210b2a4c9..49345a69a9 100644 --- a/rpcs3/Emu/Cell/Modules/cellStorage.cpp +++ b/rpcs3/Emu/Cell/Modules/cellStorage.cpp @@ -1,23 +1,63 @@ #include "stdafx.h" #include "Emu/Cell/PPUModule.h" +namespace vm { using namespace ps3; } + extern logs::channel cellSysutil; -s32 cellStorageDataImportMove() +enum CellStorageError : u32 { - fmt::throw_exception("Unimplemented" HERE); + CELL_STORAGEDATA_ERROR_BUSY = 0x8002be01, + CELL_STORAGEDATA_ERROR_INTERNAL = 0x8002be02, + CELL_STORAGEDATA_ERROR_PARAM = 0x8002be03, + CELL_STORAGEDATA_ERROR_ACCESS_ERROR = 0x8002be04, + CELL_STORAGEDATA_ERROR_FAILURE = 0x8002be05 +}; + +struct CellStorageDataSetParam +{ + be_t fileSizeMax; + vm::bptr title; + vm::bptr reserved; +}; + +using CellStorageDataFinishCallback = void(s32 result, vm::ptr userdata); + +template <> +void fmt_class_string::format(std::string& out, u64 arg) +{ + format_enum(out, arg, [](auto error) + { + switch (error) + { + STR_CASE(CELL_STORAGEDATA_ERROR_ACCESS_ERROR); + STR_CASE(CELL_STORAGEDATA_ERROR_INTERNAL); + STR_CASE(CELL_STORAGEDATA_ERROR_PARAM); + STR_CASE(CELL_STORAGEDATA_ERROR_FAILURE); + STR_CASE(CELL_STORAGEDATA_ERROR_BUSY); + } + + return unknown; + }); } -s32 cellStorageDataImport() +error_code cellStorageDataImportMove(u32 version, vm::ptr srcMediaFile, vm::ptr dstHddDir, vm::ptr param, vm::ptr funcFinish, u32 container, vm::ptr userdata) { - fmt::throw_exception("Unimplemented" HERE); + cellSysutil.todo("cellStorageDataImportMove(version=0x%x, srcMediaFile=%s, dstHddDir=%s, param=*0x%x, funcFinish=*0x%x, container=0x%x, userdata=*0x%x)", version, srcMediaFile, dstHddDir, param, funcFinish, container, userdata); + return CELL_OK; } -s32 cellStorageDataExport() +error_code cellStorageDataImport(u32 version, vm::ptr srcMediaFile, vm::ptr dstHddDir, vm::ptr param, vm::ptr funcFinish, u32 container, vm::ptr userdata) { - fmt::throw_exception("Unimplemented" HERE); + cellSysutil.todo("cellStorageDataImport(version=0x%x, srcMediaFile=%s, dstHddDir=%s, param=*0x%x, funcFinish=*0x%x, container=0x%x, userdata=*0x%x)", version, srcMediaFile, dstHddDir, param, funcFinish, container, userdata); + return CELL_OK; } +error_code cellStorageDataExport(u32 version, vm::ptr srcHddFile, vm::ptr dstMediaDir, vm::ptr param, vm::ptr funcFinish, u32 container, vm::ptr userdata) +{ + cellSysutil.todo("cellStorageDataExport(version=0x%x, srcHddFile=%s, dstMediaDir=%s, param=*0x%x, funcFinish=*0x%x, container=0x%x, userdata=*0x%x)", version, srcHddFile, dstMediaDir, param, funcFinish, container, userdata); + return CELL_OK; +} void cellSysutil_Storage_init() { diff --git a/rpcs3/Emu/Cell/Modules/cellSubdisplay.cpp b/rpcs3/Emu/Cell/Modules/cellSubdisplay.cpp index 3e978e0dcc..7f95dc23bf 100644 --- a/rpcs3/Emu/Cell/Modules/cellSubdisplay.cpp +++ b/rpcs3/Emu/Cell/Modules/cellSubdisplay.cpp @@ -5,86 +5,125 @@ logs::channel cellSubdisplay("cellSubdisplay", logs::level::notice); -s32 cellSubDisplayInit() +template<> +void fmt_class_string::format(std::string& out, u64 arg) { - UNIMPLEMENTED_FUNC(cellSubdisplay); + format_enum(out, arg, [](auto error) + { + switch (error) + { + STR_CASE(CELL_SUBDISPLAY_ERROR_OUT_OF_MEMORY); + STR_CASE(CELL_SUBDISPLAY_ERROR_FATAL); + STR_CASE(CELL_SUBDISPLAY_ERROR_NOT_FOUND); + STR_CASE(CELL_SUBDISPLAY_ERROR_INVALID_VALUE); + STR_CASE(CELL_SUBDISPLAY_ERROR_NOT_INITIALIZED); + STR_CASE(CELL_SUBDISPLAY_ERROR_SET_SAMPLE); + STR_CASE(CELL_SUBDISPLAY_ERROR_AUDIOOUT_IS_BUSY); + STR_CASE(CELL_SUBDISPLAY_ERROR_ZERO_REGISTERED); + } + + return unknown; + }); +} + +error_code cellSubDisplayInit(vm::ptr pParam, vm::ptr func, vm::ptr userdata, u32 container) +{ + cellSubdisplay.todo("cellSubDisplayInit(pParam=*0x%x, func=*0x%x, userdata=*0x%x, container=0x%x)", pParam, func, userdata, container); return CELL_OK; } -s32 cellSubDisplayEnd() +error_code cellSubDisplayEnd() { - UNIMPLEMENTED_FUNC(cellSubdisplay); + cellSubdisplay.todo("cellSubDisplayEnd()"); return CELL_OK; } -s32 cellSubDisplayGetRequiredMemory(vm::ptr pParam) +error_code cellSubDisplayGetRequiredMemory(vm::ptr pParam) { cellSubdisplay.warning("cellSubDisplayGetRequiredMemory(pParam=*0x%x)", pParam); if (pParam->version == CELL_SUBDISPLAY_VERSION_0002) { - return CELL_SUBDISPLAY_0002_MEMORY_CONTAINER_SIZE; + return not_an_error(CELL_SUBDISPLAY_0002_MEMORY_CONTAINER_SIZE); } else { - return CELL_SUBDISPLAY_0001_MEMORY_CONTAINER_SIZE; + return not_an_error(CELL_SUBDISPLAY_0001_MEMORY_CONTAINER_SIZE); } } -s32 cellSubDisplayStart() +error_code cellSubDisplayStart() { - UNIMPLEMENTED_FUNC(cellSubdisplay); + cellSubdisplay.todo("cellSubDisplayStart()"); return CELL_OK; } -s32 cellSubDisplayStop() +error_code cellSubDisplayStop() { - UNIMPLEMENTED_FUNC(cellSubdisplay); + cellSubdisplay.todo("cellSubDisplayStop()"); return CELL_OK; } -s32 cellSubDisplayGetVideoBuffer() +error_code cellSubDisplayGetVideoBuffer(s32 groupId, vm::pptr ppVideoBuf, vm::ptr pSize) { - UNIMPLEMENTED_FUNC(cellSubdisplay); + cellSubdisplay.todo("cellSubDisplayGetVideoBuffer(groupId=%d, ppVideoBuf=**0x%x, pSize=*0x%x)", groupId, ppVideoBuf, pSize); return CELL_OK; } -s32 cellSubDisplayAudioOutBlocking() +error_code cellSubDisplayAudioOutBlocking(s32 groupId, vm::ptr pvData, s32 samples) { - UNIMPLEMENTED_FUNC(cellSubdisplay); + cellSubdisplay.todo("cellSubDisplayAudioOutBlocking(groupId=%d, pvData=*0x%x, samples=%d)", groupId, pvData, samples); + + if (samples % 1024) + { + return CELL_SUBDISPLAY_ERROR_SET_SAMPLE; + } + return CELL_OK; } -s32 cellSubDisplayAudioOutNonBlocking() +error_code cellSubDisplayAudioOutNonBlocking(s32 groupId, vm::ptr pvData, s32 samples) { - UNIMPLEMENTED_FUNC(cellSubdisplay); + cellSubdisplay.todo("cellSubDisplayAudioOutNonBlocking(groupId=%d, pvData=*0x%x, samples=%d)", groupId, pvData, samples); + + if (samples % 1024) + { + return CELL_SUBDISPLAY_ERROR_SET_SAMPLE; + } + return CELL_OK; } -s32 cellSubDisplayGetPeerNum() +error_code cellSubDisplayGetPeerNum(s32 groupId) { - UNIMPLEMENTED_FUNC(cellSubdisplay); + cellSubdisplay.todo("cellSubDisplayGetPeerNum(groupId=%d)", groupId); return CELL_OK; } -s32 cellSubDisplayGetPeerList() +error_code cellSubDisplayGetPeerList(s32 groupId, vm::ptr pInfo, vm::ptr pNum) { - UNIMPLEMENTED_FUNC(cellSubdisplay); + cellSubdisplay.todo("cellSubDisplayGetPeerList(groupId=%d, pInfo=*0x%x, pNum=*0x%x)", groupId, pInfo, pNum); + + *pNum = 0; + return CELL_OK; } DECLARE(ppu_module_manager::cellSubdisplay)("cellSubdisplay", []() { + // Initialization / Termination Functions REG_FUNC(cellSubdisplay, cellSubDisplayInit); REG_FUNC(cellSubdisplay, cellSubDisplayEnd); REG_FUNC(cellSubdisplay, cellSubDisplayGetRequiredMemory); REG_FUNC(cellSubdisplay, cellSubDisplayStart); REG_FUNC(cellSubdisplay, cellSubDisplayStop); + // Data Setting Functions REG_FUNC(cellSubdisplay, cellSubDisplayGetVideoBuffer); REG_FUNC(cellSubdisplay, cellSubDisplayAudioOutBlocking); REG_FUNC(cellSubdisplay, cellSubDisplayAudioOutNonBlocking); + // Peer Status Acquisition Functions REG_FUNC(cellSubdisplay, cellSubDisplayGetPeerNum); REG_FUNC(cellSubdisplay, cellSubDisplayGetPeerList); }); diff --git a/rpcs3/Emu/Cell/Modules/cellSubdisplay.h b/rpcs3/Emu/Cell/Modules/cellSubdisplay.h index ca217f71eb..d369fa8942 100644 --- a/rpcs3/Emu/Cell/Modules/cellSubdisplay.h +++ b/rpcs3/Emu/Cell/Modules/cellSubdisplay.h @@ -3,7 +3,7 @@ namespace vm { using namespace ps3; } // Return Codes -enum +enum CellSubDisplayError : u32 { CELL_SUBDISPLAY_ERROR_OUT_OF_MEMORY = 0x80029851, CELL_SUBDISPLAY_ERROR_FATAL = 0x80029852, @@ -60,8 +60,8 @@ struct CellSubDisplayParam be_t mode; be_t nGroup; be_t nPeer; - vm::bptr videoParam; - vm::bptr audioParam; + CellSubDisplayVideoParam videoParam; + CellSubDisplayAudioParam audioParam; }; struct CellSubDisplayPSPId diff --git a/rpcs3/Emu/Cell/Modules/cellSysutilAp.cpp b/rpcs3/Emu/Cell/Modules/cellSysutilAp.cpp index d989ceb55d..56cf397dd2 100644 --- a/rpcs3/Emu/Cell/Modules/cellSysutilAp.cpp +++ b/rpcs3/Emu/Cell/Modules/cellSysutilAp.cpp @@ -1,6 +1,8 @@ #include "stdafx.h" #include "Emu/Cell/PPUModule.h" +namespace vm { using namespace ps3; } + logs::channel cellSysutilAp("cellSysutilAp", logs::level::notice); // Return Codes @@ -16,21 +18,55 @@ enum CELL_SYSUTIL_AP_ERROR_NETIF_CANNOT_CONNECT = 0x8002cd16, }; +enum +{ + CELL_SYSUTIL_AP_TITLE_ID_LEN = 9, + CELL_SYSUTIL_AP_SSID_LEN = 32, + CELL_SYSUTIL_AP_WPA_KEY_LEN = 64 +}; + +struct CellSysutilApTitleId +{ + char data[CELL_SYSUTIL_AP_TITLE_ID_LEN]; + char padding[3]; +}; + +struct CellSysutilApSsid +{ + char data[CELL_SYSUTIL_AP_SSID_LEN + 1]; + char padding[3]; +}; + +struct CellSysutilApWpaKey +{ + char data[CELL_SYSUTIL_AP_WPA_KEY_LEN + 1]; + char padding[3]; +}; + +struct CellSysutilApParam +{ + be_t type; + be_t wlanFlag; + CellSysutilApTitleId titleId; + CellSysutilApSsid ssid; + CellSysutilApWpaKey wpakey; +}; + s32 cellSysutilApGetRequiredMemSize() { cellSysutilAp.trace("cellSysutilApGetRequiredMemSize()"); return 1024*1024; // Return 1 MB as required size } -s32 cellSysutilApOn() +s32 cellSysutilApOn(vm::ptr pParam, u32 container) { - UNIMPLEMENTED_FUNC(cellSysutilAp); + cellSysutilAp.todo("cellSysutilApOn(pParam=*0x%x, container=0x%x)", pParam, container); return CELL_OK; } s32 cellSysutilApOff() { - UNIMPLEMENTED_FUNC(cellSysutilAp); + cellSysutilAp.todo("cellSysutilApOff()"); return CELL_OK; } diff --git a/rpcs3/Emu/Cell/Modules/cellUserInfo.cpp b/rpcs3/Emu/Cell/Modules/cellUserInfo.cpp index 8f53f60af0..3d15511d70 100644 --- a/rpcs3/Emu/Cell/Modules/cellUserInfo.cpp +++ b/rpcs3/Emu/Cell/Modules/cellUserInfo.cpp @@ -25,7 +25,7 @@ void fmt_class_string::format(std::string& out, u64 arg) }); } -s32 cellUserInfoGetStat(u32 id, vm::ptr stat) +error_code cellUserInfoGetStat(u32 id, vm::ptr stat) { cellUserInfo.warning("cellUserInfoGetStat(id=%d, stat=*0x%x)", id, stat); @@ -62,22 +62,21 @@ s32 cellUserInfoGetStat(u32 id, vm::ptr stat) return CELL_OK; } -s32 cellUserInfoSelectUser_ListType() +error_code cellUserInfoSelectUser_ListType(vm::ptr listType, vm::ptr funcSelect, u32 container, vm::ptr userdata) { - UNIMPLEMENTED_FUNC(cellUserInfo); + cellUserInfo.todo("cellUserInfoSelectUser_ListType(listType=*0x%x, funcSelect=*0x%x, container=0x%x, userdata=*0x%x)", listType, funcSelect, container, userdata); return CELL_OK; } -s32 cellUserInfoSelectUser_SetList() +error_code cellUserInfoSelectUser_SetList(vm::ptr setList, vm::ptr funcSelect, u32 container, vm::ptr userdata) { - UNIMPLEMENTED_FUNC(cellUserInfo); + cellUserInfo.todo("cellUserInfoSelectUser_SetList(setList=*0x%x, funcSelect=*0x%x, container=0x%x, userdata=*0x%x)", setList, funcSelect, container, userdata); return CELL_OK; } -s32 cellUserInfoEnableOverlay() +void cellUserInfoEnableOverlay(s32 enable) { - UNIMPLEMENTED_FUNC(cellUserInfo); - return CELL_OK; + cellUserInfo.todo("cellUserInfoEnableOverlay(enable=%d)", enable); } error_code cellUserInfoGetList(vm::ptr listNum, vm::ptr listBuf, vm::ptr currentUserId) diff --git a/rpcs3/Emu/Cell/Modules/cellUserInfo.h b/rpcs3/Emu/Cell/Modules/cellUserInfo.h index 021f65cccb..03beae5d29 100644 --- a/rpcs3/Emu/Cell/Modules/cellUserInfo.h +++ b/rpcs3/Emu/Cell/Modules/cellUserInfo.h @@ -66,3 +66,5 @@ struct CellUserInfoTypeSet be_t type; // CellUserInfoListType vm::bptr reserved; }; + +using CellUserInfoFinishCallback = void(s32 result, vm::ptr selectedUser, vm::ptr userdata); diff --git a/rpcs3/Emu/Cell/Modules/sceNpTrophy.cpp b/rpcs3/Emu/Cell/Modules/sceNpTrophy.cpp index c95ae73d47..3322ef1e69 100644 --- a/rpcs3/Emu/Cell/Modules/sceNpTrophy.cpp +++ b/rpcs3/Emu/Cell/Modules/sceNpTrophy.cpp @@ -34,22 +34,79 @@ struct trophy_handle_t static const u32 id_count = 1023; }; +template<> +void fmt_class_string::format(std::string& out, u64 arg) +{ + format_enum(out, arg, [](auto error) + { + switch (error) + { + STR_CASE(SCE_NP_TROPHY_ERROR_ALREADY_INITIALIZED); + STR_CASE(SCE_NP_TROPHY_ERROR_NOT_INITIALIZED); + STR_CASE(SCE_NP_TROPHY_ERROR_NOT_SUPPORTED); + STR_CASE(SCE_NP_TROPHY_ERROR_CONTEXT_NOT_REGISTERED); + STR_CASE(SCE_NP_TROPHY_ERROR_OUT_OF_MEMORY); + STR_CASE(SCE_NP_TROPHY_ERROR_INVALID_ARGUMENT); + STR_CASE(SCE_NP_TROPHY_ERROR_EXCEEDS_MAX); + STR_CASE(SCE_NP_TROPHY_ERROR_INSUFFICIENT); + STR_CASE(SCE_NP_TROPHY_ERROR_UNKNOWN_CONTEXT); + STR_CASE(SCE_NP_TROPHY_ERROR_INVALID_FORMAT); + STR_CASE(SCE_NP_TROPHY_ERROR_BAD_RESPONSE); + STR_CASE(SCE_NP_TROPHY_ERROR_INVALID_GRADE); + STR_CASE(SCE_NP_TROPHY_ERROR_INVALID_CONTEXT); + STR_CASE(SCE_NP_TROPHY_ERROR_PROCESSING_ABORTED); + STR_CASE(SCE_NP_TROPHY_ERROR_ABORT); + STR_CASE(SCE_NP_TROPHY_ERROR_UNKNOWN_HANDLE); + STR_CASE(SCE_NP_TROPHY_ERROR_LOCKED); + STR_CASE(SCE_NP_TROPHY_ERROR_HIDDEN); + STR_CASE(SCE_NP_TROPHY_ERROR_CANNOT_UNLOCK_PLATINUM); + STR_CASE(SCE_NP_TROPHY_ERROR_ALREADY_UNLOCKED); + STR_CASE(SCE_NP_TROPHY_ERROR_INVALID_TYPE); + STR_CASE(SCE_NP_TROPHY_ERROR_INVALID_HANDLE); + STR_CASE(SCE_NP_TROPHY_ERROR_INVALID_NP_COMM_ID); + STR_CASE(SCE_NP_TROPHY_ERROR_UNKNOWN_NP_COMM_ID); + STR_CASE(SCE_NP_TROPHY_ERROR_DISC_IO); + STR_CASE(SCE_NP_TROPHY_ERROR_CONF_DOES_NOT_EXIST); + STR_CASE(SCE_NP_TROPHY_ERROR_UNSUPPORTED_FORMAT); + STR_CASE(SCE_NP_TROPHY_ERROR_ALREADY_INSTALLED); + STR_CASE(SCE_NP_TROPHY_ERROR_BROKEN_DATA); + STR_CASE(SCE_NP_TROPHY_ERROR_VERIFICATION_FAILURE); + STR_CASE(SCE_NP_TROPHY_ERROR_INVALID_TROPHY_ID); + STR_CASE(SCE_NP_TROPHY_ERROR_UNKNOWN_TROPHY_ID); + STR_CASE(SCE_NP_TROPHY_ERROR_UNKNOWN_TITLE); + STR_CASE(SCE_NP_TROPHY_ERROR_UNKNOWN_FILE); + STR_CASE(SCE_NP_TROPHY_ERROR_DISC_NOT_MOUNTED); + STR_CASE(SCE_NP_TROPHY_ERROR_SHUTDOWN); + STR_CASE(SCE_NP_TROPHY_ERROR_TITLE_ICON_NOT_FOUND); + STR_CASE(SCE_NP_TROPHY_ERROR_TROPHY_ICON_NOT_FOUND); + STR_CASE(SCE_NP_TROPHY_ERROR_INSUFFICIENT_DISK_SPACE); + STR_CASE(SCE_NP_TROPHY_ERROR_ILLEGAL_UPDATE); + STR_CASE(SCE_NP_TROPHY_ERROR_SAVEDATA_USER_DOES_NOT_MATCH); + STR_CASE(SCE_NP_TROPHY_ERROR_TROPHY_ID_DOES_NOT_EXIST); + STR_CASE(SCE_NP_TROPHY_ERROR_SERVICE_UNAVAILABLE); + STR_CASE(SCE_NP_TROPHY_ERROR_UNKNOWN); + } + + return unknown; + }); +} + // Functions -s32 sceNpTrophyInit(vm::ptr pool, u32 poolSize, u32 containerId, u64 options) +error_code sceNpTrophyInit(vm::ptr pool, u32 poolSize, u32 containerId, u64 options) { sceNpTrophy.warning("sceNpTrophyInit(pool=*0x%x, poolSize=0x%x, containerId=0x%x, options=0x%llx)", pool, poolSize, containerId, options); return CELL_OK; } -s32 sceNpTrophyTerm() +error_code sceNpTrophyTerm() { sceNpTrophy.warning("sceNpTrophyTerm()"); return CELL_OK; } -s32 sceNpTrophyCreateHandle(vm::ptr handle) +error_code sceNpTrophyCreateHandle(vm::ptr handle) { sceNpTrophy.warning("sceNpTrophyCreateHandle(handle=*0x%x)", handle); @@ -63,7 +120,7 @@ s32 sceNpTrophyCreateHandle(vm::ptr handle) return CELL_OK; } -s32 sceNpTrophyDestroyHandle(u32 handle) +error_code sceNpTrophyDestroyHandle(u32 handle) { sceNpTrophy.warning("sceNpTrophyDestroyHandle(handle=0x%x)", handle); @@ -79,7 +136,7 @@ s32 sceNpTrophyDestroyHandle(u32 handle) return CELL_OK; } -s32 sceNpTrophyAbortHandle(u32 handle) +error_code sceNpTrophyAbortHandle(u32 handle) { sceNpTrophy.todo("sceNpTrophyAbortHandle(handle=0x%x)", handle); @@ -104,10 +161,15 @@ void deleteTerminateChar(char* myStr, char _char) { return; } -s32 sceNpTrophyCreateContext(vm::ptr context, vm::cptr commId, vm::cptr commSign, u64 options) +error_code sceNpTrophyCreateContext(vm::ptr context, vm::cptr commId, vm::cptr commSign, u64 options) { sceNpTrophy.warning("sceNpTrophyCreateContext(context=*0x%x, commId=*0x%x, commSign=*0x%x, options=0x%llx)", context, commId, commSign, options); + if (!context) + { + return SCE_NP_TROPHY_ERROR_INVALID_ARGUMENT; + } + // rough checks for further fmt::format call if (commId->num > 99) { @@ -151,7 +213,7 @@ s32 sceNpTrophyCreateContext(vm::ptr context, vm::cptr statusCb, vm::ptr arg, u64 options) +error_code sceNpTrophyRegisterContext(ppu_thread& ppu, u32 context, u32 handle, vm::ptr statusCb, vm::ptr arg, u64 options) { sceNpTrophy.error("sceNpTrophyRegisterContext(context=0x%x, handle=0x%x, statusCb=*0x%x, arg=*0x%x, options=0x%llx)", context, handle, statusCb, arg, options); + if (!statusCb) + { + return SCE_NP_TROPHY_ERROR_INVALID_ARGUMENT; + } + const auto ctxt = idm::get(context); if (!ctxt) @@ -241,12 +308,12 @@ s32 sceNpTrophyRegisterContext(ppu_thread& CPU, u32 context, u32 handle, vm::ptr ctxt->tropusr.reset(tropusr); // TODO: Callbacks - if (statusCb(CPU, context, SCE_NP_TROPHY_STATUS_INSTALLED, 100, 100, arg) < 0) + if (statusCb(ppu, context, SCE_NP_TROPHY_STATUS_INSTALLED, 100, 100, arg) < 0) { return SCE_NP_TROPHY_ERROR_PROCESSING_ABORTED; } - if (statusCb(CPU, context, SCE_NP_TROPHY_STATUS_PROCESSING_COMPLETE, 100, 100, arg) < 0) + if (statusCb(ppu, context, SCE_NP_TROPHY_STATUS_PROCESSING_COMPLETE, 100, 100, arg) < 0) { return SCE_NP_TROPHY_ERROR_PROCESSING_ABORTED; } @@ -254,10 +321,15 @@ s32 sceNpTrophyRegisterContext(ppu_thread& CPU, u32 context, u32 handle, vm::ptr return CELL_OK; } -s32 sceNpTrophyGetRequiredDiskSpace(u32 context, u32 handle, vm::ptr reqspace, u64 options) +error_code sceNpTrophyGetRequiredDiskSpace(u32 context, u32 handle, vm::ptr reqspace, u64 options) { sceNpTrophy.todo("sceNpTrophyGetRequiredDiskSpace(context=0x%x, handle=0x%x, reqspace=*0x%x, options=0x%llx)", context, handle, reqspace, options); + if (!reqspace) + { + return SCE_NP_TROPHY_ERROR_INVALID_ARGUMENT; + } + const auto ctxt = idm::get(context); if (!ctxt) @@ -280,14 +352,28 @@ s32 sceNpTrophyGetRequiredDiskSpace(u32 context, u32 handle, vm::ptr reqspa return CELL_OK; } -s32 sceNpTrophySetSoundLevel(u32 context, u32 handle, u32 level, u64 options) +error_code sceNpTrophySetSoundLevel(u32 context, u32 handle, u32 level, u64 options) { sceNpTrophy.todo("sceNpTrophySetSoundLevel(context=0x%x, handle=0x%x, level=%d, options=0x%llx)", context, handle, level, options); + const auto ctxt = idm::get(context); + + if (!ctxt) + { + return SCE_NP_TROPHY_ERROR_UNKNOWN_CONTEXT; + } + + const auto hndl = idm::get(handle); + + if (!hndl) + { + return SCE_NP_TROPHY_ERROR_UNKNOWN_HANDLE; + } + return CELL_OK; } -s32 sceNpTrophyGetGameInfo(u32 context, u32 handle, vm::ptr details, vm::ptr data) +error_code sceNpTrophyGetGameInfo(u32 context, u32 handle, vm::ptr details, vm::ptr data) { sceNpTrophy.error("sceNpTrophyGetGameInfo(context=0x%x, handle=0x%x, details=*0x%x, data=*0x%x)", context, handle, details, data); @@ -369,7 +455,7 @@ s32 sceNpTrophyGetGameInfo(u32 context, u32 handle, vm::ptr platinumId) +error_code sceNpTrophyUnlockTrophy(u32 context, u32 handle, s32 trophyId, vm::ptr platinumId) { sceNpTrophy.error("sceNpTrophyUnlockTrophy(context=0x%x, handle=0x%x, trophyId=%d, platinumId=*0x%x)", context, handle, trophyId, platinumId); @@ -400,7 +486,7 @@ s32 sceNpTrophyUnlockTrophy(u32 context, u32 handle, s32 trophyId, vm::ptr return CELL_OK; } -s32 sceNpTrophyGetTrophyUnlockState(u32 context, u32 handle, vm::ptr flags, vm::ptr count) +error_code sceNpTrophyGetTrophyUnlockState(u32 context, u32 handle, vm::ptr flags, vm::ptr count) { sceNpTrophy.error("sceNpTrophyGetTrophyUnlockState(context=0x%x, handle=0x%x, flags=*0x%x, count=*0x%x)", context, handle, flags, count); @@ -440,7 +526,7 @@ s32 sceNpTrophyGetTrophyUnlockState(u32 context, u32 handle, vm::ptr details, vm::ptr data) +error_code sceNpTrophyGetTrophyInfo(u32 context, u32 handle, s32 trophyId, vm::ptr details, vm::ptr data) { sceNpTrophy.warning("sceNpTrophyGetTrophyInfo(context=0x%x, handle=0x%x, trophyId=%d, details=*0x%x, data=*0x%x)", context, handle, trophyId, details, data); @@ -523,13 +609,13 @@ s32 sceNpTrophyGetTrophyInfo(u32 context, u32 handle, s32 trophyId, vm::ptr percentage) +error_code sceNpTrophyGetGameProgress(u32 context, u32 handle, vm::ptr percentage) { sceNpTrophy.warning("sceNpTrophyGetGameProgress(context=0x%x, handle=0x%x, percentage=*0x%x)", context, handle, percentage); @@ -566,7 +652,7 @@ s32 sceNpTrophyGetGameProgress(u32 context, u32 handle, vm::ptr percentage) return CELL_OK; } -s32 sceNpTrophyGetGameIcon(u32 context, u32 handle, vm::ptr buffer, vm::ptr size) +error_code sceNpTrophyGetGameIcon(u32 context, u32 handle, vm::ptr buffer, vm::ptr size) { sceNpTrophy.warning("sceNpTrophyGetGameIcon(context=0x%x, handle=0x%x, buffer=*0x%x, size=*0x%x)", context, handle, buffer, size); @@ -608,7 +694,7 @@ s32 sceNpTrophyGetGameIcon(u32 context, u32 handle, vm::ptr buffer, vm::pt return CELL_OK; } -s32 sceNpTrophyGetTrophyIcon(u32 context, u32 handle, s32 trophyId, vm::ptr buffer, vm::ptr size) +error_code sceNpTrophyGetTrophyIcon(u32 context, u32 handle, s32 trophyId, vm::ptr buffer, vm::ptr size) { sceNpTrophy.warning("sceNpTrophyGetTrophyIcon(context=0x%x, handle=0x%x, trophyId=%d, buffer=*0x%x, size=*0x%x)", context, handle, trophyId, buffer, size); diff --git a/rpcs3/Emu/Cell/Modules/sceNpTrophy.h b/rpcs3/Emu/Cell/Modules/sceNpTrophy.h index 9d9234af56..67b5cc5257 100644 --- a/rpcs3/Emu/Cell/Modules/sceNpTrophy.h +++ b/rpcs3/Emu/Cell/Modules/sceNpTrophy.h @@ -3,7 +3,7 @@ namespace vm { using namespace ps3; } // Error codes -enum +enum SceNpTrophyError : u32 { SCE_NP_TROPHY_ERROR_ALREADY_INITIALIZED = 0x80022901, SCE_NP_TROPHY_ERROR_NOT_INITIALIZED = 0x80022902, diff --git a/rpcs3/Emu/Cell/Modules/sys_mempool.cpp b/rpcs3/Emu/Cell/Modules/sys_mempool.cpp index 46ff250d65..016e468703 100644 --- a/rpcs3/Emu/Cell/Modules/sys_mempool.cpp +++ b/rpcs3/Emu/Cell/Modules/sys_mempool.cpp @@ -22,9 +22,10 @@ struct memory_pool_t std::vector> free_blocks; }; -s32 sys_mempool_allocate_block() +vm::ptr sys_mempool_allocate_block(sys_mempool_t mempool) { - fmt::throw_exception("Unimplemented" HERE); + sysPrxForUser.todo("sys_mempool_allocate_block(mempool=%d)", mempool); + return vm::null; } s32 sys_mempool_create(vm::ptr mempool, vm::ptr chunk, const u64 chunk_size, const u64 block_size, const u64 ralignment) diff --git a/rpcs3/Emu/RSX/RSXThread.cpp b/rpcs3/Emu/RSX/RSXThread.cpp index bf66135ddd..23d97f31a9 100644 --- a/rpcs3/Emu/RSX/RSXThread.cpp +++ b/rpcs3/Emu/RSX/RSXThread.cpp @@ -1165,7 +1165,7 @@ namespace rsx this->ioAddress = ioAddress; this->ioSize = ioSize; local_mem_addr = localAddress; - flip_status = 0; + flip_status = CELL_GCM_DISPLAY_FLIP_STATUS_DONE; m_used_gcm_commands.clear(); diff --git a/rpcs3/Emu/RSX/RSXThread.h b/rpcs3/Emu/RSX/RSXThread.h index c45dc53749..9956524504 100644 --- a/rpcs3/Emu/RSX/RSXThread.h +++ b/rpcs3/Emu/RSX/RSXThread.h @@ -192,7 +192,7 @@ namespace rsx std::shared_ptr intr_thread; u32 ioAddress, ioSize; - int flip_status; + u32 flip_status; int flip_mode; int debug_level; int frequency_mode; diff --git a/rpcs3/Emu/RSX/gcm_enums.h b/rpcs3/Emu/RSX/gcm_enums.h index 13a78206f5..99d1e4a456 100644 --- a/rpcs3/Emu/RSX/gcm_enums.h +++ b/rpcs3/Emu/RSX/gcm_enums.h @@ -406,7 +406,7 @@ enum enum { - CELL_GCM_DISPLAY_FLIP_STATUS_ = 0, + CELL_GCM_DISPLAY_FLIP_STATUS_DONE = 0, CELL_GCM_DISPLAY_FLIP_STATUS_WAITING = 1, }; diff --git a/rpcs3/Emu/RSX/rsx_methods.cpp b/rpcs3/Emu/RSX/rsx_methods.cpp index 079c2ca928..8f8b83efc1 100644 --- a/rpcs3/Emu/RSX/rsx_methods.cpp +++ b/rpcs3/Emu/RSX/rsx_methods.cpp @@ -827,7 +827,7 @@ namespace rsx rsx->last_flip_time = get_system_time() - 1000000; rsx->gcm_current_buffer = arg; - rsx->flip_status = 0; + rsx->flip_status = CELL_GCM_DISPLAY_FLIP_STATUS_DONE; if (rsx->flip_handler) {