Пример #1
0
        public void Save(string Filepath)
        {
            Console.WriteLine(FILEPATH);
            stageconfig.Write(new RSDKv2.Writer(Filepath));
            FILEPATH = Filepath;
            RetroED.MainForm.Instance.CurrentTabText = Path.GetFileName(Filepath);

            string        RSDK     = "RSDKv2";
            string        dispname = "";
            string        folder   = Path.GetDirectoryName(Filepath);
            DirectoryInfo di       = new DirectoryInfo(folder);

            folder = di.Name;
            string file = Path.GetFileName(Filepath);

            if (Filepath != null)
            {
                RetroED.MainForm.Instance.CurrentTabText = folder + "/" + file;
                dispname = folder + "/" + file;
            }
            else
            {
                RetroED.MainForm.Instance.CurrentTabText = "New Palette - RSDK Stageconfig Editor";
                dispname = "New Stageconfig - RSDK Stageconfig Editor";
            }

            Text = Path.GetFileName(Filepath) + " - RSDK Stageconfig Editor";

            RetroED.MainForm.Instance.rp.state   = "RetroED - RSDK Stageconfig Editor";
            RetroED.MainForm.Instance.rp.details = "Editing: " + dispname + " (" + RSDK + ")";
            SharpPresence.Discord.RunCallbacks();
            SharpPresence.Discord.UpdatePresence(RetroED.MainForm.Instance.rp);
        }
Пример #2
0
        private void saveAsToolStripMenuItem_Click(object sender, EventArgs e)
        {
            SaveFileDialog dlg = new SaveFileDialog();

            dlg.Filter = "RSDKvRS ZoneConfig Files|Zone*.zcf|RSDKv1 StageConfig Files|StageConfig*.bin|RSDKv2 StageConfig Files|StageConfig*.bin|RSDKvB StageConfig Files|StageConfig*.bin|RSDKvB GameConfig Files|GameConfig*.bin|RSDKvB Super Palettes|GlobalCode*.bin|Adobe Colour Table Files|*.act";

            if (dlg.ShowDialog(this) == System.Windows.Forms.DialogResult.OK)
            {
                Type = dlg.FilterIndex - 1;
                switch (Type)
                {
                case 0:
                    int i1 = 0;
                    for (int h = 0; h < 2; h++)
                    {
                        for (int w = 0; w < 16; w++)
                        {
                            Color c = Color.FromArgb(255, colorGrid.Colors[i1].R, colorGrid.Colors[i1].G, colorGrid.Colors[i1].B);
                            i1++;
                            //Set the colours in the Stage Config to the modified colours in the ColourGrid!
                            StageconfigvRS.StagePalette.Colors[h][w].R = c.R;
                            StageconfigvRS.StagePalette.Colors[h][w].G = c.G;
                            StageconfigvRS.StagePalette.Colors[h][w].B = c.B;
                        }
                    }
                    StageconfigvRS.Write(dlg.FileName);     //Save that!
                    break;

                case 1:
                    int i2 = 0;
                    for (int h = 0; h < 2; h++)
                    {
                        for (int w = 0; w < 16; w++)
                        {
                            Color c = Color.FromArgb(255, colorGrid.Colors[i2].R, colorGrid.Colors[i2].G, colorGrid.Colors[i2].B);
                            i2++;
                            //Set the colours in the Stage Config to the modified colours in the ColourGrid!
                            Stageconfigv1.StagePalette.Colors[h][w].R = c.R;
                            Stageconfigv1.StagePalette.Colors[h][w].G = c.G;
                            Stageconfigv1.StagePalette.Colors[h][w].B = c.B;
                        }
                    }
                    Stageconfigv1.Write(dlg.FileName);     //Save that!
                    break;

                case 2:
                    int i3 = 0;
                    for (int h = 0; h < 2; h++)
                    {
                        for (int w = 0; w < 16; w++)
                        {
                            Color c = Color.FromArgb(255, colorGrid.Colors[i3].R, colorGrid.Colors[i3].G, colorGrid.Colors[i3].B);
                            i3++;
                            //Set the colours in the Stage Config to the modified colours in the ColourGrid!
                            Stageconfigv2.StagePalette.Colors[h][w].R = c.R;
                            Stageconfigv2.StagePalette.Colors[h][w].G = c.G;
                            Stageconfigv2.StagePalette.Colors[h][w].B = c.B;
                        }
                    }
                    Stageconfigv2.Write(dlg.FileName);     //Save that!
                    break;

                case 3:
                    int is4 = 0;
                    for (int h = 0; h < 2; h++)
                    {
                        for (int w = 0; w < 16; w++)
                        {
                            Color c = Color.FromArgb(255, colorGrid.Colors[is4].R, colorGrid.Colors[is4].G, colorGrid.Colors[is4].B);
                            is4++;
                            //Set the colours in the Stage Config to the modified colours in the ColourGrid!
                            StageconfigvB.StagePalette.Colors[h][w].R = c.R;
                            StageconfigvB.StagePalette.Colors[h][w].G = c.G;
                            StageconfigvB.StagePalette.Colors[h][w].B = c.B;
                        }
                    }
                    Stageconfigv2.Write(dlg.FileName);     //Save that!
                    break;

                case 4:
                    int i4 = 0;
                    for (int h = 0; h < 6; h++)
                    {
                        for (int w = 0; w < GameconfigvB.MasterPalette.COLORS_PER_COLUMN; w++)
                        {
                            Color c = Color.FromArgb(255, colorGrid.Colors[i4].R, colorGrid.Colors[i4].G, colorGrid.Colors[i4].B);
                            i4++;
                            //Set the colours in the Stage Config to the modified colours in the ColourGrid!
                            GameconfigvB.MasterPalette.Colors[h][w].R = c.R;
                            GameconfigvB.MasterPalette.Colors[h][w].G = c.G;
                            GameconfigvB.MasterPalette.Colors[h][w].B = c.B;
                        }
                    }
                    GameconfigvB.Write(dlg.FileName);     //Save that!
                    break;

                case 5:
                    SaveSuperPalettes(dlg.FileName);
                    break;

                case 6:
                    Cyotek.Windows.Forms.IPaletteSerializer serializer;

                    serializer = new Cyotek.Windows.Forms.AdobeColorTablePaletteSerializer();

                    using (Stream stream = File.Create(dlg.FileName))
                    {
                        serializer.Serialize(stream, colorGrid.Colors);     //Save a .act file
                    }
                    break;

                default:
                    break;
                }
            }
        }