mirror of https://github.com/mgba-emu/mgba.git
GB Audio: Fix up boot sequence
This commit is contained in:
parent
4f70b313fc
commit
50fd46506c
1
CHANGES
1
CHANGES
|
@ -5,6 +5,7 @@ Features:
|
|||
Emulation fixes:
|
||||
- GB Audio: Fix channels 1/2 not playing when resetting volume (fixes mgba.io/i/2614)
|
||||
- GB Audio: Fix channel 3 volume being changed between samples (fixes mgba.io/i/1896)
|
||||
- GB Audio: Fix up boot sequence
|
||||
- GB Memory: Actually, HDMAs should start when LCD is off (fixes mgba.io/i/2662)
|
||||
- GB Serialize: Don't write BGP/OBP when loading SCGB state (fixes mgba.io/i/2694)
|
||||
- GB SIO: Further fix bidirectional transfer starting
|
||||
|
|
|
@ -116,7 +116,6 @@ void GBAudioReset(struct GBAudio* audio) {
|
|||
audio->ch3.wavedata8[13] = 0xFF;
|
||||
audio->ch3.wavedata8[14] = 0x00;
|
||||
audio->ch3.wavedata8[15] = 0xFF;
|
||||
audio->ch3.window = 0;
|
||||
audio->ch4 = (struct GBAudioNoiseChannel) { .envelope = { .dead = 2 } };
|
||||
audio->frame = 0;
|
||||
audio->sampleInterval = SAMPLE_INTERVAL * GB_MAX_SAMPLES;
|
||||
|
|
21
src/gb/gb.c
21
src/gb/gb.c
|
@ -596,13 +596,13 @@ void GBReset(struct SM83Core* cpu) {
|
|||
GBVideoReset(&gb->video);
|
||||
GBTimerReset(&gb->timer);
|
||||
GBIOReset(gb);
|
||||
GBAudioReset(&gb->audio);
|
||||
if (!gb->biosVf && gb->memory.rom) {
|
||||
GBSkipBIOS(gb);
|
||||
} else {
|
||||
mTimingSchedule(&gb->timing, &gb->timer.event, 0);
|
||||
}
|
||||
|
||||
GBAudioReset(&gb->audio);
|
||||
GBSIOReset(&gb->sio);
|
||||
|
||||
cpu->memory.setActiveRegion(cpu, cpu->pc);
|
||||
|
@ -744,6 +744,25 @@ void GBSkipBIOS(struct GB* gb) {
|
|||
GBUnmapBIOS(gb);
|
||||
}
|
||||
|
||||
GBIOWrite(gb, GB_REG_NR52, 0xF1);
|
||||
GBIOWrite(gb, GB_REG_NR14, 0x3F);
|
||||
GBIOWrite(gb, GB_REG_NR10, 0x80);
|
||||
GBIOWrite(gb, GB_REG_NR11, 0xBF);
|
||||
GBIOWrite(gb, GB_REG_NR12, 0xF3);
|
||||
GBIOWrite(gb, GB_REG_NR13, 0xF3);
|
||||
GBIOWrite(gb, GB_REG_NR24, 0x3F);
|
||||
GBIOWrite(gb, GB_REG_NR21, 0x3F);
|
||||
GBIOWrite(gb, GB_REG_NR22, 0x00);
|
||||
GBIOWrite(gb, GB_REG_NR34, 0x3F);
|
||||
GBIOWrite(gb, GB_REG_NR30, 0x7F);
|
||||
GBIOWrite(gb, GB_REG_NR31, 0xFF);
|
||||
GBIOWrite(gb, GB_REG_NR32, 0x9F);
|
||||
GBIOWrite(gb, GB_REG_NR44, 0x3F);
|
||||
GBIOWrite(gb, GB_REG_NR41, 0xFF);
|
||||
GBIOWrite(gb, GB_REG_NR42, 0x00);
|
||||
GBIOWrite(gb, GB_REG_NR43, 0x00);
|
||||
GBIOWrite(gb, GB_REG_NR50, 0x77);
|
||||
GBIOWrite(gb, GB_REG_NR51, 0xF3);
|
||||
GBIOWrite(gb, GB_REG_LCDC, 0x91);
|
||||
gb->memory.io[GB_REG_BANK] = 0x1;
|
||||
GBVideoSkipBIOS(&gb->video);
|
||||
|
|
29
src/gb/io.c
29
src/gb/io.c
|
@ -162,36 +162,7 @@ void GBIOReset(struct GB* gb) {
|
|||
GBIOWrite(gb, GB_REG_TMA, 0);
|
||||
GBIOWrite(gb, GB_REG_TAC, 0);
|
||||
GBIOWrite(gb, GB_REG_IF, 1);
|
||||
gb->audio.playingCh1 = false;
|
||||
gb->audio.playingCh2 = false;
|
||||
gb->audio.playingCh3 = false;
|
||||
gb->audio.playingCh4 = false;
|
||||
GBIOWrite(gb, GB_REG_NR52, 0xF1);
|
||||
GBIOWrite(gb, GB_REG_NR14, 0x3F);
|
||||
GBIOWrite(gb, GB_REG_NR10, 0x80);
|
||||
GBIOWrite(gb, GB_REG_NR11, 0xBF);
|
||||
GBIOWrite(gb, GB_REG_NR12, 0xF3);
|
||||
GBIOWrite(gb, GB_REG_NR13, 0xF3);
|
||||
GBIOWrite(gb, GB_REG_NR24, 0x3F);
|
||||
GBIOWrite(gb, GB_REG_NR21, 0x3F);
|
||||
GBIOWrite(gb, GB_REG_NR22, 0x00);
|
||||
GBIOWrite(gb, GB_REG_NR34, 0x3F);
|
||||
GBIOWrite(gb, GB_REG_NR30, 0x7F);
|
||||
GBIOWrite(gb, GB_REG_NR31, 0xFF);
|
||||
GBIOWrite(gb, GB_REG_NR32, 0x9F);
|
||||
GBIOWrite(gb, GB_REG_NR44, 0x3F);
|
||||
GBIOWrite(gb, GB_REG_NR41, 0xFF);
|
||||
GBIOWrite(gb, GB_REG_NR42, 0x00);
|
||||
GBIOWrite(gb, GB_REG_NR43, 0x00);
|
||||
GBIOWrite(gb, GB_REG_NR50, 0x77);
|
||||
GBIOWrite(gb, GB_REG_NR51, 0xF3);
|
||||
if (!gb->biosVf) {
|
||||
GBIOWrite(gb, GB_REG_LCDC, 0x91);
|
||||
gb->memory.io[GB_REG_BANK] = 1;
|
||||
} else {
|
||||
GBIOWrite(gb, GB_REG_LCDC, 0x00);
|
||||
gb->memory.io[GB_REG_BANK] = 0xFF;
|
||||
}
|
||||
GBIOWrite(gb, GB_REG_SCY, 0x00);
|
||||
GBIOWrite(gb, GB_REG_SCX, 0x00);
|
||||
GBIOWrite(gb, GB_REG_LYC, 0x00);
|
||||
|
|
Loading…
Reference in New Issue