Clang format

This commit is contained in:
Clang-Format 2018-04-30 21:01:23 +01:00
parent 2efab18cb5
commit acf75535ec
707 changed files with 21870 additions and 21827 deletions

View file

@ -5,9 +5,8 @@
#define CONFIG_FILENAME (L"config.xml")
CAppConfig::CAppConfig()
: CConfig(BuildConfigPath())
: CConfig(BuildConfigPath())
{
}
Framework::CConfig::PathType CAppConfig::GetBasePath()

View file

@ -31,7 +31,8 @@ struct AOT_BLOCK
};
#pragma pack(pop)
extern "C" {
extern "C"
{
extern AOT_BLOCK _aot_firstBlock;
extern uint32 _aot_blockCount;
}
@ -39,11 +40,11 @@ extern "C" {
#endif
CBasicBlock::CBasicBlock(CMIPS& context, uint32 begin, uint32 end)
: m_begin(begin)
, m_end(end)
, m_context(context)
: m_begin(begin)
, m_end(end)
, m_context(context)
#ifdef AOT_USE_CACHE
, m_function(nullptr)
, m_function(nullptr)
#endif
{
assert(m_end >= m_begin);
@ -82,16 +83,15 @@ void CBasicBlock::Compile()
{
jitter->SetVariableAsConstant(
offsetof(CMIPS, m_State.nGPR[CMIPS::R0].nV[i]),
0
);
0);
}
}
jitter->SetStream(&stream);
jitter->Begin();
CompileRange(jitter);
// codeGen.DumpVariables(0);
// codeGen.EndQuota();
// codeGen.DumpVariables(0);
// codeGen.EndQuota();
jitter->End();
}
@ -137,15 +137,14 @@ void CBasicBlock::Compile()
AOT_BLOCK* blocksBegin = &_aot_firstBlock;
AOT_BLOCK* blocksEnd = blocksBegin + _aot_blockCount;
AOT_BLOCK blockRef = { blockChecksum, m_begin, m_end, nullptr };
AOT_BLOCK blockRef = {blockChecksum, m_begin, m_end, nullptr};
static const auto blockComparer =
[] (const AOT_BLOCK& item1, const AOT_BLOCK& item2)
{
[](const AOT_BLOCK& item1, const AOT_BLOCK& item2) {
return item1.key < item2.key;
};
// assert(std::is_sorted(blocksBegin, blocksEnd, blockComparer));
// assert(std::is_sorted(blocksBegin, blocksEnd, blockComparer));
bool blockExists = std::binary_search(blocksBegin, blocksEnd, blockRef, blockComparer);
auto blockIterator = std::lower_bound(blocksBegin, blocksEnd, blockRef, blockComparer);

View file

@ -13,7 +13,7 @@ struct AOT_BLOCK_KEY
uint32 begin;
uint32 end;
bool operator <(const AOT_BLOCK_KEY& k2) const
bool operator<(const AOT_BLOCK_KEY& k2) const
{
const auto& k1 = (*this);
if(k1.crc == k2.crc)
@ -64,7 +64,6 @@ protected:
virtual void CompileRange(CMipsJitter*);
private:
#ifdef AOT_BUILD_CACHE
static Framework::CStdStream* m_aotBlockOutputStream;
static std::mutex m_aotBlockOutputStreamMutex;

View file

@ -31,7 +31,9 @@ typedef std::vector<BIOS_DEBUG_THREAD_INFO> BiosDebugThreadInfoArray;
class CBiosDebugInfoProvider
{
public:
virtual ~CBiosDebugInfoProvider() {}
virtual ~CBiosDebugInfoProvider()
{
}
#ifdef DEBUGGER_INCLUDED
virtual BiosDebugModuleInfoArray GetModulesDebugInfo() const = 0;
virtual BiosDebugThreadInfoArray GetThreadsDebugInfo() const = 0;

View file

@ -7,7 +7,7 @@
#include "MemoryUtils.h"
const uint32 CCOP_FPU::m_ccMask[8] =
{
{
0x00800000,
0x02000000,
0x04000000,
@ -15,11 +15,10 @@ const uint32 CCOP_FPU::m_ccMask[8] =
0x10000000,
0x20000000,
0x40000000,
0x80000000
};
0x80000000};
CCOP_FPU::CCOP_FPU(MIPS_REGSIZE regSize)
: CMIPSCoprocessor(regSize)
: CMIPSCoprocessor(regSize)
{
SetupReflectionTables();
}

View file

@ -65,8 +65,8 @@ void CCOP_FPU::ReflOpFdFsFt(INSTRUCTION* pInstr, CMIPS* pCtx, uint32 nAddress, u
void CCOP_FPU::ReflOpFtOffRs(INSTRUCTION* pInstr, CMIPS* pCtx, uint32 nAddress, uint32 nOpcode, char* sText, unsigned int nCount)
{
uint8 nRS = static_cast<uint8> ((nOpcode >> 21) & 0x001F);
uint8 nFT = static_cast<uint8> ((nOpcode >> 16) & 0x001F);
uint8 nRS = static_cast<uint8>((nOpcode >> 21) & 0x001F);
uint8 nFT = static_cast<uint8>((nOpcode >> 16) & 0x001F);
uint16 nImm = static_cast<uint16>((nOpcode >> 0) & 0xFFFF);
sprintf(sText, "F%i, $%04X(%s)", nFT, nImm, CMIPS::m_sGPRName[nRS]);

View file

@ -45,9 +45,9 @@ const char* CCOP_SCU::m_sRegName[] =
// clang-format on
CCOP_SCU::CCOP_SCU(MIPS_REGSIZE nRegSize)
: CMIPSCoprocessor(nRegSize)
, m_nRT(0)
, m_nRD(0)
: CMIPSCoprocessor(nRegSize)
, m_nRT(0)
, m_nRD(0)
{
SetupReflectionTables();
}

View file

@ -72,7 +72,6 @@ protected:
MIPSReflection::SUBTABLE m_ReflMfPerfTable;
MIPSReflection::SUBTABLE m_ReflMtPerfTable;
private:
typedef void (CCOP_SCU::*InstructionFuncConstant)();

View file

@ -3,7 +3,7 @@
using namespace PS2;
const char* CControllerInfo::m_buttonName[CControllerInfo::MAX_BUTTONS] =
{
{
"analog_left_x",
"analog_left_y",
"analog_right_x",
@ -23,13 +23,11 @@ const char* CControllerInfo::m_buttonName[CControllerInfo::MAX_BUTTONS] =
"l3",
"r1",
"r2",
"r3"
};
"r3"};
bool CControllerInfo::IsAxis(BUTTON button)
{
return
(button == ANALOG_LEFT_X) ||
return (button == ANALOG_LEFT_X) ||
(button == ANALOG_LEFT_Y) ||
(button == ANALOG_RIGHT_X) ||
(button == ANALOG_RIGHT_Y);

View file

@ -22,7 +22,11 @@ struct CsoHeader
};
CCsoImageStream::CCsoImageStream(CStream* baseStream)
: m_baseStream(baseStream), m_readBuffer(nullptr), m_zlibBuffer(nullptr), m_index(nullptr), m_position(0)
: m_baseStream(baseStream)
, m_readBuffer(nullptr)
, m_zlibBuffer(nullptr)
, m_index(nullptr)
, m_position(0)
{
if(baseStream == nullptr)
{
@ -35,9 +39,9 @@ CCsoImageStream::CCsoImageStream(CStream* baseStream)
CCsoImageStream::~CCsoImageStream()
{
delete [] m_readBuffer;
delete [] m_zlibBuffer;
delete [] m_index;
delete[] m_readBuffer;
delete[] m_zlibBuffer;
delete[] m_index;
}
void CCsoImageStream::ReadFileHeader()
@ -106,7 +110,7 @@ void CCsoImageStream::InitializeBuffers()
void CCsoImageStream::Seek(int64 position, Framework::STREAM_SEEK_DIRECTION origin)
{
switch (origin)
switch(origin)
{
case Framework::STREAM_SEEK_CUR:
m_position += position;

View file

@ -5,7 +5,7 @@
#include "PtrStream.h"
CELF::CELF(uint8* content)
: m_content(content)
: m_content(content)
{
Framework::CPtrStream stream(m_content, -1);
@ -46,8 +46,8 @@ CELF::CELF(uint8* content)
CELF::~CELF()
{
delete [] m_pProgram;
delete [] m_pSection;
delete[] m_pProgram;
delete[] m_pSection;
}
uint8* CELF::GetContent() const

View file

@ -150,7 +150,7 @@ public:
CELF(const CELF&) = delete;
virtual ~CELF();
CELF& operator =(const CELF&) = delete;
CELF& operator=(const CELF&) = delete;
uint8* GetContent() const;
const ELFHEADER& GetHeader() const;

View file

@ -1,18 +1,15 @@
#include "ElfFile.h"
CElfFile::CElfFile(Framework::CStream& stream)
: CElfFileContainer(stream)
, CELF(GetFileContent())
: CElfFileContainer(stream)
, CELF(GetFileContent())
{
}
CElfFile::~CElfFile()
{
}
CElfFileContainer::CElfFileContainer(Framework::CStream& input)
{
uint32 size = static_cast<uint32>(input.GetLength());
@ -22,7 +19,7 @@ CElfFileContainer::CElfFileContainer(Framework::CStream& input)
CElfFileContainer::~CElfFileContainer()
{
delete [] m_content;
delete[] m_content;
}
uint8* CElfFileContainer::GetFileContent() const

View file

@ -13,7 +13,6 @@ public:
private:
uint8* m_content;
};
class CElfFile : protected CElfFileContainer, public CELF
@ -23,7 +22,6 @@ public:
virtual ~CElfFile();
private:
};
#endif

View file

@ -19,7 +19,7 @@ CFrameDump::CFrameDump()
CFrameDump::~CFrameDump()
{
delete [] m_initialGsRam;
delete[] m_initialGsRam;
}
void CFrameDump::Reset()
@ -171,8 +171,8 @@ void CFrameDump::IdentifyDrawingKicks()
DRAWINGKICK_INFO drawingKickInfo;
static const unsigned int g_initVertexCounts[8] = { 1, 2, 2, 3, 3, 3, 2, 0 };
static const unsigned int g_nextVertexCounts[8] = { 1, 2, 1, 3, 1, 1, 2, 0 };
static const unsigned int g_initVertexCounts[8] = {1, 2, 2, 3, 3, 3, 2, 0};
static const unsigned int g_nextVertexCounts[8] = {1, 2, 1, 3, 1, 1, 2, 0};
CGSHandler::PRIM currentPrim;
currentPrim <<= GetInitialGsRegisters()[GS_REG_PRIM];

View file

@ -18,7 +18,7 @@ public:
void Execute()
{
auto newEnd = std::remove_if(m_futures.begin(), m_futures.end(),
[] (const FuturePtr& future) { return future->IsDone(); } );
[](const FuturePtr& future) { return future->IsDone(); });
m_futures.erase(newEnd, m_futures.end());
}
@ -31,16 +31,16 @@ private:
};
typedef std::unique_ptr<CFuture> FuturePtr;
template<typename ResultType>
template <typename ResultType>
class CFutureWrapper : public CFuture
{
public:
typedef std::function<void (const ResultType&)> CallbackType;
typedef std::function<void(const ResultType&)> CallbackType;
CFutureWrapper(std::future<ResultType> future, CallbackType callback)
: m_future(std::move(future)), m_callback(std::move(callback))
: m_future(std::move(future))
, m_callback(std::move(callback))
{
}
bool IsDone() override

View file

@ -14,7 +14,7 @@ namespace ISO9660
BLOCKSIZE = 0x800ULL
};
virtual ~CBlockProvider() {};
virtual ~CBlockProvider(){};
virtual void ReadBlock(uint32, void*) = 0;
};
@ -26,12 +26,10 @@ namespace ISO9660
CBlockProvider2048(const StreamPtr& stream)
: m_stream(stream)
{
}
virtual ~CBlockProvider2048()
{
}
void ReadBlock(uint32 address, void* block) override
@ -52,12 +50,10 @@ namespace ISO9660
CBlockProviderCDROMXA(const StreamPtr& stream)
: m_stream(stream)
{
}
virtual ~CBlockProviderCDROMXA()
{
}
void ReadBlock(uint32 address, void* block) override

View file

@ -32,7 +32,6 @@ CDirectoryRecord::CDirectoryRecord(Framework::CStream* stream)
CDirectoryRecord::~CDirectoryRecord()
{
}
uint8 CDirectoryRecord::GetLength() const

View file

@ -7,24 +7,23 @@
using namespace ISO9660;
CFile::CFile(CBlockProvider* blockProvider, uint64 start)
: m_blockProvider(blockProvider)
, m_start(start)
, m_end(ULLONG_MAX)
: m_blockProvider(blockProvider)
, m_start(start)
, m_end(ULLONG_MAX)
{
InitBlock();
}
CFile::CFile(CBlockProvider* blockProvider, uint64 start, uint64 size)
: m_blockProvider(blockProvider)
, m_start(start)
, m_end(start + size)
: m_blockProvider(blockProvider)
, m_start(start)
, m_end(start + size)
{
InitBlock();
}
CFile::~CFile()
{
}
void CFile::Seek(int64 amount, Framework::STREAM_SEEK_DIRECTION whence)

View file

@ -29,5 +29,4 @@ namespace ISO9660
uint8 m_block[CBlockProvider::BLOCKSIZE];
bool m_isEof = false;
};
}

View file

@ -9,16 +9,14 @@
using namespace ISO9660;
CISO9660::CISO9660(const BlockProviderPtr& blockProvider)
: m_blockProvider(blockProvider)
, m_volumeDescriptor(blockProvider.get())
, m_pathTable(blockProvider.get(), m_volumeDescriptor.GetLPathTableAddress())
: m_blockProvider(blockProvider)
, m_volumeDescriptor(blockProvider.get())
, m_pathTable(blockProvider.get(), m_volumeDescriptor.GetLPathTableAddress())
{
}
CISO9660::~CISO9660()
{
}
void CISO9660::ReadBlock(uint32 address, void* data)

View file

@ -21,7 +21,6 @@ CPathTable::CPathTable(CBlockProvider* blockProvider, uint32 tableLba)
CPathTable::~CPathTable()
{
}
uint32 CPathTable::GetDirectoryAddress(unsigned int recordIndex) const

View file

@ -23,5 +23,4 @@ namespace ISO9660
RecordMapType m_records;
};
}

View file

@ -19,7 +19,6 @@ CPathTableRecord::CPathTableRecord(Framework::CStream& stream)
CPathTableRecord::~CPathTableRecord()
{
}
uint8 CPathTableRecord::GetNameLength() const

View file

@ -39,7 +39,6 @@ CVolumeDescriptor::CVolumeDescriptor(CBlockProvider* blockProvider)
CVolumeDescriptor::~CVolumeDescriptor()
{
}
uint32 CVolumeDescriptor::GetLPathTableAddress() const

View file

@ -21,5 +21,4 @@ namespace ISO9660
uint32 m_LPathTableAddress = 0;
uint32 m_MPathTableAddress = 0;
};
}

