project64/Source/Project64-video/Settings.h

414 lines
17 KiB
C
Raw Normal View History

2017-04-26 10:23:36 +00:00
/****************************************************************************
* *
* Project64-video - A Nintendo 64 gfx plugin. *
* http://www.pj64-emu.com/ *
* Copyright (C) 2017 Project64. All rights reserved. *
* *
* License: *
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
* *
****************************************************************************/
#pragma once
#include <string>
class CSettings
{
public:
2017-04-26 10:23:36 +00:00
CSettings();
2017-04-27 10:10:12 +00:00
~CSettings();
//Frame buffer emulation options
enum fb_bits_t
{
fb_emulation = (1 << 0), //frame buffer emulation
fb_hwfbe = (1 << 1), //hardware frame buffer emualtion
fb_motionblur = (1 << 2), //emulate motion blur
fb_ref = (1 << 3), //read every frame
fb_read_alpha = (1 << 4), //read alpha
fb_hwfbe_buf_clear = (1 << 5), //clear auxiliary texture frame buffers
fb_depth_render = (1 << 6), //enable software depth render
fb_optimize_texrect = (1 << 7), //fast texrect rendering with hwfbe
fb_ignore_aux_copy = (1 << 8), //do not copy auxiliary frame buffers
fb_useless_is_useless = (1 << 10), //
fb_get_info = (1 << 11), //get frame buffer info
fb_read_back_to_screen = (1 << 12), //render N64 frame buffer to screen
fb_read_back_to_screen2 = (1 << 13), //render N64 frame buffer to screen
fb_cpu_write_hack = (1 << 14), //show images writed directly by CPU
};
enum hacks_t
{
2017-04-26 10:23:36 +00:00
hack_ASB = (1 << 0), //All-Star Baseball games
hack_Banjo2 = (1 << 1), //Banjo Tooie
hack_BAR = (1 << 2), //Beetle Adventure Racing
hack_Chopper = (1 << 3), //Chopper Attack
hack_Diddy = (1 << 4), //diddy kong racing
hack_Fifa98 = (1 << 5), //FIFA - Road to World Cup 98
hack_Fzero = (1 << 6), //F-Zero
hack_GoldenEye = (1 << 7), //Golden Eye
hack_Hyperbike = (1 << 8), //Top Gear Hyper Bike
hack_ISS64 = (1 << 9), //International Superstar Soccer 64
hack_KI = (1 << 10), //Killer Instinct
hack_Knockout = (1 << 11), //Knockout Kings 2000
hack_Lego = (1 << 12), //LEGO Racers
hack_MK64 = (1 << 13), //Mario Kart
hack_Megaman = (1 << 14), //Megaman64
hack_Makers = (1 << 15), //Mischief-makers
hack_WCWnitro = (1 << 16), //WCW Nitro
hack_Ogre64 = (1 << 17), //Ogre Battle 64
hack_Pilotwings = (1 << 18), //Pilotwings
hack_PMario = (1 << 19), //Paper Mario
hack_PPL = (1 << 20), //pokemon puzzle league requires many special fixes
hack_RE2 = (1 << 21), //Resident Evil 2
hack_Starcraft = (1 << 22), //StarCraft64
hack_Supercross = (1 << 23), //Supercross 2000
hack_TGR = (1 << 24), //Top Gear Rally
hack_TGR2 = (1 << 25), //Top Gear Rally 2
hack_Tonic = (1 << 26), //tonic trouble
hack_Winback = (1 << 27), //WinBack - Covert Operations
hack_Yoshi = (1 << 28), //Yoshi Story
hack_Zelda = (1 << 29), //zeldas hacks
hack_OoT = (1 << 30), //zelda OoT hacks
};
enum AspectMode_t
{
Aspect_4x3 = 0,
Aspect_16x9 = 1,
Aspect_Stretch = 2,
Aspect_Original = 3,
};
2017-01-29 08:58:25 +00:00
enum ScreenRotate_t
{
Rotate_None = 0,
Rotate_90 = 1,
Rotate_180 = 2,
Rotate_270 = 3,
};
2017-01-29 09:10:32 +00:00
enum Filtering_t
{
Filter_Automatic = 0,
Filter_ForceBilinear = 1,
Filter_ForcePointSampled = 2,
};
2017-01-30 06:51:54 +00:00
enum TextureFilter_t
{
TextureFilter_None = 0x00,
TextureFilter_SmoothFiltering = 0x01,
TextureFilter_SmoothFiltering2 = 0x02,
TextureFilter_SmoothFiltering3 = 0x03,
TextureFilter_SmoothFiltering4 = 0x04,
TextureFilter_SharpFiltering1 = 0x10,
TextureFilter_SharpFiltering2 = 0x20,
};
2017-01-30 07:01:22 +00:00
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,
};
2017-03-09 21:21:52 +00:00
enum TextureCompression_t
{
TextureCompression_S3TC = 0x3000,
TextureCompression_FXT1 = 0x1000,
};
2017-03-09 21:37:26 +00:00
enum HiResPackFormat_t
{
HiResPackFormat_None = 0,
HiResPackFormat_Riceformat = 0x00020000,
};
2017-04-26 10:23:36 +00:00
2017-01-29 18:05:06 +00:00
enum SwapMode_t
{
SwapMode_Old = 0,
SwapMode_New = 1,
SwapMode_Hybrid = 2,
};
2017-01-29 21:03:23 +00:00
enum PixelLevelOfDetail_t
{
LOD_Off = 0,
LOD_Fast = 1,
LOD_Precise = 2,
};
enum StippleMode_t
{
STIPPLE_Disable = 0x0,
STIPPLE_Pattern = 0x1,
STIPPLE_Rotate = 0x2,
};
2017-01-30 17:34:36 +00:00
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,
2017-06-17 01:12:31 +00:00
ucode_F3DTEXA = 10,
2017-01-30 17:34:36 +00:00
ucode_Turbo3d = 21,
};
2017-03-12 18:24:23 +00:00
enum wfmode_t
{
wfmode_NormalColors = 0,
wfmode_VertexColors = 1,
wfmode_RedOnly = 2,
};
enum FBCRCMODE_t
{
fbcrcNone = 0,
fbcrcFast = 1,
fbcrcSafe = 2
};
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); }
2017-04-26 10:23:36 +00:00
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 ScreenRes(void) const { return m_ScreenRes; }
inline bool advanced_options(void) const { return m_advanced_options; }
2017-04-18 12:03:49 +00:00
inline bool debugger_enabled(void) const { return m_debugger_enabled; }
2017-03-09 07:01:06 +00:00
inline bool texenh_options(void) const { return m_texenh_options; }
2017-03-09 07:13:25 +00:00
inline bool vsync(void) const { return m_vsync; }
2017-01-29 08:58:25 +00:00
inline ScreenRotate_t rotate(void) const { return m_rotate; }
2017-01-29 09:10:32 +00:00
inline Filtering_t filtering(void) const { return m_filtering; }
2017-04-26 10:23:36 +00:00
inline bool fog(void) const { return m_fog; }
2017-03-09 21:06:58 +00:00
inline bool buff_clear(void) const { return m_buff_clear; }
2017-01-29 18:05:06 +00:00
inline SwapMode_t swapmode(void) const { return m_swapmode; }
2017-01-29 21:03:23 +00:00
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; }
//Texture filtering options
2017-03-09 21:12:37 +00:00
inline const char * texture_dir(void) const { return m_texture_dir.c_str(); }
2017-01-30 06:51:54 +00:00
inline TextureFilter_t ghq_fltr(void) const { return m_ghq_fltr; }
2017-01-30 07:01:22 +00:00
inline TextureEnhancement_t ghq_enht(void) const { return m_ghq_enht; }
2017-03-09 21:21:52 +00:00
inline TextureCompression_t ghq_cmpr(void) const { return m_ghq_cmpr; }
2017-03-09 21:37:26 +00:00
inline HiResPackFormat_t ghq_hirs(void) const { return m_ghq_hirs; }
2017-03-10 05:31:59 +00:00
inline bool ghq_enht_cmpr(void) const { return m_ghq_enht_cmpr; }
2017-03-10 05:36:38 +00:00
inline bool ghq_enht_f16bpp(void) const { return m_ghq_enht_f16bpp; }
2017-03-10 05:42:29 +00:00
inline bool ghq_enht_gz(void) const { return m_ghq_enht_gz; }
2017-03-10 05:55:00 +00:00
inline bool ghq_enht_nobg(void) const { return m_ghq_enht_nobg; }
2017-03-10 06:01:41 +00:00
inline bool ghq_hirs_cmpr(void) const { return m_ghq_hirs_cmpr; }
2017-03-10 06:10:09 +00:00
inline bool ghq_hirs_tile(void) const { return m_ghq_hirs_tile; }
2017-03-10 12:03:10 +00:00
inline bool ghq_hirs_f16bpp(void) const { return m_ghq_hirs_f16bpp; }
2017-03-10 12:17:57 +00:00
inline bool ghq_hirs_gz(void) const { return m_ghq_hirs_gz; }
2017-03-10 20:43:12 +00:00
inline bool ghq_hirs_altcrc(void) const { return m_ghq_hirs_altcrc; }
2017-03-10 20:47:57 +00:00
inline bool ghq_cache_save(void) const { return m_ghq_cache_save; }
2017-03-12 17:49:23 +00:00
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; }
2017-03-12 17:57:37 +00:00
inline bool ghq_hirs_dump(void) const { return m_ghq_hirs_dump; }
//Debug
inline bool autodetect_ucode(void) const { return m_autodetect_ucode; }
2017-01-30 17:34:36 +00:00
inline ucode_t ucode(void) const { return m_ucode; }
2017-03-12 18:04:53 +00:00
inline bool unk_as_red(void) const { return m_unk_as_red; }
2017-03-12 18:18:58 +00:00
inline bool wireframe(void) const { return m_wireframe; }
2017-03-12 18:24:23 +00:00
inline wfmode_t wfmode(void) const { return m_wfmode; }
// Special fixes
2017-03-12 18:28:39 +00:00
inline bool fast_crc(void) const { return m_fast_crc; }
2017-03-12 20:12:17 +00:00
inline bool alt_tex_size(void) const { return m_alt_tex_size; }
2017-03-12 20:16:27 +00:00
inline bool use_sts1_only(void) const { return m_use_sts1_only; }
2017-03-12 20:19:09 +00:00
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
2017-03-12 20:48:22 +00:00
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
2017-03-12 20:55:58 +00:00
inline bool force_quad3d(void) const { return m_force_quad3d; } //force 0xb5 command to be quad, not line 3d
2017-03-12 20:59:00 +00:00
inline bool clip_zmin(void) const { return m_clip_zmin; } //enable near z clipping
2017-03-12 21:04:09 +00:00
inline bool clip_zmax(void) const { return m_clip_zmax; } //enable far plane clipping
2017-03-12 21:06:41 +00:00
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
2017-03-13 06:14:36 +00:00
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 GFX_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
2017-03-13 06:26:20 +00:00
inline bool n64_z_scale(void) const { return m_n64_z_scale; } //scale vertex z value before writing to depth buffer, as N64 does.
2017-04-26 10:23:36 +00:00
inline bool hacks(hacks_t hack) const { return (m_hacks & hack) == hack; } //Special game hacks
2017-04-26 10:23:36 +00:00
2017-04-30 19:18:09 +00:00
inline bool dirty(void) { return m_dirty; }
//wrapper settings
#ifndef ANDROID
inline uint32_t FullScreenRes(void) const { return m_FullScreenRes; }
2016-03-10 18:29:41 +00:00
#endif
2017-03-13 06:39:28 +00:00
inline int wrpVRAM(void) const { return m_wrpVRAM; }
2017-03-13 06:42:49 +00:00
inline bool wrpFBO(void) const { return m_wrpFBO; }
2017-03-13 06:46:14 +00:00
inline bool wrpAnisotropic(void) const { return m_wrpAnisotropic; }
2017-03-12 17:49:23 +00:00
inline bool FlushLogs(void) const { return m_FlushLogs; }
2017-03-09 07:01:06 +00:00
void SetTexenhOptions(bool value);
void SetScreenRes(uint32_t value);
void SetAspectmode(AspectMode_t value);
2017-01-29 21:03:23 +00:00
void SetLODmode(PixelLevelOfDetail_t value);
2017-03-09 07:13:25 +00:00
void SetVsync(bool value);
2017-01-29 09:10:32 +00:00
void SetFiltering(Filtering_t value);
2017-01-29 18:05:06 +00:00
void SetSwapMode(SwapMode_t value);
2017-03-09 20:54:56 +00:00
void SetFog(bool value);
2017-03-09 21:06:58 +00:00
void SetBuffClear(bool value);
2017-03-13 06:46:14 +00:00
void SetWrpAnisotropic(bool value);
2017-03-13 06:39:28 +00:00
void SetWrpVRAM(int value);
2017-03-13 06:42:49 +00:00
void SetWrpFBO(bool value);
2017-01-30 06:51:54 +00:00
void SetGhqFltr(TextureFilter_t value);
2017-01-30 07:01:22 +00:00
void SetGhqEnht(TextureEnhancement_t value);
2017-03-09 21:21:52 +00:00
void SetGhqCmpr(TextureCompression_t value);
2017-03-09 21:37:26 +00:00
void SetGhqHirs(HiResPackFormat_t value);
2017-03-10 05:42:29 +00:00
void SetGhqEnhtGz(bool value);
2017-03-10 06:10:09 +00:00
void SetGhqHirsTile(bool value);
2017-03-10 12:03:10 +00:00
void SetGhqHirsF16bpp(bool value);
2017-03-12 17:57:37 +00:00
void SetGhqHirsDump(bool value);
2017-03-10 05:55:00 +00:00
void SetGhqEnhtNobg(bool value);
2017-04-26 10:23:36 +00:00
void SetGhqEnhtCmpr(bool value);
2017-03-10 20:43:12 +00:00
void SetGhqHirsAltcrc(bool value);
2017-03-10 06:01:41 +00:00
void SetGhqHirsCmpr(bool value);
2017-03-10 12:17:57 +00:00
void SetGhqHirsGz(bool value);
2017-03-10 20:47:57 +00:00
void SetGhqCacheSave(bool value);
void SetGhqHirsLetTexartistsFly(bool value);
2017-03-12 17:49:23 +00:00
void SetGhqCacheSize(int value);
void UpdateFrameBufferBits(uint32_t BitsToAdd, uint32_t BitsToRemove);
2017-01-30 17:34:36 +00:00
ucode_t DetectUCode(uint32_t uc_crc);
void SetUcode(ucode_t value);
#ifndef ANDROID
void SetFullScreenRes(uint32_t value);
#endif
2017-03-12 17:49:23 +00:00
void ReadSettings();
void ReadGameSettings(const char * name);
void WriteSettings(void);
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 SettingsChanged(void);
2017-04-18 12:03:49 +00:00
void LogLevelChanged(void);
static void stSettingsChanged(void * _this)
{
((CSettings *)_this)->SettingsChanged();
}
2017-04-18 12:03:49 +00:00
static void stLogLevelChanged(void * _this)
{
((CSettings *)_this)->LogLevelChanged();
}
2017-03-13 06:50:43 +00:00
short m_Set_basic_mode;
2017-04-18 12:03:49 +00:00
short m_Set_debugger;
2017-03-09 21:12:37 +00:00
short m_Set_texture_dir;
2017-03-13 06:50:43 +00:00
short m_Set_log_dir;
short m_Set_log_flush;
2017-03-09 21:12:37 +00:00
bool m_dirty;
#ifndef ANDROID
uint32_t m_FullScreenRes;
#endif
2017-03-13 06:39:28 +00:00
int m_wrpVRAM;
2017-03-13 06:42:49 +00:00
bool m_wrpFBO;
2017-03-13 06:46:14 +00:00
bool m_wrpAnisotropic;
bool m_FlushLogs;
char m_log_dir[260];
uint32_t m_ScreenRes;
AspectMode_t m_aspectmode;
uint32_t m_frame_buffer;
FBCRCMODE_t m_fb_crc_mode;
2017-01-29 08:58:25 +00:00
ScreenRotate_t m_rotate;
2017-01-29 09:10:32 +00:00
Filtering_t m_filtering;
2017-03-09 20:54:56 +00:00
bool m_fog;
2017-03-09 21:06:58 +00:00
bool m_buff_clear;
2017-01-29 18:05:06 +00:00
SwapMode_t m_swapmode;
2017-01-29 21:03:23 +00:00
PixelLevelOfDetail_t m_lodmode;
bool m_advanced_options;
2017-04-18 12:03:49 +00:00
bool m_debugger_enabled;
2017-03-09 07:01:06 +00:00
bool m_texenh_options;
2017-03-09 07:13:25 +00:00
bool m_vsync;
2017-03-09 21:12:37 +00:00
std::string m_texture_dir;
2017-01-30 06:51:54 +00:00
TextureFilter_t m_ghq_fltr;
2017-01-30 07:01:22 +00:00
TextureEnhancement_t m_ghq_enht;
2017-03-09 21:21:52 +00:00
TextureCompression_t m_ghq_cmpr;
2017-03-09 21:37:26 +00:00
HiResPackFormat_t m_ghq_hirs;
2017-03-10 05:31:59 +00:00
bool m_ghq_enht_cmpr;
2017-03-10 05:36:38 +00:00
bool m_ghq_enht_f16bpp;
2017-03-10 05:42:29 +00:00
bool m_ghq_enht_gz;
2017-03-10 05:55:00 +00:00
bool m_ghq_enht_nobg;
2017-03-10 06:01:41 +00:00
bool m_ghq_hirs_cmpr;
2017-03-10 06:10:09 +00:00
bool m_ghq_hirs_tile;
2017-03-10 12:03:10 +00:00
bool m_ghq_hirs_f16bpp;
2017-03-10 12:17:57 +00:00
bool m_ghq_hirs_gz;
2017-03-10 20:43:12 +00:00
bool m_ghq_hirs_altcrc;
2017-03-10 20:47:57 +00:00
bool m_ghq_cache_save;
2017-03-12 17:49:23 +00:00
int m_ghq_cache_size;
bool m_ghq_hirs_let_texartists_fly;
2017-03-12 17:57:37 +00:00
bool m_ghq_hirs_dump;
bool m_autodetect_ucode;
2017-03-12 18:04:53 +00:00
bool m_unk_as_red;
2017-03-12 18:18:58 +00:00
bool m_wireframe;
2017-03-12 18:24:23 +00:00
wfmode_t m_wfmode;
2017-01-30 17:34:36 +00:00
ucode_t m_ucode;
2017-03-12 18:28:39 +00:00
bool m_fast_crc;
2017-03-12 20:12:17 +00:00
bool m_alt_tex_size;
2017-03-12 20:16:27 +00:00
bool m_use_sts1_only;
2017-03-12 20:19:09 +00:00
bool m_flame_corona;
bool m_increase_texrect_edge;
bool m_decrease_fillrect_edge;
bool m_texture_correction;
StippleMode_t m_stipple_mode;
2017-03-12 20:48:22 +00:00
uint32_t m_stipple_pattern;
bool m_force_microcheck;
2017-03-12 20:55:58 +00:00
bool m_force_quad3d;
2017-03-12 20:59:00 +00:00
bool m_clip_zmin;
2017-03-12 21:04:09 +00:00
bool m_clip_zmax;
2017-03-12 21:06:41 +00:00
bool m_adjust_aspect;
bool m_force_calc_sphere;
2017-03-13 06:14:36 +00:00
bool m_pal230;
bool m_correct_viewport;
bool m_zmode_compare_less;
bool m_old_style_adither;
2017-03-13 06:26:20 +00:00
bool m_n64_z_scale;
hacks_t m_hacks;
bool m_InWriteSettings;
};
extern CSettings * g_settings;