Merge branch 'glide64-cleanup'

This commit is contained in:
zilmar 2017-02-09 06:46:10 +11:00
commit 50116c654d
58 changed files with 2320 additions and 3761 deletions

View File

@ -22,15 +22,16 @@ LOCAL_SRC_FILES := \
$(SRCDIR)/Glitch64/OGLEStextures.cpp \
$(SRCDIR)/Glitch64/OGLESwrappers.cpp \
$(SRCDIR)/Glide64/3dmath.cpp \
$(SRCDIR)/Glide64/Android.cpp \
$(SRCDIR)/Glide64/Combine.cpp \
$(SRCDIR)/Glide64/Config.cpp \
$(SRCDIR)/Glide64/CRC.cpp \
$(SRCDIR)/Glide64/Debugger.cpp \
$(SRCDIR)/Glide64/DepthBufferRender.cpp \
$(SRCDIR)/Glide64/FBtoScreen.cpp \
$(SRCDIR)/Glide64/Keys.cpp \
$(SRCDIR)/Glide64/Main.cpp \
$(SRCDIR)/Glide64/rdp.cpp \
$(SRCDIR)/Glide64/ScreenResolution.cpp \
$(SRCDIR)/Glide64/Settings.cpp \
$(SRCDIR)/Glide64/TexBuffer.cpp \
$(SRCDIR)/Glide64/TexCache.cpp \

View File

@ -100,9 +100,11 @@
<string name="Advanced">Advanced</string>
<string name="CpuUsage_title">CPU Usage</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_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="DisplaySpeedDisplay">Display Speed Display</string>
<string name="DListPerSecond">Display lists per second</string>

View File

@ -1,6 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<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
android:key="Debugger_DisplaySpeed"
android:summary="@string/DisplaySpeed_summary"

View File

@ -23,55 +23,86 @@ import emu.project64.util.Strings;
import emu.project64.util.FileUtil;
import emu.project64.util.Utility;
import tv.ouya.console.api.OuyaFacade;
import android.annotation.SuppressLint;
import android.graphics.Point;
import android.os.Build;
import android.os.Environment;
import android.util.DisplayMetrics;
import android.view.KeyEvent;
import android.view.WindowManager;
@SuppressLint("NewApi")
public class AndroidDevice
{
/** True if device is running Gingerbread or later (9 - Android 2.3.x) */
public static final boolean IS_GINGERBREAD = Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD;
/** True if device is running Honeycomb or later (11 - Android 3.0.x) */
public static final boolean IS_HONEYCOMB = Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB;
/** True if device is running Honeycomb MR1 or later (12 - Android 3.1.x) */
public static final boolean IS_HONEYCOMB_MR1 = Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR1;
/** True if device is running Ice Cream Sandwich or later (14 - Android 4.0.x) */
public static final boolean IS_ICE_CREAM_SANDWICH = Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH;
/** True if device is running Jellybean or later (16 - Android 4.1.x) */
public static final boolean IS_JELLY_BEAN = Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN;
/** True if device is running KitKat or later (19 - Android 4.4.x) */
public static final boolean IS_KITKAT = Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT;
/** True if device is running Lollipop or later (21 - Android 5.0.x) */
public static final boolean IS_LOLLIPOP = Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP;
/** True if device is an OUYA. */
public static final boolean IS_OUYA_HARDWARE = OuyaFacade.getInstance().isRunningOnOUYAHardware();
public final static String EXTERNAL_PUBLIC_DIRECTORY = Environment.getExternalStorageDirectory().getPath();
public final static String PACKAGE_DIRECTORY = EXTERNAL_PUBLIC_DIRECTORY + "/Android/data/" + AndroidDevice.class.getPackage().getName();
public static final boolean IS_ACTION_BAR_AVAILABLE = AndroidDevice.IS_HONEYCOMB && !AndroidDevice.IS_OUYA_HARDWARE;
final static boolean isTv;
public final static int nativeWidth, nativeWidthOriginal;
public final static int nativeHeight, nativeHeightOriginal;
public static boolean MapVolumeKeys = false;
static
static
{
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()
{
return isTv;
}
public static List<Integer> getUnmappableKeyCodes ()
{
List<Integer> unmappables = new ArrayList<Integer>();
@ -89,8 +120,8 @@ public class AndroidDevice
}
return unmappables;
}
public static ArrayList<String> getStorageDirectories()
public static ArrayList<String> getStorageDirectories()
{
BufferedReader bufReader = null;
ArrayList<String> list = new ArrayList<String>();
@ -99,7 +130,7 @@ public class AndroidDevice
List<String> typeWL = Arrays.asList("vfat", "exfat", "sdcardfs", "fuse", "ntfs", "fat32", "ext3", "ext4", "esdfs");
List<String> typeBL = Arrays.asList("tmpfs");
String[] mountWL = {"/mnt", "/Removable", "/storage"};
String[] mountBL =
String[] mountBL =
{
"/mnt/secure",
"/mnt/shell",
@ -109,18 +140,18 @@ public class AndroidDevice
"/mnt/media_rw/sdcard",
"/storage/emulated"
};
String[] deviceWL =
String[] deviceWL =
{
"/dev/block/vold",
"/dev/fuse",
"/mnt/media_rw"
};
try
try
{
bufReader = new BufferedReader(new FileReader("/proc/mounts"));
String line;
while ((line = bufReader.readLine()) != null)
while ((line = bufReader.readLine()) != null)
{
StringTokenizer tokens = new StringTokenizer(line, " ");
String device = tokens.nextToken();
@ -134,7 +165,7 @@ public class AndroidDevice
}
// check that device is in whitelist, and either type or mountpoint is in a whitelist
if (Strings.startsWith(deviceWL, device) && (typeWL.contains(type) || Strings.startsWith(mountWL, mountpoint)))
if (Strings.startsWith(deviceWL, device) && (typeWL.contains(type) || Strings.startsWith(mountWL, mountpoint)))
{
int position = Strings.containsName(list, FileUtil.getFileNameFromPath(mountpoint));
if (position > -1)
@ -145,13 +176,13 @@ public class AndroidDevice
}
}
}
catch (FileNotFoundException e)
catch (FileNotFoundException e)
{
}
catch (IOException e)
catch (IOException e)
{
}
finally
finally
{
Utility.close(bufReader);
}

View File

@ -843,7 +843,7 @@ public class GalleryActivity extends AppCompatActivity implements IabBroadcastLi
{
return false;
}
int RunCount = NativeExports.UISettingsLoadDword(UISettingID.SupportWindow_RunCount.getValue());
Log.d("GalleryActivity", "ShowSupportWindow RunCount = " + RunCount);
if (RunCount == -1)

View File

@ -21,6 +21,7 @@ import java.util.ArrayList;
import java.util.Set;
import emu.project64.AndroidDevice;
import emu.project64.Project64Application;
import emu.project64.R;
import emu.project64.hack.MogaHack;
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.MogaProvider;
import emu.project64.jni.NativeExports;
import emu.project64.jni.NativeVideo;
import emu.project64.jni.NativeXperiaTouchpad;
import emu.project64.jni.SettingsID;
import emu.project64.jni.SystemEvent;
import emu.project64.jni.UISettingID;
import emu.project64.jni.VideoSettingID;
import emu.project64.persistent.ConfigFile;
import emu.project64.persistent.ConfigFile.ConfigSection;
import emu.project64.profile.Profile;
@ -52,11 +55,15 @@ import android.graphics.drawable.ColorDrawable;
import android.os.Bundle;
import android.os.Vibrator;
import android.util.Log;
import android.view.Display;
import android.view.Gravity;
import android.view.KeyEvent;
import android.view.SurfaceHolder;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.view.WindowManager.LayoutParams;
import android.widget.FrameLayout;
public class GameLifecycleHandler implements View.OnKeyListener, SurfaceHolder.Callback, GameSurface.SurfaceInfo
{
@ -92,7 +99,7 @@ public class GameLifecycleHandler implements View.OnKeyListener, SurfaceHolder.C
mActivity = activity;
mControllers = new ArrayList<AbstractController>();
mIsXperiaPlay = !(activity instanceof GameActivity);
mMogaController = Controller.getInstance( mActivity );
mMogaController = Controller.getInstance(mActivity);
}
@TargetApi(11)
@ -105,8 +112,7 @@ public class GameLifecycleHandler implements View.OnKeyListener, SurfaceHolder.C
// Initialize MOGA controller API
// TODO: Remove hack after MOGA SDK is fixed
// mMogaController.init();
MogaHack.init( mMogaController, mActivity );
MogaHack.init(mMogaController, mActivity);
// For Honeycomb, let the action bar overlay the rendered view (rather
// than squeezing it)
@ -140,19 +146,34 @@ public class GameLifecycleHandler implements View.OnKeyListener, SurfaceHolder.C
// Lay out content and get the views
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);
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)
mSurface.getHolder().addCallback( this );
mSurface.createGLContext((ActivityManager)mActivity.getSystemService(Context.ACTIVITY_SERVICE));
mSurface.getHolder().addCallback(this);
mSurface.createGLContext((ActivityManager) mActivity.getSystemService(Context.ACTIVITY_SERVICE));
// Configure the action bar introduced in higher Android versions
if (AndroidDevice.IS_ACTION_BAR_AVAILABLE)
{
mActivity.getActionBar().hide();
ColorDrawable color = new ColorDrawable(Color.parseColor("#303030"));
color.setAlpha(50 /*mGlobalPrefs.displayActionBarTransparency*/);
color.setAlpha(50 /* mGlobalPrefs.displayActionBarTransparency */);
mActivity.getActionBar().setBackgroundDrawable(color);
}
@ -162,8 +183,9 @@ public class GameLifecycleHandler implements View.OnKeyListener, SurfaceHolder.C
View inputSource = mIsXperiaPlay ? new NativeXperiaTouchpad(mActivity) : mOverlay;
initControllers(inputSource);
// Override the peripheral controllers' key provider, to add some extra functionality
inputSource.setOnKeyListener( this );
// Override the peripheral controllers' key provider, to add some extra
// functionality
inputSource.setOnKeyListener(this);
}
public void onStart()
@ -235,7 +257,7 @@ public class GameLifecycleHandler implements View.OnKeyListener, SurfaceHolder.C
{
pause = true;
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 OriginalSaveTime = NativeExports.SettingsLoadDword(SettingsID.Game_LastSaveTime.getValue());
@ -256,7 +278,7 @@ public class GameLifecycleHandler implements View.OnKeyListener, SurfaceHolder.C
{
Thread.sleep(100);
}
catch(InterruptedException ex)
catch (InterruptedException ex)
{
Thread.currentThread().interrupt();
}
@ -264,7 +286,7 @@ public class GameLifecycleHandler implements View.OnKeyListener, SurfaceHolder.C
NativeExports.SettingsSaveDword(SettingsID.Game_CurrentSaveState.getValue(), CurrentSaveState);
if (pause)
{
NativeExports.ExternalEvent( SystemEvent.SysEvent_PauseCPU_FromMenu.getValue());
NativeExports.ExternalEvent(SystemEvent.SysEvent_PauseCPU_FromMenu.getValue());
NativeExports.SettingsSaveDword(SettingsID.GameRunning_CPU_PausedType.getValue(), PauseType);
}
}
@ -324,9 +346,9 @@ public class GameLifecycleHandler implements View.OnKeyListener, SurfaceHolder.C
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());
mControllers = new ArrayList<AbstractController>();
CreateTouchScreenControls();
@ -339,37 +361,40 @@ public class GameLifecycleHandler implements View.OnKeyListener, SurfaceHolder.C
private void CreateTouchScreenControls()
{
boolean isTouchscreenAnimated = false; //mGlobalPrefs.isTouchscreenAnimated
boolean isTouchscreenHidden = false; //!isTouchscreenEnabled || globalPrefs.touchscreenTransparency == 0;
boolean isTouchscreenAnimated = false; // mGlobalPrefs.isTouchscreenAnimated
boolean isTouchscreenHidden = false; // !isTouchscreenEnabled ||
// globalPrefs.touchscreenTransparency
// == 0;
String profilesDir = AndroidDevice.PACKAGE_DIRECTORY + "/profiles";
String touchscreenProfiles_cfg = profilesDir + "/touchscreen.cfg";
ConfigFile touchscreenConfigFile = new ConfigFile( touchscreenProfiles_cfg );
ConfigFile touchscreenConfigFile = new ConfigFile(touchscreenProfiles_cfg);
ConfigSection section = touchscreenConfigFile.get(mlayout);
if (section == null)
{
mlayout = "Analog";
section = touchscreenConfigFile.get(mlayout);
}
Profile touchscreenProfile = new Profile( true, section);
Profile touchscreenProfile = new Profile(true, section);
int touchscreenTransparency = 100;
String touchscreenSkinsDir = AndroidDevice.PACKAGE_DIRECTORY + "/skins/touchscreen";
String touchscreenSkin = touchscreenSkinsDir + "/Outline";
// The touch map and overlay are needed to display frame rate and/or controls
mTouchscreenMap = new VisibleTouchMap( mActivity.getResources() );
mTouchscreenMap.load(touchscreenSkin, touchscreenProfile, isTouchscreenAnimated, mtouchscreenScale, touchscreenTransparency );
mOverlay.initialize( mTouchscreenMap, !isTouchscreenHidden, isTouchscreenAnimated );
}
// The touch map and overlay are needed to display frame rate and/or
// controls
mTouchscreenMap = new VisibleTouchMap(mActivity.getResources());
mTouchscreenMap.load(touchscreenSkin, touchscreenProfile, isTouchscreenAnimated, mtouchscreenScale, touchscreenTransparency);
mOverlay.initialize(mTouchscreenMap, !isTouchscreenHidden, isTouchscreenAnimated);
}
@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,
// they return true. Else they return false, signaling
// 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;
}
@ -378,32 +403,32 @@ public class GameLifecycleHandler implements View.OnKeyListener, SurfaceHolder.C
private void initControllers(View inputSource)
{
// 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;
boolean isTouchscreenFeedbackEnabled = false;
Set<Integer> autoHoldableButtons = null;
// Create the touchscreen controller
TouchController touchscreenController = new TouchController( mTouchscreenMap,
inputSource, mOverlay, vibrator, touchscreenAutoHold,
isTouchscreenFeedbackEnabled, autoHoldableButtons );
mControllers.add( touchscreenController );
TouchController touchscreenController = new TouchController(mTouchscreenMap, inputSource, mOverlay, vibrator,
touchscreenAutoHold, isTouchscreenFeedbackEnabled, autoHoldableButtons);
mControllers.add(touchscreenController);
// Create the input providers shared among all peripheral controllers
String profile_name = NativeExports.UISettingsLoadString(UISettingID.Controller_CurrentProfile.getValue());
ConfigFile ControllerConfigFile = new ConfigFile(NativeExports.UISettingsLoadString(UISettingID.Controller_ConfigFile.getValue()));
ConfigSection section = ControllerConfigFile.get( profile_name );
ConfigFile ControllerConfigFile = new ConfigFile(
NativeExports.UISettingsLoadString(UISettingID.Controller_ConfigFile.getValue()));
ConfigSection section = ControllerConfigFile.get(profile_name);
if (section != null)
{
Profile ControllerProfile = new Profile( false, section );
InputMap map = new InputMap( ControllerProfile.get( "map" ) );
Profile ControllerProfile = new Profile(false, section);
InputMap map = new InputMap(ControllerProfile.get("map"));
mKeyProvider = new KeyProvider( inputSource, ImeFormula.DEFAULT, AndroidDevice.getUnmappableKeyCodes() );
MogaProvider mogaProvider = new MogaProvider( mMogaController );
AbstractProvider axisProvider = AndroidDevice.IS_HONEYCOMB_MR1 ? new AxisProvider( inputSource ) : null;
mKeyProvider = new KeyProvider(inputSource, ImeFormula.DEFAULT, AndroidDevice.getUnmappableKeyCodes());
MogaProvider mogaProvider = new MogaProvider(mMogaController);
AbstractProvider axisProvider = AndroidDevice.IS_HONEYCOMB_MR1 ? new AxisProvider(inputSource) : null;
int Deadzone = NativeExports.UISettingsLoadDword(UISettingID.Controller_Deadzone.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));
}
}
@ -442,4 +467,4 @@ public class GameLifecycleHandler implements View.OnKeyListener, SurfaceHolder.C
}
NativeExports.onSurfaceChanged(width, height);
}
}
}

View File

@ -589,6 +589,9 @@ public enum LanguageStringID
ANDROID_MENU_DEBUGGINGOPTIONS(3111),
ANDROID_MENU_RESETFUNCTIONTIMES(3112),
ANDROID_MENU_DUMPFUNCTIONTIMES(3113),
//Video plugin
ANDROID_VIDEO_NATIVE_RES(3200),
;
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)
{
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.SystemEvent;
import emu.project64.jni.UISettingID;
import emu.project64.jni.VideoSettingID;
import android.content.SharedPreferences;
import android.os.Bundle;
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_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("video_screenResolution",String.valueOf(NativeExports.SettingsLoadDword(SettingsID.FirstGfxSettings.getValue() + VideoSettingID.Set_Resolution.getValue())))
.putInt("MaxRomsRemembered",NativeExports.UISettingsLoadDword(UISettingID.File_RecentGameFileCount.getValue()))
.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_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("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)); }
}
}

View File

@ -32,18 +32,15 @@ public class TwoLinesListPreferenceDialogFragmentCompat extends PreferenceDialog
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);
}
class ViewHolder
{
TextView title;
TextView subTitle;
RadioButton radioBtn;
}
ViewHolder holder;
@ -52,33 +49,32 @@ public class TwoLinesListPreferenceDialogFragmentCompat extends PreferenceDialog
@Override
public View getView(int position, View convertView, ViewGroup parent)
{
final LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
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);
final TwoLinesListPreference preference = getTwoLinesListPreference();
holder.title.setOnClickListener(listener);
holder.subTitle.setOnClickListener(listener);
holder.radioBtn.setOnClickListener(listener);
final LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
convertView = inflater.inflate(R.layout.two_lines_list_preference_row, null);
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
{
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]);
holder.title.setTag(position);
holder.subTitle.setText(preference.getEntriesSubtitles()[position]);
holder.subTitle.setTag(position);
holder.radioBtn.setChecked(preference.getValueIndex() == position);
holder.radioBtn.setTag(position);
RadioButton radioBtn = (RadioButton) convertView.findViewById(R.id.two_lines_list_view_row_radiobtn);
radioBtn.setOnClickListener(listener);
radioBtn.setChecked(preference.getValueIndex() == position);
radioBtn.setTag(position);
return convertView;
}
@ -96,7 +92,7 @@ public class TwoLinesListPreferenceDialogFragmentCompat extends PreferenceDialog
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()
{
@Override
@ -126,7 +122,7 @@ public class TwoLinesListPreferenceDialogFragmentCompat extends PreferenceDialog
{
final TwoLinesListPreference preference = getTwoLinesListPreference();
int EntryIndex = (Integer) v.getTag();
preference.setValue(preference.getEntries()[EntryIndex].toString());
preference.setValue(preference.getEntryValues()[EntryIndex].toString());
TwoLinesListPreferenceDialogFragmentCompat.this.getDialog().dismiss();
}
}

View File

