Merge remote-tracking branch 'upstream/master'

This commit is contained in:
Sérgio Benjamim 2018-11-27 23:44:37 -02:00
commit 6db8583de1
8 changed files with 42 additions and 21 deletions

View File

@ -136,6 +136,9 @@ Bugfixes:
- Qt: Fix mapping analog triggers (fixes mgba.io/i/495)
- Qt: Grab focus when game starts (fixes mgba.io/i/804)
- Core: Remember to deinit proxy ring FIFO
- GBA Savedata: Fix EEPROM writing codepath when savetype is not EEPROM
- Core: Reroot timing list when (de)scheduling
- GB Video: Changing LYC while LCDC off doesn't affect STAT (fixes mgba.io/i/1224)
Misc:
- mGUI: Add SGB border configuration option
- mGUI: Add support for different settings types
@ -151,6 +154,7 @@ Misc:
- Python: Minor API improvements
- Qt: Minor memory view tweaks
- CMake: Fix libswresample version dependencies (fixes mgba.io/i/1229)
- Debugger: Readability improvements (fixes mgba.io/i/1238)
0.7 beta 1: (2018-09-24)
- Initial beta for 0.7

View File

@ -125,13 +125,14 @@ static void _printStatus(struct CLIDebuggerSystem* debugger) {
struct CLIDebuggerBackend* be = debugger->p->backend;
struct ARMCore* cpu = debugger->p->d.core->cpu;
int r;
for (r = 0; r < 4; ++r) {
be->printf(be, "%08X %08X %08X %08X\n",
cpu->gprs[r << 2],
cpu->gprs[(r << 2) + 1],
cpu->gprs[(r << 2) + 2],
cpu->gprs[(r << 2) + 3]);
for (r = 0; r < 16; r += 4) {
be->printf(be, "%sr%i: %08X %sr%i: %08X %sr%i: %08X %sr%i: %08X\n",
r < 10 ? " " : "", r, cpu->gprs[r],
r < 9 ? " " : "", r + 1, cpu->gprs[r + 1],
r < 8 ? " " : "", r + 2, cpu->gprs[r + 2],
r < 7 ? " " : "", r + 3, cpu->gprs[r + 3]);
}
be->printf(be, "cpsr: ");
_printPSR(be, cpu->cpsr);
int instructionLength;
enum ExecutionMode mode = cpu->cpsr.t;

View File

@ -28,6 +28,10 @@ void mTimingSchedule(struct mTiming* timing, struct mTimingEvent* event, int32_t
if (nextEvent < *timing->nextEvent) {
*timing->nextEvent = nextEvent;
}
if (timing->reroot) {
timing->root = timing->reroot;
timing->reroot = NULL;
}
struct mTimingEvent** previous = &timing->root;
struct mTimingEvent* next = timing->root;
unsigned priority = event->priority;
@ -44,6 +48,10 @@ void mTimingSchedule(struct mTiming* timing, struct mTimingEvent* event, int32_t
}
void mTimingDeschedule(struct mTiming* timing, struct mTimingEvent* event) {
if (timing->reroot) {
timing->root = timing->reroot;
timing->reroot = NULL;
}
struct mTimingEvent** previous = &timing->root;
struct mTimingEvent* next = timing->root;
while (next) {

View File

@ -449,10 +449,12 @@ void GBVideoWriteSTAT(struct GBVideo* video, GBRegisterSTAT value) {
void GBVideoWriteLYC(struct GBVideo* video, uint8_t value) {
GBRegisterSTAT oldStat = video->stat;
video->stat = GBRegisterSTATSetLYC(video->stat, value == video->ly);
if (!_statIRQAsserted(video, oldStat) && _statIRQAsserted(video, video->stat)) {
video->p->memory.io[REG_IF] |= (1 << GB_IRQ_LCDSTAT);
GBUpdateIRQs(video->p);
if (GBRegisterLCDCIsEnable(video->p->memory.io[REG_LCDC])) {
video->stat = GBRegisterSTATSetLYC(video->stat, value == video->ly);
if (!_statIRQAsserted(video, oldStat) && _statIRQAsserted(video, video->stat)) {
video->p->memory.io[REG_IF] |= (1 << GB_IRQ_LCDSTAT);
GBUpdateIRQs(video->p);
}
}
video->p->memory.io[REG_STAT] = video->stat;
}

View File

@ -278,7 +278,9 @@ void GBADMAService(struct GBA* gba, int number, struct GBADMA* info) {
mLOG(GBA_MEM, INFO, "Detected EEPROM savegame");
GBASavedataInitEEPROM(&memory->savedata);
}
GBASavedataWriteEEPROM(&memory->savedata, memory->dmaTransferRegister, wordsRemaining);
if (memory->savedata.type == SAVEDATA_EEPROM512 || memory->savedata.type == SAVEDATA_EEPROM) {
GBASavedataWriteEEPROM(&memory->savedata, memory->dmaTransferRegister, wordsRemaining);
}
} else {
cpu->memory.store16(cpu, dest, memory->dmaTransferRegister, 0);

View File

@ -892,7 +892,11 @@ void GBAStore16(struct ARMCore* cpu, uint32_t address, int16_t value, int* cycle
mLOG(GBA_MEM, INFO, "Detected EEPROM savegame");
GBASavedataInitEEPROM(&memory->savedata);
}
GBASavedataWriteEEPROM(&memory->savedata, value, 1);
if (memory->savedata.type == SAVEDATA_EEPROM512 || memory->savedata.type == SAVEDATA_EEPROM) {
GBASavedataWriteEEPROM(&memory->savedata, value, 1);
break;
}
mLOG(GBA_MEM, GAME_ERROR, "Bad memory Store16: 0x%08X", address);
break;
case REGION_CART_SRAM:
case REGION_CART_SRAM_MIRROR:

View File

@ -21,7 +21,7 @@ static struct CLIDebuggerCommandSummary _lr35902Commands[] = {
};
static inline void _printFlags(struct CLIDebuggerBackend* be, union FlagRegister f) {
be->printf(be, "[%c%c%c%c]\n",
be->printf(be, "F: [%c%c%c%c]\n",
f.z ? 'Z' : '-',
f.n ? 'N' : '-',
f.h ? 'H' : '-',
@ -82,16 +82,16 @@ static inline uint16_t _printLine(struct CLIDebugger* debugger, uint16_t address
static void _printStatus(struct CLIDebuggerSystem* debugger) {
struct CLIDebuggerBackend* be = debugger->p->backend;
struct LR35902Core* cpu = debugger->p->d.core->cpu;
be->printf(be, "A: %02X F: %02X (AF: %04X)\n", cpu->a, cpu->f.packed, cpu->af);
be->printf(be, "B: %02X C: %02X (BC: %04X)\n", cpu->b, cpu->c, cpu->bc);
be->printf(be, "D: %02X E: %02X (DE: %04X)\n", cpu->d, cpu->e, cpu->de);
be->printf(be, "H: %02X L: %02X (HL: %04X)\n", cpu->h, cpu->l, cpu->hl);
be->printf(be, "PC: %04X SP: %04X\n", cpu->pc, cpu->sp);
be->printf(be, "A: %02X F: %02X (AF: %04X)\n", cpu->a, cpu->f.packed, cpu->af);
be->printf(be, "B: %02X C: %02X (BC: %04X)\n", cpu->b, cpu->c, cpu->bc);
be->printf(be, "D: %02X E: %02X (DE: %04X)\n", cpu->d, cpu->e, cpu->de);
be->printf(be, "H: %02X L: %02X (HL: %04X)\n", cpu->h, cpu->l, cpu->hl);
be->printf(be, "PC: %04X SP: %04X\n", cpu->pc, cpu->sp);
struct LR35902Debugger* platDebugger = (struct LR35902Debugger*) debugger->p->d.platform;
size_t i;
for (i = 0; platDebugger->segments[i].name; ++i) {
be->printf(be, "%s%s: %02X", i ? " " : "", platDebugger->segments[i].name, cpu->memory.currentSegment(cpu, platDebugger->segments[i].start));
be->printf(be, "%s%s: %02X", i ? " " : "", platDebugger->segments[i].name, cpu->memory.currentSegment(cpu, platDebugger->segments[i].start));
}
if (i) {
be->printf(be, "\n");

View File

@ -213,10 +213,10 @@ static void LR35902DebuggerTrace(struct mDebuggerPlatform* d, char* out, size_t*
disPtr += 2;
LR35902Disassemble(&info, disPtr, sizeof(disassembly) - (disPtr - disassembly));
*length = snprintf(out, *length, "A: %02X F: %02X B: %02X C: %02X D: %02X E: %02X H: %02X L: %02X SP: %04X PC: %04X | %s",
*length = snprintf(out, *length, "A: %02X F: %02X B: %02X C: %02X D: %02X E: %02X H: %02X L: %02X SP: %04X PC: %02X:%04X | %s",
cpu->a, cpu->f.packed, cpu->b, cpu->c,
cpu->d, cpu->e, cpu->h, cpu->l,
cpu->sp, cpu->pc, disassembly);
cpu->sp, cpu->memory.currentSegment(cpu, cpu->pc), cpu->pc, disassembly);
}
bool LR35902DebuggerGetRegister(struct mDebuggerPlatform* d, const char* name, int32_t* value) {