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

@ -7,7 +7,6 @@
CAppConfig::CAppConfig()
: 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;
}
@ -82,8 +83,7 @@ void CBasicBlock::Compile()
{
jitter->SetVariableAsConstant(
offsetof(CMIPS, m_State.nGPR[CMIPS::R0].nV[i]),
0
);
0);
}
}
@ -140,8 +140,7 @@ void CBasicBlock::Compile()
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;
};

View file

@ -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

@ -15,8 +15,7 @@ const uint32 CCOP_FPU::m_ccMask[8] =
0x10000000,
0x20000000,
0x40000000,
0x80000000
};
0x80000000};
CCOP_FPU::CCOP_FPU(MIPS_REGSIZE regSize)
: CMIPSCoprocessor(regSize)

View file

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

View file

@ -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)
{

View file

@ -4,15 +4,12 @@ CElfFile::CElfFile(Framework::CStream& stream)
: CElfFileContainer(stream)
, CELF(GetFileContent())
{
}
CElfFile::~CElfFile()
{
}
CElfFileContainer::CElfFileContainer(Framework::CStream& input)
{
uint32 size = static_cast<uint32>(input.GetLength());

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

@ -38,9 +38,9 @@ private:
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

@ -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

@ -24,7 +24,6 @@ CFile::CFile(CBlockProvider* blockProvider, uint64 start, uint64 size)
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

@ -13,12 +13,10 @@ CISO9660::CISO9660(const BlockProviderPtr& 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

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

View file

@ -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

@ -8,8 +8,7 @@ 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

@ -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

@ -5,12 +5,10 @@
CMIPSAnalysis::CMIPSAnalysis(CMIPS* 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;

View file

@ -3,5 +3,4 @@
CMIPSArchitecture::CMIPSArchitecture(MIPS_REGSIZE regSize)
: CMIPSInstructionFactory(regSize)
{
}

View file

@ -8,7 +8,6 @@ CMIPSAssembler::CMIPSAssembler(uint32* ptr)
, m_startPtr(ptr)
, m_nextLabelId(1)
{
}
CMIPSAssembler::~CMIPSAssembler()

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

@ -7,7 +7,6 @@
CMIPSInstructionFactory::CMIPSInstructionFactory(MIPS_REGSIZE nRegSize)
: m_regSize(nRegSize)
{
}
void CMIPSInstructionFactory::SetupQuickVariables(uint32 nAddress, CMipsJitter* codeGen, CMIPS* pCtx)

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

@ -5,7 +5,6 @@ CMemoryStateFile::CMemoryStateFile(const char* name, const void* memory, size_t
, m_memory(memory)
, m_size(size)
{
}
void CMemoryStateFile::Write(Framework::CStream& stream)

View file

@ -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);
}

View file

@ -9,7 +9,6 @@ CMipsFunctionPatternDb::CMipsFunctionPatternDb(Framework::Xml::CNode* node)
CMipsFunctionPatternDb::~CMipsFunctionPatternDb()
{
}
const CMipsFunctionPatternDb::PatternArray& CMipsFunctionPatternDb::GetPatterns() const

View file

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

View file

@ -5,12 +5,10 @@ CMipsJitter::CMipsJitter(Jitter::CCodeGen* codeGen)
: 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

@ -8,7 +8,11 @@ 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++()
{

View file

@ -9,7 +9,11 @@ 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++()
{
@ -55,7 +59,6 @@ public:
: m_items(items)
, m_headIdPtr(headIdPtr)
{
}
COsStructQueue(const COsStructQueue&) = delete;

View file

@ -4,7 +4,10 @@ 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;

View file

@ -10,7 +10,6 @@ CPH_Generic::CPH_Generic()
CPH_Generic::~CPH_Generic()
{
}
CPadHandler::FactoryFunction CPH_Generic::GetFactoryFunction()

View file

@ -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

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

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

@ -9,7 +9,6 @@
CRegisterStateFile::CRegisterStateFile(const char* name)
: CZipFile(name)
{
}
CRegisterStateFile::CRegisterStateFile(Framework::CStream& stream)
@ -20,7 +19,6 @@ CRegisterStateFile::CRegisterStateFile(Framework::CStream& stream)
CRegisterStateFile::~CRegisterStateFile()
{
}
void CRegisterStateFile::Read(Framework::CStream& stream)
@ -52,7 +50,6 @@ void CRegisterStateFile::Read(Framework::CStream& stream)
}
catch(...)
{
}
}
}

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

@ -10,18 +10,15 @@ public:
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

@ -12,7 +12,6 @@
CStructCollectionStateFile::CStructCollectionStateFile(const char* name)
: CZipFile(name)
{
}
CStructCollectionStateFile::CStructCollectionStateFile(Framework::CStream& 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

@ -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

@ -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

@ -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

@ -26,7 +26,6 @@ CChannel::CChannel(CDMAC& dmac, unsigned int nNumber, const DmaReceiveHandler& p
, m_number(nNumber)
, m_receive(pReceive)
{
}
void CChannel::Reset()

View file

@ -46,7 +46,6 @@ namespace Dmac
unsigned int nTAG : 16;
};
CChannel(CDMAC&, unsigned int, const DmaReceiveHandler&);
virtual ~CChannel() = default;

View file

@ -3,7 +3,6 @@
CEEAssembler::CEEAssembler(uint32* ptr)
: CMIPSAssembler(ptr)
{
}
void CEEAssembler::LQ(unsigned int rt, uint16 offset, unsigned int base)

View file

@ -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;
}

View file

@ -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,28 +38,34 @@ 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);
// anything + NaN = qNaN
if(bAbs > infRep) return (b | quietBit);
if (aAbs == infRep) {
if(aAbs == infRep)
{
// +/-infinity + -/+infinity = qNaN
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;
// 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
@ -66,7 +73,8 @@ uint32 FpAddTruncate(uint32 a, uint32 b)
}
// 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,16 +105,21 @@ 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.
@ -114,19 +127,22 @@ uint32 FpAddTruncate(uint32 a, uint32 b)
// 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;
@ -136,7 +152,8 @@ uint32 FpAddTruncate(uint32 a, uint32 b)
// If we have overflowed the type, return +/- infinity:
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

@ -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) {
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) {
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,7 +93,8 @@ 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;
@ -88,18 +104,22 @@ uint32 FpMulTruncate(uint32 a, uint32 b)
// anything * NaN = qNaN
if(bAbs > infRep) return (b | quietBit);
if (aAbs == infRep) {
if(aAbs == infRep)
{
// infinity * non-zero = +/- infinity
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);
// zero * infinity = NaN
else return qnanRep;
else
return qnanRep;
}
// zero * anything = +/- zero
@ -144,7 +164,8 @@ uint32 FpMulTruncate(uint32 a, uint32 b)
// If we have overflowed the type, return +/- infinity.
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

@ -33,7 +33,6 @@ CGIF::CGIF(CGSHandler*& gs, uint8* ram, uint8* spr)
, 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

@ -12,12 +12,10 @@ CINTC::CINTC(CDMAC& dmac, CGSHandler*& gs)
, m_dmac(dmac)
, m_gs(gs)
{
}
CINTC::~CINTC()
{
}
void CINTC::Reset()

View file

@ -48,12 +48,10 @@ CIPU::CIPU(CINTC& intc)
, 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:
@ -685,7 +680,6 @@ CIPU::COUTFIFO::COUTFIFO()
, m_alloc(0)
, m_size(0)
{
}
CIPU::COUTFIFO::~COUTFIFO()
@ -746,12 +740,10 @@ CIPU::CINFIFO::CINFIFO()
: m_size(0)
, m_bitPosition(0)
{
}
CIPU::CINFIFO::~CINFIFO()
{
}
void CIPU::CINFIFO::Write(void* data, unsigned int size)
@ -883,7 +875,6 @@ CIPU::CBCLRCommand::CBCLRCommand()
: 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)
@ -1316,7 +1311,6 @@ CIPU::CBDECCommand_ReadDct::CBDECCommand_ReadDct()
, 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)
@ -1458,7 +1452,6 @@ CIPU::CBDECCommand_ReadDcDiff::CBDECCommand_ReadDcDiff()
, m_channelId(0)
, m_dcSize(0)
{
}
void CIPU::CBDECCommand_ReadDcDiff::Initialize(CINFIFO* fifo, unsigned int channelId, int16* result)
@ -1544,7 +1537,6 @@ CIPU::CVDECCommand::CVDECCommand()
, 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";
}
@ -1657,7 +1648,6 @@ CIPU::CFDECCommand::CFDECCommand()
, m_commandCode(0)
, m_result(NULL)
{
}
void CIPU::CFDECCommand::Initialize(CINFIFO* fifo, uint32 commandCode, uint32* result)
@ -1705,7 +1695,6 @@ CIPU::CSETIQCommand::CSETIQCommand()
, m_matrix(NULL)
, m_currentIndex(0)
{
}
void CIPU::CSETIQCommand::Initialize(CINFIFO* fifo, uint8* matrix)
@ -1734,7 +1723,6 @@ CIPU::CSETVQCommand::CSETVQCommand()
, 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);
@ -1919,7 +1928,6 @@ CIPU::CSETTHCommand::CSETTHCommand()
, m_TH0(NULL)
, m_TH1(NULL)
{
}
void CIPU::CSETTHCommand::Initialize(uint32 commandCode, uint16* TH0, uint16* TH1)

View file

@ -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

