Updated to Qt6

This commit is contained in:
Jarrod Norwell 2024-03-26 02:34:27 +08:00
parent b258cf941a
commit 0b88257f43
12 changed files with 99 additions and 24 deletions

View File

@ -291,6 +291,8 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin)
# System imported libraries
# =======================================================================
add_subdirectory(externals)
# Enforce the search mode of non-required packages for better and shorter failure messages
find_package(Boost 1.79.0 REQUIRED context)
find_package(enet 1.3 MODULE)
@ -700,7 +702,6 @@ if (SUDACHI_USE_FASTER_LD AND CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
endif()
endif()
add_subdirectory(externals)
add_subdirectory(src)
# Set sudachi project or sudachi-cmd project as default StartUp Project in Visual Studio depending on whether QT is enabled or not

View File

@ -596,6 +596,8 @@ add_library(core STATIC
hle/service/caps/caps_types.h
hle/service/caps/caps_u.cpp
hle/service/caps/caps_u.h
hle/service/diag/diag.cpp
hle/service/diag/diag.h
hle/service/cmif_serialization.h
hle/service/cmif_types.h
hle/service/erpt/erpt.cpp

View File

@ -0,0 +1,55 @@
#include "common/logging/log.h"
#include "core/core.h"
#include "core/hle/kernel/k_event.h"
#include "core/hle/service/cmif_serialization.h"
#include "core/hle/service/diag/diag.h"
#include "core/hle/service/ipc_helpers.h"
#include "core/hle/service/kernel_helpers.h"
#include "core/hle/service/server_manager.h"
#include "core/hle/service/service.h"
#include "core/hle/service/sm/sm.h"
namespace Service::Diag {
class IDetailDriver final : public ServiceFramework<IDetailDriver> {
public:
explicit IDetailDriver(Core::System& system_) : ServiceFramework{system_, "detail"} {
// clang-format off
static const FunctionInfo functions[] = {
{0, nullptr, "LogImpl"},
{1, nullptr, "AbortImpl"},
{2, nullptr, "AbortImpl1"}
};
// clang-format on
RegisterHandlers(functions);
}
};
class IDiagDriver final : public ServiceFramework<IDiagDriver> {
public:
explicit IDiagDriver(Core::System& system_) : ServiceFramework{system_, "diag"} {
// clang-format off
static const FunctionInfo functions[] = {
{0, nullptr, "GetBacktrace"},
{1, nullptr, "GetBacktrace1"},
{2, nullptr, "GetSymbolName"},
{3, nullptr, "GetRequiredBufferSizeForGetAllModuleInfo"},
{4, nullptr, "GetAllModuleInfo"},
{5, nullptr, "GetSymbolSize"}
};
// clang-format on
RegisterHandlers(functions);
}
};
void LoopProcess(Core::System& system) {
auto server_manager = std::make_unique<ServerManager>(system);
server_manager->RegisterNamedService("diag", std::make_shared<IDiagDriver>(system));
server_manager->RegisterNamedService("detail", std::make_shared<IDetailDriver>(system));
ServerManager::RunServer(std::move(server_manager));
}
} // namespace Service::Diag

View File

@ -0,0 +1,15 @@
#pragma once
namespace Service::SM {
class ServiceManager;
}
namespace Core {
class System;
}
namespace Service::Diag {
void LoopProcess(Core::System& system);
} // namespace Service::Diag

View File

@ -13,6 +13,7 @@
#include "core/hle/service/btdrv/btdrv.h"
#include "core/hle/service/btm/btm.h"
#include "core/hle/service/caps/caps.h"
#include "core/hle/service/diag/diag.h"
#include "core/hle/service/erpt/erpt.h"
#include "core/hle/service/es/es.h"
#include "core/hle/service/eupld/eupld.h"
@ -80,6 +81,7 @@ Services::Services(std::shared_ptr<SM::ServiceManager>& sm, Core::System& system
kernel.RunOnHostCoreProcess("bsdsocket", [&] { Sockets::LoopProcess(system); }).detach();
kernel.RunOnHostCoreProcess("vi", [&, token] { VI::LoopProcess(system, token); }).detach();
kernel.RunOnGuestCoreProcess("diag", [&] { Diag::LoopProcess(system); });
kernel.RunOnGuestCoreProcess("sm", [&] { SM::LoopProcess(system); });
kernel.RunOnGuestCoreProcess("account", [&] { Account::LoopProcess(system); });
kernel.RunOnGuestCoreProcess("am", [&] { AM::LoopProcess(system); });

View File

@ -27,7 +27,7 @@ namespace Service::Set {
namespace {
constexpr u32 SETTINGS_VERSION{4u};
constexpr auto SETTINGS_MAGIC = Common::MakeMagic('y', 'u', 'z', 'u', '_', 's', 'e', 't');
constexpr auto SETTINGS_MAGIC = Common::MakeMagic('s', 'u', 'd', 'a', '_', 's', 'e', 't');
struct SettingsHeader {
u64 magic;
u32 version;

View File

@ -736,19 +736,19 @@ void GRenderWindow::wheelEvent(QWheelEvent* event) {
}
void GRenderWindow::TouchBeginEvent(const QTouchEvent* event) {
QList<QTouchEvent::TouchPoint> touch_points = event->touchPoints();
QList<QTouchEvent::TouchPoint> touch_points = event->points();
for (const auto& touch_point : touch_points) {
const auto [x, y] = ScaleTouch(touch_point.pos());
const auto [x, y] = ScaleTouch(touch_point.position());
const auto [touch_x, touch_y] = MapToTouchScreen(x, y);
input_subsystem->GetTouchScreen()->TouchPressed(touch_x, touch_y, touch_point.id());
}
}
void GRenderWindow::TouchUpdateEvent(const QTouchEvent* event) {
QList<QTouchEvent::TouchPoint> touch_points = event->touchPoints();
QList<QTouchEvent::TouchPoint> touch_points = event->points();
input_subsystem->GetTouchScreen()->ClearActiveFlag();
for (const auto& touch_point : touch_points) {
const auto [x, y] = ScaleTouch(touch_point.pos());
const auto [x, y] = ScaleTouch(touch_point.position());
const auto [touch_x, touch_y] = MapToTouchScreen(x, y);
input_subsystem->GetTouchScreen()->TouchMoved(touch_x, touch_y, touch_point.id());
}

View File

@ -11,9 +11,9 @@
#include "common/settings.h"
#include "core/frontend/framebuffer_layout.h"
#include "input_common/main.h"
#include "ui_configure_touch_from_button.h"
#include "sudachi/configuration/configure_touch_from_button.h"
#include "sudachi/configuration/configure_touch_widget.h"
#include "ui_configure_touch_from_button.h"
static QString GetKeyName(int key_code) {
switch (key_code) {
@ -505,7 +505,7 @@ void TouchScreenPreview::mouseMoveEvent(QMouseEvent* event) {
if (!coord_label) {
return;
}
const auto pos = MapToDeviceCoords(event->x(), event->y());
const auto pos = MapToDeviceCoords(event->position().x(), event->position().y());
if (pos) {
coord_label->setText(QStringLiteral("X: %1, Y: %2").arg(pos->x()).arg(pos->y()));
} else {
@ -523,7 +523,7 @@ void TouchScreenPreview::mousePressEvent(QMouseEvent* event) {
if (event->button() != Qt::MouseButton::LeftButton) {
return;
}
const auto pos = MapToDeviceCoords(event->x(), event->y());
const auto pos = MapToDeviceCoords(event->position().x(), event->position().y());
if (pos) {
emit DotAdded(*pos);
}
@ -539,7 +539,7 @@ bool TouchScreenPreview::eventFilter(QObject* obj, QEvent* event) {
emit DotSelected(obj->property(PropId).toInt());
drag_state.dot = qobject_cast<QLabel*>(obj);
drag_state.start_pos = mouse_event->globalPos();
drag_state.start_pos = mouse_event->globalPosition().toPoint();
return true;
}
case QEvent::Type::MouseMove: {
@ -548,14 +548,13 @@ bool TouchScreenPreview::eventFilter(QObject* obj, QEvent* event) {
}
const auto mouse_event = static_cast<QMouseEvent*>(event);
if (!drag_state.active) {
drag_state.active =
(mouse_event->globalPos() - drag_state.start_pos).manhattanLength() >=
QApplication::startDragDistance();
drag_state.active = (mouse_event->globalPosition().toPoint() - drag_state.start_pos)
.manhattanLength() >= QApplication::startDragDistance();
if (!drag_state.active) {
break;
}
}
auto current_pos = mapFromGlobal(mouse_event->globalPos());
auto current_pos = mapFromGlobal(mouse_event->globalPosition().toPoint());
current_pos.setX(std::clamp(current_pos.x(), contentsMargins().left(),
contentsMargins().left() + contentsRect().width() - 1));
current_pos.setY(std::clamp(current_pos.y(), contentsMargins().top(),

View File

@ -256,8 +256,8 @@ void ConfigureUi::InitializeLanguageComboBox() {
locale.truncate(locale.lastIndexOf(QLatin1Char{'.'}));
locale.remove(0, locale.lastIndexOf(QLatin1Char{'/'}) + 1);
const QString lang = QLocale::languageToString(QLocale(locale).language());
const QString country = QLocale::countryToString(QLocale(locale).country());
ui->language_combobox->addItem(QStringLiteral("%1 (%2)").arg(lang, country), locale);
const QString territory = QLocale::territoryToString(QLocale(locale).territory());
ui->language_combobox->addItem(QStringLiteral("%1 (%2)").arg(lang, territory), locale);
}
// Unlike other configuration changes, interface language changes need to be reflected on the

View File

@ -235,7 +235,8 @@ void GameList::OnTextChanged(const QString& new_text) {
file_path.mid(file_path.lastIndexOf(QLatin1Char{'/'}) + 1) + QLatin1Char{' '} +
file_title;
if (ContainsAllWords(file_name, edit_filter_text) ||
(file_program_id.count() == 16 && file_program_id.contains(edit_filter_text))) {
(file_program_id.length() == 16 &&
file_program_id.contains(edit_filter_text))) {
tree_view->setRowHidden(j, folder_index, false);
++result_count;
} else {

View File

@ -5245,8 +5245,8 @@ static void SetHighDPIAttributes() {
Qt::HighDpiScaleFactorRoundingPolicy::PassThrough);
#endif
QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
QApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
// QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
// QApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
}
int main(int argc, char* argv[]) {

View File

@ -18,7 +18,7 @@
<normaloff>:/img/sudachi.ico</normaloff>:/img/sudachi.ico</iconset>
</property>
<property name="tabShape">
<enum>QTabWidget::Rounded</enum>
<enum>QTabWidget::TabShape::Rounded</enum>
</property>
<property name="dockNestingEnabled">
<bool>true</bool>
@ -45,7 +45,7 @@
<x>0</x>
<y>0</y>
<width>1280</width>
<height>21</height>
<height>38</height>
</rect>
</property>
<widget class="QMenu" name="menu_File">
@ -257,7 +257,7 @@
<string>Con&amp;figure...</string>
</property>
<property name="menuRole">
<enum>QAction::PreferencesRole</enum>
<enum>QAction::MenuRole::PreferencesRole</enum>
</property>
</action>
<action name="action_Display_Dock_Widget_Headers">
@ -422,7 +422,7 @@
<string>&amp;Configure TAS...</string>
</property>
<property name="menuRole">
<enum>QAction::NoRole</enum>
<enum>QAction::MenuRole::NoRole</enum>
</property>
</action>
<action name="action_Configure_Current_Game">
@ -433,7 +433,7 @@
<string>Configure C&amp;urrent Game...</string>
</property>
<property name="menuRole">
<enum>QAction::NoRole</enum>
<enum>QAction::MenuRole::NoRole</enum>
</property>
</action>
<action name="action_TAS_Start">