Added proper const overloads for PSPPointer methods

This commit is contained in:
Nemoumbra committed 2025-02-12 03:26:01 +03:00
1 parent 1907fc7a30
commit 9528d5d8be
2 files changed
+22 -4

No files matched your search

+2 -2
View File
@@ -110,7 +110,7 @@ void PSPOskDialog::ConvertUCS2ToUTF8(std::string& _string, const PSPPointer<u16_
char stringBuffer[maxLength + 1];
char *string = stringBuffer;
u16_le *input = &em_address[0];
const u16_le *input = &em_address[0];
int c;
while ((c = *input++) != 0 && string < stringBuffer + maxLength)
{
@@ -141,7 +141,7 @@ void GetWideStringFromPSPPointer(std::u16string& _string, const PSPPointer<u16_l
char16_t stringBuffer[maxLength + 1];
char16_t *string = stringBuffer;
u16_le *input = &em_address[0];
const u16_le *input = &em_address[0];
int c;
while ((c = *input++) != 0 && string < stringBuffer + maxLength)
*string++ = c;
+20 -2
View File
@@ -399,7 +399,16 @@ struct PSPPointer
#endif
}
inline T &operator[](int i) const
inline const T &operator[](int i) const
{
#ifdef MASKED_PSP_MEMORY
return *((T *)(Memory::base + (ptr & Memory::MEMVIEW32_MASK)) + i);
#else
return *((const T *)(Memory::base + ptr) + i);
#endif
}
inline T &operator[](int i)
{
#ifdef MASKED_PSP_MEMORY
return *((T *)(Memory::base + (ptr & Memory::MEMVIEW32_MASK)) + i);
@@ -408,7 +417,16 @@ struct PSPPointer
#endif
}
inline T *operator->() const
inline const T *operator->() const
{
#ifdef MASKED_PSP_MEMORY
return (T *)(Memory::base + (ptr & Memory::MEMVIEW32_MASK));
#else
return (const T *)(Memory::base + ptr);
#endif
}
inline T *operator->()
{
#ifdef MASKED_PSP_MEMORY
return (T *)(Memory::base + (ptr & Memory::MEMVIEW32_MASK));