VERY experimental Nintendo Switch 2 emulator
C++
core/video_core: Don't cast away const in subscript operators
Lioncashd04e1ad75c89
diff --git a/src/core/hw/gpu.h b/src/core/hw/gpu.hindex 2e3a9f779d..9e07016056 100644--- a/src/core/hw/gpu.h+++ b/src/core/hw/gpu.h@@ -267,13 +267,13 @@ struct Regs {return sizeof(Regs) / sizeof(u32);}- u32& operator [] (int index) const {- u32* content = (u32*)this;+ const u32& operator [] (int index) const {+ const u32* content = reinterpret_cast<const u32*>(this);return content[index];}u32& operator [] (int index) {- u32* content = (u32*)this;+ u32* content = reinterpret_cast<u32*>(this);return content[index];}diff --git a/src/core/hw/lcd.h b/src/core/hw/lcd.hindex bcce6d8cfb..d8ece49806 100644--- a/src/core/hw/lcd.h+++ b/src/core/hw/lcd.h@@ -42,13 +42,13 @@ struct Regs {return sizeof(Regs) / sizeof(u32);}- u32& operator [] (int index) const {- u32* content = (u32*)this;+ const u32& operator [] (int index) const {+ const u32* content = reinterpret_cast<const u32*>(this);return content[index];}u32& operator [] (int index) {- u32* content = (u32*)this;+ u32* content = reinterpret_cast<u32*>(this);return content[index];}diff --git a/src/video_core/pica.h b/src/video_core/pica.hindex 7fb3aa481e..d66124410a 100644--- a/src/video_core/pica.h+++ b/src/video_core/pica.h@@ -1225,13 +1225,13 @@ struct Regs {return sizeof(Regs) / sizeof(u32);}- u32& operator [] (int index) const {- u32* content = (u32*)this;+ const u32& operator [] (int index) const {+ const u32* content = reinterpret_cast<const u32*>(this);return content[index];}u32& operator [] (int index) {- u32* content = (u32*)this;+ u32* content = reinterpret_cast<u32*>(this);return content[index];}