2012-04-29 06:16:44 +00:00
|
|
|
#include <sfc/sfc.hpp>
|
2010-08-09 13:28:56 +00:00
|
|
|
|
2012-04-26 10:51:13 +00:00
|
|
|
namespace SuperFamicom {
|
2010-08-09 13:28:56 +00:00
|
|
|
|
2016-06-05 05:03:21 +00:00
|
|
|
#include "bus.cpp"
|
|
|
|
#include "core.cpp"
|
|
|
|
#include "memory.cpp"
|
Update to v099r13 release.
byuu says:
Changelog:
- GB core code cleanup completed
- GBA core code cleanup completed
- some more cleanup on missed processor/arm functions/variables
- fixed FC loading icarus bug
- "Load ROM File" icarus functionality restored
- minor code unification efforts all around (not perfect yet)
- MMIO->IO
- mmio.cpp->io.cpp
- read,write->readIO,writeIO
It's been a very long work in progress ... starting all the way back with
v094r09, but the major part of the higan code cleanup is now completed! Of
course, it's very important to note that this is only for the basic style:
- under_score functions and variables are now camelCase
- return-type function-name() are now auto function-name() -> return-type
- Natural<T>/Integer<T> replace (u)intT_n types where possible
- signed/unsigned are now int/uint
- most of the x==true,x==false tests changed to x,!x
A lot of spot improvements to consistency, simplicity and quality have
gone in along the way, of course. But we'll probably never fully finishing
beautifying every last line of code in the entire codebase. Still,
this is a really great start. Going forward, WIP diffs should start
being smaller and of higher quality once again.
I know the joke is, "until my coding style changes again", but ... this
was way too stressful, way too time consuming, and way too risky. I'm
too old and tired now for extreme upheavel like this again. The only
major change I'm slowly mulling over would be renaming the using
Natural<T>/Integer<T> = (u)intT; shorthand to something that isn't as
easily confused with the (u)int_t types ... but we'll see. I'll definitely
continue to change small things all the time, but for the larger picture,
I need to just accept the style I have and live with it.
2016-06-29 11:10:28 +00:00
|
|
|
#include "io.cpp"
|
2016-06-05 05:03:21 +00:00
|
|
|
#include "timing.cpp"
|
2010-08-09 13:28:56 +00:00
|
|
|
#include "serialization.cpp"
|
|
|
|
SuperFX superfx;
|
|
|
|
|
2015-06-27 02:38:47 +00:00
|
|
|
auto SuperFX::Enter() -> void {
|
2016-02-09 11:51:12 +00:00
|
|
|
while(true) scheduler.synchronize(), superfx.main();
|
2015-06-27 02:38:47 +00:00
|
|
|
}
|
2010-08-09 13:28:56 +00:00
|
|
|
|
2016-02-09 11:51:12 +00:00
|
|
|
auto SuperFX::main() -> void {
|
|
|
|
if(regs.sfr.g == 0) return step(6);
|
2016-06-05 22:10:01 +00:00
|
|
|
|
Update to v098r13 release.
byuu says:
Changelog:
- nall/dsp returns with new iir/biquad.hpp and resampler/cubic.hpp files
- nall/queue.hpp added (simple ring buffer ... nall/vector wouldn't
cause too many moves with FIFO)
- audio streams now only buffer 20ms; so even if multiple audio streams
desync, latency can never exceed 20ms
- replaced blackman windwed sinc FIR hermite audio filter with transposed
direct form II biquadratic sixth-order IIR butterworth filter (better
attenuation of frequencies above 20KHz, faster, no need for decimation,
less code)
- put in experimental eight-tap echo filter (a lot better than what I
had before, but still rather weak)
- substantial cleanups to the SuperFX GSU processor core (slightly
faster, 479KB->100KB object file, 42.7KB->33.4KB source code size,
way less code duplication)
We'll definitely want to test the whole SuperFX library (not many games)
just to make sure there's no regressions caused by this one.
Not sure what I want to do with audio processing effects yet. I've always
really wanted lots of fun controls to customize audio, and now finally
with this new biquad filter, I can finally start implementing real
effects. For instance, an equalizer wouldn't be too complicated anymore.
The new reverb effect is still a poor man's version. I need to find human
readable source for implementing a comb-filter properly. I'm pretty sure
I can already treat nall::queue as an all-pass filter since all that
does is phase shift (fancy audio term for "delay audio"). What's really
going to be hard is figuring out how to expose user-friendly settings for
controlling it. It looks like you need a bunch of coprime coefficients,
and I don't think casual users are going to be able to hand-enter coprime
values to get the echo effect they want. I uh ... don't even know how
to calculate coprime values dynamically right now >_> But we're going
to have to, as they are correlated to the output sampling rate.
We'll definitely want to make some audio profiles so that users can
quickly select pre-configured themes that sound nice, but expose the
underlying coefficients so that they can tweak stuff to their liking. This
isn't just about higan, this is about me trying to learn digital signal
processing, so please don't be too upset about feature creep or anything
on this.
Anyway ... I'm having some difficulties with my audio right now. When
the reverb effect is enabled, there's a bunch of static on system
reset for just a moment. But this should not be possible. nall::queue
is initializing all previous reverb sample elements to 0.0. I don't
understand where static is coming in from. Further, we have the same
issue with both the windowed sinc and the biquad filters ... a bit of
a popping sound when starting a game. Any help tracking this down would
be appreciated.
There's also one really annoying issue ... I can't seem to do reverb
or volume adjustments with normalized samples. If I say "volume *= 0.5"
in higan/audio/audio.cpp line 68, it doesn't just halve the volume, it
adds a whole bunch of distortion. This makes absolutely zero sense to
me. The sample values are between 0.0 (mute) and 1.0 (full volume) here,
so multiplying a double by 0.5 shouldn't cause distortion. So right now,
I'm doing these adjustments with less precision after denormalizing back
to int16. Anyone ever see something like that? :/
2016-05-31 22:29:36 +00:00
|
|
|
instruction(peekpipe());
|
2016-06-05 22:10:01 +00:00
|
|
|
|
|
|
|
if(regs.r[14].modified) {
|
|
|
|
regs.r[14].modified = false;
|
|
|
|
updateROMBuffer();
|
|
|
|
}
|
|
|
|
|
|
|
|
if(regs.r[15].modified) {
|
|
|
|
regs.r[15].modified = false;
|
|
|
|
} else {
|
|
|
|
regs.r[15]++;
|
|
|
|
}
|
2010-08-09 13:28:56 +00:00
|
|
|
}
|
|
|
|
|
2015-06-27 02:38:47 +00:00
|
|
|
auto SuperFX::init() -> void {
|
2010-08-09 13:28:56 +00:00
|
|
|
}
|
|
|
|
|
2015-06-27 02:38:47 +00:00
|
|
|
auto SuperFX::load() -> void {
|
Update to v075 release.
byuu says:
This release brings improved Super Game Boy emulation, the final SHA256
hashes for the DSP-(1,1B,2,3,4) and ST-(0010,0011) coprocessors, user
interface improvements, and major internal code restructuring.
Changelog (since v074):
- completely rewrote memory sub-system to support 1-byte granularity in
XML mapping
- removed Memory inheritance and MMIO class completely, any address can
be mapped to any function now
- SuperFX: removed SuperFXBus : Bus, now implemented manually
- SA-1: removed SA1Bus : Bus, now implemented manually
- entire bus mapping is now static, happens once on cartridge load
- as a result, read/write handlers now handle MMC mapping; slower
average case, far faster worst case
- namespace memory is no more, RAM arrays are stored inside the chips
they are owned by now
- GameBoy: improved CPU HALT emulation, fixes Zelda: Link's Awakening
scrolling
- GameBoy: added serial emulation (cannot connect to another GB yet),
fixes Shin Megami Tensei - Devichil
- GameBoy: improved LCD STAT emulation, fixes Sagaia
- ui: added fullscreen support (F11 key), video settings allows for
three scale settings
- ui: fixed brightness, contrast, gamma, audio volume, input frequency
values on program startup
- ui: since Qt is dead, config file becomes bsnes.cfg once again
- Super Game Boy: you can now load the BIOS without a game inserted to
see a pretty white box
- ui-gameboy: can be built without SNES components now
- libsnes: now a UI target, compile with 'make ui=ui-libsnes'
- libsnes: added WRAM, APURAM, VRAM, OAM, CGRAM access (cheat search,
etc)
- source: removed launcher/, as the Qt port is now gone
- source: Makefile restructuring to better support new ui targets
- source: lots of other internal code cleanup work
2011-01-27 08:52:34 +00:00
|
|
|
}
|
|
|
|
|
2015-06-27 02:38:47 +00:00
|
|
|
auto SuperFX::unload() -> void {
|
2012-07-09 11:40:23 +00:00
|
|
|
rom.reset();
|
|
|
|
ram.reset();
|
2010-08-09 13:28:56 +00:00
|
|
|
}
|
|
|
|
|
2015-06-27 02:38:47 +00:00
|
|
|
auto SuperFX::power() -> void {
|
2012-04-29 06:16:44 +00:00
|
|
|
GSU::power();
|
2016-07-10 05:28:26 +00:00
|
|
|
create(SuperFX::Enter, system.colorburst() * 6.0);
|
2016-06-05 22:10:01 +00:00
|
|
|
|
|
|
|
romMask = rom.size() - 1;
|
|
|
|
ramMask = ram.size() - 1;
|
|
|
|
|
|
|
|
for(uint n : range(512)) cache.buffer[n] = 0x00;
|
|
|
|
for(uint n : range(32)) cache.valid[n] = false;
|
|
|
|
for(uint n : range(2)) {
|
|
|
|
pixelcache[n].offset = ~0;
|
|
|
|
pixelcache[n].bitpend = 0x00;
|
|
|
|
}
|
|
|
|
|
|
|
|
regs.romcl = 0;
|
|
|
|
regs.romdr = 0;
|
|
|
|
|
|
|
|
regs.ramcl = 0;
|
|
|
|
regs.ramar = 0;
|
|
|
|
regs.ramdr = 0;
|
2010-08-09 13:28:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|