View file

@ -5,8 +5,7 @@
struct INTEGER64
{
union
{
union {
uint64 q;
struct
{

View file

@ -8,7 +8,7 @@
#include "StdStream.h"
CIszImageStream::CIszImageStream(CStream* baseStream)
: m_baseStream(baseStream)
: m_baseStream(baseStream)
{
if(baseStream == nullptr)
{
@ -36,9 +36,9 @@ CIszImageStream::CIszImageStream(CStream* baseStream)
CIszImageStream::~CIszImageStream()
{
delete [] m_cachedBlock;
delete [] m_readBuffer;
delete [] m_blockDescriptorTable;
delete[] m_cachedBlock;
delete[] m_readBuffer;
delete[] m_blockDescriptorTable;
delete m_baseStream;
}
@ -117,7 +117,7 @@ void CIszImageStream::ReadBlockDescriptorTable()
m_blockDescriptorTable[i].storageType = static_cast<uint8>(value >> 22);
}
delete [] cryptedTable;
delete[] cryptedTable;
}
uint64 CIszImageStream::GetTotalSize() const

View file

@ -17,7 +17,6 @@ CLog::CLog()
CLog::~CLog()
{
}
void CLog::Print(const char* logName, const char* format, ...)

View file

@ -8,7 +8,7 @@
#include "placeholder_def.h"
uint32 g_LWMaskRight[4] =
{
{
0x00FFFFFF,
0x0000FFFF,
0x000000FF,
@ -16,7 +16,7 @@ uint32 g_LWMaskRight[4] =
};
uint32 g_LWMaskLeft[4] =
{
{
0xFFFFFF00,
0xFFFF0000,
0xFF000000,
@ -24,7 +24,7 @@ uint32 g_LWMaskLeft[4] =
};
uint64 g_LDMaskRight[8] =
{
{
0x00FFFFFFFFFFFFFFULL,
0x0000FFFFFFFFFFFFULL,
0x000000FFFFFFFFFFULL,
@ -36,7 +36,7 @@ uint64 g_LDMaskRight[8] =
};
uint64 g_LDMaskLeft[8] =
{
{
0xFFFFFFFFFFFFFF00ULL,
0xFFFFFFFFFFFF0000ULL,
0xFFFFFFFFFF000000ULL,
@ -143,8 +143,8 @@ extern "C" void SDR_Proxy(uint32 address, uint64 rt, CMIPS* context)
MemoryUtils_SetDoubleProxy(context, memory, alignedAddress);
}
CMA_MIPSIV::CMA_MIPSIV(MIPS_REGSIZE nRegSize) :
CMIPSArchitecture(nRegSize)
CMA_MIPSIV::CMA_MIPSIV(MIPS_REGSIZE nRegSize)
: CMIPSArchitecture(nRegSize)
{
SetupInstructionTables();
SetupReflectionTables();
@ -152,7 +152,6 @@ CMIPSArchitecture(nRegSize)
CMA_MIPSIV::~CMA_MIPSIV()
{
}
void CMA_MIPSIV::SetupInstructionTables()

View file

@ -24,7 +24,7 @@ protected:
MAX_REGIMM_OPS = 0x20,
};
typedef std::function<void ()> InstructionFunction;
typedef std::function<void()> InstructionFunction;
InstructionFunction m_pOpGeneral[MAX_GENERAL_OPS];
InstructionFunction m_pOpSpecial[MAX_SPECIAL_OPS];
@ -71,8 +71,8 @@ protected:
protected:
//Instruction compiler templates
typedef std::function<void (uint8)> TemplateParamedOperationFunctionType;
typedef std::function<void ()> TemplateOperationFunctionType;
typedef std::function<void(uint8)> TemplateParamedOperationFunctionType;
typedef std::function<void()> TemplateOperationFunctionType;
void Template_Add32(bool);
void Template_Add64(bool);

View file

@ -16,8 +16,8 @@ void CMA_MIPSIV::ReflOpRtRsImm(INSTRUCTION* pInstr, CMIPS* pCtx, uint32 nAddress
uint8 nRS, nRT;
uint16 nImm;
nRS = (uint8) ((nOpcode >> 21) & 0x001F);
nRT = (uint8) ((nOpcode >> 16) & 0x001F);
nRS = (uint8)((nOpcode >> 21) & 0x001F);
nRT = (uint8)((nOpcode >> 16) & 0x001F);
nImm = (uint16)((nOpcode >> 0) & 0xFFFF);
sprintf(sText, "%s, %s, $%04X", CMIPS::m_sGPRName[nRT], CMIPS::m_sGPRName[nRS], nImm);
@ -28,7 +28,7 @@ void CMA_MIPSIV::ReflOpRtImm(INSTRUCTION* pInstr, CMIPS* pCtx, uint32 nAddress,
uint8 nRT;
uint16 nImm;
nRT = (uint8) ((nOpcode >> 16) & 0x001F);
nRT = (uint8)((nOpcode >> 16) & 0x001F);
nImm = (uint16)((nOpcode >> 0) & 0xFFFF);
sprintf(sText, "%s, $%04X", CMIPS::m_sGPRName[nRT], nImm);
@ -39,8 +39,8 @@ void CMA_MIPSIV::ReflOpRsRtOff(INSTRUCTION* pInstr, CMIPS* pCtx, uint32 nAddress
uint8 nRS, nRT;
uint16 nImm;
nRS = (uint8) ((nOpcode >> 21) & 0x001F);
nRT = (uint8) ((nOpcode >> 16) & 0x001F);
nRS = (uint8)((nOpcode >> 21) & 0x001F);
nRT = (uint8)((nOpcode >> 16) & 0x001F);
nImm = (uint16)((nOpcode >> 0) & 0xFFFF);
nAddress += 4;
@ -52,7 +52,7 @@ void CMA_MIPSIV::ReflOpRsOff(INSTRUCTION* pInstr, CMIPS* pCtx, uint32 nAddress,
uint8 nRS;
uint16 nImm;
nRS = (uint8) ((nOpcode >> 21) & 0x001F);
nRS = (uint8)((nOpcode >> 21) & 0x001F);
nImm = (uint16)((nOpcode >> 0) & 0xFFFF);
nAddress += 4;
@ -64,8 +64,8 @@ void CMA_MIPSIV::ReflOpRtOffRs(INSTRUCTION* pInstr, CMIPS* pCtx, uint32 nAddress
uint8 nRS, nRT;
uint16 nImm;
nRS = (uint8) ((nOpcode >> 21) & 0x001F);
nRT = (uint8) ((nOpcode >> 16) & 0x001F);
nRS = (uint8)((nOpcode >> 21) & 0x001F);
nRT = (uint8)((nOpcode >> 16) & 0x001F);
nImm = (uint16)((nOpcode >> 0) & 0xFFFF);
nAddress += 4;
@ -74,8 +74,8 @@ void CMA_MIPSIV::ReflOpRtOffRs(INSTRUCTION* pInstr, CMIPS* pCtx, uint32 nAddress
void CMA_MIPSIV::ReflOpHintOffRs(INSTRUCTION* pInstr, CMIPS* pCtx, uint32 nAddress, uint32 nOpcode, char* sText, unsigned int nCount)
{
uint8 nRS = (uint8) ((nOpcode >> 21) & 0x001F);
uint8 nHint = (uint8) ((nOpcode >> 16) & 0x001F);
uint8 nRS = (uint8)((nOpcode >> 21) & 0x001F);
uint8 nHint = (uint8)((nOpcode >> 16) & 0x001F);
uint16 nImm = (uint16)((nOpcode >> 0) & 0xFFFF);
nAddress += 4;
@ -87,8 +87,8 @@ void CMA_MIPSIV::ReflOpIdOffRs(INSTRUCTION* pInstr, CMIPS* pCtx, uint32 nAddress
uint8 nRS, nRT;
uint16 nImm;
nRS = (uint8) ((nOpcode >> 21) & 0x001F);
nRT = (uint8) ((nOpcode >> 16) & 0x001F);
nRS = (uint8)((nOpcode >> 21) & 0x001F);
nRT = (uint8)((nOpcode >> 16) & 0x001F);
nImm = (uint16)((nOpcode >> 0) & 0xFFFF);
nAddress += 4;

View file

@ -4,12 +4,11 @@
#include "COP_SCU.h"
const char* CMIPS::m_sGPRName[] =
{
{
"R0", "AT", "V0", "V1", "A0", "A1", "A2", "A3",
"T0", "T1", "T2", "T3", "T4", "T5", "T6", "T7",
"S0", "S1", "S2", "S3", "S4", "S5", "S6", "S7",
"T8", "T9", "K0", "K1", "GP", "SP", "FP", "RA"
};
"T8", "T9", "K0", "K1", "GP", "SP", "FP", "RA"};
CMIPS::CMIPS(MEMORYMAP_ENDIANESS nEnd)
{

View file

@ -49,9 +49,9 @@ struct MIPSSTATE
uint32 nHasException;
#ifdef _WIN32
__declspec(align(16))
__declspec(align(16))
#else
__attribute__((aligned(16)))
__attribute__((aligned(16)))
#endif
uint128 nGPR[32];
@ -74,9 +74,9 @@ __attribute__((aligned(16)))
//COP2
#ifdef _WIN32
__declspec(align(16))
__declspec(align(16))
#else
__attribute__((aligned(16)))
__attribute__((aligned(16)))
#endif
uint128 nCOP2[33];
@ -150,10 +150,38 @@ public:
enum REGISTER
{
R0 = 0, AT, V0, V1, A0, A1, A2, A3,
T0, T1, T2, T3, T4, T5, T6, T7,
S0, S1, S2, S3, S4, S5, S6, S7,
T8, T9, K0, K1, GP, SP, FP, RA
R0 = 0,
AT,
V0,
V1,
A0,
A1,
A2,
A3,
T0,
T1,
T2,
T3,
T4,
T5,
T6,
T7,
S0,
S1,
S2,
S3,
S4,
S5,
S6,
S7,
T8,
T9,
K0,
K1,
GP,
SP,
FP,
RA
};
enum

View file

@ -3,14 +3,12 @@
#include "MIPS.h"
CMIPSAnalysis::CMIPSAnalysis(CMIPS* ctx)
: m_ctx(ctx)
: m_ctx(ctx)
{
}
CMIPSAnalysis::~CMIPSAnalysis()
{
}
void CMIPSAnalysis::Clear()
@ -229,8 +227,7 @@ void CMIPSAnalysis::ExpandSubroutines(uint32 executableStart, uint32 executableE
static const uint32 searchLimit = 0x1000;
const auto& findFreeSubroutineEnd =
[this](uint32 begin, uint32 end) -> uint32
{
[this](uint32 begin, uint32 end) -> uint32 {
for(uint32 address = begin; address <= begin + searchLimit; address += 4)
{
if(FindSubroutine(address) != nullptr) return MIPS_INVALID_PC;
@ -341,8 +338,8 @@ void CMIPSAnalysis::AnalyseStringReferences()
for(auto subroutinePair : m_subroutines)
{
const auto& subroutine = subroutinePair.second;
uint32 registerValue[0x20] = { 0 };
bool registerWritten[0x20] = { false };
uint32 registerValue[0x20] = {0};
bool registerWritten[0x20] = {false};
for(uint32 address = subroutine.start; address <= subroutine.end; address += 4)
{
uint32 op = m_ctx->m_pMemoryMap->GetInstruction(address);

View file

@ -1,7 +1,6 @@
#include "MIPSArchitecture.h"
CMIPSArchitecture::CMIPSArchitecture(MIPS_REGSIZE regSize)
: CMIPSInstructionFactory(regSize)
: CMIPSInstructionFactory(regSize)
{
}

View file

@ -4,11 +4,10 @@
#include "lexical_cast_ex.h"
CMIPSAssembler::CMIPSAssembler(uint32* ptr)
: m_ptr(ptr)
, m_startPtr(ptr)
, m_nextLabelId(1)
: m_ptr(ptr)
, m_startPtr(ptr)
, m_nextLabelId(1)
{
}
CMIPSAssembler::~CMIPSAssembler()

View file

@ -10,7 +10,7 @@ public:
{
unsigned int id;
bool operator < (const LABEL& rhs) const
bool operator<(const LABEL& rhs) const
{
return id < rhs.id;
};

View file

@ -1,12 +1,10 @@
#include "MIPSCoprocessor.h"
CMIPSCoprocessor::CMIPSCoprocessor(MIPS_REGSIZE nRegSize) :
CMIPSInstructionFactory(nRegSize)
CMIPSCoprocessor::CMIPSCoprocessor(MIPS_REGSIZE nRegSize)
: CMIPSInstructionFactory(nRegSize)
{
}
CMIPSCoprocessor::~CMIPSCoprocessor()
{
}

View file

@ -5,9 +5,8 @@
#include "offsetof_def.h"
CMIPSInstructionFactory::CMIPSInstructionFactory(MIPS_REGSIZE nRegSize)
: m_regSize(nRegSize)
: m_regSize(nRegSize)
{
}
void CMIPSInstructionFactory::SetupQuickVariables(uint32 nAddress, CMipsJitter* codeGen, CMIPS* pCtx)
@ -21,7 +20,7 @@ void CMIPSInstructionFactory::SetupQuickVariables(uint32 nAddress, CMipsJitter*
void CMIPSInstructionFactory::ComputeMemAccessAddr()
{
uint8 nRS = (uint8) ((m_nOpcode >> 21) & 0x001F);
uint8 nRS = (uint8)((m_nOpcode >> 21) & 0x001F);
uint16 nImmediate = (uint16)((m_nOpcode >> 0) & 0xFFFF);
if(m_pCtx->m_pAddrTranslator == &CMIPS::TranslateAddress64)

View file

@ -23,7 +23,8 @@ namespace MIPSReflection
SUBTABLE* pSubTable;
void (*pGetMnemonic)(INSTRUCTION*, CMIPS*, uint32, char*, unsigned int);
void (*pGetOperands)(INSTRUCTION*, CMIPS*, uint32, uint32, char*, unsigned int);
MIPS_BRANCH_TYPE (*pIsBranch)(INSTRUCTION*, CMIPS*, uint32);
MIPS_BRANCH_TYPE(*pIsBranch)
(INSTRUCTION*, CMIPS*, uint32);
uint32 (*pGetEffectiveAddress)(INSTRUCTION*, CMIPS*, uint32, uint32);
};

View file

@ -86,7 +86,6 @@ void CMIPSTags::Unserialize(const char* sPath)
}
catch(...)
{
}
}

View file

@ -12,7 +12,7 @@ public:
typedef std::map<uint32, std::string> TagMap;
typedef TagMap::const_iterator TagIterator;
boost::signals2::signal<void ()> OnTagListChange;
boost::signals2::signal<void()> OnTagListChange;
void InsertTag(uint32, const char*);
void RemoveTags();

View file

@ -26,7 +26,7 @@ void CMailBox::WaitForCall(unsigned int timeOut)
void CMailBox::FlushCalls()
{
SendCall([] () { }, true);
SendCall([]() {}, true);
}
void CMailBox::SendCall(const FunctionType& function, bool waitForCompletion)

View file

@ -10,7 +10,7 @@ class CMailBox
public:
virtual ~CMailBox() = default;
typedef std::function<void ()> FunctionType;
typedef std::function<void()> FunctionType;
void SendCall(const FunctionType&, bool = false);
void SendCall(FunctionType&&);
@ -29,8 +29,8 @@ private:
MESSAGE(MESSAGE&&) = default;
MESSAGE(const MESSAGE&) = delete;
MESSAGE& operator =(MESSAGE&&) = default;
MESSAGE& operator =(const MESSAGE&) = delete;
MESSAGE& operator=(MESSAGE&&) = default;
MESSAGE& operator=(const MESSAGE&) = delete;
FunctionType function;
bool sync;

View file

@ -14,7 +14,7 @@ enum MEMORYMAP_ENDIANESS
class CMemoryMap
{
public:
typedef std::function<uint32 (uint32, uint32)> MemoryMapHandlerType;
typedef std::function<uint32(uint32, uint32)> MemoryMapHandlerType;
enum MEMORYMAP_TYPE
{

View file

@ -1,11 +1,10 @@
#include "MemoryStateFile.h"
CMemoryStateFile::CMemoryStateFile(const char* name, const void* memory, size_t size)
: CZipFile(name)
, m_memory(memory)
, m_size(size)
: CZipFile(name)
, m_memory(memory)
, m_size(size)
{
}
void CMemoryStateFile::Write(Framework::CStream& stream)

View file

@ -10,8 +10,8 @@ static bool IsInsideRange(uint32 address, uint32 start, uint32 end)
#define SUBTABLE_MASK (SUBTABLE_SIZE - 1)
CMipsExecutor::CMipsExecutor(CMIPS& context, uint32 maxAddress)
: m_context(context)
, m_maxAddress(maxAddress)
: m_context(context)
, m_maxAddress(maxAddress)
{
m_subTableCount = (m_maxAddress + SUBTABLE_MASK) / SUBTABLE_SIZE;
assert(m_subTableCount != 0);
@ -26,10 +26,10 @@ CMipsExecutor::~CMipsExecutor()
CBasicBlock** subTable = m_blockTable[i];
if(subTable != NULL)
{
delete [] subTable;
delete[] subTable;
}
}
delete [] m_blockTable;
delete[] m_blockTable;
}
void CMipsExecutor::Reset()
@ -44,7 +44,7 @@ void CMipsExecutor::ClearActiveBlocks()
CBasicBlock** subTable = m_blockTable[i];
if(subTable != NULL)
{
delete [] subTable;
delete[] subTable;
m_blockTable[i] = NULL;
}
}
@ -80,8 +80,7 @@ void CMipsExecutor::ClearActiveBlocksInRangeInternal(uint32 start, uint32 end, C
auto block = table[lo / 4];
if(block == nullptr) continue;
if(block == protectedBlock) continue;
if(!IsInsideRange(block->GetBeginAddress(), start, end)
&& !IsInsideRange(block->GetEndAddress(), start, end)) continue;
if(!IsInsideRange(block->GetBeginAddress(), start, end) && !IsInsideRange(block->GetEndAddress(), start, end)) continue;
table[lo / 4] = nullptr;
blocksToDelete.insert(block);
}
@ -89,7 +88,7 @@ void CMipsExecutor::ClearActiveBlocksInRangeInternal(uint32 start, uint32 end, C
if(!blocksToDelete.empty())
{
m_blocks.remove_if([&] (const BasicBlockPtr& block) { return blocksToDelete.find(block.get()) != std::end(blocksToDelete); });
m_blocks.remove_if([&](const BasicBlockPtr& block) { return blocksToDelete.find(block.get()) != std::end(blocksToDelete); });
}
}
@ -214,7 +213,7 @@ void CMipsExecutor::DeleteBlock(CBasicBlock* block)
}
//Remove block from our lists
auto blockIterator = std::find_if(std::begin(m_blocks), std::end(m_blocks), [&] (const BasicBlockPtr& blockPtr) { return blockPtr.get() == block; });
auto blockIterator = std::find_if(std::begin(m_blocks), std::end(m_blocks), [&](const BasicBlockPtr& blockPtr) { return blockPtr.get() == block; });
assert(blockIterator != std::end(m_blocks));
m_blocks.erase(blockIterator);
}
@ -236,7 +235,7 @@ void CMipsExecutor::PartitionFunction(uint32 functionAddress)
partitionPoints.insert(functionAddress);
//Find the end
for(uint32 address = functionAddress; ; address += 4)
for(uint32 address = functionAddress;; address += 4)
{
//Probably going too far...
if((address - functionAddress) > 0x10000)

View file

@ -9,7 +9,6 @@ CMipsFunctionPatternDb::CMipsFunctionPatternDb(Framework::Xml::CNode* node)
CMipsFunctionPatternDb::~CMipsFunctionPatternDb()
{
}
const CMipsFunctionPatternDb::PatternArray& CMipsFunctionPatternDb::GetPatterns() const
@ -69,7 +68,7 @@ CMipsFunctionPatternDb::Pattern CMipsFunctionPatternDb::ParsePattern(const char*
if(currValue.length() != 0)
{
//Parse value
PATTERNITEM item = { 0 };
PATTERNITEM item = {0};
if(ParsePatternItem(currValue.c_str(), item))
{
result.items.push_back(item);

View file

@ -26,7 +26,6 @@ public:
ItemArray items;
};
typedef std::vector<Pattern> PatternArray;
CMipsFunctionPatternDb(Framework::Xml::CNode*);

View file

@ -2,15 +2,13 @@
#include "MipsJitter.h"
CMipsJitter::CMipsJitter(Jitter::CCodeGen* codeGen)
: CJitter(codeGen)
, m_lastBlockLabel(-1)
: CJitter(codeGen)
, m_lastBlockLabel(-1)
{
}
CMipsJitter::~CMipsJitter()
{
}
void CMipsJitter::Begin()

View file

@ -82,8 +82,7 @@ void COpticalMedia::CheckDualLayerDvd(const StreamPtr& stream)
stream->Read(blockHeader, blockHeaderSize);
if(
(blockHeader[0] == 0x01) &&
(!strncmp(blockHeader + 1, "CD001", 5))
)
(!strncmp(blockHeader + 1, "CD001", 5)))
{
//We've found a valid ISO9660 descriptor
m_dvdSecondLayerStart = lba;

View file

@ -1,34 +1,38 @@
#pragma once
#include <cassert>
template<typename StructType>
template <typename StructType>
class COsStructManager
{
public:
class iterator
{
public:
iterator(const COsStructManager& container, uint32 id) : m_container(container), m_id(id) {}
iterator(const COsStructManager& container, uint32 id)
: m_container(container)
, m_id(id)
{
}
iterator& operator ++()
iterator& operator++()
{
m_id++;
return (*this);
}
iterator operator ++(int)
iterator operator++(int)
{
iterator copy(*this);
m_id++;
return copy;
}
bool operator !=(const iterator& rhs) const
bool operator!=(const iterator& rhs) const
{
return m_id != rhs.m_id;
}
StructType* operator *() const
StructType* operator*() const
{
return m_container[m_id];
}
@ -57,14 +61,14 @@ public:
}
COsStructManager(const COsStructManager&) = delete;
COsStructManager& operator =(const COsStructManager) = delete;
COsStructManager& operator=(const COsStructManager) = delete;
StructType* GetBase() const
{
return m_structBase;
}
StructType* operator [](uint32 index) const
StructType* operator[](uint32 index) const
{
index -= m_idBase;
if(index >= m_structMax)

View file

@ -9,27 +9,31 @@ public:
class iterator
{
public:
iterator(const StructManager& container, uint32* idPtr) : m_container(container), m_idPtr(idPtr) {}
iterator(const StructManager& container, uint32* idPtr)
: m_container(container)
, m_idPtr(idPtr)
{
}
iterator& operator ++()
iterator& operator++()
{
MoveNext();
return (*this);
}
iterator operator ++(int)
iterator operator++(int)
{
iterator copy(*this);
MoveNext();
return copy;
}
bool operator !=(const iterator& rhs) const
bool operator!=(const iterator& rhs) const
{
return m_idPtr != rhs.m_idPtr;
}
std::pair<uint32, StructType*> operator *() const
std::pair<uint32, StructType*> operator*() const
{
assert(m_idPtr);
return std::make_pair(*m_idPtr, m_container[*m_idPtr]);
@ -55,11 +59,10 @@ public:
: m_items(items)
, m_headIdPtr(headIdPtr)
{
}
COsStructQueue(const COsStructQueue&) = delete;
COsStructQueue& operator =(const COsStructQueue) = delete;
COsStructQueue& operator=(const COsStructQueue) = delete;
bool IsEmpty() const
{

View file

@ -4,18 +4,21 @@ template <typename Type>
struct OsVariableWrapper
{
public:
explicit OsVariableWrapper(Type* storage) : m_storage(storage) { }
explicit OsVariableWrapper(Type* storage)
: m_storage(storage)
{
}
OsVariableWrapper(const OsVariableWrapper&) = delete;
OsVariableWrapper& operator =(const OsVariableWrapper&) = delete;
OsVariableWrapper& operator=(const OsVariableWrapper&) = delete;
OsVariableWrapper& operator =(const Type& value)
OsVariableWrapper& operator=(const Type& value)
{
(*m_storage) = value;
return (*this);
}
Type& operator +=(const Type& addend)
Type& operator+=(const Type& addend)
{
(*m_storage) += addend;
return (*m_storage);

View file

@ -10,12 +10,11 @@ CPH_Generic::CPH_Generic()
CPH_Generic::~CPH_Generic()
{
}
CPadHandler::FactoryFunction CPH_Generic::GetFactoryFunction()
{
return [] () { return new CPH_Generic(); };
return []() { return new CPH_Generic(); };
}
void CPH_Generic::Update(uint8* ram)

View file

@ -41,23 +41,23 @@
namespace filesystem = boost::filesystem;
CPS2VM::CPS2VM()
: m_nStatus(PAUSED)
, m_nEnd(false)
, m_pad(NULL)
, m_singleStepEe(false)
, m_singleStepIop(false)
, m_singleStepVu0(false)
, m_singleStepVu1(false)
, m_vblankTicks(0)
, m_inVblank(false)
, m_eeExecutionTicks(0)
, m_iopExecutionTicks(0)
, m_spuUpdateTicks(SPU_UPDATE_TICKS)
, m_eeProfilerZone(CProfiler::GetInstance().RegisterZone("EE"))
, m_iopProfilerZone(CProfiler::GetInstance().RegisterZone("IOP"))
, m_spuProfilerZone(CProfiler::GetInstance().RegisterZone("SPU"))
, m_gsSyncProfilerZone(CProfiler::GetInstance().RegisterZone("GSSYNC"))
, m_otherProfilerZone(CProfiler::GetInstance().RegisterZone("OTHER"))
: m_nStatus(PAUSED)
, m_nEnd(false)
, m_pad(NULL)
, m_singleStepEe(false)
, m_singleStepIop(false)
, m_singleStepVu0(false)
, m_singleStepVu1(false)
, m_vblankTicks(0)
, m_inVblank(false)
, m_eeExecutionTicks(0)
, m_iopExecutionTicks(0)
, m_spuUpdateTicks(SPU_UPDATE_TICKS)
, m_eeProfilerZone(CProfiler::GetInstance().RegisterZone("EE"))
, m_iopProfilerZone(CProfiler::GetInstance().RegisterZone("IOP"))
, m_spuProfilerZone(CProfiler::GetInstance().RegisterZone("SPU"))
, m_gsSyncProfilerZone(CProfiler::GetInstance().RegisterZone("GSSYNC"))
, m_otherProfilerZone(CProfiler::GetInstance().RegisterZone("OTHER"))
{
static const std::pair<const char*, const char*> basicDirectorySettings[] =
{
@ -101,7 +101,7 @@ CPS2VM::~CPS2VM()
void CPS2VM::CreateGSHandler(const CGSHandler::FactoryFunction& factoryFunction)
{
if(m_ee->m_gs != nullptr) return;
m_mailBox.SendCall([this, factoryFunction] () { CreateGsHandlerImpl(factoryFunction); }, true);
m_mailBox.SendCall([this, factoryFunction]() { CreateGsHandlerImpl(factoryFunction); }, true);
}
CGSHandler* CPS2VM::GetGSHandler()
@ -112,13 +112,13 @@ CGSHandler* CPS2VM::GetGSHandler()
void CPS2VM::DestroyGSHandler()
{
if(m_ee->m_gs == nullptr) return;
m_mailBox.SendCall([this] () { DestroyGsHandlerImpl(); }, true);
m_mailBox.SendCall([this]() { DestroyGsHandlerImpl(); }, true);
}
void CPS2VM::CreatePadHandler(const CPadHandler::FactoryFunction& factoryFunction)
{
if(m_pad != nullptr) return;
m_mailBox.SendCall([this, factoryFunction] () { CreatePadHandlerImpl(factoryFunction); }, true);
m_mailBox.SendCall([this, factoryFunction]() { CreatePadHandlerImpl(factoryFunction); }, true);
}
CPadHandler* CPS2VM::GetPadHandler()
@ -129,19 +129,19 @@ CPadHandler* CPS2VM::GetPadHandler()
void CPS2VM::DestroyPadHandler()
{
if(m_pad == nullptr) return;
m_mailBox.SendCall([this] () { DestroyPadHandlerImpl(); }, true);
m_mailBox.SendCall([this]() { DestroyPadHandlerImpl(); }, true);
}
void CPS2VM::CreateSoundHandler(const CSoundHandler::FactoryFunction& factoryFunction)
{
if(m_soundHandler != nullptr) return;
m_mailBox.SendCall([this, factoryFunction] () { CreateSoundHandlerImpl(factoryFunction); }, true);
m_mailBox.SendCall([this, factoryFunction]() { CreateSoundHandlerImpl(factoryFunction); }, true);
}
void CPS2VM::DestroySoundHandler()
{
if(m_soundHandler == nullptr) return;
m_mailBox.SendCall([this] () { DestroySoundHandlerImpl(); }, true);
m_mailBox.SendCall([this]() { DestroySoundHandlerImpl(); }, true);
}
CVirtualMachine::STATUS CPS2VM::GetStatus() const
@ -200,14 +200,14 @@ void CPS2VM::Reset()
void CPS2VM::DumpEEIntcHandlers()
{
// if(m_pOS == NULL) return;
// if(m_pOS == NULL) return;
if(m_nStatus != PAUSED) return;
m_ee->m_os->DumpIntcHandlers();
}
void CPS2VM::DumpEEDmacHandlers()
{
// if(m_pOS == NULL) return;
// if(m_pOS == NULL) return;
if(m_nStatus != PAUSED) return;
m_ee->m_os->DumpDmacHandlers();
}
@ -216,7 +216,7 @@ void CPS2VM::Initialize()
{
CreateVM();
m_nEnd = false;
m_thread = std::thread([&] () { EmuThread(); });
m_thread = std::thread([&]() { EmuThread(); });
}
void CPS2VM::Destroy()
@ -242,12 +242,10 @@ std::future<bool> CPS2VM::SaveState(const filesystem::path& statePath)
auto promise = std::make_shared<std::promise<bool>>();
auto future = promise->get_future();
m_mailBox.SendCall(
[this, promise, statePath] ()
{
[this, promise, statePath]() {
auto result = SaveVMState(statePath);
promise->set_value(result);
}
);
});
return future;
}
@ -256,26 +254,22 @@ std::future<bool> CPS2VM::LoadState(const filesystem::path& statePath)
auto promise = std::make_shared<std::promise<bool>>();
auto future = promise->get_future();
m_mailBox.SendCall(
[this, promise, statePath] ()
{
[this, promise, statePath]() {
auto result = LoadVMState(statePath);
promise->set_value(result);
}
);
});
return future;
}
void CPS2VM::TriggerFrameDump(const FrameDumpCallback& frameDumpCallback)
{
m_mailBox.SendCall(
[=] ()
{
[=]() {
std::unique_lock<std::mutex> frameDumpCallbackMutexLock(m_frameDumpCallbackMutex);
if(m_frameDumpCallback) return;
m_frameDumpCallback = frameDumpCallback;
},
false
);
false);
}
CPS2VM::CPU_UTILISATION_INFO CPS2VM::GetCpuUtilisationInfo() const
@ -329,7 +323,6 @@ void CPS2VM::LoadDebugTags(const char* packageName)
}
catch(...)
{
}
}
@ -355,7 +348,6 @@ void CPS2VM::SaveDebugTags(const char* packageName)
}
catch(...)
{
}
}

View file

@ -31,8 +31,8 @@ public:
typedef std::unique_ptr<Ee::CSubSystem> EeSubSystemPtr;
typedef std::unique_ptr<Iop::CSubSystem> IopSubSystemPtr;
typedef std::function<void (const CFrameDump&)> FrameDumpCallback;
typedef boost::signals2::signal<void (const CProfiler::ZoneArray&)> ProfileFrameDoneSignal;
typedef std::function<void(const CFrameDump&)> FrameDumpCallback;
typedef boost::signals2::signal<void(const CProfiler::ZoneArray&)> ProfileFrameDoneSignal;
CPS2VM();
virtual ~CPS2VM();

View file

@ -2,12 +2,10 @@
CPadHandler::CPadHandler()
{
}
CPadHandler::~CPadHandler()
{
}
void CPadHandler::InsertListener(CPadListener* pListener)

View file

@ -8,7 +8,7 @@
class CPadHandler
{
public:
typedef std::function<CPadHandler* (void)> FactoryFunction;
typedef std::function<CPadHandler*(void)> FactoryFunction;
CPadHandler();
virtual ~CPadHandler();

View file

@ -6,7 +6,9 @@
class CPadListener
{
public:
virtual ~CPadListener() {}
virtual ~CPadListener()
{
}
virtual void SetButtonState(unsigned int, PS2::CControllerInfo::BUTTON, bool, uint8*) = 0;
virtual void SetAxisState(unsigned int, PS2::CControllerInfo::BUTTON, uint8, uint8*) = 0;
static uint32 GetButtonMask(PS2::CControllerInfo::BUTTON);

View file

@ -13,7 +13,6 @@
#include <sys/statvfs.h>
#endif
#include "Posix_VolumeStream.h"
using namespace Framework::Posix;

View file

@ -4,12 +4,10 @@
CProfiler::CProfiler()
{
}
CProfiler::~CProfiler()
{
}
CProfiler::ZoneHandle CProfiler::RegisterZone(const char* name)

View file

@ -7,20 +7,18 @@
#include "lexical_cast_ex.h"
CRegisterStateFile::CRegisterStateFile(const char* name)
: CZipFile(name)
: CZipFile(name)
{
}
CRegisterStateFile::CRegisterStateFile(Framework::CStream& stream)
: CZipFile("")
: CZipFile("")
{
Read(stream);
}
CRegisterStateFile::~CRegisterStateFile()
{
}
void CRegisterStateFile::Read(Framework::CStream& stream)
@ -52,7 +50,6 @@ void CRegisterStateFile::Read(Framework::CStream& stream)
}
catch(...)
{
}
}
}

View file

@ -2,7 +2,7 @@
#include "VirtualMachine.h"
CScopedVmPauser::CScopedVmPauser(CVirtualMachine& virtualMachine)
: m_virtualMachine(virtualMachine)
: m_virtualMachine(virtualMachine)
{
if(m_virtualMachine.GetStatus() == CVirtualMachine::RUNNING)
{

View file

@ -13,8 +13,7 @@
void CScreenShotUtils::TriggerGetScreenshot(CPS2VM* virtualMachine, Callback completionCallback)
{
virtualMachine->m_ee->m_gs->OnFlipComplete.connect_extended(
[=](const boost::signals2::connection &c)->void
{
[=](const boost::signals2::connection& c) -> void {
c.disconnect();
try
{
@ -30,8 +29,7 @@ void CScreenShotUtils::TriggerGetScreenshot(CPS2VM* virtualMachine, Callback com
{
completionCallback(-1, "Error occured while trying to save screenshot.");
}
}
);
});
}
Framework::CConfig::PathType CScreenShotUtils::GetScreenShotDirectoryPath()

View file

@ -6,22 +6,19 @@
class CSifModuleAdapter : public CSifModule
{
public:
typedef std::function<bool (uint32, uint32*, uint32, uint32*, uint32, uint8*)> SifCommandHandler;
typedef std::function<bool(uint32, uint32*, uint32, uint32*, uint32, uint8*)> SifCommandHandler;
CSifModuleAdapter()
{
}
CSifModuleAdapter(const SifCommandHandler& handler)
: m_handler(handler)
{
}
virtual ~CSifModuleAdapter()
{
}
virtual bool Invoke(uint32 method, uint32* args, uint32 argsSize, uint32* ret, uint32 retSize, uint8* ram) override

View file

@ -10,13 +10,12 @@
#define STRUCT_DOCUMENT_DETAIL_NAME ("Name")
CStructCollectionStateFile::CStructCollectionStateFile(const char* name)
: CZipFile(name)
: CZipFile(name)
{
}
CStructCollectionStateFile::CStructCollectionStateFile(Framework::CStream& stream)
: CZipFile("")
: CZipFile("")
{
Read(stream);
}
@ -65,7 +64,6 @@ void CStructCollectionStateFile::Read(Framework::CStream& stream)
}
catch(...)
{
}
}
}

View file

@ -12,12 +12,10 @@ using namespace std;
CStructFile::CStructFile()
{
}
CStructFile::~CStructFile()
{
}
void CStructFile::Read(Xml::CNode* rootNode)

View file

@ -11,11 +11,11 @@ public:
PAUSED = 2,
};
virtual ~CVirtualMachine() {};
virtual ~CVirtualMachine(){};
virtual STATUS GetStatus() const = 0;
virtual void Pause() = 0;
virtual void Resume() = 0;
boost::signals2::signal<void ()> OnMachineStateChange;
boost::signals2::signal<void ()> OnRunningStateChange;
boost::signals2::signal<void()> OnMachineStateChange;
boost::signals2::signal<void()> OnRunningStateChange;
};

View file

@ -15,8 +15,7 @@ CVolumeStream::CVolumeStream(char nDriveLetter)
'\\',
nDriveLetter,
':',
'\0'
};
'\0'};
m_nVolume = CreateFileA(sPath, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_READONLY, NULL);
m_nPosition = 0;

View file

@ -27,7 +27,7 @@ enum CTRL_REG
};
CCOP_VU::CCOP_VU(MIPS_REGSIZE nRegSize)
: CMIPSCoprocessor(nRegSize)
: CMIPSCoprocessor(nRegSize)
{
SetupReflectionTables();
}
@ -256,7 +256,8 @@ void CCOP_VU::CTC2()
m_codeGen->PushCst(CVpu::VU_CMSAR1);
m_codeGen->Call(reinterpret_cast<void*>(&MemoryUtils_SetWordProxy), 3, false);
//Clear stack
assert(m_codeGen->GetTopCursor() == valueCursor); m_codeGen->PullTop();
assert(m_codeGen->GetTopCursor() == valueCursor);
m_codeGen->PullTop();
}
break;
default:

View file

@ -191,5 +191,4 @@ private:
static MIPSReflection::INSTRUCTION m_cReflVX1[32];
static MIPSReflection::INSTRUCTION m_cReflVX2[32];
static MIPSReflection::INSTRUCTION m_cReflVX3[32];
};

View file

@ -62,8 +62,8 @@ void CCOP_VU::ReflOpAccFsFt(INSTRUCTION* pInstr, CMIPS* pCtx, uint32 nAddress, u
void CCOP_VU::ReflOpFtOffRs(INSTRUCTION* pInstr, CMIPS* pCtx, uint32 nAddress, uint32 nOpcode, char* sText, unsigned int nCount)
{
uint8 nRS = static_cast<uint8> ((nOpcode >> 21) & 0x001F);
uint8 nFT = static_cast<uint8> ((nOpcode >> 16) & 0x001F);
uint8 nRS = static_cast<uint8>((nOpcode >> 21) & 0x001F);
uint8 nFT = static_cast<uint8>((nOpcode >> 16) & 0x001F);
uint16 nImm = static_cast<uint16>((nOpcode >> 0) & 0xFFFF);
sprintf(sText, "VF%i, $%04X(%s)", nFT, nImm, CMIPS::m_sGPRName[nRS]);

View file

@ -26,12 +26,12 @@
#define SADR_WRITE_MASK ((PS2::EE_SPR_SIZE - 1) & ~0x0F)
#define REGISTER_READ(addr, value) \
case (addr) + 0x0: \
case(addr) + 0x0: \
return (value); \
break; \
case (addr) + 0x4: \
case (addr) + 0x8: \
case (addr) + 0xC: \
case(addr) + 0x4: \
case(addr) + 0x8: \
case(addr) + 0xC: \
return 0; \
break;
@ -43,30 +43,30 @@ static uint32 DummyTransferFunction(uint32 address, uint32 size, uint32, bool)
}
CDMAC::CDMAC(uint8* ram, uint8* spr, uint8* vuMem0, CMIPS& ee)
: m_ram(ram)
, m_spr(spr)
, m_vuMem0(vuMem0)
, m_ee(ee)
, m_D_STAT(0)
, m_D_ENABLE(0)
, m_D0(*this, 0, DummyTransferFunction)
, m_D1(*this, 1, DummyTransferFunction)
, m_D2(*this, 2, DummyTransferFunction)
, m_D3_CHCR(0)
, m_D3_MADR(0)
, m_D3_QWC(0)
, m_D4(*this, 4, DummyTransferFunction)
, m_D5_CHCR(0)
, m_D5_MADR(0)
, m_D5_QWC(0)
, m_D6_CHCR(0)
, m_D6_MADR(0)
, m_D6_QWC(0)
, m_D6_TADR(0)
, m_D8(*this, 8, std::bind(&CDMAC::ReceiveDMA8, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, std::placeholders::_4))
, m_D8_SADR(0)
, m_D9(*this, 9, std::bind(&CDMAC::ReceiveDMA9, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, std::placeholders::_4))
, m_D9_SADR(0)
: m_ram(ram)
, m_spr(spr)
, m_vuMem0(vuMem0)
, m_ee(ee)
, m_D_STAT(0)
, m_D_ENABLE(0)
, m_D0(*this, 0, DummyTransferFunction)
, m_D1(*this, 1, DummyTransferFunction)
, m_D2(*this, 2, DummyTransferFunction)
, m_D3_CHCR(0)
, m_D3_MADR(0)
, m_D3_QWC(0)
, m_D4(*this, 4, DummyTransferFunction)
, m_D5_CHCR(0)
, m_D5_MADR(0)
, m_D5_QWC(0)
, m_D6_CHCR(0)
, m_D6_MADR(0)
, m_D6_QWC(0)
, m_D6_TADR(0)
, m_D8(*this, 8, std::bind(&CDMAC::ReceiveDMA8, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, std::placeholders::_4))
, m_D8_SADR(0)
, m_D9(*this, 9, std::bind(&CDMAC::ReceiveDMA9, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, std::placeholders::_4))
, m_D9_SADR(0)
{
Reset();
}
@ -866,7 +866,6 @@ void CDMAC::SetRegister(uint32 nAddress, uint32 nData)
#ifdef _DEBUG
DisassembleSet(nAddress, nData);
#endif
}
void CDMAC::LoadState(Framework::CZipArchiveReader& archive)
@ -931,7 +930,10 @@ void CDMAC::UpdateCpCond()
void CDMAC::DisassembleGet(uint32 nAddress)
{
#define LOG_GET(registerId) case registerId: CLog::GetInstance().Print(LOG_NAME, "= " #registerId ".\r\n"); break;
#define LOG_GET(registerId) \
case registerId: \
CLog::GetInstance().Print(LOG_NAME, "= " #registerId ".\r\n"); \
break;
switch(nAddress)
{
@ -990,7 +992,10 @@ void CDMAC::DisassembleGet(uint32 nAddress)
void CDMAC::DisassembleSet(uint32 nAddress, uint32 nData)
{
#define LOG_SET(registerId) case registerId: CLog::GetInstance().Print(LOG_NAME, #registerId " = 0x%08X.\r\n", nData); break;
#define LOG_SET(registerId) \
case registerId: \
CLog::GetInstance().Print(LOG_NAME, #registerId " = 0x%08X.\r\n", nData); \
break;
switch(nAddress)
{

View file

@ -22,11 +22,10 @@
using namespace Dmac;
CChannel::CChannel(CDMAC& dmac, unsigned int nNumber, const DmaReceiveHandler& pReceive)
: m_dmac(dmac)
, m_number(nNumber)
, m_receive(pReceive)
: m_dmac(dmac)
, m_number(nNumber)
, m_receive(pReceive)
{
}
void CChannel::Reset()

View file

@ -10,7 +10,7 @@ class CDMAC;
namespace Dmac
{
typedef std::function<uint32 (uint32, uint32, uint32, bool)> DmaReceiveHandler;
typedef std::function<uint32(uint32, uint32, uint32, bool)> DmaReceiveHandler;
class CChannel
{
@ -46,7 +46,6 @@ namespace Dmac
unsigned int nTAG : 16;
};
CChannel(CDMAC&, unsigned int, const DmaReceiveHandler&);
virtual ~CChannel() = default;

View file

@ -1,9 +1,8 @@
#include "EEAssembler.h"
CEEAssembler::CEEAssembler(uint32* ptr)
: CMIPSAssembler(ptr)
: CMIPSAssembler(ptr)
{
}
void CEEAssembler::LQ(unsigned int rt, uint16 offset, unsigned int base)

View file

@ -33,8 +33,8 @@
static CEeExecutor* g_eeExecutor = nullptr;
CEeExecutor::CEeExecutor(CMIPS& context, uint8* ram)
: CMipsExecutor(context, 0x20000000)
, m_ram(ram)
: CMipsExecutor(context, 0x20000000)
, m_ram(ram)
{
m_pageSize = framework_getpagesize();
}
@ -64,7 +64,7 @@ void CEeExecutor::AddExceptionHandler()
assert(result == KERN_SUCCESS);
m_running = true;
m_handlerThread = std::thread([this] () { HandlerThreadProc(); });
m_handlerThread = std::thread([this]() { HandlerThreadProc(); });
result = mach_port_insert_right(mach_task_self(), m_port, m_port, MACH_MSG_TYPE_MAKE_SEND);
assert(result == KERN_SUCCESS);

View file

@ -23,30 +23,30 @@ using namespace Ee;
#define FAKE_IOP_RAM_SIZE (0x1000)
CSubSystem::CSubSystem(uint8* iopRam, CIopBios& iopBios)
: m_ram(reinterpret_cast<uint8*>(framework_aligned_alloc(PS2::EE_RAM_SIZE, framework_getpagesize())))
, m_bios(new uint8[PS2::EE_BIOS_SIZE])
, m_spr(new uint8[PS2::EE_SPR_SIZE])
, m_fakeIopRam(new uint8[FAKE_IOP_RAM_SIZE])
, m_vuMem0(reinterpret_cast<uint8*>(framework_aligned_alloc(PS2::VUMEM0SIZE, 0x10)))
, m_microMem0(new uint8[PS2::MICROMEM0SIZE])
, m_vuMem1(reinterpret_cast<uint8*>(framework_aligned_alloc(PS2::VUMEM1SIZE, 0x10)))
, m_microMem1(new uint8[PS2::MICROMEM1SIZE])
, m_EE(MEMORYMAP_ENDIAN_LSBF)
, m_VU0(MEMORYMAP_ENDIAN_LSBF)
, m_VU1(MEMORYMAP_ENDIAN_LSBF)
, m_executor(m_EE, m_ram)
, m_dmac(m_ram, m_spr, m_vuMem0, m_EE)
, m_gif(m_gs, m_ram, m_spr)
, m_sif(m_dmac, m_ram, iopRam)
, m_intc(m_dmac, m_gs)
, m_ipu(m_intc)
, m_timer(m_intc)
, m_MAVU0(PS2::VUMEM0SIZE - 1)
, m_MAVU1(PS2::VUMEM1SIZE - 1)
, m_COP_SCU(MIPS_REGSIZE_64)
, m_COP_FPU(MIPS_REGSIZE_64)
, m_COP_VU(MIPS_REGSIZE_64)
, m_iopBios(iopBios)
: m_ram(reinterpret_cast<uint8*>(framework_aligned_alloc(PS2::EE_RAM_SIZE, framework_getpagesize())))
, m_bios(new uint8[PS2::EE_BIOS_SIZE])
, m_spr(new uint8[PS2::EE_SPR_SIZE])
, m_fakeIopRam(new uint8[FAKE_IOP_RAM_SIZE])
, m_vuMem0(reinterpret_cast<uint8*>(framework_aligned_alloc(PS2::VUMEM0SIZE, 0x10)))
, m_microMem0(new uint8[PS2::MICROMEM0SIZE])
, m_vuMem1(reinterpret_cast<uint8*>(framework_aligned_alloc(PS2::VUMEM1SIZE, 0x10)))
, m_microMem1(new uint8[PS2::MICROMEM1SIZE])
, m_EE(MEMORYMAP_ENDIAN_LSBF)
, m_VU0(MEMORYMAP_ENDIAN_LSBF)
, m_VU1(MEMORYMAP_ENDIAN_LSBF)
, m_executor(m_EE, m_ram)
, m_dmac(m_ram, m_spr, m_vuMem0, m_EE)
, m_gif(m_gs, m_ram, m_spr)
, m_sif(m_dmac, m_ram, iopRam)
, m_intc(m_dmac, m_gs)
, m_ipu(m_intc)
, m_timer(m_intc)
, m_MAVU0(PS2::VUMEM0SIZE - 1)
, m_MAVU1(PS2::VUMEM1SIZE - 1)
, m_COP_SCU(MIPS_REGSIZE_64)
, m_COP_FPU(MIPS_REGSIZE_64)
, m_COP_VU(MIPS_REGSIZE_64)
, m_iopBios(iopBios)
{
//Some alignment checks, this is needed because of SIMD instructions used in generated code
assert((reinterpret_cast<size_t>(&m_EE.m_State) & 0x0F) == 0);
@ -150,13 +150,13 @@ CSubSystem::~CSubSystem()
m_executor.Reset();
delete m_os;
framework_aligned_free(m_ram);
delete [] m_bios;
delete [] m_spr;
delete [] m_fakeIopRam;
delete[] m_bios;
delete[] m_spr;
delete[] m_fakeIopRam;
framework_aligned_free(m_vuMem0);
delete [] m_microMem0;
delete[] m_microMem0;
framework_aligned_free(m_vuMem1);
delete [] m_microMem1;
delete[] m_microMem1;
}
void CSubSystem::SetVpu0(std::shared_ptr<CVpu> newVpu0)
@ -361,15 +361,15 @@ void CSubSystem::SaveState(Framework::CZipArchiveWriter& archive)
void CSubSystem::LoadState(Framework::CZipArchiveReader& archive)
{
archive.BeginReadFile(STATE_EE )->Read(&m_EE.m_State, sizeof(MIPSSTATE));
archive.BeginReadFile(STATE_VU0 )->Read(&m_VU0.m_State, sizeof(MIPSSTATE));
archive.BeginReadFile(STATE_VU1 )->Read(&m_VU1.m_State, sizeof(MIPSSTATE));
archive.BeginReadFile(STATE_RAM )->Read(m_ram, PS2::EE_RAM_SIZE);
archive.BeginReadFile(STATE_SPR )->Read(m_spr, PS2::EE_SPR_SIZE);
archive.BeginReadFile(STATE_VUMEM0 )->Read(m_vuMem0, PS2::VUMEM0SIZE);
archive.BeginReadFile(STATE_MICROMEM0 )->Read(m_microMem0, PS2::MICROMEM0SIZE);
archive.BeginReadFile(STATE_VUMEM1 )->Read(m_vuMem1, PS2::VUMEM1SIZE);
archive.BeginReadFile(STATE_MICROMEM1 )->Read(m_microMem1, PS2::MICROMEM1SIZE);
archive.BeginReadFile(STATE_EE)->Read(&m_EE.m_State, sizeof(MIPSSTATE));
archive.BeginReadFile(STATE_VU0)->Read(&m_VU0.m_State, sizeof(MIPSSTATE));
archive.BeginReadFile(STATE_VU1)->Read(&m_VU1.m_State, sizeof(MIPSSTATE));
archive.BeginReadFile(STATE_RAM)->Read(m_ram, PS2::EE_RAM_SIZE);
archive.BeginReadFile(STATE_SPR)->Read(m_spr, PS2::EE_SPR_SIZE);
archive.BeginReadFile(STATE_VUMEM0)->Read(m_vuMem0, PS2::VUMEM0SIZE);
archive.BeginReadFile(STATE_MICROMEM0)->Read(m_microMem0, PS2::MICROMEM0SIZE);
archive.BeginReadFile(STATE_VUMEM1)->Read(m_vuMem1, PS2::VUMEM1SIZE);
archive.BeginReadFile(STATE_MICROMEM1)->Read(m_microMem1, PS2::MICROMEM1SIZE);
m_dmac.LoadState(archive);
m_intc.LoadState(archive);
@ -522,8 +522,7 @@ uint32 CSubSystem::IOPortWriteHandler(uint32 nAddress, uint32 nData)
if(
m_intc.IsInterruptPending() &&
(m_EE.m_State.nHasException == MIPS_EXCEPTION_NONE) &&
((m_EE.m_State.nCOP0[CCOP_SCU::STATUS] & INTERRUPTS_ENABLED_MASK) == INTERRUPTS_ENABLED_MASK)
)
((m_EE.m_State.nCOP0[CCOP_SCU::STATUS] & INTERRUPTS_ENABLED_MASK) == INTERRUPTS_ENABLED_MASK))
{
m_EE.m_State.nHasException = MIPS_EXCEPTION_CHECKPENDINGINT;
}
@ -651,7 +650,7 @@ void CSubSystem::CheckPendingInterrupts()
if(
m_intc.IsInterruptPending()
#ifdef DEBUGGER_INCLUDED
// && !m_singleStepEe
// && !m_singleStepEe
&& !m_executor.MustBreak()
#endif
)

View file

@ -12,7 +12,7 @@ typedef float fp_t;
#define REP_C UINT32_C
#define significandBits 23
#define typeWidth (sizeof(rep_t)*CHAR_BIT)
#define typeWidth (sizeof(rep_t) * CHAR_BIT)
#define exponentBits (typeWidth - significandBits - 1)
#define maxExponent ((1 << exponentBits) - 1)
#define exponentBias (maxExponent >> 1)
@ -27,7 +27,8 @@ typedef float fp_t;
#define quietBit (implicitBit >> 1)
#define qnanRep (exponentMask | quietBit)
static inline int rep_clz(rep_t a) {
static inline int rep_clz(rep_t a)
{
return __builtin_clz(a);
}
@ -37,36 +38,43 @@ uint32 FpAddTruncate(uint32 a, uint32 b)
const rep_t bAbs = b & absMask;
// Detect if a or b is zero, infinity, or NaN.
if (aAbs - 1U >= infRep - 1U || bAbs - 1U >= infRep - 1U) {
if(aAbs - 1U >= infRep - 1U || bAbs - 1U >= infRep - 1U)
{
// NaN + anything = qNaN
if (aAbs > infRep) return (a | quietBit);
if(aAbs > infRep) return (a | quietBit);
// anything + NaN = qNaN
if (bAbs > infRep) return (b | quietBit);
if(bAbs > infRep) return (b | quietBit);
if (aAbs == infRep) {
if(aAbs == infRep)
{
// +/-infinity + -/+infinity = qNaN
if ((a ^ b) == signBit) return qnanRep;
if((a ^ b) == signBit) return qnanRep;
// +/-infinity + anything remaining = +/- infinity
else return a;
else
return a;
}
// anything remaining + +/-infinity = +/-infinity
if (bAbs == infRep) return b;
if(bAbs == infRep) return b;
// zero + anything = anything
if (!aAbs) {
if(!aAbs)
{
// but we need to get the sign right for zero + zero
if (!bAbs) return (a & b);
else return b;
if(!bAbs)
return (a & b);
else
return b;
}
// anything + zero = anything
if (!bAbs) return a;
if(!bAbs) return a;
}
// Swap a and b if necessary so that a has the larger absolute value.
if (bAbs > aAbs) {
if(bAbs > aAbs)
{
const uint32 temp = a;
a = b;
b = temp;
@ -97,36 +105,44 @@ uint32 FpAddTruncate(uint32 a, uint32 b)
// Shift the significand of b by the difference in exponents, with a sticky
// bottom bit to get rounding correct.
const unsigned int align = aExponent - bExponent;
if (align) {
if (align < typeWidth) {
if(align)
{
if(align < typeWidth)
{
//const bool sticky = bSignificand << (typeWidth - align);
bSignificand = bSignificand >> align;
} else {
}
else
{
bSignificand = 0; // sticky; b is known to be non-zero.
}
}
if (subtraction) {
if(subtraction)
{
aSignificand -= bSignificand;
// If a == -b, return +zero.
if (aSignificand == 0) return 0;
if(aSignificand == 0) return 0;
// If partial cancellation occured, we need to left-shift the result
// and adjust the exponent:
if (aSignificand < implicitBit << 3) {
if(aSignificand < implicitBit << 3)
{
const int shift = rep_clz(aSignificand) - rep_clz(implicitBit << 3);
aSignificand <<= shift;
aExponent -= shift;
}
}
else /* addition */ {
else /* addition */
{
aSignificand += bSignificand;
// If the addition carried up, we need to right-shift the result and
// adjust the exponent:
if (aSignificand & implicitBit << 4) {
if(aSignificand & implicitBit << 4)
{
const bool sticky = aSignificand & 1;
aSignificand = aSignificand >> 1 | sticky;
aExponent += 1;
@ -134,9 +150,10 @@ uint32 FpAddTruncate(uint32 a, uint32 b)
}
// If we have overflowed the type, return +/- infinity:
if (aExponent >= maxExponent) return infRep | resultSign;
if(aExponent >= maxExponent) return infRep | resultSign;
if (aExponent <= 0) {
if(aExponent <= 0)
{
// Result is denormal before rounding; the exponent is zero and we
// need to shift the significand.
const int shift = 1 - aExponent;

View file

@ -11,7 +11,7 @@ typedef float fp_t;
#define REP_C UINT32_C
#define significandBits 23
#define typeWidth (sizeof(rep_t)*CHAR_BIT)
#define typeWidth (sizeof(rep_t) * CHAR_BIT)
#define exponentBits (typeWidth - significandBits - 1)
#define maxExponent ((1 << exponentBits) - 1)
#define exponentBias (maxExponent >> 1)
@ -26,41 +26,56 @@ typedef float fp_t;
#define quietBit (implicitBit >> 1)
#define qnanRep (exponentMask | quietBit)
static rep_t toRep(fp_t x) {
union { fp_t f; rep_t i; } rep;
static rep_t toRep(fp_t x)
{
union {
fp_t f;
rep_t i;
} rep;
rep.f = x;
return rep.i;
}
static fp_t fromRep(rep_t x) {
union { fp_t f; rep_t i; } rep;
static fp_t fromRep(rep_t x)
{
union {
fp_t f;
rep_t i;
} rep;
rep.i = x;
return rep.f;
}
// 32x32 --> 64 bit multiply
static void wideMultiply(rep_t a, rep_t b, rep_t *hi, rep_t *lo) {
const uint64 product = (uint64)a*b;
static void wideMultiply(rep_t a, rep_t b, rep_t* hi, rep_t* lo)
{
const uint64 product = (uint64)a * b;
*hi = product >> 32;
*lo = product;
}
static void wideLeftShift(rep_t *hi, rep_t *lo, int count) {
static void wideLeftShift(rep_t* hi, rep_t* lo, int count)
{
*hi = *hi << count | *lo >> (typeWidth - count);
*lo = *lo << count;
}
static void wideRightShiftWithSticky(rep_t *hi, rep_t *lo, int count) {
if (count < typeWidth) {
static void wideRightShiftWithSticky(rep_t* hi, rep_t* lo, int count)
{
if(count < typeWidth)
{
const bool sticky = *lo << (typeWidth - count);
*lo = *hi << (typeWidth - count) | *lo >> count | sticky;
*hi = *hi >> count;
}
else if (count < 2*typeWidth) {
const bool sticky = *hi << (2*typeWidth - count) | *lo;
else if(count < 2 * typeWidth)
{
const bool sticky = *hi << (2 * typeWidth - count) | *lo;
*lo = *hi >> (count - typeWidth) | sticky;
*hi = 0;
} else {
}
else
{
const bool sticky = *hi | *lo;
*lo = sticky;
*hi = 0;
@ -78,40 +93,45 @@ uint32 FpMulTruncate(uint32 a, uint32 b)
int scale = 0;
// Detect if a or b is zero, denormal, infinity, or NaN.
if (aExponent-1U >= maxExponent-1U || bExponent-1U >= maxExponent-1U) {
if(aExponent - 1U >= maxExponent - 1U || bExponent - 1U >= maxExponent - 1U)
{
const rep_t aAbs = a & absMask;
const rep_t bAbs = b & absMask;
// NaN * anything = qNaN
if (aAbs > infRep) return (a | quietBit);
if(aAbs > infRep) return (a | quietBit);
// anything * NaN = qNaN
if (bAbs > infRep) return (b | quietBit);
if(bAbs > infRep) return (b | quietBit);
if (aAbs == infRep) {
if(aAbs == infRep)
{
// infinity * non-zero = +/- infinity
if (bAbs) return (aAbs | productSign);
if(bAbs) return (aAbs | productSign);
// infinity * zero = NaN
else return qnanRep;
else
return qnanRep;
}
if (bAbs == infRep) {
if(bAbs == infRep)
{
// non-zero * infinity = +/- infinity
if (aAbs) return (bAbs | productSign);
if(aAbs) return (bAbs | productSign);
// zero * infinity = NaN
else return qnanRep;
else
return qnanRep;
}
// zero * anything = +/- zero
if (!aAbs) return productSign;
if(!aAbs) return productSign;
// anything * zero = +/- zero
if (!bAbs) return productSign;
if(!bAbs) return productSign;
// one or both of a or b is denormal, the other (if applicable) is a
// normal number. Renormalize one or both of a and b, and set scale to
// include the necessary exponent adjustment.
if (aAbs < implicitBit) aSignificand = 0;
if (bAbs < implicitBit) bSignificand = 0;
if(aAbs < implicitBit) aSignificand = 0;
if(bAbs < implicitBit) bSignificand = 0;
}
// Or in the implicit significand bit. (If we fell through from the
@ -132,7 +152,7 @@ uint32 FpMulTruncate(uint32 a, uint32 b)
int productExponent = aExponent + bExponent - exponentBias + scale;
// Normalize the significand, adjust exponent if needed.
if (productHi & implicitBit)
if(productHi & implicitBit)
{
productExponent++;
}
@ -142,9 +162,10 @@ uint32 FpMulTruncate(uint32 a, uint32 b)
}
// If we have overflowed the type, return +/- infinity.
if (productExponent >= maxExponent) return infRep | productSign;
if(productExponent >= maxExponent) return infRep | productSign;
if (productExponent <= 0) {
if(productExponent <= 0)
{
// Result is denormal before rounding, the exponent is zero and we
// need to shift the significand.
wideRightShiftWithSticky(&productHi, &productLo, 1 - productExponent);

View file

@ -21,19 +21,18 @@
#define STATE_REGS_QTEMP ("QTEMP")
CGIF::CGIF(CGSHandler*& gs, uint8* ram, uint8* spr)
: m_gs(gs)
, m_ram(ram)
, m_spr(spr)
, m_loops(0)
, m_cmd(0)
, m_regs(0)
, m_regsTemp(0)
, m_regList(0)
, m_eop(false)
, m_qtemp(0)
, m_gifProfilerZone(CProfiler::GetInstance().RegisterZone("GIF"))
: m_gs(gs)
, m_ram(ram)
, m_spr(spr)
, m_loops(0)
, m_cmd(0)
, m_regs(0)
, m_regsTemp(0)
, m_regList(0)
, m_eop(false)
, m_qtemp(0)
, m_gifProfilerZone(CProfiler::GetInstance().RegisterZone("GIF"))
{
}
void CGIF::Reset()
@ -261,8 +260,7 @@ uint32 CGIF::ProcessSinglePacket(const uint8* memory, uint32 address, uint32 end
{
static CGSHandler::RegisterWriteList writeList;
static const auto flushWriteList =
[] (CGSHandler* gs, const CGsPacketMetadata& packetMetadata)
{
[](CGSHandler* gs, const CGsPacketMetadata& packetMetadata) {
if(!writeList.empty())
{
auto currentCapacity = writeList.capacity();

View file

@ -7,17 +7,15 @@
#define STATE_REGS_XML ("intc/regs.xml")
CINTC::CINTC(CDMAC& dmac, CGSHandler*& gs)
: m_INTC_STAT(0)
, m_INTC_MASK(0)
, m_dmac(dmac)
, m_gs(gs)
: m_INTC_STAT(0)
, m_INTC_MASK(0)
, m_dmac(dmac)
, m_gs(gs)
{
}
CINTC::~CINTC()
{
}
void CINTC::Reset()

View file

@ -43,17 +43,15 @@ static CVLCTable::DECODE_STATUS FilterSymbolError(CVLCTable::DECODE_STATUS resul
}
CIPU::CIPU(CINTC& intc)
: m_intc(intc)
, m_IPU_CTRL(0)
, m_isBusy(false)
, m_currentCmd(nullptr)
: m_intc(intc)
, m_IPU_CTRL(0)
, m_isBusy(false)
, m_currentCmd(nullptr)
{
}
CIPU::~CIPU()
{
}
void CIPU::Reset()
@ -245,7 +243,6 @@ void CIPU::ExecuteCommand()
}
catch(const Framework::CBitStream::CBitStreamException&)
{
}
catch(const CStartCodeException&)
{
@ -508,7 +505,6 @@ void CIPU::DequantiseBlock(int16* pBlock, uint8 nMBI, uint8 nQSC, bool isLinearQ
if(nSum & 1)
{
}
}
@ -595,7 +591,6 @@ void CIPU::DisassembleSet(uint32 nAddress, uint32 nValue)
CLog::GetInstance().Print(LOG_NAME, "IPU_IN_FIFO = 0x%08X\r\n", nValue);
break;
}
}
void CIPU::DisassembleCommand(uint32 nValue)
@ -606,11 +601,11 @@ void CIPU::DisassembleCommand(uint32 nValue)
CLog::GetInstance().Print(LOG_NAME, "BCLR(bp = %i);\r\n", nValue & 0x7F);
break;
case 2:
CLog::GetInstance().Print(LOG_NAME, "BDEC(mbi = %i, dcr = %i, dt = %i, qsc = %i, fb = %i);\r\n", \
(nValue >> 27) & 1, \
(nValue >> 26) & 1, \
(nValue >> 25) & 1, \
(nValue >> 16) & 0x1F, \
CLog::GetInstance().Print(LOG_NAME, "BDEC(mbi = %i, dcr = %i, dt = %i, qsc = %i, fb = %i);\r\n",
(nValue >> 27) & 1,
(nValue >> 26) & 1,
(nValue >> 25) & 1,
(nValue >> 16) & 0x1F,
nValue & 0x3F);
break;
case 3:
@ -665,9 +660,9 @@ void CIPU::DisassembleCommand(uint32 nValue)
CLog::GetInstance().Print(LOG_NAME, "SETVQ();\r\n");
break;
case 7:
CLog::GetInstance().Print(LOG_NAME, "CSC(ofm = %i, dte = %i, mbc = %i);\r\n", \
(nValue >> 27) & 1, \
(nValue >> 26) & 1, \
CLog::GetInstance().Print(LOG_NAME, "CSC(ofm = %i, dte = %i, mbc = %i);\r\n",
(nValue >> 27) & 1,
(nValue >> 26) & 1,
(nValue >> 0) & 0x7FF);
break;
case 9:
@ -681,11 +676,10 @@ void CIPU::DisassembleCommand(uint32 nValue)
/////////////////////////////////////////////
CIPU::COUTFIFO::COUTFIFO()
: m_buffer(nullptr)
, m_alloc(0)
, m_size(0)
: m_buffer(nullptr)
, m_alloc(0)
, m_size(0)
{
}
CIPU::COUTFIFO::~COUTFIFO()
@ -743,15 +737,13 @@ void CIPU::COUTFIFO::RequestGrow(unsigned int size)
/////////////////////////////////////////////
CIPU::CINFIFO::CINFIFO()
: m_size(0)
, m_bitPosition(0)
: m_size(0)
, m_bitPosition(0)
{
}
CIPU::CINFIFO::~CINFIFO()
{
}
void CIPU::CINFIFO::Write(void* data, unsigned int size)
@ -880,10 +872,9 @@ void CIPU::CINFIFO::SyncLookupBits()
/////////////////////////////////////////////
CIPU::CBCLRCommand::CBCLRCommand()
: m_IN_FIFO(NULL)
, m_commandCode(0)
: m_IN_FIFO(NULL)
, m_commandCode(0)
{
}
void CIPU::CBCLRCommand::Initialize(CINFIFO* fifo, uint32 commandCode)
@ -906,12 +897,10 @@ bool CIPU::CBCLRCommand::Execute()
CIPU::CIDECCommand::CIDECCommand()
{
m_temp_OUT_FIFO.SetReceiveHandler(
[&] (const void* data, uint32 size)
{
[&](const void* data, uint32 size) {
m_blockStream.Write(data, size * 0x10);
return size;
}
);
});
}
void CIPU::CIDECCommand::Initialize(CBDECCommand* BDECCommand, CCSCCommand* CSCCommand, CINFIFO* inFifo, COUTFIFO* outFifo,
@ -1120,12 +1109,18 @@ void CIPU::CIDECCommand::ConvertRawBlock()
CIPU::CBDECCommand::CBDECCommand()
{
m_blocks[0].block = m_yBlock[0]; m_blocks[0].channel = 0;
m_blocks[1].block = m_yBlock[1]; m_blocks[1].channel = 0;
m_blocks[2].block = m_yBlock[2]; m_blocks[2].channel = 0;
m_blocks[3].block = m_yBlock[3]; m_blocks[3].channel = 0;
m_blocks[4].block = m_cbBlock; m_blocks[4].channel = 1;
m_blocks[5].block = m_crBlock; m_blocks[5].channel = 2;
m_blocks[0].block = m_yBlock[0];
m_blocks[0].channel = 0;
m_blocks[1].block = m_yBlock[1];
m_blocks[1].channel = 0;
m_blocks[2].block = m_yBlock[2];
m_blocks[2].channel = 0;
m_blocks[3].block = m_yBlock[3];
m_blocks[3].channel = 0;
m_blocks[4].block = m_cbBlock;
m_blocks[4].channel = 1;
m_blocks[5].block = m_crBlock;
m_blocks[5].channel = 2;
}
void CIPU::CBDECCommand::Initialize(CINFIFO* inFifo, COUTFIFO* outFifo, uint32 commandCode, bool checkStartCode, const DECODER_CONTEXT& context)
@ -1304,19 +1299,18 @@ bool CIPU::CBDECCommand::Execute()
/////////////////////////////////////////////
CIPU::CBDECCommand_ReadDct::CBDECCommand_ReadDct()
: m_state(STATE_INIT)
, m_IN_FIFO(NULL)
, m_coeffTable(NULL)
, m_block(NULL)
, m_dcPredictor(NULL)
, m_dcDiff(0)
, m_channelId(0)
, m_mbi(false)
, m_isMpeg1CoeffVLCTable(false)
, m_isMpeg2(true)
, m_blockIndex(0)
: m_state(STATE_INIT)
, m_IN_FIFO(NULL)
, m_coeffTable(NULL)
, m_block(NULL)
, m_dcPredictor(NULL)
, m_dcDiff(0)
, m_channelId(0)
, m_mbi(false)
, m_isMpeg1CoeffVLCTable(false)
, m_isMpeg2(true)
, m_blockIndex(0)
{
}
void CIPU::CBDECCommand_ReadDct::Initialize(CINFIFO* fifo, int16* block, unsigned int channelId, int16* dcPredictor, bool mbi, bool isMpeg1CoeffVLCTable, bool isMpeg2)
@ -1452,13 +1446,12 @@ bool CIPU::CBDECCommand_ReadDct::Execute()
//BDEC ReadDcDiff subcommand implementation
/////////////////////////////////////////////
CIPU::CBDECCommand_ReadDcDiff::CBDECCommand_ReadDcDiff()
: m_state(STATE_READSIZE)
, m_result(NULL)
, m_IN_FIFO(NULL)
, m_channelId(0)
, m_dcSize(0)
: m_state(STATE_READSIZE)
, m_result(NULL)
, m_IN_FIFO(NULL)
, m_channelId(0)
, m_dcSize(0)
{
}
void CIPU::CBDECCommand_ReadDcDiff::Initialize(CINFIFO* fifo, unsigned int channelId, int16* result)
@ -1538,13 +1531,12 @@ bool CIPU::CBDECCommand_ReadDcDiff::Execute()
/////////////////////////////////////////////
CIPU::CVDECCommand::CVDECCommand()
: m_IN_FIFO(NULL)
, m_state(STATE_ADVANCE)
, m_commandCode(0)
, m_result(NULL)
, m_table(NULL)
: m_IN_FIFO(NULL)
, m_state(STATE_ADVANCE)
, m_commandCode(0)
, m_result(NULL)
, m_table(NULL)
{
}
void CIPU::CVDECCommand::Initialize(CINFIFO* fifo, uint32 commandCode, uint32 pictureType, uint32* result)
@ -1624,8 +1616,7 @@ bool CIPU::CVDECCommand::Execute()
else if(
(m_table == CMacroblockTypeITable::GetInstance()) ||
(m_table == CMacroblockTypePTable::GetInstance()) ||
(m_table == CMacroblockTypeBTable::GetInstance())
)
(m_table == CMacroblockTypeBTable::GetInstance()))
{
tableName = "mb type";
}
@ -1652,12 +1643,11 @@ bool CIPU::CVDECCommand::Execute()
/////////////////////////////////////////////
CIPU::CFDECCommand::CFDECCommand()
: m_IN_FIFO(NULL)
, m_state(STATE_ADVANCE)
, m_commandCode(0)
, m_result(NULL)
: m_IN_FIFO(NULL)
, m_state(STATE_ADVANCE)
, m_commandCode(0)
, m_result(NULL)
{
}
void CIPU::CFDECCommand::Initialize(CINFIFO* fifo, uint32 commandCode, uint32* result)
@ -1701,11 +1691,10 @@ bool CIPU::CFDECCommand::Execute()
/////////////////////////////////////////////
CIPU::CSETIQCommand::CSETIQCommand()
: m_IN_FIFO(NULL)
, m_matrix(NULL)
, m_currentIndex(0)
: m_IN_FIFO(NULL)
, m_matrix(NULL)
, m_currentIndex(0)
{
}
void CIPU::CSETIQCommand::Initialize(CINFIFO* fifo, uint8* matrix)
@ -1730,11 +1719,10 @@ bool CIPU::CSETIQCommand::Execute()
/////////////////////////////////////////////
CIPU::CSETVQCommand::CSETVQCommand()
: m_IN_FIFO(NULL)
, m_clut(NULL)
, m_currentIndex(0)
: m_IN_FIFO(NULL)
, m_clut(NULL)
, m_currentIndex(0)
{
}
void CIPU::CSETVQCommand::Initialize(CINFIFO* fifo, uint16* clut)
@ -1842,9 +1830,30 @@ bool CIPU::CCSCCommand::Execute()
float nG = nY - 0.34414f * (nCb - 128) - 0.71414f * (nCr - 128);
float nB = nY + 1.772f * (nCb - 128);
if(nR < 0) { nR = 0; } if(nR > 255) { nR = 255; }
if(nG < 0) { nG = 0; } if(nG > 255) { nG = 255; }
if(nB < 0) { nB = 0; } if(nB > 255) { nB = 255; }
if(nR < 0)
{
nR = 0;
}
if(nR > 255)
{
nR = 255;
}
if(nG < 0)
{
nG = 0;
}
if(nG > 255)
{
nG = 255;
}
if(nB < 0)
{
nB = 0;
}
if(nB > 255)
{
nB = 255;
}
uint8 a = 0;
uint32 rgb = (static_cast<uint8>(nB) << 16) | (static_cast<uint8>(nG) << 8) | (static_cast<uint8>(nR) << 0);
@ -1915,11 +1924,10 @@ void CIPU::CCSCCommand::GenerateCbCrMap()
/////////////////////////////////////////////
CIPU::CSETTHCommand::CSETTHCommand()
: m_commandCode(0)
, m_TH0(NULL)
, m_TH1(NULL)
: m_commandCode(0)
, m_TH0(NULL)
, m_TH1(NULL)
{
}
void CIPU::CSETTHCommand::Initialize(uint32 commandCode, uint16* TH0, uint16* TH1)

View file

@ -14,7 +14,7 @@ class CINTC;
class CIPU
{
public:
typedef std::function<uint32 (const void*, uint32)> Dma3ReceiveHandler;
typedef std::function<uint32(const void*, uint32)> Dma3ReceiveHandler;
CIPU(CINTC&);
virtual ~CIPU();
@ -182,19 +182,24 @@ private:
class CStartCodeException : public std::exception
{
};
class CCommand
{
public:
virtual ~CCommand() {}
virtual ~CCommand()
{
}
virtual bool Execute() = 0;
virtual void CountTicks(uint32) {}
virtual bool IsDelayed() const { return false; }
virtual void CountTicks(uint32)
{
}
virtual bool IsDelayed() const
{
return false;
}
private:
};
//0x00 ------------------------------------------------------------

View file

@ -5,24 +5,23 @@ using namespace IPU;
using namespace MPEG2;
VLCTABLEENTRY CDmVectorTable::m_pTable[ENTRYCOUNT] =
{
{ 0x0000, 1, 0x00010000 },
{ 0x0002, 2, 0x00020001 },
{ 0x0003, 2, 0x0002FFFF },
{
{0x0000, 1, 0x00010000},
{0x0002, 2, 0x00020001},
{0x0003, 2, 0x0002FFFF},
};
unsigned int CDmVectorTable::m_pIndexTable[MAXBITS] =
{
{
0,
1,
};
CVLCTable* CDmVectorTable::m_pInstance = NULL;
CDmVectorTable::CDmVectorTable() :
CVLCTable(MAXBITS, m_pTable, ENTRYCOUNT, m_pIndexTable)
CDmVectorTable::CDmVectorTable()
: CVLCTable(MAXBITS, m_pTable, ENTRYCOUNT, m_pIndexTable)
{
}
CVLCTable* CDmVectorTable::GetInstance()

View file

@ -27,7 +27,6 @@ namespace IPU
static unsigned int m_pIndexTable[MAXBITS];
static MPEG2::CVLCTable* m_pInstance;
};
}
#endif

View file

@ -5,46 +5,46 @@ using namespace IPU;
using namespace MPEG2;
VLCTABLEENTRY CMacroblockAddressIncrementTable::m_pTable[ENTRYCOUNT] =
{
{ 0x0001, 1, 0x00010001 },
{ 0x0003, 3, 0x00030002 },
{ 0x0002, 3, 0x00030003 },
{ 0x0003, 4, 0x00040004 },
{ 0x0002, 4, 0x00040005 },
{ 0x0003, 5, 0x00050006 },
{ 0x0002, 5, 0x00050007 },
{ 0x0007, 7, 0x00070008 },
{ 0x0006, 7, 0x00070009 },
{ 0x000B, 8, 0x0008000A },
{ 0x000A, 8, 0x0008000B },
{ 0x0009, 8, 0x0008000C },
{ 0x0008, 8, 0x0008000D },
{ 0x0007, 8, 0x0008000E },
{ 0x0006, 8, 0x0008000F },
{ 0x0017, 10, 0x000A0010 },
{ 0x0016, 10, 0x000A0011 },
{ 0x0015, 10, 0x000A0012 },
{ 0x0014, 10, 0x000A0013 },
{ 0x0013, 10, 0x000A0014 },
{ 0x0012, 10, 0x000A0015 },
{ 0x0023, 11, 0x000B0016 },
{ 0x0022, 11, 0x000B0017 },
{ 0x0021, 11, 0x000B0018 },
{ 0x0020, 11, 0x000B0019 },
{ 0x001F, 11, 0x000B001A },
{ 0x001E, 11, 0x000B001B },
{ 0x001D, 11, 0x000B001C },
{ 0x001C, 11, 0x000B001D },
{ 0x001B, 11, 0x000B001E },
{ 0x001A, 11, 0x000B001F },
{ 0x0019, 11, 0x000B0020 },
{ 0x0018, 11, 0x000B0021 },
{ 0x000F, 11, 0x000B0022 },
{ 0x0008, 11, 0x000B0023 },
{
{0x0001, 1, 0x00010001},
{0x0003, 3, 0x00030002},
{0x0002, 3, 0x00030003},
{0x0003, 4, 0x00040004},
{0x0002, 4, 0x00040005},
{0x0003, 5, 0x00050006},
{0x0002, 5, 0x00050007},
{0x0007, 7, 0x00070008},
{0x0006, 7, 0x00070009},
{0x000B, 8, 0x0008000A},
{0x000A, 8, 0x0008000B},
{0x0009, 8, 0x0008000C},
{0x0008, 8, 0x0008000D},
{0x0007, 8, 0x0008000E},
{0x0006, 8, 0x0008000F},
{0x0017, 10, 0x000A0010},
{0x0016, 10, 0x000A0011},
{0x0015, 10, 0x000A0012},
{0x0014, 10, 0x000A0013},
{0x0013, 10, 0x000A0014},
{0x0012, 10, 0x000A0015},
{0x0023, 11, 0x000B0016},
{0x0022, 11, 0x000B0017},
{0x0021, 11, 0x000B0018},
{0x0020, 11, 0x000B0019},
{0x001F, 11, 0x000B001A},
{0x001E, 11, 0x000B001B},
{0x001D, 11, 0x000B001C},
{0x001C, 11, 0x000B001D},
{0x001B, 11, 0x000B001E},
{0x001A, 11, 0x000B001F},
{0x0019, 11, 0x000B0020},
{0x0018, 11, 0x000B0021},
{0x000F, 11, 0x000B0022},
{0x0008, 11, 0x000B0023},
};
unsigned int CMacroblockAddressIncrementTable::m_pIndexTable[MAXBITS] =
{
{
0,
1,
1,
@ -60,10 +60,9 @@ unsigned int CMacroblockAddressIncrementTable::m_pIndexTable[MAXBITS] =
CVLCTable* CMacroblockAddressIncrementTable::m_pInstance = NULL;
CMacroblockAddressIncrementTable::CMacroblockAddressIncrementTable() :
CVLCTable(MAXBITS, m_pTable, ENTRYCOUNT, m_pIndexTable)
CMacroblockAddressIncrementTable::CMacroblockAddressIncrementTable()
: CVLCTable(MAXBITS, m_pTable, ENTRYCOUNT, m_pIndexTable)
{
}
CVLCTable* CMacroblockAddressIncrementTable::GetInstance()

View file

@ -27,7 +27,6 @@ namespace IPU
static unsigned int m_pIndexTable[MAXBITS];
static MPEG2::CVLCTable* m_pInstance;
};
}
#endif

View file

@ -5,22 +5,22 @@ using namespace IPU;
using namespace MPEG2;
VLCTABLEENTRY CMacroblockTypeBTable::m_pTable[ENTRYCOUNT] =
{
{ 0x0002, 2, 0x0002000C },
{ 0x0003, 2, 0x0002000E },
{ 0x0002, 3, 0x00030004 },
{ 0x0003, 3, 0x00030006 },
{ 0x0002, 4, 0x00040008 },
{ 0x0003, 4, 0x0004000A },
{ 0x0003, 5, 0x00050001 },
{ 0x0002, 5, 0x0005001E },
{ 0x0003, 6, 0x0006001A },
{ 0x0002, 6, 0x00060016 },
{ 0x0001, 6, 0x00060011 },
{
{0x0002, 2, 0x0002000C},
{0x0003, 2, 0x0002000E},
{0x0002, 3, 0x00030004},
{0x0003, 3, 0x00030006},
{0x0002, 4, 0x00040008},
{0x0003, 4, 0x0004000A},
{0x0003, 5, 0x00050001},
{0x0002, 5, 0x0005001E},
{0x0003, 6, 0x0006001A},
{0x0002, 6, 0x00060016},
{0x0001, 6, 0x00060011},
};
unsigned int CMacroblockTypeBTable::m_pIndexTable[MAXBITS] =
{
{
0,
0,
2,
@ -31,10 +31,9 @@ unsigned int CMacroblockTypeBTable::m_pIndexTable[MAXBITS] =
CVLCTable* CMacroblockTypeBTable::m_pInstance = NULL;
CMacroblockTypeBTable::CMacroblockTypeBTable() :
CVLCTable(MAXBITS, m_pTable, ENTRYCOUNT, m_pIndexTable)
CMacroblockTypeBTable::CMacroblockTypeBTable()
: CVLCTable(MAXBITS, m_pTable, ENTRYCOUNT, m_pIndexTable)
{
}
CVLCTable* CMacroblockTypeBTable::GetInstance()

View file

@ -5,23 +5,22 @@ using namespace IPU;
using namespace MPEG2;
VLCTABLEENTRY CMacroblockTypeITable::m_pTable[ENTRYCOUNT] =
{
{ 0x0001, 1, 0x00010001 },
{ 0x0001, 2, 0x00020011 },
{
{0x0001, 1, 0x00010001},
{0x0001, 2, 0x00020011},
};
unsigned int CMacroblockTypeITable::m_pIndexTable[MAXBITS] =
{
{
0,
1,
};
CVLCTable* CMacroblockTypeITable::m_pInstance = NULL;
CMacroblockTypeITable::CMacroblockTypeITable() :
CVLCTable(MAXBITS, m_pTable, ENTRYCOUNT, m_pIndexTable)
CMacroblockTypeITable::CMacroblockTypeITable()
: CVLCTable(MAXBITS, m_pTable, ENTRYCOUNT, m_pIndexTable)
{
}
CVLCTable* CMacroblockTypeITable::GetInstance()

View file

@ -27,7 +27,6 @@ namespace IPU
static unsigned int m_pIndexTable[MAXBITS];
static MPEG2::CVLCTable* m_pInstance;
};
}
#endif

View file

@ -5,18 +5,18 @@ using namespace IPU;
using namespace MPEG2;
VLCTABLEENTRY CMacroblockTypePTable::m_pTable[ENTRYCOUNT] =
{
{ 0x0001, 1, 0x0001000A },
{ 0x0001, 2, 0x00020002 },
{ 0x0001, 3, 0x00030008 },
{ 0x0003, 5, 0x00050001 },
{ 0x0002, 5, 0x0005001A },
{ 0x0001, 5, 0x00050012 },
{ 0x0001, 6, 0x00060011 },
{
{0x0001, 1, 0x0001000A},
{0x0001, 2, 0x00020002},
{0x0001, 3, 0x00030008},
{0x0003, 5, 0x00050001},
{0x0002, 5, 0x0005001A},
{0x0001, 5, 0x00050012},
{0x0001, 6, 0x00060011},
};
unsigned int CMacroblockTypePTable::m_pIndexTable[MAXBITS] =
{
{
0,
1,
2,
@ -27,10 +27,9 @@ unsigned int CMacroblockTypePTable::m_pIndexTable[MAXBITS] =
CVLCTable* CMacroblockTypePTable::m_pInstance = NULL;
CMacroblockTypePTable::CMacroblockTypePTable() :
CVLCTable(MAXBITS, m_pTable, ENTRYCOUNT, m_pIndexTable)
CMacroblockTypePTable::CMacroblockTypePTable()
: CVLCTable(MAXBITS, m_pTable, ENTRYCOUNT, m_pIndexTable)
{
}
CVLCTable* CMacroblockTypePTable::GetInstance()

View file

@ -27,7 +27,6 @@ namespace IPU
static unsigned int m_pIndexTable[MAXBITS];
static MPEG2::CVLCTable* m_pInstance;
};
}
#endif

View file

@ -5,44 +5,44 @@ using namespace IPU;
using namespace MPEG2;
VLCTABLEENTRY CMotionCodeTable::m_pTable[ENTRYCOUNT] =
{
{ 0x0001, 1, 0x00010000 },
{ 0x0002, 3, 0x00030001 },
{ 0x0003, 3, 0x0003FFFF },
{ 0x0002, 4, 0x00040002 },
{ 0x0003, 4, 0x0004FFFE },
{ 0x0002, 5, 0x00050003 },
{ 0x0003, 5, 0x0005FFFD },
{ 0x0006, 7, 0x00070004 },
{ 0x0007, 7, 0x0007FFFC },
{ 0x000A, 8, 0x00080005 },
{ 0x000B, 8, 0x0008FFFB },
{ 0x0008, 8, 0x00080006 },
{ 0x0009, 8, 0x0008FFFA },
{ 0x0006, 8, 0x00080007 },
{ 0x0007, 8, 0x0008FFF9 },
{ 0x0016, 10, 0x000A0008 },
{ 0x0017, 10, 0x000AFFF8 },
{ 0x0014, 10, 0x000A0009 },
{ 0x0015, 10, 0x000AFFF7 },
{ 0x0012, 10, 0x000A000A },
{ 0x0013, 10, 0x000AFFF6 },
{ 0x0022, 11, 0x000B000B },
{ 0x0023, 11, 0x000BFFF5 },
{ 0x0020, 11, 0x000B000C },
{ 0x0021, 11, 0x000BFFF4 },
{ 0x001E, 11, 0x000B000D },
{ 0x001F, 11, 0x000BFFF3 },
{ 0x001C, 11, 0x000B000E },
{ 0x001D, 11, 0x000BFFF2 },
{ 0x001A, 11, 0x000B000F },
{ 0x001B, 11, 0x000BFFF1 },
{ 0x0018, 11, 0x000B0010 },
{ 0x0019, 11, 0x000BFFF0 },
{
{0x0001, 1, 0x00010000},
{0x0002, 3, 0x00030001},
{0x0003, 3, 0x0003FFFF},
{0x0002, 4, 0x00040002},
{0x0003, 4, 0x0004FFFE},
{0x0002, 5, 0x00050003},
{0x0003, 5, 0x0005FFFD},
{0x0006, 7, 0x00070004},
{0x0007, 7, 0x0007FFFC},
{0x000A, 8, 0x00080005},
{0x000B, 8, 0x0008FFFB},
{0x0008, 8, 0x00080006},
{0x0009, 8, 0x0008FFFA},
{0x0006, 8, 0x00080007},
{0x0007, 8, 0x0008FFF9},
{0x0016, 10, 0x000A0008},
{0x0017, 10, 0x000AFFF8},
{0x0014, 10, 0x000A0009},
{0x0015, 10, 0x000AFFF7},
{0x0012, 10, 0x000A000A},
{0x0013, 10, 0x000AFFF6},
{0x0022, 11, 0x000B000B},
{0x0023, 11, 0x000BFFF5},
{0x0020, 11, 0x000B000C},
{0x0021, 11, 0x000BFFF4},
{0x001E, 11, 0x000B000D},
{0x001F, 11, 0x000BFFF3},
{0x001C, 11, 0x000B000E},
{0x001D, 11, 0x000BFFF2},
{0x001A, 11, 0x000B000F},
{0x001B, 11, 0x000BFFF1},
{0x0018, 11, 0x000B0010},
{0x0019, 11, 0x000BFFF0},
};
unsigned int CMotionCodeTable::m_pIndexTable[MAXBITS] =
{
{
0,
1,
1,
@ -58,10 +58,9 @@ unsigned int CMotionCodeTable::m_pIndexTable[MAXBITS] =
CVLCTable* CMotionCodeTable::m_pInstance = NULL;
CMotionCodeTable::CMotionCodeTable() :
CVLCTable(MAXBITS, m_pTable, ENTRYCOUNT, m_pIndexTable)
CMotionCodeTable::CMotionCodeTable()
: CVLCTable(MAXBITS, m_pTable, ENTRYCOUNT, m_pIndexTable)
{
}
CVLCTable* CMotionCodeTable::GetInstance()

View file

@ -4,8 +4,8 @@
#include "MA_EE.h"
#include "offsetof_def.h"
CMA_EE::CMA_EE() :
CMA_MIPSIV(MIPS_REGSIZE_64)
CMA_EE::CMA_EE()
: CMA_MIPSIV(MIPS_REGSIZE_64)
{
m_pOpGeneral[0x1E] = std::bind(&CMA_EE::LQ, this);
m_pOpGeneral[0x1F] = std::bind(&CMA_EE::SQ, this);
@ -920,13 +920,13 @@ void CMA_EE::QFSRV()
//02
void CMA_EE::PSLLVW()
{
Generic_PSxxV([this] () { m_codeGen->Shl(); });
Generic_PSxxV([this]() { m_codeGen->Shl(); });
}
//03
void CMA_EE::PSRLVW()
{
Generic_PSxxV([this] () { m_codeGen->Srl(); });
Generic_PSxxV([this]() { m_codeGen->Srl(); });
}
//08
@ -1000,8 +1000,7 @@ void CMA_EE::PMADDH()
offsetof(CMIPS, m_State.nLO1[0]),
offsetof(CMIPS, m_State.nLO1[1]),
offsetof(CMIPS, m_State.nHI1[0]),
offsetof(CMIPS, m_State.nHI1[1])
};
offsetof(CMIPS, m_State.nHI1[1])};
for(unsigned int i = 0; i < 4; i++)
{
@ -1177,8 +1176,7 @@ void CMA_EE::PMULTH()
offsetof(CMIPS, m_State.nLO1[0]),
offsetof(CMIPS, m_State.nLO1[1]),
offsetof(CMIPS, m_State.nHI1[0]),
offsetof(CMIPS, m_State.nHI1[1])
};
offsetof(CMIPS, m_State.nHI1[1])};
for(unsigned int i = 0; i < 4; i++)
{
@ -1299,7 +1297,7 @@ void CMA_EE::PROT3W()
//03
void CMA_EE::PSRAVW()
{
Generic_PSxxV([this] () { m_codeGen->Sra(); });
Generic_PSxxV([this]() { m_codeGen->Sra(); });
}
//08
@ -1532,8 +1530,7 @@ void CMA_EE::PMFHL_LH()
offsetof(CMIPS, m_State.nLO1[0]),
offsetof(CMIPS, m_State.nLO1[1]),
offsetof(CMIPS, m_State.nHI1[0]),
offsetof(CMIPS, m_State.nHI1[1])
};
offsetof(CMIPS, m_State.nHI1[1])};
for(unsigned int i = 0; i < 4; i++)
{
@ -1555,8 +1552,7 @@ void CMA_EE::PMFHL_SH()
if(m_nRD == 0) return;
static const auto emitClamp =
[] (CMipsJitter* codeGen, size_t offsetToClamp)
{
[](CMipsJitter* codeGen, size_t offsetToClamp) {
codeGen->PushRel(offsetToClamp);
codeGen->PushCst(0x7FFF);
codeGen->BeginIf(Jitter::CONDITION_GT);
@ -1585,8 +1581,7 @@ void CMA_EE::PMFHL_SH()
offsetof(CMIPS, m_State.nLO1[0]),
offsetof(CMIPS, m_State.nLO1[1]),
offsetof(CMIPS, m_State.nHI1[0]),
offsetof(CMIPS, m_State.nHI1[1])
};
offsetof(CMIPS, m_State.nHI1[1])};
static const size_t tempOffset = offsetof(CMIPS, m_State.nCOP2T);

View file

@ -37,7 +37,6 @@ protected:
MIPSReflection::SUBTABLE m_ReflPmfhlTable;
private:
void PushVector(unsigned int);
void PullVector(unsigned int);
size_t GetLoOffset(unsigned int);

View file

@ -14,7 +14,7 @@ void CMA_EE::ReflOpRdRt(INSTRUCTION* pInstr, CMIPS* pCtx, uint32 nAddress, uint3
void CMA_EE::ReflOpRsImm(INSTRUCTION* pInstr, CMIPS* pCtx, uint32 nAddress, uint32 nOpcode, char* sText, unsigned int nCount)
{
uint8 nRS = static_cast<uint8> ((nOpcode >> 21) & 0x001F);
uint8 nRS = static_cast<uint8>((nOpcode >> 21) & 0x001F);
uint16 nImm = static_cast<uint16>((nOpcode >> 0) & 0xFFFF);
sprintf(sText, "%s, $%04X", CMIPS::m_sGPRName[nRS], nImm);

View file

@ -2,8 +2,8 @@
#include "../MIPS.h"
CMA_VU::CMA_VU(uint32 vuMemAddressMask)
: CMIPSArchitecture(MIPS_REGSIZE_64)
, m_Lower(vuMemAddressMask)
: CMIPSArchitecture(MIPS_REGSIZE_64)
, m_Lower(vuMemAddressMask)
{
SetupReflectionTables();
}

Some files were not shown because too many files have changed in this diff Show more