mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-09 16:31:28 +12:00
cellUserInfo module added & cellFsReadWithOffset
This commit is contained in:
parent
d5e94d4cd9
commit
b31a990cf1
6 changed files with 155 additions and 1 deletions
|
@ -63,7 +63,7 @@ static const g_module_list[] =
|
||||||
{0x002e, "cellLv2dbg"},
|
{0x002e, "cellLv2dbg"},
|
||||||
{0x0030, "cellUsbpspcm"},
|
{0x0030, "cellUsbpspcm"},
|
||||||
{0x0031, "cellAvconfExt"},
|
{0x0031, "cellAvconfExt"},
|
||||||
{0x0032, "cellSysutilUserinfo"},
|
{0x0032, "cellUserInfo"},
|
||||||
{0x0033, "cellSysutilSavedata"},
|
{0x0033, "cellSysutilSavedata"},
|
||||||
{0x0034, "cellSubdisplay"},
|
{0x0034, "cellSubdisplay"},
|
||||||
{0x0035, "cellSysutilRec"},
|
{0x0035, "cellSysutilRec"},
|
||||||
|
|
75
rpcs3/Emu/SysCalls/Modules/cellUserInfo.cpp
Normal file
75
rpcs3/Emu/SysCalls/Modules/cellUserInfo.cpp
Normal file
|
@ -0,0 +1,75 @@
|
||||||
|
#include "stdafx.h"
|
||||||
|
#include "Emu/SysCalls/SysCalls.h"
|
||||||
|
#include "Emu/SysCalls/SC_FUNC.h"
|
||||||
|
|
||||||
|
#include "cellUserInfo.h"
|
||||||
|
|
||||||
|
void cellUserInfo_init();
|
||||||
|
Module cellUserInfo(0x0032, cellUserInfo_init);
|
||||||
|
|
||||||
|
int cellUserInfoGetStat(u32 id, mem_ptr_t<CellUserInfoUserStat> stat)
|
||||||
|
{
|
||||||
|
cellUserInfo.Warning("cellUserInfoGetStat(id=%d, stat_addr=0x%x)", id, stat.GetAddr());
|
||||||
|
|
||||||
|
if (!stat.IsGood())
|
||||||
|
return CELL_USERINFO_ERROR_PARAM;
|
||||||
|
if (id > CELL_USERINFO_USER_MAX)
|
||||||
|
return CELL_USERINFO_ERROR_NOUSER;
|
||||||
|
|
||||||
|
char path [256];
|
||||||
|
sprintf(path, "/dev_hdd0/home/%08d", id);
|
||||||
|
if (!Emu.GetVFS().ExistsDir(path))
|
||||||
|
return CELL_USERINFO_ERROR_NOUSER;
|
||||||
|
|
||||||
|
sprintf(path, "/dev_hdd0/home/%08d/localusername", id);
|
||||||
|
vfsStream* stream = Emu.GetVFS().OpenFile(path, vfsRead);
|
||||||
|
if (!stream || !(stream->IsOpened()))
|
||||||
|
return CELL_USERINFO_ERROR_INTERNAL;
|
||||||
|
|
||||||
|
char name [CELL_USERINFO_USERNAME_SIZE];
|
||||||
|
memset(name, 0, CELL_USERINFO_USERNAME_SIZE);
|
||||||
|
stream->Read(name, CELL_USERINFO_USERNAME_SIZE);
|
||||||
|
stream->Close();
|
||||||
|
|
||||||
|
stat->id = id;
|
||||||
|
memcpy(stat->name, name, CELL_USERINFO_USERNAME_SIZE);
|
||||||
|
return CELL_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
int cellUserInfoSelectUser_ListType()
|
||||||
|
{
|
||||||
|
UNIMPLEMENTED_FUNC(cellUserInfo);
|
||||||
|
return CELL_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
int cellUserInfoSelectUser_SetList()
|
||||||
|
{
|
||||||
|
UNIMPLEMENTED_FUNC(cellUserInfo);
|
||||||
|
return CELL_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
int cellUserInfoEnableOverlay()
|
||||||
|
{
|
||||||
|
UNIMPLEMENTED_FUNC(cellUserInfo);
|
||||||
|
return CELL_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
int cellUserInfoGetList(mem32_t listNum, mem_ptr_t<CellUserInfoUserList> listBuf, mem32_t currentUserId)
|
||||||
|
{
|
||||||
|
cellUserInfo.Warning("cellUserInfoGetList(listNum_addr=0x%x, listBuf_addr=0x%x, currentUserId_addr=0x%x)",
|
||||||
|
listNum.GetAddr(), listBuf.GetAddr(), currentUserId.GetAddr());
|
||||||
|
|
||||||
|
listNum = 1;
|
||||||
|
listBuf->userId[0] = 1;
|
||||||
|
currentUserId = 1;
|
||||||
|
return CELL_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
void cellUserInfo_init()
|
||||||
|
{
|
||||||
|
cellUserInfo.AddFunc(0x2b761140, cellUserInfoGetStat);
|
||||||
|
cellUserInfo.AddFunc(0x3097cc1c, cellUserInfoSelectUser_ListType);
|
||||||
|
cellUserInfo.AddFunc(0x55123a25, cellUserInfoSelectUser_SetList);
|
||||||
|
cellUserInfo.AddFunc(0xb3516536, cellUserInfoEnableOverlay);
|
||||||
|
cellUserInfo.AddFunc(0xc55e338b, cellUserInfoGetList);
|
||||||
|
}
|
55
rpcs3/Emu/SysCalls/Modules/cellUserInfo.h
Normal file
55
rpcs3/Emu/SysCalls/Modules/cellUserInfo.h
Normal file
|
@ -0,0 +1,55 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
// Return Codes
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
CELL_USERINFO_RET_OK = 0,
|
||||||
|
CELL_USERINFO_RET_CANCEL = 1,
|
||||||
|
CELL_USERINFO_ERROR_BUSY = 0x8002c301,
|
||||||
|
CELL_USERINFO_ERROR_INTERNAL = 0x8002c302,
|
||||||
|
CELL_USERINFO_ERROR_PARAM = 0x8002c303,
|
||||||
|
CELL_USERINFO_ERROR_NOUSER = 0x8002c304,
|
||||||
|
};
|
||||||
|
|
||||||
|
// Enums
|
||||||
|
enum CellUserInfoParamSize
|
||||||
|
{
|
||||||
|
CELL_USERINFO_USER_MAX = 16,
|
||||||
|
CELL_USERINFO_TITLE_SIZE = 256,
|
||||||
|
CELL_USERINFO_USERNAME_SIZE = 64,
|
||||||
|
};
|
||||||
|
|
||||||
|
enum CellUserInfoListType
|
||||||
|
{
|
||||||
|
CELL_USERINFO_LISTTYPE_ALL = 0,
|
||||||
|
CELL_USERINFO_LISTTYPE_NOCURRENT = 1,
|
||||||
|
};
|
||||||
|
|
||||||
|
// Structs
|
||||||
|
struct CellUserInfoUserStat
|
||||||
|
{
|
||||||
|
u32 id;
|
||||||
|
u8 name[CELL_USERINFO_USERNAME_SIZE];
|
||||||
|
};
|
||||||
|
|
||||||
|
struct CellUserInfoUserList
|
||||||
|
{
|
||||||
|
u32 userId[CELL_USERINFO_USER_MAX];
|
||||||
|
};
|
||||||
|
|
||||||
|
struct CellUserInfoListSet
|
||||||
|
{
|
||||||
|
u32 title_addr; // (char*)
|
||||||
|
u32 focus;
|
||||||
|
u32 fixedListNum;
|
||||||
|
mem_ptr_t<CellUserInfoUserList> fixedList;
|
||||||
|
u32 reserved_addr; // (void*)
|
||||||
|
};
|
||||||
|
|
||||||
|
struct CellUserInfoTypeSet
|
||||||
|
{
|
||||||
|
u32 title_addr; // (char*)
|
||||||
|
u32 focus;
|
||||||
|
CellUserInfoListType type;
|
||||||
|
u32 reserved_addr; // (void*)
|
||||||
|
};
|
|
@ -270,6 +270,25 @@ int cellFsAioFinish(mem8_ptr_t mount_point)
|
||||||
return CELL_OK;
|
return CELL_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int cellFsReadWithOffset(u32 fd, u64 offset, u32 buf_addr, u64 buffer_size, mem64_t nread)
|
||||||
|
{
|
||||||
|
sys_fs.Warning("cellFsReadWithOffset(fd=%d, offset=0x%llx, buf_addr=0x%x, buffer_size=%lld nread=0x%llx)",
|
||||||
|
fd, offset, buf_addr, buffer_size, nread.GetAddr());
|
||||||
|
|
||||||
|
int ret;
|
||||||
|
MemoryAllocator<be_t<u64>> oldPos, newPos;
|
||||||
|
ret = cellFsLseek(fd, 0, CELL_SEEK_CUR, oldPos.GetAddr()); // Save the current position
|
||||||
|
if (ret) return ret;
|
||||||
|
ret = cellFsLseek(fd, offset, CELL_SEEK_SET, newPos.GetAddr()); // Move to the specified offset
|
||||||
|
if (ret) return ret;
|
||||||
|
ret = cellFsRead(fd, buf_addr, buffer_size, nread.GetAddr()); // Read the file
|
||||||
|
if (ret) return ret;
|
||||||
|
ret = cellFsLseek(fd, Memory.Read64(oldPos.GetAddr()), CELL_SEEK_SET, newPos.GetAddr()); // Return to the old position
|
||||||
|
if (ret) return ret;
|
||||||
|
|
||||||
|
return CELL_OK;
|
||||||
|
}
|
||||||
|
|
||||||
void sys_fs_init()
|
void sys_fs_init()
|
||||||
{
|
{
|
||||||
sys_fs.AddFunc(0x718bf5f8, cellFsOpen);
|
sys_fs.AddFunc(0x718bf5f8, cellFsOpen);
|
||||||
|
@ -295,5 +314,6 @@ void sys_fs_init()
|
||||||
sys_fs.AddFunc(0x9f951810, cellFsAioFinish);
|
sys_fs.AddFunc(0x9f951810, cellFsAioFinish);
|
||||||
sys_fs.AddFunc(0x1a108ab7, cellFsGetBlockSize);
|
sys_fs.AddFunc(0x1a108ab7, cellFsGetBlockSize);
|
||||||
sys_fs.AddFunc(0xaa3b4bcd, cellFsGetFreeSize);
|
sys_fs.AddFunc(0xaa3b4bcd, cellFsGetFreeSize);
|
||||||
|
sys_fs.AddFunc(0x0d5b4a14, cellFsReadWithOffset);
|
||||||
aio_init = false;
|
aio_init = false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -304,6 +304,7 @@
|
||||||
<ClCompile Include="Emu\SysCalls\Modules\cellSysmodule.cpp" />
|
<ClCompile Include="Emu\SysCalls\Modules\cellSysmodule.cpp" />
|
||||||
<ClCompile Include="Emu\SysCalls\Modules\cellSysutil.cpp" />
|
<ClCompile Include="Emu\SysCalls\Modules\cellSysutil.cpp" />
|
||||||
<ClCompile Include="Emu\SysCalls\Modules\cellSysutilAp.cpp" />
|
<ClCompile Include="Emu\SysCalls\Modules\cellSysutilAp.cpp" />
|
||||||
|
<ClCompile Include="Emu\SysCalls\Modules\cellUserInfo.cpp" />
|
||||||
<ClCompile Include="Emu\SysCalls\Modules\cellVdec.cpp" />
|
<ClCompile Include="Emu\SysCalls\Modules\cellVdec.cpp" />
|
||||||
<ClCompile Include="Emu\SysCalls\Modules\cellVpost.cpp" />
|
<ClCompile Include="Emu\SysCalls\Modules\cellVpost.cpp" />
|
||||||
<ClCompile Include="Emu\SysCalls\Modules\libmixer.cpp" />
|
<ClCompile Include="Emu\SysCalls\Modules\libmixer.cpp" />
|
||||||
|
|
|
@ -463,6 +463,9 @@
|
||||||
<ClCompile Include="Emu\SysCalls\Modules\sys_net.cpp">
|
<ClCompile Include="Emu\SysCalls\Modules\sys_net.cpp">
|
||||||
<Filter>Emu\SysCalls\Modules</Filter>
|
<Filter>Emu\SysCalls\Modules</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="Emu\SysCalls\Modules\cellUserInfo.cpp">
|
||||||
|
<Filter>Emu\SysCalls\Modules</Filter>
|
||||||
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ResourceCompile Include="rpcs3.rc" />
|
<ResourceCompile Include="rpcs3.rc" />
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue