cellGem and cellGameExec improvements

This commit is contained in:
Raul Tambre 2015-08-21 23:57:49 +03:00 committed by Nekotekina
parent 218e823fdc
commit c923cb54d3
3 changed files with 127 additions and 84 deletions

View File

@ -31,6 +31,7 @@ enum
{ {
CELL_GAME_PATH_MAX = 128, CELL_GAME_PATH_MAX = 128,
CELL_GAME_DIRNAME_SIZE = 32, CELL_GAME_DIRNAME_SIZE = 32,
CELL_GAME_HDDGAMEPATH_SIZE = 128,
CELL_GAME_THEMEFILENAME_SIZE = 48, CELL_GAME_THEMEFILENAME_SIZE = 48,
CELL_GAME_SYSP_LANGUAGE_NUM = 20, CELL_GAME_SYSP_LANGUAGE_NUM = 20,
CELL_GAME_SYSP_TITLE_SIZE = 128, CELL_GAME_SYSP_TITLE_SIZE = 128,
@ -38,8 +39,10 @@ enum
CELL_GAME_SYSP_VERSION_SIZE = 6, CELL_GAME_SYSP_VERSION_SIZE = 6,
CELL_GAME_SYSP_APP_VER_SIZE = 6, CELL_GAME_SYSP_APP_VER_SIZE = 6,
CELL_GAME_GAMETYPE_SYS = 0,
CELL_GAME_GAMETYPE_DISC = 1, CELL_GAME_GAMETYPE_DISC = 1,
CELL_GAME_GAMETYPE_HDD = 2, CELL_GAME_GAMETYPE_HDD = 2,
CELL_GAME_GAMETYPE_HOME = 4,
CELL_GAME_GAMETYPE_GAMEDATA = 3, CELL_GAME_GAMETYPE_GAMEDATA = 3,

View File

@ -2,6 +2,8 @@
#include "Emu/Memory/Memory.h" #include "Emu/Memory/Memory.h"
#include "Emu/SysCalls/Modules.h" #include "Emu/SysCalls/Modules.h"
#include "cellGame.h"
extern Module cellGameExec; extern Module cellGameExec;
s32 cellGameSetExitParam() s32 cellGameSetExitParam()
@ -29,11 +31,15 @@ s32 cellGameGetHomeLaunchOptionPath()
throw EXCEPTION(""); throw EXCEPTION("");
} }
s32 cellGameGetBootGameInfo() s32 cellGameGetBootGameInfo(vm::ptr<u32> type, vm::ptr<char> dirName, vm::ptr<u32> execData)
{ {
throw EXCEPTION(""); cellGameExec.Todo("cellGameGetBootGameInfo(type=*0x%x, dirName=*0x%x, execData=*0x%x)");
}
// TODO: Support more boot types
*type = CELL_GAME_GAMETYPE_SYS;
return CELL_OK;
}
Module cellGameExec("cellGameExec", []() Module cellGameExec("cellGameExec", []()
{ {

View File

@ -1,4 +1,5 @@
#include "stdafx.h" #include "stdafx.h"
#include "Emu/IdManager.h"
#include "Emu/Memory/Memory.h" #include "Emu/Memory/Memory.h"
#include "Emu/SysCalls/Modules.h" #include "Emu/SysCalls/Modules.h"
@ -6,6 +7,11 @@
extern Module cellGem; extern Module cellGem;
struct gem_t
{
CellGemAttribute attribute;
};
s32 cellGemCalibrate() s32 cellGemCalibrate()
{ {
UNIMPLEMENTED_FUNC(cellGem); UNIMPLEMENTED_FUNC(cellGem);
@ -45,6 +51,12 @@ s32 cellGemEnableMagnetometer()
s32 cellGemEnd() s32 cellGemEnd()
{ {
cellGem.Warning("cellGemEnd()"); cellGem.Warning("cellGemEnd()");
if (!fxm::remove<gem_t>())
{
return CELL_GEM_ERROR_UNINITIALIZED;
}
return CELL_OK; return CELL_OK;
} }
@ -106,8 +118,21 @@ s32 cellGemGetInfo(vm::ptr<CellGemInfo> info)
{ {
cellGem.Todo("cellGemGetInfo(info=*0x%x)", info); cellGem.Todo("cellGemGetInfo(info=*0x%x)", info);
// TODO: Support many controllers to be connected const auto gem = fxm::get<gem_t>();
*info = {};
if (!gem)
{
return CELL_GEM_ERROR_UNINITIALIZED;
}
// TODO: Support connecting PlayStation Move controllers
info->max_connect = gem->attribute.max_connect;
info->now_connect = 0;
for (int i = 0; i < CELL_GEM_MAX_NUM; i++)
{
info->status[i] = CELL_GEM_STATUS_DISCONNECTED;
}
return CELL_OK; return CELL_OK;
} }
@ -160,10 +185,19 @@ s32 cellGemHSVtoRGB()
return CELL_OK; return CELL_OK;
} }
s32 cellGemInit(vm::ptr<CellGemAttribute> attribute) s32 cellGemInit(vm::cptr<CellGemAttribute> attribute)
{ {
cellGem.Warning("cellGemInit(attribute=*0x%x)", attribute); cellGem.Warning("cellGemInit(attribute=*0x%x)", attribute);
const auto gem = fxm::make<gem_t>();
if (!gem)
{
return CELL_GEM_ERROR_ALREADY_INITIALIZED;
}
gem->attribute = *attribute;
return CELL_OK; return CELL_OK;
} }