diff --git a/fpPS4.lpr b/fpPS4.lpr index 0997943e..d4c28dd6 100644 --- a/fpPS4.lpr +++ b/fpPS4.lpr @@ -12,6 +12,7 @@ uses sys_crt, sys_types, sys_pthread, + sys_path, ps4libdoc, ps4_libSceScreenShot, ps4_libSceRtc, @@ -65,7 +66,8 @@ begin Writeln('PS4 compatibility layer (emulator) on Free Pascal '+{$I %FPCVERSION%}); Writeln(' Parameters:'); Writeln(' -e //decrypted elf or self file name'); - Writeln(' -f //folder of app'); + Writeln(' -f //folder of app (/app0)'); + Writeln(' -p //folder of patch (/app1)'); Writeln(' -s //savedata path'); Writeln(' -h //enable hack'); @@ -84,29 +86,34 @@ begin case LowerCase(ParamStr(i)) of '-e':n:=0; '-f':n:=1; - '-s':n:=2; - '-h':n:=3; + '-p':n:=2; + '-s':n:=3; + '-h':n:=4; else if (n<>-1) then begin Case n of 0:begin - if (ps4_app.app_file<>'') then Goto promo; - ps4_app.app_file:=Trim(ParamStr(i)); - if (ps4_app.app_path='') then + if (ps4_app.app0_file<>'') then Goto promo; + ps4_app.app0_file:=Trim(ParamStr(i)); + if (ps4_app.app0_path='') then begin - ps4_app.app_path:=ExtractFileDir(ps4_app.app_file); - if (ExcludeLeadingPathDelimiter(ps4_app.app_path)='') then ps4_app.app_path:=GetCurrentDir; + ps4_app.app0_path:=ExtractFileDir(ps4_app.app0_file); + if (ExcludeLeadingPathDelimiter(ps4_app.app0_path)='') then ps4_app.app0_path:=GetCurrentDir; end; end; 1:begin - ps4_app.app_path:=Trim(ParamStr(i)); - if (ExcludeLeadingPathDelimiter(ps4_app.app_path)='') then ps4_app.app_path:=GetCurrentDir; + ps4_app.app0_path:=Trim(ParamStr(i)); + if (ExcludeLeadingPathDelimiter(ps4_app.app0_path)='') then ps4_app.app0_path:=GetCurrentDir; end; 2:begin - ps4_app.save_path:=Trim(ParamStr(i)); + ps4_app.app1_path:=Trim(ParamStr(i)); + if (ExcludeLeadingPathDelimiter(ps4_app.app1_path)='') then ps4_app.app1_path:=GetCurrentDir; end; 3:begin + ps4_app.save_path:=Trim(ParamStr(i)); + end; + 4:begin case UpperCase(ParamStr(i)) of 'DEPTH_DISABLE_HACK' :ps4_videodrv.DEPTH_DISABLE_HACK:=True; 'COMPUTE_DISABLE_HACK':ps4_videodrv.COMPUTE_DISABLE_HACK:=True; @@ -122,18 +129,31 @@ begin end; end; - if (ps4_app.app_file='') or (ps4_app.app_path='') or (ps4_app.save_path='') then Goto promo; + if (ps4_app.app0_file='') or (ps4_app.app0_path='') or (ps4_app.save_path='') then Goto promo; - if not FileExists(ps4_app.app_file) then + if (ps4_app.app1_path=ps4_app.app0_path) then begin - Writeln(StdErr,'File not found:',ps4_app.app_file); + ps4_app.app1_path:=''; + end; + + if not FileExists(ps4_app.app0_file) then + begin + Writeln(StdErr,'File not found:',ps4_app.app0_file); Writeln; Goto promo; end; - if not DirectoryExists(ps4_app.app_path) then + if not DirectoryExists(ps4_app.app0_path) then begin - Writeln(StdErr,'Path not found:',ps4_app.app_path); + Writeln(StdErr,'Path not found:',ps4_app.app0_path); + Writeln; + Goto promo; + end; + + if (ps4_app.app1_path<>'') then + if not DirectoryExists(ps4_app.app1_path) then + begin + Writeln(StdErr,'Path not found:',ps4_app.app1_path); Writeln; Goto promo; end; @@ -397,6 +417,8 @@ begin 'sceFiosIOFilterPsarcDearchiver':; 'sceFiosFHReadSync':; 'sceFiosFHTell':; + 'sceNgs2VoiceGetState':; + 'sceNgs2SystemRender':; 'sceAudioOutOutputs':; '__tls_get_addr':; 'scePthreadRwlockRdlock':; @@ -458,17 +480,38 @@ begin end; var - elf:Telf_file; - //i:Integer; - //F:THandle; - main:pthread; -//label -// _lab; - {$R *.res} +procedure LoadProgram; +var + elf:Telf_file; + f:RawByteString; +begin + elf:=nil; + + if (ps4_app.app1_path<>'') then + begin + //first try patch + f:=''; + if (parse_filename('/app1/eboot.bin',f)=PT_FILE) then + begin + elf:=Telf_file(LoadPs4ElfFromFile(f)); + end; + end; + + if (elf=nil) then + begin + //second try app0_file + elf:=Telf_file(LoadPs4ElfFromFile(ps4_app.app0_file)); + end; + + Assert(elf<>nil,'program not loaded!'); + + ps4_app.prog:=elf; +end; + begin DefaultSystemCodePage:=CP_UTF8; DefaultUnicodeCodePage:=CP_UTF8; @@ -679,6 +722,9 @@ begin //ps4_app.app_path:='G:\Games\ps4-homebrew\TEST_PAD\'; //ps4_app.app_file:='G:\Games\ps4-homebrew\TEST_PAD\eboot.bin'; + //ps4_app.app_path:='C:\Users\User\Desktop\Games\ps4-homebrew\TEST_PAD\'; + //ps4_app.app_file:='C:\Users\User\Desktop\Games\ps4-homebrew\TEST_PAD\eboot.bin'; + //ps4_app.app_path:='G:\Games\Castlevania\SLUS00067\'; //ps4_app.app_file:='G:\Games\Castlevania\SLUS00067\eboot.bin'; @@ -736,18 +782,41 @@ begin //ps4_app.app_path:='C:\Users\User\Desktop\Games\namco\uroot\'; //ps4_app.app_file:='C:\Users\User\Desktop\Games\namco\uroot\eboot.bin'; + //ps4_app.app_path:='C:\Users\User\Desktop\Games\ps4-homebrew\PS4-Xplorer\'; + //ps4_app.app_file:='C:\Users\User\Desktop\Games\ps4-homebrew\PS4-Xplorer\eboot.bin'; + + //ps4_app.app_path:='C:\Users\User\Desktop\Games\Chronicles_of_Teddy_Harmony_of_Exidus\CUSA03328\'; + //ps4_app.app_file:='C:\Users\User\Desktop\Games\Chronicles_of_Teddy_Harmony_of_Exidus\CUSA03328\eboot.bin'; + + //ps4_app.app_path:='C:\Users\User\Desktop\Games\Another_World\CUSA00602\'; + //ps4_app.app_file:='C:\Users\User\Desktop\Games\Another_World\CUSA00602\eboot.bin'; + + //ps4_app.app_path:='C:\Users\User\Desktop\Games\Dino.Dinis.Kick.Off.Revival\CUSA03453\'; + //ps4_app.app_file:='C:\Users\User\Desktop\Games\Dino.Dinis.Kick.Off.Revival\CUSA03453\eboot.bin'; + + //ps4_app.app_path:='C:\Users\User\Desktop\Games\Cat.Quest\CUSA09499\'; + //ps4_app.app_file:='C:\Users\User\Desktop\Games\Cat.Quest\CUSA09499\eboot.bin'; + + //ps4_app.app_path:='C:\Users\User\Desktop\Games\Kitten.Squad\CUSA04801\'; + //ps4_app.app_file:='C:\Users\User\Desktop\Games\Kitten.Squad\CUSA04801\eboot.bin'; + + //ps4_app.app_path:='C:\Users\User\Desktop\Games\Mitsurugi.Kamui.Hikae\CUSA02166\'; + //ps4_app.app_file:='C:\Users\User\Desktop\Games\Mitsurugi.Kamui.Hikae\CUSA02166\eboot.bin'; + + //ps4_app.app_path:='C:\Users\User\Desktop\Games\Prison_Architect\CUSA03487\'; + //ps4_app.app_file:='C:\Users\User\Desktop\Games\Prison_Architect\CUSA03487\eboot.bin'; + + //ps4_app.app_path:='C:\Users\User\Desktop\Games\Pumped.BMX.Plus.PS4-PRELUDE\CUSA02589\'; + //ps4_app.app_file:='C:\Users\User\Desktop\Games\Pumped.BMX.Plus.PS4-PRELUDE\CUSA02589\eboot.bin'; + ps4_app.resolve_cb:=@ResolveImport; ps4_app.reload_cb :=@ReloadImport; - elf:=Telf_file(LoadPs4ElfFromFile(ps4_app.app_file)); - Assert(elf<>nil); + LoadProgram; + ps4_app.prog.Prepare; - ps4_app.prog:=elf; - - elf.Prepare; - - ps4_app.RegistredElf(elf); - ps4_app.ResolveDepended(elf); + ps4_app.RegistredElf (ps4_app.prog); + ps4_app.ResolveDepended (ps4_app.prog); ps4_app.LoadSymbolImport(nil); @@ -756,9 +825,6 @@ begin _pthread_run_entry(@main,GetSceUserMainThreadName,GetSceUserMainThreadStackSize); - //ps4_app.InitCode; - //elf.mapCodeEntry; - ps4_libSceVideoOut.App_Run; //KillALLThreads TODO diff --git a/kernel/ps4_kernel_file.pas b/kernel/ps4_kernel_file.pas index a4ab77c5..6d569912 100644 --- a/kernel/ps4_kernel_file.pas +++ b/kernel/ps4_kernel_file.pas @@ -338,9 +338,12 @@ begin rp:=''; Result:=parse_filename(path,rp); - if (Result<>0) then - begin - Exit(-EACCES); + Case Result of + PT_ROOT:Exit(-EACCES); //TODO + PT_FILE:; + PT_DEV :Exit(-EACCES); //TODO + else + Exit(-EACCES); end; wp:=UTF8Decode(rp); @@ -1037,9 +1040,19 @@ begin rp:=''; Result:=parse_filename(path,rp); - if (Result<>0) then - begin - Exit(EACCES); + Case Result of + PT_ROOT:Exit(-EACCES); //TODO + PT_FILE:; + PT_DEV : + begin + stat^.st_dev :=1; + stat^.st_rdev :=1; + stat^.st_mode :=S_IFCHR; + stat^.st_nlink:=1; + Exit(0); + end + else + Exit(-EACCES); end; hfi:=Default(WIN32_FILE_ATTRIBUTE_DATA); @@ -1114,9 +1127,12 @@ begin fn:=''; Result:=parse_filename(path,fn); - if (Result<>0) then - begin - Exit(EACCES); + Case Result of + PT_ROOT:Exit(-EACCES); //TODO + PT_FILE:; + PT_DEV :Exit(-EACCES); + else + Exit(-EACCES); end; err:=SwCreateDir(fn); @@ -1192,9 +1208,12 @@ begin Result:=parse_filename(path,fn); _sig_unlock; - if (Result<>0) then - begin - Exit(_set_sce_errno(px2sce(EACCES))); + Case Result of + PT_ROOT:Exit(_set_sce_errno(0)); + PT_FILE:; + PT_DEV :Exit(_set_sce_errno(0)); + else + Exit(_set_sce_errno(px2sce(EACCES))); end; if FileExists(fn) or DirectoryExists(fn) then diff --git a/kernel/ps4_libkernel.pas b/kernel/ps4_libkernel.pas index 0e3216aa..fb341191 100644 --- a/kernel/ps4_libkernel.pas +++ b/kernel/ps4_libkernel.pas @@ -412,9 +412,10 @@ begin Result:=parse_filename(moduleFileName,fn); - if (Result<>0) then - begin - Exit(SCE_KERNEL_ERROR_EACCES); + Case Result of + PT_FILE:; + else + Exit(_set_sce_errno(SCE_KERNEL_ERROR_EACCES)); end; node:=ps4_app.AcqureFileByName(ExtractFileName(fn)); @@ -462,6 +463,8 @@ begin begin Result:=SCE_KERNEL_ERROR_ENOENT; end; + + _set_sce_errno(Result); end; function ps4_sceKernelLoadStartModule(moduleFileName:Pchar; diff --git a/ps4_program.pas b/ps4_program.pas index c1130946..dcd456e9 100644 --- a/ps4_program.pas +++ b/ps4_program.pas @@ -130,8 +130,9 @@ type resolve_cb:Pointer; reload_cb:Pointer; prog:TElf_node; - app_file:RawByteString; - app_path:RawByteString; + app0_file:RawByteString; + app0_path:RawByteString; + app1_path:RawByteString; save_path:RawByteString; private pre_load:Thamt64locked_proc; @@ -1011,12 +1012,21 @@ begin if sce_load_filter(name) then begin - Result:=TryLoadElf(app_path,name); - if (Result<>nil) then //is default load app_path\sce_module + Result:=TryLoadElf(app1_path,name); + if (Result<>nil) then //is default load app1_path\sce_module begin Result.Prepare; ps4_app.RegistredElf(Result); Exit; + end else + begin + Result:=TryLoadElf(app0_path,name); + if (Result<>nil) then //is default load app0_path\sce_module + begin + Result.Prepare; + ps4_app.RegistredElf(Result); + Exit; + end; end; end; diff --git a/spirv/emit_mimg.pas b/spirv/emit_mimg.pas index 426d7668..9e3d316d 100644 --- a/spirv/emit_mimg.pas +++ b/spirv/emit_mimg.pas @@ -20,7 +20,7 @@ uses type TEmit_MIMG=class(TEmitFetch) procedure emit_MIMG; - procedure DistribDmask(dst:PsrRegNode;telem:TsrDataType); + procedure DistribDmask(dst:PsrRegNode;info:PsrImageInfo); function GatherDmask(telem:TsrDataType):PsrRegNode; Function GatherCoord_f(var offset:DWORD;dim_id:Byte):PsrRegNode; Function GatherCoord_u(var offset:DWORD;dim_id:Byte):PsrRegNode; @@ -374,7 +374,82 @@ begin Result.tinfo.Format :=GetImageFormat(PT); end; -procedure TEmit_MIMG.DistribDmask(dst:PsrRegNode;telem:TsrDataType); //result +type + TsrImageMods=Set Of (imMinLod,imGrad,imLod,imBiasLod,imZeroLod,imDref,imOffset); + +function GetImageMods(OP:Byte):TsrImageMods; +begin + Case OP of + IMAGE_SAMPLE_CL :Result:=[imMinLod]; + IMAGE_SAMPLE_D :Result:=[imGrad]; + IMAGE_SAMPLE_D_CL :Result:=[imGrad,imMinLod]; + IMAGE_SAMPLE_L :Result:=[imLod]; + IMAGE_SAMPLE_B :Result:=[imBiasLod]; + IMAGE_SAMPLE_B_CL :Result:=[imBiasLod,imMinLod]; + IMAGE_SAMPLE_LZ :Result:=[imZeroLod]; + IMAGE_SAMPLE_C :Result:=[imDref]; + IMAGE_SAMPLE_C_CL :Result:=[imDref,imMinLod]; + IMAGE_SAMPLE_C_D :Result:=[imDref,imGrad]; + IMAGE_SAMPLE_C_D_CL :Result:=[imDref,imGrad,imMinLod]; + IMAGE_SAMPLE_C_L :Result:=[imDref,imLod]; + IMAGE_SAMPLE_C_B :Result:=[imDref,imBiasLod]; + IMAGE_SAMPLE_C_B_CL :Result:=[imDref,imBiasLod,imMinLod]; + IMAGE_SAMPLE_C_LZ :Result:=[imDref,imZeroLod]; + IMAGE_SAMPLE_O :Result:=[imOffset]; + IMAGE_SAMPLE_CL_O :Result:=[imMinLod,imOffset]; + IMAGE_SAMPLE_D_O :Result:=[imGrad,imOffset]; + IMAGE_SAMPLE_D_CL_O :Result:=[imGrad,imMinLod,imOffset]; + IMAGE_SAMPLE_L_O :Result:=[imLod,imOffset]; + IMAGE_SAMPLE_B_O :Result:=[imBiasLod,imOffset]; + IMAGE_SAMPLE_B_CL_O :Result:=[imBiasLod,imMinLod,imOffset]; + IMAGE_SAMPLE_LZ_O :Result:=[imZeroLod,imOffset]; + IMAGE_SAMPLE_C_O :Result:=[imDref,imOffset]; + IMAGE_SAMPLE_C_CL_O :Result:=[imDref,imMinLod,imOffset]; + IMAGE_SAMPLE_C_D_O :Result:=[imDref,imGrad,imOffset]; + IMAGE_SAMPLE_C_D_CL_O :Result:=[imDref,imGrad,imMinLod,imOffset]; + IMAGE_SAMPLE_C_L_O :Result:=[imDref,imLod,imOffset]; + IMAGE_SAMPLE_C_B_O :Result:=[imDref,imBiasLod,imOffset]; + IMAGE_SAMPLE_C_B_CL_O :Result:=[imDref,imBiasLod,imMinLod,imOffset]; + IMAGE_SAMPLE_C_LZ_O :Result:=[imDref,imZeroLod,imOffset]; + // + IMAGE_GATHER4_CL :Result:=[imMinLod]; + IMAGE_GATHER4_L :Result:=[imLod]; + IMAGE_GATHER4_B :Result:=[imBiasLod]; + IMAGE_GATHER4_B_CL :Result:=[imBiasLod,imMinLod]; + IMAGE_GATHER4_LZ :Result:=[imZeroLod]; + IMAGE_GATHER4_C :Result:=[imDref]; + IMAGE_GATHER4_C_CL :Result:=[imDref,imMinLod]; + IMAGE_GATHER4_C_L :Result:=[imDref,imLod]; + IMAGE_GATHER4_C_B :Result:=[imDref,imBiasLod]; + IMAGE_GATHER4_C_B_CL :Result:=[imDref,imBiasLod,imMinLod]; + IMAGE_GATHER4_C_LZ :Result:=[imDref,imMinLod]; + IMAGE_GATHER4_O :Result:=[imOffset]; + IMAGE_GATHER4_CL_O :Result:=[imMinLod,imOffset]; + IMAGE_GATHER4_L_O :Result:=[imLod,imOffset]; + IMAGE_GATHER4_B_O :Result:=[imBiasLod,imOffset]; + IMAGE_GATHER4_B_CL_O :Result:=[imBiasLod,imMinLod,imOffset]; + IMAGE_GATHER4_LZ_O :Result:=[imZeroLod,imOffset]; + IMAGE_GATHER4_C_O :Result:=[imDref,imOffset]; + IMAGE_GATHER4_C_CL_O :Result:=[imDref,imMinLod,imOffset]; + IMAGE_GATHER4_C_L_O :Result:=[imDref,imLod,imOffset]; + IMAGE_GATHER4_C_B_O :Result:=[imDref,imBiasLod,imOffset]; + IMAGE_GATHER4_C_B_CL_O:Result:=[imDref,imBiasLod,imMinLod,imOffset]; + IMAGE_GATHER4_C_LZ_O :Result:=[imDref,imZeroLod,imOffset]; + // + IMAGE_SAMPLE_CD :Result:=[imGrad]; + IMAGE_SAMPLE_CD_CL :Result:=[imGrad,imMinLod]; + IMAGE_SAMPLE_C_CD :Result:=[imDref,imGrad]; + IMAGE_SAMPLE_C_CD_CL :Result:=[imDref,imGrad,imMinLod]; + IMAGE_SAMPLE_CD_O :Result:=[imGrad,imOffset]; + IMAGE_SAMPLE_CD_CL_O :Result:=[imGrad,imMinLod,imOffset]; + IMAGE_SAMPLE_C_CD_O :Result:=[imDref,imGrad,imOffset]; + IMAGE_SAMPLE_C_CD_CL_O:Result:=[imDref,imGrad,imMinLod,imOffset]; + else + Result:=[]; + end; +end; + +procedure TEmit_MIMG.DistribDmask(dst:PsrRegNode;info:PsrImageInfo); //result var pSlot:PsrRegSlot; i,d:Byte; @@ -386,7 +461,21 @@ begin pSlot:=get_vdst8(FSPI.MIMG.VDATA+d); Inc(d); Assert(pSlot<>nil); - OpExtract(line,pSlot^.New(line,telem),dst,i); + + if (info^.tinfo.Depth=1) then + begin + if (i=0) then + begin + MakeCopy(pSlot,dst); + end else + begin + SetConst_i(pSlot,info^.dtype,0); + end; + end else + begin + OpExtract(line,pSlot^.New(line,info^.dtype),dst,i); + end; + end; end; @@ -564,7 +653,13 @@ begin cmb:=OpSampledImage(line,Tgrp,Sgrp,info^.dtype,info^.tinfo); - dst:=NewReg(info^.dtype.AsVector(4)); + if (info^.tinfo.Depth=1) then + begin + dst:=NewReg(info^.dtype); + end else + begin + dst:=NewReg(info^.dtype.AsVector(4)); + end; roffset:=0; @@ -633,7 +728,7 @@ begin Assert(false,'MIMG?'+IntToStr(FSPI.MIMG.OP)); end; - DistribDmask(dst,info^.dtype); + DistribDmask(dst,info); end; procedure TEmit_MIMG.emit_image_load(Tgrp:PsrNode;info:PsrImageInfo); @@ -679,7 +774,7 @@ begin Assert(false,'MIMG?'+IntToStr(FSPI.MIMG.OP)); end; - DistribDmask(dst,info^.dtype); + DistribDmask(dst,info); end; procedure TEmit_MIMG.emit_image_store(Tgrp:PsrNode;info:PsrImageInfo); @@ -753,6 +848,11 @@ begin info:=GetImageInfo(pLayout^.pData); + if (imDref in GetImageMods(FSPI.MIMG.OP)) then + begin + info.tinfo.Depth:=1; + end; + Case FSPI.MIMG.OP of IMAGE_SAMPLE..IMAGE_SAMPLE_C_LZ_O: //sampled begin diff --git a/sys/sys_path.pas b/sys/sys_path.pas index d797e5c7..0925d5b3 100644 --- a/sys/sys_path.pas +++ b/sys/sys_path.pas @@ -11,6 +11,12 @@ uses ps4_program, sys_kernel; +const + PT_ERR=-1; + PT_ROOT=0; + PT_FILE=1; + PT_DEV =2; + Function FetchSaveMount(path,point:PChar;mode:Integer):Integer; Function UnMountSavePath(path:PChar):Integer; @@ -108,13 +114,14 @@ begin if (Result='') or (not IsSep(Result[Length(Result)])) then Result:=Result+DirectorySeparator; end; -function PathConcat(Path,filename:RawByteString):RawByteString; +function PathConcat(Path,filename:RawByteString;var r:RawByteString):Integer; begin Path:=Trim(Path); - If (Path='') then Exit(''); + If (Path='') then Exit(PT_ERR); if (not IsSep(Path[Length(Path)])) then Path:=Path+DirectorySeparator; DoDirSeparators(filename); - Result:=Path+filename; + r:=Path+filename; + Result:=PT_FILE; end; Function FetchSaveMount(path,point:PChar;mode:Integer):Integer; @@ -258,46 +265,58 @@ end; // /savedata0 // /savedata15 -function MountSaveConcat(id:Byte;const filename:RawByteString):RawByteString; +function MountSaveConcat(id:Byte;const filename:RawByteString;var r:RawByteString):Integer; var s:RawByteString; begin s:=GetSaveMount(id); - if (s='') then Exit(''); + if (s='') then Exit(PT_ERR); s:=IncludeTrailingPathDelimiter(ps4_app.save_path)+s; - Result:=PathConcat(s,filename); + Result:=PathConcat(s,filename,r); end; const - P_ERR =-1; - P_NEXT =0; - P_MOUNT=1; + PT_NEXT=PT_ROOT; -function _parse_cast(var pp,fp:PChar;var Path:RawByteString):Integer; +function _parse_cast(var pp,fp:PChar;var r:RawByteString):Integer; begin - Result:=P_NEXT; + Result:=PT_NEXT; Case (fp-pp) of - 0:pp:=fp+1; //next + 0:if (fp^<>#0) then pp:=fp+1; //next 3:Case (PDWORD(pp)^ and $00FFFFFF) of $00766564: //dev begin if (fp^<>#0) then Inc(fp); - Result:=P_ERR; //TODO + r:=fp; + Result:=PT_DEV; end; else - Result:=P_ERR; + Result:=PT_ERR; end; 4:Case PDWORD(pp)^ of $30707061: //app0 begin if (fp^<>#0) then Inc(fp); - Path:=PathConcat(ps4_app.app_path,fp); - Result:=P_MOUNT; + + //easy way to patch apply + Result:=PathConcat(ps4_app.app1_path,fp,r); + if (Result<>PT_ERR) then + if FileExists(r) then + begin + Exit; //done + end; + + Result:=PathConcat(ps4_app.app0_path,fp,r); + end; + $31707061: //app1 + begin + if (fp^<>#0) then Inc(fp); + Result:=PathConcat(ps4_app.app1_path,fp,r); end; else - Result:=P_ERR; + Result:=PT_ERR; end; 9:Case PQWORD(pp)^ of $6174616465766173: //savedata @@ -306,15 +325,14 @@ begin '0'..'9': begin if (fp^<>#0) then Inc(fp); - Path:=MountSaveConcat(ord((pp+8)^)-ord('0'),fp); - Result:=P_MOUNT; + Result:=MountSaveConcat(ord((pp+8)^)-ord('0'),fp,r); end; else - Result:=P_ERR; + Result:=PT_ERR; end; end; else - Result:=P_ERR; + Result:=PT_ERR; end; 10:Case PQWORD(pp)^ of $6174616465766173: //savedata @@ -328,20 +346,19 @@ begin $3531: //15 begin if (fp^<>#0) then Inc(fp); - Path:=MountSaveConcat(ord((pp+9)^)-ord('0')+10,fp); - Result:=P_MOUNT; + Result:=MountSaveConcat(ord((pp+9)^)-ord('0')+10,fp,r); end; else - Result:=P_ERR; + Result:=PT_ERR; end; end; else - Result:=P_ERR; + Result:=PT_ERR; end; else begin //Writeln((fp-pp),'*',fp,'*',pp); - Result:=P_ERR; + Result:=PT_ERR; end; end; end; @@ -366,23 +383,14 @@ begin Case fp^ of '/': begin - Case _parse_cast(pp,fp,r) of - P_MOUNT:Exit(0); //mapped - P_ERR :Exit(EACCES); //not mapped - else; - //next char - end; + Result:=_parse_cast(pp,fp,r); + if (Result<>PT_NEXT) then Exit; end; end; Inc(fp); end; - Case _parse_cast(pp,fp,r) of - P_MOUNT:Exit(0); //mapped - else; - Exit(EACCES); //not mapped - end; - + Result:=_parse_cast(pp,fp,r); end; initialization