2015-11-10 11:02:29 +00:00
|
|
|
//Sony CXD1222Q-1
|
|
|
|
|
Update to v097r02 release.
byuu says:
Note: balanced/performance profiles still broken, sorry.
Changelog:
- added nall/GNUmakefile unique() function; used on linking phase of
higan
- added nall/unique_pointer
- target-tomoko and {System}::Video updated to use
unique_pointer<ClassName> instead of ClassName* [1]
- locate() updated to search multiple paths [2]
- GB: pass gekkio's if_ie_registers and boot_hwio-G test ROMs
- FC, GB, GBA: merge video/ into the PPU cores
- ruby: fixed ~AudioXAudio2() typo
[1] I expected this to cause new crashes on exit due to changing the
order of destruction of objects (and deleting things that weren't
deleted before), but ... so far, so good. I guess we'll see what crops
up, especially on OS X (which is already crashing for unknown reasons on
exit.)
[2] right now, the search paths are: programpath(), {configpath(),
"higan/"}, {localpath(), "higan/"}; but we can add as many more as we
want, and we can also add platform-specific versions.
2016-01-25 11:27:18 +00:00
|
|
|
#include "audio.hpp"
|
|
|
|
|
2012-03-23 10:43:39 +00:00
|
|
|
struct DSP : Thread {
|
Updated to v067r21 release.
byuu says:
This moves toward a profile-selection mode. Right now, it is incomplete.
There are three binaries, one for each profile. The GUI selection
doesn't actually do anything yet. There will be a launcher in a future
release that loads each profile's respective binary.
I reverted away from blargg's SMP library for the time being, in favor
of my own. This will fix most of the csnes/bsnes-performance bugs. This
causes a 10% speed hit on 64-bit platforms, and a 15% speed hit on
32-bit platforms. I hope to be able to regain that speed in the future,
I may also experiment with creating my own fast-SMP core which drops bus
hold delays and TEST register support (never used by anything, ever.)
Save states now work in all three cores, but they are not
cross-compatible. The profile name is stored in the description field of
the save states, and it won't load a state if the profile name doesn't
match.
The debugger only works on the research target for now. Give it time and
it will return for the other targets.
Other than that, let's please resume testing on all three once again.
See how far we get this time :)
I can confirm the following games have issues on the performance
profile:
- Armored Police Metal Jacket (minor logo flickering, not a big deal)
- Chou Aniki (won't start, so obviously unplayable)
- Robocop vs The Terminator (major in-game flickering, unplayable)
Anyone still have that gigantic bsnes thread archive from the ZSNES
forum? Maybe I posted about how to fix those two broken games in there,
heh.
I really want to release this as v1.0, but my better judgment says we
need to give it another week. Damn.
2010-10-20 11:22:44 +00:00
|
|
|
enum : bool { Threaded = true };
|
2010-08-09 13:28:56 +00:00
|
|
|
|
2015-10-10 02:16:12 +00:00
|
|
|
DSP();
|
2010-08-09 13:28:56 +00:00
|
|
|
|
2016-01-23 07:29:34 +00:00
|
|
|
alwaysinline auto step(uint clocks) -> void;
|
2015-10-10 02:16:12 +00:00
|
|
|
alwaysinline auto synchronizeSMP() -> void;
|
2010-08-09 13:28:56 +00:00
|
|
|
|
2015-10-10 02:16:12 +00:00
|
|
|
auto mute() const -> bool;
|
|
|
|
auto read(uint8 addr) -> uint8;
|
|
|
|
auto write(uint8 addr, uint8 data) -> void;
|
|
|
|
|
2016-02-09 11:51:12 +00:00
|
|
|
auto main() -> void;
|
2015-10-10 02:16:12 +00:00
|
|
|
auto power() -> void;
|
|
|
|
auto reset() -> void;
|
|
|
|
|
|
|
|
auto serialize(serializer&) -> void;
|
2010-08-09 13:28:56 +00:00
|
|
|
|
2012-02-09 12:53:55 +00:00
|
|
|
privileged:
|
2015-10-10 02:16:12 +00:00
|
|
|
#include "modulo-array.hpp"
|
|
|
|
|
2016-01-23 07:29:34 +00:00
|
|
|
enum GlobalRegister : uint {
|
2015-10-10 02:16:12 +00:00
|
|
|
MVOLL = 0x0c, MVOLR = 0x1c,
|
|
|
|
EVOLL = 0x2c, EVOLR = 0x3c,
|
|
|
|
KON = 0x4c, KOFF = 0x5c,
|
|
|
|
FLG = 0x6c, ENDX = 0x7c,
|
|
|
|
EFB = 0x0d, PMON = 0x2d,
|
|
|
|
NON = 0x3d, EON = 0x4d,
|
|
|
|
DIR = 0x5d, ESA = 0x6d,
|
|
|
|
EDL = 0x7d, FIR = 0x0f, //8 coefficients at 0x0f, 0x1f, ... 0x7f
|
2010-08-09 13:28:56 +00:00
|
|
|
};
|
|
|
|
|
2016-01-23 07:29:34 +00:00
|
|
|
enum VoiceRegister : uint {
|
2015-10-10 02:16:12 +00:00
|
|
|
VOLL = 0x00, VOLR = 0x01,
|
|
|
|
PITCHL = 0x02, PITCHH = 0x03,
|
|
|
|
SRCN = 0x04, ADSR0 = 0x05,
|
|
|
|
ADSR1 = 0x06, GAIN = 0x07,
|
|
|
|
ENVX = 0x08, OUTX = 0x09,
|
2010-08-09 13:28:56 +00:00
|
|
|
};
|
|
|
|
|
2016-01-23 07:29:34 +00:00
|
|
|
enum EnvelopeMode : uint {
|
2015-10-10 02:16:12 +00:00
|
|
|
EnvelopeRelease,
|
|
|
|
EnvelopeAttack,
|
|
|
|
EnvelopeDecay,
|
|
|
|
EnvelopeSustain,
|
|
|
|
};
|
2010-08-09 13:28:56 +00:00
|
|
|
|
2016-01-23 07:29:34 +00:00
|
|
|
enum : uint {
|
2015-10-10 02:16:12 +00:00
|
|
|
EchoHistorySize = 8,
|
|
|
|
BrrBufferSize = 12,
|
|
|
|
BrrBlockSize = 9,
|
|
|
|
CounterRange = 2048 * 5 * 3, //30720 (0x7800)
|
|
|
|
};
|
2010-08-09 13:28:56 +00:00
|
|
|
|
2015-10-10 02:16:12 +00:00
|
|
|
struct State {
|
2010-08-09 13:28:56 +00:00
|
|
|
uint8 regs[128];
|
|
|
|
|
2016-01-23 07:29:34 +00:00
|
|
|
ModuloArray<int, EchoHistorySize> echoHistory[2]; //echo history keeps most recent 8 samples
|
|
|
|
int echoHistoryOffset;
|
2010-08-09 13:28:56 +00:00
|
|
|
|
2015-10-10 02:16:12 +00:00
|
|
|
bool everyOtherSample; //toggles every sample
|
2016-01-23 07:29:34 +00:00
|
|
|
int kon; //KON value when last checked
|
|
|
|
int noise;
|
|
|
|
int counter;
|
|
|
|
int echoOffset; //offset from ESA in echo buffer
|
|
|
|
int echoLength; //number of bytes that echo_offset will stop at
|
2010-08-09 13:28:56 +00:00
|
|
|
|
|
|
|
//hidden registers also written to when main register is written to
|
2016-01-23 07:29:34 +00:00
|
|
|
int konBuffer;
|
|
|
|
int endxBuffer;
|
|
|
|
int envxBuffer;
|
|
|
|
int outxBuffer;
|
2010-08-09 13:28:56 +00:00
|
|
|
|
2015-10-10 02:16:12 +00:00
|
|
|
//temporary state between clocks (prefixed with _)
|
2010-08-09 13:28:56 +00:00
|
|
|
|
|
|
|
//read once per sample
|
2016-01-23 07:29:34 +00:00
|
|
|
int _pmon;
|
|
|
|
int _non;
|
|
|
|
int _eon;
|
|
|
|
int _dir;
|
|
|
|
int _koff;
|
2010-08-09 13:28:56 +00:00
|
|
|
|
|
|
|
//read a few clocks ahead before used
|
2016-01-23 07:29:34 +00:00
|
|
|
int _brrNextAddress;
|
|
|
|
int _adsr0;
|
|
|
|
int _brrHeader;
|
|
|
|
int _brrByte;
|
|
|
|
int _srcn;
|
|
|
|
int _esa;
|
|
|
|
int _echoDisabled;
|
2010-08-09 13:28:56 +00:00
|
|
|
|
|
|
|
//internal state that is recalculated every sample
|
2016-01-23 07:29:34 +00:00
|
|
|
int _dirAddress;
|
|
|
|
int _pitch;
|
|
|
|
int _output;
|
|
|
|
int _looped;
|
|
|
|
int _echoPointer;
|
2010-08-09 13:28:56 +00:00
|
|
|
|
|
|
|
//left/right sums
|
2016-01-23 07:29:34 +00:00
|
|
|
int _mainOut[2];
|
|
|
|
int _echoOut[2];
|
|
|
|
int _echoIn [2];
|
2010-08-09 13:28:56 +00:00
|
|
|
} state;
|
|
|
|
|
2015-10-10 02:16:12 +00:00
|
|
|
struct Voice {
|
2016-01-23 07:29:34 +00:00
|
|
|
ModuloArray<int, BrrBufferSize> buffer; //decoded samples
|
|
|
|
int bufferOffset; //place in buffer where next samples will be decoded
|
|
|
|
int gaussianOffset; //relative fractional position in sample (0x1000 = 1.0)
|
|
|
|
int brrAddress; //address of current BRR block
|
|
|
|
int brrOffset; //current decoding offset in BRR block
|
|
|
|
int vbit; //bitmask for voice: 0x01 for voice 0, 0x02 for voice 1, etc
|
|
|
|
int vidx; //voice channel register index: 0x00 for voice 0, 0x10 for voice 1, etc
|
|
|
|
int konDelay; //KON delay/current setup phase
|
|
|
|
int envelopeMode;
|
|
|
|
int envelope; //current envelope level
|
|
|
|
int hiddenEnvelope; //used by GAIN mode 7, very obscure quirk
|
|
|
|
int _envxOut;
|
2010-08-09 13:28:56 +00:00
|
|
|
} voice[8];
|
|
|
|
|
|
|
|
//gaussian
|
2015-10-10 02:16:12 +00:00
|
|
|
static const int16 GaussianTable[512];
|
2016-01-23 07:29:34 +00:00
|
|
|
auto gaussianInterpolate(const Voice& v) -> int;
|
2010-08-09 13:28:56 +00:00
|
|
|
|
|
|
|
//counter
|
2015-10-10 02:16:12 +00:00
|
|
|
static const uint16 CounterRate[32];
|
|
|
|
static const uint16 CounterOffset[32];
|
|
|
|
auto counterTick() -> void;
|
2016-01-23 07:29:34 +00:00
|
|
|
auto counterPoll(uint rate) -> bool;
|
2010-08-09 13:28:56 +00:00
|
|
|
|
|
|
|
//envelope
|
2015-10-10 02:16:12 +00:00
|
|
|
auto envelopeRun(Voice& v) -> void;
|
2010-08-09 13:28:56 +00:00
|
|
|
|
|
|
|
//brr
|
2015-10-10 02:16:12 +00:00
|
|
|
auto brrDecode(Voice& v) -> void;
|
2010-08-09 13:28:56 +00:00
|
|
|
|
|
|
|
//misc
|
2015-10-10 02:16:12 +00:00
|
|
|
auto misc27() -> void;
|
|
|
|
auto misc28() -> void;
|
|
|
|
auto misc29() -> void;
|
|
|
|
auto misc30() -> void;
|
2010-08-09 13:28:56 +00:00
|
|
|
|
|
|
|
//voice
|
2015-10-10 02:16:12 +00:00
|
|
|
auto voiceOutput(Voice& v, bool channel) -> void;
|
|
|
|
auto voice1 (Voice& v) -> void;
|
|
|
|
auto voice2 (Voice& v) -> void;
|
|
|
|
auto voice3 (Voice& v) -> void;
|
|
|
|
auto voice3a(Voice& v) -> void;
|
|
|
|
auto voice3b(Voice& v) -> void;
|
|
|
|
auto voice3c(Voice& v) -> void;
|
|
|
|
auto voice4 (Voice& v) -> void;
|
|
|
|
auto voice5 (Voice& v) -> void;
|
|
|
|
auto voice6 (Voice& v) -> void;
|
|
|
|
auto voice7 (Voice& v) -> void;
|
|
|
|
auto voice8 (Voice& v) -> void;
|
|
|
|
auto voice9 (Voice& v) -> void;
|
2010-08-09 13:28:56 +00:00
|
|
|
|
|
|
|
//echo
|
2016-01-23 07:29:34 +00:00
|
|
|
auto calculateFIR(int i, bool channel) -> int;
|
|
|
|
auto echoOutput(bool channel) -> int;
|
2015-10-10 02:16:12 +00:00
|
|
|
auto echoRead(bool channel) -> void;
|
|
|
|
auto echoWrite(bool channel) -> void;
|
|
|
|
auto echo22() -> void;
|
|
|
|
auto echo23() -> void;
|
|
|
|
auto echo24() -> void;
|
|
|
|
auto echo25() -> void;
|
|
|
|
auto echo26() -> void;
|
|
|
|
auto echo27() -> void;
|
|
|
|
auto echo28() -> void;
|
|
|
|
auto echo29() -> void;
|
|
|
|
auto echo30() -> void;
|
2010-08-09 13:28:56 +00:00
|
|
|
|
2010-08-09 13:33:44 +00:00
|
|
|
//dsp
|
2015-10-10 02:16:12 +00:00
|
|
|
static auto Enter() -> void;
|
|
|
|
auto tick() -> void;
|
2010-08-09 13:28:56 +00:00
|
|
|
};
|
|
|
|
|
Update to v085r03 release.
byuu says:
Changelog:
- fixed cursor being visible under Metacity window manager (hopefully
doesn't cause regression with other WMs)
- show normal cursor when using SDL video driver
- added menu accelerators (meh, why not?)
- removed debugvirtual, ChipDebugger and chip/debugger functionality
entirely
- alt/smp disassembler moved up
- fixed alt/smp incw/decw instructions (unsigned->uint16 for internal
variables)
My plan going forward for a debugger is not to hardcode functionality
that causes the 10-15% slowdown right into the emulator itself.
Instead, I'm going to make a callback class, which will be a specialized
version of nall::function:
- can call function even if not assigned (results in no-op, return type
must have a trivial default constructor)
- if compiled without #define DEBUGGER, the entire thing turns into
a huge no-op; and will be eliminated entirely when compiled
- strategically place the functions: cb_step, cb_read, cb_write, etc.
From here, the ui-debugger GUI will bind the callbacks, implement
breakpoint checking, usage table generation, etc itself.
I'll probably have to add some breakout commands to exit the emulation
core prior to a frame event in some cases as well.
I didn't initially want any debugger-related stuff in the base cores,
but the #if debugger sCPUDebugger #else sCPU #endif stuff was already
more of a burden than this will be.
2012-02-04 09:23:53 +00:00
|
|
|
extern DSP dsp;
|