project64/Source/Glide64/Settings.h

193 lines
7.5 KiB
C++

#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
};
uint32_t res_x, scr_res_x;
uint32_t res_y, scr_res_y;
#ifndef ANDROID
uint32_t res_data;
#endif
int advanced_options;
int texenh_options;
int vsync;
int rotate;
int filtering;
int fog;
int buff_clear;
int swapmode;
int lodmode;
int aspectmode;
int use_hotkeys;
enum FBCRCMODE
{
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 bool FlushLogs(void) const { return m_FlushLogs; }
//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;
//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;
// 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;
//wrapper settings
#ifndef ANDROID
int wrpResolution;
#endif
int wrpVRAM;
int wrpFBO;
int wrpAnisotropic;
void UpdateFrameBufferBits(uint32_t BitsToAdd, uint32_t BitsToRemove);
void ReadGameSettings(const char * name);
void WriteSettings(void);
void UpdateAspectRatio(void);
private:
void ReadSettings();
void RegisterSettings(void);
bool m_dirty;
bool m_FlushLogs;
char m_log_dir[260];
uint32_t m_frame_buffer;
};
extern CSettings * g_settings;