| 778 | } |
| 779 | |
| 780 | void MainWindow::OnInjectTrigger(uint32_t PID, const rdcarray<EnvironmentModification> &env, |
| 781 | const QString &name, CaptureOptions opts, |
| 782 | std::function<void(LiveCapture *)> callback) |
| 783 | { |
| 784 | if(!PromptCloseCapture()) |
| 785 | return; |
| 786 | |
| 787 | LambdaThread *th = new LambdaThread([this, PID, env, name, opts, callback]() { |
| 788 | QString capturefile = m_Ctx.TempCaptureFilename(name); |
| 789 | |
| 790 | ExecuteResult ret = RENDERDOC_InjectIntoProcess(PID, env, capturefile, opts, false); |
| 791 | |
| 792 | GUIInvoke::call(this, [this, PID, ret, callback]() { |
| 793 | if(ret.result.code != ResultCode::Succeeded) |
| 794 | { |
| 795 | RDDialog::critical( |
| 796 | this, tr("Error injecting into process"), |
| 797 | tr("Error injecting into process %1 for capture.\n\n%2").arg(PID).arg(ret.result.Message())); |
| 798 | return; |
| 799 | } |
| 800 | |
| 801 | LiveCapture *live = new LiveCapture(m_Ctx, QString(), QString(), ret.ident, this, this); |
| 802 | ShowLiveCapture(live); |
| 803 | callback(live); |
| 804 | }); |
| 805 | }); |
| 806 | th->start(); |
| 807 | // wait a few ms before popping up a progress bar |
| 808 | th->wait(500); |
| 809 | if(th->isRunning()) |
| 810 | { |
| 811 | ShowProgressDialog(this, tr("Injecting into %1, please wait...").arg(PID), |
| 812 | [th]() { return !th->isRunning(); }); |
| 813 | } |
| 814 | th->deleteLater(); |
| 815 | } |
| 816 | |
| 817 | void MainWindow::LoadCapture(const QString &filename, const ReplayOptions &opts, bool temporary, |
| 818 | bool local) |
no test coverage detected