Skip to content

Commit

Permalink
cellGem and cellGameExec improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
tambry authored and Nekotekina committed Sep 7, 2015
1 parent 218e823 commit c923cb5
Show file tree
Hide file tree
Showing 3 changed files with 127 additions and 84 deletions.
159 changes: 81 additions & 78 deletions rpcs3/Emu/SysCalls/Modules/cellGame.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,100 +5,103 @@ namespace vm { using namespace ps3; }
// Return Codes
enum
{
CELL_GAME_RET_OK = 0,
CELL_GAME_RET_CANCEL = 1,
CELL_GAME_RET_NONE = 2,
CELL_GAME_ERROR_NOTFOUND = 0x8002cb04,
CELL_GAME_ERROR_BROKEN = 0x8002cb05,
CELL_GAME_ERROR_INTERNAL = 0x8002cb06,
CELL_GAME_ERROR_PARAM = 0x8002cb07,
CELL_GAME_ERROR_NOAPP = 0x8002cb08,
CELL_GAME_ERROR_ACCESS_ERROR = 0x8002cb09,
CELL_GAME_ERROR_NOSPACE = 0x8002cb20,
CELL_GAME_ERROR_NOTSUPPORTED = 0x8002cb21,
CELL_GAME_ERROR_FAILURE = 0x8002cb22,
CELL_GAME_ERROR_BUSY = 0x8002cb23,
CELL_GAME_ERROR_IN_SHUTDOWN = 0x8002cb24,
CELL_GAME_ERROR_INVALID_ID = 0x8002cb25,
CELL_GAME_ERROR_EXIST = 0x8002cb26,
CELL_GAME_ERROR_NOTPATCH = 0x8002cb27,
CELL_GAME_RET_OK = 0,
CELL_GAME_RET_CANCEL = 1,
CELL_GAME_RET_NONE = 2,
CELL_GAME_ERROR_NOTFOUND = 0x8002cb04,
CELL_GAME_ERROR_BROKEN = 0x8002cb05,
CELL_GAME_ERROR_INTERNAL = 0x8002cb06,
CELL_GAME_ERROR_PARAM = 0x8002cb07,
CELL_GAME_ERROR_NOAPP = 0x8002cb08,
CELL_GAME_ERROR_ACCESS_ERROR = 0x8002cb09,
CELL_GAME_ERROR_NOSPACE = 0x8002cb20,
CELL_GAME_ERROR_NOTSUPPORTED = 0x8002cb21,
CELL_GAME_ERROR_FAILURE = 0x8002cb22,
CELL_GAME_ERROR_BUSY = 0x8002cb23,
CELL_GAME_ERROR_IN_SHUTDOWN = 0x8002cb24,
CELL_GAME_ERROR_INVALID_ID = 0x8002cb25,
CELL_GAME_ERROR_EXIST = 0x8002cb26,
CELL_GAME_ERROR_NOTPATCH = 0x8002cb27,
CELL_GAME_ERROR_INVALID_THEME_FILE = 0x8002cb28,
CELL_GAME_ERROR_BOOTPATH = 0x8002cb50,
CELL_GAME_ERROR_BOOTPATH = 0x8002cb50,
};

