GBA: Slightly optimize GBAProcessEvents

This commit is contained in:
Jeffrey Pfau 2016-02-08 22:32:30 -08:00
parent be42f298da
commit 564f58c7fb
2 changed files with 14 additions and 11 deletions

View File

@ -1,6 +1,8 @@
0.5.0: (Future) 0.5.0: (Future)
Bugfixes: Bugfixes:
- VFS: Fix reading 7z archives without rewinding first - VFS: Fix reading 7z archives without rewinding first
Misc:
- GBA: Slightly optimize GBAProcessEvents
0.4.0: (2016-02-02) 0.4.0: (2016-02-02)
Features: Features:

View File

@ -205,16 +205,7 @@ void GBASkipBIOS(struct GBA* gba) {
} }
static void GBAProcessEvents(struct ARMCore* cpu) { static void GBAProcessEvents(struct ARMCore* cpu) {
do {
struct GBA* gba = (struct GBA*) cpu->master; struct GBA* gba = (struct GBA*) cpu->master;
int32_t cycles = cpu->nextEvent;
int32_t nextEvent = INT_MAX;
int32_t testEvent;
#ifndef NDEBUG
if (cycles < 0) {
GBALog(gba, GBA_LOG_FATAL, "Negative cycles passed: %i", cycles);
}
#endif
gba->bus = cpu->prefetch[1]; gba->bus = cpu->prefetch[1];
if (cpu->executionMode == MODE_THUMB) { if (cpu->executionMode == MODE_THUMB) {
@ -226,6 +217,16 @@ static void GBAProcessEvents(struct ARMCore* cpu) {
gba->springIRQ = 0; gba->springIRQ = 0;
} }
do {
int32_t cycles = cpu->nextEvent;
int32_t nextEvent = INT_MAX;
int32_t testEvent;
#ifndef NDEBUG
if (cycles < 0) {
GBALog(gba, GBA_LOG_FATAL, "Negative cycles passed: %i", cycles);
}
#endif
testEvent = GBAVideoProcessEvents(&gba->video, cycles); testEvent = GBAVideoProcessEvents(&gba->video, cycles);
if (testEvent < nextEvent) { if (testEvent < nextEvent) {
nextEvent = testEvent; nextEvent = testEvent;