all repos — mgba @ 0de37f30b6cd87e6e48e8c6ea213c8ed5626397c

mGBA Game Boy Advance Emulator

LR35902: Fix trailing whitespace in disassembly
Vicki Pfau vi@endrift.com
Mon, 29 Apr 2019 12:16:41 -0700
commit

0de37f30b6cd87e6e48e8c6ea213c8ed5626397c

parent

029638ae99d948c4a759f4446eed0e0266b3d0aa

2 files changed, 10 insertions(+), 6 deletions(-)

jump to
M CHANGESCHANGES

@@ -17,6 +17,7 @@ - Qt: Fix crash in sprite viewer magnification (fixes mgba.io/i/1362)

- 3DS: Ensure core 2 can be used for threaded renderer (fixes mgba.io/i/1371) - GB Core: Fix toggling WIN and OBJ being swapped - All: Fix several memory leaks + - LR35902: Fix trailing whitespace in disassembly Misc: - Qt: Add missing HEVC NVENC option (fixes mgba.io/i/1323) - Qt: Improve camera initialization
M src/lr35902/decoder.csrc/lr35902/decoder.c

@@ -503,6 +503,9 @@ if (op.flags & LR35902_OP_FLAG_IMPLICIT) {

return 0; } + strncpy(buffer, " ", blen - 1); + ADVANCE(1); + if (op.flags & LR35902_OP_FLAG_MEMORY) { strncpy(buffer, "[", blen - 1); ADVANCE(1);

@@ -539,16 +542,16 @@ int written;

int total = 0; const char* cond = _lr35902Conditions[info->condition]; - written = snprintf(buffer, blen - 1, "%s ", mnemonic); + written = snprintf(buffer, blen - 1, "%s", mnemonic); ADVANCE(written); if (cond) { - written = snprintf(buffer, blen - 1, "%s", cond); + written = snprintf(buffer, blen - 1, " %s", cond); ADVANCE(written); if (info->op1.reg || info->op1.immediate || info->op2.reg || info->op2.immediate) { - strncpy(buffer, ", ", blen - 1); - ADVANCE(2); + strncpy(buffer, ",", blen - 1); + ADVANCE(1); } }

@@ -559,8 +562,8 @@ }

if (info->op2.reg || (!info->op1.immediate && info->opcodeSize > 1 && info->opcode[0] != 0xCB)) { if (written) { - strncpy(buffer, ", ", blen - 1); - ADVANCE(2); + strncpy(buffer, ",", blen - 1); + ADVANCE(1); } written = _decodeOperand(info->op2, buffer, blen); ADVANCE(written);