// Definitions
enum
{
CELL_GAME_PATH_MAX = 128,
CELL_GAME_DIRNAME_SIZE = 32,
CELL_GAME_PATH_MAX = 128,
CELL_GAME_DIRNAME_SIZE = 32,
CELL_GAME_HDDGAMEPATH_SIZE = 128,
CELL_GAME_THEMEFILENAME_SIZE = 48,
CELL_GAME_SYSP_LANGUAGE_NUM = 20,
CELL_GAME_SYSP_TITLE_SIZE = 128,
CELL_GAME_SYSP_TITLEID_SIZE = 10,
CELL_GAME_SYSP_VERSION_SIZE = 6,
CELL_GAME_SYSP_APP_VER_SIZE = 6,
CELL_GAME_SYSP_LANGUAGE_NUM = 20,
CELL_GAME_SYSP_TITLE_SIZE = 128,
CELL_GAME_SYSP_TITLEID_SIZE = 10,
CELL_GAME_SYSP_VERSION_SIZE = 6,
CELL_GAME_SYSP_APP_VER_SIZE = 6,

CELL_GAME_GAMETYPE_SYS = 0,
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_SIZEKB_NOTCALC = -1,

CELL_GAME_ATTRIBUTE_PATCH = 0x1,
CELL_GAME_ATTRIBUTE_APP_HOME = 0x2,
CELL_GAME_ATTRIBUTE_DEBUG = 0x4,
CELL_GAME_ATTRIBUTE_XMBBUY = 0x8,
CELL_GAME_ATTRIBUTE_COMMERCE2_BROWSER = 0x10,
CELL_GAME_ATTRIBUTE_INVITE_MESSAGE = 0x20,
CELL_GAME_ATTRIBUTE_PATCH = 0x1,
CELL_GAME_ATTRIBUTE_APP_HOME = 0x2,
CELL_GAME_ATTRIBUTE_DEBUG = 0x4,
CELL_GAME_ATTRIBUTE_XMBBUY = 0x8,
CELL_GAME_ATTRIBUTE_COMMERCE2_BROWSER = 0x10,
CELL_GAME_ATTRIBUTE_INVITE_MESSAGE = 0x20,
CELL_GAME_ATTRIBUTE_CUSTOM_DATA_MESSAGE = 0x40,
CELL_GAME_ATTRIBUTE_WEB_BROWSER = 0x100,
CELL_GAME_ATTRIBUTE_WEB_BROWSER = 0x100,
};

//Parameter IDs of PARAM.SFO
enum
{
//Integers
CELL_GAME_PARAMID_PARENTAL_LEVEL = 102,
CELL_GAME_PARAMID_RESOLUTION = 103,
CELL_GAME_PARAMID_SOUND_FORMAT = 104,
CELL_GAME_PARAMID_RESOLUTION = 103,
CELL_GAME_PARAMID_SOUND_FORMAT = 104,

//Strings
CELL_GAME_PARAMID_TITLE = 0,
CELL_GAME_PARAMID_TITLE_DEFAULT = 1,
CELL_GAME_PARAMID_TITLE_JAPANESE = 2,
CELL_GAME_PARAMID_TITLE_ENGLISH = 3,
CELL_GAME_PARAMID_TITLE_FRENCH = 4,
CELL_GAME_PARAMID_TITLE_SPANISH = 5,
CELL_GAME_PARAMID_TITLE_GERMAN = 6,
CELL_GAME_PARAMID_TITLE_ITALIAN = 7,
CELL_GAME_PARAMID_TITLE_DUTCH = 8,
CELL_GAME_PARAMID_TITLE_PORTUGUESE = 9,
CELL_GAME_PARAMID_TITLE_RUSSIAN = 10,
CELL_GAME_PARAMID_TITLE_KOREAN = 11,
CELL_GAME_PARAMID_TITLE_CHINESE_T = 12,
CELL_GAME_PARAMID_TITLE_CHINESE_S = 13,
CELL_GAME_PARAMID_TITLE_FINNISH = 14,
CELL_GAME_PARAMID_TITLE_SWEDISH = 15,
CELL_GAME_PARAMID_TITLE_DANISH = 16,
CELL_GAME_PARAMID_TITLE_NORWEGIAN = 17,
CELL_GAME_PARAMID_TITLE_POLISH = 18,
CELL_GAME_PARAMID_TITLE = 0,
CELL_GAME_PARAMID_TITLE_DEFAULT = 1,
CELL_GAME_PARAMID_TITLE_JAPANESE = 2,
CELL_GAME_PARAMID_TITLE_ENGLISH = 3,
CELL_GAME_PARAMID_TITLE_FRENCH = 4,
CELL_GAME_PARAMID_TITLE_SPANISH = 5,
CELL_GAME_PARAMID_TITLE_GERMAN = 6,
CELL_GAME_PARAMID_TITLE_ITALIAN = 7,
CELL_GAME_PARAMID_TITLE_DUTCH = 8,
CELL_GAME_PARAMID_TITLE_PORTUGUESE = 9,
CELL_GAME_PARAMID_TITLE_RUSSIAN = 10,
CELL_GAME_PARAMID_TITLE_KOREAN = 11,
CELL_GAME_PARAMID_TITLE_CHINESE_T = 12,
CELL_GAME_PARAMID_TITLE_CHINESE_S = 13,
CELL_GAME_PARAMID_TITLE_FINNISH = 14,
CELL_GAME_PARAMID_TITLE_SWEDISH = 15,
CELL_GAME_PARAMID_TITLE_DANISH = 16,
CELL_GAME_PARAMID_TITLE_NORWEGIAN = 17,
CELL_GAME_PARAMID_TITLE_POLISH = 18,
CELL_GAME_PARAMID_TITLE_PORTUGUESE_BRAZIL = 19,
CELL_GAME_PARAMID_TITLE_ENGLISH_UK = 20,
CELL_GAME_PARAMID_TITLE_ID = 100,
CELL_GAME_PARAMID_VERSION = 101,
CELL_GAME_PARAMID_APP_VER = 106,
CELL_GAME_PARAMID_TITLE_ENGLISH_UK = 20,
CELL_GAME_PARAMID_TITLE_ID = 100,
CELL_GAME_PARAMID_VERSION = 101,
CELL_GAME_PARAMID_APP_VER = 106,
};

