diff --git a/rpcs3/Emu/Cell/Modules/cellSysutilNpEula.cpp b/rpcs3/Emu/Cell/Modules/cellSysutilNpEula.cpp index 32f0ca5f39..d2210dc11d 100644 --- a/rpcs3/Emu/Cell/Modules/cellSysutilNpEula.cpp +++ b/rpcs3/Emu/Cell/Modules/cellSysutilNpEula.cpp @@ -1,29 +1,81 @@ #include "stdafx.h" #include "Emu/Cell/PPUModule.h" +#include "cellSysutil.h" LOG_CHANNEL(cellSysutilNpEula); -s32 cellSysutilNpEula_59D1629A() // Resistance 3, Uncharted 2 +struct sceNpEulaStructUnk0 { - cellSysutilNpEula.todo("cellSysutilNpEula_59D1629A"); + char buf[0xc]; +}; + +// All error codes are unknown at this point in implementation and just guesses +enum cellSysutilNpEulaError : u32 +{ + CELL_SYSUTIL_NP_EULA_NOT_INIT = 0x8002E500, + CELL_SYSUTIL_NP_EULA_INVALID_PARAM = 0x8002E501, + CELL_SYSUTIL_NP_EULA_UNKNOWN_502 = 0x8002E502, + CELL_SYSUTIL_NP_EULA_UNKNOWN_503 = 0x8002E503, +}; + +template<> +void fmt_class_string::format(std::string& out, u64 arg) +{ + format_enum(out, arg, [](auto error) + { + switch (error) + { + STR_CASE(CELL_SYSUTIL_NP_EULA_NOT_INIT); + STR_CASE(CELL_SYSUTIL_NP_EULA_INVALID_PARAM); + STR_CASE(CELL_SYSUTIL_NP_EULA_UNKNOWN_502); + STR_CASE(CELL_SYSUTIL_NP_EULA_UNKNOWN_503); + } + + return unknown; + }); +} + +// Seen on: Resistance 3, Uncharted 2 +error_code sceNpEulaCheckEulaStatus(vm::ptr arg1, u32 arg2, u64 arg3, u32 arg4, vm::ptr callback1) +{ + cellSysutilNpEula.todo("sceNpEulaCheckEulaStatus(arg1=*0x%x, arg2=0x%x, arg3=0x%x, arg4=0x%x, callback1=*0x%x)", arg1, arg2, arg3, arg4, callback1); + + if (!arg1) + return CELL_SYSUTIL_NP_EULA_INVALID_PARAM; + + if (arg4 == 0) + return CELL_SYSUTIL_NP_EULA_INVALID_PARAM; + return CELL_OK; } -s32 sceNpEulaAbort() +// Seen on: Resistance 3 +error_code sceNpEulaAbort() { - UNIMPLEMENTED_FUNC(cellSysutilNpEula); + cellSysutilNpEula.todo("sceNpEulaAbort()"); + + // Can return CELL_SYSUTIL_NP_EULA_NOT_INIT + return CELL_OK; } -s32 cellSysutilNpEula_6599500D() // Resistance 3, Uncharted 2 +// Seen on: Resistance 3, Uncharted 2 +error_code sceNpEulaShowCurrentEula(vm::ptr arg1, u64 arg2, vm::ptr callback1, vm::ptr callback2) { - cellSysutilNpEula.todo("cellSysutilNpEula_6599500D"); + cellSysutilNpEula.todo("sceNpEulaShowCurrentEula(arg1=*0x%x, arg2=0x%x, callback1=*0x%x, callback2=*0x%x)", arg1, arg2, callback1, callback2); + + if (!arg1) + return CELL_SYSUTIL_NP_EULA_INVALID_PARAM; + + if (!callback1) + return CELL_SYSUTIL_NP_EULA_INVALID_PARAM; + return CELL_OK; } DECLARE(ppu_module_manager::cellSysutilNpEula)("cellSysutilNpEula", []() { - REG_FNID(cellSysutilNpEula, 0x59D1629A, cellSysutilNpEula_59D1629A); + REG_FUNC(cellSysutilNpEula, sceNpEulaCheckEulaStatus); REG_FUNC(cellSysutilNpEula, sceNpEulaAbort); - REG_FNID(cellSysutilNpEula, 0x6599500D, cellSysutilNpEula_6599500D); + REG_FUNC(cellSysutilNpEula, sceNpEulaShowCurrentEula); });