[[Glide64] Add ability to set screen resolution

This commit is contained in:
zilmar 2017-02-09 06:08:06 +11:00
parent bd7eaf3be4
commit b1d8db2c96
23 changed files with 409 additions and 149 deletions

View File

@ -22,6 +22,7 @@ LOCAL_SRC_FILES := \
$(SRCDIR)/Glitch64/OGLEStextures.cpp \ $(SRCDIR)/Glitch64/OGLEStextures.cpp \
$(SRCDIR)/Glitch64/OGLESwrappers.cpp \ $(SRCDIR)/Glitch64/OGLESwrappers.cpp \
$(SRCDIR)/Glide64/3dmath.cpp \ $(SRCDIR)/Glide64/3dmath.cpp \
$(SRCDIR)/Glide64/Android.cpp \
$(SRCDIR)/Glide64/Combine.cpp \ $(SRCDIR)/Glide64/Combine.cpp \
$(SRCDIR)/Glide64/Config.cpp \ $(SRCDIR)/Glide64/Config.cpp \
$(SRCDIR)/Glide64/CRC.cpp \ $(SRCDIR)/Glide64/CRC.cpp \

View File

@ -100,9 +100,11 @@
<string name="Advanced">Advanced</string> <string name="Advanced">Advanced</string>
<string name="CpuUsage_title">CPU Usage</string> <string name="CpuUsage_title">CPU Usage</string>
<string name="CpuUsage_summary">Show the cpu used by different components</string> <string name="CpuUsage_summary">Show the cpu used by different components</string>
<string name="DisplaySpeed_title">Display Speed</string>
<string name="LimitFPS_summary">Limit the max speed executed</string> <string name="LimitFPS_summary">Limit the max speed executed</string>
<string name="LimitFPS_title">Limit FPS</string> <string name="LimitFPS_title">Limit FPS</string>
<string name="screenResolution_title">Rendered Resolution</string>
<string name="screenResolution_summary">should show value???</string>
<string name="DisplaySpeed_title">Display Speed</string>
<string name="DisplaySpeed_summary">Show the speed of the emulation</string> <string name="DisplaySpeed_summary">Show the speed of the emulation</string>
<string name="DisplaySpeedDisplay">Display Speed Display</string> <string name="DisplaySpeedDisplay">Display Speed Display</string>
<string name="DListPerSecond">Display lists per second</string> <string name="DListPerSecond">Display lists per second</string>

View File

@ -1,6 +1,12 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"> <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<emu.project64.settings.TwoLinesListPreference
android:defaultValue="0"
android:key="video_screenResolution"
android:title="@string/screenResolution_title"
android:summary="@string/screenResolution_summary"
android:dialogTitle="@string/screenResolution_title" />
<CheckBoxPreference <CheckBoxPreference
android:key="Debugger_DisplaySpeed" android:key="Debugger_DisplaySpeed"
android:summary="@string/DisplaySpeed_summary" android:summary="@string/DisplaySpeed_summary"

View File

@ -23,10 +23,15 @@ import emu.project64.util.Strings;
import emu.project64.util.FileUtil; import emu.project64.util.FileUtil;
import emu.project64.util.Utility; import emu.project64.util.Utility;
import tv.ouya.console.api.OuyaFacade; import tv.ouya.console.api.OuyaFacade;
import android.annotation.SuppressLint;
import android.graphics.Point;
import android.os.Build; import android.os.Build;
import android.os.Environment; import android.os.Environment;
import android.util.DisplayMetrics;
import android.view.KeyEvent; import android.view.KeyEvent;
import android.view.WindowManager;
@SuppressLint("NewApi")
public class AndroidDevice public class AndroidDevice
{ {
/** True if device is running Gingerbread or later (9 - Android 2.3.x) */ /** True if device is running Gingerbread or later (9 - Android 2.3.x) */
@ -59,12 +64,38 @@ public class AndroidDevice
public static final boolean IS_ACTION_BAR_AVAILABLE = AndroidDevice.IS_HONEYCOMB && !AndroidDevice.IS_OUYA_HARDWARE; public static final boolean IS_ACTION_BAR_AVAILABLE = AndroidDevice.IS_HONEYCOMB && !AndroidDevice.IS_OUYA_HARDWARE;
final static boolean isTv; final static boolean isTv;
public final static int nativeWidth, nativeWidthOriginal;
public final static int nativeHeight, nativeHeightOriginal;
public static boolean MapVolumeKeys = false; public static boolean MapVolumeKeys = false;
static static
{ {
isTv = Project64Application.getAppContext().getPackageManager().hasSystemFeature("android.software.leanback"); isTv = Project64Application.getAppContext().getPackageManager().hasSystemFeature("android.software.leanback");
DisplayMetrics metrics = Project64Application.getAppContext().getResources().getDisplayMetrics();
int _nativeWidth = metrics.widthPixels < metrics.heightPixels ? metrics.heightPixels : metrics.widthPixels;
int _nativeHeight = metrics.widthPixels < metrics.heightPixels ? metrics.widthPixels: metrics.heightPixels;
if (IS_KITKAT)
{
Point size = new Point();
try
{
((WindowManager) Project64Application.getAppContext().getSystemService(Project64Application.getAppContext().WINDOW_SERVICE)).getDefaultDisplay().getRealSize(size);
_nativeWidth = size.x < size.y ? size.y : size.x;
_nativeHeight = size.x < size.y ? size.x: size.y;
}
catch (NoSuchMethodError e)
{
}
}
nativeWidth = _nativeWidth;
nativeHeight = _nativeHeight;
final float aspect = 0.75f;
final boolean isLetterboxed = ( (float) nativeHeight / (float) nativeWidth ) > aspect;
nativeWidthOriginal = isLetterboxed ? nativeWidth : Math.round( nativeHeight / aspect );
nativeHeightOriginal = isLetterboxed ? Math.round( nativeWidth * aspect ) : nativeHeight;
} }
public static boolean isAndroidTv() public static boolean isAndroidTv()

View File

@ -21,6 +21,7 @@ import java.util.ArrayList;
import java.util.Set; import java.util.Set;
import emu.project64.AndroidDevice; import emu.project64.AndroidDevice;
import emu.project64.Project64Application;
import emu.project64.R; import emu.project64.R;
import emu.project64.hack.MogaHack; import emu.project64.hack.MogaHack;
import emu.project64.input.AbstractController; import emu.project64.input.AbstractController;
@ -34,10 +35,12 @@ import emu.project64.input.provider.KeyProvider;
import emu.project64.input.provider.KeyProvider.ImeFormula; import emu.project64.input.provider.KeyProvider.ImeFormula;
import emu.project64.input.provider.MogaProvider; import emu.project64.input.provider.MogaProvider;
import emu.project64.jni.NativeExports; import emu.project64.jni.NativeExports;
import emu.project64.jni.NativeVideo;
import emu.project64.jni.NativeXperiaTouchpad; import emu.project64.jni.NativeXperiaTouchpad;
import emu.project64.jni.SettingsID; import emu.project64.jni.SettingsID;
import emu.project64.jni.SystemEvent; import emu.project64.jni.SystemEvent;
import emu.project64.jni.UISettingID; import emu.project64.jni.UISettingID;
import emu.project64.jni.VideoSettingID;
import emu.project64.persistent.ConfigFile; import emu.project64.persistent.ConfigFile;
import emu.project64.persistent.ConfigFile.ConfigSection; import emu.project64.persistent.ConfigFile.ConfigSection;
import emu.project64.profile.Profile; import emu.project64.profile.Profile;
@ -52,11 +55,15 @@ import android.graphics.drawable.ColorDrawable;
import android.os.Bundle; import android.os.Bundle;
import android.os.Vibrator; import android.os.Vibrator;
import android.util.Log; import android.util.Log;
import android.view.Display;
import android.view.Gravity;
import android.view.KeyEvent; import android.view.KeyEvent;
import android.view.SurfaceHolder; import android.view.SurfaceHolder;
import android.view.View; import android.view.View;
import android.view.Window; import android.view.Window;
import android.view.WindowManager;
import android.view.WindowManager.LayoutParams; import android.view.WindowManager.LayoutParams;
import android.widget.FrameLayout;
public class GameLifecycleHandler implements View.OnKeyListener, SurfaceHolder.Callback, GameSurface.SurfaceInfo public class GameLifecycleHandler implements View.OnKeyListener, SurfaceHolder.Callback, GameSurface.SurfaceInfo
{ {
@ -92,7 +99,7 @@ public class GameLifecycleHandler implements View.OnKeyListener, SurfaceHolder.C
mActivity = activity; mActivity = activity;
mControllers = new ArrayList<AbstractController>(); mControllers = new ArrayList<AbstractController>();
mIsXperiaPlay = !(activity instanceof GameActivity); mIsXperiaPlay = !(activity instanceof GameActivity);
mMogaController = Controller.getInstance( mActivity ); mMogaController = Controller.getInstance(mActivity);
} }
@TargetApi(11) @TargetApi(11)
@ -105,8 +112,7 @@ public class GameLifecycleHandler implements View.OnKeyListener, SurfaceHolder.C
// Initialize MOGA controller API // Initialize MOGA controller API
// TODO: Remove hack after MOGA SDK is fixed // TODO: Remove hack after MOGA SDK is fixed
// mMogaController.init(); // mMogaController.init();
MogaHack.init( mMogaController, mActivity ); MogaHack.init(mMogaController, mActivity);
// For Honeycomb, let the action bar overlay the rendered view (rather // For Honeycomb, let the action bar overlay the rendered view (rather
// than squeezing it) // than squeezing it)
@ -140,19 +146,34 @@ public class GameLifecycleHandler implements View.OnKeyListener, SurfaceHolder.C
// Lay out content and get the views // Lay out content and get the views
mActivity.setContentView(R.layout.game_activity); mActivity.setContentView(R.layout.game_activity);
mSurface = (GameSurface) mActivity.findViewById( R.id.gameSurface ); mSurface = (GameSurface) mActivity.findViewById(R.id.gameSurface);
mOverlay = (GameOverlay) mActivity.findViewById(R.id.gameOverlay); mOverlay = (GameOverlay) mActivity.findViewById(R.id.gameOverlay);
float widthRatio = (float)AndroidDevice.nativeWidth/(float)AndroidDevice.nativeWidthOriginal;
float heightRatio = (float)AndroidDevice.nativeHeight/(float)AndroidDevice.nativeHeightOriginal;
int ScreenRes = NativeExports.SettingsLoadDword(SettingsID.FirstGfxSettings.getValue() + VideoSettingID.Set_Resolution.getValue());
int videoRenderWidth = Math.round(NativeVideo.GetScreenResWidth(ScreenRes) * (ScreenRes == 0 ? 1 : widthRatio));
int videoRenderHeight = Math.round(NativeVideo.GetScreenResHeight(ScreenRes) * (ScreenRes == 0 ? 1 : heightRatio));
// Update screen res
mSurface.getHolder().setFixedSize(videoRenderWidth, videoRenderHeight);
final FrameLayout.LayoutParams params = (FrameLayout.LayoutParams) mSurface.getLayoutParams();
params.width = AndroidDevice.nativeWidth;
params.height = AndroidDevice.nativeHeight;
params.gravity = Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL;
mSurface.setLayoutParams(params);
// Listen to game surface events (created, changed, destroyed) // Listen to game surface events (created, changed, destroyed)
mSurface.getHolder().addCallback( this ); mSurface.getHolder().addCallback(this);
mSurface.createGLContext((ActivityManager)mActivity.getSystemService(Context.ACTIVITY_SERVICE)); mSurface.createGLContext((ActivityManager) mActivity.getSystemService(Context.ACTIVITY_SERVICE));
// Configure the action bar introduced in higher Android versions // Configure the action bar introduced in higher Android versions
if (AndroidDevice.IS_ACTION_BAR_AVAILABLE) if (AndroidDevice.IS_ACTION_BAR_AVAILABLE)
{ {
mActivity.getActionBar().hide(); mActivity.getActionBar().hide();
ColorDrawable color = new ColorDrawable(Color.parseColor("#303030")); ColorDrawable color = new ColorDrawable(Color.parseColor("#303030"));
color.setAlpha(50 /*mGlobalPrefs.displayActionBarTransparency*/); color.setAlpha(50 /* mGlobalPrefs.displayActionBarTransparency */);
mActivity.getActionBar().setBackgroundDrawable(color); mActivity.getActionBar().setBackgroundDrawable(color);
} }
@ -162,8 +183,9 @@ public class GameLifecycleHandler implements View.OnKeyListener, SurfaceHolder.C
View inputSource = mIsXperiaPlay ? new NativeXperiaTouchpad(mActivity) : mOverlay; View inputSource = mIsXperiaPlay ? new NativeXperiaTouchpad(mActivity) : mOverlay;
initControllers(inputSource); initControllers(inputSource);
// Override the peripheral controllers' key provider, to add some extra functionality // Override the peripheral controllers' key provider, to add some extra
inputSource.setOnKeyListener( this ); // functionality
inputSource.setOnKeyListener(this);
} }
public void onStart() public void onStart()
@ -235,7 +257,7 @@ public class GameLifecycleHandler implements View.OnKeyListener, SurfaceHolder.C
{ {
pause = true; pause = true;
PauseType = NativeExports.SettingsLoadDword(SettingsID.GameRunning_CPU_PausedType.getValue()); PauseType = NativeExports.SettingsLoadDword(SettingsID.GameRunning_CPU_PausedType.getValue());
NativeExports.ExternalEvent( SystemEvent.SysEvent_ResumeCPU_FromMenu.getValue()); NativeExports.ExternalEvent(SystemEvent.SysEvent_ResumeCPU_FromMenu.getValue());
} }
int CurrentSaveState = NativeExports.SettingsLoadDword(SettingsID.Game_CurrentSaveState.getValue()); int CurrentSaveState = NativeExports.SettingsLoadDword(SettingsID.Game_CurrentSaveState.getValue());
int OriginalSaveTime = NativeExports.SettingsLoadDword(SettingsID.Game_LastSaveTime.getValue()); int OriginalSaveTime = NativeExports.SettingsLoadDword(SettingsID.Game_LastSaveTime.getValue());
@ -256,7 +278,7 @@ public class GameLifecycleHandler implements View.OnKeyListener, SurfaceHolder.C
{ {
Thread.sleep(100); Thread.sleep(100);
} }
catch(InterruptedException ex) catch (InterruptedException ex)
{ {
Thread.currentThread().interrupt(); Thread.currentThread().interrupt();
} }
@ -264,7 +286,7 @@ public class GameLifecycleHandler implements View.OnKeyListener, SurfaceHolder.C
NativeExports.SettingsSaveDword(SettingsID.Game_CurrentSaveState.getValue(), CurrentSaveState); NativeExports.SettingsSaveDword(SettingsID.Game_CurrentSaveState.getValue(), CurrentSaveState);
if (pause) if (pause)
{ {
NativeExports.ExternalEvent( SystemEvent.SysEvent_PauseCPU_FromMenu.getValue()); NativeExports.ExternalEvent(SystemEvent.SysEvent_PauseCPU_FromMenu.getValue());
NativeExports.SettingsSaveDword(SettingsID.GameRunning_CPU_PausedType.getValue(), PauseType); NativeExports.SettingsSaveDword(SettingsID.GameRunning_CPU_PausedType.getValue(), PauseType);
} }
} }
@ -324,9 +346,9 @@ public class GameLifecycleHandler implements View.OnKeyListener, SurfaceHolder.C
mMogaController.exit(); mMogaController.exit();
} }
public void onSettingDone () public void onSettingDone()
{ {
mtouchscreenScale = ((float)NativeExports.UISettingsLoadDword(UISettingID.TouchScreen_ButtonScale.getValue())) / 100.0f; mtouchscreenScale = ((float) NativeExports.UISettingsLoadDword(UISettingID.TouchScreen_ButtonScale.getValue())) / 100.0f;
mlayout = NativeExports.UISettingsLoadString(UISettingID.TouchScreen_Layout.getValue()); mlayout = NativeExports.UISettingsLoadString(UISettingID.TouchScreen_Layout.getValue());
mControllers = new ArrayList<AbstractController>(); mControllers = new ArrayList<AbstractController>();
CreateTouchScreenControls(); CreateTouchScreenControls();
@ -339,37 +361,40 @@ public class GameLifecycleHandler implements View.OnKeyListener, SurfaceHolder.C
private void CreateTouchScreenControls() private void CreateTouchScreenControls()
{ {
boolean isTouchscreenAnimated = false; //mGlobalPrefs.isTouchscreenAnimated boolean isTouchscreenAnimated = false; // mGlobalPrefs.isTouchscreenAnimated
boolean isTouchscreenHidden = false; //!isTouchscreenEnabled || globalPrefs.touchscreenTransparency == 0; boolean isTouchscreenHidden = false; // !isTouchscreenEnabled ||
// globalPrefs.touchscreenTransparency
// == 0;
String profilesDir = AndroidDevice.PACKAGE_DIRECTORY + "/profiles"; String profilesDir = AndroidDevice.PACKAGE_DIRECTORY + "/profiles";
String touchscreenProfiles_cfg = profilesDir + "/touchscreen.cfg"; String touchscreenProfiles_cfg = profilesDir + "/touchscreen.cfg";
ConfigFile touchscreenConfigFile = new ConfigFile( touchscreenProfiles_cfg ); ConfigFile touchscreenConfigFile = new ConfigFile(touchscreenProfiles_cfg);
ConfigSection section = touchscreenConfigFile.get(mlayout); ConfigSection section = touchscreenConfigFile.get(mlayout);
if (section == null) if (section == null)
{ {
mlayout = "Analog"; mlayout = "Analog";
section = touchscreenConfigFile.get(mlayout); section = touchscreenConfigFile.get(mlayout);
} }
Profile touchscreenProfile = new Profile( true, section); Profile touchscreenProfile = new Profile(true, section);
int touchscreenTransparency = 100; int touchscreenTransparency = 100;
String touchscreenSkinsDir = AndroidDevice.PACKAGE_DIRECTORY + "/skins/touchscreen"; String touchscreenSkinsDir = AndroidDevice.PACKAGE_DIRECTORY + "/skins/touchscreen";
String touchscreenSkin = touchscreenSkinsDir + "/Outline"; String touchscreenSkin = touchscreenSkinsDir + "/Outline";
// The touch map and overlay are needed to display frame rate and/or controls // The touch map and overlay are needed to display frame rate and/or
mTouchscreenMap = new VisibleTouchMap( mActivity.getResources() ); // controls
mTouchscreenMap.load(touchscreenSkin, touchscreenProfile, isTouchscreenAnimated, mtouchscreenScale, touchscreenTransparency ); mTouchscreenMap = new VisibleTouchMap(mActivity.getResources());
mOverlay.initialize( mTouchscreenMap, !isTouchscreenHidden, isTouchscreenAnimated ); mTouchscreenMap.load(touchscreenSkin, touchscreenProfile, isTouchscreenAnimated, mtouchscreenScale, touchscreenTransparency);
} mOverlay.initialize(mTouchscreenMap, !isTouchscreenHidden, isTouchscreenAnimated);
}
@Override @Override
public boolean onKey( View view, int keyCode, KeyEvent event ) public boolean onKey(View view, int keyCode, KeyEvent event)
{ {
// If PeripheralControllers exist and handle the event, // If PeripheralControllers exist and handle the event,
// they return true. Else they return false, signaling // they return true. Else they return false, signaling
// Android to handle the event (menu button, vol keys). // Android to handle the event (menu button, vol keys).
if( mKeyProvider != null ) if (mKeyProvider != null)
{ {
return mKeyProvider.onKey( view, keyCode, event ); return mKeyProvider.onKey(view, keyCode, event);
} }
return false; return false;
} }
@ -378,32 +403,32 @@ public class GameLifecycleHandler implements View.OnKeyListener, SurfaceHolder.C
private void initControllers(View inputSource) private void initControllers(View inputSource)
{ {
// By default, send Player 1 rumbles through phone vibrator // By default, send Player 1 rumbles through phone vibrator
Vibrator vibrator = (Vibrator) mActivity.getSystemService( Context.VIBRATOR_SERVICE ); Vibrator vibrator = (Vibrator) mActivity.getSystemService(Context.VIBRATOR_SERVICE);
int touchscreenAutoHold = 0; int touchscreenAutoHold = 0;
boolean isTouchscreenFeedbackEnabled = false; boolean isTouchscreenFeedbackEnabled = false;
Set<Integer> autoHoldableButtons = null; Set<Integer> autoHoldableButtons = null;
// Create the touchscreen controller // Create the touchscreen controller
TouchController touchscreenController = new TouchController( mTouchscreenMap, TouchController touchscreenController = new TouchController(mTouchscreenMap, inputSource, mOverlay, vibrator,
inputSource, mOverlay, vibrator, touchscreenAutoHold, touchscreenAutoHold, isTouchscreenFeedbackEnabled, autoHoldableButtons);
isTouchscreenFeedbackEnabled, autoHoldableButtons ); mControllers.add(touchscreenController);
mControllers.add( touchscreenController );
// Create the input providers shared among all peripheral controllers // Create the input providers shared among all peripheral controllers
String profile_name = NativeExports.UISettingsLoadString(UISettingID.Controller_CurrentProfile.getValue()); String profile_name = NativeExports.UISettingsLoadString(UISettingID.Controller_CurrentProfile.getValue());
ConfigFile ControllerConfigFile = new ConfigFile(NativeExports.UISettingsLoadString(UISettingID.Controller_ConfigFile.getValue())); ConfigFile ControllerConfigFile = new ConfigFile(
ConfigSection section = ControllerConfigFile.get( profile_name ); NativeExports.UISettingsLoadString(UISettingID.Controller_ConfigFile.getValue()));
ConfigSection section = ControllerConfigFile.get(profile_name);
if (section != null) if (section != null)
{ {
Profile ControllerProfile = new Profile( false, section ); Profile ControllerProfile = new Profile(false, section);
InputMap map = new InputMap( ControllerProfile.get( "map" ) ); InputMap map = new InputMap(ControllerProfile.get("map"));
mKeyProvider = new KeyProvider( inputSource, ImeFormula.DEFAULT, AndroidDevice.getUnmappableKeyCodes() ); mKeyProvider = new KeyProvider(inputSource, ImeFormula.DEFAULT, AndroidDevice.getUnmappableKeyCodes());
MogaProvider mogaProvider = new MogaProvider( mMogaController ); MogaProvider mogaProvider = new MogaProvider(mMogaController);
AbstractProvider axisProvider = AndroidDevice.IS_HONEYCOMB_MR1 ? new AxisProvider( inputSource ) : null; AbstractProvider axisProvider = AndroidDevice.IS_HONEYCOMB_MR1 ? new AxisProvider(inputSource) : null;
int Deadzone = NativeExports.UISettingsLoadDword(UISettingID.Controller_Deadzone.getValue()); int Deadzone = NativeExports.UISettingsLoadDword(UISettingID.Controller_Deadzone.getValue());
int Sensitivity = NativeExports.UISettingsLoadDword(UISettingID.Controller_Sensitivity.getValue()); int Sensitivity = NativeExports.UISettingsLoadDword(UISettingID.Controller_Sensitivity.getValue());
mControllers.add( new PeripheralController( 1, map, Deadzone, Sensitivity, mKeyProvider, axisProvider, mogaProvider ) ); mControllers.add(new PeripheralController(1, map, Deadzone, Sensitivity, mKeyProvider, axisProvider, mogaProvider));
} }
} }

View File

@ -589,6 +589,9 @@ public enum LanguageStringID
ANDROID_MENU_DEBUGGINGOPTIONS(3111), ANDROID_MENU_DEBUGGINGOPTIONS(3111),
ANDROID_MENU_RESETFUNCTIONTIMES(3112), ANDROID_MENU_RESETFUNCTIONTIMES(3112),
ANDROID_MENU_DUMPFUNCTIONTIMES(3113), ANDROID_MENU_DUMPFUNCTIONTIMES(3113),
//Video plugin
ANDROID_VIDEO_NATIVE_RES(3200),
; ;
private int value; private int value;

View File

@ -0,0 +1,31 @@
/****************************************************************************
* *
* Project 64 - A Nintendo 64 emulator. *
* http://www.pj64-emu.com/ *
* Copyright (C) 2012 Project64. All rights reserved. *
* *
* License: *
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
* *
****************************************************************************/
package emu.project64.jni;
/**
* Calls made between the native input-android library and Java. Any function names changed here
* should also be changed in the corresponding C code, and vice versa.
*
* @see /Source/Android/PluginInput/Main.cpp
* @see CoreInterface
*/
public class NativeVideo
{
static
{
System.loadLibrary( "Project64-gfx-glide64" );
}
public static native int getResolutionCount();
public static native String getResolutionName(int Index);
public static native int GetScreenResWidth(int Index);
public static native int GetScreenResHeight(int Index);
}

View File

@ -0,0 +1,63 @@
/****************************************************************************
* *
* Project 64 - A Nintendo 64 emulator. *
* http://www.pj64-emu.com/ *
* Copyright (C) 2012 Project64. All rights reserved. *
* *
* License: *
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
* *
****************************************************************************/
package emu.project64.jni;
public enum VideoSettingID
{
// General Settings
Set_vsync, Set_Rotate, Set_texenh_options, Set_wrpVRAM,
Set_wrpFBO, Set_wrpAnisotropic, Set_autodetect_ucode, Set_ucode, Set_wireframe,
Set_wfmode, Set_unk_as_red, Set_unk_clear, Set_ghq_fltr,
Set_ghq_cmpr, Set_ghq_enht, Set_ghq_hirs, Set_ghq_enht_cmpr, Set_ghq_enht_tile,
Set_ghq_enht_f16bpp, Set_ghq_enht_gz, Set_ghq_enht_nobg, Set_ghq_hirs_cmpr,
Set_ghq_hirs_tile, Set_ghq_hirs_f16bpp, Set_ghq_hirs_gz, Set_ghq_hirs_altcrc,
Set_ghq_cache_save, Set_ghq_cache_size, Set_ghq_hirs_let_texartists_fly,
Set_ghq_hirs_dump, Set_Resolution,
// Default Game Settings
Set_optimize_texrect_default, Set_filtering_default, Set_lodmode_default,
Set_fog_default, Set_buff_clear_default, Set_swapmode_default,
Set_aspect_default, Set_fb_smart_default, Set_fb_hires_default,
Set_fb_read_always_default, Set_read_back_to_screen_default, Set_detect_cpu_write_default,
Set_fb_get_info_default, Set_fb_render_default,
//Game Settings
Set_alt_tex_size, Set_use_sts1_only, Set_force_calc_sphere, Set_correct_viewport,
Set_increase_texrect_edge, Set_decrease_fillrect_edge, Set_texture_correction,
Set_pal230, Set_stipple_mode, Set_stipple_pattern, Set_force_microcheck, Set_force_quad3d,
Set_clip_zmin, Set_clip_zmax, Set_fast_crc, Set_adjust_aspect, Set_zmode_compare_less,
Set_old_style_adither, Set_n64_z_scale, Set_optimize_texrect, Set_ignore_aux_copy,
Set_hires_buf_clear, Set_fb_read_alpha, Set_useless_is_useless, Set_fb_crc_mode,
Set_filtering, Set_fog, Set_buff_clear, Set_swapmode, Set_aspect, Set_lodmode,
Set_fb_smart, Set_fb_hires, Set_fb_read_always, Set_read_back_to_screen,
Set_detect_cpu_write, Set_fb_get_info, Set_fb_render,
//RDB Setting
Set_ucodeLookup,
;
private int value;
public int getValue()
{
return this.value;
}
private static final class StaticFields
{
public static int Counter = 0;
}
private VideoSettingID()
{
this.value = StaticFields.Counter;
StaticFields.Counter += 1;
}
}

View File

@ -31,27 +31,5 @@ public class GamepadScreenFragment extends BaseSettingsFragment
public void onCreatePreferences(Bundle bundle, String s) public void onCreatePreferences(Bundle bundle, String s)
{ {
super.onCreatePreferences(bundle, s); super.onCreatePreferences(bundle, s);
/*String profilesDir = AndroidDevice.PACKAGE_DIRECTORY + "/profiles";
String touchscreenProfiles_cfg = profilesDir + "/touchscreen.cfg";
ConfigFile touchscreenProfiles = new ConfigFile( touchscreenProfiles_cfg );
Set<String> layoutsKeySet = touchscreenProfiles.keySet();
String[] layouts = layoutsKeySet.toArray(new String[layoutsKeySet.size()]);
CharSequence[] entries = new CharSequence[layouts.length];
String[] entryValues = new String[layouts.length];
String[] entrySubtitles = new String[layouts.length];
for( int i = 0; i < layouts.length; i++ )
{
entries[i] = layouts[i];
entryValues[i] = layouts[i];
entrySubtitles[i] = touchscreenProfiles.get(layouts[i]).get("comment");
}
final TwoLinesListPreference listPreference = (TwoLinesListPreference) findPreference("touchscreenLayout");
listPreference.setEntries(entries);
listPreference.setEntryValues(entryValues);
listPreference.setEntriesSubtitles(entrySubtitles);*/
} }
} }

