コード例 #1
0
ファイル: _NesEmu.cs プロジェクト: ywjno/mynes-code
 public static void SetupGameGenie(bool IsGameGenieActive, GameGenieCode[] GameGenieCodes)
 {
     if (board != null)
         board.SetupGameGenie(IsGameGenieActive, GameGenieCodes);
 }
コード例 #2
0
ファイル: Main.cs プロジェクト: ywjno/mynes-code
        public static void ActiveGameGenie()
        {
            if (!NesEmu.EmulationON)
            {    
                Program.VIDEO.WriteNotification("Game Genie can't be enabled while emulation is OFF.", 200, System.Drawing.Color.Red);
                return;
            }
            string filePath = Path.Combine(Settings.Folder_GameGenieCodes,
                                  Path.GetFileNameWithoutExtension(Program.CurrentGameFile) + ".ggc");
            if (File.Exists(filePath))
            {
                string[] lines = File.ReadAllLines(filePath);
                // Clear all
                if (lines.Length > 0)
                {
                    GameGenie gameGenie = new GameGenie();
                    List<GameGenieCode> codes = new List<GameGenieCode>();
                    // Add code by code
                    for (int i = 0; i < lines.Length; i++)
                    {
                        GameGenieCode newcode = new GameGenieCode();
                        newcode.Enabled = true; 
                        newcode.Name = lines[i];

                        if (lines[i].Length == 6)
                        {
                            newcode.Address = gameGenie.GetGGAddress(gameGenie.GetCodeAsHEX(lines[i]), 6) | 0x8000;
                            newcode.Value = gameGenie.GetGGValue(gameGenie.GetCodeAsHEX(lines[i]), 6);
                            newcode.IsCompare = false;
                        }
                        else
                        {
                            newcode.Address = gameGenie.GetGGAddress(gameGenie.GetCodeAsHEX(lines[i]), 8) | 0x8000;
                            newcode.Value = gameGenie.GetGGValue(gameGenie.GetCodeAsHEX(lines[i]), 8);
                            newcode.Compare = gameGenie.GetGGCompareValue(gameGenie.GetCodeAsHEX(lines[i]));
                            newcode.IsCompare = true;
                        }
                        codes.Add(newcode);
                    }
                    if (codes.Count > 0)
                    {
                        NesEmu.SetupGameGenie(true, codes.ToArray());
                        Program.VIDEO.WriteNotification("Game Genie File Loaded; Game Genie enabled.", 200, System.Drawing.Color.Lime);
                    }
                    else
                    {
                        Program.VIDEO.WriteNotification("There is no Game Genie code to load.", 200, System.Drawing.Color.Red);
                    }
                }
                else
                {    
                    Program.VIDEO.WriteNotification("Game Genie file is empty.", 200, System.Drawing.Color.Red);
                }
            }
            else
            {    
                Program.VIDEO.WriteNotification("Game Genie file is not found.", 200, System.Drawing.Color.Red);
            }
        }
コード例 #3
0
ファイル: FormGameGenie.cs プロジェクト: Blizz9/FanCut
 //ok
 private void button1_Click(object sender, EventArgs e)
 {
     if (listView1.Items.Count == 0)
     {
         MessageBox.Show(Program.ResourceManager.GetString("Message_ThereIsNoCodeInTheList"));
         return;
     }
     //Nes.Board.IsGameGenieActive = checkBox1.Checked;
     List<GameGenieCode> codes = new List<GameGenieCode>();
     gameGenie = new GameGenie();
     foreach (ListViewItem item in listView1.Items)
     {
         GameGenieCode code = new GameGenieCode();
         code.Enabled = item.Checked;
         code.Name = item.Text;
         code.Descreption = item.SubItems[1].Text;
         if (item.Text.Length == 6)
         {
             code.Address = gameGenie.GetGGAddress(gameGenie.GetCodeAsHEX(item.Text), 6) | 0x8000;
             code.Value = gameGenie.GetGGValue(gameGenie.GetCodeAsHEX(item.Text), 6);
             code.IsCompare = false;
         }
         else
         {
             code.Address = gameGenie.GetGGAddress(gameGenie.GetCodeAsHEX(item.Text), 8) | 0x8000;
             code.Value = gameGenie.GetGGValue(gameGenie.GetCodeAsHEX(item.Text), 8);
             code.Compare = gameGenie.GetGGCompareValue(gameGenie.GetCodeAsHEX(item.Text));
             code.IsCompare = true;
         }
         //add to active list
         codes.Add(code);
     }
     NesEmu.SetupGameGenie(checkBox1.Checked, codes.ToArray());
     this.Close();
 }
コード例 #4
0
ファイル: Board.cs プロジェクト: ywjno/mynes-code
 public void SetupGameGenie(bool IsGameGenieActive, GameGenieCode[] GameGenieCodes)
 {
     this.IsGameGenieActive = IsGameGenieActive;
     this.GameGenieCodes = GameGenieCodes;
 }
