Mednafen PCE Fast - hacks to stop the crashing

All of my posts in this thread edited to remove obslote info. All of my changes are in my fork.

Get my fork here: https://github.com/ariok-x/mednafen-libretro.git

Only use it to compile the pce_fast module, no others.

make core=pce_fast

What it does:

Turn off aspect ratio correction in Mednafen. (square pixels)

Get rid of the Keep Aspect core option. (just causes confusion, we control the aspect ratio)

Add new core options Scanline Start and Scanline End. (allow us to crop)

Handle our Scanline Start and Scanline End options in retro_run(). (crop)

#define MEDNAFEN_CORE_GEOMETRY_ASPECT_RATIO (6.0 / 5.0). (compromise/TV ratio 288x240)

These changes should allow switching to different aspect ratios and cropping(with user chosen scanline output) as needed.

Example usage:

Use “Core Provided” (6:5) to make all games the same width (Equivalent to setting Mednafen to “correct aspect”). Use 1:1 PAR for “hi-res” games (Ninja Spirit). Use 16:15 for “normal” games. (Setting the new scanline options to anything other than 0 and 239 in Core Settings changes aspect ratio.)

The default values for Scanline Start (4), Scanline End (235) and aspect ratio (6:5) mimic Mednafen defaults. Change the defaults as you see fit.

The point is the end user controls what is output and how it is output.

8 pixels more visible on bottom and 1 on top regained from the infamous black bar! Nice step ahead! It changes the aspect ratio slightly though…

I tried to tweak stuff around to see if I could get rid of this black bar on top and I succeeded, with random hacks of course! :stuck_out_tongue:

Main change I did:

in mednafen\pce_fast-09333\vdc.cpp
line 1343
VDS = M_vdc_VDS - 4; 

VDS is for vertical display start, so it helps removing the black bar. With - 3 you get 1 more line of pixels visible at the top but I used - 4 to mimic exactly what mednafen on windows displayed (using the “aspect” option in the mednafen-09x.cfg).

Then in mednafen\settings.cpp
line84
   if (!strcmp("pce_fast.slstart", name))
      return 0; (instead of 4 to start display at 1st line vertically like you showed)
line 86
   if (!strcmp("pce_fast.slend", name))
      return 230; 

230 instead of 235, you can go up to show more lines at the bottom but it screws the screen aspect ratio making the picture “flat”.

So with those settings I see the same thing as mednafen stand-alone displays but the screen ratio is different. Retroarch is doing the real 4:3 (to my eyes, can be wrong) while mednafen seems to make something like pixel aspect?

Here is a zip, I’ve joined the comparison pictures and the libretro.dll for people to check it.

The changes for fullscreen and arcade games have been pushed to git.

The display should be on par with mednafen stand-alone, but in real 4:3 with retroarch (we can display it in any ratio anyway via the video menu). That means standard games are in fullscreen while particular resolutions render with black borders on top and bottom, sometimes with bigger top borders. I don’t know if that’s the way a real pc-engine displays stuff but at least it’s the same as mednafen with pce_fast from what I could test.

Thanks for the fix, this was one of the issues I was hoping to get solved. To use it I’ll have to give up my CD audio volume increase hack for now until I figure out a new way to get it to work or someone fixes the core volume options though. The default setting is accurate to the system, but I’d still prefer to balance the sound effects with the background music if possible.

Edit: I figured out a way to increase CDDA volume. In mednafen-libretro\mednafen\pce_fast-09333\pcecd.cpp I added a * 2 after CDDAVolumeSetting on line 129 to double the volume. Before figuring that out, I tried making the core option for CDPSG Volume work so I could decrease it, but couldn’t figure it out :confused:

removed

removed

That’s really nice! :slight_smile:

I just wonder about the VDS = M_vdc_VDS - 4; I think we will have 3 line of black pixels back, I don’t see where it get fixed anywhere else.

VDS = M_vdc_VDS - 3; would be the setting to see every pixels minus the black bar (I used 4 to do like mednafen default).

I’m gonna try it anyway…

removed

Wouldn’t it be better if you forked mednafen-libretro and submitted pull requests so this can be reviewed and merged into trunk?

You’re right that’s working, amazing! :slight_smile:

I just tried some changes. By putting slend to 242 in mednafen/settings.cpp

and then in libretrocpp: #define FB_HEIGHT 243 and the if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var)) { height -= (243 - atoi(var.value)); //magic }

with

{ “pce_scanlineend”, “Scanline End; 224|225|226|227|228|229|230|231|232|233|234|235|236|237|238|239|240|241|242” },

That’s working great, more lines taken from overscan.

And yes I see what you mean with the default lines. Mmmm… how to push stuff? :stuck_out_tongue: Or we should write this again in a cleaner way.

Well, I’m trying to fork. First time doing so, we’ll see how it goes.

removed

just hit fork on github, then when you have some commits ready for “consumption” create a pull request, it’s quite easy to be honest, then someone at the libretro side can check then and merge if it looks good.

Also in a fork you can give access to whoever you want.

These two PCE topics are realted right? it’s hard to keep up with both threads now :smiley:

Yeah it’s going smoothly. I’m just doing the commits to keep it readable, then everyone can decide what to do or change.

That should do it: https://github.com/Tatsuya79/mednafen-libretro

Could have made more smaller commits…?

edit: found the pull request option

OK, I forked my own. (Yeah it was easier than I thought).

I’ll do my rewrite using it. See how it goes.

Nice how you can see behind your ship in Super Star Soldier with 242 lines. That’s how I remember it on the Turbo GT as it displayed the extended picture, but in 4/3.

The aspect ratio has always been a bit strange between the coregrafx, the turbo GT and the particular games with an aspect ratio option in the menu. Some games have rounded symbols as well as oval-shaped ones on the same screen (like Devil’s crash ball vs points in circles in the background). At least now we have the choice. :stuck_out_tongue:

15-231 for Spriggan… already forgot about Dracula X. We need a save system now. :stuck_out_tongue:

Isn’t this related to

Tatsuya79 wrote:Well, just to add the pc-engine has a vertical resolution that can vary between games.
You can see this thread here about it.
Check Dracula X, it will have a black border on the bottom with slend 231 and an even bigger one with 239.
So yeah... no real solution except some kind of a register for every particular game to crop each overscan.
I guess that's something the original emulator has to decide, not libretro. :/

From the other thread? if that’s the case I guess implementing dynamic resolution would be a better approach than this… just wondering