diff --git a/rpcs3/Emu/SysCalls/Modules/sysPrxForUser.cpp b/rpcs3/Emu/SysCalls/Modules/sysPrxForUser.cpp index 424b0139e1..52a1d66755 100644 --- a/rpcs3/Emu/SysCalls/Modules/sysPrxForUser.cpp +++ b/rpcs3/Emu/SysCalls/Modules/sysPrxForUser.cpp @@ -13,31 +13,31 @@ void sys_initialize_tls() s64 sys_process_atexitspawn() { sysPrxForUser.Log("sys_process_atexitspawn()"); - return 0; + return CELL_OK; } s64 sys_process_at_Exitspawn() { sysPrxForUser.Log("sys_process_at_Exitspawn"); - return 0; + return CELL_OK; } int sys_spu_printf_initialize(int a1, int a2, int a3, int a4, int a5) { sysPrxForUser.Warning("sys_spu_printf_initialize(0x%x, 0x%x, 0x%x, 0x%x, 0x%x)", a1, a2, a3, a4, a5); - return 0; + return CELL_OK; } s64 sys_prx_register_library(u32 lib_addr) { sysPrxForUser.Error("sys_prx_register_library(lib_addr=0x%x)", lib_addr); - return 0; + return CELL_OK; } s64 sys_prx_exitspawn_with_level() { sysPrxForUser.Log("sys_prx_exitspawn_with_level()"); - return 0; + return CELL_OK; } s64 sys_strlen(u32 addr) @@ -47,6 +47,38 @@ s64 sys_strlen(u32 addr) return str.Len(); } +int sys_spu_elf_get_information(u32 elf_img, mem32_t entry, mem32_t nseg) +{ + sysPrxForUser.Warning("sys_spu_elf_get_information(elf_img=0x%x, entry_addr=0x%x, nseg_addr=0x%x", elf_img, entry.GetAddr(), nseg.GetAddr()); + return CELL_OK; +} + +int sys_spu_elf_get_segments(u32 elf_img, mem_ptr_t segments, int nseg) +{ + sysPrxForUser.Warning("sys_spu_elf_get_segments(elf_img=0x%x, segments_addr=0x%x, nseg=0x%x)", elf_img, segments.GetAddr(), nseg); + return CELL_OK; +} + +int sys_spu_image_import(mem_ptr_t img, u64 src, u32 type) +{ + sysPrxForUser.Warning("sys_spu_image_import(img=0x%x, src=0x%x, type=0x%x)", img.GetAddr(), src, type); + + if(!img.IsGood() || !Memory.IsGoodAddr(src)) + { + return CELL_EFAULT; + } + + vfsStreamMemory f(src); + u32 entry = LoadSpuImage(f); + + img->type = 1; + img->entry_point = entry; + img->segs_addr = 0x0; + img->nsegs = 0; + + return CELL_OK; +} + void sysPrxForUser_init() { sysPrxForUser.AddFunc(0x744680a2, sys_initialize_tls); @@ -82,4 +114,8 @@ void sysPrxForUser_init() sysPrxForUser.AddFunc(0xb257540b, sys_mmapper_allocate_memory); sysPrxForUser.AddFunc(0xdc578057, sys_mmapper_map_memory); + + sysPrxForUser.AddFunc(0x1ed454ce, sys_spu_elf_get_information); + sysPrxForUser.AddFunc(0xdb6b3250, sys_spu_elf_get_segments); + sysPrxForUser.AddFunc(0xebe5f72f, sys_spu_image_import); } diff --git a/rpcs3/Emu/SysCalls/lv2/SC_SPU_Thread.cpp b/rpcs3/Emu/SysCalls/lv2/SC_SPU_Thread.cpp index 92be21e5c3..bb5fe07953 100644 --- a/rpcs3/Emu/SysCalls/lv2/SC_SPU_Thread.cpp +++ b/rpcs3/Emu/SysCalls/lv2/SC_SPU_Thread.cpp @@ -1,6 +1,7 @@ #include "stdafx.h" #include "SC_SPU_Thread.h" #include "Emu/SysCalls/SysCalls.h" +#include "Emu/SysCalls/SC_FUNC.h" #include "Loader/ELF.h" #include "Emu/Cell/RawSPUThread.h" diff --git a/rpcs3/Emu/SysCalls/lv2/SC_SPU_Thread.h b/rpcs3/Emu/SysCalls/lv2/SC_SPU_Thread.h index 4d6515a5f2..c4f670c28a 100644 --- a/rpcs3/Emu/SysCalls/lv2/SC_SPU_Thread.h +++ b/rpcs3/Emu/SysCalls/lv2/SC_SPU_Thread.h @@ -1,5 +1,7 @@ #pragma once +u32 LoadSpuImage(vfsStream& stream); + struct sys_spu_thread_group_attribute { be_t name_len; @@ -30,3 +32,11 @@ struct sys_spu_image be_t segs_addr; be_t nsegs; }; + +struct sys_spu_segment +{ + be_t type; + be_t ls_start; + be_t size; + be_t src; +};