DC and SDL

If you have any questions on programming, this is the place to ask them, whether you're a newbie or an experienced programmer. Discussion on programming in general is also welcome. We will help you with programming homework, but we will not do your work for you! Any porting requests must be made in Developmental Ideas.
Post Reply
q_006
Mental DCEmu
Mental DCEmu
Posts: 415
https://www.artistsworkshop.eu/meble-kuchenne-na-wymiar-warszawa-gdzie-zamowic/
Joined: Thu Oct 10, 2002 7:18 pm
Has thanked: 0
Been thanked: 0
Contact:

DC and SDL

Post by q_006 »

has anyone heard anything about this lately?
how are we supposed to use it?
is it supposed to replace KOS or have KOS code inside SDL code??

i don't know. it was on the radar and then disappeared!!
i went to the website but nothing was said about it.....

somebody help me out.... let me know.... please!!!!!
minerjr
DCEmu Cool Newbie
DCEmu Cool Newbie
Posts: 12
Joined: Fri Nov 01, 2002 12:23 pm
Has thanked: 0
Been thanked: 0

Post by minerjr »

SDL for the dc uses KOS to draw graphics and play sound and do all the other things SDL does. So it does not replace KOS but is another api layer ontop of KOS to make porting and writing games easier.

Now the first beta version works with KOS 1.1.7 the newer version is missing the proper make file to link the files. Also there are differences in the first beta in the mapple bus code that makes it not compatiable. IE the joystick and keyboard code. Also some of the internals need to be updated in kos and sdl to get it to work with the kos 1.1.8 or newer.

If anyone needs help with compiling sdl for the dc reply here and I will post my make file and give hints to how to compile it.

PS i had to edit the makefile with the first beta version to get it to compile.

minerjr

EDIT

I have been watching the mailing list and it appears that the needed changes to KOS has been entered to the CVS tree for SDL to be included into the CVS tree. I believe that when Dan releases KOS 1.1.9 it will include SDL with it. This is just my hunch.

minerjr
User avatar
BlueCrab
The Crabby Overlord
The Crabby Overlord
Posts: 5666
Joined: Mon May 27, 2002 11:31 am
Location: Sailing the Skies of Arcadia
Has thanked: 9 times
Been thanked: 69 times
Contact:

Post by BlueCrab »

I have a patch I've been working on to get SDL 1.2.5 to compile nicely with a CVS version of KOS. It fixes a few problems I had while compiling it, and it runs correctly! I think I'll post it later today, once I get a few little bugs out of it.

Edit: I didn't have to change any of KOS to get it to compile, just a few things in the SDL source.
reaper2k2
DC Developer
DC Developer
Posts: 2648
Joined: Sun Mar 24, 2002 7:48 pm
Has thanked: 0
Been thanked: 0
Contact:

Post by reaper2k2 »

BlueCrab wrote:I have a patch I've been working on to get SDL 1.2.5 to compile nicely with a CVS version of KOS. It fixes a few problems I had while compiling it, and it runs correctly! I think I'll post it later today, once I get a few little bugs out of it.

Edit: I didn't have to change any of KOS to get it to compile, just a few things in the SDL source.
VERY cool bluecrab i would love to see sdl compile you seem to be there to help people with the best of things this is one i really love to work with

reaper_angel@hotmail.com or here if you can post the patched version

i be very greatfull to you i could start porting sdl games then as no one i know got it to compile at all this is great news

cheers :wink:
http://homebrew.dcemulation.com/dcgames/ *homebrew webbrowser games *

http://r2k2gate.topcities.com *dev site and my releases*
Image
Im' a Commodorian are you?
User avatar
BlueCrab
The Crabby Overlord
The Crabby Overlord
Posts: 5666
Joined: Mon May 27, 2002 11:31 am
Location: Sailing the Skies of Arcadia
Has thanked: 9 times
Been thanked: 69 times
Contact:

Post by BlueCrab »

You can get SDL 1.2.5 support for KOS from my webspace at http://vmudomain.tripod.com/kos_stuff/. Please test it and see if it works.

To use it, just un-tar and un-gzip the file in the $KOS_BASE directory. Then recompile KOS.

