| 210 | } |
| 211 | |
| 212 | void ScriptScreen::update(touchPosition* touch) |
| 213 | { |
| 214 | hid.update(currFiles.size()); |
| 215 | u32 down = hidKeysDown(); |
| 216 | if (down & KEY_B) |
| 217 | { |
| 218 | if (currDirString == (sdSearch ? "/3ds/PKSM" : "romfs:") + |
| 219 | (cScripts ? std::string("/scripts/universal") |
| 220 | : getScriptDir(TitleLoader::save->version()))) |
| 221 | { |
| 222 | Gui::screenBack(); |
| 223 | return; |
| 224 | } |
| 225 | else |
| 226 | { |
| 227 | currDirString = currDirString.substr(0, currDirString.find_last_of('/')); |
| 228 | currDir = STDirectory(currDirString); |
| 229 | updateEntries(); |
| 230 | } |
| 231 | } |
| 232 | else if (down & KEY_A) |
| 233 | { |
| 234 | if (currDir.good() && currDir.count() > 0) |
| 235 | { |
| 236 | if (currFiles[hid.fullIndex()].second) |
| 237 | { |
| 238 | currDirString += '/' + currFiles[hid.fullIndex()].first; |
| 239 | currDir = STDirectory(currDirString); |
| 240 | updateEntries(); |
| 241 | } |
| 242 | else |
| 243 | { |
| 244 | if (Gui::showChoiceMessage(i18n::localize("SCRIPTS_CONFIRM_USE") + "\n" + |
| 245 | ('\'' + currFiles[hid.fullIndex()].first + '\''))) |
| 246 | { |
| 247 | applyScript(); |
| 248 | } |
| 249 | } |
| 250 | } |
| 251 | } |
| 252 | else if (down & KEY_X) |
| 253 | { |
| 254 | std::string dirString = (!sdSearch ? "/3ds/PKSM" : "romfs:") + |
| 255 | (cScripts ? std::string("/scripts/universal") |
| 256 | : getScriptDir(TitleLoader::save->version())); |
| 257 | STDirectory dir = STDirectory(dirString); |
| 258 | if (dir.good()) |
| 259 | { |
| 260 | sdSearch = !sdSearch; |
| 261 | currDirString = dirString; |
| 262 | currDir = dir; |
| 263 | updateEntries(); |
| 264 | } |
| 265 | else |
| 266 | { |
| 267 | Gui::warn(("\"" + dirString + "\"") + '\n' + i18n::localize("SCRIPTS_NOT_FOUND")); |
| 268 | } |
| 269 | } |
nothing calls this directly
no test coverage detected