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

View File

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

View File

@ -464,14 +464,14 @@ begin
if (imgp=nil) then Exit;
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
begin
//SceProgramAttribute
imgp^.authinfo.app_attrs[0]:=imgp^.authinfo.app_attrs[0] or $80000000;
end;
imgp^.authinfo.app_caps [0]:=QWORD($2000038000000000); //IsGame
imgp^.authinfo.app_caps [1]:=QWORD($000000000000FF00);
imgp^.authinfo.app_attrs[0]:=QWORD($4000400040000000); //dmem map flags
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
(imgp^.image_self =nil) then