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 *
* *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2017-01-30 17:34:36 +00:00
# include <Common/StdString.h>
2017-03-13 08:31:38 +00:00
# include <Settings/Settings.h>
2017-04-26 09:05:05 +00:00
# include <Project64-video/trace.h>
2017-01-31 06:56:52 +00:00
# include "ScreenResolution.h"
2017-01-23 21:05:14 +00:00
# include "SettingsID.h"
2017-04-27 09:06:14 +00:00
# include "trace.h"
2021-01-19 05:58:59 +00:00
# include "Gfx_1.3.h"
2017-01-23 21:11:51 +00:00
2016-02-01 08:56:25 +00:00
CSettings : : CSettings ( ) :
2017-03-13 06:50:43 +00:00
m_Set_basic_mode ( 0 ) ,
2017-04-18 12:03:49 +00:00
m_Set_debugger ( 0 ) ,
2017-08-16 08:03:13 +00:00
m_Set_RDRamSize ( 0 ) ,
2017-03-09 21:12:37 +00:00
m_Set_texture_dir ( 0 ) ,
2017-03-13 06:50:43 +00:00
m_Set_log_dir ( 0 ) ,
m_Set_log_flush ( 0 ) ,
2017-01-24 19:08:33 +00:00
m_dirty ( false ) ,
2017-02-08 19:08:06 +00:00
m_ScreenRes ( GetDefaultScreenRes ( ) ) ,
2017-03-09 06:52:54 +00:00
m_advanced_options ( false ) ,
2017-04-18 12:03:49 +00:00
m_debugger_enabled ( false ) ,
2017-03-09 07:01:06 +00:00
m_texenh_options ( false ) ,
2017-03-09 07:13:25 +00:00
m_vsync ( false ) ,
2017-01-29 08:58:25 +00:00
m_rotate ( Rotate_None ) ,
2017-01-29 09:10:32 +00:00
m_filtering ( Filter_Automatic ) ,
2017-03-09 20:54:56 +00:00
m_fog ( false ) ,
2017-03-09 21:06:58 +00:00
m_buff_clear ( false ) ,
2017-01-29 18:05:06 +00:00
m_swapmode ( SwapMode_Old ) ,
2017-01-29 21:03:23 +00:00
m_lodmode ( LOD_Off ) ,
2017-01-29 06:47:28 +00:00
m_aspectmode ( Aspect_4x3 ) ,
2017-01-24 19:08:33 +00:00
m_frame_buffer ( 0 ) ,
2017-02-08 19:08:06 +00:00
m_fb_crc_mode ( fbcrcFast ) ,
2017-03-13 08:31:38 +00:00
//Texture filtering options
2017-03-09 21:12:37 +00:00
m_texture_dir ( " " ) ,
2017-01-30 06:51:54 +00:00
m_ghq_fltr ( TextureFilter_None ) ,
2017-01-30 07:01:22 +00:00
m_ghq_enht ( TextureEnht_None ) ,
2017-03-09 21:21:52 +00:00
m_ghq_cmpr ( TextureCompression_S3TC ) ,
2017-03-09 21:37:26 +00:00
m_ghq_hirs ( HiResPackFormat_None ) ,
2017-03-10 05:31:59 +00:00
m_ghq_enht_cmpr ( false ) ,
2017-03-10 05:36:38 +00:00
m_ghq_enht_f16bpp ( false ) ,
2017-03-10 05:42:29 +00:00
m_ghq_enht_gz ( false ) ,
2017-03-10 05:55:00 +00:00
m_ghq_enht_nobg ( false ) ,
2017-03-10 06:01:41 +00:00
m_ghq_hirs_cmpr ( false ) ,
2017-03-10 06:10:09 +00:00
m_ghq_hirs_tile ( false ) ,
2017-03-10 12:03:10 +00:00
m_ghq_hirs_f16bpp ( false ) ,
2017-03-10 12:17:57 +00:00
m_ghq_hirs_gz ( false ) ,
2017-03-10 20:43:12 +00:00
m_ghq_hirs_altcrc ( false ) ,
2017-03-10 20:47:57 +00:00
m_ghq_cache_save ( false ) ,
2017-03-12 17:49:23 +00:00
m_ghq_cache_size ( 0 ) ,
2017-03-12 17:54:23 +00:00
m_ghq_hirs_let_texartists_fly ( false ) ,
2017-03-12 17:57:37 +00:00
m_ghq_hirs_dump ( false ) ,
2017-03-12 18:00:37 +00:00
m_autodetect_ucode ( true ) ,
2017-01-30 17:34:36 +00:00
m_ucode ( ucode_Fast3D ) ,
2017-03-12 18:04:53 +00:00
m_unk_as_red ( false ) ,
2017-03-12 18:18:58 +00:00
m_wireframe ( false ) ,
2017-03-12 18:24:23 +00:00
m_wfmode ( wfmode_VertexColors ) ,
2016-02-01 08:56:25 +00:00
2017-03-12 18:28:39 +00:00
// Special fixes
m_fast_crc ( false ) ,
2017-03-12 20:12:17 +00:00
m_alt_tex_size ( false ) ,
2017-03-12 20:16:27 +00:00
m_use_sts1_only ( false ) ,
2017-03-12 20:19:09 +00:00
m_flame_corona ( false ) , //hack for zeldas flame's corona
2017-03-12 20:22:57 +00:00
m_increase_texrect_edge ( false ) , // add 1 to lower right corner coordinates of texrect
2017-03-12 20:31:03 +00:00
m_decrease_fillrect_edge ( false ) , // sub 1 from lower right corner coordinates of fillrect
2017-03-12 20:36:14 +00:00
m_texture_correction ( false ) , // enable perspective texture correction emulation. is on by default
2017-08-10 22:25:05 +00:00
m_stipple_mode ( GFX_STIPPLE_DISABLE ) , //used for dithered alpha emulation
2017-03-12 20:48:22 +00:00
m_stipple_pattern ( 0 ) , //used for dithered alpha emulation
2017-03-12 20:52:37 +00:00
m_force_microcheck ( false ) , //check microcode each frame, for mixed F3DEX-S2DEX games
2017-03-12 20:55:58 +00:00
m_force_quad3d ( false ) , //force 0xb5 command to be quad, not line 3d
2017-03-12 20:59:00 +00:00
m_clip_zmin ( false ) , //enable near z clipping
2017-03-12 21:04:09 +00:00
m_clip_zmax ( false ) , //enable far plane clipping;
2017-03-12 21:06:41 +00:00
m_adjust_aspect ( false ) , //adjust screen aspect for wide screen mode
2017-03-13 06:11:14 +00:00
m_force_calc_sphere ( false ) , //use spheric mapping only, Ridge Racer 64
2017-03-13 06:14:36 +00:00
m_pal230 ( false ) , //set special scale for PAL games
2017-03-13 06:17:52 +00:00
m_correct_viewport ( false ) , //correct viewport values
2017-07-31 11:05:29 +00:00
m_zmode_compare_less ( false ) , //force GFX_CMP_LESS for zmode=0 (opaque)and zmode=1 (interpenetrating)
2017-03-13 06:23:56 +00:00
m_old_style_adither ( false ) , //apply alpha dither regardless of alpha_dither_mode
2017-03-13 06:26:20 +00:00
m_n64_z_scale ( false ) , //scale vertex z value before writing to depth buffer, as N64 does.
2016-02-01 08:56:25 +00:00
2017-01-29 06:26:41 +00:00
m_hacks ( ( hacks_t ) 0 ) ,
2016-02-01 08:56:25 +00:00
2017-04-18 12:03:49 +00:00
//wrapper settings
2016-03-27 16:51:14 +00:00
# ifndef ANDROID
2017-03-13 06:33:08 +00:00
m_FullScreenRes ( 0 ) ,
2016-03-10 18:29:41 +00:00
# endif
2017-08-16 08:03:13 +00:00
m_RdramSize ( 0 ) ,
2017-03-13 06:39:28 +00:00
m_wrpVRAM ( 0 ) ,
2017-03-13 06:42:49 +00:00
m_wrpFBO ( false ) ,
2017-03-13 06:46:14 +00:00
m_wrpAnisotropic ( false ) ,
2017-06-05 18:26:54 +00:00
m_FlushLogs ( false ) ,
m_InWriteSettings ( false )
2016-02-01 08:56:25 +00:00
{
2017-01-23 21:16:25 +00:00
memset ( m_log_dir , 0 , sizeof ( m_log_dir ) ) ;
2017-01-23 18:35:27 +00:00
RegisterSettings ( ) ;
2017-01-23 21:30:46 +00:00
ReadSettings ( ) ;
2017-01-23 18:35:27 +00:00
}
2017-04-27 10:10:12 +00:00
CSettings : : ~ CSettings ( )
{
SettingsUnregisterChange ( false , Set_Resolution , this , stSettingsChanged ) ;
SettingsUnregisterChange ( false , Set_aspect , this , stSettingsChanged ) ;
SettingsUnregisterChange ( false , Set_Logging_MD5 , this , stLogLevelChanged ) ;
SettingsUnregisterChange ( false , Set_Logging_Thread , this , stLogLevelChanged ) ;
SettingsUnregisterChange ( false , Set_Logging_Path , this , stLogLevelChanged ) ;
SettingsUnregisterChange ( false , Set_Logging_Settings , this , stLogLevelChanged ) ;
SettingsUnregisterChange ( false , Set_Logging_Unknown , this , stLogLevelChanged ) ;
SettingsUnregisterChange ( false , Set_Logging_Glide64 , this , stLogLevelChanged ) ;
SettingsUnregisterChange ( false , Set_Logging_Interface , this , stLogLevelChanged ) ;
SettingsUnregisterChange ( false , Set_Logging_Resolution , this , stLogLevelChanged ) ;
SettingsUnregisterChange ( false , Set_Logging_Glitch , this , stLogLevelChanged ) ;
SettingsUnregisterChange ( false , Set_Logging_VideoRDP , this , stLogLevelChanged ) ;
SettingsUnregisterChange ( false , Set_Logging_TLUT , this , stLogLevelChanged ) ;
SettingsUnregisterChange ( false , Set_Logging_OGLWrapper , this , stLogLevelChanged ) ;
SettingsUnregisterChange ( false , Set_Logging_RDPCommands , this , stLogLevelChanged ) ;
}
2017-01-23 18:35:27 +00:00
void CSettings : : RegisterSettings ( void )
{
SetModuleName ( " default " ) ;
2017-03-13 06:50:43 +00:00
m_Set_basic_mode = FindSystemSettingId ( " Basic Mode " ) ;
2017-04-18 12:03:49 +00:00
m_Set_debugger = FindSystemSettingId ( " Debugger " ) ;
2017-08-16 08:03:13 +00:00
m_Set_RDRamSize = FindSystemSettingId ( " RDRamSize " ) ;
2017-03-09 21:12:37 +00:00
m_Set_texture_dir = FindSystemSettingId ( " Dir:Texture " ) ;
2017-03-13 06:50:43 +00:00
m_Set_log_flush = FindSystemSettingId ( " Log Auto Flush " ) ;
m_Set_log_dir = FindSystemSettingId ( " Dir:Log " ) ;
2017-01-23 18:35:27 +00:00
2017-09-26 20:27:20 +00:00
SetModuleName ( " Video " ) ;
2017-02-08 19:08:06 +00:00
general_setting ( Set_Resolution , " resolution " , GetDefaultScreenRes ( ) ) ;
2017-03-09 07:13:25 +00:00
general_setting ( Set_vsync , " vsync " , true ) ;
2017-03-09 07:01:06 +00:00
general_setting ( Set_texenh_options , " texenh_options " , false ) ;
2017-01-23 18:35:27 +00:00
general_setting ( Set_wrpVRAM , " wrpVRAM " , 0 ) ;
# ifndef ANDROID
2017-03-13 06:42:49 +00:00
general_setting ( Set_wrpFBO , " wrpFBO " , false ) ;
2017-01-23 18:35:27 +00:00
# else
2017-03-13 06:42:49 +00:00
general_setting ( Set_wrpFBO , " wrpFBO " , true ) ;
2017-01-23 18:35:27 +00:00
# endif
2017-01-29 08:58:25 +00:00
general_setting ( Set_Rotate , " rotate " , Rotate_None ) ;
2017-03-13 06:46:14 +00:00
general_setting ( Set_wrpAnisotropic , " wrpAnisotropic " , false ) ;
2017-03-12 18:00:37 +00:00
general_setting ( Set_autodetect_ucode , " autodetect_ucode " , true ) ;
2017-01-30 17:34:36 +00:00
general_setting ( Set_ucode , " ucode " , ucode_F3DEX2 ) ;
2017-03-12 18:18:58 +00:00
general_setting ( Set_wireframe , " wireframe " , false ) ;
2017-03-12 18:24:23 +00:00
general_setting ( Set_wfmode , " wfmode " , wfmode_VertexColors ) ;
2017-01-30 06:51:54 +00:00
general_setting ( Set_ghq_fltr , " ghq_fltr " , TextureFilter_None ) ;
2017-03-09 21:21:52 +00:00
general_setting ( Set_ghq_cmpr , " ghq_cmpr " , TextureCompression_S3TC ) ;
2017-01-30 07:01:22 +00:00
general_setting ( Set_ghq_enht , " ghq_enht " , TextureEnht_None ) ;
2017-03-09 21:37:26 +00:00
general_setting ( Set_ghq_hirs , " ghq_hirs " , HiResPackFormat_None ) ;
2017-03-10 05:31:59 +00:00
general_setting ( Set_ghq_enht_cmpr , " ghq_enht_cmpr " , false ) ;
2017-03-10 05:36:38 +00:00
general_setting ( Set_ghq_enht_f16bpp , " ghq_enht_f16bpp " , false ) ;
2017-03-10 05:42:29 +00:00
general_setting ( Set_ghq_enht_gz , " ghq_enht_gz " , true ) ;
2017-03-10 05:55:00 +00:00
general_setting ( Set_ghq_enht_nobg , " ghq_enht_nobg " , false ) ;
2017-03-10 06:01:41 +00:00
general_setting ( Set_ghq_hirs_cmpr , " ghq_hirs_cmpr " , false ) ;
2017-03-10 06:10:09 +00:00
general_setting ( Set_ghq_hirs_tile , " ghq_hirs_tile " , false ) ;
2017-03-10 12:03:10 +00:00
general_setting ( Set_ghq_hirs_f16bpp , " ghq_hirs_f16bpp " , false ) ;
2017-03-10 12:17:57 +00:00
general_setting ( Set_ghq_hirs_gz , " ghq_hirs_gz " , true ) ;
2017-03-10 20:43:12 +00:00
general_setting ( Set_ghq_hirs_altcrc , " ghq_hirs_altcrc " , true ) ;
2017-03-10 20:47:57 +00:00
general_setting ( Set_ghq_cache_save , " ghq_cache_save " , true ) ;
2017-01-23 18:35:27 +00:00
general_setting ( Set_ghq_cache_size , " ghq_cache_size " , 0 ) ;
2017-03-12 17:54:23 +00:00
general_setting ( Set_ghq_hirs_let_texartists_fly , " ghq_hirs_let_texartists_fly " , false ) ;
2017-03-12 17:57:37 +00:00
general_setting ( Set_ghq_hirs_dump , " ghq_hirs_dump " , false ) ;
2017-01-23 18:35:27 +00:00
2017-01-25 08:20:12 +00:00
general_setting ( Set_optimize_texrect_default , " optimize_texrect " , true ) ;
2017-01-29 09:10:32 +00:00
general_setting ( Set_filtering_default , " filtering " , CSettings : : Filter_Automatic ) ;
2017-01-29 21:03:23 +00:00
general_setting ( Set_lodmode_default , " lodmode " , CSettings : : LOD_Off ) ;
2017-03-09 20:54:56 +00:00
general_setting ( Set_fog_default , " fog " , true ) ;
2017-03-09 21:06:58 +00:00
general_setting ( Set_buff_clear_default , " buff_clear " , true ) ;
2017-01-29 18:05:06 +00:00
general_setting ( Set_swapmode_default , " swapmode " , SwapMode_New ) ;
2017-01-29 06:47:28 +00:00
general_setting ( Set_aspect_default , " aspect " , Aspect_4x3 ) ;
2017-01-23 18:35:27 +00:00
2017-01-25 08:20:12 +00:00
general_setting ( Set_fb_smart_default , " fb_smart " , true ) ;
general_setting ( Set_fb_hires_default , " fb_hires " , true ) ;
general_setting ( Set_fb_read_always_default , " fb_read_always " , false ) ;
general_setting ( Set_read_back_to_screen_default , " read_back_to_screen " , false ) ;
general_setting ( Set_detect_cpu_write_default , " detect_cpu_write " , false ) ;
general_setting ( Set_fb_get_info_default , " fb_get_info " , false ) ;
general_setting ( Set_fb_render_default , " fb_render " , false ) ;
2017-01-23 18:35:27 +00:00
2017-04-18 12:03:49 +00:00
RegisterSetting ( Set_Logging_MD5 , Data_DWORD_General , " MD5 " , " Logging " , g_ModuleLogLevel [ TraceMD5 ] , NULL ) ;
RegisterSetting ( Set_Logging_Thread , Data_DWORD_General , " Thread " , " Logging " , g_ModuleLogLevel [ TraceThread ] , NULL ) ;
RegisterSetting ( Set_Logging_Path , Data_DWORD_General , " Path " , " Logging " , g_ModuleLogLevel [ TracePath ] , NULL ) ;
RegisterSetting ( Set_Logging_Settings , Data_DWORD_General , " Settings " , " Logging " , g_ModuleLogLevel [ TraceSettings ] , NULL ) ;
RegisterSetting ( Set_Logging_Unknown , Data_DWORD_General , " Unknown " , " Logging " , g_ModuleLogLevel [ TraceUnknown ] , NULL ) ;
RegisterSetting ( Set_Logging_Glide64 , Data_DWORD_General , " Glide64 " , " Logging " , g_ModuleLogLevel [ TraceGlide64 ] , NULL ) ;
RegisterSetting ( Set_Logging_Interface , Data_DWORD_General , " Interface " , " Logging " , g_ModuleLogLevel [ TraceInterface ] , NULL ) ;
RegisterSetting ( Set_Logging_Resolution , Data_DWORD_General , " Resolution " , " Logging " , g_ModuleLogLevel [ TraceResolution ] , NULL ) ;
RegisterSetting ( Set_Logging_Glitch , Data_DWORD_General , " Glitch " , " Logging " , g_ModuleLogLevel [ TraceGlitch ] , NULL ) ;
RegisterSetting ( Set_Logging_VideoRDP , Data_DWORD_General , " VideoRDP " , " Logging " , g_ModuleLogLevel [ TraceRDP ] , NULL ) ;
RegisterSetting ( Set_Logging_TLUT , Data_DWORD_General , " TLUT " , " Logging " , g_ModuleLogLevel [ TraceTLUT ] , NULL ) ;
RegisterSetting ( Set_Logging_PNG , Data_DWORD_General , " PNG " , " Logging " , g_ModuleLogLevel [ TracePNG ] , NULL ) ;
RegisterSetting ( Set_Logging_OGLWrapper , Data_DWORD_General , " OGLWrapper " , " Logging " , g_ModuleLogLevel [ TraceOGLWrapper ] , NULL ) ;
RegisterSetting ( Set_Logging_RDPCommands , Data_DWORD_General , " RDPCommands " , " Logging " , g_ModuleLogLevel [ TraceRDPCommands ] , NULL ) ;
2017-03-13 08:54:36 +00:00
# ifndef ANDROID
general_setting ( Set_FullScreenRes , " FullScreenRes " , GetCurrentResIndex ( ) ) ;
# endif
2017-03-12 20:12:17 +00:00
game_setting ( Set_alt_tex_size , " alt_tex_size " , false ) ;
2017-03-12 20:16:27 +00:00
game_setting ( Set_use_sts1_only , " use_sts1_only " , false ) ;
2017-03-13 06:11:14 +00:00
game_setting ( Set_force_calc_sphere , " force_calc_sphere " , false ) ;
2017-03-13 06:17:52 +00:00
game_setting ( Set_correct_viewport , " correct_viewport " , false ) ;
2017-03-12 20:22:57 +00:00
game_setting ( Set_increase_texrect_edge , " increase_texrect_edge " , false ) ;
2017-03-12 20:31:03 +00:00
game_setting ( Set_decrease_fillrect_edge , " decrease_fillrect_edge " , false ) ;
2017-03-12 20:36:14 +00:00
game_setting ( Set_texture_correction , " texture_correction " , true ) ;
2017-03-13 06:14:36 +00:00
game_setting ( Set_pal230 , " pal230 " , false ) ;
2017-08-10 22:25:05 +00:00
game_setting ( Set_stipple_mode , " stipple_mode " , GFX_STIPPLE_ROTATE ) ;
2017-01-23 18:35:27 +00:00
game_setting ( Set_stipple_pattern , " stipple_pattern " , 0x3E0F83E0 ) ;
2017-03-12 20:52:37 +00:00
game_setting ( Set_force_microcheck , " force_microcheck " , false ) ;
2017-03-12 20:55:58 +00:00
game_setting ( Set_force_quad3d , " force_quad3d " , false ) ;
2017-03-12 20:59:00 +00:00
game_setting ( Set_clip_zmin , " clip_zmin " , false ) ;
2017-03-12 21:04:09 +00:00
game_setting ( Set_clip_zmax , " clip_zmax " , true ) ;
2017-03-12 18:28:39 +00:00
game_setting ( Set_fast_crc , " fast_crc " , true ) ;
2017-03-12 21:06:41 +00:00
game_setting ( Set_adjust_aspect , " adjust_aspect " , true ) ;
2017-03-13 06:21:20 +00:00
game_setting ( Set_zmode_compare_less , " zmode_compare_less " , false ) ;
2017-03-13 06:23:56 +00:00
game_setting ( Set_old_style_adither , " old_style_adither " , false ) ;
2017-03-13 06:26:20 +00:00
game_setting ( Set_n64_z_scale , " n64_z_scale " , false ) ;
2017-01-23 18:35:27 +00:00
game_setting_default ( Set_optimize_texrect , " optimize_texrect " , Set_optimize_texrect_default ) ;
2017-01-25 08:20:12 +00:00
game_setting ( Set_ignore_aux_copy , " ignore_aux_copy " , false ) ;
game_setting ( Set_hires_buf_clear , " hires_buf_clear " , true ) ;
game_setting ( Set_fb_read_alpha , " fb_read_alpha " , false ) ;
game_setting ( Set_useless_is_useless , " useless_is_useless " , false ) ;
2017-01-29 21:13:58 +00:00
game_setting ( Set_fb_crc_mode , " fb_crc_mode " , fbcrcFast ) ;
2017-01-23 18:35:27 +00:00
game_setting_default ( Set_filtering , " filtering " , Set_filtering_default ) ;
game_setting_default ( Set_fog , " fog " , Set_fog_default ) ;
game_setting_default ( Set_buff_clear , " buff_clear " , Set_buff_clear_default ) ;
game_setting_default ( Set_swapmode , " swapmode " , Set_swapmode_default ) ;
game_setting_default ( Set_aspect , " aspect " , Set_aspect_default ) ;
game_setting_default ( Set_lodmode , " lodmode " , Set_lodmode_default ) ;
game_setting_default ( Set_fb_smart , " fb_smart " , Set_fb_smart_default ) ;
game_setting_default ( Set_fb_hires , " fb_hires " , Set_fb_hires_default ) ;
game_setting_default ( Set_fb_read_always , " fb_read_always " , Set_fb_read_always_default ) ;
game_setting_default ( Set_read_back_to_screen , " read_back_to_screen " , Set_read_back_to_screen_default ) ;
game_setting_default ( Set_detect_cpu_write , " detect_cpu_write " , Set_detect_cpu_write_default ) ;
game_setting_default ( Set_fb_get_info , " fb_get_info " , Set_fb_get_info_default ) ;
game_setting_default ( Set_fb_render , " fb_render " , Set_fb_render_default ) ;
2017-02-08 19:08:06 +00:00
SettingsRegisterChange ( false , Set_Resolution , this , stSettingsChanged ) ;
2017-04-27 10:10:12 +00:00
SettingsRegisterChange ( false , Set_aspect , this , stSettingsChanged ) ;
2017-02-08 19:08:06 +00:00
2017-04-18 12:03:49 +00:00
LogLevelChanged ( ) ;
SettingsRegisterChange ( false , Set_Logging_MD5 , this , stLogLevelChanged ) ;
SettingsRegisterChange ( false , Set_Logging_Thread , this , stLogLevelChanged ) ;
SettingsRegisterChange ( false , Set_Logging_Path , this , stLogLevelChanged ) ;
SettingsRegisterChange ( false , Set_Logging_Settings , this , stLogLevelChanged ) ;
SettingsRegisterChange ( false , Set_Logging_Unknown , this , stLogLevelChanged ) ;
SettingsRegisterChange ( false , Set_Logging_Glide64 , this , stLogLevelChanged ) ;
SettingsRegisterChange ( false , Set_Logging_Interface , this , stLogLevelChanged ) ;
SettingsRegisterChange ( false , Set_Logging_Resolution , this , stLogLevelChanged ) ;
SettingsRegisterChange ( false , Set_Logging_Glitch , this , stLogLevelChanged ) ;
SettingsRegisterChange ( false , Set_Logging_VideoRDP , this , stLogLevelChanged ) ;
SettingsRegisterChange ( false , Set_Logging_TLUT , this , stLogLevelChanged ) ;
SettingsRegisterChange ( false , Set_Logging_OGLWrapper , this , stLogLevelChanged ) ;
SettingsRegisterChange ( false , Set_Logging_RDPCommands , this , stLogLevelChanged ) ;
2016-02-01 08:56:25 +00:00
}
2017-01-23 18:19:46 +00:00
2017-03-09 07:01:06 +00:00
void CSettings : : SetTexenhOptions ( bool value )
{
if ( value ! = m_texenh_options )
{
m_texenh_options = value ;
m_dirty = true ;
}
}
2017-01-31 06:56:52 +00:00
void CSettings : : SetScreenRes ( uint32_t value )
{
2017-01-31 10:37:16 +00:00
if ( value > = GetScreenResolutionCount ( ) )
2017-01-31 06:56:52 +00:00
{
2017-01-31 10:37:16 +00:00
value = GetDefaultScreenRes ( ) ;
2017-01-31 06:56:52 +00:00
}
if ( value ! = m_ScreenRes )
{
m_ScreenRes = value ;
m_dirty = true ;
}
}
2017-01-29 06:47:28 +00:00
void CSettings : : SetAspectmode ( AspectMode_t value )
{
if ( value ! = m_aspectmode )
{
m_aspectmode = value ;
m_dirty = true ;
}
}
2017-01-29 21:03:23 +00:00
void CSettings : : SetLODmode ( PixelLevelOfDetail_t value )
{
if ( value ! = m_lodmode )
{
m_lodmode = value ;
m_dirty = true ;
}
}
2017-03-09 07:13:25 +00:00
void CSettings : : SetVsync ( bool value )
{
if ( value ! = m_vsync )
{
m_vsync = value ;
m_dirty = true ;
}
}
2017-01-29 09:10:32 +00:00
void CSettings : : SetFiltering ( Filtering_t value )
{
if ( value ! = m_filtering )
{
m_filtering = value ;
m_dirty = true ;
}
}
2017-01-29 18:05:06 +00:00
void CSettings : : SetSwapMode ( SwapMode_t value )
{
if ( value ! = m_swapmode )
{
m_swapmode = value ;
m_dirty = true ;
}
}
2017-03-09 20:54:56 +00:00
void CSettings : : SetFog ( bool value )
{
if ( value ! = m_fog )
{
m_fog = value ;
m_dirty = true ;
}
}
2017-03-09 21:06:58 +00:00
void CSettings : : SetBuffClear ( bool value )
{
if ( value ! = m_buff_clear )
{
m_buff_clear = value ;
m_dirty = true ;
}
}
2017-03-13 06:46:14 +00:00
void CSettings : : SetWrpAnisotropic ( bool value )
{
if ( value ! = m_wrpAnisotropic )
{
m_wrpAnisotropic = value ;
m_dirty = true ;
}
}
2017-03-13 06:39:28 +00:00
void CSettings : : SetWrpVRAM ( int value )
{
if ( value ! = m_wrpVRAM )
{
m_wrpVRAM = value ;
m_dirty = true ;
}
}
2017-03-13 06:42:49 +00:00
void CSettings : : SetWrpFBO ( bool value )
{
if ( value ! = m_wrpFBO )
{
m_wrpFBO = value ;
m_dirty = true ;
}
}
2017-01-30 06:51:54 +00:00
void CSettings : : SetGhqFltr ( TextureFilter_t value )
{
if ( value ! = m_ghq_fltr )
{
m_ghq_fltr = value ;
m_dirty = true ;
}
}
2017-01-30 07:01:22 +00:00
void CSettings : : SetGhqEnht ( TextureEnhancement_t value )
{
if ( value ! = m_ghq_enht )
{
m_ghq_enht = value ;
m_dirty = true ;
}
}
2017-03-09 21:21:52 +00:00
void CSettings : : SetGhqCmpr ( TextureCompression_t value )
{
if ( value ! = m_ghq_cmpr )
{
m_ghq_cmpr = value ;
m_dirty = true ;
}
}
2017-03-09 21:37:26 +00:00
void CSettings : : SetGhqHirs ( HiResPackFormat_t value )
{
if ( value ! = m_ghq_hirs )
{
m_ghq_hirs = value ;
m_dirty = true ;
}
}
2017-03-10 05:42:29 +00:00
void CSettings : : SetGhqEnhtGz ( bool value )
{
if ( value ! = m_ghq_enht_gz )
{
m_ghq_enht_gz = value ;
m_dirty = true ;
}
}
2017-03-10 06:10:09 +00:00
void CSettings : : SetGhqHirsTile ( bool value )
{
if ( value ! = m_ghq_hirs_tile )
{
m_ghq_hirs_tile = value ;
m_dirty = true ;
}
}
2017-03-10 12:03:10 +00:00
void CSettings : : SetGhqHirsF16bpp ( bool value )
{
if ( value ! = m_ghq_hirs_f16bpp )
{
m_ghq_hirs_f16bpp = value ;
m_dirty = true ;
}
}
2017-03-12 17:57:37 +00:00
void CSettings : : SetGhqHirsDump ( bool value )
{
if ( value ! = m_ghq_hirs_dump )
{
m_ghq_hirs_dump = value ;
m_dirty = true ;
}
}
2017-03-10 05:55:00 +00:00
void CSettings : : SetGhqEnhtNobg ( bool value )
{
if ( value ! = m_ghq_enht_nobg )
{
m_ghq_enht_nobg = value ;
m_dirty = true ;
}
}
2017-03-10 05:31:59 +00:00
void CSettings : : SetGhqEnhtCmpr ( bool value )
{
if ( value ! = m_ghq_enht_cmpr )
{
m_ghq_enht_cmpr = value ;
m_dirty = true ;
}
}
2017-03-10 20:43:12 +00:00
void CSettings : : SetGhqHirsAltcrc ( bool value )
{
if ( value ! = m_ghq_hirs_altcrc )
{
m_ghq_hirs_altcrc = value ;
m_dirty = true ;
}
}
2017-03-10 06:01:41 +00:00
void CSettings : : SetGhqHirsCmpr ( bool value )
{
if ( value ! = m_ghq_hirs_cmpr )
{
m_ghq_hirs_cmpr = value ;
m_dirty = true ;
}
}
2017-03-10 12:17:57 +00:00
void CSettings : : SetGhqHirsGz ( bool value )
{
if ( value ! = m_ghq_hirs_gz )
{
m_ghq_hirs_gz = value ;
m_dirty = true ;
}
}
2017-03-12 17:54:23 +00:00
void CSettings : : SetGhqHirsLetTexartistsFly ( bool value )
{
if ( value ! = m_ghq_hirs_let_texartists_fly )
{
m_ghq_hirs_let_texartists_fly = value ;
m_dirty = true ;
}
}
2017-03-10 20:47:57 +00:00
void CSettings : : SetGhqCacheSave ( bool value )
{
if ( value ! = m_ghq_cache_save )
{
m_ghq_cache_save = value ;
m_dirty = true ;
}
}
2017-03-12 17:49:23 +00:00
void CSettings : : SetGhqCacheSize ( int value )
{
if ( value ! = m_ghq_cache_size )
{
m_ghq_cache_size = value ;
m_dirty = true ;
}
}
2017-01-24 19:08:33 +00:00
void CSettings : : UpdateFrameBufferBits ( uint32_t BitsToAdd , uint32_t BitsToRemove )
{
uint32_t frame_buffer_original = m_frame_buffer ;
m_frame_buffer | = BitsToAdd ;
m_frame_buffer & = ~ BitsToRemove ;
if ( frame_buffer_original ! = m_frame_buffer )
{
m_dirty = true ;
}
}
2017-01-30 17:34:36 +00:00
CSettings : : ucode_t CSettings : : DetectUCode ( uint32_t uc_crc )
{
RegisterSetting ( Set_ucodeLookup , Data_DWORD_RDB_Setting , stdstr_f ( " %08lx " , uc_crc ) . c_str ( ) , " ucode " , ( unsigned int ) - 2 , NULL ) ;
CSettings : : ucode_t uc = ( CSettings : : ucode_t ) GetSetting ( Set_ucodeLookup ) ;
if ( uc = = CSettings : : uCode_NotFound | | uc = = CSettings : : uCode_Unsupported )
{
m_ucode = ( CSettings : : ucode_t ) GetSetting ( Set_ucode ) ;
}
else
{
m_ucode = uc ;
}
return uc ;
}
void CSettings : : SetUcode ( ucode_t value )
{
m_ucode = value ;
}
2017-03-13 06:33:08 +00:00
# ifndef ANDROID
void CSettings : : SetFullScreenRes ( uint32_t value )
{
if ( value ! = m_FullScreenRes )
{
m_FullScreenRes = value ;
m_dirty = true ;
}
}
# endif
2017-01-23 21:30:46 +00:00
void CSettings : : ReadSettings ( )
2017-01-23 18:19:46 +00:00
{
2017-01-31 06:56:52 +00:00
SetScreenRes ( GetSetting ( Set_Resolution ) ) ;
2017-02-08 19:08:06 +00:00
# ifndef ANDROID
2017-03-13 06:33:08 +00:00
SetFullScreenRes ( GetSetting ( Set_FullScreenRes ) ) ;
2017-01-23 18:19:46 +00:00
# endif
2017-03-09 07:13:25 +00:00
m_vsync = GetSetting ( Set_vsync ) ! = 0 ;
2017-01-29 08:58:25 +00:00
m_rotate = ( ScreenRotate_t ) GetSetting ( Set_Rotate ) ;
2017-03-13 06:50:43 +00:00
m_advanced_options = m_Set_basic_mode ? GetSystemSetting ( m_Set_basic_mode ) = = 0 : false ;
2017-04-18 12:03:49 +00:00
m_debugger_enabled = m_advanced_options & & m_Set_debugger ? GetSystemSetting ( m_Set_debugger ) = = 1 : false ;
2017-03-09 07:01:06 +00:00
m_texenh_options = GetSetting ( Set_texenh_options ) ! = 0 ;
2017-04-27 10:10:12 +00:00
m_aspectmode = ( AspectMode_t ) GetSetting ( Set_aspect ) ;
2017-06-05 18:26:54 +00:00
2017-03-13 06:39:28 +00:00
m_wrpVRAM = GetSetting ( Set_wrpVRAM ) ;
2017-03-13 06:42:49 +00:00
m_wrpFBO = GetSetting ( Set_wrpFBO ) ! = 0 ;
2017-03-13 06:46:14 +00:00
m_wrpAnisotropic = GetSetting ( Set_wrpAnisotropic ) ! = 0 ;
2017-01-23 18:19:46 +00:00
2017-03-12 18:00:37 +00:00
m_autodetect_ucode = GetSetting ( Set_autodetect_ucode ) ! = 0 ;
2017-03-12 18:18:58 +00:00
m_wireframe = GetSetting ( Set_wireframe ) ! = 0 ;
2017-03-12 18:24:23 +00:00
m_wfmode = ( wfmode_t ) GetSetting ( Set_wfmode ) ;
2017-01-30 17:34:36 +00:00
m_ucode = ucode_F3DEX2 ;
2017-01-23 18:19:46 +00:00
char texture_dir [ 260 ] ;
memset ( texture_dir , 0 , sizeof ( texture_dir ) ) ;
2017-03-09 21:12:37 +00:00
GetSystemSettingSz ( m_Set_texture_dir , texture_dir , sizeof ( texture_dir ) ) ;
m_texture_dir = texture_dir ;
2017-01-30 06:51:54 +00:00
m_ghq_fltr = ( TextureFilter_t ) GetSetting ( Set_ghq_fltr ) ;
2017-03-09 21:21:52 +00:00
m_ghq_cmpr = ( TextureCompression_t ) GetSetting ( Set_ghq_cmpr ) ;
2017-01-30 07:01:22 +00:00
m_ghq_enht = ( TextureEnhancement_t ) GetSetting ( Set_ghq_enht ) ;
2017-03-09 21:37:26 +00:00
m_ghq_hirs = ( HiResPackFormat_t ) GetSetting ( Set_ghq_hirs ) ;
2017-03-10 05:31:59 +00:00
m_ghq_enht_cmpr = GetSetting ( Set_ghq_enht_cmpr ) ! = 0 ;
2017-04-18 12:03:49 +00:00
m_ghq_enht_f16bpp = GetSetting ( Set_ghq_enht_f16bpp ) ! = 0 ;
2017-03-10 05:42:29 +00:00
m_ghq_enht_gz = GetSetting ( Set_ghq_enht_gz ) ! = 0 ;
2017-03-10 05:55:00 +00:00
m_ghq_enht_nobg = GetSetting ( Set_ghq_enht_nobg ) ! = 0 ;
2017-03-10 06:01:41 +00:00
m_ghq_hirs_cmpr = GetSetting ( Set_ghq_hirs_cmpr ) ! = 0 ;
2017-03-10 06:10:09 +00:00
m_ghq_hirs_tile = GetSetting ( Set_ghq_hirs_tile ) ! = 0 ;
2017-03-10 12:03:10 +00:00
m_ghq_hirs_f16bpp = GetSetting ( Set_ghq_hirs_f16bpp ) ! = 0 ;
2017-03-10 12:17:57 +00:00
m_ghq_hirs_gz = GetSetting ( Set_ghq_hirs_gz ) ! = 0 ;
2017-03-10 20:43:12 +00:00
m_ghq_hirs_altcrc = GetSetting ( Set_ghq_hirs_altcrc ) ! = 0 ;
2017-03-10 20:47:57 +00:00
m_ghq_cache_save = GetSetting ( Set_ghq_cache_save ) ! = 0 ;
2017-03-12 17:49:23 +00:00
m_ghq_cache_size = GetSetting ( Set_ghq_cache_size ) ;
2017-03-12 17:54:23 +00:00
m_ghq_hirs_let_texartists_fly = GetSetting ( Set_ghq_hirs_let_texartists_fly ) ! = 0 ;
2017-03-12 17:57:37 +00:00
m_ghq_hirs_dump = GetSetting ( Set_ghq_hirs_dump ) ! = 0 ;
2017-01-23 21:16:25 +00:00
2017-03-13 06:50:43 +00:00
if ( m_Set_log_dir ! = 0 )
2017-01-23 21:16:25 +00:00
{
2017-03-13 06:50:43 +00:00
GetSystemSettingSz ( m_Set_log_dir , m_log_dir , sizeof ( m_log_dir ) ) ;
2017-01-23 21:16:25 +00:00
}
2017-03-13 06:50:43 +00:00
m_FlushLogs = m_Set_log_flush ! = 0 ? GetSystemSetting ( m_Set_log_flush ) ! = 0 : false ;
2017-01-24 19:08:33 +00:00
m_dirty = false ;
2017-01-23 18:19:46 +00:00
}
2017-01-23 18:28:13 +00:00
2017-01-24 19:08:33 +00:00
void CSettings : : ReadGameSettings ( const char * name )
2017-01-23 18:28:13 +00:00
{
2017-01-29 06:26:41 +00:00
m_hacks = ( hacks_t ) 0 ;
2017-01-23 18:28:13 +00:00
//detect games which require special hacks
if ( strstr ( name , ( const char * ) " ZELDA " ) )
2017-01-29 06:26:41 +00:00
{
m_hacks = ( hacks_t ) ( m_hacks | ( CSettings : : hack_Zelda | CSettings : : hack_OoT ) ) ;
}
2017-01-23 18:28:13 +00:00
else if ( strstr ( name , ( const char * ) " MASK " ) )
2017-01-29 06:26:41 +00:00
{
m_hacks = ( hacks_t ) ( m_hacks | CSettings : : hack_Zelda ) ;
}
2017-01-23 18:28:13 +00:00
else if ( strstr ( name , ( const char * ) " ROADSTERS TROPHY " ) )
2017-01-29 06:26:41 +00:00
{
m_hacks = ( hacks_t ) ( m_hacks | CSettings : : hack_Zelda ) ;
}
2017-01-23 18:28:13 +00:00
else if ( strstr ( name , ( const char * ) " Diddy Kong Racing " ) )
2017-01-29 06:26:41 +00:00
{
m_hacks = ( hacks_t ) ( m_hacks | CSettings : : hack_Diddy ) ;
}
2017-01-23 18:28:13 +00:00
else if ( strstr ( name , ( const char * ) " Tonic Trouble " ) )
2017-01-29 06:26:41 +00:00
{
m_hacks = ( hacks_t ) ( m_hacks | CSettings : : hack_Tonic ) ;
}
2017-01-23 18:28:13 +00:00
else if ( strstr ( name , ( const char * ) " All " ) & & strstr ( name , ( const char * ) " Star " ) & & strstr ( name , ( const char * ) " Baseball " ) )
2017-01-29 06:26:41 +00:00
{
m_hacks = ( hacks_t ) ( m_hacks | CSettings : : hack_ASB ) ;
}
2017-01-23 18:28:13 +00:00
else if ( strstr ( name , ( const char * ) " Beetle " ) | | strstr ( name , ( const char * ) " BEETLE " ) | | strstr ( name , ( const char * ) " HSV " ) )
2017-01-29 06:26:41 +00:00
{
m_hacks = ( hacks_t ) ( m_hacks | CSettings : : hack_BAR ) ;
}
2017-01-23 18:28:13 +00:00
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 " ) )
2017-01-29 06:26:41 +00:00
{
m_hacks = ( hacks_t ) ( m_hacks | CSettings : : hack_ISS64 ) ;
}
2017-01-23 18:28:13 +00:00
else if ( strstr ( name , ( const char * ) " MARIOKART64 " ) )
2017-01-29 06:26:41 +00:00
{
m_hacks = ( hacks_t ) ( m_hacks | CSettings : : hack_MK64 ) ;
}
2017-01-23 18:28:13 +00:00
else if ( strstr ( name , ( const char * ) " NITRO64 " ) )
2017-01-29 06:26:41 +00:00
{
m_hacks = ( hacks_t ) ( m_hacks | CSettings : : hack_WCWnitro ) ;
}
2017-01-23 18:28:13 +00:00
else if ( strstr ( name , ( const char * ) " CHOPPER_ATTACK " ) | | strstr ( name , ( const char * ) " WILD CHOPPERS " ) )
2017-01-29 06:26:41 +00:00
{
m_hacks = ( hacks_t ) ( m_hacks | CSettings : : hack_Chopper ) ;
}
2017-01-23 18:28:13 +00:00
else if ( strstr ( name , ( const char * ) " Resident Evil II " ) | | strstr ( name , ( const char * ) " BioHazard II " ) )
2017-01-29 06:26:41 +00:00
{
m_hacks = ( hacks_t ) ( m_hacks | CSettings : : hack_RE2 ) ;
}
2017-01-23 18:28:13 +00:00
else if ( strstr ( name , ( const char * ) " YOSHI STORY " ) )
2017-01-29 06:26:41 +00:00
{
m_hacks = ( hacks_t ) ( m_hacks | CSettings : : hack_Yoshi ) ;
}
2017-01-23 18:28:13 +00:00
else if ( strstr ( name , ( const char * ) " F-Zero X " ) | | strstr ( name , ( const char * ) " F-ZERO X " ) )
2017-01-29 06:26:41 +00:00
{
m_hacks = ( hacks_t ) ( m_hacks | CSettings : : hack_Fzero ) ;
}
2017-01-23 18:28:13 +00:00
else if ( strstr ( name , ( const char * ) " PAPER MARIO " ) | | strstr ( name , ( const char * ) " MARIO STORY " ) )
2017-01-29 06:26:41 +00:00
{
m_hacks = ( hacks_t ) ( m_hacks | CSettings : : hack_PMario ) ;
}
2017-01-23 18:28:13 +00:00
else if ( strstr ( name , ( const char * ) " TOP GEAR RALLY 2 " ) )
2017-01-29 06:26:41 +00:00
{
m_hacks = ( hacks_t ) ( m_hacks | CSettings : : hack_TGR2 ) ;
}
2017-01-23 18:28:13 +00:00
else if ( strstr ( name , ( const char * ) " TOP GEAR RALLY " ) )
2017-01-29 06:26:41 +00:00
{
m_hacks = ( hacks_t ) ( m_hacks | CSettings : : hack_TGR ) ;
}
2017-01-23 18:28:13 +00:00
else if ( strstr ( name , ( const char * ) " Top Gear Hyper Bike " ) )
2017-01-29 06:26:41 +00:00
{
m_hacks = ( hacks_t ) ( m_hacks | CSettings : : hack_Hyperbike ) ;
}
2017-01-23 18:28:13 +00:00
else if ( strstr ( name , ( const char * ) " Killer Instinct Gold " ) | | strstr ( name , ( const char * ) " KILLER INSTINCT GOLD " ) )
2017-01-29 06:26:41 +00:00
{
m_hacks = ( hacks_t ) ( m_hacks | CSettings : : hack_KI ) ;
}
2017-01-23 18:28:13 +00:00
else if ( strstr ( name , ( const char * ) " Knockout Kings 2000 " ) )
2017-01-29 06:26:41 +00:00
{
m_hacks = ( hacks_t ) ( m_hacks | CSettings : : hack_Knockout ) ;
}
2017-01-23 18:28:13 +00:00
else if ( strstr ( name , ( const char * ) " LEGORacers " ) )
2017-01-29 06:26:41 +00:00
{
m_hacks = ( hacks_t ) ( m_hacks | CSettings : : hack_Lego ) ;
}
2017-01-23 18:28:13 +00:00
else if ( strstr ( name , ( const char * ) " OgreBattle64 " ) )
2017-01-29 06:26:41 +00:00
{
m_hacks = ( hacks_t ) ( m_hacks | CSettings : : hack_Ogre64 ) ;
}
2017-01-23 18:28:13 +00:00
else if ( strstr ( name , ( const char * ) " Pilot Wings64 " ) )
2017-01-29 06:26:41 +00:00
{
m_hacks = ( hacks_t ) ( m_hacks | CSettings : : hack_Pilotwings ) ;
}
2017-01-23 18:28:13 +00:00
else if ( strstr ( name , ( const char * ) " Supercross " ) )
2017-01-29 06:26:41 +00:00
{
m_hacks = ( hacks_t ) ( m_hacks | CSettings : : hack_Supercross ) ;
}
2017-01-23 18:28:13 +00:00
else if ( strstr ( name , ( const char * ) " STARCRAFT 64 " ) )
2017-01-29 06:26:41 +00:00
{
m_hacks = ( hacks_t ) ( m_hacks | CSettings : : hack_Starcraft ) ;
}
2017-01-23 18:28:13 +00:00
else if ( strstr ( name , ( const char * ) " BANJO KAZOOIE 2 " ) | | strstr ( name , ( const char * ) " BANJO TOOIE " ) )
2017-01-29 06:26:41 +00:00
{
m_hacks = ( hacks_t ) ( m_hacks | CSettings : : hack_Banjo2 ) ;
}
2017-01-23 18:28:13 +00:00
else if ( strstr ( name , ( const char * ) " FIFA: RTWC 98 " ) | | strstr ( name , ( const char * ) " RoadToWorldCup98 " ) )
2017-01-29 06:26:41 +00:00
{
m_hacks = ( hacks_t ) ( m_hacks | CSettings : : hack_Fifa98 ) ;
}
2017-01-23 18:28:13 +00:00
else if ( strstr ( name , ( const char * ) " Mega Man 64 " ) | | strstr ( name , ( const char * ) " RockMan Dash " ) )
2017-01-29 06:26:41 +00:00
{
m_hacks = ( hacks_t ) ( m_hacks | CSettings : : hack_Megaman ) ;
}
2017-01-23 18:28:13 +00:00
else if ( strstr ( name , ( const char * ) " MISCHIEF MAKERS " ) | | strstr ( name , ( const char * ) " TROUBLE MAKERS " ) )
2017-01-29 06:26:41 +00:00
{
m_hacks = ( hacks_t ) ( m_hacks | CSettings : : hack_Makers ) ;
}
2017-01-23 18:28:13 +00:00
else if ( strstr ( name , ( const char * ) " GOLDENEYE " ) )
2017-01-29 06:26:41 +00:00
{
m_hacks = ( hacks_t ) ( m_hacks | CSettings : : hack_GoldenEye ) ;
}
2017-01-23 18:28:13 +00:00
else if ( strstr ( name , ( const char * ) " PUZZLE LEAGUE " ) )
2017-01-29 06:26:41 +00:00
{
m_hacks = ( hacks_t ) ( m_hacks | CSettings : : hack_PPL ) ;
}
else if ( strstr ( name , ( const char * ) " WIN BACK " ) | | strstr ( name , ( const char * ) " OPERATION WINBACK " ) )
{
m_hacks = ( hacks_t ) ( m_hacks | CSettings : : hack_Winback ) ;
}
2017-01-23 18:28:13 +00:00
2017-03-12 20:12:17 +00:00
m_alt_tex_size = GetSetting ( Set_alt_tex_size ) ! = 0 ;
2017-03-12 20:16:27 +00:00
m_use_sts1_only = GetSetting ( Set_use_sts1_only ) ! = 0 ;
2017-03-13 06:11:14 +00:00
m_force_calc_sphere = GetSetting ( Set_force_calc_sphere ) ! = 0 ;
2021-01-19 05:58:59 +00:00
m_correct_viewport = GetSetting ( Set_correct_viewport ) ! = 0 ;
2017-03-12 20:22:57 +00:00
m_increase_texrect_edge = GetSetting ( Set_increase_texrect_edge ) ! = 0 ;
2017-03-12 20:31:03 +00:00
m_decrease_fillrect_edge = GetSetting ( Set_decrease_fillrect_edge ) ! = 0 ;
2017-03-12 20:36:14 +00:00
m_texture_correction = GetSetting ( Set_texture_correction ) ! = 0 ;
2017-03-13 06:14:36 +00:00
m_pal230 = GetSetting ( Set_pal230 ) ! = 0 ;
2017-08-10 22:25:05 +00:00
m_stipple_mode = ( gfxStippleMode_t ) GetSetting ( Set_stipple_mode ) ;
2017-01-23 18:28:13 +00:00
int stipple_pattern = GetSetting ( Set_stipple_pattern ) ;
2017-03-12 20:48:22 +00:00
m_stipple_pattern = stipple_pattern > 0 ? ( uint32_t ) stipple_pattern : 0x3E0F83E0 ;
2017-03-12 20:52:37 +00:00
m_force_microcheck = GetSetting ( Set_force_microcheck ) ! = 0 ;
2017-03-12 20:55:58 +00:00
m_force_quad3d = GetSetting ( Set_force_quad3d ) ! = 0 ;
2017-03-12 20:59:00 +00:00
m_clip_zmin = GetSetting ( Set_clip_zmin ) ! = 0 ;
2017-03-12 21:04:09 +00:00
m_clip_zmax = GetSetting ( Set_clip_zmax ) ! = 0 ;
2017-03-12 18:28:39 +00:00
m_fast_crc = GetSetting ( Set_fast_crc ) ! = 0 ;
2021-01-19 05:58:59 +00:00
m_adjust_aspect = GetSetting ( Set_adjust_aspect ) ! = 0 ;
m_zmode_compare_less = GetSetting ( Set_zmode_compare_less ) ! = 0 ;
m_old_style_adither = GetSetting ( Set_old_style_adither ) ! = 0 ;
2017-03-13 06:26:20 +00:00
m_n64_z_scale = GetSetting ( Set_n64_z_scale ) ! = 0 ;
2017-08-16 08:03:13 +00:00
m_RdramSize = GetSystemSetting ( m_Set_RDRamSize ) ;
2017-01-25 08:20:12 +00:00
2017-02-08 19:08:06 +00:00
m_ScreenRes = GetSetting ( Set_Resolution ) ;
if ( m_ScreenRes > = GetScreenResolutionCount ( ) ) { m_ScreenRes = GetDefaultScreenRes ( ) ; }
2017-01-23 18:28:13 +00:00
//frame buffer
2021-01-19 05:58:59 +00:00
VideoSettings fb_Settings [ ] =
2017-01-24 19:08:33 +00:00
{
g_romopen ? Set_optimize_texrect : Set_optimize_texrect_default ,
Set_ignore_aux_copy ,
Set_hires_buf_clear ,
Set_fb_read_alpha ,
Set_useless_is_useless ,
g_romopen ? Set_fb_smart : Set_fb_smart_default ,
g_romopen ? Set_fb_hires : Set_fb_hires_default ,
g_romopen ? Set_fb_read_always : Set_fb_read_always_default ,
g_romopen ? Set_detect_cpu_write : Set_detect_cpu_write_default ,
g_romopen ? Set_fb_get_info : Set_fb_get_info_default ,
g_romopen ? Set_fb_render : Set_fb_render_default
} ;
fb_bits_t bits [ ] =
{
fb_optimize_texrect ,
fb_ignore_aux_copy ,
fb_hwfbe_buf_clear ,
fb_read_alpha ,
fb_useless_is_useless ,
fb_emulation ,
fb_hwfbe ,
fb_ref ,
fb_cpu_write_hack ,
fb_get_info ,
fb_depth_render
} ;
uint32_t fb_add_bits = 0 , fb_remove_bits = 0 ;
for ( int i = 0 ; i < ( sizeof ( fb_Settings ) / sizeof ( fb_Settings [ 0 ] ) ) ; i + + )
{
if ( GetSetting ( fb_Settings [ i ] ) ! = 0 )
{
fb_add_bits | = bits [ i ] ;
}
else
{
fb_remove_bits | = bits [ i ] ;
}
}
fb_add_bits | = fb_motionblur ;
2017-01-23 18:28:13 +00:00
int read_back_to_screen = GetSetting ( g_romopen ? Set_read_back_to_screen : Set_read_back_to_screen_default ) ;
2017-01-24 19:08:33 +00:00
if ( read_back_to_screen = = 1 ) { fb_add_bits | = fb_read_back_to_screen ; }
else if ( read_back_to_screen = = 2 ) { fb_add_bits | = fb_read_back_to_screen2 ; }
else if ( read_back_to_screen = = 0 ) { fb_remove_bits | = fb_read_back_to_screen | fb_read_back_to_screen2 ; }
2017-03-13 08:54:36 +00:00
UpdateFrameBufferBits ( fb_add_bits , fb_remove_bits ) ;
2017-01-29 21:13:58 +00:00
m_fb_crc_mode = ( FBCRCMODE_t ) GetSetting ( Set_fb_crc_mode ) ;
2017-01-29 09:10:32 +00:00
SetFiltering ( ( Filtering_t ) GetSetting ( g_romopen ? Set_filtering : Set_filtering_default ) ) ;
2017-03-09 20:54:56 +00:00
SetFog ( GetSetting ( g_romopen ? Set_fog : Set_fog_default ) ! = 0 ) ;
2017-03-09 21:06:58 +00:00
SetBuffClear ( GetSetting ( g_romopen ? Set_buff_clear : Set_buff_clear_default ) ! = 0 ) ;
2017-01-29 18:05:06 +00:00
SetSwapMode ( ( SwapMode_t ) GetSetting ( g_romopen ? Set_swapmode : Set_swapmode_default ) ) ;
2017-01-29 06:47:28 +00:00
SetAspectmode ( ( AspectMode_t ) GetSetting ( g_romopen ? Set_aspect : Set_aspect_default ) ) ;
2017-01-29 21:03:23 +00:00
SetLODmode ( ( PixelLevelOfDetail_t ) GetSetting ( g_romopen ? Set_lodmode : Set_lodmode_default ) ) ;
2017-03-13 08:54:36 +00:00
m_flame_corona = hacks ( hack_Zelda ) & & ! fb_depth_render_enabled ( ) ;
2017-04-27 10:10:12 +00:00
m_aspectmode = ( AspectMode_t ) GetSetting ( g_romopen ? Set_aspect : Set_aspect_default ) ;
2017-01-23 18:28:13 +00:00
}
2017-01-27 06:30:19 +00:00
void CSettings : : WriteSettings ( void )
2017-01-23 18:28:13 +00:00
{
2017-06-05 18:26:54 +00:00
m_InWriteSettings = true ;
2017-03-13 08:54:36 +00:00
SetSetting ( Set_Resolution , m_ScreenRes ) ;
2017-03-13 06:33:08 +00:00
# ifndef ANDROID
SetSetting ( Set_FullScreenRes , m_FullScreenRes ) ;
2017-01-23 18:28:13 +00:00
# endif
2017-03-09 07:13:25 +00:00
SetSetting ( Set_vsync , m_vsync ? 1 : 0 ) ;
2017-01-29 08:58:25 +00:00
SetSetting ( Set_Rotate , m_rotate ) ;
2017-03-09 07:01:06 +00:00
SetSetting ( Set_texenh_options , m_texenh_options ) ;
2017-01-23 18:28:13 +00:00
2017-03-13 06:39:28 +00:00
SetSetting ( Set_wrpVRAM , m_wrpVRAM ) ;
2017-03-13 06:42:49 +00:00
SetSetting ( Set_wrpFBO , m_wrpFBO ) ;
2017-03-13 06:46:14 +00:00
SetSetting ( Set_wrpAnisotropic , m_wrpAnisotropic ) ;
2017-03-12 18:00:37 +00:00
SetSetting ( Set_autodetect_ucode , m_autodetect_ucode ) ;
2017-01-23 18:28:13 +00:00
2017-03-12 18:18:58 +00:00
SetSetting ( Set_wireframe , m_wireframe ) ;
2017-03-12 18:24:23 +00:00
SetSetting ( Set_wfmode , m_wfmode ) ;
2017-03-13 08:54:36 +00:00
SetSetting ( Set_ucode , ( int ) m_ucode ) ;
2017-01-23 18:28:13 +00:00
2017-01-30 06:51:54 +00:00
SetSetting ( Set_ghq_fltr , m_ghq_fltr ) ;
2017-03-09 21:21:52 +00:00
SetSetting ( Set_ghq_cmpr , m_ghq_cmpr ) ;
2017-01-30 07:01:22 +00:00
SetSetting ( Set_ghq_enht , m_ghq_enht ) ;
2017-03-09 21:37:26 +00:00
SetSetting ( Set_ghq_hirs , m_ghq_hirs ) ;
2017-03-10 05:31:59 +00:00
SetSetting ( Set_ghq_enht_cmpr , m_ghq_enht_cmpr ) ;
2017-03-10 05:36:38 +00:00
SetSetting ( Set_ghq_enht_f16bpp , m_ghq_enht_f16bpp ) ;
2017-03-10 05:42:29 +00:00
SetSetting ( Set_ghq_enht_gz , m_ghq_enht_gz ) ;
2017-03-10 05:55:00 +00:00
SetSetting ( Set_ghq_enht_nobg , m_ghq_enht_nobg ) ;
2017-03-10 06:01:41 +00:00
SetSetting ( Set_ghq_hirs_cmpr , m_ghq_hirs_cmpr ) ;
2017-03-10 06:10:09 +00:00
SetSetting ( Set_ghq_hirs_tile , m_ghq_hirs_tile ) ;
2017-03-10 12:03:10 +00:00
SetSetting ( Set_ghq_hirs_f16bpp , m_ghq_hirs_f16bpp ) ;
2017-03-10 12:17:57 +00:00
SetSetting ( Set_ghq_hirs_gz , m_ghq_hirs_gz ) ;
2017-03-10 20:43:12 +00:00
SetSetting ( Set_ghq_hirs_altcrc , m_ghq_hirs_altcrc ) ;
2017-03-10 20:47:57 +00:00
SetSetting ( Set_ghq_cache_save , m_ghq_cache_save ) ;
2017-03-12 17:49:23 +00:00
SetSetting ( Set_ghq_cache_size , m_ghq_cache_size ) ;
2017-03-12 17:54:23 +00:00
SetSetting ( Set_ghq_hirs_let_texartists_fly , m_ghq_hirs_let_texartists_fly ) ;
2017-03-12 17:57:37 +00:00
SetSetting ( Set_ghq_hirs_dump , m_ghq_hirs_dump ) ;
2017-01-23 18:28:13 +00:00
2017-03-13 08:54:36 +00:00
SetSetting ( g_romopen ? Set_filtering : Set_filtering_default , m_filtering ) ;
2017-03-09 20:54:56 +00:00
SetSetting ( g_romopen ? Set_fog : Set_fog_default , m_fog ) ;
2017-03-09 21:06:58 +00:00
SetSetting ( g_romopen ? Set_buff_clear : Set_buff_clear_default , m_buff_clear ) ;
2017-03-13 08:54:36 +00:00
SetSetting ( g_romopen ? Set_swapmode : Set_swapmode_default , m_swapmode ) ;
SetSetting ( g_romopen ? Set_lodmode : Set_lodmode_default , m_lodmode ) ;
2017-01-29 06:47:28 +00:00
SetSetting ( g_romopen ? Set_aspect : Set_aspect_default , m_aspectmode ) ;
2017-01-23 18:28:13 +00:00
2017-03-13 08:54:36 +00:00
SetSetting ( g_romopen ? Set_fb_read_always : Set_fb_read_always_default , fb_ref_enabled ( ) ? true : false ) ;
SetSetting ( g_romopen ? Set_fb_smart : Set_fb_smart_default , fb_emulation_enabled ( ) ? true : false ) ;
SetSetting ( g_romopen ? Set_fb_hires : Set_fb_hires_default , fb_hwfbe_set ( ) ? true : false ) ;
SetSetting ( g_romopen ? Set_fb_get_info : Set_fb_get_info_default , fb_get_info_enabled ( ) ? true : false ) ;
SetSetting ( g_romopen ? Set_fb_render : Set_fb_render_default , fb_depth_render_enabled ( ) ? true : false ) ;
SetSetting ( g_romopen ? Set_detect_cpu_write : Set_detect_cpu_write_default , fb_cpu_write_hack_enabled ( ) ? true : false ) ;
if ( fb_read_back_to_screen_enabled ( ) )
2017-01-23 18:28:13 +00:00
{
SetSetting ( g_romopen ? Set_read_back_to_screen : Set_read_back_to_screen_default , 1 ) ;
}
2017-03-13 08:54:36 +00:00
else if ( fb_read_back_to_screen2_enabled ( ) )
2017-01-23 18:28:13 +00:00
{
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 ( ) ;
2017-06-05 18:26:54 +00:00
m_InWriteSettings = false ;
2017-01-23 18:28:13 +00:00
}
2017-02-08 19:08:06 +00:00
2017-03-13 06:53:41 +00:00
void CSettings : : general_setting ( short setting_ID , const char * name , unsigned int value )
{
RegisterSetting ( setting_ID , Data_DWORD_General , name , NULL , value , NULL ) ;
}
void CSettings : : game_setting ( short setting_ID , const char * name , unsigned int value )
{
RegisterSetting ( setting_ID , Data_DWORD_Game , name , NULL , value , NULL ) ;
}
void CSettings : : game_setting_default ( short setting_ID , const char * name , short default_setting )
{
RegisterSetting2 ( setting_ID , Data_DWORD_Game , name , NULL , default_setting ) ;
}
2017-02-08 19:08:06 +00:00
void CSettings : : SettingsChanged ( void )
{
2017-06-05 18:26:54 +00:00
if ( m_InWriteSettings )
{
return ;
}
2017-02-08 19:08:06 +00:00
m_ScreenRes = GetSetting ( Set_Resolution ) ;
2017-04-27 10:10:12 +00:00
m_aspectmode = ( AspectMode_t ) GetSetting ( Set_aspect ) ;
2017-02-08 19:08:06 +00:00
}
2017-03-13 09:28:34 +00:00
2017-04-18 12:03:49 +00:00
void CSettings : : LogLevelChanged ( void )
{
g_ModuleLogLevel [ TraceMD5 ] = GetSetting ( Set_Logging_MD5 ) ;
g_ModuleLogLevel [ TraceThread ] = GetSetting ( Set_Logging_Thread ) ;
g_ModuleLogLevel [ TracePath ] = GetSetting ( Set_Logging_Path ) ;
g_ModuleLogLevel [ TraceSettings ] = GetSetting ( Set_Logging_Settings ) ;
g_ModuleLogLevel [ TraceUnknown ] = GetSetting ( Set_Logging_Unknown ) ;
g_ModuleLogLevel [ TraceGlide64 ] = GetSetting ( Set_Logging_Glide64 ) ;
g_ModuleLogLevel [ TraceInterface ] = GetSetting ( Set_Logging_Interface ) ;
g_ModuleLogLevel [ TraceResolution ] = GetSetting ( Set_Logging_Resolution ) ;
g_ModuleLogLevel [ TraceGlitch ] = GetSetting ( Set_Logging_Glitch ) ;
g_ModuleLogLevel [ TraceRDP ] = GetSetting ( Set_Logging_VideoRDP ) ;
g_ModuleLogLevel [ TraceTLUT ] = GetSetting ( Set_Logging_TLUT ) ;
g_ModuleLogLevel [ TracePNG ] = GetSetting ( Set_Logging_PNG ) ;
g_ModuleLogLevel [ TraceOGLWrapper ] = GetSetting ( Set_Logging_OGLWrapper ) ;
g_ModuleLogLevel [ TraceRDPCommands ] = GetSetting ( Set_Logging_RDPCommands ) ;
}
2017-03-13 09:28:34 +00:00
void UseUnregisteredSetting ( int /*SettingID*/ )
{
2021-01-19 05:58:59 +00:00
g_Notify - > BreakPoint ( __FILE__ , __LINE__ ) ;
2017-04-18 12:03:49 +00:00
}