private void ExportFamiTone2Sfx(bool famiStudio)
        {
            var props        = dialog.GetPropertyPage(famiStudio ? (int)ExportFormat.FamiStudioSfx : (int)ExportFormat.FamiTone2Sfx);
            var exportFormat = (AssemblyFormat)Enum.Parse(typeof(AssemblyFormat), props.GetPropertyValue <string>(0));
            var ext          = exportFormat == AssemblyFormat.CA65 ? "s" : "asm";
            var mode         = (MachineType)Enum.Parse(typeof(MachineType), props.GetPropertyValue <string>(1));
            var songIds      = GetSongIds(props.GetPropertyValue <bool[]>(2));

            var filename = PlatformUtils.ShowSaveFileDialog("Export FamiTone2 Code", $"FamiTone2 Assembly File (*.{ext})|*.{ext}", ref Settings.LastExportFolder);

            if (filename != null)
            {
                FamitoneSoundEffectFile f = new FamitoneSoundEffectFile();
                f.Save(project, songIds, exportFormat, mode, filename);
            }
        }
        private void FamiTone2SfxExport(string filename, bool famiStudio)
        {
            var engineName   = famiStudio ? "famistudio" : "famitone2";
            var formatString = ParseOption($"{engineName}-asm-format", "nesasm");
            var format       = AssemblyFormat.NESASM;

            switch (formatString)
            {
            case "ca65": format = AssemblyFormat.CA65; break;

            case "asm6": format = AssemblyFormat.ASM6; break;
            }

            var machineString = ParseOption($"{engineName}-asm-sfx-mode", project.PalMode ? "pal" : "ntsc");
            var machine       = project.PalMode ? MachineType.PAL : MachineType.NTSC;

            switch (machineString.ToLower())
            {
            case "pal": machine = MachineType.PAL;  break;

            case "dual": machine = MachineType.Dual; break;

            case "ntsc": machine = MachineType.NTSC; break;
            }

            var extension = format == AssemblyFormat.CA65 ? ".s" : ".asm";

            if (!ValidateExtension(filename, extension))
            {
                return;
            }

            var generateInclude = HasOption($"{engineName}-sfx-generate-list");

            var exportSongIds = GetExportSongIds();

            if (exportSongIds != null)
            {
                var includeFilename = generateInclude ? Path.ChangeExtension(filename, null) + "_sfxlist.inc" : null;

                FamitoneSoundEffectFile f = new FamitoneSoundEffectFile();
                f.Save(project, exportSongIds, format, machine, famiStudio ? FamiToneKernel.FamiStudio : FamiToneKernel.FamiTone2, filename, includeFilename);
            }
        }
Esempio n. 3
0
        private void ExportFamiTone2Sfx(bool famiStudio)
        {
            var props           = dialog.GetPropertyPage(famiStudio ? (int)ExportFormat.FamiStudioSfx : (int)ExportFormat.FamiTone2Sfx);
            var exportFormat    = AssemblyFormat.GetValueForName(props.GetPropertyValue <string>(0));
            var ext             = exportFormat == AssemblyFormat.CA65 ? "s" : "asm";
            var mode            = MachineType.GetValueForName(props.GetPropertyValue <string>(1));
            var engineName      = famiStudio ? "FamiStudio" : "FamiTone2";
            var generateInclude = props.GetPropertyValue <bool>(2);
            var songIds         = GetSongIds(props.GetPropertyValue <bool[]>(3));

            var filename = lastExportFilename != null ? lastExportFilename : PlatformUtils.ShowSaveFileDialog($"Export {engineName} Code", $"{engineName} Assembly File (*.{ext})|*.{ext}", ref Settings.LastExportFolder);

            if (filename != null)
            {
                var includeFilename = generateInclude ? Path.ChangeExtension(filename, null) + "_sfxlist.inc" : null;

                FamitoneSoundEffectFile f = new FamitoneSoundEffectFile();
                f.Save(project, songIds, exportFormat, mode, famiStudio ? FamiToneKernel.FamiStudio : FamiToneKernel.FamiTone2, filename, includeFilename);
                lastExportFilename = filename;
            }
        }
        private void FamiTone2SfxExport(string filename)
        {
            var formatString = ParseOption("famitone2-format", "nesasm");
            var format       = AssemblyFormat.NESASM;

            switch (formatString)
            {
            case "ca65": format = AssemblyFormat.CA65; break;

            case "asm6": format = AssemblyFormat.ASM6; break;
            }

            var machineString = ParseOption("nsf-export-mode", project.PalMode ? "pal" : "ntsc");
            var machine       = project.PalMode ? MachineType.PAL : MachineType.NTSC;

            switch (machineString.ToLower())
            {
            case "pal": machine = MachineType.PAL;  break;

            case "dual": machine = MachineType.Dual; break;

            case "ntsc": machine = MachineType.NTSC; break;
            }

            var extension = format == AssemblyFormat.CA65 ? ".s" : ".asm";

            if (!ValidateExtension(filename, extension))
            {
                return;
            }

            var exportSongIds = GetExportSongIds();

            if (exportSongIds != null)
            {
                FamitoneSoundEffectFile f = new FamitoneSoundEffectFile();
                f.Save(project, exportSongIds, format, machine, filename);
            }
        }