Tell me if you have any problems with it.

I wish anyone who uses it the best of luck!
reaper2k2
DC Developer
DC Developer
Posts: 2648
Joined: Sun Mar 24, 2002 7:48 pm
Has thanked: 0
Been thanked: 0
Contact:

thanks

Post by reaper2k2 »

thanks going to try it right now ill give reports of what i can compile with it

later thanks for your work bluecrab
http://homebrew.dcemulation.com/dcgames/ *homebrew webbrowser games *

http://r2k2gate.topcities.com *dev site and my releases*
Image
Im' a Commodorian are you?
User avatar
BlueCrab
The Crabby Overlord
The Crabby Overlord
Posts: 5666
Joined: Mon May 27, 2002 11:31 am
Location: Sailing the Skies of Arcadia
Has thanked: 9 times
Been thanked: 69 times
Contact:

Post by BlueCrab »

Your welcome reaper2k2, and keep me updated. The only thing I've tryied compiling so far is SDLMappy, and that worked fine.
reaper2k2
DC Developer
DC Developer
Posts: 2648
Joined: Sun Mar 24, 2002 7:48 pm
Has thanked: 0
Been thanked: 0
Contact:

ok

Post by reaper2k2 »

IVE been trying to update my version of kos1.18 with the files from cvs one by one its very slow is there a better way?

it fails to compile with this error but im not sure if its due to my version of kos being 1.18 with not all the updates

if some one has the whole addon dir uptodated from cvs i like to have it

if you could zip it .

SDL_syscdrom.c line 100 line 109 is why it fails to compile for me

by commenting out those 2 lines it compiles but surely its going to be troublesum with out it?

any ideas ? or is it due to my old version of kos

could you post the mak file of sdlmappy just want to mke sure ive got the right way of using the lib thanks bluecrab tell me to stop asking for things any time ok lol
http://homebrew.dcemulation.com/dcgames/ *homebrew webbrowser games *

http://r2k2gate.topcities.com *dev site and my releases*
Image
Im' a Commodorian are you?
User avatar
BlueCrab
The Crabby Overlord
The Crabby Overlord
Posts: 5666
Joined: Mon May 27, 2002 11:31 am
Location: Sailing the Skies of Arcadia
Has thanked: 9 times
Been thanked: 69 times
Contact:

Post by BlueCrab »

What OS are you using? If you are using Windows and Cygwin you can easily get the entire CVS version of KOS by doing the following.

Code: Select all

cvs -d:pserver:anonymous@cvs.cadcdev.sourceforge.net:/cvsroot/cadcdev login

Press enter when asked for a password

cvs -d:pserver:anonymous@cvs.cadcdev.sourceforge.net:/cvsroot/cadcdev -z3 co kos
That should get the entire CVS tree from the server for you. BTW: If you are using MinGW/MSYS or Linux that should also work.

Here's the bulk of the makefile I am using for SDLMappy:

Code: Select all


all: SDLMappy.elf SDLMappy.bin

include $(KOS_BASE)/Makefile.rules

OBJS = main.o SDLMappy.o


SDLMappy.elf: $(OBJS)
	$(KOS_CC) $(KOS_CFLAGS) $(KOS_LOCAL_CFLAGS) $(KOS_LDFLAGS) -o $@ $(KOS_START) $^ -lSDL -lk++ -lm $(KOS_LIBS)

SDLMappy.bin:
	$(KOS_OBJCOPY) -O binary SDLMappy.elf output.bin
	scramble output.bin SDLMappy.bin

clean:
	rm $(OBJS)
	rm SDL.elf
	rm output.bin
The problem on SDL_syscdrom.c line 100 is due to the fact that the name of the variable being looked for was fixed in the CVS version. I believe that you can just change the word "leadout_sector" to "dunno" and it should work. I don't quite understand what is wrong on 109, maybe you could post the entire error that the compiler gives you, and then I could look.

I don't mind people asking me questions. Its better they get asked now, while my changes are still fresh in my head than in a month, when I won't remember half of the changes I made!

