Minor code cleanup and changes

This commit is contained in:
2025-07-22 08:15:32 -04:00
parent 522303c785
commit 3a28cf09ea
4 changed files with 5 additions and 6 deletions

View File

@@ -13,8 +13,7 @@ uint8_t Bus::Read(uint32_t address) {
return wram[address - 0x7E0000];
} else if (address >= 0x800000 && cartridge) {
// ROM access
uint32_t rom_addr = address & 0x7FFFFF;
if (rom_addr < cartridge->size()) {
if (const uint32_t rom_addr = address & 0x7FFFFF; rom_addr < cartridge->size()) {
return (*cartridge)[rom_addr];
}
}

View File

@@ -12,7 +12,7 @@ class PPU;
class APU;
class Bus;
int main(int argc, char* argv[]) {
int main(const int argc, char* argv[]) {
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO) < 0) {
std::cout << "SDL could not initialize! SDL_Error: " << SDL_GetError() << std::endl;
return -1;
@@ -22,7 +22,7 @@ int main(int argc, char* argv[]) {
"BreadedSNES",
SDL_WINDOWPOS_UNDEFINED,
SDL_WINDOWPOS_UNDEFINED,
256, 224, // SNES output resolution
256, 224, // SNES output res
SDL_WINDOW_SHOWN
);

View File

@@ -29,7 +29,7 @@ bool System::LoadROM(const std::string& filename) {
}
file.seekg(0, std::ios::end);
size_t size = file.tellg();
const size_t size = file.tellg();
file.seekg(0, std::ios::beg);
cartridge_data.resize(size);