This commit is contained in:
Pavel 2024-03-04 16:42:42 +03:00
parent 5a1c3c1488
commit 0988155200
3 changed files with 92 additions and 37 deletions

View File

@ -97,6 +97,8 @@ type
function get_caption_format:RawByteString; function get_caption_format:RawByteString;
function OpenMainWindows():THandle; function OpenMainWindows():THandle;
Procedure CloseMainWindows(); Procedure CloseMainWindows();
Procedure ShowMainWindows();
Procedure HideMainWindows();
procedure SetCaptionFPS(Ffps:QWORD); procedure SetCaptionFPS(Ffps:QWORD);
procedure OpenLog(Const LogFile:RawByteString); procedure OpenLog(Const LogFile:RawByteString);
@ -112,6 +114,7 @@ type
procedure DoEdit(Sender: TObject); procedure DoEdit(Sender: TObject);
procedure LogEnd; procedure LogEnd;
procedure ClearLog; procedure ClearLog;
function GameProcessForked:Boolean;
procedure SetButtonsState(s:TMainButtonsState); procedure SetButtonsState(s:TMainButtonsState);
end; end;
@ -465,7 +468,11 @@ const
pd_Width=1280; pd_Width=1280;
pd_Height=720; pd_Height=720;
begin begin
if (FGameMainForm<>nil) then Exit(FGameMainForm.Handle); if (FGameMainForm<>nil) then
begin
FGameMainForm.Show;
Exit(FGameMainForm.Handle);
end;
FGameMainForm:=TGameMainForm.CreateNew(Self); FGameMainForm:=TGameMainForm.CreateNew(Self);
FGameMainForm.ShowInTaskBar:=stAlways; FGameMainForm.ShowInTaskBar:=stAlways;
@ -492,6 +499,22 @@ begin
FreeAndNil(FGameMainForm); FreeAndNil(FGameMainForm);
end; end;
Procedure TfrmMain.ShowMainWindows();
begin
if (FGameMainForm<>nil) then
begin
FGameMainForm.Show;
end;
end;
Procedure TfrmMain.HideMainWindows();
begin
if (FGameMainForm<>nil) then
begin
FGameMainForm.Hide;
end;
end;
procedure TfrmMain.SetCaptionFPS(Ffps:QWORD); procedure TfrmMain.SetCaptionFPS(Ffps:QWORD);
begin begin
if (FGameMainForm=nil) then Exit; if (FGameMainForm=nil) then Exit;
@ -621,6 +644,7 @@ begin
if (FGameProcess<>nil) then if (FGameProcess<>nil) then
begin begin
//resume //resume
ShowMainWindows();
FGameProcess.resume; FGameProcess.resume;
SetButtonsState(mdsRunned); SetButtonsState(mdsRunned);
end else end else
@ -640,10 +664,18 @@ begin
end; end;
end; end;
function TfrmMain.GameProcessForked:Boolean;
begin
Result:=False;
if (FGameProcess<>nil) then
begin
Result:=FGameProcess.g_fork;
end;
end;
procedure TfrmMain.TBStopClick(Sender: TObject); procedure TfrmMain.TBStopClick(Sender: TObject);
begin begin
if (FGameProcess<>nil) then if GameProcessForked then //only forked
if (FGameProcess.g_fork) then //only forked
begin begin
//terminate //terminate
FGameProcess.stop; FGameProcess.stop;
@ -799,21 +831,35 @@ begin
begin begin
TBPlay .Enabled:=False; TBPlay .Enabled:=False;
TBPause.Enabled:=True; TBPause.Enabled:=True;
TBStop .Enabled:=True; TBStop .Enabled:=False;
// //
TBPlay .ImageIndex:=0+3; TBPlay .ImageIndex:=0+3;
TBPause.ImageIndex:=1; TBPause.ImageIndex:=1;
TBStop .ImageIndex:=2; TBStop .ImageIndex:=2+3;
if GameProcessForked then //only forked
begin
TBStop .Enabled:=True;
TBStop .ImageIndex:=2;
end;
end; end;
mdsSuspended: mdsSuspended:
begin begin
TBPlay .Enabled:=True; TBPlay .Enabled:=True;
TBPause.Enabled:=False; TBPause.Enabled:=False;
TBStop .Enabled:=True; TBStop .Enabled:=False;
// //
TBPlay .ImageIndex:=0; TBPlay .ImageIndex:=0;
TBPause.ImageIndex:=1+3; TBPause.ImageIndex:=1+3;
TBStop .ImageIndex:=2; TBStop .ImageIndex:=2+3;
if GameProcessForked then //only forked
begin
TBStop .Enabled:=True;
TBStop .ImageIndex:=2;
end;
end; end;
end; end;

