mirror of https://github.com/bsnes-emu/bsnes.git
Update to v077r01 release.
byuu says: Changelog: - fixed auto joypad polling bug (fixes Super Star Wars start button input) - added pseudo-random class; so far it is RAM only [WRAM, APURAM, VRAM, OAM, CGRAM] - added new system configuration options to bsnes.cfg The pseudo-random class is optional. For right now, I am defaulting it to enabled. bsnes.cfg::snes.random = true. You can of course turn it off if you want. This will break Death Brade and Unnamed Euro Racer, no questions about it. So I don't know if I want to leave this on or off by default. Leaving it on will thwart emulator detection code and help to keep code that relies on uninitialized memory from working, but leaving it off will increase compatibility.
This commit is contained in:
parent
9ea35ce569
commit
a92a554d7b
|
@ -5,7 +5,7 @@ profile := accuracy
|
|||
ui := ui
|
||||
|
||||
# debugger
|
||||
options :=
|
||||
options := debugger
|
||||
|
||||
# compiler
|
||||
c := $(compiler) -std=gnu99
|
||||
|
|
|
@ -73,7 +73,7 @@ void APU::Wave::power() {
|
|||
frequency = 0;
|
||||
counter = 0;
|
||||
|
||||
random_cyclic r;
|
||||
random_lfsr r;
|
||||
foreach(n, pattern) n = r() & 15;
|
||||
|
||||
output = 0;
|
||||
|
|
|
@ -8,12 +8,20 @@ namespace nall {
|
|||
return n = (n >> 1) ^ (((n & 1) - 1) & 0xedb88320);
|
||||
}
|
||||
|
||||
struct random_cyclic {
|
||||
unsigned seed;
|
||||
inline unsigned operator()() {
|
||||
return seed = (seed >> 1) ^ (((seed & 1) - 1) & 0xedb88320);
|
||||
struct random_lfsr {
|
||||
inline void seed(unsigned seed__) {
|
||||
seed_ = seed__;
|
||||
}
|
||||
random_cyclic() : seed(0) {}
|
||||
|
||||
inline unsigned operator()() {
|
||||
return seed_ = (seed_ >> 1) ^ (((seed_ & 1) - 1) & 0xedb88320);
|
||||
}
|
||||
|
||||
random_lfsr() : seed_(0) {
|
||||
}
|
||||
|
||||
private:
|
||||
unsigned seed_;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@ Configuration::Configuration() {
|
|||
controller_port2 = Input::Device::Joypad;
|
||||
expansion_port = System::ExpansionPortDevice::BSX;
|
||||
region = System::Region::Autodetect;
|
||||
random = true;
|
||||
|
||||
cpu.version = 2;
|
||||
cpu.ntsc_frequency = 21477272; //315 / 88 * 6000000
|
||||
|
|
|
@ -3,6 +3,7 @@ struct Configuration {
|
|||
Input::Device controller_port2;
|
||||
System::ExpansionPortDevice expansion_port;
|
||||
System::Region region;
|
||||
bool random;
|
||||
|
||||
struct CPU {
|
||||
unsigned version;
|
||||
|
|
|
@ -124,7 +124,7 @@ void CPU::enable() {
|
|||
|
||||
void CPU::power() {
|
||||
cpu_version = config.cpu.version;
|
||||
foreach(n, wram) n = config.cpu.wram_init_value;
|
||||
foreach(n, wram) n = random(config.cpu.wram_init_value);
|
||||
|
||||
regs.a = regs.x = regs.y = 0x0000;
|
||||
regs.s = 0x01ff;
|
||||
|
|
|
@ -2,18 +2,12 @@
|
|||
|
||||
//called every 256 clocks; see CPU::add_clocks()
|
||||
void CPU::step_auto_joypad_poll() {
|
||||
if(vcounter() >= (ppu.overscan() == false ? 225 : 240) && status.auto_joypad_counter <= 16) {
|
||||
if(status.auto_joypad_counter == 0) {
|
||||
status.auto_joypad_active = true;
|
||||
input.poll();
|
||||
} else if(status.auto_joypad_counter == 16) {
|
||||
status.auto_joypad_active = false;
|
||||
return;
|
||||
}
|
||||
if(vcounter() >= (ppu.overscan() == false ? 225 : 240)) {
|
||||
status.auto_joypad_active = status.auto_joypad_counter <= 15;
|
||||
|
||||
status.auto_joypad_counter++;
|
||||
if(status.auto_joypad_active && status.auto_joypad_poll) {
|
||||
if(status.auto_joypad_counter == 0) input.poll();
|
||||
|
||||
if(status.auto_joypad_poll) {
|
||||
uint8 port0 = input.port_read(0);
|
||||
uint8 port1 = input.port_read(1);
|
||||
|
||||
|
@ -22,6 +16,8 @@ void CPU::step_auto_joypad_poll() {
|
|||
status.joy3 = (status.joy3 << 1) | (bool)(port0 & 2);
|
||||
status.joy4 = (status.joy4 << 1) | (bool)(port1 & 2);
|
||||
}
|
||||
|
||||
status.auto_joypad_counter++;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -91,9 +91,9 @@ void PPU::power() {
|
|||
ppu1_version = config.ppu1.version;
|
||||
ppu2_version = config.ppu2.version;
|
||||
|
||||
foreach(n, vram) n = 0x00;
|
||||
foreach(n, oam) n = 0x00;
|
||||
foreach(n, cgram) n = 0x00;
|
||||
foreach(n, vram) n = random(0x00);
|
||||
foreach(n, oam) n = random(0x00);
|
||||
foreach(n, cgram) n = random(0x00);
|
||||
|
||||
reset();
|
||||
}
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
Random random;
|
||||
|
||||
void Random::seed(unsigned seed_iter) {
|
||||
iter = seed_iter;
|
||||
}
|
||||
|
||||
unsigned Random::operator()(unsigned result) {
|
||||
if(config.random == false) return result;
|
||||
return iter = (iter >> 1) ^ (((iter & 1) - 1) & 0xedb88320);
|
||||
}
|
||||
|
||||
void Random::serialize(serializer &s) {
|
||||
s.integer(iter);
|
||||
}
|
||||
|
||||
Random::Random() {
|
||||
iter = 0;
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
struct Random {
|
||||
void seed(unsigned seed);
|
||||
unsigned operator()(unsigned result = 0);
|
||||
void serialize(serializer&);
|
||||
Random();
|
||||
|
||||
private:
|
||||
unsigned iter;
|
||||
};
|
||||
|
||||
extern Random random;
|
|
@ -71,7 +71,7 @@ void SMP::reset() {
|
|||
regs.sp = 0xef;
|
||||
regs.p = 0x02;
|
||||
|
||||
foreach(n, apuram) n = 0x00;
|
||||
foreach(n, apuram) n = random(0x00);
|
||||
|
||||
status.clock_counter = 0;
|
||||
status.dsp_counter = 0;
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
namespace SNES {
|
||||
namespace Info {
|
||||
static const char Name[] = "bsnes";
|
||||
static const char Version[] = "077";
|
||||
static const unsigned SerializerVersion = 18;
|
||||
static const char Version[] = "077.01";
|
||||
static const unsigned SerializerVersion = 19;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -51,6 +51,7 @@ void System::serialize(serializer &s) {
|
|||
void System::serialize_all(serializer &s) {
|
||||
cartridge.serialize(s);
|
||||
system.serialize(s);
|
||||
random.serialize(s);
|
||||
cpu.serialize(s);
|
||||
smp.serialize(s);
|
||||
ppu.serialize(s);
|
||||
|
|
|
@ -8,6 +8,7 @@ System system;
|
|||
#include <snes/config/config.cpp>
|
||||
#include <snes/debugger/debugger.cpp>
|
||||
#include <snes/scheduler/scheduler.cpp>
|
||||
#include <snes/random/random.cpp>
|
||||
|
||||
#include <snes/video/video.cpp>
|
||||
#include <snes/audio/audio.cpp>
|
||||
|
@ -147,6 +148,8 @@ void System::unload() {
|
|||
}
|
||||
|
||||
void System::power() {
|
||||
random.seed(0x62797575);
|
||||
|
||||
region = config.region;
|
||||
expansion = config.expansion_port;
|
||||
if(region == Region::Autodetect) {
|
||||
|
|
|
@ -51,5 +51,6 @@ private:
|
|||
#include <snes/config/config.hpp>
|
||||
#include <snes/debugger/debugger.hpp>
|
||||
#include <snes/scheduler/scheduler.hpp>
|
||||
#include <snes/random/random.hpp>
|
||||
|
||||
extern System system;
|
||||
|
|
|
@ -9,6 +9,16 @@ void Configuration::save() {
|
|||
}
|
||||
|
||||
void Configuration::create() {
|
||||
attach(SNES::config.random, "snes.random");
|
||||
attach(SNES::config.cpu.version, "snes.cpu.version");
|
||||
attach(SNES::config.cpu.ntsc_frequency, "snes.cpu.ntscFrequency");
|
||||
attach(SNES::config.cpu.pal_frequency, "snes.cpu.palFrequency");
|
||||
attach(SNES::config.smp.ntsc_frequency, "snes.smp.ntscFrequency");
|
||||
attach(SNES::config.smp.pal_frequency, "snes.smp.palFrequency");
|
||||
attach(SNES::config.ppu1.version, "snes.ppu1.version");
|
||||
attach(SNES::config.ppu2.version, "snes.ppu2.version");
|
||||
attach(SNES::config.superfx.speed, "snes.superfx.speed");
|
||||
|
||||
attach(video.driver = "", "video.driver");
|
||||
attach(video.synchronize = false, "video.synchronize");
|
||||
attach(video.smooth = true, "video.smooth");
|
||||
|
|
Loading…
Reference in New Issue