@@ -63,10 +63,17 @@ protected virtual void PathChanged(object? sender, EventArgs ev)
6363 GameItem item = new ( ) ;
6464
6565 string iconPath = Path . Combine ( gamePath , "ICON0.PNG" ) ;
66- if ( this . Accessor . FileExists ( iconPath ) )
66+ try
67+ {
68+ if ( this . Accessor . FileExists ( iconPath ) )
69+ {
70+ using Stream iconStream = this . Accessor . OpenRead ( iconPath ) ;
71+ item . Image = new Bitmap ( iconStream ) . WithSize ( new Size ( 64 , 64 ) ) ;
72+ }
73+ }
74+ catch
6775 {
68- using Stream iconStream = this . Accessor . OpenRead ( iconPath ) ;
69- item . Image = new Bitmap ( iconStream ) . WithSize ( new Size ( 64 , 64 ) ) ;
76+ // don't set any image
7077 }
7178
7279 string sfoPath = Path . Combine ( gamePath , "PARAM.SFO" ) ;
@@ -163,13 +170,13 @@ public override void CompletePatch(object? sender, EventArgs e) {
163170 string backup = destination + ".ORIG" ;
164171 if ( ! this . Accessor . FileExists ( backup ) )
165172 this . Accessor . CopyFile ( destination , backup ) ;
166-
167- this . Accessor . RemoveFile ( destination ) ;
168173 }
169-
170- // wait a second for the ps3 to calm the fuck down
171- // this is apparently necessary
172- Thread . Sleep ( 1000 ) ; // TODO: don't. block. the. main. fucking. thread.
174+
175+ if ( this . Accessor . FileExists ( destination ) )
176+ this . Accessor . RemoveFile ( destination ) ;
177+
178+ // wait a second for the ps3 to calm down
179+ Thread . Sleep ( 1000 ) ; // TODO: don't. block. the. main. thread.
173180
174181 this . Accessor . UploadFile ( fileToUpload , destination ) ;
175182 MessageBox . Show ( $ "Successfully patched EBOOT! It was saved to '{ destination } '.") ;
@@ -191,13 +198,19 @@ private void RevertToOriginalExecutable(object? sender, EventArgs e)
191198 {
192199 if ( this . Accessor == null ) return ;
193200
194- if ( ! this . Accessor . FileExists ( this . _usrDir + "EBOOT.BIN.ORIG" ) )
201+ string eboot = this . _usrDir + "EBOOT.BIN" ;
202+ string ebootOrig = this . _usrDir + "EBOOT.BIN.ORIG" ;
203+
204+ if ( ! this . Accessor . FileExists ( ebootOrig ) )
195205 {
196206 MessageBox . Show ( "Cannot revert EBOOT since the original EBOOT does not exist" , MessageBoxType . Error ) ;
197207 return ;
198208 }
199209
200- this . Accessor . CopyFile ( this . _usrDir + "EBOOT.BIN.ORIG" , this . _usrDir + "EBOOT.BIN" ) ;
210+ if ( this . Accessor . FileExists ( eboot ) )
211+ this . Accessor . RemoveFile ( eboot ) ;
212+
213+ this . Accessor . CopyFile ( ebootOrig , eboot ) ;
201214 MessageBox . Show ( "The EBOOT has successfully been reverted to it's original backup" ) ;
202215 }
203216
0 commit comments