@@ -44,6 +44,8 @@ public interface ISubmenu { }
4444
4545 private OuiFileSelectSlotLevelSetPicker newGameLevelSetPicker ;
4646
47+ public bool MissingVanillaData ;
48+
4749 // computed maximums for stamp rendering
4850 private int maxStrawberryCount ;
4951 private int maxGoldenStrawberryCount ;
@@ -204,8 +206,6 @@ private void OnExistingFileRenameSelected() {
204206
205207 public extern void orig_OnNewGameSelected ( ) ;
206208 public void OnNewGameSelected ( ) {
207- patch_SaveData . TryDeleteModSaveData ( FileSlot ) ;
208-
209209 orig_OnNewGameSelected ( ) ;
210210
211211 string newGameLevelSet = newGameLevelSetPicker ? . NewGameLevelSet ;
@@ -291,6 +291,7 @@ public class Button {
291291 public float Scale = 1f ;
292292 }
293293
294+ [ PatchFileSelectSlotRenderMissingVanillaDataDialog ]
294295 [ PatchFileSelectSlotRender ] // manually manipulate the method via MonoModRules
295296 public extern void orig_Render ( ) ;
296297 public override void Render ( ) {
@@ -354,6 +355,12 @@ class PatchFileSelectSlotRenderAttribute : Attribute { }
354355 [ MonoModCustomMethodAttribute ( nameof ( MonoModRules . PatchOuiFileSelectSlotOnContinueSelected ) ) ]
355356 class PatchOuiFileSelectSlotOnContinueSelectedAttribute : Attribute { }
356357
358+ /// <summary>
359+ /// Patches the method to differentiate between Corrupted and MissingVanillaData.
360+ /// </summary>
361+ [ MonoModCustomMethodAttribute ( nameof ( MonoModRules . PatchFileSelectSlotRenderMissingVanillaDataDialog ) ) ]
362+ class PatchFileSelectSlotRenderMissingVanillaDataDialog : Attribute { }
363+
357364 static partial class MonoModRules {
358365
359366 public static void PatchOuiFileSelectSlotUpdate ( ILContext context , CustomAttribute attrib ) {
@@ -370,6 +377,48 @@ public static void PatchOuiFileSelectSlotUpdate(ILContext context, CustomAttribu
370377 cursor . Next . OpCode = OpCodes . Brfalse ;
371378 }
372379
380+ public static void PatchFileSelectSlotRenderMissingVanillaDataDialog ( ILContext context , CustomAttribute attrib ) {
381+ TypeDefinition declaringType = context . Method . DeclaringType ;
382+ FieldDefinition f_MissingVanillaData = declaringType . FindField ( "MissingVanillaData" ) ;
383+
384+ ILCursor cursor = new ILCursor ( context ) ;
385+
386+ // C# change:
387+ // [...]
388+ // else if (Corrupted)
389+ // {
390+ // - ActiveFont.Draw(Dialog.Clean("file_corrupted"), slide2, new Vector2(0.5f, 0.5f), Vector2.One, Color.Black * 0.8f);
391+ // + ActiveFont.Draw(Dialog.Clean((!MissingVanillaData) ? "file_corrupted" : "MISSING_VANILLA_DATA"), vector3, new Vector2(0.5f, 0.5f), Vector2.One, Color.Black * 0.8f);
392+ // }
393+ // [...]
394+
395+ // IL change:
396+ // [...]
397+ // ldfld System.Boolean Celeste.OuiFileSelectSlot::Corrupted
398+ // brfalse.s (...)
399+ // + ldarg.0
400+ // + ldfld bool Celeste.OuiFileSelectSlot::MissingVanillaData
401+ // + brfalse.s ldstr
402+ // + ldstr "MISSING_VANILLA_DATA"
403+ // + br.s ldnull
404+ // ldstr : ldstr "file_corrupted"
405+ // ldnull : ldnull
406+ // call string Celeste.Dialog::Clean(string, class Celeste.Language)
407+ // [...]
408+
409+ cursor . GotoNext ( MoveType . Before , instr => instr . MatchLdstr ( "file_corrupted" ) ) ;
410+ ILLabel ldstr = cursor . MarkLabel ( ) ;
411+ cursor . GotoNext ( ) ;
412+ ILLabel ldnull = cursor . MarkLabel ( ) ;
413+
414+ cursor . GotoLabel ( ldstr , MoveType . Before ) ;
415+ cursor . EmitLdarg0 ( ) ;
416+ cursor . EmitLdfld ( f_MissingVanillaData ) ;
417+ cursor . EmitBrfalse ( ldstr ) ;
418+ cursor . EmitLdstr ( "MISSING_VANILLA_DATA" ) ;
419+ cursor . EmitBr ( ldnull ) ;
420+ }
421+
373422 public static void PatchFileSelectSlotRender ( ILContext context , CustomAttribute attrib ) {
374423 TypeDefinition declaringType = context . Method . DeclaringType ;
375424 FieldDefinition f_maxStrawberryCount = declaringType . FindField ( "maxStrawberryCount" ) ;
0 commit comments