MAMEWorld >> EmuChat
View all threads Index   Threaded Mode Threaded  

Pages: 1

Marcelo_20XX
MAME Fan
Reged: 04/20/13
Posts: 43
Send PM


MAME weird pixel stretching on SNES games
#372882 - 01/09/18 12:19 AM


Most SNES games run on a internal res of 256x224, but because some games run on hi-res mode 512x448 I am always stuck on an uneven stretched res of 512x224 which make all filters to scale the image very badly, compared to other emulators like Snes9X, Bsnes, etc...

So my question is, how can I force the snes driver to display on a internal and more standard res of 256x224, it doesn't matter if a few games get broken in the process, or is there another way to have the game properly scaled...

By the way I tried already GroovyMAME stretch option, clean, unclean, unholy options... nothing worked so far...

As a last attempt I took a look at the snes.c driver on the source and the ppu.c too if I can tweak some lines and after compiling it I didn't get any good results either...

I appreciate any help, thanks!!!!!1



Haze
Reged: 09/23/03
Posts: 5242
Send PM


Re: MAME weird pixel stretching on SNES games new [Re: Marcelo_20XX]
#372883 - 01/09/18 12:30 AM


> Most SNES games run on a internal res of 256x224, but because some games run on
> hi-res mode 512x448 I am always stuck on an uneven stretched res of 512x224 which
> make all filters to scale the image very badly, compared to other emulators like
> Snes9X, Bsnes, etc...
>
> So my question is, how can I force the snes driver to display on a internal and more
> standard res of 256x224, it doesn't matter if a few games get broken in the process,
> or is there another way to have the game properly scaled...
>
> By the way I tried already GroovyMAME stretch option, clean, unclean, unholy
> options... nothing worked so far...
>
> As a last attempt I took a look at the snes.c driver on the source and the ppu.c too
> if I can tweak some lines and after compiling it I didn't get any good results
> either...
>
> I appreciate any help, thanks!!!!!1

you can't.

this is a problem with shaders that assume things about pixels.

in reality a system doesn't have a fixed horizontal resolution, some even mix 'resolutions' between layers because different chips can output at different rates. (typical examples, Galaxian starfield and the PC-FX VDPs)

