Skip to content

Commit fe36e31

Browse files
committed
Use existing framebuffer
1 parent 68d0008 commit fe36e31

File tree

3 files changed

+11
-8
lines changed

3 files changed

+11
-8
lines changed

include/ogc/consol.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@
2626
* \param[in] xres,yres size of the console in pixel
2727
* \param[in] stride size of one line of the framebuffer in bytes
2828
*
29-
* \return none
29+
* \return 0 on success, <0 on error
3030
*/
31-
void CON_Init(void *framebuffer,int xstart,int ystart,int xres,int yres,int stride);
31+
s32 CON_Init(void *framebuffer,int xstart,int ystart,int xres,int yres,int stride);
3232

3333
/*!
3434
* \fn s32 CON_InitEx(GXRModeObj *rmode, s32 conXOrigin,s32 conYOrigin,s32 conWidth,s32 conHeight)

libogc/console.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ static FILE *stdcon = NULL;
8686

8787
extern u8 console_font_8x16[];
8888

89-
void __console_vipostcb(u32 retraceCnt)
89+
void __console_vipostcb(u32 retraceCount)
9090
{
9191
u32 ycnt,xcnt, fb_stride;
9292
u32 *fb,*ptr;
@@ -613,10 +613,14 @@ static int __console_fstat_r(struct _reent *r,void *fd,struct stat *st)
613613
return 0;
614614
}
615615

616-
void CON_Init(void *framebuffer,int xstart,int ystart,int xres,int yres,int stride)
616+
s32 CON_Init(void *framebuffer,int xstart,int ystart,int xres,int yres,int stride)
617617
{
618618
framebuffer = SYS_VirtualToUncached(framebuffer);
619+
if(!framebuffer) return -1;
620+
619621
__console_init(framebuffer,xstart,ystart,xres,yres,stride);
622+
623+
return 0;
620624
}
621625

622626
s32 CON_InitEx(GXRModeObj *rmode, s32 conXOrigin,s32 conYOrigin,s32 conWidth,s32 conHeight)

libogc/exception.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ typedef struct _framerec {
6060
void *lr;
6161
} frame_rec, *frame_rec_t;
6262

63-
static void *exception_xfb = (void*)0xC1700000; //we use a static address above ArenaHi.
6463
static int reload_timer = -1;
6564
static u32 rumble_cmds[PAD_CHANMAX] = {
6665
PAD_MOTOR_STOP, PAD_MOTOR_STOP, PAD_MOTOR_STOP, PAD_MOTOR_STOP
@@ -72,7 +71,6 @@ extern void fpu_exceptionhandler(frame_context*);
7271
extern void irq_exceptionhandler(frame_context*);
7372
extern void dec_exceptionhandler(frame_context*);
7473
extern void default_exceptionhandler(frame_context*);
75-
extern void VIDEO_SetFramebuffer(void *);
7674
extern void __dsp_shutdown(void);
7775
extern void __reload(void);
7876
#if defined(HW_DOL)
@@ -260,14 +258,15 @@ static void waitForReload(void)
260258
//just implement core for unrecoverable exceptions.
261259
void c_default_exceptionhandler(frame_context *pCtx)
262260
{
261+
void *framebuffer;
263262
u16 xstart,ystart;
264263
u16 xres,yres,stride;
265264

266265
__dsp_shutdown();
267266
GX_AbortFrame();
268267
VIDEO_GetFrameBufferPan(&xstart,&ystart,&xres,&yres,&stride);
269-
CON_Init(exception_xfb,xstart,ystart,xres,yres,stride*VI_DISPLAY_PIX_SZ);
270-
VIDEO_SetFramebuffer(exception_xfb);
268+
framebuffer = VIDEO_GetCurrentFramebuffer();
269+
CON_Init(framebuffer,xstart,ystart,xres,yres,stride*VI_DISPLAY_PIX_SZ);
271270

272271
kprintf("\n\n\n\tException (%s) occurred!", exception_name[pCtx->nExcept]);
273272

0 commit comments

Comments
 (0)