View File

@ -18,6 +18,7 @@ import emu.project64.jni.NativeExports;
import emu.project64.jni.SettingsID; import emu.project64.jni.SettingsID;
import emu.project64.jni.SystemEvent; import emu.project64.jni.SystemEvent;
import emu.project64.jni.UISettingID; import emu.project64.jni.UISettingID;
import emu.project64.jni.VideoSettingID;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.os.Bundle; import android.os.Bundle;
import android.preference.PreferenceManager; import android.preference.PreferenceManager;
@ -92,6 +93,7 @@ public class SettingsActivity extends AppCompatActivity implements SharedPrefere
.putString("Debugger_TraceExceptionHandler",String.valueOf(NativeExports.SettingsLoadDword(SettingsID.Debugger_TraceExceptionHandler.getValue()))) .putString("Debugger_TraceExceptionHandler",String.valueOf(NativeExports.SettingsLoadDword(SettingsID.Debugger_TraceExceptionHandler.getValue())))
.putString("Debugger_TraceAudioInitShutdown",String.valueOf(NativeExports.SettingsLoadDword(SettingsID.FirstAudioSettings.getValue() + AudioSettingID.Logging_LogAudioInitShutdown.getValue()))) .putString("Debugger_TraceAudioInitShutdown",String.valueOf(NativeExports.SettingsLoadDword(SettingsID.FirstAudioSettings.getValue() + AudioSettingID.Logging_LogAudioInitShutdown.getValue())))
.putString("Debugger_TraceAudioAudioInterface",String.valueOf(NativeExports.SettingsLoadDword(SettingsID.FirstAudioSettings.getValue() + AudioSettingID.Logging_LogAudioInterface.getValue()))) .putString("Debugger_TraceAudioAudioInterface",String.valueOf(NativeExports.SettingsLoadDword(SettingsID.FirstAudioSettings.getValue() + AudioSettingID.Logging_LogAudioInterface.getValue())))
.putString("video_screenResolution",String.valueOf(NativeExports.SettingsLoadDword(SettingsID.FirstGfxSettings.getValue() + VideoSettingID.Set_Resolution.getValue())))
.putInt("MaxRomsRemembered",NativeExports.UISettingsLoadDword(UISettingID.File_RecentGameFileCount.getValue())) .putInt("MaxRomsRemembered",NativeExports.UISettingsLoadDword(UISettingID.File_RecentGameFileCount.getValue()))
.apply(); .apply();
@ -175,6 +177,7 @@ public class SettingsActivity extends AppCompatActivity implements SharedPrefere
else if (key.equals("Debugger_TraceExceptionHandler")) { NativeExports.SettingsSaveDword(SettingsID.Debugger_TraceExceptionHandler.getValue(), Integer.valueOf(sharedPreferences.getString(key, "1"))); } else if (key.equals("Debugger_TraceExceptionHandler")) { NativeExports.SettingsSaveDword(SettingsID.Debugger_TraceExceptionHandler.getValue(), Integer.valueOf(sharedPreferences.getString(key, "1"))); }
else if (key.equals("Debugger_TraceAudioInitShutdown")) { NativeExports.SettingsSaveDword(SettingsID.FirstAudioSettings.getValue() + AudioSettingID.Logging_LogAudioInitShutdown.getValue(), Integer.valueOf(sharedPreferences.getString(key, "1"))); } else if (key.equals("Debugger_TraceAudioInitShutdown")) { NativeExports.SettingsSaveDword(SettingsID.FirstAudioSettings.getValue() + AudioSettingID.Logging_LogAudioInitShutdown.getValue(), Integer.valueOf(sharedPreferences.getString(key, "1"))); }
else if (key.equals("Debugger_TraceAudioAudioInterface")) { NativeExports.SettingsSaveDword(SettingsID.FirstAudioSettings.getValue() + AudioSettingID.Logging_LogAudioInterface.getValue(), Integer.valueOf(sharedPreferences.getString(key, "1"))); } else if (key.equals("Debugger_TraceAudioAudioInterface")) { NativeExports.SettingsSaveDword(SettingsID.FirstAudioSettings.getValue() + AudioSettingID.Logging_LogAudioInterface.getValue(), Integer.valueOf(sharedPreferences.getString(key, "1"))); }
else if (key.equals("video_screenResolution")) { NativeExports.SettingsSaveDword(SettingsID.FirstGfxSettings.getValue() + VideoSettingID.Set_Resolution.getValue(), Integer.valueOf(sharedPreferences.getString(key, "1"))); }
else if (key.equals("MaxRomsRemembered")) { NativeExports.UISettingsSaveDword(UISettingID.File_RecentGameFileCount.getValue(), sharedPreferences.getInt(key, 10)); } else if (key.equals("MaxRomsRemembered")) { NativeExports.UISettingsSaveDword(UISettingID.File_RecentGameFileCount.getValue(), sharedPreferences.getInt(key, 10)); }
} }
} }

