Page 1 of 1

Jukebox

Posted: Mon Jun 08, 2015 12:01 pm
by Mills
Hi.

I'm making a jukebox for MD/GEN. I first made it for SNES and now i'm porting it to SGDK.

There is no vgm archive for homebrew, covers... for the ym2612 chip, so i'd like some help to find vgm's, xgm's... whatever you like to be included in the jukebox. (I already found some at vgmrips).

OST's from games will also be included.


This is the snes version:

Image


This is the MD/GEN version:

Image

As you see i have trouble setting the sprites to represent the music tittle, first i stored sprite numbers for every character:

Code: Select all

char *Char[40] = {&sprite0,&sprite1...........};
This stores 40 sprites, everythig OK

Code: Select all

Text[60][18] = {1,21,3,2,7,27,3,12,5........};
This stores 60 strings of 18 characters each, everything OK

Now inside a for, I set the sprites.

Code: Select all

  
for(Lx = 0; Lx < 18; Lx++){ 
  SPR_initSprite(&sprites[Lx],Char[Text[MUS][Lx]], 80+pos, 150, TILE_ATTR(PAL2,1,0,0)); 
         pos+=8; 
} 
This is not working: "Char[ Text[MUS][Lx] ]", it looks like "Text[int][int]" does not return anything.

i'll upload a demo this week.

Thanks.

Posted: Mon Jun 08, 2015 8:19 pm
by nolddor
To view the values of any numeric \ String var you can use Kdegub.h + genskmod.

By the way, the second parameter of SPR_iniSprite sould be an SpriteDef pointer generated by rescomp and sould be included in the code with something like this #include "../res/rescomp.h" this path is an example and could be different in your case.

Re: Jukebox

Posted: Mon Jun 08, 2015 8:46 pm
by MrTamk1s
Now I see why you wanted the custom text characters as sprites, so that you could have pixel-precision movement of text character tiles so that they could move in a wavy motion if I am correct. In that case, you may want to treat all text characters as sprites.
As you see i have trouble setting the sprites to represent the music tittle, first i stored sprite numbers for every character:

Code: Select all

char *Char[40] = {&sprite0,&sprite1...........};
This stores 40 sprites, everythig OK
Assuming the &sprite[#] variables are SpriteDefinitions, you can't store that in a char array!

Code: Select all

  
for(Lx = 0; Lx < 18; Lx++){ 
  SPR_initSprite(&sprites[Lx],Char[Text[MUS][Lx]], 80+pos, 150, TILE_ATTR(PAL2,1,0,0)); 
         pos+=8; 
} 
This is not working: "Char[ Text[MUS][Lx] ]", it looks like "Text[int][int]" does not return anything.
[/quote]



The 2nd param of SPR_initSprite() needs to point to a SpriteDefinition, (using "&" followed by the SpriteDefinition name) not a 2D Char array. SpriteDefinitions can be created using ResComp for SPRITE resources.

My suggestion would be to use initSprite() and set each of the 18 sprites to an empty sprite frame from your sprite sheet upon boot, and then use SPR_setFrame() and SPR_setPosition() to update each sprite to the text character's graphic and to its position as needed. Using a custom function, you could convert text chars from your string into their ASCII values, and get the proper sprite frame ID to update each sprite's tiles. Check out the SGDK Doxygen documentation, especially sprite_eng.h and string.h .

I have some working sprite code from the repo of my in-progress Genesis homebrew title. Look at fmv.c. sprites.h and .res, and the code under Game.c, especially the InitGame and HUD functions.

Posted: Tue Jun 09, 2015 4:00 pm
by Mills
Thanks.

I thoght this was nothing to do with sgdk, that's why i posted here with my demo. Tried several ways, this was the fastest (in SNES and MD/GEN).

This (pseudocode) will work:

Code: Select all

Sprite sprites[20];
char *Char[40] = {&sprite0,&sprite1..}; //sprite1 is a 8x8 pixels "A".
SPR_initSprite(&sprites[1],Char[1],10, 10, TILE_ATTR(PAL2,1,0,0));
In the code above, Char[1] = &sprite1, so SPR_initSprites works well and i will see an 8x8 pixels "A" at that position (10,10).

But, the next code won't work:

Code: Select all

Sprite sprites[20];
char *Char[40] = {&sprite0,&sprite1..}; //sprite1 is a 8x8 pixels "A".
Text[60][18] = {1,6,57,8...};
SPR_initSprite(&sprites[1],Char[Text[0][0]],10, 10, TILE_ATTR(PAL2,1,0,0));
In the code above,Text[0][0] should be = 1, and Char[1] = &sprite1, so SPR_initSprites should work as in the first code... But for some reason, it is not working as I expected. :(


So Char[1] =! Char[ Text[0][0] ]... Why?

EDIT: it looks like this is working: Char[ (Text[1][1]) ] :lol:

Posted: Wed Jun 10, 2015 8:32 am
by nolddor
Have you try to replace this line.... ?
char *Char[40] = {&sprite0,&sprite1...........};
change to:
SpriteDef *Char[40] = {&sprite0,&sprite1...........};

Posted: Wed Jun 10, 2015 10:45 am
by Mills
nolddor wrote:Have you try to replace this line.... ?
char *Char[40] = {&sprite0,&sprite1...........};
change to:
SpriteDef *Char[40] = {&sprite0,&sprite1...........};
Thanks, it worked fine with the first one, I solved some syntax error.

Now i need more vgm's :)

Posted: Tue Jun 16, 2015 7:48 pm
by MrTamk1s
Now i need more vgm's :)

*Shamelesss plug. Just give some credit to me and the original authors as due :)

Posted: Tue Jul 14, 2015 10:49 am
by Mills
MrTamk1s wrote:
Now i need more vgm's :)

*Shamelesss plug. Just give some credit to me and the original authors as due :)
To be honest, most of the vgm's at that page were horrible :oops:.

But the air hockey ones are cool, I even found some good conversions from modarchive xm's / mod's inside this homebrew.

I should find more homebrew vgm's :D