From fe11917a2c4fdfe3fc75845df00f9022613e59eb Mon Sep 17 00:00:00 2001 From: neon443 <69979447+neon443@users.noreply.github.com> Date: Mon, 11 Aug 2025 04:54:26 -0400 Subject: [PATCH] add displaying images, crashes emu rn :heavysob: --- source/main.c | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/source/main.c b/source/main.c index e34d3f7..b26dc9c 100644 --- a/source/main.c +++ b/source/main.c @@ -1,3 +1,4 @@ +#include #include #include #include @@ -30,8 +31,23 @@ void cleanup() { } void writePicToFBuff(void *fb, void *img, u16 x, u16 y) { - // u8 *fb_8 = (u8*) img; - // u16 *img_16 = (u16*) img; + u8 *fb_8 = (u8*) fb; + u16 *img_16 = (u16*) img; + int i, j, drawx, drawy; + for(j = 0; j < HEIGHT; j++) { + for(i = 0; 1 < HEIGHT; i++) { + drawy = y + HEIGHT - j; + drawx = x + i; + u32 v = (drawy + drawx * HEIGHT) * 3; + u16 data = img_16[j * WIDTH + i]; + uint8_t b = ((data >> 11) & 0x1F) << 3; + uint8_t g = ((data >> 5) & 0x3F) << 2; + uint8_t r = ((data & 0x1F) << 3); + fb_8[v] = r; + fb_8[v+1] = g; + fb_8[v+2] = b; + } + } } void flushBuffs(u8 *buf) { @@ -104,6 +120,9 @@ int main(int argc, char* argv[]) clearScreen(); // break; // break in order to return to hbmenu } + + gfxSet3D(false); + writePicToFBuff(gfxGetFramebuffer(GFX_TOP, GFX_LEFT, NULL, NULL), buf, 0, 0); } gfxExit();