//Error dialog types
enum
{
CELL_GAME_ERRDIALOG_BROKEN_GAMEDATA = 0,
CELL_GAME_ERRDIALOG_BROKEN_HDDGAME = 1,
CELL_GAME_ERRDIALOG_NOSPACE = 2,
CELL_GAME_ERRDIALOG_BROKEN_GAMEDATA = 0,
CELL_GAME_ERRDIALOG_BROKEN_HDDGAME = 1,
CELL_GAME_ERRDIALOG_NOSPACE = 2,
CELL_GAME_ERRDIALOG_BROKEN_EXIT_GAMEDATA = 100,
CELL_GAME_ERRDIALOG_BROKEN_EXIT_HDDGAME = 101,
CELL_GAME_ERRDIALOG_NOSPACE_EXIT = 102,
CELL_GAME_ERRDIALOG_BROKEN_EXIT_HDDGAME = 101,
CELL_GAME_ERRDIALOG_NOSPACE_EXIT = 102,
};

struct CellGameContentSize
Expand Down Expand Up @@ -127,44 +130,44 @@ struct CellGameDataCBResult

enum // old consts
{
CELL_GAMEDATA_CBRESULT_OK_CANCEL = 1,
CELL_GAMEDATA_CBRESULT_OK = 0,
CELL_GAMEDATA_CBRESULT_OK_CANCEL = 1,
CELL_GAMEDATA_CBRESULT_OK = 0,
CELL_GAMEDATA_CBRESULT_ERR_NOSPACE = -1,
CELL_GAMEDATA_CBRESULT_ERR_BROKEN = -3,
CELL_GAMEDATA_CBRESULT_ERR_NODATA = -4,
CELL_GAMEDATA_CBRESULT_ERR_BROKEN = -3,
CELL_GAMEDATA_CBRESULT_ERR_NODATA = -4,
CELL_GAMEDATA_CBRESULT_ERR_INVALID = -5,

CELL_GAMEDATA_RET_OK = 0,
CELL_GAMEDATA_RET_OK = 0,
CELL_GAMEDATA_RET_CANCEL = 1,

CELL_GAMEDATA_ERROR_CBRESULT = 0x8002b601,
CELL_GAMEDATA_ERROR_CBRESULT = 0x8002b601,
CELL_GAMEDATA_ERROR_ACCESS_ERROR = 0x8002b602,
CELL_GAMEDATA_ERROR_INTERNAL = 0x8002b603,
CELL_GAMEDATA_ERROR_INTERNAL = 0x8002b603,

CELL_GAMEDATA_ERROR_PARAM = 0x8002b604,
CELL_GAMEDATA_ERROR_PARAM = 0x8002b604,
CELL_GAMEDATA_ERROR_NOSPACE = 0x8002b605,
CELL_GAMEDATA_ERROR_BROKEN = 0x8002b606,
CELL_GAMEDATA_ERROR_BROKEN = 0x8002b606,

CELL_GAMEDATA_ERROR_FAILURE = 0x8002b607,

CELL_GAMEDATA_ATTR_NORMAL = 0,
CELL_GAMEDATA_ATTR_NORMAL = 0,
CELL_GAMEDATA_VERSION_CURRENT = 0,

CELL_GAMEDATA_INVALIDMSG_MAX = 256,
CELL_GAMEDATA_PATH_MAX = 1055,
CELL_GAMEDATA_DIRNAME_SIZE = 32,
CELL_GAMEDATA_PATH_MAX = 1055,
CELL_GAMEDATA_DIRNAME_SIZE = 32,

CELL_GAMEDATA_SIZEKB_NOTCALC = -1,

CELL_GAMEDATA_SYSP_LANGUAGE_NUM = 20,
CELL_GAMEDATA_SYSP_TITLE_SIZE = 128,
CELL_GAMEDATA_SYSP_TITLE_SIZE = 128,
CELL_GAMEDATA_SYSP_TITLEID_SIZE = 10,
CELL_GAMEDATA_SYSP_VERSION_SIZE = 6,

CELL_GAMEDATA_ISNEWDATA_NO = 0,
CELL_GAMEDATA_ISNEWDATA_NO = 0,
CELL_GAMEDATA_ISNEWDATA_YES = 1,

CELL_GAMEDATA_ERRDIALOG_NONE = 0,
CELL_GAMEDATA_ERRDIALOG_NONE = 0,
CELL_GAMEDATA_ERRDIALOG_ALWAYS = 1,
};

