GB Audio: Improve "zombie mode" emulation in CGB mode (fixes #2029)
1
CHANGES
|
@ -11,6 +11,7 @@ Emulation fixes:
|
|||
- GB Audio: Fix channels 1/2 staying muted if restarted after long silence
|
||||
- GB Audio: Fix channel 1 restarting if sweep applies after stop (fixes mgba.io/i/2965)
|
||||
- GB Audio: Fix restarting envelope when writing to register (fixes mgba.io/i/3067)
|
||||
- GB Audio: Improve "zombie mode" emulation in CGB mode (fixes mgba.io/i/2029)
|
||||
- GB I/O: Read back proper SVBK value after writing 0 (fixes mgba.io/i/2921)
|
||||
- GB I/O: Fix STAT writing IRQ trigger conditions (fixes mgba.io/i/2501)
|
||||
- GB Serialize: Add missing Pocket Cam state to savestates
|
||||
|
|
Before Width: | Height: | Size: 762 B After Width: | Height: | Size: 747 B |
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 2.5 KiB After Width: | Height: | Size: 2.5 KiB |
Before Width: | Height: | Size: 756 B After Width: | Height: | Size: 724 B |
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 569 B After Width: | Height: | Size: 569 B |
|
@ -911,12 +911,25 @@ void _writeDuty(struct GBAudioEnvelope* envelope, uint8_t value) {
|
|||
}
|
||||
|
||||
bool _writeEnvelope(struct GBAudioEnvelope* envelope, uint8_t value, enum GBAudioStyle style) {
|
||||
bool oldDirection = envelope->direction;
|
||||
envelope->stepTime = GBAudioRegisterSweepGetStepTime(value);
|
||||
envelope->direction = GBAudioRegisterSweepGetDirection(value);
|
||||
envelope->initialVolume = GBAudioRegisterSweepGetInitialVolume(value);
|
||||
if (style == GB_AUDIO_DMG && !envelope->stepTime) {
|
||||
if (!envelope->stepTime) {
|
||||
// TODO: Improve "zombie" mode
|
||||
++envelope->currentVolume;
|
||||
if (style == GB_AUDIO_DMG) {
|
||||
++envelope->currentVolume;
|
||||
} else if (style == GB_AUDIO_CGB) {
|
||||
if (envelope->direction == oldDirection) {
|
||||
if (envelope->direction) {
|
||||
++envelope->currentVolume;
|
||||
} else {
|
||||
envelope->currentVolume += 2;
|
||||
}
|
||||
} else {
|
||||
envelope->currentVolume = 0;
|
||||
}
|
||||
}
|
||||
envelope->currentVolume &= 0xF;
|
||||
}
|
||||
_updateEnvelopeDead(envelope);
|
||||
|
|