public void TestMethod1() { var Config = new PspConfig(); var PspEmulatorContext = new PspEmulatorContext(Config); PspEmulatorContext.SetInstanceType<PspMemory, LazyPspMemory>(); var PspMemory = PspEmulatorContext.GetInstance<PspMemory>(); var PspMemoryStream = new PspMemoryStream(PspMemory); var MipsAssembler = new MipsAssembler(PspMemoryStream); var DynarecFunctionCompilerTask = PspEmulatorContext.GetInstance<DynarecFunctionCompilerTask>(); var CpuProcessor = PspEmulatorContext.GetInstance<CpuProcessor>(); var CpuThreadState = new CpuThreadState(CpuProcessor); MipsAssembler.Assemble(@" .code 0x08000000 addi r1, r1, 1 jr r31 nop "); var DynarecFunction = DynarecFunctionCompilerTask.GetFunctionForAddress(PspMemory.MainSegment.Low); Assert.AreEqual(0, CpuThreadState.GPR[1]); DynarecFunction.Delegate(CpuThreadState); Assert.AreEqual(1, CpuThreadState.GPR[1]); }
public static void Init() { PspConfig = new PspConfig(); foreach (var _FileName in new[] { Path.GetDirectoryName(typeof(Program).Assembly.Location) + @"\CSPspEmu.Hle.Modules.dll", Application.ExecutablePath, }) { if (File.Exists(_FileName)) { PspConfig.HleModulesDll = Assembly.LoadFile(_FileName); break; } } }
public static void Init() { PspConfig = new PspConfig(); PspConfig.DebugSyscalls = false; PspConfig.TraceLastSyscalls = false; PspConfig.ShowInstructionStats = false; PspConfig.StoredConfig.EnableMpeg = true; foreach (var _FileName in new[] { Path.GetDirectoryName(typeof(TestsAutoProgram).Assembly.Location) + @"\CSPspEmu.Hle.Modules.dll", Application.ExecutablePath, }) { if (File.Exists(_FileName)) { PspConfig.HleModulesDll = Assembly.LoadFile(_FileName); break; } } }
public void TestMethod1() { var Config = new PspConfig(); var PspEmulatorContext = new PspEmulatorContext(Config); PspEmulatorContext.SetInstanceType<PspMemory, LazyPspMemory>(); var DynarecFunctionCompiler = PspEmulatorContext.GetInstance<DynarecFunctionCompiler>(); var CpuProcessor = PspEmulatorContext.GetInstance<CpuProcessor>(); var CpuThreadState = new CpuThreadState(CpuProcessor); var DynarecFunction = DynarecFunctionCompiler.CreateFunction( new InstructionArrayReader(MipsAssembler.StaticAssembleInstructions(@" addi r1, r1, 1 jr r31 nop ")), 0 ); Assert.AreEqual(0, CpuThreadState.GPR[1]); DynarecFunction.Delegate(CpuThreadState); Assert.AreEqual(1, CpuThreadState.GPR[1]); }
public ButtonMappingForm(PspConfig PspConfig) { InitializeComponent(); this.PspConfig = PspConfig; LoadConfig(); foreach (var Field in typeof(ButtonMappingForm).GetFields().Where(Item => Item.FieldType == typeof(TextBox))) { var TextBox = (Field.GetValue(this) as TextBox); TextBox.KeyDown += this.HandleKeyDown; TextBox.GotFocus += this.HandleGotFocus; TextBox.LostFocus += this.HandleLostFocus; var ConfigField = typeof(ControllerConfig).GetField(TextBox.Name); if (ConfigField != null) TextBox.Text = (String)ConfigField.GetValue(CurrentControllerConfig); } this.AcceptButton = button1; this.CancelButton = button2; this.Load += HandleLoad; }
/// <summary> /// Constructor. /// </summary> public PspEmulator() { PspConfig = new PspConfig(); }
public HleThread(PspEmulatorContext PspEmulatorContext, CpuThreadState CpuThreadState) { this.HleInterruptManager = PspEmulatorContext.GetInstance<HleInterruptManager>(); this.HleThreadManager = PspEmulatorContext.GetInstance<HleThreadManager>(); this.MethodCache = CpuThreadState.CpuProcessor.MethodCache; this.PspConfig = CpuThreadState.CpuProcessor.PspConfig; if (this.PspConfig.UseCoRoutines) { this.Coroutine = HleThreadManager.Processor.CoroutinePool.CreateCoroutine(this.Name, MainLoop); } else { this.GreenThread = new GreenThread(); GreenThread.InitAndStartStopped(MainLoop); } this.CpuThreadState = CpuThreadState; }
public HleThread(CpuThreadState CpuThreadState) { this.MethodCache = CpuThreadState.CpuProcessor.MethodCache; this.PspConfig = CpuThreadState.CpuProcessor.PspConfig; this.GreenThread = new GreenThread(); this.CpuThreadState = CpuThreadState; this.PrepareThread(); }
public override void InitializeComponent() { this.PspConfig = PspEmulatorContext.PspConfig; }
static void Main(string[] args) { var PspConfig = new PspConfig(); var PspEmulatorContext = new PspEmulatorContext(PspConfig); var DebugPspMemory = PspEmulatorContext.GetInstance<DebugPspMemory>(); PspEmulatorContext.SetInstance<PspMemory>(DebugPspMemory); var CpuProcessor = PspEmulatorContext.GetInstance<CpuProcessor>(); var CpuThreadState = new CpuThreadState(CpuProcessor); var Dma = new Dma(CpuThreadState); DebugPspMemory.CpuThreadState = CpuThreadState; DebugPspMemory.Dma = Dma; Console.SetWindowSize(120, 60); Console.SetBufferSize(120, 8000); PspConfig.MustLogWrites = true; var NandStream = File.OpenRead(NandPath); //DebugPspMemory.Write4(0xBFC00FFC, 0x20040420); // It doesn't start the ME //DebugPspMemory.Write4(0xBFC00FFC, 0xFFFFFFFF); #if false // PRE-IPL uint StartPC = 0x1FC00000; DebugPspMemory.WriteBytes(StartPC, File.ReadAllBytes(PreIplPath)); PspConfig.TraceJal = true; //PspConfig.TraceJIT = true; #else var IplReader = new IplReader(new NandReader(NandStream)); var Info = IplReader.LoadIplToMemory(new PspMemoryStream(DebugPspMemory)); uint StartPC = Info.EntryFunction; #endif /* ME: li $t0, 0x40EC19C jr $t0 nop */ //IplReader.WriteIplToFile(File.Open(NandPath + ".ipl.bin", FileMode.Create, FileAccess.Write)); var LLEState = new LLEState(); Dma.LLEState = LLEState; LLEState.GPIO = new LleGPIO(); LLEState.NAND = new LleNAND(NandStream); LLEState.Cpu = new LlePspCpu("CPU", PspEmulatorContext, CpuProcessor, StartPC); LLEState.Me = new LlePspCpu("ME", PspEmulatorContext, CpuProcessor, StartPC); LLEState.LleKirk = new LleKirk(DebugPspMemory); LLEState.Memory = DebugPspMemory; LLEState.Cpu.Start(); while (true) Thread.Sleep(int.MaxValue); }
//public event Action ApplicationExit; public PspEmulatorContext(PspConfig PspConfig) { this.PspConfig = PspConfig; }