Browse Source

it barely works?

Signed-off-by: crueter <crueter@eden-emu.dev>
pull/3016/head
crueter 2 weeks ago
parent
commit
e1b0227f71
No known key found for this signature in database GPG Key ID: 425ACD2D4830EBC6
  1. 2
      src/Eden/Config/GlobalConfigureDialog.qml
  2. 5
      src/Eden/Config/fields/BaseField.qml
  3. 3
      src/Eden/Interface/QMLSetting.cpp
  4. 42
      src/Eden/Interface/RenderWindow.cpp
  5. 2
      src/Eden/Interface/RenderWindow.h
  6. 15
      src/Eden/Main/Main.qml
  7. 14
      src/qt_common/config/qt_config.cpp
  8. 15
      src/qt_common/render/emu_thread.cpp

2
src/Eden/Config/GlobalConfigureDialog.qml

@ -30,7 +30,6 @@ NativeDialog {
function applyConfigs() { function applyConfigs() {
configs.forEach(config => { configs.forEach(config => {
// console.log(config)
config.apply() config.apply()
}) })
@ -39,7 +38,6 @@ NativeDialog {
function syncConfigs() { function syncConfigs() {
configs.forEach(setting => { configs.forEach(setting => {
console.log(setting)
setting.sync() setting.sync()
}) })
} }

5
src/Eden/Config/fields/BaseField.qml

@ -27,17 +27,12 @@ Item {
function apply() { function apply() {
if (setting.value !== value) { if (setting.value !== value) {
console.log("Changing value", setting.value, "of setting",
setting.label, "to", value)
setting.value = value setting.value = value
} }
} }
function sync() { function sync() {
if (value !== setting.value) { if (value !== setting.value) {
// console.log("Syncing setting", setting.label, "from", value, "to",
// setting.value)
value = setting.value value = setting.value
} }
} }

3
src/Eden/Interface/QMLSetting.cpp

@ -145,12 +145,9 @@ QVariant QMLSetting::value() const
} }
void QMLSetting::setValue(const QVariant& newValue) { void QMLSetting::setValue(const QVariant& newValue) {
qDebug() << "changing value" << m_setting->ToString() << "to" << newValue << "for setting"
<< m_setting->GetLabel();
QVariant var = newValue; QVariant var = newValue;
var.convert(QMetaType(m_metaType)); var.convert(QMetaType(m_metaType));
qDebug() << var.toString();
m_setting->LoadString(var.toString().toStdString()); m_setting->LoadString(var.toString().toStdString());
emit valueChanged(); emit valueChanged();

42
src/Eden/Interface/RenderWindow.cpp

@ -24,8 +24,8 @@ private:
}; };
struct VulkanRenderItem : public QQuickItem { struct VulkanRenderItem : public QQuickItem {
explicit VulkanRenderItem(RenderWindow* parent) : QQuickItem(parent) {
window()->setSurfaceType(QWindow::VulkanSurface);
explicit VulkanRenderItem(QQuickItem* parent) : QQuickItem(parent) {
// window()->setSurfaceType(QWindow::VulkanSurface);
} }
}; };
@ -45,11 +45,11 @@ bool RenderWindow::initializeOpenGL() {
// WA_DontShowOnScreen, WA_DeleteOnClose // WA_DontShowOnScreen, WA_DeleteOnClose
auto child = new OpenGLRenderItem(this); auto child = new OpenGLRenderItem(this);
child_item = child; child_item = child;
child_item->window()->create();
auto context = std::make_shared<OpenGLSharedContext>(child->window());
child->window()->create();
auto context = std::make_shared<OpenGLSharedContext>(m_window);
main_context = context; main_context = context;
child->SetContext( child->SetContext(
std::make_unique<OpenGLSharedContext>(context->GetShareContext(), child->window()));
std::make_unique<OpenGLSharedContext>(context->GetShareContext(), m_window));
return true; return true;
#else #else
@ -61,9 +61,9 @@ bool RenderWindow::initializeOpenGL() {
bool RenderWindow::initializeVulkan() { bool RenderWindow::initializeVulkan() {
qDebug() << "initializing Vulkan."; qDebug() << "initializing Vulkan.";
auto child = new VulkanRenderItem(this);
auto child = new VulkanRenderItem(m_parent);
child_item = child; child_item = child;
// child_item->window()->create();
// child->window()->create();
main_context = std::make_unique<DummyContext>(); main_context = std::make_unique<DummyContext>();
return true; return true;
@ -76,8 +76,21 @@ void RenderWindow::initializeNull() {
RenderWindow::RenderWindow(QQuickWindow* window, RenderWindow::RenderWindow(QQuickWindow* window,
std::shared_ptr<InputCommon::InputSubsystem> input_subsystem_) std::shared_ptr<InputCommon::InputSubsystem> input_subsystem_)
: QQuickItem(window->contentItem()), input_subsystem{std::move(input_subsystem_)} {
: QQuickItem(), input_subsystem{std::move(input_subsystem_)}, m_window(window) {
// STUBBED // STUBBED
QQuickItem* renderHost = m_window->findChild<QQuickItem*>("renderHost");
assert(renderHost);
setParentItem(renderHost);
m_parent = renderHost;
setWidth(renderHost->width());
setHeight(renderHost->height());
setX(0);
setY(0);
window->setTitle(QStringLiteral("Eden %1 | %2-%3") window->setTitle(QStringLiteral("Eden %1 | %2-%3")
.arg(QString::fromUtf8(Common::g_build_name), .arg(QString::fromUtf8(Common::g_build_name),
QString::fromUtf8(Common::g_scm_branch), QString::fromUtf8(Common::g_scm_branch),
@ -111,7 +124,7 @@ std::unique_ptr<Core::Frontend::GraphicsContext> RenderWindow::CreateSharedConte
auto c = static_cast<OpenGLSharedContext*>(main_context.get()); auto c = static_cast<OpenGLSharedContext*>(main_context.get());
// Bind the shared contexts to the main surface in case the backend wants to take over // Bind the shared contexts to the main surface in case the backend wants to take over
// presentation // presentation
return std::make_unique<OpenGLSharedContext>(c->GetShareContext(), child_item->window());
return std::make_unique<OpenGLSharedContext>(c->GetShareContext(), m_window);
} }
#endif #endif
return std::make_unique<DummyContext>(); return std::make_unique<DummyContext>();
@ -151,7 +164,7 @@ bool RenderWindow::initRenderTarget() {
} }
// Update the Window System information with the new render target // Update the Window System information with the new render target
window_info = QtCommon::GetWindowSystemInfo(window());
window_info = QtCommon::GetWindowSystemInfo(m_window);
OnMinimalClientAreaChangeRequest(GetActiveConfig().min_client_area_size); OnMinimalClientAreaChangeRequest(GetActiveConfig().min_client_area_size);
onFramebufferSizeChanged(); onFramebufferSizeChanged();
@ -167,7 +180,7 @@ bool RenderWindow::initRenderTarget() {
} }
void RenderWindow::OnMinimalClientAreaChangeRequest(std::pair<u32, u32> minimal_size) { void RenderWindow::OnMinimalClientAreaChangeRequest(std::pair<u32, u32> minimal_size) {
window()->setMinimumSize(QSize(minimal_size.first, minimal_size.second));
m_window->setMinimumSize(QSize(minimal_size.first, minimal_size.second));
} }
bool RenderWindow::loadOpenGL() { bool RenderWindow::loadOpenGL() {
@ -223,8 +236,9 @@ QStringList RenderWindow::getUnsupportedGLExtensions() const {
void RenderWindow::onFramebufferSizeChanged() { void RenderWindow::onFramebufferSizeChanged() {
// Screen changes potentially incur a change in screen DPI, hence we should update the // Screen changes potentially incur a change in screen DPI, hence we should update the
// framebuffer size // framebuffer size
const qreal pixel_ratio = window()->devicePixelRatio();
const u32 width = this->width() * pixel_ratio;
const u32 height = this->height() * pixel_ratio;
qDebug() << width() << height();
const qreal pixel_ratio = m_window->devicePixelRatio();
const u32 width = (this->width()) * pixel_ratio;
const u32 height = (this->height()) * pixel_ratio;
UpdateCurrentFramebufferLayout(width, height); UpdateCurrentFramebufferLayout(width, height);
} }

2
src/Eden/Interface/RenderWindow.h

@ -45,6 +45,8 @@ private:
InputCommon::TasInput::TasState last_tas_state; InputCommon::TasInput::TasState last_tas_state;
QQuickItem* child_item = nullptr; QQuickItem* child_item = nullptr;
QQuickWindow* m_window;
QQuickItem* m_parent;
void initializeNull(); void initializeNull();
bool initializeVulkan(); bool initializeVulkan();

15
src/Eden/Main/Main.qml

@ -304,6 +304,21 @@ ApplicationWindow {
} }
} }
Item {
id: renderHost
objectName: "renderHost"
anchors {
top: parent.top
left: parent.left
right: parent.right
bottom: status.top
}
layer.enabled: true
z: -1
}
StatusBar { StatusBar {
id: status id: status

14
src/qt_common/config/qt_config.cpp

@ -562,23 +562,11 @@ void QtConfig::SaveMultiplayerValues() {
} }
std::vector<Settings::BasicSetting*>& QtConfig::FindRelevantList(Settings::Category category) { std::vector<Settings::BasicSetting*>& QtConfig::FindRelevantList(Settings::Category category) {
qDebug() << "-- Category" << u32(category);
auto log_list = [](auto list, QString label) {
qDebug() << "-- !" << label;
for (auto s : list) {
qDebug() << "-- *" << s->GetLabel();
}
};
auto& list = Settings::values.linkage.by_category[category]; auto& list = Settings::values.linkage.by_category[category];
log_list(list, QStringLiteral("Settings"));
if (!list.empty()) if (!list.empty())
return list; return list;
auto& list2 = UISettings::values.linkage.by_category[category];
log_list(list2, QStringLiteral("UISettings"));
return list2;
return UISettings::values.linkage.by_category[category];
} }
void QtConfig::ReadQtControlPlayerValues(std::size_t player_index) { void QtConfig::ReadQtControlPlayerValues(std::size_t player_index) {

15
src/qt_common/render/emu_thread.cpp

@ -1,3 +1,4 @@
#include <qdebug.h>
#include "core/core.h" #include "core/core.h"
#include "core/cpu_manager.h" #include "core/cpu_manager.h"
#include "emu_thread.h" #include "emu_thread.h"
@ -20,6 +21,7 @@ void EmuThread::run() {
// Main process has been loaded. Make the context current to this thread and begin GPU and CPU // Main process has been loaded. Make the context current to this thread and begin GPU and CPU
// execution. // execution.
qDebug() << "Obtaining Context";
gpu.ObtainContext(); gpu.ObtainContext();
emit LoadProgress(VideoCore::LoadCallbackStage::Prepare, 0, 0); emit LoadProgress(VideoCore::LoadCallbackStage::Prepare, 0, 0);
@ -32,15 +34,26 @@ void EmuThread::run() {
} }
emit LoadProgress(VideoCore::LoadCallbackStage::Complete, 0, 0); emit LoadProgress(VideoCore::LoadCallbackStage::Complete, 0, 0);
qDebug() << "Releaseing Context";
gpu.ReleaseContext(); gpu.ReleaseContext();
qDebug() << "Starting";
gpu.Start(); gpu.Start();
qDebug() << "GPU Ready";
QtCommon::system->GetCpuManager().OnGpuReady(); QtCommon::system->GetCpuManager().OnGpuReady();
qDebug() << "Debugger stuff.";
if (QtCommon::system->DebuggerEnabled()) { if (QtCommon::system->DebuggerEnabled()) {
QtCommon::system->InitializeDebugger(); QtCommon::system->InitializeDebugger();
} }
qDebug() << "Beginning EmuThread";
while (!stop_token.stop_requested()) { while (!stop_token.stop_requested()) {
std::unique_lock lk{m_should_run_mutex}; std::unique_lock lk{m_should_run_mutex};
if (m_should_run) { if (m_should_run) {
@ -58,6 +71,8 @@ void EmuThread::run() {
} }
} }
qDebug() << "Obtaining Context";
// Shutdown the main emulated process // Shutdown the main emulated process
QtCommon::system->DetachDebugger(); QtCommon::system->DetachDebugger();
QtCommon::system->ShutdownMainProcess(); QtCommon::system->ShutdownMainProcess();

Loading…
Cancel
Save