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
User avatar
BlueCrab
The Crabby Overlord
The Crabby Overlord
Posts: 5658
https://www.artistsworkshop.eu/meble-kuchenne-na-wymiar-warszawa-gdzie-zamowic/
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 »

Do you mind if I add those changes into my driver, BlackAura?
BlackAura
DC Developer
DC Developer
Posts: 9951
Joined: Sun Dec 30, 2001 9:02 am
Has thanked: 0
Been thanked: 1 time

Post by BlackAura »

Go right ahead, if you can work out what they are. It's mostly this bit:

Code: Select all

   // Process axes 
   DC_Process_Axis(state->joyx, oldstate->joyx, 0, state->joyx << 8) 
   DC_Process_Axis(state->joyy, oldstate->joyy, 1, state->joyy << 8) 
   DC_Process_Axis(state->ltrig, oldstate->ltrig, 2, state->ltrig << 7) 
   DC_Process_Axis(state->rtrig, oldstate->rtrig, 3, state->rtrig << 7) 
   DC_Process_Axis(state->joy2x, oldstate->joy2x, 4, state->joy2x << 8) 
   DC_Process_Axis(state->joy2y, oldstate->joy2y, 5, state->joy2y << 8) 
The bitshifts scale the DC's axes up from -127...127 and 0...255 to -32K...32K.
User avatar
BlueCrab
The Crabby Overlord
The Crabby Overlord
Posts: 5658
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 »

Ok, thanks.... I'll add it tonight. After I finish my homework.
Bombshell
DC Developer
DC Developer
Posts: 179
Joined: Wed Nov 20, 2002 8:29 pm
Has thanked: 0
Been thanked: 0

Post by Bombshell »

Reaper2K2 I am just about finished the Slot machine Demo nothing extravagent mostly not that fun to play over and over again, next time i am gonna make something better like a pacman clone or a early donkey kong clone

I just have to add support for the DC controller or else you can only keyboard
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 »

THank you for showing the time and effort you spent on that game

is the source in SDL i like to take a look if i could

reaperangel@yahoo.com

B A and BC .>have posted the dc controler drivers now

thanks bombshell! cool man!
http://homebrew.dcemulation.com/dcgames/ *homebrew webbrowser games *

http://r2k2gate.topcities.com *dev site and my releases*
Image
Im' a Commodorian are you?
Bombshell
DC Developer
DC Developer
Posts: 179
Joined: Wed Nov 20, 2002 8:29 pm
Has thanked: 0
Been thanked: 0

Post by Bombshell »

Reaper2K2 I emailed you a source and a link to a tarball where you can download the graphics check your mail

I have a Java Project to finish up right now once I am done I am gonna start working on a Retro Donkey Kong Clone I think that should be fun.. Anywas 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 »

thanks i emailed you what i did with the source some think may be wrong with SDL_IMAGE so can you test what i sent you ?

IT only gives me a blank screen only made small changes to make it more suited to the DC like the screen res

ok off to sleep i go 24 hour session! :D :o


IT should work at lest i think so
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: 5658
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've got a working version of SDL_image for Dreamcast (well, at least the PNG part). What image types do you need enabled, and I'll make a version with those types.
Bombshell
DC Developer
DC Developer
Posts: 179
Joined: Wed Nov 20, 2002 8:29 pm
Has thanked: 0
Been thanked: 0

Post by Bombshell »

BlueCrab Well id like to have JPG because of the amount of space BMPs take up but i dont feel like reprogramming the source ATM, BTW how do you program Functions suchs as SDL_image which can display images can you give an example of how to start programming them or maybe a page so that i could do it myslef.
User avatar
BlueCrab
The Crabby Overlord
The Crabby Overlord
Posts: 5658
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 »

Ok, here's how you can load and display images in SDL_Image, it is very similar to doing it with BMPs in SDL. This is an adapted form of something I posted earlier (in a different topic).

Code: Select all

