comment out bunch of qt things

This commit is contained in:
SimoZ64
2025-04-16 15:20:12 +02:00
parent a27ccf87d8
commit 0cb479dda8
13 changed files with 125 additions and 226 deletions

View File

@@ -1,53 +1,56 @@
#include <Core.hpp>
#include <EmuThread.hpp>
EmuThread::EmuThread(const std::shared_ptr<n64::Core> &core, QLabel &fps, RenderWidget &renderWidget,
EmuThread::EmuThread(const std::shared_ptr<n64::Core> &core, std::string &fps, RenderWidget &renderWidget,
SettingsWindow &settings) noexcept :
renderWidget(renderWidget), core(core), settings(settings), fps(fps) {}
void EmuThread::run() noexcept {
core->parallel.Init(renderWidget.qtVkInstanceFactory, renderWidget.wsiPlatform, renderWidget.windowInfo,
core->cpu->GetMem().GetRDRAMPtr());
auto lastSample = std::chrono::high_resolution_clock::now();
auto avgFps = 16.667;
auto sampledFps = 0;
static bool oneSecondPassed = false;
fps.setText(fmt::format("{:.2f} FPS", 1000.0 / avgFps).c_str());
while (!isInterruptionRequested()) {
const auto startFrameTime = std::chrono::high_resolution_clock::now();
if (!core->pause) {
core->Run(settings.getVolumeL(), settings.getVolumeR());
}
if (core->render) {
core->parallel.UpdateScreen(core->cpu->GetMem().mmio.vi);
}
const auto endFrameTime = std::chrono::high_resolution_clock::now();
using namespace std::chrono_literals;
const auto frameTimeMs = std::chrono::duration<double>(endFrameTime - startFrameTime) / 1ms;
avgFps += frameTimeMs;
sampledFps++;
if (const auto elapsedSinceLastSample = std::chrono::duration<double>(endFrameTime - lastSample) / 1s;
elapsedSinceLastSample >= 1.0) {
if (!oneSecondPassed) {
oneSecondPassed = true;
continue;
void EmuThread::start() noexcept {
thread = std::thread([this]() {
isRunning = true;
core->parallel.Init(renderWidget.imGuiVkInstanceFactory, renderWidget.wsiPlatform, renderWidget.windowInfo,
core->cpu->GetMem().GetRDRAMPtr());
auto lastSample = std::chrono::high_resolution_clock::now();
auto avgFps = 16.667;
auto sampledFps = 0;
static bool oneSecondPassed = false;
fps = fmt::format("{:.2f} FPS", 1000.0 / avgFps);
while (!interruptionRequested) {
const auto startFrameTime = std::chrono::high_resolution_clock::now();
if (!core->pause) {
core->Run(settings.getVolumeL(), settings.getVolumeR());
}
if (core->render) {
core->parallel.UpdateScreen(core->cpu->GetMem().mmio.vi);
}
const auto endFrameTime = std::chrono::high_resolution_clock::now();
using namespace std::chrono_literals;
const auto frameTimeMs = std::chrono::duration<double>(endFrameTime - startFrameTime) / 1ms;
avgFps += frameTimeMs;
sampledFps++;
if (const auto elapsedSinceLastSample = std::chrono::duration<double>(endFrameTime - lastSample) / 1s;
elapsedSinceLastSample >= 1.0) {
if (!oneSecondPassed) {
oneSecondPassed = true;
continue;
}
lastSample = endFrameTime;
avgFps /= sampledFps;
sampledFps = 0;
fps = fmt::format("{:.2f} FPS", 1000.0 / avgFps);
}
lastSample = endFrameTime;
avgFps /= sampledFps;
sampledFps = 0;
fps.setText(fmt::format("{:.2f} FPS", 1000.0 / avgFps).c_str());
}
}
SetRender(false);
Stop();
SetRender(false);
Stop();
isRunning = false;
});
}
void EmuThread::TogglePause() const noexcept {