About 240p mode on Wii

Sorry to bring this again. It seems like a controversial and stressful subject. I didn’t participate in that discussion on gbatemp, but I read everything.

I’m quite happy with what we have right now, but I urge you to please consider changing how the 240p mode works, because, otherwise, people will always complain about it, since each game needs a different resolution to be displayed properly - requiring from the user a previously knowledge of the system been emulated and which resolution that system uses - or in the case of FBA, which resolution each game uses, and there are dozens of resolutions across the multiple arcade games (a lot of those resolutions still not available yet).

With that in mind, isn’t possible to implement something that Wii-mednafen does? Using the double-strike mode, Wii-mednafen switch the output every time the display changes. That can occur when the game is initially loaded or if the game itself triggers a new resolution. None of the sizes are predetermined (so, unlike Retroach, you don’t need to choose a specific resolution). It makes all of the calculations based on the new width as provided by the game (either on load, or during the game if it changes it).

See the following file: http://code.google.com/p/wii-mednafen/source/browse/trunk/SDL/src/video/wii/SDL_wiivideo.c

Check out the updateWidth() method.

I’m not a programmer, so I’m not sure how hard it would be to implement this method, but if it’s not too complicated and if you have the time or the interest - it would simplify everything: no need to know exactly the resolution the game is using so that you can adjust the resolution accordingly. And people will never complain again about a specific resolution missing, etc.

Like was said before, the Wii is not really capable of displaying the exact original resolution of each game been emulated since it’s horizontal resolution is fixed at 720. But the correct way to reproduce 240p - using the GX scaler to double the horizontal resolution and the video encoder to upscale horizontally the framebuffer rendered by the Wii GPU up to the max. resolution (640 or 720 pixels) - looks EXACTLY like the true original resolution (I compared the Wii’s 240p mode with a modified PC card with special drivers capable of true 256x240, 320x240 and others modes - and the Wii looks exactly the same). A very smart “hack”, indeed.

To tell the true, I think the 240p mode is what makes the Wii version of Retroarch really special, since you can run Retroarch faster on others devices.

Thanks!

Submit a patch or pull request. Our video code got hacked to hell and back adding that support in and the fact that for so many people it just isn’t enough is really infuriating. If anyone wants it done they can do it themselves because what we have now works fine >99% of the time and I don’t want to hack at the code any more for those <1% of the cases it isn’t enough.

Yes, I understand your frustration. I don’t want to sound demanding or ungrateful. In the first place, I’m really glad that 240p is supported - even if the method is not ideal.

I’m just trying to suggest a solution that will definitely end any future complains about this subject. Fell free to ignore it if you are not interested, but please, don’t make it sound like a superfluous request.

Your definition of “works fine 99% of the time” is very controversial. I know you are very smart guy and know exactly what I’m proposing - you probably don’t care because you are not interested, will never use it, etc., and that’s fine, you have the right… but it’s not honest from your part to say it “works >99% of the time”.

I don’t mean to be disrespectful, but the way Retroarch deals with 240p right now is very confusing. First of all, you need to know exactly what resolution the game is using in order to choose the resolution accordingly. And not 99% of all users know that. And even if someone knows that, for example, SNES games use 256x224 - he will probably select 256x224 in the GUI settings - which is wrong.

When using the 240p mode on Wii, only doubled horizontal resolutions makes sense. So, the correct resolution to use with SNES games is 512x224, and not 256x224. That’s why I think the resolutions above are not necessary…

GX_RESOLUTIONS_160_144 GX_RESOLUTIONS_240_160, GX_RESOLUTIONS_256_192, GX_RESOLUTIONS_256_224, GX_RESOLUTIONS_256_239, GX_RESOLUTIONS_256_240, GX_RESOLUTIONS_256_256, GX_RESOLUTIONS_256_480, GX_RESOLUTIONS_288_224, GX_RESOLUTIONS_304_224, GX_RESOLUTIONS_320_200, GX_RESOLUTIONS_320_224, GX_RESOLUTIONS_320_240, GX_RESOLUTIONS_320_256, GX_RESOLUTIONS_320_480, GX_RESOLUTIONS_352_224, GX_RESOLUTIONS_352_240, GX_RESOLUTIONS_352_256

