1
0
mirror of https://github.com/salvadordf/CEF4Delphi.git synced 2025-06-02 21:57:37 +02:00

Fixed build issues in ARM CPUs with a 64 bits target

Possible fix for issue #406
This commit is contained in:
salvadordf 2022-02-25 16:02:59 +01:00
parent 03f9e9a1b9
commit b76bc452aa
3 changed files with 15 additions and 15 deletions

View File

@ -348,7 +348,7 @@ begin
// https://github.com/salvadordf/CEF4Delphi/issues/278 // https://github.com/salvadordf/CEF4Delphi/issues/278
// The TCefRect return type seems to be messing the stack and the other parameters // The TCefRect return type seems to be messing the stack and the other parameters
// are assigned wrong addresses. // are assigned wrong addresses.
{$IFDEF CPUX64} {$IFDEF TARGET_64BITS}
get_preferred_size := {$IFDEF FPC}@{$ENDIF}cef_view_delegate_get_preferred_size; get_preferred_size := {$IFDEF FPC}@{$ENDIF}cef_view_delegate_get_preferred_size;
get_minimum_size := {$IFDEF FPC}@{$ENDIF}cef_view_delegate_get_minimum_size; get_minimum_size := {$IFDEF FPC}@{$ENDIF}cef_view_delegate_get_minimum_size;
get_maximum_size := {$IFDEF FPC}@{$ENDIF}cef_view_delegate_get_maximum_size; get_maximum_size := {$IFDEF FPC}@{$ENDIF}cef_view_delegate_get_maximum_size;

View File

