From 94939e395b58cf3e774a76d49b8518b8c2937432 Mon Sep 17 00:00:00 2001 From: Kurausukun Date: Sun, 23 May 2021 22:26:34 -0400 Subject: [PATCH] one last goto --- gflib/bg.c | 40 +++++++++++++++++----------------------- 1 file changed, 17 insertions(+), 23 deletions(-) diff --git a/gflib/bg.c b/gflib/bg.c index b6d1b0b92..0c702ae0f 100644 --- a/gflib/bg.c +++ b/gflib/bg.c @@ -173,36 +173,30 @@ u8 LoadBgVram(u8 bg, const void *src, u16 size, u16 destOffset, u8 mode) u16 offset; s8 cursor; - if (!IsInvalidBg(bg) && sGpuBgConfigs.configs[bg].visible) - { - switch (mode) - { - case 0x1: - offset = sGpuBgConfigs.configs[bg].charBaseIndex * BG_CHAR_SIZE; - break; - case 0x2: - offset = sGpuBgConfigs.configs[bg].mapBaseIndex * BG_SCREEN_SIZE; - break; - default: - cursor = -1; - goto end; - } + if (IsInvalidBg(bg) || !sGpuBgConfigs.configs[bg].visible) + return -1; + switch (mode) + { + case 0x1: + offset = sGpuBgConfigs.configs[bg].charBaseIndex * BG_CHAR_SIZE; offset = destOffset + offset; - cursor = RequestDma3Copy(src, (void*)(offset + BG_VRAM), size, 0); - if (cursor == -1) - { return -1; - } - } - else - { - return -1; + break; + case 0x2: + offset = sGpuBgConfigs.configs[bg].mapBaseIndex * BG_SCREEN_SIZE; + offset = destOffset + offset; + cursor = RequestDma3Copy(src, (void*)(offset + BG_VRAM), size, 0); + if (cursor == -1) + return -1; + break; + default: + cursor = -1; + break; } -end: return cursor; }