Skip to content

Commit

Permalink
chore: 由toolkit config控制log
Browse files Browse the repository at this point in the history
  • Loading branch information
dongwlin committed Nov 8, 2023
1 parent 5de9dcb commit c502363
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 10 deletions.
11 changes: 2 additions & 9 deletions source/cli/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ int main(int argc, char** argv)
print_help();
print_version();

bool debug = false;
std::string adb;
std::string adb_address;
int client_type = 1;
Expand All @@ -22,7 +21,7 @@ int main(int argc, char** argv)
mpause();
return -1;
}
bool proced = proc_argv(argc, argv, debug, adb, adb_address, client_type, tasks, after_task, control_type);
bool proced = proc_argv(argc, argv, adb, adb_address, client_type, tasks, after_task, control_type);
if (!proced) {
std::cout << "Failed to parse argv" << std::endl;
mpause();
Expand Down Expand Up @@ -53,14 +52,10 @@ int main(int argc, char** argv)
}

const auto cur_dir = std::filesystem::path(argv[0]).parent_path();
std::string debug_dir = (cur_dir / "debug").string();
std::string resource_dir = (cur_dir / "resource").string();
std::string adb_config = MaaToolKitGetDeviceAdbConfig(kIndex);
std::string agent_dir = (cur_dir / "MaaAgentBinary").string();

MaaSetGlobalOption(MaaGlobalOption_LogDir, (void*)debug_dir.c_str(), debug_dir.size());
MaaSetGlobalOption(MaaGlobalOption_Recording, (void*)&debug, sizeof(bool));

auto maa_handle = MaaCreate(nullptr, nullptr);
auto resource_handle = MaaResourceCreate(nullptr, nullptr);
auto controller_handle = MaaAdbControllerCreateV2(adb.c_str(), adb_address.c_str(), control_type,
Expand Down Expand Up @@ -290,7 +285,7 @@ json::value end_to_do_param() {
return param;
}

bool proc_argv(int argc, char** argv, bool& debug, std::string& adb, std::string& adb_address, int& client_type,
bool proc_argv(int argc, char** argv, std::string& adb, std::string& adb_address, int& client_type,
TaskList& tasks, AfterTask& after_task, MaaAdbControllerType& ctrl_type)
{
int touch = 3;
Expand All @@ -302,7 +297,6 @@ bool proc_argv(int argc, char** argv, bool& debug, std::string& adb, std::string
if (auto config_opt = json::open("config.json")) {
auto& confing = *config_opt;

debug = confing.get("debug", false);
adb = confing["adb"].as_string();
adb_address = confing["adb_address"].as_string();
client_type = confing["client_type"].as_integer();
Expand Down Expand Up @@ -442,7 +436,6 @@ void save_config(const std::string& adb, const std::string& adb_address, const i
MaaAdbControllerType ctrl_type)
{
json::value config;
config["debug"] = false;
config["adb"] = adb;
config["adb_Doc"] = "adb.exe 所在路径,相对绝对均可";
config["adb_address"] = adb_address;
Expand Down
2 changes: 1 addition & 1 deletion source/cli/main.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ json::value universal_mirage_param();

json::value end_to_do_param();

bool proc_argv(int argc, char** argv, bool& debug, std::string& adb, std::string& adb_address, int& client_type,
bool proc_argv(int argc, char** argv, std::string& adb, std::string& adb_address, int& client_type,
TaskList& tasks, AfterTask& after_task, MaaAdbControllerType& ctrl_type);

bool app_package_and_activity(int client_type, std::string& package, std::string& activity);
Expand Down

0 comments on commit c502363

Please sign in to comment.