Play-/Source/iop/Iop_Secrman.cpp
Jean-Philip Desjardins 30568a057d
Some checks failed
Build macOS / build_macos (push) Has been cancelled
Build Android / build_android (apk) (push) Has been cancelled
Build Android / build_android (libretro) (push) Has been cancelled
Build Linux ARM32 / build_linux_arm32 (push) Has been cancelled
Build Linux ARM64 / build_linux_arm64 (push) Has been cancelled
Build Windows Psf / build_windows_psf (off, x86_64, Visual Studio 16 2019, installer64.nsi, x64) (push) Has been cancelled
Build Windows Psf / build_windows_psf (on, x86_64, Visual Studio 16 2019, installer64.nsi, x64) (push) Has been cancelled
Build Windows / build_windows (x86_32, Visual Studio 16 2019, installer32.nsi, win32_msvc2019, Win32) (push) Has been cancelled
Build Windows / build_windows (x86_64, Visual Studio 16 2019, installer64.nsi, win64_msvc2019_64, x64) (push) Has been cancelled
Check Format / run_clangformat (push) Has been cancelled
Build iOS / build_ios (push) Has been cancelled
Build JavaScript / build_js (push) Has been cancelled
Build Linux / build_linux (push) Has been cancelled
Use app_config module.
2025-03-11 16:18:58 -04:00

75 lines
1.9 KiB
C++

#include "Iop_Secrman.h"
#include "Log.h"
#define LOGNAME "iop_secrman"
using namespace Iop;
#define FUNCTIONID_SETMCCOMMANDHANDLER 4
#define FUNCTIONID_SETMCDEVIDHANDLER 5
#define FUNCTIONID_AUTHCARD 6
#define FUNCTION_SETMCCOMMANDHANDLER "SetMcCommandHandler"
#define FUNCTION_SETMCDEVIDHANDLER "SetMcDevIdHandler"
#define FUNCTION_AUTHCARD "AuthCard"
std::string CSecrman::GetId() const
{
return "secrman";
}
std::string CSecrman::GetFunctionName(unsigned int functionId) const
{
switch(functionId)
{
case FUNCTIONID_SETMCCOMMANDHANDLER:
return FUNCTION_SETMCCOMMANDHANDLER;
case FUNCTIONID_SETMCDEVIDHANDLER:
return FUNCTION_SETMCDEVIDHANDLER;
case FUNCTIONID_AUTHCARD:
return FUNCTION_AUTHCARD;
default:
return "unknown";
break;
}
}
void CSecrman::Invoke(CMIPS& context, unsigned int functionId)
{
switch(functionId)
{
case FUNCTIONID_SETMCCOMMANDHANDLER:
SetMcCommandHandler(context.m_State.nGPR[CMIPS::A0].nV0);
break;
case FUNCTIONID_SETMCDEVIDHANDLER:
SetMcDevIdHandler(context.m_State.nGPR[CMIPS::A0].nV0);
break;
case FUNCTIONID_AUTHCARD:
context.m_State.nGPR[CMIPS::V0].nV0 = AuthCard(
context.m_State.nGPR[CMIPS::A0].nV0,
context.m_State.nGPR[CMIPS::A1].nV0,
context.m_State.nGPR[CMIPS::A2].nV0);
break;
default:
CLog::GetInstance().Warn(LOGNAME, "%08X: Unknown function (%d) called.\r\n", context.m_State.nPC, functionId);
break;
}
}
void CSecrman::SetMcCommandHandler(uint32 handlerPtr)
{
CLog::GetInstance().Print(LOGNAME, "SetMcCommandHandler(handlerPtr = 0x%08X);\r\n", handlerPtr);
}
void CSecrman::SetMcDevIdHandler(uint32 handlerPtr)
{
CLog::GetInstance().Print(LOGNAME, "SetMcDevIdHandler(handlerPtr = 0x%08X);\r\n", handlerPtr);
}
uint32 CSecrman::AuthCard(uint32 port, uint32 slot, uint32 cnum)
{
CLog::GetInstance().Print(LOGNAME, "AuthCard(port = %d, slot = %d, cnum = %d);\r\n",
port, slot, cnum);
//Returns non-zero on success
return 1;
}