示例#1
0
        private void openToolStripMenuItem_Click(object sender, EventArgs e)
        {
            OpenFileDialog dlg = new OpenFileDialog();

            dlg.Filter = "RSDKv1 ZoneConfig Files|Zone.zcf|RSDKv4 GameConfig Files|GameConfig.bin|Adobe Colour Table Files|*.act";

            if (dlg.ShowDialog(this) == System.Windows.Forms.DialogResult.OK)
            {
                Cyotek.Windows.Forms.ColorCollection pal = new Cyotek.Windows.Forms.ColorCollection();
                colorGrid.Colors.Clear(); //Clear the colourGrid!
                switch (dlg.FilterIndex - 1)
                {
                case 0:
                    sc1 = new RSDKv1.zcf(dlg.FileName);

                    for (int h = 0; h < 2; h++)      //For two rows...
                    {
                        for (int w = 0; w < 16; w++) // Get 16 colours...
                        {
                            Color c = Color.FromArgb(255, sc1.palette.Colors[h][w].R, sc1.palette.Colors[h][w].G, sc1.palette.Colors[h][w].B);
                            pal.Add(c);     //And place them into the grid!
                        }
                    }
                    break;

                case 1:
                    gc4 = new RSDKv4.GameConfig(dlg.FileName);

                    for (int h = 0; h < 6; h++)                                 // For six rows...
                    {
                        for (int w = 0; w < gc4.Palette.COLORS_PER_COLUMN; w++) //Get 16 Colours
                        {
                            Color c = Color.FromArgb(255, gc4.Palette.Colors[h][w].R, gc4.Palette.Colors[h][w].G, gc4.Palette.Colors[h][w].B);
                            pal.Add(c);     //And place them into the grid!
                        }
                    }
                    break;

                case 2:
                    pal = Cyotek.Windows.Forms.ColorCollection.LoadPalette(dlg.FileName);     //Load .act file
                    break;

                default:
                    break;
                }
                Text             = Path.GetFileName(dlg.FileName) + " - RSDK Palette Editor";
                colorGrid.Colors = pal; //Set the Colourgrid's colours!
            }
        }
示例#2
0
        private void viewSonicCDInternalPaletteToolStripMenuItem_Click(object sender, EventArgs e)
        {
            try
            {
                Process process = Process.GetProcessesByName("Soniccd")[0];

                MemoryEditing = true;
                GameType      = 2;

                IntPtr processHandle = OpenProcess(PROCESS_WM_READ, false, process.Id);

                int    bytesRead = 0;
                byte[] buffer    = new byte[2048]; //3 bytes for RGB and one for... idk lmfao

                colorGrid.Colors.Clear();
                Cyotek.Windows.Forms.ColorCollection cc = new Cyotek.Windows.Forms.ColorCollection();

                //int offset = 0x01C34D88;
                int offset = 0xABFB64;

                for (int i = 0; i < 2048; i++)
                {
                    ReadProcessMemory((int)processHandle, offset + (i), buffer, buffer.Length, ref bytesRead);

                    Color c = Color.FromArgb(255, buffer[2], buffer[1], buffer[0]);

                    cc.Add(c);

                    Console.WriteLine(buffer[0]);// + " " + buffer[1] + " " + buffer[2]);
                }

                /*for (int i = 0; i < 256; i++)
                 * {
                 *  ReadProcessMemory((int)processHandle, offset + (i), buffer, buffer.Length, ref bytesRead);
                 *
                 *  Color c = Color.FromArgb(255, buffer[2], buffer[1], buffer[0]);
                 *
                 *  cc.Add(c);
                 *
                 *  Console.WriteLine(buffer[0]);// + " " + buffer[1] + " " + buffer[2]);
                 * }*/
                colorGrid.Colors = cc;
            }
            catch (Exception Ex)
            {
                MessageBox.Show("Error: " + Ex.Message + Environment.NewLine + "(This likely means you don't have 'Soniccd.exe' open!)");
                MemoryEditing = false;
            }
        }
