2009-09-08 12:08:10 +00:00
|
|
|
/* PCSX2 - PS2 Emulator for PCs
|
2010-05-03 14:08:02 +00:00
|
|
|
* Copyright (C) 2002-2010 PCSX2 Dev Team
|
2010-04-25 00:31:27 +00:00
|
|
|
*
|
2009-09-08 12:08:10 +00:00
|
|
|
* PCSX2 is free software: you can redistribute it and/or modify it under the terms
|
|
|
|
* of the GNU Lesser General Public License as published by the Free Software Found-
|
|
|
|
* ation, either version 3 of the License, or (at your option) any later version.
|
2009-02-09 21:15:56 +00:00
|
|
|
*
|
2009-09-08 12:08:10 +00:00
|
|
|
* PCSX2 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
|
|
|
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
|
|
|
* PURPOSE. See the GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along with PCSX2.
|
|
|
|
* If not, see <http://www.gnu.org/licenses/>.
|
2009-02-09 21:15:56 +00:00
|
|
|
*/
|
|
|
|
|
2009-09-08 12:08:10 +00:00
|
|
|
|
2009-02-09 21:15:56 +00:00
|
|
|
#include "PrecompiledHeader.h"
|
|
|
|
#include "Common.h"
|
2009-12-07 14:00:39 +00:00
|
|
|
#include "VUmicro.h"
|
2009-02-09 21:15:56 +00:00
|
|
|
|
2010-11-15 14:05:02 +00:00
|
|
|
|
2010-08-27 03:21:16 +00:00
|
|
|
__aligned16 VURegs vuRegs[2];
|
|
|
|
|
2009-02-09 21:15:56 +00:00
|
|
|
|
2010-11-15 14:05:02 +00:00
|
|
|
vuMemoryReserve::vuMemoryReserve()
|
|
|
|
: _parent( L"VU0/1 on-chip memory", VU1_PROGSIZE + VU1_MEMSIZE + VU0_PROGSIZE + VU0_MEMSIZE )
|
2009-02-09 21:15:56 +00:00
|
|
|
{
|
2010-11-15 14:05:02 +00:00
|
|
|
}
|
2009-02-09 21:15:56 +00:00
|
|
|
|
2010-11-15 14:05:02 +00:00
|
|
|
void vuMemoryReserve::Reserve()
|
|
|
|
{
|
|
|
|
_parent::Reserve(HostMemoryMap::VUmem);
|
|
|
|
//_parent::Reserve(EmuConfig.HostMemMap.VUmem);
|
2009-02-09 21:15:56 +00:00
|
|
|
|
2010-11-15 14:05:02 +00:00
|
|
|
u8* curpos = m_reserve.GetPtr();
|
2010-11-16 00:22:18 +00:00
|
|
|
VU0.Micro = curpos; curpos += VU0_PROGSIZE;
|
|
|
|
VU0.Mem = curpos; curpos += VU0_MEMSIZE;
|
|
|
|
VU1.Micro = curpos; curpos += VU1_PROGSIZE;
|
|
|
|
VU1.Mem = curpos; curpos += VU1_MEMSIZE;
|
2009-02-09 21:15:56 +00:00
|
|
|
}
|
|
|
|
|
2010-11-15 14:05:02 +00:00
|
|
|
void vuMemoryReserve::Release()
|
2009-02-09 21:15:56 +00:00
|
|
|
{
|
2010-11-15 14:05:02 +00:00
|
|
|
_parent::Release();
|
2009-02-09 21:15:56 +00:00
|
|
|
|
2010-11-15 14:05:02 +00:00
|
|
|
VU0.Micro = VU0.Mem = NULL;
|
|
|
|
VU1.Micro = VU1.Mem = NULL;
|
2009-02-09 21:15:56 +00:00
|
|
|
}
|
|
|
|
|
2010-11-15 14:05:02 +00:00
|
|
|
void vuMemoryReserve::Reset()
|
2009-02-09 21:15:56 +00:00
|
|
|
{
|
2010-11-15 14:05:02 +00:00
|
|
|
_parent::Reset();
|
|
|
|
|
2011-07-24 13:02:50 +00:00
|
|
|
pxAssert( VU0.Mem );
|
|
|
|
pxAssert( VU1.Mem );
|
2009-02-09 21:15:56 +00:00
|
|
|
|
2011-08-12 02:31:49 +00:00
|
|
|
// Below memMap is already called by "void eeMemoryReserve::Reset()"
|
|
|
|
//memMapVUmicro();
|
2009-02-09 21:15:56 +00:00
|
|
|
|
|
|
|
// === VU0 Initialization ===
|
2009-09-23 12:53:32 +00:00
|
|
|
memzero(VU0.ACC);
|
|
|
|
memzero(VU0.VF);
|
|
|
|
memzero(VU0.VI);
|
2009-02-09 21:15:56 +00:00
|
|
|
VU0.VF[0].f.x = 0.0f;
|
|
|
|
VU0.VF[0].f.y = 0.0f;
|
|
|
|
VU0.VF[0].f.z = 0.0f;
|
|
|
|
VU0.VF[0].f.w = 1.0f;
|
|
|
|
VU0.VI[0].UL = 0;
|
|
|
|
|
|
|
|
// === VU1 Initialization ===
|
2009-09-23 12:53:32 +00:00
|
|
|
memzero(VU1.ACC);
|
|
|
|
memzero(VU1.VF);
|
|
|
|
memzero(VU1.VI);
|
2009-02-09 21:15:56 +00:00
|
|
|
VU1.VF[0].f.x = 0.0f;
|
|
|
|
VU1.VF[0].f.y = 0.0f;
|
|
|
|
VU1.VF[0].f.z = 0.0f;
|
|
|
|
VU1.VF[0].f.w = 1.0f;
|
|
|
|
VU1.VI[0].UL = 0;
|
|
|
|
}
|
|
|
|
|
2009-09-16 17:23:02 +00:00
|
|
|
void SaveStateBase::vuMicroFreeze()
|
2009-02-09 21:15:56 +00:00
|
|
|
{
|
2010-11-18 13:01:38 +00:00
|
|
|
FreezeTag( "vuMicroRegs" );
|
2009-02-09 21:15:56 +00:00
|
|
|
|
|
|
|
Freeze(VU0.ACC);
|
2010-11-18 13:01:38 +00:00
|
|
|
Freeze(VU0.code);
|
2009-02-09 21:15:56 +00:00
|
|
|
|
|
|
|
Freeze(VU0.VF);
|
2009-03-19 04:16:24 +00:00
|
|
|
Freeze(VU0.VI);
|
2009-02-09 21:15:56 +00:00
|
|
|
|
|
|
|
Freeze(VU1.ACC);
|
2010-07-07 20:01:30 +00:00
|
|
|
|
|
|
|
u32& temp_vu1_code = VU1.code;
|
2010-07-07 09:14:47 +00:00
|
|
|
Freeze(temp_vu1_code);
|
2010-07-07 20:01:30 +00:00
|
|
|
|
2009-02-09 21:15:56 +00:00
|
|
|
Freeze(VU1.VF);
|
2009-03-19 04:16:24 +00:00
|
|
|
Freeze(VU1.VI);
|
2009-02-09 21:15:56 +00:00
|
|
|
}
|