Beispiel #1
0
	s32 send(s32 s, vm::ptr<const char> buf, u32 len, s32 flags)
	{
		sys_net.Warning("send(s=%d, buf_addr=0x%x, len=%d, flags=0x%x)", s, buf.addr(), len, flags);

		int ret = ::send(s, buf.get_ptr(), len, flags);
		*g_lastError = getLastError();
		return ret;
	}
Beispiel #2
0
int cellFontOpenFontFile(vm::ptr<CellFontLibrary> library, vm::ptr<const char> fontPath, u32 subNum, s32 uniqueId, vm::ptr<CellFont> font)
{
	std::string fp(fontPath.get_ptr());
	cellFont->Warning("cellFontOpenFontFile(library_addr=0x%x, fontPath=\"%s\", subNum=%d, uniqueId=%d, font_addr=0x%x)",
		library.addr(), fp.c_str(), subNum, uniqueId, font.addr());

	vfsFile f(fp);
	if (!f.IsOpened())
		return CELL_FONT_ERROR_FONT_OPEN_FAILED;

	u32 fileSize = (u32)f.GetSize();
	u32 bufferAddr = (u32)Memory.Alloc(fileSize, 1); // Freed in cellFontCloseFont
	f.Read(vm::get_ptr<void>(bufferAddr), fileSize);
	int ret = cellFontOpenFontMemory(library, bufferAddr, fileSize, subNum, uniqueId, font);
	font->origin = CELL_FONT_OPEN_FONT_FILE;
	return ret;
}
Beispiel #3
0
int cellFontSetScalePixel(vm::ptr<CellFont> font, float w, float h)
{
	cellFont->Log("cellFontSetScalePixel(font_addr=0x%x, w=%f, h=%f)", font.addr(), w, h);

	font->scale_x = w;
	font->scale_y = h;
	return CELL_FONT_OK;
}
Beispiel #4
0
s32 _sys_printf(vm::ptr<const char> fmt)
{
	sysPrxForUser->Todo("_sys_printf(fmt_addr=0x%x, ...)", fmt.addr());

	// probably, assertion failed
	sysPrxForUser->Warning("_sys_printf: \n%s", fmt.get_ptr());
	return CELL_OK;
}
Beispiel #5
0
s32 sys_tty_read(s32 ch, vm::ptr<void> buf, u32 len, vm::ptr<u32> preadlen)
{
	sys_tty.Error("sys_tty_read(ch=%d, buf_addr=0x%x, len=%d, preadlen_addr=0x%x)", ch, buf.addr(), len, preadlen.addr());

	// We currently do not support reading from the Console
	*preadlen = 0;
	Emu.Pause();
	return CELL_OK;
}
Beispiel #6
0
s32 cellSailDescriptorIsAutoSelection(vm::ptr<CellSailDescriptor> pSelf)
{
	cellSail.Warning("cellSailDescriptorIsAutoSelection(pSelf_addr=0x%x)", pSelf.addr());
	
	if (pSelf)
		return pSelf->autoSelection;

	return CELL_OK;
}
Beispiel #7
0
s32 cellSailPlayerDestroyDescriptor(vm::ptr<CellSailPlayer> pSelf, vm::ptr<CellSailDescriptor> pDesc)
{
	cellSail.Todo("cellSailPlayerAddDescriptor(pSelf_addr=0x%x, pDesc_addr=0x%x)", pSelf.addr(), pDesc.addr());

	if (pDesc->registered)
		return CELL_SAIL_ERROR_INVALID_STATE;

	return CELL_OK;
}
void sys_spinlock_unlock(vm::ptr<atomic_be_t<u32>> lock)
{
	sysPrxForUser.Log("sys_spinlock_unlock(lock=*0x%x)", lock);

	// prx: sync and set 0
	lock->exchange(be_t<u32>::make(0));

	g_sys_spinlock_wm.notify(lock.addr());
}
Beispiel #9
0
int cellNetCtlNetStartDialogLoadAsync(vm::ptr<CellNetCtlNetStartDialogParam> param)
{
	cellNetCtl.Warning("cellNetCtlNetStartDialogLoadAsync(param_addr=0x%x)", param.addr());

	// TODO: Actually sign into PSN
	sysutilSendSystemCommand(CELL_SYSUTIL_NET_CTL_NETSTART_FINISHED, 0);

	return CELL_OK;
}
Beispiel #10
0
int cellWebBrowserEstimate2(const vm::ptr<const CellWebBrowserConfig2> config, vm::ptr<u32> memSize)
{
	cellSysutil.Warning("cellWebBrowserEstimate2(config_addr=0x%x, memSize_addr=0x%x)", config.addr(), memSize.addr());

	// TODO: When cellWebBrowser stuff is implemented, change this to some real
	// needed memory buffer size.
	*memSize = 1 * 1024 * 1024; // 1 MB
	return CELL_OK;
}
Beispiel #11
0
int cellFontOpenFontMemory(vm::ptr<CellFontLibrary> library, u32 fontAddr, u32 fontSize, u32 subNum, u32 uniqueId, vm::ptr<CellFont> font)
{
	cellFont->Warning("cellFontOpenFontMemory(library_addr=0x%x, fontAddr=0x%x, fontSize=%d, subNum=%d, uniqueId=%d, font_addr=0x%x)",
		library.addr(), fontAddr, fontSize, subNum, uniqueId, font.addr());

	if (!s_fontInternalInstance->m_bInitialized)
		return CELL_FONT_ERROR_UNINITIALIZED;

	font->stbfont = (stbtt_fontinfo*)((u8*)&(font->stbfont) + sizeof(void*)); // hack: use next bytes of the struct

	if (!stbtt_InitFont(font->stbfont, (unsigned char*)Memory.VirtualToRealAddr(fontAddr), 0))
		return CELL_FONT_ERROR_FONT_OPEN_FAILED;

	font->renderer_addr = 0;
	font->fontdata_addr = fontAddr;
	font->origin = CELL_FONT_OPEN_MEMORY;
	return CELL_FONT_OK;
}
Beispiel #12
0
s32 sys_memory_get_user_memory_size(vm::ptr<sys_memory_info_t> mem_info)
{
	sys_memory.Warning("sys_memory_get_user_memory_size(mem_info_addr=0x%x)", mem_info.addr());
	
	// Fetch the user memory available.
	mem_info->total_user_memory = Memory.GetUserMemTotalSize();
	mem_info->available_user_memory = Memory.GetUserMemAvailSize();
	return CELL_OK;
}
Beispiel #13
0
int cellFontInit(vm::ptr<CellFontConfig> config)
{
	cellFont->Log("cellFontInit(config=0x%x)", config.addr());

	vm::var<be_t<u64>> revisionFlags;
	revisionFlags.value() = 0;
	cellFontGetRevisionFlags(revisionFlags);
	return cellFontInitializeWithRevision(revisionFlags.value(), config);
}
Beispiel #14
0
int cellSysutilDisableBgmPlaybackEx(vm::ptr<CellSysutilBgmPlaybackExtraParam> param)
{
	cellSysutil.Warning("cellSysutilDisableBgmPlaybackEx(param_addr=0x%x)", param.addr());

	// TODO
	bgm_playback_enabled = false;

	return CELL_OK;
}
Beispiel #15
0
int cellFontSetEffectSlant(vm::ptr<CellFont> font, float slantParam)
{
	cellFont->Log("cellFontSetEffectSlant(font_addr=0x%x, slantParam=%f)", font.addr(), slantParam);

	if (slantParam < -1.0 || slantParam > 1.0)
		return CELL_FONT_ERROR_INVALID_PARAMETER;

	font->slant = slantParam;
	return CELL_FONT_OK;
}
Beispiel #16
0
int cellFontSetupRenderScalePixel(vm::ptr<CellFont> font, float w, float h)
{
	cellFont->Log("cellFontSetupRenderScalePixel(font_addr=0x%x, w=%f, h=%f)", font.addr(), w, h);

	if (!font->renderer_addr)
		return CELL_FONT_ERROR_RENDERER_UNBIND;

	// TODO: ?
	return CELL_FONT_OK;
}
Beispiel #17
0
int cellFontUnbindRenderer(vm::ptr<CellFont> font)
{
	cellFont->Warning("cellFontBindRenderer(font_addr=0x%x)", font.addr());
	
	if (!font->renderer_addr)
		return CELL_FONT_ERROR_RENDERER_UNBIND;

	font->renderer_addr = 0;
	return CELL_FONT_OK;
}
Beispiel #18
0
s64 cellSpursAttributeEnableSystemWorkload(vm::ptr<CellSpursAttribute> attr, vm::ptr<const u8> priority, u32 maxSpu, vm::ptr<const bool> isPreemptible)
{
	cellSpurs->Warning("cellSpursAttributeEnableSystemWorkload(attr_addr=0x%x, priority_addr=0x%x, maxSpu=%d, isPreemptible_addr=0x%x)",
		attr.addr(), priority.addr(), maxSpu, isPreemptible.addr());

#ifdef PRX_DEBUG
	return GetCurrentPPUThread().FastCall2(libsre + 0xF410, libsre_rtoc);
#else
	for (s32 i = 0; i < CELL_SPURS_MAX_SPU; i++)
	{
		if (priority[i] != 1 || maxSpu == 0)
		{
			cellSpurs->Error("cellSpursAttributeEnableSystemWorkload : CELL_SPURS_CORE_ERROR_INVAL");
			return CELL_SPURS_CORE_ERROR_INVAL;
		}
	}
	return CELL_OK;
#endif
}
Beispiel #19
0
int cellSysutilGetBgmPlaybackStatus2(vm::ptr<CellSysutilBgmPlaybackStatus2> status2)
{
	cellSysutil.Log("cellSysutilGetBgmPlaybackStatus2(status2_addr=0x%x)", status2.addr());

	// TODO
	status2->playerState = CELL_SYSUTIL_BGMPLAYBACK_STATUS_STOP;
	memset(status2->reserved, 0, sizeof(status2->reserved));

	return CELL_OK;
}
Beispiel #20
0
s64 cellSpursShutdownTaskset(vm::ptr<CellSpursTaskset> taskset)
{
#ifdef PRX_DEBUG
	cellSpurs->Warning("cellSpursShutdownTaskset(taskset_addr=0x%x)", taskset.addr());
	return GetCurrentPPUThread().FastCall2(libsre + 0x14868, libsre_rtoc);
#else
	UNIMPLEMENTED_FUNC(cellSpurs);
	return CELL_OK;
#endif
}
Beispiel #21
0
s64 cellSpursEventFlagSet(vm::ptr<CellSpursEventFlag> eventFlag, u16 bits)
{
#ifdef PRX_DEBUG
	cellSpurs->Warning("cellSpursEventFlagSet(eventFlag_addr=0x%x, bits=0x%x)", eventFlag.addr(), bits);
	return GetCurrentPPUThread().FastCall2(libsre + 0x15F04, libsre_rtoc);
#else
	UNIMPLEMENTED_FUNC(cellSpurs);
	return CELL_OK;
#endif
}
Beispiel #22
0
s64 cellSpursEventFlagDetachLv2EventQueue(vm::ptr<CellSpursEventFlag> eventFlag)
{
#ifdef PRX_DEBUG
	cellSpurs->Warning("cellSpursEventFlagDetachLv2EventQueue(eventFlag_addr=0x%x)", eventFlag.addr());
	return GetCurrentPPUThread().FastCall2(libsre + 0x15998, libsre_rtoc);
#else
	UNIMPLEMENTED_FUNC(cellSpurs);
	return CELL_OK;
#endif
}
Beispiel #23
0
s64 cellSpursUnsetGlobalExceptionEventHandler(vm::ptr<CellSpurs> spurs)
{
#ifdef PRX_DEBUG
	cellSpurs->Warning("cellSpursUnsetGlobalExceptionEventHandler(spurs_addr=0x%x)", spurs.addr());
	return GetCurrentPPUThread().FastCall2(libsre + 0xD674, libsre_rtoc);
#else
	UNIMPLEMENTED_FUNC(cellSpurs);
	return CELL_OK;
#endif
}
Beispiel #24
0
s64 cellSpursDetachLv2EventQueue(vm::ptr<CellSpurs> spurs, u8 port)
{
#ifdef PRX_DEBUG
	cellSpurs->Warning("cellSpursDetachLv2EventQueue(spurs_addr=0x%x, port=0x%x)", spurs.addr(), port);
	return GetCurrentPPUThread().FastCall2(libsre + 0xB144, libsre_rtoc);
#else
	UNIMPLEMENTED_FUNC(cellSpurs);
	return CELL_OK;
#endif
}
Beispiel #25
0
s64 cellSpursGetNumSpuThread(vm::ptr<CellSpurs> spurs, vm::ptr<be_t<u32>> nThreads)
{
#ifdef PRX_DEBUG
	cellSpurs->Warning("cellSpursGetNumSpuThread(spurs_addr=0x%x, nThreads_addr=0x%x)", spurs.addr(), nThreads.addr());
	return GetCurrentPPUThread().FastCall2(libsre + 0x8B78, libsre_rtoc);
#else
	UNIMPLEMENTED_FUNC(cellSpurs);
	return CELL_OK;
#endif
}
Beispiel #26
0
s32 sys_net_finalize_network()
{
	sys_net.Warning("sys_net_initialize_network_ex()");
	Memory.Free(g_lastError.addr());
	g_lastError = vm::null;
#ifdef _WIN32
	WSACleanup();
#endif
	return CELL_OK;
}
Beispiel #27
0
s64 _cellSpursSendSignal(vm::ptr<CellSpursTaskset> taskset, u32 taskID)
{
#ifdef PRX_DEBUG
	cellSpurs->Warning("_cellSpursSendSignal(taskset_addr=0x%x, taskID=%d)", taskset.addr(), taskID);
	return GetCurrentPPUThread().FastCall2(libsre + 0x124CC, libsre_rtoc);
#else
	UNIMPLEMENTED_FUNC(cellSpurs);
	return CELL_OK;
#endif
}
Beispiel #28
0
void cellFontRenderSurfaceSetScissor(vm::ptr<CellFontRenderSurface> surface, s32 x0, s32 y0, s32 w, s32 h)
{
	cellFont->Warning("cellFontRenderSurfaceSetScissor(surface_addr=0x%x, x0=%d, y0=%d, w=%d, h=%d)",
		surface.addr(), x0, y0, w, h);

	surface->Scissor.x0 = x0;
	surface->Scissor.y0 = y0;
	surface->Scissor.x1 = w;
	surface->Scissor.y1 = h;
}
Beispiel #29
0
s64 cellSpursGetInfo(vm::ptr<CellSpurs> spurs, vm::ptr<CellSpursInfo> info)
{
#ifdef PRX_DEBUG
	cellSpurs->Warning("cellSpursGetInfo(spurs_addr=0x%x, info_addr=0x%x)", spurs.addr(), info.addr());
	return GetCurrentPPUThread().FastCall2(libsre + 0xE540, libsre_rtoc);
#else
	UNIMPLEMENTED_FUNC(cellSpurs);
	return CELL_OK;
#endif
}
Beispiel #30
0
s64 cellSpursAttributeEnableSpuPrintfIfAvailable(vm::ptr<CellSpursAttribute> attr)
{
#ifdef PRX_DEBUG
	cellSpurs->Warning("cellSpursAttributeEnableSpuPrintfIfAvailable(attr_addr=0x%x)", attr.addr());
	return GetCurrentPPUThread().FastCall2(libsre + 0x7150, libsre_rtoc);
#else
	UNIMPLEMENTED_FUNC(cellSpurs);
	return CELL_OK;
#endif
}