View File

@ -32,18 +32,15 @@ public class TwoLinesListPreferenceDialogFragmentCompat extends PreferenceDialog
return (TwoLinesListPreference)this.getPreference(); return (TwoLinesListPreference)this.getPreference();
} }
class YourAdapter extends ArrayAdapter<String> class TwoLinesListPreferenceAdapter extends ArrayAdapter<String>
{ {
public YourAdapter(Context context, String[] values) public TwoLinesListPreferenceAdapter(Context context, String[] values)
{ {
super(context, R.layout.two_lines_list_preference_row, values); super(context, R.layout.two_lines_list_preference_row, values);
} }
class ViewHolder class ViewHolder
{ {
TextView title;
TextView subTitle;
RadioButton radioBtn;
} }
ViewHolder holder; ViewHolder holder;
@ -52,33 +49,32 @@ public class TwoLinesListPreferenceDialogFragmentCompat extends PreferenceDialog
@Override @Override
public View getView(int position, View convertView, ViewGroup parent) public View getView(int position, View convertView, ViewGroup parent)
{ {
final LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE); final TwoLinesListPreference preference = getTwoLinesListPreference();
if (convertView == null)
{
convertView = inflater.inflate(R.layout.two_lines_list_preference_row, null);
holder = new ViewHolder();
holder.title = (TextView) convertView.findViewById(R.id.two_lines_list_view_row_text);
holder.subTitle = (TextView) convertView.findViewById(R.id.two_lines_list_view_row_subtext);
holder.radioBtn = (RadioButton) convertView.findViewById(R.id.two_lines_list_view_row_radiobtn);
convertView.setTag(holder);
holder.title.setOnClickListener(listener); final LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
holder.subTitle.setOnClickListener(listener); convertView = inflater.inflate(R.layout.two_lines_list_preference_row, null);
holder.radioBtn.setOnClickListener(listener);
TextView title = (TextView) convertView.findViewById(R.id.two_lines_list_view_row_text);
title.setOnClickListener(listener);
title.setText(preference.getEntries()[position]);
title.setTag(position);
TextView subTitle = (TextView) convertView.findViewById(R.id.two_lines_list_view_row_subtext);
if (preference.getEntriesSubtitles()[position].length() == 0)
{
subTitle.setVisibility(View.GONE);
} }
else else
{ {
holder = (ViewHolder) convertView.getTag(); subTitle.setOnClickListener(listener);
subTitle.setText(preference.getEntriesSubtitles()[position]);
subTitle.setTag(position);
} }
final TwoLinesListPreference preference = getTwoLinesListPreference();
holder.title.setText(preference.getEntries()[position]); RadioButton radioBtn = (RadioButton) convertView.findViewById(R.id.two_lines_list_view_row_radiobtn);
holder.title.setTag(position); radioBtn.setOnClickListener(listener);
holder.subTitle.setText(preference.getEntriesSubtitles()[position]); radioBtn.setChecked(preference.getValueIndex() == position);
holder.subTitle.setTag(position); radioBtn.setTag(position);
holder.radioBtn.setChecked(preference.getValueIndex() == position);
holder.radioBtn.setTag(position);
return convertView; return convertView;
} }
@ -96,7 +92,7 @@ public class TwoLinesListPreferenceDialogFragmentCompat extends PreferenceDialog
values[i] = entries[i].toString(); values[i] = entries[i].toString();
} }
ListAdapter adapter = new YourAdapter(builder.getContext(), values); ListAdapter adapter = new TwoLinesListPreferenceAdapter(builder.getContext(), values);
builder.setAdapter(adapter, new DialogInterface.OnClickListener() builder.setAdapter(adapter, new DialogInterface.OnClickListener()
{ {
@Override @Override
@ -126,7 +122,7 @@ public class TwoLinesListPreferenceDialogFragmentCompat extends PreferenceDialog
{ {
final TwoLinesListPreference preference = getTwoLinesListPreference(); final TwoLinesListPreference preference = getTwoLinesListPreference();
int EntryIndex = (Integer) v.getTag(); int EntryIndex = (Integer) v.getTag();
preference.setValue(preference.getEntries()[EntryIndex].toString()); preference.setValue(preference.getEntryValues()[EntryIndex].toString());
TwoLinesListPreferenceDialogFragmentCompat.this.getDialog().dismiss(); TwoLinesListPreferenceDialogFragmentCompat.this.getDialog().dismiss();
} }
} }

View File

@ -10,7 +10,18 @@
****************************************************************************/ ****************************************************************************/
package emu.project64.settings; package emu.project64.settings;
import android.content.Context;
import android.graphics.Point;
import android.os.Build;
import android.os.Bundle;
import android.util.DisplayMetrics;
import android.util.Log;
import android.view.WindowManager;
import emu.project64.AndroidDevice;
import emu.project64.R; import emu.project64.R;
import emu.project64.jni.LanguageStringID;
import emu.project64.jni.NativeVideo;
import emu.project64.util.Strings;
public class VideoFragment extends BaseSettingsFragment public class VideoFragment extends BaseSettingsFragment
{ {
@ -25,4 +36,32 @@ public class VideoFragment extends BaseSettingsFragment
{ {
return R.string.video_screen_title; return R.string.video_screen_title;
} }
@Override
public void onCreatePreferences(Bundle bundle, String s)
{
super.onCreatePreferences(bundle, s);
int ResCount = NativeVideo.getResolutionCount();
CharSequence[] ResEntries = new CharSequence[ResCount];
String[] ResEntryValues = new String[ResCount];
String[] ResEntrySubtitles = new String[ResCount];
for( int i = 0; i < ResCount; i++ )
{
ResEntries[i] = NativeVideo.getResolutionName(i);
ResEntryValues[i] = Integer.toString(i);
ResEntrySubtitles[i] = "";
if (ResEntries[i].equals("#3200#"))
{
ResEntries[i] = Strings.GetString(LanguageStringID.ANDROID_VIDEO_NATIVE_RES);
ResEntrySubtitles[i] = AndroidDevice.nativeWidth+"x"+AndroidDevice.nativeHeight;
}
}
final TwoLinesListPreference listPreference = (TwoLinesListPreference) findPreference("video_screenResolution");
listPreference.setEntries(ResEntries);
listPreference.setEntryValues(ResEntryValues);
listPreference.setEntriesSubtitles(ResEntrySubtitles);
}
} }

View File

@ -0,0 +1,37 @@
/****************************************************************************
* *
* Project 64 - A Nintendo 64 emulator. *
* http://www.pj64-emu.com/ *
* Copyright (C) 2012 Project64. All rights reserved. *
* *
* License: *
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
* *
****************************************************************************/
#ifdef ANDROID
#include <jni.h>
#include "ScreenResolution.h"
#define EXPORT extern "C" __attribute__((visibility("default")))
#define CALL
EXPORT jint CALL Java_emu_project64_jni_NativeVideo_getResolutionCount(JNIEnv* env, jclass cls)
{
return GetScreenResolutionCount();
}
EXPORT jstring CALL Java_emu_project64_jni_NativeVideo_getResolutionName(JNIEnv* env, jclass cls, int index)
{
return env->NewStringUTF(GetScreenResolutionName(index));
}
EXPORT jint CALL Java_emu_project64_jni_NativeVideo_GetScreenResWidth(JNIEnv* env, jclass cls, int index)
{
return GetScreenResWidth(index);
}
EXPORT jint CALL Java_emu_project64_jni_NativeVideo_GetScreenResHeight(JNIEnv* env, jclass cls, int index)
{
return GetScreenResHeight(index);
}
#endif

View File

@ -96,6 +96,7 @@
<ClInclude Include="Version.h" /> <ClInclude Include="Version.h" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="Android.cpp" />
<ClCompile Include="CRC.cpp" /> <ClCompile Include="CRC.cpp" />
<ClCompile Include="ScreenResolution.cpp" /> <ClCompile Include="ScreenResolution.cpp" />
<ClCompile Include="Settings.cpp" /> <ClCompile Include="Settings.cpp" />

View File

@ -155,6 +155,7 @@
<ClCompile Include="trace.cpp" /> <ClCompile Include="trace.cpp" />
<ClCompile Include="Settings.cpp" /> <ClCompile Include="Settings.cpp" />
<ClCompile Include="ScreenResolution.cpp" /> <ClCompile Include="ScreenResolution.cpp" />
<ClCompile Include="Android.cpp" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Text Include="gpl.txt"> <Text Include="gpl.txt">

View File

@ -67,6 +67,10 @@
#include <stdarg.h> #include <stdarg.h>
#ifdef ANDROID
uint32_t g_NativeWidth, g_NativeHeight;
#endif
GFX_INFO gfx; GFX_INFO gfx;
int to_fullscreen = FALSE; int to_fullscreen = FALSE;
@ -79,6 +83,8 @@ int evoodoo = 0;
int ev_fullscreen = 0; int ev_fullscreen = 0;
extern int viewport_offset; extern int viewport_offset;
extern int g_width, g_height;
#ifdef _WIN32 #ifdef _WIN32
HINSTANCE hinstDLL = NULL; HINSTANCE hinstDLL = NULL;
@ -410,7 +416,6 @@ void SetWindowDisplaySize(HWND hWnd)
else else
{ {
RECT clientRect = { 0 }, toolbarRect = { 0 }, statusbarRect = { 0 }, windowedRect = { 0 }; RECT clientRect = { 0 }, toolbarRect = { 0 }, statusbarRect = { 0 }, windowedRect = { 0 };
ZeroMemory(&g_windowedRect, sizeof(RECT));
HWND hToolBar = FindWindowEx(hWnd, NULL, REBARCLASSNAME, NULL); HWND hToolBar = FindWindowEx(hWnd, NULL, REBARCLASSNAME, NULL);
HWND hStatusBar = FindWindowEx(hWnd, NULL, STATUSCLASSNAME, NULL); HWND hStatusBar = FindWindowEx(hWnd, NULL, STATUSCLASSNAME, NULL);
if (hStatusBar == NULL) if (hStatusBar == NULL)
@ -503,18 +508,18 @@ int InitGfx()
voodoo.has_2mb_tex_boundary = (SST_type < GR_SSTTYPE_Banshee) && !evoodoo; voodoo.has_2mb_tex_boundary = (SST_type < GR_SSTTYPE_Banshee) && !evoodoo;
// use UMA if available // use UMA if available
voodoo.tex_UMA = FALSE; voodoo.tex_UMA = FALSE;
//* if (strstr(extensions, " TEXUMA "))
if (strstr(extensions, " TEXUMA ")) { {
// we get better texture cache hits with UMA on // we get better texture cache hits with UMA on
grEnable(GR_TEXTURE_UMA_EXT); grEnable(GR_TEXTURE_UMA_EXT);
voodoo.tex_UMA = TRUE; voodoo.tex_UMA = TRUE;
WriteTrace(TraceGlide64, TraceDebug, "Using TEXUMA extension"); WriteTrace(TraceGlide64, TraceDebug, "Using TEXUMA extension");
} }
//*/
#ifndef ANDROID
g_settings->UpdateScreenSize(ev_fullscreen); g_settings->UpdateScreenSize(ev_fullscreen);
#ifndef ANDROID
SetWindowDisplaySize(gfx.hWnd); SetWindowDisplaySize(gfx.hWnd);
#endif
gfx_context = grSstWinOpen(GR_COLORFORMAT_RGBA, GR_ORIGIN_UPPER_LEFT, 2, 1); gfx_context = grSstWinOpen(GR_COLORFORMAT_RGBA, GR_ORIGIN_UPPER_LEFT, 2, 1);
if (!gfx_context) if (!gfx_context)
{ {
@ -526,11 +531,6 @@ int InitGfx()
grGlideShutdown(); grGlideShutdown();
return FALSE; return FALSE;
} }
#else
gfx_context = grSstWinOpen(GR_COLORFORMAT_RGBA, GR_ORIGIN_UPPER_LEFT, 2, 1);
g_settings->scr_res_x = g_settings->res_x = g_width;
g_settings->scr_res_y = g_settings->res_y = g_height;
#endif
GfxInitDone = TRUE; GfxInitDone = TRUE;
to_fullscreen = FALSE; to_fullscreen = FALSE;
@ -1614,16 +1614,12 @@ Purpose: this function is called when the surface is has changed.
input: none input: none
output: none output: none
*******************************************************************/ *******************************************************************/
void init_combiner();
void CALL SurfaceChanged(int width, int height) void CALL SurfaceChanged(int width, int height)
{ {
g_width = width; g_NativeWidth = width;
g_height = height; g_NativeHeight = height;
} }
#endif
#ifdef ANDROID
void Android_JNI_SwapWindow() void Android_JNI_SwapWindow()
{ {
gfx.SwapBuffers(); gfx.SwapBuffers();

View File

@ -12,6 +12,10 @@
#include "settings.h" #include "settings.h"
#include "trace.h" #include "trace.h"
#ifdef ANDROID
extern uint32_t g_NativeWidth, g_NativeHeight;
#endif
struct ResolutionInfo struct ResolutionInfo
{ {
ResolutionInfo(const char * name = NULL, uint32_t width = 0, uint32_t height = 0, uint32_t frequency = 0, bool default_res = false) : ResolutionInfo(const char * name = NULL, uint32_t width = 0, uint32_t height = 0, uint32_t frequency = 0, bool default_res = false) :
@ -114,6 +118,12 @@ uint32_t GetScreenResWidth(uint32_t index)
{ {
if (index < GetScreenResolutionCount()) if (index < GetScreenResolutionCount())
{ {
#ifdef ANDROID
if (g_resolutions[index].width() == 0)
{
return g_NativeWidth;
}
#endif
return g_resolutions[index].width(); return g_resolutions[index].width();
} }
return 0; return 0;
@ -123,6 +133,12 @@ uint32_t GetScreenResHeight(uint32_t index)
{ {
if (index < GetScreenResolutionCount()) if (index < GetScreenResolutionCount())
{ {
#ifdef ANDROID
if (g_resolutions[index].height() == 0)
{
return g_NativeHeight;
}
#endif
return g_resolutions[index].height(); return g_resolutions[index].height();
} }
return 0; return 0;

View File

@ -7,16 +7,20 @@
int GetCurrentResIndex(void); int GetCurrentResIndex(void);
#endif #endif
#ifdef ANDROID
extern uint32_t g_NativeWidth, g_NativeHeight;
#endif
short Set_basic_mode = 0, Set_texture_dir = 0, Set_log_dir = 0, Set_log_flush = 0; short Set_basic_mode = 0, Set_texture_dir = 0, Set_log_dir = 0, Set_log_flush = 0;
extern int g_width, g_height; extern int g_width, g_height;
CSettings::CSettings() : CSettings::CSettings() :
m_dirty(false), m_dirty(false),
m_res_x(640), m_res_x(GetScreenResWidth(GetDefaultScreenRes())),
m_scr_res_x(640), m_scr_res_x(GetScreenResWidth(GetDefaultScreenRes())),
m_res_y(480), m_res_y(GetScreenResHeight(GetDefaultScreenRes())),
m_scr_res_y(480), m_scr_res_y(GetScreenResHeight(GetDefaultScreenRes())),
m_ScreenRes(7), m_ScreenRes(GetDefaultScreenRes()),
advanced_options(0), advanced_options(0),
texenh_options(0), texenh_options(0),
vsync(0), vsync(0),
@ -29,6 +33,7 @@ buff_clear(0),
m_lodmode(LOD_Off), m_lodmode(LOD_Off),
m_aspectmode(Aspect_4x3), m_aspectmode(Aspect_4x3),
m_frame_buffer(0), m_frame_buffer(0),
m_fb_crc_mode(fbcrcFast),
//Texture filtering options //Texture filtering options
texture_dir(""), texture_dir(""),
m_ghq_fltr(TextureFilter_None), m_ghq_fltr(TextureFilter_None),
@ -99,6 +104,10 @@ m_FlushLogs(false)
ReadSettings(); ReadSettings();
} }
CSettings::~CSettings()
{
}
void CSettings::RegisterSettings(void) void CSettings::RegisterSettings(void)
{ {
SetModuleName("default"); SetModuleName("default");
@ -108,7 +117,7 @@ void CSettings::RegisterSettings(void)
Set_log_dir = FindSystemSettingId("Dir:Log"); Set_log_dir = FindSystemSettingId("Dir:Log");
SetModuleName("Glide64"); SetModuleName("Glide64");
general_setting(Set_Resolution, "resolution", 7); general_setting(Set_Resolution, "resolution", GetDefaultScreenRes());
#ifdef _WIN32 #ifdef _WIN32
general_setting(Set_FullScreenRes, "FullScreenRes", GetCurrentResIndex()); general_setting(Set_FullScreenRes, "FullScreenRes", GetCurrentResIndex());
#endif #endif
@ -203,6 +212,9 @@ void CSettings::RegisterSettings(void)
game_setting_default(Set_detect_cpu_write, "detect_cpu_write", Set_detect_cpu_write_default); game_setting_default(Set_detect_cpu_write, "detect_cpu_write", Set_detect_cpu_write_default);
game_setting_default(Set_fb_get_info, "fb_get_info", Set_fb_get_info_default); game_setting_default(Set_fb_get_info, "fb_get_info", Set_fb_get_info_default);
game_setting_default(Set_fb_render, "fb_render", Set_fb_render_default); game_setting_default(Set_fb_render, "fb_render", Set_fb_render_default);
SettingsRegisterChange(false, Set_Resolution, this, stSettingsChanged);
} }
void CSettings::SetScreenRes(uint32_t value) void CSettings::SetScreenRes(uint32_t value)
@ -234,6 +246,11 @@ void CSettings::UpdateScreenSize(bool fullscreen)
} }
m_scr_res_x = m_res_x = g_width; m_scr_res_x = m_res_x = g_width;
m_scr_res_y = m_res_y = g_height; m_scr_res_y = m_res_y = g_height;
#else
g_width = GetScreenResWidth(m_ScreenRes);
g_height = GetScreenResHeight(m_ScreenRes);
m_scr_res_x = m_res_x = g_width;
m_scr_res_y = m_res_y = g_height;
#endif #endif
UpdateAspectRatio(); UpdateAspectRatio();
} }
@ -363,11 +380,8 @@ void CSettings::UpdateAspectRatio(void)
void CSettings::ReadSettings() void CSettings::ReadSettings()
{ {
#ifdef ANDROID
this->scr_res_x = this->res_x = g_width;
this->scr_res_y = this->res_y = g_height;
#else
SetScreenRes(GetSetting(Set_Resolution)); SetScreenRes(GetSetting(Set_Resolution));
#ifndef ANDROID
this->wrpResolution = GetSetting(Set_FullScreenRes); this->wrpResolution = GetSetting(Set_FullScreenRes);
#endif #endif
this->vsync = GetSetting(Set_vsync); this->vsync = GetSetting(Set_vsync);
@ -582,10 +596,8 @@ void CSettings::ReadGameSettings(const char * name)
g_settings->fog = GetSetting(g_romopen ? Set_fog : Set_fog_default); g_settings->fog = GetSetting(g_romopen ? Set_fog : Set_fog_default);
g_settings->buff_clear = GetSetting(g_romopen ? Set_buff_clear : Set_buff_clear_default); g_settings->buff_clear = GetSetting(g_romopen ? Set_buff_clear : Set_buff_clear_default);
#ifdef _WIN32 m_ScreenRes = GetSetting(Set_Resolution);
g_settings->m_ScreenRes = GetSetting(Set_Resolution); if (m_ScreenRes >= GetScreenResolutionCount()) { m_ScreenRes = GetDefaultScreenRes(); }
if (g_settings->m_ScreenRes < 0 || g_settings->m_ScreenRes >= 0x18) g_settings->m_ScreenRes = 12;
#endif
//frame buffer //frame buffer
short fb_Settings[] = short fb_Settings[] =
@ -649,8 +661,8 @@ void CSettings::ReadGameSettings(const char * name)
void CSettings::WriteSettings(void) void CSettings::WriteSettings(void)
{ {
#ifdef _WIN32
SetSetting(Set_Resolution, g_settings->m_ScreenRes); SetSetting(Set_Resolution, g_settings->m_ScreenRes);
#ifdef _WIN32
SetSetting(Set_FullScreenRes, g_settings->wrpResolution); SetSetting(Set_FullScreenRes, g_settings->wrpResolution);
#endif #endif
SetSetting(Set_vsync, g_settings->vsync); SetSetting(Set_vsync, g_settings->vsync);
@ -717,3 +729,8 @@ void CSettings::WriteSettings(void)
FlushSettings(); FlushSettings();
} }
void CSettings::SettingsChanged(void)
{
m_ScreenRes = GetSetting(Set_Resolution);
}

View File

@ -5,6 +5,7 @@ class CSettings
{ {
public: public:
CSettings(); CSettings();
~CSettings();
//Frame buffer emulation options //Frame buffer emulation options
enum fb_bits_t enum fb_bits_t
@ -272,10 +273,15 @@ public:
void UpdateAspectRatio(void); void UpdateAspectRatio(void);
void UpdateScreenSize(bool fullscreen); void UpdateScreenSize(bool fullscreen);
private: private:
void ReadSettings(); void ReadSettings();
void RegisterSettings(void); void RegisterSettings(void);
void SettingsChanged(void);
static void stSettingsChanged(void * _this)
{
((CSettings *)_this)->SettingsChanged();
}
bool m_dirty; bool m_dirty;
bool m_FlushLogs; bool m_FlushLogs;

View File

@ -589,6 +589,9 @@ enum LanguageStringID
ANDROID_MENU_DEBUGGINGOPTIONS = 3111, ANDROID_MENU_DEBUGGINGOPTIONS = 3111,
ANDROID_MENU_RESETFUNCTIONTIMES = 3112, ANDROID_MENU_RESETFUNCTIONTIMES = 3112,
ANDROID_MENU_DUMPFUNCTIONTIMES = 3113, ANDROID_MENU_DUMPFUNCTIONTIMES = 3113,
//Video plugin
ANDROID_VIDEO_NATIVE_RES = 3200,
}; };
#include "Multilanguage/LanguageClass.h" #include "Multilanguage/LanguageClass.h"

View File

@ -557,6 +557,9 @@ void CLanguage::LoadDefaultStrings(void)
DEF_STR(ANDROID_MENU_DEBUGGINGOPTIONS, "Debugging Options"); DEF_STR(ANDROID_MENU_DEBUGGINGOPTIONS, "Debugging Options");
DEF_STR(ANDROID_MENU_RESETFUNCTIONTIMES, "Reset Function Times"); DEF_STR(ANDROID_MENU_RESETFUNCTIONTIMES, "Reset Function Times");
DEF_STR(ANDROID_MENU_DUMPFUNCTIONTIMES, "Dump Function Times"); DEF_STR(ANDROID_MENU_DUMPFUNCTIONTIMES, "Dump Function Times");
//Video plugin
DEF_STR(ANDROID_VIDEO_NATIVE_RES, "Native");
} }
CLanguage::CLanguage() : CLanguage::CLanguage() :

2
changes.txt Normal file
View File

@ -0,0 +1,2 @@
Android Release 9:
- Add ability to change screen res