Want to expirement with graphics filters

This is for people involved in the developement of Snes9x, or SNES emulators in general.
BUG REPORTS BELONG IN TECH SUPPORT/BUG TRACKING!
Post Reply
Joe
Snes9x White Belt
Posts: 7
Joined: Fri Sep 23, 2011 12:46 am

Want to expirement with graphics filters

Post by Joe »

Hey Folks,

I want to mess around with some graphics filter code. I thought it would be more fun to use Snes9x over AVISynth, which I've done a little in. I may need help figuring out how to access the pixels.

Right now, I'm looking through RenderPlain to see how to do a basic pixel copy.
What does SetRect do? I'm kind of guessing that it seems like it's setting the source read region for other htings. I don't run it, the emu crashes when showing text.

The pixel format is 555 for SNES, right? Is the source data always that? I did notice a few masking constants, but that could also be for the output. Also, the bit shifting is throwing me off a little on things like the pitch. I have a good idea what the pitch is, but in the context of this program, what is it?
User avatar
OV2
Official Win32 Porter/Dev
Posts: 679
Joined: Thu Aug 30, 2007 10:15 pm

Re: Want to expirement with graphics filters

Post by OV2 »

Hi Joe,

The rect variable is used to determine how much of the destination surface has been filled by the filter. This is usually a multiple of the input (for renderplain it's factor 1), which is what SetRect() is used for. You can simply set the values to the rect directly.

The windows port usually uses RGB565. It can change in directdraw mode, but there are already some filters that can't handle other modes, such as blargg's ntsc.

Pitch is the amount of bytes from one line to the next in the surface. It is shifted around when using pointers other than uint8, since those increment according to their size (so if using uint16 *, it does Pitch >> 1).
Joe
Snes9x White Belt
Posts: 7
Joined: Fri Sep 23, 2011 12:46 am

Re: Want to expirement with graphics filters

Post by Joe »

My goodness. I didn't know what to expect, but I'm glad I asked. There's lots of elitism when it comes to programming.

Thanks for the nice, clear answers
Joe
Snes9x White Belt
Posts: 7
Joined: Fri Sep 23, 2011 12:46 am

Re: Want to expirement with graphics filters

Post by Joe »

Hm... I'm looking through the code and I'm trying to figure out if there's "fill the whole screen" because the filtering does seem managed by Snes9x
User avatar
OV2
Official Win32 Porter/Dev
Posts: 679
Joined: Thu Aug 30, 2007 10:15 pm

Re: Want to expirement with graphics filters

Post by OV2 »

You mean an option that makes the filter get the whole screen as surface? There's nothing like that - each filter specifies the factor of the destination it needs in GetFilterScale, and then gets passed a surface of that size, into which it can then output and mark the area with the rect (e.g. blargg's specifies factor 3, thus gets 768*672 and then fills ~603*512).
S9x then outputs that centered or streched, depending on the users choice.
Joe
Snes9x White Belt
Posts: 7
Joined: Fri Sep 23, 2011 12:46 am

Re: Want to expirement with graphics filters

Post by Joe »

Ah, yes. Exactly that
Post Reply