diff --git a/Core/ApuFrameCounter.h b/Core/ApuFrameCounter.h index 9ac895f6..dd481c84 100644 --- a/Core/ApuFrameCounter.h +++ b/Core/ApuFrameCounter.h @@ -81,6 +81,10 @@ public: if(_nesModel != model) { _nesModel = model; switch(model) { + case NesModel::Auto: + //Auto should never be set here + break; + case NesModel::NTSC: case NesModel::Dendy: memcpy(_stepCycles, _stepCyclesNtsc, sizeof(_stepCycles)); diff --git a/Core/BaseMapper.cpp b/Core/BaseMapper.cpp index 0d9bb37b..54dfc910 100644 --- a/Core/BaseMapper.cpp +++ b/Core/BaseMapper.cpp @@ -886,6 +886,7 @@ uint32_t BaseMapper::CopyMemory(DebugMemoryType type, uint8_t* buffer) { uint32_t chrRomSize = _onlyChrRam ? 0 : _chrRomSize; switch(type) { + default: break; case DebugMemoryType::ChrRam: memcpy(buffer, _chrRam, _chrRamSize); return _chrRamSize; case DebugMemoryType::ChrRom: memcpy(buffer, _chrRom, chrRomSize); return chrRomSize; case DebugMemoryType::PrgRom: memcpy(buffer, _prgRom, _prgSize); return _prgSize; @@ -899,6 +900,7 @@ uint32_t BaseMapper::CopyMemory(DebugMemoryType type, uint8_t* buffer) void BaseMapper::WriteMemory(DebugMemoryType type, uint8_t* buffer) { switch(type) { + default: break; case DebugMemoryType::ChrRam: memcpy(_chrRam, buffer, _chrRamSize); break; case DebugMemoryType::SaveRam: memcpy(_saveRam, buffer, _saveRamSize); break; case DebugMemoryType::WorkRam: memcpy(_workRam, buffer, _workRamSize); break; @@ -933,6 +935,7 @@ uint8_t BaseMapper::GetMemoryValue(DebugMemoryType memoryType, uint32_t address) } switch(memoryType) { + default: break; case DebugMemoryType::ChrRom: return _chrRom[address]; case DebugMemoryType::ChrRam: return _chrRam[address]; case DebugMemoryType::SaveRam: return _saveRam[address]; @@ -952,6 +955,7 @@ void BaseMapper::SetMemoryValue(DebugMemoryType memoryType, uint32_t address, ui } switch(memoryType) { + default: break; case DebugMemoryType::ChrRom: _chrRom[address] = value; break; case DebugMemoryType::ChrRam: _chrRam[address] = value; break; case DebugMemoryType::SaveRam: _saveRam[address] = value; break; diff --git a/Core/Console.cpp b/Core/Console.cpp index 66a65dac..10e63792 100644 --- a/Core/Console.cpp +++ b/Core/Console.cpp @@ -968,6 +968,8 @@ uint8_t* Console::GetRamBuffer(DebugMemoryType memoryType, uint32_t &size, int32 { //Only used by libretro port for achievements - should not be used by anything else. switch(memoryType) { + default: break; + case DebugMemoryType::InternalRam: size = MemoryManager::InternalRAMSize; startAddr = 0; diff --git a/Core/ControlManager.cpp b/Core/ControlManager.cpp index c3e86031..e42a1a67 100644 --- a/Core/ControlManager.cpp +++ b/Core/ControlManager.cpp @@ -124,6 +124,7 @@ shared_ptr ControlManager::CreateControllerDevice(ControllerT shared_ptr device; switch(type) { + case ControllerType::None: break; case ControllerType::StandardController: device.reset(new StandardController(port, EmulationSettings::GetControllerKeys(port))); break; case ControllerType::Zapper: device.reset(new Zapper(port)); break; case ControllerType::ArkanoidController: device.reset(new ArkanoidController(port)); break; diff --git a/Core/Debugger.cpp b/Core/Debugger.cpp index 1a2c0a95..9ae6ae07 100644 --- a/Core/Debugger.cpp +++ b/Core/Debugger.cpp @@ -290,6 +290,9 @@ void Debugger::ProcessBreakpoints(BreakpointType type, OperationInfo &operationI PpuAddressTypeInfo ppuInfo { -1, PpuAddressType::None }; bool isPpuBreakpoint = false; switch(type) { + case BreakpointType::Global: + break; + case BreakpointType::Execute: case BreakpointType::ReadRam: case BreakpointType::WriteRam: @@ -657,8 +660,9 @@ bool Debugger::PrivateProcessRamOperation(MemoryOperationType type, uint16_t &ad } if(type != MemoryOperationType::DummyRead) { - BreakpointType breakpointType = BreakpointType::Execute; + BreakpointType breakpointType; switch(type) { + default: breakpointType = BreakpointType::Execute; break; case MemoryOperationType::Read: breakpointType = BreakpointType::ReadRam; break; case MemoryOperationType::Write: breakpointType = BreakpointType::WriteRam; break; } diff --git a/Core/Disassembler.cpp b/Core/Disassembler.cpp index 222996ff..241c0c71 100644 --- a/Core/Disassembler.cpp +++ b/Core/Disassembler.cpp @@ -156,6 +156,10 @@ bool Disassembler::IsUnconditionalJump(uint8_t opCode) void Disassembler::GetInfo(AddressTypeInfo &info, uint8_t** source, uint32_t &size, vector> **cache) { switch(info.Type) { + case AddressType::Register: + //AddressType::Register should never be used here + break; + case AddressType::InternalRam: *source = _memoryManager->GetInternalRAM(); *cache = &_disassembleMemoryCache; @@ -264,6 +268,10 @@ void Disassembler::InvalidateCache(AddressTypeInfo &info) addr = info.Address; cache = &_disassembleSaveRamCache; break; + + default: + //No need to invalidate PRG ROM cache (since it's not RAM) + break; } if(cache && addr >= 0) { @@ -470,6 +478,7 @@ string Disassembler::GetCode(AddressTypeInfo &addressInfo, uint32_t endAddr, uin uint8_t *source; char memoryType = 'P'; switch(addressInfo.Type) { + case AddressType::Register: break; //Should never happen case AddressType::InternalRam: memoryType = 'N'; break; case AddressType::PrgRom: memoryType = 'P'; break; case AddressType::WorkRam: memoryType = 'W'; break; @@ -662,6 +671,7 @@ DisassemblyInfo Disassembler::GetDisassemblyInfo(AddressTypeInfo &info) { DisassemblyInfo* disassemblyInfo = nullptr; switch(info.Type) { + case AddressType::Register: break; //Should never happen case AddressType::InternalRam: disassemblyInfo = _disassembleMemoryCache[info.Address & 0x7FF].get(); break; case AddressType::PrgRom: disassemblyInfo = _disassembleCache[info.Address].get(); break; case AddressType::WorkRam: disassemblyInfo = _disassembleWorkRamCache[info.Address].get(); break; diff --git a/Core/DisassemblyInfo.cpp b/Core/DisassemblyInfo.cpp index 2305a128..43083596 100644 --- a/Core/DisassemblyInfo.cpp +++ b/Core/DisassemblyInfo.cpp @@ -226,6 +226,8 @@ void DisassemblyInfo::GetEffectiveAddressString(string &out, State& cpuState, Me int32_t DisassemblyInfo::GetEffectiveAddress(State& cpuState, MemoryManager* memoryManager) { switch(_opMode) { + default: break; + case AddrMode::ZeroX: return (uint8_t)(_byteCode[1] + cpuState.X); break; case AddrMode::ZeroY: return (uint8_t)(_byteCode[1] + cpuState.Y); break; diff --git a/Core/EmulationSettings.cpp b/Core/EmulationSettings.cpp index cd9b9448..8a9109c7 100644 --- a/Core/EmulationSettings.cpp +++ b/Core/EmulationSettings.cpp @@ -142,6 +142,8 @@ uint32_t EmulationSettings::GetEmulationSpeed(bool ignoreTurbo) double EmulationSettings::GetAspectRatio() { switch(_aspectRatio) { + case VideoAspectRatio::NoStretching: return 0.0; + case VideoAspectRatio::Auto: { NesModel model = GetNesModel(); diff --git a/Core/EmulationSettings.h b/Core/EmulationSettings.h index c8fed99a..594c4570 100644 --- a/Core/EmulationSettings.h +++ b/Core/EmulationSettings.h @@ -525,7 +525,7 @@ struct KeyCombination enum class Language { - SystemDefault = 0, + //SystemDefault = 0, //This value is never used by the C++ core English = 1, French = 2, Japanese = 3, diff --git a/Core/GameDatabase.cpp b/Core/GameDatabase.cpp index 2c151c1a..ebebc3a1 100644 --- a/Core/GameDatabase.cpp +++ b/Core/GameDatabase.cpp @@ -439,6 +439,7 @@ void GameDatabase::SetGameInfo(uint32_t romCrc, RomData &romData, bool updateRom } switch(GetBusConflictType(info.BusConflicts)) { + case BusConflictType::Default: break; case BusConflictType::Yes: MessageManager::Log("[DB] Bus conflicts: Yes"); break; case BusConflictType::No: MessageManager::Log("[DB] Bus conflicts: No"); break; } diff --git a/Core/HdBuilderPpu.h b/Core/HdBuilderPpu.h index 864a377e..963fe1a1 100644 --- a/Core/HdBuilderPpu.h +++ b/Core/HdBuilderPpu.h @@ -92,12 +92,10 @@ protected: void WriteRAM(uint16_t addr, uint8_t value) { - switch(GetRegisterID(addr)) { - case PPURegisters::VideoMemoryData: - if(_state.VideoRamAddr < 0x2000) { - _needChrHash = true; - } - break; + if(GetRegisterID(addr) == PPURegisters::VideoMemoryData) { + if(_state.VideoRamAddr < 0x2000) { + _needChrHash = true; + } } PPU::WriteRAM(addr, value); } diff --git a/Core/LuaApi.cpp b/Core/LuaApi.cpp index 6f9d30d4..a346b42a 100644 --- a/Core/LuaApi.cpp +++ b/Core/LuaApi.cpp @@ -710,6 +710,7 @@ int LuaApi::GetAccessCounters(lua_State *lua) uint32_t size = 0; switch(memoryType) { + case AddressType::Register: error("Invalid memory type"); break; case AddressType::InternalRam: size = 0x2000; break; case AddressType::PrgRom: size = _debugger->GetMemoryDumper()->GetMemorySize(DebugMemoryType::PrgRom); break; case AddressType::WorkRam: size = _debugger->GetMemoryDumper()->GetMemorySize(DebugMemoryType::WorkRam); break; diff --git a/Core/MMC3.h b/Core/MMC3.h index 6af3f97d..370f4d9d 100644 --- a/Core/MMC3.h +++ b/Core/MMC3.h @@ -281,6 +281,9 @@ class MMC3 : public BaseMapper virtual void NotifyVRAMAddressChange(uint16_t addr) override { switch(_a12Watcher.UpdateVramAddress(addr)) { + case A12StateChange::None: + break; + case A12StateChange::Fall: if(_needIrq) { //Used by MC-ACC (Acclaim copy of the MMC3), see TriggerIrq above diff --git a/Core/Mapper116.h b/Core/Mapper116.h index 70d93b7c..1f459960 100644 --- a/Core/Mapper116.h +++ b/Core/Mapper116.h @@ -97,6 +97,10 @@ protected: { if((_mode & 0x03) == 1) { switch(_a12Watcher.UpdateVramAddress(addr)) { + case A12StateChange::None: + case A12StateChange::Fall: + break; + case A12StateChange::Rise: if(_irqCounter == 0 || _irqReload) { _irqCounter = _irqReloadValue; diff --git a/Core/Mapper218.h b/Core/Mapper218.h index 4814c52c..672e977b 100644 --- a/Core/Mapper218.h +++ b/Core/Mapper218.h @@ -26,6 +26,7 @@ protected: case MirroringType::Horizontal: mask = 0x800; break; case MirroringType::ScreenAOnly: mask = 0x1000; break; case MirroringType::ScreenBOnly: mask = 0x2000; break; + case MirroringType::FourScreens: break; //Will never be FourScreens, see InitMapper() above } for(int i = 0; i < 8; i++) { diff --git a/Core/MemoryAccessCounter.cpp b/Core/MemoryAccessCounter.cpp index 9d96762e..84d03ec7 100644 --- a/Core/MemoryAccessCounter.cpp +++ b/Core/MemoryAccessCounter.cpp @@ -90,6 +90,8 @@ void MemoryAccessCounter::GetAccessCounts(AddressType memoryType, MemoryOperatio void MemoryAccessCounter::GetAccessStamps(uint32_t offset, uint32_t length, DebugMemoryType memoryType, MemoryOperationType operationType, uint32_t stamps[]) { switch(memoryType) { + default: break; + case DebugMemoryType::InternalRam: memcpy(stamps, GetArray(operationType, AddressType::InternalRam, true).data() + offset, length * sizeof(uint32_t)); break; @@ -119,6 +121,8 @@ void MemoryAccessCounter::GetAccessStamps(uint32_t offset, uint32_t length, Debu void MemoryAccessCounter::GetAccessCountsEx(uint32_t offset, uint32_t length, DebugMemoryType memoryType, MemoryOperationType operationType, int32_t counts[]) { switch(memoryType) { + default: break; + case DebugMemoryType::InternalRam: memcpy(counts, GetArray(operationType, AddressType::InternalRam, false).data() + offset, length * sizeof(uint32_t)); break; diff --git a/Core/MemoryDumper.cpp b/Core/MemoryDumper.cpp index db2a11fd..78f888d7 100644 --- a/Core/MemoryDumper.cpp +++ b/Core/MemoryDumper.cpp @@ -23,6 +23,12 @@ MemoryDumper::MemoryDumper(shared_ptr ppu, shared_ptr memory void MemoryDumper::SetMemoryState(DebugMemoryType type, uint8_t *buffer) { switch(type) { + case DebugMemoryType::ChrRom: + case DebugMemoryType::PrgRom: + case DebugMemoryType::CpuMemory: + case DebugMemoryType::PpuMemory: + break; + case DebugMemoryType::InternalRam: for(int i = 0; i < 0x800; i++) { _memoryManager->DebugWrite(i, buffer[i]); @@ -172,6 +178,7 @@ void MemoryDumper::SetMemoryValue(DebugMemoryType memoryType, uint32_t address, _debugger->GetAbsoluteAddressAndType(address, &info); if(info.Address >= 0) { switch(info.Type) { + case AddressType::Register: break; //not supported case AddressType::InternalRam: SetMemoryValue(DebugMemoryType::InternalRam, info.Address, value, preventRebuildCache, true); break; case AddressType::PrgRom: SetMemoryValue(DebugMemoryType::PrgRom, info.Address, value, preventRebuildCache, true); break; case AddressType::WorkRam: SetMemoryValue(DebugMemoryType::WorkRam, info.Address, value, preventRebuildCache, true); break; @@ -230,6 +237,7 @@ uint8_t MemoryDumper::GetMemoryValue(DebugMemoryType memoryType, uint32_t addres _debugger->GetAbsoluteAddressAndType(address, &info); if(info.Address >= 0) { switch(info.Type) { + case AddressType::Register: return 0; //not supported case AddressType::InternalRam: return GetMemoryValue(DebugMemoryType::InternalRam, info.Address, true); case AddressType::PrgRom: return GetMemoryValue(DebugMemoryType::PrgRom, info.Address, true); case AddressType::WorkRam: return GetMemoryValue(DebugMemoryType::WorkRam, info.Address, true); diff --git a/Core/MovieRecorder.cpp b/Core/MovieRecorder.cpp index fe01b41c..ad3a57eb 100644 --- a/Core/MovieRecorder.cpp +++ b/Core/MovieRecorder.cpp @@ -77,6 +77,7 @@ void MovieRecorder::GetGameSettings(stringstream &out) } switch(model) { + case NesModel::Auto: break; //Console::GetModel() will never return Auto. case NesModel::NTSC: WriteString(out, MovieKeys::Region, "NTSC"); break; case NesModel::PAL: WriteString(out, MovieKeys::Region, "PAL"); break; case NesModel::Dendy: WriteString(out, MovieKeys::Region, "Dendy"); break; diff --git a/Core/PPU.cpp b/Core/PPU.cpp index 3f50695a..1f223bdd 100644 --- a/Core/PPU.cpp +++ b/Core/PPU.cpp @@ -109,6 +109,10 @@ void PPU::SetNesModel(NesModel model) _nesModel = model; switch(_nesModel) { + case NesModel::Auto: + //Should never be Auto + break; + case NesModel::NTSC: _nmiScanline = 241; _vblankEnd = 260; @@ -239,6 +243,7 @@ uint8_t PPU::ReadRAM(uint16_t addr) case PpuModel::Ppu2C05C: openBusMask = 0x00; returnValue |= 0x1C; break; case PpuModel::Ppu2C05D: openBusMask = 0x00; returnValue |= 0x1B; break; case PpuModel::Ppu2C05E: openBusMask = 0x00; break; + default: break; } break; diff --git a/Core/RecordedRomTest.cpp b/Core/RecordedRomTest.cpp index be319410..cb714793 100644 --- a/Core/RecordedRomTest.cpp +++ b/Core/RecordedRomTest.cpp @@ -89,6 +89,9 @@ void RecordedRomTest::ProcessNotification(ConsoleNotificationType type, void* pa Save(); } break; + + default: + break; } } diff --git a/Core/Sachen8259.h b/Core/Sachen8259.h index ff1b5ad1..0d2698db 100644 --- a/Core/Sachen8259.h +++ b/Core/Sachen8259.h @@ -105,6 +105,12 @@ public: _chrOr[1] = 2; _chrOr[2] = 3; break; + + case Sachen8259Variant::Sachen8259D: + //Variant D does not use the _shift / _chrOr variables at all + _shift = 0; + _chrOr[0] = _chrOr[1] = _chrOr[2] = 0; + break; } } }; diff --git a/Core/ScaleFilter.cpp b/Core/ScaleFilter.cpp index 55b109f9..3cb16557 100644 --- a/Core/ScaleFilter.cpp +++ b/Core/ScaleFilter.cpp @@ -103,6 +103,15 @@ shared_ptr ScaleFilter::GetScaleFilter(VideoFilterType filter) { shared_ptr scaleFilter; switch(filter) { + case VideoFilterType::BisqwitNtsc: + case VideoFilterType::BisqwitNtscHalfRes: + case VideoFilterType::BisqwitNtscQuarterRes: + case VideoFilterType::NTSC: + case VideoFilterType::HdPack: + case VideoFilterType::Raw: + case VideoFilterType::None: + break; + case VideoFilterType::xBRZ2x: scaleFilter.reset(new ScaleFilter(ScaleFilterType::xBRZ, 2)); break; case VideoFilterType::xBRZ3x: scaleFilter.reset(new ScaleFilter(ScaleFilterType::xBRZ, 3)); break; case VideoFilterType::xBRZ4x: scaleFilter.reset(new ScaleFilter(ScaleFilterType::xBRZ, 4)); break; diff --git a/Core/ScriptHost.cpp b/Core/ScriptHost.cpp index 7d3e1c57..8e796267 100644 --- a/Core/ScriptHost.cpp +++ b/Core/ScriptHost.cpp @@ -42,6 +42,7 @@ void ScriptHost::ProcessCpuOperation(uint16_t addr, uint8_t &value, MemoryOperat case MemoryOperationType::Read: _context->CallMemoryCallback(addr, value, CallbackType::CpuRead); break; case MemoryOperationType::Write: _context->CallMemoryCallback(addr, value, CallbackType::CpuWrite); break; case MemoryOperationType::ExecOpCode: _context->CallMemoryCallback(addr, value, CallbackType::CpuExec); break; + default: break; } } } @@ -52,6 +53,7 @@ void ScriptHost::ProcessPpuOperation(uint16_t addr, uint8_t &value, MemoryOperat switch(type) { case MemoryOperationType::Read: _context->CallMemoryCallback(addr, value, CallbackType::PpuRead); break; case MemoryOperationType::Write: _context->CallMemoryCallback(addr, value, CallbackType::PpuWrite); break; + default: break; } } } diff --git a/Core/SoundMixer.cpp b/Core/SoundMixer.cpp index fad08c9a..af96b818 100644 --- a/Core/SoundMixer.cpp +++ b/Core/SoundMixer.cpp @@ -139,6 +139,7 @@ void SoundMixer::PlayAudioBuffer(uint32_t time) } switch(EmulationSettings::GetStereoFilter()) { + case StereoFilter::None: break; case StereoFilter::Delay: _stereoDelay.ApplyFilter(_outputBuffer, sampleCount, _sampleRate); break; case StereoFilter::Panning: _stereoPanning.ApplyFilter(_outputBuffer, sampleCount); break; } diff --git a/Core/Sunsoft4.h b/Core/Sunsoft4.h index 954afade..f869da3d 100644 --- a/Core/Sunsoft4.h +++ b/Core/Sunsoft4.h @@ -20,6 +20,7 @@ private: if(_useChrForNametables) { switch(GetMirroringType()) { + case MirroringType::FourScreens: break; //4-screen mirroring is not supported by this mapper case MirroringType::Vertical: SetNametables(4, 5, 4, 5); break; case MirroringType::Horizontal: SetNametables(4, 4, 5, 5); break; case MirroringType::ScreenAOnly: SetNametables(4, 4, 4, 4); break; diff --git a/makefile b/makefile index 2f5cf2fb..5492ba77 100644 --- a/makefile +++ b/makefile @@ -32,7 +32,7 @@ else PROFILE_USE_FLAG = -fprofile-instr-use=$(CURDIR)/PGOHelper/pgo.profdata endif -GCCOPTIONS=-fPIC -Wall --std=c++14 -O3 $(MESENFLAGS) -Wno-switch +GCCOPTIONS=-fPIC -Wall --std=c++14 -O3 $(MESENFLAGS) CCOPTIONS=-fPIC -Wall -O3 $(MESENFLAGS) ifeq ($(MESENPLATFORM),x86)