Besides games that change the resolution during the game itself, the main culprit would be the FB Alpha, since arcade games use a lot of different resolutions, making it impossible for a sane person to know exactly which one the game is using.

Choosing the wrong resolution produces bad scaling artifacts.

Anyway, you already made clear in your comment that you will deal with it, and this is fine by me. You probably don’t think it’s a problem (for you) and I respect that. I’m just using this space to share a few ideas with others, for what it’s worth.

I know there was one someone else pissing Squarepusher, who I deeply admire, with this same subject - so I was afraid to bring this again - but it’s not my intention to be annoying. I’m very passionate about this subject and I couldn’t contain myself.

Sorry.

I assume “>99% of the time” refers to all of RetroArch’s users, of whom people piping their Wiis into CRT TVs represents a vanishingly small (but extremely vocal) minority.

The stance here is clear. If you want anything of this done, get someone to fix it, make a pull request and have it reviewed.

tisurame, perhaps you could bug the author of Wii-mednafen about this?

OK. I will.

The last update to Wii Mednafen was over a year ago, so good luck with that.

Regarding this issue -

I don’t want to unnecessarily disillusion Wii people for no reason, however, this whole 240p business on Wii bothers me simply because of the fact that it’s not scaleable to be multiplying VI width by 2.

First off, there are hard limits set on the size the framebuffer can be (on the GX side) - for CPS2 games we can’t ‘bump up’ 384x224 to 768x224 because that would already be exceeding the limit. So then you would be limited to bumping it up to 640x224 and that will still not look right due to the GX Scaler.

Really, the Wii GX video subsystem (and the Gamecube’s) is a subpar fixed function mess - the fact that you get the best performance out of it by using paletted textures only reinforces that it’s stuck in the Stone Age compared to modern GPUs.

So, basically, my whole issue is - this whole idea of ‘multiplying’ VI width by 2 might be fine for SNES and NES’ lower resolutions - however, it already isn’t scaleable for the SNES’ highest resolution (512x448 or even going below that - 512x224) - that would be 1024x448 and 1204x224 and no way can the Wii handle that. So you would still be stuck with badly scaled graphics either way at (say) 640x224 or 640x448 no matter which way you slice or dice it.

Second, the way the GX video subsystem does its scaling already precludes you from getting ‘pixel perfect’ graphics to begin with. If this weren’t the case, you wouldn’t even have to do this VI_WIDTH * 2 hack to begin with.

Because of the fact that a scaleable solution for this that could work for most videogame console systems/emulators is not achievable, I therefore think it is best that people just simply manually choose which VI width/height they want at any time - and the ‘Settings’ screen allows them to do just that.

I repeat - bumping up a CPS2 game from 384x224 to 640x224 because 768x224 would be going beyond framebuffer and VI bounds - I fail to see the logic in this - the scaling will still look bad either way and not what would be ‘required’ for you pixel purists out there.

Face it - the kind of ‘pixel perfect graphics’ you have pretended you can get out of the Wii all depends on a big hack that isn’t even remotely scaleable. Perhaps if those Xbox 1 guys succeed at getting 240p out of the Xbox 1’s video encoders you could finally have sensible and decent 240p video on a videogame console without the crappy GX scaling or the arbitrary limits enforced on framebuffer size and VI width/height.

Isn’t possible to upscale to 768x224 using Wii GPU texture hardware (GX) and downscale to 640 with the video encoder?

The video encoder always upscale horizontally the framebuffer rendered by the Wii GPU up to the max. resolution. So, maybe it could also downscale it automatically?

Edit: I’ve read the framebuffer can only handle a max width of 640 pixels. But there are PC Engine games, like Forgotten Worlds, that use 336x224 (meaning 672 when multiplied by 2) running perfectly on Wii Mednafen.

Actually, isn’t the game picture just a texture? Aren’t we talking about different things? (Texture resolution VS screen resolution). As a texture, I guess it’s possible to render the game screen into a textured and pre-transformed quad so you can position it and scale it in any way you want.

So, rendering 768x224 to support CPS1 and CPS2 games would be possible.

Anyway, I will happily accept your decision to only change the resolutions manually. :slight_smile:

BTW, to add or remove resolutions do you only need to change the rgui.c file like it was done in the commit above?

