mirror of
https://github.com/jpd002/Play-.git
synced 2025-04-28 13:47:57 +03:00
Implement GetModuleIdListByName.
Some checks failed
Build Linux ARM64 / build_linux_arm64 (push) Has been cancelled
Build macOS / build_macos (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
Build Android / build_android (apk) (push) Has been cancelled
Build Android / build_android (libretro) (push) Has been cancelled
Build JavaScript / build_js (push) Has been cancelled
Build Linux / build_linux (push) Has been cancelled
Build Linux ARM32 / build_linux_arm32 (push) Has been cancelled
Build iOS / build_ios (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
Check Format / run_clangformat (push) Has been cancelled
Some checks failed
Build Linux ARM64 / build_linux_arm64 (push) Has been cancelled
Build macOS / build_macos (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
Build Android / build_android (apk) (push) Has been cancelled
Build Android / build_android (libretro) (push) Has been cancelled
Build JavaScript / build_js (push) Has been cancelled
Build Linux / build_linux (push) Has been cancelled
Build Linux ARM32 / build_linux_arm32 (push) Has been cancelled
Build iOS / build_ios (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
Check Format / run_clangformat (push) Has been cancelled
This commit is contained in:
parent
dd968d1472
commit
43e373a540
2 changed files with 37 additions and 0 deletions
|
@ -12,6 +12,7 @@ using namespace Iop;
|
|||
#define FUNCTION_LOADMODULEBUFFER "LoadModuleBuffer"
|
||||
#define FUNCTION_GETMODULEIDLIST "GetModuleIdList"
|
||||
#define FUNCTION_REFERMODULESTATUS "ReferModuleStatus"
|
||||
#define FUNCTION_GETMODULEIDLISTBYNAME "GetModuleIdListByName"
|
||||
#define FUNCTION_LOADMODULEWITHOPTION "LoadModuleWithOption"
|
||||
#define FUNCTION_STOPMODULE "StopModule"
|
||||
#define FUNCTION_UNLOADMODULE "UnloadModule"
|
||||
|
@ -64,6 +65,9 @@ std::string CModload::GetFunctionName(unsigned int functionId) const
|
|||
case 17:
|
||||
return FUNCTION_REFERMODULESTATUS;
|
||||
break;
|
||||
case 18:
|
||||
return FUNCTION_GETMODULEIDLISTBYNAME;
|
||||
break;
|
||||
case 19:
|
||||
return FUNCTION_LOADMODULEWITHOPTION;
|
||||
break;
|
||||
|
@ -125,6 +129,13 @@ void CModload::Invoke(CMIPS& context, unsigned int functionId)
|
|||
context.m_State.nGPR[CMIPS::A0].nV0,
|
||||
context.m_State.nGPR[CMIPS::A1].nV0);
|
||||
break;
|
||||
case 18:
|
||||
context.m_State.nGPR[CMIPS::V0].nD0 = GetModuleIdListByName(
|
||||
context.m_State.nGPR[CMIPS::A0].nV0,
|
||||
context.m_State.nGPR[CMIPS::A1].nV0,
|
||||
context.m_State.nGPR[CMIPS::A2].nV0,
|
||||
context.m_State.nGPR[CMIPS::A3].nV0);
|
||||
break;
|
||||
case 19:
|
||||
context.m_State.nGPR[CMIPS::V0].nD0 = LoadModuleWithOption(
|
||||
context.m_State.nGPR[CMIPS::A0].nV0,
|
||||
|
@ -233,6 +244,31 @@ int32 CModload::ReferModuleStatus(uint32 moduleId, uint32 moduleStatusPtr)
|
|||
return m_bios.ReferModuleStatus(moduleId, moduleStatusPtr);
|
||||
}
|
||||
|
||||
int32 CModload::GetModuleIdListByName(uint32 moduleNamePtr, uint32 readBufPtr, uint32 readBufSize, uint32 moduleCountPtr)
|
||||
{
|
||||
CLog::GetInstance().Print(LOG_NAME, FUNCTION_GETMODULEIDLISTBYNAME "(moduleNamePtr = %s, readBufPtr = 0x%08X, readBufSize = 0x%08X, moduleCountPtr = 0x%08X);\r\n",
|
||||
PrintStringParameter(m_ram, moduleNamePtr).c_str(), readBufPtr, readBufSize, moduleCountPtr);
|
||||
std::vector<int32> moduleIds;
|
||||
{
|
||||
int32 moduleId = SearchModuleByName(moduleNamePtr);
|
||||
if(moduleId >= 0) moduleIds.push_back(moduleId);
|
||||
}
|
||||
int32 readAmount = 0;
|
||||
auto readBuf = reinterpret_cast<uint32*>(m_ram + readBufPtr);
|
||||
for(size_t i = 0; i < moduleIds.size(); i++)
|
||||
{
|
||||
if(i >= readBufSize) break;
|
||||
(*readBuf) = moduleIds[i];
|
||||
readAmount++;
|
||||
}
|
||||
auto moduleCount = (moduleCountPtr != 0) ? reinterpret_cast<uint32*>(m_ram + moduleCountPtr) : nullptr;
|
||||
if(moduleCount)
|
||||
{
|
||||
(*moduleCount) = static_cast<uint32>(moduleIds.size());
|
||||
}
|
||||
return readAmount;
|
||||
}
|
||||
|
||||
int32 CModload::LoadModuleWithOption(uint32 pathPtr, uint32 optionPtr)
|
||||
{
|
||||
CLog::GetInstance().Print(LOG_NAME, FUNCTION_LOADMODULEWITHOPTION "(pathPtr = 0x%08X, optionPtr = 0x%08X);\r\n",
|
||||
|
|
|
@ -23,6 +23,7 @@ namespace Iop
|
|||
uint32 LoadModuleBuffer(uint32);
|
||||
uint32 GetModuleIdList(uint32, uint32, uint32);
|
||||
int32 ReferModuleStatus(uint32, uint32);
|
||||
int32 GetModuleIdListByName(uint32, uint32, uint32, uint32);
|
||||
int32 LoadModuleWithOption(uint32, uint32);
|
||||
int32 StopModule(uint32, uint32, uint32, uint32);
|
||||
int32 UnloadModule(uint32);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue