Merge pull request #1286 from project64/glide64-cleanup

Glide64 cleanup
This commit is contained in:
zilmar 2017-03-13 20:36:07 +11:00 committed by GitHub
commit d7c9ccf034
63 changed files with 2946 additions and 4237 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

@ -76,7 +76,7 @@ void calc_light(VERTEX *v)
//*
void calc_linear(VERTEX *v)
{
if (g_settings->force_calc_sphere)
if (g_settings->force_calc_sphere())
{
calc_sphere(v);
return;
@ -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

@ -619,25 +619,7 @@ COMBINE cmb;
cmb.tmu0_a_fac = GR_COMBINE_FACTOR_DETAIL_FACTOR, \
percent = (float)(rdp.env_color&0xFF) / 255.0f, \
cmb.dc0_detailmax = cmb.dc1_detailmax = percent
// Bright red, sets up a bright red combine
#ifdef BRIGHT_RED
// Bright red, sets up a bright red combine during the alpha stage
#define BrightRed() { \
CCMB (GR_COMBINE_FUNCTION_LOCAL, \
GR_COMBINE_FACTOR_NONE, \
GR_COMBINE_LOCAL_CONSTANT, \
GR_COMBINE_OTHER_NONE); \
ACMB (GR_COMBINE_FUNCTION_LOCAL, \
GR_COMBINE_FACTOR_NONE, \
GR_COMBINE_LOCAL_CONSTANT, \
GR_COMBINE_OTHER_NONE); \
cmb.ccolor = 0xFF0000FF; \
}
#else
#define BrightRed()
#endif
#define CC(color) cmb.ccolor=(color)&0xFFFFFF00
#define CC_BYTE(byte) { cmb.ccolor=(byte<<8)|(byte<<16)|(byte<<24); }
#define CC_C1MULC2(color1, color2) { \
@ -997,7 +979,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 +5958,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 +8112,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 +8393,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 +8425,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 +8794,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 +11183,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 +15502,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 +15589,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,23 +15637,12 @@ 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)
{
BrightRed();
}
else
{
// use full alpha as default
ac_t0();
}
//tex |= 3;
// use full alpha as default
ac_t0();
}
else
{
@ -15685,7 +15658,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 +15686,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 +15882,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 +15892,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 +15908,7 @@ void CombineBlender()
//hack
//*
if (g_settings->hacks&hack_ISS64)
if (g_settings->hacks(CSettings::hack_ISS64))
{
if (rdp.othermode_l == 0xff5a6379)
{
@ -15946,7 +15919,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"
@ -69,6 +68,7 @@ short Set_basic_mode = 0, Set_texture_dir = 0, Set_log_dir = 0, Set_log_flush =
#include <wtl/atlcrack.h>
extern HINSTANCE hinstDLL;
extern bool g_ghq_use;
extern CriticalSection * g_ProcessDListCS;
@ -107,48 +107,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"
// NCC_COMPRESSION, //"NCC"
S3TC_COMPRESSION, //"S3TC"
FXT1_COMPRESSION, //"FXT1"
};
uint32_t texhirs[] =
{
NO_HIRESTEXTURES, //"Do not use"
RICE_HIRESTEXTURES, //"Rice format"
// GHQ_HIRESTEXTURES, //"GlideHQ format"
// JABO_HIRESTEXTURES, //"Jabo format"
};
#endif
#ifdef _WIN32
template < class T, class TT = CToolTipCtrl >
@ -312,8 +270,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,55 +283,19 @@ 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);
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_cbxTextureSettings.SetCheck(g_settings->texenh_options() ? BST_CHECKED : BST_UNCHECKED);
m_cmbFSResolution.Attach(GetDlgItem(IDC_CMB_FS_RESOLUTION));
int32_t size = 0;
@ -386,24 +306,24 @@ public:
{
m_cmbFSResolution.AddString(aRes[r]);
}
m_cmbFSResolution.SetCurSel(g_settings->wrpResolution < size ? g_settings->wrpResolution : 0);
m_cmbFSResolution.SetCurSel(g_settings->FullScreenRes() < size ? g_settings->FullScreenRes() : 0);
}
TTSetTxt(IDC_CMB_FS_RESOLUTION, "Full screen resolution:\n\nThis sets the full screen resolution.\nAll the resolutions that your video card / monitor support should be displayed.\n\n[Recommended:native(max) resolution of your monitor - unless performance becomes an issue]");
m_cbxAnisotropic.Attach(GetDlgItem(IDC_CBXANISOTROPIC));
m_cbxAnisotropic.SetCheck(g_settings->wrpAnisotropic > 0 ? BST_CHECKED : BST_UNCHECKED);
m_cbxAnisotropic.SetCheck(g_settings->wrpAnisotropic() ? BST_CHECKED : BST_UNCHECKED);
TTSetTxt(IDC_CBXANISOTROPIC, "Anisotropic filtering:\n\nThis filter sharpens and brings out the details of textures that recede into the distance.\nWhen activated, it will use the max anisotropy your video card supports.\nHowever, this will override native way of texture filtering and may cause visual artifacts in some games.\n\n[Recommended: your preference, game dependant]");
m_cbxFBO.Attach(GetDlgItem(IDC_CHK_USE_FRAME_BUFFER_OBJECT));
TTSetTxt(IDC_CHK_USE_FRAME_BUFFER_OBJECT, "Use frame buffer objects:\n\nChanges the way FB effects are rendered - with or without usage of the OpenGL Frame Buffer Objects (FBO) extension.\nThe choice depends on game and your video card. FBO off is good for NVIDIA cards, while for ATI cards, it's usually best that FBOs are turned on.\nAlso, some FB effects works only with one of the methods, no matter, which card you have.\nOn the whole, with FBO off, compatibility/ accuracy is a bit better (which is the case for Resident Evil 2).\nHowever, with FBO on with some systems, it can actually be a bit faster in cases.\n\n[Recommended: video card and game dependant]");
m_cbxFBO.SetCheck(g_settings->wrpFBO > 0 ? BST_CHECKED : BST_UNCHECKED);
m_cbxFBO.SetCheck(g_settings->wrpFBO() > 0 ? BST_CHECKED : BST_UNCHECKED);
m_cbxVRAM.Attach(GetDlgItem(IDC_CHK_AUTODETECT_VRAM));
TTSetTxt(IDC_CHK_AUTODETECT_VRAM, "Autodetect VRAM Size:\n\nSince OpenGL cannot do this reliably at the moment, the option to set this manually is available.\nIf checked, plugin will try to autodetect VRAM size.\nBut if this appears wrong, please uncheck and set it to correct value.\n\n[Recommended: on]");
m_VramSize.Attach(GetDlgItem(IDC_SPIN_VRAM_SIZE));
m_VramSize.SetBuddy(GetDlgItem(IDC_TXT_VRAM_SIZE));
m_spinVRAM.Attach(GetDlgItem(IDC_TXT_VRAM_SIZE));
m_cbxVRAM.SetCheck(g_settings->wrpVRAM == 0 ? BST_CHECKED : BST_UNCHECKED);
m_cbxVRAM.SetCheck(g_settings->wrpVRAM() == 0 ? BST_CHECKED : BST_UNCHECKED);
m_lblMb.Attach(GetDlgItem(IDC_LBL_MB));
AutoDetectChanged();
return TRUE;
@ -414,23 +334,17 @@ 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->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);
g_settings->wrpFBO = m_cbxFBO.GetCheck() == BST_CHECKED;
g_settings->SetScreenRes(m_WindowRes.GetCurSel());
g_settings->SetVsync(m_cbxVSync.GetCheck() == BST_CHECKED);
g_settings->SetTexenhOptions(m_cbxTextureSettings.GetCheck() == BST_CHECKED);
g_settings->SetFullScreenRes(m_cmbFSResolution.GetCurSel());
g_settings->SetWrpAnisotropic(m_cbxAnisotropic.GetCheck() == BST_CHECKED);
g_settings->SetWrpVRAM(m_cbxVRAM.GetCheck() == BST_CHECKED ? 0 : atoi(spinVRAM));
g_settings->SetWrpFBO(m_cbxFBO.GetCheck() == BST_CHECKED);
if (memcmp(&oldsettings, g_settings, sizeof(oldsettings))) //check that settings were changed
{
WriteSettings();
g_settings->WriteSettings();
}
m_options_page->UpdateTextureSettings();
return true;
@ -447,7 +361,7 @@ private:
void AutoDetectChanged(void)
{
m_spinVRAM.SetWindowText(m_cbxVRAM.GetCheck() == BST_CHECKED ? " auto" : stdstr_f("%d",g_settings->wrpVRAM ? g_settings->wrpVRAM : 32).c_str());
m_spinVRAM.SetWindowText(m_cbxVRAM.GetCheck() == BST_CHECKED ? " auto" : stdstr_f("%d",g_settings->wrpVRAM() != 0 ? g_settings->wrpVRAM() : 32).c_str());
m_spinVRAM.EnableWindow(m_cbxVRAM.GetCheck() != BST_CHECKED);
m_VramSize.EnableWindow(m_cbxVRAM.GetCheck() != BST_CHECKED);
m_lblMb.EnableWindow(m_cbxVRAM.GetCheck() != BST_CHECKED);
@ -455,10 +369,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,77 +424,77 @@ 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());
m_cbxFog.Attach(GetDlgItem(IDC_CHK_FOG));
m_cbxFog.SetCheck(g_settings->fog > 0 ? BST_CHECKED : BST_UNCHECKED);
m_cbxFog.SetCheck(g_settings->fog() > 0 ? BST_CHECKED : BST_UNCHECKED);
tooltip = "Buffer clear on every frame:\n\nForces the frame buffer to be cleared every frame drawn.\nUsually frame buffer clear is controlled by the game.\nHowever, in some cases it is not well emulated, and some garbage may be left on the screen.\nIn such cases, this option must be set on.\n\n[Recommended: on]";
TTSetTxt(IDC_CHK_BUFFER_CLEAR, tooltip.c_str());
m_cbxBuffer.Attach(GetDlgItem(IDC_CHK_BUFFER_CLEAR));
m_cbxBuffer.SetCheck(g_settings->buff_clear > 0 ? BST_CHECKED : BST_UNCHECKED);
m_cbxBuffer.SetCheck(g_settings->buff_clear() ? BST_CHECKED : BST_UNCHECKED);
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 +502,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->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->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->SetFog(m_cbxFog.GetCheck() == BST_CHECKED);
g_settings->SetBuffClear(m_cbxBuffer.GetCheck() == BST_CHECKED);
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,100 +586,99 @@ 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());
TTSetTxt(IDC_CMB_FORMAT_CHOICES, tooltip.c_str());
m_cmbHrsFormat.Attach(GetDlgItem(IDC_CMB_FORMAT_CHOICES));
m_cmbHrsFormat.SetItemData(m_cmbHrsFormat.AddString("None"), 0);
m_cmbHrsFormat.SetItemData(m_cmbHrsFormat.AddString("Rice format"), 1);
SetComboBoxIndex(m_cmbHrsFormat, g_settings->ghq_hirs);
m_cmbHrsFormat.SetItemData(m_cmbHrsFormat.AddString("None"), CSettings::HiResPackFormat_None);
m_cmbHrsFormat.SetItemData(m_cmbHrsFormat.AddString("Rice format"), CSettings::HiResPackFormat_Riceformat);
SetComboBoxIndex(m_cmbHrsFormat, g_settings->ghq_hirs());
m_cmbTextureCompression.Attach(GetDlgItem(IDC_CMB_TEX_COMPRESS_MEHTOD));
m_cmbTextureCompression.SetItemData(m_cmbTextureCompression.AddString("S3TC"), 0);
m_cmbTextureCompression.SetItemData(m_cmbTextureCompression.AddString("FXT1"), 1);
SetComboBoxIndex(m_cmbTextureCompression, g_settings->ghq_cmpr);
m_cmbTextureCompression.SetItemData(m_cmbTextureCompression.AddString("S3TC"), CSettings::TextureCompression_S3TC);
m_cmbTextureCompression.SetItemData(m_cmbTextureCompression.AddString("FXT1"), CSettings::TextureCompression_FXT1);
SetComboBoxIndex(m_cmbTextureCompression, g_settings->ghq_cmpr());
tooltip = "Texture cache size:\n\nEnhanced and filtered textures can be cached to aid performance.\nThis setting will adjust how much PC memory will be dedicated for texture cache.\nThis helps boost performance if there are subsequent requests for the same texture (usually the case).\nNormally, 128MB should be more than enough but there is a sweet spot for each game.\nSuper Mario may not need more than 32megs, but Conker streams a lot of textures, so setting 256+ megs can boost performance.\nAdjust accordingly if you are encountering speed issues.\n'0' disables cache.\n\n[Recommended: PC and game dependant]";
TTSetTxt(IDC_TXT_TEXTURE_CACHE, tooltip.c_str());
TTSetTxt(IDC_SPIN_TEXTURE_CACHE, tooltip.c_str());
TTSetTxt(IDC_TEXT_MB, tooltip.c_str());
m_textTexCache.Attach(GetDlgItem(IDC_TXT_TEXTURE_CACHE));
m_textTexCache.SetWindowTextA(stdstr_f("%d", g_settings->ghq_cache_size).c_str());
m_textTexCache.SetWindowTextA(stdstr_f("%d", g_settings->ghq_cache_size()).c_str());
m_spinEnhCacheSize.Attach(GetDlgItem(IDC_SPIN_TEXTURE_CACHE));
m_spinEnhCacheSize.SetBuddy(m_textTexCache);
TTSetTxt(IDC_CHK_IGNORE_BACKGROUND, "Ignore Backgrounds:\n\nIt is used to skip enhancement for long narrow textures, usually used for backgrounds.\nThis may save texture memory greatly and increase performance.\n\n[Recommended: on (off for 'Store' mode)]");
m_cbxEnhIgnoreBG.Attach(GetDlgItem(IDC_CHK_IGNORE_BACKGROUND));
m_cbxEnhIgnoreBG.SetCheck(g_settings->ghq_enht_nobg > 0 ? BST_CHECKED : BST_UNCHECKED);
m_cbxEnhIgnoreBG.SetCheck(g_settings->ghq_enht_nobg() > 0 ? BST_CHECKED : BST_UNCHECKED);
tooltip = "Texture compression:\n\nTextures will be compressed using selected texture compression method.\nThe overall compression ratio is about 1/6 for FXT1 and 1/4 for S3TC.\nIn addition to saving space on the texture cache, the space occupied on the GFX hardware's texture RAM, by the enhanced textures, will be greatly reduced.\nThis minimizes texture RAM usage, decreasing the number of texture swaps to the GFX hardware leading to performance gains.\nHowever, due to the nature of lossy compression of FXT1 and S3TC, using this option can sometimes lead to quality degradation of small size textures and color banding of gradient colored textures.\n\n[Recommended: off]";
TTSetTxt(IDC_CHK_TEX_COMPRESSION, tooltip.c_str());
TTSetTxt(IDC_CHK_HIRES_TEX_COMPRESSION, tooltip.c_str());
m_cbxEnhTexCompression.Attach(GetDlgItem(IDC_CHK_TEX_COMPRESSION));
m_cbxEnhTexCompression.SetCheck(g_settings->ghq_enht_cmpr > 0 ? BST_CHECKED : BST_UNCHECKED);
m_cbxEnhTexCompression.SetCheck(g_settings->ghq_enht_cmpr() > 0 ? BST_CHECKED : BST_UNCHECKED);
m_cbxHrsTexCompression.Attach(GetDlgItem(IDC_CHK_HIRES_TEX_COMPRESSION));
m_cbxHrsTexCompression.SetCheck(g_settings->ghq_hirs_cmpr > 0 ? BST_CHECKED : BST_UNCHECKED);
m_cbxHrsTexCompression.SetCheck(g_settings->ghq_hirs_cmpr() ? BST_CHECKED : BST_UNCHECKED);
TTSetTxt(IDC_CHK_COMPRESS_CACHE, "Compress texture cache:\n\nMemory will be compressed so that more textures can be held in the texture cache.\nThe compression ratio varies with each texture, but 1/5 of the original size would be a modest approximation.\nThey will be decompressed on-the-fly, before being downloaded to the gfx hardware.\nThis option will still help save memory space even when using texture compression.\n\n[Recommended: on]");
m_cbxEnhCompressCache.Attach(GetDlgItem(IDC_CHK_COMPRESS_CACHE));
m_cbxEnhCompressCache.SetCheck(g_settings->ghq_enht_gz > 0 ? BST_CHECKED : BST_UNCHECKED);
m_cbxEnhCompressCache.SetCheck(g_settings->ghq_enht_gz() > 0 ? BST_CHECKED : BST_UNCHECKED);
m_cbxHrsTile.Attach(GetDlgItem(IDC_CHK_TILE_TEX));
TTSetTxt(IDC_CHK_TILE_TEX, "Tile textures:\n\nWhen on, wide texture will be split on several tiles to fit in one 256-width texture.\nThis tiled texture takes much less video memory space and thus overall performance will increase.\nHowever, corresponding polygons must be split too, and this is not polished yet - various issues are possible, including black lines and polygons distortions.\n\n[Recommended: off]");
m_cbxHrsTile.SetCheck(g_settings->ghq_hirs_tile > 0 ? BST_CHECKED : BST_UNCHECKED);
m_cbxHrsTile.SetCheck(g_settings->ghq_hirs_tile() ? BST_CHECKED : BST_UNCHECKED);
m_cbxHrsForce16.Attach(GetDlgItem(IDC_CHK_FORCE_16BPP_TEXT));
TTSetTxt(IDC_CHK_FORCE_16BPP_TEXT, "Force 16bpp textures:\n\nThe color of the textures will be reduced to 16bpp.\nThis is another space saver and performance enhancer.\nThis halves the space used on the texture cache and the GFX hardware's texture RAM.\nColor reduction is done so that the original quality is preserved as much as possible.\nDepending on the texture, this usually is hardly noticeable.\nSometimes though, it can be: skies are a good example.\n\n[Recommended: off]");
m_cbxHrsForce16.SetCheck(g_settings->ghq_hirs_tile > 0 ? BST_CHECKED : BST_UNCHECKED);
m_cbxHrsForce16.SetCheck(g_settings->ghq_hirs_f16bpp() > 0 ? BST_CHECKED : BST_UNCHECKED);
m_cbxHrsTexEdit.Attach(GetDlgItem(IDC_CHK_TEX_DUMP_EDIT));
TTSetTxt(IDC_CHK_TEX_DUMP_EDIT, "Texture dumping mode:\n\nIn this mode, you have that ability to dump textures on screen to the appropriate folder.\nYou can also reload textures while the game is running to see how they look instantly - big time saver!\n\nHotkeys:\n\"R\" reloads hires textures from the texture pack\n\"D\" toggles texture dumps on/off.");
m_cbxHrsTexEdit.SetCheck(g_settings->ghq_hirs_dump > 0 ? BST_CHECKED : BST_UNCHECKED);
m_cbxHrsTexEdit.SetCheck(g_settings->ghq_hirs_dump() > 0 ? BST_CHECKED : BST_UNCHECKED);
m_cbxHrsAltCRC.Attach(GetDlgItem(IDC_CHK_ALT_CRC));
TTSetTxt(IDC_CHK_ALT_CRC, "Alternative CRC calculation:\n\nThis option enables emulation of a palette CRC calculation bug in RiceVideo.\nIf some textures are not loaded, try to set this option on/off.\n\n[Recommended: texture pack dependant, mostly on]");
m_cbxHrsAltCRC.SetCheck(g_settings->ghq_hirs_altcrc > 0 ? BST_CHECKED : BST_UNCHECKED);
if (g_settings->ghq_hirs_dump)
m_cbxHrsAltCRC.SetCheck(g_settings->ghq_hirs_altcrc() > 0 ? BST_CHECKED : BST_UNCHECKED);
if (g_settings->ghq_hirs_dump())
{
m_cbxHrsAltCRC.EnableWindow(false);
}
m_cbxHrsCompressCache.Attach(GetDlgItem(IDC_CHK_HRS_COMPRESS_CACHE));
TTSetTxt(IDC_CHK_HRS_COMPRESS_CACHE, "Compress texture cache:\n\nWhen game started, plugin loads all its hi-resolution textures into PC memory.\nSince hi-resolution textures are usually large, the whole pack can take hundreds megabytes of memory.\nCache compression allows save memory space greatly.\nTextures will be decompressed on-the-fly, before being downloaded to the gfx hardware.\nThis option will still help save memory space even when using texture compression.\n\n[Recommended: on]");
m_cbxHrsCompressCache.SetCheck(g_settings->ghq_hirs_gz > 0 ? BST_CHECKED : BST_UNCHECKED);
m_cbxHrsCompressCache.SetCheck(g_settings->ghq_hirs_gz() > 0 ? BST_CHECKED : BST_UNCHECKED);
m_cbxHrsLetFly.Attach(GetDlgItem(IDC_CHK_USE_ALPHA_FULLY));
TTSetTxt(IDC_CHK_USE_ALPHA_FULLY, "Use Alpha channel fully:\n\nWhen this option is off, 16bit rgba textures will be loaded using RiceVideo style, with 1bit for alpha channel.\nWhen it is on, GlideHQ will check, how alpha channel is used by the hires texture, and select most appropriate format for it.\nThis gives texture designers freedom to play with alpha, as they need, regardless of format of original N64 texture.\nFor older and badly designed texture packs it can cause unwanted black borders.\n\n[Recommended: texture pack dependant]");
m_cbxHrsLetFly.SetCheck(g_settings->ghq_hirs_let_texartists_fly > 0 ? BST_CHECKED : BST_UNCHECKED);
m_cbxHrsLetFly.SetCheck(g_settings->ghq_hirs_let_texartists_fly() > 0 ? BST_CHECKED : BST_UNCHECKED);
m_cbxSaveTexCache.Attach(GetDlgItem(IDC_CHK_TEX_CACHE_HD));
TTSetTxt(IDC_CHK_TEX_CACHE_HD, "Save texture cache to HD:\n\nFor enhanced textures cache:\nThis will save all previously loaded and enhanced textures to HD.\nSo upon next game launch, all the textures will be instantly loaded, resulting in smoother performance.\n\nFor high-resolution textures cache:\nAfter creation, loading hi-res texture will take only a few seconds upon game launch, as opposed to the 5 to 60 seconds a pack can take to load without this cache file.\nThe only downside here is upon any changes to the pack, the cache file will need to be manually deleted.\n\nSaved cache files go into a folder called \"Cache\" within the Textures folder.\n\n[Highly Recommended: on]");
m_cbxSaveTexCache.SetCheck(g_settings->ghq_cache_save > 0 ? BST_CHECKED : BST_UNCHECKED);
m_cbxSaveTexCache.SetCheck(g_settings->ghq_cache_save() > 0 ? BST_CHECKED : BST_UNCHECKED);
return TRUE;
}
@ -763,25 +688,25 @@ 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->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;
g_settings->ghq_enht_gz = (int)m_cbxEnhCompressCache.GetCheck() == BST_CHECKED;
g_settings->ghq_hirs = m_cmbHrsFormat.GetItemData(m_cmbHrsFormat.GetCurSel());
g_settings->ghq_hirs_tile = (int)m_cbxHrsTile.GetCheck() == BST_CHECKED;
g_settings->ghq_hirs_f16bpp = (int)m_cbxHrsForce16.GetCheck() == BST_CHECKED;
g_settings->ghq_hirs_dump = (int)m_cbxHrsTexEdit.GetCheck() == BST_CHECKED;
g_settings->ghq_hirs_altcrc = (int)m_cbxHrsAltCRC.GetCheck() == BST_CHECKED;
g_settings->ghq_hirs_cmpr = (int)m_cbxHrsTexCompression.GetCheck() == BST_CHECKED;
g_settings->ghq_hirs_gz = (int)m_cbxHrsCompressCache.GetCheck() == BST_CHECKED;
g_settings->ghq_hirs_let_texartists_fly = (int)m_cbxHrsLetFly.GetCheck() == BST_CHECKED;
g_settings->ghq_cmpr = (int)m_cmbTextureCompression.GetItemData(m_cmbTextureCompression.GetCurSel());
g_settings->ghq_cache_save = (int)m_cbxSaveTexCache.GetCheck() == BST_CHECKED;
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->SetGhqCacheSize(atoi(texcache));
g_settings->SetGhqEnhtNobg(m_cbxEnhIgnoreBG.GetCheck() == BST_CHECKED);
g_settings->SetGhqEnhtCmpr(m_cbxEnhTexCompression.GetCheck() == BST_CHECKED);
g_settings->SetGhqEnhtGz(m_cbxEnhCompressCache.GetCheck() == BST_CHECKED);
g_settings->SetGhqHirs((CSettings::HiResPackFormat_t)m_cmbHrsFormat.GetItemData(m_cmbHrsFormat.GetCurSel()));
g_settings->SetGhqHirsTile(m_cbxHrsTile.GetCheck() == BST_CHECKED);
g_settings->SetGhqHirsF16bpp(m_cbxHrsForce16.GetCheck() == BST_CHECKED);
g_settings->SetGhqHirsDump(m_cbxHrsTexEdit.GetCheck() == BST_CHECKED);
g_settings->SetGhqHirsAltcrc(m_cbxHrsAltCRC.GetCheck() == BST_CHECKED);
g_settings->SetGhqHirsCmpr(m_cbxHrsTexCompression.GetCheck() == BST_CHECKED);
g_settings->SetGhqHirsGz(m_cbxHrsCompressCache.GetCheck() == BST_CHECKED);
g_settings->SetGhqHirsLetTexartistsFly(m_cbxHrsLetFly.GetCheck() == BST_CHECKED);
g_settings->SetGhqCmpr((CSettings::TextureCompression_t)m_cmbTextureCompression.GetItemData(m_cmbTextureCompression.GetCurSel()));
g_settings->SetGhqCacheSave(m_cbxSaveTexCache.GetCheck() == BST_CHECKED);
if (memcmp(&oldsettings, g_settings, sizeof(oldsettings))) //check that settings were changed
{
WriteSettings();
g_settings->WriteSettings();
}
return true;
}
@ -817,7 +742,7 @@ COptionsSheet::COptionsSheet(_U_STRINGorID /*title*/, UINT /*uStartPage*/, HWND
m_hTextureEnhancement(0)
{
AddPage(&m_pgBasicPage->m_psp);
if (g_settings->advanced_options)
if (g_settings->advanced_options())
{
AddPage(&m_pgEmuSettings->m_psp);
}
@ -833,7 +758,7 @@ COptionsSheet::~COptionsSheet()
void COptionsSheet::UpdateTextureSettings(void)
{
if (g_settings->texenh_options)
if (g_settings->texenh_options())
{
if (m_hTextureEnhancement == NULL)
{
@ -864,7 +789,6 @@ void CALL DllConfig(HWND hParent)
WriteTrace(TraceGlide64, TraceDebug, "-");
#ifdef _WIN32
CGuard guard(*g_ProcessDListCS);
ReadSettings();
if (g_romopen)
{
@ -873,18 +797,17 @@ void CALL DllConfig(HWND hParent)
ReleaseGfx();
rdp_reset();
}
#ifdef TEXTURE_FILTER // Hiroshi Morii <koolsmoky@users.sourceforge.net>
if (g_settings->ghq_use)
if (g_ghq_use)
{
ext_ghq_shutdown();
g_settings->ghq_use = 0;
g_ghq_use = false;
}
#endif
}
else
{
char name[21] = "DEFAULT";
ReadSpecialSettings(name);
g_settings->ReadGameSettings(name);
ZLUT_init();
}
COptionsSheet("Glide64 settings").DoModal(hParent);
@ -896,8 +819,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();
@ -947,18 +872,3 @@ void CALL DllAbout(HWND /*hParent*/)
dlg.DoModal();
#endif
}
void general_setting(short setting_ID, const char * name, unsigned int value)
{
RegisterSetting(setting_ID, Data_DWORD_General, name, NULL, value, NULL);
}
void game_setting(short setting_ID, const char * name, unsigned int value)
{
RegisterSetting(setting_ID, Data_DWORD_Game, name, NULL, value, NULL);
}
void game_setting_default(short setting_ID, const char * name, short default_setting)
{
RegisterSetting2(setting_ID, Data_DWORD_Game, name, NULL, default_setting);
}

View File

@ -47,49 +47,3 @@
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);
extern void game_setting_default(short setting_ID, const char * name, short default_setting);

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

@ -70,10 +70,8 @@ the plugin
#include <stddef.h> // offsetof
#include <glide.h>
#include <Common/MemTest.h>
#include <Settings/Settings.h>
#include "GlideExtensions.h"
#include "rdp.h"
#include "Keys.h"
#include "Config.h"
#include "Settings.h"
@ -99,24 +97,14 @@ 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.
// ********************************
#define LOGNOTKEY // Log if not pressing:
#define LOGKEY 0x11 // this key (CONTROL)
#define LOG_COMMANDS // log the whole 64-bit command as (0x........, 0x........)
//#define CATCH_EXCEPTIONS // catch exceptions so it doesn't freeze and will report
// "The gfx plugin has caused an exception" instead.
#define FLUSH // flush the file buffer. slower logging, but makes sure
// the command is logged before continuing (in case of
// crash or exception, the log will not be cut short)
#ifndef _ENDUSER_RELEASE_
#endif
@ -127,33 +115,16 @@ 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
//********
#ifndef _ENDUSER_RELEASE_
#define BRIGHT_RED // Keep enabled, option in dialog
#endif
#define COLORED_DEBUGGER // ;) pretty colors
// rdram mask at 0x400000 bytes (bah, not right for majora's mask)
//#define BMASK 0x7FFFFF
extern unsigned int BMASK;
#define WMASK 0x3FFFFF
#define DMASK 0x1FFFFF
extern uint32_t update_screen_count;
extern uint32_t resolutions[0x18][2];
int CheckKeyPressed(int key, int mask);
//#define PERFORMANCE
#ifdef PERFORMANCE
@ -164,7 +135,6 @@ extern "C" {
extern int GfxInitDone;
extern bool g_romopen;
extern int to_fullscreen;
extern int debugging;
extern int evoodoo;
extern int ev_fullscreen;
@ -288,8 +258,6 @@ extern "C" {
typedef int(*GETTEXADDR)(int tmu, int texsize);
extern GRSTIPPLE grStippleModeExt;
extern GRSTIPPLE grStipplePatternExt;
extern GETTEXADDR GetTexAddr;
#ifndef GR_STIPPLE_DISABLE
@ -298,10 +266,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->FullScreenRes(), width, height);
return g_settings->FullScreenRes();
}
#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);

File diff suppressed because it is too large Load Diff

View File

@ -1,166 +1,397 @@
#pragma once
#include <string>
class CSettings
{
public:
CSettings();
int card_id;
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
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
};
#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)
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
};
uint32_t frame_buffer;
enum FBCRCMODE
{
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 TextureCompression_t
{
TextureCompression_S3TC = 0x3000,
TextureCompression_FXT1 = 0x1000,
};
enum HiResPackFormat_t
{
HiResPackFormat_None = 0,
HiResPackFormat_Riceformat = 0x00020000,
};
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,
};
enum wfmode_t
{
wfmode_NormalColors = 0,
wfmode_VertexColors = 1,
wfmode_RedOnly = 2,
};
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 advanced_options(void) const { return m_advanced_options; }
inline bool texenh_options(void) const { return m_texenh_options; }
inline bool vsync(void) const { return m_vsync; }
inline ScreenRotate_t rotate(void) const { return m_rotate; }
inline Filtering_t filtering(void) const { return m_filtering; }
inline bool fog (void) const { return m_fog; }
inline bool buff_clear(void) const { return m_buff_clear; }
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;
int ghq_cmpr;
int ghq_hirs;
int ghq_use;
int ghq_enht_cmpr;
int ghq_enht_tile;
int ghq_enht_f16bpp;
int ghq_enht_gz;
int ghq_enht_nobg;
int ghq_hirs_cmpr;
int ghq_hirs_tile;
int ghq_hirs_f16bpp;
int ghq_hirs_gz;
int ghq_hirs_altcrc;
int ghq_cache_save;
int ghq_cache_size;
int ghq_hirs_let_texartists_fly;
int ghq_hirs_dump;
#endif
inline const char * texture_dir(void) const { return m_texture_dir.c_str(); }
inline TextureFilter_t ghq_fltr(void) const { return m_ghq_fltr; }
inline TextureEnhancement_t ghq_enht(void) const { return m_ghq_enht; }
inline TextureCompression_t ghq_cmpr(void) const { return m_ghq_cmpr; }
inline HiResPackFormat_t ghq_hirs(void) const { return m_ghq_hirs; }
inline bool ghq_enht_cmpr(void) const { return m_ghq_enht_cmpr; }
inline bool ghq_enht_f16bpp(void) const { return m_ghq_enht_f16bpp; }
inline bool ghq_enht_gz(void) const { return m_ghq_enht_gz; }
inline bool ghq_enht_nobg(void) const { return m_ghq_enht_nobg; }
inline bool ghq_hirs_cmpr(void) const { return m_ghq_hirs_cmpr; }
inline bool ghq_hirs_tile(void) const { return m_ghq_hirs_tile; }
inline bool ghq_hirs_f16bpp(void) const { return m_ghq_hirs_f16bpp; }
inline bool ghq_hirs_gz(void) const { return m_ghq_hirs_gz; }
inline bool ghq_hirs_altcrc(void) const { return m_ghq_hirs_altcrc; }
inline bool ghq_cache_save(void) const { return m_ghq_cache_save; }
inline int ghq_cache_size(void) const { return m_ghq_cache_size; }
inline bool ghq_hirs_let_texartists_fly(void) const { return m_ghq_hirs_let_texartists_fly; }
inline bool ghq_hirs_dump(void) const { return m_ghq_hirs_dump; }
//Debug
int autodetect_ucode;
int ucode;
int logging;
int elogging;
int log_clear;
int run_in_window;
int filter_cache;
int unk_as_red;
int log_unk;
int unk_clear;
int wireframe;
int wfmode;
inline bool autodetect_ucode(void) const { return m_autodetect_ucode; }
inline ucode_t ucode(void) const { return m_ucode; }
inline bool unk_as_red(void) const { return m_unk_as_red; }
inline bool wireframe(void) const { return m_wireframe; }
inline wfmode_t wfmode(void) const { return m_wfmode; }
// Special fixes
int offset_x, offset_y;
int scale_x, scale_y;
int fast_crc;
int alt_tex_size;
int use_sts1_only;
int flame_corona; //hack for zeldas flame's corona
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
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
int clip_zmin; //enable near z clipping
int clip_zmax; //enable far plane clipping;
int adjust_aspect; //adjust screen aspect for wide screen mode
int force_calc_sphere; //use spheric mapping only, Ridge Racer 64
int pal230; //set special scale for PAL games
int correct_viewport; //correct viewport values
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 fast_crc(void) const { return m_fast_crc; }
inline bool alt_tex_size(void) const { return m_alt_tex_size; }
inline bool use_sts1_only(void) const { return m_use_sts1_only; }
inline bool flame_corona(void) const { return m_flame_corona; } //hack for zeldas flame's corona
inline bool increase_texrect_edge(void) const { return m_increase_texrect_edge; } // add 1 to lower right corner coordinates of texrect
inline bool decrease_fillrect_edge(void) const { return m_decrease_fillrect_edge; }; // sub 1 from lower right corner coordinates of fillrect
inline bool texture_correction(void) const { return m_texture_correction; } // enable perspective texture correction emulation. is on by default
inline StippleMode_t stipple_mode(void) const { return m_stipple_mode; } //used for dithered alpha emulation
inline uint32_t stipple_pattern(void) const { return m_stipple_pattern; } //used for dithered alpha emulation
inline bool force_microcheck(void) const { return m_force_microcheck; } //check microcode each frame, for mixed F3DEX-S2DEX games
inline bool force_quad3d(void) const { return m_force_quad3d; } //force 0xb5 command to be quad, not line 3d
inline bool clip_zmin(void) const { return m_clip_zmin; } //enable near z clipping
inline bool clip_zmax(void) const { return m_clip_zmax; } //enable far plane clipping
inline bool adjust_aspect(void) const { return m_adjust_aspect; } //adjust screen aspect for wide screen mode
inline bool force_calc_sphere(void) const { return m_force_calc_sphere; } //use spheric mapping only, Ridge Racer 64
inline bool pal230(void) const { return m_pal230; } //use spheric mapping only, Ridge Racer 64
inline bool correct_viewport(void) const { return m_correct_viewport; } //correct viewport values
inline bool zmode_compare_less(void) const { return m_zmode_compare_less; } //force GR_CMP_LESS for zmode=0 (opaque)and zmode=1 (interpenetrating)
inline bool old_style_adither(void) const { return m_old_style_adither; } //apply alpha dither regardless of alpha_dither_mode
inline bool n64_z_scale(void) const { return m_n64_z_scale; } //scale vertex z value before writing to depth buffer, as N64 does.
inline bool hacks(hacks_t hack) const { return (m_hacks & hack) == hack; } //Special game hacks
//wrapper settings
#ifndef ANDROID
int wrpResolution;
inline uint32_t FullScreenRes(void) const { return m_FullScreenRes; }
#endif
int wrpVRAM;
int wrpFBO;
int wrpAnisotropic;
inline int wrpVRAM(void) const { return m_wrpVRAM; }
inline bool wrpFBO(void) const { return m_wrpFBO; }
inline bool wrpAnisotropic(void) const { return m_wrpAnisotropic; }
inline bool FlushLogs(void) const { return m_FlushLogs; }
void SetTexenhOptions(bool value);
void SetScreenRes(uint32_t value);
void SetAspectmode(AspectMode_t value);
void SetLODmode(PixelLevelOfDetail_t value);
void SetVsync(bool value);
void SetFiltering(Filtering_t value);
void SetSwapMode(SwapMode_t value);
void SetFog(bool value);
void SetBuffClear(bool value);
void SetWrpAnisotropic(bool value);
void SetWrpVRAM(int value);
void SetWrpFBO(bool value);
void SetGhqFltr(TextureFilter_t value);
void SetGhqEnht(TextureEnhancement_t value);
void SetGhqCmpr(TextureCompression_t value);
void SetGhqHirs(HiResPackFormat_t value);
void SetGhqEnhtGz(bool value);
void SetGhqHirsTile(bool value);
void SetGhqHirsF16bpp(bool value);
void SetGhqHirsDump(bool value);
void SetGhqEnhtNobg(bool value);
void SetGhqEnhtCmpr(bool value);
void SetGhqHirsAltcrc(bool value);
void SetGhqHirsCmpr(bool value);
void SetGhqHirsGz(bool value);
void SetGhqCacheSave(bool value);
void SetGhqHirsLetTexartistsFly(bool value);
void SetGhqCacheSize(int value);
void UpdateFrameBufferBits(uint32_t BitsToAdd, uint32_t BitsToRemove);
ucode_t DetectUCode(uint32_t uc_crc);
void SetUcode(ucode_t value);
#ifndef ANDROID
void SetFullScreenRes(uint32_t value);
#endif
void ReadSettings();
void ReadGameSettings(const char * name);
void WriteSettings(void);
void UpdateScreenSize(bool fullscreen);
private:
static void general_setting(short setting_ID, const char * name, unsigned int value);
static void game_setting(short setting_ID, const char * name, unsigned int value);
static void game_setting_default(short setting_ID, const char * name, short default_setting);
void RegisterSettings(void);
void UpdateAspectRatio(void);
void SettingsChanged(void);
static void stSettingsChanged(void * _this)
{
((CSettings *)_this)->SettingsChanged();
}
short m_Set_basic_mode;
short m_Set_texture_dir;
short m_Set_log_dir;
short m_Set_log_flush;
bool m_dirty;
#ifndef ANDROID
uint32_t m_FullScreenRes;
#endif
int m_wrpVRAM;
bool m_wrpFBO;
bool m_wrpAnisotropic;
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;
bool m_fog;
bool m_buff_clear;
SwapMode_t m_swapmode;
PixelLevelOfDetail_t m_lodmode;
bool m_advanced_options;
bool m_texenh_options;
bool m_vsync;
std::string m_texture_dir;
TextureFilter_t m_ghq_fltr;
TextureEnhancement_t m_ghq_enht;
TextureCompression_t m_ghq_cmpr;
HiResPackFormat_t m_ghq_hirs;
bool m_ghq_enht_cmpr;
bool m_ghq_enht_f16bpp;
bool m_ghq_enht_gz;
bool m_ghq_enht_nobg;
bool m_ghq_hirs_cmpr;
bool m_ghq_hirs_tile;
bool m_ghq_hirs_f16bpp;
bool m_ghq_hirs_gz;
bool m_ghq_hirs_altcrc;
bool m_ghq_cache_save;
int m_ghq_cache_size;
bool m_ghq_hirs_let_texartists_fly;
bool m_ghq_hirs_dump;
bool m_autodetect_ucode;
bool m_unk_as_red;
bool m_wireframe;
wfmode_t m_wfmode;
ucode_t m_ucode;
bool m_fast_crc;
bool m_alt_tex_size;
bool m_use_sts1_only;
bool m_flame_corona;
bool m_increase_texrect_edge;
bool m_decrease_fillrect_edge;
bool m_texture_correction;
StippleMode_t m_stipple_mode;
uint32_t m_stipple_pattern;
bool m_force_microcheck;
bool m_force_quad3d;
bool m_clip_zmin;
bool m_clip_zmax;
bool m_adjust_aspect;
bool m_force_calc_sphere;
bool m_pal230;
bool m_correct_viewport;
bool m_zmode_compare_less;
bool m_old_style_adither;
bool m_n64_z_scale;
hacks_t m_hacks;
};
extern CSettings * g_settings;

View File

@ -0,0 +1,48 @@
/****************************************************************************
* *
* 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_ghq_fltr, Set_ghq_cmpr, Set_ghq_enht, Set_ghq_hirs, Set_ghq_enht_cmpr,
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,11 +457,11 @@ 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;
if (g_settings->fog && (rdp.flags & FOG_ENABLED))
if (g_settings->fog() && (rdp.flags & FOG_ENABLED))
{
grFogMode(GR_FOG_WITH_TABLE_ON_FOGCOORD_EXT);
}
@ -519,14 +519,14 @@ 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;
rdp.update |= UPDATE_ZBUF_ENABLED | UPDATE_COMBINE | UPDATE_TEXTURE | UPDATE_ALPHA_COMPARE;
rdp.update |= UPDATE_VIEWPORT | UPDATE_SCISSOR;
if (g_settings->fog && (rdp.flags & FOG_ENABLED))
if (g_settings->fog() && (rdp.flags & FOG_ENABLED))
grFogMode(GR_FOG_WITH_TABLE_ON_FOGCOORD_EXT);
WriteTrace(TraceRDP, TraceDebug, "CopyTextureBuffer draw, OK");
rdp.tbuff_tex = 0;
@ -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;
@ -580,7 +580,7 @@ int CopyDepthBuffer()
grAuxBufferExt(GR_BUFFER_TEXTUREAUXBUFFER_EXT);
rdp.update |= UPDATE_ZBUF_ENABLED | UPDATE_COMBINE | UPDATE_TEXTURE | UPDATE_ALPHA_COMPARE;
if (g_settings->fog && (rdp.flags & FOG_ENABLED))
if (g_settings->fog() && (rdp.flags & FOG_ENABLED))
grFogMode(GR_FOG_WITH_TABLE_ON_FOGCOORD_EXT);
WriteTrace(TraceRDP, TraceDebug, "CopyDepthBuffer draw, OK");
rdp.tbuff_tex = 0;
@ -654,7 +654,7 @@ int SwapTextureBuffer()
rdp.update |= UPDATE_VIEWPORT | UPDATE_SCISSOR;
}
rdp.update |= UPDATE_ZBUF_ENABLED | UPDATE_COMBINE | UPDATE_TEXTURE | UPDATE_ALPHA_COMPARE;
if (g_settings->fog && (rdp.flags & FOG_ENABLED))
if (g_settings->fog() && (rdp.flags & FOG_ENABLED))
{
grFogMode(GR_FOG_WITH_TABLE_ON_FOGCOORD_EXT);
}
@ -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,11 @@ 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 {
extern bool g_ghq_use;
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 +72,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
@ -203,7 +200,7 @@ void GetTexInfo(int id, int tile)
mask_width = (rdp.tiles[tile].mask_s == 0) ? (tile_width) : (1 << rdp.tiles[tile].mask_s);
mask_height = (rdp.tiles[tile].mask_t == 0) ? (tile_height) : (1 << rdp.tiles[tile].mask_t);
if (g_settings->alt_tex_size)
if (g_settings->alt_tex_size())
{
// ** ALTERNATE TEXTURE SIZE METHOD **
// Helps speed in some games that loaded weird-sized textures, but could break other
@ -356,7 +353,7 @@ void GetTexInfo(int id, int tile)
if (rdp.tiles[tile].size == 3)
line <<= 1;
uint32_t crc = 0;
if (g_settings->fast_crc)
if (g_settings->fast_crc())
{
line = (line - wid_64) << 3;
if (wid_64 < 1) wid_64 = 1;
@ -527,28 +524,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 +869,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 +937,6 @@ void TexCache()
WriteTrace(TraceRDP, TraceDebug, " | +- TexCache End");
}
#ifdef TEXTURE_FILTER
/** cite from RiceVideo */
inline uint32_t CalculateDXT(uint32_t txl2words)
{
@ -996,7 +970,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 +1002,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 +1027,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,11 +1254,10 @@ 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;
if (g_settings->ghq_use)
if (g_ghq_use)
{
int bpl;
uint8_t* addr = (uint8_t*)(gfx.RDRAM + rdp.addr[rdp.tiles[td].t_mem]);
@ -1329,7 +1299,7 @@ void LoadTex(int id, int tmu)
{
if (rdp.tiles[td].size == 1)
paladdr = (uint8_t*)(rdp.pal_8_rice);
else if (g_settings->ghq_hirs_altcrc)
else if (g_settings->ghq_hirs_altcrc())
paladdr = (uint8_t*)(rdp.pal_8_rice + (rdp.tiles[td].palette << 5));
else
paladdr = (uint8_t*)(rdp.pal_8_rice + (rdp.tiles[td].palette << 4));
@ -1359,7 +1329,6 @@ void LoadTex(int id, int tmu)
if (ghqTexInfo.data)
;//do nothing
else
#endif
if (splits > 1)
{
cache->scale_y = 0.125f;
@ -1491,11 +1460,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,46 +1581,10 @@ void LoadTex(int id, int tmu)
if (GfxInitDone)
{
#ifdef TEXTURE_FILTER // Hiroshi Morii <koolsmoky@users.sourceforge.net>
if (g_settings->ghq_use)
if (g_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))
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);
if (ghqTexInfo.data)
@ -1713,17 +1642,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 +1681,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 +1692,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;
@ -799,10 +802,14 @@ void do_triangle_stuff(uint16_t linew, int old_interpolate) // what else?? do th
rdp.clip = 0;
else
{
if (!g_settings->clip_zmin)
if (!g_settings->clip_zmin())
{
rdp.clip &= ~CLIP_ZMIN;
if (!g_settings->clip_zmax)
}
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;
@ -1018,7 +1025,7 @@ static void CalculateLOD(VERTEX *v, int n)
float ScaleZ(float z)
{
if (g_settings->n64_z_scale)
if (g_settings->n64_z_scale())
{
int iz = (int)(z*8.0f + 0.5f);
if (iz < 0) iz = 0;
@ -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,21 +1569,14 @@ 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)
if (g_settings->wireframe())
{
SetWireframeCol();
for (i = 0; i < n; i++)
@ -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);
@ -1874,14 +1792,14 @@ void update()
switch ((rdp.rm & 0xC00) >> 10) {
case 0:
grDepthBiasLevel(0);
grDepthBufferFunction(g_settings->zmode_compare_less ? GR_CMP_LESS : GR_CMP_LEQUAL);
grDepthBufferFunction(g_settings->zmode_compare_less() ? GR_CMP_LESS : GR_CMP_LEQUAL);
break;
case 1:
grDepthBiasLevel(-4);
grDepthBufferFunction(g_settings->zmode_compare_less ? GR_CMP_LESS : GR_CMP_LEQUAL);
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:
@ -1958,23 +1876,20 @@ void update()
}
if (rdp.acmp == 3 && rdp.cycle_mode < 2)
{
if (grStippleModeExt != 0)
if (g_settings->old_style_adither() || rdp.alpha_dither_mode != 3)
{
if (g_settings->old_style_adither || rdp.alpha_dither_mode != 3) {
WriteTrace(TraceRDP, TraceDebug, " |- alpha compare: dither");
grStippleModeExt(g_settings->stipple_mode);
}
else
grStippleModeExt(GR_STIPPLE_DISABLE);
WriteTrace(TraceRDP, TraceDebug, " |- alpha compare: dither");
grStippleMode(g_settings->stipple_mode());
}
else
{
grStippleMode(GR_STIPPLE_DISABLE);
}
}
else
{
if (grStippleModeExt)
{
//WriteTrace(TraceRDP, TraceDebug, " |- alpha compare: dither disabled");
grStippleModeExt(GR_STIPPLE_DISABLE);
}
//WriteTrace(TraceRDP, TraceDebug, " |- alpha compare: dither disabled");
grStippleMode(GR_STIPPLE_DISABLE);
}
}
// Cull mode (leave this in for z-clipped triangles)
@ -2001,7 +1916,7 @@ void update()
}
//Added by Gonetz.
if (g_settings->fog && (rdp.update & UPDATE_FOG_ENABLED))
if (g_settings->fog() && (rdp.update & UPDATE_FOG_ENABLED))
{
rdp.update ^= UPDATE_FOG_ENABLED;
@ -2053,8 +1968,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)
@ -2092,10 +2007,7 @@ void set_message_combiner()
GR_BLEND_ZERO,
GR_BLEND_ZERO);
grAlphaTestFunction(GR_CMP_ALWAYS);
if (grStippleModeExt)
{
grStippleModeExt(GR_STIPPLE_DISABLE);
}
grStippleMode(GR_STIPPLE_DISABLE);
grTexFilterMode(0, GR_TEXTUREFILTER_BILINEAR, GR_TEXTUREFILTER_BILINEAR);
grTexCombine(GR_TMU1,
GR_COMBINE_FUNCTION_NONE,

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
@ -167,12 +164,6 @@ typedef struct {
uint32_t lr_y;
} SCISSOR;
#ifdef TEXTURE_FILTER
extern uint32_t texfltr[];
extern uint32_t texenht[];
extern uint32_t texcmpr[];
extern uint32_t texhirs[];
typedef struct {
uint16_t tile_ul_s;
uint16_t tile_ul_t;
@ -182,30 +173,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 +292,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 +468,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 +489,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 +600,6 @@ void ChangeSize();
void GoToFullScreen();
extern RDP rdp;
extern HOTKEY_INFO hotkey_info;
extern VOODOO voodoo;
extern GrTexInfo fontTex;
@ -649,7 +609,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;
@ -369,10 +357,10 @@ static void uc0_movemem()
short trans_x = ((short*)gfx.RDRAM)[(a + 4) ^ 1] / 4;
short trans_y = ((short*)gfx.RDRAM)[(a + 5) ^ 1] / 4;
short trans_z = ((short*)gfx.RDRAM)[(a + 6) ^ 1];
if (g_settings->correct_viewport)
if (g_settings->correct_viewport())
{
scale_x = abs(scale_x);
scale_y = abs(scale_y);
scale_x = (short)abs(scale_x);
scale_y = (short)abs(scale_y);
}
rdp.view_scale[0] = scale_x * rdp.scale_x;
rdp.view_scale[1] = -scale_y * rdp.scale_y;
@ -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;
@ -931,8 +922,10 @@ static void uc0_setothermode_l()
rdp.update |= UPDATE_FOG_ENABLED; //if blender has no fog bits, fog must be set off
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;
if (g_settings->flame_corona() && (rdp.rm == 0x00504341)) //hack for flame's corona
{
rdp.othermode_l |= 0x00000010;
}
WriteTrace(TraceRDP, TraceDebug, "rendermode: %08lx", rdp.othermode_l); // just output whole othermode_l
}

View File

@ -104,7 +104,7 @@ static void uc1_tri2()
static void uc1_line3d()
{
if (!g_settings->force_quad3d && ((rdp.cmd1 & 0xFF000000) == 0) && ((rdp.cmd0 & 0x00FFFFFF) == 0))
if (!g_settings->force_quad3d() && ((rdp.cmd1 & 0xFF000000) == 0) && ((rdp.cmd0 & 0x00FFFFFF) == 0))
{
uint16_t width = (uint16_t)(rdp.cmd1 & 0xFF) + 3;

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;
@ -413,8 +413,10 @@ static void uc2_geom_mode()
{
if ((rdp.flags & ZBUF_ENABLED))
{
if (!g_settings->flame_corona || (rdp.rm != 0x00504341)) //hack for flame's corona
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;
@ -233,7 +231,6 @@ void DrawHiresDepthImage(const DRAWIMAGE & d)
GR_ASPECT_LOG2_1x1, GR_TEXFMT_RGB_565, GR_MIPMAPLEVELMASK_BOTH);
grRenderBuffer(GR_BUFFER_TEXTUREBUFFER_EXT);
grAuxBufferExt(GR_BUFFER_AUXBUFFER);
grSstOrigin(GR_ORIGIN_UPPER_LEFT);
grBufferClear(0, 0, 0xFFFF);
grDrawTriangle(&v[0], &v[2], &v[1]);
grDrawTriangle(&v[2], &v[3], &v[1]);
@ -246,12 +243,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 +259,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++)
@ -289,7 +286,9 @@ void DrawImage(DRAWIMAGE & d)
{
if (d.imageW == 0 || d.imageH == 0 || d.frameH == 0) return;
int x_size, y_size, x_shift, y_shift, line;
int x_shift, y_shift;
uint16_t x_size, y_size, line;
// choose optimum size for the format/size
switch (d.imageSiz)
{
@ -356,15 +355,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 +446,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 +549,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 +598,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 +663,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 +730,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);
@ -979,7 +951,7 @@ static void uc6_draw_polygons(VERTEX v[4])
}
rdp.update |= UPDATE_ZBUF_ENABLED | UPDATE_VIEWPORT;
if (g_settings->fog && (rdp.flags & FOG_ENABLED))
if (g_settings->fog() && (rdp.flags & FOG_ENABLED))
{
grFogMode(GR_FOG_WITH_TABLE_ON_FOGCOORD_EXT);
}
@ -1276,7 +1248,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 +1356,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 +1491,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;
@ -1688,7 +1660,7 @@ void uc6_sprite2d()
}
rdp.update |= UPDATE_ZBUF_ENABLED | UPDATE_VIEWPORT;
if (g_settings->fog && (rdp.flags & FOG_ENABLED))
if (g_settings->fog() && (rdp.flags & FOG_ENABLED))
{
grFogMode(GR_FOG_WITH_TABLE_ON_FOGCOORD_EXT);
}

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

@ -146,8 +146,6 @@ TxHiResCache::load(boolean replace) /* 0 : reload, 1 : replace partial */
switch (_options & HIRESTEXTURES_MASK)
{
case GHQ_HIRESTEXTURES:
break;
case RICE_HIRESTEXTURES:
INFO(80, "-----\n");
INFO(80, "using Rice hires texture format...\n");
@ -163,8 +161,6 @@ TxHiResCache::load(boolean replace) /* 0 : reload, 1 : replace partial */
dir_path.AppendDirectory(_ident.c_str());
loadHiResTextures(dir_path, replace);
break;
case JABO_HIRESTEXTURES:
;
}
return 1;

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();
}
@ -1697,7 +1689,7 @@ grChromakeyValue(GrColor_t value)
g_chroma_color[2], g_chroma_color[3]);
}
static void setPattern()
void setPattern()
{
int i;
GLubyte stip[32 * 4];
@ -1732,15 +1724,6 @@ static void setPattern()
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
}
FX_ENTRY void FX_CALL
grStipplePattern(
GrStipplePattern_t stipple)
{
WriteTrace(TraceResolution, TraceDebug, "value: %x", stipple);
srand(stipple);
setPattern();
}
FX_ENTRY void FX_CALL
grStippleMode(GrStippleMode_t mode)
{

View File

@ -350,7 +350,7 @@ void FindBestDepthBias()
glVertex3f(float(x + 4 - widtho) / (width / 2), float(4 - heighto) / (height / 2), 0.5);
glVertex3f(float(x - widtho) / (width / 2), float(4 - heighto) / (height / 2), 0.5);
glEnd();
glReadPixels(x + 2, 2 + viewport_offset, 1, 1, GL_DEPTH_COMPONENT, GL_FLOAT, &z);
glReadPixels(x + 2, 2 + g_viewport_offset, 1, 1, GL_DEPTH_COMPONENT, GL_FLOAT, &z);
z -= 0.75f + 8e-6f;
if (z < 0.0f) z = -z;
if (z > 0.01f) continue;
@ -397,7 +397,7 @@ grDrawTriangle(const void *a, const void *b, const void *c)
vbo_enable();
if (nvidia_viewport_hack && !render_to_texture)
{
glViewport(0, viewport_offset, viewport_width, viewport_height);
glViewport(0, g_viewport_offset, viewport_width, viewport_height);
nvidia_viewport_hack = 0;
}
@ -436,7 +436,7 @@ grDrawPoint(const void *pt)
if(nvidia_viewport_hack && !render_to_texture)
{
glViewport(0, viewport_offset, viewport_width, viewport_height);
glViewport(0, g_viewport_offset, viewport_width, viewport_height);
nvidia_viewport_hack = 0;
}
@ -506,7 +506,7 @@ grDrawLine(const void *a, const void *b)
if(nvidia_viewport_hack && !render_to_texture)
{
glViewport(0, viewport_offset, viewport_width, viewport_height);
glViewport(0, g_viewport_offset, viewport_width, viewport_height);
nvidia_viewport_hack = 0;
}
@ -579,7 +579,7 @@ grDrawVertexArray(FxU32 mode, FxU32 Count, void *pointers2)
if (nvidia_viewport_hack && !render_to_texture)
{
glViewport(0, viewport_offset, viewport_width, viewport_height);
glViewport(0, g_viewport_offset, viewport_width, viewport_height);
nvidia_viewport_hack = 0;
}
@ -603,7 +603,7 @@ grDrawVertexArrayContiguous(FxU32 mode, FxU32 Count, void *pointers, FxU32 strid
if (nvidia_viewport_hack && !render_to_texture)
{
glViewport(0, viewport_offset, viewport_width, viewport_height);
glViewport(0, g_viewport_offset, viewport_width, viewport_height);
nvidia_viewport_hack = 0;
}

View File

@ -22,7 +22,6 @@
#ifdef _WIN32
#include <windows.h>
#include <commctrl.h>
#else
#include <stdint.h>
#include <stdarg.h>
@ -72,8 +71,8 @@ if (x+width >= screen_width) {
width = screen_width - x;
//printf("resizing w --> %d\n", width);
}
if (y+height >= screen_height+viewport_offset) {
height = screen_height+viewport_offset - y;
if (y+height >= screen_height+g_viewport_offset) {
height = screen_height+g_viewport_offset - y;
//printf("resizing h --> %d\n", height);
}
glCopyTexSubImage2D(target, level, 0, 0, x, y, width, height);
@ -162,7 +161,7 @@ int default_texture; // the infamous "32*1024*1024" is now configurable
int current_texture;
int depth_texture, color_texture;
int glsl_support = 1;
int viewport_width, viewport_height, viewport_offset = 0, nvidia_viewport_hack = 0;
int viewport_width, viewport_height, g_viewport_offset = 0, nvidia_viewport_hack = 0;
int save_w, save_h;
int lfb_color_fmt;
float invtex[2];
@ -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;
@ -287,11 +280,11 @@ grClipWindow(FxU32 minx, FxU32 miny, FxU32 maxx, FxU32 maxy)
if (int(miny) < 0) miny = 0;
if (maxx < minx) maxx = minx;
if (maxy < miny) maxy = miny;
glScissor(minx, miny + viewport_offset, maxx - minx, maxy - miny);
glScissor(minx, miny + g_viewport_offset, maxx - minx, maxy - miny);
//printf("gl scissor %d %d %d %d\n", minx, miny, maxx, maxy);
}
else {
glScissor(minx, (viewport_offset)+g_height - maxy, maxx - minx, maxy - miny);
glScissor(minx, (g_viewport_offset)+g_height - maxy, maxx - minx, maxy - miny);
}
glEnable(GL_SCISSOR_TEST);
}
@ -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,16 +392,16 @@ 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;
// ZIGGY viewport_offset is WIN32 specific, with SDL just set it to zero
viewport_offset = 0; //-10 //-20;
//g_viewport_offset = ((screen_resolution>>2) > 20) ? screen_resolution >> 2 : 20;
// ZIGGY g_viewport_offset is WIN32 specific, with SDL just set it to zero
g_viewport_offset = 0; //-10 //-20;
printf("(II) Setting video mode %dx%d...\n", g_width, g_height);
glViewport(0, viewport_offset, g_width, g_height);
glViewport(0, g_viewport_offset, g_width, g_height);
lfb_color_fmt = color_format;
if (origin_location != GR_ORIGIN_UPPER_LEFT) WriteTrace(TraceGlitch, TraceWarning, "origin must be in upper left corner");
if (nColBuffers != 2) WriteTrace(TraceGlitch, TraceWarning, "number of color buffer is not 2");
@ -542,12 +529,12 @@ FX_ENTRY GrContext_t FX_CALL grSstWinOpen( GrScreenRefresh_t refresh_rate, GrCol
#endif
#ifdef _WIN32
glViewport(0, viewport_offset, width, height);
glViewport(0, g_viewport_offset, width, height);
viewport_width = width;
viewport_height = height;
nvidia_viewport_hack = 1;
#else
glViewport(0, viewport_offset, g_width, g_height);
glViewport(0, g_viewport_offset, g_width, g_height);
viewport_width = g_width;
viewport_height = g_height;
#endif // _WIN32
@ -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;
}
@ -749,26 +725,26 @@ FX_ENTRY void FX_CALL grTextureBufferExt(GrChipID_t tmu,
if (save_w) {
if (tw > save_w && th > save_h) {
glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, save_h,
0, viewport_offset + save_h, tw, th - save_h);
0, g_viewport_offset + save_h, tw, th - save_h);
glCopyTexSubImage2D(GL_TEXTURE_2D, 0, save_w, 0,
save_w, viewport_offset, tw - save_w, save_h);
save_w, g_viewport_offset, tw - save_w, save_h);
save_w = tw;
save_h = th;
}
else if (tw > save_w) {
glCopyTexSubImage2D(GL_TEXTURE_2D, 0, save_w, 0,
save_w, viewport_offset, tw - save_w, save_h);
save_w, g_viewport_offset, tw - save_w, save_h);
save_w = tw;
}
else if (th > save_h) {
glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, save_h,
0, viewport_offset + save_h, save_w, th - save_h);
0, g_viewport_offset + save_h, save_w, th - save_h);
save_h = th;
}
}
else {
glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0,
0, viewport_offset, tw, th);
0, g_viewport_offset, tw, th);
save_w = tw;
save_h = th;
}
@ -817,12 +793,12 @@ FX_ENTRY void FX_CALL grTextureBufferExt(GrChipID_t tmu,
//printf("viewport %dx%d\n", width, height);
if (g_height > screen_height) {
glViewport(0, viewport_offset + screen_height - g_height, g_width, g_height);
glViewport(0, g_viewport_offset + screen_height - g_height, g_width, g_height);
}
else
glViewport(0, viewport_offset, g_width, g_height);
glViewport(0, g_viewport_offset, g_width, g_height);
glScissor(0, viewport_offset, g_width, g_height);
glScissor(0, g_viewport_offset, g_width, g_height);
}
else {
if (!render_to_texture) //initialization
@ -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
@ -1359,7 +1333,7 @@ void updateTexture()
//glDeleteTextures( 1, &pBufferAddress );
glBindTexture(GL_TEXTURE_2D, pBufferAddress);
glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB,
0, viewport_offset, g_width, g_height, 0);
0, g_viewport_offset, g_width, g_height, 0);
glBindTexture(GL_TEXTURE_2D, default_texture);
//glPopAttrib();
@ -1385,7 +1359,7 @@ FX_ENTRY void FX_CALL grFramebufferCopyExt(int x, int y, int w, int h,
//glReadBuffer(current_buffer);
glBindTexture(GL_TEXTURE_2D, depth_texture);
glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT,
0, viewport_offset, tw, th, 0);
0, g_viewport_offset, tw, th, 0);
glBindTexture(GL_TEXTURE_2D, default_texture);
return;
}
@ -1448,8 +1422,8 @@ grRenderBuffer(GrBuffer_t buffer)
}
curBufferAddr = 0;
glViewport(0, viewport_offset, g_width, viewport_height);
glScissor(0, viewport_offset, g_width, g_height);
glViewport(0, g_viewport_offset, g_width, viewport_height);
glScissor(0, g_viewport_offset, g_width, g_height);
#ifdef SAVE_CBUFFER
if (!use_fbo && render_to_texture == 2) {
@ -1688,7 +1662,7 @@ GrLfbInfo_t *info)
info->strideInBytes = g_width * 4;
info->writeMode = GR_LFBWRITEMODE_888;
info->origin = origin;
glReadPixels(0, viewport_offset, g_width, g_height, GL_RGBA, GL_UNSIGNED_BYTE, frameBuffer);
glReadPixels(0, g_viewport_offset, g_width, g_height, GL_RGBA, GL_UNSIGNED_BYTE, frameBuffer);
}
else {
buf = (unsigned char*)malloc(g_width*g_height * 4);
@ -1697,7 +1671,7 @@ GrLfbInfo_t *info)
info->strideInBytes = g_width * 2;
info->writeMode = GR_LFBWRITEMODE_565;
info->origin = origin;
glReadPixels(0, viewport_offset, g_width, g_height, GL_RGBA, GL_UNSIGNED_BYTE, buf);
glReadPixels(0, g_viewport_offset, g_width, g_height, GL_RGBA, GL_UNSIGNED_BYTE, buf);
for (j = 0; j < g_height; j++)
{
@ -1718,7 +1692,7 @@ GrLfbInfo_t *info)
info->strideInBytes = g_width * 2;
info->writeMode = GR_LFBWRITEMODE_ZA16;
info->origin = origin;
glReadPixels(0, viewport_offset, g_width, g_height, GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT, depthBuffer);
glReadPixels(0, g_viewport_offset, g_width, g_height, GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT, depthBuffer);
}
}
@ -1767,7 +1741,7 @@ FxU32 dst_stride, void *dst_data)
{
buf = (unsigned char*)malloc(src_width*src_height * 4);
glReadPixels(src_x, (viewport_offset)+g_height - src_y - src_height, src_width, src_height, GL_RGBA, GL_UNSIGNED_BYTE, buf);
glReadPixels(src_x, (g_viewport_offset)+g_height - src_y - src_height, src_width, src_height, GL_RGBA, GL_UNSIGNED_BYTE, buf);
for (j = 0; j < src_height; j++)
{
@ -1785,7 +1759,7 @@ FxU32 dst_stride, void *dst_data)
{
buf = (unsigned char*)malloc(src_width*src_height * 2);
glReadPixels(src_x, (viewport_offset)+g_height - src_y - src_height, src_width, src_height, GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT, depthBuffer);
glReadPixels(src_x, (g_viewport_offset)+g_height - src_y - src_height, src_width, src_height, GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT, depthBuffer);
for (j = 0; j < src_height; j++)
{
@ -1912,7 +1886,7 @@ FxI32 src_stride, void *src_data)
}
else
{
float *buf = (float*)malloc(src_width*(src_height + (viewport_offset))*sizeof(float));
float *buf = (float*)malloc(src_width*(src_height + (g_viewport_offset))*sizeof(float));
if (src_format != GR_LFBWRITEMODE_ZA16)
WriteTrace(TraceGlitch, TraceWarning, "unknown depth buffer write format:%x", src_format);
@ -1924,14 +1898,14 @@ FxI32 src_stride, void *src_data)
{
for (i = 0; i < src_width; i++)
{
buf[(j + (viewport_offset))*src_width + i] =
buf[(j + (g_viewport_offset))*src_width + i] =
(frameBuffer[(src_height - j - 1)*(src_stride / 2) + i] / (65536.0f*(2.0f / zscale))) + 1 - zscale / 2.0f;
}
}
#ifdef VPDEBUG
if (dumping) {
unsigned char * buf2 = (unsigned char *)malloc(src_width*(src_height + (viewport_offset)));
unsigned char * buf2 = (unsigned char *)malloc(src_width*(src_height + (g_viewport_offset)));
for (i = 0; i < src_width*src_height; i++)
buf2[i] = buf[i] * 255.0f;
ilTexImage(src_width, src_height, 1, 1, IL_LUMINANCE, IL_UNSIGNED_BYTE, buf2);
@ -1950,7 +1924,7 @@ FxI32 src_stride, void *src_data)
//glDrawBuffer(GL_BACK);
glClear(GL_DEPTH_BUFFER_BIT);
glDepthMask(1);
//glDrawPixels(src_width, src_height+(viewport_offset), GL_DEPTH_COMPONENT, GL_FLOAT, buf);
//glDrawPixels(src_width, src_height+(g_viewport_offset), GL_DEPTH_COMPONENT, GL_FLOAT, buf);
free(buf);
}
@ -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

