Esempio n. 1
0
        public Disassembly(USBGecko 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
        }
Esempio n. 2
0
        public Breakpoints(USBGecko 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;
        }
Esempio n. 3
0
        public Disassembly(USBGecko 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
        }
Esempio n. 4
0
        public MemoryViewer(USBGecko 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;
        }
Esempio n. 5
0
        public WatchList(USBGecko 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();
        }
Esempio n. 6
0
        public MemoryViewer(USBGecko 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;
        }
Esempio n. 7
0
        public FST(USBGecko UGecko, TreeView UTreeView, TextBox UFileSwapCode,
                   Button USetAsSourceButton, Button USetAsTargetButton, Button UGenerateFileSwap,
                   Label USourceFileName, Label UTargetFileName, TextBox UGeneratedSwapCode,
                   Button USwapNowButton, ExceptionHandler UExceptionHandling)
        {
            exceptionHandling = UExceptionHandling;
            imgList           = new ImageList();
#if !MONO
            System.Drawing.Icon ni = IconReader.GetFolderIcon(IconReader.IconSize.Small,
                                                              IconReader.FolderType.Closed);
            imgList.Images.Add(ni);
            ni = IconReader.GetFolderIcon(IconReader.IconSize.Small,
                                          IconReader.FolderType.Open);
            imgList.Images.Add(ni);
            ni = IconReader.GetFileIcon("?.?", IconReader.IconSize.Small, false);
            imgList.Images.Add(ni);
#endif
            treeView                 = UTreeView;
            treeView.ImageList       = imgList;
            treeView.NodeMouseClick += TreeView_NodeMouseClick;
            gecko            = UGecko;
            fstTextPositions = new List <fstEntry>();

            fileSwapCode = UFileSwapCode;

            sourceFile        = null;
            targetFile        = null;
            setAsSourceButton = USetAsSourceButton;
            setAsTargetButton = USetAsTargetButton;
            generateFileSwap  = UGenerateFileSwap;
            sourceFileName    = USourceFileName;
            targetFileName    = UTargetFileName;
            generatedSwapCode = UGeneratedSwapCode;
            swapFilesNow      = USwapNowButton;

            setAsSourceButton.Click += SourceButtonClick;
            setAsTargetButton.Click += TargetButtonClick;
            generateFileSwap.Click  += GenSwapButtonClick;
            swapFilesNow.Click      += ImmediateSwap;

            generatedSwapCode.Text    = "";
            targetFileName.Text       = "";
            sourceFileName.Text       = "";
            setAsSourceButton.Enabled = false;
            setAsTargetButton.Enabled = false;
            generateFileSwap.Enabled  = false;
            swapFilesNow.Enabled      = false;
            selectedFile = -1;
        }
Esempio n. 8
0
        public bool Compare(Stream regStream, BreakpointType bpType, UInt32 bpAddress, USBGecko 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;
        }
Esempio n. 9
0
        public bool Check(Stream regStream, BreakpointType bpType, UInt32 bpAddress, USBGecko 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);
        }
Esempio n. 10
0
        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";

            gamename = "";
            gecko = new USBGecko();
            gecko.chunkUpdate += transfer;

            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;

            fst = new FST(gecko, FSTTreeView, FSTCodeData, FSTSetAsSource, FSTSetAsTarget,
                FSTGenSwap, FSTFileSource, FSTFileTarget, FSTSwapCode, FSTSwapNow, 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);
            CUSBGecko.Enabled = true;

            codesModified = false;

            AbtText.Text = "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();

            //Set MEM2 upper to 93400000
            MEM2UpperBoundary.SelectedIndex = 0;

            // 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;

        }
Esempio n. 11
0
        public bool Compare(Stream regStream, BreakpointType bpType, UInt32 bpAddress, USBGecko 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);
        }
Esempio n. 12
0
        public WatchList(USBGecko 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();
        }
Esempio n. 13
0
        public Breakpoints(USBGecko 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;
        }
Esempio n. 14
0
        public bool Check(Stream regStream, BreakpointType bpType, UInt32 bpAddress, USBGecko 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);
        }