diff --git a/include/MaaFramework/MaaDef.h b/include/MaaFramework/MaaDef.h index 64e65342d..effb8b22f 100644 --- a/include/MaaFramework/MaaDef.h +++ b/include/MaaFramework/MaaDef.h @@ -223,9 +223,9 @@ typedef struct MaaRect /* * See MaaMsg.h */ -typedef void (MAA_CALL *MaaNotificationCallback)(const char* message, const char* details_json, void* notify_trans_arg); +typedef void(MAA_CALL* MaaNotificationCallback)(const char* message, const char* details_json, void* notify_trans_arg); -typedef MaaBool (MAA_CALL *MaaCustomRecognitionCallback)( +typedef MaaBool(MAA_CALL* MaaCustomRecognitionCallback)( MaaContext* context, MaaTaskId task_id, const char* current_task_name, @@ -237,7 +237,7 @@ typedef MaaBool (MAA_CALL *MaaCustomRecognitionCallback)( /* out */ MaaRect* out_box, /* out */ MaaStringBuffer* out_detail); -typedef MaaBool (MAA_CALL *MaaCustomActionCallback)( +typedef MaaBool(MAA_CALL* MaaCustomActionCallback)( MaaContext* context, MaaTaskId task_id, const char* current_task_name, diff --git a/include/MaaFramework/MaaMsg.h b/include/MaaFramework/MaaMsg.h index d8aaf4866..10772bad6 100644 --- a/include/MaaFramework/MaaMsg.h +++ b/include/MaaFramework/MaaMsg.h @@ -94,7 +94,6 @@ #define MaaMsg_Task_Recognition_Failed ("Task.Recognition.Failed") /// @} - /** * @{ * @brief Message for the task action. diff --git a/include/MaaFramework/Utility/MaaUtility.h b/include/MaaFramework/Utility/MaaUtility.h index 361e3c710..f32ea0c3b 100644 --- a/include/MaaFramework/Utility/MaaUtility.h +++ b/include/MaaFramework/Utility/MaaUtility.h @@ -24,7 +24,8 @@ extern "C" /** * @param[in] value */ - MAA_FRAMEWORK_API MaaBool MaaSetGlobalOption(MaaGlobalOption key, MaaOptionValue value /**< byte array, int*, char*, bool* */, MaaOptionValueSize val_size); + MAA_FRAMEWORK_API MaaBool + MaaSetGlobalOption(MaaGlobalOption key, MaaOptionValue value /**< byte array, int*, char*, bool* */, MaaOptionValueSize val_size); #ifdef __cplusplus } diff --git a/include/MaaToolkit/ProjectInterface/MaaToolkitProjectInterface.h b/include/MaaToolkit/ProjectInterface/MaaToolkitProjectInterface.h index 5ed2b6e5c..0cb8528b7 100644 --- a/include/MaaToolkit/ProjectInterface/MaaToolkitProjectInterface.h +++ b/include/MaaToolkit/ProjectInterface/MaaToolkitProjectInterface.h @@ -9,12 +9,16 @@ extern "C" { #endif + MAA_TOOLKIT_API void MaaToolkitProjectInterfaceRegisterCustomRecognition( + uint64_t inst_id, + const char* name, + MaaCustomRecognitionCallback recognition, + void* trans_arg); MAA_TOOLKIT_API void - MaaToolkitProjectInterfaceRegisterCustomRecognition(uint64_t inst_id, const char* name, MaaCustomRecognitionCallback recognition, void* trans_arg); - MAA_TOOLKIT_API void MaaToolkitProjectInterfaceRegisterCustomAction(uint64_t inst_id, const char* name, MaaCustomActionCallback action, void* trans_arg); + MaaToolkitProjectInterfaceRegisterCustomAction(uint64_t inst_id, const char* name, MaaCustomActionCallback action, void* trans_arg); MAA_TOOLKIT_API MaaBool MaaToolkitProjectInterfaceRunCli( - uint64_t inst_id, + uint64_t inst_id, const char* resource_path, const char* user_path, MaaBool directly, diff --git a/source/MaaFramework/API/MaaController.cpp b/source/MaaFramework/API/MaaController.cpp index fc28f3720..8be98df97 100644 --- a/source/MaaFramework/API/MaaController.cpp +++ b/source/MaaFramework/API/MaaController.cpp @@ -65,8 +65,11 @@ MaaController* MaaWin32ControllerCreate( #endif } -MaaController* - MaaCustomControllerCreate(MaaCustomControllerCallbacks* controller, void* controller_arg, MaaNotificationCallback notify, void* notify_trans_arg) +MaaController* MaaCustomControllerCreate( + MaaCustomControllerCallbacks* controller, + void* controller_arg, + MaaNotificationCallback notify, + void* notify_trans_arg) { LogFunc << VAR(controller) << VAR(controller_arg) << VAR_VOIDP(notify) << VAR_VOIDP(notify_trans_arg); diff --git a/source/MaaFramework/Controller/CustomControllerAgent.cpp b/source/MaaFramework/Controller/CustomControllerAgent.cpp index f1b4ac036..71ab8f85f 100644 --- a/source/MaaFramework/Controller/CustomControllerAgent.cpp +++ b/source/MaaFramework/Controller/CustomControllerAgent.cpp @@ -17,9 +17,10 @@ CustomControllerAgent::CustomControllerAgent( , controller_(controller) , controller_arg_(controller_arg) { - LogDebug << VAR_VOIDP(controller_) << VAR_VOIDP(controller_arg_) << VAR_VOIDP(controller->connect) << VAR_VOIDP(controller->request_uuid) - << VAR_VOIDP(controller->start_app) << VAR_VOIDP(controller->stop_app) << VAR_VOIDP(controller->screencap) << VAR_VOIDP(controller->click) - << VAR_VOIDP(controller->swipe) << VAR_VOIDP(controller->touch_down) << VAR_VOIDP(controller->touch_move) << VAR_VOIDP(controller->touch_up) + LogDebug << VAR_VOIDP(controller_) << VAR_VOIDP(controller_arg_) << VAR_VOIDP(controller->connect) + << VAR_VOIDP(controller->request_uuid) << VAR_VOIDP(controller->start_app) << VAR_VOIDP(controller->stop_app) + << VAR_VOIDP(controller->screencap) << VAR_VOIDP(controller->click) << VAR_VOIDP(controller->swipe) + << VAR_VOIDP(controller->touch_down) << VAR_VOIDP(controller->touch_move) << VAR_VOIDP(controller->touch_up) << VAR_VOIDP(controller->press_key) << VAR_VOIDP(controller->input_text); } diff --git a/source/MaaFramework/Controller/CustomControllerAgent.h b/source/MaaFramework/Controller/CustomControllerAgent.h index c79b13a36..5d49b5a7a 100644 --- a/source/MaaFramework/Controller/CustomControllerAgent.h +++ b/source/MaaFramework/Controller/CustomControllerAgent.h @@ -8,7 +8,11 @@ MAA_CTRL_NS_BEGIN class CustomControllerAgent : public ControllerAgent { public: - CustomControllerAgent(MaaCustomControllerCallbacks* controller, void* controller_arg, MaaNotificationCallback notify, void* notify_trans_arg); + CustomControllerAgent( + MaaCustomControllerCallbacks* controller, + void* controller_arg, + MaaNotificationCallback notify, + void* notify_trans_arg); virtual ~CustomControllerAgent() override = default; protected: diff --git a/source/MaaFramework/Resource/PipelineResMgr.cpp b/source/MaaFramework/Resource/PipelineResMgr.cpp index 6f79b96c3..75734d3c0 100644 --- a/source/MaaFramework/Resource/PipelineResMgr.cpp +++ b/source/MaaFramework/Resource/PipelineResMgr.cpp @@ -1328,7 +1328,7 @@ bool PipelineResMgr::parse_wait_freezes_param( return false; } output.rate_limit = std::chrono::milliseconds(rate_limit); - + auto timeout = default_value.timeout.count(); if (!get_and_check_value(field, "timeout", timeout, timeout)) { LogError << "failed to parse_wait_freezes_param timeout" << VAR(field); diff --git a/source/MaaFramework/Resource/PipelineResMgr.h b/source/MaaFramework/Resource/PipelineResMgr.h index a57e9d762..40958e0fd 100644 --- a/source/MaaFramework/Resource/PipelineResMgr.h +++ b/source/MaaFramework/Resource/PipelineResMgr.h @@ -107,7 +107,7 @@ class PipelineResMgr : public NonCopyable static bool parse_target_offset(const json::value& input_target, Action::Target& output); static bool parse_action_target(const json::value& input, const std::string& key, Action::Target& output, const Action::Target& default_value); - + static bool check_all_next_list(const PipelineDataMap& data_map); private: @@ -117,6 +117,7 @@ class PipelineResMgr : public NonCopyable bool parse_config(const json::value& input, std::set& existing_keys, const DefaultPipelineMgr& default_mg); static bool check_next_list(const PipelineData::NextList& next_list, const PipelineDataMap& data_map); + private: std::vector paths_; PipelineDataMap pipeline_data_map_; diff --git a/source/MaaFramework/Task/Component/CustomAction.cpp b/source/MaaFramework/Task/Component/CustomAction.cpp index fc167315c..d0de028e7 100644 --- a/source/MaaFramework/Task/Component/CustomAction.cpp +++ b/source/MaaFramework/Task/Component/CustomAction.cpp @@ -9,11 +9,11 @@ bool CustomAction::run( std::string task_name, MAA_RES_NS::CustomActionSession session, const MAA_RES_NS::Action::CustomParam& param, - MaaRecoId reco_id, + MaaRecoId reco_id, const cv::Rect& rect) { LogFunc << VAR(context.task_id()) << VAR(task_name) << VAR_VOIDP(session.action) << VAR_VOIDP(session.trans_arg) - << VAR(param.custom_param)<< VAR(reco_id) << VAR(rect) ; + << VAR(param.custom_param) << VAR(reco_id) << VAR(rect); if (!session.action) { LogError << "Action is null" << VAR(task_name) << VAR(param.name); diff --git a/source/MaaFramework/Task/TaskBase.cpp b/source/MaaFramework/Task/TaskBase.cpp index 05aca2586..74217a01c 100644 --- a/source/MaaFramework/Task/TaskBase.cpp +++ b/source/MaaFramework/Task/TaskBase.cpp @@ -156,7 +156,6 @@ NodeDetail TaskBase::run_action(const RecoResult& reco) }; notify(MaaMsg_Task_Action_Starting, cb_detail); } - Actuator actuator(tasker_, *context_); bool ret = actuator.run(*reco.box, reco.reco_id, pipeline_data); diff --git a/source/MaaFramework/Task/TaskBase.h b/source/MaaFramework/Task/TaskBase.h index 407f380f1..35574b4b7 100644 --- a/source/MaaFramework/Task/TaskBase.h +++ b/source/MaaFramework/Task/TaskBase.h @@ -56,7 +56,7 @@ class TaskBase std::string cur_task_; std::shared_ptr context_ = nullptr; - + private: void init(); bool debug_mode() const; diff --git a/source/MaaToolkit/ProjectInterface/ProjectInterfaceMgr.h b/source/MaaToolkit/ProjectInterface/ProjectInterfaceMgr.h index 463f40f8e..a3d4081c4 100644 --- a/source/MaaToolkit/ProjectInterface/ProjectInterfaceMgr.h +++ b/source/MaaToolkit/ProjectInterface/ProjectInterfaceMgr.h @@ -16,8 +16,10 @@ class ProjectInterfaceMgr : public SingletonHolder friend class SingletonHolder; public: - void - register_custom_recognition(uint64_t inst_id, const std::string& name, MAA_PROJECT_INTERFACE_NS::CustomRecognitionSession recognition); + void register_custom_recognition( + uint64_t inst_id, + const std::string& name, + MAA_PROJECT_INTERFACE_NS::CustomRecognitionSession recognition); void register_custom_action(uint64_t inst_id, const std::string& name, MAA_PROJECT_INTERFACE_NS::CustomActionSession action); bool run_cli( diff --git a/source/MaaUtils/Codec/Codec.cpp b/source/MaaUtils/Codec/Codec.cpp index 92cbd5127..5b54f1261 100644 --- a/source/MaaUtils/Codec/Codec.cpp +++ b/source/MaaUtils/Codec/Codec.cpp @@ -28,8 +28,7 @@ static constexpr inline void char32_to_utf8(std::string& out, char32_t ch) } } -static constexpr inline bool - utf8_to_char32(std::string_view::iterator& cur, std::string_view::iterator end, char32_t& ch) +static constexpr inline bool utf8_to_char32(std::string_view::iterator& cur, std::string_view::iterator end, char32_t& ch) { char leading = *cur++; if ((leading & 0b10000000) == 0) { @@ -57,8 +56,7 @@ static constexpr inline bool char next1 = *cur++; char next2 = *cur++; char next3 = *cur++; - ch = ((leading & 0b00001111) << 18) | ((next1 & 0b00111111) << 12) - | ((next2 & 0b00111111) << 6) | (next3 & 0b00111111); + ch = ((leading & 0b00001111) << 18) | ((next1 & 0b00111111) << 12) | ((next2 & 0b00111111) << 6) | (next3 & 0b00111111); } else { // mainly for 0b10xxxxxx, skip corrupted data @@ -84,8 +82,7 @@ static constexpr inline void char32_to_wchar(std::wstring& out, char32_t ch) } } -static constexpr inline bool - wchar_to_char32(std::wstring_view::iterator& cur, std::wstring_view::iterator end, char32_t& ch) +static constexpr inline bool wchar_to_char32(std::wstring_view::iterator& cur, std::wstring_view::iterator end, char32_t& ch) { if constexpr (sizeof(wchar_t) == 2) { auto leading = static_cast(static_cast(*cur++)); @@ -97,9 +94,7 @@ static constexpr inline bool if ((next & 0b1111'1100'0000'0000) != 0xDC00) { return false; } - ch = static_cast( - (((leading & 0b0000'0011'1111'1111) << 10) | (next & 0b0000'0011'1111'1111)) - + 0x10000); + ch = static_cast((((leading & 0b0000'0011'1111'1111) << 10) | (next & 0b0000'0011'1111'1111)) + 0x10000); } else if ((leading & 0b1111'1100'0000'0000) == 0xDC00) { return false; diff --git a/source/include/Utils/JsonExt.hpp b/source/include/Utils/JsonExt.hpp index ccf6e99fe..6cfb60a9e 100644 --- a/source/include/Utils/JsonExt.hpp +++ b/source/include/Utils/JsonExt.hpp @@ -12,7 +12,6 @@ namespace json::ext { - template <> class jsonization { @@ -58,5 +57,4 @@ class jsonization return true; } }; - } // namespace json::ext diff --git a/source/include/Utils/Time.hpp b/source/include/Utils/Time.hpp index d2296dd56..253eff4f4 100644 --- a/source/include/Utils/Time.hpp +++ b/source/include/Utils/Time.hpp @@ -23,8 +23,9 @@ MAA_NS_BEGIN inline std::string format_now() { #ifndef MAA_USE_POSIX_TIME - return std::format("{}", std::chrono::current_zone()->to_local( - std::chrono::floor(std::chrono::system_clock::now()))); + return std::format( + "{}", + std::chrono::current_zone()->to_local(std::chrono::floor(std::chrono::system_clock::now()))); #else timeval tv = {}; gettimeofday(&tv, nullptr); @@ -45,8 +46,7 @@ inline std::string format_now() inline std::string format_now_for_filename() { #ifndef MAA_USE_POSIX_TIME - return std::format("{:%Y.%m.%d-%H.%M.%S}", - std::chrono::current_zone()->to_local(std::chrono::system_clock::now())); + return std::format("{:%Y.%m.%d-%H.%M.%S}", std::chrono::current_zone()->to_local(std::chrono::system_clock::now())); #else timeval tv = {}; gettimeofday(&tv, nullptr); @@ -70,4 +70,4 @@ inline duration_t duration_since(const std::chrono::steady_clock::time_point& st return std::chrono::duration_cast(std::chrono::steady_clock::now() - start_time); } -MAA_NS_END \ No newline at end of file +MAA_NS_END diff --git a/test/pipeline/main.cpp b/test/pipeline/main.cpp index a956c5d99..5d5717796 100644 --- a/test/pipeline/main.cpp +++ b/test/pipeline/main.cpp @@ -14,10 +14,7 @@ int main([[maybe_unused]] int argc, char** argv) } std::string logging_dir = (cur_dir / "debug").string(); - MaaSetGlobalOption( - MaaGlobalOption_LogDir, - static_cast(logging_dir.data()), - logging_dir.size()); + MaaSetGlobalOption(MaaGlobalOption_LogDir, static_cast(logging_dir.data()), logging_dir.size()); bool on = true; MaaSetGlobalOption(MaaGlobalOption_SaveDraw, &on, sizeof(on)); MaaLoggingLevel lv = MaaLoggingLevel_Info; @@ -31,4 +28,4 @@ int main([[maybe_unused]] int argc, char** argv) } return 0; -} \ No newline at end of file +}