I wish you luck.
reaper2k2
DC Developer
DC Developer
Posts: 2648
Joined: Sun Mar 24, 2002 7:48 pm
Has thanked: 0
Been thanked: 0
Contact:

Post by reaper2k2 »

IM using cygwin ill try that command thanks

IT's updating it now this sure saves time

IVe tryed compiling some games with out changing the source airpong being one only errors were scanf errors ....


HAS any one tryed to compile prboom now since it needs no sourcechange or so bero told me in email once not even controler changes since its ported in the sdl lib keyboard mouse will work


to see if will compile now ?
http://homebrew.dcemulation.com/dcgames/ *homebrew webbrowser games *

http://r2k2gate.topcities.com *dev site and my releases*
Image
Im' a Commodorian are you?
User avatar
BlueCrab
The Crabby Overlord
The Crabby Overlord
Posts: 5666
Joined: Mon May 27, 2002 11:31 am
Location: Sailing the Skies of Arcadia
Has thanked: 9 times
Been thanked: 69 times
Contact:

Post by BlueCrab »

I was considering trying to compile prboom, but haven't had the time due to Black Friday and Christmas shopping :lol: Anyway, I'll see if it will compile later on tonight. (I don't see why it wouldn't as I only made a few bugfix changes, and made it a bit easier to compile). I'll report back later.

EDIT:
I just realized that OpenGL support is needed to compile prboom, and for that you need BERO's libgl, which I have personally not used. I'll look into it more later.
reaper2k2
DC Developer
DC Developer
Posts: 2648
Joined: Sun Mar 24, 2002 7:48 pm
Has thanked: 0
Been thanked: 0
Contact:

Post by reaper2k2 »

BlueCrab wrote:I was considering trying to compile prboom, but haven't had the time due to Black Friday and Christmas shopping :lol: Anyway, I'll see if it will compile later on tonight. (I don't see why it wouldn't as I only made a few bugfix changes, and made it a bit easier to compile). I'll report back later.

EDIT:
I just realized that OpenGL support is needed to compile prboom, and for that you need BERO's libgl, which I have personally not used. I'll look into it more later.
EDIT i fixed the problem i had it was due to my version of kos i had made changes to that i forgot about ....

its now working perfectly
Last edited by reaper2k2 on Sat Nov 30, 2002 2:55 pm, edited 2 times in total.
http://homebrew.dcemulation.com/dcgames/ *homebrew webbrowser games *

http://r2k2gate.topcities.com *dev site and my releases*
Image
Im' a Commodorian are you?
reaper2k2
DC Developer
DC Developer
Posts: 2648
Joined: Sun Mar 24, 2002 7:48 pm
Has thanked: 0
Been thanked: 0
Contact:

thanks

Post by reaper2k2 »

THanks for your help and work blue crab i just got sldmappy to compile TOO now .....

FOR once ive got a fully working dev system again
http://homebrew.dcemulation.com/dcgames/ *homebrew webbrowser games *

http://r2k2gate.topcities.com *dev site and my releases*
Image
Im' a Commodorian are you?
reaper2k2
DC Developer
DC Developer
Posts: 2648
Joined: Sun Mar 24, 2002 7:48 pm
Has thanked: 0
Been thanked: 0
Contact:

Post by reaper2k2 »

http://www.libsdl.org/projects/flxplay/

IT compiles with no errors but only reboots for me when tryed on the dc

because its a commandline app and since it has no file name to play its just like clicking a exe with out a option it reboots. On windows the program closes etc

http://www.libsdl.org/projects/fire/

compiles with warnings but works , nice ! you have to have a keyboard to test all the fireworks effects

more testing to go

also any one want to try the bins on the dreamcast them self just ask and i will email , or uploaded them all soon enff


OK ive put together bits from here and there and have a voxel landscape 3d type demo using the SDL lib for dc

IVE combinded DC_LAND menu's with the voxel demo so its got a title screen .... 2 addon libs in one example ill be posting the source on my site later one time... next will be music of some sort

like i said any one want to try them ill upload the 1ST_READ.bins

