mirror of https://github.com/mgba-emu/mgba.git
DS: Fix exposed CPU frequencies and audio timing
This commit is contained in:
parent
b796a689cb
commit
c0f427597e
1
CHANGES
1
CHANGES
|
@ -21,6 +21,7 @@ Bugfixes:
|
||||||
- DS GX: Allow viewport to change in the middle of a frame
|
- DS GX: Allow viewport to change in the middle of a frame
|
||||||
- DS GX: Properly mask address for slot 2 4x4-texel textures
|
- DS GX: Properly mask address for slot 2 4x4-texel textures
|
||||||
- DS Slot-1: Emulate initial SPI command delay
|
- DS Slot-1: Emulate initial SPI command delay
|
||||||
|
- DS: Fix exposed CPU frequencies and audio timing
|
||||||
Misc:
|
Misc:
|
||||||
- DS: Set boot complete bit in RAM on boot (fixes mgba.io/i/576, mgba.io/i/580, mgba.io/i/586)
|
- DS: Set boot complete bit in RAM on boot (fixes mgba.io/i/576, mgba.io/i/580, mgba.io/i/586)
|
||||||
- DS Memory: Ensure DS9 I/O is 8-byte aligned
|
- DS Memory: Ensure DS9 I/O is 8-byte aligned
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
mLOG_DEFINE_CATEGORY(DS_AUDIO, "DS Audio", "ds.audio");
|
mLOG_DEFINE_CATEGORY(DS_AUDIO, "DS Audio", "ds.audio");
|
||||||
|
|
||||||
static const unsigned BLIP_BUFFER_SIZE = 0x4000;
|
static const unsigned BLIP_BUFFER_SIZE = 0x4000;
|
||||||
static const int CLOCKS_PER_FRAME = 0x4000;
|
static const int CLOCKS_PER_FRAME = 0x8000;
|
||||||
const int DS_AUDIO_VOLUME_MAX = 0x100;
|
const int DS_AUDIO_VOLUME_MAX = 0x100;
|
||||||
|
|
||||||
static void _updateChannel(struct mTiming* timing, void* user, uint32_t cyclesLate);
|
static void _updateChannel(struct mTiming* timing, void* user, uint32_t cyclesLate);
|
||||||
|
@ -332,10 +332,11 @@ static void _sample(struct mTiming* timing, void* user, uint32_t cyclesLate) {
|
||||||
blip_add_delta(audio->right, audio->clock, sampleRight - audio->lastRight);
|
blip_add_delta(audio->right, audio->clock, sampleRight - audio->lastRight);
|
||||||
audio->lastLeft = sampleLeft;
|
audio->lastLeft = sampleLeft;
|
||||||
audio->lastRight = sampleRight;
|
audio->lastRight = sampleRight;
|
||||||
audio->clock += audio->sampleInterval;
|
// blip clock is in ARM9 cycles, but sampleInterval is in ARM7 cycles
|
||||||
|
audio->clock += audio->sampleInterval * 2;
|
||||||
if (audio->clock >= CLOCKS_PER_FRAME) {
|
if (audio->clock >= CLOCKS_PER_FRAME) {
|
||||||
blip_end_frame(audio->left, audio->clock);
|
blip_end_frame(audio->left, CLOCKS_PER_FRAME);
|
||||||
blip_end_frame(audio->right, audio->clock);
|
blip_end_frame(audio->right, CLOCKS_PER_FRAME);
|
||||||
audio->clock -= CLOCKS_PER_FRAME;
|
audio->clock -= CLOCKS_PER_FRAME;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -409,7 +409,7 @@ static int32_t _DSCoreFrameCounter(const struct mCore* core) {
|
||||||
|
|
||||||
static int32_t _DSCoreFrameCycles(const struct mCore* core) {
|
static int32_t _DSCoreFrameCycles(const struct mCore* core) {
|
||||||
UNUSED(core);
|
UNUSED(core);
|
||||||
return DS_VIDEO_TOTAL_LENGTH;
|
return DS_VIDEO_TOTAL_LENGTH * 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t _DSCoreFrequency(const struct mCore* core) {
|
static int32_t _DSCoreFrequency(const struct mCore* core) {
|
||||||
|
|
|
@ -20,8 +20,8 @@
|
||||||
|
|
||||||
mLOG_DEFINE_CATEGORY(DS, "DS", "ds");
|
mLOG_DEFINE_CATEGORY(DS, "DS", "ds");
|
||||||
|
|
||||||
const uint32_t DS_ARM946ES_FREQUENCY = 0x1FF61FE;
|
const uint32_t DS_ARM946ES_FREQUENCY = 0x3FEC3FC;
|
||||||
const uint32_t DS_ARM7TDMI_FREQUENCY = 0xFFB0FF;
|
const uint32_t DS_ARM7TDMI_FREQUENCY = 0x1FF61FE;
|
||||||
const uint32_t DS_COMPONENT_MAGIC = 0x1FF61FE;
|
const uint32_t DS_COMPONENT_MAGIC = 0x1FF61FE;
|
||||||
const uint8_t DS_CHIP_ID[4] = { 0xC2, 0x0F, 0x00, 0x00 };
|
const uint8_t DS_CHIP_ID[4] = { 0xC2, 0x0F, 0x00, 0x00 };
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue