Jukebox

Announce (tech) demos or games releases

Moderator: Mask of Destiny

Post Reply
Mills
Interested
Posts: 34
Joined: Fri Apr 11, 2014 11:09 pm

Jukebox

Post by Mills » Mon Jun 08, 2015 12:01 pm

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.

nolddor
Very interested
Posts: 101
Joined: Sun Jun 02, 2013 1:35 pm
Location: Spain

Post by nolddor » Mon Jun 08, 2015 8:19 pm

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.
Last edited by nolddor on Mon Jun 08, 2015 8:49 pm, edited 1 time in total.

MrTamk1s
Very interested
Posts: 75
Joined: Sun Jan 04, 2015 10:27 pm
Location: Pennsylvania
Contact:

Re: Jukebox

Post by MrTamk1s » Mon Jun 08, 2015 8:46 pm

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.
SGDK homebrew dev and Unity3D Indie dev.
Sega does what Nintendont!

Mills
Interested
Posts: 34
Joined: Fri Apr 11, 2014 11:09 pm

Post by Mills » Tue Jun 09, 2015 4:00 pm

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:

nolddor
Very interested
Posts: 101
Joined: Sun Jun 02, 2013 1:35 pm
Location: Spain

Post by nolddor » Wed Jun 10, 2015 8:32 am

Have you try to replace this line.... ?
char *Char[40] = {&sprite0,&sprite1...........};
change to:
SpriteDef *Char[40] = {&sprite0,&sprite1...........};

Mills
Interested
Posts: 34
Joined: Fri Apr 11, 2014 11:09 pm

Post by Mills » Wed Jun 10, 2015 10:45 am

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 :)

MrTamk1s
Very interested
Posts: 75
Joined: Sun Jan 04, 2015 10:27 pm
Location: Pennsylvania
Contact:

Post by MrTamk1s » Tue Jun 16, 2015 7:48 pm

Now i need more vgm's :)

*Shamelesss plug. Just give some credit to me and the original authors as due :)
SGDK homebrew dev and Unity3D Indie dev.
Sega does what Nintendont!

Mills
Interested
Posts: 34
Joined: Fri Apr 11, 2014 11:09 pm

Post by Mills » Tue Jul 14, 2015 10:49 am

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

Post Reply