Fixed some uninitialized variables
+ Fixed rare crash when calling Stop()
This commit is contained in:
parent
4aea512397
commit
95d0c5a910
9 changed files with 17 additions and 16 deletions
|
@ -12,6 +12,7 @@ namespace CartFlags
|
|||
{
|
||||
enum CartFlags
|
||||
{
|
||||
None = 0,
|
||||
LoRom = 1,
|
||||
HiRom = 2,
|
||||
FastRom = 4,
|
||||
|
@ -28,9 +29,9 @@ private:
|
|||
|
||||
vector<unique_ptr<IMemoryHandler>> _prgRomHandlers;
|
||||
vector<unique_ptr<IMemoryHandler>> _saveRamHandlers;
|
||||
SnesCartInformation _cartInfo;
|
||||
SnesCartInformation _cartInfo = {};
|
||||
|
||||
CartFlags::CartFlags _flags;
|
||||
CartFlags::CartFlags _flags = CartFlags::CartFlags::None;
|
||||
string _romPath;
|
||||
string _patchPath;
|
||||
|
||||
|
|
|
@ -73,6 +73,8 @@ void Console::Run()
|
|||
if(!_cpu) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto emulationLock = _emulationLock.AcquireSafe();
|
||||
|
||||
DebugStats stats(this);
|
||||
Timer lastFrameTimer;
|
||||
|
@ -160,7 +162,7 @@ void Console::Stop(bool sendNotification)
|
|||
debugger->Run();
|
||||
}
|
||||
|
||||
_runLock.WaitForRelease();
|
||||
_emulationLock.WaitForRelease();
|
||||
|
||||
if(_cart) {
|
||||
RomInfo romInfo = _cart->GetRomInfo();
|
||||
|
|
|
@ -54,6 +54,7 @@ private:
|
|||
|
||||
atomic<uint32_t> _lockCounter;
|
||||
SimpleLock _runLock;
|
||||
SimpleLock _emulationLock;
|
||||
|
||||
SimpleLock _debuggerLock;
|
||||
atomic<bool> _stopFlag;
|
||||
|
|
|
@ -14,6 +14,7 @@ public:
|
|||
{
|
||||
_delay = delay;
|
||||
_targetTime = _delay;
|
||||
_resetRunTimers = false;
|
||||
}
|
||||
|
||||
void SetDelay(double delay)
|
||||
|
|
|
@ -31,7 +31,7 @@ private:
|
|||
|
||||
uint8_t _ioPortOutput = 0;
|
||||
|
||||
uint16_t _controllerData[4];
|
||||
uint16_t _controllerData[4] = {};
|
||||
|
||||
public:
|
||||
InternalRegisters(Console* console);
|
||||
|
|
|
@ -32,12 +32,12 @@ private:
|
|||
vector<unique_ptr<RamHandler>> _workRamHandlers;
|
||||
|
||||
uint8_t *_workRam;
|
||||
uint64_t _masterClock;
|
||||
uint64_t _masterClock = 0;
|
||||
uint16_t _hClock = 0;
|
||||
uint16_t _dramRefreshPosition = 0;
|
||||
uint16_t _hdmaInitPosition = 0;
|
||||
uint8_t _openBus;
|
||||
uint8_t _cpuSpeed;
|
||||
uint8_t _openBus = 0;
|
||||
uint8_t _cpuSpeed = 8;
|
||||
|
||||
bool _hasEvent[1369];
|
||||
uint8_t _masterClockTable[2][0x10000];
|
||||
|
|
10
Core/Ppu.cpp
10
Core/Ppu.cpp
|
@ -33,9 +33,6 @@ Ppu::Ppu(Console* console)
|
|||
_console = console;
|
||||
|
||||
_vram = new uint16_t[Ppu::VideoRamSize >> 1];
|
||||
_console->GetSettings()->InitializeRam(_vram, Ppu::VideoRamSize);
|
||||
_console->GetSettings()->InitializeRam(_cgram, Ppu::CgRamSize);
|
||||
_console->GetSettings()->InitializeRam(_oamRam, Ppu::SpriteRamSize);
|
||||
|
||||
_outputBuffers[0] = new uint16_t[512 * 478];
|
||||
_outputBuffers[1] = new uint16_t[512 * 478];
|
||||
|
@ -67,9 +64,9 @@ void Ppu::PowerOn()
|
|||
|
||||
_cgramAddress = 0;
|
||||
|
||||
memset(_vram, 0, Ppu::VideoRamSize);
|
||||
memset(_oamRam, 0, Ppu::SpriteRamSize);
|
||||
memset(_cgram, 0, Ppu::CgRamSize);
|
||||
_console->GetSettings()->InitializeRam(_vram, Ppu::VideoRamSize);
|
||||
_console->GetSettings()->InitializeRam(_cgram, Ppu::CgRamSize);
|
||||
_console->GetSettings()->InitializeRam(_oamRam, Ppu::SpriteRamSize);
|
||||
|
||||
memset(_spriteIndexes, 0xFF, sizeof(_spriteIndexes));
|
||||
|
||||
|
@ -462,7 +459,6 @@ bool Ppu::ProcessEndOfScanline(uint16_t hClock)
|
|||
(_console->GetSettings()->GetEmulationSpeed() == 0 || _console->GetSettings()->GetEmulationSpeed() > 150) &&
|
||||
_frameSkipTimer.GetElapsedMS() < 10
|
||||
);
|
||||
|
||||
if(!_skipRender) {
|
||||
//If we're not skipping this frame, reset the high resolution flag
|
||||
_useHighResOutput = false;
|
||||
|
|
|
@ -24,7 +24,7 @@ private:
|
|||
MemoryManager* _memoryManager;
|
||||
|
||||
//Temporary data used for the tilemap/tile fetching
|
||||
LayerData _layerData[4];
|
||||
LayerData _layerData[4] = {};
|
||||
uint16_t _hOffset = 0;
|
||||
uint16_t _vOffset = 0;
|
||||
uint16_t _fetchBgStart = 0;
|
||||
|
|
2
makefile
2
makefile
|
@ -110,7 +110,7 @@ testhelper: InteropDLL/$(OBJFOLDER)/$(SHAREDLIB)
|
|||
$(CPPC) $(GCCOPTIONS) -Wl,-z,defs -o testhelper TestHelper/*.cpp InteropDLL/ConsoleWrapper.cpp $(SEVENZIPOBJ) $(LUAOBJ) $(LINUXOBJ) $(LIBEVDEVOBJ) $(UTILOBJ) $(COREOBJ) -pthread $(FSLIB) $(SDL2LIB) $(LIBEVDEVLIB)
|
||||
mv testhelper TestHelper/$(OBJFOLDER)
|
||||
|
||||
pgohelper:
|
||||
pgohelper: InteropDLL/$(OBJFOLDER)/$(SHAREDLIB)
|
||||
mkdir -p PGOHelper/$(OBJFOLDER) && cd PGOHelper/$(OBJFOLDER) && $(CPPC) $(GCCOPTIONS) -Wl,-z,defs -o pgohelper ../PGOHelper.cpp ../../bin/pgohelperlib.so -pthread $(FSLIB) $(SDL2LIB) $(LIBEVDEVLIB)
|
||||
|
||||
SevenZip/$(OBJFOLDER)/%.o: SevenZip/%.c
|
||||
|
|
Loading…
Add table
Reference in a new issue