From 886ae6425feb12f1e51aa8e55ba0d539faee409f Mon Sep 17 00:00:00 2001 From: Sour Date: Sun, 23 Jun 2019 20:10:55 -0400 Subject: [PATCH] Fixed some cases of variables being used before initialization --- Core/APU.cpp | 1 + Core/ApuFrameCounter.h | 2 +- Core/Debugger.cpp | 3 +++ Core/MMC5.h | 6 ++++++ Core/MMC5Audio.h | 1 + Core/SoundMixer.cpp | 1 + 6 files changed, 13 insertions(+), 1 deletion(-) diff --git a/Core/APU.cpp b/Core/APU.cpp index 3cb41bc6..887febf3 100644 --- a/Core/APU.cpp +++ b/Core/APU.cpp @@ -14,6 +14,7 @@ APU::APU(shared_ptr console) { _nesModel = NesModel::Auto; _apuEnabled = true; + _needToRun = false; _console = console; _mixer = _console->GetSoundMixer(); diff --git a/Core/ApuFrameCounter.h b/Core/ApuFrameCounter.h index 6c9ea3f4..cfada017 100644 --- a/Core/ApuFrameCounter.h +++ b/Core/ApuFrameCounter.h @@ -64,7 +64,7 @@ public: void StreamState(bool saving) override { - int32_t unusednextIrqCycle; + int32_t unusednextIrqCycle = 0; Stream(unusednextIrqCycle, _previousCycle, _currentStep, _stepMode, _inhibitIRQ, _nesModel, _blockFrameCounterTick, _writeDelayCounter, _newValue); if(!saving) { diff --git a/Core/Debugger.cpp b/Core/Debugger.cpp index 6d6d0c2f..6d08b7da 100644 --- a/Core/Debugger.cpp +++ b/Core/Debugger.cpp @@ -76,6 +76,9 @@ Debugger::Debugger(shared_ptr console, shared_ptr cpu, shared_ptr< _breakOnScanline = -2; _breakSource = BreakSource::Unspecified; + memset(_hasBreakpoint, 0, sizeof(_hasBreakpoint)); + _bpDummyCpuRequired = false; + _preventResume = 0; _stopFlag = false; _suspendCount = 0; diff --git a/Core/MMC5.h b/Core/MMC5.h index 1a390a2c..9a7e5d8d 100644 --- a/Core/MMC5.h +++ b/Core/MMC5.h @@ -353,6 +353,9 @@ protected: _fillModeTile = 0; _verticalSplitScroll = 0; _verticalSplitBank = 0; + _verticalSplitEnabled = false; + _verticalSplitDelimiterTile = 0; + _verticalSplitRightSide = false; _multiplierValue1 = 0; _multiplierValue2 = 0; _chrUpperBits = 0; @@ -365,12 +368,15 @@ protected: _exAttributeLastNametableFetch = 0; _exAttrSelectedChrBank = 0; + _irqPending = false; _irqCounterTarget = 0; _irqCounter = 0; _irqEnabled = false; _previousScanline = -1; _ppuInFrame = false; + _lastVramOperationType = MemoryOperationType::Read; + _splitInSplitRegion = false; _splitVerticalScroll = 0; _splitTile = 0; diff --git a/Core/MMC5Audio.h b/Core/MMC5Audio.h index 3bcd34b8..c190f0dc 100644 --- a/Core/MMC5Audio.h +++ b/Core/MMC5Audio.h @@ -21,6 +21,7 @@ public: { _currentOutput = 0; _isMmc5Square = true; + Reset(false); } int8_t GetOutput() diff --git a/Core/SoundMixer.cpp b/Core/SoundMixer.cpp index 0e33db43..10dd2fc3 100644 --- a/Core/SoundMixer.cpp +++ b/Core/SoundMixer.cpp @@ -12,6 +12,7 @@ SoundMixer::SoundMixer(shared_ptr console) { _audioDevice = nullptr; + _clockRate = 0; _console = console; _settings = _console->GetSettings(); _eqFrequencyGrid.reset(new orfanidis_eq::freq_grid());