one last goto
This commit is contained in:
parent
aca96a1510
commit
94939e395b
1 changed files with 17 additions and 23 deletions
40
gflib/bg.c
40
gflib/bg.c
|
@ -173,36 +173,30 @@ u8 LoadBgVram(u8 bg, const void *src, u16 size, u16 destOffset, u8 mode)
|
||||||
u16 offset;
|
u16 offset;
|
||||||
s8 cursor;
|
s8 cursor;
|
||||||
|
|
||||||
if (!IsInvalidBg(bg) && sGpuBgConfigs.configs[bg].visible)
|
if (IsInvalidBg(bg) || !sGpuBgConfigs.configs[bg].visible)
|
||||||
{
|
return -1;
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
switch (mode)
|
||||||
|
{
|
||||||
|
case 0x1:
|
||||||
|
offset = sGpuBgConfigs.configs[bg].charBaseIndex * BG_CHAR_SIZE;
|
||||||
offset = destOffset + offset;
|
offset = destOffset + offset;
|
||||||
|
|
||||||
cursor = RequestDma3Copy(src, (void*)(offset + BG_VRAM), size, 0);
|
cursor = RequestDma3Copy(src, (void*)(offset + BG_VRAM), size, 0);
|
||||||
|
|
||||||
if (cursor == -1)
|
if (cursor == -1)
|
||||||
{
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
break;
|
||||||
}
|
case 0x2:
|
||||||
else
|
offset = sGpuBgConfigs.configs[bg].mapBaseIndex * BG_SCREEN_SIZE;
|
||||||
{
|
offset = destOffset + offset;
|
||||||
return -1;
|
cursor = RequestDma3Copy(src, (void*)(offset + BG_VRAM), size, 0);
|
||||||
|
if (cursor == -1)
|
||||||
|
return -1;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
cursor = -1;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
end:
|
|
||||||
return cursor;
|
return cursor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue