Skip to content

Commit f94db70

Browse files
committed
console: clip console to framebuffer size on con_initex
1 parent b0fcc09 commit f94db70

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

libogc/console.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1083,6 +1083,13 @@ s32 CON_InitEx(GXRModeObj *rmode, s32 conXOrigin,s32 conYOrigin,s32 conWidth,s32
10831083
VIDEO_SetPostRetraceCallback(NULL);
10841084
if(_console_buffer)
10851085
free(_console_buffer);
1086+
1087+
// clip console to framebuffer size
1088+
if(rmode->fbWidth < conXOrigin + conWidth)
1089+
conWidth = rmode->fbWidth - conXOrigin;
1090+
1091+
if(rmode->xfbHeight < conYOrigin + conHeight)
1092+
conHeight = rmode->xfbHeight - conYOrigin;
10861093

10871094
// force conWidth, conHeight to be multiples of font size
10881095
conWidth = (conWidth / FONT_XSIZE) * FONT_XSIZE;

0 commit comments

Comments
 (0)