From 6c3aec7dc96affaf7ef7d1ea4b293407f2309f91 Mon Sep 17 00:00:00 2001 From: Tim Allen Date: Fri, 22 Oct 2010 20:54:59 +1100 Subject: [PATCH] Update to v071 release. byuu says (since v070): - fixed a regression in the accuracy/compatibility CPU core with IRQ masking; fixes World Heroes 2 - fixed OAM address reset on $2100 writes for performance PPU core; fixes Mahjongg 2 and others - DSP-1 always returns high 8-bits of status register; fixes Ace wo Nerae! freeze [Jonas Quinn] - performance core can now take advantage of serial support - pixel shaders now use a unified XML format; in the future they will support multi-pass shaders and textures - major code restructuring - first public release of phoenix GUI port - mightymo's cheat code pack is now an external file for the phoenix port - phoenix port stores cheat codes in XML format as well, unifying all file formats to the same markup language --- bsnes/Makefile | 2 +- .../alt/ppu-compatibility/render/mode7.cpp | 4 +- .../alt/ppu-performance/background/mode7.cpp | 4 +- bsnes/snes/alt/ppu-performance/mmio/mmio.cpp | 2 +- bsnes/snes/libsnes/libsnes.cpp | 6 +- bsnes/snes/libsnes/libsnes.hpp | 1 + bsnes/snes/snes.hpp | 2 +- bsnes/ui-phoenix/input/hotkeys.cpp | 55 ++++++++++++++++++- 8 files changed, 65 insertions(+), 11 deletions(-) diff --git a/bsnes/Makefile b/bsnes/Makefile index 1e08781e..a820d46f 100755 --- a/bsnes/Makefile +++ b/bsnes/Makefile @@ -1,6 +1,6 @@ include nall/Makefile snes := snes -profile := performance +profile := accuracy ui := ui-phoenix # compiler diff --git a/bsnes/snes/alt/ppu-compatibility/render/mode7.cpp b/bsnes/snes/alt/ppu-compatibility/render/mode7.cpp index b233efc8..dc4d747c 100755 --- a/bsnes/snes/alt/ppu-compatibility/render/mode7.cpp +++ b/bsnes/snes/alt/ppu-compatibility/render/mode7.cpp @@ -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; diff --git a/bsnes/snes/alt/ppu-performance/background/mode7.cpp b/bsnes/snes/alt/ppu-performance/background/mode7.cpp index 026c4dae..0f3c09c5 100755 --- a/bsnes/snes/alt/ppu-performance/background/mode7.cpp +++ b/bsnes/snes/alt/ppu-performance/background/mode7.cpp @@ -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; diff --git a/bsnes/snes/alt/ppu-performance/mmio/mmio.cpp b/bsnes/snes/alt/ppu-performance/mmio/mmio.cpp index 06a5eb21..ab0ac597 100755 --- a/bsnes/snes/alt/ppu-performance/mmio/mmio.cpp +++ b/bsnes/snes/alt/ppu-performance/mmio/mmio.cpp @@ -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; diff --git a/bsnes/snes/libsnes/libsnes.cpp b/bsnes/snes/libsnes/libsnes.cpp index 63fc6252..494bc0b3 100755 --- a/bsnes/snes/libsnes/libsnes.cpp +++ b/bsnes/snes/libsnes/libsnes.cpp @@ -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)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); diff --git a/bsnes/snes/libsnes/libsnes.hpp b/bsnes/snes/libsnes/libsnes.hpp index d895adb8..25328c10 100755 --- a/bsnes/snes/libsnes/libsnes.hpp +++ b/bsnes/snes/libsnes/libsnes.hpp @@ -74,6 +74,7 @@ void snes_set_input_poll(snes_input_poll_t); void snes_set_input_state(snes_input_state_t); void snes_set_controller_port_device(bool port, unsigned device); +void snes_set_cartridge_basename(const char *basename); void snes_init(void); void snes_term(void); diff --git a/bsnes/snes/snes.hpp b/bsnes/snes/snes.hpp index 44b35103..33c6e7b5 100755 --- a/bsnes/snes/snes.hpp +++ b/bsnes/snes/snes.hpp @@ -1,7 +1,7 @@ namespace SNES { namespace Info { static const char Name[] = "bsnes"; - static const char Version[] = "070.17"; + static const char Version[] = "071"; static const unsigned SerializerVersion = 14; } } diff --git a/bsnes/ui-phoenix/input/hotkeys.cpp b/bsnes/ui-phoenix/input/hotkeys.cpp index 14b98700..df79be1c 100755 --- a/bsnes/ui-phoenix/input/hotkeys.cpp +++ b/bsnes/ui-phoenix/input/hotkeys.cpp @@ -1,5 +1,54 @@ void InputMapper::poll_hotkeys(unsigned scancode, int16_t value) { - if(value == 0) return; - if(scancode == keyboard(0)[Keyboard::Escape]) input.unacquire(); - if(mainWindow.focused() == false) return; + //internal state + static unsigned activeSlot = 1; + static bool videoSync = false; + static bool audioSync = false; + + if(value) { + //key pressed + if(scancode == keyboard(0)[Keyboard::Escape]) input.unacquire(); + if(mainWindow.focused() == false) return; + + //save states + if(scancode == keyboard(0)[Keyboard::F5]) { + utility.saveState(activeSlot); + } + + if(scancode == keyboard(0)[Keyboard::F7]) { + utility.loadState(activeSlot); + } + + if(scancode == keyboard(0)[Keyboard::F6]) { + activeSlot = (activeSlot == 1 ? 5 : activeSlot - 1); + utility.showMessage({ "Slot ", activeSlot, " selected" }); + } + + if(scancode == keyboard(0)[Keyboard::F8]) { + activeSlot = (activeSlot == 5 ? 1 : activeSlot + 1); + utility.showMessage({ "Slot ", activeSlot, " selected" }); + } + + //fast forward + if(scancode == keyboard(0)[Keyboard::Tilde]) { + videoSync = config.video.synchronize; + audioSync = config.audio.synchronize; + video.set(Video::Synchronize, config.video.synchronize = false); + audio.set(Audio::Synchronize, config.audio.synchronize = false); + #if defined(PROFILE_COMPATIBILITY) || defined(PROFILE_PERFORMANCE) + SNES::ppu.set_frameskip(9); + #endif + } + } else { + //key released + if(mainWindow.focused() == false) return; + + //fast forward + if(scancode == keyboard(0)[Keyboard::Tilde]) { + video.set(Video::Synchronize, config.video.synchronize = videoSync); + audio.set(Audio::Synchronize, config.audio.synchronize = audioSync); + #if defined(PROFILE_COMPATIBILITY) || defined(PROFILE_PERFORMANCE) + SNES::ppu.set_frameskip(0); + #endif + } + } }