Notification for encrypted SPU modules

This commit is contained in:
Nekotekina 2014-10-06 01:21:00 +04:00
parent 5e954f4f76
commit ed0918d097
2 changed files with 31 additions and 5 deletions

View File

@ -15,11 +15,17 @@
#include "Emu/SysCalls/lv2/sys_mmapper.h" #include "Emu/SysCalls/lv2/sys_mmapper.h"
#include "Emu/SysCalls/lv2/sys_lwcond.h" #include "Emu/SysCalls/lv2/sys_lwcond.h"
#include "Loader/ELF.h" #include "Loader/ELF.h"
#include "Crypto/unself.h"
#include "Emu/Cell/RawSPUThread.h" #include "Emu/Cell/RawSPUThread.h"
#include "sysPrxForUser.h" #include "sysPrxForUser.h"
Module *sysPrxForUser = nullptr; Module *sysPrxForUser = nullptr;
void sys_initialize_tls()
{
sysPrxForUser->Log("sys_initialize_tls()");
}
int _sys_heap_create_heap(const u32 heap_addr, const u32 align, const u32 size) int _sys_heap_create_heap(const u32 heap_addr, const u32 align, const u32 size)
{ {
sysPrxForUser->Warning("_sys_heap_create_heap(heap_addr=0x%x, align=0x%x, size=0x%x)", heap_addr, align, size); sysPrxForUser->Warning("_sys_heap_create_heap(heap_addr=0x%x, align=0x%x, size=0x%x)", heap_addr, align, size);
@ -49,11 +55,6 @@ u32 _sys_heap_memalign(u32 heap_id, u32 align, u32 size)
return (u32)Memory.Alloc(size, align); return (u32)Memory.Alloc(size, align);
} }
void sys_initialize_tls()
{
sysPrxForUser->Log("sys_initialize_tls()");
}
s64 _sys_process_atexitspawn() s64 _sys_process_atexitspawn()
{ {
sysPrxForUser->Log("_sys_process_atexitspawn()"); sysPrxForUser->Log("_sys_process_atexitspawn()");
@ -117,6 +118,18 @@ int sys_raw_spu_load(s32 id, vm::ptr<const char> path, vm::ptr<be_t<u32>> entry)
return CELL_ENOENT; return CELL_ENOENT;
} }
SceHeader hdr;
hdr.Load(f);
if (hdr.CheckMagic())
{
sysPrxForUser->Error("sys_raw_spu_load error: '%s' is encrypted! Decrypt SELF and try again.", path.get_ptr());
Emu.Pause();
return CELL_ENOENT;
}
f.Seek(0);
ELFLoader l(f); ELFLoader l(f);
l.LoadInfo(); l.LoadInfo();
l.LoadData(RAW_SPU_BASE_ADDR + RAW_SPU_OFFSET * id); l.LoadData(RAW_SPU_BASE_ADDR + RAW_SPU_OFFSET * id);

View File

@ -8,6 +8,7 @@
#include "Emu/FS/vfsStreamMemory.h" #include "Emu/FS/vfsStreamMemory.h"
#include "Emu/FS/vfsFile.h" #include "Emu/FS/vfsFile.h"
#include "Loader/ELF.h" #include "Loader/ELF.h"
#include "Crypto/unself.h"
#include "sys_spu.h" #include "sys_spu.h"
static SysCallBase sys_spu("sys_spu"); static SysCallBase sys_spu("sys_spu");
@ -48,6 +49,18 @@ s32 sys_spu_image_open(vm::ptr<sys_spu_image> img, vm::ptr<const char> path)
return CELL_ENOENT; return CELL_ENOENT;
} }
SceHeader hdr;
hdr.Load(f);
if (hdr.CheckMagic())
{
sys_spu.Error("sys_spu_image_open error: '%s' is encrypted! Decrypt SELF and try again.", path.get_ptr());
Emu.Pause();
return CELL_ENOENT;
}
f.Seek(0);
u32 entry; u32 entry;
u32 offset = LoadSpuImage(f, entry); u32 offset = LoadSpuImage(f, entry);