From 57579490231028b8156192316c047b581cb66d72 Mon Sep 17 00:00:00 2001 From: byuu <2107894+byuu@users.noreply.github.com> Date: Tue, 6 Aug 2019 02:48:28 +0900 Subject: [PATCH] v108.6 * fix IRQ regression in Power Rangers: Fighting Edition --- LICENSE.txt | 17 ++++++++--------- bsnes/emulator/emulator.hpp | 2 +- bsnes/sfc/cpu/memory.cpp | 7 +++---- bsnes/sfc/ppu-fast/mode7.cpp | 4 ++-- bsnes/sfc/ppu/ppu.cpp | 2 +- bsnes/sfc/ppu/ppu.hpp | 14 +++++++------- 6 files changed, 22 insertions(+), 24 deletions(-) diff --git a/LICENSE.txt b/LICENSE.txt index 38d08fd2..d0522524 100644 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -1,10 +1,9 @@ ---------------------------------------------------------------------- -bsnes - Suite of videogame console emulators -icarus - Game library importer for higan +bsnes - Super Nintendo emulator - Copyright © 2004-2019 byuu + Copyright © 2004-2019 byuu - https://byuu.org/ + https://byuu.org This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -21,12 +20,12 @@ along with this program. If not, see . ---------------------------------------------------------------------- ---------------------------------------------------------------------- -hiro - User interface toolkit -libco - C cooperative threading library -nall - C++ template library -ruby - Hardware abstraction layer +libco - C cooperative threading library +nall - C++ template library +ruby - Hardware abstraction library +hiro - User interface library - Copyright © 2006-2019 byuu + Copyright © 2006-2019 byuu Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the diff --git a/bsnes/emulator/emulator.hpp b/bsnes/emulator/emulator.hpp index 13ac9cfd..88d7dda2 100644 --- a/bsnes/emulator/emulator.hpp +++ b/bsnes/emulator/emulator.hpp @@ -31,7 +31,7 @@ using namespace nall; namespace Emulator { static const string Name = "bsnes"; - static const string Version = "108.5"; + static const string Version = "108.6"; static const string Author = "byuu"; static const string License = "GPLv3"; static const string Website = "https://byuu.org"; diff --git a/bsnes/sfc/cpu/memory.cpp b/bsnes/sfc/cpu/memory.cpp index 55a2227c..c63de17a 100644 --- a/bsnes/sfc/cpu/memory.cpp +++ b/bsnes/sfc/cpu/memory.cpp @@ -1,14 +1,12 @@ auto CPU::idle() -> void { - status.irqLock = false; status.clockCount = 6; dmaEdge(); step<6,0>(); + status.irqLock = 0; aluEdge(); } auto CPU::read(uint address) -> uint8 { - status.irqLock = false; - if(address & 0x408000) { if(address & 0x800000 && io.fastROM) { status.clockCount = 6; @@ -38,6 +36,7 @@ auto CPU::read(uint address) -> uint8 { step<8,1>(); } + status.irqLock = 0; auto data = bus.read(address, r.mdr); step<4,0>(); aluEdge(); @@ -47,7 +46,6 @@ auto CPU::read(uint address) -> uint8 { } auto CPU::write(uint address, uint8 data) -> void { - status.irqLock = false; aluEdge(); if(address & 0x408000) { @@ -79,6 +77,7 @@ auto CPU::write(uint address, uint8 data) -> void { step<12,1>(); } + status.irqLock = 0; bus.write(address, r.mdr = data); } diff --git a/bsnes/sfc/ppu-fast/mode7.cpp b/bsnes/sfc/ppu-fast/mode7.cpp index eb73a980..d54d9d13 100644 --- a/bsnes/sfc/ppu-fast/mode7.cpp +++ b/bsnes/sfc/ppu-fast/mode7.cpp @@ -43,8 +43,8 @@ auto PPU::Line::renderMode7(PPU::IO::Background& self, uint source) -> void { bool outOfBounds = (pixelX | pixelY) & ~1023; uint15 tileAddress = tileY * 128 + tileX; uint15 paletteAddress = ((pixelY & 7) << 3) + (pixelX & 7); - uint8_t tile = io.mode7.repeat == 3 && outOfBounds ? 0 : ppu.vram[tileAddress] >> 0; - uint8_t palette = io.mode7.repeat == 2 && outOfBounds ? 0 : ppu.vram[paletteAddress + (tile << 6)] >> 8; + uint8 tile = io.mode7.repeat == 3 && outOfBounds ? 0 : ppu.vram[tileAddress] >> 0; + uint8 palette = io.mode7.repeat == 2 && outOfBounds ? 0 : ppu.vram[tile << 6 | paletteAddress] >> 8; uint priority; if(source == Source::BG1) { diff --git a/bsnes/sfc/ppu/ppu.cpp b/bsnes/sfc/ppu/ppu.cpp index 0d8db633..c3b41ecc 100644 --- a/bsnes/sfc/ppu/ppu.cpp +++ b/bsnes/sfc/ppu/ppu.cpp @@ -140,7 +140,7 @@ auto PPU::power(bool reset) -> void { //$2102 OAMADDL //$2103 OAMADDH - io.oamBaseAddress = random(); + io.oamBaseAddress = random() & ~1; io.oamAddress = random(); io.oamPriority = random(); diff --git a/bsnes/sfc/ppu/ppu.hpp b/bsnes/sfc/ppu/ppu.hpp index 7a97e5f4..23dabb94 100644 --- a/bsnes/sfc/ppu/ppu.hpp +++ b/bsnes/sfc/ppu/ppu.hpp @@ -28,16 +28,16 @@ private: alwaysinline auto addressVRAM() const -> uint16; alwaysinline auto readVRAM() -> uint16; alwaysinline auto writeVRAM(bool byte, uint8 data) -> void; - alwaysinline auto readOAM(uint10 addr) -> uint8; - alwaysinline auto writeOAM(uint10 addr, uint8 data) -> void; - alwaysinline auto readCGRAM(bool byte, uint8 addr) -> uint8; - alwaysinline auto writeCGRAM(uint8 addr, uint15 data) -> void; - auto readIO(uint addr, uint8 data) -> uint8; - auto writeIO(uint addr, uint8 data) -> void; + alwaysinline auto readOAM(uint10 address) -> uint8; + alwaysinline auto writeOAM(uint10 address, uint8 data) -> void; + alwaysinline auto readCGRAM(bool byte, uint8 address) -> uint8; + alwaysinline auto writeCGRAM(uint8 address, uint15 data) -> void; + auto readIO(uint address, uint8 data) -> uint8; + auto writeIO(uint address, uint8 data) -> void; auto updateVideoMode() -> void; struct VRAM { - auto& operator[](uint addr) { return data[addr & mask]; } + auto& operator[](uint address) { return data[address & mask]; } uint16 data[64 * 1024]; uint16 mask = 0x7fff; } vram;