scripted_input is active is a script is loaded, not based on the button mapping
This commit is contained in:
		| @@ -77,6 +77,10 @@ void ScriptRunner::LoadScript(std::string script_name) { | |||||||
|     fclose(file); |     fclose(file); | ||||||
| } | } | ||||||
|  |  | ||||||
|  | bool ScriptRunner::HasScript() const { | ||||||
|  |     return script.size() > 0; | ||||||
|  | } | ||||||
|  |  | ||||||
| void ScriptRunner::NotifyFrameFinished() { | void ScriptRunner::NotifyFrameFinished() { | ||||||
|     frame_number++; |     frame_number++; | ||||||
|  |  | ||||||
|   | |||||||
| @@ -31,6 +31,7 @@ class ScriptRunner final { | |||||||
| public: | public: | ||||||
|     void SetButtons(std::shared_ptr<ScriptedButtons> buttons); |     void SetButtons(std::shared_ptr<ScriptedButtons> buttons); | ||||||
|     void LoadScript(std::string script_name); |     void LoadScript(std::string script_name); | ||||||
|  |     bool HasScript() const; | ||||||
|  |  | ||||||
|     void NotifyFrameFinished(); |     void NotifyFrameFinished(); | ||||||
| private: | private: | ||||||
|   | |||||||
| @@ -63,16 +63,11 @@ std::unique_ptr<Input::ButtonDevice> ScriptedButtons::Create(const Common::Param | |||||||
|     int index = IndexOfButton(button_str); |     int index = IndexOfButton(button_str); | ||||||
|     if (index >= 0) { |     if (index >= 0) { | ||||||
|         scripted_button_list.get()->buttons[index] = button.get(); |         scripted_button_list.get()->buttons[index] = button.get(); | ||||||
|         is_in_use = true; |  | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     return std::move(button); |     return std::move(button); | ||||||
| } | } | ||||||
|  |  | ||||||
| bool ScriptedButtons::IsInUse() { |  | ||||||
|     return is_in_use; |  | ||||||
| } |  | ||||||
|  |  | ||||||
| void ScriptedButtons::SetActiveButtons(const std::vector<int>& buttons_active) { | void ScriptedButtons::SetActiveButtons(const std::vector<int>& buttons_active) { | ||||||
|  |  | ||||||
|     for (int i = 0; i < button_count; i++) { |     for (int i = 0; i < button_count; i++) { | ||||||
|   | |||||||
| @@ -26,15 +26,9 @@ public: | |||||||
|     */ |     */ | ||||||
|     std::unique_ptr<Input::ButtonDevice> Create(const Common::ParamPackage& params) override; |     std::unique_ptr<Input::ButtonDevice> Create(const Common::ParamPackage& params) override; | ||||||
|  |  | ||||||
|     /** |  | ||||||
|     * True if any button is being controlled |  | ||||||
|     */ |  | ||||||
|     bool IsInUse(); |  | ||||||
|  |  | ||||||
|     void SetActiveButtons(const std::vector<int>& buttons_active); |     void SetActiveButtons(const std::vector<int>& buttons_active); | ||||||
| private: | private: | ||||||
|     std::shared_ptr<ScriptedButtonList> scripted_button_list; |     std::shared_ptr<ScriptedButtonList> scripted_button_list; | ||||||
|     bool is_in_use {false}; |  | ||||||
| }; | }; | ||||||
|  |  | ||||||
| } // namespace InputCommon | } // namespace InputCommon | ||||||
|   | |||||||
| @@ -31,8 +31,7 @@ void Shutdown() { | |||||||
| } | } | ||||||
|  |  | ||||||
| bool IsInUse() { | bool IsInUse() { | ||||||
|     //TODO return script_runner.HasScript(); |     return script_runner.HasScript(); | ||||||
|     return scripted_buttons.get()->IsInUse(); |  | ||||||
| } | } | ||||||
|  |  | ||||||
| void NotifyFrameFinished() { | void NotifyFrameFinished() { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 danzel
					danzel