Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hle: cellSysutilNpEula #7558

Merged
merged 2 commits into from Mar 27, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Expand Up @@ -108,3 +108,7 @@ CMakeLists.txt.user

# yaml-cpp
yaml-cpp.pc

# libusb
/3rdparty/libusb_cmake/config.h
/3rdparty/libusb_cmake/libusb-1.0.pc
68 changes: 60 additions & 8 deletions 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<cellSysutilNpEulaError>::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<sceNpEulaStructUnk0> arg1, u32 arg2, u64 arg3, u32 arg4, vm::ptr<CellSysutilCallback> 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<sceNpEulaStructUnk0> arg1, u64 arg2, vm::ptr<CellSysutilCallback> callback1, vm::ptr<CellSysutilCallback> 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);
});