Beispiel #1
0
int cellFsSdataOpen(u32 path_addr, int flags, mem32_t fd, mem32_t arg, u64 size)
{
	const std::string& path = Memory.ReadString(path_addr);
	sys_fs.Warning("cellFsSdataOpen(path=\"%s\", flags=0x%x, fd_addr=0x%x, arg_addr=0x%x, size=0x%llx)",
		path.c_str(), flags, fd.GetAddr(), arg.GetAddr(), size);

	if (!fd.IsGood() || (!arg.IsGood() && size))
		return CELL_EFAULT;

	if (flags != CELL_O_RDONLY)
		return CELL_EINVAL;

	std::string suffix = path.substr(path.length() - 5, 4);
	if (suffix != ".sdat" && suffix != ".SDAT")
		return CELL_ENOTSDATA;

	std::string::size_type last_slash = path.rfind('/'); //TODO: use a filesystem library to solve this more robustly
	last_slash = last_slash == std::string::npos ? 0 : last_slash+1;
	std::string unpacked_path = "/dev_hdd1/"+path.substr(last_slash,path.length()-last_slash)+".unpacked";
	int ret = sdata_unpack(path, unpacked_path);
	if (ret) return ret;

	fd = sys_fs.GetNewId(Emu.GetVFS().OpenFile(unpacked_path, vfsRead), flags);

	return CELL_OK;
}
Beispiel #2
0
int cellGameBootCheck(mem32_t type, mem32_t attributes, mem_ptr_t<CellGameContentSize> size, mem_list_ptr_t<u8> dirName)
{
	cellGame.Warning("cellGameBootCheck(type_addr=0x%x, attributes_addr=0x%x, size_addr=0x%x, dirName_addr=0x%x)",
		type.GetAddr(), attributes.GetAddr(), size.GetAddr(), dirName.GetAddr());

	if (!type.IsGood() || !attributes.IsGood() || !size.IsGood() || !dirName.IsGood())
	{
		cellGame.Warning("cellGameBootCheck returns CELL_GAME_ERROR_PARAM. As a result size->hddFreeSizeKB may be 0.");
		return CELL_GAME_ERROR_PARAM;
	}

	// TODO: Only works for HDD games
	type                = CELL_GAME_GAMETYPE_HDD;
	attributes          = 0;
	size->hddFreeSizeKB = 40000000; //40 GB, TODO: Use the free space of the computer's HDD where RPCS3 is being run.
	size->sizeKB        = CELL_GAME_SIZEKB_NOTCALC;
	size->sysSizeKB     = 0;

	// TODO: Locate the PARAM.SFO. The following path may be wrong.
	vfsFile f("/app_home/PARAM.SFO");
	PSFLoader psf(f);
	if(!psf.Load(false))
		return CELL_GAME_ERROR_FAILURE;
	std::string titleId = psf.GetString("TITLE_ID");

	Memory.WriteString(dirName.GetAddr(), titleId);
	return CELL_OK;
}
Beispiel #3
0
int cellSpursGetSpuThreadId(mem_ptr_t<CellSpurs> spurs, mem32_t thread, mem32_t nThreads)
{
	cellSpurs.Error("cellSpursGetSpuThreadId(spurs_addr=0x%x, thread_addr=0x%x, nThreads_addr=0x%x)", 
		spurs.GetAddr(), thread.GetAddr(), nThreads.GetAddr());
	
	if(!spurs.IsGood() || !thread.IsGood() || nThreads.IsGood())
		return CELL_SPURS_CORE_ERROR_NULL_POINTER;

	return CELL_OK;
}
Beispiel #4
0
//178
s32 sys_spu_thread_group_join(u32 id, mem32_t cause, mem32_t status)
{
	sc_spu.Warning("sys_spu_thread_group_join(id=%d, cause_addr=0x%x, status_addr=0x%x)", id, cause.GetAddr(), status.GetAddr());

	SpuGroupInfo* group_info;
	if(!Emu.GetIdManager().GetIDData(id, group_info))
	{
		return CELL_ESRCH;
	}

	if (cause.GetAddr() && !cause.IsGood())
	{
		return CELL_EFAULT;
	}

	if (status.GetAddr() && !status.IsGood())
	{
		return CELL_EFAULT;
	}

	if (group_info->lock.exchange(1)) // acquire lock
	{
		return CELL_EBUSY;
	}

	if (cause.GetAddr()) cause = SYS_SPU_THREAD_GROUP_JOIN_ALL_THREADS_EXIT;
	if (status.GetAddr()) status = 0; //unspecified because of ALL_THREADS_EXIT

	for (u32 i = 0; i < group_info->list.size(); i++)
	{
		while (CPUThread* t = Emu.GetCPU().GetThread(group_info->list[i]))
		{
			if (!t->IsRunning())
			{
				break;
			}
			if (Emu.IsStopped())
			{
				LOG_WARNING(Log::SPU, "sys_spu_thread_group_join(id=%d, ...) aborted", id);
				return CELL_OK;
			}
			std::this_thread::sleep_for(std::chrono::milliseconds(1));
		}
	}

	group_info->lock = 0; // release lock
	return CELL_OK;
}
Beispiel #5
0
int sceNpTrophyUnlockTrophy(u32 context, u32 handle, s32 trophyId, mem32_t platinumId)
{
	sceNpTrophy.Warning("sceNpTrophyUnlockTrophy(context=%d, handle=%d, trophyId=%d, platinumId_addr=0x%x)",
		context, handle, trophyId, platinumId.GetAddr());
	
	if (!s_npTrophyInstance.m_bInitialized)
		return SCE_NP_TROPHY_ERROR_NOT_INITIALIZED;
	if (!platinumId.IsGood())
		return SCE_NP_TROPHY_ERROR_INVALID_ARGUMENT;
	// TODO: There are other possible errors

	sceNpTrophyInternalContext& ctxt = s_npTrophyInstance.contexts[context];
	if (trophyId >= ctxt.tropusr->GetTrophiesCount())
		return SCE_NP_TROPHY_ERROR_INVALID_TROPHY_ID;
	if (ctxt.tropusr->GetTrophyUnlockState(trophyId))
		return SCE_NP_TROPHY_ERROR_ALREADY_UNLOCKED;

	u64 timestamp1 = get_system_time(); // TODO: Either timestamp1 or timestamp2 is wrong
	u64 timestamp2 = get_system_time(); // TODO: Either timestamp1 or timestamp2 is wrong
	ctxt.tropusr->UnlockTrophy(trophyId, timestamp1, timestamp2);
	std::string trophyPath = "/dev_hdd0/home/00000001/trophy/" + ctxt.trp_name + "/TROPUSR.DAT";
	ctxt.tropusr->Save(trophyPath);

	platinumId = SCE_NP_TROPHY_INVALID_TROPHY_ID; // TODO
	return CELL_OK;
}
Beispiel #6
0
int sceNpTrophyGetTrophyUnlockState(u32 context, u32 handle, mem_ptr_t<SceNpTrophyFlagArray> flags, mem32_t count)
{
	sceNpTrophy.Warning("sceNpTrophyGetTrophyUnlockState(context=%d, handle=%d, flags_addr=0x%x, count_addr=0x%x)",
		context, handle, flags.GetAddr(), count.GetAddr());

	if (!s_npTrophyInstance.m_bInitialized)
		return SCE_NP_TROPHY_ERROR_NOT_INITIALIZED;
	if (!flags.IsGood() || !count.IsGood())
		return SCE_NP_TROPHY_ERROR_INVALID_ARGUMENT;
	// TODO: There are other possible errors

	sceNpTrophyInternalContext& ctxt = s_npTrophyInstance.contexts[context];
	count = ctxt.tropusr->GetTrophiesCount();
	if (count.GetValue() > 128)
		ConLog.Warning("sceNpTrophyGetTrophyUnlockState: More than 128 trophies detected!");

	// Pack up to 128 bools in u32 flag_bits[4]
	for (u32 id=0; id<count.GetValue(); id++)
	{
		if (ctxt.tropusr->GetTrophyUnlockState(id))
			flags->flag_bits[id/32] |= 1<<(id%32);
		else
			flags->flag_bits[id/32] &= ~(1<<(id%32));
	}

	return CELL_OK;
}
Beispiel #7
0
int cellAudioPortOpen(mem_ptr_t<CellAudioPortParam> audioParam, mem32_t portNum)
{
	cellAudio.Warning("cellAudioPortOpen(audioParam_addr=0x%x, portNum_addr=0x%x)", audioParam.GetAddr(), portNum.GetAddr());

	if(!audioParam.IsGood() || !portNum.IsGood())
	{
		return CELL_AUDIO_ERROR_PARAM;
	}

	if (m_config.m_port_in_use >= m_config.m_ports.GetCount())
	{
		return CELL_AUDIO_ERROR_PORT_FULL;
	}

	for (u32 i = 0; i < m_config.m_ports.GetCount(); i++)
	{
		if (m_config.m_ports[i] == nullptr)
		{
			CellAudioPortParam& ref = (m_config.m_ports[i] = new AudioPortConfig)->m_param;
	
			ref.nChannel = audioParam->nChannel;
			ref.nBlock = audioParam->nBlock;
			ref.attr = audioParam->attr;
			ref.level = audioParam->level;

			portNum = i;
			cellAudio.Warning("*** audio port opened(nChannel=%lld, nBlock=0x%llx, attr=0x%llx, level=%f): port = %d",
				(u64)ref.nChannel, (u64)ref.nBlock, (u64)ref.attr, (float)ref.level, portNum.GetValue());
			//TODO: implementation of ring buffer
			return CELL_OK;
		}
	}

	return CELL_AUDIO_ERROR_PORT_FULL;
}
Beispiel #8
0
s32 sys_mmapper_allocate_memory(u32 size, u64 flags, mem32_t mem_id)
{
	sys_mmapper.Warning("sys_mmapper_allocate_memory(size=0x%x, flags=0x%llx, mem_id_addr=0x%x)", size, flags, mem_id.GetAddr());

	if(!mem_id.IsGood())
		return CELL_EFAULT;

	// Check page granularity.
	u32 addr;
	switch(flags & (SYS_MEMORY_PAGE_SIZE_1M | SYS_MEMORY_PAGE_SIZE_64K))
	{
	case SYS_MEMORY_PAGE_SIZE_1M:
		if(size & 0xfffff)
			return CELL_EALIGN;
		addr = Memory.Alloc(size, 0x100000);
	break;

	case SYS_MEMORY_PAGE_SIZE_64K:
		if(size & 0xffff)
			return CELL_EALIGN;
		addr = Memory.Alloc(size, 0x10000);
	break;

	default:
		return CELL_EINVAL;
	}

	if(!addr)
		return CELL_ENOMEM;

	// Generate a new mem ID.
	mem_id = sys_mmapper.GetNewId(new mmapper_info(addr, size, flags));

	return CELL_OK;
}
Beispiel #9
0
s32 sys_raw_spu_create_interrupt_tag(u32 id, u32 class_id, u32 hwthread, mem32_t intrtag)
{
	sc_spu.Error("sys_raw_spu_create_interrupt_tag(id=%d, class_id=%d, hwthread=0x%x, intrtag_addr=0x%x)", id, class_id, hwthread, intrtag.GetAddr());

	RawSPUThread* t = Emu.GetCPU().GetRawSPUThread(id);

	if (!t)
	{
		return CELL_ESRCH;
	}

	if (class_id != 0 && class_id != 2)
	{
		return CELL_EINVAL;
	}

	if (!intrtag.IsGood())
	{
		return CELL_EFAULT;
	}
	
	if (t->m_intrtag[class_id].enabled)
	{
		return CELL_EAGAIN;
	}

	t->m_intrtag[class_id].enabled = 1;
	intrtag = (id & 0xff) | (class_id << 8);

	return CELL_OK;
}
Beispiel #10
0
int cellGameGetParamInt(u32 id, mem32_t value)
{
	cellGame.Warning("cellGameGetParamInt(id=%d, value_addr=0x%x)", id, value.GetAddr());

	if(!value.IsGood())
		return CELL_GAME_ERROR_PARAM;

	// TODO: Locate the PARAM.SFO. The following path is in most cases wrong.
	vfsFile f("/app_home/PARAM.SFO");
	PSFLoader psf(f);
	if(!psf.Load(false))
		return CELL_GAME_ERROR_FAILURE;

	switch(id)
	{
	case CELL_GAME_PARAMID_PARENTAL_LEVEL:	value = psf.m_info.parental_lvl;	break;
	case CELL_GAME_PARAMID_RESOLUTION:		value = psf.m_info.resolution;		break;
	case CELL_GAME_PARAMID_SOUND_FORMAT:	value = psf.m_info.sound_format;	break;

	default:
		return CELL_GAME_ERROR_INVALID_ID;
	}

	return CELL_OK;
}
Beispiel #11
0
int sys_rwlock_create(mem32_t rw_lock_id, mem_ptr_t<sys_rwlock_attribute_t> attr)
{
	sys_rwlock.Warning("sys_rwlock_create(rw_lock_id_addr=0x%x, attr_addr=0x%x)", rw_lock_id.GetAddr(), attr.GetAddr());

	if (!rw_lock_id.IsGood() || !attr.IsGood()) return CELL_EFAULT;

	switch (attr->attr_protocol.ToBE())
	{
	case se(attr->attr_protocol, SYS_SYNC_PRIORITY): sys_rwlock.Warning("TODO: SYS_SYNC_PRIORITY attr"); break;
	case se(attr->attr_protocol, SYS_SYNC_RETRY): sys_rwlock.Error("Invalid SYS_SYNC_RETRY attr"); break;
	case se(attr->attr_protocol, SYS_SYNC_PRIORITY_INHERIT): sys_rwlock.Warning("TODO: SYS_SYNC_PRIORITY_INHERIT attr"); break;
	case se(attr->attr_protocol, SYS_SYNC_FIFO): break;
	default: return CELL_EINVAL;
	}

	if (attr->attr_pshared.ToBE() != se32(0x200))
	{
		sys_rwlock.Error("Invalid attr_pshared(0x%x)", (u32)attr->attr_pshared);
		return CELL_EINVAL;
	}

	rw_lock_id = sys_rwlock.GetNewId(new RWLock((u32)attr->attr_protocol, attr->name_u64));

	sys_rwlock.Warning("*** rwlock created [%s] (protocol=0x%x): id = %d", 
		wxString(attr->name, 8).wx_str(), (u32)attr->attr_protocol, rw_lock_id.GetValue());

	return CELL_OK;
}
Beispiel #12
0
int cellGameGetParamInt(u32 id, mem32_t value)
{
	cellGame.Warning("cellGameGetParamInt(id=%d, value_addr=0x%x)", id, value.GetAddr());

	if(!value.IsGood())
		return CELL_GAME_ERROR_PARAM;

	// TODO: Locate the PARAM.SFO. The following path may be wrong.
	vfsFile f("/app_home/PARAM.SFO");
	PSFLoader psf(f);
	if(!psf.Load(false))
		return CELL_GAME_ERROR_FAILURE;

	switch(id)
	{
	case CELL_GAME_PARAMID_PARENTAL_LEVEL:  value = psf.GetInteger("PARENTAL_LEVEL"); break;
	case CELL_GAME_PARAMID_RESOLUTION:      value = psf.GetInteger("RESOLUTION");     break;
	case CELL_GAME_PARAMID_SOUND_FORMAT:    value = psf.GetInteger("SOUND_FORMAT");   break;

	default:
		return CELL_GAME_ERROR_INVALID_ID;
	}

	return CELL_OK;
}
Beispiel #13
0
int sys_cond_create(mem32_t cond_id, u32 mutex_id, mem_ptr_t<sys_cond_attribute> attr)
{
	sys_cond.Log("sys_cond_create(cond_id_addr=0x%x, mutex_id=%d, attr_addr=0x%x)",
		cond_id.GetAddr(), mutex_id, attr.GetAddr());

	if (!cond_id.IsGood() || !attr.IsGood())
	{
		return CELL_EFAULT;
	}

	if (attr->pshared.ToBE() != se32(0x200))
	{
		sys_cond.Error("Invalid pshared attribute(0x%x)", (u32)attr->pshared);
		return CELL_EINVAL;
	}

	Mutex* mutex;
	if (!Emu.GetIdManager().GetIDData(mutex_id, mutex))
	{
		return CELL_ESRCH;
	}

	if (mutex->is_recursive)
	{
		sys_cond.Warning("*** condition on recursive mutex(%d)", mutex_id);
	}

	Cond* cond = new Cond(mutex, attr->name_u64);
	u32 id = sys_cond.GetNewId(cond);
	cond_id = id;
	mutex->cond_count++;
	sys_cond.Warning("*** condition created [%s] (mutex_id=%d): id = %d", wxString(attr->name, 8).wx_str(), mutex_id, cond_id.GetValue());

	return CELL_OK;
}
Beispiel #14
0
int cellFsAioRead(mem_ptr_t<CellFsAio> aio, mem32_t aio_id, mem_func_ptr_t<void (*)(mem_ptr_t<CellFsAio> xaio, int error, int xid, u64 size)> func)
{
	sys_fs.Warning("cellFsAioRead(aio_addr=0x%x, id_addr=0x%x, func_addr=0x%x)", aio.GetAddr(), aio_id.GetAddr(), func.GetAddr());

	if (!aio.IsGood() || !aio_id.IsGood() || !func.IsGood())
	{
		return CELL_EFAULT;
	}

	if (!aio_init)
	{
		return CELL_ENXIO;
	}

	vfsFileBase* orig_file;
	u32 fd = aio->fd;
	if (!sys_fs.CheckId(fd, orig_file)) return CELL_EBADF;

	//get a unique id for the callback (may be used by cellFsAioCancel)
	const u32 xid = g_FsAioReadID++;
	aio_id = xid;

	{
		thread t("fsAioRead", std::bind(fsAioRead, fd, aio, xid, func));
		t.detach();
	}

	return CELL_OK;
}
Beispiel #15
0
int sys_process_get_number_of_object(u32 object, mem32_t nump)
{
	sc_p.Warning("sys_process_get_number_of_object(object=%d, nump_addr=0x%x)",
		object, nump.GetAddr());
	
	if (!nump.IsGood())
		return CELL_EFAULT;

	switch(object)
	{
	case SYS_MEM_OBJECT:                  nump = procObjects.mem_objects.size();                 break;
	case SYS_MUTEX_OBJECT:                nump = procObjects.mutex_objects.size();               break;
	case SYS_COND_OBJECT:                 nump = procObjects.cond_objects.size();                break;
	case SYS_RWLOCK_OBJECT:               nump = procObjects.rwlock_objects.size();              break;
	case SYS_INTR_TAG_OBJECT:             nump = procObjects.intr_tag_objects.size();            break;
	case SYS_INTR_SERVICE_HANDLE_OBJECT:  nump = procObjects.intr_service_handle_objects.size(); break;
	case SYS_EVENT_QUEUE_OBJECT:          nump = procObjects.event_queue_objects.size();         break;
	case SYS_EVENT_PORT_OBJECT:           nump = procObjects.event_port_objects.size();          break;
	case SYS_TRACE_OBJECT:                nump = procObjects.trace_objects.size();               break;
	case SYS_SPUIMAGE_OBJECT:             nump = procObjects.spuimage_objects.size();            break;
	case SYS_PRX_OBJECT:                  nump = procObjects.prx_objects.size();                 break;
	case SYS_SPUPORT_OBJECT:              nump = procObjects.spuport_objects.size();             break;
	case SYS_LWMUTEX_OBJECT:              nump = procObjects.lwmutex_objects.size();             break;
	case SYS_TIMER_OBJECT:                nump = procObjects.timer_objects.size();               break;
	case SYS_SEMAPHORE_OBJECT:            nump = procObjects.semaphore_objects.size();           break;
	case SYS_FS_FD_OBJECT:                nump = procObjects.fs_fd_objects.size();               break;
	case SYS_LWCOND_OBJECT:               nump = procObjects.lwcond_objects.size();              break;

	default:      
		return CELL_EINVAL;
	}

	return CELL_OK;
}
Beispiel #16
0
int cellJpgDecOpen(u32 mainHandle, mem32_t subHandle, mem_ptr_t<CellJpgDecSrc> src, mem_ptr_t<CellJpgDecOpnInfo> openInfo)
{
	cellJpgDec.Warning("cellJpgDecOpen(mainHandle=0x%x, subHandle=0x%x, src_addr=0x%x, openInfo=0x%x)",
		mainHandle, subHandle.GetAddr(), src.GetAddr(), openInfo);

	if (!subHandle.IsGood() || !src.IsGood() || !openInfo.IsGood())
		return CELL_JPGDEC_ERROR_ARG;

	CellJpgDecSubHandle *current_subHandle = new CellJpgDecSubHandle;

	// Get file descriptor
	MemoryAllocator<be_t<u32>> fd;
	int ret = cellFsOpen(src->fileName, 0, fd, NULL, 0);
	current_subHandle->fd = fd->ToLE();
	if(ret != CELL_OK) return CELL_JPGDEC_ERROR_OPEN_FILE;

	// Get size of file
	MemoryAllocator<CellFsStat> sb; // Alloc a CellFsStat struct
	ret = cellFsFstat(current_subHandle->fd, sb.GetAddr());
	if(ret != CELL_OK) return ret;
	current_subHandle->fileSize = sb->st_size;	// Get CellFsStat.st_size

	// From now, every u32 subHandle argument is a pointer to a CellPngDecSubHandle struct.
	subHandle = cellJpgDec.GetNewId(current_subHandle);

	return CELL_OK;
}
Beispiel #17
0
//165
s32 sys_spu_thread_get_exit_status(u32 id, mem32_t status)
{
	sc_spu.Warning("sys_spu_thread_get_exit_status(id=%d, status_addr=0x%x)", id, status.GetAddr());

	if (!status.IsGood())
	{
		return CELL_EFAULT;
	}

	CPUThread* thr = Emu.GetCPU().GetThread(id);

	if(!thr || (thr->GetType() != CPU_THREAD_SPU && thr->GetType() != CPU_THREAD_RAW_SPU))
	{
		return CELL_ESRCH;
	}

	u32 res;
	if (!(*(SPUThread*)thr).SPU.Out_MBox.Pop(res) || !thr->IsStopped())
	{
		return CELL_ESTAT;
	}

	status = res;
	return CELL_OK;
}
Beispiel #18
0
//172
int sys_spu_thread_initialize(mem32_t thread, u32 group, u32 spu_num, mem_ptr_t<sys_spu_image> img, mem_ptr_t<sys_spu_thread_attribute> attr, mem_ptr_t<sys_spu_thread_argument> arg)
{
	sc_spu.Warning("sys_spu_thread_initialize(thread_addr=0x%x, group=0x%x, spu_num=%d, img_addr=0x%x, attr_addr=0x%x, arg_addr=0x%x)",
		thread.GetAddr(), group, spu_num, img.GetAddr(), attr.GetAddr(), arg.GetAddr());

	SpuGroupInfo* group_info;
	if(!Emu.GetIdManager().GetIDData(group, group_info))
	{
		return CELL_ESRCH;
	}

	if(!thread.IsGood() || !img.IsGood() || !attr.IsGood() || !arg.IsGood())
	{
		return CELL_EFAULT;
	}

	if(!Memory.IsGoodAddr(attr->name_addr, attr->name_len))
	{
		return CELL_EFAULT;
	}

	if(spu_num >= g_spu_group_thr_max)
	{
		return CELL_EINVAL;
	}
	
	if(group_info->list[spu_num])
	{
		return CELL_EBUSY;
	}

	u32 spu_ep = (u32)img->entry_point;
	std::string name = Memory.ReadString(attr->name_addr, attr->name_len).ToStdString();
	u64 a1 = arg->arg1;
	u64 a2 = arg->arg2;
	u64 a3 = arg->arg3;
	u64 a4 = arg->arg4;

	CPUThread& new_thread = Emu.GetCPU().AddThread(CPU_THREAD_SPU);
	//copy SPU image:
	u32 spu_offset = Memory.MainMem.AllocAlign(256 * 1024);
	memcpy(Memory + spu_offset, Memory + (u32)img->segs_addr, 256 * 1024);
	//initialize from new place:
	new_thread.SetOffset(spu_offset);
	new_thread.SetEntry(spu_ep);
	new_thread.SetName(name);
	new_thread.SetArg(0, a1);
	new_thread.SetArg(1, a2);
	new_thread.SetArg(2, a3);
	new_thread.SetArg(3, a4);
	new_thread.Run();

	thread = group_info->list[spu_num] = new_thread.GetId();

	sc_spu.Warning("*** New SPU Thread [%s] (img_offset=0x%x, ls_offset=0x%x, ep=0x%x, a1=0x%llx, a2=0x%llx, a3=0x%llx, a4=0x%llx): id=%d",
		wxString(name).wx_str(), (u32)img->segs_addr, ((SPUThread&)new_thread).dmac.ls_offset, spu_ep, a1, a2, a3, a4, thread.GetValue());

	return CELL_OK;
}
Beispiel #19
0
int cellGameBootCheck(mem32_t type, mem32_t attributes, mem_ptr_t<CellGameContentSize> size, mem_list_ptr_t<u8> dirName)
{
	cellGame.Warning("cellGameBootCheck(type_addr=0x%x, attributes_addr=0x%x, size_addr=0x%x, dirName_addr=0x%x)",
		type.GetAddr(), attributes.GetAddr(), size.GetAddr(), dirName.GetAddr());

	if (!type.IsGood() || !attributes.IsGood() || !size.IsGood() || !dirName.IsGood())
		return CELL_GAME_ERROR_PARAM;
	
	type				= CELL_GAME_GAMETYPE_DISC;
	attributes			= 0;
	size->hddFreeSizeKB = 40000000; //40 GB, TODO: Use the free space of the computer's HDD where RPCS3 is being run.
	size->sizeKB		= CELL_GAME_SIZEKB_NOTCALC;
	size->sysSizeKB		= 0;
	//TODO: dirName

	return CELL_OK;
}
Beispiel #20
0
int cellFsOpendir(u32 path_addr, mem32_t fd)
{
	const wxString& path = Memory.ReadString(path_addr);
	sys_fs.Error("cellFsOpendir(path_addr: 0x%x(%s), fd_addr: 0x%x)", path_addr, path.mb_str(), fd.GetAddr());
	if(!Memory.IsGoodAddr(path_addr) || !fd.IsGood()) return CELL_EFAULT;

	return CELL_OK;
}
Beispiel #21
0
int cellSpursGetSpuThreadId(mem_ptr_t<CellSpurs> spurs, mem32_t thread, mem32_t nThreads)
{
	cellSpurs->Todo("cellSpursGetSpuThreadId(spurs_addr=0x%x, thread_addr=0x%x, nThreads_addr=0x%x)", spurs.GetAddr(), thread.GetAddr(), nThreads.GetAddr());

	if (spurs.GetAddr() % 128 != 0)
	{
		cellSpurs->Error("cellSpursGetSpuThreadId : CELL_SPURS_CORE_ERROR_ALIGN");
		return CELL_SPURS_CORE_ERROR_ALIGN;
	}

	if (!spurs.IsGood() || !thread.IsGood() || nThreads.IsGood())
	{
		cellSpurs->Error("cellSpursGetSpuThreadId : CELL_SPURS_CORE_ERROR_NULL_POINTER");
		return CELL_SPURS_CORE_ERROR_NULL_POINTER;
	}

	return CELL_OK;
}
Beispiel #22
0
int cellUserInfoGetList(mem32_t listNum, mem_ptr_t<CellUserInfoUserList> listBuf, mem32_t currentUserId)
{
	cellUserInfo.Warning("cellUserInfoGetList(listNum_addr=0x%x, listBuf_addr=0x%x, currentUserId_addr=0x%x)",
		listNum.GetAddr(), listBuf.GetAddr(), currentUserId.GetAddr());

	// If only listNum is NULL, an should will be returned
	if (listBuf.IsGood() && !listNum.IsGood())
		return CELL_USERINFO_ERROR_PARAM;
	if (listNum.IsGood())
		listNum = 1;
	if (listBuf.IsGood())
		listBuf->userId[0] = 1;

	if (currentUserId.IsGood())
		currentUserId = 1;
	
	return CELL_OK;
}
Beispiel #23
0
int cellSpursGetTasksetId(mem_ptr_t<CellSpursTaskset> taskset, mem32_t workloadId)
{
	cellSpurs.Error("cellSpursGetTasksetId(taskset_addr=0x%x, workloadId_addr=0x%x)", taskset.GetAddr(), workloadId.GetAddr());
	
	if(!taskset.IsGood() || !workloadId.IsGood())
		return CELL_SPURS_TASK_ERROR_NULL_POINTER;

	return CELL_OK;
}
Beispiel #24
0
int sys_process_get_sdk_version(u32 pid, mem32_t version)
{
	sc_p.Warning("sys_process_get_sdk_version(pid=%d, version_addr=0x%x)", pid, version.GetAddr());

	if (!version.IsGood())
		return CELL_EFAULT;

	version = 0x360001; // TODO
	return CELL_OK;
}
Beispiel #25
0
int cellNetCtlGetState(mem32_t state)
{
	cellNetCtl->Log("cellNetCtlGetState(state_addr=0x%x)", state.GetAddr());

	if (!state.IsGood())
		return CELL_NET_CTL_ERROR_INVALID_ADDR;

	state = CELL_NET_CTL_STATE_Disconnected; // TODO: Allow other states
	return CELL_OK;
}
Beispiel #26
0
int cellFontGetEffectSlant(mem_ptr_t<CellFont> font, mem32_t slantParam)
{
	cellFont.Warning("cellFontSetEffectSlant(font_addr=0x%x, slantParam_addr=0x%x)", font.GetAddr(), slantParam.GetAddr());

	if (!font.IsGood() || !slantParam.IsGood())
		return CELL_FONT_ERROR_INVALID_PARAMETER;

	slantParam = font->slant;
	return CELL_FONT_OK;
}
Beispiel #27
0
int cellFontGetFontIdCode(mem_ptr_t<CellFont> font, u32 code, mem32_t fontId, mem32_t fontCode)
{
	cellFont.Warning("cellFontGetFontIdCode(font_addr=0x%x, code=0x%x, fontId_addr=0x%x, fontCode_addr=0x%x",
		font.GetAddr(), code, fontId.GetAddr(), fontCode.GetAddr());

	if (!font.IsGood() || !fontId.IsGood()) //fontCode isn't used
		return CELL_FONT_ERROR_INVALID_PARAMETER;

	return CELL_FONT_OK;
}
Beispiel #28
0
int cellFontGetEffectSlant(mem_ptr_t<CellFont> font, mem32_t slantParam)
{
	cellFont->Warning("cellFontSetEffectSlant(font_addr=0x%x, slantParam_addr=0x%x)", font.GetAddr(), slantParam.GetAddr());

	if (!font.IsGood() || !slantParam.IsGood())
		return CELL_FONT_ERROR_INVALID_PARAMETER;

	slantParam = font->slant; //Does this conversion from be_t<float> to *mem32_t work?
	return CELL_FONT_OK;
}
Beispiel #29
0
int cellSpursGetSpuThreadGroupId(mem_ptr_t<CellSpurs> spurs, mem32_t group)
{
	cellSpurs.Error("cellSpursGetSpuThreadGroupId(spurs_addr=0x%x, group_addr=0x%x)", 
		spurs.GetAddr(), group.GetAddr());

	if(!spurs.IsGood() || group.IsGood())
		return CELL_SPURS_CORE_ERROR_NULL_POINTER;

	return CELL_OK;
}
Beispiel #30
0
int cellFsStReadGetCurrentAddr(u32 fd, mem32_t addr_addr, mem64_t size)
{
	sys_fs.Warning("TODO: cellFsStReadGetCurrentAddr(fd=%d, addr_addr=0x%x, size_addr = 0x%x)", fd, addr_addr.GetAddr(), size.GetAddr());

	vfsStream* file;
	if(!sys_fs.CheckId(fd, file)) return CELL_ESRCH;

	if (!addr_addr.IsGood() && !size.IsGood()) return CELL_EFAULT;
	
	return CELL_OK;
}