Getting SDL working on DC isn't that easy :/
I searched through the forum for old threads to spot the mistake I made, but couldn't find anything that solved my issue
First up my setup is KOS 2.0 and I'm using the SDL that came with it.
I think my issue is the romdisk thing.
I wrote sample cpp to test it before I wanted to port my SDL game over to DC.
When I run the code on the DC it's caught in an endless looped bootscreen.
So my code is:
Code: Select all
#include <kos.h>
#include <stdio.h>
#include <SDL.h>
#include <SDL_dreamcast.h>
extern uint8 romdisk[];
KOS_INIT_ROMDISK(romdisk);
int main() {
puts("\n\n * SDL Project");
SDL_Surface * screen;
SDL_Surface * image;
Uint32 flags = SDL_HWSURFACE;
SDL_Init(SDL_INIT_VIDEO);
screen = SDL_SetVideoMode(320, 240, 16, flags);
// Load BMP using SDL SDL_LoadBMP
image = SDL_LoadBMP("/rd/main_theme_2.bmp");
// Load JPG using SDL_image
// image = IMG_Load("image.jpg");
// Puting image on the screen up
while(1){
SDL_BlitSurface(image, NULL, screen, NULL);
SDL_Flip(screen);
//SDL_Delay(10000);
}
return 0;
}
Code: Select all
all: rm-elf game.elf
include $(KOS_BASE)/Makefile.rules
OBJS = game.o
KOS_LOCAL_CFLAGS = -I$(KOS_BASE)/addons/zlib
clean:
-rm -f game.elf $(OBJS)
-rm -f romdisk.*
dist:
-rm -f $(OBJS)
-rm -f romdisk.*
$(KOS_STRIP) game.elf
rm-elf:
-rm -f game.elf
-rm -f romdisk.*
game.elf: $(OBJS) romdisk.o
$(KOS_CC) $(KOS_CFLAGS) $(KOS_LDFLAGS) -o $@ $(KOS_START) $^ -lSDL -lz -lm $(KOS_LIBS)
romdisk.img:
$(KOS_GENROMFS) -f $@ -d romdisk -v
romdisk.o: romdisk.img
$(KOS_BASE)/utils/bin2o/bin2o $< romdisk $@
run: game.elf
$(KOS_LOADER) $<