Page 1 of 1
Dreamcas KOS help
Posted: Mon Feb 04, 2013 3:06 pm
by lalacomun
Hi, a few days ago i started with dreamcast development, im working a bit with SDL, but when i try to load an image EX: SDL_Surface *img = SDL_LoadBMP("image.bmp"); it doesnt load it, i read about KOS Romdisk but i dont know how to use it with the makefile, so is there any other way for loading files???
Re: Dreamcas KOS help
Posted: Mon Feb 04, 2013 4:40 pm
by Falco Girgis
lalacomun wrote:Hi, a few days ago i started with dreamcast development, im working a bit with SDL, but when i try to load an image EX: SDL_Surface *img = SDL_LoadBMP("image.bmp"); it doesnt load it, i read about KOS Romdisk but i dont know how to use it with the makefile, so is there any other way for loading files???
...If you aren't mounting a ramdisk/romdisk, where exactly is your image located at?
Building a romdisk in KOS is a very easy extra step in your makefile. Just look at any image/texture examples in KOS.
If you're using a coder's cable or broadband adapter, you can also stream your file directly from the host machine via the "/pc/" virtual directory:
Code: Select all
//Loads directly from your PC.
SDL_Surface *img = SDL_LoadBMP("/pc/image.bmp");
The actual location "pc" points to on the host depends on whether you're running a real Linux distro or Cygwin. You can always create a new file/print the current directory from the Dreamcast to see where the hell you are.
Keep in mind that /pc/ is extremely slow with a coder's cable, and EXREMELY fast with a BBA. I'm assuming the USB coder's cable is somewhere in between.
Re: Dreamcas KOS help
Posted: Mon Feb 04, 2013 9:39 pm
by lalacomun
Falco Girgis wrote:lalacomun wrote:Hi, a few days ago i started with dreamcast development, im working a bit with SDL, but when i try to load an image EX: SDL_Surface *img = SDL_LoadBMP("image.bmp"); it doesnt load it, i read about KOS Romdisk but i dont know how to use it with the makefile, so is there any other way for loading files???
...If you aren't mounting a ramdisk/romdisk, where exactly is your image located at?
Building a romdisk in KOS is a very easy extra step in your makefile. Just look at any image/texture examples in KOS.
If you're using a coder's cable or broadband adapter, you can also stream your file directly from the host machine via the "/pc/" virtual directory:
Code: Select all
//Loads directly from your PC.
SDL_Surface *img = SDL_LoadBMP("/pc/image.bmp");
The actual location "pc" points to on the host depends on whether you're running a real Linux distro or Cygwin. You can always create a new file/print the current directory from the Dreamcast to see where the hell you are.
Keep in mind that /pc/ is extremely slow with a coder's cable, and EXREMELY fast with a BBA. I'm assuming the USB coder's cable is somewhere in between.
Thanks for the response, right now im using an emulator, so i cant use /pc/image.bmp i made a new makefile, that creates a romdisk.img and a romdisk.o, but it seems that the program isnt loading the file correctly
now for loading the image i use the folowing code:
Code: Select all
SDL_Surface*img = SDL_LoadBMP("/rd/image.bmp");
and the image is located on a folder called romdisk
this is the makefile:
Code: Select all
TARGET = video_test
OPTFLAGS=-O3 -fomit-frame-pointer
KOS_CFLAGS+= -I$(KOS_BASE)/../kos-ports/include/SDL-1.2.9 $(OPTFLAGS)
all: $(TARGET).bin
include $(KOS_BASE)/Makefile.rules
.SRCS = video_test.c \
OBJS = $(.SRCS:.c=.o)
clean:
rm -f $(OBJS) $(TARGET).elf $(TARGET).bin
-rm -f romdisk.*
rm-elf:
-rm -f romdisk.*
$(TARGET).elf: $(OBJS) romdisk.o
$(KOS_CC) $(KOS_CFLAGS) $(KOS_LDFLAGS) -o $(TARGET).elf $(KOS_START) \
$(OBJS) romdisk.o -lSDL_129 -lm $(OBJEXTRA) $(KOS_LIBS)
$(TARGET).bin: $(TARGET).elf
$(KOS_OBJCOPY) -R .stack -O binary $(TARGET).elf $(TARGET).bin
romdisk.img:
$(KOS_GENROMFS) -f romdisk.img -d romdisk -v
romdisk.o: romdisk.img
$(KOS_BASE)/utils/bin2o/bin2o romdisk.img romdisk romdisk.o
run: $(TARGET).bin
$(KOS_LOADER) $(TARGET).bin
dist:
rm -f $(OBJS) romdisk.o romdisk.img
$(KOS_STRIP) $(TARGET)
Any suggestions???
Re: Dreamcas KOS help
Posted: Mon Feb 04, 2013 10:13 pm
by Dormoxx
Do you have something like this:
Code: Select all
extern uint8 romdisk[];
KOS_INIT_ROMDISK(romdisk);
right outside your main()?
Re: Dreamcas KOS help
Posted: Mon Feb 04, 2013 11:14 pm
by lalacomun
Dormoxx wrote:Do you have something like this:
Code: Select all
extern uint8 romdisk[];
KOS_INIT_ROMDISK(romdisk);
right outside your main()?
Dude, i feel like an idiot, i had that, but inside my main function, now is working great!!
Thanks for all your responses!!
Re: Dreamcas KOS help
Posted: Mon Feb 04, 2013 11:24 pm
by Dormoxx
lalacomun wrote:Dormoxx wrote:Do you have something like this:
Code: Select all
extern uint8 romdisk[];
KOS_INIT_ROMDISK(romdisk);
right outside your main()?
Dude, i feel like an idiot, i had that, but inside my main function, now is working great!!
Thanks for all your responses!!
Hey, no problem. The only way I knew it was supposed to be outside of main() is because when I first started with KOS, I modified the PNG example and it was there, so I kept it there.
Re: Dreamcas KOS help
Posted: Tue Feb 05, 2013 12:36 pm
by Falco Girgis
Dormoxx wrote:lalacomun wrote:Dormoxx wrote:Do you have something like this:
Code: Select all
extern uint8 romdisk[];
KOS_INIT_ROMDISK(romdisk);
right outside your main()?
Dude, i feel like an idiot, i had that, but inside my main function, now is working great!!
Thanks for all your responses!!
Hey, no problem. The only way I knew it was supposed to be outside of main() is because when I first started with KOS, I modified the PNG example and it was there, so I kept it there.
Oh, snap. I was totally just reading your thread on DCemulation.org!