PDA

View Full Version : Multiple Themes for one game - Randomly choosen



firefoxian
11-24-2009, 01:12 AM
If anybody is interested and has any ideas on how this would be performed, post here. I thought I would throw it out there.

THK
11-24-2009, 01:22 AM
It would be a nice feature. I personally install & rename alternate themes I like for the game's clones.

SophT
11-24-2009, 01:47 AM
you would have to store the files outside of the themes
something like this:

/random/game/1
/random/game/2
/random/game/3
/random/game2/1
/random/game2/2

where '1' '2' and '3' respectively are the different versions of those themes. In the # folder would be the current file structure:

/1/images/
/1/themes/
/1/sounds/
/2/images/
/2/themes/
/2/sounds/

Ok. So we've stored all of our copies in another folder outside of

/media/mame/themes/

Now we need to write a program that does all the lifting. Forgive me, I'm not using real code here, just programming logic, and probably shaky logic at best.

----------

first you need to have your program 'read' all the different games that you have copies of into an array, with a for() loop

something like

i = 0

for ( i < games)
read game name to array
i = i+1
return

now that you have your array we're going to have to delete files in the HS directory, since we can't simply overwrite incase teh current theme uses artwor4 and the new one doesn't.

this will be another for() loop

array_index = 0

for each
(now we're using UNIX lol)
sudo rm -R array{array_index}.*
(oops this deletes video too - but I don't know how to GREP in windows...)
array_index = array_index +1

well I hope you're following the logic anyways...

now for the 'random' movement. you need to access your game array again, starting the index at 0, and we can do this with 2 more nested for() loops

for each (game in array)
i = 0
for (i < theme options)
i = i + 1
return
now 'i' is the number of themes you have.
select a random number
1 <= r =< i
in your range of themes.
now move the files for that particular theme to the hs directory
sudo cp -R ${r}/* /media/mame/
return (second loop makes it happen for every game)

the problem is that every different theme for the same game bears the same file name, so it's not as easy as throwing them all in a directory and randomly picking one.

now if we had zip support, that would be different - hell you could even add zip support yourself. That would be eazy

select a random number 'r'
tar xfvz game_${r} /media/mame

of course you'd still have the same loops to write to see how many available games, and themes for each game there are.

hahaha it's so ugly.

-----

Long story short? I just do what THK does.