Update libsnes to v72

This commit is contained in:
Themaister 2010-11-20 14:20:06 +01:00
parent a0bd5b45b3
commit 3e96924d2f
13 changed files with 29 additions and 21 deletions

View File

@ -5,7 +5,7 @@ uint8 CPU::pio() {
}
bool CPU::joylatch() {
return 0;
return status.joypad_strobe_latch;
}
bool CPU::interrupt_pending() {

View File

@ -75,7 +75,7 @@ void PPU::render_line_mode7(uint8 pri0_pos, uint8 pri1_pos) {
palette = memory::vram[(((tile << 6) + ((py & 7) << 3) + (px & 7)) << 1) + 1];
} break;
case 2: { //palette color 0 outside of screen area
if(px < 0 || px > 1023 || py < 0 || py > 1023) {
if((px | py) & ~1023) {
palette = 0;
} else {
px &= 1023;
@ -87,7 +87,7 @@ void PPU::render_line_mode7(uint8 pri0_pos, uint8 pri1_pos) {
}
} break;
case 3: { //character 0 repetition outside of screen area
if(px < 0 || px > 1023 || py < 0 || py > 1023) {
if((px | py) & ~1023) {
tile = 0;
} else {
px &= 1023;

View File

@ -43,10 +43,10 @@ void PPU::Background::offset_per_tile(unsigned x, unsigned y, unsigned &hoffset,
void PPU::Background::scanline() {
if(self.vcounter() == 1) {
mosaic_vcounter = regs.mosaic + 1;
y = 1;
mosaic_voffset = 1;
} else if(--mosaic_vcounter == 0) {
mosaic_vcounter = regs.mosaic + 1;
y += regs.mosaic + 1;
mosaic_voffset += regs.mosaic + 1;
}
if(self.regs.display_disable) return;
@ -93,7 +93,7 @@ void PPU::Background::render() {
hscroll = regs.hoffset;
vscroll = regs.voffset;
unsigned y = Background::y;
unsigned y = (regs.mosaic == 0 ? self.vcounter() : mosaic_voffset);
if(hires) {
hscroll <<= 1;
if(self.regs.interlace) y = (y << 1) + self.field();

View File

@ -31,7 +31,6 @@ struct Background {
const unsigned id;
unsigned opt_valid_bit;
unsigned y;
bool hires;
signed width;
@ -48,6 +47,7 @@ struct Background {
unsigned vscroll;
unsigned mosaic_vcounter;
unsigned mosaic_voffset;
LayerWindow window;

View File

@ -49,7 +49,7 @@ void PPU::Background::render_mode7() {
}
case 2: {
if(px < 0 || px > 1023 || py < 0 || py > 1023) {
if((px | py) & ~1023) {
palette = 0;
} else {
px &= 1023;
@ -63,7 +63,7 @@ void PPU::Background::render_mode7() {
}
case 3: {
if(px < 0 || px > 1023 || py < 0 || py > 1023) {
if((px | py) & ~1023) {
tile = 0;
} else {
px &= 1023;

View File

@ -283,7 +283,7 @@ void PPU::mmio_write(unsigned addr, uint8 data) {
switch(addr & 0xffff) {
case 0x2100: { //INIDISP
if(regs.display_disable && vcounter() == display.height) oam.address_reset();
if(regs.display_disable && cpu.vcounter() == display.height) oam.address_reset();
regs.display_disable = data & 0x80;
regs.display_brightness = data & 0x0f;
return;

View File

@ -115,7 +115,6 @@ void PPU::Background::serialize(serializer &s) {
s.integer(regs.main_enable);
s.integer(regs.sub_enable);
s.integer(y);
s.integer(hires);
s.integer(width);
@ -132,6 +131,7 @@ void PPU::Background::serialize(serializer &s) {
s.integer(vscroll);
s.integer(mosaic_vcounter);
s.integer(mosaic_voffset);
window.serialize(s);
}

View File

@ -17,9 +17,11 @@ Dsp1::Dsp1()
uint8 Dsp1::getSr()
{
mSrLowByteAccess = ~mSrLowByteAccess;
if (mSrLowByteAccess)
return 0;
else
//Overload: only high 8-bits are accessible externally
//this is required for "Ace wo Nerae!"
// if (mSrLowByteAccess)
// return 0;
// else
return mSr;
}

View File

@ -100,8 +100,8 @@ private:
uint8 wrdivb;
//$4207-$420a
uint10 hirq_pos;
uint10 virq_pos;
uint9 hirq_pos;
uint9 virq_pos;
//$420d
unsigned rom_speed;

View File

@ -38,7 +38,7 @@ unsigned snes_library_revision_major(void) {
}
unsigned snes_library_revision_minor(void) {
return 0;
return 1;
}
void snes_set_video_refresh(snes_video_refresh_t video_refresh) {
@ -61,6 +61,10 @@ void snes_set_controller_port_device(bool port, unsigned device) {
SNES::input.port_set_device(port, (SNES::Input::Device::e)device);
}
void snes_set_cartridge_basename(const char *basename) {
SNES::cartridge.basename = basename;
}
void snes_init(void) {
SNES::system.init(&interface);
SNES::input.port_set_device(0, SNES::Input::Device::Joypad);

View File

@ -205,6 +205,7 @@ void snes_set_input_state(snes_input_state_t);
it safe to call this method from inside the input state callback?
*/
void snes_set_controller_port_device(bool port, unsigned device);
void snes_set_cartridge_basename(const char *basename);
// Initializes library
void snes_init(void);

View File

@ -1,8 +1,8 @@
namespace SNES {
namespace Info {
static const char Name[] = "bsnes";
static const char Version[] = "070";
static const unsigned SerializerVersion = 13;
static const char Version[] = "072";
static const unsigned SerializerVersion = 14;
}
}

View File

@ -92,6 +92,9 @@ void System::init(Interface *interface_) {
video.init();
audio.init();
input.init();
input.port_set_device(0, config.controller_port1.i);
input.port_set_device(1, config.controller_port2.i);
}
void System::term() {
@ -173,8 +176,6 @@ void System::power() {
scheduler.init();
input.port_set_device(0, config.controller_port1.i);
input.port_set_device(1, config.controller_port2.i);
input.update();
//video.update();
}