Skip to content
This repository has been archived by the owner on Sep 11, 2023. It is now read-only.

Commit

Permalink
Merge branch 'NovaSquirrel:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
Perkka2 authored Nov 13, 2021
2 parents 3e8733f + 1a656fa commit a7245cd
Show file tree
Hide file tree
Showing 26 changed files with 580 additions and 752 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/linux-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: "Linux build"
on: push

jobs:
win-build:
linux-build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
Expand All @@ -13,8 +13,8 @@ jobs:
- name: Build
run: |
make
# - name: Upload binary
# uses: actions/upload-artifact@v1
# with:
# name: Mesen-win
# path: bin/Any CPU/Release/Mesen.exe
- name: Upload binary
uses: actions/upload-artifact@v1
with:
name: Mesen-Linux
path: bin/x64/Release/Mesen.exe
6 changes: 1 addition & 5 deletions Core/BaseMapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -511,10 +511,8 @@ void BaseMapper::StreamState(bool saving)
ArrayInfo<MemoryAccessType> prgMemoryAccess = { _prgMemoryAccess, 0x100 };
ArrayInfo<MemoryAccessType> chrMemoryAccess = { _chrMemoryAccess, 0x40 };
SnapshotInfo epsmaudio{ _epsmaudio.get() };
SnapshotInfo invA13Audio{ _invA13Audio.get() };
SnapshotInfo invOE1Audio{ _invOE1Audio.get() };

Stream(_mirroringType, chrRam, workRam, saveRam, nametableRam, prgMemoryOffset, chrMemoryOffset, prgMemoryType, chrMemoryType, prgMemoryAccess, chrMemoryAccess, epsmaudio, invA13Audio, invOE1Audio);
Stream(_mirroringType, chrRam, workRam, saveRam, nametableRam, prgMemoryOffset, chrMemoryOffset, prgMemoryType, chrMemoryType, prgMemoryAccess, chrMemoryAccess, epsmaudio);

