| 15 | } |
| 16 | |
| 17 | bool LDPlayerExtras::parse(const json::value& config) |
| 18 | { |
| 19 | bool enable = config.get("extras", "ld", "enable", false); |
| 20 | if (!enable) { |
| 21 | LogInfo << "extras.ld.enable is false, ignore"; |
| 22 | return false; |
| 23 | } |
| 24 | |
| 25 | std::string lib = config.get("extras", "ld", "lib", ""); |
| 26 | if (lib.empty()) { |
| 27 | std::string p = config.get("extras", "ld", "path", ""); |
| 28 | lib_path_ = MAA_NS::path(p) / MAA_NS::path("ldopengl64"); |
| 29 | } |
| 30 | else { |
| 31 | lib_path_ = MAA_NS::path(lib); |
| 32 | } |
| 33 | |
| 34 | ld_index_ = config.get("extras", "ld", "index", 0); |
| 35 | ld_pid_ = config.get("extras", "ld", "pid", 0); |
| 36 | |
| 37 | bool info_parsed = device_info_->parse(config); |
| 38 | LogInfo << VAR(lib_path_) << VAR(ld_index_) << VAR(ld_pid_) << VAR(info_parsed); |
| 39 | return info_parsed; |
| 40 | } |
| 41 | |
| 42 | bool LDPlayerExtras::init() |
| 43 | { |