Skip to content
Permalink
Browse files
front: Fixed resolution issues.
  • Loading branch information
fzurita committed Dec 16, 2015
1 parent 406640b commit ce821fa0b05bd143aea3b905bdcb5eb8126b637a
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
@@ -133,7 +133,7 @@ public static void syncConfigFiles( GamePrefs game, GlobalPrefs global, AppData

mupen64plus_cfg.put( "Video-GLideN64", "configVersion", "5" ); // Settings version. Don't touch it.
putGliden64( mupen64plus_cfg, game, "MultiSampling", "0" ); // Enable/Disable MultiSampling (0=off, 2,4,8,16=quality)
putGliden64( mupen64plus_cfg, game, "AspectRatio", aspectRatio ); // Screen aspect ratio (0=stretch, 1=force 4:3, 2=force 16:9, 3=adjust)
mupen64plus_cfg.put( "Video-GLideN64", "AspectRatio", aspectRatio); // Screen aspect ratio (0=stretch, 1=force 4:3, 2=force 16:9, 3=adjust)
putGliden64( mupen64plus_cfg, game, "bilinearMode", "1" ); // Bilinear filtering mode (0=N64 3point, 1=standard)
putGliden64( mupen64plus_cfg, game, "MaxAnisotropy", "0" ); // Max level of Anisotropic Filtering, 0 for off
putGliden64( mupen64plus_cfg, game, "CacheSize", "500" ); // Size of texture cache in megabytes. Good value is VRAM*3/4
@@ -172,7 +172,7 @@
public final boolean isTouchscreenAnimated;

/** The width of the OpenGL rendering context, in pixels. */
public final int videoRenderWidth;
public int videoRenderWidth;

/** The height of the OpenGL rendering context, in pixels. */
public final int videoRenderHeight;
@@ -329,6 +329,12 @@ public GamePrefs( Context context, String romMd5, String crc, String headerName,
break;
}

if(globalPrefs.mStretch)
{
float newWidth = videoRenderWidth * 1.333333f;
videoRenderWidth = Math.round(newWidth);
}

videoSurfaceZoom = getSafeInt( mPreferences, "displayZoom", 100 );

// Touchscreen prefs
@@ -220,6 +220,9 @@
/** Maximum number of auto saves */
public final int maxAutoSaves;

/** If display mode is stretch*/
public final boolean mStretch;

// Shared preferences keys and key templates
private static final String KEY_EMULATION_PROFILE_DEFAULT = "emulationProfileDefault";
private static final String KEY_TOUCHSCREEN_PROFILE_DEFAULT = "touchscreenProfileDefault";
@@ -470,8 +473,10 @@ else if( AppData.IS_KITKAT && isImmersiveModeEnabled )
videoSurfaceWidthOriginal = originalWidth;
videoSurfaceHeightOriginal = originalHeight;

mStretch = scaling.equals( "stretch" );

// Native resolution
if( scaling.equals( "stretch" ) )
if( mStretch )
{
videoSurfaceWidth = stretchWidth;
videoSurfaceHeight = stretchHeight;

6 comments on commit ce821fa

@Gillou68310
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will only work if the screen ratio is 16:9, why not using the actual screen resolution instead?
I probably missed something but what was wrong with the original implementation?

@fzurita
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mean the 1.3333 variable? That's a good point, you are correct, it will only work for 16:9.

Also, using the original screen resolution only works when the user chooses the native resolution, it doesn't work when the user chooses a lower resolution.

I will add a method to GlobalPrefs to get the aspect ratio since it can also vary depending on whether the user chooses immersive mode or not.

@Gillou68310
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's weird I don't recall having issues with this, let me check again!

@fzurita
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I'll give you an example of what would happen with the old implementation:

If you chose "720" as your selected resolution, we would render in the video plugin at 960 x 720, which then gets stretched by android to 1920 x 1080.

With the way I have it now, if you choose "720" as your selected resolution, we would render in the video plugin at 1280 x 720 and then stretch in android to 1920 x 1080.

It's a minor visual quality boost when choosing lower resolutions.

@Gillou68310
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok I understand now, btw that's why I initialy defined the resolution option as a pourcentage of the actual game res using a seekbar. Anyway I'm okay with this, we just have to adapt the 1.33 factor to the real screen ratio.

@fzurita
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I took care of it. Also, I noticed that my solution was broken in portrait mode. I went ahead and fixed that as well.

Please sign in to comment.