mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
Merge pull request #19468 from hrydgard/german-static-const-override
Code cleanup: Add some const and static modifiers
This commit is contained in:
commit
a6dbb4dfdb
25 changed files with 34 additions and 47 deletions
|
@ -1934,7 +1934,7 @@ inline int64_t abs64(int64_t x) {
|
|||
return x >= 0 ? x : -x;
|
||||
}
|
||||
|
||||
int Count(bool part[4]) {
|
||||
static int Count(const bool part[4]) {
|
||||
int cnt = 0;
|
||||
for (int i = 0; i < 4; i++) {
|
||||
if (part[i])
|
||||
|
|
|
@ -456,7 +456,7 @@ public:
|
|||
void AddNewLit(u32 val);
|
||||
bool TrySetValue_TwoOp(ARMReg reg, u32 val);
|
||||
|
||||
CCFlags GetCC() { return CCFlags(condition >> 28); }
|
||||
CCFlags GetCC() const { return CCFlags(condition >> 28); }
|
||||
void SetCC(CCFlags cond = CC_AL);
|
||||
|
||||
// Special purpose instructions
|
||||
|
|
|
@ -74,7 +74,7 @@ public:
|
|||
size_t size() const { return data_.size(); }
|
||||
bool empty() const { return size() == 0; }
|
||||
void clear() { data_.resize(0); }
|
||||
bool IsVoid() { return void_; }
|
||||
bool IsVoid() const { return void_; }
|
||||
|
||||
protected:
|
||||
// TODO: Find a better internal representation, like a cord.
|
||||
|
|
|
@ -73,7 +73,7 @@ void ppsspp_md5_starts( md5_context *ctx )
|
|||
ctx->state[3] = 0x10325476;
|
||||
}
|
||||
|
||||
static void ppsspp_md5_process( md5_context *ctx, unsigned char data[64] )
|
||||
static void ppsspp_md5_process( md5_context *ctx, const unsigned char data[64] )
|
||||
{
|
||||
unsigned long X[16], A, B, C, D;
|
||||
|
||||
|
|
|
@ -74,7 +74,7 @@ void sha1_starts( sha1_context *ctx )
|
|||
ctx->state[4] = 0xC3D2E1F0;
|
||||
}
|
||||
|
||||
static void sha1_process( sha1_context *ctx, unsigned char data[64] )
|
||||
static void sha1_process( sha1_context *ctx, const unsigned char data[64] )
|
||||
{
|
||||
unsigned long temp, W[16], A, B, C, D, E;
|
||||
|
||||
|
|
|
@ -204,10 +204,6 @@ void PathBrowser::ResetPending() {
|
|||
pendingPath_.clear();
|
||||
}
|
||||
|
||||
bool PathBrowser::IsListingReady() {
|
||||
return ready_;
|
||||
}
|
||||
|
||||
std::string PathBrowser::GetFriendlyPath() const {
|
||||
// Show relative to memstick root if there.
|
||||
if (path_.StartsWith(aliasMatch_)) {
|
||||
|
|
|
@ -23,7 +23,9 @@ public:
|
|||
void Refresh() {
|
||||
HandlePath();
|
||||
}
|
||||
bool IsListingReady();
|
||||
bool IsListingReady() const {
|
||||
return ready_;
|
||||
}
|
||||
bool GetListing(std::vector<File::FileInfo> &fileInfo, const char *filter = nullptr, bool *cancel = nullptr);
|
||||
|
||||
bool CanNavigateUp();
|
||||
|
|
|
@ -86,7 +86,6 @@ public:
|
|||
// Utility for users of this class, not used internally.
|
||||
enum { INVALID_OFFSET = 0xFFFFFFFF };
|
||||
|
||||
private:
|
||||
// Needs context in case of defragment.
|
||||
void Begin() {
|
||||
buf_ = 0;
|
||||
|
@ -105,7 +104,6 @@ private:
|
|||
Unmap();
|
||||
}
|
||||
|
||||
public:
|
||||
void Map();
|
||||
void Unmap();
|
||||
|
||||
|
|
|
@ -376,14 +376,6 @@ public:
|
|||
deleter_.pushBuffers.push_back(pushbuffer);
|
||||
}
|
||||
|
||||
void BeginPushBuffer(GLPushBuffer *pushbuffer) {
|
||||
pushbuffer->Begin();
|
||||
}
|
||||
|
||||
void EndPushBuffer(GLPushBuffer *pushbuffer) {
|
||||
pushbuffer->End();
|
||||
}
|
||||
|
||||
bool IsInRenderPass() const {
|
||||
return curRenderStep_ && curRenderStep_->stepType == GLRStepType::RENDER;
|
||||
}
|
||||
|
|
|
@ -799,12 +799,12 @@ OpenGLContext::~OpenGLContext() {
|
|||
void OpenGLContext::BeginFrame(DebugFlags debugFlags) {
|
||||
renderManager_.BeginFrame(debugFlags & DebugFlags::PROFILE_TIMESTAMPS);
|
||||
FrameData &frameData = frameData_[renderManager_.GetCurFrame()];
|
||||
renderManager_.BeginPushBuffer(frameData.push);
|
||||
frameData.push->Begin();
|
||||
}
|
||||
|
||||
void OpenGLContext::EndFrame() {
|
||||
FrameData &frameData = frameData_[renderManager_.GetCurFrame()];
|
||||
renderManager_.EndPushBuffer(frameData.push); // upload the data!
|
||||
frameData.push->End(); // upload the data!
|
||||
renderManager_.Finish();
|
||||
Invalidate(InvalidationFlags::CACHED_RENDER_STATE);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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) {}
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
|
@ -150,16 +150,16 @@ void DrawEngineGLES::ClearInputLayoutMap() {
|
|||
|
||||
void DrawEngineGLES::BeginFrame() {
|
||||
FrameData &frameData = frameData_[render_->GetCurFrame()];
|
||||
render_->BeginPushBuffer(frameData.pushIndex);
|
||||
render_->BeginPushBuffer(frameData.pushVertex);
|
||||
frameData.pushIndex->Begin();
|
||||
frameData.pushVertex->Begin();
|
||||
|
||||
lastRenderStepId_ = -1;
|
||||
}
|
||||
|
||||
void DrawEngineGLES::EndFrame() {
|
||||
FrameData &frameData = frameData_[render_->GetCurFrame()];
|
||||
render_->EndPushBuffer(frameData.pushIndex);
|
||||
render_->EndPushBuffer(frameData.pushVertex);
|
||||
frameData.pushIndex->End();
|
||||
frameData.pushVertex->End();
|
||||
tessDataTransferGLES->EndFrame();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue