2014-03-11 18:40:37 +01:00
|
|
|
#include "stdafx.h"
|
2014-06-02 19:27:24 +02:00
|
|
|
#include "Emu/Memory/Memory.h"
|
|
|
|
|
#include "Emu/System.h"
|
|
|
|
|
#include "Emu/SysCalls/Modules.h"
|
2014-03-11 18:40:37 +01:00
|
|
|
|
2014-08-26 01:55:37 +02:00
|
|
|
#include "Emu/FS/VFS.h"
|
2014-08-25 20:09:48 +02:00
|
|
|
#include "Emu/FS/vfsFileBase.h"
|
2014-03-11 18:40:37 +01:00
|
|
|
#include "cellUserInfo.h"
|
|
|
|
|
|
2015-09-08 15:53:28 +02:00
|
|
|
extern Module<> cellUserInfo;
|
2014-03-11 18:40:37 +01:00
|
|
|
|
2015-07-09 17:30:37 +02:00
|
|
|
s32 cellUserInfoGetStat(u32 id, vm::ptr<CellUserInfoUserStat> stat)
|
2014-03-11 18:40:37 +01:00
|
|
|
{
|
2015-07-11 01:38:40 +02:00
|
|
|
cellUserInfo.Warning("cellUserInfoGetStat(id=%d, stat=*0x%x)", id, stat);
|
2014-03-11 18:40:37 +01:00
|
|
|
|
|
|
|
|
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);
|
2015-08-12 03:52:26 +02:00
|
|
|
vfsStream* stream = Emu.GetVFS().OpenFile(path, fom::read);
|
2014-03-11 18:40:37 +01:00
|
|
|
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();
|
2014-04-15 16:12:15 +02:00
|
|
|
delete stream;
|
2014-03-11 18:40:37 +01:00
|
|
|
|
|
|
|
|
stat->id = id;
|
|
|
|
|
memcpy(stat->name, name, CELL_USERINFO_USERNAME_SIZE);
|
|
|
|
|
return CELL_OK;
|
|
|
|
|
}
|
|
|
|
|
|
2015-07-09 17:30:37 +02:00
|
|
|
s32 cellUserInfoSelectUser_ListType()
|
2014-03-11 18:40:37 +01:00
|
|
|
{
|
|
|
|
|
UNIMPLEMENTED_FUNC(cellUserInfo);
|
|
|
|
|
return CELL_OK;
|
|
|
|
|
}
|
|
|
|
|
|
2015-07-09 17:30:37 +02:00
|
|
|
s32 cellUserInfoSelectUser_SetList()
|
2014-03-11 18:40:37 +01:00
|
|
|
{
|
|
|
|
|
UNIMPLEMENTED_FUNC(cellUserInfo);
|
|
|
|
|
return CELL_OK;
|
|
|
|
|
}
|
|
|
|
|
|
2015-07-09 17:30:37 +02:00
|
|
|
s32 cellUserInfoEnableOverlay()
|
2014-03-11 18:40:37 +01:00
|
|
|
{
|
|
|
|
|
UNIMPLEMENTED_FUNC(cellUserInfo);
|
|
|
|
|
return CELL_OK;
|
|
|
|
|
}
|
|
|
|
|
|
2015-07-09 17:30:37 +02:00
|
|
|
s32 cellUserInfoGetList(vm::ptr<u32> listNum, vm::ptr<CellUserInfoUserList> listBuf, vm::ptr<u32> currentUserId)
|
2014-03-11 18:40:37 +01:00
|
|
|
{
|
2015-07-11 01:38:40 +02:00
|
|
|
cellUserInfo.Warning("cellUserInfoGetList(listNum=*0x%x, listBuf=*0x%x, currentUserId=*0x%x)", listNum, listBuf, currentUserId);
|
2014-03-11 18:40:37 +01:00
|
|
|
|
2014-05-25 22:31:40 +02:00
|
|
|
// If only listNum is NULL, an error will be returned
|
2014-09-01 02:51:48 +02:00
|
|
|
if (listBuf && !listNum)
|
2014-05-19 15:05:53 +02:00
|
|
|
return CELL_USERINFO_ERROR_PARAM;
|
2014-09-01 02:51:48 +02:00
|
|
|
if (listNum)
|
|
|
|
|
*listNum = 1;
|
|
|
|
|
if (listBuf)
|
2014-05-19 15:05:53 +02:00
|
|
|
listBuf->userId[0] = 1;
|
|
|
|
|
|
2014-09-01 02:51:48 +02:00
|
|
|
if (currentUserId)
|
|
|
|
|
*currentUserId = 1;
|
2014-05-19 15:05:53 +02:00
|
|
|
|
2014-03-11 18:40:37 +01:00
|
|
|
return CELL_OK;
|
|
|
|
|
}
|
|
|
|
|
|
2015-09-08 15:53:28 +02:00
|
|
|
Module<> cellUserInfo("cellUserInfo", []()
|
2014-03-11 18:40:37 +01:00
|
|
|
{
|
2015-02-20 14:58:40 +01:00
|
|
|
REG_FUNC(cellUserInfo, cellUserInfoGetStat);
|
|
|
|
|
REG_FUNC(cellUserInfo, cellUserInfoSelectUser_ListType);
|
|
|
|
|
REG_FUNC(cellUserInfo, cellUserInfoSelectUser_SetList);
|
|
|
|
|
REG_FUNC(cellUserInfo, cellUserInfoEnableOverlay);
|
|
|
|
|
REG_FUNC(cellUserInfo, cellUserInfoGetList);
|
2015-02-18 17:22:06 +01:00
|
|
|
});
|