mirror of https://github.com/mgba-emu/mgba.git
3DS: Always draw GUI on bottom screen
This commit is contained in:
parent
fafcfebf2e
commit
0090928465
|
@ -258,7 +258,13 @@ void GBAGUIRunloop(struct GBAGUIRunner* runner) {
|
||||||
runner->params.drawStart();
|
runner->params.drawStart();
|
||||||
runner->drawFrame(runner, false);
|
runner->drawFrame(runner, false);
|
||||||
if (drawFps) {
|
if (drawFps) {
|
||||||
|
if (runner->params.guiPrepare) {
|
||||||
|
runner->params.guiPrepare();
|
||||||
|
}
|
||||||
GUIFontPrintf(runner->params.font, 0, GUIFontHeight(runner->params.font), GUI_TEXT_LEFT, 0x7FFFFFFF, "%.2f fps", runner->fps);
|
GUIFontPrintf(runner->params.font, 0, GUIFontHeight(runner->params.font), GUI_TEXT_LEFT, 0x7FFFFFFF, "%.2f fps", runner->fps);
|
||||||
|
if (runner->params.guiPrepare) {
|
||||||
|
runner->params.guiFinish();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
runner->params.drawEnd();
|
runner->params.drawEnd();
|
||||||
|
|
||||||
|
|
|
@ -48,6 +48,7 @@ static int16_t* audioLeft = 0;
|
||||||
static int16_t* audioRight = 0;
|
static int16_t* audioRight = 0;
|
||||||
static size_t audioPos = 0;
|
static size_t audioPos = 0;
|
||||||
static struct ctrTexture gbaOutputTexture;
|
static struct ctrTexture gbaOutputTexture;
|
||||||
|
static bool guiDrawn;
|
||||||
|
|
||||||
extern bool allocateRomBuffer(void);
|
extern bool allocateRomBuffer(void);
|
||||||
|
|
||||||
|
@ -60,18 +61,48 @@ static void _drawStart(void) {
|
||||||
} else {
|
} else {
|
||||||
ctrSetViewportSize(400, 240);
|
ctrSetViewportSize(400, 240);
|
||||||
}
|
}
|
||||||
|
guiDrawn = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void _drawEnd(void) {
|
static void _drawEnd(void) {
|
||||||
|
if (!guiDrawn) {
|
||||||
int screen = screenMode < SM_PA_TOP ? GFX_BOTTOM : GFX_TOP;
|
int screen = screenMode < SM_PA_TOP ? GFX_BOTTOM : GFX_TOP;
|
||||||
u16 width = 0, height = 0;
|
u16 width = 0, height = 0;
|
||||||
|
|
||||||
void* outputFramebuffer = gfxGetFramebuffer(screen, GFX_LEFT, &height, &width);
|
void* outputFramebuffer = gfxGetFramebuffer(screen, GFX_LEFT, &height, &width);
|
||||||
ctrGpuEndFrame(outputFramebuffer, width, height);
|
ctrGpuEndFrame(outputFramebuffer, width, height);
|
||||||
|
}
|
||||||
gfxSwapBuffersGpu();
|
gfxSwapBuffersGpu();
|
||||||
gspWaitForEvent(GSPEVENT_VBlank0, false);
|
gspWaitForEvent(GSPEVENT_VBlank0, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void _guiPrepare(void) {
|
||||||
|
int screen = screenMode < SM_PA_TOP ? GFX_BOTTOM : GFX_TOP;
|
||||||
|
if (screen == GFX_BOTTOM) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
u16 width = 0, height = 0;
|
||||||
|
|
||||||
|
void* outputFramebuffer = gfxGetFramebuffer(screen, GFX_LEFT, &height, &width);
|
||||||
|
ctrGpuEndFrame(outputFramebuffer, width, height);
|
||||||
|
guiDrawn = true;
|
||||||
|
|
||||||
|
ctrGpuBeginFrame();
|
||||||
|
ctrSetViewportSize(320, 240);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void _guiFinish(void) {
|
||||||
|
int screen = screenMode < SM_PA_TOP ? GFX_BOTTOM : GFX_TOP;
|
||||||
|
if (screen == GFX_BOTTOM) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
u16 width = 0, height = 0;
|
||||||
|
void* outputFramebuffer = gfxGetFramebuffer(GFX_BOTTOM, GFX_LEFT, &height, &width);
|
||||||
|
ctrGpuEndFrame(outputFramebuffer, width, height);
|
||||||
|
}
|
||||||
|
|
||||||
static void _setup(struct GBAGUIRunner* runner) {
|
static void _setup(struct GBAGUIRunner* runner) {
|
||||||
runner->context.gba->rotationSource = &rotation.d;
|
runner->context.gba->rotationSource = &rotation.d;
|
||||||
if (hasSound) {
|
if (hasSound) {
|
||||||
|
@ -403,7 +434,7 @@ int main() {
|
||||||
font, "/",
|
font, "/",
|
||||||
_drawStart, _drawEnd,
|
_drawStart, _drawEnd,
|
||||||
_pollInput, _pollCursor,
|
_pollInput, _pollCursor,
|
||||||
0, 0,
|
_guiPrepare, _guiFinish,
|
||||||
|
|
||||||
GUI_PARAMS_TRAIL
|
GUI_PARAMS_TRAIL
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue