Two sprite fixes for the accurate PPU and Star Ocean.
This commit is contained in:
byuu 2019-10-06 18:11:53 +09:00
parent 78c76962ec
commit 0c82cc325e
6 changed files with 16 additions and 6 deletions

View File

@ -29,13 +29,13 @@ using namespace nall;
namespace Emulator {
static const string Name = "bsnes";
static const string Version = "111.1";
static const string Version = "111.2";
static const string Author = "byuu";
static const string License = "GPLv3";
static const string Website = "https://byuu.org";
//incremented only when serialization format changes
static const string SerializerVersion = "110";
static const string SerializerVersion = "111.2";
namespace Constants {
namespace Colorburst {

View File

@ -184,7 +184,7 @@ auto PPU::cycleRenderPixel() -> void {
template<uint Cycle>
auto PPU::cycle() -> void {
if constexpr(Cycle >= 0 && Cycle <= 1022 && (Cycle - 0) % 8 == 0) cycleObjectEvaluate();
if constexpr(Cycle >= 0 && Cycle <= 1016 && (Cycle - 0) % 8 == 0) cycleObjectEvaluate();
if constexpr(Cycle >= 0 && Cycle <= 1054 && (Cycle - 0) % 4 == 0) cycleBackgroundFetch<(Cycle - 0) / 4 & 7>();
if constexpr(Cycle == 56 ) cycleBackgroundBegin();
if constexpr(Cycle >= 56 && Cycle <= 1078 && (Cycle - 56) % 4 == 0) cycleBackgroundBelow();

View File

@ -15,6 +15,8 @@ auto PPU::Object::frame() -> void {
}
auto PPU::Object::scanline() -> void {
latch.firstSprite = io.firstSprite;
t.x = 0;
t.y = ppu.vcounter();
t.itemCount = 0;
@ -33,11 +35,12 @@ auto PPU::Object::scanline() -> void {
auto PPU::Object::evaluate(uint7 index) -> void {
if(ppu.io.displayDisable) return;
if(t.itemCount > 32) return;
auto oamItem = t.item[t.active];
auto oamTile = t.tile[t.active];
uint7 sprite = io.firstSprite + index;
uint7 sprite = latch.firstSprite + index;
if(!onScanline(oam.object[sprite])) return;
ppu.latch.oamAddress = sprite;
@ -95,7 +98,7 @@ auto PPU::Object::fetch() -> void {
for(uint i : reverse(range(32))) {
if(!oamItem[i].valid) continue;
if(ppu.io.displayDisable) {
if(ppu.io.displayDisable || ppu.vcounter() >= ppu.vdisp() - 1) {
ppu.step(8);
continue;
}
@ -209,6 +212,8 @@ auto PPU::Object::power() -> void {
io.timeOver = false;
io.rangeOver = false;
latch = {};
output.above.palette = 0;
output.above.priority = 0;
output.below.palette = 0;

View File

@ -50,6 +50,10 @@ struct Object {
uint1 rangeOver;
} io;
struct Latch {
uint7 firstSprite;
} latch;
struct Item {
uint1 valid;
uint7 index;

View File

@ -61,7 +61,6 @@ private:
uint vdisp;
} display;
// auto scanline() -> void;
auto refresh() -> void;
struct {

View File

@ -163,6 +163,8 @@ auto PPU::Object::serialize(serializer& s) -> void {
s.integer(io.timeOver);
s.integer(io.rangeOver);
s.integer(latch.firstSprite);
s.integer(t.x);
s.integer(t.y);