Dreamcas KOS help
Moderator: Coders of Rage
- lalacomun
- VS Setup Wizard
- Posts: 114
- Joined: Wed Dec 28, 2011 10:18 pm
- Favorite Gaming Platforms: psx, nintendo ds, gameboy advance, xbox 360, ps2
- Programming Language of Choice: C++
- Location: Argentina
- Contact:
Dreamcas KOS help
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???
- Falco Girgis
- Elysian Shadows Team
- Posts: 10294
- Joined: Thu May 20, 2004 2:04 pm
- Current Project: Elysian Shadows
- Favorite Gaming Platforms: Dreamcast, SNES, NES
- Programming Language of Choice: C/++
- Location: Studio Vorbis, AL
- Contact:
Re: Dreamcas KOS help
...If you aren't mounting a ramdisk/romdisk, where exactly is your image located at?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???
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");
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.
- lalacomun
- VS Setup Wizard
- Posts: 114
- Joined: Wed Dec 28, 2011 10:18 pm
- Favorite Gaming Platforms: psx, nintendo ds, gameboy advance, xbox 360, ps2
- Programming Language of Choice: C++
- Location: Argentina
- Contact:
Re: Dreamcas KOS help
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 correctlyFalco Girgis wrote:...If you aren't mounting a ramdisk/romdisk, where exactly is your image located at?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???
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: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.Code: Select all
//Loads directly from your PC. SDL_Surface *img = SDL_LoadBMP("/pc/image.bmp");
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.
now for loading the image i use the folowing code:
Code: Select all
SDL_Surface*img = SDL_LoadBMP("/rd/image.bmp");
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)
- Dormoxx
- Chaos Rift Newbie
- Posts: 19
- Joined: Sun Feb 05, 2012 9:01 am
- Current Project: Learning SFML and KallistiOS
- Favorite Gaming Platforms: PC, Dreamcast, SNES
- Programming Language of Choice: C++
- Location: Gigazilla HQ, Kentucky
- Contact:
Re: Dreamcas KOS help
Do you have something like this:
right outside your main()?
Code: Select all
extern uint8 romdisk[];
KOS_INIT_ROMDISK(romdisk);
- lalacomun
- VS Setup Wizard
- Posts: 114
- Joined: Wed Dec 28, 2011 10:18 pm
- Favorite Gaming Platforms: psx, nintendo ds, gameboy advance, xbox 360, ps2
- Programming Language of Choice: C++
- Location: Argentina
- Contact:
Re: Dreamcas KOS help
Dude, i feel like an idiot, i had that, but inside my main function, now is working great!!Dormoxx wrote:Do you have something like this:right outside your main()?Code: Select all
extern uint8 romdisk[]; KOS_INIT_ROMDISK(romdisk);
Thanks for all your responses!!
- Dormoxx
- Chaos Rift Newbie
- Posts: 19
- Joined: Sun Feb 05, 2012 9:01 am
- Current Project: Learning SFML and KallistiOS
- Favorite Gaming Platforms: PC, Dreamcast, SNES
- Programming Language of Choice: C++
- Location: Gigazilla HQ, Kentucky
- Contact:
Re: Dreamcas KOS help
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.lalacomun wrote:Dude, i feel like an idiot, i had that, but inside my main function, now is working great!!Dormoxx wrote:Do you have something like this:right outside your main()?Code: Select all
extern uint8 romdisk[]; KOS_INIT_ROMDISK(romdisk);
Thanks for all your responses!!
- Falco Girgis
- Elysian Shadows Team
- Posts: 10294
- Joined: Thu May 20, 2004 2:04 pm
- Current Project: Elysian Shadows
- Favorite Gaming Platforms: Dreamcast, SNES, NES
- Programming Language of Choice: C/++
- Location: Studio Vorbis, AL
- Contact:
Re: Dreamcas KOS help
Oh, snap. I was totally just reading your thread on DCemulation.org!Dormoxx wrote: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.lalacomun wrote:Dude, i feel like an idiot, i had that, but inside my main function, now is working great!!Dormoxx wrote:Do you have something like this:right outside your main()?Code: Select all
extern uint8 romdisk[]; KOS_INIT_ROMDISK(romdisk);
Thanks for all your responses!!