File tree Expand file tree Collapse file tree 6 files changed +98
-1
lines changed
Expand file tree Collapse file tree 6 files changed +98
-1
lines changed Original file line number Diff line number Diff line change @@ -31,6 +31,16 @@ public static class CommonStepInputs
3131 Placeholder = "(leave empty to randomize)" ,
3232 } ;
3333
34+ internal static readonly StepInput ElfInput = new ( "elf-input" , "Input .ELF" , StepInputType . OpenFile )
35+ {
36+ Placeholder = @"C:\path\to\EBOOT.elf" ,
37+ } ;
38+
39+ internal static readonly StepInput ElfOutput = new ( "elf-output" , "Output .ELF" , StepInputType . SaveFile )
40+ {
41+ Placeholder = @"C:\path\to\EBOOT.elf" ,
42+ } ;
43+
3444 // TODO: Cache the last used location for easier entry
3545 private static string ? DetermineDefaultRpcs3Path ( )
3646 {
Original file line number Diff line number Diff line change 1+ using Refresher . Core . Pipelines . Steps ;
2+
3+ namespace Refresher . Core . Pipelines ;
4+
5+ public class ElfToElfPatchPipeline : Pipeline
6+ {
7+ public override string Id => "elf-elf-patch" ;
8+ public override string Name => ".elf->.elf Patch" ;
9+
10+ protected override List < Type > StepTypes =>
11+ [
12+ typeof ( InputElfStep ) ,
13+
14+ typeof ( PrepareEbootPatcherAndVerifyStep ) ,
15+ typeof ( ApplyPatchToEbootStep ) ,
16+
17+ typeof ( OutputElfStep ) ,
18+ ] ;
19+ }
Original file line number Diff line number Diff line change 1+ using Refresher . Core . Patching ;
2+
3+ namespace Refresher . Core . Pipelines . Steps ;
4+
5+ public class InputElfStep : Step
6+ {
7+ public InputElfStep ( Pipeline pipeline ) : base ( pipeline )
8+ { }
9+
10+ public override List < StepInput > Inputs =>
11+ [
12+ CommonStepInputs . ElfInput ,
13+ ] ;
14+
15+ public override float Progress { get ; protected set ; }
16+ public override Task ExecuteAsync ( CancellationToken cancellationToken = default )
17+ {
18+ string elfInput = this . Inputs . First ( ) . GetValueFromPipeline ( this . Pipeline ) ;
19+ if ( ! File . Exists ( elfInput ) )
20+ throw new FileNotFoundException ( "The Input .ELF could not be found." ) ;
21+
22+ string temp = Path . GetTempFileName ( ) ;
23+
24+ {
25+ using FileStream write = File . OpenWrite ( temp ) ;
26+ using FileStream read = File . OpenRead ( elfInput ) ;
27+ read . CopyTo ( write ) ;
28+ }
29+
30+ this . Pipeline . GameInformation = new GameInformation
31+ {
32+ DecryptedEbootPath = temp ,
33+ Name = Path . GetFileName ( elfInput ) ,
34+ TitleId = "UNKN12345" ,
35+ } ;
36+
37+ return Task . CompletedTask ;
38+ }
39+ }
Original file line number Diff line number Diff line change 1+ namespace Refresher . Core . Pipelines . Steps ;
2+
3+ public class OutputElfStep : Step
4+ {
5+ public OutputElfStep ( Pipeline pipeline ) : base ( pipeline )
6+ { }
7+
8+ public override List < StepInput > Inputs =>
9+ [
10+ CommonStepInputs . ElfOutput ,
11+ ] ;
12+
13+ public override float Progress { get ; protected set ; }
14+ public override Task ExecuteAsync ( CancellationToken cancellationToken = default )
15+ {
16+ string elfOutput = this . Inputs . First ( ) . GetValueFromPipeline ( this . Pipeline ) ;
17+ // if (File.Exists(elfOutput))
18+ // TODO: ask user if they want to replace
19+
20+ File . Copy ( this . Game . DecryptedEbootPath ! , Path . GetFullPath ( elfOutput ) ) ;
21+
22+ return Task . CompletedTask ;
23+ }
24+ }
Original file line number Diff line number Diff line change @@ -24,10 +24,13 @@ public class MainForm : RefresherForm
2424 this . PipelineButton < PatchworkRPCS3ConfigPipeline > ( "Reconfigure Patch for RPCS3" ) ,
2525
2626 new Label { Text = "General (for non-LBP games):" } ,
27- new Button ( ( _ , _ ) => this . ShowChild < FilePatchForm > ( ) ) { Text = "File Patch (using a .ELF)" } ,
2827 this . PipelineButton < RPCS3PatchPipeline > ( "Patch any RPCS3 game" ) ,
2928 this . PipelineButton < PS3PatchPipeline > ( "Patch any PS3 game" ) ,
3029
30+ new Label { Text = "Advanced (for experts):" } ,
31+ new Button ( ( _ , _ ) => this . ShowChild < FilePatchForm > ( ) ) { Text = "File Patch (using a .ELF)" } ,
32+ this . PipelineButton < ElfToElfPatchPipeline > ( ".elf->.elf Patch" ) ,
33+
3134 #if DEBUG
3235 new Label { Text = "Debugging options:" } ,
3336 this . PipelineButton < ExamplePipeline > ( "Example Pipeline" ) ,
Original file line number Diff line number Diff line change @@ -144,6 +144,8 @@ private void InitializePipeline()
144144 row = AddField < TextBox > ( input , value ) ;
145145 break ;
146146 case StepInputType . Directory :
147+ case StepInputType . OpenFile :
148+ case StepInputType . SaveFile :
147149 row = AddField < FilePicker > ( input , value ) ;
148150 if ( input . ShouldCauseGameDownloadWhenChanged )
149151 {
You can’t perform that action at this time.
0 commit comments