MCPcopy Create free account
hub / github.com/PCSX2/pcsx2 / ApplyLayoutSettings

Method ApplyLayoutSettings

pcsx2/ImGui/FullscreenUI.cpp:153–255  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

151}
152
153void FullscreenUI::ApplyLayoutSettings(const SettingsInterface* bsi)
154{
155 ImGuiIO& io = ImGui::GetIO();
156#define GET_SETTINGS_VALUE(type, section, key, default) \
157 (bsi ? bsi->Get##type##Value(section, key, default) : Host::GetBase##type##SettingValue(section, key, default))
158
159 SmallString swap_mode = GET_SETTINGS_VALUE(SmallString, "UI", "SwapOKFullscreenUI", "auto");
160
161 // Check Nintendo Setting
162 SmallString sdl2_nintendo_mode = GET_SETTINGS_VALUE(SmallString, "UI", "SDL2NintendoLayout", "false");
163 // Check glyph preference
164 SmallString glyph_mode = GET_SETTINGS_VALUE(SmallString, "UI", "FullscreenUIGlyphStyle", "auto");
165
166 const auto parse_glyph_layout = [](const SmallString& mode) -> InputLayout {
167 if (mode == "xbox")
168 return InputLayout::Xbox;
169 if (mode == "playstation")
170 return InputLayout::Playstation;
171 if (mode == "nintendo")
172 return InputLayout::Nintendo;
173 return InputLayout::Unknown;
174 };
175
176 switch (parse_glyph_layout(glyph_mode))
177 {
178 case InputLayout::Xbox:
179 InputManager::SetGamepadIconPreference(InputLayout::Xbox);
180 break;
181 case InputLayout::Playstation:
182 InputManager::SetGamepadIconPreference(InputLayout::Playstation);
183 break;
184 case InputLayout::Nintendo:
185 InputManager::SetGamepadIconPreference(InputLayout::Nintendo);
186 break;
187 default:
188 InputManager::SetGamepadIconPreference(InputLayout::Unknown);
189 break;
190 }
191
192 const InputLayout layout = ImGuiFullscreen::GetGamepadLayout();
193
194 if ((sdl2_nintendo_mode == "true" || sdl2_nintendo_mode == "auto") && layout == InputLayout::Nintendo)
195 {
196 // Apply
197 ImGuiManager::SwapGamepadNorthWest(true);
198
199 // Check swap_mode if A/B should also be swapped
200 if (swap_mode == "auto")
201 {
202 io.ConfigNavSwapGamepadButtons = true;
203 return;
204 }
205 }
206 else
207 ImGuiManager::SwapGamepadNorthWest(false);
208
209 if (swap_mode == "true")
210 io.ConfigNavSwapGamepadButtons = true;

Callers

nothing calls this directly

Calls 3

IsBIOSFunction · 0.85
CombineFunction · 0.85
c_strMethod · 0.45

Tested by

no test coverage detected