mirror of
https://github.com/citra-emu/citra.git
synced 2024-11-30 06:50:06 +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 <atomic>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
#include "core/settings.h"
|
||||||
#include "scripted_input/scripted_buttons.h"
|
#include "scripted_input/scripted_buttons.h"
|
||||||
|
|
||||||
const int button_count = 15;
|
const int button_count = 15;
|
||||||
@ -40,6 +41,12 @@ public:
|
|||||||
ScriptedButton* buttons[button_count];
|
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>()} {}
|
ScriptedButtons::ScriptedButtons() : scripted_button_list{std::make_shared<ScriptedButtonList>()} {}
|
||||||
|
|
||||||
std::unique_ptr<Input::ButtonDevice> ScriptedButtons::Create(const Common::ParamPackage& params) {
|
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> {
|
class ScriptedButtons final : public Input::Factory<Input::ButtonDevice> {
|
||||||
public:
|
public:
|
||||||
|
/**
|
||||||
|
* Overrides the Settings for buttons so they are controlled by us
|
||||||
|
*/
|
||||||
|
static void OverrideControlsSettings();
|
||||||
|
|
||||||
ScriptedButtons();
|
ScriptedButtons();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -22,6 +22,8 @@ void Init() {
|
|||||||
void LoadScript(std::string script_name) {
|
void LoadScript(std::string script_name) {
|
||||||
if (script_name.length() > 0) {
|
if (script_name.length() > 0) {
|
||||||
script_runner.LoadScript(script_name);
|
script_runner.LoadScript(script_name);
|
||||||
|
|
||||||
|
ScriptedButtons::OverrideControlsSettings();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user