diff --git a/Common/ArmEmitter.cpp b/Common/ArmEmitter.cpp index 9ba1a59d29..2d55b8dffa 100644 --- a/Common/ArmEmitter.cpp +++ b/Common/ArmEmitter.cpp @@ -748,7 +748,7 @@ void ARMXEmitter::B(ARMReg src) Write32(condition | 0x012FFF10 | src); } -bool ARMXEmitter::BLInRange(const void *fnptr) { +bool ARMXEmitter::BLInRange(const void *fnptr) const { ptrdiff_t distance = (intptr_t)fnptr - (intptr_t(code) + 8); if (distance <= -0x2000000 || distance > 0x2000000) return false; diff --git a/Common/ArmEmitter.h b/Common/ArmEmitter.h index 206338e445..d571742486 100644 --- a/Common/ArmEmitter.h +++ b/Common/ArmEmitter.h @@ -143,7 +143,7 @@ private: u8 IndexOrShift; ShiftType Shift; public: - OpType GetType() + OpType GetType() const { return Type; } @@ -240,35 +240,35 @@ public: _assert_msg_(JIT, Type == TYPE_RSR, "RSR must be RSR Of Course"); return (IndexOrShift << 8) | (Shift << 5) | 0x10 | Value; } - u32 Rm() + u32 Rm() const { _assert_msg_(JIT, Type == TYPE_REG, "Rm must be with Reg"); return Value; } - u32 Imm5() + u32 Imm5() const { _assert_msg_(JIT, (Type == TYPE_IMM), "Imm5 not IMM value"); return ((Value & 0x0000001F) << 7); } - u32 Imm8() + u32 Imm8() const { _assert_msg_(JIT, (Type == TYPE_IMM), "Imm8Rot not IMM value"); return Value & 0xFF; } - u32 Imm8Rot() // IMM8 with Rotation + u32 Imm8Rot() const // IMM8 with Rotation { _assert_msg_(JIT, (Type == TYPE_IMM), "Imm8Rot not IMM value"); _assert_msg_(JIT, (Rotation & 0xE1) != 0, "Invalid Operand2: immediate rotation %u", Rotation); return (1 << 25) | (Rotation << 7) | (Value & 0x000000FF); } - u32 Imm12() + u32 Imm12() const { _assert_msg_(JIT, (Type == TYPE_IMM), "Imm12 not IMM"); return (Value & 0x00000FFF); } - u32 Imm12Mod() + u32 Imm12Mod() const { // This is an IMM12 with the top four bits being rotation and the // bottom eight being an IMM. This is for instructions that need to @@ -278,32 +278,32 @@ public: _assert_msg_(JIT, (Type == TYPE_IMM), "Imm12Mod not IMM"); return ((Rotation & 0xF) << 8) | (Value & 0xFF); } - u32 Imm16() + u32 Imm16() const { _assert_msg_(JIT, (Type == TYPE_IMM), "Imm16 not IMM"); return ( (Value & 0xF000) << 4) | (Value & 0x0FFF); } - u32 Imm16Low() + u32 Imm16Low() const { return Imm16(); } - u32 Imm16High() // Returns high 16bits + u32 Imm16High() const // Returns high 16bits { _assert_msg_(JIT, (Type == TYPE_IMM), "Imm16 not IMM"); return ( ((Value >> 16) & 0xF000) << 4) | ((Value >> 16) & 0x0FFF); } - u32 Imm24() + u32 Imm24() const { _assert_msg_(JIT, (Type == TYPE_IMM), "Imm16 not IMM"); return (Value & 0x0FFFFFFF); } // NEON and ASIMD specific - u32 Imm8ASIMD() + u32 Imm8ASIMD() const { _assert_msg_(JIT, (Type == TYPE_IMM), "Imm8ASIMD not IMM"); return ((Value & 0x80) << 17) | ((Value & 0x70) << 12) | (Value & 0xF); } - u32 Imm8VFP() + u32 Imm8VFP() const { _assert_msg_(JIT, (Type == TYPE_IMM), "Imm8VFP not IMM"); return ((Value & 0xF0) << 12) | (Value & 0xF); @@ -511,7 +511,7 @@ public: void B (ARMReg src); void BL(const void *fnptr); void BL(ARMReg src); - bool BLInRange(const void *fnptr); + bool BLInRange(const void *fnptr) const; void PUSH(const int num, ...); void POP(const int num, ...); diff --git a/Common/MemoryUtil.h b/Common/MemoryUtil.h index 68a40dbf1c..3f6812434c 100644 --- a/Common/MemoryUtil.h +++ b/Common/MemoryUtil.h @@ -75,7 +75,7 @@ public: return buf_; } - size_t size() { + size_t size() const { return size_; } diff --git a/Common/Timer.cpp b/Common/Timer.cpp index 89f10db9e3..b45a7d4c34 100644 --- a/Common/Timer.cpp +++ b/Common/Timer.cpp @@ -93,7 +93,7 @@ void Timer::Update() // ------------------------------------- // Get the number of milliseconds since the last Update() -u64 Timer::GetTimeDifference() +u64 Timer::GetTimeDifference() const { return GetTimeMs() - m_LastTime; } @@ -112,7 +112,7 @@ void Timer::WindBackStartingTime(u64 WindBack) } // Get the time elapsed since the Start() -u64 Timer::GetTimeElapsed() +u64 Timer::GetTimeElapsed() const { // If we have not started yet, return 1 (because then I don't // have to change the FPS calculation in CoreRerecording.cpp . diff --git a/Common/Timer.h b/Common/Timer.h index 5ccfb69aa5..dbe19f5469 100644 --- a/Common/Timer.h +++ b/Common/Timer.h @@ -33,7 +33,7 @@ public: void Update(); // The time difference is always returned in milliseconds, regardless of alternative internal representation - u64 GetTimeDifference(); + u64 GetTimeDifference() const; void AddTimeDifference(); void WindBackStartingTime(u64 WindBack); @@ -45,7 +45,7 @@ public: static void GetTimeFormatted(char formattedTime[13]); std::string GetTimeElapsedFormatted() const; - u64 GetTimeElapsed(); + u64 GetTimeElapsed() const; static u32 GetTimeMs(); diff --git a/Core/FileSystems/VirtualDiscFileSystem.h b/Core/FileSystems/VirtualDiscFileSystem.h index f219f223a7..aab5f10fff 100644 --- a/Core/FileSystems/VirtualDiscFileSystem.h +++ b/Core/FileSystems/VirtualDiscFileSystem.h @@ -84,7 +84,7 @@ private: ReadFunc Read; CloseFunc Close; - bool IsValid() { return library != NULL; } + bool IsValid() const { return library != NULL; } }; struct HandlerFileHandle { diff --git a/Core/HLE/scePsmf.cpp b/Core/HLE/scePsmf.cpp index c180bfc50b..ba1b3b6b6c 100644 --- a/Core/HLE/scePsmf.cpp +++ b/Core/HLE/scePsmf.cpp @@ -170,7 +170,7 @@ public: void setStreamNum(int num); bool setStreamWithType(int type, int channel); - int FindEPWithTimestamp(int pts); + int FindEPWithTimestamp(int pts) const; u32 magic; u32 version; @@ -548,7 +548,7 @@ bool Psmf::setStreamWithType(int type, int channel) { return false; } -int Psmf::FindEPWithTimestamp(int pts) { +int Psmf::FindEPWithTimestamp(int pts) const { int best = -1; int bestPts = 0; diff --git a/Core/MIPS/PPC/PpcRegCache.cpp b/Core/MIPS/PPC/PpcRegCache.cpp index 53a0711f68..b44e463cf3 100644 --- a/Core/MIPS/PPC/PpcRegCache.cpp +++ b/Core/MIPS/PPC/PpcRegCache.cpp @@ -41,7 +41,7 @@ void PpcRegCache::Start(MIPSAnalyst::AnalysisResults &stats) { } } -const PPCReg *PpcRegCache::GetMIPSAllocationOrder(int &count) { +const PPCReg *PpcRegCache::GetMIPSAllocationOrder(int &count) const { // Note that R0 is reserved as scratch for now. // R1 could be used as it's only used for scratch outside "regalloc space" now. // R12 is also potentially usable. diff --git a/Core/MIPS/PPC/PpcRegCache.h b/Core/MIPS/PPC/PpcRegCache.h index c74b98b1e0..5f982bbe7f 100644 --- a/Core/MIPS/PPC/PpcRegCache.h +++ b/Core/MIPS/PPC/PpcRegCache.h @@ -139,8 +139,8 @@ public: int GetMipsRegOffset(MIPSReg r); private: - const PPCReg *GetMIPSAllocationOrder(int &count); - + const PPCReg *GetMIPSAllocationOrder(int &count) const; + MIPSState *mips_; MIPSComp::PpcJitOptions *options_; PPCXEmitter *emit_; diff --git a/Core/MIPS/PPC/PpcRegCacheVPU.cpp b/Core/MIPS/PPC/PpcRegCacheVPU.cpp index 905ce47db4..59faa11a62 100644 --- a/Core/MIPS/PPC/PpcRegCacheVPU.cpp +++ b/Core/MIPS/PPC/PpcRegCacheVPU.cpp @@ -41,7 +41,7 @@ void PpcRegCacheVPU::Start(MIPSAnalyst::AnalysisResults &stats) { } } -const PPCReg *PpcRegCacheVPU::GetMIPSAllocationOrder(int &count) { +const PPCReg *PpcRegCacheVPU::GetMIPSAllocationOrder(int &count) const { // Note that R0 is reserved as scratch for now. // R1 could be used as it's only used for scratch outside "regalloc space" now. // R12 is also potentially usable. diff --git a/Core/MIPS/PPC/PpcRegCacheVPU.h b/Core/MIPS/PPC/PpcRegCacheVPU.h index 6ebf8356a6..eaf836eec8 100644 --- a/Core/MIPS/PPC/PpcRegCacheVPU.h +++ b/Core/MIPS/PPC/PpcRegCacheVPU.h @@ -89,8 +89,8 @@ public: int GetMipsRegOffset(MIPSReg r); private: - const PPCReg *GetMIPSAllocationOrder(int &count); - + const PPCReg *GetMIPSAllocationOrder(int &count) const; + MIPSState *mips_; MIPSComp::PpcJitOptions *options_; PPCXEmitter *emit_; diff --git a/GPU/Common/IndexGenerator.cpp b/GPU/Common/IndexGenerator.cpp index 7a20129ad8..f0ab7e462a 100644 --- a/GPU/Common/IndexGenerator.cpp +++ b/GPU/Common/IndexGenerator.cpp @@ -45,7 +45,7 @@ bool IndexGenerator::PrimCompatible(int prim1, int prim2) { return indexedPrimitiveType[prim1] == indexedPrimitiveType[prim2]; } -bool IndexGenerator::PrimCompatible(int prim) { +bool IndexGenerator::PrimCompatible(int prim) const { if (prim_ == GE_PRIM_INVALID) return true; return indexedPrimitiveType[prim] == prim_; diff --git a/GPU/Common/IndexGenerator.h b/GPU/Common/IndexGenerator.h index de56df064e..f30de3d1e3 100644 --- a/GPU/Common/IndexGenerator.h +++ b/GPU/Common/IndexGenerator.h @@ -27,7 +27,7 @@ public: void Setup(u16 *indexptr); void Reset(); static bool PrimCompatible(int prim1, int prim2); - bool PrimCompatible(int prim); + bool PrimCompatible(int prim) const; GEPrimitiveType Prim() const { return prim_; } void AddPrim(int prim, int vertexCount); diff --git a/GPU/GPUState.h b/GPU/GPUState.h index 178fe11d07..55bb87bb57 100644 --- a/GPU/GPUState.h +++ b/GPU/GPUState.h @@ -276,13 +276,13 @@ struct GPUgstate // Alpha Test bool isAlphaTestEnabled() const { return alphaTestEnable & 1; } - GEComparison getAlphaTestFunction() { return static_cast(alphatest & 0x7); } + GEComparison getAlphaTestFunction() const { return static_cast(alphatest & 0x7); } int getAlphaTestRef() const { return (alphatest >> 8) & 0xFF; } int getAlphaTestMask() const { return (alphatest >> 16) & 0xFF; } // Color Test bool isColorTestEnabled() const { return colorTestEnable & 1; } - GEComparison getColorTestFunction() { return static_cast(colortest & 0x3); } + GEComparison getColorTestFunction() const { return static_cast(colortest & 0x3); } u32 getColorTestRef() const { return colorref & 0xFFFFFF; } u32 getColorTestMask() const { return colortestmask & 0xFFFFFF; } @@ -305,7 +305,7 @@ struct GPUgstate u32 getClutAddress() const { return (clutaddr & 0x00FFFFFF) | ((clutaddrupper << 8) & 0x0F000000); } int getClutLoadBytes() const { return (loadclut & 0x3F) * 32; } int getClutLoadBlocks() const { return (loadclut & 0x3F); } - GEPaletteFormat getClutPaletteFormat() { return static_cast(clutformat & 3); } + GEPaletteFormat getClutPaletteFormat() const { return static_cast(clutformat & 3); } int getClutIndexShift() const { return (clutformat >> 2) & 0x1F; } int getClutIndexMask() const { return (clutformat >> 8) & 0xFF; } int getClutIndexStartPos() const { return ((clutformat >> 16) & 0x1F) << 4; }