private void RomExport(string filename)
        {
            if (!ValidateExtension(filename, ".nes"))
            {
                return;
            }

            var exportSongIds = GetExportSongIds();

            if (exportSongIds != null)
            {
                if (exportSongIds.Length > RomFileBase.MaxSongs)
                {
                    Console.WriteLine("There is currently a hard limit of 8 songs for NES ROM export.");
                    return;
                }

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

                switch (machineString.ToLower())
                {
                case "pal": pal = true;  break;

                case "ntsc": pal = false; break;
                }

                if (project.UsesExpansionAudio)
                {
                    pal = false;
                }

                var rom = new RomFile();
                rom.Save(
                    project,
                    filename,
                    exportSongIds,
                    project.Name,
                    project.Author,
                    pal);
            }
        }
예제 #2
0
        private void ExportRom()
        {
            var props   = dialog.GetPropertyPage((int)ExportFormat.Rom);
            var songIds = GetSongIds(props.GetPropertyValue <bool[]>(4));

            if (songIds.Length > RomFileBase.MaxSongs)
            {
                PlatformUtils.MessageBox($"Please select {RomFileBase.MaxSongs} songs or less.", "ROM Export", MessageBoxButtons.OK);
                return;
            }

            if (props.GetPropertyValue <string>(0) == "NES ROM")
            {
                var filename = lastExportFilename != null ? lastExportFilename : PlatformUtils.ShowSaveFileDialog("Export ROM File", "NES ROM (*.nes)|*.nes", ref Settings.LastExportFolder);
                if (filename != null)
                {
                    var rom = new RomFile();
                    rom.Save(
                        project, filename, songIds,
                        props.GetPropertyValue <string>(1),
                        props.GetPropertyValue <string>(2),
                        props.GetPropertyValue <string>(3) == "PAL");

                    lastExportFilename = filename;
                }
            }
            else
            {
                var filename = lastExportFilename != null ? null : PlatformUtils.ShowSaveFileDialog("Export Famicom Disk", "FDS Disk (*.fds)|*.fds", ref Settings.LastExportFolder);
                if (filename != null)
                {
                    var fds = new FdsFile();
                    fds.Save(
                        project, filename, songIds,
                        props.GetPropertyValue <string>(1),
                        props.GetPropertyValue <string>(2));

                    lastExportFilename = filename;
                }
            }
        }
예제 #3
0
        private void ExportRom()
        {
            var props   = dialog.GetPropertyPage((int)ExportFormat.Rom);
            var songIds = GetSongIds(props.GetPropertyValue <bool[]>(2));

            if (songIds.Length > RomFile.MaxSongs)
            {
                PlatformUtils.MessageBox("Please select 8 songs or less.", "ROM Export", MessageBoxButtons.OK);
                return;
            }

            var filename = PlatformUtils.ShowSaveFileDialog("Export ROM File", "NES ROM (*.nes)|*.nes");

            if (filename != null)
            {
                RomFile.Save(project, filename,
                             songIds,
                             props.GetPropertyValue <string>(0),
                             props.GetPropertyValue <string>(1));
            }
        }
예제 #4
0
        private void ExportRom()
        {
            var props   = dialog.GetPropertyPage((int)ExportFormat.Rom);
            var songIds = GetSongIds(props.GetPropertyValue <bool[]>(4));

            if (songIds.Length > RomFileBase.MaxSongs)
            {
                PlatformUtils.MessageBoxAsync($"Please select {RomFileBase.MaxSongs} songs or less.", "ROM Export", MessageBoxButtons.OK);
                return;
            }

            if (props.GetPropertyValue <string>(0) == "NES ROM")
            {
                Action <string> ExportRomAction = (filename) =>
                {
                    if (filename != null)
                    {
                        var rom = new RomFile();
                        rom.Save(
                            project, filename, songIds,
                            props.GetPropertyValue <string>(1),
                            props.GetPropertyValue <string>(2),
                            props.GetPropertyValue <string>(3) == "PAL");

                        lastExportFilename = filename;
                    }
                };

                if (PlatformUtils.IsMobile)
                {
                    PlatformUtils.StartMobileSaveFileOperationAsync("*/*", $"{project.Name}.nes", (f) =>
                    {
                        ExportRomAction(f);
                        PlatformUtils.FinishMobileSaveFileOperationAsync(true, () => { PlatformUtils.ShowToast("NES ROM Export Successful!"); });
                    });
                }
                else
                {
                    var filename = lastExportFilename != null ? lastExportFilename : PlatformUtils.ShowSaveFileDialog("Export ROM File", "NES ROM (*.nes)|*.nes", ref Settings.LastExportFolder);
                    ExportRomAction(filename);
                }
            }
            else
            {
                Action <string> ExportFdsAction = (filename) =>
                {
                    if (filename != null)
                    {
                        var fds = new FdsFile();
                        fds.Save(
                            project, filename, songIds,
                            props.GetPropertyValue <string>(1),
                            props.GetPropertyValue <string>(2));

                        lastExportFilename = filename;
                    }
                };

                if (PlatformUtils.IsMobile)
                {
                    PlatformUtils.StartMobileSaveFileOperationAsync("*/*", $"{project.Name}.fds", (f) =>
                    {
                        ExportFdsAction(f);
                        PlatformUtils.FinishMobileSaveFileOperationAsync(true, () => { PlatformUtils.ShowToast("FDS Disk Export Successful!"); });
                    });
                }
                else
                {
                    var filename = lastExportFilename != null ? null : PlatformUtils.ShowSaveFileDialog("Export Famicom Disk", "FDS Disk (*.fds)|*.fds", ref Settings.LastExportFolder);
                    ExportFdsAction(filename);
                }
            }
        }