From c923cb54d3e09ca47b17b5d3a099f2567294e997 Mon Sep 17 00:00:00 2001 From: Raul Tambre Date: Fri, 21 Aug 2015 23:57:49 +0300 Subject: [PATCH] cellGem and cellGameExec improvements --- rpcs3/Emu/SysCalls/Modules/cellGame.h | 159 ++++++++++---------- rpcs3/Emu/SysCalls/Modules/cellGameExec.cpp | 12 +- rpcs3/Emu/SysCalls/Modules/cellGem.cpp | 40 ++++- 3 files changed, 127 insertions(+), 84 deletions(-) diff --git a/rpcs3/Emu/SysCalls/Modules/cellGame.h b/rpcs3/Emu/SysCalls/Modules/cellGame.h index f95f28629a..fbe714d5c4 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellGame.h +++ b/rpcs3/Emu/SysCalls/Modules/cellGame.h @@ -5,54 +5,57 @@ 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 @@ -60,45 +63,45 @@ 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 @@ -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, }; diff --git a/rpcs3/Emu/SysCalls/Modules/cellGameExec.cpp b/rpcs3/Emu/SysCalls/Modules/cellGameExec.cpp index 0ccbb7174a..2d960d9b76 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellGameExec.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellGameExec.cpp @@ -2,6 +2,8 @@ #include "Emu/Memory/Memory.h" #include "Emu/SysCalls/Modules.h" +#include "cellGame.h" + extern Module cellGameExec; s32 cellGameSetExitParam() @@ -29,11 +31,15 @@ s32 cellGameGetHomeLaunchOptionPath() throw EXCEPTION(""); } -s32 cellGameGetBootGameInfo() +s32 cellGameGetBootGameInfo(vm::ptr type, vm::ptr dirName, vm::ptr 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", []() { diff --git a/rpcs3/Emu/SysCalls/Modules/cellGem.cpp b/rpcs3/Emu/SysCalls/Modules/cellGem.cpp index 1498f67b8f..b2a9061227 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellGem.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellGem.cpp @@ -1,4 +1,5 @@ #include "stdafx.h" +#include "Emu/IdManager.h" #include "Emu/Memory/Memory.h" #include "Emu/SysCalls/Modules.h" @@ -6,6 +7,11 @@ extern Module cellGem; +struct gem_t +{ + CellGemAttribute attribute; +}; + s32 cellGemCalibrate() { UNIMPLEMENTED_FUNC(cellGem); @@ -45,6 +51,12 @@ s32 cellGemEnableMagnetometer() s32 cellGemEnd() { cellGem.Warning("cellGemEnd()"); + + if (!fxm::remove()) + { + return CELL_GEM_ERROR_UNINITIALIZED; + } + return CELL_OK; } @@ -106,8 +118,21 @@ s32 cellGemGetInfo(vm::ptr info) { cellGem.Todo("cellGemGetInfo(info=*0x%x)", info); - // TODO: Support many controllers to be connected - *info = {}; + const auto gem = fxm::get(); + + 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; } @@ -160,10 +185,19 @@ s32 cellGemHSVtoRGB() return CELL_OK; } -s32 cellGemInit(vm::ptr attribute) +s32 cellGemInit(vm::cptr attribute) { cellGem.Warning("cellGemInit(attribute=*0x%x)", attribute); + const auto gem = fxm::make(); + + if (!gem) + { + return CELL_GEM_ERROR_ALREADY_INITIALIZED; + } + + gem->attribute = *attribute; + return CELL_OK; }