Mednafen Members Members   Search Search   Help Help   Register Register   Login Login   Home Home
Home » Mednafen » Development » How to contribute?
Show: Today's Messages  :: Show Polls :: Message Navigator
Switch to threaded view of this topic Create a new topic Submit Reply
How to contribute? [message #1692] Mon, 19 April 2010 18:17 Go to next message
donb04  [PM]
I would like to contribute some patches to the Mednafen source tree, but I do not see any explanation of how to do that.

I have already downloaded the Mednafen source code and added a couple features, and now I am ready to check them in. The things I added are:

* 2xSaI / Super2xSaI / SuperEagle scaling filters - ported the scaling filters from VisualBoyAdvance. (Can be used with any system, not just GBA.)
* Game Boy custom palettes - Add custom colors to black and white Game Boy games. You can choose from over 80 stock palettes, set a game's default palette, change palettes on the fly, and create your own palette by editing a simple text file.
* Fullscreen stretch that maintains aspect ratio - letterbox a fullscreen image so that the source aspect ratio is preserved.

They are all coded, tested (by me, anyway) and ready to go. The code is ready, I just don't know how to submit it. So, what is the best way to submit new code?

Thanks in advance.

--------------------------------------------------
Game Boy Custom Palettes
index.php?t=getfile&id=205&private=0

2xSaI Filters
index.php?t=getfile&id=206&private=0

Re: How to contribute? [message #1694 is a reply to message #1692 ] Tue, 20 April 2010 13:33 Go to previous messageGo to next message
Dryer Lint  [PM]
Wow, I always missed custom GB colours in Mednafen! Can you post your patch here for public (ab)use? Very Happy

Preferably Mednafen 0.9 compatible. Wink

Your work is much appreciated!
Re: How to contribute? [message #1698 is a reply to message #1694 ] Fri, 23 April 2010 16:11 Go to previous messageGo to next message
donb04  [PM]
Ok. Attached are my patches in a zip file. They are based off the 0.9 WIP source release from April 11.

There are three patches:

1. Letterbox
I changed the <system>.stretch option from boolean to integer. If it is set to 0 or 1, it will behave as before (no stretch or fullscreen stretch). If you set it to 2, in fullscreen mode the image will be stretched but letterboxed to maintain the correct aspect ratio.

<system>.stretch X
   0 = No stretching in fullscreen mode
   1 = Stretch to fill screen when in fullscreen mode
   2 = Letterbox to fill screen when in fullscreen mode


2. Game Boy Palettes
The palette of black and white Game Boy games can be switched using two user-assignable buttons (forward and back). By default, the buttons are mapped to '[' and ']', but they can be mapped to anything by running the joystick the configuration wizard (ALT+SHIFT+1).

There are 88 custom palettes, some of which are tailored specifically for certain games. The default palette can be any of the 88 built-in palettes. To set the default palette, use the gb.palette parameter. The gb.palette parameter can be an integer between 0 and 88. The parameter gb.palette defaults to 1, which enables custom palettes but sets the default palette to Mednafen's traditional grayscale.

gb.palette X
   0 = Disable custom palettes
   1 = Use Mednafen's traditional grayscale palette (default)
   2-88 = Use palette 2-88 as default

When you change a game's palette, the selected palette is saved in Mednafen's default palette folder as <gamename>.pal. Each time a game is started, Mednafen will load that game's palette file if it exists, otherwise it will use the default custom palette. Editing a game's palette is as simple as opening it's saved .pal file in a text editor and changing the RGB values.


3. 2xSaI Filters
These filters are ported from Visual Boy Advance but can be used with any system. Three new special video filters are added:
  • 2xSaI
  • Super2xSaI
  • SuperEagle

To enable the filters, set <system>.special to 2xsai, super2xsai, or supereagle.

NOTE: To compile Mednafen with the 2xSaI filters, the Makefile needs to be modified. I don't know enough about Makefiles to submit a correct patch. Sorry. But, chances are, if you're compiling Mednafen you can figure it out. Check out the readme in the zip to see what changes are needed.

Let me know what you think. Thanks.

UPDATE 4/26/2010: Uploaded new .zip file with 2xSaI RGB fix.

  • Attachment: patches.zip
    (Size: 135.08KB, Downloaded 382 time(s))

[Updated on: Mon, 26 April 2010 13:15]

Re: How to contribute? [message #1701 is a reply to message #1692 ] Mon, 26 April 2010 11:08 Go to previous messageGo to next message
Administrator  [PM]
Letterbox patch looks fine, I'll commit it.

I haven't looked at the GB patch yet, though I'm a bit wary about using the gamepad input configuration like that.

Will the 2xsai filters function properly regardless of how the r, g, and b components are packed into a 32-bit pixel(assuming contiguous 8-bits per component, and assuming each component aligned to a byte boundary)?

[Updated on: Mon, 26 April 2010 11:08]

Re: How to contribute? [message #1702 is a reply to message #1701 ] Mon, 26 April 2010 13:26 Go to previous messageGo to next message
donb04  [PM]
Administrator wrote on Mon, 26 April 2010 12:08

Will the 2xsai filters function properly regardless of how the r, g, and b components are packed into a 32-bit pixel(assuming contiguous 8-bits per component, and assuming each component aligned to a byte boundary)?

No, they only worked properly if the alpha value was in the MSByte. Nice find, thanks.

I went ahead and fixed that problem so now they work regardless of the RGB packing. Attached is the updated source file. I also updated the .zip file in the previous post with the fix.

Administrator wrote on Mon, 26 April 2010 12:08

I haven't looked at the GB patch yet, though I'm a bit wary about using the gamepad input configuration like that.

You're the boss. But personally, I think it works nicely having the ability to swap palettes conveniently mapped to the gamepad shoulder buttons. And there is precedent for controlling Game Boy palettes with a gamepad.

  • Attachment: 2xSaI.cpp
    (Size: 40.37KB, Downloaded 373 time(s))

Re: How to contribute? [message #1703 is a reply to message #1692 ] Tue, 27 April 2010 01:08 Go to previous messageGo to next message
Administrator  [PM]
Ah, I remembered why I didn't have 2xsai included before now. I believe its license is incompatible with the GPL.

http://www.google.com/codesearch/p?hl=en#N-j4sQf5Dek/2xsai/2xsai.zip|2-z4LrlfIf4/2xsai.txt&q=Init_2xSaI%20derek&d=2

But http://web.archive.org/web/20070107140022/http://elektron.its.tudelft.nl/~dalikifa/ says it's GPL'd, though it doesn't include any license text, nor any mention of GPL in the actual source code or documentation files. Very confusing.

[Updated on: Tue, 27 April 2010 01:41]

Re: How to contribute? [message #1704 is a reply to message #1703 ] Tue, 27 April 2010 11:00 Go to previous message
donb04  [PM]
Your're right, it was super confusing. To clear up the confusion, it was officially released as GPL in October:

Re: 2xSai has an unclear license and may be removed from a number of programs in Fedora Linux

Derek Liauw wrote:

To whomever it may concern,

Given the confusion (see mail history) on some license issue I wrote some time ago.

I hereby release all versions of 2xSai, old and new, under the GNU General Public License, version 2 or (at your option) any later version.

I did in fact give the ZSNES and probably some other projects permission a long time ago (don't remember exactly when, but probably when it was either first featured or it went from closed source -> GPL), but I guess it wasn't documented as such in the history.
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic:Mednafen 0.8.D Release Candidate 1
Next Topic:How to donate?
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ ]

Current Time: Sat May 18 11:17:33 CDT 2024
.:: Contact :: Home ::.

Powered by FUDforum.
Copyright © FUDforum Bulletin Board Software