示例#3
0
        private void openToolStripMenuItem_Click(object sender, EventArgs e)
        {
            OpenFileDialog dlg = new OpenFileDialog();

            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)
            {
                MemoryEditing = false;
                GameType      = 0;
                Cyotek.Windows.Forms.ColorCollection pal = new Cyotek.Windows.Forms.ColorCollection();
                colorGrid.Colors.Clear(); //Clear the colourGrid!
                string RSDK = "RSDKvB";
                switch (dlg.FilterIndex - 1)
                {
                case 0:
                    StageconfigvRS = new RSDKvRS.Zoneconfig(dlg.FileName);

                    for (int h = 0; h < 2; h++)      //For two rows...
                    {
                        for (int w = 0; w < 16; w++) // Get 16 colours...
                        {
                            Color c = Color.FromArgb(255, StageconfigvRS.StagePalette.Colors[h][w].R, StageconfigvRS.StagePalette.Colors[h][w].G, StageconfigvRS.StagePalette.Colors[h][w].B);
                            pal.Add(c);     //And place them into the grid!
                        }
                    }
                    RSDK = "RSDKvRS";
                    break;

                case 1:
                    Stageconfigv1 = new RSDKv1.StageConfig(dlg.FileName);

                    for (int h = 0; h < 2; h++)      // For six rows...
                    {
                        for (int w = 0; w < 16; w++) //Get 16 Colours
                        {
                            Color c = Color.FromArgb(255, Stageconfigv1.StagePalette.Colors[h][w].R, Stageconfigv1.StagePalette.Colors[h][w].G, Stageconfigv1.StagePalette.Colors[h][w].B);
                            pal.Add(c);     //And place them into the grid!
                        }
                    }
                    RSDK = "RSDKv1";
                    break;

                case 2:
                    Stageconfigv2 = new RSDKv2.StageConfig(dlg.FileName);

                    for (int h = 0; h < 2; h++)      // For six rows...
                    {
                        for (int w = 0; w < 16; w++) //Get 16 Colours
                        {
                            Color c = Color.FromArgb(255, Stageconfigv2.StagePalette.Colors[h][w].R, Stageconfigv2.StagePalette.Colors[h][w].G, Stageconfigv2.StagePalette.Colors[h][w].B);
                            pal.Add(c);     //And place them into the grid!
                        }
                    }
                    RSDK = "RSDKv2";
                    break;

                case 3:
                    StageconfigvB = new RSDKvB.StageConfig(dlg.FileName);

                    for (int h = 0; h < 2; h++)      // For six rows...
                    {
                        for (int w = 0; w < 16; w++) //Get 16 Colours
                        {
                            Color c = Color.FromArgb(255, StageconfigvB.StagePalette.Colors[h][w].R, StageconfigvB.StagePalette.Colors[h][w].G, StageconfigvB.StagePalette.Colors[h][w].B);
                            pal.Add(c);     //And place them into the grid!
                        }
                    }
                    RSDK = "RSDKvB";
                    break;

                case 4:
                    GameconfigvB = new RSDKvB.GameConfig(dlg.FileName);

                    for (int h = 0; h < 6; h++)                                                // For six rows...
                    {
                        for (int w = 0; w < GameconfigvB.MasterPalette.COLORS_PER_COLUMN; w++) //Get 16 Colours
                        {
                            Color c = Color.FromArgb(255, GameconfigvB.MasterPalette.Colors[h][w].R, GameconfigvB.MasterPalette.Colors[h][w].G, GameconfigvB.MasterPalette.Colors[h][w].B);
                            pal.Add(c);     //And place them into the grid!
                        }
                    }
                    RSDK = "RSDKvB";
                    break;

                case 5:
                    LoadSuperPalettes(dlg.FileName);
                    RSDK = "RSDKvB";
                    break;

                case 6:
                    pal  = Cyotek.Windows.Forms.ColorCollection.LoadPalette(dlg.FileName);    //Load .act file
                    RSDK = ".Act File";
                    break;

                default:
                    break;
                }

                string        dispname = "";
                string        folder   = Path.GetDirectoryName(dlg.FileName);
                DirectoryInfo di       = new DirectoryInfo(folder);
                folder = di.Name;
                string file = Path.GetFileName(dlg.FileName);

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

                Text = Path.GetFileName(dlg.FileName) + " - RSDK Palette Editor";

                Parent.rp.state   = "RetroED - " + this.Text;
                Parent.rp.details = "Editing: " + dispname + " (" + RSDK + ")";
                SharpPresence.Discord.RunCallbacks();
                SharpPresence.Discord.UpdatePresence(Parent.rp);

                colorGrid.Colors = pal; //Set the Colourgrid's colours!
            }
        }
