From 6dde5925bc7b1fd7663d272483fa510ff9e57bfc Mon Sep 17 00:00:00 2001 From: gijs Date: Fri, 20 Oct 2023 12:45:21 +0200 Subject: [PATCH] Decompile `nuGfxSetCfb` --- src/nu/nugfxsetcfb.c | 36 +++++++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/src/nu/nugfxsetcfb.c b/src/nu/nugfxsetcfb.c index 6c950b5..b176722 100644 --- a/src/nu/nugfxsetcfb.c +++ b/src/nu/nugfxsetcfb.c @@ -1,3 +1,37 @@ #include "common.h" -INCLUDE_ASM(const s32, "nu/nugfxsetcfb", nuGfxSetCfb); +#include "nu/nusys.h" + +void nuGfxSetCfb(u16** framebuf, u32 framebufnum) { + u32 i; + + nuGfxCfb = framebuf; + nuGfxCfbNum = framebufnum; + nuGfxCfbCounter = 0; + nuGfxCfb_ptr = nuGfxCfb[0]; + + nuGfxRetraceWait(1); + nuScSetFrameBufferNum(framebufnum); + + if (framebufnum > 1) { + s32 i; + + for (i = 0; i < framebufnum - 1; i++) { + if (nuGfxCfb[i] != nuGfxCfb[i+1]) { + break; + } + } + + if (i == framebufnum - 1) { + nuScSetFrameBufferNum(1); + } else { + for (i = 0; i < framebufnum; i++) { + if (osViGetNextFramebuffer() != nuGfxCfb[i]) { + nuGfxCfbCounter = i; + nuGfxCfb_ptr = nuGfxCfb[i]; + break; + } + } + } + } +} \ No newline at end of file