diff --git a/gui/cfg_edit.lfm b/gui/cfg_edit.lfm index d220a7a1..cb0de1f8 100644 --- a/gui/cfg_edit.lfm +++ b/gui/cfg_edit.lfm @@ -1,7 +1,7 @@ object frmCfgEditor: TfrmCfgEditor Left = 448 Height = 319 - Top = 221 + Top = 198 Width = 400 Caption = 'Config Editor' ClientHeight = 319 @@ -13,11 +13,11 @@ object frmCfgEditor: TfrmCfgEditor Height = 270 Top = 0 Width = 397 - ActivePage = Tab_Vulkan + ActivePage = Tab_PS4System Align = alCustom Anchors = [akTop, akLeft, akRight, akBottom] BorderSpacing.Bottom = 10 - TabIndex = 4 + TabIndex = 5 TabOrder = 0 object Tab_MainInfo: TTabSheet Caption = 'Main' @@ -514,6 +514,237 @@ object frmCfgEditor: TfrmCfgEditor } end end + object Tab_PS4System: TTabSheet + Caption = 'PS4 System' + ClientHeight = 242 + ClientWidth = 389 + object PanelHalf: TPanel + AnchorSideLeft.Control = Tab_PS4System + AnchorSideLeft.Side = asrCenter + AnchorSideRight.Control = Tab_PS4System + AnchorSideRight.Side = asrCenter + Left = 188 + Height = 49 + Top = 64 + Width = 12 + Anchors = [akTop, akLeft, akRight] + BevelOuter = bvNone + Enabled = False + TabOrder = 0 + end + object Edt_PS4SystemService_Language: TComboBox + AnchorSideLeft.Control = Tab_PS4System + AnchorSideTop.Control = Label5 + AnchorSideTop.Side = asrBottom + AnchorSideRight.Control = Tab_PS4System + AnchorSideRight.Side = asrBottom + Left = 10 + Height = 23 + Top = 93 + Width = 369 + Anchors = [akTop, akLeft, akRight] + BorderSpacing.Left = 10 + BorderSpacing.Top = 10 + BorderSpacing.Right = 10 + ItemHeight = 15 + Items.Strings = ( + 'Japanese' + 'English (United States)' + 'French (France)' + 'Spanish (Spain)' + 'German' + 'Italian' + 'Dutch' + 'Portuguese (Portugal)' + 'Russian' + 'Korean' + 'Chinese (traditional)' + 'Chinese (simplified)' + 'Finnish' + 'Swedish' + 'Danish' + 'Norwegian' + 'Polish' + 'Portuguese (Brazil)' + 'English (United Kingdom)' + 'Turkish' + 'Spanish (Latin America)' + 'Arabic' + 'French (Canada)' + 'Czech' + 'Hungarian' + 'Greek' + 'Romanian' + 'Thai' + 'Vietnamese' + 'Indonesian' + 'Ukrainian' + ) + Style = csDropDownList + TabOrder = 2 + end + object Edt_PS4SystemService_DateFormat: TComboBox + AnchorSideLeft.Control = Tab_PS4System + AnchorSideTop.Control = Label6 + AnchorSideTop.Side = asrBottom + AnchorSideRight.Control = PanelHalf + Left = 10 + Height = 23 + Top = 151 + Width = 168 + Anchors = [akTop, akLeft, akRight] + BorderSpacing.Left = 10 + BorderSpacing.Top = 10 + BorderSpacing.Right = 10 + ItemHeight = 15 + Items.Strings = ( + 'YYYYMMDD' + 'DDMMYYYY' + 'MMDDYYYY' + ) + Style = csDropDownList + TabOrder = 3 + end + object Label6: TLabel + AnchorSideLeft.Control = Tab_PS4System + AnchorSideTop.Control = Edt_PS4SystemService_Language + AnchorSideTop.Side = asrBottom + AnchorSideRight.Control = PanelHalf + Left = 10 + Height = 15 + Top = 126 + Width = 168 + Anchors = [akTop, akLeft, akRight] + BorderSpacing.Left = 10 + BorderSpacing.Top = 10 + BorderSpacing.Right = 10 + Caption = 'Date Format:' + end + object Edt_PS4SystemService_TimeFormat: TComboBox + AnchorSideLeft.Control = PanelHalf + AnchorSideLeft.Side = asrBottom + AnchorSideTop.Control = Label6 + AnchorSideTop.Side = asrBottom + AnchorSideRight.Control = Tab_PS4System + AnchorSideRight.Side = asrBottom + Left = 210 + Height = 23 + Top = 151 + Width = 169 + Anchors = [akTop, akLeft, akRight] + BorderSpacing.Left = 10 + BorderSpacing.Top = 10 + BorderSpacing.Right = 10 + ItemHeight = 15 + Items.Strings = ( + '12HOUR' + '24HOUR' + ) + Style = csDropDownList + TabOrder = 4 + end + object Label7: TLabel + AnchorSideLeft.Control = PanelHalf + AnchorSideLeft.Side = asrBottom + AnchorSideTop.Control = Edt_PS4SystemService_Language + AnchorSideTop.Side = asrBottom + AnchorSideRight.Control = Tab_PS4System + AnchorSideRight.Side = asrBottom + Left = 210 + Height = 15 + Top = 126 + Width = 169 + Anchors = [akTop, akLeft, akRight] + BorderSpacing.Left = 10 + BorderSpacing.Top = 10 + BorderSpacing.Right = 10 + Caption = 'Time Format:' + end + object Label8: TLabel + AnchorSideLeft.Control = Tab_PS4System + AnchorSideTop.Control = Edt_PS4SystemService_TimeFormat + AnchorSideTop.Side = asrBottom + AnchorSideRight.Control = PanelHalf + Left = 10 + Height = 15 + Top = 184 + Width = 168 + Anchors = [akTop, akLeft, akRight] + BorderSpacing.Left = 10 + BorderSpacing.Top = 10 + BorderSpacing.Right = 10 + Caption = 'Button Assign:' + end + object Edt_PS4SystemService_ButtonAssign: TComboBox + AnchorSideLeft.Control = Tab_PS4System + AnchorSideTop.Control = Label8 + AnchorSideTop.Side = asrBottom + AnchorSideRight.Control = PanelHalf + Left = 10 + Height = 23 + Top = 209 + Width = 168 + Anchors = [akTop, akLeft, akRight] + BorderSpacing.Left = 10 + BorderSpacing.Top = 10 + BorderSpacing.Right = 10 + ItemHeight = 15 + Items.Strings = ( + 'CIRCLE' + 'CROSS' + ) + Style = csDropDownList + TabOrder = 5 + end + object Label9: TLabel + AnchorSideLeft.Control = Tab_PS4System + AnchorSideTop.Control = Tab_PS4System + AnchorSideRight.Control = Tab_PS4System + AnchorSideRight.Side = asrBottom + Left = 10 + Height = 15 + Top = 10 + Width = 369 + Anchors = [akTop, akLeft, akRight] + BorderSpacing.Left = 10 + BorderSpacing.Top = 10 + BorderSpacing.Right = 10 + Caption = 'System Name:' + end + object Label5: TLabel + AnchorSideLeft.Control = Tab_PS4System + AnchorSideTop.Control = Edt_PS4SystemService_SystemName + AnchorSideTop.Side = asrBottom + AnchorSideRight.Control = Tab_PS4System + AnchorSideRight.Side = asrBottom + Left = 10 + Height = 15 + Top = 68 + Width = 369 + Anchors = [akTop, akLeft, akRight] + BorderSpacing.Left = 10 + BorderSpacing.Top = 10 + BorderSpacing.Right = 10 + Caption = 'Language:' + end + object Edt_PS4SystemService_SystemName: TEdit + AnchorSideLeft.Control = Tab_PS4System + AnchorSideTop.Control = Label9 + AnchorSideTop.Side = asrBottom + AnchorSideRight.Control = Tab_PS4System + AnchorSideRight.Side = asrBottom + Left = 10 + Height = 23 + Top = 35 + Width = 369 + Anchors = [akTop, akLeft, akRight] + BorderSpacing.Left = 10 + BorderSpacing.Top = 10 + BorderSpacing.Right = 10 + MaxLength = 65 + TabOrder = 1 + end + end end object BtnCancel: TButton AnchorSideLeft.Control = Owner diff --git a/gui/cfg_edit.pas b/gui/cfg_edit.pas index 0801e2bf..368eb259 100644 --- a/gui/cfg_edit.pas +++ b/gui/cfg_edit.pas @@ -36,6 +36,11 @@ type BtnOk: TButton; BtnLogOpen: TButton; BtnDataOpen: TButton; + Edt_PS4SystemService_SystemName: TEdit; + Edt_PS4SystemService_ButtonAssign: TComboBox; + Edt_PS4SystemService_TimeFormat: TComboBox; + Edt_PS4SystemService_Language: TComboBox; + Edt_PS4SystemService_DateFormat: TComboBox; GrAppFlags: TCheckGroup; Edt_VulkanInfo_device_cmb: TComboBox; Edt_BootparamInfo_halt_on_exit: TCheckBox; @@ -60,6 +65,13 @@ type Label2: TLabel; Label3: TLabel; Label4: TLabel; + Label5: TLabel; + Label6: TLabel; + Label7: TLabel; + Label8: TLabel; + Label9: TLabel; + PanelHalf: TPanel; + Tab_PS4System: TTabSheet; Tab_Vulkan: TTabSheet; Tab_Misc: TTabSheet; Tab_JIT: TTabSheet; @@ -94,7 +106,9 @@ implementation uses TypInfo, - Rtti; + Rtti, + + ps4_libSceSystemService; var FVulkanDeviceInit:Boolean=False; @@ -266,26 +280,26 @@ end; procedure SetText(control:TComponent;const Text:RawByteString); begin - if control.InheritsFrom(TControl) then - begin - TMyControl(control).Text:=Text; - end else if (control is TVulkanDevGuid) then begin TVulkanDevGuid(control).SetText(Text); + end else + if control.InheritsFrom(TControl) then + begin + TMyControl(control).Text:=Text; end; end; function GetText(control:TComponent):RawByteString; begin Result:=''; - if control.InheritsFrom(TControl) then - begin - Result:=TMyControl(control).Text; - end else if (control is TVulkanDevGuid) then begin Result:=TVulkanDevGuid(control).GetText; + end else + if control.InheritsFrom(TControl) then + begin + Result:=TMyControl(control).Text; end; end; @@ -296,6 +310,28 @@ begin if (control is TVulkanAppFlags) then begin TVulkanAppFlags(control).SetInteger(i); + end else + if control.InheritsFrom(TCustomComboBox) then + begin + if (i=-1) then + begin + //preload default + if (control.Name='Edt_PS4SystemService_Language') then + begin + i:=GetHostSystemLang; + end else + if (control.Name='Edt_PS4SystemService_DateFormat') then + begin + i:=GetHostSystemDateFormat; + end else + if (control.Name='Edt_PS4SystemService_TimeFormat') then + begin + i:=GetHostSystemTimeFormat; + end; + //preload default + end; + + TCustomComboBox(control).ItemIndex:=i; end; end; @@ -305,6 +341,10 @@ begin if (control is TVulkanAppFlags) then begin Result:=TVulkanAppFlags(control).GetInteger; + end else + if control.InheritsFrom(TCustomComboBox) then + begin + Result:=TCustomComboBox(control).ItemIndex; end; end; diff --git a/gui/game_info.pas b/gui/game_info.pas index 04a22556..727deafa 100644 --- a/gui/game_info.pas +++ b/gui/game_info.pas @@ -166,19 +166,38 @@ type property app_flags:DWORD read Fapp_flags write Fapp_flags; end; + TPS4SystemService=class(TAbstractObject) + private + FSystemName :RawByteString; + FLanguage :ShortInt; + FDateFormat :ShortInt; + FTimeFormat :ShortInt; + FButtonAssign:Byte; + published + property SystemName :RawByteString read FSystemName write FSystemName; + property Language :ShortInt read FLanguage write FLanguage; + property DateFormat :ShortInt read FDateFormat write FDateFormat; + property TimeFormat :ShortInt read FTimeFormat write FTimeFormat; + property ButtonAssign:Byte read FButtonAssign write FButtonAssign; + public + Constructor Create; override; + end; + TConfigInfo=class(TAbstractObject) private - FMainInfo :TMainInfo; - FBootParamInfo:TBootParamInfo; - FJITInfo :TJITInfo; - FMiscInfo :TMiscInfo; - FVulkanInfo :TVulkanInfo; + FMainInfo :TMainInfo; + FBootParamInfo :TBootParamInfo; + FJITInfo :TJITInfo; + FMiscInfo :TMiscInfo; + FVulkanInfo :TVulkanInfo; + FPS4SystemService:TPS4SystemService; published - property MainInfo :TMainInfo read FMainInfo write FMainInfo; - property BootParamInfo:TBootParamInfo read FBootParamInfo write FBootParamInfo; - property JITInfo :TJITInfo read FJITInfo write FJITInfo; - property MiscInfo :TMiscInfo read FMiscInfo write FMiscInfo; - property VulkanInfo :TVulkanInfo read FVulkanInfo write FVulkanInfo; + property MainInfo :TMainInfo read FMainInfo write FMainInfo; + property BootParamInfo :TBootParamInfo read FBootParamInfo write FBootParamInfo; + property JITInfo :TJITInfo read FJITInfo write FJITInfo; + property MiscInfo :TMiscInfo read FMiscInfo write FMiscInfo; + property VulkanInfo :TVulkanInfo read FVulkanInfo write FVulkanInfo; + property PS4SystemService:TPS4SystemService read FPS4SystemService write FPS4SystemService; end; TGameInfo=class(TAbstractObject) @@ -1056,6 +1075,16 @@ begin Ffork_proc:=True; end; +Constructor TPS4SystemService.Create; +begin + inherited; + FSystemName :='PS4-123'; + FLanguage :=-1; + FDateFormat :=-1; + FTimeFormat :=-1; + FButtonAssign:=1; +end; + Constructor TGameInfo.Create; begin inherited; diff --git a/gui/game_run.pas b/gui/game_run.pas index 8fec0ace..f1c0a023 100644 --- a/gui/game_run.pas +++ b/gui/game_run.pas @@ -173,6 +173,13 @@ begin TryStringToGUID(ConfInfo.VulkanInfo.device,vDevice.VulkanDeviceGuid); vDevice.VulkanAppFlags:=t_vulkan_app_flags(ConfInfo.VulkanInfo.app_flags); + // + + ps4_libSceSystemService.FSystemName :=ConfInfo.PS4SystemService.SystemName; + ps4_libSceSystemService.FLanguage :=ConfInfo.PS4SystemService.Language; + ps4_libSceSystemService.FDateFormat :=ConfInfo.PS4SystemService.DateFormat; + ps4_libSceSystemService.FTimeFormat :=ConfInfo.PS4SystemService.TimeFormat; + ps4_libSceSystemService.FButtonAssign:=ConfInfo.PS4SystemService.ButtonAssign; end; procedure prepare(GameStartupInfo:TGameStartupInfo); SysV_ABI_CDecl; diff --git a/src/ps4_libscesystemservice.pas b/src/ps4_libscesystemservice.pas index cfb8b81d..4405b84f 100644 --- a/src/ps4_libscesystemservice.pas +++ b/src/ps4_libscesystemservice.pas @@ -13,6 +13,13 @@ uses ps4_libSceUserService, ps4_libSceNpCommon; +var + FSystemName :array[0..65] of AnsiChar='PS4-123'#0; + FLanguage :ShortInt=-1; + FDateFormat :ShortInt=-1; + FTimeFormat :ShortInt=-1; + FButtonAssign:Byte=0; + const SCE_SYSTEM_SERVICE_PARAM_ID_LANG =1; SCE_SYSTEM_SERVICE_PARAM_ID_DATE_FORMAT =2; @@ -76,10 +83,10 @@ const SCE_SYSTEM_PARAM_TIME_FORMAT_12HOUR=0; SCE_SYSTEM_PARAM_TIME_FORMAT_24HOUR=1; - // + // System name SCE_SYSTEM_SERVICE_MAX_SYSTEM_NAME_LENGTH=65; - // + // Game parental level SCE_SYSTEM_PARAM_GAME_PARENTAL_OFF =0; SCE_SYSTEM_PARAM_GAME_PARENTAL_LEVEL01=1; SCE_SYSTEM_PARAM_GAME_PARENTAL_LEVEL02=2; @@ -93,7 +100,7 @@ const SCE_SYSTEM_PARAM_GAME_PARENTAL_LEVEL10=10; SCE_SYSTEM_PARAM_GAME_PARENTAL_LEVEL11=11; - // + // Enter button assign SCE_SYSTEM_PARAM_ENTER_BUTTON_ASSIGN_CIRCLE=0; SCE_SYSTEM_PARAM_ENTER_BUTTON_ASSIGN_CROSS =1; @@ -126,6 +133,10 @@ const SCE_SYSTEM_SERVICE_EVENT_OPEN_SHARE_MENU = $30000000; SCE_SYSTEM_SERVICE_EVENT_UNIFIED_ENTITLEMENT_UPDATE = $10000018; +function GetHostSystemLang:Byte; +function GetHostSystemDateFormat:Byte; +function GetHostSystemTimeFormat:Byte; + function ps4_sceSystemServiceParamGetInt(paramId:Integer;value:Pinteger):Integer; implementation @@ -205,15 +216,14 @@ type end; end; -function GetHostSystemLang:Integer; +//// +function GetHostSystemLang:Byte; var info:DWORD; begin Result:=SCE_SYSTEM_PARAM_LANG_ENGLISH_US; - sig_lock; info:=GetThreadLocale; - sig_unlock; info:=info and $FFFF; @@ -280,16 +290,14 @@ begin end; end; -function GetHostSystemDateFormat:Integer; +function GetHostSystemDateFormat:Byte; var Format:array[0..0] of AnsiChar; begin Result:=0; Format[0]:=#0; - sig_lock; GetLocaleInfo(LOCALE_USER_DEFAULT,LOCALE_ILDATE,@Format,1); - sig_unlock; Case Format[0] of '0':Result:=SCE_SYSTEM_PARAM_DATE_FORMAT_MMDDYYYY; @@ -298,22 +306,21 @@ begin end; end; -function GetHostSystemTimeFormat:Integer; +function GetHostSystemTimeFormat:Byte; var Format:array[0..0] of AnsiChar; begin Result:=0; Format[0]:=#0; - sig_lock; GetLocaleInfo(LOCALE_USER_DEFAULT,LOCALE_ILDATE,@Format,1); - sig_unlock; Case Format[0] of '0':Result:=SCE_SYSTEM_PARAM_TIME_FORMAT_12HOUR; '1':Result:=SCE_SYSTEM_PARAM_TIME_FORMAT_24HOUR; end; end; +//// function ps4_sceSystemServiceParamGetInt(paramId:Integer;value:Pinteger):Integer; var @@ -327,17 +334,32 @@ begin Case paramId of SCE_SYSTEM_SERVICE_PARAM_ID_LANG: begin - value^:=GetHostSystemLang; + if (FLanguage=-1) then + begin + FLanguage:=GetHostSystemLang; + end; + // + value^:=FLanguage; end; SCE_SYSTEM_SERVICE_PARAM_ID_DATE_FORMAT: begin - value^:=GetHostSystemDateFormat; + if (FDateFormat=-1) then + begin + FDateFormat:=GetHostSystemDateFormat; + end; + // + value^:=FDateFormat; end; SCE_SYSTEM_SERVICE_PARAM_ID_TIME_FORMAT: begin - value^:=GetHostSystemTimeFormat; + if (FTimeFormat=-1) then + begin + FTimeFormat:=GetHostSystemTimeFormat; + end; + // + value^:=FTimeFormat; end; SCE_SYSTEM_SERVICE_PARAM_ID_TIME_ZONE: @@ -352,27 +374,42 @@ begin value^:=z.tz_dsttime; end; - SCE_SYSTEM_SERVICE_PARAM_ID_SYSTEM_NAME:; - SCE_SYSTEM_SERVICE_PARAM_ID_GAME_PARENTAL_LEVEL:value^:=SCE_SYSTEM_PARAM_GAME_PARENTAL_OFF; - SCE_SYSTEM_SERVICE_PARAM_ID_ENTER_BUTTON_ASSIGN:value^:=SCE_SYSTEM_PARAM_ENTER_BUTTON_ASSIGN_CROSS; + SCE_SYSTEM_SERVICE_PARAM_ID_SYSTEM_NAME:; //error + + SCE_SYSTEM_SERVICE_PARAM_ID_GAME_PARENTAL_LEVEL: + begin + value^:=SCE_SYSTEM_PARAM_GAME_PARENTAL_OFF; + end; + + SCE_SYSTEM_SERVICE_PARAM_ID_ENTER_BUTTON_ASSIGN: + begin + value^:=FButtonAssign; + end else Exit(SCE_SYSTEM_SERVICE_ERROR_PARAMETER); end; end; -const - SYSTEM_NAME='PS4-123'#0; - function ps4_sceSystemServiceParamGetString(paramId:Integer;buf:Pchar;bufSize:size_t):Integer; +var + len:Integer; begin if (buf=nil) then Exit(SCE_SYSTEM_SERVICE_ERROR_PARAMETER); Case paramId of SCE_SYSTEM_SERVICE_PARAM_ID_SYSTEM_NAME: begin - if (bufSize