示例#4
0
        private void Palette_Update(object sender, EventArgs e)
        {
            if (MemoryEditing)
            {
                try
                {
                    if (GameType == 0)
                    {
                        Process process = Process.GetProcessesByName("RSonic")[0];

                        IntPtr processHandle = OpenProcess(PROCESS_WM_READ, false, process.Id);

                        MemoryEditing = true;
                        GameType      = 0;

                        int    bytesRead = 0;
                        byte[] buffer    = new byte[1024]; //3 bytes for RGB and one for... idk lmfao

                        colorGrid.Colors.Clear();
                        Cyotek.Windows.Forms.ColorCollection cc = new Cyotek.Windows.Forms.ColorCollection();

                        int offset = 0x0053FD74;

                        for (int i = 0; i < 256; i++)
                        {
                            ReadProcessMemory((int)processHandle, offset + (i * 4), buffer, buffer.Length, ref bytesRead);

                            Color c = Color.FromArgb(255, buffer[2], buffer[1], buffer[0]);

                            cc.Add(c);
                        }
                        colorGrid.Colors = cc;
                    }

                    if (GameType == 1)
                    {
                        Process process = Process.GetProcessesByName("Nexus")[0];

                        IntPtr processHandle = OpenProcess(PROCESS_WM_READ, false, process.Id);

                        int    bytesRead = 0;
                        byte[] buffer    = new byte[1024]; //3 bytes for RGB and one for... idk lmfao

                        colorGrid.Colors.Clear();
                        Cyotek.Windows.Forms.ColorCollection cc = new Cyotek.Windows.Forms.ColorCollection();

                        int offset = 0x00473408;

                        for (int i = 0; i < 256; i++)
                        {
                            ReadProcessMemory((int)processHandle, offset + (i * 4), buffer, buffer.Length, ref bytesRead);

                            Color c = Color.FromArgb(255, buffer[2], buffer[1], buffer[0]);

                            cc.Add(c);
                        }
                        colorGrid.Colors = cc;
                    }
                    if (GameType == 2)
                    {
                        Process process = Process.GetProcessesByName("soniccd")[0];

                        IntPtr processHandle = OpenProcess(PROCESS_WM_READ, false, process.Id);

                        int    bytesRead = 0;
                        byte[] buffer    = new byte[2048]; //3 bytes for RGB and one for... idk lmfao

                        colorGrid.Colors.Clear();
                        Cyotek.Windows.Forms.ColorCollection cc = new Cyotek.Windows.Forms.ColorCollection();

                        //int offset = 0x01C34D88;
                        int offset = 0x00A2EC00;

                        for (int i = 0; i < 2048; i++)
                        {
                            ReadProcessMemory((int)processHandle, offset + (316) + (i), buffer, buffer.Length, ref bytesRead);

                            Color c = Color.FromArgb(255, buffer[2], buffer[1], buffer[0]);

                            cc.Add(c);

                            Console.WriteLine(buffer[0]);// + " " + buffer[1] + " " + buffer[2]);
                        }

                        /*for (int i = 0; i < 256; i++)
                         * {
                         *  ReadProcessMemory((int)processHandle, offset + (i), buffer, buffer.Length, ref bytesRead);
                         *
                         *  Color c = Color.FromArgb(255, buffer[2], buffer[1], buffer[0]);
                         *
                         *  cc.Add(c);
                         *
                         *  Console.WriteLine(buffer[0]);// + " " + buffer[1] + " " + buffer[2]);
                         * }*/
                        colorGrid.Colors = cc;
                    }
                }
                catch (Exception Ex)
                {
                    MessageBox.Show("Error: " + Ex.Message + Environment.NewLine + "(This likely means you don't have 'RSonic.exe', 'Nexus.exe' or 'Soniccd.exe' open!)");
                    MemoryEditing = false;
                }
            }
        }