@ -10,19 +10,58 @@
****************************************************************************/
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.jni.LanguageStringID;
import emu.project64.jni.NativeVideo;
import emu.project64.util.Strings;
public class VideoFragment extends BaseSettingsFragment
{
@Override
protected int getXml()
protected int getXml()
{
return R.xml.setting_video;
}
@Override
protected int getTitleId()
protected int getTitleId()
{
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

@ -122,7 +122,7 @@ void calc_sphere(VERTEX *v)
WriteTrace(TraceRDP, TraceDebug, "calc_sphere");
DECLAREALIGN16VAR(vec[3]);
int s_scale, t_scale;
if (g_settings->hacks&hack_Chopper)
if (g_settings->hacks(CSettings::hack_Chopper))
{
s_scale = minval(rdp.tiles[rdp.cur_tile].org_s_scale >> 6, rdp.tiles[rdp.cur_tile].lr_s);
t_scale = minval(rdp.tiles[rdp.cur_tile].org_t_scale >> 6, rdp.tiles[rdp.cur_tile].lr_t);

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

@ -997,7 +997,7 @@ static void cc_shade()
static void cc_one_mul_shade()
{
if ((g_settings->hacks&hack_Knockout) && (rdp.aTBuffTex[0] || rdp.aTBuffTex[1] || rdp.cur_image)) //hack for boxer shadow
if (g_settings->hacks(CSettings::hack_Knockout) && (rdp.aTBuffTex[0] || rdp.aTBuffTex[1] || rdp.cur_image)) //hack for boxer shadow
{
CCMB(GR_COMBINE_FUNCTION_SCALE_OTHER,
GR_COMBINE_FACTOR_LOCAL,
@ -5976,7 +5976,7 @@ static void cc_prim_sub_env_mul_t1_add_env()
GR_COMBINE_OTHER_CONSTANT);
CC_PRIM();
SETSHADE_ENV();
if (rdp.cycle_mode == 0 || ((g_settings->hacks&hack_KI) && (rdp.cycle2 & 0x0FFFFFFF) == 0x01FF1FFF))
if (rdp.cycle_mode == 0 || (g_settings->hacks(CSettings::hack_KI) && (rdp.cycle2 & 0x0FFFFFFF) == 0x01FF1FFF))
{
USE_T0();
}
@ -8130,13 +8130,12 @@ static void cc__t1_inter_t0_using_prim__mul_shade()
static void cc__t0_inter_t1_using_primlod__mul_shade()
{
//*
if (rdp.LOD_en && (rdp.mipmap_level == 0) && !(g_settings->hacks&hack_Fifa98))
if (rdp.LOD_en && (rdp.mipmap_level == 0) && !g_settings->hacks(CSettings::hack_Fifa98))
{
cc_t0_mul_shade();
return;
}
//*/
if (g_settings->ucode == 7)
if (g_settings->ucode() == CSettings::ucode_PerfectDark)
lod_frac = rdp.prim_lodfrac;
CCMB(GR_COMBINE_FUNCTION_SCALE_OTHER,
GR_COMBINE_FACTOR_LOCAL,
@ -8412,7 +8411,7 @@ static void cc__one_inter_prim_using_t1__mul_shade()
{
if (cmb.combine_ext)
{
if ((g_settings->hacks&hack_BAR) && rdp.cur_tile == 1)
if (g_settings->hacks(CSettings::hack_BAR) && rdp.cur_tile == 1)
{
T0CCMBEXT(GR_CMBX_TMU_CCOLOR, GR_FUNC_MODE_X,
GR_CMBX_TMU_CALPHA, GR_FUNC_MODE_NEGATIVE_X,
@ -8444,7 +8443,7 @@ static void cc__one_inter_prim_using_t1__mul_shade()
GR_COMBINE_FACTOR_LOCAL,
GR_COMBINE_LOCAL_ITERATED,
GR_COMBINE_OTHER_TEXTURE);
if ((g_settings->hacks&hack_BAR) && rdp.cur_tile == 1)
if (g_settings->hacks(CSettings::hack_BAR) && rdp.cur_tile == 1)
{
MOD_0(TMOD_COL_INTER_COL1_USING_TEX);
MOD_0_COL(0xFFFFFF00);
@ -8813,7 +8812,7 @@ static void ac_t1()
GR_COMBINE_FACTOR_ONE,
GR_COMBINE_LOCAL_NONE,
GR_COMBINE_OTHER_TEXTURE);
if ((g_settings->hacks&hack_BAR) && rdp.tiles[rdp.cur_tile].format == 3)
if (g_settings->hacks(CSettings::hack_BAR) && rdp.tiles[rdp.cur_tile].format == 3)
A_USE_T0();
else
A_USE_T1();
@ -11202,7 +11201,7 @@ static void ac__t1_mul_primlod_add_t0__mul_env()
static void ac__t0_inter_t1_using_primlod__mul_shade()
{
if (g_settings->hacks & hack_Makers)
if (g_settings->hacks(CSettings::hack_Makers))
{
//rolling rock issue - it has zero shade alpha and thus rejected by alpha compare
ac_t0_inter_t1_using_primlod();
@ -15521,12 +15520,18 @@ void Combine()
Alpha0[(rdp.cycle1 >> 16) & 7], Alpha1[(rdp.cycle1 >> 19) & 7], Alpha2[(rdp.cycle1 >> 22) & 7], Alpha3[(rdp.cycle1 >> 25) & 7],
Alpha0[(rdp.cycle2 >> 16) & 7], Alpha1[(rdp.cycle2 >> 19) & 7], Alpha2[(rdp.cycle2 >> 22) & 7], Alpha3[(rdp.cycle2 >> 25) & 7]);
if (!rdp.LOD_en || rdp.cur_tile == rdp.mipmap_level)
{
lod_frac = rdp.prim_lodfrac;
else if (g_settings->lodmode == 0)
}
else if (g_settings->lodmode() == CSettings::LOD_Off)
{
lod_frac = 0;
}
else
{
lod_frac = 10;
}
rdp.noise = RDP::noise_none;
uint32_t found = TRUE;
@ -15602,12 +15607,9 @@ void Combine()
if (actual_combine != current_combine)
{
rdp.uncombined |= 1;
if (g_settings->log_unk)
{
WriteTrace(TraceUnknown, TraceDebug, "COLOR combine not found: %08x, #1: (%s-%s)*%s+%s, #2: (%s-%s)*%s+%s", actual_combine,
Mode0[rdp.cycle1 & 0xF], Mode1[(rdp.cycle1 >> 4) & 0xF], Mode2[(rdp.cycle1 >> 8) & 0x1F], Mode3[(rdp.cycle1 >> 13) & 7],
Mode0[rdp.cycle2 & 0xF], Mode1[(rdp.cycle2 >> 4) & 0xF], Mode2[(rdp.cycle2 >> 8) & 0x1F], Mode3[(rdp.cycle2 >> 13) & 7]);
}
WriteTrace(TraceUnknown, TraceDebug, "COLOR combine not found: %08x, #1: (%s-%s)*%s+%s, #2: (%s-%s)*%s+%s", actual_combine,
Mode0[rdp.cycle1 & 0xF], Mode1[(rdp.cycle1 >> 4) & 0xF], Mode2[(rdp.cycle1 >> 8) & 0x1F], Mode3[(rdp.cycle1 >> 13) & 7],
Mode0[rdp.cycle2 & 0xF], Mode1[(rdp.cycle2 >> 4) & 0xF], Mode2[(rdp.cycle2 >> 8) & 0x1F], Mode3[(rdp.cycle2 >> 13) & 7]);
found = FALSE;
//tex |= 3;
@ -15653,12 +15655,9 @@ void Combine()
if (actual_combine != current_combine)
{
rdp.uncombined |= 2;
if (g_settings->log_unk)
{
WriteTrace(TraceUnknown, TraceDebug, "ALPHA combine not found: %08x, #1: (%s-%s)*%s+%s, #2: (%s-%s)*%s+%s", actual_combine,
Alpha0[(rdp.cycle1 >> 16) & 7], Alpha1[(rdp.cycle1 >> 19) & 7], Alpha2[(rdp.cycle1 >> 22) & 7], Alpha3[(rdp.cycle1 >> 25) & 7],
Alpha0[(rdp.cycle2 >> 16) & 7], Alpha1[(rdp.cycle2 >> 19) & 7], Alpha2[(rdp.cycle2 >> 22) & 7], Alpha3[(rdp.cycle2 >> 25) & 7]);
}
WriteTrace(TraceUnknown, TraceDebug, "ALPHA combine not found: %08x, #1: (%s-%s)*%s+%s, #2: (%s-%s)*%s+%s", actual_combine,
Alpha0[(rdp.cycle1 >> 16) & 7], Alpha1[(rdp.cycle1 >> 19) & 7], Alpha2[(rdp.cycle1 >> 22) & 7], Alpha3[(rdp.cycle1 >> 25) & 7],
Alpha0[(rdp.cycle2 >> 16) & 7], Alpha1[(rdp.cycle2 >> 19) & 7], Alpha2[(rdp.cycle2 >> 22) & 7], Alpha3[(rdp.cycle2 >> 25) & 7]);
}
if (g_settings->unk_as_red)
{
@ -15685,7 +15684,7 @@ void Combine()
cc_t0();
ac_t1();
}
else if (color_combine == 0x613522f0 && (g_settings->hacks&hack_PMario)) //Paper Mario fortune teller spheres
else if (color_combine == 0x613522f0 && g_settings->hacks(CSettings::hack_PMario)) //Paper Mario fortune teller spheres
{
ac_t0();
}
@ -15713,9 +15712,9 @@ void Combine()
aTBuff[rdp.aTBuffTex[1]->tile] = rdp.aTBuffTex[1];
if (cmb.tex && (aTBuff[0] || aTBuff[1]))
{
if (aTBuff[0] && (g_settings->frame_buffer&fb_read_alpha))
if (aTBuff[0] && g_settings->fb_read_alpha_enabled())
{
if ((g_settings->hacks&hack_PMario) && aTBuff[0]->width == rdp.ci_width)
if (g_settings->hacks(CSettings::hack_PMario) && aTBuff[0]->width == rdp.ci_width)
;
else
{
@ -15909,7 +15908,7 @@ void CombineBlender()
*/
else if (blendmode == 0x0040) // Mia Soccer Lights
A_BLEND(GR_BLEND_SRC_ALPHA, GR_BLEND_ONE_MINUS_SRC_ALPHA);
else if ((g_settings->hacks&hack_Pilotwings) && (rdp.othermode_l & 0x80)) //CLR_ON_CVG without FORCE_BL
else if (g_settings->hacks(CSettings::hack_Pilotwings) && (rdp.othermode_l & 0x80)) //CLR_ON_CVG without FORCE_BL
A_BLEND(GR_BLEND_ZERO, GR_BLEND_ONE);
else
A_BLEND(GR_BLEND_ONE, GR_BLEND_ZERO);
@ -15919,7 +15918,7 @@ void CombineBlender()
// if (rdp.othermode_l & 0x2000)
if ((rdp.othermode_l & 0x2000) && ((rdp.othermode_l & 0x7000) != 0x7000))
{
if ((g_settings->hacks&hack_PMario) && (blendmode == 0x5055))
if (g_settings->hacks(CSettings::hack_PMario) && (blendmode == 0x5055))
{
A_BLEND(GR_BLEND_ZERO, GR_BLEND_ONE);
}
@ -15935,7 +15934,7 @@ void CombineBlender()
//hack
//*
if (g_settings->hacks&hack_ISS64)
if (g_settings->hacks(CSettings::hack_ISS64))
{
if (rdp.othermode_l == 0xff5a6379)
{
@ -15946,7 +15945,7 @@ void CombineBlender()
A_BLEND(GR_BLEND_ZERO, GR_BLEND_ONE);
}
}
else if (g_settings->hacks&hack_TGR)
else if (g_settings->hacks(CSettings::hack_TGR))
{
if (rdp.othermode_l == 0x0f0a0235)
{

View File

@ -48,10 +48,9 @@
#include "DepthBufferRender.h"
#include "Config.h"
#include "trace.h"
#include "ScreenResolution.h"
#include <Common/StdString.h>
short Set_basic_mode = 0, Set_texture_dir = 0, Set_log_dir = 0, Set_log_flush = 0;
#ifdef _WIN32
#include <Common/CriticalSection.h>
#include "resource.h"
@ -107,31 +106,6 @@ void ConfigCleanup(void)
void CloseConfig();
#ifdef TEXTURE_FILTER
uint32_t texfltr[] =
{
NO_FILTER, //"None"
SMOOTH_FILTER_1, //"Smooth filtering 1"
SMOOTH_FILTER_2, //"Smooth filtering 2"
SMOOTH_FILTER_3, //"Smooth filtering 3"
SMOOTH_FILTER_4, //"Smooth filtering 4"
SHARP_FILTER_1, //"Sharp filtering 1"
SHARP_FILTER_2, //"Sharp filtering 2"
};
uint32_t texenht[] =
{
NO_ENHANCEMENT, //"None"
NO_ENHANCEMENT, //"Store"
X2_ENHANCEMENT, //"X2"
X2SAI_ENHANCEMENT, //"X2SAI"
HQ2X_ENHANCEMENT, //"HQ2X"
HQ2XS_ENHANCEMENT, //"HQ2XS"
LQ2X_ENHANCEMENT, //"LQ2X"
LQ2XS_ENHANCEMENT, //"LQ2XS"
HQ4X_ENHANCEMENT, //"HQ4X"
};
uint32_t texcmpr[] =
{
//NO_COMPRESSION, //"None"
@ -147,7 +121,6 @@ uint32_t texhirs[] =
// GHQ_HIRESTEXTURES, //"GlideHQ format"
// JABO_HIRESTEXTURES, //"Jabo format"
};
#endif
#ifdef _WIN32
@ -312,8 +285,6 @@ public:
COMMAND_HANDLER_EX(IDC_CMB_WINDOW_RES, CBN_SELCHANGE, ItemChanged)
COMMAND_HANDLER_EX(IDC_CMB_FS_RESOLUTION, CBN_SELCHANGE, ItemChanged)
COMMAND_HANDLER_EX(IDC_CHK_VERTICAL_SYNC, BN_CLICKED, ItemChanged)
COMMAND_HANDLER_EX(IDC_CHK_CLOCK_ENABLED, BN_CLICKED, ItemChanged)
COMMAND_HANDLER_EX(IDC_CHK_CLOCK_24, BN_CLICKED, ItemChanged)
COMMAND_HANDLER_EX(IDC_CBXANISOTROPIC, BN_CLICKED, ItemChanged)
COMMAND_HANDLER_EX(IDC_CHK_SHOW_TEXTURE_ENHANCEMENT, BN_CLICKED, ItemChanged)
COMMAND_HANDLER_EX(IDC_CHK_AUTODETECT_VRAM, BN_CLICKED, ItemChanged)
@ -327,56 +298,20 @@ public:
TTInit();
TTSize(400);
m_WindowRes.Attach(GetDlgItem(IDC_CMB_WINDOW_RES));
m_WindowRes.SetItemData(m_WindowRes.AddString("320x200"), 0);
m_WindowRes.SetItemData(m_WindowRes.AddString("320x240"), 1);
m_WindowRes.SetItemData(m_WindowRes.AddString("400x256"), 2);
m_WindowRes.SetItemData(m_WindowRes.AddString("512x384"), 3);
m_WindowRes.SetItemData(m_WindowRes.AddString("640x200"), 4);
m_WindowRes.SetItemData(m_WindowRes.AddString("640x350"), 5);
m_WindowRes.SetItemData(m_WindowRes.AddString("640x400"), 6);
m_WindowRes.SetItemData(m_WindowRes.AddString("640x480"), 7);
m_WindowRes.SetItemData(m_WindowRes.AddString("800x600"), 8);
m_WindowRes.SetItemData(m_WindowRes.AddString("960x720"), 9);
m_WindowRes.SetItemData(m_WindowRes.AddString("856x480"), 10);
m_WindowRes.SetItemData(m_WindowRes.AddString("512x256"), 11);
m_WindowRes.SetItemData(m_WindowRes.AddString("1024x768"), 12);
m_WindowRes.SetItemData(m_WindowRes.AddString("1280x1024"), 13);
m_WindowRes.SetItemData(m_WindowRes.AddString("1600x1200"), 14);
m_WindowRes.SetItemData(m_WindowRes.AddString("400x300"), 15);
m_WindowRes.SetItemData(m_WindowRes.AddString("1152x864"), 16);
m_WindowRes.SetItemData(m_WindowRes.AddString("1280x960"), 17);
m_WindowRes.SetItemData(m_WindowRes.AddString("1600x1024"), 18);
m_WindowRes.SetItemData(m_WindowRes.AddString("1792x1344"), 19);
m_WindowRes.SetItemData(m_WindowRes.AddString("1856x1392"), 20);
m_WindowRes.SetItemData(m_WindowRes.AddString("1920x1440"), 21);
m_WindowRes.SetItemData(m_WindowRes.AddString("2048x1536"), 22);
m_WindowRes.SetItemData(m_WindowRes.AddString("2048x2048"), 23);
SetComboBoxIndex(m_WindowRes, g_settings->res_data);
for (uint32_t i = 0, n = GetScreenResolutionCount(); i < n; i++)
{
m_WindowRes.SetItemData(m_WindowRes.AddString(GetScreenResolutionName(i)), i);
}
SetComboBoxIndex(m_WindowRes, g_settings->ScreenRes());
TTSetTxt(IDC_CMB_WINDOW_RES, "Resolution:\n\nThis option selects the windowed resolution.\n\n[Recommended: 640x480, 800x600, 1024x768]");
m_cbxVSync.Attach(GetDlgItem(IDC_CHK_VERTICAL_SYNC));
m_cbxVSync.SetCheck(g_settings->vsync ? BST_CHECKED : BST_UNCHECKED);
TTSetTxt(IDC_CHK_VERTICAL_SYNC, "Vertical sync:\n\nThis option will enable the vertical sync, which will prevent tearing.\nNote: this option will ONLY have effect if vsync is set to \"Software Controlled\".");
m_cmbScreenShotFormat.Attach(GetDlgItem(IDC_CMB_SCREEN_SHOT_FORMAT));
for (int f = 0; f < NumOfFormats; f++)
{
m_cmbScreenShotFormat.SetItemData(m_cmbScreenShotFormat.AddString(ScreenShotFormats[f].format), ScreenShotFormats[f].type);
}
SetComboBoxIndex(m_cmbScreenShotFormat, g_settings->ssformat);
TTSetTxt(IDC_CMB_SCREEN_SHOT_FORMAT, "Select a format, in which screen shots will be saved");
m_cbxTextureSettings.Attach(GetDlgItem(IDC_CHK_SHOW_TEXTURE_ENHANCEMENT));
m_cbxTextureSettings.SetCheck(g_settings->texenh_options ? BST_CHECKED : BST_UNCHECKED);
m_cbxClockEnabled.Attach(GetDlgItem(IDC_CHK_CLOCK_ENABLED));
m_cbxClockEnabled.SetCheck(g_settings->clock > 0 ? BST_CHECKED : BST_UNCHECKED);
TTSetTxt(IDC_CHK_CLOCK_ENABLED, "Clock enabled:\n\nThis option will put a clock in the lower right corner of the screen, showing the current time.\n\n[Recommended: your preference]");
m_cbxClock24.Attach(GetDlgItem(IDC_CHK_CLOCK_24));
m_cbxClock24.SetCheck(g_settings->clock_24_hr > 0 ? BST_CHECKED : BST_UNCHECKED);
TTSetTxt(IDC_CHK_CLOCK_24, "Display hours as 24-hour clock.\n\n[Recommended: your preference]");
m_cmbFSResolution.Attach(GetDlgItem(IDC_CMB_FS_RESOLUTION));
int32_t size = 0;
char ** aRes = grQueryResolutionsExt(&size);
@ -414,15 +349,9 @@ public:
char spinVRAM[100];
m_spinVRAM.GetWindowText(spinVRAM, sizeof(spinVRAM));
CSettings oldsettings = *g_settings;
g_settings->res_data = m_WindowRes.GetCurSel();
g_settings->res_data_org = g_settings->res_data;
g_settings->scr_res_x = g_settings->res_x = resolutions[g_settings->res_data][0];
g_settings->scr_res_y = g_settings->res_y = resolutions[g_settings->res_data][1];
g_settings->SetScreenRes(m_WindowRes.GetCurSel());
g_settings->vsync = m_cbxVSync.GetCheck() == BST_CHECKED;
g_settings->ssformat = m_cmbScreenShotFormat.GetCurSel();
g_settings->texenh_options = m_cbxTextureSettings.GetCheck() == BST_CHECKED;
g_settings->clock = m_cbxClockEnabled.GetCheck() == BST_CHECKED;
g_settings->clock_24_hr = m_cbxClock24.GetCheck() == BST_CHECKED;
g_settings->wrpResolution = m_cmbFSResolution.GetCurSel();
g_settings->wrpAnisotropic = m_cbxAnisotropic.GetCheck() == BST_CHECKED;
g_settings->wrpVRAM = m_cbxVRAM.GetCheck() == BST_CHECKED ? 0 : atoi(spinVRAM);
@ -430,7 +359,7 @@ public:
if (memcmp(&oldsettings, g_settings, sizeof(oldsettings))) //check that settings were changed
{
WriteSettings();
g_settings->WriteSettings();
}
m_options_page->UpdateTextureSettings();
return true;
@ -455,10 +384,8 @@ private:
COptionsSheet * m_options_page;
CComboBox m_WindowRes, m_cmbFSResolution;
CComboBox m_cmbScreenShotFormat;
CButton m_cbxVSync;
CButton m_cbxTextureSettings;
CButton m_cbxClockEnabled, m_cbxClock24;
CButton m_cbxAnisotropic;
CButton m_cbxFBO;
CButton m_cbxVRAM;
@ -512,39 +439,39 @@ public:
TTSetTxt(IDC_CMB_FILTERING_MODE, tooltip.c_str());
m_cmbFiltering.Attach(GetDlgItem(IDC_CMB_FILTERING_MODE));
m_cmbFiltering.SetItemData(m_cmbFiltering.AddString("Automatic"), 0);
m_cmbFiltering.SetItemData(m_cmbFiltering.AddString("Force Bilinear"), 1);
m_cmbFiltering.SetItemData(m_cmbFiltering.AddString("Force Point-sampled"), 2);
SetComboBoxIndex(m_cmbFiltering, g_settings->filtering);
m_cmbFiltering.SetItemData(m_cmbFiltering.AddString("Automatic"), CSettings::Filter_Automatic);
m_cmbFiltering.SetItemData(m_cmbFiltering.AddString("Force Bilinear"), CSettings::Filter_ForceBilinear);
m_cmbFiltering.SetItemData(m_cmbFiltering.AddString("Force Point-sampled"), CSettings::Filter_ForcePointSampled);
SetComboBoxIndex(m_cmbFiltering, (uint32_t)g_settings->filtering());
tooltip = "Buffer swapping method:\n\nThere are 3 buffer swapping methods:\n\n* old - swap buffers when vertical interrupt has occurred.\n* new - swap buffers when set of conditions is satisfied. Prevents flicker on some games.\n* hybrid - mix of first two methods. Can prevent even more flickering then previous method, but also can cause artefacts.\nIf you have flickering problems in a game (or graphics that don't show), try to change swapping method.\n\n[Recommended: new (hybrid for Paper Mario)]";
TTSetTxt(IDC_TXT_BUFFER_SWAPPING, tooltip.c_str());
TTSetTxt(IDC_CMB_BUFFER_SWAPPING, tooltip.c_str());
m_cmbBufferSwap.Attach(GetDlgItem(IDC_CMB_BUFFER_SWAPPING));
m_cmbBufferSwap.SetItemData(m_cmbBufferSwap.AddString("Old"), 0);
m_cmbBufferSwap.SetItemData(m_cmbBufferSwap.AddString("New"), 1);
m_cmbBufferSwap.SetItemData(m_cmbBufferSwap.AddString("Hybrid"), 2);
SetComboBoxIndex(m_cmbBufferSwap, g_settings->swapmode);
m_cmbBufferSwap.SetItemData(m_cmbBufferSwap.AddString("Old"), CSettings::SwapMode_Old);
m_cmbBufferSwap.SetItemData(m_cmbBufferSwap.AddString("New"), CSettings::SwapMode_New);
m_cmbBufferSwap.SetItemData(m_cmbBufferSwap.AddString("Hybrid"), CSettings::SwapMode_Hybrid);
SetComboBoxIndex(m_cmbBufferSwap, g_settings->swapmode());
tooltip = "Per-pixel level-of-detail calculation:\n\nN64 uses special mechanism for mip-mapping, which nearly impossible to reproduce correctly on PC hardware.\nThis option enables approximate emulation of this feature.\nFor example, it is required for the Peach/Bowser portrait's transition in Super Mario 64.\nThere are 3 modes:\n\n* off - LOD is not calculated\n* fast - fast imprecise LOD calculation.\n* precise - most precise LOD calculation possible, but more slow.\n\n[Recommended: your preference]";
TTSetTxt(IDC_TXT_LOD_CALC, tooltip.c_str());
TTSetTxt(IDC_CMB_LOD_CALC, tooltip.c_str());
m_cmbLOD.Attach(GetDlgItem(IDC_CMB_LOD_CALC));
m_cmbLOD.SetItemData(m_cmbLOD.AddString("off"), 0);
m_cmbLOD.SetItemData(m_cmbLOD.AddString("fast"), 1);
m_cmbLOD.SetItemData(m_cmbLOD.AddString("precise"), 2);
SetComboBoxIndex(m_cmbLOD, g_settings->lodmode);
m_cmbLOD.SetItemData(m_cmbLOD.AddString("off"), CSettings::LOD_Off);
m_cmbLOD.SetItemData(m_cmbLOD.AddString("fast"), CSettings::LOD_Fast);
m_cmbLOD.SetItemData(m_cmbLOD.AddString("precise"), CSettings::LOD_Precise);
SetComboBoxIndex(m_cmbLOD, g_settings->lodmode());
tooltip = "Aspect ratio of the output:\n\nMost N64 games use 4:3 aspect ratio, but some support widescreen too.\nYou may select appropriate aspect here and set widescreen mode in game settings->\nIn \"Stretch\" mode the output will be stretched to the entire screen, other modes may add black borders if necessary";
TTSetTxt(IDC_TXT_ASPECT_RATIO, tooltip.c_str());
TTSetTxt(IDC_CMB_ASPECT_RATIO, tooltip.c_str());
m_cmbAspect.Attach(GetDlgItem(IDC_CMB_ASPECT_RATIO));
m_cmbAspect.SetItemData(m_cmbAspect.AddString("4:3 (default)"), 0);
m_cmbAspect.SetItemData(m_cmbAspect.AddString("Force 16:9"), 1);
m_cmbAspect.SetItemData(m_cmbAspect.AddString("Stretch"), 2);
m_cmbAspect.SetItemData(m_cmbAspect.AddString("Original"), 3);
SetComboBoxIndex(m_cmbAspect, g_settings->aspectmode);
m_cmbAspect.SetItemData(m_cmbAspect.AddString("4:3 (default)"), CSettings::Aspect_4x3);
m_cmbAspect.SetItemData(m_cmbAspect.AddString("Force 16:9"), CSettings::Aspect_16x9);
m_cmbAspect.SetItemData(m_cmbAspect.AddString("Stretch"), CSettings::Aspect_Stretch);
m_cmbAspect.SetItemData(m_cmbAspect.AddString("Original"), CSettings::Aspect_Original);
SetComboBoxIndex(m_cmbAspect, (uint32_t)g_settings->aspectmode());
tooltip = "Fog enabled:\n\nSets fog emulation on//off.\n\n[Recommended: on]";
TTSetTxt(IDC_CHK_FOG, tooltip.c_str());
@ -558,31 +485,31 @@ public:
m_cbxFBEnable.Attach(GetDlgItem(IDC_CHK_FRAME_BUFFER_EMULATION));
TTSetTxt(IDC_CHK_FRAME_BUFFER_EMULATION, "Enable frame buffer emulation:\n\nIf on, plugin will try to detect frame buffer usage and apply appropriate frame buffer emulation.\n\n[Recommended: on for games which use frame buffer effects]");
m_cbxFBEnable.SetCheck((g_settings->frame_buffer&fb_emulation) > 0 ? BST_CHECKED : BST_UNCHECKED);
m_cbxFBEnable.SetCheck(g_settings->fb_emulation_enabled() ? BST_CHECKED : BST_UNCHECKED);
m_cbxFBHWFBE.Attach(GetDlgItem(IDC_CHK_HARDWARE_FRAMEBUFFER));
TTSetTxt(IDC_CHK_HARDWARE_FRAMEBUFFER, "Enable hardware frame buffer emulation:\n\nIf this option is on, plugin will create auxiliary frame buffers in video memory instead of copying frame buffer content into main memory.\nThis allows plugin to run frame buffer effects without slowdown and without scaling image down to N64's native resolution.\nThis feature is fully supported by Voodoo 4/5 cards and partially by Voodoo3 and Banshee. Modern cards also fully support it.\n\n[Recommended: on, if supported by your hardware]");
m_cbxFBHWFBE.SetCheck((g_settings->frame_buffer&fb_hwfbe) > 0 ? BST_CHECKED : BST_UNCHECKED);
m_cbxFBHWFBE.SetCheck(g_settings->fb_hwfbe_set() ? BST_CHECKED : BST_UNCHECKED);
m_cbxFBGetFBI.Attach(GetDlgItem(IDC_CHK_GET_FRAMEBUFFER));
TTSetTxt(IDC_CHK_GET_FRAMEBUFFER, "Get information about frame buffers:\n\nThis is compatibility option. It must be set on for Mupen64 and off for 1964");
m_cbxFBGetFBI.SetCheck((g_settings->frame_buffer&fb_get_info) > 0 ? BST_CHECKED : BST_UNCHECKED);
m_cbxFBGetFBI.SetCheck(g_settings->fb_get_info_enabled() ? BST_CHECKED : BST_UNCHECKED);
m_cbxFBReadEveryFrame.Attach(GetDlgItem(IDC_CHK_READ_EVERY_FRAME));
TTSetTxt(IDC_CHK_READ_EVERY_FRAME, "Read every frame:\n\nIn some games plugin can't detect frame buffer usage.\nIn such cases you need to enable this option to see frame buffer effects.\nEvery drawn frame will be read from video card -> it works very slow.\n\n[Recommended: mostly off (needed only for a few games)]");
m_cbxFBReadEveryFrame.SetCheck((g_settings->frame_buffer&fb_ref) > 0 ? BST_CHECKED : BST_UNCHECKED);
m_cbxFBReadEveryFrame.SetCheck(g_settings->fb_ref_enabled() ? BST_CHECKED : BST_UNCHECKED);
m_cbxFBasTex.Attach(GetDlgItem(IDC_RENDER_FRAME_AS_TEXTURE));
TTSetTxt(IDC_RENDER_FRAME_AS_TEXTURE, "Render N64 frame buffer as texture:\n\nWhen this option is enabled, content of each N64 frame buffer is rendered as texture over the frame, rendered by the plugin.\nThis prevents graphics lost, but may cause slowdowns and various glitches in some games.\n\n[Recommended: mostly off]");
m_cbxFBasTex.SetCheck((g_settings->frame_buffer&fb_read_back_to_screen) > 0 ? BST_CHECKED : BST_UNCHECKED);
m_cbxFBasTex.SetCheck(g_settings->fb_read_back_to_screen_enabled() ? BST_CHECKED : BST_UNCHECKED);
m_cbxDetect.Attach(GetDlgItem(IDC_CHK_DETECT_CPU_WRITE));
TTSetTxt(IDC_CHK_DETECT_CPU_WRITE, "Detect CPU write to the N64 frame buffer:\n\nThis option works as the previous options, but the plugin is trying to detect, when game uses CPU writes to N64 frame buffer.\nThe N64 frame buffer is rendered only when CPU writes is detected.\nUse this option for those games, in which you see still image or no image at all for some time with no reason.\n\n[Recommended: mostly off]");
m_cbxDetect.SetCheck((g_settings->frame_buffer&fb_cpu_write_hack) > 0 ? BST_CHECKED : BST_UNCHECKED);
m_cbxDetect.SetCheck(g_settings->fb_cpu_write_hack_enabled() ? BST_CHECKED : BST_UNCHECKED);
m_cbxFBDepthBuffer.Attach(GetDlgItem(IDC_SOFTWARE_DEPTH_BUFFER));
TTSetTxt(IDC_SOFTWARE_DEPTH_BUFFER, "Enable depth buffer rendering:\n\nThis option is used to fully emulate N64 depth buffer.\nIt is required for correct emulation of depth buffer based effects.\nHowever, it requires fast (>1GHz) CPU to work full speed.\n\n[Recommended: on for fast PC]");
m_cbxFBDepthBuffer.SetCheck((g_settings->frame_buffer&fb_depth_render) > 0 ? BST_CHECKED : BST_UNCHECKED);
m_cbxFBDepthBuffer.SetCheck(g_settings->fb_depth_render_enabled() ? BST_CHECKED : BST_UNCHECKED);
return TRUE;
}
@ -590,30 +517,44 @@ public:
{
CSettings oldsettings = *g_settings;
g_settings->filtering = m_cmbFiltering.GetItemData(m_cmbFiltering.GetCurSel());
g_settings->aspectmode = m_cmbAspect.GetItemData(m_cmbAspect.GetCurSel());
g_settings->swapmode = m_cmbBufferSwap.GetItemData(m_cmbBufferSwap.GetCurSel());
g_settings->SetFiltering((CSettings::Filtering_t)m_cmbFiltering.GetItemData(m_cmbFiltering.GetCurSel()));
g_settings->SetAspectmode((CSettings::AspectMode_t)m_cmbAspect.GetItemData(m_cmbAspect.GetCurSel()));
g_settings->SetSwapMode((CSettings::SwapMode_t)m_cmbBufferSwap.GetItemData(m_cmbBufferSwap.GetCurSel()));
g_settings->fog = m_cbxFog.GetCheck() == BST_CHECKED;
g_settings->buff_clear = m_cbxBuffer.GetCheck() == BST_CHECKED;
g_settings->lodmode = m_cmbLOD.GetItemData(m_cmbLOD.GetCurSel());
g_settings->SetLODmode((CSettings::PixelLevelOfDetail_t)m_cmbLOD.GetItemData(m_cmbLOD.GetCurSel()));
if (m_cbxFBEnable.GetCheck() == BST_CHECKED) g_settings->frame_buffer |= fb_emulation;
else g_settings->frame_buffer &= ~fb_emulation;
if (m_cbxFBHWFBE.GetCheck() == BST_CHECKED) g_settings->frame_buffer |= fb_hwfbe;
else g_settings->frame_buffer &= ~fb_hwfbe;
if (m_cbxFBReadEveryFrame.GetCheck() == BST_CHECKED) g_settings->frame_buffer |= fb_ref;
else g_settings->frame_buffer &= ~fb_ref;
if (m_cbxFBasTex.GetCheck() == BST_CHECKED) g_settings->frame_buffer |= fb_read_back_to_screen;
else g_settings->frame_buffer &= ~fb_read_back_to_screen;
if (m_cbxDetect.GetCheck() == BST_CHECKED) g_settings->frame_buffer |= fb_cpu_write_hack;
else g_settings->frame_buffer &= ~fb_cpu_write_hack;
if (m_cbxFBGetFBI.GetCheck() == BST_CHECKED) g_settings->frame_buffer |= fb_get_info;
else g_settings->frame_buffer &= ~fb_get_info;
if (m_cbxFBDepthBuffer.GetCheck() == BST_CHECKED) g_settings->frame_buffer |= fb_depth_render;
else g_settings->frame_buffer &= ~fb_depth_render;
CButton * fb_buttons[] =
{
&m_cbxFBEnable, &m_cbxFBHWFBE, &m_cbxFBReadEveryFrame,
&m_cbxFBasTex, &m_cbxDetect,
&m_cbxFBGetFBI, &m_cbxFBDepthBuffer
};
CSettings::fb_bits_t bits[] =
{
CSettings::fb_emulation, CSettings::fb_hwfbe, CSettings::fb_ref,
CSettings::fb_read_back_to_screen, CSettings::fb_cpu_write_hack,
CSettings::fb_get_info, CSettings::fb_depth_render
};
uint32_t fb_add_bits = 0, fb_remove_bits = 0;
for (int i = 0; i < (sizeof(fb_buttons) / sizeof(fb_buttons[0])); i++)
{
if (fb_buttons[i]->GetCheck() == BST_CHECKED)
{
fb_add_bits |= bits[i];
}
else
{
fb_remove_bits |= bits[i];
}
}
g_settings->UpdateFrameBufferBits(fb_add_bits, fb_remove_bits);
if (memcmp(&oldsettings, g_settings, sizeof(oldsettings))) //check that settings were changed
{
WriteSettings();
g_settings->WriteSettings();
}
return true;
}
@ -660,29 +601,28 @@ public:
TTSetTxt(IDC_TXT_ENH_FILTER, tooltip.c_str());
TTSetTxt(IDC_CMB_ENH_FILTER, tooltip.c_str());
m_cmbEnhFilter.Attach(GetDlgItem(IDC_CMB_ENH_FILTER));
m_cmbEnhFilter.SetItemData(m_cmbEnhFilter.AddString("None"), 0);
m_cmbEnhFilter.SetItemData(m_cmbEnhFilter.AddString("Smooth filtering 1"), 1);
m_cmbEnhFilter.SetItemData(m_cmbEnhFilter.AddString("Smooth filtering 2"), 2);
m_cmbEnhFilter.SetItemData(m_cmbEnhFilter.AddString("Smooth filtering 3"), 3);
m_cmbEnhFilter.SetItemData(m_cmbEnhFilter.AddString("Smooth filtering 4"), 4);
m_cmbEnhFilter.SetItemData(m_cmbEnhFilter.AddString("Sharp filtering 1"), 5);
m_cmbEnhFilter.SetItemData(m_cmbEnhFilter.AddString("Sharp filtering 2"), 6);
SetComboBoxIndex(m_cmbEnhFilter, g_settings->ghq_fltr);
m_cmbEnhFilter.SetItemData(m_cmbEnhFilter.AddString("None"), CSettings::TextureFilter_None);
m_cmbEnhFilter.SetItemData(m_cmbEnhFilter.AddString("Smooth filtering 1"), CSettings::TextureFilter_SmoothFiltering);
m_cmbEnhFilter.SetItemData(m_cmbEnhFilter.AddString("Smooth filtering 2"), CSettings::TextureFilter_SmoothFiltering2);
m_cmbEnhFilter.SetItemData(m_cmbEnhFilter.AddString("Smooth filtering 3"), CSettings::TextureFilter_SmoothFiltering3);
m_cmbEnhFilter.SetItemData(m_cmbEnhFilter.AddString("Smooth filtering 4"), CSettings::TextureFilter_SmoothFiltering4);
m_cmbEnhFilter.SetItemData(m_cmbEnhFilter.AddString("Sharp filtering 1"), CSettings::TextureFilter_SharpFiltering1);
m_cmbEnhFilter.SetItemData(m_cmbEnhFilter.AddString("Sharp filtering 2"), CSettings::TextureFilter_SharpFiltering2);
SetComboBoxIndex(m_cmbEnhFilter, g_settings->ghq_fltr());
tooltip = "Texture enhancement:\n\n7 different filters are selectable here, each one with a distinctive look.\nBe aware of possible performance impacts.\n\nIMPORTANT: 'Store' mode - saves textures in cache 'as is'.\nIt can improve performance in games, which load many textures.\nDisable 'Ignore backgrounds' option for better result.\n\n[Recommended: your preference]";
TTSetTxt(IDC_TXT_ENHANCEMENT, tooltip.c_str());
TTSetTxt(IDC_CMB_ENHANCEMENT, tooltip.c_str());
m_cmbEnhEnhancement.Attach(GetDlgItem(IDC_CMB_ENHANCEMENT));
m_cmbEnhEnhancement.SetItemData(m_cmbEnhEnhancement.AddString("None"), 0);
m_cmbEnhEnhancement.SetItemData(m_cmbEnhEnhancement.AddString("Store"), 1);
m_cmbEnhEnhancement.SetItemData(m_cmbEnhEnhancement.AddString("X2"), 2);
m_cmbEnhEnhancement.SetItemData(m_cmbEnhEnhancement.AddString("X2SAI"), 3);
m_cmbEnhEnhancement.SetItemData(m_cmbEnhEnhancement.AddString("HQ2X"), 4);
m_cmbEnhEnhancement.SetItemData(m_cmbEnhEnhancement.AddString("HQ2XS"), 5);
m_cmbEnhEnhancement.SetItemData(m_cmbEnhEnhancement.AddString("LQ2X"), 6);
m_cmbEnhEnhancement.SetItemData(m_cmbEnhEnhancement.AddString("LQ2XS"), 7);
m_cmbEnhEnhancement.SetItemData(m_cmbEnhEnhancement.AddString("HQ4X"), 8);
SetComboBoxIndex(m_cmbEnhEnhancement, g_settings->ghq_enht);
m_cmbEnhEnhancement.SetItemData(m_cmbEnhEnhancement.AddString("None"), CSettings::TextureEnht_None);
m_cmbEnhEnhancement.SetItemData(m_cmbEnhEnhancement.AddString("X2"), CSettings::TextureEnht_X2);
m_cmbEnhEnhancement.SetItemData(m_cmbEnhEnhancement.AddString("X2SAI"), CSettings::TextureEnht_X2SAI);
m_cmbEnhEnhancement.SetItemData(m_cmbEnhEnhancement.AddString("HQ2X"), CSettings::TextureEnht_HQ2X);
m_cmbEnhEnhancement.SetItemData(m_cmbEnhEnhancement.AddString("HQ2XS"), CSettings::TextureEnht_HQ2XS);
m_cmbEnhEnhancement.SetItemData(m_cmbEnhEnhancement.AddString("LQ2X"), CSettings::TextureEnht_LQ2X);
m_cmbEnhEnhancement.SetItemData(m_cmbEnhEnhancement.AddString("LQ2XS"), CSettings::TextureEnht_LQ2XS);
m_cmbEnhEnhancement.SetItemData(m_cmbEnhEnhancement.AddString("HQ4X"), CSettings::TextureEnht_HQ4X);
SetComboBoxIndex(m_cmbEnhEnhancement, g_settings->ghq_enht());
tooltip = "Hi-res pack format:\n\nChoose which method is to be used for loading Hi-res texture packs.\nOnly Rice's format is available currently.\nLeave on \"None\" if you will not be needing to load hi-res packs.\n\n[Recommended: Rice's format. Default: \"None\"]";
TTSetTxt(IDC_TXT_FORMAT_CHOICES, tooltip.c_str());
@ -763,8 +703,8 @@ public:
m_textTexCache.GetWindowText(texcache, sizeof(texcache));
CSettings oldsettings = *g_settings;
g_settings->ghq_fltr = m_cmbEnhFilter.GetItemData(m_cmbEnhFilter.GetCurSel());
g_settings->ghq_enht = m_cmbEnhEnhancement.GetItemData(m_cmbEnhEnhancement.GetCurSel());
g_settings->SetGhqFltr((CSettings::TextureFilter_t)m_cmbEnhFilter.GetItemData(m_cmbEnhFilter.GetCurSel()));
g_settings->SetGhqEnht((CSettings::TextureEnhancement_t)m_cmbEnhEnhancement.GetItemData(m_cmbEnhEnhancement.GetCurSel()));
g_settings->ghq_cache_size = atoi(texcache);
g_settings->ghq_enht_nobg = (int)m_cbxEnhIgnoreBG.GetCheck() == BST_CHECKED;
g_settings->ghq_enht_cmpr = (int)m_cbxEnhTexCompression.GetCheck() == BST_CHECKED;
@ -781,7 +721,7 @@ public:
g_settings->ghq_cache_save = (int)m_cbxSaveTexCache.GetCheck() == BST_CHECKED;
if (memcmp(&oldsettings, g_settings, sizeof(oldsettings))) //check that settings were changed
{
WriteSettings();
g_settings->WriteSettings();
}
return true;
}
@ -864,27 +804,25 @@ void CALL DllConfig(HWND hParent)
WriteTrace(TraceGlide64, TraceDebug, "-");
#ifdef _WIN32
CGuard guard(*g_ProcessDListCS);
ReadSettings();
if (g_romopen)
{
if (evoodoo)// && fullscreen && !ev_fullscreen)
if (evoodoo)// && g_fullscreen && !ev_fullscreen)
{
ReleaseGfx();
rdp_reset();
}
#ifdef TEXTURE_FILTER // Hiroshi Morii <koolsmoky@users.sourceforge.net>
if (g_settings->ghq_use)
{
ext_ghq_shutdown();
g_settings->ghq_use = 0;
}
#endif
}
else
{
char name[21] = "DEFAULT";
ReadSpecialSettings(name);
g_settings->ReadGameSettings(name);
ZLUT_init();
}
COptionsSheet("Glide64 settings").DoModal(hParent);
@ -896,8 +834,10 @@ void CloseConfig()
{
if (g_romopen)
{
if (fb_depth_render_enabled)
if (g_settings->fb_depth_render_enabled())
{
ZLUT_init();
}
// re-init evoodoo graphics to resize window
if (evoodoo)// && !ev_fullscreen)
InitGfx();

View File

@ -48,47 +48,7 @@ void ConfigInit(HINSTANCE hinst);
void ConfigCleanup(void);
#endif
enum
{
// General Settings
Set_CardId, Set_vsync, Set_ssformat, Set_clock,
Set_clock_24_hr, Set_Rotate, Set_texenh_options, Set_hotkeys, Set_wrpVRAM,
Set_wrpFBO, Set_wrpAnisotropic, Set_autodetect_ucode, Set_ucode, Set_wireframe,
Set_wfmode, Set_logging, Set_log_clear, Set_elogging, Set_run_in_window,
Set_filter_cache, Set_unk_as_red, Set_log_unk, 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,
#ifndef ANDROID
Set_Resolution, Set_wrpResolution,
#endif
// 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,
};
extern short Set_basic_mode, Set_texture_dir, Set_log_dir, Set_log_flush;
extern void general_setting(short setting_ID, const char * name, unsigned int value);
extern void game_setting(short setting_ID, const char * name, unsigned int value);

View File

@ -44,938 +44,9 @@
#include "Util.h"
#include "Debugger.h"
GLIDE64_DEBUGGER _debugger;
#define SX(x) ((x)*rdp.scale_1024)
#define SY(x) ((x)*rdp.scale_768)
#ifdef COLORED_DEBUGGER
#define COL_CATEGORY() grConstantColorValue(0xD288F400)
#define COL_UCC() grConstantColorValue(0xFF000000)
#define COL_CC() grConstantColorValue(0x88C3F400)
#define COL_UAC() grConstantColorValue(0xFF808000)
#define COL_AC() grConstantColorValue(0x3CEE5E00)
#define COL_TEXT() grConstantColorValue(0xFFFFFF00)
#define COL_SEL(x) grConstantColorValue((x)?0x00FF00FF:0x800000FF)
#else
#define COL_CATEGORY()
#define COL_UCC()
#define COL_CC()
#define COL_UAC()
#define COL_AC()
#define COL_TEXT()
#define COL_SEL(x)
#endif
#define COL_GRID 0xFFFFFF80
int grid = 0;
static const char *tri_type[4] = { "TRIANGLE", "TEXRECT", "FILLRECT", "BACKGROUND" };
//Platform-specific stuff
#ifndef _WIN32
typedef struct dbgPOINT {
int x;
int y;
} POINT;
#endif
void DbgCursorPos(POINT * pt)
{
pt->x = pt->y = 0;
}
//
// debug_init - initialize the debugger
//
void debug_init ()
{
_debugger.capture = 0;
_debugger.selected = SELECTED_TRI;
_debugger.screen = NULL;
_debugger.tri_list = NULL;
_debugger.tri_last = NULL;
_debugger.tri_sel = NULL;
_debugger.tmu = 0;
_debugger.tex_scroll = 0;
_debugger.tex_sel = 0;
_debugger.draw_mode = 0;
}
//
// debug_cacheviewer - views the debugger's cache
//
void debug_cacheviewer ()
{
grCullMode (GR_CULL_DISABLE);
int i;
for (i=0; i<2; i++)
{
grTexFilterMode (i,
(g_settings->filter_cache)?GR_TEXTUREFILTER_BILINEAR:GR_TEXTUREFILTER_POINT_SAMPLED,
(g_settings->filter_cache)?GR_TEXTUREFILTER_BILINEAR:GR_TEXTUREFILTER_POINT_SAMPLED);
grTexClampMode (i,
GR_TEXTURECLAMP_CLAMP,
GR_TEXTURECLAMP_CLAMP);
}
switch (_debugger.draw_mode)
{
case 0:
grColorCombine (GR_COMBINE_FUNCTION_SCALE_OTHER,
GR_COMBINE_FACTOR_ONE,
GR_COMBINE_LOCAL_NONE,
GR_COMBINE_OTHER_TEXTURE,
FXFALSE);
grAlphaCombine (GR_COMBINE_FUNCTION_SCALE_OTHER,
GR_COMBINE_FACTOR_ONE,
GR_COMBINE_LOCAL_NONE,
GR_COMBINE_OTHER_TEXTURE,
FXFALSE);
break;
case 1:
grColorCombine (GR_COMBINE_FUNCTION_SCALE_OTHER,
GR_COMBINE_FACTOR_ONE,
GR_COMBINE_LOCAL_NONE,
GR_COMBINE_OTHER_TEXTURE,
FXFALSE);
grAlphaCombine (GR_COMBINE_FUNCTION_LOCAL,
GR_COMBINE_FACTOR_NONE,
GR_COMBINE_LOCAL_CONSTANT,
GR_COMBINE_OTHER_NONE,
FXFALSE);
grConstantColorValue (0xFFFFFFFF);
break;
case 2:
grColorCombine (GR_COMBINE_FUNCTION_LOCAL,
GR_COMBINE_FACTOR_NONE,
GR_COMBINE_LOCAL_CONSTANT,
GR_COMBINE_OTHER_NONE,
FXFALSE);
grAlphaCombine (GR_COMBINE_FUNCTION_SCALE_OTHER,
GR_COMBINE_FACTOR_ONE,
GR_COMBINE_LOCAL_NONE,
GR_COMBINE_OTHER_TEXTURE,
FXFALSE);
grConstantColorValue (0xFFFFFFFF);
}
if (_debugger.tmu == 1)
{
grTexCombine (GR_TMU1,
GR_COMBINE_FUNCTION_LOCAL,
GR_COMBINE_FACTOR_NONE,
GR_COMBINE_FUNCTION_LOCAL,
GR_COMBINE_FACTOR_NONE,
FXFALSE,
FXFALSE);
grTexCombine (GR_TMU0,
GR_COMBINE_FUNCTION_SCALE_OTHER,
GR_COMBINE_FACTOR_ONE,
GR_COMBINE_FUNCTION_SCALE_OTHER,
GR_COMBINE_FACTOR_ONE,
FXFALSE,
FXFALSE);
}
else
{
grTexCombine (GR_TMU0,
GR_COMBINE_FUNCTION_LOCAL,
GR_COMBINE_FACTOR_NONE,
GR_COMBINE_FUNCTION_LOCAL,
GR_COMBINE_FACTOR_NONE,
FXFALSE,
FXFALSE);
}
grAlphaBlendFunction (GR_BLEND_SRC_ALPHA,
GR_BLEND_ONE_MINUS_SRC_ALPHA,
GR_BLEND_ONE,
GR_BLEND_ZERO);
// Draw texture memory
for (i=0; i<4; i++)
{
for (uint32_t x=0; x<16; x++)
{
uint32_t y = i+_debugger.tex_scroll;
if (x+y*16 >= (uint32_t)rdp.n_cached[_debugger.tmu]) break;
CACHE_LUT * cache = voodoo.tex_UMA?rdp.cache[0]:rdp.cache[_debugger.tmu];
VERTEX v[4] = {
{ SX(x*64.0f), SY(512+64.0f*i), 1, 1, 0, 0, 0, 0, {0, 0, 0, 0} },
{ SX(x*64.0f+64.0f*cache[x+y*16].scale_x), SY(512+64.0f*i), 1, 1, 255*cache[x+y*16].scale_x, 0, 0, 0, {0, 0, 0, 0} },
{ SX(x*64.0f), SY(512+64.0f*i+64.0f*cache[x+y*16].scale_y), 1, 1, 0, 255*cache[x+y*16].scale_y, 0, 0, {0, 0, 0, 0} },
{ SX(x*64.0f+64.0f*cache[x+y*16].scale_x), SY(512+64.0f*i+64.0f*cache[x+y*16].scale_y), 1, 1, 255*cache[x+y*16].scale_x, 255*cache[x+y*16].scale_y, 0, 0, {0, 0, 0, 0} }
};
for
(int i=0; i<4; i++)
{
v[i].u1 = v[i].u0;
v[i].v1 = v[i].v0;
}
ConvertCoordsConvert (v, 4);
grTexSource(_debugger.tmu,
voodoo.tex_min_addr[_debugger.tmu] + cache[x+y*16].tmem_addr,
GR_MIPMAPLEVELMASK_BOTH,
&cache[x+y*16].t_info);
grDrawTriangle (&v[2], &v[1], &v[0]);
grDrawTriangle (&v[2], &v[3], &v[1]);
}
}
}
//
// debug_capture - does a frame capture event (for debugging)
//
void debug_capture ()
{
uint32_t i,j;
if (_debugger.tri_list == NULL) goto END;
_debugger.tri_sel = _debugger.tri_list;
_debugger.selected = SELECTED_TRI;
// Connect the list
_debugger.tri_last->pNext = _debugger.tri_list;
while (!CheckKeyPressed(G64_VK_INSERT, 0x0001)) //INSERT
{
// Check for clicks
if (CheckKeyPressed(G64_VK_LBUTTON, 0x0001)) //LBUTTON
{
POINT pt;
DbgCursorPos(&pt);
//int diff = g_settings->scr_res_y-g_settings->res_y;
if (pt.y <= (int)g_settings->res_y)
{
int x = pt.x;
int y = pt.y;//g_settings->res_y - (pt.y - diff);
TRI_INFO *start;
TRI_INFO *tri;
if (_debugger.tri_sel == NULL) tri = _debugger.tri_list, start = _debugger.tri_list;
else tri = _debugger.tri_sel->pNext, start = _debugger.tri_sel;
// Select a triangle (start from the currently selected one)
do {
if (tri->v[0].x == tri->v[1].x &&
tri->v[0].y == tri->v[1].y)
{
tri = tri->pNext;
continue;
}
for (i=0; i<tri->nv; i++)
{
j=i+1;
if (j==tri->nv) j=0;
if ((y-tri->v[i].y)*(tri->v[j].x-tri->v[i].x) -
(x-tri->v[i].x)*(tri->v[j].y-tri->v[i].y) < 0)
break; // It's outside
}
if (i==tri->nv) // all lines passed
{
_debugger.tri_sel = tri;
break;
}
for (i=0; i<tri->nv; i++)
{
j=i+1;
if (j==tri->nv) j=0;
if ((y-tri->v[i].y)*(tri->v[j].x-tri->v[i].x) -
(x-tri->v[i].x)*(tri->v[j].y-tri->v[i].y) > 0)
break; // It's outside
}
if (i==tri->nv) // all lines passed
{
_debugger.tri_sel = tri;
break;
}
tri = tri->pNext;
} while (tri != start);
}
else
{
// on a texture
_debugger.tex_sel = (((uint32_t)((pt.y-SY(512))/SY(64))+_debugger.tex_scroll)*16) +
(uint32_t)(pt.x/SX(64));
}
}
debug_keys ();
grBufferClear (0, 0, 0xFFFF);
// Copy the screen capture back to the screen:
grLfbWriteRegion(GR_BUFFER_BACKBUFFER,
(uint32_t)rdp.offset_x,
(uint32_t)rdp.offset_y,
GR_LFB_SRC_FMT_565,
g_settings->res_x,
g_settings->res_y,
FXFALSE,
g_settings->res_x<<1,
_debugger.screen);
// Do the cacheviewer
debug_cacheviewer ();
// **
// 3/16/02: Moved texture viewer out of loop, remade it. Now it's simpler, and
// supports TMU1. [Dave2001]
// Original by Gugaman
CACHE_LUT * cache = voodoo.tex_UMA?rdp.cache[0]:rdp.cache[_debugger.tmu];
if (_debugger.page == PAGE_TEX_INFO)
{
grTexSource(_debugger.tmu,
voodoo.tex_min_addr[_debugger.tmu] + cache[_debugger.tex_sel].tmem_addr,
GR_MIPMAPLEVELMASK_BOTH,
&cache[_debugger.tex_sel].t_info);
#ifdef SHOW_FULL_TEXVIEWER
float scx = 1.0f;
float scy = 1.0f;
#else
float scx = cache[_debugger.tex_sel].scale_x;
float scy = cache[_debugger.tex_sel].scale_y;
#endif
VERTEX v[4] = {
{ SX(704.0f), SY(221.0f), 1, 1, 0, 0, 0, 0, {0, 0, 0, 0} },
{ SX(704.0f+256.0f*scx), SY(221.0f), 1, 1, 255*scx, 0, 255*scx, 0, {0, 0, 0, 0} },
{ SX(704.0f), SY(221.0f+256.0f*scy), 1, 1, 0, 255*scy, 0, 255*scy, {0, 0, 0, 0} },
{ SX(704.0f+256.0f*scx), SY(221.0f+256.0f*scy), 1, 1, 255*scx, 255*scy, 255*scx, 255*scy, {0, 0, 0, 0} }
};
ConvertCoordsConvert (v, 4);
VERTEX *varr[4] = { &v[0], &v[1], &v[2], &v[3] };
grDrawVertexArray (GR_TRIANGLE_STRIP, 4, varr);
}
// **
grTexFilterMode (GR_TMU0,
GR_TEXTUREFILTER_BILINEAR,
GR_TEXTUREFILTER_BILINEAR);
grColorCombine (GR_COMBINE_FUNCTION_LOCAL,
GR_COMBINE_FACTOR_NONE,
GR_COMBINE_LOCAL_CONSTANT,
GR_COMBINE_OTHER_NONE,
FXFALSE);
grAlphaCombine (GR_COMBINE_FUNCTION_LOCAL,
GR_COMBINE_FACTOR_NONE,
GR_COMBINE_LOCAL_CONSTANT,
GR_COMBINE_OTHER_NONE,
FXFALSE);
grConstantColorValue (0x0000FFFF);
VERTEX *v[8];
if (_debugger.tri_sel)
{
// Draw the outline around the selected triangle
for (i=0; i<_debugger.tri_sel->nv; i++)
{
j=i+1;
if (j>=_debugger.tri_sel->nv) j=0;
grDrawLine (&_debugger.tri_sel->v[i], &_debugger.tri_sel->v[j]);
v[i] = &_debugger.tri_sel->v[i];
}
}
// and the selected texture
uint32_t t_y = ((_debugger.tex_sel & 0xFFFFFFF0) >> 4) - _debugger.tex_scroll;
uint32_t t_x = _debugger.tex_sel & 0xF;
VERTEX vt[4] = {
{ SX(t_x*64.0f), SY(512+64.0f*t_y), 1, 1 },
{ SX(t_x*64.0f+64.0f), SY(512+64.0f*t_y), 1, 1 },
{ SX(t_x*64.0f), SY(512+64.0f*t_y+64.0f), 1, 1 },
{ SX(t_x*64.0f+64.0f), SY(512+64.0f*t_y+64.0f), 1, 1 } };
if (t_y < 4)
{
grDrawLine (&vt[0], &vt[1]);
grDrawLine (&vt[1], &vt[3]);
grDrawLine (&vt[3], &vt[2]);
grDrawLine (&vt[2], &vt[0]);
}
grConstantColorValue (0xFF000020);
if (t_y < 4)
{
grDrawTriangle (&vt[2], &vt[1], &vt[0]);
grDrawTriangle (&vt[2], &vt[3], &vt[1]);
}
if (_debugger.tri_sel)
grDrawVertexArray (GR_TRIANGLE_FAN, _debugger.tri_sel->nv, &v);
// Draw the outline of the cacheviewer
if (_debugger.page == PAGE_TEX_INFO)
{
float scx = cache[_debugger.tex_sel].scale_x;
float scy = cache[_debugger.tex_sel].scale_y;
// And the grid
if (grid)
{
grConstantColorValue (COL_GRID);
float scale_y = (256.0f * scy) / (float)cache[_debugger.tex_sel].height;
for (int y=0; y<=(int)cache[_debugger.tex_sel].height; y++)
{
float y_val = SY(221.0f+y*scale_y);
VERTEX vh[2] = {
{ SX(704.0f), y_val, 1, 1 },
{ SX(704.0f+255.0f*scx), y_val, 1, 1 } };
grDrawLine (&vh[0], &vh[1]);
}
float scale_x = (256.0f * scx) / (float)cache[_debugger.tex_sel].width;
for (int x=0; x<=(int)cache[_debugger.tex_sel].width; x++)
{
float x_val = SX(704.0f+x*scale_x);
VERTEX vv[2] = {
{ x_val, SX(221.0f), 1, 1 },
{ x_val, SX(221.0f+256.0f*scy), 1, 1 } };
grDrawLine (&vv[0], &vv[1]);
}
}
}
grTexCombine (GR_TMU0,
GR_COMBINE_FUNCTION_LOCAL,
GR_COMBINE_FACTOR_NONE,
GR_COMBINE_FUNCTION_LOCAL,
GR_COMBINE_FACTOR_NONE,
FXFALSE,
FXFALSE);
grColorCombine (GR_COMBINE_FUNCTION_LOCAL,
GR_COMBINE_FACTOR_NONE,
GR_COMBINE_LOCAL_CONSTANT,
GR_COMBINE_OTHER_NONE,
FXFALSE);
grAlphaCombine (GR_COMBINE_FUNCTION_SCALE_OTHER,
GR_COMBINE_FACTOR_ONE,
GR_COMBINE_LOCAL_NONE,
GR_COMBINE_OTHER_TEXTURE,
FXFALSE);
grConstantColorValue (0xFFFFFF00);
// Output the information about the selected triangle
grTexSource(GR_TMU0, // Text
voodoo.tex_min_addr[_debugger.tmu]+ offset_font,
GR_MIPMAPLEVELMASK_BOTH,
&fontTex);
static const char *cycle_mode_s[4] = { "1 cycle (0)", "2 cycle (1)", "copy (2)", "fill (3)" };
#define OUTPUT(fmt,other) output(642,(float)i,1,fmt,other); i-=16;
#define OUTPUT1(fmt,other,other1) output(642,(float)i,1,fmt,other,other1); i-=16;
#define OUTPUT_(fmt,cc) COL_SEL(cc); x=642; output(x,(float)i,1,fmt,0); x+=8*(strlen(fmt)+1)
#define _OUTPUT(fmt,cc) COL_SEL(cc); output(x,(float)i,1,fmt,0); x+=8*(strlen(fmt)+1)
i = 740;
float x;
if (_debugger.page == PAGE_GENERAL && _debugger.tri_sel)
{
COL_CATEGORY();
OUTPUT ("GENERAL (page 1):",0);
COL_TEXT();
OUTPUT ("tri #%d", _debugger.tri_sel->tri_n);
OUTPUT ("type: %s", tri_type[_debugger.tri_sel->type]);
OUTPUT ("geom: 0x%08lx", _debugger.tri_sel->geom_mode);
OUTPUT ("othermode_h: 0x%08lx", _debugger.tri_sel->othermode_h);
OUTPUT ("othermode_l: 0x%08lx", _debugger.tri_sel->othermode_l);
OUTPUT ("flags: 0x%08lx", _debugger.tri_sel->flags);
OUTPUT ("",0);
COL_CATEGORY();
OUTPUT ("COMBINE:",0);
COL_TEXT();
OUTPUT ("cycle_mode: %s", cycle_mode_s[_debugger.tri_sel->cycle_mode]);
OUTPUT ("cycle1: 0x%08lx", _debugger.tri_sel->cycle1);
OUTPUT ("cycle2: 0x%08lx", _debugger.tri_sel->cycle2);
if (_debugger.tri_sel->uncombined & 1)
COL_UCC();
else
COL_CC();
OUTPUT ("a0: %s", Mode0[(_debugger.tri_sel->cycle1)&0x0000000F]);
OUTPUT ("b0: %s", Mode1[(_debugger.tri_sel->cycle1>>4)&0x0000000F]);
OUTPUT ("c0: %s", Mode2[(_debugger.tri_sel->cycle1>>8)&0x0000001F]);
OUTPUT ("d0: %s", Mode3[(_debugger.tri_sel->cycle1>>13)&0x00000007]);
if (_debugger.tri_sel->uncombined & 2)
COL_UAC();
else
COL_AC();
OUTPUT ("Aa0: %s", Alpha0[(_debugger.tri_sel->cycle1>>16)&0x00000007]);
OUTPUT ("Ab0: %s", Alpha1[(_debugger.tri_sel->cycle1>>19)&0x00000007]);
OUTPUT ("Ac0: %s", Alpha2[(_debugger.tri_sel->cycle1>>22)&0x00000007]);
OUTPUT ("Ad0: %s", Alpha3[(_debugger.tri_sel->cycle1>>25)&0x00000007]);
if (_debugger.tri_sel->uncombined & 1)
COL_UCC();
else
COL_CC();
OUTPUT ("a1: %s", Mode0[(_debugger.tri_sel->cycle2)&0x0000000F]);
OUTPUT ("b1: %s", Mode1[(_debugger.tri_sel->cycle2>>4)&0x0000000F]);
OUTPUT ("c1: %s", Mode2[(_debugger.tri_sel->cycle2>>8)&0x0000001F]);
OUTPUT ("d1: %s", Mode3[(_debugger.tri_sel->cycle2>>13)&0x00000007]);
if (_debugger.tri_sel->uncombined & 2)
COL_UAC();
else
COL_AC();
OUTPUT ("Aa1: %s", Alpha0[(_debugger.tri_sel->cycle2>>16)&0x00000007]);
OUTPUT ("Ab1: %s", Alpha1[(_debugger.tri_sel->cycle2>>19)&0x00000007]);
OUTPUT ("Ac1: %s", Alpha2[(_debugger.tri_sel->cycle2>>22)&0x00000007]);
OUTPUT ("Ad1: %s", Alpha3[(_debugger.tri_sel->cycle2>>25)&0x00000007]);
}
if ((_debugger.page == PAGE_TEX1 || _debugger.page == PAGE_TEX2) && _debugger.tri_sel)
{
COL_CATEGORY ();
OUTPUT1 ("TEXTURE %d (page %d):", _debugger.page-PAGE_TEX1, 2+_debugger.page-PAGE_TEX1);
COL_TEXT();
int tmu = _debugger.page - PAGE_TEX1;
OUTPUT1 ("cur cache: %d,%d", _debugger.tri_sel->t[tmu].cur_cache[tmu]&0x0F, _debugger.tri_sel->t[tmu].cur_cache[tmu]>>4);
OUTPUT ("tex_size: %d", _debugger.tri_sel->t[tmu].size);
OUTPUT ("tex_format: %d", _debugger.tri_sel->t[tmu].format);
OUTPUT ("width: %d", _debugger.tri_sel->t[tmu].width);
OUTPUT ("height: %d", _debugger.tri_sel->t[tmu].height);
OUTPUT ("palette: %d", _debugger.tri_sel->t[tmu].palette);
OUTPUT ("clamp_s: %d", _debugger.tri_sel->t[tmu].clamp_s);
OUTPUT ("clamp_t: %d", _debugger.tri_sel->t[tmu].clamp_t);
OUTPUT ("mirror_s: %d", _debugger.tri_sel->t[tmu].mirror_s);
OUTPUT ("mirror_t: %d", _debugger.tri_sel->t[tmu].mirror_t);
OUTPUT ("mask_s: %d", _debugger.tri_sel->t[tmu].mask_s);
OUTPUT ("mask_t: %d", _debugger.tri_sel->t[tmu].mask_t);
OUTPUT ("shift_s: %d", _debugger.tri_sel->t[tmu].shift_s);
OUTPUT ("shift_t: %d", _debugger.tri_sel->t[tmu].shift_t);
OUTPUT ("ul_s: %d", _debugger.tri_sel->t[tmu].ul_s);
OUTPUT ("ul_t: %d", _debugger.tri_sel->t[tmu].ul_t);
OUTPUT ("lr_s: %d", _debugger.tri_sel->t[tmu].lr_s);
OUTPUT ("lr_t: %d", _debugger.tri_sel->t[tmu].lr_t);
OUTPUT ("t_ul_s: %d", _debugger.tri_sel->t[tmu].t_ul_s);
OUTPUT ("t_ul_t: %d", _debugger.tri_sel->t[tmu].t_ul_t);
OUTPUT ("t_lr_s: %d", _debugger.tri_sel->t[tmu].t_lr_s);
OUTPUT ("t_lr_t: %d", _debugger.tri_sel->t[tmu].t_lr_t);
OUTPUT ("scale_s: %f", _debugger.tri_sel->t[tmu].scale_s);
OUTPUT ("scale_t: %f", _debugger.tri_sel->t[tmu].scale_t);
OUTPUT ("s_mode: %s", str_cm[((_debugger.tri_sel->t[tmu].clamp_s << 1) | _debugger.tri_sel->t[tmu].mirror_s)&3]);
OUTPUT ("t_mode: %s", str_cm[((_debugger.tri_sel->t[tmu].clamp_t << 1) | _debugger.tri_sel->t[tmu].mirror_t)&3]);
}
if (_debugger.page == PAGE_COLORS && _debugger.tri_sel)
{
COL_CATEGORY();
OUTPUT ("COLORS (page 4)", 0);
COL_TEXT();
OUTPUT ("fill: %08lx", _debugger.tri_sel->fill_color);
OUTPUT ("prim: %08lx", _debugger.tri_sel->prim_color);
OUTPUT ("blend: %08lx", _debugger.tri_sel->blend_color);
OUTPUT ("env: %08lx", _debugger.tri_sel->env_color);
OUTPUT ("fog: %08lx", _debugger.tri_sel->fog_color);
OUTPUT ("prim_lodmin: %d", _debugger.tri_sel->prim_lodmin);
OUTPUT ("prim_lodfrac: %d", _debugger.tri_sel->prim_lodfrac);
}
if (_debugger.page == PAGE_FBL && _debugger.tri_sel)
{
COL_CATEGORY();
OUTPUT ("BLENDER", 0);
COL_TEXT();
OUTPUT ("fbl_a0: %s", FBLa[(_debugger.tri_sel->othermode_l>>30)&0x3]);
OUTPUT ("fbl_b0: %s", FBLb[(_debugger.tri_sel->othermode_l>>26)&0x3]);
OUTPUT ("fbl_c0: %s", FBLc[(_debugger.tri_sel->othermode_l>>22)&0x3]);
OUTPUT ("fbl_d0: %s", FBLd[(_debugger.tri_sel->othermode_l>>18)&0x3]);
OUTPUT ("fbl_a1: %s", FBLa[(_debugger.tri_sel->othermode_l>>28)&0x3]);
OUTPUT ("fbl_b1: %s", FBLb[(_debugger.tri_sel->othermode_l>>24)&0x3]);
OUTPUT ("fbl_c1: %s", FBLc[(_debugger.tri_sel->othermode_l>>20)&0x3]);
OUTPUT ("fbl_d1: %s", FBLd[(_debugger.tri_sel->othermode_l>>16)&0x3]);
OUTPUT ("", 0);
OUTPUT ("fbl: %08lx", _debugger.tri_sel->othermode_l&0xFFFF0000);
OUTPUT ("fbl #1: %08lx", _debugger.tri_sel->othermode_l&0xCCCC0000);
OUTPUT ("fbl #2: %08lx", _debugger.tri_sel->othermode_l&0x33330000);
}
if (_debugger.page == PAGE_OTHERMODE_L && _debugger.tri_sel)
{
uint32_t othermode_l = _debugger.tri_sel->othermode_l;
COL_CATEGORY ();
OUTPUT ("OTHERMODE_L: %08lx", othermode_l);
OUTPUT_ ("AC_NONE", (othermode_l & 3) == 0);
_OUTPUT ("AC_THRESHOLD", (othermode_l & 3) == 1);
_OUTPUT ("AC_DITHER", (othermode_l & 3) == 3);
i -= 16;
OUTPUT_ ("ZS_PIXEL", !(othermode_l & 4));
_OUTPUT ("ZS_PRIM", (othermode_l & 4));
i -= 32;
COL_CATEGORY ();
OUTPUT ("RENDERMODE: %08lx", othermode_l);
OUTPUT_ ("AA_EN", othermode_l & 0x08);
i -= 16;
OUTPUT_ ("Z_CMP", othermode_l & 0x10);
i -= 16;
OUTPUT_ ("Z_UPD", othermode_l & 0x20);
i -= 16;
OUTPUT_ ("IM_RD", othermode_l & 0x40);
i -= 16;
OUTPUT_ ("CLR_ON_CVG", othermode_l & 0x80);
i -= 16;
OUTPUT_ ("CVG_DST_CLAMP", (othermode_l & 0x300) == 0x000);
_OUTPUT ("CVG_DST_WRAP", (othermode_l & 0x300) == 0x100);
_OUTPUT (".._FULL", (othermode_l & 0x300) == 0x200);
_OUTPUT (".._SAVE", (othermode_l & 0x300) == 0x300);
i -= 16;
OUTPUT_ ("ZM_OPA", (othermode_l & 0xC00) == 0x000);
_OUTPUT ("ZM_INTER", (othermode_l & 0xC00) == 0x400);
_OUTPUT ("ZM_XLU", (othermode_l & 0xC00) == 0x800);
_OUTPUT ("ZM_DEC", (othermode_l & 0xC00) == 0xC00);
i -= 16;
OUTPUT_ ("CVG_X_ALPHA", othermode_l & 0x1000);
i -= 16;
OUTPUT_ ("ALPHA_CVG_SEL", othermode_l & 0x2000);
i -= 16;
OUTPUT_ ("FORCE_BL", othermode_l & 0x4000);
}
if (_debugger.page == PAGE_OTHERMODE_H && _debugger.tri_sel)
{
uint32_t othermode_h = _debugger.tri_sel->othermode_h;
COL_CATEGORY ();
OUTPUT ("OTHERMODE_H: %08lx", othermode_h);
OUTPUT_ ("CK_NONE", (othermode_h & 0x100) == 0);
_OUTPUT ("CK_KEY", (othermode_h & 0x100) == 1);
i -= 16;
OUTPUT_ ("TC_CONV", (othermode_h & 0xE00) == 0x200);
_OUTPUT ("TC_FILTCONV", (othermode_h & 0xE00) == 0xA00);
_OUTPUT ("TC_FILT", (othermode_h & 0xE00) == 0xC00);
i -= 16;
OUTPUT_ ("TF_POINT", (othermode_h & 0x3000) == 0x0000);
_OUTPUT ("TF_AVERAGE", (othermode_h & 0x3000) == 0x3000);
_OUTPUT ("TF_BILERP", (othermode_h & 0x3000) == 0x2000);
i -= 16;
OUTPUT_ ("TT_NONE", (othermode_h & 0xC000) == 0x0000);
_OUTPUT ("TT_RGBA16", (othermode_h & 0xC000) == 0x8000);
_OUTPUT ("TT_IA16", (othermode_h & 0xC000) == 0xC000);
i -= 16;
OUTPUT_ ("TL_TILE", (othermode_h & 0x10000) == 0x00000);
_OUTPUT ("TL_LOD", (othermode_h & 0x10000) == 0x10000);
i -= 16;
OUTPUT_ ("TD_CLAMP", (othermode_h & 0x60000) == 0x00000);
_OUTPUT ("TD_SHARPEN", (othermode_h & 0x60000) == 0x20000);
_OUTPUT ("TD_DETAIL", (othermode_h & 0x60000) == 0x40000);
i -= 16;
OUTPUT_ ("TP_NONE", (othermode_h & 0x80000) == 0x00000);
_OUTPUT ("TP_PERSP", (othermode_h & 0x80000) == 0x80000);
i -= 16;
OUTPUT_ ("1CYCLE", (othermode_h & 0x300000) == 0x000000);
_OUTPUT ("2CYCLE", (othermode_h & 0x300000) == 0x100000);
_OUTPUT ("COPY", (othermode_h & 0x300000) == 0x200000);
_OUTPUT ("FILL", (othermode_h & 0x300000) == 0x300000);
i -= 16;
OUTPUT_ ("PM_1PRIM", (othermode_h & 0x400000) == 0x000000);
_OUTPUT ("PM_NPRIM", (othermode_h & 0x400000) == 0x400000);
}
if (_debugger.page == PAGE_TEXELS && _debugger.tri_sel)
{
// change these to output whatever you need, ou for triangles, or u0 for texrects
COL_TEXT();
OUTPUT ("n: %d", _debugger.tri_sel->nv);
OUTPUT ("",0);
for (j=0; j<_debugger.tri_sel->nv; j++)
{
OUTPUT1 ("v[%d].s0: %f", j, _debugger.tri_sel->v[j].ou);
OUTPUT1 ("v[%d].t0: %f", j, _debugger.tri_sel->v[j].ov);
}
OUTPUT ("",0);
for (j=0; j<_debugger.tri_sel->nv; j++)
{
OUTPUT1 ("v[%d].s1: %f", j, _debugger.tri_sel->v[j].u0);
OUTPUT1 ("v[%d].t1: %f", j, _debugger.tri_sel->v[j].v0);
}
}
if (_debugger.page == PAGE_COORDS && _debugger.tri_sel)
{
COL_TEXT();
OUTPUT ("n: %d", _debugger.tri_sel->nv);
for (j=0; j<_debugger.tri_sel->nv; j++)
{
OUTPUT1 ("v[%d].x: %f", j, _debugger.tri_sel->v[j].x);
OUTPUT1 ("v[%d].y: %f", j, _debugger.tri_sel->v[j].y);
OUTPUT1 ("v[%d].z: %f", j, _debugger.tri_sel->v[j].z);
OUTPUT1 ("v[%d].w: %f", j, _debugger.tri_sel->v[j].w);
OUTPUT1 ("v[%d].f: %f", j, 1.0f/_debugger.tri_sel->v[j].f);
OUTPUT1 ("v[%d].r: %d", j, _debugger.tri_sel->v[j].r);
OUTPUT1 ("v[%d].g: %d", j, _debugger.tri_sel->v[j].g);
OUTPUT1 ("v[%d].b: %d", j, _debugger.tri_sel->v[j].b);
OUTPUT1 ("v[%d].a: %d", j, _debugger.tri_sel->v[j].a);
}
}
if (_debugger.page == PAGE_TEX_INFO && _debugger.tex_sel < (uint32_t)rdp.n_cached[_debugger.tmu])
{
COL_CATEGORY();
OUTPUT ("CACHE (page 0)", 0);
COL_TEXT();
//OUTPUT ("t_mem: %08lx", rdp.cache[0][_debugger.tex_sel].t_mem);
//OUTPUT ("crc: %08lx", rdp.cache[0][_debugger.tex_sel].crc);
OUTPUT ("addr: %08lx", cache[_debugger.tex_sel].addr);
OUTPUT ("scale_x: %f", cache[_debugger.tex_sel].scale_x);
OUTPUT ("scale_y: %f", cache[_debugger.tex_sel].scale_y);
OUTPUT ("tmem_addr: %08lx", cache[_debugger.tex_sel].tmem_addr);
OUTPUT ("palette: %08lx", cache[_debugger.tex_sel].palette);
OUTPUT ("set_by: %08lx", cache[_debugger.tex_sel].set_by);
OUTPUT ("texrecting: %d", cache[_debugger.tex_sel].texrecting);
OUTPUT ("mod: %08lx", cache[_debugger.tex_sel].mod);
OUTPUT ("mod_col: %08lx", cache[_debugger.tex_sel].mod_color);
OUTPUT ("mod_col1: %08lx", cache[_debugger.tex_sel].mod_color1);
i=740;
output(800,(float)i,1,"width: %d", cache[_debugger.tex_sel].width);
i-=16;
output(800,(float)i,1,"height: %d", cache[_debugger.tex_sel].height);
i-=16;
output(800,(float)i,1,"format: %d", cache[_debugger.tex_sel].format);
i-=16;
output(800,(float)i,1,"size: %d", cache[_debugger.tex_sel].size);
i-=16;
output(800,(float)i,1,"crc: %08lx", cache[_debugger.tex_sel].crc);
i-=16;
#ifdef TEXTURE_FILTER
output(800,(float)i,1,"RiceCrc: %08lx", (uint32_t)(rdp.cache[_debugger.tmu][_debugger.tex_sel].ricecrc&0xFFFFFFFF));
i-=16;
output(800,(float)i,1,"RicePalCrc: %08lx", (uint32_t)(rdp.cache[_debugger.tmu][_debugger.tex_sel].ricecrc>>32));
i-=16;
#endif
output(800,(float)i,1,"flags: %08lx", cache[_debugger.tex_sel].flags);
i-=16;
output(800,(float)i,1,"line: %d", cache[_debugger.tex_sel].line);
i-=16;
output(800,(float)i,1,"mod_factor: %08lx", cache[_debugger.tex_sel].mod_factor);
i-=32;
output(800,(float)i,1,"lod: %s", str_lod[cache[_debugger.tex_sel].lod]);
i-=16;
output(800,(float)i,1,"aspect: %s", str_aspect[cache[_debugger.tex_sel].aspect + 3]);
// debug_texture(_debugger.tmu, cache[_debugger.tex_sel].addr, _debugger.tex_sel);
}
// Draw the vertex numbers
if (_debugger.tri_sel)
{
for (i=0; i<_debugger.tri_sel->nv; i++)
{
grConstantColorValue (0x000000FF);
output (_debugger.tri_sel->v[i].x+1, g_settings->scr_res_y-_debugger.tri_sel->v[i].y+1, 1,
"%d", i);
grConstantColorValue (0xFFFFFFFF);
output (_debugger.tri_sel->v[i].x, g_settings->scr_res_y-_debugger.tri_sel->v[i].y, 1,
"%d", i);
}
}
// Draw the cursor
debug_mouse ();
grBufferSwap (1);
}
END:
// Release all data
delete [] _debugger.screen;
TRI_INFO *tri;
for (tri=_debugger.tri_list; tri != _debugger.tri_last;)
{
TRI_INFO *tmp = tri;
tri = tri->pNext;
delete [] tmp->v;
delete tmp;
}
delete [] tri->v;
delete tri;
// Reset all values
_debugger.capture = 0;
_debugger.selected = SELECTED_TRI;
_debugger.screen = NULL;
_debugger.tri_list = NULL;
_debugger.tri_last = NULL;
_debugger.tri_sel = NULL;
_debugger.tex_sel = 0;
}
//
// debug_mouse - draws the debugger mouse
//
void debug_mouse ()
{
grColorCombine (GR_COMBINE_FUNCTION_SCALE_OTHER,
GR_COMBINE_FACTOR_ONE,
GR_COMBINE_LOCAL_NONE,
GR_COMBINE_OTHER_TEXTURE,
FXFALSE);
grAlphaCombine (GR_COMBINE_FUNCTION_SCALE_OTHER,
GR_COMBINE_FACTOR_ONE,
GR_COMBINE_LOCAL_NONE,
GR_COMBINE_OTHER_TEXTURE,
FXFALSE);
// Draw the cursor
POINT pt;
DbgCursorPos(&pt);
float cx = (float)pt.x;
float cy = (float)pt.y;
VERTEX v[4] = {
{ cx, cy, 1, 1, 0, 0, 0, 0, {0, 0, 0, 0} },
{ cx+32, cy, 1, 1, 255, 0, 0, 0, {0, 0, 0, 0} },
{ cx, cy+32, 1, 1, 0, 255, 0, 0, {0, 0, 0, 0} },
{ cx+32, cy+32, 1, 1, 255, 255, 0, 0, {0, 0, 0, 0} }
};
ConvertCoordsKeep (v, 4);
grTexSource(GR_TMU0,
voodoo.tex_min_addr[GR_TMU0] + offset_cursor,
GR_MIPMAPLEVELMASK_BOTH,
&cursorTex);
if (voodoo.num_tmu >= 3)
grTexCombine (GR_TMU2,
GR_COMBINE_FUNCTION_NONE,
GR_COMBINE_FACTOR_NONE,
GR_COMBINE_FUNCTION_NONE,
GR_COMBINE_FACTOR_NONE, FXFALSE, FXFALSE);
if (voodoo.num_tmu >= 2)
grTexCombine (GR_TMU1,
GR_COMBINE_FUNCTION_NONE,
GR_COMBINE_FACTOR_NONE,
GR_COMBINE_FUNCTION_NONE,
GR_COMBINE_FACTOR_NONE, FXFALSE, FXFALSE);
grTexCombine (GR_TMU0,
GR_COMBINE_FUNCTION_LOCAL,
GR_COMBINE_FACTOR_NONE,
GR_COMBINE_FUNCTION_LOCAL,
GR_COMBINE_FACTOR_NONE, FXFALSE, FXFALSE);
grDrawTriangle (&v[0], &v[1], &v[2]);
grDrawTriangle (&v[1], &v[3], &v[2]);
}
//
// debug_keys - receives debugger key input
//
void debug_keys ()
{
if (CheckKeyPressed(G64_VK_RIGHT, 0x0001) && _debugger.tri_sel)
{
TRI_INFO *start = _debugger.tri_sel;
while (_debugger.tri_sel->pNext != start)
_debugger.tri_sel = _debugger.tri_sel->pNext;
}
if (CheckKeyPressed(G64_VK_LEFT, 0x0001) && _debugger.tri_sel)
_debugger.tri_sel = _debugger.tri_sel->pNext;
// Check for page changes
if (CheckKeyPressed(G64_VK_1, 0x0001))
_debugger.page = PAGE_GENERAL;
if (CheckKeyPressed(G64_VK_2, 0x0001))
_debugger.page = PAGE_TEX1;
if (CheckKeyPressed(G64_VK_3, 0x0001))
_debugger.page = PAGE_TEX2;
if (CheckKeyPressed(G64_VK_4, 0x0001))
_debugger.page = PAGE_COLORS;
if (CheckKeyPressed(G64_VK_5, 0x0001))
_debugger.page = PAGE_FBL;
if (CheckKeyPressed(G64_VK_6, 0x0001))
_debugger.page = PAGE_OTHERMODE_L;
if (CheckKeyPressed(G64_VK_7, 0x0001))
_debugger.page = PAGE_OTHERMODE_H;
if (CheckKeyPressed(G64_VK_8, 0x0001))
_debugger.page = PAGE_TEXELS;
if (CheckKeyPressed(G64_VK_9, 0x0001))
_debugger.page = PAGE_COORDS;
if (CheckKeyPressed(G64_VK_0, 0x0001))
_debugger.page = PAGE_TEX_INFO;
if (CheckKeyPressed(G64_VK_Q, 0x0001))
_debugger.tmu = 0;
if (CheckKeyPressed(G64_VK_W, 0x0001))
_debugger.tmu = 1;
if (CheckKeyPressed(G64_VK_G, 0x0001))
grid = !grid;
// Go to texture
if (CheckKeyPressed(G64_VK_SPACE, 0x0001))
{
int tile = -1;
if (_debugger.page == PAGE_TEX2)
tile = 1;
else
tile = 0;
if (tile != -1)
{
_debugger.tmu = _debugger.tri_sel->t[tile].tmu;
_debugger.tex_sel = _debugger.tri_sel->t[tile].cur_cache[_debugger.tmu];
_debugger.tex_scroll = (_debugger.tri_sel->t[tile].cur_cache[_debugger.tmu] >> 4) - 1;
}
}
// Go to triangle
CACHE_LUT * cache = voodoo.tex_UMA?rdp.cache[0]:rdp.cache[_debugger.tmu];
if (CheckKeyPressed(G64_VK_CONTROL, 0x0001))
{
int count = rdp.debug_n - cache[_debugger.tex_sel].uses - 1;
if (cache[_debugger.tex_sel].last_used == frame_count)
{
TRI_INFO *t = _debugger.tri_list;
while (count && t) {
t = t->pNext;
count --;
}
_debugger.tri_sel = t;
}
else
_debugger.tri_sel = NULL;
}
if (CheckKeyPressed(G64_VK_A, 0x0001))
_debugger.draw_mode = 0; // texture & texture alpha
if (CheckKeyPressed(G64_VK_S, 0x0001))
_debugger.draw_mode = 1; // texture
if (CheckKeyPressed(G64_VK_D, 0x0001))
_debugger.draw_mode = 2; // texture alpha
// Check for texture scrolling
if (CheckKeyPressed(G64_VK_DOWN, 0x0001))
_debugger.tex_scroll ++;
if (CheckKeyPressed(G64_VK_UP, 0x0001))
_debugger.tex_scroll --;
}
//
// output - output debugger text
//

View File

@ -37,101 +37,4 @@
//
//****************************************************************
#define SELECTED_NONE 0x00000000
#define SELECTED_TRI 0x00000001
#define SELECTED_TEX 0x00000002
typedef struct TEX_INFO_t
{
uint32_t cur_cache[2]; // Current cache #
uint8_t format;
uint8_t size;
uint32_t width, height;
uint16_t line, wid;
uint8_t palette;
uint8_t clamp_s, clamp_t;
uint8_t mirror_s, mirror_t;
uint8_t mask_s, mask_t;
uint8_t shift_s, shift_t;
uint16_t ul_s, ul_t, lr_s, lr_t;
uint16_t t_ul_s, t_ul_t, t_lr_s, t_lr_t;
float scale_s, scale_t;
int tmu;
} TEX_INFO;
typedef struct TRI_INFO_t
{
uint32_t nv; // Number of vertices
VERTEX *v; // Vertices (2d screen coords) of the triangle, used to outline
uint32_t cycle1, cycle2, cycle_mode; // Combine mode at the time of rendering
uint8_t uncombined; // which is uncombined: 0x01=color 0x02=alpha 0x03=both
uint32_t geom_mode; // geometry mode flags
uint32_t othermode_h; // setothermode_h flags
uint32_t othermode_l; // setothermode_l flags
uint32_t tri_n; // Triangle number
uint32_t flags;
int type; // 0-normal, 1-texrect, 2-fillrect
// texture info
TEX_INFO t[2];
// colors
uint32_t fog_color;
uint32_t fill_color;
uint32_t prim_color;
uint32_t blend_color;
uint32_t env_color;
uint32_t prim_lodmin, prim_lodfrac;
TRI_INFO_t *pNext;
} TRI_INFO;
typedef struct DEBUGGER_t
{
int capture; // Capture moment for debugging?
uint32_t selected; // Selected object (see flags above)
TRI_INFO *tri_sel;
uint32_t tex_scroll; // texture scrolling
uint32_t tex_sel;
// CAPTURE INFORMATION
uint8_t *screen; // Screen capture
TRI_INFO *tri_list; // Triangle information list
TRI_INFO *tri_last; // Last in the list (first in)
uint32_t tmu; // tmu #
uint32_t draw_mode;
// Page number
int page;
} GLIDE64_DEBUGGER;
#define PAGE_GENERAL 0
#define PAGE_TEX1 1
#define PAGE_TEX2 2
#define PAGE_COLORS 3
#define PAGE_FBL 4
#define PAGE_OTHERMODE_L 5
#define PAGE_OTHERMODE_H 6
#define PAGE_TEXELS 7
#define PAGE_COORDS 8
#define PAGE_TEX_INFO 9
#define TRI_TRIANGLE 0
#define TRI_TEXRECT 1
#define TRI_FILLRECT 2
#define TRI_BACKGROUND 3
extern GLIDE64_DEBUGGER _debugger;
void debug_init ();
void debug_capture ();
void debug_cacheviewer ();
void debug_mouse ();
void debug_keys ();
void output (float x, float y, int scale, const char *fmt, ...);

View File

@ -130,11 +130,11 @@ static int SetupFBtoScreenCombiner(uint32_t texture_size, uint32_t opaque)
static void DrawRE2Video(FB_TO_SCREEN_INFO & fb_info, float scale)
{
float scale_y = (float)fb_info.width / rdp.vi_height;
float height = g_settings->scr_res_x / scale_y;
float height = g_settings->scr_res_x() / scale_y;
float ul_x = 0.5f;
float ul_y = (g_settings->scr_res_y - height) / 2.0f;
float lr_y = g_settings->scr_res_y - ul_y - 1.0f;
float lr_x = g_settings->scr_res_x - 1.0f;
float ul_y = (g_settings->scr_res_y() - height) / 2.0f;
float lr_y = g_settings->scr_res_y() - ul_y - 1.0f;
float lr_x = g_settings->scr_res_x() - 1.0f;
float lr_u = (fb_info.width - 1)*scale;
float lr_v = (fb_info.height - 1)*scale;
VERTEX v[4] = {
@ -191,7 +191,7 @@ static void DrawRE2Video256(FB_TO_SCREEN_INFO & fb_info)
static void DrawFrameBufferToScreen256(FB_TO_SCREEN_INFO & fb_info)
{
if (g_settings->hacks&hack_RE2)
if (g_settings->hacks(CSettings::hack_RE2))
{
DrawRE2Video256(fb_info);
return;
@ -403,7 +403,7 @@ bool DrawFrameBufferToScreen(FB_TO_SCREEN_INFO & fb_info)
voodoo.tex_min_addr[tmu] + voodoo.tmem_ptr[tmu],
GR_MIPMAPLEVELMASK_BOTH,
&t_info);
if (g_settings->hacks&hack_RE2)
if (g_settings->hacks(CSettings::hack_RE2))
{
DrawRE2Video(fb_info, scale);
}
@ -506,7 +506,7 @@ static void DrawHiresDepthBufferToScreen(FB_TO_SCREEN_INFO & fb_info)
GrTexInfo t_info;
float scale = 0.25f;
GrLOD_t LOD = GR_LOD_LOG2_1024;
if (g_settings->scr_res_x > 1024)
if (g_settings->scr_res_x() > 1024)
{
scale = 0.125f;
LOD = GR_LOD_LOG2_2048;
@ -578,7 +578,7 @@ void DrawDepthBufferToScreen(FB_TO_SCREEN_INFO & fb_info)
DrawDepthBufferToScreen256(fb_info);
return;
}
if (fb_hwfbe_enabled && !evoodoo)
if (g_settings->fb_hwfbe_enabled() && !evoodoo)
{
DrawHiresDepthBufferToScreen(fb_info);
return;

View File

@ -73,7 +73,6 @@ the plugin
#include <Settings/Settings.h>
#include "GlideExtensions.h"
#include "rdp.h"
#include "Keys.h"
#include "Config.h"
#include "Settings.h"
@ -99,8 +98,6 @@ extern "C" {
// ** TAKE OUT BEFORE RELEASE!!! **
//#define LOG_UCODE
//#define ALTTAB_FIX
// note that some of these things are inserted/removed
// from within the code & may not be changed by this define.
@ -127,12 +124,6 @@ extern "C" {
// Usually enabled
#define LARGE_TEXTURE_HANDLING // allow large-textured objects to be split?
#ifdef ALTTAB_FIX
extern HHOOK hhkLowLevelKybd;
extern LRESULT CALLBACK LowLevelKeyboardProc(int nCode,
WPARAM wParam, LPARAM lParam);
#endif
// Simulations
//#define SIMULATE_VOODOO1
//#define SIMULATE_BANSHEE
@ -151,7 +142,6 @@ extern "C" {
#define DMASK 0x1FFFFF
extern uint32_t update_screen_count;
extern uint32_t resolutions[0x18][2];
int CheckKeyPressed(int key, int mask);
@ -164,7 +154,6 @@ extern "C" {
extern int GfxInitDone;
extern bool g_romopen;
extern int to_fullscreen;
extern int debugging;
extern int evoodoo;
extern int ev_fullscreen;
@ -298,10 +287,6 @@ extern "C" {
#define GR_STIPPLE_ROTATE 0x2
#endif
void ReadSettings();
void ReadSpecialSettings(const char * name);
void WriteSettings(void);
/******************************************************************
Function: CaptureScreen
Purpose: This function dumps the current frame to a file

View File

@ -84,7 +84,7 @@ STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD | WS_CAPTION
CAPTION "Basic Settings"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
GROUPBOX "Rendering",IDC_STATIC,6,2,161,128
GROUPBOX "Rendering",IDC_STATIC,7,2,303,128
LTEXT "Windowed Resolution",IDC_STATIC,11,17,75,8
COMBOBOX IDC_CMB_WINDOW_RES,86,15,77,100,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
CONTROL "Vertical sync",IDC_CHK_VERTICAL_SYNC,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,30,120,10
@ -99,15 +99,9 @@ BEGIN
GROUPBOX "Frame buffer emulation",IDC_STATIC,14,103,146,23
CONTROL "Use frame buffer objects",IDC_CHK_USE_FRAME_BUFFER_OBJECT,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,20,113,133,10
GROUPBOX "On screen display",IDC_STATIC,174,2,135,128
GROUPBOX "Time",IDC_STATIC,179,13,124,36
CONTROL "Clock enabled",IDC_CHK_CLOCK_ENABLED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,186,24,59,10
CONTROL "Clock is 24-hour",IDC_CHK_CLOCK_24,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,186,37,52,8
GROUPBOX "Other",IDC_STATIC,7,132,303,36
CONTROL "Show texture enhancement options",IDC_CHK_SHOW_TEXTURE_ENHANCEMENT,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,140,123,11
LTEXT "Screenshot format:",IDC_STATIC,14,153,65,11
COMBOBOX IDC_CMB_SCREEN_SHOT_FORMAT,79,151,42,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
END
IDD_EMULATION_SETTINGS DIALOGEX 0, 0, 311, 177

View File

@ -48,7 +48,9 @@
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="Gfx_1.3.h" />
<ClInclude Include="ScreenResolution.h" />
<ClInclude Include="Settings.h" />
<ClInclude Include="SettingsID.h" />
<ClInclude Include="trace.h" />
<ClInclude Include="turbo3D.h" />
<ClInclude Include="ucode.h" />
@ -88,14 +90,15 @@
<ClInclude Include="Ext_TxFilter.h" />
<ClInclude Include="FBtoScreen.h" />
<ClInclude Include="GlideExtensions.h" />
<ClInclude Include="Keys.h" />
<ClInclude Include="rdp.h" />
<ClInclude Include="TexBuffer.h" />
<ClInclude Include="Util.h" />
<ClInclude Include="Version.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="Android.cpp" />
<ClCompile Include="CRC.cpp" />
<ClCompile Include="ScreenResolution.cpp" />
<ClCompile Include="Settings.cpp" />
<ClCompile Include="TexCache.cpp" />
<ClCompile Include="Config.cpp" />
@ -105,7 +108,6 @@
<ClCompile Include="DepthBufferRender.cpp" />
<ClCompile Include="Ext_TxFilter.cpp" />
<ClCompile Include="FBtoScreen.cpp" />
<ClCompile Include="Keys.cpp" />
<ClCompile Include="Main.cpp" />
<ClCompile Include="rdp.cpp" />
<ClCompile Include="TexBuffer.cpp" />

View File

@ -122,7 +122,6 @@
<ClInclude Include="Ext_TxFilter.h" />
<ClInclude Include="FBtoScreen.h" />
<ClInclude Include="GlideExtensions.h" />
<ClInclude Include="Keys.h" />
<ClInclude Include="rdp.h" />
<ClInclude Include="TexBuffer.h" />
<ClInclude Include="Util.h" />
@ -130,6 +129,8 @@
<ClInclude Include="Gfx_1.3.h" />
<ClInclude Include="trace.h" />
<ClInclude Include="Settings.h" />
<ClInclude Include="SettingsID.h" />
<ClInclude Include="ScreenResolution.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="CRC.cpp">
@ -147,13 +148,14 @@
<ClCompile Include="DepthBufferRender.cpp" />
<ClCompile Include="Ext_TxFilter.cpp" />
<ClCompile Include="FBtoScreen.cpp" />
<ClCompile Include="Keys.cpp" />
<ClCompile Include="Main.cpp" />
<ClCompile Include="rdp.cpp" />
<ClCompile Include="TexBuffer.cpp" />
<ClCompile Include="Util.cpp" />
<ClCompile Include="trace.cpp" />
<ClCompile Include="Settings.cpp" />
<ClCompile Include="ScreenResolution.cpp" />
<ClCompile Include="Android.cpp" />
</ItemGroup>
<ItemGroup>
<Text Include="gpl.txt">

View File

@ -44,31 +44,16 @@ typedef FxU32 GrCombineMode_t;
#define GR_TEXTURE_UMA_EXT 0x06
//wrapper specific
FX_ENTRY void FX_CALL grConfigWrapperExt(
#ifndef ANDROID
FxI32, /* resolution parameter not supported on Android */
#endif
void grConfigWrapperExt(
FxI32,
FxBool,
FxBool
);
FX_ENTRY GrScreenResolution_t FX_CALL grWrapperFullScreenResolutionExt(FxU32*, FxU32*);
FX_ENTRY char ** FX_CALL grQueryResolutionsExt(int32_t*);
FX_ENTRY FxBool FX_CALL grKeyPressedExt(FxU32 key);
uint32_t grWrapperFullScreenResolutionExt(uint32_t *, uint32_t *);
char ** grQueryResolutionsExt(int32_t*);
FX_ENTRY void FX_CALL grGetGammaTableExt(FxU32, FxU32*, FxU32*, FxU32*);
FX_ENTRY GrContext_t FX_CALL grSstWinOpenExt(
#ifndef ANDROID
HWND hWnd,
GrScreenResolution_t screen_resolution,
#endif
GrScreenRefresh_t refresh_rate,
GrColorFormat_t color_format,
GrOriginLocation_t origin_location,
GrPixelFormat_t pixelformat,
int nColBuffers,
int nAuxBuffers
);
FX_ENTRY GrContext_t FX_CALL grSstWinOpenExt(GrColorFormat_t color_format, GrOriginLocation_t origin_location, GrPixelFormat_t pixelformat, int nColBuffers, int nAuxBuffers );
//color combiner
FX_ENTRY void FX_CALL

View File

@ -1,80 +0,0 @@
/*
* Glide64 - Glide video plugin for Nintendo 64 emulators.
* Copyright (c) 2002 Dave2001
* Copyright (c) 2003-2009 Sergey 'Gonetz' Lipski
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
//****************************************************************
//
// Glide64 - Glide Plugin for Nintendo 64 emulators
// Project started on December 29th, 2001
//
// Authors:
// Dave2001, original author, founded the project in 2001, left it in 2002
// Gugaman, joined the project in 2002, left it in 2002
// Sergey 'Gonetz' Lipski, joined the project in 2002, main author since fall of 2002
// Hiroshi 'KoolSmoky' Morii, joined the project in 2007
//
//****************************************************************
//
// To modify Glide64:
// * Write your name and (optional)email, commented by your work, so I know who did it, and so that you can find which parts you modified when it comes time to send it to me.
// * Do NOT send me the whole project or file that you modified. Take out your modified code sections, and tell me where to put them. If people sent the whole thing, I would have many different versions, but no idea how to combine them all.
//
//****************************************************************
//
// Keys, used by Glide64.
// Since key codes are different for WinAPI and SDL, this difference is managed here
// Created by Sergey 'Gonetz' Lipski, July 2009
//
//****************************************************************
#include "Gfx_1.3.h"
Glide64Keys::Glide64Keys()
{
_keys[G64_VK_CONTROL] = 306;
_keys[G64_VK_ALT] = 308;
_keys[G64_VK_INSERT] = 277;
_keys[G64_VK_LBUTTON] = 1;
_keys[G64_VK_UP] = 273;
_keys[G64_VK_DOWN] = 274;
_keys[G64_VK_LEFT] = 276;
_keys[G64_VK_RIGHT] = 275;
_keys[G64_VK_SPACE] = 32;
_keys[G64_VK_BACK] = 8;
_keys[G64_VK_SCROLL] = 302;
_keys[G64_VK_1] = 49;
_keys[G64_VK_2] = 50;
_keys[G64_VK_3] = 51;
_keys[G64_VK_4] = 52;
_keys[G64_VK_5] = 53;
_keys[G64_VK_6] = 54;
_keys[G64_VK_7] = 55;
_keys[G64_VK_8] = 56;
_keys[G64_VK_9] = 57;
_keys[G64_VK_0] = 48;
_keys[G64_VK_A] = 97;
_keys[G64_VK_B] = 98;
_keys[G64_VK_D] = 100;
_keys[G64_VK_G] = 103;
_keys[G64_VK_Q] = 113;
_keys[G64_VK_R] = 114;
_keys[G64_VK_S] = 115;
_keys[G64_VK_V] = 118;
_keys[G64_VK_W] = 119;
}

View File

@ -1,93 +0,0 @@
/*
* Glide64 - Glide video plugin for Nintendo 64 emulators.
* Copyright (c) 2002 Dave2001
* Copyright (c) 2003-2009 Sergey 'Gonetz' Lipski
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
//****************************************************************
//
// Glide64 - Glide Plugin for Nintendo 64 emulators
// Project started on December 29th, 2001
//
// Authors:
// Dave2001, original author, founded the project in 2001, left it in 2002
// Gugaman, joined the project in 2002, left it in 2002
// Sergey 'Gonetz' Lipski, joined the project in 2002, main author since fall of 2002
// Hiroshi 'KoolSmoky' Morii, joined the project in 2007
//
//****************************************************************
//
// To modify Glide64:
// * Write your name and (optional)email, commented by your work, so I know who did it, and so that you can find which parts you modified when it comes time to send it to me.
// * Do NOT send me the whole project or file that you modified. Take out your modified code sections, and tell me where to put them. If people sent the whole thing, I would have many different versions, but no idea how to combine them all.
//
//****************************************************************
//
// Keys, used by Glide64.
// Since key codes are different for WinAPI and SDL, this difference is managed here
// Created by Sergey 'Gonetz' Lipski, July 2009
//
//****************************************************************
#ifndef Keys_H
#define Keys_H
#define G64_VK_CONTROL 0
#define G64_VK_ALT 1
#define G64_VK_INSERT 2
#define G64_VK_LBUTTON 3
#define G64_VK_UP 4
#define G64_VK_DOWN 5
#define G64_VK_LEFT 6
#define G64_VK_RIGHT 7
#define G64_VK_SPACE 8
#define G64_VK_BACK 9
#define G64_VK_SCROLL 10
#define G64_VK_1 11
#define G64_VK_2 12
#define G64_VK_3 13
#define G64_VK_4 14
#define G64_VK_5 15
#define G64_VK_6 16
#define G64_VK_7 17
#define G64_VK_8 18
#define G64_VK_9 19
#define G64_VK_0 20
#define G64_VK_A 21
#define G64_VK_B 22
#define G64_VK_D 23
#define G64_VK_G 24
#define G64_VK_Q 25
#define G64_VK_R 26
#define G64_VK_S 27
#define G64_VK_V 28
#define G64_VK_W 29
#define G64_NUM_KEYS 30
class Glide64Keys
{
public:
Glide64Keys();
~Glide64Keys(){}
int operator[](unsigned int index){return _keys[index];}
private:
int _keys[G64_NUM_KEYS];
};
#endif //Keys_H

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,337 @@
/****************************************************************************
* *
* Project64 - 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 *
* *
****************************************************************************/
#include "ScreenResolution.h"
#include "settings.h"
#include "trace.h"
#ifdef ANDROID
extern uint32_t g_NativeWidth, g_NativeHeight;
#endif
struct ResolutionInfo
{
ResolutionInfo(const char * name = NULL, uint32_t width = 0, uint32_t height = 0, uint32_t frequency = 0, bool default_res = false) :
m_name(name),
m_width(width),
m_height(height),
m_frequency(frequency),
m_default_res(default_res)
{
}
const char * Name(void) const { return m_name; }
uint32_t width(void) const { return m_width; }
uint32_t height(void) const { return m_height; }
uint32_t frequency(void) const { return m_frequency; }
bool DefaultRes(void) const { return m_default_res; }
bool operator == (const ResolutionInfo& rRes) const
{
return m_width == rRes.m_width && m_height == rRes.m_height && m_frequency == rRes.m_frequency;
}
bool operator != (const ResolutionInfo& rRes) const
{
return !(*this == rRes);
}
private:
uint32_t m_width, m_height, m_frequency;
const char * m_name;
bool m_default_res;
};
#ifdef ANDROID
static ResolutionInfo g_resolutions[] =
{
ResolutionInfo("#3200#", 0, 0, 0, true),
ResolutionInfo("960x720", 960, 720, 0, false),
ResolutionInfo("800x600", 800, 600, 0, false),
ResolutionInfo("640x480", 640, 480, 0, false),
ResolutionInfo("480x360", 480, 360, 0, false),
ResolutionInfo("320x240", 320, 240, 0, false),
};
#else
static ResolutionInfo g_resolutions[] =
{
{ "320x200", 320, 200, 0, false },
{ "320x240", 320, 240, 0, false },
{ "400x256", 400, 256, 0, false },
{ "512x384", 512, 384, 0, false },
{ "640x200", 640, 200, 0, false },
{ "640x350", 640, 350, 0, false },
{ "640x400", 640, 400, 0, false },
{ "640x480", 640, 480, 0, true },
{ "800x600", 800, 600, 0, false },
{ "960x720", 960, 720, 0, false },
{ "856x480", 856, 480, 0, false },
{ "512x256", 512, 256, 0, false },
{ "1024x768", 1024, 768, 0, false },
{ "1280x1024", 1280, 1024, 0, false },
{ "1600x1200", 1600, 1200, 0, false },
{ "400x300", 400, 300, 0, false },
{ "1152x864", 1152, 864, 0, false },
{ "1280x960", 1280, 960, 0, false },
{ "1600x1024", 1600, 1024, 0, false },
{ "1792x1344", 1792, 1344, 0, false },
{ "1856x1392", 1856, 1392, 0, false },
{ "1920x1440", 1920, 1440, 0, false },
{ "2048x1536", 2048, 1536, 0, false },
{ "2048x2048", 2048, 2048, 0, false },
};
#endif
uint32_t GetScreenResolutionCount()
{
return sizeof(g_resolutions) / sizeof(g_resolutions[0]);
}
const char * GetScreenResolutionName(uint32_t index)
{
if (index < GetScreenResolutionCount())
{
return g_resolutions[index].Name();
}
return "unknown";
}
uint32_t GetDefaultScreenRes()
{
for (uint32_t i = 0, n = GetScreenResolutionCount(); i < n; i++)
{
if (g_resolutions[i].DefaultRes())
{
return i;
}
}
return 0;
}
uint32_t GetScreenResWidth(uint32_t index)
{
if (index < GetScreenResolutionCount())
{
#ifdef ANDROID
if (g_resolutions[index].width() == 0)
{
return g_NativeWidth;
}
#endif
return g_resolutions[index].width();
}
return 0;
}
uint32_t GetScreenResHeight(uint32_t index)
{
if (index < GetScreenResolutionCount())
{
#ifdef ANDROID
if (g_resolutions[index].height() == 0)
{
return g_NativeHeight;
}
#endif
return g_resolutions[index].height();
}
return 0;
}
class FullScreenResolutions
{
public:
FullScreenResolutions() :
m_dwNumResolutions(0),
m_aResolutions(0),
m_aResolutionsStr(0)
{
}
~FullScreenResolutions();
void getResolution(uint32_t _idx, uint32_t * _width, uint32_t * _height, uint32_t * _frequency = 0)
{
WriteTrace(TraceResolution, TraceDebug, "_idx: %d", _idx);
if (m_dwNumResolutions == 0)
{
init();
}
if (_idx >= m_dwNumResolutions)
{
WriteTrace(TraceGlitch, TraceError, "NumResolutions = %d", m_dwNumResolutions);
_idx = 0;
}
*_width = (uint32_t)m_aResolutions[_idx].width();
*_height = (uint32_t)m_aResolutions[_idx].height();
if (_frequency != 0)
{
*_frequency = (uint32_t)m_aResolutions[_idx].frequency();
}
}
int getCurrentResolutions(void)
{
if (m_dwNumResolutions == 0)
{
init();
}
return m_currentResolutions;
}
char ** getResolutionsList(int32_t * Size)
{
if (m_dwNumResolutions == 0)
{
init();
}
*Size = (int32_t)m_dwNumResolutions;
return m_aResolutionsStr;
}
bool changeDisplaySettings(uint32_t _resolution);
private:
void init();
unsigned int m_dwNumResolutions;
ResolutionInfo * m_aResolutions;
char ** m_aResolutionsStr;
int m_currentResolutions;
};
FullScreenResolutions::~FullScreenResolutions()
{
for (unsigned int i = 0; i < m_dwNumResolutions; i++)
{
delete[] m_aResolutionsStr[i];
m_aResolutionsStr[i] = NULL;
}
if (m_aResolutionsStr)
{
delete[] m_aResolutionsStr;
m_aResolutionsStr = NULL;
}
if (m_aResolutions)
{
delete[] m_aResolutions;
m_aResolutions = NULL;
}
}
void FullScreenResolutions::init()
{
#ifdef _WIN32
m_currentResolutions = -1;
DEVMODE enumMode, currentMode;
int iModeNum = 0;
memset(&enumMode, 0, sizeof(DEVMODE));
EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &currentMode);
ResolutionInfo prevInfo;
while (EnumDisplaySettings(NULL, iModeNum++, &enumMode) != 0)
{
ResolutionInfo curInfo("", enumMode.dmPelsWidth, enumMode.dmPelsHeight, enumMode.dmDisplayFrequency);
if (enumMode.dmBitsPerPel == 32 && curInfo != prevInfo)
{
m_dwNumResolutions++;
prevInfo = curInfo;
}
}
m_aResolutions = new ResolutionInfo[m_dwNumResolutions];
m_aResolutionsStr = new char*[m_dwNumResolutions];
iModeNum = 0;
int current = 0;
char smode[256];
memset(&enumMode, 0, sizeof(DEVMODE));
memset(&prevInfo, 0, sizeof(ResolutionInfo));
while (EnumDisplaySettings(NULL, iModeNum++, &enumMode) != 0)
{
ResolutionInfo curInfo(NULL, enumMode.dmPelsWidth, enumMode.dmPelsHeight, enumMode.dmDisplayFrequency);
if (enumMode.dmBitsPerPel == 32 && curInfo != prevInfo)
{
if (enumMode.dmPelsHeight == currentMode.dmPelsHeight && enumMode.dmPelsWidth == currentMode.dmPelsWidth)
{
m_currentResolutions = current;
}
m_aResolutions[current] = curInfo;
sprintf(smode, curInfo.frequency() > 0 ? "%ix%i 32bpp %iHz" : "%ix%i 32bpp", curInfo.width(), curInfo.height(), curInfo.frequency());
m_aResolutionsStr[current] = new char[strlen(smode) + 1];
strcpy(m_aResolutionsStr[current], smode);
prevInfo = curInfo;
current++;
}
}
#endif
}
bool FullScreenResolutions::changeDisplaySettings(uint32_t _resolution)
{
#ifdef _WIN32
uint32_t width, height, frequency;
getResolution(_resolution, &width, &height, &frequency);
ResolutionInfo info(NULL, width, height, frequency);
DEVMODE enumMode;
int iModeNum = 0;
memset(&enumMode, 0, sizeof(DEVMODE));
while (EnumDisplaySettings(NULL, iModeNum++, &enumMode) != 0)
{
ResolutionInfo curInfo(NULL, enumMode.dmPelsWidth, enumMode.dmPelsHeight, enumMode.dmDisplayFrequency);
if (enumMode.dmBitsPerPel == 32 && curInfo == info) {
bool bRes = ChangeDisplaySettings(&enumMode, CDS_FULLSCREEN) == DISP_CHANGE_SUCCESSFUL;
WriteTrace(TraceGlitch, TraceDebug, "width=%d, height=%d, freq=%d %s\r\n", enumMode.dmPelsWidth, enumMode.dmPelsHeight, enumMode.dmDisplayFrequency, bRes ? "Success" : "Failed");
return bRes;
}
}
return false;
#else // _WIN32
return false;
#endif // _WIN32
}
FullScreenResolutions g_FullScreenResolutions;
uint32_t GetFullScreenResWidth(uint32_t index)
{
uint32_t _width, _height;
g_FullScreenResolutions.getResolution(index, &_width, &_height);
return _width;
}
uint32_t GetFullScreenResHeight(uint32_t index)
{
uint32_t _width, _height;
g_FullScreenResolutions.getResolution(index, &_width, &_height);
return _height;
}
bool EnterFullScreen(uint32_t index)
{
return g_FullScreenResolutions.changeDisplaySettings(index);
}
int GetCurrentResIndex(void)
{
return g_FullScreenResolutions.getCurrentResolutions();
}
#ifndef ANDROID
char ** grQueryResolutionsExt(int32_t * Size)
{
WriteTrace(TraceGlitch, TraceDebug, "-");
return g_FullScreenResolutions.getResolutionsList(Size);
}
uint32_t grWrapperFullScreenResolutionExt(uint32_t * width, uint32_t * height)
{
WriteTrace(TraceGlitch, TraceDebug, "-");
g_FullScreenResolutions.getResolution(g_settings->wrpResolution, width, height);
return g_settings->wrpResolution;
}
#endif

View File

@ -0,0 +1,23 @@
/****************************************************************************
* *
* Project64 - 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 *
* *
****************************************************************************/
#pragma once
#include <Common/stdtypes.h>
uint32_t GetScreenResolutionCount();
uint32_t GetDefaultScreenRes();
uint32_t GetScreenResWidth(uint32_t index);
uint32_t GetScreenResHeight(uint32_t index);
const char * GetScreenResolutionName(uint32_t index);
int GetCurrentResIndex(void);
uint32_t GetFullScreenResWidth(uint32_t index);
uint32_t GetFullScreenResHeight(uint32_t index);
bool EnterFullScreen(uint32_t index);

View File

@ -1,36 +1,43 @@
#include <Common/StdString.h>
#include "Gfx_1.3.h"
#include "ScreenResolution.h"
#include "SettingsID.h"
#ifdef _WIN32
int GetCurrentResIndex(void);
#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;
extern int g_width, g_height;
CSettings::CSettings() :
card_id(0),
res_x(640),
scr_res_x(640),
res_y(480),
scr_res_y(480),
#ifndef ANDROID
res_data(GR_RESOLUTION_640x480),
res_data_org(GR_RESOLUTION_640x480),
#endif
m_dirty(false),
m_res_x(GetScreenResWidth(GetDefaultScreenRes())),
m_scr_res_x(GetScreenResWidth(GetDefaultScreenRes())),
m_res_y(GetScreenResHeight(GetDefaultScreenRes())),
m_scr_res_y(GetScreenResHeight(GetDefaultScreenRes())),
m_ScreenRes(GetDefaultScreenRes()),
advanced_options(0),
texenh_options(0),
ssformat(0),
vsync(0),
m_rotate(Rotate_None),
m_filtering(Filter_Automatic),
clock(0),
clock_24_hr(0),
rotate(0),
filtering(0),
fog(0),
buff_clear(0),
swapmode(0),
lodmode(0),
aspectmode(0),
use_hotkeys(0),
#ifdef TEXTURE_FILTER
m_swapmode(SwapMode_Old),
m_lodmode(LOD_Off),
m_aspectmode(Aspect_4x3),
m_frame_buffer(0),
m_fb_crc_mode(fbcrcFast),
//Texture filtering options
texture_dir(""),
ghq_fltr(0),
ghq_enht(0),
m_ghq_fltr(TextureFilter_None),
m_ghq_enht(TextureEnht_None),
ghq_cmpr(0),
ghq_hirs(0),
ghq_use(0),
@ -48,16 +55,9 @@ ghq_cache_save(0),
ghq_cache_size(0),
ghq_hirs_let_texartists_fly(0),
ghq_hirs_dump(0),
#endif
autodetect_ucode(0),
ucode(0),
logging(0),
elogging(0),
log_clear(0),
run_in_window(0),
filter_cache(0),
m_ucode(ucode_Fast3D),
unk_as_red(0),
log_unk(0),
unk_clear(0),
wireframe(0),
wfmode(0),
@ -74,7 +74,7 @@ flame_corona(0), //hack for zeldas flame's corona
increase_texrect_edge(0), // add 1 to lower right corner coordinates of texrect
decrease_fillrect_edge(0), // sub 1 from lower right corner coordinates of fillrect
texture_correction(0), // enable perspective texture correction emulation. is on by default
stipple_mode(0), //used for dithered alpha emulation
m_stipple_mode(STIPPLE_Disable), //used for dithered alpha emulation
stipple_pattern(0), //used for dithered alpha emulation
force_microcheck(0), //check microcode each frame, for mixed F3DEX-S2DEX games
force_quad3d(0), //force 0xb5 command to be quad, not line 3d
@ -88,7 +88,7 @@ zmode_compare_less(0), //force GR_CMP_LESS for zmode=0 (opaque)and zmode=1 (inte
old_style_adither(0), //apply alpha dither regardless of alpha_dither_mode
n64_z_scale(0), //scale vertex z value before writing to depth buffer, as N64 does.
hacks(0),
m_hacks((hacks_t)0),
//wrapper settings
#ifndef ANDROID
@ -96,6 +96,641 @@ wrpResolution(0),
#endif
wrpVRAM(0),
wrpFBO(0),
wrpAnisotropic(0)
wrpAnisotropic(0),
m_FlushLogs(false)
{
memset(m_log_dir, 0, sizeof(m_log_dir));
RegisterSettings();
ReadSettings();
}
CSettings::~CSettings()
{
}
void CSettings::RegisterSettings(void)
{
SetModuleName("default");
Set_basic_mode = FindSystemSettingId("Basic Mode");
Set_texture_dir = FindSystemSettingId("Dir:Texture");
Set_log_flush = FindSystemSettingId("Log Auto Flush");
Set_log_dir = FindSystemSettingId("Dir:Log");
SetModuleName("Glide64");
general_setting(Set_Resolution, "resolution", GetDefaultScreenRes());
#ifdef _WIN32
general_setting(Set_FullScreenRes, "FullScreenRes", GetCurrentResIndex());
#endif
general_setting(Set_vsync, "vsync", 1);
general_setting(Set_texenh_options, "texenh_options", 0);
general_setting(Set_wrpVRAM, "wrpVRAM", 0);
#ifndef ANDROID
general_setting(Set_wrpFBO, "wrpFBO", 0);
#else
general_setting(Set_wrpFBO, "wrpFBO", 1);
#endif
general_setting(Set_Rotate, "rotate", Rotate_None);
general_setting(Set_wrpAnisotropic, "wrpAnisotropic", 0);
general_setting(Set_autodetect_ucode, "autodetect_ucode", 1);
general_setting(Set_ucode, "ucode", ucode_F3DEX2);
general_setting(Set_wireframe, "wireframe", 0);
general_setting(Set_wfmode, "wfmode", 1);
general_setting(Set_unk_as_red, "unk_as_red", 0);
general_setting(Set_unk_clear, "unk_clear", 0);
general_setting(Set_ghq_fltr, "ghq_fltr", TextureFilter_None);
general_setting(Set_ghq_cmpr, "ghq_cmpr", 0);
general_setting(Set_ghq_enht, "ghq_enht", TextureEnht_None);
general_setting(Set_ghq_hirs, "ghq_hirs", 0);
general_setting(Set_ghq_enht_cmpr, "ghq_enht_cmpr", 0);
general_setting(Set_ghq_enht_tile, "ghq_enht_tile", 0);
general_setting(Set_ghq_enht_f16bpp, "ghq_enht_f16bpp", 0);
general_setting(Set_ghq_enht_gz, "ghq_enht_gz", 1);
general_setting(Set_ghq_enht_nobg, "ghq_enht_nobg", 0);
general_setting(Set_ghq_hirs_cmpr, "ghq_hirs_cmpr", 0);
general_setting(Set_ghq_hirs_tile, "ghq_hirs_tile", 0);
general_setting(Set_ghq_hirs_f16bpp, "ghq_hirs_f16bpp", 0);
general_setting(Set_ghq_hirs_gz, "ghq_hirs_gz", 1);
general_setting(Set_ghq_hirs_altcrc, "ghq_hirs_altcrc", 1);
general_setting(Set_ghq_cache_save, "ghq_cache_save", 1);
general_setting(Set_ghq_cache_size, "ghq_cache_size", 0);
general_setting(Set_ghq_hirs_let_texartists_fly, "ghq_hirs_let_texartists_fly", 0);
general_setting(Set_ghq_hirs_dump, "ghq_hirs_dump", 0);
general_setting(Set_optimize_texrect_default, "optimize_texrect", true);
general_setting(Set_filtering_default, "filtering", CSettings::Filter_Automatic);
general_setting(Set_lodmode_default, "lodmode", CSettings::LOD_Off);
general_setting(Set_fog_default, "fog", 1);
general_setting(Set_buff_clear_default, "buff_clear", 1);
general_setting(Set_swapmode_default, "swapmode", SwapMode_New);
general_setting(Set_aspect_default, "aspect", Aspect_4x3);
general_setting(Set_fb_smart_default, "fb_smart", true);
general_setting(Set_fb_hires_default, "fb_hires", true);
general_setting(Set_fb_read_always_default, "fb_read_always", false);
general_setting(Set_read_back_to_screen_default, "read_back_to_screen", false);
general_setting(Set_detect_cpu_write_default, "detect_cpu_write", false);
general_setting(Set_fb_get_info_default, "fb_get_info", false);
general_setting(Set_fb_render_default, "fb_render", false);
game_setting(Set_alt_tex_size, "alt_tex_size", 0);
game_setting(Set_use_sts1_only, "use_sts1_only", 0);
game_setting(Set_force_calc_sphere, "force_calc_sphere", 0);
game_setting(Set_correct_viewport, "correct_viewport", 0);
game_setting(Set_increase_texrect_edge, "increase_texrect_edge", 0);
game_setting(Set_decrease_fillrect_edge, "decrease_fillrect_edge", 0);
game_setting(Set_texture_correction, "texture_correction", 1);
game_setting(Set_pal230, "pal230", 0);
game_setting(Set_stipple_mode, "stipple_mode", STIPPLE_Rotate);
game_setting(Set_stipple_pattern, "stipple_pattern", 0x3E0F83E0);
game_setting(Set_force_microcheck, "force_microcheck", 0);
game_setting(Set_force_quad3d, "force_quad3d", 0);
game_setting(Set_clip_zmin, "clip_zmin", 0);
game_setting(Set_clip_zmax, "clip_zmax", 1);
game_setting(Set_fast_crc, "fast_crc", 1);
game_setting(Set_adjust_aspect, "adjust_aspect", 1);
game_setting(Set_zmode_compare_less, "zmode_compare_less", 0);
game_setting(Set_old_style_adither, "old_style_adither", 0);
game_setting(Set_n64_z_scale, "n64_z_scale", 0);
game_setting_default(Set_optimize_texrect, "optimize_texrect", Set_optimize_texrect_default);
game_setting(Set_ignore_aux_copy, "ignore_aux_copy", false);
game_setting(Set_hires_buf_clear, "hires_buf_clear", true);
game_setting(Set_fb_read_alpha, "fb_read_alpha", false);
game_setting(Set_useless_is_useless, "useless_is_useless", false);
game_setting(Set_fb_crc_mode, "fb_crc_mode", fbcrcFast);
game_setting_default(Set_filtering, "filtering", Set_filtering_default);
game_setting_default(Set_fog, "fog", Set_fog_default);
game_setting_default(Set_buff_clear, "buff_clear", Set_buff_clear_default);
game_setting_default(Set_swapmode, "swapmode", Set_swapmode_default);
game_setting_default(Set_aspect, "aspect", Set_aspect_default);
game_setting_default(Set_lodmode, "lodmode", Set_lodmode_default);
game_setting_default(Set_fb_smart, "fb_smart", Set_fb_smart_default);
game_setting_default(Set_fb_hires, "fb_hires", Set_fb_hires_default);
game_setting_default(Set_fb_read_always, "fb_read_always", Set_fb_read_always_default);
game_setting_default(Set_read_back_to_screen, "read_back_to_screen", Set_read_back_to_screen_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_render, "fb_render", Set_fb_render_default);
SettingsRegisterChange(false, Set_Resolution, this, stSettingsChanged);
}
void CSettings::SetScreenRes(uint32_t value)
{
if (value >= GetScreenResolutionCount())
{
value = GetDefaultScreenRes();
}
if (value != m_ScreenRes)
{
m_ScreenRes = value;
m_dirty = true;
}
}
void CSettings::UpdateScreenSize(bool fullscreen)
{
#ifndef ANDROID
if (fullscreen)
{
g_width = GetFullScreenResWidth(wrpResolution);
g_height = GetFullScreenResHeight(wrpResolution);
}
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;
#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
UpdateAspectRatio();
}
void CSettings::SetAspectmode(AspectMode_t value)
{
if (value != m_aspectmode)
{
m_aspectmode = value;
UpdateAspectRatio();
m_dirty = true;
}
}
void CSettings::SetLODmode(PixelLevelOfDetail_t value)
{
if (value != m_lodmode)
{
m_lodmode = value;
m_dirty = true;
}
}
void CSettings::SetFiltering(Filtering_t value)
{
if (value != m_filtering)
{
m_filtering = value;
m_dirty = true;
}
}
void CSettings::SetSwapMode(SwapMode_t value)
{
if (value != m_swapmode)
{
m_swapmode = value;
m_dirty = true;
}
}
void CSettings::SetGhqFltr(TextureFilter_t value)
{
if (value != m_ghq_fltr)
{
m_ghq_fltr = value;
m_dirty = true;
}
}
void CSettings::SetGhqEnht(TextureEnhancement_t value)
{
if (value != m_ghq_enht)
{
m_ghq_enht = value;
m_dirty = true;
}
}
void CSettings::UpdateFrameBufferBits(uint32_t BitsToAdd, uint32_t BitsToRemove)
{
uint32_t frame_buffer_original = m_frame_buffer;
m_frame_buffer |= BitsToAdd;
m_frame_buffer &= ~BitsToRemove;
if (frame_buffer_original != m_frame_buffer)
{
m_dirty = true;
}
}
CSettings::ucode_t CSettings::DetectUCode(uint32_t uc_crc)
{
RegisterSetting(Set_ucodeLookup, Data_DWORD_RDB_Setting, stdstr_f("%08lx", uc_crc).c_str(), "ucode", (unsigned int)-2, NULL);
CSettings::ucode_t uc = (CSettings::ucode_t)GetSetting(Set_ucodeLookup);
if (uc == CSettings::uCode_NotFound || uc == CSettings::uCode_Unsupported)
{
m_ucode = (CSettings::ucode_t)GetSetting(Set_ucode);
}
else
{
m_ucode = uc;
}
return uc;
}
void CSettings::SetUcode(ucode_t value)
{
m_ucode = value;
}
void CSettings::UpdateAspectRatio(void)
{
switch (m_aspectmode)
{
case Aspect_4x3:
if (m_scr_res_x >= m_scr_res_y * 4.0f / 3.0f) {
m_res_y = m_scr_res_y;
m_res_x = (uint32_t)(m_res_y * 4.0f / 3.0f);
}
else
{
m_res_x = m_scr_res_x;
m_res_y = (uint32_t)(m_res_x / 4.0f * 3.0f);
}
break;
case Aspect_16x9:
if (m_scr_res_x >= m_scr_res_y * 16.0f / 9.0f)
{
m_res_y = m_scr_res_y;
m_res_x = (uint32_t)(m_res_y * 16.0f / 9.0f);
}
else
{
m_res_x = m_scr_res_x;
m_res_y = (uint32_t)(m_res_x / 16.0f * 9.0f);
}
break;
default: //stretch or original
m_res_x = m_scr_res_x;
m_res_y = m_scr_res_y;
}
m_res_x += (uint32_t)(m_scr_res_x - m_res_x) / 2.0f;
m_res_y += (uint32_t)(m_scr_res_y - m_res_y) / 2.0f;
}
void CSettings::ReadSettings()
{
SetScreenRes(GetSetting(Set_Resolution));
#ifndef ANDROID
this->wrpResolution = GetSetting(Set_FullScreenRes);
#endif
this->vsync = GetSetting(Set_vsync);
m_rotate = (ScreenRotate_t)GetSetting(Set_Rotate);
this->advanced_options = Set_basic_mode ? !GetSystemSetting(Set_basic_mode) : 0;
this->texenh_options = GetSetting(Set_texenh_options);
this->wrpVRAM = GetSetting(Set_wrpVRAM);
this->wrpFBO = GetSetting(Set_wrpFBO);
this->wrpAnisotropic = GetSetting(Set_wrpAnisotropic);
#ifndef _ENDUSER_RELEASE_
this->autodetect_ucode = GetSetting(Set_autodetect_ucode);
this->wireframe = GetSetting(Set_wireframe);
this->wfmode = GetSetting(Set_wfmode);
this->unk_as_red = GetSetting(Set_unk_as_red);
this->unk_clear = GetSetting(Set_unk_clear);
#else
this->autodetect_ucode = TRUE;
this->wireframe = FALSE;
this->wfmode = 0;
this->unk_as_red = FALSE;
this->unk_clear = FALSE;
#endif
m_ucode = ucode_F3DEX2;
char texture_dir[260];
memset(texture_dir, 0, sizeof(texture_dir));
GetSystemSettingSz(Set_texture_dir, texture_dir, sizeof(texture_dir));
this->texture_dir = texture_dir;
m_ghq_fltr = (TextureFilter_t)GetSetting(Set_ghq_fltr);
this->ghq_cmpr = (uint8_t)GetSetting(Set_ghq_cmpr);
m_ghq_enht = (TextureEnhancement_t)GetSetting(Set_ghq_enht);
this->ghq_hirs = (uint8_t)GetSetting(Set_ghq_hirs);
this->ghq_enht_cmpr = GetSetting(Set_ghq_enht_cmpr);
this->ghq_enht_tile = GetSetting(Set_ghq_enht_tile);
this->ghq_enht_f16bpp = GetSetting(Set_ghq_enht_f16bpp);
this->ghq_enht_gz = GetSetting(Set_ghq_enht_gz);
this->ghq_enht_nobg = GetSetting(Set_ghq_enht_nobg);
this->ghq_hirs_cmpr = GetSetting(Set_ghq_hirs_cmpr);
this->ghq_hirs_tile = GetSetting(Set_ghq_hirs_tile);
this->ghq_hirs_f16bpp = GetSetting(Set_ghq_hirs_f16bpp);
this->ghq_hirs_gz = GetSetting(Set_ghq_hirs_gz);
this->ghq_hirs_altcrc = GetSetting(Set_ghq_hirs_altcrc);
this->ghq_cache_save = GetSetting(Set_ghq_cache_save);
this->ghq_cache_size = GetSetting(Set_ghq_cache_size);
this->ghq_hirs_let_texartists_fly = GetSetting(Set_ghq_hirs_let_texartists_fly);
this->ghq_hirs_dump = GetSetting(Set_ghq_hirs_dump);
if (Set_log_dir != 0)
{
GetSystemSettingSz(Set_log_dir, m_log_dir, sizeof(m_log_dir));
}
m_FlushLogs = Set_log_flush != 0 ? GetSystemSetting(Set_log_flush) != 0 : false;
m_dirty = false;
}
void CSettings::ReadGameSettings(const char * name)
{
m_hacks = (hacks_t)0;
//detect games which require special hacks
if (strstr(name, (const char *)"ZELDA"))
{
m_hacks = (hacks_t)(m_hacks | (CSettings::hack_Zelda | CSettings::hack_OoT));
}
else if (strstr(name, (const char *)"MASK"))
{
m_hacks = (hacks_t)(m_hacks | CSettings::hack_Zelda);
}
else if (strstr(name, (const char *)"ROADSTERS TROPHY"))
{
m_hacks = (hacks_t)(m_hacks | CSettings::hack_Zelda);
}
else if (strstr(name, (const char *)"Diddy Kong Racing"))
{
m_hacks = (hacks_t)(m_hacks | CSettings::hack_Diddy);
}
else if (strstr(name, (const char *)"Tonic Trouble"))
{
m_hacks = (hacks_t)(m_hacks | CSettings::hack_Tonic);
}
else if (strstr(name, (const char *)"All") && strstr(name, (const char *)"Star") && strstr(name, (const char *)"Baseball"))
{
m_hacks = (hacks_t)(m_hacks | CSettings::hack_ASB);
}
else if (strstr(name, (const char *)"Beetle") || strstr(name, (const char *)"BEETLE") || strstr(name, (const char *)"HSV"))
{
m_hacks = (hacks_t)(m_hacks | CSettings::hack_BAR);
}
else if (strstr(name, (const char *)"I S S 64") || strstr(name, (const char *)"J WORLD SOCCER3") || strstr(name, (const char *)"PERFECT STRIKER") || strstr(name, (const char *)"RONALDINHO SOCCER"))
{
m_hacks = (hacks_t)(m_hacks | CSettings::hack_ISS64);
}
else if (strstr(name, (const char *)"MARIOKART64"))
{
m_hacks = (hacks_t)(m_hacks | CSettings::hack_MK64);
}
else if (strstr(name, (const char *)"NITRO64"))
{
m_hacks = (hacks_t)(m_hacks | CSettings::hack_WCWnitro);
}
else if (strstr(name, (const char *)"CHOPPER_ATTACK") || strstr(name, (const char *)"WILD CHOPPERS"))
{
m_hacks = (hacks_t)(m_hacks | CSettings::hack_Chopper);
}
else if (strstr(name, (const char *)"Resident Evil II") || strstr(name, (const char *)"BioHazard II"))
{
m_hacks = (hacks_t)(m_hacks | CSettings::hack_RE2);
}
else if (strstr(name, (const char *)"YOSHI STORY"))
{
m_hacks = (hacks_t)(m_hacks | CSettings::hack_Yoshi);
}
else if (strstr(name, (const char *)"F-Zero X") || strstr(name, (const char *)"F-ZERO X"))
{
m_hacks = (hacks_t)(m_hacks | CSettings::hack_Fzero);
}
else if (strstr(name, (const char *)"PAPER MARIO") || strstr(name, (const char *)"MARIO STORY"))
{
m_hacks = (hacks_t)(m_hacks | CSettings::hack_PMario);
}
else if (strstr(name, (const char *)"TOP GEAR RALLY 2"))
{
m_hacks = (hacks_t)(m_hacks | CSettings::hack_TGR2);
}
else if (strstr(name, (const char *)"TOP GEAR RALLY"))
{
m_hacks = (hacks_t)(m_hacks | CSettings::hack_TGR);
}
else if (strstr(name, (const char *)"Top Gear Hyper Bike"))
{
m_hacks = (hacks_t)(m_hacks | CSettings::hack_Hyperbike);
}
else if (strstr(name, (const char *)"Killer Instinct Gold") || strstr(name, (const char *)"KILLER INSTINCT GOLD"))
{
m_hacks = (hacks_t)(m_hacks | CSettings::hack_KI);
}
else if (strstr(name, (const char *)"Knockout Kings 2000"))
{
m_hacks = (hacks_t)(m_hacks | CSettings::hack_Knockout);
}
else if (strstr(name, (const char *)"LEGORacers"))
{
m_hacks = (hacks_t)(m_hacks | CSettings::hack_Lego);
}
else if (strstr(name, (const char *)"OgreBattle64"))
{
m_hacks = (hacks_t)(m_hacks | CSettings::hack_Ogre64);
}
else if (strstr(name, (const char *)"Pilot Wings64"))
{
m_hacks = (hacks_t)(m_hacks | CSettings::hack_Pilotwings);
}
else if (strstr(name, (const char *)"Supercross"))
{
m_hacks = (hacks_t)(m_hacks | CSettings::hack_Supercross);
}
else if (strstr(name, (const char *)"STARCRAFT 64"))
{
m_hacks = (hacks_t)(m_hacks | CSettings::hack_Starcraft);
}
else if (strstr(name, (const char *)"BANJO KAZOOIE 2") || strstr(name, (const char *)"BANJO TOOIE"))
{
m_hacks = (hacks_t)(m_hacks | CSettings::hack_Banjo2);
}
else if (strstr(name, (const char *)"FIFA: RTWC 98") || strstr(name, (const char *)"RoadToWorldCup98"))
{
m_hacks = (hacks_t)(m_hacks | CSettings::hack_Fifa98);
}
else if (strstr(name, (const char *)"Mega Man 64") || strstr(name, (const char *)"RockMan Dash"))
{
m_hacks = (hacks_t)(m_hacks | CSettings::hack_Megaman);
}
else if (strstr(name, (const char *)"MISCHIEF MAKERS") || strstr(name, (const char *)"TROUBLE MAKERS"))
{
m_hacks = (hacks_t)(m_hacks | CSettings::hack_Makers);
}
else if (strstr(name, (const char *)"GOLDENEYE"))
{
m_hacks = (hacks_t)(m_hacks | CSettings::hack_GoldenEye);
}
else if (strstr(name, (const char *)"PUZZLE LEAGUE"))
{
m_hacks = (hacks_t)(m_hacks | CSettings::hack_PPL);
}
else if (strstr(name, (const char *)"WIN BACK") || strstr(name, (const char *)"OPERATION WINBACK"))
{
m_hacks = (hacks_t)(m_hacks | CSettings::hack_Winback);
}
g_settings->alt_tex_size = GetSetting(Set_alt_tex_size);
g_settings->use_sts1_only = GetSetting(Set_use_sts1_only);
g_settings->force_calc_sphere = GetSetting(Set_force_calc_sphere);
g_settings->correct_viewport = GetSetting(Set_correct_viewport);
g_settings->increase_texrect_edge = GetSetting(Set_increase_texrect_edge);
g_settings->decrease_fillrect_edge = GetSetting(Set_decrease_fillrect_edge);
g_settings->texture_correction = GetSetting(Set_texture_correction) == 0 ? 0 : 1;
g_settings->pal230 = GetSetting(Set_pal230) == 1 ? 1 : 0;
m_stipple_mode = (StippleMode_t)GetSetting(Set_stipple_mode);
int stipple_pattern = GetSetting(Set_stipple_pattern);
g_settings->stipple_pattern = stipple_pattern > 0 ? (uint32_t)stipple_pattern : 0x3E0F83E0;
g_settings->force_microcheck = GetSetting(Set_force_microcheck);
g_settings->force_quad3d = GetSetting(Set_force_quad3d);
g_settings->clip_zmin = GetSetting(Set_clip_zmin);
g_settings->clip_zmax = GetSetting(Set_clip_zmax);
g_settings->fast_crc = GetSetting(Set_fast_crc);
g_settings->adjust_aspect = GetSetting(Set_adjust_aspect);
g_settings->zmode_compare_less = GetSetting(Set_zmode_compare_less);
g_settings->old_style_adither = GetSetting(Set_old_style_adither);
g_settings->n64_z_scale = GetSetting(Set_n64_z_scale);
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);
m_ScreenRes = GetSetting(Set_Resolution);
if (m_ScreenRes >= GetScreenResolutionCount()) { m_ScreenRes = GetDefaultScreenRes(); }
//frame buffer
short fb_Settings[] =
{
g_romopen ? Set_optimize_texrect : Set_optimize_texrect_default,
Set_ignore_aux_copy,
Set_hires_buf_clear,
Set_fb_read_alpha,
Set_useless_is_useless,
g_romopen ? Set_fb_smart : Set_fb_smart_default,
g_romopen ? Set_fb_hires : Set_fb_hires_default,
g_romopen ? Set_fb_read_always : Set_fb_read_always_default,
g_romopen ? Set_detect_cpu_write : Set_detect_cpu_write_default,
g_romopen ? Set_fb_get_info : Set_fb_get_info_default,
g_romopen ? Set_fb_render : Set_fb_render_default
};
fb_bits_t bits[] =
{
fb_optimize_texrect,
fb_ignore_aux_copy,
fb_hwfbe_buf_clear,
fb_read_alpha,
fb_useless_is_useless,
fb_emulation,
fb_hwfbe,
fb_ref,
fb_cpu_write_hack,
fb_get_info,
fb_depth_render
};
uint32_t fb_add_bits = 0, fb_remove_bits = 0;
for (int i = 0; i < (sizeof(fb_Settings) / sizeof(fb_Settings[0])); i++)
{
if (GetSetting(fb_Settings[i]) != 0)
{
fb_add_bits |= bits[i];
}
else
{
fb_remove_bits |= bits[i];
}
}
fb_add_bits |= fb_motionblur;
int read_back_to_screen = GetSetting(g_romopen ? Set_read_back_to_screen : Set_read_back_to_screen_default);
if (read_back_to_screen == 1) { fb_add_bits |= fb_read_back_to_screen; }
else if (read_back_to_screen == 2) { fb_add_bits |= fb_read_back_to_screen2; }
else if (read_back_to_screen == 0) { fb_remove_bits |= fb_read_back_to_screen | fb_read_back_to_screen2; }
g_settings->UpdateFrameBufferBits(fb_add_bits, fb_remove_bits);
m_fb_crc_mode = (FBCRCMODE_t)GetSetting(Set_fb_crc_mode);
SetFiltering((Filtering_t)GetSetting(g_romopen ? Set_filtering : Set_filtering_default));
SetSwapMode((SwapMode_t)GetSetting(g_romopen ? Set_swapmode : Set_swapmode_default));
SetAspectmode((AspectMode_t)GetSetting(g_romopen ? Set_aspect : Set_aspect_default));
SetLODmode((PixelLevelOfDetail_t)GetSetting(g_romopen ? Set_lodmode : Set_lodmode_default));
g_settings->flame_corona = g_settings->hacks(hack_Zelda) && !fb_depth_render_enabled();
}
void CSettings::WriteSettings(void)
{
SetSetting(Set_Resolution, g_settings->m_ScreenRes);
#ifdef _WIN32
SetSetting(Set_FullScreenRes, g_settings->wrpResolution);
#endif
SetSetting(Set_vsync, g_settings->vsync);
SetSetting(Set_Rotate, m_rotate);
SetSetting(Set_texenh_options, g_settings->texenh_options);
SetSetting(Set_wrpVRAM, g_settings->wrpVRAM);
SetSetting(Set_wrpFBO, g_settings->wrpFBO);
SetSetting(Set_wrpAnisotropic, g_settings->wrpAnisotropic);
#ifndef _ENDUSER_RELEASE_
SetSetting(Set_autodetect_ucode, g_settings->autodetect_ucode);
SetSetting(Set_ucode, (int)g_settings->ucode);
SetSetting(Set_wireframe, g_settings->wireframe);
SetSetting(Set_wfmode, g_settings->wfmode);
SetSetting(Set_unk_as_red,g_settings->unk_as_red);
SetSetting(Set_unk_clear, g_settings->unk_clear);
#endif //_ENDUSER_RELEASE_
SetSetting(Set_ghq_fltr, m_ghq_fltr);
SetSetting(Set_ghq_cmpr, g_settings->ghq_cmpr);
SetSetting(Set_ghq_enht, m_ghq_enht);
SetSetting(Set_ghq_hirs, g_settings->ghq_hirs);
SetSetting(Set_ghq_enht_cmpr, g_settings->ghq_enht_cmpr);
SetSetting(Set_ghq_enht_tile, g_settings->ghq_enht_tile);
SetSetting(Set_ghq_enht_f16bpp, g_settings->ghq_enht_f16bpp);
SetSetting(Set_ghq_enht_gz, g_settings->ghq_enht_gz);
SetSetting(Set_ghq_enht_nobg, g_settings->ghq_enht_nobg);
SetSetting(Set_ghq_hirs_cmpr, g_settings->ghq_hirs_cmpr);
SetSetting(Set_ghq_hirs_tile, g_settings->ghq_hirs_tile);
SetSetting(Set_ghq_hirs_f16bpp, g_settings->ghq_hirs_f16bpp);
SetSetting(Set_ghq_hirs_gz, g_settings->ghq_hirs_gz);
SetSetting(Set_ghq_hirs_altcrc, g_settings->ghq_hirs_altcrc);
SetSetting(Set_ghq_cache_save, g_settings->ghq_cache_save);
SetSetting(Set_ghq_cache_size, g_settings->ghq_cache_size);
SetSetting(Set_ghq_hirs_let_texartists_fly, g_settings->ghq_hirs_let_texartists_fly);
SetSetting(Set_ghq_hirs_dump, g_settings->ghq_hirs_dump);
SetSetting(g_romopen ? Set_filtering : Set_filtering_default, filtering());
SetSetting(g_romopen ? Set_fog : Set_fog_default, g_settings->fog);
SetSetting(g_romopen ? Set_buff_clear : Set_buff_clear_default, g_settings->buff_clear);
SetSetting(g_romopen ? Set_swapmode : Set_swapmode_default, g_settings->swapmode());
SetSetting(g_romopen ? Set_lodmode : Set_lodmode_default, lodmode());
SetSetting(g_romopen ? Set_aspect : Set_aspect_default, m_aspectmode);
SetSetting(g_romopen ? Set_fb_read_always : Set_fb_read_always_default, g_settings->fb_ref_enabled() ? true : false);
SetSetting(g_romopen ? Set_fb_smart : Set_fb_smart_default, g_settings->fb_emulation_enabled() ? true : false);
SetSetting(g_romopen ? Set_fb_hires : Set_fb_hires_default, g_settings->fb_hwfbe_set() ? true : false);
SetSetting(g_romopen ? Set_fb_get_info : Set_fb_get_info_default, g_settings->fb_get_info_enabled() ? true : false);
SetSetting(g_romopen ? Set_fb_render : Set_fb_render_default, g_settings->fb_depth_render_enabled() ? true : false);
SetSetting(g_romopen ? Set_detect_cpu_write : Set_detect_cpu_write_default, g_settings->fb_cpu_write_hack_enabled() ? true : false);
if (g_settings->fb_read_back_to_screen_enabled())
{
SetSetting(g_romopen ? Set_read_back_to_screen : Set_read_back_to_screen_default, 1);
}
else if (g_settings->fb_read_back_to_screen2_enabled())
{
SetSetting(g_romopen ? Set_read_back_to_screen : Set_read_back_to_screen_default, 2);
}
else
{
SetSetting(g_romopen ? Set_read_back_to_screen : Set_read_back_to_screen_default, 0);
}
FlushSettings();
}
void CSettings::SettingsChanged(void)
{
m_ScreenRes = GetSetting(Set_Resolution);
}

View File

@ -1,68 +1,203 @@
#pragma once
#include <string>
class CSettings
{
public:
CSettings();
~CSettings();
int card_id;
//Frame buffer emulation options
enum fb_bits_t
{
fb_emulation = (1 << 0), //frame buffer emulation
fb_hwfbe = (1 << 1), //hardware frame buffer emualtion
fb_motionblur = (1 << 2), //emulate motion blur
fb_ref = (1 << 3), //read every frame
fb_read_alpha = (1 << 4), //read alpha
fb_hwfbe_buf_clear = (1 << 5), //clear auxiliary texture frame buffers
fb_depth_render = (1 << 6), //enable software depth render
fb_optimize_texrect = (1 << 7), //fast texrect rendering with hwfbe
fb_ignore_aux_copy = (1 << 8), //do not copy auxiliary frame buffers
fb_useless_is_useless = (1 << 10), //
fb_get_info = (1 << 11), //get frame buffer info
fb_read_back_to_screen = (1 << 12), //render N64 frame buffer to screen
fb_read_back_to_screen2 = (1 << 13), //render N64 frame buffer to screen
fb_cpu_write_hack = (1 << 14), //show images writed directly by CPU
};
enum hacks_t
{
hack_ASB = (1<<0), //All-Star Baseball games
hack_Banjo2 = (1<<1), //Banjo Tooie
hack_BAR = (1<<2), //Beetle Adventure Racing
hack_Chopper = (1<<3), //Chopper Attack
hack_Diddy = (1<<4), //diddy kong racing
hack_Fifa98 = (1<<5), //FIFA - Road to World Cup 98
hack_Fzero = (1<<6), //F-Zero
hack_GoldenEye = (1<<7), //Golden Eye
hack_Hyperbike = (1<<8), //Top Gear Hyper Bike
hack_ISS64 = (1<<9), //International Superstar Soccer 64
hack_KI = (1<<10), //Killer Instinct
hack_Knockout = (1<<11), //Knockout Kings 2000
hack_Lego = (1<<12), //LEGO Racers
hack_MK64 = (1<<13), //Mario Kart
hack_Megaman = (1<<14), //Megaman64
hack_Makers = (1<<15), //Mischief-makers
hack_WCWnitro = (1<<16), //WCW Nitro
hack_Ogre64 = (1<<17), //Ogre Battle 64
hack_Pilotwings = (1<<18), //Pilotwings
hack_PMario = (1<<19), //Paper Mario
hack_PPL = (1<<20), //pokemon puzzle league requires many special fixes
hack_RE2 = (1<<21), //Resident Evil 2
hack_Starcraft = (1<<22), //StarCraft64
hack_Supercross = (1<<23), //Supercross 2000
hack_TGR = (1<<24), //Top Gear Rally
hack_TGR2 = (1<<25), //Top Gear Rally 2
hack_Tonic = (1<<26), //tonic trouble
hack_Winback = (1<<27), //WinBack - Covert Operations
hack_Yoshi = (1<<28), //Yoshi Story
hack_Zelda = (1<<29), //zeldas hacks
hack_OoT = (1<<30), //zelda OoT hacks
};
enum AspectMode_t
{
Aspect_4x3 = 0,
Aspect_16x9 = 1,
Aspect_Stretch = 2,
Aspect_Original = 3,
};
enum ScreenRotate_t
{
Rotate_None = 0,
Rotate_90 = 1,
Rotate_180 = 2,
Rotate_270 = 3,
};
enum Filtering_t
{
Filter_Automatic = 0,
Filter_ForceBilinear = 1,
Filter_ForcePointSampled = 2,
};
enum TextureFilter_t
{
TextureFilter_None = 0x00,
TextureFilter_SmoothFiltering = 0x01,
TextureFilter_SmoothFiltering2 = 0x02,
TextureFilter_SmoothFiltering3 = 0x03,
TextureFilter_SmoothFiltering4 = 0x04,
TextureFilter_SharpFiltering1 = 0x10,
TextureFilter_SharpFiltering2 = 0x20,
};
enum TextureEnhancement_t
{
TextureEnht_None = 0x00,
TextureEnht_X2 = 0x100,
TextureEnht_X2SAI = 0x200,
TextureEnht_HQ2X = 0x300,
TextureEnht_HQ2XS = 0x600,
TextureEnht_LQ2X = 0x400,
TextureEnht_LQ2XS = 0x700,
TextureEnht_HQ4X = 0x500,
};
enum SwapMode_t
{
SwapMode_Old = 0,
SwapMode_New = 1,
SwapMode_Hybrid = 2,
};
enum PixelLevelOfDetail_t
{
LOD_Off = 0,
LOD_Fast = 1,
LOD_Precise = 2,
};
enum StippleMode_t
{
STIPPLE_Disable = 0x0,
STIPPLE_Pattern = 0x1,
STIPPLE_Rotate = 0x2,
};
enum ucode_t
{
uCode_NotFound = -2,
uCode_Unsupported = -1,
ucode_Fast3D = 0,
ucode_F3DEX = 1,
ucode_F3DEX2 = 2,
ucode_WaveRace = 3,
ucode_StarWars = 4,
ucode_DiddyKong = 5,
ucode_S2DEX = 6,
ucode_PerfectDark = 7,
ucode_CBFD = 8,
ucode_zSort = 9,
ucode_Turbo3d = 21,
};
uint32_t res_x, scr_res_x;
uint32_t res_y, scr_res_y;
#ifndef ANDROID
uint32_t res_data, res_data_org;
#endif
int advanced_options;
int texenh_options;
int ssformat;
int vsync;
int clock;
int clock_24_hr;
int rotate;
int filtering;
int fog;
int buff_clear;
int swapmode;
int lodmode;
int aspectmode;
int use_hotkeys;
//Frame buffer emulation options
#define fb_emulation (1<<0) //frame buffer emulation
#define fb_hwfbe (1<<1) //hardware frame buffer emualtion
#define fb_motionblur (1<<2) //emulate motion blur
#define fb_ref (1<<3) //read every frame
#define fb_read_alpha (1<<4) //read alpha
#define fb_hwfbe_buf_clear (1<<5) //clear auxiliary texture frame buffers
#define fb_depth_render (1<<6) //enable software depth render
#define fb_optimize_texrect (1<<7) //fast texrect rendering with hwfbe
#define fb_ignore_aux_copy (1<<8) //do not copy auxiliary frame buffers
#define fb_useless_is_useless (1<<10) //
#define fb_get_info (1<<11) //get frame buffer info
#define fb_read_back_to_screen (1<<12) //render N64 frame buffer to screen
#define fb_read_back_to_screen2 (1<<13) //render N64 frame buffer to screen
#define fb_cpu_write_hack (1<<14) //show images writed directly by CPU
#define fb_emulation_enabled ((g_settings->frame_buffer&fb_emulation)>0)
#define fb_hwfbe_enabled ((g_settings->frame_buffer&(fb_emulation|fb_hwfbe))==(fb_emulation|fb_hwfbe))
#define fb_depth_render_enabled ((g_settings->frame_buffer&fb_depth_render)>0)
uint32_t frame_buffer;
enum FBCRCMODE
{
enum FBCRCMODE_t
{
fbcrcNone = 0,
fbcrcFast = 1,
fbcrcSafe = 2
} fb_crc_mode;
};
inline bool fb_emulation_enabled(void) const { return ((m_frame_buffer&fb_emulation) != 0); }
inline bool fb_ref_enabled(void) const { return ((m_frame_buffer&fb_ref) != 0); }
inline bool fb_hwfbe_enabled(void) const { return ((m_frame_buffer&(fb_emulation |fb_hwfbe)) == (fb_emulation | fb_hwfbe)); }
inline bool fb_hwfbe_set(void) const { return ((m_frame_buffer&fb_hwfbe) != 0); }
inline bool fb_depth_render_enabled(void) const { return ((m_frame_buffer&fb_depth_render) != 0); }
inline bool fb_get_info_enabled(void) const { return ((m_frame_buffer&fb_get_info) != 0); }
inline bool fb_read_back_to_screen_enabled(void) const { return ((m_frame_buffer&fb_read_back_to_screen) != 0); }
inline bool fb_read_back_to_screen2_enabled(void) const { return ((m_frame_buffer&fb_read_back_to_screen2) != 0); }
inline bool fb_cpu_write_hack_enabled(void) const { return ((m_frame_buffer&fb_cpu_write_hack) != 0); }
inline bool fb_ignore_aux_copy_enabled(void) const { return ((m_frame_buffer&fb_ignore_aux_copy) != 0); }
inline bool fb_hwfbe_buf_clear_enabled(void) const { return ((m_frame_buffer&fb_hwfbe_buf_clear) != 0); }
inline bool fb_useless_is_useless_enabled(void) const { return ((m_frame_buffer&fb_useless_is_useless) != 0); }
inline bool fb_motionblur_enabled(void) const { return ((m_frame_buffer&fb_motionblur) != 0); }
inline bool fb_read_alpha_enabled(void) const { return ((m_frame_buffer&fb_read_alpha) != 0); }
inline bool fb_optimize_texrect_enabled(void) const { return ((m_frame_buffer&fb_optimize_texrect) != 0); }
inline const char * log_dir(void) const { return m_log_dir; }
inline uint32_t res_x(void) const { return m_res_x; }
inline uint32_t res_y(void) const { return m_res_y; }
inline uint32_t scr_res_x(void) const { return m_scr_res_x; }
inline uint32_t scr_res_y(void) const { return m_scr_res_y; }
inline uint32_t ScreenRes(void) const { return m_ScreenRes; }
inline bool FlushLogs(void) const { return m_FlushLogs; }
inline ScreenRotate_t rotate(void) const { return m_rotate; }
inline Filtering_t filtering(void) const { return m_filtering; }
inline SwapMode_t swapmode(void) const { return m_swapmode; }
inline PixelLevelOfDetail_t lodmode(void) const { return m_lodmode; }
inline AspectMode_t aspectmode(void) const { return m_aspectmode; }
inline FBCRCMODE_t fb_crc_mode(void) const { return m_fb_crc_mode; }
#ifdef TEXTURE_FILTER
//Texture filtering options
std::string texture_dir;
int ghq_fltr;
int ghq_enht;
inline TextureFilter_t ghq_fltr(void) const { return m_ghq_fltr; }
inline TextureEnhancement_t ghq_enht(void) const { return m_ghq_enht; }
int ghq_cmpr;
int ghq_hirs;
int ghq_use;
@ -80,18 +215,11 @@ public:
int ghq_cache_size;
int ghq_hirs_let_texartists_fly;
int ghq_hirs_dump;
#endif
//Debug
int autodetect_ucode;
int ucode;
int logging;
int elogging;
int log_clear;
int run_in_window;
int filter_cache;
inline ucode_t ucode(void) const { return m_ucode; }
int unk_as_red;
int log_unk;
int unk_clear;
int wireframe;
int wfmode;
@ -106,7 +234,7 @@ public:
int increase_texrect_edge; // add 1 to lower right corner coordinates of texrect
int decrease_fillrect_edge; // sub 1 from lower right corner coordinates of fillrect
int texture_correction; // enable perspective texture correction emulation. is on by default
int stipple_mode; //used for dithered alpha emulation
inline StippleMode_t stipple_mode(void) const { return m_stipple_mode; } //used for dithered alpha emulation
uint32_t stipple_pattern; //used for dithered alpha emulation
int force_microcheck; //check microcode each frame, for mixed F3DEX-S2DEX games
int force_quad3d; //force 0xb5 command to be quad, not line 3d
@ -119,41 +247,9 @@ public:
int zmode_compare_less; //force GR_CMP_LESS for zmode=0 (opaque)and zmode=1 (interpenetrating)
int old_style_adither; //apply alpha dither regardless of alpha_dither_mode
int n64_z_scale; //scale vertex z value before writing to depth buffer, as N64 does.
//Special game hacks
#define hack_ASB (1<<0) //All-Star Baseball games
#define hack_Banjo2 (1<<1) //Banjo Tooie
#define hack_BAR (1<<2) //Beetle Adventure Racing
#define hack_Chopper (1<<3) //Chopper Attack
#define hack_Diddy (1<<4) //diddy kong racing
#define hack_Fifa98 (1<<5) //FIFA - Road to World Cup 98
#define hack_Fzero (1<<6) //F-Zero
#define hack_GoldenEye (1<<7) //Golden Eye
#define hack_Hyperbike (1<<8) //Top Gear Hyper Bike
#define hack_ISS64 (1<<9) //International Superstar Soccer 64
#define hack_KI (1<<10) //Killer Instinct
#define hack_Knockout (1<<11) //Knockout Kings 2000
#define hack_Lego (1<<12) //LEGO Racers
#define hack_MK64 (1<<13) //Mario Kart
#define hack_Megaman (1<<14) //Megaman64
#define hack_Makers (1<<15) //Mischief-makers
#define hack_WCWnitro (1<<16) //WCW Nitro
#define hack_Ogre64 (1<<17) //Ogre Battle 64
#define hack_Pilotwings (1<<18) //Pilotwings
#define hack_PMario (1<<19) //Paper Mario
#define hack_PPL (1<<20) //pokemon puzzle league requires many special fixes
#define hack_RE2 (1<<21) //Resident Evil 2
#define hack_Starcraft (1<<22) //StarCraft64
#define hack_Supercross (1<<23) //Supercross 2000
#define hack_TGR (1<<24) //Top Gear Rally
#define hack_TGR2 (1<<25) //Top Gear Rally 2
#define hack_Tonic (1<<26) //tonic trouble
#define hack_Winback (1<<27) //WinBack - Covert Operations
#define hack_Yoshi (1<<28) //Yoshi Story
#define hack_Zelda (1<<29) //zeldas hacks
#define hack_OoT (1<<30) //zelda OoT hacks
uint32_t hacks;
inline bool hacks(hacks_t hack) const { return (m_hacks & hack) == hack; } //Special game hacks
//wrapper settings
#ifndef ANDROID
int wrpResolution;
@ -161,6 +257,50 @@ public:
int wrpVRAM;
int wrpFBO;
int wrpAnisotropic;
void SetScreenRes(uint32_t value);
void SetAspectmode(AspectMode_t value);
void SetLODmode(PixelLevelOfDetail_t value);
void SetFiltering(Filtering_t value);
void SetSwapMode(SwapMode_t value);
void SetGhqFltr(TextureFilter_t value);
void SetGhqEnht(TextureEnhancement_t value);
void UpdateFrameBufferBits(uint32_t BitsToAdd, uint32_t BitsToRemove);
ucode_t DetectUCode(uint32_t uc_crc);
void SetUcode(ucode_t value);
void ReadGameSettings(const char * name);
void WriteSettings(void);
void UpdateAspectRatio(void);
void UpdateScreenSize(bool fullscreen);
private:
void ReadSettings();
void RegisterSettings(void);
void SettingsChanged(void);
static void stSettingsChanged(void * _this)
{
((CSettings *)_this)->SettingsChanged();
}
bool m_dirty;
bool m_FlushLogs;
char m_log_dir[260];
uint32_t m_ScreenRes;
uint32_t m_res_x, m_scr_res_x;
uint32_t m_res_y, m_scr_res_y;
AspectMode_t m_aspectmode;
uint32_t m_frame_buffer;
FBCRCMODE_t m_fb_crc_mode;
ScreenRotate_t m_rotate;
Filtering_t m_filtering;
SwapMode_t m_swapmode;
PixelLevelOfDetail_t m_lodmode;
TextureFilter_t m_ghq_fltr;
TextureEnhancement_t m_ghq_enht;
ucode_t m_ucode;
StippleMode_t m_stipple_mode;
hacks_t m_hacks;
};
extern CSettings * g_settings;

View File

@ -0,0 +1,49 @@
/****************************************************************************
* *
* 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 *
* *
****************************************************************************/
#pragma once
enum
{
// 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,
#ifdef _WIN32
Set_FullScreenRes,
#endif
};

View File

@ -57,7 +57,7 @@ static TBUFF_COLOR_IMAGE * AllocateTextureBuffer(COLOR_IMAGE & cimage)
texbuf.height = cimage.height;
texbuf.format = cimage.format;
texbuf.size = cimage.size;
texbuf.scr_width = minval(cimage.width * rdp.scale_x, g_settings->scr_res_x);
texbuf.scr_width = minval(cimage.width * rdp.scale_x, g_settings->scr_res_x());
float height = minval(rdp.vi_height, cimage.height);
if (cimage.status == ci_copy_self || (cimage.status == ci_copy && cimage.width == rdp.frame_buffers[rdp.main_ci_index].width))
height = rdp.vi_height;
@ -216,7 +216,7 @@ int OpenTextureBuffer(COLOR_IMAGE & cimage)
int found = FALSE, search = TRUE;
TBUFF_COLOR_IMAGE *texbuf = 0;
uint32_t addr = cimage.addr;
if ((g_settings->hacks&hack_Banjo2) && cimage.status == ci_copy_self)
if (g_settings->hacks(CSettings::hack_Banjo2) && cimage.status == ci_copy_self)
addr = rdp.frame_buffers[rdp.copy_ci_index].addr;
uint32_t end_addr = addr + ((cimage.width*cimage.height) << cimage.size >> 1);
if (rdp.motionblur)
@ -227,7 +227,7 @@ int OpenTextureBuffer(COLOR_IMAGE & cimage)
}
if (rdp.read_whole_frame)
{
if (g_settings->hacks&hack_PMario) //motion blur effects in Paper Mario
if (g_settings->hacks(CSettings::hack_PMario)) //motion blur effects in Paper Mario
{
rdp.cur_tex_buf = rdp.acc_tex_buf;
WriteTrace(TraceRDP, TraceDebug, "\nread_whole_frame. last allocated bank: %d", rdp.acc_tex_buf);
@ -326,8 +326,8 @@ int OpenTextureBuffer(COLOR_IMAGE & cimage)
grRenderBuffer(GR_BUFFER_TEXTUREBUFFER_EXT);
grTextureBufferExt(rdp.cur_image->tmu, rdp.cur_image->tex_addr, rdp.cur_image->info.smallLodLog2, rdp.cur_image->info.largeLodLog2,
rdp.cur_image->info.aspectRatioLog2, rdp.cur_image->info.format, GR_MIPMAPLEVELMASK_BOTH);
///*
if (rdp.cur_image->clear && (g_settings->frame_buffer&fb_hwfbe_buf_clear) && cimage.changed)
if (rdp.cur_image->clear && g_settings->fb_hwfbe_buf_clear_enabled() && cimage.changed)
{
rdp.cur_image->clear = FALSE;
grDepthMask(FXFALSE);
@ -369,7 +369,7 @@ static GrTextureFormat_t TexBufSetupCombiner(int force_rgb = FALSE)
GR_BLEND_ZERO,
GR_BLEND_ONE,
GR_BLEND_ZERO);
grClipWindow(0, 0, g_settings->scr_res_x, g_settings->scr_res_y);
grClipWindow(0, 0, g_settings->scr_res_x(), g_settings->scr_res_y());
grDepthBufferFunction(GR_CMP_ALWAYS);
grDepthMask(FXFALSE);
grCullMode(GR_CULL_DISABLE);
@ -457,7 +457,7 @@ int CloseTextureBuffer(int draw)
};
grTexSource(rdp.tbuff_tex->tmu, rdp.tbuff_tex->tex_addr, GR_MIPMAPLEVELMASK_BOTH, &(rdp.tbuff_tex->info));
grClipWindow(0, 0, g_settings->res_x, g_settings->res_y);
grClipWindow(0, 0, g_settings->res_x(), g_settings->res_y());
grDrawTriangle(&v[0], &v[2], &v[1]);
grDrawTriangle(&v[2], &v[3], &v[1]);
rdp.update |= UPDATE_ZBUF_ENABLED | UPDATE_COMBINE | UPDATE_TEXTURE | UPDATE_ALPHA_COMPARE;
@ -519,7 +519,7 @@ int CopyTextureBuffer(COLOR_IMAGE & fb_from, COLOR_IMAGE & fb_to)
rdp.offset_y = rdp.offset_y_bak;
rdp.offset_x_bak = rdp.offset_y_bak = 0;
AddOffset(v, 4);
grClipWindow(0, 0, g_settings->res_x, g_settings->res_y);
grClipWindow(0, 0, g_settings->res_x(), g_settings->res_y());
grDrawTriangle(&v[0], &v[2], &v[1]);
grDrawTriangle(&v[2], &v[3], &v[1]);
rdp.tbuff_tex->info.format = buf_format;
@ -539,7 +539,7 @@ int CopyDepthBuffer()
WriteTrace(TraceRDP, TraceDebug, "CopyDepthBuffer. ");
float bound = 1024.0f;
GrLOD_t LOD = GR_LOD_LOG2_1024;
if (g_settings->scr_res_x > 1024)
if (g_settings->scr_res_x() > 1024)
{
bound = 2048.0f;
LOD = GR_LOD_LOG2_2048;
@ -665,11 +665,15 @@ int SwapTextureBuffer()
static uint32_t CalcCRC(TBUFF_COLOR_IMAGE * pTCI)
{
uint32_t result = 0;
if ((g_settings->frame_buffer&fb_ref) > 0)
if (g_settings->fb_ref_enabled())
{
pTCI->crc = 0; //Since fb content changes each frame, crc check is meaningless.
else if (g_settings->fb_crc_mode == CSettings::fbcrcFast)
}
else if (g_settings->fb_crc_mode() == CSettings::fbcrcFast)
{
result = *((uint32_t*)(gfx.RDRAM + pTCI->addr + (pTCI->end_addr - pTCI->addr) / 2));
else if (g_settings->fb_crc_mode == CSettings::fbcrcSafe)
}
else if (g_settings->fb_crc_mode() == CSettings::fbcrcSafe)
{
uint8_t * pSrc = gfx.RDRAM + pTCI->addr;
const uint32_t nSize = pTCI->end_addr - pTCI->addr;

View File

@ -59,11 +59,9 @@ uint8_t *texture_buffer = tex1;
#include "TexMod.h"
#include "TexModCI.h"
#include "CRC.h"
#ifdef TEXTURE_FILTER // Hiroshi Morii <koolsmoky@users.sourceforge.net>
extern int ghq_dmptex_toggle_key;
#endif
typedef struct TEXINFO_t {
typedef struct TEXINFO_t
{
int real_image_width, real_image_height; // FOR ALIGNMENT PURPOSES ONLY!!!
int tile_width, tile_height;
int mask_width, mask_height;
@ -72,21 +70,18 @@ typedef struct TEXINFO_t {
uint32_t crc;
uint32_t flags;
int splits, splitheight;
#ifdef TEXTURE_FILTER
uint64 ricecrc;
#endif
} TEXINFO;
TEXINFO texinfo[2];
int tex_found[2][MAX_TMU];
#ifdef TEXTURE_FILTER
typedef struct HIRESTEX_t {
typedef struct HIRESTEX_t
{
int width, height;
uint16_t format;
uint8_t *data;
} HIRESTEX;
#endif
//****************************************************************
// List functions
@ -527,28 +522,6 @@ void TexCache()
{
WriteTrace(TraceRDP, TraceDebug, " |-+ TexCache called");
#ifdef TEXTURE_FILTER /* Hiroshi Morii <koolsmoky@users.sourceforge.net> */ // POSTNAPALM
if (g_settings->ghq_use && g_settings->ghq_hirs_dump) {
/* Force reload hi-res textures. Useful for texture artists */
if (CheckKeyPressed(G64_VK_R, 0x0001)) {
if (ext_ghq_reloadhirestex()) ClearCache();
}
/* Turn on texture dump */
else if (CheckKeyPressed(G64_VK_D, 0x0001)) {
extern void DisplayLoadProgress(const wchar_t *format, ...);
ghq_dmptex_toggle_key = !ghq_dmptex_toggle_key;
if (ghq_dmptex_toggle_key) {
DisplayLoadProgress(L"Texture dump - ON");
ClearCache();
}
else {
DisplayLoadProgress(L"Texture dump - OFF");
}
pjutil::Sleep(1000);
}
}
#endif
if (rdp.tex & 1)
GetTexInfo(0, rdp.cur_tile);
if (rdp.tex & 2)
@ -894,14 +867,14 @@ void TexCache()
int tile = rdp.cur_tile + i;
if (g_settings->filtering == 0)
if (g_settings->filtering() == CSettings::Filter_Automatic)
{
int filter = (rdp.filter_mode != 2) ? GR_TEXTUREFILTER_POINT_SAMPLED : GR_TEXTUREFILTER_BILINEAR;
grTexFilterMode(tmu, filter, filter);
}
else
{
int filter = (g_settings->filtering == 1) ? GR_TEXTUREFILTER_BILINEAR : GR_TEXTUREFILTER_POINT_SAMPLED;
int filter = (g_settings->filtering() == CSettings::Filter_ForceBilinear) ? GR_TEXTUREFILTER_BILINEAR : GR_TEXTUREFILTER_POINT_SAMPLED;
grTexFilterMode(tmu, filter, filter);
}
@ -962,7 +935,6 @@ void TexCache()
WriteTrace(TraceRDP, TraceDebug, " | +- TexCache End");
}
#ifdef TEXTURE_FILTER
/** cite from RiceVideo */
inline uint32_t CalculateDXT(uint32_t txl2words)
{
@ -996,7 +968,6 @@ inline uint32_t ReverseDXT(uint32_t val, uint32_t /*lrs*/, uint32_t width, uint3
return (low + high) / 2;
}
/** end RiceVideo cite */
#endif
//****************************************************************
// LoadTex - does the actual texture loading after everything is prepared
@ -1029,7 +1000,7 @@ void LoadTex(int id, int tmu)
//!Hackalert
//GoldenEye water texture. It has CI format in fact, but the game set it to RGBA
if ((g_settings->hacks&hack_GoldenEye) && rdp.tiles[td].format == 0 && rdp.tlut_mode == 2 && rdp.tiles[td].size == 2)
if (g_settings->hacks(CSettings::hack_GoldenEye) && rdp.tiles[td].format == 0 && rdp.tlut_mode == 2 && rdp.tiles[td].size == 2)
{
rdp.tiles[td].format = 2;
rdp.tiles[td].size = 1;
@ -1054,10 +1025,8 @@ void LoadTex(int id, int tmu)
cache->f_mirror_t = FALSE;
cache->f_wrap_s = FALSE;
cache->f_wrap_t = FALSE;
#ifdef TEXTURE_FILTER
cache->is_hires_tex = FALSE;
cache->ricecrc = texinfo[id].ricecrc;
#endif
// Add this cache to the list
AddToList(&cachelut[cache->crc >> 16], cache->crc, uintptr_t(cache), tmu, rdp.n_cached[tmu]);
@ -1283,7 +1252,6 @@ void LoadTex(int id, int tmu)
// when we get passed the texture ram cache and texture buffers for
// minimal calculation overhead.
//
#ifdef TEXTURE_FILTER // Hiroshi Morii <koolsmoky@users.sourceforge.net>
GHQTexInfo ghqTexInfo;
memset(&ghqTexInfo, 0, sizeof(GHQTexInfo));
uint32_t g64_crc = cache->crc;
@ -1359,7 +1327,6 @@ void LoadTex(int id, int tmu)
if (ghqTexInfo.data)
;//do nothing
else
#endif
if (splits > 1)
{
cache->scale_y = 0.125f;
@ -1491,11 +1458,7 @@ void LoadTex(int id, int tmu)
memcpy(rdp.pal_8, tmp_pal, 512);
}
#ifdef TEXTURE_FILTER
if (mod && !modifyPalette && !ghqTexInfo.data)
#else
if (mod && !modifyPalette)
#endif
{
// Convert the texture to ARGB 4444
if (LOWORD(result) == GR_TEXFMT_ARGB_1555)
@ -1616,44 +1579,8 @@ void LoadTex(int id, int tmu)
if (GfxInitDone)
{
#ifdef TEXTURE_FILTER // Hiroshi Morii <koolsmoky@users.sourceforge.net>
if (g_settings->ghq_use)
{
if (!ghqTexInfo.data && ghq_dmptex_toggle_key) {
unsigned char *tmpbuf = (unsigned char*)texture;
int tmpwidth = real_x;
if (texinfo[id].splits > 1) {
int dstpixoffset, srcpixoffset;
int shift;
switch (LOWORD(result) & 0x7fff) { // XXX is there a better way of determining the pixel color depth?
case GR_TEXFMT_ARGB_8888:
shift = 3;
break;
case GR_TEXFMT_ALPHA_INTENSITY_44:
case GR_TEXFMT_ALPHA_8:
shift = 0;
break;
default:
shift = 1;
}
tmpwidth = texinfo[id].real_image_width;
tmpbuf = (unsigned char*)malloc((256 * 256) << 3); // XXX performance overhead
for (int i = 0; i < cache->splitheight; i++) {
dstpixoffset = texinfo[id].real_image_width * i;
srcpixoffset = 256 * i;
for (int k = 0; k < texinfo[id].splits; k++) {
memcpy(tmpbuf + (dstpixoffset << shift), texture + (srcpixoffset << shift), (256 << shift));
dstpixoffset += 256;
srcpixoffset += (256 * cache->splitheight);
}
}
}
ext_ghq_dmptx(tmpbuf, (int)texinfo[id].real_image_width, (int)texinfo[id].real_image_height, (int)tmpwidth, (unsigned short)LOWORD(result), (unsigned short)((cache->format << 8) | (cache->size)), cache->ricecrc);
if (tmpbuf != texture && tmpbuf) {
free(tmpbuf);
}
}
if (!ghqTexInfo.data)
if (!g_settings->ghq_enht_nobg || !rdp.texrecting || (texinfo[id].splits == 1 && texinfo[id].width <= 256))
ext_ghq_txfilter((unsigned char*)texture, (int)real_x, (int)real_y, LOWORD(result), (uint64)g64_crc, &ghqTexInfo);
@ -1713,17 +1640,6 @@ void LoadTex(int id, int tmu)
cache->c_scl_y *= mscale;
cache->c_scl_x *= mscale;
}
/*
else
{
if (rdp.tiles[td].mirror_s && sup_mirroring)
cache->f_mirror_s = TRUE;
if (rdp.tiles[td].mirror_t && sup_mirroring)
cache->f_mirror_t = TRUE;
//cache->c_scl_y /= mscale;
//cache->c_scl_x /= mscale;
}
*/
if (ghqTexInfo.aspectRatioLog2 >= 0)
{
cache->scale_x = 1.0f;
@ -1763,7 +1679,6 @@ void LoadTex(int id, int tmu)
}
else
{
//cache->scale = 256.0f / float(1<<lod);
cache->c_off = 128.0f / float(1 << lod);
}
real_x = ghqTexInfo.width;
@ -1775,7 +1690,6 @@ void LoadTex(int id, int tmu)
}
}
}
#endif
// Load the texture into texture memory
GrTexInfo *t_info = &cache->t_info;

View File

@ -289,7 +289,7 @@ VERTEX **org_vtx;
void draw_tri(VERTEX **vtx, uint16_t linew)
{
deltaZ = dzdx = 0;
if (linew == 0 && (fb_depth_render_enabled || (rdp.rm & 0xC00) == 0xC00))
if (linew == 0 && (g_settings->fb_depth_render_enabled() || (rdp.rm & 0xC00) == 0xC00))
{
double X0 = vtx[0]->sx / rdp.scale_x;
double Y0 = vtx[0]->sy / rdp.scale_y;
@ -308,12 +308,15 @@ void draw_tri(VERTEX **vtx, uint16_t linew)
double diffz_02 = vtx[0]->sz - vtx[2]->sz;
double diffz_12 = vtx[1]->sz - vtx[2]->sz;
double fdzdx = (diffz_02 * diffy_12 - diffz_12 * diffy_02) / denom;
if ((rdp.rm & 0xC00) == 0xC00) {
if ((rdp.rm & 0xC00) == 0xC00)
{
// Calculate deltaZ per polygon for Decal z-mode
double fdzdy = (diffz_02 * diffx_12 - diffz_12 * diffx_02) / denom;
double fdz = fabs(fdzdx) + fabs(fdzdy);
if ((g_settings->hacks & hack_Zelda) && (rdp.rm & 0x800))
if (g_settings->hacks(CSettings::hack_Zelda) && (rdp.rm & 0x800))
{
fdz *= 4.0; // Decal mode in Zelda sometimes needs mutiplied deltaZ to work correct, e.g. roads
}
deltaZ = maxval(8, (int)fdz);
}
dzdx = (int)(fdzdx * 65536.0);
@ -398,7 +401,7 @@ void draw_tri(VERTEX **vtx, uint16_t linew)
{
if (rdp.aTBuffTex[0]->tile_uls != (int)rdp.tiles[rdp.cur_tile].f_ul_s)
v->u0 -= rdp.tiles[rdp.cur_tile].f_ul_s;
if (rdp.aTBuffTex[0]->tile_ult != (int)rdp.tiles[rdp.cur_tile].f_ul_t || (g_settings->hacks&hack_Megaman))
if (rdp.aTBuffTex[0]->tile_ult != (int)rdp.tiles[rdp.cur_tile].f_ul_t || g_settings->hacks(CSettings::hack_Megaman))
v->v0 -= rdp.tiles[rdp.cur_tile].f_ul_t; //required for megaman (boss special attack)
v->u0 *= rdp.aTBuffTex[0]->u_scale;
v->v0 *= rdp.aTBuffTex[0]->v_scale;
@ -800,9 +803,13 @@ void do_triangle_stuff(uint16_t linew, int old_interpolate) // what else?? do th
else
{
if (!g_settings->clip_zmin)
{
rdp.clip &= ~CLIP_ZMIN;
}
if (!g_settings->clip_zmax)
{
rdp.clip &= ~CLIP_ZMAX;
}
}
render_tri(linew, old_interpolate);
}
@ -964,7 +971,7 @@ static void CalculateLOD(VERTEX *v, int n)
double intptr;
float s_scale = rdp.tiles[rdp.cur_tile].width / 255.0f;
float t_scale = rdp.tiles[rdp.cur_tile].height / 255.0f;
if (g_settings->lodmode == 1)
if (g_settings->lodmode() == CSettings::LOD_Fast)
{
deltaS = (v[1].u0 / v[1].q - v[0].u0 / v[0].q) * s_scale;
deltaT = (v[1].v0 / v[1].q - v[0].v0 / v[0].q) * t_scale;
@ -1033,7 +1040,7 @@ float ScaleZ(float z)
static void DepthBuffer(VERTEX * vtx, int n)
{
if (fb_depth_render_enabled && !(g_settings->hacks&hack_RE2) && dzdx && (rdp.flags & ZBUF_UPDATE))
if (g_settings->fb_depth_render_enabled() && !g_settings->hacks(CSettings::hack_RE2) && dzdx && (rdp.flags & ZBUF_UPDATE))
{
vertexi v[12];
if (u_cull_mode == 1) //cull front
@ -1562,20 +1569,13 @@ static void render_tri(uint16_t linew, int old_interpolate)
}
}
if (g_settings->lodmode > 0 && rdp.cur_tile < rdp.mipmap_level)
if (g_settings->lodmode() != CSettings::LOD_Off && rdp.cur_tile < rdp.mipmap_level)
{
CalculateLOD(rdp.vtxbuf, n);
}
cmb.cmb_ext_use = cmb.tex_cmb_ext_use = 0;
/*
if (rdp.tbuff_tex)
{
for (int k = 0; k < 3; k++)
{
WriteTrace(TraceRDP, TraceDebug, "v%d %f->%f, width: %d. height: %d, tex_width: %d, tex_height: %d, lr_u: %f, lr_v: %f", k, vv0[k], pv[k]->v1, rdp.tbuff_tex->width, rdp.tbuff_tex->height, rdp.tbuff_tex->tex_width, rdp.tbuff_tex->tex_height, rdp.tbuff_tex->lr_u, rdp.tbuff_tex->lr_v);
}
}
*/
if (g_settings->wireframe)
{
SetWireframeCol();
@ -1588,11 +1588,6 @@ static void render_tri(uint16_t linew, int old_interpolate)
}
else
{
// VERTEX ** pv = rdp.vtx_buffer?(vtx_list2):(vtx_list1);
// for (int k = 0; k < n; k ++)
// WriteTrace(TraceRDP, TraceDebug, "DRAW[%d]: v.x = %f, v.y = %f, v.z = %f, v.u = %f, v.v = %f", k, pv[k]->x, pv[k]->y, pv[k]->z, pv[k]->coord[rdp.t0<<1], pv[k]->coord[(rdp.t0<<1)+1]);
// pv[k]->y = g_settings->res_y - pv[k]->y;
if (linew > 0)
{
VERTEX *V0 = &rdp.vtxbuf[0];
@ -1652,83 +1647,6 @@ static void render_tri(uint16_t linew, int old_interpolate)
grDrawVertexArray(GR_TRIANGLE_FAN, n, rdp.vtx_buffer ? (&vtx_list2) : (&vtx_list1));
}
}
if (_debugger.capture) add_tri(rdp.vtxbuf, n, TRI_TRIANGLE);
}
void add_tri(VERTEX *v, int n, int type)
{
//WriteTrace(TraceRDP, TraceDebug, "ENTER (%f, %f, %f), (%f, %f, %f), (%f, %f, %f)", v[0].x, v[0].y, v[0].w,
// v[1].x, v[1].y, v[1].w, v[2].x, v[2].y, v[2].w);
// Debug capture
if (_debugger.capture)
{
rdp.debug_n++;
TRI_INFO *info = new TRI_INFO;
info->nv = n;
info->v = new VERTEX[n];
memcpy(info->v, v, sizeof(VERTEX)*n);
info->cycle_mode = rdp.cycle_mode;
info->cycle1 = rdp.cycle1;
info->cycle2 = rdp.cycle2;
info->uncombined = rdp.uncombined;
info->geom_mode = rdp.geom_mode;
info->othermode_h = rdp.othermode_h;
info->othermode_l = rdp.othermode_l;
info->tri_n = rdp.tri_n;
info->type = type;
for (int i = 0; i < 2; i++)
{
int j = rdp.cur_tile + i;
if (i == 0)
info->t[i].tmu = rdp.t0;
else
info->t[i].tmu = rdp.t1;
info->t[i].cur_cache[0] = rdp.cur_cache_n[rdp.t0];
info->t[i].cur_cache[1] = rdp.cur_cache_n[rdp.t1];
info->t[i].format = rdp.tiles[j].format;
info->t[i].size = rdp.tiles[j].size;
info->t[i].width = rdp.tiles[j].width;
info->t[i].height = rdp.tiles[j].height;
info->t[i].line = rdp.tiles[j].line;
info->t[i].palette = rdp.tiles[j].palette;
info->t[i].clamp_s = rdp.tiles[j].clamp_s;
info->t[i].clamp_t = rdp.tiles[j].clamp_t;
info->t[i].mirror_s = rdp.tiles[j].mirror_s;
info->t[i].mirror_t = rdp.tiles[j].mirror_t;
info->t[i].shift_s = rdp.tiles[j].shift_s;
info->t[i].shift_t = rdp.tiles[j].shift_t;
info->t[i].mask_s = rdp.tiles[j].mask_s;
info->t[i].mask_t = rdp.tiles[j].mask_t;
info->t[i].ul_s = rdp.tiles[j].ul_s;
info->t[i].ul_t = rdp.tiles[j].ul_t;
info->t[i].lr_s = rdp.tiles[j].lr_s;
info->t[i].lr_t = rdp.tiles[j].lr_t;
info->t[i].t_ul_s = rdp.tiles[7].t_ul_s;
info->t[i].t_ul_t = rdp.tiles[7].t_ul_t;
info->t[i].t_lr_s = rdp.tiles[7].t_lr_s;
info->t[i].t_lr_t = rdp.tiles[7].t_lr_t;
info->t[i].scale_s = rdp.tiles[j].s_scale;
info->t[i].scale_t = rdp.tiles[j].t_scale;
}
info->fog_color = rdp.fog_color;
info->fill_color = rdp.fill_color;
info->prim_color = rdp.prim_color;
info->blend_color = rdp.blend_color;
info->env_color = rdp.env_color;
info->prim_lodmin = rdp.prim_lodmin;
info->prim_lodfrac = rdp.prim_lodfrac;
info->pNext = _debugger.tri_list;
_debugger.tri_list = info;
if (_debugger.tri_last == NULL)
_debugger.tri_last = _debugger.tri_list;
}
}
void update_scissor()
@ -1738,10 +1656,10 @@ void update_scissor()
rdp.update ^= UPDATE_SCISSOR;
// KILL the floating point error with 0.01f
rdp.scissor.ul_x = (uint32_t)maxval(minval((rdp.scissor_o.ul_x * rdp.scale_x + rdp.offset_x + 0.01f), g_settings->res_x), 0);
rdp.scissor.lr_x = (uint32_t)maxval(minval((rdp.scissor_o.lr_x * rdp.scale_x + rdp.offset_x + 0.01f), g_settings->res_x), 0);
rdp.scissor.ul_y = (uint32_t)maxval(minval((rdp.scissor_o.ul_y * rdp.scale_y + rdp.offset_y + 0.01f), g_settings->res_y), 0);
rdp.scissor.lr_y = (uint32_t)maxval(minval((rdp.scissor_o.lr_y * rdp.scale_y + rdp.offset_y + 0.01f), g_settings->res_y), 0);
rdp.scissor.ul_x = (uint32_t)maxval(minval((rdp.scissor_o.ul_x * rdp.scale_x + rdp.offset_x + 0.01f), g_settings->res_x()), 0);
rdp.scissor.lr_x = (uint32_t)maxval(minval((rdp.scissor_o.lr_x * rdp.scale_x + rdp.offset_x + 0.01f), g_settings->res_x()), 0);
rdp.scissor.ul_y = (uint32_t)maxval(minval((rdp.scissor_o.ul_y * rdp.scale_y + rdp.offset_y + 0.01f), g_settings->res_y()), 0);
rdp.scissor.lr_y = (uint32_t)maxval(minval((rdp.scissor_o.lr_y * rdp.scale_y + rdp.offset_y + 0.01f), g_settings->res_y()), 0);
//grClipWindow specifies the hardware clipping window. Any pixels outside the clipping window are rejected.
//Values are inclusive for minimum x and y values and exclusive for maximum x and y values.
// grClipWindow (rdp.scissor.ul_x?rdp.scissor.ul_x+1:0, rdp.scissor.ul_y?rdp.scissor.ul_y+1:0, rdp.scissor.lr_x, rdp.scissor.lr_y);
@ -1881,7 +1799,7 @@ void update()
grDepthBufferFunction(g_settings->zmode_compare_less ? GR_CMP_LESS : GR_CMP_LEQUAL);
break;
case 2:
grDepthBiasLevel(g_settings->ucode == 7 ? -4 : 0);
grDepthBiasLevel(g_settings->ucode() == CSettings::ucode_PerfectDark ? -4 : 0);
grDepthBufferFunction(GR_CMP_LESS);
break;
case 3:
@ -1962,7 +1880,7 @@ void update()
{
if (g_settings->old_style_adither || rdp.alpha_dither_mode != 3) {
WriteTrace(TraceRDP, TraceDebug, " |- alpha compare: dither");
grStippleModeExt(g_settings->stipple_mode);
grStippleModeExt(g_settings->stipple_mode());
}
else
grStippleModeExt(GR_STIPPLE_DISABLE);
@ -2053,8 +1971,8 @@ void update()
rdp.clip_min_x = maxval((rdp.view_trans[0] - scale_x + rdp.offset_x) / rdp.clip_ratio, 0.0f);
rdp.clip_min_y = maxval((rdp.view_trans[1] - scale_y + rdp.offset_y) / rdp.clip_ratio, 0.0f);
rdp.clip_max_x = minval((rdp.view_trans[0] + scale_x + rdp.offset_x) * rdp.clip_ratio, g_settings->res_x);
rdp.clip_max_y = minval((rdp.view_trans[1] + scale_y + rdp.offset_y) * rdp.clip_ratio, g_settings->res_y);
rdp.clip_max_x = minval((rdp.view_trans[0] + scale_x + rdp.offset_x) * rdp.clip_ratio, g_settings->res_x());
rdp.clip_max_y = minval((rdp.view_trans[1] + scale_y + rdp.offset_y) * rdp.clip_ratio, g_settings->res_y());
WriteTrace(TraceRDP, TraceDebug, " |- viewport - (%d, %d, %d, %d)", (uint32_t)rdp.clip_min_x, (uint32_t)rdp.clip_min_y, (uint32_t)rdp.clip_max_x, (uint32_t)rdp.clip_max_y);
if (!rdp.scissor_set)

View File

@ -45,13 +45,11 @@
#define NOT_TMU2 0x02
void util_init();
void render_tri(uint16_t linew = 0);
int cull_tri(VERTEX **v);
void draw_tri(VERTEX **v, uint16_t linew = 0);
void do_triangle_stuff(uint16_t linew = 0, int old_interpolate = TRUE);
void do_triangle_stuff_2(uint16_t linew = 0);
void add_tri(VERTEX *v, int n, int type);
void apply_shade_mods(VERTEX *v);
void update();

File diff suppressed because it is too large Load Diff

View File

@ -47,10 +47,7 @@ extern char out_buf[2048];
extern uint32_t frame_count; // frame counter
//GlideHQ support
#define TEXTURE_FILTER
#ifdef TEXTURE_FILTER
#include "Ext_TxFilter.h"
#endif
#define MAX_CACHE 1024*4
#define MAX_TRI_CACHE 768 // this is actually # of vertices, not triangles
@ -166,10 +163,7 @@ typedef struct {
uint32_t lr_x;
uint32_t lr_y;
} SCISSOR;
#ifdef TEXTURE_FILTER
extern uint32_t texfltr[];
extern uint32_t texenht[];
extern uint32_t texcmpr[];
extern uint32_t texhirs[];
@ -182,30 +176,6 @@ typedef struct {
uint16_t tex_size;
uint32_t dxt;
} LOAD_TILE_INFO;
#endif
enum rdpBitmapType
{
rdpBITMAP_TYPE_INVALID, // should be == 0 for compatibility!
rdpBITMAP_TYPE_PNG,
};
typedef struct
{
const char * format;
const char * extension;
rdpBitmapType type;
} SCREEN_SHOT_FORMAT;
extern const int NumOfFormats;
extern SCREEN_SHOT_FORMAT ScreenShotFormats[];
typedef struct
{
uint8_t hk_ref;
uint8_t hk_motionblur;
uint8_t hk_filtering;
} HOTKEY_INFO;
typedef struct
{
@ -325,10 +295,8 @@ typedef struct {
float c_scl_y; // scale to lower-right center-texel y
uint32_t mod, mod_color, mod_color1, mod_color2, mod_factor;
#ifdef TEXTURE_FILTER
uint64 ricecrc;
int is_hires_tex;
#endif
} CACHE_LUT;
// Lights
@ -503,9 +471,7 @@ struct RDP_Base{
TILE tiles[8]; // 8 tile descriptors
uint8_t tmem[4096]; // 4k tmem
uint32_t addr[512]; // 512 addresses (used to determine address loaded from)
#ifdef TEXTURE_FILTER
LOAD_TILE_INFO load_info[512]; // 512 addresses. inforamation about tile loading.
#endif
int cur_tile; // current tile
int mipmap_level;
@ -526,9 +492,7 @@ struct RDP_Base{
int Persp_en;
int persp_supported;
int force_wrap;
#ifdef TEXTURE_FILTER
uint16_t pal_8_rice[512];
#endif
// Lighting
uint32_t num_lights;
@ -639,7 +603,6 @@ void ChangeSize();
void GoToFullScreen();
extern RDP rdp;
extern HOTKEY_INFO hotkey_info;
extern VOODOO voodoo;
extern GrTexInfo fontTex;
@ -649,7 +612,7 @@ extern uint32_t offset_cursor;
extern uint32_t offset_textures;
extern uint32_t offset_texbuf1;
extern int ucode_error_report;
extern bool g_ucode_error_report;
// RDP functions
void rdp_reset();

View File

@ -17,9 +17,6 @@
#define IDC_SPIN_TEXTURE_CACHE 1006
#define IDC_EDIT1 1007
#define IDC_CHK_USE_FRAME_BUFFER_OBJECT 1008
#define IDC_CHK_CLOCK_ENABLED 1012
#define IDC_CHK_CLOCK_24 1013
#define IDC_CMB_SCREEN_SHOT_FORMAT 1015
#define IDC_CHK_SHOW_TEXTURE_ENHANCEMENT 1016
#define IDC_INFO 1017
#define IDC_CMB_FILTERING_MODE 1018

View File

@ -1,11 +1,11 @@
#include "trace.h"
#include "Config.h"
#include "settings.h"
#include <string.h>
#include <Common/Trace.h>
#include <Common/path.h>
#include <Common/LogClass.h>
#include <Settings/Settings.h>
#ifdef ANDROID
#include <android/log.h>
@ -55,7 +55,6 @@ void SetupTrace(void)
TraceSetMaxModule(MaxTraceModuleGlide64, TraceError);
#endif
TraceSetModuleName(TraceMD5, "MD5");
TraceSetModuleName(TraceThread, "Thread");
TraceSetModuleName(TracePath, "Path");
@ -70,14 +69,8 @@ void SetupTrace(void)
TraceSetModuleName(TracePNG, "PNG");
TraceSetModuleName(TraceOGLWrapper, "OGL Wrapper");
char log_dir[260];
memset(log_dir, 0, sizeof(log_dir));
if (Set_log_dir != 0)
{
GetSystemSettingSz(Set_log_dir, log_dir, sizeof(log_dir));
}
if (strlen(log_dir) == 0)
const char * log_dir = g_settings ? g_settings->log_dir() : NULL;
if (log_dir == NULL || log_dir[0] == '\0')
{
return;
}
@ -87,6 +80,6 @@ void SetupTrace(void)
{
LogFilePath.DirectoryCreate();
}
g_LogFile = new CTraceFileLog(LogFilePath, GetSystemSetting(Set_log_flush) != 0, CLog::Log_New, 500);
g_LogFile = new CTraceFileLog(LogFilePath, g_settings->FlushLogs(), CLog::Log_New, 500);
TraceAddModule(g_LogFile);
}

View File

@ -243,9 +243,10 @@ static void t3dLoadObject(uint32_t pstate, uint32_t pvtx, uint32_t ptri)
static void Turbo3D()
{
WriteTrace(TraceRDP, TraceDebug, "Start Turbo3D microcode");
g_settings->ucode = ucode_Fast3D;
g_settings->SetUcode(CSettings::ucode_Fast3D);
uint32_t a = 0, pgstate = 0, pstate = 0, pvtx = 0, ptri = 0;
do {
do
{
a = rdp.pc[rdp.pc_i] & BMASK;
pgstate = ((uint32_t*)gfx.RDRAM)[a >> 2];
pstate = ((uint32_t*)gfx.RDRAM)[(a >> 2) + 1];
@ -258,11 +259,12 @@ static void Turbo3D()
break;
}
if (pgstate)
{
t3dLoadGlobState(pgstate);
}
t3dLoadObject(pstate, pvtx, ptri);
// Go to the next instruction
rdp.pc[rdp.pc_i] += 16;
} while (pstate);
// rdp_fullsync();
g_settings->ucode = ucode_Turbo3d;
g_settings->SetUcode(CSettings::ucode_Turbo3d);
}

View File

@ -37,18 +37,6 @@
//
//****************************************************************
#define ucode_Fast3D 0
#define ucode_F3DEX 1
#define ucode_F3DEX2 2
#define ucode_WaveRace 3
#define ucode_StarWars 4
#define ucode_DiddyKong 5
#define ucode_S2DEX 6
#define ucode_PerfectDark 7
#define ucode_CBFD 8
#define ucode_zSort 9
#define ucode_Turbo3d 21
static void rsp_vertex(int v0, int n)
{
uint32_t addr = segoffset(rdp.cmd1) & 0x00FFFFFF;
@ -535,7 +523,7 @@ static void uc0_tri1()
&rdp.vtx[((rdp.cmd1 >> 8) & 0xFF) / 10],
&rdp.vtx[(rdp.cmd1 & 0xFF) / 10]
};
if (g_settings->hacks & hack_Makers)
if (g_settings->hacks(CSettings::hack_Makers))
{
rdp.force_wrap = FALSE;
for (int i = 0; i < 3; i++)
@ -775,7 +763,10 @@ static void uc0_moveword()
static void uc0_texture()
{
int tile = (rdp.cmd0 >> 8) & 0x07;
if (tile == 7 && (g_settings->hacks&hack_Supercross)) tile = 0; //fix for supercross 2000
if (tile == 7 && g_settings->hacks(CSettings::hack_Supercross))
{
tile = 0; //fix for supercross 2000
}
rdp.mipmap_level = (rdp.cmd0 >> 11) & 0x07;
uint32_t on = (rdp.cmd0 & 0xFF);
rdp.cur_tile = tile;
@ -811,7 +802,7 @@ static void uc0_setothermode_h()
WriteTrace(TraceRDP, TraceDebug, "uc0:setothermode_h: ");
int shift, len;
if ((g_settings->ucode == ucode_F3DEX2) || (g_settings->ucode == ucode_CBFD))
if (g_settings->ucode() == CSettings::ucode_F3DEX2 || g_settings->ucode() == CSettings::ucode_CBFD)
{
len = (rdp.cmd0 & 0xFF) + 1;
shift = 32 - ((rdp.cmd0 >> 8) & 0xFF) - len;
@ -889,7 +880,7 @@ static void uc0_setothermode_l()
WriteTrace(TraceRDP, TraceDebug, "uc0:setothermode_l ");
int shift, len;
if ((g_settings->ucode == ucode_F3DEX2) || (g_settings->ucode == ucode_CBFD))
if (g_settings->ucode() == CSettings::ucode_F3DEX2 || g_settings->ucode() == CSettings::ucode_CBFD)
{
len = (rdp.cmd0 & 0xFF) + 1;
shift = 32 - ((rdp.cmd0 >> 8) & 0xFF) - len;
@ -932,7 +923,9 @@ static void uc0_setothermode_l()
rdp.render_mode_changed |= rdp.rm ^ rdp.othermode_l;
rdp.rm = rdp.othermode_l;
if (g_settings->flame_corona && (rdp.rm == 0x00504341)) //hack for flame's corona
rdp.othermode_l |= /*0x00000020 |*/ 0x00000010;
{
rdp.othermode_l |= 0x00000010;
}
WriteTrace(TraceRDP, TraceDebug, "rendermode: %08lx", rdp.othermode_l); // just output whole othermode_l
}

View File

@ -123,7 +123,7 @@ static void uc2_vertex()
}
uint32_t geom_mode = rdp.geom_mode;
if ((g_settings->hacks&hack_Fzero) && (rdp.geom_mode & 0x40000))
if (g_settings->hacks(CSettings::hack_Fzero) && (rdp.geom_mode & 0x40000))
{
if (((short*)gfx.RDRAM)[(((addr) >> 1) + 4) ^ 1] || ((short*)gfx.RDRAM)[(((addr) >> 1) + 5) ^ 1])
rdp.geom_mode ^= 0x40000;
@ -414,7 +414,9 @@ static void uc2_geom_mode()
if ((rdp.flags & ZBUF_ENABLED))
{
if (!g_settings->flame_corona || (rdp.rm != 0x00504341)) //hack for flame's corona
{
rdp.flags ^= ZBUF_ENABLED;
}
rdp.update |= UPDATE_ZBUF_ENABLED;
}
}

View File

@ -114,7 +114,7 @@ static void uc5_vertex()
// 0 = unused
int n = ((rdp.cmd0 >> 19) & 0x1F);// + 1;
if (g_settings->hacks&hack_Diddy)
if (g_settings->hacks(CSettings::hack_Diddy))
n++;
if (rdp.cmd0 & 0x00010000)

View File

@ -209,9 +209,7 @@ void DrawHiresDepthImage(const DRAWIMAGE & d)
grDepthBufferFunction(GR_CMP_ALWAYS);
grDepthMask(FXFALSE);
GrLOD_t LOD = GR_LOD_LOG2_1024;
if (g_settings->scr_res_x > 1024)
LOD = GR_LOD_LOG2_2048;
GrLOD_t LOD = g_settings->scr_res_x() > 1024 ? GR_LOD_LOG2_2048 : GR_LOD_LOG2_1024;
float lr_x = (float)d.imageW * rdp.scale_x;
float lr_y = (float)d.imageH * rdp.scale_y;
@ -246,12 +244,12 @@ void DrawHiresDepthImage(const DRAWIMAGE & d)
void DrawDepthImage(const DRAWIMAGE & d)
{
if (!fb_depth_render_enabled)
if (!g_settings->fb_depth_render_enabled())
return;
if (d.imageH > d.imageW)
return;
WriteTrace(TraceRDP, TraceDebug, "Depth image write");
if (fb_hwfbe_enabled)
if (g_settings->fb_hwfbe_enabled())
{
DrawHiresDepthImage(d);
return;
@ -262,8 +260,8 @@ void DrawDepthImage(const DRAWIMAGE & d)
float scale_y_src = 1.0f / rdp.scale_y;
int src_width = d.imageW;
int src_height = d.imageH;
int dst_width = minval(int(src_width*scale_x_dst), (int)g_settings->scr_res_x);
int dst_height = minval(int(src_height*scale_y_dst), (int)g_settings->scr_res_y);
int dst_width = minval(int(src_width*scale_x_dst), (int)g_settings->scr_res_x());
int dst_height = minval(int(src_height*scale_y_dst), (int)g_settings->scr_res_y());
uint16_t * src = (uint16_t*)(gfx.RDRAM + d.imagePtr);
uint16_t * dst = new uint16_t[dst_width*dst_height];
for (int y = 0; y < dst_height; y++)
@ -356,15 +354,19 @@ void DrawImage(DRAWIMAGE & d)
}
}
if ((g_settings->hacks&hack_PPL) > 0)
if (g_settings->hacks(CSettings::hack_PPL))
{
if (d.imageY > d.imageH)
{
d.imageY = (d.imageY%d.imageH);
}
}
else if ((g_settings->hacks&hack_Starcraft) > 0)
else if (g_settings->hacks(CSettings::hack_Starcraft))
{
if (d.imageH % 2 == 1)
{
d.imageH -= 1;
}
}
else
{
@ -443,7 +445,7 @@ void DrawImage(DRAWIMAGE & d)
rdp.allow_combine = 0;
if (rdp.ci_width == 512 && !no_dlist)
grClipWindow(0, 0, g_settings->scr_res_x, g_settings->scr_res_y);
grClipWindow(0, 0, g_settings->scr_res_x(), g_settings->scr_res_y());
else if (d.scaleX == 1.0f && d.scaleY == 1.0f)
grClipWindow(rdp.scissor.ul_x, rdp.scissor.ul_y, rdp.scissor.lr_x, rdp.scissor.lr_y);
else
@ -546,23 +548,7 @@ void DrawImage(DRAWIMAGE & d)
ConvertCoordsConvert(v, 4);
grDrawVertexArrayContiguous(GR_TRIANGLE_STRIP, 4, v, sizeof(VERTEX));
if (_debugger.capture)
{
VERTEX vl[3];
vl[0] = v[0];
vl[1] = v[2];
vl[2] = v[1];
add_tri(vl, 3, TRI_BACKGROUND);
rdp.tri_n++;
vl[0] = v[2];
vl[1] = v[3];
vl[2] = v[1];
add_tri(vl, 3, TRI_BACKGROUND);
rdp.tri_n++;
}
else
rdp.tri_n += 2;
rdp.tri_n += 2;
}
else
{
@ -611,13 +597,13 @@ void DrawHiresImage(DRAWIMAGE & d, int screensize = FALSE)
setTBufTex(rdp.tbuff_tex->t_mem, rdp.tbuff_tex->width << rdp.tbuff_tex->size >> 1);
const float Z = set_sprite_combine_mode();
grClipWindow(0, 0, g_settings->res_x, g_settings->res_y);
grClipWindow(0, 0, g_settings->res_x(), g_settings->res_y());
if (d.imageW % 2 == 1) d.imageW -= 1;
if (d.imageH % 2 == 1) d.imageH -= 1;
if (d.imageY > d.imageH) d.imageY = (d.imageY%d.imageH);
if (!(g_settings->hacks&hack_PPL))
if (!g_settings->hacks(CSettings::hack_PPL))
{
if ((d.frameX > 0) && (d.frameW == rdp.ci_width))
d.frameW -= (uint16_t)(2.0f*d.frameX);
@ -676,22 +662,7 @@ void DrawHiresImage(DRAWIMAGE & d, int screensize = FALSE)
grDrawTriangle(&v[0], &v[2], &v[1]);
grDrawTriangle(&v[2], &v[3], &v[1]);
rdp.update |= UPDATE_ZBUF_ENABLED | UPDATE_COMBINE | UPDATE_TEXTURE | UPDATE_ALPHA_COMPARE | UPDATE_SCISSOR;
if (_debugger.capture)
{
VERTEX vl[3];
vl[0] = v[0];
vl[1] = v[2];
vl[2] = v[1];
add_tri(vl, 3, TRI_BACKGROUND);
rdp.tri_n++;
vl[0] = v[2];
vl[1] = v[3];
vl[2] = v[1];
add_tri(vl, 3, TRI_BACKGROUND);
rdp.tri_n++;
}
else
rdp.tri_n += 2;
rdp.tri_n += 2;
rdp.tbuff_tex = tbuff_tex;
}
@ -758,13 +729,13 @@ static void uc6_bg(bool bg_1cyc)
DRAWIMAGE d;
uc6_read_background_data(d, bg_1cyc);
if (fb_hwfbe_enabled && FindTextureBuffer(d.imagePtr, d.imageW))
if (g_settings->fb_hwfbe_enabled() && FindTextureBuffer(d.imagePtr, d.imageW))
{
DrawHiresImage(d);
return;
}
if (g_settings->ucode == ucode_F3DEX2 || (g_settings->hacks&hack_PPL))
if (g_settings->ucode() == CSettings::ucode_F3DEX2 || g_settings->hacks(CSettings::hack_PPL))
{
if ((d.imagePtr != rdp.cimg) && (d.imagePtr != rdp.ocimg) && d.imagePtr) //can't draw from framebuffer
DrawImage(d);
@ -1276,7 +1247,7 @@ static void uc6_obj_rectangle_r()
DRAWOBJECT d;
uc6_read_object_data(d);
if (d.imageFmt == 1 && (g_settings->hacks&hack_Ogre64)) //Ogre Battle needs to copy YUV texture to frame buffer
if (d.imageFmt == 1 && g_settings->hacks(CSettings::hack_Ogre64)) //Ogre Battle needs to copy YUV texture to frame buffer
{
float ul_x = d.objX / mat_2d.BaseScaleX + mat_2d.X;
float lr_x = (d.objX + d.imageW / d.scaleW) / mat_2d.BaseScaleX + mat_2d.X;
@ -1384,7 +1355,7 @@ static void uc6_obj_loadtxtr()
WriteTrace(TraceRDP, TraceDebug, "tile addr: %08lx, tmem: %08lx, twidth: %d, theight: %d", image, tmem, twidth, theight);
int line = (twidth + 1) >> 2;
uint16_t line = (twidth + 1) >> 2;
rdp.timg.addr = image;
rdp.timg.width = line << 3;
@ -1519,7 +1490,7 @@ void uc6_sprite2d()
d.frameY = ((short)(cmd1 & 0xFFFF)) / 4.0f;
d.frameW = (uint16_t)(d.imageW / d.scaleX);
d.frameH = (uint16_t)(d.imageH / d.scaleY);
if (g_settings->hacks&hack_WCWnitro)
if (g_settings->hacks(CSettings::hack_WCWnitro))
{
int scaleY = (int)d.scaleY;
d.imageH /= scaleY;

View File

@ -63,7 +63,7 @@ void uc9_rpdcmd()
a++;
rdp.cmd3 = ((uint32_t*)gfx.RDRAM)[a++];
}
gfx_instruction[ucode_zSort][cmd]();
gfx_instruction[CSettings::ucode_zSort][cmd]();
};
rdp.LLE = 0;
}

View File

@ -62,7 +62,7 @@ static void fb_bg_copy()
if (rdp.main_ci == 0)
return;
CI_STATUS status = rdp.frame_buffers[rdp.ci_count - 1].status;
if ((status == ci_copy))
if (status == ci_copy)
return;
uint32_t addr = segoffset(rdp.cmd1) >> 1;
@ -222,7 +222,7 @@ static void fb_settextureimage()
rdp.scale_y = 1.0f;
}
}
else if (!(g_settings->frame_buffer & fb_ignore_aux_copy) && cur_fb.width < rdp.frame_buffers[rdp.main_ci_index].width)
else if (!g_settings->fb_ignore_aux_copy_enabled() && cur_fb.width < rdp.frame_buffers[rdp.main_ci_index].width)
{
rdp.copy_ci_index = rdp.ci_count - 1;
cur_fb.status = ci_aux_copy;
@ -238,7 +238,6 @@ static void fb_settextureimage()
}
WriteTrace(TraceRDP, TraceDebug, "Detect FB usage. texture addr is inside framebuffer: %08lx - %08lx ", addr, rdp.main_ci);
}
///*
else if ((cur_fb.status != ci_main) && (addr >= rdp.zimg && addr < rdp.zimg_end))
{
cur_fb.status = ci_zcopy;
@ -246,7 +245,6 @@ static void fb_settextureimage()
rdp.copy_zi_index = rdp.ci_count - 1;
WriteTrace(TraceRDP, TraceDebug, "fb_settextureimage. rdp.frame_buffers[%d].status = ci_zcopy", rdp.ci_count - 1);
}
//*/
else if ((rdp.maincimg[0].width > 64) && (addr >= rdp.maincimg[0].addr) && (addr < (rdp.maincimg[0].addr + rdp.maincimg[0].width*rdp.maincimg[0].height * 2)))
{
if (cur_fb.status != ci_main)
@ -268,7 +266,7 @@ static void fb_settextureimage()
WriteTrace(TraceRDP, TraceDebug, "read_previous_ci = TRUE");
}
}
else if (fb_hwfbe_enabled && (cur_fb.status == ci_main))
else if (g_settings->fb_hwfbe_enabled() && (cur_fb.status == ci_main))
{
if ((addr >= rdp.main_ci) && (addr < rdp.main_ci_end)) //addr within main frame buffer
{
@ -407,7 +405,7 @@ static void fb_setcolorimage()
}
if (rdp.ci_count > 0 && rdp.frame_buffers[rdp.ci_count - 1].status == ci_unknown) //status of previous fb was not changed - it is useless
{
if (fb_hwfbe_enabled && !(g_settings->frame_buffer & fb_useless_is_useless))
if (g_settings->fb_hwfbe_enabled() && !g_settings->fb_useless_is_useless_enabled())
{
rdp.frame_buffers[rdp.ci_count - 1].status = ci_aux;
rdp.frame_buffers[rdp.ci_count - 1].changed = 0;
@ -432,7 +430,7 @@ static void fb_setcolorimage()
}
if (cur_fb.status == ci_main)
{
int viSwapOK = ((g_settings->swapmode == 2) && (rdp.vi_org_reg == *gfx.VI_ORIGIN_REG)) ? FALSE : TRUE;
int viSwapOK = ((g_settings->swapmode() == CSettings::SwapMode_Hybrid) && (rdp.vi_org_reg == *gfx.VI_ORIGIN_REG)) ? FALSE : TRUE;
if ((rdp.maincimg[0].addr != cur_fb.addr) && SwapOK && viSwapOK)
{
SwapOK = FALSE;

View File

@ -29,31 +29,28 @@
#include <Common/StdString.h>
#include <Common/path.h>
#include <Glide64/Config.h>
#include <Settings/Settings.h>
#include <Glide64/Settings.h>
TxDbg::TxDbg()
{
char log_dir[260];
memset(log_dir, 0, sizeof(log_dir));
if (Set_log_dir != 0)
const char * log_dir = g_settings->log_dir();
if (log_dir != NULL && log_dir[0] != '\0')
{
GetSystemSettingSz(Set_log_dir, log_dir, sizeof(log_dir));
}
_level = DBG_LEVEL;
_level = DBG_LEVEL;
if (!_dbgfile)
if (!_dbgfile)
#ifdef GHQCHK
_dbgfile = fopen(CPath(log_dir, "ghqchk.txt"), "w");
_dbgfile = fopen(CPath(log_dir, "ghqchk.txt"), "w");
#else
_dbgfile = fopen(CPath(log_dir, "glidehq.dbg"), "w");
_dbgfile = fopen(CPath(log_dir, "glidehq.dbg"), "w");
#endif
}
}
TxDbg::~TxDbg()
{
if (_dbgfile) {
if (_dbgfile)
{
fclose(_dbgfile);
_dbgfile = 0;
}

View File

@ -241,7 +241,7 @@ void check_link(GLuint program)
}
}
void set_rotation_matrix(GLuint loc, int rotate)
void set_rotation_matrix(GLuint loc, CSettings::ScreenRotate_t rotate)
{
GLfloat mat[16];
@ -252,13 +252,13 @@ void set_rotation_matrix(GLuint loc, int rotate)
* (0, 0, 0, 1)
*/
//mat[0] = cos(angle);
//mat[1] = sin(angle);
mat[0] = 1;
mat[1] = 0;
mat[2] = 0;
mat[3] = 0;
//mat[4] = -sin(angle);
//mat[5] = cos(angle);
mat[4] = 0;
mat[5] = 1;
mat[6] = 0;
mat[7] = 0;
@ -273,35 +273,27 @@ void set_rotation_matrix(GLuint loc, int rotate)
mat[15] = 1;
/* now set the actual rotation */
if (1 == rotate) // 90 degree
if (rotate == CSettings::Rotate_90)
{
mat[0] = 0;
mat[1] = 1;
mat[4] = -1;
mat[5] = 0;
}
else if (2 == rotate) // 180 degree
else if (rotate == CSettings::Rotate_180)
{
mat[0] = -1;
mat[1] = 0;
mat[4] = 0;
mat[5] = -1;
}
else if (3 == rotate) // 270 degree
else if (rotate == CSettings::Rotate_270)
{
mat[0] = 0;
mat[1] = -1;
mat[4] = 1;
mat[5] = 0;
}
else /* 0 degree, also fallback if input is wrong) */
{
mat[0] = 1;
mat[1] = 0;
mat[4] = 0;
mat[5] = 1;
}
glUniformMatrix4fv(loc, 1, GL_FALSE, mat);
}
@ -349,7 +341,7 @@ void init_combiner()
check_link(g_program_object_default);
glUseProgram(g_program_object_default);
int rotation_matrix_location = glGetUniformLocation(g_program_object_default, "rotation_matrix");
set_rotation_matrix(rotation_matrix_location, g_settings->rotate);
set_rotation_matrix(rotation_matrix_location, g_settings->rotate());
texture0_location = glGetUniformLocation(g_program_object_default, "texture0");
texture1_location = glGetUniformLocation(g_program_object_default, "texture1");
@ -484,7 +476,7 @@ void update_uniforms(GLuint program_object, const shader_program_key & prog)
}
GLuint rotation_matrix_location = glGetUniformLocation(program_object, "rotation_matrix");
set_rotation_matrix(rotation_matrix_location, g_settings->rotate);
set_rotation_matrix(rotation_matrix_location, g_settings->rotate());
set_lambda();
}

View File

@ -22,7 +22,6 @@
#ifdef _WIN32
#include <windows.h>
#include <commctrl.h>
#else
#include <stdint.h>
#include <stdarg.h>
@ -173,14 +172,8 @@ int UMAmode = 0; //support for VSA-100 UMA mode;
static HDC hDC = NULL;
static HGLRC hGLRC = NULL;
static HWND hToolBar = NULL;
static HWND hwnd_win = NULL;
static unsigned long windowedExStyle, windowedStyle;
#endif // _WIN32
static unsigned long fullscreen;
#ifdef _WIN32
static RECT windowedRect;
static HMENU windowedMenu;
#endif // _WIN32
static int savedWidtho, savedHeighto;
static int savedWidth, savedHeight;
@ -309,12 +302,6 @@ grGlideInit(void)
WriteTrace(TraceGlitch, TraceDebug, "-");
}
FX_ENTRY void FX_CALL
grSstSelect(int which_sst)
{
WriteTrace(TraceGlitch, TraceDebug, "which_sst = %d", which_sst);
}
int isExtensionSupported(const char *extension)
{
return 0;
@ -380,10 +367,10 @@ int isWglExtensionSupported(const char *extension)
#define GrPixelFormat_t int
FX_ENTRY GrContext_t FX_CALL grSstWinOpenExt(GrScreenRefresh_t refresh_rate, GrColorFormat_t color_format, GrOriginLocation_t origin_location, GrPixelFormat_t pixelformat, int nColBuffers, int nAuxBuffers)
FX_ENTRY GrContext_t FX_CALL grSstWinOpenExt(GrColorFormat_t color_format, GrOriginLocation_t origin_location, GrPixelFormat_t pixelformat, int nColBuffers, int nAuxBuffers)
{
WriteTrace(TraceGlitch, TraceDebug, "refresh_rate: %d, color_format: %d, origin_location: %d, nColBuffers: %d, nAuxBuffers: %d", refresh_rate, color_format, origin_location, nColBuffers, nAuxBuffers);
return grSstWinOpen(refresh_rate, color_format, origin_location, nColBuffers, nAuxBuffers);
WriteTrace(TraceGlitch, TraceDebug, "color_format: %d, origin_location: %d, nColBuffers: %d, nAuxBuffers: %d", color_format, origin_location, nColBuffers, nAuxBuffers);
return grSstWinOpen(color_format, origin_location, nColBuffers, nAuxBuffers);
}
#ifdef _WIN32
@ -393,7 +380,7 @@ FX_ENTRY GrContext_t FX_CALL grSstWinOpenExt(GrScreenRefresh_t refresh_rate, GrC
# endif
#endif
FX_ENTRY GrContext_t FX_CALL grSstWinOpen( GrScreenRefresh_t refresh_rate, GrColorFormat_t color_format, GrOriginLocation_t origin_location, int nColBuffers, int nAuxBuffers)
FX_ENTRY GrContext_t FX_CALL grSstWinOpen( GrColorFormat_t color_format, GrOriginLocation_t origin_location, int nColBuffers, int nAuxBuffers)
{
static int show_warning = 1;
@ -405,7 +392,7 @@ FX_ENTRY GrContext_t FX_CALL grSstWinOpen( GrScreenRefresh_t refresh_rate, GrCol
color_texture = free_texture++;
depth_texture = free_texture++;
WriteTrace(TraceGlitch, TraceDebug, "refresh_rate: %d, color_format: %d, origin_location: %d, nColBuffers: %d, nAuxBuffers: %d", refresh_rate, color_format, origin_location, nColBuffers, nAuxBuffers);
WriteTrace(TraceGlitch, TraceDebug, "color_format: %d, origin_location: %d, nColBuffers: %d, nAuxBuffers: %d", color_format, origin_location, nColBuffers, nAuxBuffers);
WriteTrace(TraceGlitch, TraceDebug, "g_width: %d, g_height: %d fullscreen: %d", g_width, g_height, fullscreen);
//viewport_offset = ((screen_resolution>>2) > 20) ? screen_resolution >> 2 : 20;
@ -676,18 +663,7 @@ grSstWinClose(GrContext_t context)
wglDeleteContext(hGLRC);
hGLRC = NULL;
}
if (fullscreen)
{
ChangeDisplaySettings(NULL, 0);
SetWindowPos(hwnd_win, NULL,
windowedRect.left, windowedRect.top,
0, 0,
SWP_NOZORDER | SWP_NOSIZE);
SetWindowLong(hwnd_win, GWL_STYLE, windowedStyle);
SetWindowLong(hwnd_win, GWL_EXSTYLE, windowedExStyle);
if (windowedMenu) SetMenu(hwnd_win, windowedMenu);
fullscreen = 0;
}
ExitFullScreen();
#endif
return FXTRUE;
}
@ -1058,8 +1034,6 @@ grGetProcAddress(char *procName)
return (GrProc)grTextureAuxBufferExt;
if (!strcmp(procName, "grAuxBufferExt"))
return (GrProc)grAuxBufferExt;
if (!strcmp(procName, "grWrapperFullScreenResolutionExt"))
return (GrProc)grWrapperFullScreenResolutionExt;
if (!strcmp(procName, "grConfigWrapperExt"))
return (GrProc)grConfigWrapperExt;
if (!strcmp(procName, "grKeyPressedExt"))
@ -1087,7 +1061,7 @@ grGet(FxU32 pname, FxU32 plength, FxI32 *params)
if (plength < 4 || params == NULL) return 0;
if (!nbTextureUnits)
{
grSstWinOpen(0, GR_COLORFORMAT_ARGB, GR_ORIGIN_UPPER_LEFT, 2, 1);
grSstWinOpen(GR_COLORFORMAT_ARGB, GR_ORIGIN_UPPER_LEFT, 2, 1);
grSstWinClose(0);
}
#ifdef VOODOO1
@ -1966,16 +1940,6 @@ grQueryResolutionsExt(int32_t * Size)
{
WriteTrace(TraceGlitch, TraceDebug, "-");
return 0;
}
FX_ENTRY GrScreenResolution_t FX_CALL grWrapperFullScreenResolutionExt(FxU32* width, FxU32* height)
{
WriteTrace(TraceGlitch, TraceDebug, "-");
return 0;
/*
g_FullScreenResolutions.getResolution(config.res, width, height);
return config.res;
*/
}
FX_ENTRY FxBool FX_CALL grKeyPressedExt(FxU32 key)
@ -1983,7 +1947,7 @@ FX_ENTRY FxBool FX_CALL grKeyPressedExt(FxU32 key)
return 0;
}
FX_ENTRY void FX_CALL grConfigWrapperExt(FxI32 vram, FxBool fbo, FxBool aniso)
void grConfigWrapperExt(FxI32 vram, FxBool fbo, FxBool aniso)
{
WriteTrace(TraceGlitch, TraceDebug, "-");
config.vram_size = vram;
@ -2236,18 +2200,6 @@ GrTexInfo *info)
FX_ENTRY void FX_CALL
grLoadGammaTable(FxU32 nentries, FxU32 *red, FxU32 *green, FxU32 *blue)
{
//TODO?
/*LOG("grLoadGammaTable\r\n");
if (!fullscreen)
return;
FxU16 aGammaRamp[3][256];
for (int i = 0; i < 256; i++)
{
aGammaRamp[0][i] = (FxU16)((red[i] << 8) & 0xFFFF);
aGammaRamp[1][i] = (FxU16)((green[i] << 8) & 0xFFFF);
aGammaRamp[2][i] = (FxU16)((blue[i] << 8) & 0xFFFF);
}
CorrectGamma(aGammaRamp);*/
}
FX_ENTRY void FX_CALL

View File

@ -2,7 +2,6 @@
#ifdef _WIN32
#include <windows.h>
#include <commctrl.h>
#else
#include <stdint.h>
#include <stdarg.h>
@ -29,188 +28,7 @@
*/
#include <Settings/Settings.h>
struct ResolutionInfo
{
unsigned int dwW, dwH, dwF;
ResolutionInfo() : dwW(0), dwH(0), dwF(0) {}
ResolutionInfo(unsigned int _w, unsigned int _h, unsigned int _f) : dwW(_w), dwH(_h), dwF(_f) {}
bool operator == (const ResolutionInfo & _other) const
{
if (dwW != _other.dwW)
return false;
if (dwH != _other.dwH)
return false;
if (dwF != _other.dwF)
return false;
return true;
}
bool operator != (const ResolutionInfo & _other) const
{
return !(operator==(_other));
}
void toString(char * _str) const
{
if (dwF > 0)
sprintf(_str, "%ix%i 32bpp %iHz", dwW, dwH, dwF);
else
sprintf(_str, "%ix%i 32bpp", dwW, dwH);
}
};
class FullScreenResolutions
{
public:
FullScreenResolutions() : dwNumResolutions(0), aResolutions(0), aResolutionsStr(0) {}
~FullScreenResolutions();
void getResolution(FxU32 _idx, FxU32 * _width, FxU32 * _height, FxU32 * _frequency = 0)
{
WriteTrace(TraceResolution, TraceDebug, "_idx: %d", _idx);
if (dwNumResolutions == 0)
{
init();
}
if (_idx >= dwNumResolutions)
{
WriteTrace(TraceGlitch, TraceError, "NumResolutions = %d", dwNumResolutions);
_idx = 0;
}
*_width = (FxU32)aResolutions[_idx].dwW;
*_height = (FxU32)aResolutions[_idx].dwH;
if (_frequency != 0)
{
*_frequency = (FxU32)aResolutions[_idx].dwF;
}
}
int getCurrentResolutions(void)
{
if (dwNumResolutions == 0)
{
init();
}
return currentResolutions;
}
char ** getResolutionsList(int32_t * Size)
{
if (dwNumResolutions == 0)
{
init();
}
*Size = (int32_t)dwNumResolutions;
return aResolutionsStr;
}
bool changeDisplaySettings(FxU32 _resolution);
private:
void init();
unsigned int dwNumResolutions;
ResolutionInfo * aResolutions;
char ** aResolutionsStr;
int currentResolutions;
};
FullScreenResolutions::~FullScreenResolutions()
{
for (unsigned int i = 0; i < dwNumResolutions; i++)
{
delete[] aResolutionsStr[i];
aResolutionsStr[i] = NULL;
}
if (aResolutionsStr)
{
delete[] aResolutionsStr;
aResolutionsStr = NULL;
}
if (aResolutions)
{
delete[] aResolutions;
aResolutions = NULL;
}
}
void FullScreenResolutions::init()
{
WriteTrace(TraceGlitch, TraceDebug, "executing");
#ifdef _WIN32
currentResolutions = -1;
DEVMODE enumMode , currentMode;
int iModeNum = 0;
memset(&enumMode, 0, sizeof(DEVMODE));
EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &currentMode);
ResolutionInfo prevInfo;
while (EnumDisplaySettings(NULL, iModeNum++, &enumMode) != 0)
{
ResolutionInfo curInfo(enumMode.dmPelsWidth, enumMode.dmPelsHeight, enumMode.dmDisplayFrequency);
if (enumMode.dmBitsPerPel == 32 && curInfo != prevInfo)
{
dwNumResolutions++;
prevInfo = curInfo;
}
}
aResolutions = new ResolutionInfo[dwNumResolutions];
aResolutionsStr = new char*[dwNumResolutions];
iModeNum = 0;
int current = 0;
char smode[256];
memset(&enumMode, 0, sizeof(DEVMODE));
memset(&prevInfo, 0, sizeof(ResolutionInfo));
while (EnumDisplaySettings(NULL, iModeNum++, &enumMode) != 0)
{
ResolutionInfo curInfo(enumMode.dmPelsWidth, enumMode.dmPelsHeight, enumMode.dmDisplayFrequency);
if (enumMode.dmBitsPerPel == 32 && curInfo != prevInfo)
{
if (enumMode.dmPelsHeight == currentMode.dmPelsHeight && enumMode.dmPelsWidth == currentMode.dmPelsWidth)
{
currentResolutions = current;
}
aResolutions[current] = curInfo;
curInfo.toString(smode);
aResolutionsStr[current] = new char[strlen(smode) + 1];
strcpy(aResolutionsStr[current], smode);
prevInfo = curInfo;
current++;
}
}
#endif
}
bool FullScreenResolutions::changeDisplaySettings(FxU32 _resolution)
{
#ifdef _WIN32
FxU32 width, height, frequency;
getResolution(_resolution, &width, &height, &frequency);
ResolutionInfo info(width, height, frequency);
DEVMODE enumMode;
int iModeNum = 0;
memset(&enumMode, 0, sizeof(DEVMODE));
while (EnumDisplaySettings(NULL, iModeNum++, &enumMode) != 0)
{
ResolutionInfo curInfo(enumMode.dmPelsWidth, enumMode.dmPelsHeight, enumMode.dmDisplayFrequency);
if (enumMode.dmBitsPerPel == 32 && curInfo == info) {
bool bRes = ChangeDisplaySettings(&enumMode, CDS_FULLSCREEN) == DISP_CHANGE_SUCCESSFUL;
WriteTrace(TraceGlitch, TraceDebug, "width=%d, height=%d, freq=%d %s\r\n", enumMode.dmPelsWidth, enumMode.dmPelsHeight, enumMode.dmDisplayFrequency, bRes ? "Success" : "Failed");
return bRes;
}
}
return false;
#else // _WIN32
return false;
#endif // _WIN32
}
FullScreenResolutions g_FullScreenResolutions;
wrapper_config config = { 0, 0, 0, 0 };
wrapper_config config = { 0, 0, 0 };
int screen_width, screen_height;
static inline void opt_glCopyTexImage2D(GLenum target,
@ -485,13 +303,6 @@ int UMAmode = 0; //support for VSA-100 UMA mode;
static HDC hDC = NULL;
static HGLRC hGLRC = NULL;
static HWND hToolBar = NULL;
static HWND hwnd_win = NULL;
static unsigned long windowedExStyle, windowedStyle;
#endif // _WIN32
static unsigned long fullscreen;
#ifdef _WIN32
static RECT windowedRect;
static HMENU windowedMenu;
#endif // _WIN32
static int savedWidtho, savedHeighto;
@ -595,12 +406,6 @@ grGlideInit(void)
WriteTrace(TraceGlitch, TraceDebug, "-");
}
FX_ENTRY void FX_CALL
grSstSelect(int which_sst)
{
WriteTrace(TraceGlitch, TraceDebug, "which_sst = %d", which_sst);
}
int isExtensionSupported(const char *extension)
{
const GLubyte *extensions = NULL;
@ -667,17 +472,14 @@ int isWglExtensionSupported(const char *extension)
FX_ENTRY GrContext_t FX_CALL
grSstWinOpenExt(
HWND hWnd,
GrScreenResolution_t screen_resolution,
GrScreenRefresh_t refresh_rate,
GrColorFormat_t color_format,
GrOriginLocation_t origin_location,
GrPixelFormat_t /*pixelformat*/,
int nColBuffers,
int nAuxBuffers)
{
WriteTrace(TraceGlitch, TraceDebug, "hWnd: %d, screen_resolution: %d, refresh_rate: %d, color_format: %d, origin_location: %d, nColBuffers: %d, nAuxBuffers: %d", hWnd, screen_resolution, refresh_rate, color_format, origin_location, nColBuffers, nAuxBuffers);
return grSstWinOpen(hWnd, screen_resolution, refresh_rate, color_format, origin_location, nColBuffers, nAuxBuffers);
WriteTrace(TraceGlitch, TraceDebug, "color_format: %d, origin_location: %d, nColBuffers: %d, nAuxBuffers: %d", color_format, origin_location, nColBuffers, nAuxBuffers);
return grSstWinOpen(color_format, origin_location, nColBuffers, nAuxBuffers);
}
#ifdef _WIN32
@ -685,13 +487,11 @@ int nAuxBuffers)
# ifndef ATTACH_PARENT_PROCESS
# define ATTACH_PARENT_PROCESS ((FxU32)-1)
# endif
extern HWND g_hwnd_win;
#endif
FX_ENTRY GrContext_t FX_CALL
grSstWinOpen(
HWND hWnd,
GrScreenResolution_t screen_resolution,
GrScreenRefresh_t refresh_rate,
GrColorFormat_t color_format,
GrOriginLocation_t origin_location,
int nColBuffers,
@ -724,184 +524,16 @@ int nAuxBuffers)
fputs("ERROR: No GLX yet to start GL on [Free]BSD, Linux etc.\n", stderr);
#endif // _WIN32
WriteTrace(TraceGlitch, TraceDebug, "hWnd: %d, screen_resolution: %d, refresh_rate: %d, color_format: %d, origin_location: %d, nColBuffers: %d, nAuxBuffers: %d", hWnd, screen_resolution&~0x80000000, refresh_rate, color_format, origin_location, nColBuffers, nAuxBuffers);
WriteTrace(TraceGlitch, TraceDebug, "color_format: %d, origin_location: %d, nColBuffers: %d, nAuxBuffers: %d", color_format, origin_location, nColBuffers, nAuxBuffers);
#ifdef _WIN32
if ((HWND)hWnd == NULL) hWnd = GetActiveWindow();
hwnd_win = (HWND)hWnd;
#endif // _WIN32
g_width = g_height = 0;
if (screen_resolution & 0x80000000)
{
switch (screen_resolution & ~0x80000000)
{
case GR_RESOLUTION_320x200:
g_width = 320;
g_height = 200;
break;
case GR_RESOLUTION_320x240:
g_width = 320;
g_height = 240;
break;
case GR_RESOLUTION_400x256:
g_width = 400;
g_height = 256;
break;
case GR_RESOLUTION_512x384:
g_width = 512;
g_height = 384;
break;
case GR_RESOLUTION_640x200:
g_width = 640;
g_height = 200;
break;
case GR_RESOLUTION_640x350:
g_width = 640;
g_height = 350;
break;
case GR_RESOLUTION_640x400:
g_width = 640;
g_height = 400;
break;
case GR_RESOLUTION_640x480:
g_width = 640;
g_height = 480;
break;
case GR_RESOLUTION_800x600:
g_width = 800;
g_height = 600;
break;
case GR_RESOLUTION_960x720:
g_width = 960;
g_height = 720;
break;
case GR_RESOLUTION_856x480:
g_width = 856;
g_height = 480;
break;
case GR_RESOLUTION_512x256:
g_width = 512;
g_height = 256;
break;
case GR_RESOLUTION_1024x768:
g_width = 1024;
g_height = 768;
break;
case GR_RESOLUTION_1280x1024:
g_width = 1280;
g_height = 1024;
break;
case GR_RESOLUTION_1600x1200:
g_width = 1600;
g_height = 1200;
break;
case GR_RESOLUTION_400x300:
g_width = 400;
g_height = 300;
break;
case GR_RESOLUTION_1152x864:
g_width = 1152;
g_height = 864;
break;
case GR_RESOLUTION_1280x960:
g_width = 1280;
g_height = 960;
break;
case GR_RESOLUTION_1600x1024:
g_width = 1600;
g_height = 1024;
break;
case GR_RESOLUTION_1792x1344:
g_width = 1792;
g_height = 1344;
break;
case GR_RESOLUTION_1856x1392:
g_width = 1856;
g_height = 1392;
break;
case GR_RESOLUTION_1920x1440:
g_width = 1920;
g_height = 1440;
break;
case GR_RESOLUTION_2048x1536:
g_width = 2048;
g_height = 1536;
break;
case GR_RESOLUTION_2048x2048:
g_width = 2048;
g_height = 2048;
break;
default:
WriteTrace(TraceGlitch, TraceWarning, "unknown SstWinOpen resolution : %x", screen_resolution);
}
}
#ifdef _WIN32
if (screen_resolution & 0x80000000)
{
RECT clientRect, toolbarRect, statusbarRect;
ZeroMemory(&windowedRect, sizeof(RECT));
ZeroMemory(&clientRect, sizeof(RECT));
ZeroMemory(&toolbarRect, sizeof(RECT));
ZeroMemory(&statusbarRect, sizeof(RECT));
HWND hToolBar = FindWindowEx(hwnd_win, NULL, REBARCLASSNAME, NULL);
HWND hStatusBar = FindWindowEx(hwnd_win, NULL, STATUSCLASSNAME, NULL);
if (hStatusBar == NULL) hStatusBar = FindWindowEx(hwnd_win, NULL, "msctls_statusbar32", NULL); // 1964
if (hToolBar != NULL) GetWindowRect(hToolBar, &toolbarRect);
if (hStatusBar != NULL) GetWindowRect(hStatusBar, &statusbarRect);
viewport_offset = statusbarRect.bottom - statusbarRect.top;
GetWindowRect(hwnd_win, &windowedRect);
GetClientRect(hwnd_win, &clientRect);
windowedRect.right += (g_width - (clientRect.right - clientRect.left));
windowedRect.bottom += (g_height + (toolbarRect.bottom - toolbarRect.top) + (statusbarRect.bottom - statusbarRect.top) - (clientRect.bottom - clientRect.top));
SetWindowPos(hwnd_win, NULL, 0, 0, windowedRect.right - windowedRect.left,
windowedRect.bottom - windowedRect.top, SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOMOVE);
TMU_SIZE = (config.vram_size - g_width * g_height * 4 * 3) / 2; // XXX - what about windows desktop usage?
fullscreen = 0;
}
else
{
{
FxU32 _width, _height;
g_FullScreenResolutions.getResolution(screen_resolution, &_width, &_height);
g_width = _width;
g_height = _height;
}
ZeroMemory(&windowedRect, sizeof(RECT));
GetWindowRect(hwnd_win, &windowedRect);
windowedExStyle = GetWindowLong(hwnd_win, GWL_EXSTYLE);
windowedStyle = GetWindowLong(hwnd_win, GWL_STYLE);
// primary monitor only
if (!g_FullScreenResolutions.changeDisplaySettings(screen_resolution))
{
WriteTrace(TraceGlitch, TraceWarning, "can't change to fullscreen mode");
}
windowedMenu = GetMenu(hwnd_win);
if (windowedMenu) SetMenu(hwnd_win, NULL);
HWND hStatusBar = FindWindowEx(hwnd_win, NULL, "msctls_statusbar32", NULL); // 1964
if (hStatusBar) ShowWindow(hStatusBar, SW_HIDE);
SetWindowLong(hwnd_win, GWL_STYLE, 0);
SetWindowLong(hwnd_win, GWL_EXSTYLE, WS_EX_APPWINDOW | WS_EX_TOPMOST);
SetWindowPos(hwnd_win, NULL, 0, 0, g_width, g_height, SWP_NOACTIVATE | SWP_NOZORDER | SWP_SHOWWINDOW);
viewport_offset = 0;
fullscreen = 1;
}
TMU_SIZE = (config.vram_size - g_width * g_height * 4 * 3) / 2;
// save screen resolution for hwfbe, after resolution enumeration
screen_width = g_width;
screen_height = g_height;
if ((hDC = GetDC(hwnd_win)) == NULL)
if ((hDC = GetDC(g_hwnd_win)) == NULL)
{
WriteTrace(TraceGlitch, TraceWarning, "GetDC on main window failed");
return FXFALSE;
@ -1271,18 +903,7 @@ grSstWinClose(GrContext_t context)
wglDeleteContext(hGLRC);
hGLRC = NULL;
}
if (fullscreen)
{
ChangeDisplaySettings(NULL, 0);
SetWindowPos(hwnd_win, NULL,
windowedRect.left, windowedRect.top,
0, 0,
SWP_NOZORDER | SWP_NOSIZE);
SetWindowLong(hwnd_win, GWL_STYLE, windowedStyle);
SetWindowLong(hwnd_win, GWL_EXSTYLE, windowedExStyle);
if (windowedMenu) SetMenu(hwnd_win, windowedMenu);
fullscreen = 0;
}
ExitFullScreen();
#else
//SDL_QuitSubSystem(SDL_INIT_VIDEO);
//sleep(2);
@ -1689,7 +1310,7 @@ grGet(FxU32 pname, FxU32 plength, FxI32 *params)
if (plength < 4 || params == NULL) return 0;
if (!nbTextureUnits)
{
grSstWinOpen((unsigned long)NULL, GR_RESOLUTION_640x480 | 0x80000000, 0, GR_COLORFORMAT_ARGB, GR_ORIGIN_UPPER_LEFT, 2, 1);
grSstWinOpen(GR_COLORFORMAT_ARGB, GR_ORIGIN_UPPER_LEFT, 2, 1);
grSstWinClose(0);
}
#ifdef VOODOO1
@ -2510,27 +2131,9 @@ FxI32 src_stride, void *src_data)
return FXTRUE;
}
int GetCurrentResIndex(void)
{
return g_FullScreenResolutions.getCurrentResolutions();
}
/* wrapper-specific glide extensions */
FX_ENTRY char ** FX_CALL
grQueryResolutionsExt(int32_t * Size)
{
WriteTrace(TraceGlitch, TraceDebug, "-");
return g_FullScreenResolutions.getResolutionsList(Size);
}
FX_ENTRY GrScreenResolution_t FX_CALL grWrapperFullScreenResolutionExt(FxU32* width, FxU32* height)
{
WriteTrace(TraceGlitch, TraceDebug, "-");
g_FullScreenResolutions.getResolution(config.res, width, height);
return config.res;
}
FX_ENTRY FxBool FX_CALL grKeyPressedExt(FxU32 key)
{
#ifdef _WIN32
@ -2540,10 +2143,9 @@ FX_ENTRY FxBool FX_CALL grKeyPressedExt(FxU32 key)
#endif
}
FX_ENTRY void FX_CALL grConfigWrapperExt(FxI32 resolution, FxI32 vram, FxBool fbo, FxBool aniso)
void grConfigWrapperExt(FxI32 vram, FxBool fbo, FxBool aniso)
{
WriteTrace(TraceGlitch, TraceDebug, "-");
config.res = resolution;
config.vram_size = vram;
config.fbo = fbo;
config.anisofilter = aniso;
@ -2819,8 +2421,6 @@ FX_ENTRY void FX_CALL
grLoadGammaTable(FxU32 /*nentries*/, FxU32 *red, FxU32 *green, FxU32 *blue)
{
WriteTrace(TraceGlitch, TraceDebug, "-");
if (!fullscreen)
return;
FxU16 aGammaRamp[3][256];
for (int i = 0; i < 256; i++)
{
@ -2829,7 +2429,6 @@ grLoadGammaTable(FxU32 /*nentries*/, FxU32 *red, FxU32 *green, FxU32 *blue)
aGammaRamp[2][i] = (FxU16)((blue[i] << 8) & 0xFFFF);
}
CorrectGamma(aGammaRamp);
pjutil::Sleep(1000);
}
FX_ENTRY void FX_CALL
@ -2862,8 +2461,7 @@ FX_ENTRY void FX_CALL
guGammaCorrectionRGB(FxFloat gammaR, FxFloat gammaG, FxFloat gammaB)
{
WriteTrace(TraceGlitch, TraceDebug, "-");
if (!fullscreen)
return;
FxU16 aGammaRamp[3][256];
for (int i = 0; i < 256; i++)
{

View File

@ -17,9 +17,6 @@ extern int dumping;
typedef struct _wrapper_config
{
#ifndef ANDROID
int res;
#endif
int fbo;
int anisofilter;
int vram_size;
@ -172,19 +169,13 @@ void compile_shader();
void set_lambda();
void set_copy_shader();
void disable_textureSizes();
void ExitFullScreen();
// config functions
FX_ENTRY void FX_CALL grConfigWrapperExt(
#ifndef ANDROID
FxI32, /* resolution parameter not supported on Android build */
#endif
FxI32,
FxBool,
FxBool
);
FX_ENTRY GrScreenResolution_t FX_CALL grWrapperFullScreenResolutionExt(FxU32*, FxU32*);
FX_ENTRY char ** FX_CALL grQueryResolutionsExt(int32_t*);
void grConfigWrapperExt(FxI32,FxBool,FxBool);
uint32_t grWrapperFullScreenResolutionExt(uint32_t * width, uint32_t * height);
char ** grQueryResolutionsExt(int32_t*);
FX_ENTRY FxBool FX_CALL grKeyPressedExt(FxU32 key);
FX_ENTRY void FX_CALL grGetGammaTableExt(FxU32, FxU32*, FxU32*, FxU32*);

View File

@ -623,13 +623,7 @@ grFinish(void);
FX_ENTRY void FX_CALL
grFlush(void);
FX_ENTRY GrContext_t FX_CALL grSstWinOpen(
#ifdef ANDROID
GrScreenRefresh_t refresh_rate, GrColorFormat_t color_format, GrOriginLocation_t origin_location, int nColBuffers, int nAuxBuffers
#else
HWND hWnd, GrScreenResolution_t screen_resolution, GrScreenRefresh_t refresh_rate, GrColorFormat_t color_format, GrOriginLocation_t origin_location, int nColBuffers, int nAuxBuffers
#endif
);
FX_ENTRY GrContext_t FX_CALL grSstWinOpen(GrColorFormat_t color_format, GrOriginLocation_t origin_location, int nColBuffers, int nAuxBuffers);
FX_ENTRY FxBool FX_CALL
grSstWinClose( GrContext_t context );

View File

@ -589,6 +589,9 @@ enum LanguageStringID
ANDROID_MENU_DEBUGGINGOPTIONS = 3111,
ANDROID_MENU_RESETFUNCTIONTIMES = 3112,
ANDROID_MENU_DUMPFUNCTIONTIMES = 3113,
//Video plugin
ANDROID_VIDEO_NATIVE_RES = 3200,
};
#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_RESETFUNCTIONTIMES, "Reset Function Times");
DEF_STR(ANDROID_MENU_DUMPFUNCTIONTIMES, "Dump Function Times");
//Video plugin
DEF_STR(ANDROID_VIDEO_NATIVE_RES, "Native");
}
CLanguage::CLanguage() :

2
changes.txt Normal file
View File

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