@ -19,10 +19,9 @@ unsigned int CDmVectorTable::m_pIndexTable[MAXBITS] =
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

@ -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

@ -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

@ -18,10 +18,9 @@ unsigned int CMacroblockTypeITable::m_pIndexTable[MAXBITS] =
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

@ -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

@ -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);
@ -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++)
{
@ -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

@ -10,7 +10,6 @@ CMA_VU::CLower::CLower(uint32 vuMemAddressMask)
: CMIPSInstructionFactory(MIPS_REGSIZE_32)
, m_vuMemAddressMask(vuMemAddressMask)
{
}
void CMA_VU::CLower::CompileInstruction(uint32 address, CMipsJitter* codeGen, CMIPS* context)
@ -121,8 +120,7 @@ void CMA_VU::CLower::GenerateEATAN()
9,
11,
13,
15
};
15};
ApplySumSeries(offsetof(CMIPS, m_State.nCOP2T),
seriesConstants, seriesExponents, seriesLength);
@ -718,16 +716,14 @@ void CMA_VU::CLower::ESIN()
0xBE2AAAA4,
0x3C08873E,
0xB94FB21F,
0x362E9C14
};
0x362E9C14};
static const unsigned int seriesExponents[seriesLength] =
{
1,
3,
5,
7,
9
};
9};
ApplySumSeries(offsetof(CMIPS, m_State.nCOP2[m_nIS].nV[m_nFSF]),
seriesConstants, seriesExponents, seriesLength);
@ -902,8 +898,7 @@ void CMA_VU::CLower::EEXP()
0x3B29D3FF,
0x3933E553,
0x36B63510,
0x353961AC
};
0x353961AC};
static const unsigned int seriesExponents[seriesLength] =
{
1,
@ -911,8 +906,7 @@ void CMA_VU::CLower::EEXP()
3,
4,
5,
6
};
6};
ApplySumSeries(offsetof(CMIPS, m_State.nCOP2[m_nIS].nV[m_nFSF]),
seriesConstants, seriesExponents, seriesLength);

View file

@ -14,7 +14,6 @@ CMA_VU::CUpper::CUpper()
, m_nDest(0)
, m_relativePipeTime(0)
{
}
void CMA_VU::CUpper::CompileInstruction(uint32 nAddress, CMipsJitter* codeGen, CMIPS* pCtx)
@ -461,7 +460,6 @@ void CMA_VU::CUpper::MSUBAi()
//0B
void CMA_VU::CUpper::NOP()
{
}
//////////////////////////////////////////////////

View file

