Ejemplo n.º 1
0
 public static bool loadState(string filename)
 {
     try
     {
         GameBoy.Cpu.Init();
         DebugFunctions.ResetDebug();
         FileStream fs = File.Open(filename, FileMode.Open, FileAccess.Read);
         int        l  = (int)fs.Length;
         byte[]     ba = new byte[l];
         fs.Read(ba, 0, l);
         fs.Close();
         int  startAdr  = 0;
         long imageSize = BitConverter.ToInt64(ba, 0);
         startAdr += 8;
         startAdr += (int)imageSize;
         //CARTRIDGE
         startAdr = GameBoy.Cartridge.Unserialize(ref ba, startAdr);
         //MEM
         startAdr = GameBoy.Ram.Unserialize(ref ba, startAdr);
         //CPU
         startAdr = GameBoy.Cpu.Unserialize(ref ba, startAdr);
         GameBoy.Cpu.Start();
         return(true);
     }
     catch (Exception e)
     {
         Console.Write(e);
         return(false);
     }
 }
Ejemplo n.º 2
0
 private void button_reset_Click(object sender, EventArgs e)
 {
     m_cpu.Init();
     DebugFunctions.ResetDebug();
 }