@ -1651,7 +1651,7 @@ grChromakeyValue(GrColor_t value)
grDisplayGLError("grChromakeyValue");
}
static void setPattern()
void setPattern()
{
int i;
GLubyte stip[32 * 4];
@ -1690,15 +1690,6 @@ static void setPattern()
grDisplayGLError("setPattern");
}
FX_ENTRY void FX_CALL
grStipplePattern(
GrStipplePattern_t stipple)
{
WriteTrace(TraceResolution, TraceDebug, "value: %x", stipple);
srand(stipple);
setPattern();
}
FX_ENTRY void FX_CALL
grStippleMode(GrStippleMode_t mode)
{

View File

@ -276,7 +276,7 @@ void FindBestDepthBias()
glVertex3fv(vertices[3]);
glEnd();
glReadPixels(x + 2, 2 + viewport_offset, 1, 1, GL_DEPTH_COMPONENT, GL_FLOAT, &z);
glReadPixels(x + 2, 2 + g_viewport_offset, 1, 1, GL_DEPTH_COMPONENT, GL_FLOAT, &z);
z -= 0.75f + 8e-6f;
if (z < 0.0f) z = -z;
if (z > 0.01f) continue;
@ -354,7 +354,7 @@ grDrawTriangle(const void *a, const void *b, const void *c)
if (nvidia_viewport_hack && !render_to_texture)
{
glViewport(0, viewport_offset, viewport_width, viewport_height);
glViewport(0, g_viewport_offset, viewport_width, viewport_height);
nvidia_viewport_hack = 0;
}
@ -467,7 +467,7 @@ grDrawPoint(const void *pt)
if (nvidia_viewport_hack && !render_to_texture)
{
glViewport(0, viewport_offset, viewport_width, viewport_height);
glViewport(0, g_viewport_offset, viewport_width, viewport_height);
nvidia_viewport_hack = 0;
}
@ -536,7 +536,7 @@ grDrawLine(const void *a, const void *b)
if (nvidia_viewport_hack && !render_to_texture)
{
glViewport(0, viewport_offset, viewport_width, viewport_height);
glViewport(0, g_viewport_offset, viewport_width, viewport_height);
nvidia_viewport_hack = 0;
}
@ -612,7 +612,7 @@ grDrawVertexArray(FxU32 mode, FxU32 Count, void *pointers2)
if (nvidia_viewport_hack && !render_to_texture)
{
glViewport(0, viewport_offset, viewport_width, viewport_height);
glViewport(0, g_viewport_offset, viewport_width, viewport_height);
nvidia_viewport_hack = 0;
}
@ -684,7 +684,7 @@ grDrawVertexArrayContiguous(FxU32 mode, FxU32 Count, void *pointers, FxU32 strid
if (nvidia_viewport_hack && !render_to_texture)
{
glViewport(0, viewport_offset, viewport_width, viewport_height);
glViewport(0, g_viewport_offset, viewport_width, viewport_height);
nvidia_viewport_hack = 0;
}

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,
@ -233,8 +51,8 @@ static inline void opt_glCopyTexImage2D(GLenum target,
width = screen_width - x;
//printf("resizing w --> %d\n", width);
}
if (y + height >= screen_height + viewport_offset) {
height = screen_height + viewport_offset - y;
if (y + height >= screen_height + g_viewport_offset) {
height = screen_height + g_viewport_offset - y;
//printf("resizing h --> %d\n", height);
}
glCopyTexSubImage2D(target, level, 0, 0, x, y, width, height);
@ -474,7 +292,7 @@ int default_texture; // the infamous "32*1024*1024" is now configurable
int current_texture;
int depth_texture, color_texture;
int glsl_support = 1;
int viewport_width, viewport_height, viewport_offset = 0, nvidia_viewport_hack = 0;
int viewport_width, viewport_height, g_viewport_offset = 0, nvidia_viewport_hack = 0;
int save_w, save_h;
int lfb_color_fmt;
float invtex[2];
@ -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;
@ -571,11 +382,11 @@ grClipWindow(FxU32 minx, FxU32 miny, FxU32 maxx, FxU32 maxy)
if (int(miny) < 0) miny = 0;
if (maxx < minx) maxx = minx;
if (maxy < miny) maxy = miny;
glScissor(minx, miny + viewport_offset, maxx - minx, maxy - miny);
glScissor(minx, miny + g_viewport_offset, maxx - minx, maxy - miny);
//printf("gl scissor %d %d %d %d\n", minx, miny, maxx, maxy);
}
else {
glScissor(minx, (viewport_offset)+g_height - maxy, maxx - minx, maxy - miny);
glScissor(minx, (g_viewport_offset)+g_height - maxy, maxx - minx, maxy - miny);
}
glEnable(GL_SCISSOR_TEST);
grDisplayGLError("grClipWindow");
@ -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;
@ -1134,12 +766,12 @@ int nAuxBuffers)
#endif
#ifndef ANDROID
glViewport(0, viewport_offset, g_width, g_height);
glViewport(0, g_viewport_offset, g_width, g_height);
viewport_width = g_width;
viewport_height = g_height;
nvidia_viewport_hack = 1;
#else
glViewport(0, viewport_offset, width, height);
glViewport(0, g_viewport_offset, width, height);
viewport_width = width;
viewport_height = height;
#endif // _WIN32
@ -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);
@ -1348,26 +969,26 @@ FX_ENTRY void FX_CALL grTextureBufferExt(GrChipID_t tmu,
if (save_w) {
if (tw > save_w && th > save_h) {
glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, save_h,
0, viewport_offset + save_h, tw, th - save_h);
0, g_viewport_offset + save_h, tw, th - save_h);
glCopyTexSubImage2D(GL_TEXTURE_2D, 0, save_w, 0,
save_w, viewport_offset, tw - save_w, save_h);
save_w, g_viewport_offset, tw - save_w, save_h);
save_w = tw;
save_h = th;
}
else if (tw > save_w) {
glCopyTexSubImage2D(GL_TEXTURE_2D, 0, save_w, 0,
save_w, viewport_offset, tw - save_w, save_h);
save_w, g_viewport_offset, tw - save_w, save_h);
save_w = tw;
}
else if (th > save_h) {
glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, save_h,
0, viewport_offset + save_h, save_w, th - save_h);
0, g_viewport_offset + save_h, save_w, th - save_h);
save_h = th;
}
}
else {
glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0,
0, viewport_offset, tw, th);
0, g_viewport_offset, tw, th);
save_w = tw;
save_h = th;
}
@ -1416,12 +1037,12 @@ FX_ENTRY void FX_CALL grTextureBufferExt(GrChipID_t tmu,
//printf("viewport %dx%d\n", width, height);
if (g_height > screen_height) {
glViewport(0, viewport_offset + screen_height - g_height, g_width, g_height);
glViewport(0, g_viewport_offset + screen_height - g_height, g_width, g_height);
}
else
glViewport(0, viewport_offset, g_width, g_height);
glViewport(0, g_viewport_offset, g_width, g_height);
glScissor(0, viewport_offset, g_width, g_height);
glScissor(0, g_viewport_offset, g_width, g_height);
grDisplayGLError("grTextureBufferExt :: A");
}
@ -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
@ -1935,7 +1556,7 @@ void updateTexture()
//glDeleteTextures( 1, &pBufferAddress );
glBindTexture(GL_TEXTURE_2D, pBufferAddress);
glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB,
0, viewport_offset, g_width, g_height, 0);
0, g_viewport_offset, g_width, g_height, 0);
glBindTexture(GL_TEXTURE_2D, default_texture);
glPopAttrib();
@ -1962,7 +1583,7 @@ FX_ENTRY void FX_CALL grFramebufferCopyExt(int /*x*/, int /*y*/, int /*w*/, int
glReadBuffer(current_buffer);
glBindTexture(GL_TEXTURE_2D, depth_texture);
glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT,
0, viewport_offset, tw, th, 0);
0, g_viewport_offset, tw, th, 0);
glBindTexture(GL_TEXTURE_2D, default_texture);
grDisplayGLError("grFramebufferCopyExt :: A");
return;
@ -2027,8 +1648,8 @@ grRenderBuffer(GrBuffer_t buffer)
}
curBufferAddr = 0;
glViewport(0, viewport_offset, g_width, viewport_height);
glScissor(0, viewport_offset, g_width, g_height);
glViewport(0, g_viewport_offset, g_width, viewport_height);
glScissor(0, g_viewport_offset, g_width, g_height);
#ifdef SAVE_CBUFFER
if (!use_fbo && render_to_texture == 2) {
@ -2235,7 +1856,7 @@ GrLfbInfo_t *info)
info->strideInBytes = g_width * 4;
info->writeMode = GR_LFBWRITEMODE_888;
info->origin = origin;
glReadPixels(0, viewport_offset, g_width, g_height, GL_BGRA, GL_UNSIGNED_BYTE, frameBuffer);
glReadPixels(0, g_viewport_offset, g_width, g_height, GL_BGRA, GL_UNSIGNED_BYTE, frameBuffer);
}
else {
buf = (unsigned char*)malloc(g_width*g_height * 4);
@ -2244,7 +1865,7 @@ GrLfbInfo_t *info)
info->strideInBytes = g_width * 2;
info->writeMode = GR_LFBWRITEMODE_565;
info->origin = origin;
glReadPixels(0, viewport_offset, g_width, g_height, GL_RGBA, GL_UNSIGNED_BYTE, buf);
glReadPixels(0, g_viewport_offset, g_width, g_height, GL_RGBA, GL_UNSIGNED_BYTE, buf);
for (j = 0; j < g_height; j++)
{
@ -2265,7 +1886,7 @@ GrLfbInfo_t *info)
info->strideInBytes = g_width * 2;
info->writeMode = GR_LFBWRITEMODE_ZA16;
info->origin = origin;
glReadPixels(0, viewport_offset, g_width, g_height, GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT, depthBuffer);
glReadPixels(0, g_viewport_offset, g_width, g_height, GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT, depthBuffer);
}
}
@ -2315,7 +1936,7 @@ FxU32 dst_stride, void *dst_data)
{
buf = (unsigned char*)malloc(src_width*src_height * 4);
glReadPixels(src_x, (viewport_offset)+g_height - src_y - src_height, src_width, src_height, GL_RGBA, GL_UNSIGNED_BYTE, buf);
glReadPixels(src_x, (g_viewport_offset)+g_height - src_y - src_height, src_width, src_height, GL_RGBA, GL_UNSIGNED_BYTE, buf);
for (j = 0; j < src_height; j++)
{
@ -2333,7 +1954,7 @@ FxU32 dst_stride, void *dst_data)
{
buf = (unsigned char*)malloc(src_width*src_height * 2);
glReadPixels(src_x, (viewport_offset)+g_height - src_y - src_height, src_width, src_height, GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT, depthBuffer);
glReadPixels(src_x, (g_viewport_offset)+g_height - src_y - src_height, src_width, src_height, GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT, depthBuffer);
for (j = 0; j < src_height; j++)
{
@ -2461,7 +2082,7 @@ FxI32 src_stride, void *src_data)
}
else
{
float *buf = (float*)malloc(src_width*(src_height + (viewport_offset))*sizeof(float));
float *buf = (float*)malloc(src_width*(src_height + (g_viewport_offset))*sizeof(float));
if (src_format != GR_LFBWRITEMODE_ZA16)
WriteTrace(TraceGlitch, TraceWarning, "unknown depth buffer write format:%x", src_format);
@ -2473,14 +2094,14 @@ FxI32 src_stride, void *src_data)
{
for (i = 0; i < src_width; i++)
{
buf[(j + (viewport_offset))*src_width + i] =
buf[(j + (g_viewport_offset))*src_width + i] =
(frameBuffer[(src_height - j - 1)*(src_stride / 2) + i] / (65536.0f*(2.0f / zscale))) + 1 - zscale / 2.0f;
}
}
#ifdef VPDEBUG
if (dumping) {
unsigned char * buf2 = (unsigned char *)malloc(src_width*(src_height + (viewport_offset)));
unsigned char * buf2 = (unsigned char *)malloc(src_width*(src_height + (g_viewport_offset)));
for (i = 0; i < src_width*src_height; i++)
buf2[i] = buf[i] * 255.0f;
ilTexImage(src_width, src_height, 1, 1, IL_LUMINANCE, IL_UNSIGNED_BYTE, buf2);
@ -2499,7 +2120,7 @@ FxI32 src_stride, void *src_data)
glDrawBuffer(GL_BACK);
glClear(GL_DEPTH_BUFFER_BIT);
glDepthMask(1);
glDrawPixels(src_width, src_height + (viewport_offset), GL_DEPTH_COMPONENT, GL_FLOAT, buf);
glDrawPixels(src_width, src_height + (g_viewport_offset), GL_DEPTH_COMPONENT, GL_FLOAT, buf);
free(buf);
}
@ -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;
@ -158,7 +155,7 @@ extern int fog_coord_support;
//extern int pbuffer_support;
extern int glsl_support;
extern unsigned int pBufferAddress;
extern int viewport_width, viewport_height, viewport_offset, nvidia_viewport_hack;
extern int viewport_width, viewport_height, g_viewport_offset, nvidia_viewport_hack;
extern int UMAmode;
void grChromaRangeExt(GrColor_t color0, GrColor_t color1, FxU32 mode);
@ -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