Expand Down
12 changes: 9 additions & 3 deletions rpcs3/Emu/SysCalls/Modules/cellGameExec.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
#include "Emu/Memory/Memory.h"
#include "Emu/SysCalls/Modules.h"

#include "cellGame.h"

extern Module cellGameExec;

s32 cellGameSetExitParam()
Expand Down Expand Up @@ -29,11 +31,15 @@ s32 cellGameGetHomeLaunchOptionPath()
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", []()
{
Expand Down
40 changes: 37 additions & 3 deletions rpcs3/Emu/SysCalls/Modules/cellGem.cpp
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
#include "stdafx.h"
#include "Emu/IdManager.h"
#include "Emu/Memory/Memory.h"
#include "Emu/SysCalls/Modules.h"

#include "cellGem.h"

extern Module cellGem;

struct gem_t
{
CellGemAttribute attribute;
};

s32 cellGemCalibrate()
{
UNIMPLEMENTED_FUNC(cellGem);
Expand Down Expand Up @@ -45,6 +51,12 @@ s32 cellGemEnableMagnetometer()
s32 cellGemEnd()
{
cellGem.Warning("cellGemEnd()");

if (!fxm::remove<gem_t>())
{
return CELL_GEM_ERROR_UNINITIALIZED;
}

return CELL_OK;
}

Expand Down Expand Up @@ -106,8 +118,21 @@ s32 cellGemGetInfo(vm::ptr<CellGemInfo> info)
{
cellGem.Todo("cellGemGetInfo(info=*0x%x)", info);

// TODO: Support many controllers to be connected
*info = {};
const auto gem = fxm::get<gem_t>();

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;
}
Expand Down Expand Up @@ -160,10 +185,19 @@ s32 cellGemHSVtoRGB()
return CELL_OK;
}

s32 cellGemInit(vm::ptr<CellGemAttribute> attribute)
s32 cellGemInit(vm::cptr<CellGemAttribute> 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;
}

Expand Down

0 comments on commit c923cb5

Please sign in to comment.