More const/static-ification

This commit is contained in:
Henrik Rydgård 2024-09-17 15:22:37 +02:00
parent 2ba4eaf3dd
commit eccd7f3767
14 changed files with 20 additions and 21 deletions

View File

@ -286,9 +286,9 @@ private:
void ResizeReadbackBuffer(CachedReadback *readback, VkDeviceSize requiredSize);
void ApplyMGSHack(std::vector<VKRStep *> &steps);
void ApplySonicHack(std::vector<VKRStep *> &steps);
void ApplyRenderPassMerge(std::vector<VKRStep *> &steps);
static void ApplyMGSHack(std::vector<VKRStep *> &steps);
static void ApplySonicHack(std::vector<VKRStep *> &steps);
static void ApplyRenderPassMerge(std::vector<VKRStep *> &steps);
static void SetupTransferDstWriteAfterWrite(VKRImage &img, VkImageAspectFlags aspect, VulkanBarrierBatch *recordBarrier);

View File

@ -450,9 +450,9 @@ public:
class Framebuffer : public RefCountedObject {
public:
Framebuffer() : RefCountedObject("Framebuffer") {}
int Width() { return width_; }
int Height() { return height_; }
int Layers() { return layers_; }
int Width() const { return width_; }
int Height() const { return height_; }
int Layers() const { return layers_; }
int MultiSampleLevel() { return multiSampleLevel_; }
virtual void UpdateTag(const char *tag) {}

View File

@ -66,7 +66,7 @@ inline int TranslateKeyCodeToAxis(int keyCode, int *direction) {
class InputMapping {
private:
inline int TranslateKeyCodeFromAxis(int axisId, int direction) {
static inline int TranslateKeyCodeFromAxis(int axisId, int direction) {
return AXIS_BIND_NKCODE_START + axisId * 2 + (direction < 0 ? 1 : 0);
}
public:

View File

@ -253,7 +253,7 @@ void MIPSEmitter::QuickCallFunction(MIPSReg scratchreg, const void *func) {
}
}
FixupBranch MIPSEmitter::MakeFixupBranch(FixupBranchType type) {
FixupBranch MIPSEmitter::MakeFixupBranch(FixupBranchType type) const {
FixupBranch b;
b.ptr = code_;
b.type = type;

View File

@ -258,7 +258,7 @@ protected:
static void SetJumpTarget(const FixupBranch &branch, const void *dst);
static bool BInRange(const void *src, const void *dst);
static bool JInRange(const void *src, const void *dst);
FixupBranch MakeFixupBranch(FixupBranchType type);
FixupBranch MakeFixupBranch(FixupBranchType type) const;
void ApplyDelaySlot(std::function<void ()> delaySlot);
private:

View File

@ -114,7 +114,7 @@ public:
}
private:
bool IsHttpsUrl(const std::string &url);
static bool IsHttpsUrl(const std::string &url);
std::vector<std::shared_ptr<Request>> downloads_;
// These get copied to downloads_ in Update(). It's so that callbacks can add new downloads

View File

@ -37,7 +37,7 @@ void TextDrawer::SetFontScale(float xscale, float yscale) {
fontScaleY_ = yscale;
}
float TextDrawer::CalculateDPIScale() {
float TextDrawer::CalculateDPIScale() const {
if (ignoreGlobalDpi_)
return dpiScale_;
float scale = g_display.dpi_scale_y;

View File

@ -58,7 +58,7 @@ public:
// Use for housekeeping like throwing out old strings.
void OncePerFrame();
float CalculateDPIScale();
float CalculateDPIScale() const;
void SetForcedDPIScale(float dpi) {
dpiScale_ = dpi;
ignoreGlobalDpi_ = true;

View File

@ -129,7 +129,7 @@ struct AtlasHeader {
struct Atlas {
~Atlas();
bool Load(const uint8_t *data, size_t data_size);
bool IsMetadataLoaded() {
bool IsMetadataLoaded() const {
return images != nullptr;
}

View File

@ -13,10 +13,10 @@ float ToRadians(float deg) {
return (float)(deg * M_PI / 180.0f);
}
bool IsMatrixIdentity(float* matrix) {
bool IsMatrixIdentity(const float *matrix4x4) {
for (int i = 0; i < 4; i++) {
for (int j = 0; j < 4; j++) {
float value = matrix[i * 4 + j];
float value = matrix4x4[i * 4 + j];
// Other number than zero on non-diagonale
if ((i != j) && (fabs(value) > EPSILON)) return false;

View File

@ -9,7 +9,7 @@
float ToDegrees(float rad);
float ToRadians(float deg);
bool IsMatrixIdentity(float* matrix);
bool IsMatrixIdentity(const float *matrix4x4);
// XrPosef
XrPosef XrPosef_Identity();

View File

@ -205,8 +205,7 @@ void PSPDialog::FinishFadeOut() {
ChangeStatus(SCE_UTILITY_STATUS_FINISHED, 0);
}
u32 PSPDialog::CalcFadedColor(u32 inColor)
{
u32 PSPDialog::CalcFadedColor(u32 inColor) const {
u32 alpha = inColor >> 24;
alpha = alpha * fadeValue / 255;
return (inColor & 0x00FFFFFF) | (alpha << 24);

View File

@ -114,7 +114,7 @@ protected:
void StartFade(bool fadeIn_);
void UpdateFade(int animSpeed);
virtual void FinishFadeOut();
u32 CalcFadedColor(u32 inColor);
u32 CalcFadedColor(u32 inColor) const;
DialogStatus pendingStatus = SCE_UTILITY_STATUS_NONE;
u64 pendingStatusTicks = 0;

View File

@ -227,8 +227,8 @@ protected:
}
private:
void ConvertUCS2ToUTF8(std::string& _string, const PSPPointer<u16_le>& em_address);
void ConvertUCS2ToUTF8(std::string& _string, const char16_t *input);
static void ConvertUCS2ToUTF8(std::string& _string, const PSPPointer<u16_le>& em_address);
static void ConvertUCS2ToUTF8(std::string& _string, const char16_t *input);
void RenderKeyboard();
int NativeKeyboard();