MCPcopy Create free account
hub / github.com/DaedalusX64/daedalus / OpenPreferencesFile

Method OpenPreferencesFile

Source/Utility/Preferences.cpp:127–294  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

125}
126
127bool IPreferences::OpenPreferencesFile( const char * filename )
128{
129 mFilename = filename;
130
131 CIniFile * p_ini_file( CIniFile::Create( filename ) );
132 if( p_ini_file == NULL )
133 {
134 return false;
135 }
136
137 const CIniFileSection * section( p_ini_file->GetDefaultSection() );
138 if( section != NULL )
139 {
140 const CIniFileProperty * property;
141
142#define BOOL_SETTING( b, nm, def ) if( section->FindProperty( #nm, &property ) ) { b.nm = property->GetBooleanValue( def.nm ); }
143#define INT_SETTING( b, nm, def ) if( section->FindProperty( #nm, &property ) ) { b.nm = property->GetIntValue( def.nm ); }
144#define FLOAT_SETTING( b, nm, def ) if( section->FindProperty( #nm, &property ) ) { b.nm = property->GetFloatValue( def.nm ); }
145
146 const SGlobalPreferences defaults;
147
148 INT_SETTING( gGlobalPreferences, DisplayFramerate, defaults );
149 BOOL_SETTING( gGlobalPreferences, ForceLinearFilter, defaults );
150 BOOL_SETTING( gGlobalPreferences, RumblePak, defaults );
151#ifdef DAEDALUS_DEBUG_DISPLAYLIST
152 BOOL_SETTING( gGlobalPreferences, HighlightInexactBlendModes, defaults );
153 BOOL_SETTING( gGlobalPreferences, CustomBlendModes, defaults );
154#endif
155 BOOL_SETTING( gGlobalPreferences, BatteryWarning, defaults );
156 BOOL_SETTING( gGlobalPreferences, LargeROMBuffer, defaults );
157 FLOAT_SETTING( gGlobalPreferences, StickMinDeadzone, defaults );
158 FLOAT_SETTING( gGlobalPreferences, StickMaxDeadzone, defaults );
159// INT_SETTING( gGlobalPreferences, Language, defaults );
160#ifdef DAEDALUS_PSP
161 if( section->FindProperty( "Language", &property ) )
162 {
163 gGlobalPreferences.Language = Translate_IndexFromName( property->GetValue() );
164 }
165#endif
166 if( section->FindProperty( "GuiColor", &property ) )
167 {
168 u32 value( property->GetIntValue(defaults.GuiColor) );
169 if( value < NUM_COLOR_TYPES ) //value >= 0 && not needed as it's always True
170 {
171 gGlobalPreferences.GuiColor = EGuiColor( value );
172 }
173 }
174
175 if( section->FindProperty( "ViewportType", &property ) )
176 {
177 u32 value( property->GetIntValue( defaults.ViewportType ) );
178 if(value < NUM_VIEWPORT_TYPES ) //value >= 0 && Not need as it's always True
179 {
180 gGlobalPreferences.ViewportType = EViewportType( value );
181 }
182 }
183
184 BOOL_SETTING( gGlobalPreferences, TVEnable, defaults );

Callers

nothing calls this directly

Calls 15

Translate_IndexFromNameFunction · 0.85
EGuiColorEnum · 0.85
EViewportTypeEnum · 0.85
ETVTypeEnum · 0.85
GetFrameskipValueFromIntFunction · 0.85
FindPropertyMethod · 0.80
GetValueMethod · 0.80
GetIntValueMethod · 0.80
GetNumSectionsMethod · 0.80
GetBooleanValueMethod · 0.80
RomIDFromStringFunction · 0.70

Tested by

no test coverage detected