@ -197,8 +197,7 @@ const CPS2OS::SYSCALL_NAME CPS2OS::g_syscallNames[] =
{0x0078, SYSCALL_NAME_SIFSETDCHAIN},
{0x007C, SYSCALL_NAME_DECI2CALL},
{0x007E, SYSCALL_NAME_MACHINETYPE},
{ 0x0000, NULL }
};
{0x0000, NULL}};
#endif
@ -225,7 +224,6 @@ CPS2OS::CPS2OS(CMIPS& ee, uint8* ram, uint8* bios, uint8* spr, CGSHandler*& gs,
, m_intcHandlerQueue(m_intcHandlers, reinterpret_cast<uint32*>(m_ram + BIOS_ADDRESS_INTCHANDLERQUEUE_BASE))
, m_dmacHandlerQueue(m_dmacHandlers, reinterpret_cast<uint32*>(m_ram + BIOS_ADDRESS_DMACHANDLERQUEUE_BASE))
{
}
CPS2OS::~CPS2OS()
@ -273,7 +271,7 @@ void CPS2OS::DumpIntcHandlers()
auto handler = m_intcHandlers[i + 1];
if(handler == nullptr) continue;
printf("ID: %02i, Line: %i, Address: 0x%08X.\r\n", \
printf("ID: %02i, Line: %i, Address: 0x%08X.\r\n",
i + 1,
handler->cause,
handler->address);
@ -290,7 +288,7 @@ void CPS2OS::DumpDmacHandlers()
auto handler = m_dmacHandlers[i + 1];
if(handler == nullptr) continue;
printf("ID: %02i, Channel: %i, Address: 0x%08X.\r\n", \
printf("ID: %02i, Channel: %i, Address: 0x%08X.\r\n",
i + 1,
handler->channel,
handler->address);
@ -420,8 +418,7 @@ void CPS2OS::LoadELF(Framework::CStream& stream, const char* executablePath, con
m_currentArguments = arguments;
m_executableName =
[&] ()
{
[&]() {
auto executableName = reinterpret_cast<const char*>(strchr(executablePath, ':'));
if(!executableName) return executablePath;
executableName++;
@ -477,8 +474,7 @@ void CPS2OS::LoadExecutableInternal()
uint32 jr = *reinterpret_cast<uint32*>(m_ram + address + 4);
if(
(jr == 0x03E00008) &&
(addiu & 0xFFFF0000) == 0x24030000
)
(addiu & 0xFFFF0000) == 0x24030000)
{
//We have it!
int16 syscallId = static_cast<int16>(addiu);
@ -698,8 +694,7 @@ void CPS2OS::AssembleInterruptHandler()
assembler.NOP();
static const auto generateIntHandler =
[](CMIPSAssembler& assembler, uint32 line)
{
[](CMIPSAssembler& assembler, uint32 line) {
auto skipIntHandlerLabel = assembler.CreateLabel();
//Check cause
@ -1116,10 +1111,14 @@ void CPS2OS::ThreadSwitchContext(uint32 id)
auto& hi = context->gpr[CMIPS::K0];
auto& lo = context->gpr[CMIPS::K1];
sa = m_ee.m_State.nSA >> 3; //Act as if MFSA was used
hi.nV[0] = m_ee.m_State.nHI[0]; hi.nV[1] = m_ee.m_State.nHI[1];
hi.nV[2] = m_ee.m_State.nHI1[0]; hi.nV[3] = m_ee.m_State.nHI1[1];
lo.nV[0] = m_ee.m_State.nLO[0]; lo.nV[1] = m_ee.m_State.nLO[1];
lo.nV[2] = m_ee.m_State.nLO1[0]; lo.nV[3] = m_ee.m_State.nLO1[1];
hi.nV[0] = m_ee.m_State.nHI[0];
hi.nV[1] = m_ee.m_State.nHI[1];
hi.nV[2] = m_ee.m_State.nHI1[0];
hi.nV[3] = m_ee.m_State.nHI1[1];
lo.nV[0] = m_ee.m_State.nLO[0];
lo.nV[1] = m_ee.m_State.nLO[1];
lo.nV[2] = m_ee.m_State.nLO1[0];
lo.nV[3] = m_ee.m_State.nLO1[1];
context->cop1a = m_ee.m_State.nCOP1A;
context->fcsr = m_ee.m_State.nFCSR;
}
@ -1154,10 +1153,14 @@ void CPS2OS::ThreadSwitchContext(uint32 id)
auto& hi = context->gpr[CMIPS::K0];
auto& lo = context->gpr[CMIPS::K1];
m_ee.m_State.nSA = (sa & 0x0F) << 3; //Act as if MTSA was used
m_ee.m_State.nHI[0] = hi.nV[0]; m_ee.m_State.nHI[1] = hi.nV[1];
m_ee.m_State.nHI1[0] = hi.nV[2]; m_ee.m_State.nHI1[1] = hi.nV[3];
m_ee.m_State.nLO[0] = lo.nV[0]; m_ee.m_State.nLO[1] = lo.nV[1];
m_ee.m_State.nLO1[0] = lo.nV[2]; m_ee.m_State.nLO1[1] = lo.nV[3];
m_ee.m_State.nHI[0] = hi.nV[0];
m_ee.m_State.nHI[1] = hi.nV[1];
m_ee.m_State.nHI1[0] = hi.nV[2];
m_ee.m_State.nHI1[1] = hi.nV[3];
m_ee.m_State.nLO[0] = lo.nV[0];
m_ee.m_State.nLO[1] = lo.nV[1];
m_ee.m_State.nLO1[0] = lo.nV[2];
m_ee.m_State.nLO1[1] = lo.nV[3];
m_ee.m_State.nCOP1A = context->cop1a;
m_ee.m_State.nFCSR = context->fcsr;
}
@ -1390,7 +1393,6 @@ void CPS2OS::sc_GsSetCrt()
}
}
//04
void CPS2OS::sc_Exit()
{
@ -2122,8 +2124,7 @@ void CPS2OS::sc_SuspendThread()
(thread->status == THREAD_ZOMBIE) ||
(thread->status == THREAD_SUSPENDED) ||
(thread->status == THREAD_SUSPENDED_WAITING) ||
(thread->status == THREAD_SUSPENDED_SLEEPING)
)
(thread->status == THREAD_SUSPENDED_SLEEPING))
{
m_ee.m_State.nGPR[SC_RETURN].nD0 = static_cast<int32>(-1);
return;
@ -2176,8 +2177,7 @@ void CPS2OS::sc_ResumeThread()
(thread->status == THREAD_ZOMBIE) ||
(thread->status == THREAD_RUNNING) ||
(thread->status == THREAD_WAITING) ||
(thread->status == THREAD_SLEEPING)
)
(thread->status == THREAD_SLEEPING))
{
m_ee.m_State.nGPR[SC_RETURN].nD0 = static_cast<int32>(-1);
return;
@ -2704,7 +2704,6 @@ void CPS2OS::sc_Deci2Call()
CLog::GetInstance().Print(LOG_NAME, "Unknown Deci2Call function (0x%08X) called. PC: 0x%08X.\r\n", function, m_ee.m_State.nPC);
break;
}
}
//7E
@ -2794,9 +2793,9 @@ std::string CPS2OS::GetSysCallDescription(uint8 function)
switch(function)
{
case 0x02:
sprintf(description, "GsSetCrt(interlace = %i, mode = %i, field = %i);", \
m_ee.m_State.nGPR[SC_PARAM0].nV[0], \
m_ee.m_State.nGPR[SC_PARAM1].nV[0], \
sprintf(description, "GsSetCrt(interlace = %i, mode = %i, field = %i);",
m_ee.m_State.nGPR[SC_PARAM0].nV[0],
m_ee.m_State.nGPR[SC_PARAM1].nV[0],
m_ee.m_State.nGPR[SC_PARAM2].nV[0]);
break;
case 0x04:
@ -2823,36 +2822,36 @@ std::string CPS2OS::GetSysCallDescription(uint8 function)
m_ee.m_State.nGPR[SC_PARAM3].nV[0]);
break;
case 0x11:
sprintf(description, SYSCALL_NAME_REMOVEINTCHANDLER "(cause = %i, id = %i);", \
m_ee.m_State.nGPR[SC_PARAM0].nV[0], \
sprintf(description, SYSCALL_NAME_REMOVEINTCHANDLER "(cause = %i, id = %i);",
m_ee.m_State.nGPR[SC_PARAM0].nV[0],
m_ee.m_State.nGPR[SC_PARAM1].nV[0]);
break;
case 0x12:
sprintf(description, SYSCALL_NAME_ADDDMACHANDLER "(channel = %i, address = 0x%08X, next = %i, arg = %i);", \
m_ee.m_State.nGPR[SC_PARAM0].nV[0], \
m_ee.m_State.nGPR[SC_PARAM1].nV[0], \
m_ee.m_State.nGPR[SC_PARAM2].nV[0], \
sprintf(description, SYSCALL_NAME_ADDDMACHANDLER "(channel = %i, address = 0x%08X, next = %i, arg = %i);",
m_ee.m_State.nGPR[SC_PARAM0].nV[0],
m_ee.m_State.nGPR[SC_PARAM1].nV[0],
m_ee.m_State.nGPR[SC_PARAM2].nV[0],
m_ee.m_State.nGPR[SC_PARAM3].nV[0]);
break;
case 0x13:
sprintf(description, SYSCALL_NAME_REMOVEDMACHANDLER "(channel = %i, handler = %i);", \
m_ee.m_State.nGPR[SC_PARAM0].nV[0], \
sprintf(description, SYSCALL_NAME_REMOVEDMACHANDLER "(channel = %i, handler = %i);",
m_ee.m_State.nGPR[SC_PARAM0].nV[0],
m_ee.m_State.nGPR[SC_PARAM1].nV[0]);
break;
case 0x14:
sprintf(description, SYSCALL_NAME_ENABLEINTC "(cause = %i);", \
sprintf(description, SYSCALL_NAME_ENABLEINTC "(cause = %i);",
m_ee.m_State.nGPR[SC_PARAM0].nV[0]);
break;
case 0x15:
sprintf(description, SYSCALL_NAME_DISABLEINTC "(cause = %i);", \
sprintf(description, SYSCALL_NAME_DISABLEINTC "(cause = %i);",
m_ee.m_State.nGPR[SC_PARAM0].nV[0]);
break;
case 0x16:
sprintf(description, SYSCALL_NAME_ENABLEDMAC "(channel = %i);", \
sprintf(description, SYSCALL_NAME_ENABLEDMAC "(channel = %i);",
m_ee.m_State.nGPR[SC_PARAM0].nV[0]);
break;
case 0x17:
sprintf(description, SYSCALL_NAME_DISABLEDMAC "(channel = %i);", \
sprintf(description, SYSCALL_NAME_DISABLEDMAC "(channel = %i);",
m_ee.m_State.nGPR[SC_PARAM0].nV[0]);
break;
case 0x18:
@ -2882,16 +2881,16 @@ std::string CPS2OS::GetSysCallDescription(uint8 function)
m_ee.m_State.nGPR[SC_PARAM0].nV[0]);
break;
case 0x20:
sprintf(description, SYSCALL_NAME_CREATETHREAD "(thread = 0x%08X);", \
sprintf(description, SYSCALL_NAME_CREATETHREAD "(thread = 0x%08X);",
m_ee.m_State.nGPR[SC_PARAM0].nV[0]);
break;
case 0x21:
sprintf(description, SYSCALL_NAME_DELETETHREAD "(id = 0x%08X);", \
sprintf(description, SYSCALL_NAME_DELETETHREAD "(id = 0x%08X);",
m_ee.m_State.nGPR[SC_PARAM0].nV[0]);
break;
case 0x22:
sprintf(description, SYSCALL_NAME_STARTTHREAD "(id = 0x%08X, a0 = 0x%08X);", \
m_ee.m_State.nGPR[SC_PARAM0].nV[0], \
sprintf(description, SYSCALL_NAME_STARTTHREAD "(id = 0x%08X, a0 = 0x%08X);",
m_ee.m_State.nGPR[SC_PARAM0].nV[0],
m_ee.m_State.nGPR[SC_PARAM1].nV[0]);
break;
case 0x23:
@ -2901,21 +2900,21 @@ std::string CPS2OS::GetSysCallDescription(uint8 function)
sprintf(description, SYSCALL_NAME_EXITDELETETHREAD "();");
break;
case 0x25:
sprintf(description, SYSCALL_NAME_TERMINATETHREAD "(id = 0x%08X);", \
sprintf(description, SYSCALL_NAME_TERMINATETHREAD "(id = 0x%08X);",
m_ee.m_State.nGPR[SC_PARAM0].nV[0]);
break;
case 0x29:
sprintf(description, SYSCALL_NAME_CHANGETHREADPRIORITY "(id = 0x%08X, priority = %i);", \
m_ee.m_State.nGPR[SC_PARAM0].nV[0], \
sprintf(description, SYSCALL_NAME_CHANGETHREADPRIORITY "(id = 0x%08X, priority = %i);",
m_ee.m_State.nGPR[SC_PARAM0].nV[0],
m_ee.m_State.nGPR[SC_PARAM1].nV[0]);
break;
case 0x2A:
sprintf(description, SYSCALL_NAME_ICHANGETHREADPRIORITY "(id = 0x%08X, priority = %i);", \
m_ee.m_State.nGPR[SC_PARAM0].nV[0], \
sprintf(description, SYSCALL_NAME_ICHANGETHREADPRIORITY "(id = 0x%08X, priority = %i);",
m_ee.m_State.nGPR[SC_PARAM0].nV[0],
m_ee.m_State.nGPR[SC_PARAM1].nV[0]);
break;
case 0x2B:
sprintf(description, SYSCALL_NAME_ROTATETHREADREADYQUEUE "(prio = %i);", \
sprintf(description, SYSCALL_NAME_ROTATETHREADREADYQUEUE "(prio = %i);",
m_ee.m_State.nGPR[SC_PARAM0].nV[0]);
break;
case 0x2F:
@ -2935,11 +2934,11 @@ std::string CPS2OS::GetSysCallDescription(uint8 function)
sprintf(description, SYSCALL_NAME_SLEEPTHREAD "();");
break;
case 0x33:
sprintf(description, SYSCALL_NAME_WAKEUPTHREAD "(id = %i);", \
sprintf(description, SYSCALL_NAME_WAKEUPTHREAD "(id = %i);",
m_ee.m_State.nGPR[SC_PARAM0].nV[0]);
break;
case 0x34:
sprintf(description, SYSCALL_NAME_IWAKEUPTHREAD "(id = %i);", \
sprintf(description, SYSCALL_NAME_IWAKEUPTHREAD "(id = %i);",
m_ee.m_State.nGPR[SC_PARAM0].nV[0]);
break;
case 0x35:
@ -2951,7 +2950,7 @@ std::string CPS2OS::GetSysCallDescription(uint8 function)
m_ee.m_State.nGPR[SC_PARAM0].nV[0]);
break;
case 0x37:
sprintf(description, SYSCALL_NAME_SUSPENDTHREAD "(id = %i);", \
sprintf(description, SYSCALL_NAME_SUSPENDTHREAD "(id = %i);",
m_ee.m_State.nGPR[SC_PARAM0].nV[0]);
break;
case 0x38:
@ -2959,51 +2958,51 @@ std::string CPS2OS::GetSysCallDescription(uint8 function)
m_ee.m_State.nGPR[SC_PARAM0].nV[0]);
break;
case 0x39:
sprintf(description, SYSCALL_NAME_RESUMETHREAD "(id = %i);", \
sprintf(description, SYSCALL_NAME_RESUMETHREAD "(id = %i);",
m_ee.m_State.nGPR[SC_PARAM0].nV[0]);
break;
case 0x3C:
sprintf(description, "SetupThread(gp = 0x%08X, stack = 0x%08X, stack_size = 0x%08X, args = 0x%08X, root_func = 0x%08X);", \
m_ee.m_State.nGPR[SC_PARAM0].nV[0], \
m_ee.m_State.nGPR[SC_PARAM1].nV[0], \
m_ee.m_State.nGPR[SC_PARAM2].nV[0], \
m_ee.m_State.nGPR[SC_PARAM3].nV[0], \
sprintf(description, "SetupThread(gp = 0x%08X, stack = 0x%08X, stack_size = 0x%08X, args = 0x%08X, root_func = 0x%08X);",
m_ee.m_State.nGPR[SC_PARAM0].nV[0],
m_ee.m_State.nGPR[SC_PARAM1].nV[0],
m_ee.m_State.nGPR[SC_PARAM2].nV[0],
m_ee.m_State.nGPR[SC_PARAM3].nV[0],
m_ee.m_State.nGPR[SC_PARAM4].nV[0]);
break;
case 0x3D:
sprintf(description, "SetupHeap(heap_start = 0x%08X, heap_size = 0x%08X);", \
m_ee.m_State.nGPR[SC_PARAM0].nV[0], \
sprintf(description, "SetupHeap(heap_start = 0x%08X, heap_size = 0x%08X);",
m_ee.m_State.nGPR[SC_PARAM0].nV[0],
m_ee.m_State.nGPR[SC_PARAM1].nV[0]);
break;
case 0x3E:
sprintf(description, SYSCALL_NAME_ENDOFHEAP "();");
break;
case 0x40:
sprintf(description, SYSCALL_NAME_CREATESEMA "(sema = 0x%08X);", \
sprintf(description, SYSCALL_NAME_CREATESEMA "(sema = 0x%08X);",
m_ee.m_State.nGPR[SC_PARAM0].nV[0]);
break;
case 0x41:
sprintf(description, SYSCALL_NAME_DELETESEMA "(semaid = %i);", \
sprintf(description, SYSCALL_NAME_DELETESEMA "(semaid = %i);",
m_ee.m_State.nGPR[SC_PARAM0].nV[0]);
break;
case 0x42:
sprintf(description, SYSCALL_NAME_SIGNALSEMA "(semaid = %i);", \
sprintf(description, SYSCALL_NAME_SIGNALSEMA "(semaid = %i);",
m_ee.m_State.nGPR[SC_PARAM0].nV[0]);
break;
case 0x43:
sprintf(description, SYSCALL_NAME_ISIGNALSEMA "(semaid = %i);", \
sprintf(description, SYSCALL_NAME_ISIGNALSEMA "(semaid = %i);",
m_ee.m_State.nGPR[SC_PARAM0].nV[0]);
break;
case 0x44:
sprintf(description, SYSCALL_NAME_WAITSEMA "(semaid = %i);", \
sprintf(description, SYSCALL_NAME_WAITSEMA "(semaid = %i);",
m_ee.m_State.nGPR[SC_PARAM0].nV[0]);
break;
case 0x45:
sprintf(description, SYSCALL_NAME_POLLSEMA "(semaid = %i);", \
sprintf(description, SYSCALL_NAME_POLLSEMA "(semaid = %i);",
m_ee.m_State.nGPR[SC_PARAM0].nV[0]);
break;
case 0x46:
sprintf(description, SYSCALL_NAME_IPOLLSEMA "(semaid = %i);", \
sprintf(description, SYSCALL_NAME_IPOLLSEMA "(semaid = %i);",
m_ee.m_State.nGPR[SC_PARAM0].nV[0]);
break;
case 0x47:
@ -3026,37 +3025,37 @@ std::string CPS2OS::GetSysCallDescription(uint8 function)
sprintf(description, SYSCALL_NAME_GSGETIMR "();");
break;
case 0x71:
sprintf(description, SYSCALL_NAME_GSPUTIMR "(GS_IMR = 0x%08X);", \
sprintf(description, SYSCALL_NAME_GSPUTIMR "(GS_IMR = 0x%08X);",
m_ee.m_State.nGPR[SC_PARAM0].nV[0]);
break;
case 0x73:
sprintf(description, SYSCALL_NAME_SETVSYNCFLAG "(ptr1 = 0x%08X, ptr2 = 0x%08X);", \
m_ee.m_State.nGPR[SC_PARAM0].nV[0], \
sprintf(description, SYSCALL_NAME_SETVSYNCFLAG "(ptr1 = 0x%08X, ptr2 = 0x%08X);",
m_ee.m_State.nGPR[SC_PARAM0].nV[0],
m_ee.m_State.nGPR[SC_PARAM1].nV[0]);
break;
case 0x74:
sprintf(description, SYSCALL_NAME_SETSYSCALL "(num = 0x%02X, address = 0x%08X);", \
m_ee.m_State.nGPR[SC_PARAM0].nV[0], \
sprintf(description, SYSCALL_NAME_SETSYSCALL "(num = 0x%02X, address = 0x%08X);",
m_ee.m_State.nGPR[SC_PARAM0].nV[0],
m_ee.m_State.nGPR[SC_PARAM1].nV[0]);
break;
case 0x76:
sprintf(description, SYSCALL_NAME_SIFDMASTAT "();");
break;
case 0x77:
sprintf(description, SYSCALL_NAME_SIFSETDMA "(list = 0x%08X, count = %i);", \
m_ee.m_State.nGPR[SC_PARAM0].nV[0], \
sprintf(description, SYSCALL_NAME_SIFSETDMA "(list = 0x%08X, count = %i);",
m_ee.m_State.nGPR[SC_PARAM0].nV[0],
m_ee.m_State.nGPR[SC_PARAM1].nV[0]);
break;
case 0x78:
sprintf(description, SYSCALL_NAME_SIFSETDCHAIN "();");
break;
case 0x79:
sprintf(description, "SifSetReg(register = 0x%08X, value = 0x%08X);", \
m_ee.m_State.nGPR[SC_PARAM0].nV[0], \
sprintf(description, "SifSetReg(register = 0x%08X, value = 0x%08X);",
m_ee.m_State.nGPR[SC_PARAM0].nV[0],
m_ee.m_State.nGPR[SC_PARAM1].nV[0]);
break;
case 0x7A:
sprintf(description, "SifGetReg(register = 0x%08X);", \
sprintf(description, "SifGetReg(register = 0x%08X);",
m_ee.m_State.nGPR[SC_PARAM0].nV[0]);
break;
case 0x7C:

View file

@ -57,7 +57,6 @@ CSIF::CSIF(CDMAC& dmac, uint8* eeRam, uint8* iopRam)
, m_eeRam(eeRam)
, m_iopRam(iopRam)
{
}
void CSIF::Reset()

View file

@ -16,24 +16,21 @@ const VUShared::REGISTER_PIPEINFO VUShared::g_pipeInfoQ =
{
offsetof(CMIPS, m_State.nCOP2Q),
offsetof(CMIPS, m_State.pipeQ.heldValue),
offsetof(CMIPS, m_State.pipeQ.counter)
};
offsetof(CMIPS, m_State.pipeQ.counter)};
const VUShared::FLAG_PIPEINFO VUShared::g_pipeInfoMac =
{
offsetof(CMIPS, m_State.nCOP2MF),
offsetof(CMIPS, m_State.pipeMac.index),
offsetof(CMIPS, m_State.pipeMac.values),
offsetof(CMIPS, m_State.pipeMac.pipeTimes)
};
offsetof(CMIPS, m_State.pipeMac.pipeTimes)};
const VUShared::FLAG_PIPEINFO VUShared::g_pipeInfoClip =
{
offsetof(CMIPS, m_State.nCOP2CF),
offsetof(CMIPS, m_State.pipeClip.index),
offsetof(CMIPS, m_State.pipeClip.values),
offsetof(CMIPS, m_State.pipeClip.pipeTimes)
};
offsetof(CMIPS, m_State.pipeClip.pipeTimes)};
using namespace VUShared;
@ -1564,8 +1561,10 @@ void VUShared::QueueInFlagPipeline(const FLAG_PIPEINFO& pipeInfo, CMipsJitter* c
codeGen->StoreAtRef();
}
assert(codeGen->GetTopCursor() == offsetCursor); codeGen->PullTop();
assert(codeGen->GetTopCursor() == valueCursor); codeGen->PullTop();
assert(codeGen->GetTopCursor() == offsetCursor);
codeGen->PullTop();
assert(codeGen->GetTopCursor() == valueCursor);
codeGen->PullTop();
//Increment counter
codeGen->PushRel(pipeInfo.index);
@ -1589,5 +1588,6 @@ void VUShared::ResetFlagPipeline(const FLAG_PIPEINFO& pipeInfo, CMipsJitter* cod
codeGen->PullRel(pipeInfo.valueArray + (i * 4));
}
assert(codeGen->GetTopCursor() == valueCursor); codeGen->PullTop();
assert(codeGen->GetTopCursor() == valueCursor);
codeGen->PullTop();
}

View file

@ -44,7 +44,6 @@ CVif::CVif(unsigned int number, CVpu& vpu, CINTC& intc, uint8* ram, uint8* spr)
, m_vpu(vpu)
, m_vifProfilerZone(CProfiler::GetInstance().RegisterZone(string_format("VIF%d", number).c_str()))
{
}
void CVif::Reset()
@ -134,8 +133,7 @@ void CVif::SetRegister(uint32 address, uint32 value)
{
if(
(address >= VIF0_FIFO_START && address < VIF0_FIFO_END) ||
(address >= VIF1_FIFO_START && address < VIF1_FIFO_END)
)
(address >= VIF1_FIFO_START && address < VIF1_FIFO_END))
{
ProcessFifoWrite(address, value);
}
@ -977,7 +975,10 @@ bool CVif::ResumeDelayedMicroProgram()
void CVif::DisassembleGet(uint32 address)
{
#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(address)
{
@ -1023,7 +1024,10 @@ void CVif::DisassembleSet(uint32 address, uint32 value)
}
else
{
#define LOG_SET(registerId) case registerId: CLog::GetInstance().Print(LOG_NAME, #registerId " = 0x%08X.\r\n", value); break;
#define LOG_SET(registerId) \
case registerId: \
CLog::GetInstance().Print(LOG_NAME, #registerId " = 0x%08X.\r\n", value); \
break;
switch(address)
{
@ -1072,8 +1076,7 @@ void CVif::DisassembleCommand(CODE code)
"V4-32",
"V4-16",
"V4-8",
"V4-5"
};
"V4-5"};
CLog::GetInstance().Print(LOG_NAME, "UNPACK(format = %s, imm = 0x%x, num = 0x%x);\r\n",
packFormats[code.nCMD & 0x0F], code.nIMM, code.nNUM);
}
@ -1155,7 +1158,6 @@ CVif::CFifoStream::CFifoStream(uint8* ram, uint8* spr)
: m_ram(ram)
, m_spr(spr)
{
}
void CVif::CFifoStream::Reset()

View file

@ -18,12 +18,10 @@ CVif1::CVif1(unsigned int number, CVpu& vpu, CGIF& gif, CINTC& intc, uint8* ram,
: CVif(1, vpu, intc, ram, spr)
, m_gif(gif)
{
}
CVif1::~CVif1()
{
}
void CVif1::Reset()

View file

@ -27,7 +27,6 @@ CVpu::CVpu(unsigned int number, const VPUINIT& vpuInit, CGIF& gif, CINTC& intc,
, m_itopMiniState(0)
#endif
{
}
CVpu::~CVpu()

View file

@ -30,7 +30,6 @@ public:
, vuMem(vuMem)
, context(context)
{
}
uint8* microMem;

View file

@ -50,8 +50,7 @@ void CVuAnalysis::Analyse(CMIPS* ctx, uint32 begin, uint32 end)
//Check for JR or END bit
if(
(lowerInstruction & 0xFE000000) == (0x24 << 25) ||
(upperInstruction & 0x40000000)
)
(upperInstruction & 0x40000000))
{
subroutineAddresses.insert(potentialRoutineStart);
potentialRoutineStart = address + 8;
@ -76,8 +75,7 @@ void CVuAnalysis::Analyse(CMIPS* ctx, uint32 begin, uint32 end)
//Check for JR or END bit
if(
(lowerInstruction & 0xFE000000) == (0x24 << 25) ||
(upperInstruction & 0x40000000)
)
(upperInstruction & 0x40000000))
{
ctx->m_analysis->InsertSubroutine(subroutineAddress, address + 8, 0, 0, 0, 0);
routineCount++;

View file

@ -7,7 +7,6 @@
CVuBasicBlock::CVuBasicBlock(CMIPS& context, uint32 begin, uint32 end)
: CBasicBlock(context, begin, end)
{
}
void CVuBasicBlock::CompileRange(CMipsJitter* jitter)
@ -44,8 +43,7 @@ void CVuBasicBlock::CompileRange(CMipsJitter* jitter)
bool hasPendingXgKick = false;
const auto clearPendingXgKick =
[&]()
{
[&]() {
assert(hasPendingXgKick);
EmitXgKick(jitter);
hasPendingXgKick = false;
@ -89,8 +87,7 @@ void CVuBasicBlock::CompileRange(CMipsJitter* jitter)
assert(hiOps.writeF != loOps.writeF);
if(
(hiOps.writeF == loOps.readF0) ||
(hiOps.writeF == loOps.readF1)
)
(hiOps.writeF == loOps.readF1))
{
savedReg = hiOps.writeF;
jitter->MD_PushRel(offsetof(CMIPS, m_State.nCOP2[savedReg]));
@ -229,8 +226,7 @@ CVuBasicBlock::INTEGER_BRANCH_DELAY_INFO CVuBasicBlock::GetIntegerBranchDelayInf
auto branchLoOps = arch->GetAffectedOperands(&m_context, branchOpcodeAddr, branchOpcodeLo);
if(
(branchLoOps.readI0 == priorLoOps.writeI) ||
(branchLoOps.readI1 == priorLoOps.writeI)
)
(branchLoOps.readI1 == priorLoOps.writeI))
{
//Check if our block is a "special" loop. Disable delayed integer processing if it's the case
//TODO: Handle that case better

View file

@ -5,7 +5,6 @@
CVuExecutor::CVuExecutor(CMIPS& context, uint32 maxAddress)
: CMipsExecutor(context, maxAddress)
{
}
void CVuExecutor::Reset()

View file

@ -2,47 +2,38 @@
CGSH_Null::CGSH_Null()
{
}
CGSH_Null::~CGSH_Null()
{
}
void CGSH_Null::InitializeImpl()
{
}
void CGSH_Null::ReleaseImpl()
{
}
void CGSH_Null::ProcessHostToLocalTransfer()
{
}
void CGSH_Null::ProcessLocalToHostTransfer()
{
}
void CGSH_Null::ProcessLocalToLocalTransfer()
{
}
void CGSH_Null::ProcessClutTransfer(uint32, uint32)
{
}
void CGSH_Null::ReadFramebuffer(uint32, uint32, void*)
{
}
CGSHandler::FactoryFunction CGSH_Null::GetFactoryFunction()

View file

@ -15,16 +15,14 @@ const GLenum CGSH_OpenGL::g_nativeClampModes[CGSHandler::CLAMP_MODE_MAX] =
GL_REPEAT,
GL_CLAMP_TO_EDGE,
GL_REPEAT,
GL_REPEAT
};
GL_REPEAT};
const unsigned int CGSH_OpenGL::g_shaderClampModes[CGSHandler::CLAMP_MODE_MAX] =
{
TEXTURE_CLAMP_MODE_STD,
TEXTURE_CLAMP_MODE_STD,
TEXTURE_CLAMP_MODE_REGION_CLAMP,
TEXTURE_CLAMP_MODE_REGION_REPEAT
};
TEXTURE_CLAMP_MODE_REGION_REPEAT};
const unsigned int CGSH_OpenGL::g_alphaTestInverse[CGSHandler::ALPHA_TEST_MAX] =
{
@ -35,8 +33,7 @@ const unsigned int CGSH_OpenGL::g_alphaTestInverse[CGSHandler::ALPHA_TEST_MAX] =
ALPHA_TEST_NOTEQUAL,
ALPHA_TEST_LESS,
ALPHA_TEST_LEQUAL,
ALPHA_TEST_EQUAL
};
ALPHA_TEST_EQUAL};
static uint32 MakeColor(uint8 r, uint8 g, uint8 b, uint8 a)
{
@ -145,8 +142,7 @@ void CGSH_OpenGL::FlipImpl()
if(
(candidateFramebuffer->m_basePtr == fb.GetBufPtr()) &&
(GetFramebufferBitDepth(candidateFramebuffer->m_psm) == GetFramebufferBitDepth(fb.nPSM)) &&
(candidateFramebuffer->m_width == fb.GetBufWidth())
)
(candidateFramebuffer->m_width == fb.GetBufWidth()))
{
//We have a winner
framebuffer = candidateFramebuffer;
@ -203,8 +199,7 @@ void CGSH_OpenGL::FlipImpl()
int selectedViewport = 0;
if(
(viewportWidth[0] > static_cast<int>(m_presentationParams.windowWidth)) ||
(viewportHeight[0] > static_cast<int>(m_presentationParams.windowHeight))
)
(viewportHeight[0] > static_cast<int>(m_presentationParams.windowHeight)))
{
selectedViewport = 1;
assert(
@ -282,11 +277,9 @@ void CGSH_OpenGL::LoadState(Framework::CZipArchiveReader& archive)
{
CGSHandler::LoadState(archive);
m_mailBox.SendCall(
[this] ()
{
[this]() {
m_textureCache.InvalidateRange(0, RAMSIZE);
}
);
});
}
void CGSH_OpenGL::RegisterPreferences()
@ -1176,7 +1169,6 @@ CGSH_OpenGL::TECHNIQUE CGSH_OpenGL::GetTechniqueFromTest(const uint64& testReg)
{
if((test.nAlphaMethod == ALPHA_TEST_NEVER) && (test.nAlphaFail != ALPHA_TEST_FAIL_KEEP))
{
}
else
{
@ -1328,13 +1320,11 @@ void CGSH_OpenGL::SetupTexture(uint64 primReg, uint64 tex0Reg, uint64 tex1Reg, u
CGSH_OpenGL::FramebufferPtr CGSH_OpenGL::FindFramebuffer(const FRAME& frame) const
{
auto framebufferIterator = std::find_if(std::begin(m_framebuffers), std::end(m_framebuffers),
[&] (const FramebufferPtr& framebuffer)
{
[&](const FramebufferPtr& framebuffer) {
return (framebuffer->m_basePtr == frame.GetBasePtr()) &&
(framebuffer->m_psm == frame.nPsm) &&
(framebuffer->m_width == frame.GetWidth());
}
);
});
return (framebufferIterator != std::end(m_framebuffers)) ? *(framebufferIterator) : FramebufferPtr();
}
@ -1342,11 +1332,9 @@ CGSH_OpenGL::FramebufferPtr CGSH_OpenGL::FindFramebuffer(const FRAME& frame) con
CGSH_OpenGL::DepthbufferPtr CGSH_OpenGL::FindDepthbuffer(const ZBUF& zbuf, const FRAME& frame) const
{
auto depthbufferIterator = std::find_if(std::begin(m_depthbuffers), std::end(m_depthbuffers),
[&] (const DepthbufferPtr& depthbuffer)
{
[&](const DepthbufferPtr& depthbuffer) {
return (depthbuffer->m_basePtr == zbuf.GetBasePtr()) && (depthbuffer->m_width == frame.GetWidth());
}
);
});
return (depthbufferIterator != std::end(m_depthbuffers)) ? *(depthbufferIterator) : DepthbufferPtr();
}
@ -1360,7 +1348,9 @@ void CGSH_OpenGL::Prim_Point()
auto xyz = make_convertible<XYZ>(m_VtxBuffer[0].nPosition);
auto rgbaq = make_convertible<RGBAQ>(m_VtxBuffer[0].nRGBAQ);
float x = xyz.GetX(); float y = xyz.GetY(); float z = xyz.GetZ();
float x = xyz.GetX();
float y = xyz.GetY();
float z = xyz.GetZ();
x -= m_nPrimOfsX;
y -= m_nPrimOfsY;
@ -1388,8 +1378,12 @@ void CGSH_OpenGL::Prim_Line()
xyz[0] <<= m_VtxBuffer[1].nPosition;
xyz[1] <<= m_VtxBuffer[0].nPosition;
float nX1 = xyz[0].GetX(); float nY1 = xyz[0].GetY(); float nZ1 = xyz[0].GetZ();
float nX2 = xyz[1].GetX(); float nY2 = xyz[1].GetY(); float nZ2 = xyz[1].GetZ();
float nX1 = xyz[0].GetX();
float nY1 = xyz[0].GetY();
float nZ1 = xyz[0].GetZ();
float nX2 = xyz[1].GetX();
float nY2 = xyz[1].GetY();
float nZ2 = xyz[1].GetZ();
nX1 -= m_nPrimOfsX;
nX2 -= m_nPrimOfsX;
@ -1497,8 +1491,12 @@ void CGSH_OpenGL::Prim_Triangle()
st[1] <<= m_VtxBuffer[1].nST;
st[2] <<= m_VtxBuffer[0].nST;
nS[0] = st[0].nS; nS[1] = st[1].nS; nS[2] = st[2].nS;
nT[0] = st[0].nT; nT[1] = st[1].nT; nT[2] = st[2].nT;
nS[0] = st[0].nS;
nS[1] = st[1].nS;
nS[2] = st[2].nS;
nT[0] = st[0].nT;
nT[1] = st[1].nT;
nT[2] = st[2].nT;
bool isQ0Neg = (rgbaq[0].nQ < 0);
bool isQ1Neg = (rgbaq[1].nQ < 0);
@ -1507,7 +1505,9 @@ void CGSH_OpenGL::Prim_Triangle()
assert(isQ0Neg == isQ1Neg);
assert(isQ1Neg == isQ2Neg);
nQ[0] = rgbaq[0].nQ; nQ[1] = rgbaq[1].nQ; nQ[2] = rgbaq[2].nQ;
nQ[0] = rgbaq[0].nQ;
nQ[1] = rgbaq[1].nQ;
nQ[2] = rgbaq[2].nQ;
}
}
@ -1554,8 +1554,11 @@ void CGSH_OpenGL::Prim_Sprite()
xyz[0] <<= m_VtxBuffer[1].nPosition;
xyz[1] <<= m_VtxBuffer[0].nPosition;
float nX1 = xyz[0].GetX(); float nY1 = xyz[0].GetY();
float nX2 = xyz[1].GetX(); float nY2 = xyz[1].GetY(); float nZ = xyz[1].GetZ();
float nX1 = xyz[0].GetX();
float nY1 = xyz[0].GetY();
float nX2 = xyz[1].GetX();
float nY2 = xyz[1].GetY();
float nZ = xyz[1].GetZ();
RGBAQ rgbaq[2];
rgbaq[0] <<= m_VtxBuffer[1].nRGBAQ;
@ -2072,11 +2075,9 @@ void CGSH_OpenGL::ProcessLocalToHostTransfer()
if((trxPos.nSSAX != 0) || (trxPos.nSSAY != 0)) return;
auto framebufferIterator = std::find_if(m_framebuffers.begin(), m_framebuffers.end(),
[] (const FramebufferPtr& framebuffer)
{
[](const FramebufferPtr& framebuffer) {
return (framebuffer->m_psm == PSMCT32) && (framebuffer->m_basePtr == 0);
}
);
});
if(framebufferIterator == std::end(m_framebuffers)) return;
const auto& framebuffer = (*framebufferIterator);
@ -2109,19 +2110,15 @@ void CGSH_OpenGL::ProcessLocalToLocalTransfer()
{
auto bltBuf = make_convertible<BITBLTBUF>(m_nReg[GS_REG_BITBLTBUF]);
auto srcFramebufferIterator = std::find_if(m_framebuffers.begin(), m_framebuffers.end(),
[&] (const FramebufferPtr& framebuffer)
{
[&](const FramebufferPtr& framebuffer) {
return (framebuffer->m_basePtr == bltBuf.GetSrcPtr()) &&
(framebuffer->m_width == bltBuf.GetSrcWidth());
}
);
});
auto dstFramebufferIterator = std::find_if(m_framebuffers.begin(), m_framebuffers.end(),
[&] (const FramebufferPtr& framebuffer)
{
[&](const FramebufferPtr& framebuffer) {
return (framebuffer->m_basePtr == bltBuf.GetDstPtr()) &&
(framebuffer->m_width == bltBuf.GetDstWidth());
}
);
});
if(
srcFramebufferIterator != std::end(m_framebuffers) &&
dstFramebufferIterator != std::end(m_framebuffers))

View file

@ -66,7 +66,10 @@ private:
unsigned int alphaTestMethod : 3;
unsigned int padding : 15;
bool isIndexedTextureSource() const { return texSourceMode == TEXTURE_SOURCE_MODE_IDX4 || texSourceMode == TEXTURE_SOURCE_MODE_IDX8; }
bool isIndexedTextureSource() const
{
return texSourceMode == TEXTURE_SOURCE_MODE_IDX4 || texSourceMode == TEXTURE_SOURCE_MODE_IDX8;
}
};
static_assert(sizeof(SHADERCAPS) == sizeof(uint32), "SHADERCAPS structure size must be 4 bytes.");
@ -344,10 +347,13 @@ private:
void TexUpdater_Invalid(uint32, uint32, unsigned int, unsigned int, unsigned int, unsigned int);
void TexUpdater_Psm32(uint32, uint32, unsigned int, unsigned int, unsigned int, unsigned int);
template <typename> void TexUpdater_Psm16(uint32, uint32, unsigned int, unsigned int, unsigned int, unsigned int);
template <typename>
void TexUpdater_Psm16(uint32, uint32, unsigned int, unsigned int, unsigned int, unsigned int);
template <typename> void TexUpdater_Psm48(uint32, uint32, unsigned int, unsigned int, unsigned int, unsigned int);
template <uint32, uint32> void TexUpdater_Psm48H(uint32, uint32, unsigned int, unsigned int, unsigned int, unsigned int);
template <typename>
void TexUpdater_Psm48(uint32, uint32, unsigned int, unsigned int, unsigned int, unsigned int);
template <uint32, uint32>
void TexUpdater_Psm48H(uint32, uint32, unsigned int, unsigned int, unsigned int, unsigned int);
//Context variables (put this in a struct or something?)
float m_nPrimOfsX;

View file

@ -327,16 +327,16 @@ std::string CGSH_OpenGL::GenerateTexCoordClampingSection(TEXTURE_CLAMP_MODE clam
switch(clampMode)
{
case TEXTURE_CLAMP_MODE_REGION_CLAMP:
shaderBuilder << " texCoord." << coordinate << " = min(g_clampMax." << coordinate << ", " <<
"max(g_clampMin." << coordinate << ", texCoord." << coordinate << "));" << std::endl;
shaderBuilder << " texCoord." << coordinate << " = min(g_clampMax." << coordinate << ", "
<< "max(g_clampMin." << coordinate << ", texCoord." << coordinate << "));" << std::endl;
break;
case TEXTURE_CLAMP_MODE_REGION_REPEAT:
shaderBuilder << " texCoord." << coordinate << " = or(int(and(int(texCoord." << coordinate << "), " <<
"int(g_clampMin." << coordinate << "))), int(g_clampMax." << coordinate << "));";
shaderBuilder << " texCoord." << coordinate << " = or(int(and(int(texCoord." << coordinate << "), "
<< "int(g_clampMin." << coordinate << "))), int(g_clampMax." << coordinate << "));";
break;
case TEXTURE_CLAMP_MODE_REGION_REPEAT_SIMPLE:
shaderBuilder << " texCoord." << coordinate << " = mod(texCoord." << coordinate << ", " <<
"g_clampMin." << coordinate << ") + g_clampMax." << coordinate << ";" << std::endl;
shaderBuilder << " texCoord." << coordinate << " = mod(texCoord." << coordinate << ", "
<< "g_clampMin." << coordinate << ") + g_clampMax." << coordinate << ";" << std::endl;
break;
}

View file

@ -342,7 +342,6 @@ CGSH_OpenGL::CPalette::CPalette()
, m_texture(0)
, m_live(false)
{
}
CGSH_OpenGL::CPalette::~CPalette()

View file

@ -151,12 +151,10 @@ void CGSHandler::ResetBase()
void CGSHandler::ResetImpl()
{
}
void CGSHandler::NotifyPreferencesChangedImpl()
{
}
void CGSHandler::SetPresentationParams(const PRESENTATION_PARAMS& presentationParams)
@ -477,11 +475,9 @@ void CGSHandler::WriteRegisterMassively(RegisterWriteList registerWrites, const
#endif
m_mailBox.SendCall(
[this, massiveWrite = std::move(massiveWrite)] ()
{
[this, massiveWrite = std::move(massiveWrite)]() {
WriteRegisterMassivelyImpl(massiveWrite);
}
);
});
}
void CGSHandler::WriteRegisterImpl(uint8 nRegister, uint64 nData)
@ -1256,8 +1252,7 @@ bool CGSHandler::IsCompatibleFramebufferPSM(unsigned int psmFb, unsigned int psm
void CGSHandler::MakeLinearCLUT(const TEX0& tex0, std::array<uint32, 256>& clut) const
{
static const auto RGBA16ToRGBA32 =
[] (uint16 color)
{
[](uint16 color) {
return ((color & 0x8000) ? 0xFF000000 : 0) | ((color & 0x7C00) << 9) | ((color & 0x03E0) << 6) | ((color & 0x001F) << 3);
};

View file

@ -220,8 +220,14 @@ public:
uint16 nV;
uint32 nReserved;
float GetU() const { return static_cast<float>(nU & 0x3FFF) / 16.0f; }
float GetV() const { return static_cast<float>(nV & 0x3FFF) / 16.0f; }
float GetU() const
{
return static_cast<float>(nU & 0x3FFF) / 16.0f;
}
float GetV() const
{
return static_cast<float>(nV & 0x3FFF) / 16.0f;
}
};
static_assert(sizeof(UV) == sizeof(uint64), "Size of UV struct must be 8 bytes.");
@ -233,8 +239,14 @@ public:
unsigned int nZ : 24;
unsigned int nF : 8;
float GetX() { return static_cast<float>(nX) / 16.0f; }
float GetY() { return static_cast<float>(nY) / 16.0f; }
float GetX()
{
return static_cast<float>(nX) / 16.0f;
}
float GetY()
{
return static_cast<float>(nY) / 16.0f;
}
};
static_assert(sizeof(XYZF) == sizeof(uint64), "Size of XYZF struct must be 8 bytes.");
@ -245,9 +257,18 @@ public:
unsigned int nY : 16;
uint32 nZ;
float GetX() { return static_cast<float>(nX) / 16.0f; }
float GetY() { return static_cast<float>(nY) / 16.0f; }
float GetZ() { return static_cast<float>(nZ); }
float GetX()
{
return static_cast<float>(nX) / 16.0f;
}
float GetY()
{
return static_cast<float>(nY) / 16.0f;
}
float GetZ()
{
return static_cast<float>(nZ);
}
};
static_assert(sizeof(XYZ) == sizeof(uint64), "Size of XYZ struct must be 8 bytes.");
@ -267,11 +288,26 @@ public:
unsigned int nCSM : 1;
unsigned int nCSA : 5;
unsigned int nCLD : 3;
uint32 GetBufPtr() const { return nBufPtr * 256; }
uint32 GetBufWidth() const { return nBufWidth * 64; }
uint32 GetWidth() const { return (1 << nWidth); }
uint32 GetHeight() const { return (1 << (nPad0 | (nPad1 << 2))); }
uint32 GetCLUTPtr() const { return nCBP * 256; }
uint32 GetBufPtr() const
{
return nBufPtr * 256;
}
uint32 GetBufWidth() const
{
return nBufWidth * 64;
}
uint32 GetWidth() const
{
return (1 << nWidth);
}
uint32 GetHeight() const
{
return (1 << (nPad0 | (nPad1 << 2)));
}
uint32 GetCLUTPtr() const
{
return nCBP * 256;
}
};
static_assert(sizeof(TEX0) == sizeof(uint64), "Size of TEX0 struct must be 8 bytes.");
@ -286,10 +322,22 @@ public:
unsigned int nReserved1 : 2;
unsigned int nMAXV : 10;
unsigned int nReserved2 : 20;
unsigned int GetMinU() { return nMINU; }
unsigned int GetMaxU() { return nMAXU; }
unsigned int GetMinV() { return (nReserved0) | (nReserved1 << 8); }
unsigned int GetMaxV() { return nMAXV; }
unsigned int GetMinU()
{
return nMINU;
}
unsigned int GetMaxU()
{
return nMAXU;
}
unsigned int GetMinV()
{
return (nReserved0) | (nReserved1 << 8);
}
unsigned int GetMaxV()
{
return nMAXV;
}
};
static_assert(sizeof(CLAMP) == sizeof(uint64), "Size of CLAMP struct must be 8 bytes.");
@ -328,7 +376,10 @@ public:
unsigned int nCSM : 1;
unsigned int nCSA : 5;
unsigned int nCLD : 3;
uint32 GetCLUTPtr() { return nCBP * 256; }
uint32 GetCLUTPtr()
{
return nCBP * 256;
}
};
static_assert(sizeof(TEX2) == sizeof(uint64), "Size of TEX2 struct must be 8 bytes.");
@ -339,8 +390,14 @@ public:
uint16 nReserved0;
uint16 nOffsetY;
uint16 nReserved1;
float GetX() { return static_cast<float>(nOffsetX) / 16.0f; }
float GetY() { return static_cast<float>(nOffsetY) / 16.0f; }
float GetX()
{
return static_cast<float>(nOffsetX) / 16.0f;
}
float GetY()
{
return static_cast<float>(nOffsetY) / 16.0f;
}
};
static_assert(sizeof(XYOFFSET) == sizeof(uint64), "Size of XYOFFSET struct must be 8 bytes.");
@ -372,12 +429,30 @@ public:
unsigned int tbp3 : 14;
unsigned int tbw3 : 6;
unsigned int reserved : 4;
uint32 GetTbp1() const { return tbp1 * 256; }
uint32 GetTbp2() const { return (pad0 | (pad1 << 12)) * 256; }
uint32 GetTbp3() const { return tbp3 * 256; }
uint32 GetTbw1() const { return tbw1 * 64; }
uint32 GetTbw2() const { return tbw2 * 64; }
uint32 GetTbw3() const { return tbw3 * 64; }
uint32 GetTbp1() const
{
return tbp1 * 256;
}
uint32 GetTbp2() const
{
return (pad0 | (pad1 << 12)) * 256;
}
uint32 GetTbp3() const
{
return tbp3 * 256;
}
uint32 GetTbw1() const
{
return tbw1 * 64;
}
uint32 GetTbw2() const
{
return tbw2 * 64;
}
uint32 GetTbw3() const
{
return tbw3 * 64;
}
};
static_assert(sizeof(MIPTBP1) == sizeof(uint64), "Size of MIPTBP1 struct must be 8 bytes.");
@ -392,12 +467,30 @@ public:
unsigned int tbp6 : 14;
unsigned int tbw6 : 6;
unsigned int reserved : 4;
uint32 GetTbp4() const { return tbp4 * 256; }
uint32 GetTbp5() const { return (pad0 | (pad1 << 12)) * 256; }
uint32 GetTbp6() const { return tbp6 * 256; }
uint32 GetTbw4() const { return tbw4 * 64; }
uint32 GetTbw5() const { return tbw5 * 64; }
uint32 GetTbw6() const { return tbw6 * 64; }
uint32 GetTbp4() const
{
return tbp4 * 256;
}
uint32 GetTbp5() const
{
return (pad0 | (pad1 << 12)) * 256;
}
uint32 GetTbp6() const
{
return tbp6 * 256;
}
uint32 GetTbw4() const
{
return tbw4 * 64;
}
uint32 GetTbw5() const
{
return tbw5 * 64;
}
uint32 GetTbw6() const
{
return tbw6 * 64;
}
};
static_assert(sizeof(MIPTBP2) == sizeof(uint64), "Size of MIPTBP2 struct must be 8 bytes.");
@ -432,9 +525,18 @@ public:
unsigned int nCOV : 10;
unsigned int nReserved1 : 10;
unsigned int nReserved2 : 32;
uint32 GetBufWidth() { return nCBW * 64; }
uint32 GetOffsetU() { return nCOU * 16; }
uint32 GetOffsetV() { return nCOV; }
uint32 GetBufWidth()
{
return nCBW * 64;
}
uint32 GetOffsetU()
{
return nCOU * 16;
}
uint32 GetOffsetV()
{
return nCOV;
}
};
static_assert(sizeof(TEXCLUT) == sizeof(uint64), "Size of TEXCLUT struct must be 8 bytes.");
@ -491,8 +593,14 @@ public:
unsigned int nPsm : 6;
unsigned int nReserved2 : 2;
unsigned int nMask : 32;
uint32 GetBasePtr() const { return nPtr * 8192; }
uint32 GetWidth() const { return nWidth * 64; }
uint32 GetBasePtr() const
{
return nPtr * 8192;
}
uint32 GetWidth() const
{
return nWidth * 64;
}
};
static_assert(sizeof(FRAME) == sizeof(uint64), "Size of FRAME struct must be 8 bytes.");
@ -505,7 +613,10 @@ public:
unsigned int nReserved1 : 4;
unsigned int nMask : 1;
unsigned int nReserved2 : 31;
uint32 GetBasePtr() const { return nPtr * 8192; }
uint32 GetBasePtr() const
{
return nPtr * 8192;
}
};
static_assert(sizeof(ZBUF) == sizeof(uint64), "Size of ZBUF struct must be 8 bytes.");
@ -524,10 +635,22 @@ public:
unsigned int nReserved4 : 2;
unsigned int nDstPsm : 6;
unsigned int nReserved5 : 2;
uint32 GetSrcPtr() { return nSrcPtr * 256; }
uint32 GetSrcWidth() { return nSrcWidth * 64; }
uint32 GetDstPtr() { return nDstPtr * 256; }
uint32 GetDstWidth() { return nDstWidth * 64; }
uint32 GetSrcPtr()
{
return nSrcPtr * 256;
}
uint32 GetSrcWidth()
{
return nSrcWidth * 64;
}
uint32 GetDstPtr()
{
return nDstPtr * 256;
}
uint32 GetDstWidth()
{
return nDstWidth * 64;
}
};
static_assert(sizeof(BITBLTBUF) == sizeof(uint64), "Size of BITBLTBUF struct must be 8 bytes.");
@ -729,8 +852,14 @@ protected:
unsigned int nX : 11;
unsigned int nY : 11;
unsigned int nReserved1 : 10;
uint32 GetBufPtr() { return nBufPtr * 8192; };
uint32 GetBufWidth() { return nBufWidth * 64; };
uint32 GetBufPtr()
{
return nBufPtr * 8192;
};
uint32 GetBufWidth()
{
return nBufWidth * 64;
};
};
static_assert(sizeof(DISPFB) == sizeof(uint64), "Size of DISPFB struct must be 8 bytes.");
@ -789,18 +918,23 @@ protected:
TRANSFERREADHANDLER m_transferReadHandlers[PSM_MAX];
bool TransferWriteHandlerInvalid(const void*, uint32);
template <typename Storage> bool TransferWriteHandlerGeneric(const void*, uint32);
template <typename Storage>
bool TransferWriteHandlerGeneric(const void*, uint32);
bool TransferWriteHandlerPSMT4(const void*, uint32);
bool TransferWriteHandlerPSMCT24(const void*, uint32);
bool TransferWriteHandlerPSMT8H(const void*, uint32);
template <uint32, uint32> bool TransferWriteHandlerPSMT4H(const void*, uint32);
template <uint32, uint32>
bool TransferWriteHandlerPSMT4H(const void*, uint32);
void TransferReadHandlerInvalid(void*, uint32);
template <typename Storage> void TransferReadHandlerGeneric(void*, uint32);
template <typename Storage>
void TransferReadHandlerGeneric(void*, uint32);
void SyncCLUT(const TEX0&);
template <typename Indexor> bool ReadCLUT4_16(const TEX0&);
template <typename Indexor> bool ReadCLUT8_16(const TEX0&);
template <typename Indexor>
bool ReadCLUT4_16(const TEX0&);
template <typename Indexor>
bool ReadCLUT8_16(const TEX0&);
void ReadCLUT4(const TEX0&);
void ReadCLUT8(const TEX0&);

View file

@ -64,8 +64,7 @@ CGsCachedArea::PageRect CGsCachedArea::GetDirtyPageRect() const
}
const auto getHorzSpan =
[&] (uint32 bx, uint32 by)
{
[&](uint32 bx, uint32 by) {
uint32 span = 0;
for(uint32 x = bx; x < areaRect.width; x++)
{

View file

@ -28,12 +28,30 @@ public:
struct STORAGEPSMCT32
{
enum PAGEWIDTH { PAGEWIDTH = 64 };
enum PAGEHEIGHT { PAGEHEIGHT = 32 };
enum BLOCKWIDTH { BLOCKWIDTH = 8 };
enum BLOCKHEIGHT { BLOCKHEIGHT = 8 };
enum COLUMNWIDTH { COLUMNWIDTH = 8 };
enum COLUMNHEIGHT { COLUMNHEIGHT = 2 };
enum PAGEWIDTH
{
PAGEWIDTH = 64
};
enum PAGEHEIGHT
{
PAGEHEIGHT = 32
};
enum BLOCKWIDTH
{
BLOCKWIDTH = 8
};
enum BLOCKHEIGHT
{
BLOCKHEIGHT = 8
};
enum COLUMNWIDTH
{
COLUMNWIDTH = 8
};
enum COLUMNHEIGHT
{
COLUMNHEIGHT = 2
};
static const int m_nBlockSwizzleTable[4][8];
static const int m_nColumnSwizzleTable[2][8];
@ -43,12 +61,30 @@ public:
struct STORAGEPSMCT16
{
enum PAGEWIDTH { PAGEWIDTH = 64 };
enum PAGEHEIGHT { PAGEHEIGHT = 64 };
enum BLOCKWIDTH { BLOCKWIDTH = 16 };
enum BLOCKHEIGHT { BLOCKHEIGHT = 8 };
enum COLUMNWIDTH { COLUMNWIDTH = 16 };
enum COLUMNHEIGHT { COLUMNHEIGHT = 2 };
enum PAGEWIDTH
{
PAGEWIDTH = 64
};
enum PAGEHEIGHT
{
PAGEHEIGHT = 64
};
enum BLOCKWIDTH
{
BLOCKWIDTH = 16
};
enum BLOCKHEIGHT
{
BLOCKHEIGHT = 8
};
enum COLUMNWIDTH
{
COLUMNWIDTH = 16
};
enum COLUMNHEIGHT
{
COLUMNHEIGHT = 2
};
static const int m_nBlockSwizzleTable[8][4];
static const int m_nColumnSwizzleTable[2][16];
@ -58,12 +94,30 @@ public:
struct STORAGEPSMCT16S
{
enum PAGEWIDTH { PAGEWIDTH = 64 };
enum PAGEHEIGHT { PAGEHEIGHT = 64 };
enum BLOCKWIDTH { BLOCKWIDTH = 16 };
enum BLOCKHEIGHT { BLOCKHEIGHT = 8 };
enum COLUMNWIDTH { COLUMNWIDTH = 16 };
enum COLUMNHEIGHT { COLUMNHEIGHT = 2 };
enum PAGEWIDTH
{
PAGEWIDTH = 64
};
enum PAGEHEIGHT
{
PAGEHEIGHT = 64
};
enum BLOCKWIDTH
{
BLOCKWIDTH = 16
};
enum BLOCKHEIGHT
{
BLOCKHEIGHT = 8
};
enum COLUMNWIDTH
{
COLUMNWIDTH = 16
};
enum COLUMNHEIGHT
{
COLUMNHEIGHT = 2
};
static const int m_nBlockSwizzleTable[8][4];
static const int m_nColumnSwizzleTable[2][16];
@ -73,12 +127,30 @@ public:
struct STORAGEPSMT8
{
enum PAGEWIDTH { PAGEWIDTH = 128 };
enum PAGEHEIGHT { PAGEHEIGHT = 64 };
enum BLOCKWIDTH { BLOCKWIDTH = 16 };
enum BLOCKHEIGHT { BLOCKHEIGHT = 16 };
enum COLUMNWIDTH { COLUMNWIDTH = 16 };
enum COLUMNHEIGHT { COLUMNHEIGHT = 4 };
enum PAGEWIDTH
{
PAGEWIDTH = 128
};
enum PAGEHEIGHT
{
PAGEHEIGHT = 64
};
enum BLOCKWIDTH
{
BLOCKWIDTH = 16
};
enum BLOCKHEIGHT
{
BLOCKHEIGHT = 16
};
enum COLUMNWIDTH
{
COLUMNWIDTH = 16
};
enum COLUMNHEIGHT
{
COLUMNHEIGHT = 4
};
static const int m_nBlockSwizzleTable[4][8];
static const int m_nColumnWordTable[2][2][8];
@ -88,12 +160,30 @@ public:
struct STORAGEPSMT4
{
enum PAGEWIDTH { PAGEWIDTH = 128 };
enum PAGEHEIGHT { PAGEHEIGHT = 128 };
enum BLOCKWIDTH { BLOCKWIDTH = 32 };
enum BLOCKHEIGHT { BLOCKHEIGHT = 16 };
enum COLUMNWIDTH { COLUMNWIDTH = 32 };
enum COLUMNHEIGHT { COLUMNHEIGHT = 4 };
enum PAGEWIDTH
{
PAGEWIDTH = 128
};
enum PAGEHEIGHT
{
PAGEHEIGHT = 128
};
enum BLOCKWIDTH
{
BLOCKWIDTH = 32
};
enum BLOCKHEIGHT
{
BLOCKHEIGHT = 16
};
enum COLUMNWIDTH
{
COLUMNWIDTH = 32
};
enum COLUMNHEIGHT
{
COLUMNHEIGHT = 4
};
static const int m_nBlockSwizzleTable[8][4];
static const int m_nColumnWordTable[2][2][8];
@ -107,7 +197,8 @@ public:
static bool IsPsmIDTEX4(unsigned int);
static bool IsPsmIDTEX8(unsigned int);
template <typename Storage> class CPixelIndexor
template <typename Storage>
class CPixelIndexor
{
public:
CPixelIndexor(uint8* pMemory, uint32 nPointer, uint32 nWidth)
@ -263,7 +354,6 @@ inline void CGsPixelFormats::CPixelIndexor<CGsPixelFormats::STORAGEPSMT4>::SetPi
template <>
inline void CGsPixelFormats::CPixelIndexor<CGsPixelFormats::STORAGEPSMT4>::BuildPageOffsetTable()
{
}
template <>

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