Play-/Source/iop/Iop_FileIoHandler2100.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

55 lines
1.2 KiB
C++

#include <cstring>
#include "Iop_FileIoHandler2100.h"
#include "Iop_Ioman.h"
#include "Log.h"
#define LOG_NAME ("iop_fileio")
using namespace Iop;
CFileIoHandler2100::CFileIoHandler2100(CIoman* ioman)
: CHandler(ioman)
{
}
bool CFileIoHandler2100::Invoke(uint32 method, uint32* args, uint32 argsSize, uint32* ret, uint32 retSize, uint8* ram)
{
switch(method)
{
case 0:
{
assert(retSize == 4);
auto command = reinterpret_cast<OPENCOMMAND*>(args);
*ret = m_ioman->Open(command->flags, command->fileName);
}
break;
case 1:
{
assert(retSize == 4);
auto command = reinterpret_cast<CLOSECOMMAND*>(args);
*ret = m_ioman->Close(command->fd);
}
break;
case 2:
{
assert(retSize == 4);
auto command = reinterpret_cast<READCOMMAND*>(args);
*ret = m_ioman->Read(command->fd, command->size, reinterpret_cast<void*>(ram + command->buffer));
}
break;
case 4:
{
assert(retSize == 4);
auto command = reinterpret_cast<SEEKCOMMAND*>(args);
*ret = m_ioman->Seek(command->fd, command->offset, command->whence);
}
break;
case 255:
//Init - Taken care of by owner (CFileIo)
break;
default:
CLog::GetInstance().Warn(LOG_NAME, "Unknown function (%d) called.\r\n", method);
break;
}
return true;
}