mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-03-12 22:56:52 +01:00
Merge pull request #9596 from Minty-Meeo/apply-moar-RunAsCPUThread
Apply More Core::RunAsCPUThread
This commit is contained in:
commit
c915b780cf
@ -734,26 +734,14 @@ static std::string GenerateScreenshotName()
|
|||||||
|
|
||||||
void SaveScreenShot()
|
void SaveScreenShot()
|
||||||
{
|
{
|
||||||
const bool bPaused = GetState() == State::Paused;
|
Core::RunAsCPUThread([] { g_renderer->SaveScreenshot(GenerateScreenshotName()); });
|
||||||
|
|
||||||
SetState(State::Paused);
|
|
||||||
|
|
||||||
g_renderer->SaveScreenshot(GenerateScreenshotName());
|
|
||||||
|
|
||||||
if (!bPaused)
|
|
||||||
SetState(State::Running);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SaveScreenShot(std::string_view name)
|
void SaveScreenShot(std::string_view name)
|
||||||
{
|
{
|
||||||
const bool bPaused = GetState() == State::Paused;
|
Core::RunAsCPUThread([&name] {
|
||||||
|
g_renderer->SaveScreenshot(fmt::format("{}{}.png", GenerateScreenshotFolderPath(), name));
|
||||||
SetState(State::Paused);
|
});
|
||||||
|
|
||||||
g_renderer->SaveScreenshot(fmt::format("{}{}.png", GenerateScreenshotFolderPath(), name));
|
|
||||||
|
|
||||||
if (!bPaused)
|
|
||||||
SetState(State::Running);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void RequestRefreshInfo()
|
void RequestRefreshInfo()
|
||||||
|
@ -131,26 +131,22 @@ void GetProfileResults(Profiler::ProfileStats* prof_stats)
|
|||||||
prof_stats->timecost_sum = 0;
|
prof_stats->timecost_sum = 0;
|
||||||
prof_stats->block_stats.clear();
|
prof_stats->block_stats.clear();
|
||||||
|
|
||||||
Core::State old_state = Core::GetState();
|
Core::RunAsCPUThread([&prof_stats] {
|
||||||
if (old_state == Core::State::Running)
|
QueryPerformanceFrequency((LARGE_INTEGER*)&prof_stats->countsPerSec);
|
||||||
Core::SetState(Core::State::Paused);
|
g_jit->GetBlockCache()->RunOnBlocks([&prof_stats](const JitBlock& block) {
|
||||||
|
const auto& data = block.profile_data;
|
||||||
|
u64 cost = data.downcountCounter;
|
||||||
|
u64 timecost = data.ticCounter;
|
||||||
|
// Todo: tweak.
|
||||||
|
if (data.runCount >= 1)
|
||||||
|
prof_stats->block_stats.emplace_back(block.effectiveAddress, cost, timecost, data.runCount,
|
||||||
|
block.codeSize);
|
||||||
|
prof_stats->cost_sum += cost;
|
||||||
|
prof_stats->timecost_sum += timecost;
|
||||||
|
});
|
||||||
|
|
||||||
QueryPerformanceFrequency((LARGE_INTEGER*)&prof_stats->countsPerSec);
|
sort(prof_stats->block_stats.begin(), prof_stats->block_stats.end());
|
||||||
g_jit->GetBlockCache()->RunOnBlocks([&prof_stats](const JitBlock& block) {
|
|
||||||
const auto& data = block.profile_data;
|
|
||||||
u64 cost = data.downcountCounter;
|
|
||||||
u64 timecost = data.ticCounter;
|
|
||||||
// Todo: tweak.
|
|
||||||
if (data.runCount >= 1)
|
|
||||||
prof_stats->block_stats.emplace_back(block.effectiveAddress, cost, timecost, data.runCount,
|
|
||||||
block.codeSize);
|
|
||||||
prof_stats->cost_sum += cost;
|
|
||||||
prof_stats->timecost_sum += timecost;
|
|
||||||
});
|
});
|
||||||
|
|
||||||
sort(prof_stats->block_stats.begin(), prof_stats->block_stats.end());
|
|
||||||
if (old_state == Core::State::Running)
|
|
||||||
Core::SetState(Core::State::Running);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int GetHostCode(u32* address, const u8** code, u32* code_size)
|
int GetHostCode(u32* address, const u8** code, u32* code_size)
|
||||||
|
@ -1675,19 +1675,12 @@ void MainWindow::OnStopRecording()
|
|||||||
|
|
||||||
void MainWindow::OnExportRecording()
|
void MainWindow::OnExportRecording()
|
||||||
{
|
{
|
||||||
bool was_paused = Core::GetState() == Core::State::Paused;
|
Core::RunAsCPUThread([this] {
|
||||||
|
QString dtm_file = QFileDialog::getSaveFileName(this, tr("Select the Recording File"),
|
||||||
if (!was_paused)
|
QString(), tr("Dolphin TAS Movies (*.dtm)"));
|
||||||
Core::SetState(Core::State::Paused);
|
if (!dtm_file.isEmpty())
|
||||||
|
Movie::SaveRecording(dtm_file.toStdString());
|
||||||
QString dtm_file = QFileDialog::getSaveFileName(this, tr("Select the Recording File"), QString(),
|
});
|
||||||
tr("Dolphin TAS Movies (*.dtm)"));
|
|
||||||
|
|
||||||
if (!dtm_file.isEmpty())
|
|
||||||
Movie::SaveRecording(dtm_file.toStdString());
|
|
||||||
|
|
||||||
if (!was_paused)
|
|
||||||
Core::SetState(Core::State::Running);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::OnActivateChat()
|
void MainWindow::OnActivateChat()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user