IM working on a oldskool DEMO like the old c64 ones music effects and a scroller got the music the scroller working hope to get it all finshed this week.... ILL be using sdl kos addon libs and some other libs ill put out the source as well when finshed ...

HAVing fun like the old days at moment WHO wants to be in the greets lol


JUST a ? bluecrab was your sdlmappy grafix messed up when you tryed it ive got it working you can scroll the man round the screen but he is repeating 4 times plus the textures are not displaying right ... was it working just like the windows port to you...

this lib could be used for all sorts of home brew games to
http://homebrew.dcemulation.com/dcgames/ *homebrew webbrowser games *

http://r2k2gate.topcities.com *dev site and my releases*
Image
Im' a Commodorian are you?
User avatar
BlueCrab
The Crabby Overlord
The Crabby Overlord
Posts: 5666
Joined: Mon May 27, 2002 11:31 am
Location: Sailing the Skies of Arcadia
Has thanked: 9 times
Been thanked: 69 times
Contact:

Post by BlueCrab »

There were a few glitches on mine, but I have not looked at the windows port yet. I haven't quite gotten SDL to compile right for my Windows system yet because I don't have the DirectX SDK installed (I thought I did). I thought maybe that it was a problem in the SDLMappy code, but I guess I'll look after I finish my Homework for school.

Glad you could get it to work!
reaper2k2
DC Developer
DC Developer
Posts: 2648
Joined: Sun Mar 24, 2002 7:48 pm
Has thanked: 0
Been thanked: 0
Contact:

Post by reaper2k2 »

DEV C++ has all the addon libs to use SDL now IM back working on stuff with it it now ....

yeah ITS fun sdl ive tryed to compile heeps of games apps seems only examples with out sound work so far if you can find a working sound example that will compile with the dc SDL it be helpfull

WHAT is no new line at the end of file error? i get that a bit never herd of it before.

any ways back to work !
http://homebrew.dcemulation.com/dcgames/ *homebrew webbrowser games *

http://r2k2gate.topcities.com *dev site and my releases*
Image
Im' a Commodorian are you?
User avatar
BlueCrab
The Crabby Overlord
The Crabby Overlord
Posts: 5666
Joined: Mon May 27, 2002 11:31 am
Location: Sailing the Skies of Arcadia
Has thanked: 9 times
Been thanked: 69 times
Contact:

Post by BlueCrab »

Well I finally got it to compile on Windows, with one problem in SDLMappy, and I believe that the problem in the Dreamcast version you're having is with the "parallax bitmap". Other than that everything seems good in the Dreamcast verion. If you just disable the parallax bitmap, it should work a bit better.

And about the no newline at end of file, its just GCC being a bit annoying, if you want to get rid of it, just open up the files giving you the problem, go to the last line and press Enter (return).
reaper2k2
DC Developer
DC Developer
Posts: 2648
Joined: Sun Mar 24, 2002 7:48 pm
Has thanked: 0
Been thanked: 0
Contact:

Post by reaper2k2 »

I think this sdl lib has great uses in video modes for emualtors or homebrew games and sicne you can test it in windows linux its makes working on it easyer ..... going to have to study it more


going to compile a list of every think i get to compile no source change first and use them as examples
what do you think ? some think to do i was rather at a dead end with mame .. for speed warmtoe has the anwser for that but ive not seen his source changes yet....

you know of any good sites with SDL apps games besided the home page its quiet hard to fine platform independed SDL source

i found a beos site with lots of sdl source code games etc

http://www.bebits.com/search?search=sdl&start=50

what can we do about using SDL_mixer lib was it ported to dc to

i normaly dont ask any ? but if you dont mind ill prolly bore you silly with my ? on things lol
http://homebrew.dcemulation.com/dcgames/ *homebrew webbrowser games *

http://r2k2gate.topcities.com *dev site and my releases*
Image
Im' a Commodorian are you?
User avatar
BlueCrab
The Crabby Overlord
The Crabby Overlord
Posts: 5666
Joined: Mon May 27, 2002 11:31 am
Location: Sailing the Skies of Arcadia
Has thanked: 9 times
Been thanked: 69 times
Contact:

Post by BlueCrab »

