| 257 | } |
| 258 | |
| 259 | static void downloadRemotePatchSucceeded(const char* const filename) |
| 260 | { |
| 261 | d_stdout("downloadRemotePatchSucceeded %s | %s", filename, APP->patch->templatePath.c_str()); |
| 262 | CardinalPluginContext* const context = static_cast<CardinalPluginContext*>(APP); |
| 263 | CardinalBaseUI* const ui = static_cast<CardinalBaseUI*>(context->ui); |
| 264 | |
| 265 | ui->psDialog->overlay->requestDelete(); |
| 266 | ui->psDialog = nullptr; |
| 267 | |
| 268 | if (FILE* f = fopen(filename, "r")) |
| 269 | { |
| 270 | uint8_t buf[8] = {}; |
| 271 | fread(buf, 8, 1, f); |
| 272 | d_stdout("read patch %x %x %x %x %x %x %x %x", |
| 273 | buf[0],buf[1],buf[2],buf[3],buf[4],buf[5],buf[6],buf[7]); |
| 274 | fclose(f); |
| 275 | } |
| 276 | |
| 277 | try { |
| 278 | context->patch->load(filename); |
| 279 | } catch (rack::Exception& e) { |
| 280 | const std::string message = rack::string::f("Could not load patch: %s", e.what()); |
| 281 | asyncDialog::create(message.c_str()); |
| 282 | return; |
| 283 | } |
| 284 | |
| 285 | context->patch->path.clear(); |
| 286 | context->scene->rackScroll->reset(); |
| 287 | context->history->setSaved(); |
| 288 | } |
| 289 | #endif |
| 290 | |
| 291 | // ----------------------------------------------------------------------------------------------------------- |