project64/Source/Glide64/Settings.h

368 lines
14 KiB
C
Raw Normal View History

#pragma once
#include <string>
class CSettings
{
public:
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
{
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-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,
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); }
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; }
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-03-09 20:54:56 +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
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.
inline bool hacks(hacks_t hack) const { return (m_hacks & hack) == hack; } //Special game hacks
//wrapper settings
#ifndef ANDROID
int wrpResolution;
2016-03-10 18:29:41 +00:00
#endif
int wrpVRAM;
int wrpFBO;
int 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-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-03-10 05:31:59 +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);
2017-03-12 17:49:23 +00:00
void ReadSettings();
void ReadGameSettings(const char * name);
void WriteSettings(void);
void UpdateScreenSize(bool fullscreen);
private:
void RegisterSettings(void);
2017-03-12 17:49:23 +00:00
void UpdateAspectRatio(void);
void SettingsChanged(void);
static void stSettingsChanged(void * _this)
{
((CSettings *)_this)->SettingsChanged();
}
2017-03-09 21:12:37 +00:00
short m_Set_texture_dir;
bool m_dirty;
bool m_FlushLogs;
char m_log_dir[260];
uint32_t m_ScreenRes;
uint32_t m_res_x, m_scr_res_x;
uint32_t m_res_y, m_scr_res_y;
AspectMode_t m_aspectmode;
uint32_t m_frame_buffer;
FBCRCMODE_t m_fb_crc_mode;
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-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;
hacks_t m_hacks;
};
extern CSettings * g_settings;