Core: Mark some functions as const

This commit is contained in:
Lioncash 2014-12-03 15:16:11 -05:00
parent 0c349e062a
commit f830d5dec7
14 changed files with 23 additions and 23 deletions

View File

@ -141,7 +141,7 @@ struct ConfigSetting {
cb_.s = def;
}
bool HasMore() {
bool HasMore() const {
return type_ != TYPE_TERMINATOR;
}

View File

@ -580,7 +580,7 @@ int ElfReader::LoadInto(u32 loadAddress, bool fromTop)
}
SectionID ElfReader::GetSectionByName(const char *name, int firstSection)
SectionID ElfReader::GetSectionByName(const char *name, int firstSection) const
{
for (int i = firstSection; i < header->e_shnum; i++)
{

View File

@ -72,10 +72,10 @@ public:
}
// Quick accessors
ElfType GetType() { return (ElfType)(u16)(header->e_type); }
ElfMachine GetMachine() { return (ElfMachine)(u16)(header->e_machine); }
u32 GetEntryPoint() { return entryPoint; }
u32 GetFlags() { return (u32)(header->e_flags); }
ElfType GetType() const { return (ElfType)(u16)(header->e_type); }
ElfMachine GetMachine() const { return (ElfMachine)(u16)(header->e_machine); }
u32 GetEntryPoint() const { return entryPoint; }
u32 GetFlags() const { return (u32)(header->e_flags); }
int GetNumSegments() const { return (int)(header->e_phnum); }
int GetNumSections() const { return (int)(header->e_shnum); }
@ -100,7 +100,7 @@ public:
int GetSectionSize(SectionID section) const {
return sections[section].sh_size;
}
SectionID GetSectionByName(const char *name, int firstSection=0); //-1 for not found
SectionID GetSectionByName(const char *name, int firstSection=0) const; //-1 for not found
u32 GetSegmentPaddr(int segment) const {
return segments[segment].p_paddr;

View File

@ -218,12 +218,12 @@ struct Atrac {
}
int Analyze();
u32 getDecodePosBySample(int sample) {
u32 getDecodePosBySample(int sample) const {
int atracSamplesPerFrame = (codecType == PSP_MODE_AT_3_PLUS ? ATRAC3PLUS_MAX_SAMPLES : ATRAC3_MAX_SAMPLES);
return (u32)(firstSampleoffset + sample / atracSamplesPerFrame * atracBytesPerFrame );
}
int getRemainFrames() {
int getRemainFrames() const {
// games would like to add atrac data when it wants.
// Do not try to guess when it want to add data.
// Just return current remainFrames.

View File

@ -485,7 +485,7 @@ public:
nfl_->altCharCode = charCode;
}
int GetFontHandle(int index) {
int GetFontHandle(int index) const {
return fonts_[index];
}

View File

@ -470,7 +470,7 @@ SceUID KernelObjectPool::Create(KernelObject *obj, int rangeBottom, int rangeTop
return 0;
}
bool KernelObjectPool::IsValid(SceUID handle)
bool KernelObjectPool::IsValid(SceUID handle) const
{
int index = handle - handleOffset;
if (index < 0)
@ -520,7 +520,7 @@ void KernelObjectPool::List()
}
}
int KernelObjectPool::GetCount()
int KernelObjectPool::GetCount() const
{
int count = 0;
for (int i=0; i<maxCount; i++)

View File

@ -447,7 +447,7 @@ public:
return error;
};
bool IsValid(SceUID handle);
bool IsValid(SceUID handle) const;
template <class T>
T* Get(SceUID handle, u32 &outError)
@ -533,7 +533,7 @@ public:
KernelObject *&operator [](SceUID handle);
void List();
void Clear();
int GetCount();
int GetCount() const;
private:
enum {

View File

@ -258,7 +258,7 @@ struct SceKernelVplHeader {
return false;
}
u32 FreeSize() {
u32 FreeSize() const {
// Size less the header and number of allocated bytes.
return sizeMinus8_ + 8 - 0x20 - allocatedInBlocks_ * 8;
}

View File

@ -163,7 +163,7 @@ public:
~Psmf();
void DoState(PointerWrap &p);
bool isValidCurrentStreamNumber() {
bool isValidCurrentStreamNumber() const {
return currentStreamNum >= 0 && currentStreamNum < (int)streamMap.size(); // urgh, checking size isn't really right here.
}

View File

@ -21,7 +21,7 @@ public:
int getNextAudioFrame(u8 **buf, int *headerCode1, int *headerCode2, s64 *pts = NULL);
bool hasNextAudioFrame(int *gotsizeOut, int *frameSizeOut, int *headerCode1, int *headerCode2);
inline int getRemainSize() {
int getRemainSize() const {
return m_len - m_readSize;
}
@ -52,7 +52,7 @@ private:
s64 readPts(int c) {
return (((s64) (c & 0x0E)) << 29) | ((read16() >> 1) << 15) | (read16() >> 1);
}
bool isEOF() {
bool isEOF() const {
return m_index >= m_len;
}
void skip(int n) {

View File

@ -417,7 +417,7 @@ void SasVoice::ReadSamples(s16 *output, int numSamples) {
}
}
bool SasVoice::HaveSamplesEnded() {
bool SasVoice::HaveSamplesEnded() const {
switch (type) {
case VOICETYPE_VAG:
return vag.End();

View File

@ -222,7 +222,7 @@ struct SasVoice {
void DoState(PointerWrap &p);
void ReadSamples(s16 *output, int numSamples);
bool HaveSamplesEnded();
bool HaveSamplesEnded() const;
bool playing;
bool paused; // a voice can be playing AND paused. In that case, it won't play.

View File

@ -183,7 +183,7 @@ namespace SaveState
next_ = 0;
}
bool Empty()
bool Empty() const
{
return next_ == first_;
}

View File

@ -122,11 +122,11 @@ public:
// Do not use, only for savestate upgrading.
void CompatLoad(u32 texture, int width, int height);
int Width() {
int Width() const {
return width_;
}
int Height() {
int Height() const {
return height_;
}