hamt backport and bugfixes

This commit is contained in:
Pavel 2023-11-08 12:33:18 +03:00
parent 302d832fc3
commit 2dc4d5304c
8 changed files with 732 additions and 99 deletions

View File

@ -615,6 +615,7 @@
<Unit133> <Unit133>
<Filename Value="src\audiodec\ps4_libsceaudiodec.pas"/> <Filename Value="src\audiodec\ps4_libsceaudiodec.pas"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<UnitName Value="ps4_libSceAudiodec"/>
</Unit133> </Unit133>
<Unit134> <Unit134>
<Filename Value="src\audiodec\ps4_libsceaudiodeccpu.pas"/> <Filename Value="src\audiodec\ps4_libsceaudiodeccpu.pas"/>

View File

@ -559,7 +559,7 @@ begin
begin begin
Result:=0; Result:=0;
node:=P^; node:=P^;
HAMT_delete32(@eq^.FUserEvents.hamt,id); HAMT_delete32(@eq^.FUserEvents.hamt,id,nil);
_free_kevent_node(node); _free_kevent_node(node);
end else end else
begin begin

View File

@ -1054,6 +1054,7 @@ begin
DT_NEEDED: DT_NEEDED:
begin begin
mu.value:=entry.d_un.d_val; mu.value:=entry.d_un.d_val;
_md:=Default(TMODULE);
_md.strName:=PChar(@pStrTable[mu.name_offset]); _md.strName:=PChar(@pStrTable[mu.name_offset]);
_add_need(_md.strName); _add_need(_md.strName);
Writeln('DT_NEEDED :',_md.strName); //import filename Writeln('DT_NEEDED :',_md.strName); //import filename
@ -1061,6 +1062,7 @@ begin
DT_SCE_MODULE_INFO: DT_SCE_MODULE_INFO:
begin begin
mu.value:=entry.d_un.d_val; mu.value:=entry.d_un.d_val;
_md:=Default(TMODULE);
_md.strName:=PChar(@pStrTable[mu.name_offset]); _md.strName:=PChar(@pStrTable[mu.name_offset]);
_md.Import:=False; _md.Import:=False;
Writeln('DT_SCE_MODULE_INFO:',_md.strName,':',HexStr(mu.id,4)); //current module name Writeln('DT_SCE_MODULE_INFO:',_md.strName,':',HexStr(mu.id,4)); //current module name
@ -1070,6 +1072,7 @@ begin
DT_SCE_NEEDED_MODULE: DT_SCE_NEEDED_MODULE:
begin begin
mu.value:=entry.d_un.d_val; mu.value:=entry.d_un.d_val;
_md:=Default(TMODULE);
_md.strName:=PChar(@pStrTable[mu.name_offset]); _md.strName:=PChar(@pStrTable[mu.name_offset]);
_md.Import:=True; _md.Import:=True;
Writeln('DT_SCE_NEEDED_MODULE :',HexStr(mu.id,4),':',_md.strName); //import module name Writeln('DT_SCE_NEEDED_MODULE :',HexStr(mu.id,4),':',_md.strName); //import module name
@ -1078,6 +1081,7 @@ begin
DT_SCE_IMPORT_LIB: DT_SCE_IMPORT_LIB:
begin begin
lu.value:=entry.d_un.d_val; lu.value:=entry.d_un.d_val;
lib:=Default(TLIBRARY);
lib.strName:=PChar(@pStrTable[lu.name_offset]); lib.strName:=PChar(@pStrTable[lu.name_offset]);
lib.Import:=True; lib.Import:=True;
Writeln('DT_SCE_IMPORT_LIB :',HexStr(lu.id,4),':',lib.strName); //import lib name Writeln('DT_SCE_IMPORT_LIB :',HexStr(lu.id,4),':',lib.strName); //import lib name
@ -1086,6 +1090,7 @@ begin
DT_SCE_EXPORT_LIB: DT_SCE_EXPORT_LIB:
begin begin
lu.value:=entry.d_un.d_val; lu.value:=entry.d_un.d_val;
lib:=Default(TLIBRARY);
lib.strName:=PChar(@pStrTable[lu.name_offset]); lib.strName:=PChar(@pStrTable[lu.name_offset]);
lib.Import:=False; lib.Import:=False;
Writeln('DT_SCE_EXPORT_LIB :',HexStr(lu.id,4),':',lib.strName); //export libname Writeln('DT_SCE_EXPORT_LIB :',HexStr(lu.id,4),':',lib.strName); //export libname

