Homebrew SDL 3DS - Getting an image to screen

orochii

New Member
OP
Newbie
Joined
Jan 31, 2021
Messages
1
Trophies
0
Age
32
XP
35
Country
Costa Rica
Hi! I'm new on homebrew and specially on 3DS homebrew. I want to do a simple game just for trying out stuff. I decided to use SDL 1.2, as it should simplify some of the low-level stuff, so I thought it was a good compromise.

I've done simple small games with SDL before, I'm not an expert but I'd say I can do stuff happen at the very least. The issue is I don't really know the specifics of how to make the game read the image and display it on 3DS. I know of the RomFS (by my understanding it is like a virtual file system?), so I threw my images in there, but I'm probably missing steps, since all I get is a black screen. I also don't get any errors, at least when testing it out on Citra.

My code looks exactly like this, since I'm just starting to dabble in, I just threw LazyFoo's SDL 1.2 Tutorial first step and did a couple minimal changes here and there (I'm deleting spaces and comments just for the sake of space):
Code:
#include <SDL/SDL.h>

int main( int argc, char* args[] )
{
    SDL_Surface* hello = NULL;
    SDL_Surface* screen = NULL;
    SDL_Init( SDL_INIT_EVERYTHING );
    screen = SDL_SetVideoMode(400, 480, 32, SDL_DUALSCR);
    hello = SDL_LoadBMP( "title.bmp" );
    SDL_BlitSurface( hello, NULL, screen, NULL );
    SDL_Flip( screen );
    SDL_Delay( 2000 );
    SDL_FreeSurface( hello );
    SDL_Quit();
    return 0;
}

Run make, it compiles, so SDL should be properly configured on the makefile and my environment should be all set.
I run that, the game doesn't crash, but doesn't display my image (a dumb 320x240 white canvas with some letters on it).

As I mentioned, I know RomFS exists, but I don't really know what to do with it after that. I think nothing since I added a huge file, just to see if my file size changed, and it did (went from ~100kb to 8Mb). I don't even know if the reference to my file is correct, or maybe I need to add something like "romfs/" at the start or something.

Or maybe my video mode is wrong.

I've also tried looking at other people's code, but I still can't figure it out.

Help very appreciated.

EDIT: There is also this weird thing that still makes me wonder, where my mouse actually displays on the 3DS screen, inside Citra, scaled up. Just there, static, on the top left corner. Frankly I don't understand what's happening. Is Citra reading a buffer from my PC's RAM or something?
whyyoudothis.jpg
Might throw it into my 3DS just to check it out, but honestly I have no faith in that it's gonna change a thing.

EDIT: Nvm it appears on my 3DS too, so I guess it's a default cursor. Don't mind me I didn't even know that existed.
 
Last edited by orochii,

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
    Perpo @ Perpo: heyy does anybody knows a library where to find shader cache for ryujinx?