View File

@ -60,28 +60,37 @@ type
t_touch_pad_info=packed record t_touch_pad_info=packed record
pixelDensity:DWORD; pixelDensity:DWORD;
x :word; x :Word;
y :word; y :Word;
end;
t_pad_ext_info=packed record
case byte of
0:(quantityOfSelectorSwitch:Byte);
1:(maxPhysicalWheelAngle:Integer);
2:(data:array[0..7] of Byte);
end; end;
p_pad_device_info=^t_pad_device_info; p_pad_device_info=^t_pad_device_info;
t_pad_device_info=packed record t_pad_device_info=packed record //0x40
conn_type :Byte; conn_type :Byte;
pad1 :array[0..2] of Byte; pad1 :array[0..2] of Byte;
connected :Integer; connected :Integer;
unknow1 :QWORD; unknow1 :QWORD;
unknow2 :word; pad_type1 :Word;
unknow3 :word; pad_type2 :Word;
unknow4 :array[0..11] of Byte; unknow2 :array[0..11] of Byte;
pad_type :Byte; pad_type :Byte;
pad2 :array[0..2] of Byte; pad2 :array[0..2] of Byte;
capability:Integer; capability1:Integer;
dev_class :Byte; dev_classid:Byte;
pad3 :array[0..2] of Byte; unknow3 :Byte;
unknow5 :QWORD; capability2:Byte;
touchpad :t_touch_pad_info; unknow4 :Byte;
stick_info:t_pad_stick_info; ext_data :t_pad_ext_info;
unknow6 :word; touchpad :t_touch_pad_info;
stick_info :t_pad_stick_info;
unknow5 :Word;
end; end;
{$IF sizeof(t_pad_device_info)<>64}{$STOP sizeof(t_pad_device_info)<>64}{$ENDIF} {$IF sizeof(t_pad_device_info)<>64}{$STOP sizeof(t_pad_device_info)<>64}{$ENDIF}
@ -204,10 +213,10 @@ begin
begin begin
FillChar(_data,64,0); FillChar(_data,64,0);
p_pad_device_info(@_data)^.conn_type:=0; p_pad_device_info(@_data)^.conn_type :=0;
p_pad_device_info(@_data)^.connected:=1; p_pad_device_info(@_data)^.connected :=1;
p_pad_device_info(@_data)^.pad_type :=0; p_pad_device_info(@_data)^.pad_type :=0;
p_pad_device_info(@_data)^.dev_class:=0; p_pad_device_info(@_data)^.dev_classid:=0;
Result:=copyout(@_data,info,64); Result:=copyout(@_data,info,64);
end; end;

View File

@ -464,14 +464,14 @@ begin
if (imgp=nil) then Exit; if (imgp=nil) then Exit;
imgp^.authinfo:=Default(t_authinfo); imgp^.authinfo:=Default(t_authinfo);
imgp^.authinfo.app_caps [0]:=QWORD($2000000000000000); //IsGame
imgp^.authinfo.app_attrs[0]:=$400000 or $800000; //allow dmem map
if (imgp^.proc_param_addr<>nil) then imgp^.authinfo.app_caps [0]:=QWORD($2000038000000000); //IsGame
begin imgp^.authinfo.app_caps [1]:=QWORD($000000000000FF00);
//SceProgramAttribute
imgp^.authinfo.app_attrs[0]:=imgp^.authinfo.app_attrs[0] or $80000000; imgp^.authinfo.app_attrs[0]:=QWORD($4000400040000000); //dmem map flags
end; imgp^.authinfo.app_attrs[1]:=QWORD($4000000000000000);
imgp^.authinfo.app_attrs[2]:=QWORD($0080000000000002);
imgp^.authinfo.app_attrs[3]:=QWORD($F0000000FFFF4000);
if (imgp^.image_header=nil) or if (imgp^.image_header=nil) or
(imgp^.image_self =nil) then (imgp^.image_self =nil) then