View File

@ -416,14 +416,19 @@ end;
procedure TElf_node._set_lib(id:Word;lib:TLIBRARY); procedure TElf_node._set_lib(id:Word;lib:TLIBRARY);
var var
i:SizeInt; p,i:SizeInt;
plib:PLIBRARY; plib:PLIBRARY;
begin begin
i:=Length(aLibs); i:=Length(aLibs);
if (i<=id) then if (i<=id) then
begin begin
i:=id+1; i:=id+1;
p:=Length(aLibs);
SetLength(aLibs,i); SetLength(aLibs,i);
for p:=p to i-1 do
begin
aLibs[p]:=nil;
end;
end; end;
plib:=aLibs[id]; plib:=aLibs[id];
if (plib=nil) then plib:=AllocMem(SizeOf(TLIBRARY)); if (plib=nil) then plib:=AllocMem(SizeOf(TLIBRARY));
@ -434,14 +439,19 @@ end;
procedure TElf_node._set_lib_attr(u:TLibraryValue); procedure TElf_node._set_lib_attr(u:TLibraryValue);
var var
i:SizeInt; p,i:SizeInt;
plib:PLIBRARY; plib:PLIBRARY;
begin begin
i:=Length(aLibs); i:=Length(aLibs);
if (i<=u.id) then if (i<=u.id) then
begin begin
i:=u.id+1; i:=u.id+1;
p:=Length(aLibs);
SetLength(aLibs,i); SetLength(aLibs,i);
for p:=p to i-1 do
begin
aLibs[p]:=nil;
end;
end; end;
plib:=aLibs[u.id]; plib:=aLibs[u.id];
if (plib=nil) then plib:=AllocMem(SizeOf(TLIBRARY)); if (plib=nil) then plib:=AllocMem(SizeOf(TLIBRARY));

File diff suppressed because it is too large Load Diff

View File

@ -175,7 +175,7 @@ begin
Result:=False; Result:=False;
if (Key<min_key) or (Key>max_key) then Exit; if (Key<min_key) or (Key>max_key) then Exit;
rwlock_wrlock(FLock); rwlock_wrlock(FLock);
Pointer(data):=HAMT_delete32(FHAMT,Key); HAMT_delete32(FHAMT,Key,@data);
if Assigned(data) then if Assigned(data) then
begin begin
data.Release; data.Release;

View File

@ -158,7 +158,7 @@ end;
procedure _DeleteDecoder(const handle:SceAudiodecHandle); procedure _DeleteDecoder(const handle:SceAudiodecHandle);
begin begin
spin_lock(hamt_lock); spin_lock(hamt_lock);
HAMT_delete32(@AudiodecHamt,handle); HAMT_delete32(@AudiodecHamt,handle,nil);
spin_unlock(hamt_lock); spin_unlock(hamt_lock);
end; end;

View File

@ -377,7 +377,7 @@ var
data:TAvPlayerInfo; data:TAvPlayerInfo;
begin begin
spin_lock(hamt_lock); spin_lock(hamt_lock);
data:=TAvPlayerInfo(HAMT_delete64(@AvHandleHamt,handle)); HAMT_delete64(@AvHandleHamt,handle,@data);
spin_unlock(hamt_lock); spin_unlock(hamt_lock);
if (data<>nil) then if (data<>nil) then