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>
<Filename Value="src\audiodec\ps4_libsceaudiodec.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="ps4_libSceAudiodec"/>
</Unit133>
<Unit134>
<Filename Value="src\audiodec\ps4_libsceaudiodeccpu.pas"/>

View File

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

View File

@ -1054,6 +1054,7 @@ begin
DT_NEEDED:
begin
mu.value:=entry.d_un.d_val;
_md:=Default(TMODULE);
_md.strName:=PChar(@pStrTable[mu.name_offset]);
_add_need(_md.strName);
Writeln('DT_NEEDED :',_md.strName); //import filename
@ -1061,6 +1062,7 @@ begin
DT_SCE_MODULE_INFO:
begin
mu.value:=entry.d_un.d_val;
_md:=Default(TMODULE);
_md.strName:=PChar(@pStrTable[mu.name_offset]);
_md.Import:=False;
Writeln('DT_SCE_MODULE_INFO:',_md.strName,':',HexStr(mu.id,4)); //current module name
@ -1070,6 +1072,7 @@ begin
DT_SCE_NEEDED_MODULE:
begin
mu.value:=entry.d_un.d_val;
_md:=Default(TMODULE);
_md.strName:=PChar(@pStrTable[mu.name_offset]);
_md.Import:=True;
Writeln('DT_SCE_NEEDED_MODULE :',HexStr(mu.id,4),':',_md.strName); //import module name
@ -1078,6 +1081,7 @@ begin
DT_SCE_IMPORT_LIB:
begin
lu.value:=entry.d_un.d_val;
lib:=Default(TLIBRARY);
lib.strName:=PChar(@pStrTable[lu.name_offset]);
lib.Import:=True;
Writeln('DT_SCE_IMPORT_LIB :',HexStr(lu.id,4),':',lib.strName); //import lib name
@ -1086,6 +1090,7 @@ begin
DT_SCE_EXPORT_LIB:
begin
lu.value:=entry.d_un.d_val;
lib:=Default(TLIBRARY);
lib.strName:=PChar(@pStrTable[lu.name_offset]);
lib.Import:=False;
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);
var
i:SizeInt;
p,i:SizeInt;
plib:PLIBRARY;
begin
i:=Length(aLibs);
if (i<=id) then
begin
i:=id+1;
p:=Length(aLibs);
SetLength(aLibs,i);
for p:=p to i-1 do
begin
aLibs[p]:=nil;
end;
end;
plib:=aLibs[id];
if (plib=nil) then plib:=AllocMem(SizeOf(TLIBRARY));
@ -434,14 +439,19 @@ end;
procedure TElf_node._set_lib_attr(u:TLibraryValue);
var
i:SizeInt;
p,i:SizeInt;
plib:PLIBRARY;
begin
i:=Length(aLibs);
if (i<=u.id) then
begin
i:=u.id+1;
p:=Length(aLibs);
SetLength(aLibs,i);
for p:=p to i-1 do
begin
aLibs[p]:=nil;
end;
end;
plib:=aLibs[u.id];
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;
if (Key<min_key) or (Key>max_key) then Exit;
rwlock_wrlock(FLock);
Pointer(data):=HAMT_delete32(FHAMT,Key);
HAMT_delete32(FHAMT,Key,@data);
if Assigned(data) then
begin
data.Release;

View File

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

View File

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