Skip to content

Commit

Permalink
Front: Added zoom option in emulation profile
Browse files Browse the repository at this point in the history
  • Loading branch information
Gillou68310 committed Oct 20, 2015
1 parent 20adeb2 commit 2a496cf
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 2 deletions.
16 changes: 16 additions & 0 deletions res/values/arrays.xml
Expand Up @@ -382,6 +382,22 @@
</string-array> </string-array>


<string name="r4300Emulator_default" translatable="false">2</string> <string name="r4300Emulator_default" translatable="false">2</string>

<!-- Display zoom -->
<string-array name="displayZoom_entries" translatable="false">
<item>@string/displayZoom_entry100</item>
<item>@string/displayZoom_entry105</item>
<item>@string/displayZoom_entry110</item>
<item>@string/displayZoom_entry115</item>
</string-array>
<string-array name="displayZoom_values" translatable="false">
<item>100</item>
<item>105</item>
<item>110</item>
<item>115</item>
</string-array>

<string name="displayZoom_default" translatable="false">100</string>


<!-- Navigation Mode --> <!-- Navigation Mode -->
<string-array name="navigationMode_entries" translatable="false"> <string-array name="navigationMode_entries" translatable="false">
Expand Down
6 changes: 6 additions & 0 deletions res/values/strings.xml
Expand Up @@ -355,6 +355,12 @@
<string name="r4300Emulator_entryPureInterpreter">Pure interpreter</string> <string name="r4300Emulator_entryPureInterpreter">Pure interpreter</string>
<string name="r4300Emulator_entryCachedInterpreter">Cached interpreter</string> <string name="r4300Emulator_entryCachedInterpreter">Cached interpreter</string>
<string name="r4300Emulator_entryDynarec">Dynamic recompiler (dynarec)</string> <string name="r4300Emulator_entryDynarec">Dynamic recompiler (dynarec)</string>

<string name="displayZoom_title">Zoom</string>
<string name="displayZoom_entry100">100%</string>
<string name="displayZoom_entry105">105%</string>
<string name="displayZoom_entry110">110%</string>
<string name="displayZoom_entry115">115%</string>


<string name="audioPlugin_title">Audio plugin</string> <string name="audioPlugin_title">Audio plugin</string>
<string name="audioPlugin_entryNone">None (audio disabled)</string> <string name="audioPlugin_entryNone">None (audio disabled)</string>
Expand Down
7 changes: 7 additions & 0 deletions res/xml/profile_emulation.xml
Expand Up @@ -18,6 +18,13 @@
mupen64:minimumValue="1" mupen64:minimumValue="1"
mupen64:stepSize="1" mupen64:stepSize="1"
mupen64:units="%" /> mupen64:units="%" />
<paulscode.android.mupen64plusae.preference.CompatibleListPreference
android:defaultValue="@string/displayZoom_default"
android:entries="@array/displayZoom_entries"
android:entryValues="@array/displayZoom_values"
android:key="displayZoom"
android:summary="@string/selectedValue"
android:title="@string/displayZoom_title" />
<paulscode.android.mupen64plusae.preference.CompatibleListPreference <paulscode.android.mupen64plusae.preference.CompatibleListPreference
android:defaultValue="@string/videoPlugin_default" android:defaultValue="@string/videoPlugin_default"
android:entries="@array/videoPlugin_entries" android:entries="@array/videoPlugin_entries"
Expand Down
Expand Up @@ -250,8 +250,8 @@ public void onCreateEnd( Bundle savedInstanceState )
// Update the GameSurface size // Update the GameSurface size
mSurface.getHolder().setFixedSize( mGamePrefs.videoRenderWidth, mGamePrefs.videoRenderHeight ); mSurface.getHolder().setFixedSize( mGamePrefs.videoRenderWidth, mGamePrefs.videoRenderHeight );
FrameLayout.LayoutParams params = (FrameLayout.LayoutParams) mSurface.getLayoutParams(); FrameLayout.LayoutParams params = (FrameLayout.LayoutParams) mSurface.getLayoutParams();
params.width = mGlobalPrefs.videoSurfaceWidth; params.width = Math.round ( (float) mGlobalPrefs.videoSurfaceWidth * ( (float) mGamePrefs.videoSurfaceZoom / 100.f ) );
params.height = mGlobalPrefs.videoSurfaceHeight; params.height = Math.round ( (float) mGlobalPrefs.videoSurfaceHeight * ( (float) mGamePrefs.videoSurfaceZoom / 100.f ) );
params.gravity = mGlobalPrefs.displayPosition | Gravity.CENTER_HORIZONTAL; params.gravity = mGlobalPrefs.displayPosition | Gravity.CENTER_HORIZONTAL;
mSurface.setLayoutParams( params ); mSurface.setLayoutParams( params );


Expand Down
5 changes: 5 additions & 0 deletions src/paulscode/android/mupen64plusae/persistent/GamePrefs.java
Expand Up @@ -177,6 +177,9 @@ public class GamePrefs
/** The height of the OpenGL rendering context, in pixels. */ /** The height of the OpenGL rendering context, in pixels. */
public final int videoRenderHeight; public final int videoRenderHeight;


/** The zoom value applied to the viewing surface, in percent. */
public final int videoSurfaceZoom;

/** Game CRC */ /** Game CRC */
public final String crc; public final String crc;


Expand Down Expand Up @@ -268,6 +271,8 @@ public GamePrefs( Context context, String romMd5, String crc, String headerName,
videoRenderWidth = Math.round( ( float ) ( globalPrefs.videoSurfaceWidth * resolution ) / 100.f ); videoRenderWidth = Math.round( ( float ) ( globalPrefs.videoSurfaceWidth * resolution ) / 100.f );
videoRenderHeight = Math.round( ( float ) ( globalPrefs.videoSurfaceHeight * resolution ) / 100.f ); videoRenderHeight = Math.round( ( float ) ( globalPrefs.videoSurfaceHeight * resolution ) / 100.f );


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

// Touchscreen prefs // Touchscreen prefs
isTouchscreenEnabled = touchscreenProfile != null; isTouchscreenEnabled = touchscreenProfile != null;


Expand Down

0 comments on commit 2a496cf

Please sign in to comment.