コード例 #5
0
ファイル: Room_GameGenie.cs プロジェクト: ywjno/mynes-code
            public override void Execute()
            {
                string filePath = Path.Combine(Settings.Folder_GameGenieCodes,
                                      Path.GetFileNameWithoutExtension(Program.CurrentGameFile) + ".ggc");
                if (File.Exists(filePath))
                {
                    string[] lines = File.ReadAllLines(filePath);
                    // Clear all
                    if (lines.Length > 0)
                    {
                        page.Items[3].Options.Clear();
                        page.Items[4].Options.Clear();
                        page.Items[5].Options.Clear();
                        page.Items[6].Options.Clear();
                        page.Items[7].Options.Clear();
                        // Add code by code
                        for (int i = 0; i < lines.Length; i++)
                        {
                            GameGenieCode newcode = new GameGenieCode();
                            newcode.Enabled = true; 
                            newcode.Name = lines[i];
                            if (lines[i].Length == 6)
                            {
                                newcode.Address = gameGenie.GetGGAddress(gameGenie.GetCodeAsHEX(lines[i]), 6);
                                newcode.Value = gameGenie.GetGGValue(gameGenie.GetCodeAsHEX(lines[i]), 6);
                                newcode.IsCompare = false;
                            }
                            else
                            {
                                newcode.Address = gameGenie.GetGGAddress(gameGenie.GetCodeAsHEX(lines[i]), 8);
                                newcode.Value = gameGenie.GetGGValue(gameGenie.GetCodeAsHEX(lines[i]), 8);
                                newcode.Compare = gameGenie.GetGGCompareValue(gameGenie.GetCodeAsHEX(lines[i]));
                                newcode.IsCompare = true;
                            }
                            page.Items[3].Options.Add(i.ToString());
                            page.Items[4].Options.Add(lines[i]);
                            page.Items[5].Options.Add(newcode.Address.ToString("X4"));
                            page.Items[6].Options.Add(newcode.Value.ToString("X2"));
                            page.Items[7].Options.Add(newcode.Compare.ToString("X2"));
                        }

                        page.SelectLastCode();

                        Program.VIDEO.WriteNotification("Game Genie File Loaded !!", 200, System.Drawing.Color.Lime);
                    }
                    else
                    {    
                        Program.VIDEO.WriteNotification("Game Genie file is empty.", 200, System.Drawing.Color.Red);
                    }
                }
                else
                {    
                    Program.VIDEO.WriteNotification("Game Genie file is not found.", 200, System.Drawing.Color.Red);
                }
            }
コード例 #6
0
ファイル: Room_GameGenie.cs プロジェクト: ywjno/mynes-code
            public override void Execute()
            {
                GameGenieCode newcode = new GameGenieCode();
                newcode.Address = 0;
                newcode.Compare = 0;
                newcode.Descreption = "";
                newcode.IsCompare = false;
                newcode.Name = "";
                newcode.Value = 0;
                page._gameGenieCodes.Add(newcode);
                if (page.Items[3].Options[0] == "N/A")
                {
                    page.Items[3].Options.Clear();
                    page.Items[4].Options.Clear();
                    page.Items[5].Options.Clear();
                    page.Items[6].Options.Clear();
                    page.Items[7].Options.Clear();
                }
                int last = page._gameGenieCodes.Count - 1;

                page.Items[3].Options.Add(last.ToString());
                page.Items[4].Options.Add(page._gameGenieCodes[last].Name);
                page.Items[5].Options.Add(page._gameGenieCodes[last].Address.ToString("X4"));
                page.Items[6].Options.Add(page._gameGenieCodes[last].Value.ToString("X2"));
                page.Items[7].Options.Add(page._gameGenieCodes[last].Compare.ToString("X2"));

                page.Items[3].SelectedOptionIndex = last;
                page.Items[4].SelectedOptionIndex = last;
                page.Items[5].SelectedOptionIndex = last;
                page.Items[6].SelectedOptionIndex = last;
                page.Items[7].SelectedOptionIndex = last;
            }
コード例 #7
0
ファイル: Room_GameGenie.cs プロジェクト: ywjno/mynes-code
            public override void Execute()
            {
                // Apply all codes !
                page._gameGenieCodes = new List<GameGenieCode>();
                bool enabled = page.Items[0].SelectedOptionIndex == 1;
                if (page.Items[3].Options[0] != "N/A")
                {
                    for (int i = 0; i < page.Items[3].Options.Count; i++)
                    {
                        if (page.Items[4].Options[0] != "" &&
                            page.Items[5].Options[0] != "ERROR")
                        {
                            GameGenieCode newcode = new GameGenieCode();
                            newcode.Enabled = true; 
                            string code = page.Items[4].Options[0];
                            newcode.Name = code;
                            if (code.Length == 6)
                            {
                                newcode.Address = gameGenie.GetGGAddress(gameGenie.GetCodeAsHEX(code), 6) | 0x8000;
                                newcode.Value = gameGenie.GetGGValue(gameGenie.GetCodeAsHEX(code), 6);
                                newcode.IsCompare = false;
                            }
                            else
                            {
                                newcode.Address = gameGenie.GetGGAddress(gameGenie.GetCodeAsHEX(code), 8) | 0x8000;
                                newcode.Value = gameGenie.GetGGValue(gameGenie.GetCodeAsHEX(code), 8);
                                newcode.Compare = gameGenie.GetGGCompareValue(gameGenie.GetCodeAsHEX(code));
                                newcode.IsCompare = true;
                            }
                            page._gameGenieCodes.Add(newcode);
                        }
                    }
                }

                NesEmu.SetupGameGenie(enabled, page._gameGenieCodes.ToArray());

                Program.SelectRoom("main menu");
            }