예제 #1
0
        }         //GEN-LAST:event_btnClearActionPerformed

        private void btnImportCheatDBActionPerformed([email protected] evt)
        {         //GEN-FIRST:event_btnImportCheatDBActionPerformed
            File cheatDBFile = new File("cheat.db");

            if (cheatDBFile.canRead())
            {
                try
                {
                    System.IO.StreamReader reader = new System.IO.StreamReader(cheatDBFile);
                    bool insideApplicationid      = false;
                    while (reader.ready())
                    {
                        string line = reader.ReadLine();
                        if (string.ReferenceEquals(line, null))
                        {
                            // end of file
                            break;
                        }
                        line = line.Trim();
                        if (line.StartsWith("_S ", StringComparison.Ordinal))
                        {
                            string applicationId = line.Substring(2).Trim().Replace("-", "");
                            insideApplicationid = applicationId.Equals(State.discId, StringComparison.OrdinalIgnoreCase);
                        }
                        if (insideApplicationid)
                        {
                            // Add the line to the cheat codes
                            addCheatLine(line);
                        }
                    }
                    reader.Close();
                }
                catch (IOException e)
                {
                    Emulator.Console.WriteLine("Import from cheat.db", e);
                }
            }
            else
            {
                JpcspDialogManager.showInformation(this, java.util.ResourceBundle.getBundle("pspsharp/languages/pspsharp").getString("CheatsGUI.strReadFromDB.text"));
            }
        }         //GEN-LAST:event_btnImportCheatDBActionPerformed
예제 #2
0
        }         //GEN-LAST:event_btnImportCheatDBActionPerformed

        private void btnOnOffActionPerformed([email protected] evt)
        {         //GEN-FIRST:event_btnOnOffActionPerformed
            if (btnOnOff.Selected)
            {
                if (taCheats.Text.Empty)
                {
                    JpcspDialogManager.showInformation(this, java.util.ResourceBundle.getBundle("pspsharp/languages/pspsharp").getString("CheatsGUI.strNoCheatsEntered.text"));
                    btnOnOff.Selected = false;
                    return;
                }

                if (cheatsThread == null)
                {
                    taCheats.Editable        = false;
                    taCheats.BackgRound      = UIManager.getColor("Panel.backgRound");
                    btnClear.Enabled         = false;
                    btnImportCheatDB.Enabled = false;

                    cheatsThread          = new CheatsThread(this);
                    cheatsThread.Priority = Thread.MIN_PRIORITY;
                    cheatsThread.Name     = "HLECheatThread";
                    cheatsThread.Daemon   = true;
                    cheatsThread.Start();
                }
            }
            else
            {
                if (cheatsThread != null)
                {
                    taCheats.Editable        = true;
                    taCheats.BackgRound      = UIManager.getColor("TextArea.backgRound");
                    btnClear.Enabled         = true;
                    btnImportCheatDB.Enabled = true;

                    cheatsThread.exit();
                }
            }
        }         //GEN-LAST:event_btnOnOffActionPerformed
예제 #3
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public pspsharp.HLE.kernel.types.SceModule load(String pspfilename, ByteBuffer f, bool fromSyscall) throws java.io.IOException, GeneralJpcspException
        public virtual SceModule load(string pspfilename, ByteBuffer f, bool fromSyscall)
        {
            initNewPsp(fromSyscall);

            HLEModuleManager.Instance.loadAvailableFlash0Modules(fromSyscall);

            int loadAddress = LoadAddress;

            module = Loader.Instance.LoadModule(pspfilename, f, loadAddress, USER_PARTITION_ID, USER_PARTITION_ID, false, true, fromSyscall);

            if ((module.fileFormat & Loader.FORMAT_ELF) != Loader.FORMAT_ELF)
            {
                throw new GeneralJpcspException("File format not supported!");
            }
            if (isBootModuleBad(module.modname))
            {
                JpcspDialogManager.showError(null, java.util.ResourceBundle.getBundle("pspsharp/languages/pspsharp").getString("Emulator.strPrometheusLoader.text"));
            }

            moduleLoaded = true;
            initCpu(fromSyscall);

            // Delete breakpoints and reset to PC
            if (State.debugger != null)
            {
                State.debugger.resetDebugger();
            }

            // Update instruction counter dialog with the new app
            if (instructionCounter != null)
            {
                instructionCounter.Module = module;
            }

            return(module);
        }