mirror of
https://github.com/red-prig/fpPS4.git
synced 2024-10-07 03:33:20 +00:00
+
This commit is contained in:
parent
45a02161c5
commit
b65099ba72
@ -327,6 +327,7 @@ begin
|
||||
begin
|
||||
|
||||
Case Info^.lib^.strName of
|
||||
'libSceNpToolkit':;
|
||||
'libSceSaveDataDialog':;
|
||||
'libSceVideoOut':;
|
||||
'libSceSystemService':;
|
||||
@ -739,8 +740,12 @@ begin
|
||||
ps4_app.reload_cb :=@ReloadImport;
|
||||
|
||||
elf:=Telf_file(LoadPs4ElfFromFile(ps4_app.app_file));
|
||||
elf.Prepare;
|
||||
Assert(elf<>nil);
|
||||
|
||||
ps4_app.prog:=elf;
|
||||
|
||||
elf.Prepare;
|
||||
|
||||
ps4_app.RegistredElf(elf);
|
||||
ps4_app.ResolveDepended(elf);
|
||||
ps4_app.LoadSymbolImport(nil);
|
||||
|
58
ps4_elf.pas
58
ps4_elf.pas
@ -165,7 +165,9 @@ type
|
||||
|
||||
ro_segments:array[0..3] of TMemChunk;
|
||||
|
||||
pEntryPoint:QWORD;
|
||||
pEntry:QWORD;
|
||||
dtInit:QWORD;
|
||||
dtFini:QWORD;
|
||||
|
||||
pProcParam :QWORD;
|
||||
pModuleParam :QWORD;
|
||||
@ -183,9 +185,6 @@ type
|
||||
stub:TMemChunk;
|
||||
end;
|
||||
|
||||
dtInit:QWORD;
|
||||
dtFini:QWORD;
|
||||
|
||||
pInit:packed record
|
||||
dt_preinit_array,
|
||||
dt_preinit_array_count:QWORD;
|
||||
@ -261,7 +260,9 @@ type
|
||||
Procedure InitCode; override;
|
||||
function module_start(argc:size_t;argp,param:PPointer):Integer; override;
|
||||
function GetCodeFrame:TMemChunk; override;
|
||||
function GetEntryPoint:Pointer; override;
|
||||
function GetEntry:Pointer; override;
|
||||
function GetdInit:Pointer; override;
|
||||
function GetdFini:Pointer; override;
|
||||
Function GetModuleInfo:SceKernelModuleInfo; override;
|
||||
Function GetModuleInfoEx:SceKernelModuleInfoEx; override;
|
||||
procedure mapCodeEntry;
|
||||
@ -1381,7 +1382,14 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
mMap.pAddr:=VirtualAlloc(nil,mMap.nSize,MEM_COMMIT or MEM_RESERVE,PAGE_READWRITE);
|
||||
mMap.pAddr:=nil;
|
||||
|
||||
if (ps4_app.prog=self) then
|
||||
begin
|
||||
mMap.pAddr:=Pointer($800000000);
|
||||
end;
|
||||
|
||||
mMap.pAddr:=VirtualAlloc(mMap.pAddr,mMap.nSize,MEM_COMMIT or MEM_RESERVE,PAGE_READWRITE);
|
||||
|
||||
Assert(mMap.pAddr<>nil);
|
||||
Assert(IsAlign(mMap.pAddr,16*1024));
|
||||
@ -1463,7 +1471,7 @@ begin
|
||||
|
||||
|
||||
|
||||
pEntryPoint:=Pelf64_hdr(mElf.pAddr)^.e_entry;
|
||||
pEntry:=Pelf64_hdr(mElf.pAddr)^.e_entry;
|
||||
|
||||
Result:=True;
|
||||
end;
|
||||
@ -2170,7 +2178,7 @@ var
|
||||
P:PPointer;
|
||||
|
||||
begin
|
||||
FWriteln('e_entry:' +HexStr(elf.pEntryPoint,16));
|
||||
FWriteln('e_entry:' +HexStr(elf.pEntry,16));
|
||||
|
||||
base:=elf.mMap.pAddr;
|
||||
|
||||
@ -2817,13 +2825,35 @@ begin
|
||||
safe_move(mMap,Result,SizeOf(TMemChunk));
|
||||
end;
|
||||
|
||||
function Telf_file.GetEntryPoint:Pointer;
|
||||
function Telf_file.GetEntry:Pointer;
|
||||
begin
|
||||
Case Int64(pEntryPoint) of
|
||||
-1,0,1:Result:=nil;//skip
|
||||
Case Int64(pEntry) of
|
||||
-1:Result:=nil;//skip
|
||||
else
|
||||
begin
|
||||
Result:=Pointer(mMap.pAddr+QWORD(pEntryPoint));
|
||||
Result:=Pointer(mMap.pAddr+QWORD(pEntry));
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
function Telf_file.GetdInit:Pointer;
|
||||
begin
|
||||
Case Int64(dtInit) of
|
||||
-1:Result:=nil;//skip
|
||||
else
|
||||
begin
|
||||
Result:=Pointer(mMap.pAddr+QWORD(dtInit));
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
function Telf_file.GetdFini:Pointer;
|
||||
begin
|
||||
Case Int64(dtFini) of
|
||||
-1:Result:=nil;//skip
|
||||
else
|
||||
begin
|
||||
Result:=Pointer(mMap.pAddr+QWORD(dtFini));
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
@ -2890,8 +2920,8 @@ procedure Telf_file.mapCodeEntry;
|
||||
var
|
||||
P:TEntryPoint;
|
||||
begin
|
||||
Pointer(P):=Pointer(pEntryPoint);
|
||||
Writeln('EntryPoint:',HexStr(P));
|
||||
Pointer(P):=Pointer(pEntry);
|
||||
Writeln('Entry:',HexStr(P));
|
||||
Case Int64(P) of
|
||||
-1,0,1:;//skip
|
||||
else
|
||||
|
@ -88,7 +88,9 @@ type
|
||||
Procedure InitCode; virtual;
|
||||
function module_start(argc:size_t;argp,param:PPointer):Integer; virtual;
|
||||
function GetCodeFrame:TMemChunk; virtual;
|
||||
function GetEntryPoint:Pointer; virtual;
|
||||
function GetEntry:Pointer; virtual;
|
||||
function GetdInit:Pointer; virtual;
|
||||
function GetdFini:Pointer; virtual;
|
||||
Function GetModuleInfo:SceKernelModuleInfo; virtual;
|
||||
Function GetModuleInfoEx:SceKernelModuleInfoEx; virtual;
|
||||
Function get_proc(nid:QWORD):Pointer;
|
||||
@ -588,7 +590,17 @@ begin
|
||||
Result:=Default(TMemChunk);
|
||||
end;
|
||||
|
||||
function TElf_node.GetEntryPoint:Pointer;
|
||||
function TElf_node.GetEntry:Pointer;
|
||||
begin
|
||||
Result:=nil;
|
||||
end;
|
||||
|
||||
function TElf_node.GetdInit:Pointer;
|
||||
begin
|
||||
Result:=nil;
|
||||
end;
|
||||
|
||||
function TElf_node.GetdFini:Pointer;
|
||||
begin
|
||||
Result:=nil;
|
||||
end;
|
||||
|
@ -255,6 +255,50 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
Function FindLQProcStr(node:TElf_node;r:PTLQRec):shortstring;
|
||||
var
|
||||
adr:Pointer;
|
||||
begin
|
||||
Result:='';
|
||||
if FindLQProc(node,r) then
|
||||
begin
|
||||
Result:=ps4libdoc.GetFunctName(r^.LastNid);
|
||||
end else
|
||||
begin
|
||||
adr:=node.GetdInit;
|
||||
|
||||
if (adr>=r^.pAddr) then
|
||||
if (adr<=r^.ExceptAddr) then
|
||||
if (adr>r^.LastAdr) then
|
||||
begin
|
||||
r^.LastAdr:=adr;
|
||||
Result:='dtInit';
|
||||
end;
|
||||
|
||||
adr:=node.GetdFini;
|
||||
|
||||
if (adr>=r^.pAddr) then
|
||||
if (adr<=r^.ExceptAddr) then
|
||||
if (adr>r^.LastAdr) then
|
||||
begin
|
||||
r^.LastAdr:=adr;
|
||||
Result:='dtFini';
|
||||
end;
|
||||
|
||||
adr:=node.GetEntry;
|
||||
|
||||
if (adr>=r^.pAddr) then
|
||||
if (adr<=r^.ExceptAddr) then
|
||||
if (adr>r^.LastAdr) then
|
||||
begin
|
||||
r^.LastAdr:=adr;
|
||||
Result:='Entry';
|
||||
end;
|
||||
|
||||
end;
|
||||
|
||||
end;
|
||||
|
||||
Procedure WriteErr(Const s:shortstring);
|
||||
var
|
||||
num:DWORD;
|
||||
@ -299,6 +343,7 @@ var
|
||||
procedure print_adr;
|
||||
var
|
||||
r:TLQRec;
|
||||
n:shortstring;
|
||||
begin
|
||||
Report:=' $'+hexstr(ExceptAddr);
|
||||
if (node<>nil) then
|
||||
@ -308,16 +353,13 @@ var
|
||||
begin
|
||||
safe_move_ptr(node.pFileName,pFileName);
|
||||
Report:=Report+' offset $'+hexstr(ExceptAddr-Mem.pAddr,8)+' '+safe_str(pFileName);
|
||||
|
||||
r.pAddr:=Mem.pAddr;
|
||||
r.ExceptAddr:=ExceptAddr;
|
||||
if FindLQProc(node,@r) then
|
||||
begin
|
||||
Report:=Report+':'+ps4libdoc.GetFunctName(r.LastNid)+'+$'+hexstr(ExceptAddr-r.LastAdr,8);
|
||||
end else
|
||||
if (node.GetEntryPoint<>nil) then
|
||||
begin
|
||||
Report:=Report+':EntryPoint+$'+hexstr(ExceptAddr-node.GetEntryPoint,8);
|
||||
end;
|
||||
|
||||
n:=FindLQProcStr(node,@r);
|
||||
|
||||
Report:=Report+':'+n+'+$'+hexstr(ExceptAddr-r.LastAdr,8);
|
||||
end;
|
||||
end;
|
||||
Report:=Report+#13#10;
|
||||
|
@ -263,7 +263,8 @@ begin
|
||||
t:=_New_sparce(cmd.FQueue.FHandle,Addr,Size,usage);
|
||||
Assert(t<>nil,'create sparse buffer fail');
|
||||
end;
|
||||
else;
|
||||
else
|
||||
Assert(false,'_is_sparce');
|
||||
end;
|
||||
|
||||
t.FAddr:=addr;
|
||||
|
@ -714,6 +714,7 @@ begin
|
||||
VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER,
|
||||
VK_DESCRIPTOR_TYPE_STORAGE_BUFFER:
|
||||
Case b.addr[0].rtype of
|
||||
vtRoot,
|
||||
vtBufPtr2:AddBufPtr(P,Fset,b.size,b.bind,b.offset);
|
||||
vtVSharp4:AddVSharp(P,Fset,b.bind,b.offset);
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user