| 109 | |
| 110 | |
| 111 | void ResourcesLoadingLayer::handleWindows() |
| 112 | { |
| 113 | auto label = Label::create(); |
| 114 | label->setString("Geometry Dash Resources not found!\n Waiting for GeometryDash.exe"); |
| 115 | label->setSystemFontSize(20); |
| 116 | label->setPosition(_posMiddle); |
| 117 | addChild(label); |
| 118 | |
| 119 | _gdProcessAction = RepeatForever::create(Sequence::create(DelayTime::create(0.6), CallFunc::create([=]() { |
| 120 | static int nPoints = -1; |
| 121 | ++nPoints; |
| 122 | if (nPoints > 3) |
| 123 | nPoints = 0; |
| 124 | |
| 125 | label->setString(fmt::format("Geometry Dash Resources not found!\n Waiting for GeometryDash.exe{}", nPoints == 1 ? "." : nPoints == 2 ? ".." : nPoints == 3 ? "..." : "")); |
| 126 | |
| 127 | if (std::string exepath = ResourcesLoadingLayer::getRunningGDPathWindows(); !exepath.empty()) |
| 128 | { |
| 129 | if (isWindowsGDPathValid(exepath)) |
| 130 | { |
| 131 | exepath.erase(exepath.find_last_of('\\')); |
| 132 | std::string resourcesPath = fmt::format("{}\\Resources", exepath); |
| 133 | _fu->addSearchPath(resourcesPath, true); |
| 134 | _fu->addSearchPath(resourcesPath + "\\icons", true); |
| 135 | _gm->set<std::string>("resources_path", resourcesPath); |
| 136 | _gm->save(); |
| 137 | loadLoadingLayer(); |
| 138 | } |
| 139 | else |
| 140 | { |
| 141 | label->setString("Invalid GeometryDash.exe path found..."); |
| 142 | nPoints = 0; |
| 143 | } |
| 144 | } |
| 145 | }), nullptr)); |
| 146 | |
| 147 | this->runAction(_gdProcessAction); |
| 148 | } |
| 149 | |
| 150 | bool ResourcesLoadingLayer::isWindowsGDPathValid(std::string exepath) |
| 151 | { |
nothing calls this directly
no test coverage detected