Generic host, gfx and tools taken from d2r-mobile (MIT), with the D2R gameplay, diagnostics and Blizzard/Granny/movie layers removed. - hle_hid.c: generic standard-controller layer (all Npad styles) - hle_sdk16.c: newer-SDK oe/time/pl/vsync/diag hooks - hle_offline.c: offline stubs for prepo/ldn/socket/ssl/nifm/nsd/friends/ngc/err - hle_fs.c, hle_account.c: SDK 16 overloads - loader.c: unreferenced forced hooks only logged (DM_FORCE_STRICT=1 aborts) - NVN: API 55.15, 13 newer names, ~45 state-only functions, tex_t packed to 0x80 (Mario allocates NVNtexture as 0x80; 0x88 corrupted the heap) Frontier: null read at main+0x64763c inside the frame loop.
15 lines
559 B
Python
15 lines
559 B
Python
import sys,struct,lz4.block
|
|
d=open(sys.argv[1],'rb').read()
|
|
flags=struct.unpack_from('<I',d,0xc)[0]
|
|
segs=[struct.unpack_from('<III',d,0x10+i*0x10) for i in range(3)]
|
|
bss=struct.unpack_from('<I',d,0x3c)[0]
|
|
csz=struct.unpack_from('<III',d,0x60)
|
|
end=segs[2][1]+segs[2][2]
|
|
img=bytearray(end+bss)
|
|
for i,(fo,mo,sz) in enumerate(segs):
|
|
raw=d[fo:fo+csz[i]]
|
|
if flags>>i&1: raw=lz4.block.decompress(raw,uncompressed_size=sz)
|
|
img[mo:mo+sz]=raw
|
|
open(sys.argv[2],'wb').write(img)
|
|
print([hex(x) for s in segs for x in s],hex(bss),'moduleid',d[0x40:0x60].hex())
|