MCPcopy Create free account
hub / github.com/MaaXYZ/MaaFramework / parse

Method parse

source/MaaAdbControlUnit/EmulatorExtras/MuMuPlayerExtras.cpp:17–55  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

15}
16
17bool MuMuPlayerExtras::parse(const json::value& config)
18{
19 bool enable = config.get("extras", "mumu", "enable", false);
20 if (!enable) {
21 LogInfo << "extras.mumu.enable is false, ignore";
22 return false;
23 }
24
25 std::string p = config.get("extras", "mumu", "path", "");
26 if (p.empty()) {
27 LogError << "falied to get mumu path from config: extras.mumu.path";
28 return false;
29 }
30 mumu_path_ = MAA_NS::path(p);
31
32 std::string lib = config.get("extras", "mumu", "lib", "");
33 if (lib.empty()) {
34 lib_path_ = mumu_path_ / MAA_NS::path("nx_main/sdk/external_renderer_ipc.dll");
35 if (!std::filesystem::exists(lib_path_)) {
36 lib_path_ = mumu_path_ / MAA_NS::path("shell/sdk/external_renderer_ipc.dll");
37 if (!std::filesystem::exists(lib_path_)) {
38 LogError << "Failed to find mumu library path, please check extras.mumu.lib or extras.mumu.path";
39 return false;
40 }
41 }
42 }
43 else {
44 lib_path_ = MAA_NS::path(lib);
45 }
46
47 mumu_index_ = config.get("extras", "mumu", "index", 0);
48
49 std::string package = config.get("extras", "mumu", "app_package", "");
50 int cloned_index = config.get("extras", "mumu", "app_cloned_index", 0);
51 set_app_package(package, cloned_index);
52
53 LogInfo << VAR(mumu_path_) << VAR(lib_path_) << VAR(mumu_index_);
54 return true;
55}
56
57bool MuMuPlayerExtras::init()
58{

Callers

nothing calls this directly

Calls 2

getMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected