mirror of
https://github.com/SourMesen/Mesen2.git
synced 2025-04-02 10:21:44 -04:00
GB: Performance tweaks
This commit is contained in:
parent
1c1a0a9985
commit
36d23cc47d
5 changed files with 13 additions and 8 deletions
|
@ -169,7 +169,7 @@ public:
|
|||
uint64_t GetCycleCount() { return _state.CycleCount; }
|
||||
|
||||
void Exec();
|
||||
void ProcessNextCycleStart();
|
||||
__forceinline void ProcessNextCycleStart();
|
||||
|
||||
void Serialize(Serializer& s) override;
|
||||
|
||||
|
|
|
@ -102,10 +102,10 @@ void GbMemoryManager::ExecMasterCycle()
|
|||
{
|
||||
uint64_t& cycleCount = _cpu->GetState().CycleCount;
|
||||
cycleCount++;
|
||||
if(!(cycleCount & 1)) {
|
||||
if(cycleCount & 1) {
|
||||
ExecTimerDmaSerial();
|
||||
}
|
||||
_ppu->Exec(true);
|
||||
_ppu->Exec<true>();
|
||||
}
|
||||
|
||||
void GbMemoryManager::Exec()
|
||||
|
@ -113,7 +113,7 @@ void GbMemoryManager::Exec()
|
|||
uint64_t& cycleCount = _cpu->GetState().CycleCount;
|
||||
cycleCount += 2;
|
||||
ExecTimerDmaSerial();
|
||||
_ppu->Exec(false);
|
||||
_ppu->Exec<false>();
|
||||
}
|
||||
|
||||
void GbMemoryManager::MapRegisters(uint16_t start, uint16_t end, RegisterAccess access)
|
||||
|
|
|
@ -39,7 +39,7 @@ private:
|
|||
|
||||
GbMemoryManagerState _state = {};
|
||||
|
||||
void ExecTimerDmaSerial();
|
||||
__forceinline void ExecTimerDmaSerial();
|
||||
|
||||
public:
|
||||
virtual ~GbMemoryManager();
|
||||
|
|
|
@ -82,7 +82,8 @@ uint16_t* GbPpu::GetPreviousEventViewerBuffer()
|
|||
return _currentEventViewerBuffer == _eventViewerBuffers[0] ? _eventViewerBuffers[1] : _eventViewerBuffers[0];
|
||||
}
|
||||
|
||||
void GbPpu::Exec(bool singleStep)
|
||||
template<bool singleStep>
|
||||
void GbPpu::Exec()
|
||||
{
|
||||
if(!_state.LcdEnabled) {
|
||||
//LCD is disabled, prevent IRQs, etc.
|
||||
|
@ -332,7 +333,7 @@ void GbPpu::ProcessPpuCycle()
|
|||
{
|
||||
if(_emu->IsDebugging()) {
|
||||
_emu->ProcessPpuCycle<CpuType::Gameboy>();
|
||||
if(_state.Mode <= PpuMode::OamEvaluation) {
|
||||
if(_state.Mode != PpuMode::Drawing) {
|
||||
_currentEventViewerBuffer[456 * _state.Scanline + _state.Cycle] = evtColors[(int)_state.Mode];
|
||||
} else if(_prevDrawnPixels != _drawnPixels && _drawnPixels > 0) {
|
||||
uint16_t color = _currentBuffer[_state.Scanline * GbConstants::ScreenWidth + (_drawnPixels - 1)];
|
||||
|
@ -1205,3 +1206,6 @@ void GbPpu::Serialize(Serializer& s)
|
|||
template void GbPpu::ProcessOamCorruption<GbOamCorruptionType::Read>(uint16_t addr);
|
||||
template void GbPpu::ProcessOamCorruption<GbOamCorruptionType::ReadIncDec>(uint16_t addr);
|
||||
template void GbPpu::ProcessOamCorruption<GbOamCorruptionType::Write>(uint16_t addr);
|
||||
|
||||
template void GbPpu::Exec<true>();
|
||||
template void GbPpu::Exec<false>();
|
||||
|
|
|
@ -99,7 +99,8 @@ public:
|
|||
bool IsCgbEnabled();
|
||||
PpuMode GetMode();
|
||||
|
||||
void Exec(bool singleStep);
|
||||
template<bool singleStep>
|
||||
void Exec();
|
||||
|
||||
uint8_t Read(uint16_t addr);
|
||||
void Write(uint16_t addr, uint8_t value);
|
||||
|
|
Loading…
Add table
Reference in a new issue