2020-12-05 13:08:24 +01:00
|
|
|
#include "stdafx.h"
|
2016-03-21 20:43:03 +01:00
|
|
|
#include "Emu/Cell/PPUModule.h"
|
2022-04-09 23:28:52 +02:00
|
|
|
#include "Emu/IdManager.h"
|
|
|
|
|
#include "Emu/System.h"
|
2015-07-30 00:30:13 +02:00
|
|
|
|
2015-08-21 22:57:49 +02:00
|
|
|
#include "cellGame.h"
|
|
|
|
|
|
2018-08-25 14:39:00 +02:00
|
|
|
LOG_CHANNEL(cellGameExec);
|
2015-07-30 00:30:13 +02:00
|
|
|
|
2022-04-09 23:28:52 +02:00
|
|
|
struct game_exec_data
|
|
|
|
|
{
|
|
|
|
|
atomic_t<u32> execdata = 0; // TODO: pass this to the source application after closing the current application
|
|
|
|
|
};
|
|
|
|
|
|
2020-07-16 12:14:57 +02:00
|
|
|
error_code cellGameSetExitParam(u32 execdata)
|
2015-07-30 00:30:13 +02:00
|
|
|
{
|
2017-07-23 22:46:16 +02:00
|
|
|
cellGameExec.todo("cellGameSetExitParam(execdata=0x%x)", execdata);
|
2022-04-09 23:28:52 +02:00
|
|
|
|
|
|
|
|
g_fxo->get<game_exec_data>().execdata = execdata;
|
|
|
|
|
|
2017-07-23 22:46:16 +02:00
|
|
|
return CELL_OK;
|
2015-07-30 00:30:13 +02:00
|
|
|
}
|
|
|
|
|
|
2020-07-16 12:14:57 +02:00
|
|
|
error_code cellGameGetHomeDataExportPath(vm::ptr<char> exportPath)
|
2015-07-30 00:30:13 +02:00
|
|
|
{
|
2017-07-23 22:46:16 +02:00
|
|
|
cellGameExec.warning("cellGameGetHomeDataExportPath(exportPath=*0x%x)", exportPath);
|
2015-09-10 16:30:14 +02:00
|
|
|
|
2018-06-12 21:32:40 +02:00
|
|
|
if (!exportPath)
|
|
|
|
|
{
|
|
|
|
|
return CELL_GAME_ERROR_PARAM;
|
|
|
|
|
}
|
|
|
|
|
|
2015-09-10 16:30:14 +02:00
|
|
|
// TODO: PlayStation home is defunct.
|
|
|
|
|
|
|
|
|
|
return CELL_GAME_ERROR_NOAPP;
|
2015-07-30 00:30:13 +02:00
|
|
|
}
|
|
|
|
|
|
2022-04-09 23:28:52 +02:00
|
|
|
error_code cellGameGetHomePath(vm::ptr<char> homePath)
|
2015-07-30 00:30:13 +02:00
|
|
|
{
|
2022-04-09 23:28:52 +02:00
|
|
|
cellGameExec.todo("cellGameGetHomePath(homePath=*0x%x)", homePath);
|
|
|
|
|
|
|
|
|
|
if (!homePath)
|
|
|
|
|
{
|
|
|
|
|
return CELL_GAME_ERROR_PARAM;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// TODO: PlayStation home is defunct.
|
|
|
|
|
|
2017-07-23 22:46:16 +02:00
|
|
|
return CELL_OK;
|
2015-07-30 00:30:13 +02:00
|
|
|
}
|
|
|
|
|
|
2020-07-16 12:14:57 +02:00
|
|
|
error_code cellGameGetHomeDataImportPath(vm::ptr<char> importPath)
|
2015-07-30 00:30:13 +02:00
|
|
|
{
|
2017-07-23 22:46:16 +02:00
|
|
|
cellGameExec.warning("cellGameGetHomeDataImportPath(importPath=*0x%x)", importPath);
|
|
|
|
|
|
2018-06-12 21:32:40 +02:00
|
|
|
if (!importPath)
|
|
|
|
|
{
|
|
|
|
|
return CELL_GAME_ERROR_PARAM;
|
|
|
|
|
}
|
|
|
|
|
|
2017-07-23 22:46:16 +02:00
|
|
|
// TODO: PlayStation home is defunct.
|
|
|
|
|
|
|
|
|
|
return CELL_GAME_ERROR_NOAPP;
|
2015-07-30 00:30:13 +02:00
|
|
|
}
|
|
|
|
|
|
2020-07-16 12:14:57 +02:00
|
|
|
error_code cellGameGetHomeLaunchOptionPath(vm::ptr<char> commonPath, vm::ptr<char> personalPath)
|
2015-07-30 00:30:13 +02:00
|
|
|
{
|
2017-02-14 18:46:56 +01:00
|
|
|
cellGameExec.todo("cellGameGetHomeLaunchOptionPath(commonPath=%s, personalPath=%s)", commonPath, personalPath);
|
|
|
|
|
|
2018-06-12 21:32:40 +02:00
|
|
|
if (!commonPath || !personalPath)
|
|
|
|
|
{
|
|
|
|
|
return CELL_GAME_ERROR_PARAM;
|
|
|
|
|
}
|
|
|
|
|
|
2017-02-14 18:46:56 +01:00
|
|
|
// TODO: PlayStation home is not supported atm.
|
|
|
|
|
return CELL_GAME_ERROR_NOAPP;
|
2015-07-30 00:30:13 +02:00
|
|
|
}
|
|
|
|
|
|
2022-04-10 15:14:17 +02:00
|
|
|
error_code cellGameExecGame(u32 type, vm::ptr<char> dirName, u32 options, u32 memContainer, u32 execData, u32 userData)
|
2019-04-10 19:34:44 +02:00
|
|
|
{
|
2022-05-05 11:38:01 +02:00
|
|
|
cellGameExec.todo("cellGameExecGame(type=0x%x, dirName=%s, options=0x%x, memContainer=0x%x, execData=0x%x, userData=0x%x)", type, dirName, options, memContainer, execData, userData);
|
2019-04-10 19:34:44 +02:00
|
|
|
return CELL_OK;
|
|
|
|
|
}
|
|
|
|
|
|
2022-04-10 15:14:17 +02:00
|
|
|
error_code cellGameDeleteGame(vm::ptr<char> dirName, u32 memContainer)
|
2022-04-09 23:28:52 +02:00
|
|
|
{
|
2022-05-05 11:38:01 +02:00
|
|
|
cellGameExec.todo("cellGameDeleteGame(dirName=%s, memContainer=0x%x)", dirName, memContainer);
|
2022-04-09 23:28:52 +02:00
|
|
|
return CELL_OK;
|
|
|
|
|
}
|
|
|
|
|
|
2020-07-16 12:14:57 +02:00
|
|
|
error_code cellGameGetBootGameInfo(vm::ptr<u32> type, vm::ptr<char> dirName, vm::ptr<u32> execdata)
|
2015-07-30 00:30:13 +02:00
|
|
|
{
|
2022-05-05 11:38:01 +02:00
|
|
|
cellGameExec.todo("cellGameGetBootGameInfo(type=*0x%x, dirName=*0x%x, execdata=*0x%x)", type, dirName, execdata);
|
2015-07-30 00:30:13 +02:00
|
|
|
|
2018-06-12 21:32:40 +02:00
|
|
|
if (!type || !dirName) // execdata can be NULL
|
|
|
|
|
{
|
|
|
|
|
return CELL_GAME_ERROR_PARAM;
|
|
|
|
|
}
|
|
|
|
|
|
2022-04-09 23:28:52 +02:00
|
|
|
const u32 source_type = Emu.GetBootSourceType();
|
|
|
|
|
|
|
|
|
|
*type = source_type;
|
|
|
|
|
|
|
|
|
|
if (execdata)
|
|
|
|
|
{
|
|
|
|
|
*execdata = g_fxo->get<game_exec_data>().execdata;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (source_type == CELL_GAME_GAMETYPE_HDD)
|
|
|
|
|
{
|
|
|
|
|
const std::string dir_name = Emu.GetDir();
|
|
|
|
|
|
|
|
|
|
if (dir_name.size() >= CELL_GAME_DIRNAME_SIZE)
|
|
|
|
|
{
|
|
|
|
|
return CELL_HDDGAME_ERROR_INTERNAL; // Speculative
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
std::memcpy(dirName.get_ptr(), dir_name.c_str(), dir_name.size() + 1);
|
|
|
|
|
}
|
2015-08-21 22:57:49 +02:00
|
|
|
|
|
|
|
|
return CELL_OK;
|
|
|
|
|
}
|
2015-07-30 00:30:13 +02:00
|
|
|
|
2022-04-10 15:14:17 +02:00
|
|
|
error_code cellGameGetExitGameInfo(vm::ptr<u32> status, vm::ptr<u32> type, vm::ptr<char> dirName, vm::ptr<u32> execData, vm::ptr<u32> userData)
|
|
|
|
|
{
|
2022-05-05 11:38:01 +02:00
|
|
|
cellGameExec.todo("cellGameGetExitGameInfo(status=*0x%x, type=*0x%x, dirName=*0x%x, execData=*0x%x, userData=0x%x)", status, type, dirName, execData, userData);
|
2022-04-10 15:14:17 +02:00
|
|
|
return CELL_OK;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
error_code cellGameGetList(u32 listBufNum, u32 unk, vm::ptr<u32> listNum, vm::ptr<u32> getListNum, u32 memContainer)
|
|
|
|
|
{
|
2022-05-05 11:38:01 +02:00
|
|
|
cellGameExec.todo("cellGameGetList(listBufNum=0x%x, unk=0x%x, listNum=*0x%x, getListNum=*0x%x, memContainer=0x%x)", listBufNum, unk, listNum, getListNum, memContainer);
|
2022-04-10 15:14:17 +02:00
|
|
|
return CELL_OK;
|
|
|
|
|
}
|
|
|
|
|
|
2016-03-21 20:43:03 +01:00
|
|
|
DECLARE(ppu_module_manager::cellGameExec)("cellGameExec", []()
|
2025-04-05 21:50:45 +02:00
|
|
|
{
|
|
|
|
|
REG_FUNC(cellGameExec, cellGameSetExitParam);
|
|
|
|
|
REG_FUNC(cellGameExec, cellGameGetHomeDataExportPath);
|
|
|
|
|
REG_FUNC(cellGameExec, cellGameGetHomePath);
|
|
|
|
|
REG_FUNC(cellGameExec, cellGameGetHomeDataImportPath);
|
|
|
|
|
REG_FUNC(cellGameExec, cellGameGetHomeLaunchOptionPath);
|
|
|
|
|
REG_FUNC(cellGameExec, cellGameExecGame);
|
|
|
|
|
REG_FUNC(cellGameExec, cellGameDeleteGame);
|
|
|
|
|
REG_FUNC(cellGameExec, cellGameGetBootGameInfo);
|
|
|
|
|
REG_FUNC(cellGameExec, cellGameGetExitGameInfo);
|
|
|
|
|
REG_FUNC(cellGameExec, cellGameGetList);
|
|
|
|
|
});
|