Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

per-game custom palettes #2

Closed
eadmaster opened this issue Jun 7, 2012 · 15 comments
Closed

per-game custom palettes #2

eadmaster opened this issue Jun 7, 2012 · 15 comments

Comments

@eadmaster
Copy link
Contributor

Vanilla Gambatte also supports per-game custom palettes (they are saved in "%APPDATA%\gambatte\palettes").
How to use them with RetroArch?

@eadmaster
Copy link
Contributor Author

since now we have a "system_directory" option,
shall we look here for them?

@Themaister
Copy link
Contributor

Certainly possible. Could you implement it? I wouldn't be able to look at this until some other time.

@eadmaster
Copy link
Contributor Author

I need to setup the build environment and i have to study the code a bit, so i'm not able to help at the moment, sorry!

@eadmaster
Copy link
Contributor Author

this should be easy to fix: just add a few lines into
https://github.com/libretro/gambatte-libretro/blob/master/libgambatte/libretro/libretro.cpp
in the function "retro_load_game", after the rom is loaded, check if exists a file named "$system_directory/palettes/$input_rom_basename.pal".
If yes, load the palette colors with "setDmgPaletteColor(unsigned palNum, unsigned colorNum, unsigned rgb32)" using 2 nested for loops like those in
https://github.com/libretro/gambatte-libretro/blob/master/gambatte_qt/src/gambattemenuhandler.cpp
(line 554)

Here it is an example of a .pal file:

[General]
Background0=11846369
Background1=15851184
Background2=9917014
Background3=0
Sprite%2010=0
Sprite%2011=16316664
Sprite%2012=14778518
Sprite%2013=8337480
Sprite%2020=0
Sprite%2021=16316664
Sprite%2022=14778518
Sprite%2023=8337480
slectedScheme=SUPER MARIOLAND

@Themaister
Copy link
Contributor

Please make a pull request. The feature is pretty far down on the TODO list atm for me at least.

@eadmaster
Copy link
Contributor Author

I haven't the compiler ready to test the results, so i prefer you to write the code...

EDIT: i've committed some skeleton code, if you need more help i can work on it tomorrow:
https://github.com/eadmaster/gambatte-libretro/blob/master/libgambatte/libretro/libretro.cpp

@Themaister
Copy link
Contributor

Still need to parse the config file somehow. Any .ini reader code in gambatte?

@eadmaster
Copy link
Contributor Author

Gambatte is using the Qt builtin ini parser.
Btw, since the palette file is so simple (without subsections), i think we could use a more lazy approach for parsing:
(see my updated code)

@Themaister
Copy link
Contributor

Ye, looks simple enough that this is feasible. What platform are you on? Should be a simple matter to get a toolchain to test with.

@eadmaster
Copy link
Contributor Author

win7 64bit
I have old Mingw, Cygwin and the SDL libraries installed, nothing else.
Using mingw, "make -f Makefile.libretro" outputs:

Makefile.libretro:7: Extraneous text after `else' directive
Makefile.libretro:9: Extraneous text after `else' directive
Makefile.libretro:9: *** only one `else' per conditional.  Stop.

@Themaister
Copy link
Contributor

You probably have a really outdated MinGW setup.
MinGW-w64 is the good stuff:

http://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win64/Automated%20Builds/
The latest one I see right now is: http://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win64/Automated%20Builds/mingw-w64-bin_i686-mingw_20111220.zip/download

Download, set PATH correctly, and you should be good to go.

@eadmaster
Copy link
Contributor Author

ok, i still have to add some code, when it's ready i'll warn you.
I will also try to add GBC BIOS palettes to fix issue 1:
#1

@eadmaster
Copy link
Contributor Author

I've verified custom palettes are now working on my fork!
I still need to do some testing and add GBC builtin BIOS palettes (i need to add an header file to store them).

Super Game Boy support would also be nice, but this was not present in vanilla Gambatte...

@Themaister
Copy link
Contributor

Great stuff. Please submit a pull request once you feel happy with your code :)

@sergiobenrocha2
Copy link
Contributor

This issue was moved to libretro/libretro-meta#51

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants