mirror of
https://github.com/citra-emu/citra.git
synced 2024-11-30 04:40:05 +00:00
When a script is configured, override the controls settings so it is used. This means you only need to set one thing in the config to use a script (script_name).
This commit is contained in:
parent
c70b49be17
commit
196a09fefa
@ -4,6 +4,7 @@
|
||||
|
||||
#include <atomic>
|
||||
#include <vector>
|
||||
#include "core/settings.h"
|
||||
#include "scripted_input/scripted_buttons.h"
|
||||
|
||||
const int button_count = 15;
|
||||
@ -40,6 +41,12 @@ public:
|
||||
ScriptedButton* buttons[button_count];
|
||||
};
|
||||
|
||||
void ScriptedButtons::OverrideControlsSettings() {
|
||||
for (int i = 0; i < button_count; i++) {
|
||||
Settings::values.buttons[i] = "engine:scripted,button:" + button_name_to_index[i];
|
||||
}
|
||||
}
|
||||
|
||||
ScriptedButtons::ScriptedButtons() : scripted_button_list{std::make_shared<ScriptedButtonList>()} {}
|
||||
|
||||
std::unique_ptr<Input::ButtonDevice> ScriptedButtons::Create(const Common::ParamPackage& params) {
|
||||
|
@ -18,6 +18,11 @@ class ScriptedButtonList;
|
||||
*/
|
||||
class ScriptedButtons final : public Input::Factory<Input::ButtonDevice> {
|
||||
public:
|
||||
/**
|
||||
* Overrides the Settings for buttons so they are controlled by us
|
||||
*/
|
||||
static void OverrideControlsSettings();
|
||||
|
||||
ScriptedButtons();
|
||||
|
||||
/**
|
||||
|
@ -22,6 +22,8 @@ void Init() {
|
||||
void LoadScript(std::string script_name) {
|
||||
if (script_name.length() > 0) {
|
||||
script_runner.LoadScript(script_name);
|
||||
|
||||
ScriptedButtons::OverrideControlsSettings();
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user