#include "SDL.h"
#include "SDL_image.h"
int main(int argc, char *argv[])   {
   uint32 flags = SDL_HWSURFACE | SDL_DOUBLEBUF;
   SDL_Surface * screen, * image;

   if(SDL_Init(SDL_INIT_VIDEO) < 0)   {
      return -1;
   }

   /* Set our video mode to 640x480 16bpp */
   screen = SDL_SetVideoMode(640, 480, 16, flags);

/* This stuff, right now, is only applicable to the DC version. */
#ifdef _arch_dreamcast

   /* Load up disclaimer */
   image = IMG_Load("/cd/images/image.jpg"); /* This is the only difference between using SDL_image, and SDL's builtin BMP function, all other stuff works just the same */

   /* Put up the Disclaimer */
   SDL_BlitSurface(image, NULL, screen, NULL);
   SDL_Flip(screen);

   SDL_Delay(20000);

   /* Get rid of the image */
   SDL_FreeSurface(image);

#endif

/* put the rest of your game here, of course, in different functions */
   return 0;
}
I'll get a copy of SDL_image up after I get back from youth group. It'll have support for all types that KOS supports (meaning that you need to add -ljpeg -lpng etc. to your linker line). And to answer your question, I've never written (and released) anything of the sort, the best way to do it is to study the documentation that comes with the library for that image type. It'll usually give you an idea of how to program with it. Oh, and if you are looking to conserve space, PNG files are generally smaller than JPEG files.
User avatar
BlueCrab
The Crabby Overlord
The Crabby Overlord
Posts: 5658
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 »

Ok, I've posted a (should-be) working version of SDL_image on my site, use the banner in my sig, or the WWW button to get there, then click on downloads, and let me know how it works for you.
Bombshell
DC Developer
DC Developer
Posts: 179
Joined: Wed Nov 20, 2002 8:29 pm
Has thanked: 0
Been thanked: 0

Post by Bombshell »

BlueCrab thanks, I have to switch into root mode to do it do right now i am just gonna chill cause i want to code a little more, Thanks a lot for all the work

Reaper, once you awake from hibernation check your mail
User avatar
BlueCrab
The Crabby Overlord
The Crabby Overlord
Posts: 5658
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 »

SDL_image was no problem at all, once I figured out what was wrong...... Stupid setjmp and longjmp calls..... :?
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 »

GREAT i wondered why when i used it black screen is all i got SO OFF to test this version i thought the one i compiled for me was working 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: 5658
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 really do need to get a dev cable. If I had one, I could have figured that out right away. But I don't..... sadly..... I think that I'll need one to get sound working in SDL for all of us. But I'm going to try again today without.
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 »

TO BOMBSHELL AKA LUCIOUS

ive now got it working on the dc so no worrys iam going to really work on it thanks for doing this I HAVE to really fix the grafix and the real effect is not right other then that with a bit of work i may be able to get it looking almost like my webgame
DUDE if you want to join R.A.D software my site it be no worrys i can provide hosting and stuff like that and ive got a web site maker freind ....

SO im going to try turn your port of my game into a full game iwt music and a new effect ive been working on .....

bombshell NEEDS DEVVER STARS ANY one listening ???

thanks again it would of taken me years to do that i had it half done so ill add those bits and grafix

I should say 4 weeks or so it be finshed ill give you the first beta to try

back to SDL it rocks
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 »

I think the sound problem is somethink like this

/* #define dc_snd_base ((volatile unsigned char *)0x00800000) */ /* arm side */
#define dc_snd_base ((volatile unsigned char *)0xa0700000) /* dc side */
this bit use to be 0x00800000 as well and it dont work it that same as SDL silent whenchanged to 0xa0700000 the sound then plays its prolly nothing to do with it but im sure there just one wrong thin in it that needs changing


/* Some convienence macros */
#define SNDREGADDR(x) (0xa0700000 + (x))
#define CHNREGADDR(ch,x) SNDREGADDR(0x80*(ch)+(x))


just some think that happend in quake i thought it may help

SDL sound does work for DC bero had it on and siad some think about the paths not being right to me in email once you change them and sound works he told me but i dont know what to change them to :o
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: 5658
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 »

The thing about the paths is talking about playing MIDI files in timidity, and it is changed already in SDL_mixer. (Both BERO's version and the one that was on my site). Anyway, off to school now.
Later.
dragonsimoto
DC Developer
DC Developer
Posts: 78
Joined: Wed Oct 17, 2001 7:44 pm
Location: USA
Has thanked: 0
Been thanked: 0
Contact:

Post by dragonsimoto »

could someone send me your latest sdl files? dragonsimoto@yahoo.com

unless there isnt much changed from cvs current.

Thanks hope to develop here again shortly.
"If your a 'tard use the pictures on the left for navigation."

<img src="http://www.caskam.com/images/plan9avatar.gif"></img>
Bombshell
DC Developer
DC Developer
Posts: 179
Joined: Wed Nov 20, 2002 8:29 pm
Has thanked: 0
Been thanked: 0

Post by Bombshell »

Glad to hear it is working Reaper, I would be honoured to join your Dev Team. If you want any help from me to get this version more like the web version I can help. It was kind of a fast job and can be greatly improed upon

Also can you please send me the compiled binary?
Post Reply