[Glide64] Move ReadSpecialSettings to Settings.cpp

This commit is contained in:
zilmar 2017-01-24 05:28:13 +11:00
parent 9afe8e6973
commit f0ea584929
2 changed files with 238 additions and 237 deletions

View File

@ -266,243 +266,6 @@ void UseUnregisteredSetting(int /*SettingID*/)
extern int g_width, g_height;
void ReadSpecialSettings(const char * name)
{
g_settings->hacks = 0;
//detect games which require special hacks
if (strstr(name, (const char *)"ZELDA"))
g_settings->hacks |= (hack_Zelda | hack_OoT);
else if (strstr(name, (const char *)"MASK"))
g_settings->hacks |= hack_Zelda;
else if (strstr(name, (const char *)"ROADSTERS TROPHY"))
g_settings->hacks |= hack_Zelda;
else if (strstr(name, (const char *)"Diddy Kong Racing"))
g_settings->hacks |= hack_Diddy;
else if (strstr(name, (const char *)"Tonic Trouble"))
g_settings->hacks |= hack_Tonic;
else if (strstr(name, (const char *)"All") && strstr(name, (const char *)"Star") && strstr(name, (const char *)"Baseball"))
g_settings->hacks |= hack_ASB;
else if (strstr(name, (const char *)"Beetle") || strstr(name, (const char *)"BEETLE") || strstr(name, (const char *)"HSV"))
g_settings->hacks |= hack_BAR;
else if (strstr(name, (const char *)"I S S 64") || strstr(name, (const char *)"J WORLD SOCCER3") || strstr(name, (const char *)"PERFECT STRIKER") || strstr(name, (const char *)"RONALDINHO SOCCER"))
g_settings->hacks |= hack_ISS64;
else if (strstr(name, (const char *)"MARIOKART64"))
g_settings->hacks |= hack_MK64;
else if (strstr(name, (const char *)"NITRO64"))
g_settings->hacks |= hack_WCWnitro;
else if (strstr(name, (const char *)"CHOPPER_ATTACK") || strstr(name, (const char *)"WILD CHOPPERS"))
g_settings->hacks |= hack_Chopper;
else if (strstr(name, (const char *)"Resident Evil II") || strstr(name, (const char *)"BioHazard II"))
g_settings->hacks |= hack_RE2;
else if (strstr(name, (const char *)"YOSHI STORY"))
g_settings->hacks |= hack_Yoshi;
else if (strstr(name, (const char *)"F-Zero X") || strstr(name, (const char *)"F-ZERO X"))
g_settings->hacks |= hack_Fzero;
else if (strstr(name, (const char *)"PAPER MARIO") || strstr(name, (const char *)"MARIO STORY"))
g_settings->hacks |= hack_PMario;
else if (strstr(name, (const char *)"TOP GEAR RALLY 2"))
g_settings->hacks |= hack_TGR2;
else if (strstr(name, (const char *)"TOP GEAR RALLY"))
g_settings->hacks |= hack_TGR;
else if (strstr(name, (const char *)"Top Gear Hyper Bike"))
g_settings->hacks |= hack_Hyperbike;
else if (strstr(name, (const char *)"Killer Instinct Gold") || strstr(name, (const char *)"KILLER INSTINCT GOLD"))
g_settings->hacks |= hack_KI;
else if (strstr(name, (const char *)"Knockout Kings 2000"))
g_settings->hacks |= hack_Knockout;
else if (strstr(name, (const char *)"LEGORacers"))
g_settings->hacks |= hack_Lego;
else if (strstr(name, (const char *)"OgreBattle64"))
g_settings->hacks |= hack_Ogre64;
else if (strstr(name, (const char *)"Pilot Wings64"))
g_settings->hacks |= hack_Pilotwings;
else if (strstr(name, (const char *)"Supercross"))
g_settings->hacks |= hack_Supercross;
else if (strstr(name, (const char *)"STARCRAFT 64"))
g_settings->hacks |= hack_Starcraft;
else if (strstr(name, (const char *)"BANJO KAZOOIE 2") || strstr(name, (const char *)"BANJO TOOIE"))
g_settings->hacks |= hack_Banjo2;
else if (strstr(name, (const char *)"FIFA: RTWC 98") || strstr(name, (const char *)"RoadToWorldCup98"))
g_settings->hacks |= hack_Fifa98;
else if (strstr(name, (const char *)"Mega Man 64") || strstr(name, (const char *)"RockMan Dash"))
g_settings->hacks |= hack_Megaman;
else if (strstr(name, (const char *)"MISCHIEF MAKERS") || strstr(name, (const char *)"TROUBLE MAKERS"))
g_settings->hacks |= hack_Makers;
else if (strstr(name, (const char *)"GOLDENEYE"))
g_settings->hacks |= hack_GoldenEye;
else if (strstr(name, (const char *)"PUZZLE LEAGUE"))
g_settings->hacks |= hack_PPL;
else if (strstr(name, (const char *)"WIN BACK") || strstr(name, (const char *)"OPERATION WINBACK"))
g_settings->hacks |= hack_Winback;
g_settings->alt_tex_size = GetSetting(Set_alt_tex_size);
g_settings->use_sts1_only = GetSetting(Set_use_sts1_only);
g_settings->force_calc_sphere = GetSetting(Set_force_calc_sphere);
g_settings->correct_viewport = GetSetting(Set_correct_viewport);
g_settings->increase_texrect_edge = GetSetting(Set_increase_texrect_edge);
g_settings->decrease_fillrect_edge = GetSetting(Set_decrease_fillrect_edge);
g_settings->texture_correction = GetSetting(Set_texture_correction) == 0 ? 0 : 1;
g_settings->pal230 = GetSetting(Set_pal230) == 1 ? 1 : 0;
g_settings->stipple_mode = GetSetting(Set_stipple_mode);
int stipple_pattern = GetSetting(Set_stipple_pattern);
g_settings->stipple_pattern = stipple_pattern > 0 ? (uint32_t)stipple_pattern : 0x3E0F83E0;
g_settings->force_microcheck = GetSetting(Set_force_microcheck);
g_settings->force_quad3d = GetSetting(Set_force_quad3d);
g_settings->clip_zmin = GetSetting(Set_clip_zmin);
g_settings->clip_zmax = GetSetting(Set_clip_zmax);
g_settings->fast_crc = GetSetting(Set_fast_crc);
g_settings->adjust_aspect = GetSetting(Set_adjust_aspect);
g_settings->zmode_compare_less = GetSetting(Set_zmode_compare_less);
g_settings->old_style_adither = GetSetting(Set_old_style_adither);
g_settings->n64_z_scale = GetSetting(Set_n64_z_scale);
ZLUT_init();
//frame buffer
int optimize_texrect = GetSetting(g_romopen ? Set_optimize_texrect : Set_optimize_texrect_default);
int ignore_aux_copy = GetSetting(Set_ignore_aux_copy);
int hires_buf_clear = GetSetting(Set_hires_buf_clear);
int read_alpha = GetSetting(Set_fb_read_alpha);
int useless_is_useless = GetSetting(Set_useless_is_useless);
int fb_crc_mode = GetSetting(Set_fb_crc_mode);
if (optimize_texrect > 0) g_settings->frame_buffer |= fb_optimize_texrect;
else if (optimize_texrect == 0) g_settings->frame_buffer &= ~fb_optimize_texrect;
if (ignore_aux_copy > 0) g_settings->frame_buffer |= fb_ignore_aux_copy;
else if (ignore_aux_copy == 0) g_settings->frame_buffer &= ~fb_ignore_aux_copy;
if (hires_buf_clear > 0) g_settings->frame_buffer |= fb_hwfbe_buf_clear;
else if (hires_buf_clear == 0) g_settings->frame_buffer &= ~fb_hwfbe_buf_clear;
if (read_alpha > 0) g_settings->frame_buffer |= fb_read_alpha;
else if (read_alpha == 0) g_settings->frame_buffer &= ~fb_read_alpha;
if (useless_is_useless > 0) g_settings->frame_buffer |= fb_useless_is_useless;
else g_settings->frame_buffer &= ~fb_useless_is_useless;
if (fb_crc_mode >= 0) g_settings->fb_crc_mode = (CSettings::FBCRCMODE)fb_crc_mode;
g_settings->filtering = GetSetting(g_romopen ? Set_filtering : Set_filtering_default);
g_settings->fog = GetSetting(g_romopen ? Set_fog : Set_fog_default);
g_settings->buff_clear = GetSetting(g_romopen ? Set_buff_clear : Set_buff_clear_default);
g_settings->swapmode = GetSetting(g_romopen ? Set_swapmode : Set_swapmode_default);
g_settings->aspectmode = GetSetting(g_romopen ? Set_aspect : Set_aspect_default);
g_settings->lodmode = GetSetting(g_romopen ? Set_lodmode : Set_lodmode_default);
#ifdef _WIN32
g_settings->res_data = GetSetting(Set_Resolution);
if (g_settings->res_data < 0 || g_settings->res_data >= 0x18) g_settings->res_data = 12;
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];
#endif
//frame buffer
int smart_read = GetSetting(g_romopen ? Set_fb_smart : Set_fb_smart_default);
int hires = GetSetting(g_romopen ? Set_fb_hires : Set_fb_hires_default);
int read_always = GetSetting(g_romopen ? Set_fb_read_always : Set_fb_read_always_default);
int read_back_to_screen = GetSetting(g_romopen ? Set_read_back_to_screen : Set_read_back_to_screen_default);
int cpu_write_hack = GetSetting(g_romopen ? Set_detect_cpu_write : Set_detect_cpu_write_default);
int get_fbinfo = GetSetting(g_romopen ? Set_fb_get_info : Set_fb_get_info_default);
int depth_render = GetSetting(g_romopen ? Set_fb_render : Set_fb_render_default);
if (smart_read > 0) g_settings->frame_buffer |= fb_emulation;
else if (smart_read == 0) g_settings->frame_buffer &= ~fb_emulation;
if (hires > 0) g_settings->frame_buffer |= fb_hwfbe;
else if (hires == 0) g_settings->frame_buffer &= ~fb_hwfbe;
if (read_always > 0) g_settings->frame_buffer |= fb_ref;
else if (read_always == 0) g_settings->frame_buffer &= ~fb_ref;
if (read_back_to_screen == 1) g_settings->frame_buffer |= fb_read_back_to_screen;
else if (read_back_to_screen == 2) g_settings->frame_buffer |= fb_read_back_to_screen2;
else if (read_back_to_screen == 0) g_settings->frame_buffer &= ~(fb_read_back_to_screen | fb_read_back_to_screen2);
if (cpu_write_hack > 0) g_settings->frame_buffer |= fb_cpu_write_hack;
else if (cpu_write_hack == 0) g_settings->frame_buffer &= ~fb_cpu_write_hack;
if (get_fbinfo > 0) g_settings->frame_buffer |= fb_get_info;
else if (get_fbinfo == 0) g_settings->frame_buffer &= ~fb_get_info;
if (depth_render > 0) g_settings->frame_buffer |= fb_depth_render;
else if (depth_render == 0) g_settings->frame_buffer &= ~fb_depth_render;
g_settings->frame_buffer |= fb_motionblur;
g_settings->flame_corona = (g_settings->hacks & hack_Zelda) && !fb_depth_render_enabled;
}
void WriteSettings(void)
{
SetSetting(Set_CardId, g_settings->card_id);
#ifdef _WIN32
SetSetting(Set_Resolution, (int)g_settings->res_data);
SetSetting(Set_wrpResolution, g_settings->wrpResolution);
#endif
SetSetting(Set_ssformat, g_settings->ssformat);
SetSetting(Set_vsync, g_settings->vsync);
SetSetting(Set_clock, g_settings->clock);
SetSetting(Set_clock_24_hr, g_settings->clock_24_hr);
SetSetting(Set_Rotate, g_settings->rotate);
//SetSetting(Set_advanced_options,g_settings->advanced_options);
SetSetting(Set_texenh_options, g_settings->texenh_options);
SetSetting(Set_wrpVRAM, g_settings->wrpVRAM);
SetSetting(Set_wrpFBO, g_settings->wrpFBO);
SetSetting(Set_wrpAnisotropic, g_settings->wrpAnisotropic);
#ifndef _ENDUSER_RELEASE_
SetSetting(Set_autodetect_ucode, g_settings->autodetect_ucode);
SetSetting(Set_ucode, (int)g_settings->ucode);
SetSetting(Set_wireframe, g_settings->wireframe);
SetSetting(Set_wfmode, g_settings->wfmode);
SetSetting(Set_logging, g_settings->logging);
SetSetting(Set_log_clear, g_settings->log_clear);
SetSetting(Set_run_in_window,g_settings->run_in_window);
SetSetting(Set_elogging,g_settings->elogging);
SetSetting(Set_filter_cache,g_settings->filter_cache);
SetSetting(Set_unk_as_red,g_settings->unk_as_red);
SetSetting(Set_log_unk,g_settings->log_unk);
SetSetting(Set_unk_clear, g_settings->unk_clear);
#endif //_ENDUSER_RELEASE_
#ifdef TEXTURE_FILTER
SetSetting(Set_ghq_fltr, g_settings->ghq_fltr);
SetSetting(Set_ghq_cmpr, g_settings->ghq_cmpr);
SetSetting(Set_ghq_enht, g_settings->ghq_enht);
SetSetting(Set_ghq_hirs, g_settings->ghq_hirs);
SetSetting(Set_ghq_enht_cmpr, g_settings->ghq_enht_cmpr);
SetSetting(Set_ghq_enht_tile, g_settings->ghq_enht_tile);
SetSetting(Set_ghq_enht_f16bpp, g_settings->ghq_enht_f16bpp);
SetSetting(Set_ghq_enht_gz, g_settings->ghq_enht_gz);
SetSetting(Set_ghq_enht_nobg, g_settings->ghq_enht_nobg);
SetSetting(Set_ghq_hirs_cmpr, g_settings->ghq_hirs_cmpr);
SetSetting(Set_ghq_hirs_tile, g_settings->ghq_hirs_tile);
SetSetting(Set_ghq_hirs_f16bpp, g_settings->ghq_hirs_f16bpp);
SetSetting(Set_ghq_hirs_gz, g_settings->ghq_hirs_gz);
SetSetting(Set_ghq_hirs_altcrc, g_settings->ghq_hirs_altcrc);
SetSetting(Set_ghq_cache_save, g_settings->ghq_cache_save);
SetSetting(Set_ghq_cache_size, g_settings->ghq_cache_size);
SetSetting(Set_ghq_hirs_let_texartists_fly, g_settings->ghq_hirs_let_texartists_fly);
SetSetting(Set_ghq_hirs_dump, g_settings->ghq_hirs_dump);
#endif
SetSetting(g_romopen ? Set_filtering : Set_filtering_default, g_settings->filtering);
SetSetting(g_romopen ? Set_fog : Set_fog_default, g_settings->fog);
SetSetting(g_romopen ? Set_buff_clear : Set_buff_clear_default, g_settings->buff_clear);
SetSetting(g_romopen ? Set_swapmode : Set_swapmode_default, g_settings->swapmode);
SetSetting(g_romopen ? Set_lodmode : Set_lodmode_default, g_settings->lodmode);
SetSetting(g_romopen ? Set_aspect : Set_aspect_default, g_settings->aspectmode);
SetSetting(g_romopen ? Set_fb_read_always : Set_fb_read_always_default, g_settings->frame_buffer&fb_ref ? 1 : 0);
SetSetting(g_romopen ? Set_fb_smart : Set_fb_smart_default, g_settings->frame_buffer & fb_emulation ? 1 : 0);
SetSetting(g_romopen ? Set_fb_hires : Set_fb_hires_default, g_settings->frame_buffer & fb_hwfbe ? 1 : 0);
SetSetting(g_romopen ? Set_fb_get_info : Set_fb_get_info_default, g_settings->frame_buffer & fb_get_info ? 1 : 0);
SetSetting(g_romopen ? Set_fb_render : Set_fb_render_default, g_settings->frame_buffer & fb_depth_render ? 1 : 0);
SetSetting(g_romopen ? Set_detect_cpu_write : Set_detect_cpu_write_default, g_settings->frame_buffer & fb_cpu_write_hack ? 1 : 0);
if (g_settings->frame_buffer & fb_read_back_to_screen)
{
SetSetting(g_romopen ? Set_read_back_to_screen : Set_read_back_to_screen_default, 1);
}
else if (g_settings->frame_buffer & fb_read_back_to_screen2)
{
SetSetting(g_romopen ? Set_read_back_to_screen : Set_read_back_to_screen_default, 2);
}
else
{
SetSetting(g_romopen ? Set_read_back_to_screen : Set_read_back_to_screen_default, 0);
}
FlushSettings();
}
GRSTIPPLE grStippleModeExt = NULL;
GRSTIPPLE grStipplePatternExt = NULL;
@ -1263,6 +1026,7 @@ int CALL InitiateGFX(GFX_INFO Gfx_Info)
ReadSettings();
char name[21] = "DEFAULT";
ReadSpecialSettings(name);
ZLUT_init();
ConfigWrapper();
#ifndef ANDROID
g_settings->res_data_org = g_settings->res_data;

