Beispiel #1
0
int sdata_unpack(const std::string& packed_file, const std::string& unpacked_file)
{
	std::shared_ptr<vfsFileBase> packed_stream(Emu.GetVFS().OpenFile(packed_file, vfsRead));
	std::shared_ptr<vfsFileBase> unpacked_stream(Emu.GetVFS().OpenFile(unpacked_file, vfsWrite));
	
	if(!packed_stream || !packed_stream->IsOpened())
	{
		sys_fs.Error("'%s' not found! flags: 0x%08x", packed_file.c_str(), vfsRead);
		return CELL_ENOENT;
	}

	if(!unpacked_stream || !unpacked_stream->IsOpened())
	{
		sys_fs.Error("'%s' couldn't be created! flags: 0x%08x", unpacked_file.c_str(), vfsWrite);
		return CELL_ENOENT;
	}

	char buffer [10200];
	packed_stream->Read(buffer, 256);
	u32 format = re32(*(u32*)&buffer[0]);
	if (format != 0x4E504400) // "NPD\x00"
	{
		sys_fs.Error("Illegal format. Expected 0x4E504400, but got 0x%08x", format);
		return CELL_EFSSPECIFIC;
	}

	u32 version	       = re32(*(u32*)&buffer[0x04]);
	u32 flags          = re32(*(u32*)&buffer[0x80]);
	u32 blockSize      = re32(*(u32*)&buffer[0x84]);
	u64 filesizeOutput = re64(*(u64*)&buffer[0x88]);
	u64 filesizeInput  = packed_stream->GetSize();
	u32 blockCount     = (filesizeOutput + blockSize-1) / blockSize;

	// SDATA file is compressed
	if (flags & 0x1)
	{
		sys_fs.Warning("cellFsSdataOpen: Compressed SDATA files are not supported yet.");
		return CELL_EFSSPECIFIC;
	}

	// SDATA file is NOT compressed
	else 
	{
		u32 t1 = (flags & 0x20) ? 0x20 : 0x10;
		u32 startOffset = (blockCount * t1) + 0x100;
		u64 filesizeTmp = (filesizeOutput+0xF)&0xFFFFFFF0 + startOffset;

		if (!sdata_check(version, flags, filesizeInput, filesizeTmp))
		{
			sys_fs.Error("cellFsSdataOpen: Wrong header information.");
			return CELL_EFSSPECIFIC;
		}
	
		if (flags & 0x20)
			packed_stream->Seek(0x100);
		else
			packed_stream->Seek(startOffset);

		for (u32 i = 0; i < blockCount; i++)
		{
			if (flags & 0x20)
				packed_stream->Seek(packed_stream->Tell() + t1);

			if (!(blockCount-i-1))
				blockSize = filesizeOutput-i*blockSize;

			packed_stream->Read(buffer+256, blockSize);
			unpacked_stream->Write(buffer+256, blockSize);
		}
	}

	return CELL_OK;
}
Beispiel #2
0
int cellHddGameCheck(u32 version, vm::ptr<const char> dirName, u32 errDialog, vm::ptr<CellHddGameStatCallback> funcStat, u32 container)
{
	cellSysutil.Warning("cellHddGameCheck(version=%d, dirName_addr=0x%x, errDialog=%d, funcStat_addr=0x%x, container=%d)",
		version, dirName.addr(), errDialog, funcStat.addr(), container);

	std::string dir = dirName.get_ptr();
	if (dir.size() != 9)
		return CELL_HDDGAME_ERROR_PARAM;

	vm::var<CellHddGameSystemFileParam> param;
	vm::var<CellHddGameCBResult> result;
	vm::var<CellHddGameStatGet> get;
	vm::var<CellHddGameStatSet> set;

	get->hddFreeSizeKB = 40 * 1024 * 1024; // 40 GB, TODO: Use the free space of the computer's HDD where RPCS3 is being run.
	get->isNewData = CELL_HDDGAME_ISNEWDATA_EXIST;
	get->sysSizeKB = 0; // TODO
	get->st_atime__  = 0; // TODO
	get->st_ctime__  = 0; // TODO
	get->st_mtime__  = 0; // TODO
	get->sizeKB = CELL_HDDGAME_SIZEKB_NOTCALC;
	memcpy(get->contentInfoPath, ("/dev_hdd0/game/" + dir).c_str(), CELL_HDDGAME_PATH_MAX);
	memcpy(get->hddGamePath, ("/dev_hdd0/game/" + dir + "/USRDIR").c_str(), CELL_HDDGAME_PATH_MAX);

	if (!Emu.GetVFS().ExistsDir(("/dev_hdd0/game/" + dir).c_str()))
	{
		get->isNewData = CELL_HDDGAME_ISNEWDATA_NODIR;
	}
	else
	{
		// TODO: Is cellHddGameCheck really responsible for writing the information in get->getParam ? (If not, delete this else)

		vfsFile f(("/dev_hdd0/game/" + dir + "/PARAM.SFO").c_str());
		PSFLoader psf(f);
		if (!psf.Load(false)) {
			return CELL_HDDGAME_ERROR_BROKEN;
		}

		get->getParam.parentalLevel = psf.GetInteger("PARENTAL_LEVEL");
		get->getParam.attribute = psf.GetInteger("ATTRIBUTE");
		get->getParam.resolution = psf.GetInteger("RESOLUTION");
		get->getParam.soundFormat = psf.GetInteger("SOUND_FORMAT");
		std::string title = psf.GetString("TITLE");
		strcpy_trunc(get->getParam.title, title);
		std::string app_ver = psf.GetString("APP_VER");
		strcpy_trunc(get->getParam.dataVersion, app_ver);
		strcpy_trunc(get->getParam.titleId, dir);

		for (u32 i=0; i<CELL_HDDGAME_SYSP_LANGUAGE_NUM; i++) {
			char key [16];
			sprintf(key, "TITLE_%02d", i);
			title = psf.GetString(key);
			strcpy_trunc(get->getParam.titleLang[i], title);
		}
	}

	// TODO ?

	funcStat(result, get, set);

	if (result->result != CELL_HDDGAME_CBRESULT_OK &&
        result->result != CELL_HDDGAME_CBRESULT_OK_CANCEL) {
		return CELL_HDDGAME_ERROR_CBRESULT;
    }

	// TODO ?

	return CELL_OK;
}
Beispiel #3
0
s32 cellAtracSetLoopNum(vm::ptr<CellAtracHandle> pHandle, int iLoopNum)
{
	cellAtrac.Warning("cellAtracSetLoopNum(pHandle=0x%x, iLoopNum=0x%x)", pHandle.addr(), iLoopNum);

	return CELL_OK;
}
Beispiel #4
0
s32 sceNpLookupTerm()
{
	sceNp.Warning("sceNpLookupTerm()");

	return CELL_OK;
}
Beispiel #5
0
s32 cellGameDataCheckCreate2(PPUThread& ppu, u32 version, vm::cptr<char> dirName, u32 errDialog, vm::ptr<CellGameDataStatCallback> funcStat, u32 container)
{
	cellGame.Warning("cellGameDataCheckCreate2(version=0x%x, dirName=*0x%x, errDialog=0x%x, funcStat=*0x%x, container=%d)", version, dirName, errDialog, funcStat, container);

	if (version != CELL_GAMEDATA_VERSION_CURRENT || errDialog > 1)
	{
		cellGame.Error("cellGameDataCheckCreate2(): CELL_GAMEDATA_ERROR_PARAM");
		return CELL_GAMEDATA_ERROR_PARAM;
	}

	// TODO: output errors (errDialog)

	const std::string dir = "/dev_hdd0/game/"s + dirName.get_ptr();

	if (!Emu.GetVFS().ExistsDir(dir))
	{
		cellGame.Todo("cellGameDataCheckCreate2(): creating directory '%s'", dir.c_str());
		// TODO: create data
		return CELL_GAMEDATA_RET_OK;
	}

	vfsFile f("/app_home/../PARAM.SFO");
	const PSFLoader psf(f);
	if (!psf)
	{
		cellGame.Error("cellGameDataCheckCreate2(): CELL_GAMEDATA_ERROR_BROKEN (cannot read PARAM.SFO)");
		return CELL_GAMEDATA_ERROR_BROKEN;
	}

	vm::var<CellGameDataCBResult> cbResult;
	vm::var<CellGameDataStatGet>  cbGet;
	vm::var<CellGameDataStatSet>  cbSet;

	// TODO: Use the free space of the computer's HDD where RPCS3 is being run.
	cbGet->hddFreeSizeKB = 40000000; //40 GB

	cbGet->isNewData = CELL_GAMEDATA_ISNEWDATA_NO;
	strcpy_trunc(cbGet->contentInfoPath, dir);
	strcpy_trunc(cbGet->gameDataPath, dir + "/USRDIR");

	// TODO: set correct time
	cbGet->st_atime_ = 0;
	cbGet->st_ctime_ = 0;
	cbGet->st_mtime_ = 0;

	// TODO: calculate data size, if necessary
	cbGet->sizeKB = CELL_GAMEDATA_SIZEKB_NOTCALC;
	cbGet->sysSizeKB = 0;

	cbGet->getParam.attribute = CELL_GAMEDATA_ATTR_NORMAL;
	cbGet->getParam.parentalLevel = psf.GetInteger("PARENTAL_LEVEL");
	strcpy_trunc(cbGet->getParam.dataVersion, psf.GetString("APP_VER"));
	strcpy_trunc(cbGet->getParam.titleId, psf.GetString("TITLE_ID"));
	strcpy_trunc(cbGet->getParam.title, psf.GetString("TITLE"));
	// TODO: write lang titles

	funcStat(ppu, cbResult, cbGet, cbSet);

	if (cbSet->setParam)
	{
		// TODO: write PARAM.SFO from cbSet
		cellGame.Todo("cellGameDataCheckCreate2(): writing PARAM.SFO parameters (addr=0x%x)", cbSet->setParam);
	}

	switch ((s32)cbResult->result)
	{
	case CELL_GAMEDATA_CBRESULT_OK_CANCEL:
		// TODO: do not process game data
		cellGame.Warning("cellGameDataCheckCreate2(): callback returned CELL_GAMEDATA_CBRESULT_OK_CANCEL");

	case CELL_GAMEDATA_CBRESULT_OK:
		return CELL_GAMEDATA_RET_OK;

	case CELL_GAMEDATA_CBRESULT_ERR_NOSPACE: // TODO: process errors, error message and needSizeKB result
		cellGame.Error("cellGameDataCheckCreate2(): callback returned CELL_GAMEDATA_CBRESULT_ERR_NOSPACE");
		return CELL_GAMEDATA_ERROR_CBRESULT;

	case CELL_GAMEDATA_CBRESULT_ERR_BROKEN:
		cellGame.Error("cellGameDataCheckCreate2(): callback returned CELL_GAMEDATA_CBRESULT_ERR_BROKEN");
		return CELL_GAMEDATA_ERROR_CBRESULT;

	case CELL_GAMEDATA_CBRESULT_ERR_NODATA:
		cellGame.Error("cellGameDataCheckCreate2(): callback returned CELL_GAMEDATA_CBRESULT_ERR_NODATA");
		return CELL_GAMEDATA_ERROR_CBRESULT;

	case CELL_GAMEDATA_CBRESULT_ERR_INVALID:
		cellGame.Error("cellGameDataCheckCreate2(): callback returned CELL_GAMEDATA_CBRESULT_ERR_INVALID");
		return CELL_GAMEDATA_ERROR_CBRESULT;

	default:
		cellGame.Error("cellGameDataCheckCreate2(): callback returned unknown error (code=0x%x)");
		return CELL_GAMEDATA_ERROR_CBRESULT;
	}
}
Beispiel #6
0
s32 sceNpScoreTerm()
{
	sceNp.Warning("sceNpScoreTerm()");

	return CELL_OK;
}
Beispiel #7
0
s32 npDrmIsAvailable(u32 k_licensee_addr, vm::cptr<char> drm_path)
{
	if (!Emu.GetVFS().ExistsFile(drm_path.get_ptr()))
	{
		sceNp.Warning("npDrmIsAvailable(): '%s' not found", drm_path.get_ptr());
		return CELL_ENOENT;
	}

	std::string k_licensee_str = "0";
	u8 k_licensee[0x10];

	if (k_licensee_addr)
	{
		for (s32 i = 0; i < 0x10; i++)
		{
			k_licensee[i] = vm::read8(k_licensee_addr + i);
			k_licensee_str += fmt::format("%02x", k_licensee[i]);
		}
	}

	sceNp.Warning("npDrmIsAvailable(): Found DRM license file at %s", drm_path.get_ptr());
	sceNp.Warning("npDrmIsAvailable(): Using k_licensee 0x%s", k_licensee_str.c_str());

	// Set the necessary file paths.
	std::string drm_file_name = fmt::AfterLast(drm_path.get_ptr(), '/');

	// TODO: Make more explicit what this actually does (currently it copies "XXXXXXXX" from drm_path (== "/dev_hdd0/game/XXXXXXXXX/*" assumed)
	std::string titleID(&drm_path[15], 9);

	// TODO: These shouldn't use current dir
	std::string enc_drm_path = drm_path.get_ptr();
	std::string dec_drm_path = "/dev_hdd1/cache/" + drm_file_name;
	std::string pf_str("00000001");  // TODO: Allow multiple profiles. Use default for now.
	std::string rap_path("/dev_hdd0/home/" + pf_str + "/exdata/");

	// Search dev_usb000 for a compatible RAP file. 
	for (const auto entry : vfsDir(rap_path))
	{
		if (entry->name.find(titleID) != std::string::npos)
		{
			rap_path += entry->name;
			break;
		}
	}

	if (rap_path.back() == '/')
	{
		sceNp.Warning("npDrmIsAvailable(): Can't find RAP file for '%s' (titleID='%s')", drm_path.get_ptr(), titleID);
	}

	// Decrypt this EDAT using the supplied k_licensee and matching RAP file.
	std::string enc_drm_path_local, dec_drm_path_local, rap_path_local;
	Emu.GetVFS().GetDevice(enc_drm_path, enc_drm_path_local);
	Emu.GetVFS().GetDevice(dec_drm_path, dec_drm_path_local);
	Emu.GetVFS().GetDevice(rap_path, rap_path_local);

	if (DecryptEDAT(enc_drm_path_local, dec_drm_path_local, 8, rap_path_local, k_licensee, false) >= 0)
	{
		// If decryption succeeds, replace the encrypted file with it.
		fs::remove_file(enc_drm_path_local);
		fs::rename(dec_drm_path_local, enc_drm_path_local);
	}

	return CELL_OK;
}
Beispiel #8
0
s32 sceNpTrophyTerm()
{
	sceNpTrophy.Warning("sceNpTrophyTerm()");

	return CELL_OK;
}
Beispiel #9
0
void sys_ppu_thread_get_join_state(u32 isjoinable_addr)
{
    sysPrxForUser.Warning("sys_ppu_thread_get_join_state(isjoinable_addr=0x%x)", isjoinable_addr);
    Memory.Write32(isjoinable_addr, GetCurrentPPUThread().IsJoinable());
}
Beispiel #10
0
int cellHddGameCheck(u32 version, u32 dirName_addr, u32 errDialog, mem_func_ptr_t<CellHddGameStatCallback> funcStat, u32 container)
{
	cellSysutil.Warning("cellHddGameCheck(version=%d, dirName_addr=0x%xx, errDialog=%d, funcStat_addr=0x%x, container=%d)",
		version, dirName_addr, errDialog, funcStat, container);

	if (!Memory.IsGoodAddr(dirName_addr) || !funcStat.IsGood())
		return CELL_HDDGAME_ERROR_PARAM;

	std::string dirName = Memory.ReadString(dirName_addr).ToStdString();
	if (dirName.size() != 9)
		return CELL_HDDGAME_ERROR_PARAM;

	MemoryAllocator<CellHddGameSystemFileParam> param;
	MemoryAllocator<CellHddGameCBResult> result;
	MemoryAllocator<CellHddGameStatGet> get;
	MemoryAllocator<CellHddGameStatSet> set;

	get->hddFreeSizeKB = 40000000; // 40 GB, TODO: Use the free space of the computer's HDD where RPCS3 is being run.
	get->isNewData = CELL_HDDGAME_ISNEWDATA_EXIST;
	get->sysSizeKB = 0; // TODO
	get->st_atime__  = 0; // TODO
	get->st_ctime__  = 0; // TODO
	get->st_mtime__  = 0; // TODO
	get->sizeKB = CELL_HDDGAME_SIZEKB_NOTCALC;
	memcpy(get->contentInfoPath, ("/dev_hdd0/game/"+dirName).c_str(), CELL_HDDGAME_PATH_MAX);
	memcpy(get->hddGamePath, ("/dev_hdd0/game/"+dirName+"/USRDIR").c_str(), CELL_HDDGAME_PATH_MAX);

	if (!Emu.GetVFS().ExistsDir(("/dev_hdd0/game/"+dirName).c_str()))
	{
		get->isNewData = CELL_HDDGAME_ISNEWDATA_NODIR;
	}
	else
	{
		// TODO: Is cellHddGameCheck really responsible for writing the information in get->getParam ? (If not, delete this else)

		vfsFile f(("/dev_hdd0/game/"+dirName+"/PARAM.SFO").c_str());
		PSFLoader psf(f);
		if (!psf.Load(false)) {
			return CELL_HDDGAME_ERROR_BROKEN;
		}

		get->getParam.parentalLevel = psf.m_info.parental_lvl;
		get->getParam.attribute = psf.m_info.attr;
		get->getParam.resolution = psf.m_info.resolution;
		get->getParam.soundFormat = psf.m_info.sound_format;
		memcpy(get->getParam.title, psf.m_info.name.mb_str(), CELL_HDDGAME_SYSP_TITLE_SIZE);
		memcpy(get->getParam.dataVersion, psf.m_info.app_ver.mb_str(), CELL_HDDGAME_SYSP_VERSION_SIZE);
		memcpy(get->getParam.titleId, dirName.c_str(), CELL_HDDGAME_SYSP_TITLEID_SIZE);

		for (u32 i=0; i<CELL_HDDGAME_SYSP_LANGUAGE_NUM; i++) {
			memcpy(get->getParam.titleLang[i], psf.m_info.name.mb_str(), CELL_HDDGAME_SYSP_TITLE_SIZE); // TODO: Get real titleLang name
		}
	}

	// TODO ?

	funcStat(result.GetAddr(), get.GetAddr(), set.GetAddr());
	if (result->result != CELL_HDDGAME_CBRESULT_OK &&
		result->result != CELL_HDDGAME_CBRESULT_OK_CANCEL)
		return CELL_HDDGAME_ERROR_CBRESULT;

	// TODO ?

	return CELL_OK;
}
Beispiel #11
0
// Functions
s32 sceNpTrophyInit(vm::ptr<void> pool, u32 poolSize, u32 containerId, u64 options)
{
	sceNpTrophy.Warning("sceNpTrophyInit(pool=*0x%x, poolSize=0x%x, containerId=0x%x, options=0x%llx)", pool, poolSize, containerId, options);

	return CELL_OK;
}
Beispiel #12
0
s32 cellMsgDialogOpen2(u32 type, vm::cptr<char> msgString, vm::ptr<CellMsgDialogCallback> callback, vm::ptr<void> userData, vm::ptr<void> extParam)
{
	cellSysutil.Warning("cellMsgDialogOpen2(type=0x%x, msgString=*0x%x, callback=*0x%x, userData=*0x%x, extParam=*0x%x)", type, msgString, callback, userData, extParam);

	if (!msgString || strlen(msgString.get_ptr()) >= 0x200 || type & -0x33f8)
	{
		return CELL_MSGDIALOG_ERROR_PARAM;
	}

	switch (type & CELL_MSGDIALOG_TYPE_BUTTON_TYPE)
	{
	case CELL_MSGDIALOG_TYPE_BUTTON_TYPE_NONE:
	{
		if (type & CELL_MSGDIALOG_TYPE_DEFAULT_CURSOR)
		{
			return CELL_MSGDIALOG_ERROR_PARAM;
		}
		switch (type & CELL_MSGDIALOG_TYPE_PROGRESSBAR)
		{
		case CELL_MSGDIALOG_TYPE_PROGRESSBAR_NONE: break;
		case CELL_MSGDIALOG_TYPE_PROGRESSBAR_SINGLE: break;
		case CELL_MSGDIALOG_TYPE_PROGRESSBAR_DOUBLE: break;
		default: return CELL_MSGDIALOG_ERROR_PARAM;
		}
		break;
	}

	case CELL_MSGDIALOG_TYPE_BUTTON_TYPE_YESNO:
	{
		switch (type & CELL_MSGDIALOG_TYPE_DEFAULT_CURSOR)
		{
		case CELL_MSGDIALOG_TYPE_DEFAULT_CURSOR_YES: break;
		case CELL_MSGDIALOG_TYPE_DEFAULT_CURSOR_NO: break;
		default: return CELL_MSGDIALOG_ERROR_PARAM;
		}
		if (type & CELL_MSGDIALOG_TYPE_PROGRESSBAR)
		{
			return CELL_MSGDIALOG_ERROR_PARAM;
		}
		break;
	}

	case CELL_MSGDIALOG_TYPE_BUTTON_TYPE_OK:
	{
		if (type & CELL_MSGDIALOG_TYPE_DEFAULT_CURSOR)
		{
			return CELL_MSGDIALOG_ERROR_PARAM;
		}
		if (type & CELL_MSGDIALOG_TYPE_PROGRESSBAR)
		{
			return CELL_MSGDIALOG_ERROR_PARAM;
		}
		break;
	}

	default: return CELL_MSGDIALOG_ERROR_PARAM;
	}

	MsgDialogState old = msgDialogNone;
	if (!g_msg_dialog->state.compare_exchange_strong(old, msgDialogInit))
	{
		return CELL_SYSUTIL_ERROR_BUSY;
	}

	g_msg_dialog->wait_until = get_system_time() + 31536000000000ull; // some big value

	switch (type & CELL_MSGDIALOG_TYPE_PROGRESSBAR)
	{
	case CELL_MSGDIALOG_TYPE_PROGRESSBAR_DOUBLE: g_msg_dialog->progress_bar_count = 2; break;
	case CELL_MSGDIALOG_TYPE_PROGRESSBAR_SINGLE: g_msg_dialog->progress_bar_count = 1; break;
	default: g_msg_dialog->progress_bar_count = 0; break;
	}

	switch (type & CELL_MSGDIALOG_TYPE_SE_MUTE) // TODO
	{
	case CELL_MSGDIALOG_TYPE_SE_MUTE_OFF: break;
	case CELL_MSGDIALOG_TYPE_SE_MUTE_ON: break;
	}

	std::string msg = msgString.get_ptr();

	switch (type & CELL_MSGDIALOG_TYPE_SE_TYPE)
	{
	case CELL_MSGDIALOG_TYPE_SE_TYPE_NORMAL: cellSysutil.Warning("%s", msg); break;
	case CELL_MSGDIALOG_TYPE_SE_TYPE_ERROR: cellSysutil.Error("%s", msg); break;
	}

	g_msg_dialog->status = CELL_MSGDIALOG_BUTTON_NONE;

	CallAfter([type, msg]()
	{
		if (Emu.IsStopped())
		{
			g_msg_dialog->state.exchange(msgDialogNone);

			return;
		}

		g_msg_dialog->Create(type, msg);

		g_msg_dialog->state.exchange(msgDialogOpen);
	});

	while (g_msg_dialog->state == msgDialogInit)
	{
		if (Emu.IsStopped())
		{
			if (g_msg_dialog->state != msgDialogNone)
			{
				break;
			}

			CHECK_EMU_STATUS;
		}

		std::this_thread::sleep_for(std::chrono::milliseconds(1)); // hack
	}

	thread_t(WRAP_EXPR("MsgDialog Thread"), [=]()
	{
		while (g_msg_dialog->state == msgDialogOpen || (s64)(get_system_time() - g_msg_dialog->wait_until) < 0)
		{
			if (Emu.IsStopped())
			{
				g_msg_dialog->state = msgDialogAbort;
				break;
			}
			std::this_thread::sleep_for(std::chrono::milliseconds(1)); // hack
		}

		if (callback && g_msg_dialog->state != msgDialogAbort)
		{
			const s32 status = g_msg_dialog->status;

			Emu.GetCallbackManager().Register([=](CPUThread& CPU) -> s32
			{
				callback(static_cast<PPUThread&>(CPU), status, userData);
				return CELL_OK;
			});
		}

		CallAfter([]()
		{
			g_msg_dialog->Destroy();
			g_msg_dialog->state = msgDialogNone;
		});

	}).detach();

	return CELL_OK;
}
Beispiel #13
0
s32 cellMsgDialogOpenErrorCode(PPUThread& CPU, u32 errorCode, vm::ptr<CellMsgDialogCallback> callback, vm::ptr<void> userData, vm::ptr<void> extParam)
{
	cellSysutil.Warning("cellMsgDialogOpenErrorCode(errorCode=0x%x, callback=*0x%x, userData=*0x%x, extParam=*0x%x)", errorCode, callback, userData, extParam);

	std::string error;

	switch (errorCode)
	{
	case 0x80010001: error = "The resource is temporarily unavailable."; break;
	case 0x80010002: error = "Invalid argument or flag."; break;
	case 0x80010003: error = "The feature is not yet implemented."; break;
	case 0x80010004: error = "Memory allocation failed."; break;
	case 0x80010005: error = "The resource with the specified identifier does not exist."; break;
	case 0x80010006: error = "The file does not exist."; break;
	case 0x80010007: error = "The file is in unrecognized format / The file is not a valid ELF file."; break;
	case 0x80010008: error = "Resource deadlock is avoided."; break;
	case 0x80010009: error = "Operation not permitted."; break;
	case 0x8001000A: error = "The device or resource is busy."; break;
	case 0x8001000B: error = "The operation is timed out."; break;
	case 0x8001000C: error = "The operation is aborted."; break;
	case 0x8001000D: error = "Invalid memory access."; break;
	case 0x8001000F: error = "State of the target thread is invalid."; break;
	case 0x80010010: error = "Alignment is invalid."; break;
	case 0x80010011: error = "Shortage of the kernel resources."; break;
	case 0x80010012: error = "The file is a directory."; break;
	case 0x80010013: error = "Operation cancelled."; break;
	case 0x80010014: error = "Entry already exists."; break;
	case 0x80010015: error = "Port is already connected."; break;
	case 0x80010016: error = "Port is not connected."; break;
	case 0x80010017: error = "Failure in authorizing SELF. Program authentication fail."; break;
	case 0x80010018: error = "The file is not MSELF."; break;
	case 0x80010019: error = "System version error."; break;
	case 0x8001001A: error = "Fatal system error occurred while authorizing SELF. SELF auth failure."; break;
	case 0x8001001B: error = "Math domain violation."; break;
	case 0x8001001C: error = "Math range violation."; break;
	case 0x8001001D: error = "Illegal multi-byte sequence in input."; break;
	case 0x8001001E: error = "File position error."; break;
	case 0x8001001F: error = "Syscall was interrupted."; break;
	case 0x80010020: error = "File too large."; break;
	case 0x80010021: error = "Too many links."; break;
	case 0x80010022: error = "File table overflow."; break;
	case 0x80010023: error = "No space left on device."; break;
	case 0x80010024: error = "Not a TTY."; break;
	case 0x80010025: error = "Broken pipe."; break;
	case 0x80010026: error = "Read-only filesystem."; break;
	case 0x80010027: error = "Illegal seek."; break;
	case 0x80010028: error = "Arg list too long."; break;
	case 0x80010029: error = "Access violation."; break;
	case 0x8001002A: error = "Invalid file descriptor."; break;
	case 0x8001002B: error = "Filesystem mounting failed."; break;
	case 0x8001002C: error = "Too many files open."; break;
	case 0x8001002D: error = "No device."; break;
	case 0x8001002E: error = "Not a directory."; break;
	case 0x8001002F: error = "No such device or IO."; break;
	case 0x80010030: error = "Cross-device link error."; break;
	case 0x80010031: error = "Bad Message."; break;
	case 0x80010032: error = "In progress."; break;
	case 0x80010033: error = "Message size error."; break;
	case 0x80010034: error = "Name too long."; break;
	case 0x80010035: error = "No lock."; break;
	case 0x80010036: error = "Not empty."; break;
	case 0x80010037: error = "Not supported."; break;
	case 0x80010038: error = "File-system specific error."; break;
	case 0x80010039: error = "Overflow occured."; break;
	case 0x8001003A: error = "Filesystem not mounted."; break;
	case 0x8001003B: error = "Not SData."; break;
	case 0x8001003C: error = "Incorrect version in sys_load_param."; break;
	case 0x8001003D: error = "Pointer is null."; break;
	case 0x8001003E: error = "Pointer is null."; break;
	default: error = "An error has occurred."; break;
	}

	error.append(fmt::format("\n(%08x)", errorCode));

	vm::stackvar<char> message(CPU, error.size() + 1);

	memcpy(message.get_ptr(), error.c_str(), message.size());

	return cellMsgDialogOpen2(CELL_MSGDIALOG_DIALOG_TYPE_ERROR | CELL_MSGDIALOG_TYPE_BUTTON_TYPE_OK, message, callback, userData, extParam);
}
Beispiel #14
0
int cellVpostExec(u32 handle, const u32 inPicBuff_addr, const mem_ptr_t<CellVpostCtrlParam> ctrlParam,
                  u32 outPicBuff_addr, mem_ptr_t<CellVpostPictureInfo> picInfo)
{
    cellVpost.Warning("cellVpostExec(handle=0x%x, inPicBuff_addr=0x%x, ctrlParam_addr=0x%x, outPicBuff_addr=0x%x, picInfo_addr=0x%x)",
                      handle, inPicBuff_addr, ctrlParam.GetAddr(), outPicBuff_addr, picInfo.GetAddr());

    VpostInstance* vpost;
    if (!Emu.GetIdManager().GetIDData(handle, vpost))
    {
        return CELL_VPOST_ERROR_E_ARG_HDL_INVALID;
    }

    if (!ctrlParam.IsGood())
    {
        return CELL_VPOST_ERROR_E_ARG_CTRL_INVALID;
    }

    u32 w = ctrlParam->inWidth;
    u32 h = ctrlParam->inHeight;

    if (!Memory.IsGoodAddr(inPicBuff_addr, w*h*3/2))
    {
        return CELL_VPOST_ERROR_E_ARG_INPICBUF_INVALID;
    }

    if (!Memory.IsGoodAddr(outPicBuff_addr, w*h*4))
    {
        return CELL_VPOST_ERROR_E_ARG_OUTPICBUF_INVALID;
    }

    if (!picInfo.IsGood())
    {
        return CELL_VPOST_ERROR_E_ARG_PICINFO_NULL;
    }

    ctrlParam->inWindow; // ignored
    ctrlParam->outWindow; // ignored
    ctrlParam->execType; // ignored
    ctrlParam->scalerType; // ignored
    ctrlParam->ipcType; // ignored

    picInfo->inWidth = ctrlParam->inWidth; // copy
    picInfo->inHeight = ctrlParam->inHeight; // copy
    picInfo->inDepth = CELL_VPOST_PIC_DEPTH_8; // fixed
    picInfo->inScanType = CELL_VPOST_SCAN_TYPE_P; // TODO
    picInfo->inPicFmt = CELL_VPOST_PIC_FMT_IN_YUV420_PLANAR; // fixed
    picInfo->inChromaPosType = ctrlParam->inChromaPosType; // copy
    picInfo->inPicStruct = CELL_VPOST_PIC_STRUCT_PFRM; // TODO
    picInfo->inQuantRange = ctrlParam->inQuantRange; // copy
    picInfo->inColorMatrix = ctrlParam->inColorMatrix; // copy

    picInfo->outWidth = picInfo->inWidth; // TODO (resampling)
    picInfo->outHeight = picInfo->inHeight; // TODO
    picInfo->outDepth = CELL_VPOST_PIC_DEPTH_8; // fixed
    picInfo->outScanType = CELL_VPOST_SCAN_TYPE_P; // TODO
    picInfo->outPicFmt = CELL_VPOST_PIC_FMT_OUT_RGBA_ILV; // TODO
    picInfo->outChromaPosType = ctrlParam->inChromaPosType; // ???
    picInfo->outPicStruct = picInfo->inPicStruct; // ???
    picInfo->outQuantRange = ctrlParam->inQuantRange; // ???
    picInfo->outColorMatrix = ctrlParam->inColorMatrix; // ???

    picInfo->userData = ctrlParam->userData; // copy
    picInfo->reserved1 = 0;
    picInfo->reserved2 = 0;

    u8* pY = (u8*)malloc(w*h);
    u8* pU = (u8*)malloc(w*h/4);
    u8* pV = (u8*)malloc(w*h/4);
    u32* res = (u32*)malloc(w*h*4);
    const u8 alpha = ctrlParam->outAlpha;

    if (!Memory.CopyToReal(pY, inPicBuff_addr, w*h))
    {
        cellVpost.Error("cellVpostExec: data copying failed(pY)");
    }

    if (!Memory.CopyToReal(pU, inPicBuff_addr + w*h, w*h/4))
    {
        cellVpost.Error("cellVpostExec: data copying failed(pU)");
    }

    if (!Memory.CopyToReal(pV, inPicBuff_addr + w*h + w*h/4, w*h/4))
    {
        cellVpost.Error("cellVpostExec: data copying failed(pV)");
    }

    for (u32 i = 0; i < h; i++) for (u32 j = 0; j < w; j++)
        {
            float Cr = pV[(i/2)*(w/2)+j/2];
            float Cb = pU[(i/2)*(w/2)+j/2];
            float Y = pY[i*w+j];

            int R = Y + 1.5701f * Cr;
            if (R < 0) R = 0;
            if (R > 255) R = 255;
            int G = Y - 0.1870f * Cb - 0.4664f * Cr;
            if (G < 0) G = 0;
            if (G > 255) G = 255;
            int B = Y - 1.8556f * Cb;
            if (B < 0) B = 0;
            if (B > 255) B = 255;
            res[i*w+j] = ((u32)alpha << 24) | (B << 16) | (G << 8) | (R);
        }

    if (!Memory.CopyFromReal(outPicBuff_addr, res, w*h*4))
    {
        cellVpost.Error("cellVpostExec: data copying failed(result)");
        Emu.Pause();
    }

    free(pY);
    free(pU);
    free(pV);
    free(res);
    return CELL_OK;
}
Beispiel #15
0
s32 cellSysutilGetSystemParamInt(s32 id, vm::ptr<s32> value)
{
	cellSysutil.Warning("cellSysutilGetSystemParamInt(id=0x%x(%s), value=*0x%x)", id, get_systemparam_id_name(id), value);

	switch(id)
	{
	case CELL_SYSUTIL_SYSTEMPARAM_ID_LANG:
		*value = rpcs3::config.system.language.value();
	break;

	case CELL_SYSUTIL_SYSTEMPARAM_ID_ENTER_BUTTON_ASSIGN:
		*value = CELL_SYSUTIL_ENTER_BUTTON_ASSIGN_CROSS;
	break;

	case CELL_SYSUTIL_SYSTEMPARAM_ID_DATE_FORMAT:
		*value = CELL_SYSUTIL_DATE_FMT_DDMMYYYY;
	break;

	case CELL_SYSUTIL_SYSTEMPARAM_ID_TIME_FORMAT:
		*value = CELL_SYSUTIL_TIME_FMT_CLOCK24;
	break;

	case CELL_SYSUTIL_SYSTEMPARAM_ID_TIMEZONE:
		*value = 180;
	break;

	case CELL_SYSUTIL_SYSTEMPARAM_ID_SUMMERTIME:
		*value = 0;
	break;

	case CELL_SYSUTIL_SYSTEMPARAM_ID_GAME_PARENTAL_LEVEL:
		*value = CELL_SYSUTIL_GAME_PARENTAL_OFF;
	break;

	case CELL_SYSUTIL_SYSTEMPARAM_ID_GAME_PARENTAL_LEVEL0_RESTRICT:
		*value = CELL_SYSUTIL_GAME_PARENTAL_LEVEL0_RESTRICT_OFF;
	break;

	case CELL_SYSUTIL_SYSTEMPARAM_ID_CURRENT_USER_HAS_NP_ACCOUNT:
		*value = 0;
	break;

	case CELL_SYSUTIL_SYSTEMPARAM_ID_CAMERA_PLFREQ:
		*value = CELL_SYSUTIL_CAMERA_PLFREQ_DISABLED;
	break;

	case CELL_SYSUTIL_SYSTEMPARAM_ID_PAD_RUMBLE:
		*value = CELL_SYSUTIL_PAD_RUMBLE_OFF;
	break;

	case CELL_SYSUTIL_SYSTEMPARAM_ID_KEYBOARD_TYPE:
		*value = 0;
	break;

	case CELL_SYSUTIL_SYSTEMPARAM_ID_JAPANESE_KEYBOARD_ENTRY_METHOD:
		*value = 0;
	break;

	case CELL_SYSUTIL_SYSTEMPARAM_ID_CHINESE_KEYBOARD_ENTRY_METHOD:
		*value = 0;
	break;

	case CELL_SYSUTIL_SYSTEMPARAM_ID_PAD_AUTOOFF:
		*value = 0;
	break;

	default:
		return CELL_EINVAL;
	}

	return CELL_OK;
}
Beispiel #16
0
s32 cellSurMixerCreate(vm::cptr<CellSurMixerConfig> config)
{
	libmixer.Warning("cellSurMixerCreate(config=*0x%x)", config);

	g_surmx.audio_port = g_audio.open_port();

	if (!~g_surmx.audio_port)
	{
		return CELL_LIBMIXER_ERROR_FULL;
	}

	g_surmx.priority = config->priority;
	g_surmx.ch_strips_1 = config->chStrips1;
	g_surmx.ch_strips_2 = config->chStrips2;
	g_surmx.ch_strips_6 = config->chStrips6;
	g_surmx.ch_strips_8 = config->chStrips8;

	AudioPortConfig& port = g_audio.ports[g_surmx.audio_port];

	port.channel = 8;
	port.block = 16;
	port.attr = 0;
	port.addr = g_audio.buffer + AUDIO_PORT_OFFSET * g_surmx.audio_port;
	port.read_index_addr = g_audio.indexes + sizeof(u64) * g_surmx.audio_port;
	port.size = port.channel * port.block * AUDIO_SAMPLES * sizeof(float);
	port.tag = 0;
	port.level = 1.0f;
	port.level_set.store({ 1.0f, 0.0f });

	libmixer.Warning("*** audio port opened (port=%d)", g_surmx.audio_port);

	g_surmx.mixcount = 0;
	g_surmx.cb = vm::null;

	g_ssp.clear();

	libmixer.Warning("*** surMixer created (ch1=%d, ch2=%d, ch6=%d, ch8=%d)", config->chStrips1, config->chStrips2, config->chStrips6, config->chStrips8);

	const auto ppu = idm::make_ptr<PPUThread>("Surmixer Thread");
	ppu->prio = 1001;
	ppu->stack_size = 0x10000;
	ppu->custom_task = [](PPUThread& ppu)
	{
		AudioPortConfig& port = g_audio.ports[g_surmx.audio_port];

		while (port.state != AUDIO_PORT_STATE_CLOSED)
		{
			CHECK_EMU_STATUS;

			if (g_surmx.mixcount > (port.tag + 0)) // adding positive value (1-15): preemptive buffer filling (hack)
			{
				std::this_thread::sleep_for(std::chrono::milliseconds(1)); // hack
				continue;
			}

			if (port.state == AUDIO_PORT_STATE_STARTED)
			{
				//u64 stamp0 = get_system_time();

				memset(g_surmx.mixdata, 0, sizeof(g_surmx.mixdata));
				if (g_surmx.cb)
				{
					g_surmx.cb(ppu, g_surmx.cb_arg, (u32)g_surmx.mixcount, 256);
				}

				//u64 stamp1 = get_system_time();

				{
					std::lock_guard<std::mutex> lock(g_surmx.mutex);

					for (auto& p : g_ssp) if (p.m_active && p.m_created)
					{
						auto v = vm::ptrl<s16>::make(p.m_addr); // 16-bit LE audio data
						float left = 0.0f;
						float right = 0.0f;
						float speed = fabs(p.m_speed);
						float fpos = 0.0f;
						for (s32 i = 0; i < 256; i++) if (p.m_active)
						{
							u32 pos = p.m_position;
							s32 pos_inc = 0;
							if (p.m_speed > 0.0f) // select direction
							{
								pos_inc = 1;
							}
							else if (p.m_speed < 0.0f)
							{
								pos_inc = -1;
							}
							s32 shift = i - (int)fpos; // change playback speed (simple and rough)
							if (shift > 0)
							{
								// slow playback
								pos_inc = 0; // duplicate one sample at this time
								fpos += 1.0f;
								fpos += speed;
							}
							else if (shift < 0)
							{
								// fast playback
								i--; // mix two sample into one at this time
								fpos -= 1.0f;
							}
							else
							{
								fpos += speed;
							}
							p.m_position += (u32)pos_inc;
							if (p.m_channels == 1) // get mono data
							{
								left = right = (float)v[pos] / 0x8000 * p.m_level;
							}
							else if (p.m_channels == 2) // get stereo data
							{
								left = (float)v[pos * 2 + 0] / 0x8000 * p.m_level;
								right = (float)v[pos * 2 + 1] / 0x8000 * p.m_level;
							}
							if (p.m_connected) // mix
							{
								// TODO: m_x, m_y, m_z ignored
								g_surmx.mixdata[i * 8 + 0] += left;
								g_surmx.mixdata[i * 8 + 1] += right;
							}
							if ((p.m_position == p.m_samples && p.m_speed > 0.0f) ||
								(p.m_position == ~0 && p.m_speed < 0.0f)) // loop or stop
							{
								if (p.m_loop_mode == CELL_SSPLAYER_LOOP_ON)
								{
									p.m_position = p.m_loop_start;
								}
								else if (p.m_loop_mode == CELL_SSPLAYER_ONESHOT_CONT)
								{
									p.m_position -= (u32)pos_inc; // restore position
								}
								else // oneshot
								{
									p.m_active = false;
									p.m_position = p.m_loop_start; // TODO: check value
								}
							}
						}
					}
				}

				//u64 stamp2 = get_system_time();

				auto buf = vm::get_ptr<be_t<float>>(port.addr + (g_surmx.mixcount % port.block) * port.channel * AUDIO_SAMPLES * sizeof(float));

				for (auto& mixdata : g_surmx.mixdata)
				{
					// reverse byte order
					*buf++ = mixdata;
				}

				//u64 stamp3 = get_system_time();

				//ConLog.Write("Libmixer perf: start=%lld (cb=%lld, ssp=%lld, finalize=%lld)", stamp0 - m_config.start_time, stamp1 - stamp0, stamp2 - stamp1, stamp3 - stamp2);
			}

			g_surmx.mixcount++;
		}

		idm::remove<PPUThread>(ppu.get_id());
	};

	ppu->run();
	ppu->exec();

	return CELL_OK;
}
Beispiel #17
0
s32 sceNpScoreInit()
{
	sceNp.Warning("sceNpScoreInit()");

	return CELL_OK;
}
Beispiel #18
0
s32 cellSurMixerGetAANHandle(vm::ptr<u32> handle)
{
	libmixer.Warning("cellSurMixerGetAANHandle(handle=*0x%x) -> %d", handle, 0x11111111);
	*handle = 0x11111111;
	return CELL_OK;
}
Beispiel #19
0
s32 sceNpDrmIsAvailable2(u32 k_licensee_addr, vm::cptr<char> drm_path)
{
	sceNp.Warning("sceNpDrmIsAvailable2(k_licensee=*0x%x, drm_path=*0x%x)", k_licensee_addr, drm_path);

	return npDrmIsAvailable(k_licensee_addr, drm_path);
}
Beispiel #20
0
s32 cellSurMixerChStripGetAANPortNo(vm::ptr<u32> port, u32 type, u32 index)
{
	libmixer.Warning("cellSurMixerChStripGetAANPortNo(port=*0x%x, type=0x%x, index=0x%x) -> 0x%x", port, type, index, (type << 16) | index);
	*port = (type << 16) | index;
	return CELL_OK;
}
Beispiel #21
0
s32 sceNpLookupInit()
{
	sceNp.Warning("sceNpLookupInit()");

	return CELL_OK;
}
Beispiel #22
0
int cellMsgDialogOpenErrorCode(u32 errorCode, mem_func_ptr_t<CellMsgDialogCallback> callback, mem_ptr_t<void> userData, u32 extParam)
{
	cellSysutil.Warning("cellMsgDialogOpenErrorCode(errorCode=0x%x, callback_addr=0x%x, userData=%d, extParam=%d)",
		errorCode, callback.GetAddr(), userData, extParam);

	std::string errorMessage;
	switch(errorCode)
	{
	// Generic errors
	case 0x80010001: errorMessage = "The resource is temporarily unavailable."; break;
	case 0x80010002: errorMessage = "Invalid argument or flag."; break;
	case 0x80010003: errorMessage = "The feature is not yet implemented."; break;
	case 0x80010004: errorMessage = "Memory allocation failed."; break;
	case 0x80010005: errorMessage = "The resource with the specified identifier does not exist."; break;
	case 0x80010006: errorMessage = "The file does not exist."; break;
	case 0x80010007: errorMessage = "The file is in unrecognized format / The file is not a valid ELF file."; break;
	case 0x80010008: errorMessage = "Resource deadlock is avoided."; break;
	case 0x80010009: errorMessage = "Operation not permitted."; break;
	case 0x8001000A: errorMessage = "The device or resource is bus."; break;
	case 0x8001000B: errorMessage = "The operation is timed ou."; break;
	case 0x8001000C: errorMessage = "The operation is aborte."; break;
	case 0x8001000D: errorMessage = "Invalid memory access."; break;
	case 0x8001000F: errorMessage = "State of the target thread is invalid."; break;
	case 0x80010010: errorMessage = "Alignment is invalid."; break;
	case 0x80010011: errorMessage = "Shortage of the kernel resources."; break;
	case 0x80010012: errorMessage = "The file is a directory."; break;
	case 0x80010013: errorMessage = "Operation canceled."; break;
	case 0x80010014: errorMessage = "Entry already exists."; break;
	case 0x80010015: errorMessage = "Port is already connected."; break;
	case 0x80010016: errorMessage = "Port is not connected."; break;
	case 0x80010017: errorMessage = "Failure in authorizing SELF. Program authentication fail."; break;
	case 0x80010018: errorMessage = "The file is not MSELF."; break;
	case 0x80010019: errorMessage = "System version error."; break;
	case 0x8001001A: errorMessage = "Fatal system error occurred while authorizing SELF. SELF auth failure."; break;
	case 0x8001001B: errorMessage = "Math domain violation."; break;
	case 0x8001001C: errorMessage = "Math range violation."; break;
	case 0x8001001D: errorMessage = "Illegal multi-byte sequence in input."; break;
	case 0x8001001E: errorMessage = "File position error."; break;
	case 0x8001001F: errorMessage = "Syscall was interrupted."; break;
	case 0x80010020: errorMessage = "File too large."; break;
	case 0x80010021: errorMessage = "Too many links."; break;
	case 0x80010022: errorMessage = "File table overflow."; break;
	case 0x80010023: errorMessage = "No space left on device."; break;
	case 0x80010024: errorMessage = "Not a TTY."; break;
	case 0x80010025: errorMessage = "Broken pipe."; break;
	case 0x80010026: errorMessage = "Read-only filesystem."; break;
	case 0x80010027: errorMessage = "Illegal seek."; break;
	case 0x80010028: errorMessage = "Arg list too long."; break;
	case 0x80010029: errorMessage = "Access violation."; break;
	case 0x8001002A: errorMessage = "Invalid file descriptor."; break;
	case 0x8001002B: errorMessage = "Filesystem mounting failed."; break;
	case 0x8001002C: errorMessage = "Too many files open."; break;
	case 0x8001002D: errorMessage = "No device."; break;
	case 0x8001002E: errorMessage = "Not a directory."; break;
	case 0x8001002F: errorMessage = "No such device or IO."; break;
	case 0x80010030: errorMessage = "Cross-device link error."; break;
	case 0x80010031: errorMessage = "Bad Message."; break;
	case 0x80010032: errorMessage = "In progress."; break;
	case 0x80010033: errorMessage = "Message size error."; break;
	case 0x80010034: errorMessage = "Name too long."; break;
	case 0x80010035: errorMessage = "No lock."; break;
	case 0x80010036: errorMessage = "Not empty."; break;
	case 0x80010037: errorMessage = "Not supported."; break;
	case 0x80010038: errorMessage = "File-system specific error."; break;
	case 0x80010039: errorMessage = "Overflow occured."; break;
	case 0x8001003A: errorMessage = "Filesystem not mounted."; break;
	case 0x8001003B: errorMessage = "Not SData."; break;
	case 0x8001003C: errorMessage = "Incorrect version in sys_load_param."; break;
	case 0x8001003D: errorMessage = "Pointer is null."; break;
	case 0x8001003E: errorMessage = "Pointer is null."; break;
	default: errorMessage = "An error has occurred."; break;
	}

	char errorCodeHex [9];
	sprintf(errorCodeHex, "%08x", errorCode);
	errorMessage.append("\n(");
	errorMessage.append(errorCodeHex);
	errorMessage.append(")\n");

	u64 status;
	int res = wxMessageBox(errorMessage, wxGetApp().GetAppName(), wxICON_ERROR | wxOK);
	switch(res)
	{
	case wxOK: status = CELL_MSGDIALOG_BUTTON_OK; break;
	default:
		if(res)
		{
			status = CELL_MSGDIALOG_BUTTON_INVALID;
			break;
		}

		status = CELL_MSGDIALOG_BUTTON_NONE;
	break;
	}

	if(callback)
		callback(status, userData);

	return CELL_OK;
}
Beispiel #23
0
s32 cellGameBootCheck(vm::ptr<u32> type, vm::ptr<u32> attributes, vm::ptr<CellGameContentSize> size, vm::ptr<char[CELL_GAME_DIRNAME_SIZE]> dirName)
{
	cellGame.Warning("cellGameBootCheck(type=*0x%x, attributes=*0x%x, size=*0x%x, dirName=*0x%x)", type, attributes, size, dirName);

	if (size)
	{
		// TODO: Use the free space of the computer's HDD where RPCS3 is being run.
		size->hddFreeSizeKB = 40000000; // 40 GB

		// TODO: Calculate data size for HG and DG games, if necessary.
		size->sizeKB = CELL_GAME_SIZEKB_NOTCALC;
		size->sysSizeKB = 0;
	}

	vfsFile f("/app_home/../PARAM.SFO");
	const PSFLoader psf(f);

	if (!psf)
	{
		// According to testing (in debug mode) cellGameBootCheck doesn't return an error code, when PARAM.SFO doesn't exist.
		cellGame.Error("cellGameBootCheck(): Cannot read PARAM.SFO.");
	}

	std::string category = psf.GetString("CATEGORY");
	if (category.substr(0, 2) == "DG")
	{
		*type = CELL_GAME_GAMETYPE_DISC;
		*attributes = 0; // TODO
		if (dirName) strcpy_trunc(*dirName, ""); // ???

		if (!fxm::make<content_permission_t>("/dev_bdvd/PS3_GAME", false))
		{
			return CELL_GAME_ERROR_BUSY;
		}
	}
	else if (category.substr(0, 2) == "HG")
	{
		std::string titleId = psf.GetString("TITLE_ID");
		*type = CELL_GAME_GAMETYPE_HDD;
		*attributes = 0; // TODO
		if (dirName) strcpy_trunc(*dirName, titleId); 

		if (!fxm::make<content_permission_t>("/dev_hdd0/game/" + titleId, false))
		{
			return CELL_GAME_ERROR_BUSY;
		}
	}
	else if (category.substr(0, 2) == "GD")
	{
		std::string titleId = psf.GetString("TITLE_ID");
		*type = CELL_GAME_GAMETYPE_DISC;
		*attributes = CELL_GAME_ATTRIBUTE_PATCH; // TODO
		if (dirName) strcpy_trunc(*dirName, titleId); // ???

		if (!fxm::make<content_permission_t>("/dev_bdvd/PS3_GAME", false))
		{
			return CELL_GAME_ERROR_BUSY;
		}
	}
	else if (psf)
	{
		cellGame.Error("cellGameBootCheck(): Unknown CATEGORY.");
	}

	return CELL_GAME_RET_OK;
}
Beispiel #24
0
u32 _sys_net_errno_loc()
{
	sys_net.Warning("_sys_net_errno_loc()");
	return g_lastError.addr();
}
Beispiel #25
0
int cellSysutilGetSystemParamInt(int id, vm::ptr<u32> value)
{
	cellSysutil.Log("cellSysutilGetSystemParamInt(id=0x%x, value_addr=0x%x)", id, value.addr());

	switch(id)
	{
	case CELL_SYSUTIL_SYSTEMPARAM_ID_LANG:
		cellSysutil.Warning("cellSysutilGetSystemParamInt: CELL_SYSUTIL_SYSTEMPARAM_ID_LANG");
		*value = Ini.SysLanguage.GetValue();
	break;

	case CELL_SYSUTIL_SYSTEMPARAM_ID_ENTER_BUTTON_ASSIGN:
		cellSysutil.Warning("cellSysutilGetSystemParamInt: CELL_SYSUTIL_SYSTEMPARAM_ID_ENTER_BUTTON_ASSIGN");
		*value = CELL_SYSUTIL_ENTER_BUTTON_ASSIGN_CROSS;
	break;

	case CELL_SYSUTIL_SYSTEMPARAM_ID_DATE_FORMAT:
		cellSysutil.Warning("cellSysutilGetSystemParamInt: CELL_SYSUTIL_SYSTEMPARAM_ID_DATE_FORMAT");
		*value = CELL_SYSUTIL_DATE_FMT_DDMMYYYY;
	break;

	case CELL_SYSUTIL_SYSTEMPARAM_ID_TIME_FORMAT:
		cellSysutil.Warning("cellSysutilGetSystemParamInt: CELL_SYSUTIL_SYSTEMPARAM_ID_TIME_FORMAT");
		*value = CELL_SYSUTIL_TIME_FMT_CLOCK24;
	break;

	case CELL_SYSUTIL_SYSTEMPARAM_ID_TIMEZONE:
		cellSysutil.Warning("cellSysutilGetSystemParamInt: CELL_SYSUTIL_SYSTEMPARAM_ID_TIMEZONE");
		*value = 3;
	break;

	case CELL_SYSUTIL_SYSTEMPARAM_ID_SUMMERTIME:
		cellSysutil.Warning("cellSysutilGetSystemParamInt: CELL_SYSUTIL_SYSTEMPARAM_ID_SUMMERTIME");
		*value = 1;
	break;

	case CELL_SYSUTIL_SYSTEMPARAM_ID_GAME_PARENTAL_LEVEL:
		cellSysutil.Warning("cellSysutilGetSystemParamInt: CELL_SYSUTIL_SYSTEMPARAM_ID_GAME_PARENTAL_LEVEL");
		*value = CELL_SYSUTIL_GAME_PARENTAL_OFF;
	break;

	case CELL_SYSUTIL_SYSTEMPARAM_ID_GAME_PARENTAL_LEVEL0_RESTRICT:
		cellSysutil.Warning("cellSysutilGetSystemParamInt: CELL_SYSUTIL_SYSTEMPARAM_ID_GAME_PARENTAL_LEVEL0_RESTRICT");
		*value = CELL_SYSUTIL_GAME_PARENTAL_LEVEL0_RESTRICT_OFF;
	break;

	case CELL_SYSUTIL_SYSTEMPARAM_ID_CURRENT_USER_HAS_NP_ACCOUNT:
		cellSysutil.Warning("cellSysutilGetSystemParamInt: CELL_SYSUTIL_SYSTEMPARAM_ID_CURRENT_USER_HAS_NP_ACCOUNT");
		*value = 0;
	break;

	case CELL_SYSUTIL_SYSTEMPARAM_ID_CAMERA_PLFREQ:
		cellSysutil.Warning("cellSysutilGetSystemParamInt: CELL_SYSUTIL_SYSTEMPARAM_ID_CAMERA_PLFREQ");
		*value = CELL_SYSUTIL_CAMERA_PLFREQ_DISABLED;
	break;

	case CELL_SYSUTIL_SYSTEMPARAM_ID_PAD_RUMBLE:
		cellSysutil.Warning("cellSysutilGetSystemParamInt: CELL_SYSUTIL_SYSTEMPARAM_ID_PAD_RUMBLE");
		*value = CELL_SYSUTIL_PAD_RUMBLE_OFF;
	break;

	case CELL_SYSUTIL_SYSTEMPARAM_ID_KEYBOARD_TYPE:
		cellSysutil.Warning("cellSysutilGetSystemParamInt: CELL_SYSUTIL_SYSTEMPARAM_ID_KEYBOARD_TYPE");
		*value = 0;
	break;

	case CELL_SYSUTIL_SYSTEMPARAM_ID_JAPANESE_KEYBOARD_ENTRY_METHOD:
		cellSysutil.Warning("cellSysutilGetSystemParamInt: CELL_SYSUTIL_SYSTEMPARAM_ID_JAPANESE_KEYBOARD_ENTRY_METHOD");
		*value = 0;
	break;

	case CELL_SYSUTIL_SYSTEMPARAM_ID_CHINESE_KEYBOARD_ENTRY_METHOD:
		cellSysutil.Warning("cellSysutilGetSystemParamInt: CELL_SYSUTIL_SYSTEMPARAM_ID_CHINESE_KEYBOARD_ENTRY_METHOD");
		*value = 0;
	break;

	case CELL_SYSUTIL_SYSTEMPARAM_ID_PAD_AUTOOFF:
		cellSysutil.Warning("cellSysutilGetSystemParamInt: CELL_SYSUTIL_SYSTEMPARAM_ID_PAD_AUTOOFF");
		*value = 0;
	break;

	default:
		return CELL_EINVAL;
	}

	return CELL_OK;
}
Beispiel #26
0
s32 jstrchk(vm::cptr<char> jstr)
{
	cellL10n.Warning("jstrchk(jstr=*0x%x) -> utf8", jstr);

	return L10N_STR_UTF8;
}
Beispiel #27
0
s32 sceNpSnsFbTerm()
{
	sceNpSns.Warning("sceNpSnsFbTerm()");

	return CELL_OK;
}
Beispiel #28
0
s32 cellSysmoduleFinalize()
{
	cellSysmodule.Warning("cellSysmoduleFinalize()");
	return CELL_OK;
}
Beispiel #29
0
s32 cellAtracDeleteDecoder(vm::ptr<CellAtracHandle> pHandle)
{
	cellAtrac.Warning("cellAtracDeleteDecoder(pHandle=0x%x)", pHandle.addr());

	return CELL_OK;
}
Beispiel #30
0
s32 cellNetCtlTerm()
{
    cellNetCtl.Warning("cellNetCtlTerm()");

    return CELL_OK;
}