mirror of
https://github.com/jpd002/Play-.git
synced 2025-04-28 13:47:57 +03:00
Add PowerOff IOP module stub
Makes ScummVM boot, if LIBSD is provided in rom0
This commit is contained in:
parent
729050e139
commit
dd538f9561
5 changed files with 83 additions and 0 deletions
|
@ -319,6 +319,8 @@ set(COMMON_SRC_FILES
|
|||
iop/Iop_PadMan.h
|
||||
iop/Iop_PathUtils.cpp
|
||||
iop/Iop_PathUtils.h
|
||||
iop/Iop_PowerOff.cpp
|
||||
iop/Iop_PowerOff.h
|
||||
iop/Iop_RootCounters.cpp
|
||||
iop/Iop_RootCounters.h
|
||||
iop/Iop_Secrman.cpp
|
||||
|
|
|
@ -254,6 +254,10 @@ void CIopBios::Reset(const Iop::SifManPtr& sifMan)
|
|||
m_mcserv = std::make_shared<Iop::CMcServ>(*this, *m_sifMan, *m_sifCmd, *m_sysmem, m_ram);
|
||||
RegisterModule(m_mcserv);
|
||||
}
|
||||
{
|
||||
m_powerOff = std::make_shared<Iop::CPowerOff>(*m_sifMan);
|
||||
RegisterModule(m_powerOff);
|
||||
}
|
||||
RegisterModule(std::make_shared<Iop::CIomanX>(*m_ioman));
|
||||
//RegisterModule(std::make_shared<Iop::CNaplink>(*m_sifMan, *m_ioman));
|
||||
{
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include "Iop_MtapMan.h"
|
||||
#include "Iop_Cdvdfsv.h"
|
||||
#include "Iop_McServ.h"
|
||||
#include "Iop_PowerOff.h"
|
||||
#endif
|
||||
|
||||
class CIopBios : public Iop::CBiosBase
|
||||
|
@ -680,6 +681,7 @@ private:
|
|||
Iop::MtapManPtr m_mtapman;
|
||||
Iop::McServPtr m_mcserv;
|
||||
Iop::CdvdfsvPtr m_cdvdfsv;
|
||||
Iop::PowerOffPtr m_powerOff;
|
||||
|
||||
std::map<std::string, Iop::ModulePtr> m_hleModules;
|
||||
#endif
|
||||
|
|
41
Source/iop/Iop_PowerOff.cpp
Normal file
41
Source/iop/Iop_PowerOff.cpp
Normal file
|
@ -0,0 +1,41 @@
|
|||
#include "Iop_PowerOff.h"
|
||||
#include "Log.h"
|
||||
#include "Iop_SifMan.h"
|
||||
|
||||
#define LOG_NAME ("iop_poweroff")
|
||||
|
||||
using namespace Iop;
|
||||
|
||||
CPowerOff::CPowerOff(CSifMan& sifMan)
|
||||
{
|
||||
sifMan.RegisterModule(MODULE_ID, this);
|
||||
}
|
||||
|
||||
std::string CPowerOff::GetId() const
|
||||
{
|
||||
return "poweroff";
|
||||
}
|
||||
|
||||
std::string CPowerOff::GetFunctionName(unsigned int functionId) const
|
||||
{
|
||||
return "unknown";
|
||||
}
|
||||
|
||||
void CPowerOff::Invoke(CMIPS& context, unsigned int functionId)
|
||||
{
|
||||
switch(functionId)
|
||||
{
|
||||
default:
|
||||
CLog::GetInstance().Warn(LOG_NAME, "%08X: Unknown function (%d) called.\r\n", context.m_State.nPC, functionId);
|
||||
break;
|
||||
}
|
||||
}
|
||||
bool CPowerOff::Invoke(uint32 method, uint32* args, uint32 argsSize, uint32* ret, uint32 retSize, uint8* ram)
|
||||
{
|
||||
switch(method)
|
||||
{
|
||||
default:
|
||||
CLog::GetInstance().Warn(LOG_NAME, "Unknown RPC method invoked (0x%08X).\r\n", method);
|
||||
return true;
|
||||
}
|
||||
}
|
34
Source/iop/Iop_PowerOff.h
Normal file
34
Source/iop/Iop_PowerOff.h
Normal file
|
@ -0,0 +1,34 @@
|
|||
#pragma once
|
||||
|
||||
#include "Iop_Module.h"
|
||||
#include "Iop_SifMan.h"
|
||||
|
||||
// Not an actual implementation of the PowerOff module.
|
||||
// For insights what this emulates see here:
|
||||
// https://github.com/ps2dev/ps2sdk/blob/c80310b3967a0ef3f8cb3cf20e469d7763fe0e9a/iop/dev9/poweroff/src/poweroff.c
|
||||
// Some homebrew (e.g. ScummVM) expect the module to be loaded beforehand on the IOP
|
||||
// via the ELF loader (e.g. ps2link), and thus don't load it themselves.
|
||||
// In the future, this module should only be loaded on ELF files, and not on discs.
|
||||
|
||||
namespace Iop
|
||||
{
|
||||
class CPowerOff : public CModule, public CSifModule
|
||||
{
|
||||
public:
|
||||
CPowerOff(Iop::CSifMan& sifMan);
|
||||
virtual ~CPowerOff() = default;
|
||||
|
||||
std::string GetId() const override;
|
||||
std::string GetFunctionName(unsigned int) const override;
|
||||
void Invoke(CMIPS&, unsigned int) override;
|
||||
bool Invoke(uint32, uint32*, uint32, uint32*, uint32, uint8*) override;
|
||||
|
||||
private:
|
||||
enum MODULE_ID
|
||||
{
|
||||
MODULE_ID = 0x09090900,
|
||||
};
|
||||
};
|
||||
|
||||
typedef std::shared_ptr<CPowerOff> PowerOffPtr;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue