MCPcopy Create free account
hub / github.com/cemu-project/Cemu / load_controller

Method load_controller

src/gui/input/panels/InputPanel.cpp:151–184  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

149
150
151void InputPanel::load_controller(const EmulatedControllerPtr& controller)
152{
153 reset_configuration();
154 if(!controller)
155 {
156 return;
157 }
158
159 if(controller->get_controllers().empty())
160 {
161 return;
162 }
163
164 wxWindowUpdateLocker lock(this);
165 for (auto* child : this->GetChildren())
166 {
167 const auto text = dynamic_cast<wxTextCtrl*>(child);
168 if (text == nullptr)
169 continue;
170
171
172 const auto mapping = reinterpret_cast<sint64>(text->GetClientData());
173 if (mapping <= 0)
174 continue;
175
176 auto button_name = controller->get_mapping_name(mapping);
177#if BOOST_OS_WINDOWS
178 text->SetLabelText(button_name);
179#else
180 // SetLabelText doesn't seem to work here for some reason on wxGTK
181 text->ChangeValue(button_name);
182#endif
183 }
184}
185
186void InputPanel::set_selected_controller(const EmulatedControllerPtr& emulated_controller, const ControllerPtr& controller)
187{

Callers 3

update_stateMethod · 0.45
on_controller_addMethod · 0.45
on_controller_removeMethod · 0.45

Calls 4

GetChildrenMethod · 0.80
get_mapping_nameMethod · 0.80
emptyMethod · 0.45
get_controllersMethod · 0.45

Tested by

no test coverage detected