Beispiel #1
0
void DoState(PointerWrap& p)
{
  // some of this code has been disabled, because
  // it changes registers even in MODE_MEASURE (which is suspicious and seems like it could cause
  // desyncs)
  // and because the values it's changing have been added to CoreTiming::DoState, so it might
  // conflict to mess with them here.

  // rSPR(SPR_DEC) = SystemTimers::GetFakeDecrementer();
  // *((u64 *)&TL) = SystemTimers::GetFakeTimeBase(); //works since we are little endian and TL
  // comes first :)

  p.DoArray(ppcState.gpr);
  p.Do(ppcState.pc);
  p.Do(ppcState.npc);
  p.DoArray(ppcState.cr_val);
  p.Do(ppcState.msr);
  p.Do(ppcState.fpscr);
  p.Do(ppcState.Exceptions);
  p.Do(ppcState.downcount);
  p.Do(ppcState.xer_ca);
  p.Do(ppcState.xer_so_ov);
  p.Do(ppcState.xer_stringctrl);
  p.DoArray(ppcState.ps);
  p.DoArray(ppcState.sr);
  p.DoArray(ppcState.spr);
  p.DoArray(ppcState.tlb);
  p.Do(ppcState.pagetable_base);
  p.Do(ppcState.pagetable_hashmask);

  ppcState.iCache.DoState(p);

  if (p.GetMode() == PointerWrap::MODE_READ)
  {
    IBATUpdated();
    DBATUpdated();
  }

  // SystemTimers::DecrementerSet();
  // SystemTimers::TimeBaseSet();

  JitInterface::DoState(p);
}
Beispiel #2
0
static void ResetRegisters()
{
  memset(ppcState.ps, 0, sizeof(ppcState.ps));
  memset(ppcState.sr, 0, sizeof(ppcState.sr));
  memset(ppcState.gpr, 0, sizeof(ppcState.gpr));
  memset(ppcState.spr, 0, sizeof(ppcState.spr));
  /*
  0x00080200 = lonestar 2.0
  0x00088202 = lonestar 2.2
  0x70000100 = gekko 1.0
  0x00080100 = gekko 2.0
  0x00083203 = gekko 2.3a
  0x00083213 = gekko 2.3b
  0x00083204 = gekko 2.4
  0x00083214 = gekko 2.4e (8SE) - retail HW2
  */
  ppcState.spr[SPR_PVR] = 0x00083214;
  ppcState.spr[SPR_HID1] = 0x80000000;  // We're running at 3x the bus clock
  ppcState.spr[SPR_ECID_U] = 0x0d96e200;
  ppcState.spr[SPR_ECID_M] = 0x1840c00d;
  ppcState.spr[SPR_ECID_L] = 0x82bb08e8;

  ppcState.fpscr.Hex = 0;
  ppcState.pc = 0;
  ppcState.npc = 0;
  ppcState.Exceptions = 0;
  for (auto& v : ppcState.cr_val)
    v = 0x8000000000000001;

  DBATUpdated();
  IBATUpdated();

  TL = 0;
  TU = 0;
  SystemTimers::TimeBaseSet();

  // MSR should be 0x40, but we don't emulate BS1, so it would never be turned off :}
  ppcState.msr.Hex = 0;
  rDEC = 0xFFFFFFFF;
  SystemTimers::DecrementerSet();
}
Beispiel #3
0
void DoState(PointerWrap& p)
{
	// some of this code has been disabled, because
	// it changes registers even in MODE_MEASURE (which is suspicious and seems like it could cause
	// desyncs)
	// and because the values it's changing have been added to CoreTiming::DoState, so it might
	// conflict to mess with them here.

	// rSPR(SPR_DEC) = SystemTimers::GetFakeDecrementer();
	// *((u64 *)&TL) = SystemTimers::GetFakeTimeBase(); //works since we are little endian and TL
	// comes first :)

	p.DoPOD(ppcState);
	if (p.GetMode() == PointerWrap::MODE_READ)
	{
		IBATUpdated();
		DBATUpdated();
	}

	// SystemTimers::DecrementerSet();
	// SystemTimers::TimeBaseSet();

	JitInterface::DoState(p);
}