@ -83,7 +83,7 @@ type
function GetValue(pi: PTypeInfo; const v: ICefv8Value; var ret: TValue): Boolean; function GetValue(pi: PTypeInfo; const v: ICefv8Value; var ret: TValue): Boolean;
function SetValue(const v: TValue; var ret: ICefv8Value): Boolean; function SetValue(const v: TValue; var ret: ICefv8Value): Boolean;
{$IFDEF CPUX64} {$IFDEF TARGET_64BITS}
class function StrToPtr(const str: ustring): Pointer; class function StrToPtr(const str: ustring): Pointer;
class function PtrToStr(p: Pointer): ustring; class function PtrToStr(p: Pointer): ustring;
{$ENDIF} {$ENDIF}
@ -420,7 +420,7 @@ function TCefRTTIExtension.GetValue(pi: PTypeInfo; const v: ICefv8Value; var ret
begin begin
ud := v.GetUserData; ud := v.GetUserData;
if (ud = nil) then Exit(False); if (ud = nil) then Exit(False);
{$IFDEF CPUX64} {$IFDEF TARGET_64BITS}
rt := StrToPtr(ud.GetValueByIndex(0).GetStringValue); rt := StrToPtr(ud.GetValueByIndex(0).GetStringValue);
{$ELSE} {$ELSE}
rt := TRttiType(ud.GetValueByIndex(0).GetIntValue); rt := TRttiType(ud.GetValueByIndex(0).GetIntValue);
@ -429,7 +429,7 @@ function TCefRTTIExtension.GetValue(pi: PTypeInfo; const v: ICefv8Value; var ret
if (rt.TypeKind = tkClass) and td.ClassType.InheritsFrom(GetTypeData(pi).ClassType) then if (rt.TypeKind = tkClass) and td.ClassType.InheritsFrom(GetTypeData(pi).ClassType) then
begin begin
{$IFDEF CPUX64} {$IFDEF TARGET_64BITS}
i := StrToPtr(ud.GetValueByIndex(1).GetStringValue); i := StrToPtr(ud.GetValueByIndex(1).GetStringValue);
{$ELSE} {$ELSE}
i := Pointer(ud.GetValueByIndex(1).GetIntValue); i := Pointer(ud.GetValueByIndex(1).GetIntValue);
@ -453,7 +453,7 @@ function TCefRTTIExtension.GetValue(pi: PTypeInfo; const v: ICefv8Value; var ret
begin begin
ud := v.GetUserData; ud := v.GetUserData;
if (ud = nil) then Exit(False); if (ud = nil) then Exit(False);
{$IFDEF CPUX64} {$IFDEF TARGET_64BITS}
rt := StrToPtr(ud.GetValueByIndex(0).GetStringValue); rt := StrToPtr(ud.GetValueByIndex(0).GetStringValue);
{$ELSE} {$ELSE}
rt := TRttiType(ud.GetValueByIndex(0).GetIntValue); rt := TRttiType(ud.GetValueByIndex(0).GetIntValue);
@ -461,7 +461,7 @@ function TCefRTTIExtension.GetValue(pi: PTypeInfo; const v: ICefv8Value; var ret
if (rt.TypeKind = tkClassRef) then if (rt.TypeKind = tkClassRef) then
begin begin
{$IFDEF CPUX64} {$IFDEF TARGET_64BITS}
i := StrToPtr(ud.GetValueByIndex(1).GetStringValue); i := StrToPtr(ud.GetValueByIndex(1).GetStringValue);
{$ELSE} {$ELSE}
i := Pointer(ud.GetValueByIndex(1).GetIntValue); i := Pointer(ud.GetValueByIndex(1).GetIntValue);
@ -539,7 +539,7 @@ function TCefRTTIExtension.SetValue(const v: TValue; var ret: ICefv8Value): Bool
begin begin
ud := TCefv8ValueRef.NewArray(1); ud := TCefv8ValueRef.NewArray(1);
rt := FCtx.GetType(v.TypeInfo); rt := FCtx.GetType(v.TypeInfo);
{$IFDEF CPUX64} {$IFDEF TARGET_64BITS}
ud.SetValueByIndex(0, TCefv8ValueRef.NewString(PtrToStr(rt))); ud.SetValueByIndex(0, TCefv8ValueRef.NewString(PtrToStr(rt)));
{$ELSE} {$ELSE}
ud.SetValueByIndex(0, TCefv8ValueRef.NewInt(Integer(rt))); ud.SetValueByIndex(0, TCefv8ValueRef.NewInt(Integer(rt)));
@ -592,7 +592,7 @@ function TCefRTTIExtension.SetValue(const v: TValue; var ret: ICefv8Value): Bool
rt := FCtx.GetType(v.TypeInfo); rt := FCtx.GetType(v.TypeInfo);
ud := TCefv8ValueRef.NewArray(2); ud := TCefv8ValueRef.NewArray(2);
{$IFDEF CPUX64} {$IFDEF TARGET_64BITS}
ud.SetValueByIndex(0, TCefv8ValueRef.NewString(PtrToStr(rt))); ud.SetValueByIndex(0, TCefv8ValueRef.NewString(PtrToStr(rt)));
ud.SetValueByIndex(1, TCefv8ValueRef.NewString(PtrToStr(v.AsObject))); ud.SetValueByIndex(1, TCefv8ValueRef.NewString(PtrToStr(v.AsObject)));
{$ELSE} {$ELSE}
@ -656,7 +656,7 @@ function TCefRTTIExtension.SetValue(const v: TValue; var ret: ICefv8Value): Bool
rt := FCtx.GetType(c); rt := FCtx.GetType(c);
ud := TCefv8ValueRef.NewArray(2); ud := TCefv8ValueRef.NewArray(2);
{$IFDEF CPUX64} {$IFDEF TARGET_64BITS}
ud.SetValueByIndex(0, TCefv8ValueRef.NewString(PtrToStr(rt))); ud.SetValueByIndex(0, TCefv8ValueRef.NewString(PtrToStr(rt)));
ud.SetValueByIndex(1, TCefv8ValueRef.NewString(PtrToStr(c))); ud.SetValueByIndex(1, TCefv8ValueRef.NewString(PtrToStr(c)));
{$ELSE} {$ELSE}
@ -724,7 +724,7 @@ function TCefRTTIExtension.SetValue(const v: TValue; var ret: ICefv8Value): Bool
ud := TCefv8ValueRef.NewArray(2); ud := TCefv8ValueRef.NewArray(2);
{$IFDEF CPUX64} {$IFDEF TARGET_64BITS}
ud.SetValueByIndex(0, TCefv8ValueRef.NewString(PtrToStr(rt))); ud.SetValueByIndex(0, TCefv8ValueRef.NewString(PtrToStr(rt)));
ud.SetValueByIndex(1, TCefv8ValueRef.NewString(PtrToStr(Pointer(v.AsInterface)))); ud.SetValueByIndex(1, TCefv8ValueRef.NewString(PtrToStr(Pointer(v.AsInterface))));
{$ELSE} {$ELSE}
@ -792,7 +792,7 @@ begin
end; end;
end; end;
{$IFDEF CPUX64} {$IFDEF TARGET_64BITS}
class function TCefRTTIExtension.StrToPtr(const str: ustring): Pointer; class function TCefRTTIExtension.StrToPtr(const str: ustring): Pointer;
begin begin
HexToBin(PWideChar(str), @Result, SizeOf(Result)); HexToBin(PWideChar(str), @Result, SizeOf(Result));
@ -832,7 +832,7 @@ begin
ud := object_.GetUserData; ud := object_.GetUserData;
if ud <> nil then if ud <> nil then
begin begin
{$IFDEF CPUX64} {$IFDEF TARGET_64BITS}
rt := StrToPtr(ud.GetValueByIndex(0).GetStringValue); rt := StrToPtr(ud.GetValueByIndex(0).GetStringValue);
{$ELSE} {$ELSE}
rt := TRttiType(ud.GetValueByIndex(0).GetIntValue); rt := TRttiType(ud.GetValueByIndex(0).GetIntValue);
@ -840,7 +840,7 @@ begin
case rt.TypeKind of case rt.TypeKind of
tkClass: tkClass:
begin begin
{$IFDEF CPUX64} {$IFDEF TARGET_64BITS}
val := StrToPtr(ud.GetValueByIndex(1).GetStringValue); val := StrToPtr(ud.GetValueByIndex(1).GetStringValue);
{$ELSE} {$ELSE}
val := TObject(ud.GetValueByIndex(1).GetIntValue); val := TObject(ud.GetValueByIndex(1).GetIntValue);
@ -924,7 +924,7 @@ begin
tkClassRef: tkClassRef:
begin begin
val := nil; val := nil;
{$IFDEF CPUX64} {$IFDEF TARGET_64BITS}
cls := StrToPtr(ud.GetValueByIndex(1).GetStringValue); cls := StrToPtr(ud.GetValueByIndex(1).GetStringValue);
{$ELSE} {$ELSE}
cls := TClass(ud.GetValueByIndex(1).GetIntValue); cls := TClass(ud.GetValueByIndex(1).GetIntValue);

View File

@ -2,7 +2,7 @@
"UpdateLazPackages" : [ "UpdateLazPackages" : [
{ {
"ForceNotify" : true, "ForceNotify" : true,
"InternalVersion" : 360, "InternalVersion" : 361,
"Name" : "cef4delphi_lazarus.lpk", "Name" : "cef4delphi_lazarus.lpk",
"Version" : "98.2.0.0" "Version" : "98.2.0.0"
} }