View File

@ -179,3 +179,240 @@ void ReadSettings()
g_settings->ghq_hirs_dump = GetSetting(Set_ghq_hirs_dump);
#endif
}
void ReadSpecialSettings(const char * name)
{
g_settings->hacks = 0;
//detect games which require special hacks
if (strstr(name, (const char *)"ZELDA"))
g_settings->hacks |= (hack_Zelda | hack_OoT);
else if (strstr(name, (const char *)"MASK"))
g_settings->hacks |= hack_Zelda;
else if (strstr(name, (const char *)"ROADSTERS TROPHY"))
g_settings->hacks |= hack_Zelda;
else if (strstr(name, (const char *)"Diddy Kong Racing"))
g_settings->hacks |= hack_Diddy;
else if (strstr(name, (const char *)"Tonic Trouble"))
g_settings->hacks |= hack_Tonic;
else if (strstr(name, (const char *)"All") && strstr(name, (const char *)"Star") && strstr(name, (const char *)"Baseball"))
g_settings->hacks |= hack_ASB;
else if (strstr(name, (const char *)"Beetle") || strstr(name, (const char *)"BEETLE") || strstr(name, (const char *)"HSV"))
g_settings->hacks |= hack_BAR;
else if (strstr(name, (const char *)"I S S 64") || strstr(name, (const char *)"J WORLD SOCCER3") || strstr(name, (const char *)"PERFECT STRIKER") || strstr(name, (const char *)"RONALDINHO SOCCER"))
g_settings->hacks |= hack_ISS64;
else if (strstr(name, (const char *)"MARIOKART64"))
g_settings->hacks |= hack_MK64;
else if (strstr(name, (const char *)"NITRO64"))
g_settings->hacks |= hack_WCWnitro;
else if (strstr(name, (const char *)"CHOPPER_ATTACK") || strstr(name, (const char *)"WILD CHOPPERS"))
g_settings->hacks |= hack_Chopper;
else if (strstr(name, (const char *)"Resident Evil II") || strstr(name, (const char *)"BioHazard II"))
g_settings->hacks |= hack_RE2;
else if (strstr(name, (const char *)"YOSHI STORY"))
g_settings->hacks |= hack_Yoshi;
else if (strstr(name, (const char *)"F-Zero X") || strstr(name, (const char *)"F-ZERO X"))
g_settings->hacks |= hack_Fzero;
else if (strstr(name, (const char *)"PAPER MARIO") || strstr(name, (const char *)"MARIO STORY"))
g_settings->hacks |= hack_PMario;
else if (strstr(name, (const char *)"TOP GEAR RALLY 2"))
g_settings->hacks |= hack_TGR2;
else if (strstr(name, (const char *)"TOP GEAR RALLY"))
g_settings->hacks |= hack_TGR;
else if (strstr(name, (const char *)"Top Gear Hyper Bike"))
g_settings->hacks |= hack_Hyperbike;
else if (strstr(name, (const char *)"Killer Instinct Gold") || strstr(name, (const char *)"KILLER INSTINCT GOLD"))
g_settings->hacks |= hack_KI;
else if (strstr(name, (const char *)"Knockout Kings 2000"))
g_settings->hacks |= hack_Knockout;
else if (strstr(name, (const char *)"LEGORacers"))
g_settings->hacks |= hack_Lego;
else if (strstr(name, (const char *)"OgreBattle64"))
g_settings->hacks |= hack_Ogre64;
else if (strstr(name, (const char *)"Pilot Wings64"))
g_settings->hacks |= hack_Pilotwings;
else if (strstr(name, (const char *)"Supercross"))
g_settings->hacks |= hack_Supercross;
else if (strstr(name, (const char *)"STARCRAFT 64"))
g_settings->hacks |= hack_Starcraft;
else if (strstr(name, (const char *)"BANJO KAZOOIE 2") || strstr(name, (const char *)"BANJO TOOIE"))
g_settings->hacks |= hack_Banjo2;
else if (strstr(name, (const char *)"FIFA: RTWC 98") || strstr(name, (const char *)"RoadToWorldCup98"))
g_settings->hacks |= hack_Fifa98;
else if (strstr(name, (const char *)"Mega Man 64") || strstr(name, (const char *)"RockMan Dash"))
g_settings->hacks |= hack_Megaman;
else if (strstr(name, (const char *)"MISCHIEF MAKERS") || strstr(name, (const char *)"TROUBLE MAKERS"))
g_settings->hacks |= hack_Makers;
else if (strstr(name, (const char *)"GOLDENEYE"))
g_settings->hacks |= hack_GoldenEye;
else if (strstr(name, (const char *)"PUZZLE LEAGUE"))
g_settings->hacks |= hack_PPL;
else if (strstr(name, (const char *)"WIN BACK") || strstr(name, (const char *)"OPERATION WINBACK"))
g_settings->hacks |= hack_Winback;
g_settings->alt_tex_size = GetSetting(Set_alt_tex_size);
g_settings->use_sts1_only = GetSetting(Set_use_sts1_only);
g_settings->force_calc_sphere = GetSetting(Set_force_calc_sphere);
g_settings->correct_viewport = GetSetting(Set_correct_viewport);
g_settings->increase_texrect_edge = GetSetting(Set_increase_texrect_edge);
g_settings->decrease_fillrect_edge = GetSetting(Set_decrease_fillrect_edge);
g_settings->texture_correction = GetSetting(Set_texture_correction) == 0 ? 0 : 1;
g_settings->pal230 = GetSetting(Set_pal230) == 1 ? 1 : 0;
g_settings->stipple_mode = GetSetting(Set_stipple_mode);
int stipple_pattern = GetSetting(Set_stipple_pattern);
g_settings->stipple_pattern = stipple_pattern > 0 ? (uint32_t)stipple_pattern : 0x3E0F83E0;
g_settings->force_microcheck = GetSetting(Set_force_microcheck);
g_settings->force_quad3d = GetSetting(Set_force_quad3d);
g_settings->clip_zmin = GetSetting(Set_clip_zmin);
g_settings->clip_zmax = GetSetting(Set_clip_zmax);
g_settings->fast_crc = GetSetting(Set_fast_crc);
g_settings->adjust_aspect = GetSetting(Set_adjust_aspect);
g_settings->zmode_compare_less = GetSetting(Set_zmode_compare_less);
g_settings->old_style_adither = GetSetting(Set_old_style_adither);
g_settings->n64_z_scale = GetSetting(Set_n64_z_scale);
//frame buffer
int optimize_texrect = GetSetting(g_romopen ? Set_optimize_texrect : Set_optimize_texrect_default);
int ignore_aux_copy = GetSetting(Set_ignore_aux_copy);
int hires_buf_clear = GetSetting(Set_hires_buf_clear);
int read_alpha = GetSetting(Set_fb_read_alpha);
int useless_is_useless = GetSetting(Set_useless_is_useless);
int fb_crc_mode = GetSetting(Set_fb_crc_mode);
if (optimize_texrect > 0) g_settings->frame_buffer |= fb_optimize_texrect;
else if (optimize_texrect == 0) g_settings->frame_buffer &= ~fb_optimize_texrect;
if (ignore_aux_copy > 0) g_settings->frame_buffer |= fb_ignore_aux_copy;
else if (ignore_aux_copy == 0) g_settings->frame_buffer &= ~fb_ignore_aux_copy;
if (hires_buf_clear > 0) g_settings->frame_buffer |= fb_hwfbe_buf_clear;
else if (hires_buf_clear == 0) g_settings->frame_buffer &= ~fb_hwfbe_buf_clear;
if (read_alpha > 0) g_settings->frame_buffer |= fb_read_alpha;
else if (read_alpha == 0) g_settings->frame_buffer &= ~fb_read_alpha;
if (useless_is_useless > 0) g_settings->frame_buffer |= fb_useless_is_useless;
else g_settings->frame_buffer &= ~fb_useless_is_useless;
if (fb_crc_mode >= 0) g_settings->fb_crc_mode = (CSettings::FBCRCMODE)fb_crc_mode;
g_settings->filtering = GetSetting(g_romopen ? Set_filtering : Set_filtering_default);
g_settings->fog = GetSetting(g_romopen ? Set_fog : Set_fog_default);
g_settings->buff_clear = GetSetting(g_romopen ? Set_buff_clear : Set_buff_clear_default);
g_settings->swapmode = GetSetting(g_romopen ? Set_swapmode : Set_swapmode_default);
g_settings->aspectmode = GetSetting(g_romopen ? Set_aspect : Set_aspect_default);
g_settings->lodmode = GetSetting(g_romopen ? Set_lodmode : Set_lodmode_default);
#ifdef _WIN32
g_settings->res_data = GetSetting(Set_Resolution);
if (g_settings->res_data < 0 || g_settings->res_data >= 0x18) g_settings->res_data = 12;
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];
#endif
//frame buffer
int smart_read = GetSetting(g_romopen ? Set_fb_smart : Set_fb_smart_default);
int hires = GetSetting(g_romopen ? Set_fb_hires : Set_fb_hires_default);
int read_always = GetSetting(g_romopen ? Set_fb_read_always : Set_fb_read_always_default);
int read_back_to_screen = GetSetting(g_romopen ? Set_read_back_to_screen : Set_read_back_to_screen_default);
int cpu_write_hack = GetSetting(g_romopen ? Set_detect_cpu_write : Set_detect_cpu_write_default);
int get_fbinfo = GetSetting(g_romopen ? Set_fb_get_info : Set_fb_get_info_default);
int depth_render = GetSetting(g_romopen ? Set_fb_render : Set_fb_render_default);
if (smart_read > 0) g_settings->frame_buffer |= fb_emulation;
else if (smart_read == 0) g_settings->frame_buffer &= ~fb_emulation;
if (hires > 0) g_settings->frame_buffer |= fb_hwfbe;
else if (hires == 0) g_settings->frame_buffer &= ~fb_hwfbe;
if (read_always > 0) g_settings->frame_buffer |= fb_ref;
else if (read_always == 0) g_settings->frame_buffer &= ~fb_ref;
if (read_back_to_screen == 1) g_settings->frame_buffer |= fb_read_back_to_screen;
else if (read_back_to_screen == 2) g_settings->frame_buffer |= fb_read_back_to_screen2;
else if (read_back_to_screen == 0) g_settings->frame_buffer &= ~(fb_read_back_to_screen | fb_read_back_to_screen2);
if (cpu_write_hack > 0) g_settings->frame_buffer |= fb_cpu_write_hack;
else if (cpu_write_hack == 0) g_settings->frame_buffer &= ~fb_cpu_write_hack;
if (get_fbinfo > 0) g_settings->frame_buffer |= fb_get_info;
else if (get_fbinfo == 0) g_settings->frame_buffer &= ~fb_get_info;
if (depth_render > 0) g_settings->frame_buffer |= fb_depth_render;
else if (depth_render == 0) g_settings->frame_buffer &= ~fb_depth_render;
g_settings->frame_buffer |= fb_motionblur;
g_settings->flame_corona = (g_settings->hacks & hack_Zelda) && !fb_depth_render_enabled;
}
void WriteSettings(void)
{
SetSetting(Set_CardId, g_settings->card_id);
#ifdef _WIN32
SetSetting(Set_Resolution, (int)g_settings->res_data);
SetSetting(Set_wrpResolution, g_settings->wrpResolution);
#endif
SetSetting(Set_ssformat, g_settings->ssformat);
SetSetting(Set_vsync, g_settings->vsync);
SetSetting(Set_clock, g_settings->clock);
SetSetting(Set_clock_24_hr, g_settings->clock_24_hr);
SetSetting(Set_Rotate, g_settings->rotate);
//SetSetting(Set_advanced_options,g_settings->advanced_options);
SetSetting(Set_texenh_options, g_settings->texenh_options);
SetSetting(Set_wrpVRAM, g_settings->wrpVRAM);
SetSetting(Set_wrpFBO, g_settings->wrpFBO);
SetSetting(Set_wrpAnisotropic, g_settings->wrpAnisotropic);
#ifndef _ENDUSER_RELEASE_
SetSetting(Set_autodetect_ucode, g_settings->autodetect_ucode);
SetSetting(Set_ucode, (int)g_settings->ucode);
SetSetting(Set_wireframe, g_settings->wireframe);
SetSetting(Set_wfmode, g_settings->wfmode);
SetSetting(Set_logging, g_settings->logging);
SetSetting(Set_log_clear, g_settings->log_clear);
SetSetting(Set_run_in_window,g_settings->run_in_window);
SetSetting(Set_elogging,g_settings->elogging);
SetSetting(Set_filter_cache,g_settings->filter_cache);
SetSetting(Set_unk_as_red,g_settings->unk_as_red);
SetSetting(Set_log_unk,g_settings->log_unk);
SetSetting(Set_unk_clear, g_settings->unk_clear);
#endif //_ENDUSER_RELEASE_
#ifdef TEXTURE_FILTER
SetSetting(Set_ghq_fltr, g_settings->ghq_fltr);
SetSetting(Set_ghq_cmpr, g_settings->ghq_cmpr);
SetSetting(Set_ghq_enht, g_settings->ghq_enht);
SetSetting(Set_ghq_hirs, g_settings->ghq_hirs);
SetSetting(Set_ghq_enht_cmpr, g_settings->ghq_enht_cmpr);
SetSetting(Set_ghq_enht_tile, g_settings->ghq_enht_tile);
SetSetting(Set_ghq_enht_f16bpp, g_settings->ghq_enht_f16bpp);
SetSetting(Set_ghq_enht_gz, g_settings->ghq_enht_gz);
SetSetting(Set_ghq_enht_nobg, g_settings->ghq_enht_nobg);
SetSetting(Set_ghq_hirs_cmpr, g_settings->ghq_hirs_cmpr);
SetSetting(Set_ghq_hirs_tile, g_settings->ghq_hirs_tile);
SetSetting(Set_ghq_hirs_f16bpp, g_settings->ghq_hirs_f16bpp);
SetSetting(Set_ghq_hirs_gz, g_settings->ghq_hirs_gz);
SetSetting(Set_ghq_hirs_altcrc, g_settings->ghq_hirs_altcrc);
SetSetting(Set_ghq_cache_save, g_settings->ghq_cache_save);
SetSetting(Set_ghq_cache_size, g_settings->ghq_cache_size);
SetSetting(Set_ghq_hirs_let_texartists_fly, g_settings->ghq_hirs_let_texartists_fly);
SetSetting(Set_ghq_hirs_dump, g_settings->ghq_hirs_dump);
#endif
SetSetting(g_romopen ? Set_filtering : Set_filtering_default, g_settings->filtering);
SetSetting(g_romopen ? Set_fog : Set_fog_default, g_settings->fog);
SetSetting(g_romopen ? Set_buff_clear : Set_buff_clear_default, g_settings->buff_clear);
SetSetting(g_romopen ? Set_swapmode : Set_swapmode_default, g_settings->swapmode);
SetSetting(g_romopen ? Set_lodmode : Set_lodmode_default, g_settings->lodmode);
SetSetting(g_romopen ? Set_aspect : Set_aspect_default, g_settings->aspectmode);
SetSetting(g_romopen ? Set_fb_read_always : Set_fb_read_always_default, g_settings->frame_buffer&fb_ref ? 1 : 0);
SetSetting(g_romopen ? Set_fb_smart : Set_fb_smart_default, g_settings->frame_buffer & fb_emulation ? 1 : 0);
SetSetting(g_romopen ? Set_fb_hires : Set_fb_hires_default, g_settings->frame_buffer & fb_hwfbe ? 1 : 0);
SetSetting(g_romopen ? Set_fb_get_info : Set_fb_get_info_default, g_settings->frame_buffer & fb_get_info ? 1 : 0);
SetSetting(g_romopen ? Set_fb_render : Set_fb_render_default, g_settings->frame_buffer & fb_depth_render ? 1 : 0);
SetSetting(g_romopen ? Set_detect_cpu_write : Set_detect_cpu_write_default, g_settings->frame_buffer & fb_cpu_write_hack ? 1 : 0);
if (g_settings->frame_buffer & fb_read_back_to_screen)
{
SetSetting(g_romopen ? Set_read_back_to_screen : Set_read_back_to_screen_default, 1);
}
else if (g_settings->frame_buffer & fb_read_back_to_screen2)
{
SetSetting(g_romopen ? Set_read_back_to_screen : Set_read_back_to_screen_default, 2);
}
else
{
SetSetting(g_romopen ? Set_read_back_to_screen : Set_read_back_to_screen_default, 0);
}
FlushSettings();
}