public Disassembly(TCPGecko UGecko, String UVdappPath, ListBox UMainBox, VScrollBar UScroll,TextBox UAInput,TextBox UASAddress,TextBox UASText,ExceptionHandler UEXCHandler) { gecko = UGecko; exceptionHandling = UEXCHandler; vdappPath = UVdappPath; if (!GlobalFunctions.tryToHex(GeckoApp.Properties.Settings.Default.MemViewAddr, out cAddress)) { // If the restored value is corrupt, use this instead cAddress = 0x80003100; } scrollbar = UScroll; mainBox = UMainBox; adressInput = UAInput; asAddress = UASAddress; asText = UASText; mainBox.SelectedIndexChanged += MainBoxClick; mainBox.DoubleClick += MainBoxDoubleClick; mainBox.KeyDown += MainBoxKeyDown; scrollbar.Scroll += Scrolling; #if MONO GAs = "powerpc-eabi-as"; GLd = "powerpc-eabi-ld"; GOc = "powerpc-eabi-objcopy"; #else GAs = "powerpc-gekko-as.exe"; GLd = "powerpc-gekko-ld.exe"; GOc = "powerpc-gekko-objcopy.exe"; #endif }
public MemoryViewer(TCPGecko UGecko, UInt32 initAddress,DataGridView UGView, TextBox UPokeAddress,TextBox UPokeValue,Label UFPValue, ExceptionHandler UExpHandler) { gecko = UGecko; exceptionHandling = UExpHandler; cAddress = initAddress; gView = UGView; pokeAddress = UPokeAddress; pokeValue = UPokeValue; fpValue = UFPValue; gView.CellClick += CellClick; gView.SelectionChanged += CellSelectionChange; }
public static void setDataUpper(TCPGecko upper) { UInt32 mem; switch (upper.OsVersionRequest()) { case 400: case 410: mem = upper.peek_kern(0xffe8619c); break; case 500: case 510: return; // TODO: This doesn't work for some reason - crashes on connection? //mem = upper.peek_kern(0xffe8591c); //break; default: return; } UInt32 tbl = upper.peek_kern(mem + 4); UInt32 lst = upper.peek_kern(tbl + 20); UInt32 init_start = upper.peek_kern(lst + 0 + 0x00); UInt32 init_len = upper.peek_kern(lst + 4 + 0x00); UInt32 code_start = upper.peek_kern(lst + 0 + 0x10); UInt32 code_len = upper.peek_kern(lst + 4 + 0x10); UInt32 data_start = upper.peek_kern(lst + 0 + 0x20); UInt32 data_len = upper.peek_kern(lst + 4 + 0x20); ValidAreas[0] = new AddressRange(AddressType.Ex, init_start, init_start + init_len); ValidAreas[1] = new AddressRange(AddressType.Ex, code_start, code_start + code_len); ValidAreas[2] = new AddressRange(AddressType.Rw, data_start, data_start + data_len); }
private void MainForm_Load(object sender, EventArgs e) { this.Icon = Icon.ExtractAssociatedIcon(System.Reflection.Assembly.GetEntryAssembly().Location); int i; SettingsFile = new Xml("gecko.xml"); SettingsFile.RootName = "gecko"; MainControl.TabPages.Remove(GCTPage); MainControl.TabPages.Remove(BreakpointPage); MainControl.TabPages.Remove(shotPage); gamename = ""; gecko = new TCPGecko(Properties.Settings.Default.hostname, 7331); gecko.chunkUpdate += transfer; hostTextBox.DataBindings.Add("Text", gecko, "Host", false, DataSourceUpdateMode.OnPropertyChanged); exceptionHandling = new ExceptionHandler(this); if (!Directory.Exists("DumpHistory")) Directory.CreateDirectory("DumpHistory"); search = new MemSearch(gecko, SearchResults, PrvPage, NxtPage, ResList, UpDownSearchResultPage, exceptionHandling); viewer = new MemoryViewer(gecko, ValidMemory.ValidAreas[0].low, memViewGrid, memViewPAddress, memViewPValue, MemViewFPValue, exceptionHandling); #if MONO disassembler = new Disassembly(gecko, "./vdappc", DisAssBox, DisScroll, DisRegion, AsAddress, AsText, exceptionHandling); #else disassembler = new Disassembly(gecko, "vdappc.exe", DisAssBox, DisScroll, DisRegion, AsAddress, AsText, exceptionHandling); #endif bpHandler = new Breakpoints(gecko, BPList, this, disassembler, BPDiss, BPClassic, BPCondList, exceptionHandling); //bpHandler = new Breakpoints(gecko, BPList, this, disassembler, richTextBox1, BPClassic, BPCondList, exceptionHandling); foreach (String reg in BPList.longRegNames) BPConditionRegSelect.Items.Add(reg.Trim()); BPConditionRegSelect.Items.Add("VoA"); BPConditionRegSelect.SelectedIndex = 0; BPConditionCompare.SelectedIndex = 0; bpHandler.BPSkip += BPSkipped; watcher = new WatchList(gecko, WatchList, WatchIntervalSet, exceptionHandling); addWatchDialog = null; watchValueInput = null; fsa = new FSA(gecko, FSATreeView, extractFsaToolStripMenuItem, FSACodeData, exceptionHandling); GCTCodeContents = new CodeController(GCTCodeList, GCTCodeValues); GCTCodeContents.codesModified += GCTModified; bpHandler.BPStop += BPStopped; for (i = 0; i < ValidMemory.ValidAreas.Length; i++) { memRange.Items.Add( GlobalFunctions.toHex(ValidMemory.ValidAreas[i].id, 2)); MemViewARange.Items.Add( GlobalFunctions.toHex(ValidMemory.ValidAreas[i].id, 2)); ToolsDumpRegions.Items.Add( GlobalFunctions.toHex(ValidMemory.ValidAreas[i].id, 2)); } codeWizard = new GCTWizard(GCTCodeContents); memRange.SelectedIndex = 0; MemViewARange.SelectedIndex = 0; MemViewShowMode.SelectedIndex = 0; MemViewSearchType.SelectedIndex = 0; ToolsDumpRegions.SelectedIndex = 0; comboBoxSearchDataType.SelectedIndex = 2; //UpperEnable.SelectedIndex = 0; //BPType.SelectedIndex = 0; comboBoxDisplayType.SelectedIndex = 0; WasAlreadyDisabled = new List<Control>(); searchComparisons = new List<SearchComparisonInfo>(); searchComparisons.Add(new SearchComparisonInfo()); comboBoxComparisonType.SelectedIndex = 0; comboBoxComparisonRHS.SelectedIndex = 0; buttonCancelSearch.Enabled = false; SteppingOut = false; buttonUndoSearch.Enabled = search.CanUndo(); TabLock = null; BPStepLogWriter = null; comboBoxPokeOperation.SelectedIndex = 0; SetComboboxValue("Screenshots", "Format", 0, ImgFormat); SetComboboxValue("Screenshots", "Sizing", 0, ShotSizingType); int value = SettingsFile.GetValue("Screenshots", "JPEGQuality", 85); if (value < 0 || value > 100) value = 85; JPGQual.Value = value; multiPokeAddr = new List<UInt32>(); FormStop(false); CTCPGecko.Enabled = true; codesModified = false; AbtText.Text = "tcpGecko dotNET Beta 0.1 by Chadderz\n" + "based on gecko dotNET Beta 0.63 by Link and dcx2\n\n" + "Special thanks to:\n\n" + "kenobi: for original WiiRd GUI!\n" + "Nuke: for the USB Gecko!\n" + "brkirch: for continuing Gecko OS!\n" + "Y.S.: for the original code handler!\n" + "Team Twiizers for bringing homebrew to the Wii\n" + "DevKitPro team: No homebrew without them!\n" + "Frank Wille: vdappc developer!\n" + "various beta testers!\n" + "and you!"; notes = new NoteSheets(); // Restore previous settings checkBoxAlwaysOnTop.Checked = GeckoApp.Properties.Settings.Default.AlwaysOnTop; numericUpDownFPS.Value = GeckoApp.Properties.Settings.Default.FPS; BPAddress.Text = GeckoApp.Properties.Settings.Default.BPAddr; memViewAValue.Text = GeckoApp.Properties.Settings.Default.MemViewAddr; BPType.SelectedIndex = GeckoApp.Properties.Settings.Default.BPType; checkBoxBPNext.Checked = GeckoApp.Properties.Settings.Default.BPNext; checkBoxPauseCodes.Checked = GeckoApp.Properties.Settings.Default.PauseCodes; Size = GeckoApp.Properties.Settings.Default.LastSize; int oldSplitter = GeckoApp.Properties.Settings.Default.LastSplitterSize; // The splitter gets moved when the breakpoint page is entered // so artificially force it to move MainControl.SelectedTab = BreakpointPage; MainControl.SelectedTab = searchPage; splitContainerRegASM.SplitterDistance = oldSplitter; toolStripTextBoxMemViewFontSize.Text = GeckoApp.Properties.Settings.Default.MemViewFontSize.ToString(); toolStripTextBoxMemViewFontSize_KeyDown(null, new KeyEventArgs(Keys.Enter)); viewFloatsInHexToolStripMenuItem.Checked = GeckoApp.Properties.Settings.Default.ViewFloatsInHex; //addressTextBox1.CopyStringToHistory(GeckoApp.Properties.Settings.Default.addressHistory); //addressTextBox1.AutoHistory = true; }
public Breakpoints(TCPGecko UGecko, BPList UBPOut, MainForm UMainForm, Disassembly UDissAss, //RichTextBox UDissBox, TextBox UClassicBox, ListBox conditionList, ExceptionHandler UExcHandler) TextBox UDissBox, TextBox UClassicBox, ListBox conditionList, ExceptionHandler UExcHandler) { exceptionHandling = UExcHandler; gecko = UGecko; bpOutput = UBPOut; mainForm = UMainForm; listSet = false; disassembler = UDissAss; dissBox = UDissBox; classicBox = UClassicBox; stepOverPossible = false; changableRegs = new UInt32[40]; regDialog = new RegisterDialog(); PConditions = new BreakpointConditions(conditionList); for (int i = 0; i < 40; i++) { bpOutput.shortRegTextBox[i].Click += clickReg; } ShowFloatsInHex = false; }
public bool Check(Stream regStream, BreakpointType bpType, UInt32 bpAddress, TCPGecko gecko) { if (!Enabled) return true; if (PConditions.Count == 0) return true; if (regStream.Length != 0x120) return false; List<UInt32> groups = new List<uint>(); // Fill it up with each groupNumber in the condition list foreach (BreakpointCondition cond in PConditions) { if (!groups.Contains(cond.GroupNumber)) groups.Add(cond.GroupNumber); } // If any condition fails, remove it's group number from the group foreach (BreakpointCondition cond in PConditions) { if (groups.Contains(cond.GroupNumber) && !cond.Compare(regStream, bpType, bpAddress, gecko)) groups.Remove(cond.GroupNumber); } // If there are any left, we succeeded! return (groups.Count != 0); }
public bool Compare(Stream regStream, BreakpointType bpType, UInt32 bpAddress, TCPGecko gecko) { if (regStream.Length != 0x120) return false; int spos = PRegister * 4; UInt32 val = 0; if (spos == 0x120) //Value of address is supposed to be checked { switch (bpType) { case BreakpointType.Read: val = gecko.peek(bpAddress); break; case BreakpointType.ReadWrite: case BreakpointType.Write: gecko.Step(); val = gecko.peek(bpAddress); break; default: return true; } } else { regStream.Seek(spos, SeekOrigin.Begin); val = GlobalFunctions.ReadStream(regStream); } switch (PCondition) { case BreakpointComparison.Equal: return (val == PValue); case BreakpointComparison.NotEqual: return (val != PValue); case BreakpointComparison.Greater: return (val > PValue); case BreakpointComparison.GreaterEqual: return (val >= PValue); case BreakpointComparison.Lower: return (val < PValue); case BreakpointComparison.LowerEqual: return (val <= PValue); } return true; }
public WatchList(TCPGecko UGecko,DataGridView UWatchOut,NumericUpDown UWatchUpDown,ExceptionHandler UEXCHandler) { exceptionHandling = UEXCHandler; PAddressDebug = false; addressWatchList = new List<WatchEntry>(); gecko = UGecko; watchOut = UWatchOut; watchUpDown = UWatchUpDown; listEnabled = true; listActive = true; listManager = new Thread(UpdateListThread); listManager.Start(); }