Ejemplo n.º 1
0
        private void PostSerialize(string filename, ProjectXmlSerializer.Root xmlRoot, ProjectSerializer serializer)
        {
            if (xmlRoot?.Project?.Data?.SnesAddressSpace != null || xmlRoot?.Project?.Session == null)
            {
                throw new InvalidDataException(
                          "Internal error with deserialized data, either Project, Data, Session, or SnesAddressSpace failed to load correctly.");
            }

            xmlRoot.Project.Session = new ProjectSession(xmlRoot.Project)
            {
                ProjectFileName = filename
            };

            // at this stage, 'Data' is populated with everything EXCEPT the actual ROM bytes.
            // It would be easy to store the ROM bytes in the save file, but, for copyright reasons,
            // we leave it out.
            //
            // So now, with all our metadata loaded successfully, we now open the .smc file on disk
            // and marry the original rom's bytes with all of our metadata loaded from the project file.

            var romAddCmd = new AddRomDataCommand(xmlRoot)
            {
                GetNextRomFileToTry = RomPromptFn,
                MigrationRunner     = serializer.MigrationRunner,
            };

            romAddCmd.TryReadAttachedProjectRom();
        }
Ejemplo n.º 2
0
        private Project Setup(AddRomDataCommand romAddCmd)
        {
            Debug.Assert(beforeAddRun);

            // we're called now after the romBytes have been loaded and all other checks are clear.
            romAddCmd.ShouldProjectCartTitleMatchRomBytes = previousCartTitleMatchState;

            return(romAddCmd.Root?.Project);
        }
Ejemplo n.º 3
0
        public void OnLoadingBeforeAddLinkedRom(AddRomDataCommand romAddCmd)
        {
            // this will have the loader skip checking the cart title name.
            // we'll down our own check later.
            previousCartTitleMatchState = romAddCmd.ShouldProjectCartTitleMatchRomBytes;
            romAddCmd.ShouldProjectCartTitleMatchRomBytes = false;

            beforeAddRun = true;
        }
Ejemplo n.º 4
0
        public void OnLoadingAfterAddLinkedRom(AddRomDataCommand romAddCmd)
        {
            var project = Setup(romAddCmd);

            if (!IsMitigationNeeded(project))
            {
                return;
            }

            ApplyMitigation(project);
        }
Ejemplo n.º 5
0
 public void OnLoadingAfterAddLinkedRom(AddRomDataCommand romAddCmd)
 {
     RunAllMigrations(migration => migration.OnLoadingAfterAddLinkedRom(romAddCmd));
 }