Save states: Removed MS-specific extension usage & disabled extensions + Removed some errors/warnings caused by this change
This commit is contained in:
parent
53f1808f73
commit
4cb8ae7076
33 changed files with 104 additions and 64 deletions
|
@ -58,12 +58,12 @@ uint8_t BaseControlDevice::ProcessNetPlayState(uint32_t netplayState)
|
|||
|
||||
uint8_t BaseControlDevice::GetControlState()
|
||||
{
|
||||
GameServerConnection* netPlayDevice = nullptr;
|
||||
GameServerConnection* netPlayDevice = GameServerConnection::GetNetPlayDevice(_port);
|
||||
if(Movie::Playing()) {
|
||||
_currentState = Movie::GetInstance()->GetState(_port);
|
||||
} else if(GameClient::Connected()) {
|
||||
_currentState = GameClient::GetControllerState(_port);
|
||||
} else if(netPlayDevice = GameServerConnection::GetNetPlayDevice(_port)) {
|
||||
} else if(netPlayDevice) {
|
||||
_currentState = ProcessNetPlayState(netPlayDevice->GetState());
|
||||
} else {
|
||||
_currentState = RefreshState();
|
||||
|
|
|
@ -4,6 +4,11 @@
|
|||
#include "../Utilities/FolderUtilities.h"
|
||||
#include "CheatManager.h"
|
||||
|
||||
void BaseMapper::WriteRegister(uint16_t addr, uint8_t value) { }
|
||||
uint8_t BaseMapper::ReadRegister(uint16_t addr) { return 0; }
|
||||
void BaseMapper::InitMapper(RomData &romData) { }
|
||||
void BaseMapper::Reset(bool softReset) { }
|
||||
|
||||
uint16_t BaseMapper::InternalGetPrgPageSize()
|
||||
{
|
||||
//Make sure the page size is no bigger than the size of the ROM itself
|
||||
|
@ -72,8 +77,8 @@ void BaseMapper::SetCpuMemoryMapping(uint16_t startAddr, uint16_t endAddr, int16
|
|||
|
||||
void BaseMapper::SetPpuMemoryMapping(uint16_t startAddr, uint16_t endAddr, uint16_t pageNumber, ChrMemoryType type, int8_t accessType)
|
||||
{
|
||||
uint32_t pageCount;
|
||||
uint32_t pageSize;
|
||||
uint32_t pageCount = 0;
|
||||
uint32_t pageSize = 0;
|
||||
uint8_t* sourceMemory = nullptr;
|
||||
uint8_t defaultAccessType = MemoryAccessType::Read;
|
||||
switch(type) {
|
||||
|
@ -272,13 +277,13 @@ void BaseMapper::RemoveRegisterRange(uint16_t startAddr, uint16_t endAddr)
|
|||
|
||||
void BaseMapper::StreamState(bool saving)
|
||||
{
|
||||
Stream(_mirroringType,
|
||||
ArrayInfo<uint8_t>{_chrRam, _chrRamSize},
|
||||
ArrayInfo<uint8_t>{_workRam, GetWorkRamSize()},
|
||||
ArrayInfo<uint8_t>{_saveRam, _saveRamSize},
|
||||
ArrayInfo<uint32_t>{_prgPageNumbers, 64},
|
||||
ArrayInfo<uint32_t>{_chrPageNumbers, 64},
|
||||
ArrayInfo<uint8_t>{_nametableIndexes, 4});
|
||||
ArrayInfo<uint8_t> chrRam = { _chrRam, _chrRamSize };
|
||||
ArrayInfo<uint8_t> workRam = { _workRam, GetWorkRamSize() };
|
||||
ArrayInfo<uint8_t> saveRam = { _saveRam, _saveRamSize };
|
||||
ArrayInfo<uint32_t> prgPageNumbers = { _prgPageNumbers, 64 };
|
||||
ArrayInfo<uint32_t> chrPageNumbers = { _chrPageNumbers, 64 };
|
||||
ArrayInfo<uint8_t> nametableIndexes = { _nametableIndexes, 4 };
|
||||
Stream(_mirroringType, chrRam, workRam, saveRam, prgPageNumbers, chrPageNumbers, nametableIndexes);
|
||||
|
||||
if(!saving) {
|
||||
for(uint16_t i = 0; i < 64; i++) {
|
||||
|
|
|
@ -80,7 +80,7 @@ protected:
|
|||
bool _hasBattery = false;
|
||||
|
||||
virtual void InitMapper() = 0;
|
||||
virtual void InitMapper(RomData &romData) { }
|
||||
virtual void InitMapper(RomData &romData);
|
||||
virtual uint16_t GetPRGPageSize() = 0;
|
||||
virtual uint16_t GetCHRPageSize() = 0;
|
||||
|
||||
|
@ -105,8 +105,8 @@ protected:
|
|||
|
||||
uint8_t InternalReadRam(uint16_t addr);
|
||||
|
||||
virtual void WriteRegister(uint16_t addr, uint8_t value) { }
|
||||
virtual uint8_t ReadRegister(uint16_t addr) { return 0; }
|
||||
virtual void WriteRegister(uint16_t addr, uint8_t value);
|
||||
virtual uint8_t ReadRegister(uint16_t addr);
|
||||
|
||||
void SelectPrgPage4x(uint16_t slot, uint16_t page, PrgMemoryType memoryType = PrgMemoryType::PrgRom);
|
||||
void SelectPrgPage2x(uint16_t slot, uint16_t page, PrgMemoryType memoryType = PrgMemoryType::PrgRom);
|
||||
|
@ -147,7 +147,7 @@ protected:
|
|||
public:
|
||||
void Initialize(RomData &romData);
|
||||
virtual ~BaseMapper();
|
||||
virtual void Reset(bool softReset) { }
|
||||
virtual void Reset(bool softReset);
|
||||
|
||||
virtual void ProcessCpuClock() { }
|
||||
virtual void NotifyVRAMAddressChange(uint16_t addr);
|
||||
|
|
|
@ -12,7 +12,7 @@ Breakpoint::~Breakpoint()
|
|||
|
||||
bool Breakpoint::Matches(uint32_t memoryAddr, uint32_t absoluteAddr)
|
||||
{
|
||||
return _addr == -1 || (memoryAddr == _addr && !_isAbsoluteAddr) || (absoluteAddr == _addr && _isAbsoluteAddr);
|
||||
return _addr == -1 || ((int32_t)memoryAddr == _addr && !_isAbsoluteAddr) || ((int32_t)absoluteAddr == _addr && _isAbsoluteAddr);
|
||||
}
|
||||
|
||||
BreakpointType Breakpoint::GetType()
|
||||
|
|
|
@ -503,7 +503,6 @@ private:
|
|||
if(branch) {
|
||||
//"a taken non-page-crossing branch ignores IRQ/NMI during its last clock, so that next instruction executes before the IRQ"
|
||||
//Fixes "branch_delays_irq" test
|
||||
bool skipIrq = false;
|
||||
if(_runIrq && !_prevRunIrq) {
|
||||
_runIrq = false;
|
||||
}
|
||||
|
|
|
@ -204,7 +204,6 @@ void Console::Run()
|
|||
{
|
||||
Timer clockTimer;
|
||||
double targetTime;
|
||||
double elapsedTime = 0;
|
||||
uint32_t lastFrameNumber = -1;
|
||||
|
||||
_runLock.Acquire();
|
||||
|
@ -314,6 +313,7 @@ double Console::UpdateNesModel(bool sendNotification)
|
|||
} else {
|
||||
//60.1fps (NTSC), 50.01fps (PAL/Dendy)
|
||||
switch(model) {
|
||||
default:
|
||||
case NesModel::NTSC: frameDelay = 16.63926405550947; break;
|
||||
case NesModel::PAL:
|
||||
case NesModel::Dendy: frameDelay = 19.99720920217466; break;
|
||||
|
|
|
@ -217,7 +217,8 @@ void ControlManager::StreamState(bool saving)
|
|||
}
|
||||
}
|
||||
|
||||
Stream(_refreshState, _mousePosition.X, _mousePosition.Y, nesModel, expansionDevice, consoleType, ArrayInfo<ControllerType>{controllerTypes, 4}, hasFourScore);
|
||||
ArrayInfo<ControllerType> types = { controllerTypes, 4 };
|
||||
Stream(_refreshState, _mousePosition.X, _mousePosition.Y, nesModel, expansionDevice, consoleType, types, hasFourScore);
|
||||
|
||||
if(!saving) {
|
||||
EmulationSettings::SetNesModel(nesModel);
|
||||
|
|
|
@ -183,6 +183,7 @@
|
|||
</AdditionalIncludeDirectories>
|
||||
<StructMemberAlignment>Default</StructMemberAlignment>
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
<DisableLanguageExtensions>true</DisableLanguageExtensions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
|
@ -209,6 +210,7 @@
|
|||
</AdditionalIncludeDirectories>
|
||||
<StructMemberAlignment>Default</StructMemberAlignment>
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
<DisableLanguageExtensions>true</DisableLanguageExtensions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
|
@ -221,7 +223,7 @@
|
|||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<Optimization>Full</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
|
@ -235,6 +237,7 @@
|
|||
</AdditionalIncludeDirectories>
|
||||
<StructMemberAlignment>Default</StructMemberAlignment>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<DisableLanguageExtensions>true</DisableLanguageExtensions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
|
@ -259,6 +262,7 @@
|
|||
</AdditionalIncludeDirectories>
|
||||
<StructMemberAlignment>Default</StructMemberAlignment>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<DisableLanguageExtensions>true</DisableLanguageExtensions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
|
@ -283,6 +287,7 @@
|
|||
</AdditionalIncludeDirectories>
|
||||
<StructMemberAlignment>Default</StructMemberAlignment>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<DisableLanguageExtensions>true</DisableLanguageExtensions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
|
@ -293,7 +298,7 @@
|
|||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<Optimization>Full</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
|
@ -307,6 +312,7 @@
|
|||
</AdditionalIncludeDirectories>
|
||||
<StructMemberAlignment>Default</StructMemberAlignment>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<DisableLanguageExtensions>true</DisableLanguageExtensions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
|
@ -331,6 +337,7 @@
|
|||
</AdditionalIncludeDirectories>
|
||||
<StructMemberAlignment>Default</StructMemberAlignment>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<DisableLanguageExtensions>true</DisableLanguageExtensions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
|
@ -355,6 +362,7 @@
|
|||
</AdditionalIncludeDirectories>
|
||||
<StructMemberAlignment>Default</StructMemberAlignment>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<DisableLanguageExtensions>true</DisableLanguageExtensions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
|
|
|
@ -37,8 +37,9 @@ protected:
|
|||
Stream(&_volume);
|
||||
Stream(&_mod);
|
||||
|
||||
Stream(_waveWriteEnabled, _disableEnvelopes, _haltWaveform, _masterVolume, _waveOverflowCounter, _wavePitch, _wavePosition, _lastOutput,
|
||||
ArrayInfo<uint8_t>{_waveTable, 64});
|
||||
ArrayInfo<uint8_t> waveTable = { _waveTable, 64 };
|
||||
|
||||
Stream(_waveWriteEnabled, _disableEnvelopes, _haltWaveform, _masterVolume, _waveOverflowCounter, _wavePitch, _wavePosition, _lastOutput, waveTable);
|
||||
}
|
||||
|
||||
public:
|
||||
|
|
|
@ -10,6 +10,8 @@
|
|||
#include "ClientConnectionData.h"
|
||||
#include "ForceDisconnectMessage.h"
|
||||
|
||||
const uint32_t PlayerListMessage::PlayerNameMaxLength;
|
||||
|
||||
GameConnection::GameConnection(shared_ptr<Socket> socket, shared_ptr<ClientConnectionData> connectionData)
|
||||
{
|
||||
_connectionData = connectionData;
|
||||
|
|
|
@ -216,7 +216,7 @@ public:
|
|||
}
|
||||
|
||||
if(pixelInfo.Sprite.TileIndex != HdPpuTileInfo::NoTile) {
|
||||
auto hdTile = _tileInfoByKey.find(pixelInfo.Sprite.GetKey(false));
|
||||
hdTile = _tileInfoByKey.find(pixelInfo.Sprite.GetKey(false));
|
||||
if(hdTile != _tileInfoByKey.end()) {
|
||||
hdPackSpriteInfo = hdTile->second;
|
||||
} else {
|
||||
|
|
|
@ -32,12 +32,12 @@ class JalecoSs88006 : public BaseMapper
|
|||
|
||||
virtual void StreamState(bool saving)
|
||||
{
|
||||
|
||||
BaseMapper::StreamState(saving);
|
||||
Stream(_irqCounter, _irqCounterSize, _irqEnabled,
|
||||
ArrayInfo<uint8_t>{_prgBanks, 3},
|
||||
ArrayInfo<uint8_t>{_chrBanks, 8},
|
||||
ArrayInfo<uint8_t>{_irqReloadValue, 4});
|
||||
|
||||
ArrayInfo<uint8_t> prgBanks = { _prgBanks, 3 };
|
||||
ArrayInfo<uint8_t> chrBanks = { _chrBanks, 8 };
|
||||
ArrayInfo<uint8_t> irqReloadValue = { _irqReloadValue, 4 };
|
||||
Stream(_irqCounter, _irqCounterSize, _irqEnabled, prgBanks, chrBanks, irqReloadValue);
|
||||
}
|
||||
|
||||
void SetMirroring(uint8_t value)
|
||||
|
|
|
@ -149,9 +149,10 @@ class MMC3 : public BaseMapper
|
|||
virtual void StreamState(bool saving)
|
||||
{
|
||||
BaseMapper::StreamState(saving);
|
||||
ArrayInfo<uint8_t> registers = { _registers, 8 };
|
||||
Stream(_state.Reg8000, _state.RegA000, _state.RegA001, _currentRegister, _chrMode, _prgMode,
|
||||
_irqReloadValue, _irqCounter, _irqReload, _irqEnabled, _lastCycle, _cyclesDown,
|
||||
_wramEnabled, _wramWriteProtected, ArrayInfo<uint8_t>{_registers, 8}, _needIrq);
|
||||
_wramEnabled, _wramWriteProtected, registers, _needIrq);
|
||||
}
|
||||
|
||||
virtual uint16_t GetPRGPageSize() { return 0x2000; }
|
||||
|
|
|
@ -15,7 +15,8 @@ protected:
|
|||
virtual void StreamState(bool saving)
|
||||
{
|
||||
MMC3::StreamState(saving);
|
||||
Stream(_regIndex, ArrayInfo<uint8_t>{_reg, 4});
|
||||
ArrayInfo<uint8_t> reg = { _reg, 4 };
|
||||
Stream(_regIndex, reg);
|
||||
|
||||
if(_reg[3] & 0x40) {
|
||||
RemoveRegisterRange(0x6000, 0x7FFF);
|
||||
|
|
|
@ -319,10 +319,12 @@ protected:
|
|||
{
|
||||
BaseMapper::StreamState(saving);
|
||||
|
||||
ArrayInfo<uint8_t> prgBanks = { _prgBanks, 5 };
|
||||
ArrayInfo<uint16_t> chrBanks = { _chrBanks, 12 };
|
||||
Stream(_prgRamProtect1, _prgRamProtect2, _fillModeTile, _fillModeColor, _verticalSplitEnabled, _verticalSplitRightSide,
|
||||
_verticalSplitDelimiterTile, _verticalSplitScroll, _verticalSplitBank, _multiplierValue1, _multiplierValue2,
|
||||
_nametableMapping, _extendedRamMode, _exAttributeLastNametableFetch, _exAttrLastFetchCounter, _exAttrSelectedChrBank,
|
||||
_prgMode, ArrayInfo<uint8_t>{_prgBanks, 5}, _chrMode, _chrUpperBits, ArrayInfo<uint16_t>{_chrBanks, 12}, _lastChrReg,
|
||||
_prgMode, prgBanks, _chrMode, _chrUpperBits, chrBanks, _lastChrReg,
|
||||
_spriteFetch, _largeSprites, _irqCounterTarget, _irqEnabled, _previousScanline, _irqCounter, _irqPending, _ppuInFrame);
|
||||
|
||||
if(!saving) {
|
||||
|
|
|
@ -171,7 +171,8 @@ uint32_t MemoryManager::ToAbsoluteChrAddress(uint16_t vramAddr)
|
|||
|
||||
void MemoryManager::StreamState(bool saving)
|
||||
{
|
||||
Stream(ArrayInfo<uint8_t>{_internalRAM, MemoryManager::InternalRAMSize},
|
||||
ArrayInfo<uint8_t>{_nametableRAM[0], MemoryManager::NameTableScreenSize},
|
||||
ArrayInfo<uint8_t>{_nametableRAM[1], MemoryManager::NameTableScreenSize});
|
||||
ArrayInfo<uint8_t> internalRam = { _internalRAM, MemoryManager::InternalRAMSize };
|
||||
ArrayInfo<uint8_t> nameTable0Ram = { _nametableRAM[0], MemoryManager::NameTableScreenSize };
|
||||
ArrayInfo<uint8_t> nameTable1Ram = { _nametableRAM[1], MemoryManager::NameTableScreenSize };
|
||||
Stream(internalRam, nameTable0Ram, nameTable1Ram);
|
||||
}
|
|
@ -19,7 +19,9 @@ protected:
|
|||
void StreamState(bool saving)
|
||||
{
|
||||
BaseFdsChannel::StreamState(saving);
|
||||
Stream(_counter, _modulationDisabled, _modTablePosition, _overflowCounter, ArrayInfo<uint8_t>{_modTable, 64});
|
||||
|
||||
ArrayInfo<uint8_t> modTable = { _modTable, 64 };
|
||||
Stream(_counter, _modulationDisabled, _modTablePosition, _overflowCounter, modTable);
|
||||
}
|
||||
|
||||
public:
|
||||
|
|
|
@ -26,7 +26,8 @@ protected:
|
|||
virtual void StreamState(bool saving)
|
||||
{
|
||||
BaseMapper::StreamState(saving);
|
||||
Stream(ArrayInfo<uint8_t>{_registers, 5}, _toggle, _autoSwitchCHR);
|
||||
ArrayInfo<uint8_t> registers = { _registers, 5 };
|
||||
Stream(registers, _toggle, _autoSwitchCHR);
|
||||
}
|
||||
|
||||
void InitMapper()
|
||||
|
|
12
Core/PPU.cpp
12
Core/PPU.cpp
|
@ -887,6 +887,12 @@ void PPU::ExecStatic()
|
|||
|
||||
void PPU::StreamState(bool saving)
|
||||
{
|
||||
ArrayInfo<uint8_t> paletteRam = { _paletteRAM, 0x20 };
|
||||
ArrayInfo<uint8_t> spriteRam = { _spriteRAM, 0x100 };
|
||||
ArrayInfo<uint8_t> secondarySpriteRam = { _secondarySpriteRAM, 0x20 };
|
||||
ArrayInfo<int32_t> openBusDecayStamp = { _openBusDecayStamp, 8 };
|
||||
|
||||
|
||||
Stream(_state.Control, _state.Mask, _state.Status, _state.SpriteRamAddr, _state.VideoRamAddr, _state.XScroll, _state.TmpVideoRamAddr, _state.WriteToggle,
|
||||
_state.HighBitShift, _state.LowBitShift, _flags.VerticalWrite, _flags.SpritePatternAddr, _flags.BackgroundPatternAddr, _flags.LargeSprites, _flags.VBlank,
|
||||
_flags.Grayscale, _flags.BackgroundMask, _flags.SpriteMask, _flags.BackgroundEnabled, _flags.SpritesEnabled, _flags.IntensifyRed, _flags.IntensifyGreen,
|
||||
|
@ -894,11 +900,7 @@ void PPU::StreamState(bool saving)
|
|||
_cycle, _frameCount, _memoryReadBuffer, _currentTile.LowByte, _currentTile.HighByte, _currentTile.PaletteOffset, _nextTile.LowByte, _nextTile.HighByte,
|
||||
_nextTile.PaletteOffset, _nextTile.TileAddr, _previousTile.LowByte, _previousTile.HighByte, _previousTile.PaletteOffset, _spriteIndex, _spriteCount,
|
||||
_secondaryOAMAddr, _sprite0Visible, _oamCopybuffer, _spriteInRange, _sprite0Added, _spriteAddrH, _spriteAddrL, _oamCopyDone, _nesModel, _spriteDmaAddr,
|
||||
_spriteDmaCounter, _prevRenderingEnabled, _renderingEnabled, _openBus, _ignoreVramRead, _skipScrollingIncrement,
|
||||
ArrayInfo<uint8_t>{_paletteRAM, 0x20},
|
||||
ArrayInfo<uint8_t>{_spriteRAM, 0x100},
|
||||
ArrayInfo<uint8_t>{_secondarySpriteRAM, 0x20},
|
||||
ArrayInfo<int32_t>{_openBusDecayStamp, 8});
|
||||
_spriteDmaCounter, _prevRenderingEnabled, _renderingEnabled, _openBus, _ignoreVramRead, _skipScrollingIncrement, paletteRam, spriteRam, secondarySpriteRam, openBusDecayStamp);
|
||||
|
||||
for(int i = 0; i < 64; i++) {
|
||||
Stream(_spriteTiles[i].SpriteX, _spriteTiles[i].LowByte, _spriteTiles[i].HighByte, _spriteTiles[i].PaletteOffset, _spriteTiles[i].HorizontalMirror, _spriteTiles[i].BackgroundPriority);
|
||||
|
|
|
@ -35,8 +35,9 @@ protected:
|
|||
void StreamState(bool saving)
|
||||
{
|
||||
BaseMapper::StreamState(saving);
|
||||
ArrayInfo<uint8_t> registers = { _registers, 16 };
|
||||
Stream(_irqEnabled, _irqCycleMode, _needReload, _needIrqDelay, _irqCounter, _irqReloadValue, _lastCycle,
|
||||
_cyclesDown, _cpuClockCounter, _currentRegister, ArrayInfo<uint8_t>{_registers, 16}, _forceClock);
|
||||
_cyclesDown, _cpuClockCounter, _currentRegister, registers, _forceClock);
|
||||
}
|
||||
|
||||
virtual void ProcessCpuClock()
|
||||
|
|
|
@ -20,10 +20,10 @@ bool RomLoader::LoadFromZip(istream &zipFile)
|
|||
if(filename.length() > 4) {
|
||||
if(filename.substr(filename.length() - 4, 4).compare(".nes") == 0 || filename.substr(filename.length() - 4, 4).compare(".fds") == 0) {
|
||||
uint8_t* fileBuffer = nullptr;
|
||||
size_t fileSize = 0;
|
||||
reader.ExtractFile(filename, &fileBuffer, fileSize);
|
||||
size_t size = 0;
|
||||
reader.ExtractFile(filename, &fileBuffer, size);
|
||||
if(fileBuffer) {
|
||||
result = LoadFromMemory(fileBuffer, fileSize);
|
||||
result = LoadFromMemory(fileBuffer, size);
|
||||
delete[] fileBuffer;
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -6,6 +6,8 @@
|
|||
#include "../Utilities/FolderUtilities.h"
|
||||
#include "EmulationSettings.h"
|
||||
|
||||
const uint32_t SaveStateManager::FileFormatVersion;
|
||||
|
||||
string SaveStateManager::GetStateFilepath(int stateIndex)
|
||||
{
|
||||
string folder = FolderUtilities::GetSaveStateFolder();
|
||||
|
|
|
@ -13,7 +13,8 @@ void Snapshotable::StreamStartBlock()
|
|||
_blockBuffer = new uint8_t[0xFFFFF];
|
||||
if(!_saving) {
|
||||
InternalStream(_blockSize);
|
||||
InternalStream(ArrayInfo<uint8_t>{_blockBuffer, std::min((uint32_t)0xFFFFF, _blockSize)});
|
||||
ArrayInfo<uint8_t> arrayInfo = { _blockBuffer, std::min((uint32_t)0xFFFFF, _blockSize) };
|
||||
InternalStream(arrayInfo);
|
||||
}
|
||||
_blockPosition = 0;
|
||||
_inBlock = true;
|
||||
|
@ -24,7 +25,8 @@ void Snapshotable::StreamEndBlock()
|
|||
_inBlock = false;
|
||||
if(_saving) {
|
||||
InternalStream(_blockPosition);
|
||||
InternalStream(ArrayInfo<uint8_t>{_blockBuffer, _blockPosition});
|
||||
ArrayInfo<uint8_t> arrayInfo = { _blockBuffer, _blockPosition };
|
||||
InternalStream(arrayInfo);
|
||||
}
|
||||
|
||||
delete[] _blockBuffer;
|
||||
|
@ -43,7 +45,8 @@ void Snapshotable::Stream(Snapshotable* snapshotable)
|
|||
uint8_t *buffer = new uint8_t[size];
|
||||
stream.read((char*)buffer, size);
|
||||
InternalStream(size);
|
||||
InternalStream(ArrayInfo<uint8_t>{buffer, size});
|
||||
ArrayInfo<uint8_t> arrayInfo = { buffer, size };
|
||||
InternalStream(arrayInfo);
|
||||
delete[] buffer;
|
||||
} else {
|
||||
uint32_t size = 0;
|
||||
|
@ -51,7 +54,8 @@ void Snapshotable::Stream(Snapshotable* snapshotable)
|
|||
|
||||
if(_position + size <= _streamSize) {
|
||||
uint8_t *buffer = new uint8_t[size];
|
||||
InternalStream(ArrayInfo<uint8_t>{buffer, size});
|
||||
ArrayInfo<uint8_t> arrayInfo = { buffer, size };
|
||||
InternalStream(arrayInfo);
|
||||
|
||||
stream.write((char*)buffer, size);
|
||||
stream.seekg(0, ios::beg);
|
||||
|
|
|
@ -31,7 +31,8 @@ void SoundMixer::StreamState(bool saving)
|
|||
UpdateRates();
|
||||
}
|
||||
|
||||
Stream(_previousOutput, ArrayInfo<int8_t>{_currentOutput, MaxChannelCount});
|
||||
ArrayInfo<int8_t> currentOutput = { _currentOutput, MaxChannelCount };
|
||||
Stream(_previousOutput, currentOutput);
|
||||
}
|
||||
|
||||
void SoundMixer::RegisterAudioDevice(IAudioDevice *audioDevice)
|
||||
|
@ -172,13 +173,13 @@ void SoundMixer::EndFrame(uint32_t time)
|
|||
_timestamps.erase(std::unique(_timestamps.begin(), _timestamps.end()), _timestamps.end());
|
||||
|
||||
for(size_t i = 0, len = _timestamps.size(); i < len; i++) {
|
||||
uint32_t time = _timestamps[i];
|
||||
uint32_t stamp = _timestamps[i];
|
||||
for(int j = 0; j < MaxChannelCount; j++) {
|
||||
_currentOutput[j] += _channelOutput[j][time];
|
||||
_currentOutput[j] += _channelOutput[j][stamp];
|
||||
}
|
||||
|
||||
int16_t currentOutput = GetOutputVolume();
|
||||
blip_add_delta(_blipBuf, time, (int)((currentOutput - _previousOutput) * masterVolume));
|
||||
blip_add_delta(_blipBuf, stamp, (int)((currentOutput - _previousOutput) * masterVolume));
|
||||
_previousOutput = currentOutput;
|
||||
}
|
||||
blip_end_frame(_blipBuf, time);
|
||||
|
|
|
@ -110,7 +110,9 @@ protected:
|
|||
virtual void StreamState(bool saving)
|
||||
{
|
||||
BaseMapper::StreamState(saving);
|
||||
Stream(ArrayInfo<uint8_t>{_ramPermission, 3}, ArrayInfo<uint8_t>{_chrRegs, 6}, _chrMode);
|
||||
ArrayInfo<uint8_t> ramPermission = { _ramPermission, 3 };
|
||||
ArrayInfo<uint8_t> chrRegs = { _chrRegs, 6 };
|
||||
Stream(ramPermission, chrRegs, _chrMode);
|
||||
|
||||
if(!saving) {
|
||||
UpdateRamAccess();
|
||||
|
|
|
@ -25,7 +25,9 @@ protected:
|
|||
virtual void StreamState(bool saving)
|
||||
{
|
||||
BaseMapper::StreamState(saving);
|
||||
Stream(ArrayInfo<uint8_t>{ _chrBanks, 2 });
|
||||
|
||||
ArrayInfo<uint8_t> chrBanks = { _chrBanks, 2 };
|
||||
Stream(chrBanks);
|
||||
}
|
||||
|
||||
void WriteRegister(uint16_t addr, uint8_t value)
|
||||
|
|
|
@ -189,6 +189,8 @@ class VRC2_4 : public BaseMapper
|
|||
void StreamState(bool saving)
|
||||
{
|
||||
BaseMapper::StreamState(saving);
|
||||
Stream(_prgReg0, _prgReg1, _prgMode, ArrayInfo<uint8_t>{_loCHRRegs, 8}, ArrayInfo<uint8_t>{_hiCHRRegs, 8}, _hasIRQ, _irq);
|
||||
ArrayInfo<uint8_t> loChrRegs = { _loCHRRegs, 8 };
|
||||
ArrayInfo<uint8_t> hiChrRegs = { _hiCHRRegs, 8 };
|
||||
Stream(_prgReg0, _prgReg1, _prgMode, loChrRegs, hiChrRegs, _hasIRQ, _irq);
|
||||
}
|
||||
};
|
|
@ -34,7 +34,8 @@ protected:
|
|||
{
|
||||
BaseMapper::StreamState(saving);
|
||||
Stream(_irq);
|
||||
Stream(_bankingMode, ArrayInfo<uint8_t>{_chrRegisters, 8});
|
||||
ArrayInfo<uint8_t> chrRegisters = { _chrRegisters, 8 };
|
||||
Stream(_bankingMode, chrRegisters);
|
||||
|
||||
if(!saving) {
|
||||
UpdatePrgRamAccess();
|
||||
|
|
|
@ -32,7 +32,8 @@ protected:
|
|||
{
|
||||
BaseMapper::StreamState(saving);
|
||||
Stream(_irq);
|
||||
Stream(_controlFlags, ArrayInfo<uint8_t>{_chrRegisters, 8});
|
||||
ArrayInfo<uint8_t> chrRegisters = { _chrRegisters, 8 };
|
||||
Stream(_controlFlags, chrRegisters);
|
||||
|
||||
if(!saving) {
|
||||
UpdatePrgRamAccess();
|
||||
|
|
|
@ -34,8 +34,6 @@ namespace NES
|
|||
|
||||
void Renderer::SetScreenSize(uint32_t width, uint32_t height)
|
||||
{
|
||||
double scale = EmulationSettings::GetVideoScale();
|
||||
|
||||
ScreenSize screenSize;
|
||||
VideoDecoder::GetInstance()->GetScreenSize(screenSize, false);
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "..\Core\IKeyManager.h"
|
||||
#include "../Core/IKeyManager.h"
|
||||
#include "GamePad.h"
|
||||
|
||||
struct KeyDefinition {
|
||||
|
|
Loading…
Add table
Reference in a new issue