I believe that SDL_mixer was ported to DC by BERO also, I am a bit tired right now, or I would look into it now. I'll look tomorrow after school at it. Sorry if I sound kinda grumpy, but I have to be up in about 6 hours.... :|
reaper2k2
DC Developer
DC Developer
Posts: 2648
Joined: Sun Mar 24, 2002 7:48 pm
Has thanked: 0
Been thanked: 0
Contact:

Post by reaper2k2 »

BlueCrab wrote:I believe that SDL_mixer was ported to DC by BERO also, I am a bit tired right now, or I would look into it now. I'll look tomorrow after school at it. Sorry if I sound kinda grumpy, but I have to be up in about 6 hours.... :|

no worrys i dont have to do any think right now

i got the lib from beros site installed it etc but it gives errors when trying to compile examples needing so far

report later

ok ive got this example and made a monor change to it its to display a bitmap image with SDL for dc

Code: Select all

#include <stdio.h>
#include <stdlib.h>
#include "SDL.h"
#include "SDL_timer.h"

void ComplainAndExit(void)
{
        fprintf(stderr, "Problem: %s\n", SDL_GetError());
        exit(1);
}

int main(int argc, char *argv[])
{
        SDL_PixelFormat fmt;
        SDL_Surface *screen, *locked;
        SDL_Surface *imagebmp, *image;
        SDL_Rect dstrect;
        int i;
        Uint8 *buffer;

        /* Initialize SDL */
        if ( SDL_Init(SDL_INIT_VIDEO) < 0 ) {
                ComplainAndExit();
        }
        atexit(SDL_Quit);

        /* Load a BMP image into a surface */
        imagebmp = SDL_LoadBMP("/cd/image.bmp");   //only change needed
        if ( imagebmp == NULL ) {
                ComplainAndExit();
        }

        /* Set the video mode (640x480 at native depth) */
        screen = SDL_SetVideoMode(640, 480, 0, SDL_HWSURFACE|SDL_FULLSCREEN);
        if ( screen == NULL ) {
                ComplainAndExit();
        }

        /* Set the video colormap */
        if ( imagebmp->format->palette != NULL ) {
                SDL_SetColors(screen,
                                imagebmp->format->palette->colors, 0,
                                imagebmp->format->palette->ncolors);
        }

        /* Convert the image to the video format (maps colors) */
        image = SDL_DisplayFormat(imagebmp);
        SDL_FreeSurface(imagebmp);
        if ( image == NULL ) {
                ComplainAndExit();
        }

        /* Draw bands of color on the raw surface */
        if ( SDL_MUSTLOCK(screen) ) {
                if ( SDL_LockSurface(screen) < 0 )
                        ComplainAndExit();
        }
        buffer=(Uint8 *)screen->pixels;
        for ( i=0; i<screen->h; ++i ) {
                memset(buffer,(i*255)/screen->h,
                        screen->w*screen->format->BytesPerPixel);
                buffer += screen->pitch;
        }
        if ( SDL_MUSTLOCK(screen) ) {
                SDL_UnlockSurface(screen);
        }

        /* Blit the image to the center of the screen */
        dstrect.x = (screen->w-image->w)/2;
        dstrect.y = (screen->h-image->h)/2;
        dstrect.w = image->w;
        dstrect.h = image->h;
        if ( SDL_BlitSurface(image, NULL, screen, &dstrect) < 0 ) {
                SDL_FreeSurface(image);
                ComplainAndExit();
        }
        SDL_FreeSurface(image);

        /* Update the screen */
        SDL_UpdateRects(screen, 1, &dstrect);

        SDL_Delay(5000);        /* Wait 5 seconds */    // change this to display longer
        exit(0);
}
use the same mak file you had up there...

place a IMAGE.BMP on the same cd root and it will display fullscreen

some think is wrong with the sdl lib the bmp is not displaying correctly for me it looks like its scanlined and on top of its self ...

can any one test it and see if its displaying right for them !
http://homebrew.dcemulation.com/dcgames/ *homebrew webbrowser games *

http://r2k2gate.topcities.com *dev site and my releases*
Image
Im' a Commodorian are you?
Post Reply