For some reason there is a problem with PC Engine games: the vertical resolution needs to be slightly adjusted because as it is right now there are scaling artifacts when the screen is scrolling (vertically). It’s possible to fix the problem adjusting the overscan value, but since the overscan resize the picture horizontally and vertically (you cant adjust only the width or only the height), fixing the vertical resolution will also break the horizontal res.

I guess the optimum resolution for PC Engine could be 512x233 (and not 512x239) - but I would like to confirm and if it’s that simple to add new resolutions I could try to learn and find out by myself.

Face it - the kind of ‘pixel perfect graphics’ you have pretended you can get out of the Wii all depends on a big hack that isn’t even remotely scaleable. Perhaps if those Xbox 1 guys succeed at getting 240p out of the Xbox 1’s video encoders you could finally have sensible and decent 240p video on a videogame console without the crappy GX scaling or the arbitrary limits enforced on framebuffer size and VI width/height.

When properly adjusted, it looks pixel perfect, I guarantee you. I already compared the picture from a SNES game between a PC using an “ArcadeVGA” (special card that can output true low resolutions modes - like 256x224) and the Wii (using 512x224) - both using component cable connected to a video switch hooked to the same TV (Sony Wega CRT) - allowing me to rapidly alternate between the Wii and the PC video signal for a better comparison, and it looked absolutely the same (and I am overly critical about the subject).

There is actually a huge arcade scene focused on replicating the original experience, and with the release of Retroarch (and Final Burn Alpha), I think a lot of people will be interested, since using the Wii is much more cheap, simple and user friendly.

then tell one of them to submit a patch or pull request

You say component. Does that GPU support component? Does your CRT TV support component? That’s new to me. Anyway, have you compared this to the real consoles, connected through RGB SCART?

As for the rgui.c file, why don’t you just download RetroArch from git, change that file, and compile RetroArch for Wii? Then you will find out if it works.

Just tell me what extra VI resolutions you need in there and I’ll throw that in as well - might as well go overboard with it.

Regarding all of this 240p talk, my main question is how exactly did old consoles display these signals? Take for example SNES. The resolution is 256x224, but as I understand, an old NTSC CRT displays a fixed resolution of 480 vertical lines. So, even though the SNES outputs 224 lines, every other line is a scanline to make up the full 480 lines (well, 448 lines with the rest being overscan I assume). If this is the case, what happens to the 256 horizontal lines? Wouldn’t this have to be stretched by a factor of 2 to maintain the proper aspect ratio? I only ask because I tend to agree that Retroarch does look identical to the original consoles, and I wonder how this can be the case if the pixels are in fact being scaled so much. I would think there would be a loss of detail and some type of pixel distortion, but this does not seem to be the case. Could it just be the way an old CRT handles the signal? Anyhow, as far as the 240/224p resolutions, they look amazing, regardless of how its achieved. Remember, emulation is never 100% identical to the real thing, only an “illusion” I guess you could say. If it looks/plays/sounds the same, that’s all that really matters. No complaints here, merely curious how old systems really worked.

I might be wrong here, but I don’t think a CRT has a fixed resolution, it only has a max resolution. There is no “scaling”, but rather the pixels change in size so that any resolution that is not too big gets displayed natively.

My CRT TV support component. I use a transcoder to convert the VGA signal to component. I didn’t compare with the real consoles, but I also compared with the Playstation 2 running a few emulators - and the PS2 is truly capable of producing a variety of low-resolutions.

Wii and PS2 looks identical.

I think it looks identical because the vertical resolution is the same as the original console and the vertical resolution is much more important.

Also, if you double the horizontal resolution and have the emulator perform a scaling, it will look identical to the original resolution. So, 640x240 looks exactly the same as 320x240. That’s why the Wii is using horizontal doubling for this purpose.

Like sparklewind said, a CRT don’t have a fixed resolution. But the correct ratio of a SDTV is 4:3 and any other resolution that isn’t 4:3 will be “analog stretched” to fill the screen.

The SNES resolution, for example, is 256x240 (not 4:3), so the picture will be stretched. The same happens with the Wii, but the console itself stretch the screen, and not the TV. It looks identical, in either case.

