Skip to content

Commit

Permalink
Update to v102r02 release.
Browse files Browse the repository at this point in the history
byuu says:

Changelog:

  - I caved on the `samples[] = {0.0}` thing, but I'm very unhappy about it
      - if it's really invalid C++, then GCC needs to stop accepting it
        in strict `-std=c++14` mode
  - Emulator::Interface::Information::resettable is gone
  - Emulator::Interface::reset() is gone
  - FC, SFC, MD cores updated to remove soft reset behavior
  - split GameBoy::Interface into GameBoyInterface,
    GameBoyColorInterface
  - split WonderSwan::Interface into WonderSwanInterface,
    WonderSwanColorInterface
  - PCE: fixed off-by-one scanline error [hex_usr]
  - PCE: temporary hack to prevent crashing when VDS is set to < 2
  - hiro: Cocoa: removed (u)int(#) constants; converted (u)int(#)
    types to (u)int_(#)t types
  - icarus: replaced usage of unique with strip instead (so we don't
    mess up frameworks on macOS)
  - libco: added macOS-specific section marker [Ryphecha]

So ... the major news this time is the removal of the soft reset
behavior. This is a major!! change that results in a 100KiB diff file,
and it's very prone to accidental mistakes!! If anyone is up for
testing, or even better -- looking over the code changes between v102r01
and v102r02 and looking for any issues, please do so. Ideally we'll want
to test every NES mapper type and every SNES coprocessor type by loading
said games and power cycling to make sure the games are all cleanly
resetting. It's too big of a change for me to cover there not being any
issues on my own, but this is truly critical code, so yeah ... please
help if you can.

We technically lose a bit of hardware documentation here. The soft reset
events do all kinds of interesting things in all kinds of different
chips -- or at least they do on the SNES. This is obviously not ideal.
But in the process of removing these portions of code, I found a few
mistakes I had made previously. It simplifies resetting the system state
a lot when not trying to have all the power() functions call the reset()
functions to share partial functionality.

In the future, the goal will be to come up with a way to add back in the
soft reset behavior via keyboard binding as with the Master System core.
What's going to have to happen is that the key binding will have to send
a "reset pulse" to every emulated chip, and those chips are going to
have to act independently to power() instead of reusing functionality.
We'll get there eventually, but there's many things of vastly greater
importance to work on right now, so it'll be a while. The information
isn't lost ... we'll just have to pull it out of v102 when we are ready.

Note that I left the SNES reset vector simulation code in, even though
it's not possible to trigger, for the time being.

Also ... the Super Game Boy core is still disconnected. To be honest, it
totally slipped my mind when I released v102 that it wasn't connected
again yet. This one's going to be pretty tricky to be honest. I'm
thinking about making a third GameBoy::Interface class just for SGB, and
coming up with some way of bypassing platform-> calls when in this
mode.
  • Loading branch information
Screwtapello committed Jan 22, 2017
1 parent c40e975 commit bdc100e
Show file tree
Hide file tree
Showing 147 changed files with 854 additions and 893 deletions.
8 changes: 5 additions & 3 deletions higan/audio/audio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,15 @@ auto Audio::process() -> void {
if(!stream->pending()) return;
}

double samples[channels] = {0.0};
double samples[channels];
for(auto& sample : samples) sample = 0.0;

for(auto& stream : streams) {
double buffer[16];
uint length = stream->read(buffer), offset = 0;

for(auto c : range(channels)) {
samples[c] += buffer[offset];
for(auto& sample : samples) {
sample += buffer[offset];
if(++offset >= length) offset = 0;
}
}
Expand Down
2 changes: 1 addition & 1 deletion higan/emulator/emulator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ using namespace nall;

namespace Emulator {
static const string Name = "higan";
static const string Version = "102.01";
static const string Version = "102.02";
static const string Author = "byuu";
static const string License = "GPLv3";
static const string Website = "http://byuu.org/";
Expand Down
2 changes: 0 additions & 2 deletions higan/emulator/interface.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ struct Interface {
string manufacturer;
string name;
bool overscan;
bool resettable;
struct Capability {
bool states;
bool cheats;
Expand Down Expand Up @@ -75,7 +74,6 @@ struct Interface {
//system interface
virtual auto connect(uint port, uint device) -> void {}
virtual auto power() -> void {}
virtual auto reset() -> void {}
virtual auto run() -> void {}

//time functions
Expand Down
14 changes: 3 additions & 11 deletions higan/fc/apu/apu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ auto APU::setSample(int16 sample) -> void {
}

auto APU::power() -> void {
create(APU::Enter, system.colorburst() * 6.0);
stream = Emulator::audio.createStream(1, system.colorburst() / 2.0);

filter.hipassStrong = 0;
filter.hipassWeak = 0;
filter.lopass = 0;
Expand All @@ -85,17 +88,6 @@ auto APU::power() -> void {
triangle.power();
noise.power();
dmc.power();
}

auto APU::reset() -> void {
create(APU::Enter, system.colorburst() * 6.0);
stream = Emulator::audio.createStream(1, system.colorburst() / 2.0);

pulse[0].reset();
pulse[1].reset();
triangle.reset();
noise.reset();
dmc.reset();

frame.irqPending = 0;

Expand Down
7 changes: 0 additions & 7 deletions higan/fc/apu/apu.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ struct APU : Thread {
auto setSample(int16 sample) -> void;

auto power() -> void;
auto reset() -> void;

auto readIO(uint16 addr) -> uint8;
auto writeIO(uint16 addr, uint8 data) -> void;
Expand All @@ -36,7 +35,6 @@ struct APU : Thread {
auto clock() -> void;

auto power() -> void;
auto reset() -> void;

auto serialize(serializer&) -> void;

Expand All @@ -54,7 +52,6 @@ struct APU : Thread {
auto clock(uint channel) -> void;

auto power() -> void;
auto reset() -> void;

auto serialize(serializer&) -> void;

Expand All @@ -73,7 +70,6 @@ struct APU : Thread {
auto clock() -> uint8;

auto power() -> void;
auto reset() -> void;

auto serialize(serializer&) -> void;

Expand All @@ -95,7 +91,6 @@ struct APU : Thread {
auto clock() -> uint8;

auto power() -> void;
auto reset() -> void;

auto serialize(serializer&) -> void;

Expand All @@ -117,7 +112,6 @@ struct APU : Thread {
auto clock() -> uint8;

auto power() -> void;
auto reset() -> void;

auto serialize(serializer&) -> void;

Expand All @@ -138,7 +132,6 @@ struct APU : Thread {
auto clock() -> uint8;

auto power() -> void;
auto reset() -> void;

auto serialize(serializer&) -> void;

Expand Down
3 changes: 0 additions & 3 deletions higan/fc/apu/dmc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,6 @@ auto APU::DMC::clock() -> uint8 {
}

auto APU::DMC::power() -> void {
}

auto APU::DMC::reset() -> void {
lengthCounter = 0;
irqPending = 0;

Expand Down
3 changes: 0 additions & 3 deletions higan/fc/apu/envelope.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@ auto APU::Envelope::clock() -> void {
}

auto APU::Envelope::power() -> void {
}

auto APU::Envelope::reset() -> void {
speed = 0;
useSpeedAsVolume = 0;
loopMode = 0;
Expand Down
3 changes: 0 additions & 3 deletions higan/fc/apu/noise.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,6 @@ auto APU::Noise::clock() -> uint8 {
}

auto APU::Noise::power() -> void {
}

auto APU::Noise::reset() -> void {
lengthCounter = 0;

envelope.speed = 0;
Expand Down
5 changes: 0 additions & 5 deletions higan/fc/apu/pulse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,6 @@ auto APU::Pulse::clock() -> uint8 {
auto APU::Pulse::power() -> void {
envelope.power();
sweep.power();
}

auto APU::Pulse::reset() -> void {
envelope.reset();
sweep.reset();

lengthCounter = 0;

Expand Down
3 changes: 0 additions & 3 deletions higan/fc/apu/sweep.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,3 @@ auto APU::Sweep::power() -> void {
reload = 0;
pulsePeriod = 0;
}

auto APU::Sweep::reset() -> void {
}
4 changes: 0 additions & 4 deletions higan/fc/apu/triangle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,6 @@ auto APU::Triangle::clock() -> uint8 {
}

auto APU::Triangle::power() -> void {
reset();
}

auto APU::Triangle::reset() -> void {
lengthCounter = 0;

linearLength = 0;
Expand Down
3 changes: 0 additions & 3 deletions higan/fc/cartridge/board/board.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,6 @@ auto Board::writeCHR(uint addr, uint8 data) -> void {
auto Board::power() -> void {
}

auto Board::reset() -> void {
}

auto Board::serialize(serializer& s) -> void {
if(prgram.size) s.array(prgram.data, prgram.size);
if(chrram.size) s.array(chrram.data, chrram.size);
Expand Down
1 change: 0 additions & 1 deletion higan/fc/cartridge/board/board.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ struct Board {
virtual inline auto scanline(uint y) -> void {}

virtual auto power() -> void;
virtual auto reset() -> void;

virtual auto serialize(serializer&) -> void;

Expand Down
4 changes: 0 additions & 4 deletions higan/fc/cartridge/board/konami-vrc1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,6 @@ struct KonamiVRC1 : Board {
vrc1.power();
}

auto reset() -> void {
vrc1.reset();
}

auto serialize(serializer& s) -> void {
Board::serialize(s);
vrc1.serialize(s);
Expand Down
4 changes: 0 additions & 4 deletions higan/fc/cartridge/board/konami-vrc2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,6 @@ struct KonamiVRC2 : Board {
vrc2.power();
}

auto reset() -> void {
vrc2.reset();
}

auto serialize(serializer& s) -> void {
Board::serialize(s);
vrc2.serialize(s);
Expand Down
4 changes: 0 additions & 4 deletions higan/fc/cartridge/board/konami-vrc3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,6 @@ struct KonamiVRC3 : Board {
vrc3.power();
}

auto reset() -> void {
vrc3.reset();
}

auto serialize(serializer& s) -> void {
Board::serialize(s);
vrc3.serialize(s);
Expand Down
4 changes: 0 additions & 4 deletions higan/fc/cartridge/board/konami-vrc4.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,6 @@ struct KonamiVRC4 : Board {
vrc4.power();
}

auto reset() -> void {
vrc4.reset();
}

auto serialize(serializer& s) -> void {
Board::serialize(s);
vrc4.serialize(s);
Expand Down
1 change: 0 additions & 1 deletion higan/fc/cartridge/board/konami-vrc6.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ struct KonamiVRC6 : Board {

auto main() -> void { vrc6.main(); }
auto power() -> void { vrc6.power(); }
auto reset() -> void { vrc6.reset(); }

VRC6 vrc6;
};
4 changes: 0 additions & 4 deletions higan/fc/cartridge/board/konami-vrc7.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,6 @@ struct KonamiVRC7 : Board {
vrc7.power();
}

auto reset() -> void {
vrc7.reset();
}

auto serialize(serializer& s) -> void {
Board::serialize(s);
vrc7.serialize(s);
Expand Down
3 changes: 0 additions & 3 deletions higan/fc/cartridge/board/nes-axrom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,6 @@ struct NES_AxROM : Board {
}

auto power() -> void {
}

auto reset() -> void {
prgBank = 0x0f;
mirrorSelect = 0;
}
Expand Down
3 changes: 0 additions & 3 deletions higan/fc/cartridge/board/nes-bnrom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,6 @@ struct NES_BNROM : Board {
}

auto power() -> void {
}

auto reset() -> void {
prgBank = 0;
}

Expand Down
3 changes: 0 additions & 3 deletions higan/fc/cartridge/board/nes-cnrom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,6 @@ struct NES_CNROM : Board {
}

auto power() -> void {
}

auto reset() -> void {
chrBank = 0;
}

Expand Down
4 changes: 0 additions & 4 deletions higan/fc/cartridge/board/nes-exrom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,6 @@ struct NES_ExROM : Board {
mmc5.power();
}

auto reset() -> void {
mmc5.reset();
}

auto serialize(serializer& s) -> void {
Board::serialize(s);
mmc5.serialize(s);
Expand Down
3 changes: 0 additions & 3 deletions higan/fc/cartridge/board/nes-fxrom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,6 @@ struct NES_FxROM : Board {
}

auto power() -> void {
}

auto reset() -> void {
prgBank = 0;
chrBank[0][0] = 0;
chrBank[0][1] = 0;
Expand Down
3 changes: 0 additions & 3 deletions higan/fc/cartridge/board/nes-gxrom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,6 @@ struct NES_GxROM : Board {
}

auto power() -> void {
}

auto reset() -> void {
prgBank = 0;
chrBank = 0;
}
Expand Down
4 changes: 0 additions & 4 deletions higan/fc/cartridge/board/nes-hkrom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,6 @@ struct NES_HKROM : Board {
mmc6.power();
}

auto reset() -> void {
mmc6.reset();
}

auto serialize(serializer& s) -> void {
Board::serialize(s);
mmc6.serialize(s);
Expand Down
3 changes: 3 additions & 0 deletions higan/fc/cartridge/board/nes-nrom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ struct NES_NROM : Board {
if(chrram.size) return chrram.write(addr, data);
}

auto power() -> void {
}

auto serialize(serializer& s) -> void {
Board::serialize(s);
}
Expand Down
3 changes: 0 additions & 3 deletions higan/fc/cartridge/board/nes-pxrom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,6 @@ struct NES_PxROM : Board {
}

auto power() -> void {
}

auto reset() -> void {
prgBank = 0;
chrBank[0][0] = 0;
chrBank[0][1] = 0;
Expand Down
4 changes: 0 additions & 4 deletions higan/fc/cartridge/board/nes-sxrom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,6 @@ struct NES_SxROM : Board {
mmc1.power();
}

auto reset() -> void {
mmc1.reset();
}

auto serialize(serializer& s) -> void {
Board::serialize(s);
mmc1.serialize(s);
Expand Down
4 changes: 0 additions & 4 deletions higan/fc/cartridge/board/nes-txrom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,6 @@ struct NES_TxROM : Board {
mmc3.power();
}

auto reset() -> void {
mmc3.reset();
}

auto serialize(serializer& s) -> void {
Board::serialize(s);
mmc3.serialize(s);
Expand Down
3 changes: 0 additions & 3 deletions higan/fc/cartridge/board/nes-uxrom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,6 @@ struct NES_UxROM : Board {
}

auto power() -> void {
}

auto reset() -> void {
prgBank = 0;
}

Expand Down
Loading

0 comments on commit bdc100e

Please sign in to comment.