if(!saving) {
RestorePrgChrState();
Expand Down Expand Up @@ -642,8 +640,6 @@ void BaseMapper::Initialize(RomData &romData)
InitMapper();
InitMapper(romData);
_epsmaudio.reset(new EPSMAudio(_console));
_invA13Audio.reset(new InvA13Audio(_console));
_invOE1Audio.reset(new InvOE1Audio(_console));

//Load battery data if present
LoadBattery();
Expand Down
12 changes: 1 addition & 11 deletions Core/BaseMapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
#include "Console.h"
#include "CPU.h"
#include "EPSMAudio.h"
#include "InvA13Audio.h"
#include "InvOE1Audio.h"

class BaseControlDevice;

Expand Down Expand Up @@ -161,8 +159,6 @@ class BaseMapper : public IMemoryHandler, public Snapshotable, public IBattery
static constexpr uint32_t NametableCount = 0x10;
static constexpr uint32_t NametableSize = 0x400;
unique_ptr<EPSMAudio> _epsmaudio;
unique_ptr<InvA13Audio> _invA13Audio;
unique_ptr<InvOE1Audio> _invOE1Audio;
void Initialize(RomData &romData);

virtual ~BaseMapper();
Expand All @@ -172,13 +168,7 @@ class BaseMapper : public IMemoryHandler, public Snapshotable, public IBattery

virtual void SetNesModel(NesModel model) { }
virtual void ProcessCpuClock() { }
void ProcessMiscClock()
{
_epsmaudio->Clock();
_invA13Audio->Clock();
_invOE1Audio->Clock();
}

virtual void ProcessEPSMClock() { _epsmaudio->Clock(); }
virtual void NotifyVRAMAddressChange(uint16_t addr);
virtual void GetMemoryRanges(MemoryRanges &ranges) override;

Expand Down
14 changes: 1 addition & 13 deletions Core/Console.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -465,23 +465,11 @@ bool Console::Initialize(VirtualFile &romFile, VirtualFile &patchFile, bool forP

void Console::ProcessCpuClock()
{
ProcessInterferenceAudio();
_mapper->ProcessEPSMClock();
_mapper->ProcessCpuClock();
_mapper->ProcessMiscClock();
_apu->ProcessCpuClock();
}

void Console::ProcessInterferenceAudio()
{
_InvA13 = _ppu->_A13pinLowSum;
_ppu->_A13pinLowSum = 0;

_InvOE1 = !_controlManager->GetInvOE1(_controlManager->_address); // invert relative to 2A03

if (_controlManager->_strobed == true)
_controlManager->_strobed = false;
}

CPU* Console::GetCpu()
{
return _cpu.get();
Expand Down
4 changes: 0 additions & 4 deletions Core/Console.h
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,6 @@ class Console : public std::enable_shared_from_this<Console>
void Init();
void Release(bool forShutdown);

uint8_t _InvA13;
uint8_t _InvOE1;

shared_ptr<BatteryManager> GetBatteryManager();
shared_ptr<SaveStateManager> GetSaveStateManager();
shared_ptr<VideoDecoder> GetVideoDecoder();
Expand All @@ -134,7 +131,6 @@ class Console : public std::enable_shared_from_this<Console>
bool IsMaster();

void ProcessCpuClock();
void ProcessInterferenceAudio();
CPU* GetCpu();
PPU* GetPpu();
APU* GetApu();
Expand Down
10 changes: 0 additions & 10 deletions Core/ControlManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -333,12 +333,10 @@ uint8_t ControlManager::ReadRAM(uint16_t addr)
{
//Used for lag counter - any frame where the input is read does not count as lag
_isLagging = false;
_address = addr;

uint8_t value = _console->GetMemoryManager()->GetOpenBus(GetOpenBusMask(addr - 0x4016));
for(shared_ptr<BaseControlDevice> &device : _controlDevices) {
value |= device->ReadRAM(addr);
_strobed = true;
}

return value;
Expand All @@ -351,14 +349,6 @@ void ControlManager::WriteRAM(uint16_t addr, uint8_t value)
}
}

bool ControlManager::GetInvOE1(uint16_t addr)
{
// pull low for only one clock
if (addr == 0x4016)
_OE1pinLow = !_strobed;
return _OE1pinLow;
}

void ControlManager::Reset(bool softReset)
{
ResetLagCounter();
Expand Down
6 changes: 0 additions & 6 deletions Core/ControlManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,6 @@ class ControlManager : public Snapshotable, public IMemoryHandler
virtual uint8_t GetOpenBusMask(uint8_t port);

public:
bool _OE1pinLow;
uint16_t _address;
bool _strobed;

ControlManager(shared_ptr<Console> console, shared_ptr<BaseControlDevice> systemActionManager, shared_ptr<BaseControlDevice> mapperControlDevice);
virtual ~ControlManager();

Expand Down Expand Up @@ -84,6 +80,4 @@ class ControlManager : public Snapshotable, public IMemoryHandler

virtual uint8_t ReadRAM(uint16_t addr) override;
virtual void WriteRAM(uint16_t addr, uint8_t value) override;

bool GetInvOE1(uint16_t addr);
};
2 changes: 0 additions & 2 deletions Core/Core.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -574,8 +574,6 @@
<ClInclude Include="IInputProvider.h" />
<ClInclude Include="IInputRecorder.h" />
<ClInclude Include="InternalRamHandler.h" />
<ClInclude Include="InvA13Audio.h" />
<ClInclude Include="InvOE1Audio.h" />
<ClInclude Include="Kaiser7017.h" />
<ClInclude Include="Kaiser7031.h" />
<ClInclude Include="KeyManager.h" />
Expand Down
2 changes: 0 additions & 2 deletions Core/Core.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -1523,8 +1523,6 @@
<ClInclude Include="fmopn_2608rom.h">
<Filter>Nes\Mappers\EPSG</Filter>
</ClInclude>
<ClInclude Include="InvA13Audio.h" />
<ClInclude Include="InvOE1Audio.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="stdafx.cpp">
Expand Down
8 changes: 8 additions & 0 deletions Core/Debugger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1003,8 +1003,16 @@ bool Debugger::SleepUntilResume(BreakSource source, uint32_t breakpointId, Break

_executionStopped = true;
_pausedForDebugHelper = breakRequested;
int whilePausedRunCounter = 0;
while((((stepCount == 0 || _breakRequested) && _suspendCount == 0) || _preventResume > 0) && !_stopFlag) {
std::this_thread::sleep_for(std::chrono::duration<int, std::milli>(10));
if (preventResume == 0) {
whilePausedRunCounter++;
if (whilePausedRunCounter > 10) {
ProcessEvent(EventType::WhilePaused);
whilePausedRunCounter = 0;
}
}
if(stepCount == 0) {
_console->ResetRunTimers();
}
Expand Down
1 change: 1 addition & 0 deletions Core/DebuggerTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@ enum class EventType
SpriteZeroHit = 9,
ScriptEnded = 10,
BusConflict = 11,
WhilePaused = 12,
EventTypeSize
};

Expand Down
39 changes: 2 additions & 37 deletions Core/EmulationSettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,6 @@ enum class AudioChannel
Sunsoft5B = 10,
EPSM_L = 11,
EPSM_R = 12,
InvA13 = 13,
InvOE1 = 14,
MaxChannelCount
};

enum class EqualizerFilterType
Expand Down Expand Up @@ -663,40 +660,8 @@ class EmulationSettings
bool _audioSettingsChanged = false;
uint32_t _audioLatency = 50;
uint32_t _EPSMClockFrequency = 3579545;
double _channelVolume[15] = {
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0
};
double _channelPanning[15] = {
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
0.0,
2.0,
1.0,
1.0
};
double _channelVolume[13] = { 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 };
double _channelPanning[13] = { 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 0.0, 2.0 };
EqualizerFilterType _equalizerFilterType = EqualizerFilterType::None;
vector<double> _bandGains = { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 };
vector<double> _bands = { { 40,56,80,113,160,225,320,450,600,750,1000,2000,3000,4000,5000,6000,7000,10000,12500,15000 } };
Expand Down
41 changes: 0 additions & 41 deletions Core/InvA13Audio.h

This file was deleted.

41 changes: 0 additions & 41 deletions Core/InvOE1Audio.h

This file was deleted.

21 changes: 21 additions & 0 deletions Core/LuaApi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ int LuaApi::GetLibrary(lua_State *lua)
{ "reset", LuaApi::Reset },
{ "stop", LuaApi::Stop },
{ "breakExecution", LuaApi::Break },
{ "stepOver", LuaApi::StepOver },
{ "stepOut", LuaApi::StepOut },
{ "resume", LuaApi::Resume },
{ "execute", LuaApi::Execute },
{ "rewind", LuaApi::Rewind },
Expand Down Expand Up @@ -168,6 +170,7 @@ int LuaApi::GetLibrary(lua_State *lua)
lua_pushintvalue(stateSaved, EventType::StateSaved);
lua_pushintvalue(inputPolled, EventType::InputPolled);
lua_pushintvalue(scriptEnded, EventType::ScriptEnded);
lua_pushintvalue(whilePaused, EventType::WhilePaused);
lua_settable(lua, -3);

lua_pushliteral(lua, "executeCountType");
Expand Down Expand Up @@ -584,6 +587,24 @@ int LuaApi::Execute(lua_State *lua)
return l.ReturnCount();
}

int LuaApi::StepOut(lua_State* lua)
{
LuaCallHelper l(lua);
checkparams();
checkinitdone();
_debugger->StepOut();
return l.ReturnCount();
}

int LuaApi::StepOver(lua_State* lua)
{
LuaCallHelper l(lua);
checkparams();
checkinitdone();
_debugger->StepOver();
return l.ReturnCount();
}

int LuaApi::Rewind(lua_State *lua)
{
LuaCallHelper l(lua);
Expand Down
Loading

0 comments on commit a7245cd

Please sign in to comment.