Thanks. This is my preliminary list of custom resolutions. I think it’s much more practical to sort by the vertical resolution in ascending order.

{
   GX_RESOLUTIONS_320_102 = 0, // Lynx
   GX_RESOLUTIONS_320_144, // Gameboy and Gamegear
   GX_RESOLUTIONS_448_144, // WonderSwan
   GX_RESOLUTIONS_320_152, // Neo Geo Pocket Color
   GX_RESOLUTIONS_480_160, // Gameboy Advance
   GX_RESOLUTIONS_512_192, // Master System
   GX_RESOLUTIONS_640_200, // Doom, ScummVM and DOSBox
   GX_RESOLUTIONS_384_224, // CPS1 and CPS2 
   GX_RESOLUTIONS_448_224, // IGS arcade games
   GX_RESOLUTIONS_480_224, // Arcades
   GX_RESOLUTIONS_512_224, // SNES and others
   GX_RESOLUTIONS_340_232, // PC Engine
   GX_RESOLUTIONS_512_232, // PC Engine
   GX_RESOLUTIONS_512_236, // SNES Ys games
   GX_RESOLUTIONS_336_240, // Arcades
   GX_RESOLUTIONS_384_240, // Arcades
   GX_RESOLUTIONS_512_240, // NES and others
   GX_RESOLUTIONS_576_224, // Konami Arcades and others
   GX_RESOLUTIONS_608_224, // NeoGeo 
   GX_RESOLUTIONS_640_224, // MegaDrive and others
   GX_RESOLUTIONS_640_240, // Arcades and others
   GX_RESOLUTIONS_400_254, // Mortal Kombat
   GX_RESOLUTIONS_640_448, 
   GX_RESOLUTIONS_640_480,
   GX_RESOLUTIONS_LAST,
};

unsigned rgui_gx_resolutions[GX_RESOLUTIONS_LAST][2] = {
   { 320, 102 },
   { 320, 144 },
   { 448, 144 },
   { 320, 152 },
   { 480, 160 },
   { 512, 192 },
   { 640, 200 },
   { 384, 224 },
   { 448, 224 },
   { 480, 224 },
   { 512, 224 },
   { 340, 232 },
   { 512, 232 },
   { 512, 236 },
   { 336, 240 },
   { 384, 240 },
   { 512, 240 },
   { 576, 224 },
   { 608, 224 },
   { 640, 224 },
   { 640, 240 },
   { 400, 254 },
   { 640, 448 },
   { 640, 480 },
};

All tested and working (with the exception of 400x254, which is meant for Mortal Kombat for a future Mame release). Any feedback is appreciated.

The only problem is the aspect ratio of handhelds consoles. You can’t change the aspect ratio when using low resolution modes and for a very good reason, since it’s a mode only meant for 4:3 TVs. So it should be the normal behavior.

But this is problematic for handhelds systems. The vertical resolution is perfect, but the width looks wrong, because the picture is been horizontally stretched to fill the screen.

The solution is to choose a higher horizontal resolution and create borders to keep the aspect ratio.

Is it possible without hacking the video code even more?

Adjusting the overscan could solve the problem, since it creates borders - but the width and height are reduced at the same time, messing with the integer scaling.

Even so, I think it’s possible to use a specific resolution + overscan value that could solve the problem. But first, I would need to know exactly how many pixels are modified when you decrease the value by 0.01 - at first I thought -0.01 equals -1 pixel… so, creating a custom resolution of 560x240 and applying an overscan of -0.80 would reach 480x160 with borders - which is perfect for GBA, for example. But it doesn’t seem to work like that.

OK. After a lot of work, testing every possible resolution and overscan value, I have finally reached the optimum resolution + overscan for some handhelds, preserving a perfect picture without artifacts and keeping the aspect ratio at the same time. The aspect looks even more accurate than Mednafen-Wii.

Just for the record, the values are:

Game Boy Advance = 598x200 and -0.49 of overscan

Game Boy (Color) and Game Gear = 530x240 and -1.32 of overscan

These are the most popular handhelds. I won’t bother with the others, since it takes a huge amount of time to get the ideal resolution and overscan.

Gameboy and Gamegear should actually have different aspect ratios, the Gamegear screen is aprox. 4:3 I believe, I may misremember this.