2015-05-07 01:52:45 -04:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "Types.h"
|
|
|
|
#include "../MIPS.h"
|
|
|
|
#include "../Profiler.h"
|
|
|
|
#include "Convertible.h"
|
|
|
|
#include "zip/ZipArchiveWriter.h"
|
|
|
|
#include "zip/ZipArchiveReader.h"
|
|
|
|
|
|
|
|
class CVif;
|
|
|
|
class CGIF;
|
2017-08-20 18:03:24 -04:00
|
|
|
class CINTC;
|
2015-05-07 01:52:45 -04:00
|
|
|
|
|
|
|
class CVpu
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
enum VU1REGISTERS
|
|
|
|
{
|
2018-04-30 21:01:23 +01:00
|
|
|
VU_TOP = 0x8400,
|
|
|
|
VU_XGKICK = 0x8410,
|
|
|
|
VU_ITOP = 0x8420,
|
|
|
|
VU_CMSAR1 = 0x1000FFC0, //This is meant to be used by the EE through CTC2
|
2015-05-07 01:52:45 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
struct VPUINIT
|
|
|
|
{
|
2018-04-30 21:01:23 +01:00
|
|
|
VPUINIT(uint8* microMem, uint8* vuMem, CMIPS* context)
|
|
|
|
: microMem(microMem)
|
|
|
|
, vuMem(vuMem)
|
|
|
|
, context(context)
|
2015-05-07 01:52:45 -04:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
uint8* microMem;
|
|
|
|
uint8* vuMem;
|
|
|
|
CMIPS* context;
|
|
|
|
};
|
|
|
|
|
2019-10-15 18:47:55 -04:00
|
|
|
typedef Framework::CSignal<void(bool)> VuStateChangedEvent;
|
2019-10-14 12:55:09 -04:00
|
|
|
|
2018-04-30 21:01:23 +01:00
|
|
|
CVpu(unsigned int, const VPUINIT&, CGIF&, CINTC&, uint8*, uint8*);
|
|
|
|
virtual ~CVpu();
|
2015-05-07 01:52:45 -04:00
|
|
|
|
2018-04-30 21:01:23 +01:00
|
|
|
void Execute(int32);
|
|
|
|
void Reset();
|
|
|
|
void SaveState(Framework::CZipArchiveWriter&);
|
|
|
|
void LoadState(Framework::CZipArchiveReader&);
|
2015-05-07 01:52:45 -04:00
|
|
|
|
2018-04-30 21:01:23 +01:00
|
|
|
CMIPS& GetContext() const;
|
|
|
|
uint8* GetMicroMemory() const;
|
2020-07-10 16:31:09 -04:00
|
|
|
uint32 GetMicroMemorySize() const;
|
2018-04-30 21:01:23 +01:00
|
|
|
uint8* GetVuMemory() const;
|
|
|
|
uint32 GetVuMemorySize() const;
|
|
|
|
bool IsVuRunning() const;
|
2015-05-07 01:52:45 -04:00
|
|
|
|
2018-04-30 21:01:23 +01:00
|
|
|
CVif& GetVif();
|
2015-05-07 01:52:45 -04:00
|
|
|
|
2018-04-30 21:01:23 +01:00
|
|
|
void ExecuteMicroProgram(uint32);
|
|
|
|
void InvalidateMicroProgram();
|
2019-10-18 13:04:26 -04:00
|
|
|
void InvalidateMicroProgram(uint32, uint32);
|
2015-05-07 01:52:45 -04:00
|
|
|
|
2018-04-30 21:01:23 +01:00
|
|
|
void ProcessXgKick(uint32);
|
2015-05-07 01:52:45 -04:00
|
|
|
|
|
|
|
#ifdef DEBUGGER_INCLUDED
|
2018-04-30 21:01:23 +01:00
|
|
|
void SaveMiniState();
|
|
|
|
const MIPSSTATE& GetVuMiniState() const;
|
|
|
|
uint8* GetVuMemoryMiniState() const;
|
|
|
|
uint8* GetMicroMemoryMiniState() const;
|
|
|
|
uint32 GetVuTopMiniState() const;
|
|
|
|
uint32 GetVuItopMiniState() const;
|
2015-05-07 01:52:45 -04:00
|
|
|
#endif
|
|
|
|
|
2019-10-14 12:55:09 -04:00
|
|
|
VuStateChangedEvent VuStateChanged;
|
|
|
|
|
2015-05-07 01:52:45 -04:00
|
|
|
protected:
|
|
|
|
typedef std::unique_ptr<CVif> VifPtr;
|
|
|
|
|
2018-04-30 21:01:23 +01:00
|
|
|
uint8* m_microMem = nullptr;
|
2020-07-10 16:31:09 -04:00
|
|
|
uint32 m_microMemSize = 0;
|
2018-04-30 21:01:23 +01:00
|
|
|
uint8* m_vuMem = nullptr;
|
|
|
|
uint32 m_vuMemSize = 0;
|
|
|
|
CMIPS* m_ctx = nullptr;
|
|
|
|
CGIF& m_gif;
|
|
|
|
VifPtr m_vif;
|
2015-05-07 01:52:45 -04:00
|
|
|
|
|
|
|
#ifdef DEBUGGER_INCLUDED
|
2018-08-30 13:25:46 -04:00
|
|
|
MIPSSTATE m_vuMiniState;
|
2018-04-30 21:01:23 +01:00
|
|
|
uint8* m_microMemMiniState;
|
|
|
|
uint8* m_vuMemMiniState;
|
|
|
|
uint32 m_topMiniState;
|
|
|
|
uint32 m_itopMiniState;
|
2015-05-07 01:52:45 -04:00
|
|
|
#endif
|
|
|
|
|
2018-04-30 21:01:23 +01:00
|
|
|
unsigned int m_number = 0;
|
|
|
|
bool m_running = false;
|
2015-05-07 01:52:45 -04:00
|
|
|
|
2018-04-30 21:01:23 +01:00
|
|
|
CProfiler::ZoneHandle m_vuProfilerZone = 0;
|
2015-05-07 01:52:45 -04:00
|
|
|
};
|