Пример #1
0
        public static Mother3Project CreateNew(IFileSystem fileSystem, string romDataPath,
                                               string romConfigPath)
        {
            var binaryManager = new BinaryFileManager(fileSystem);
            var jsonManager   = new JsonFileManager(fileSystem);

            var romData         = binaryManager.ReadFile <Block>(romDataPath);
            var romConfig       = jsonManager.ReadJson <Mother3RomConfig>(romConfigPath);
            var projectSettings = Mother3ProjectSettings.CreateDefault();

            var project = new Mother3Project(romData, romConfig, projectSettings);

            // Do some ROM config prep before reading the modules
            if (romConfig.IsJapanese)
            {
                romConfig.AddJapaneseCharsToLookup(romData);
            }

            if (romConfig.ScriptEncodingParameters != null)
            {
                romConfig.ReadEncodingPadData(romData);
            }

            romConfig.UpdateLookups();

            foreach (var module in project.Modules)
            {
                module.ReadFromRom(romData);
            }

            return(project);
        }
Пример #2
0
        public static Mother3Project Load(IFileSystem fileSystem, string projectSettingsPath)
        {
            var jsonManager     = new JsonFileManager(fileSystem);
            var projectSettings = jsonManager.ReadJson <Mother3ProjectSettings>(projectSettingsPath);
            var romConfig       = jsonManager.ReadJson <Mother3RomConfig>(projectSettings.RomConfigPath);

            var binaryManager = new BinaryFileManager(fileSystem);
            var romData       = binaryManager.ReadFile <Block>(projectSettings.BaseRomPath);

            var project = new Mother3Project(romData, romConfig, projectSettings);

            foreach (var module in project.Modules)
            {
                module.ReadFromFiles(fileSystem);
            }

            return(project);
        }