MAME drivers have to use a resolution that is the lowest multiple of all the possible selections (which is possible as they're all driven by the same clock) in order for things like mid-screen raster effects to work.

if you don't do that then you'd always have a frame delay between a game trying to use a mid-screen effect and MAME changing resolution to that, which wouldn't be correct.

proper shaders, like the CRT ones care less about pixels, much as the TV wouldn't care about pixels.



anikom15
Instigator/Local CRT Guru
Reged: 04/11/16
Posts: 287
Send PM


Re: MAME weird pixel stretching on SNES games new [Re: Haze]
#372884 - 01/09/18 12:48 AM


I was under the impression this is just a MAME thing. Shouldn’t it be possible to allow for resolution to switch dependent on the mode?



Haze
Reged: 09/23/03
Posts: 5242
Send PM


Re: MAME weird pixel stretching on SNES games new [Re: anikom15]
#372885 - 01/09/18 01:19 AM


> I was under the impression this is just a MAME thing. Shouldn’t it be possible to
> allow for resolution to switch dependent on the mode?

real resolution switching isn't instant, so is automatically out.

low-resolution and high-resolution scanlines can be mixed, this was very common on platforms like the Amstrad CPC (and even used on things like Doom for the Jaguar) in such cases part of the screen would need to be pixel doubled anyway, so the effect wouldn't work anyway, the shaders wouldn't know how to deal with some lines being high resolution and others low resolution for the same reasons.

fake resolution switching would still require the higher resolution screenmode in advance anyway due to the ability to mix modes, it would also just complicate the code as it already has to be able to double pixels etc. to handle the aformentioned case.

and as already stated, some systems mix resolutions, so there's no chance of it working there (and trying to use any shaders like the ones mentioned would just make a hideous mess)

It's a limitation of shaders that assume things about relative pixels etc.

MAME just does it in the way that actually works for emulation cases.

Don't use crap shaders. This is one reason MAMEdev were against adding such shaders for a long time.

even if MAME was to stop using internal bitmaps, and use a series of lines of variable length, and try to do the scaling outside of the driver that would fail completely for cases where different layers are different resolutions.

what you could do for the SNES case is write a shader that knows the expected resolution and knows some pixels are going to be stretched and some might be higher resolution, checks that they're all the same colour, and disables the effect if they're not (which would indicate a high resolution part) otherwise processes it, but that's extra work. It's all about shaders making bad assumptions tho, they only really work if you dumb down the cases your emulator can otherwise handle properly.



Marcelo_20XX
MAME Fan
Reged: 04/20/13
Posts: 43
Send PM


Re: MAME weird pixel stretching on SNES games new [Re: Haze]
#372886 - 01/09/18 01:38 AM


Thank you for your responses, and I know different games switch dynamically its resolutions for certain modes and effects and MAME has to support the lowest multiply of every possible resolution the system uses but what I am asking here is: Is there anyway (no matter if its a source edit) that I can force MAME to only pick the 256x224 resolution on the SNES driver? its because the games I play I know certainly doesn't change this resolution as other do...

I was trying to limit the resolution selecting routine but got lost on the source since I couldn't understand the ppu code...



anikom15
Instigator/Local CRT Guru
Reged: 04/11/16
Posts: 287
Send PM


Re: MAME weird pixel stretching on SNES games new [Re: Haze]
#372887 - 01/09/18 01:58 AM


Yeah, I'm in favor of moving from bitmaps to lines and letting the shaders do the horizontal 'rasterizing'. It's something I'd like to try to implement at some point, at least for systems like the SNES.

That wouldn't actually fix OP's problem though. You could still have shaders making the same assumption after the rasterization.



Haze
Reged: 09/23/03
Posts: 5242
Send PM


Re: MAME weird pixel stretching on SNES games new [Re: Marcelo_20XX]
#372889 - 01/09/18 02:02 AM


> Thank you for your responses, and I know different games switch dynamically its
> resolutions for certain modes and effects and MAME has to support the lowest multiply
> of every possible resolution the system uses but what I am asking here is: Is there
> anyway (no matter if its a source edit) that I can force MAME to only pick the
> 256x224 resolution on the SNES driver? its because the games I play I know certainly
> doesn't change this resolution as other do...
>
> I was trying to limit the resolution selecting routine but got lost on the source
> since I couldn't understand the ppu code...

well you got your answer

no, there is no easy way

MAME isn't the type of emulator to offer easy options to break things on purpose.

You might know the games don't use those resolutions, the emulated machine has no way of knowing.



Marcelo_20XX
MAME Fan
Reged: 04/20/13
Posts: 43
Send PM


Re: MAME weird pixel stretching on SNES games new [Re: Haze]
#372894 - 01/09/18 02:40 AM


But why I am getting a proper scaled and filtered image on other cores like Snes9X, etc using the same shaders that cause problem on MAME, btw I am testing this on RetroArch using the libretro versions...

I though it would be the same on the other emulators but only MAME experience this issue...



Haze
Reged: 09/23/03
Posts: 5242
Send PM


Re: MAME weird pixel stretching on SNES games new [Re: Marcelo_20XX]
#372897 - 01/09/18 02:59 AM


> But why I am getting a proper scaled and filtered image on other cores like Snes9X,
> etc using the same shaders that cause problem on MAME, btw I am testing this on
> RetroArch using the libretro versions...
>
> I though it would be the same on the other emulators but only MAME experience this
> issue...

Complain to the RA guys then, they can maybe add some ugly hack to do it since that's what they're all about doing anyway, ugly "user-pleasing" hacks without caring what the damage is.

The MAME RA port is absolutely abysmal anyway, so them breaking it further for the sake of things like this won't make much difference.

Also you should probably have stated that from the beginning anyway, because if you had I wouldn't have bothered to reply at all.

MAME isn't Snes9x or anything else, MAME is MAME, MAME does things the way MAME does them because it has to consider a lot more use cases which would break the kind of cheap hacks you might otherwise get away with. As I said already, the shaders make far too many assumptions to work in all cases with a proper emulation model like MAME. MAME can't assume you're only going to run SNES emulation and therefore that certain things will never happen, the problem is the shaders expect certain assumptions to be made.

No different to why MAME isn't going to do high resolution PSX rendering or widescreen patches, because it's at odds with doing things properly and would require hacks etc. to work. Just because something else does it, doesn't mean it's a good idea or that MAME will do it, or that MAME will be compromised to work with bad assumptions made by other software (in this case the shaders)



Marcelo_20XX
MAME Fan
Reged: 04/20/13
Posts: 43
Send PM


Re: MAME weird pixel stretching on SNES games new [Re: Haze]
#372898 - 01/09/18 03:06 AM


I was asking here because I too used the same options on stock MAME and nowhere near my post I asked this "ugly" hacks to be incorporated on the main source, I was only asking politely if someone with more knowledge than me help me modify the snes driver to achieve this specific thing, you act as if this change is a MUST pull on the source base...

Also I understand that open source is for this kind of things, to modify one local source to our hearth contents, so your post its a bit off...



anikom15
Instigator/Local CRT Guru
Reged: 04/11/16
Posts: 287
Send PM


Re: MAME weird pixel stretching on SNES games new [Re: Marcelo_20XX]
#372900 - 01/09/18 03:13 AM


That’s just Haze being Haze. Don’t take it personally.

The SNES driver isn’t even good right now. It has a lot of issues. If another emulator works better for you, use it. It’s the shaders that need to be fixed, and I don’t think any of the devs like these types of shaders to begin with, so sorry I guess.



Marcelo_20XX
MAME Fan
Reged: 04/20/13
Posts: 43
Send PM


Re: MAME weird pixel stretching on SNES games new [Re: anikom15]
#372902 - 01/09/18 03:21 AM


Thank you for the explanation, I am not to used to frequent this forums so I got scolded. There is a reason why I insist on using MAME over other options and that's because it have ironically another useful option called overclocking...

You know SNES games are plagued with all kinds of slowdowns, I dealt with it as a kid but why will I be tortured again by that? Since I already overclocked the Snes driver I am having a blast on MAME playing the compatible games that works on it...

The only thing that annoys me is the shader not scaling correctly on this emulator (not a fault of MAME itself as pointed by Haze) but I would want to "fix" it even if this would be an ugly hack...



Haze
Reged: 09/23/03
Posts: 5242
Send PM


Re: MAME weird pixel stretching on SNES games new [Re: Marcelo_20XX]
#372903 - 01/09/18 03:26 AM


> Thank you for the explanation, I am not to used to frequent this forums so I got
> scolded. There is a reason why I insist on using MAME over other options and that's
> because it have ironically another useful option called overclocking...
>
> You know SNES games are plagued with all kinds of slowdowns, I dealt with it as a kid
> but why will I be tortured again by that? Since I already overclocked the Snes driver
> I am having a blast on MAME playing the compatible games that works on it...
>
> The only thing that annoys me is the shader not scaling correctly on this emulator
> (not a fault of MAME itself as pointed by Haze) but I would want to "fix" it even if
> this would be an ugly hack...

my best advice would just be to use a shader that isn't dependent on pixel knowledge, like one of the proper CRT shaders.

the 'smoothing' shaders really aren't doing justice to any of the original game art, nor presenting it in the manner in which it was intended at all, they're converting what was carefully crafted pixelart into something that looks like it was drawn by a child in MSPaint.

the CRT shaders, which simulate how the image would have looked on a TV will present you with something far closer to how the game designers and artists intended.

also most SNES emulators don't offer Overclocking options because it's a terrible idea on SNES games, many of them are incredibly timing sensitive, it's one of the worst things you can do for a SNES game and even now in MAME the inaccuracies in the CPU emulation speed relative to other things are the reason the compatibility with some games isn't great. The other emulators don't have such options because they've spent years finding out how things should run to help ensure good compatibility. MAME specifically hides the overclocking option behind the cheat options because it's a bad idea in the majority of cases, and really only a debug aid.

There's a point at which you should probably take the resistance of the emulators to do what you want as a sign that doing it isn't really a good idea.

This thread is looking like bad ideas piled on top of bad ideas...



anikom15
Instigator/Local CRT Guru
Reged: 04/11/16
Posts: 287
Send PM


Re: MAME weird pixel stretching on SNES games new [Re: Haze]
#372905 - 01/09/18 04:35 AM


Do you think overclocking should be dropped at some point, given that it’s almost universally considered a bad idea?



Haze
Reged: 09/23/03
Posts: 5242
Send PM


Re: MAME weird pixel stretching on SNES games new [Re: anikom15]
#372907 - 01/09/18 04:53 AM


> Do you think overclocking should be dropped at some point, given that it’s almost
> universally considered a bad idea?

it can be useful for debugging without recompiling, but I have to say I do think the feature is on it's last legs.



Dullaron
Diablo III - Dunard #1884
Reged: 07/22/05
Posts: 6122
Loc: Fort Worth, Tx
Send PM


Re: MAME weird pixel stretching on SNES games new [Re: Haze]
#372921 - 01/09/18 01:11 PM


Make me wonder. Has he tried bgfx crt-geom or bgfx crt-geom-deluxe? I didn't had problem using those on the 0.192 and below. No cut off top, bottom, left and right.

He have to turn off some of the default HLSL settings to get the screen fix. That is what I did so many of times.

I wouldn't recommended 0.193 because bgfx got a small broken. Stay away from 0.193 if using bgfx.



W11 Home 64-bit + Nobara OS / AMD Radeon RX 5700 XT / AMD Ryzen 7 3700X 8-Core 3.59 GHz / RAM 64 GB



smf
I've been here before
Reged: 01/16/15
Posts: 130
Send PM


Re: MAME weird pixel stretching on SNES games new [Re: anikom15]
#372922 - 01/09/18 03:29 PM


> Do you think overclocking should be dropped at some point, given that it’s almost
> universally considered a bad idea?

MAME should allow overclocking, but only to the same extent the real hardware would.

So replacing the clock in your C64 should affect all the timing, including video output. If that causes the composite video to go black and white, then so be it.

You should also be able to overclock/underclock world time, which would allow you to run all games at your monitor refresh rate (audio will be pitch shifted, but you'll get used to it).

Edited by John Doe (01/09/18 03:32 PM)



smf
I've been here before
Reged: 01/16/15
Posts: 130
Send PM


Re: MAME weird pixel stretching on SNES games new [Re: Haze]
#372923 - 01/09/18 03:44 PM


> low-resolution and high-resolution scanlines can be mixed,

It's worse than that, some systems can change pixel clock mid scan line and not all systems have resolutions that are integer doubles.



Haze
Reged: 09/23/03
Posts: 5242
Send PM


Re: MAME weird pixel stretching on SNES games new [Re: smf]
#372925 - 01/09/18 05:48 PM


> > low-resolution and high-resolution scanlines can be mixed,
>
> It's worse than that, some systems can change pixel clock mid scan line and not all
> systems have resolutions that are integer doubles.

yeah, that would be worse.

Luckily I've not actually encountered any that do that myself, for the systems I've encountered they specifically say that pixel clock changes only take place for the next frame, although you can change multiplier mid-scanline. I'd imagine if you're changing the actual pixel clock mid scanline that's very tricky to create a stable display with even on real hardware.

obviously for such cases there's even less chance of this kind of 'make assumptions based on surrounding pixels' type shader working.

but yeah, that's the type of thing that MAME will need to handle in the future.

the gist of it is that horizontal resolutions don't really exist.

IIRC there are demos on some systems that change the resolution when outside of the visible screen area to trick the hardware into giving them more DMA cycles too because in the lower resolutions you get more cycles and the hardware wasn't designed to be smart enough to give them to you anyway if you were outside of the visible part of the sceen. I remember reading that, although can't recall the system right now.



Marcelo_20XX
MAME Fan
Reged: 04/20/13
Posts: 43
Send PM


Re: MAME weird pixel stretching on SNES games new [Re: Dullaron]
#372926 - 01/09/18 06:33 PM


Also I loved the CRTs chaders, specially the royale one, most nostalgic shader, it display like I remember a Trinitron I own back in the day would do. But I am more interested on the xBRz ones made by Zenju, yeah I know I will be bashed again for liking this shader because such is the tastes and opinions of people...

Also there is no risk that other systems will be broken because I compiled this version of MAME specifically to work for the 12 SNES games I play and no one exhibited any visible flaw that would affect gameplay by Overclocking it to remove slowdowns. I have the stock MAME for everyday use on the other systems...



smf
I've been here before
Reged: 01/16/15
Posts: 130
Send PM


Re: MAME weird pixel stretching on SNES games new [Re: Haze]
#372928 - 01/09/18 09:03 PM


> I'd imagine if you're
> changing the actual pixel clock mid scanline that's very tricky to create a stable
> display with even on real hardware.

You're assuming that the desired effect is a stable display.

Demos often simulate display corruption, throwing in random pixel clocks would certainly achieve that & it would only look correct on real hardware.

MAME's arcade roots shows up in spades.



Haze
Reged: 09/23/03
Posts: 5242
Send PM


Re: MAME weird pixel stretching on SNES games new [Re: smf]
#372929 - 01/09/18 09:12 PM


> > I'd imagine if you're
> > changing the actual pixel clock mid scanline that's very tricky to create a stable
> > display with even on real hardware.
>
> You're assuming that the desired effect is a stable display.
>
> Demos often simulate display corruption, throwing in random pixel clocks would
> certainly achieve that & it would only look correct on real hardware.
>
> MAME's arcade roots shows up in spades.

I think display timings are actually a problem even with the arcade side of things.

We still basically assume that the screen drives the timings when in reality the timings of everything else drive the screen.

hap speculated that the Moon Cresta sync bug might be as simple as the number of cycles before the first interrupt occurs for example. MAME assumes that the interrupt comes from the screen, so it always occurs after exactly one frame of time after boot while in reality it could be anything and the display would sync to output of the PCB from that point forward.

the discrete stuff basically drives the signals directly too.

Don't think you can blame it on arcade roots, it's just something that wasn't considered, like a lot of other things at the time (it was 20 years ago, we were still learning) or were ignored because it was easier to ignore them (waitstates, cpu cache, interruptible CPU fetch-execute cycles etc.)

If you take pretty much any emulator from 20 years ago most of these things weren't real considerations then. If you were to write a well researched emulator from scratch today, they would be because there are now thousands of examples of where such things are important due to research done in that time, and a lot more test code about.

If anything it's just a case of "MAME is showing it's age" and "Doing things properly is hard"



TafoidAdministrator
I keep on testing.. testing.. testing... into the future!
Reged: 04/19/06
Posts: 3135
Loc: USA
Send PM


Re: MAME weird pixel stretching on SNES games new [Re: Marcelo_20XX]
#372933 - 01/09/18 10:05 PM


> Most SNES games run on a internal res of 256x224, but because some games run on
> hi-res mode 512x448 I am always stuck on an uneven stretched res of 512x224 which
> make all filters to scale the image very badly, compared to other emulators like
> Snes9X, Bsnes, etc...
>
> So my question is, how can I force the snes driver to display on a internal and more
> standard res of 256x224, it doesn't matter if a few games get broken in the process,
> or is there another way to have the game properly scaled...
>
> By the way I tried already GroovyMAME stretch option, clean, unclean, unholy
> options... nothing worked so far...
>
> As a last attempt I took a look at the snes.c driver on the source and the ppu.c too
> if I can tweak some lines and after compiling it I didn't get any good results
> either...
>
> I appreciate any help, thanks!!!!!1

If you are looking for a simple way to scale things, use -snapsize 256x224 and every snapshot and video recorded from MAME should scale at that resolution. But, I suppose you wanted more?



Marcelo_20XX
MAME Fan
Reged: 04/20/13
Posts: 43
Send PM


Re: MAME weird pixel stretching on SNES games new [Re: Tafoid]
#372934 - 01/09/18 10:35 PM


Thank you Tafoid, but that only works on snapshots and videos recorded but what I want is to actually play on that internal resolution...


Pages: 1

MAMEWorld >> EmuChat
View all threads Index   Threaded Mode Threaded  

Extra information Permissions
Moderator:  Robbbert, Tafoid 
1 registered and 29 anonymous users are browsing this forum.
You cannot start new topics
You cannot reply to topics
HTML is enabled
UBBCode is enabled
Thread views: 1188