diff options
Diffstat (limited to 'src/citra_qt')
-rw-r--r-- | src/citra_qt/CMakeLists.txt | 6 | ||||
-rw-r--r-- | src/citra_qt/Info.plist | 40 | ||||
-rw-r--r-- | src/citra_qt/bootmanager.cpp | 31 | ||||
-rw-r--r-- | src/citra_qt/bootmanager.h | 2 | ||||
-rw-r--r-- | src/citra_qt/debugger/graphics_vertex_shader.cpp | 8 | ||||
-rw-r--r-- | src/citra_qt/game_list.cpp | 2 | ||||
-rw-r--r-- | src/citra_qt/main.cpp | 19 |
7 files changed, 85 insertions, 23 deletions
diff --git a/src/citra_qt/CMakeLists.txt b/src/citra_qt/CMakeLists.txt index 51a574629..bbf6ae001 100644 --- a/src/citra_qt/CMakeLists.txt +++ b/src/citra_qt/CMakeLists.txt @@ -24,6 +24,7 @@ set(SRCS hotkeys.cpp main.cpp citra-qt.rc + Info.plist ) set(HEADERS @@ -71,7 +72,10 @@ else() endif() if (APPLE) - add_executable(citra-qt MACOSX_BUNDLE ${SRCS} ${HEADERS} ${UI_HDRS}) + set(MACOSX_ICON "../../dist/citra.icns") + set_source_files_properties(${MACOSX_ICON} PROPERTIES MACOSX_PACKAGE_LOCATION Resources) + add_executable(citra-qt MACOSX_BUNDLE ${SRCS} ${HEADERS} ${UI_HDRS} ${MACOSX_ICON}) + set_target_properties(citra-qt PROPERTIES MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/Info.plist) else() add_executable(citra-qt ${SRCS} ${HEADERS} ${UI_HDRS}) endif() diff --git a/src/citra_qt/Info.plist b/src/citra_qt/Info.plist new file mode 100644 index 000000000..4c89e128b --- /dev/null +++ b/src/citra_qt/Info.plist @@ -0,0 +1,40 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>CFBundleDevelopmentRegion</key> + <string>English</string> + <key>CFBundleExecutable</key> + <string>$(EXECUTABLE_NAME)</string> + <key>CFBundleGetInfoString</key> + <string></string> + <key>CFBundleIconFile</key> + <string>citra.icns</string> + <key>CFBundleIdentifier</key> + <string>com.citra-emu.citra</string> + <key>CFBundleInfoDictionaryVersion</key> + <string>6.0</string> + <key>CFBundleLongVersionString</key> + <string></string> + <key>CFBundleName</key> + <string>Citra</string> + <key>CFBundlePackageType</key> + <string>APPL</string> + <key>CFBundleShortVersionString</key> + <string></string> + <key>CFBundleSignature</key> + <string>????</string> + <key>CFBundleVersion</key> + <string></string> + <key>CSResourcesFileMapped</key> + <true/> + <key>LSRequiresCarbon</key> + <true/> + <key>NSHumanReadableCopyright</key> + <string></string> + <key>NSPrincipalClass</key> + <string>NSApplication</string> + <key>NSHighResolutionCapable</key> + <string>True</string> +</dict> +</plist> diff --git a/src/citra_qt/bootmanager.cpp b/src/citra_qt/bootmanager.cpp index b19b367e1..8e60b9cad 100644 --- a/src/citra_qt/bootmanager.cpp +++ b/src/citra_qt/bootmanager.cpp @@ -181,16 +181,9 @@ void GRenderWindow::PollEvents() { void GRenderWindow::OnFramebufferSizeChanged() { // Screen changes potentially incur a change in screen DPI, hence we should update the framebuffer size -#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) - // windowHandle() might not be accessible until the window is displayed to screen. - auto pixel_ratio = windowHandle() ? (windowHandle()->screen()->devicePixelRatio()) : 1.0; - - unsigned width = child->QPaintDevice::width() * pixel_ratio; - unsigned height = child->QPaintDevice::height() * pixel_ratio; -#else - unsigned width = child->QPaintDevice::width(); - unsigned height = child->QPaintDevice::height(); -#endif + qreal pixelRatio = windowPixelRatio(); + unsigned width = child->QPaintDevice::width() * pixelRatio; + unsigned height = child->QPaintDevice::height() * pixelRatio; NotifyFramebufferLayoutChanged(EmuWindow::FramebufferLayout::DefaultScreenLayout(width, height)); } @@ -223,6 +216,16 @@ QByteArray GRenderWindow::saveGeometry() return geometry; } +qreal GRenderWindow::windowPixelRatio() +{ +#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) + // windowHandle() might not be accessible until the window is displayed to screen. + return windowHandle() ? windowHandle()->screen()->devicePixelRatio() : 1.0f; +#else + return 1.0f; +#endif +} + void GRenderWindow::closeEvent(QCloseEvent* event) { emit Closed(); QWidget::closeEvent(event); @@ -243,14 +246,18 @@ void GRenderWindow::mousePressEvent(QMouseEvent *event) if (event->button() == Qt::LeftButton) { auto pos = event->pos(); - this->TouchPressed(static_cast<unsigned>(pos.x()), static_cast<unsigned>(pos.y())); + qreal pixelRatio = windowPixelRatio(); + this->TouchPressed(static_cast<unsigned>(pos.x() * pixelRatio), + static_cast<unsigned>(pos.y() * pixelRatio)); } } void GRenderWindow::mouseMoveEvent(QMouseEvent *event) { auto pos = event->pos(); - this->TouchMoved(static_cast<unsigned>(std::max(pos.x(), 0)), static_cast<unsigned>(std::max(pos.y(), 0))); + qreal pixelRatio = windowPixelRatio(); + this->TouchMoved(std::max(static_cast<unsigned>(pos.x() * pixelRatio), 0u), + std::max(static_cast<unsigned>(pos.y() * pixelRatio), 0u)); } void GRenderWindow::mouseReleaseEvent(QMouseEvent *event) diff --git a/src/citra_qt/bootmanager.h b/src/citra_qt/bootmanager.h index 0a9d263b8..0dcf3e5eb 100644 --- a/src/citra_qt/bootmanager.h +++ b/src/citra_qt/bootmanager.h @@ -111,6 +111,8 @@ public: void restoreGeometry(const QByteArray& geometry); // overridden QByteArray saveGeometry(); // overridden + qreal windowPixelRatio(); + void closeEvent(QCloseEvent* event) override; void keyPressEvent(QKeyEvent* event) override; diff --git a/src/citra_qt/debugger/graphics_vertex_shader.cpp b/src/citra_qt/debugger/graphics_vertex_shader.cpp index f915d2bab..a5a5fe6b0 100644 --- a/src/citra_qt/debugger/graphics_vertex_shader.cpp +++ b/src/citra_qt/debugger/graphics_vertex_shader.cpp @@ -294,16 +294,16 @@ QVariant GraphicsVertexShaderModel::data(const QModelIndex& index, int role) con { // Highlight current instruction int current_record_index = par->cycle_index->value(); - if (current_record_index < par->debug_data.records.size()) { + if (current_record_index < static_cast<int>(par->debug_data.records.size())) { const auto& current_record = par->debug_data.records[current_record_index]; - if (index.row() == current_record.instruction_offset) { + if (index.row() == static_cast<int>(current_record.instruction_offset)) { return QColor(255, 255, 63); } } // Use a grey background for instructions which have no debug data associated to them for (const auto& record : par->debug_data.records) - if (index.row() == record.instruction_offset) + if (index.row() == static_cast<int>(record.instruction_offset)) return QVariant(); return QBrush(QColor(192, 192, 192)); @@ -494,7 +494,7 @@ void GraphicsVertexShaderWidget::Reload(bool replace_vertex_data, void* vertex_d debug_data = Pica::Shader::ProduceDebugInfo(input_vertex, num_attributes, shader_config, shader_setup); // Reload widget state - for (unsigned int attr = 0; attr < num_attributes; ++attr) { + for (int attr = 0; attr < num_attributes; ++attr) { unsigned source_attr = shader_config.input_register_map.GetRegisterForAttribute(attr); input_data_mapping[source_attr]->setText(QString("-> v%1").arg(attr)); input_data_container[source_attr]->setVisible(true); diff --git a/src/citra_qt/game_list.cpp b/src/citra_qt/game_list.cpp index dade3c212..e925f08a7 100644 --- a/src/citra_qt/game_list.cpp +++ b/src/citra_qt/game_list.cpp @@ -80,7 +80,7 @@ void GameList::DonePopulating() void GameList::PopulateAsync(const QString& dir_path, bool deep_scan) { if (!FileUtil::Exists(dir_path.toStdString()) || !FileUtil::IsDirectory(dir_path.toStdString())) { - LOG_ERROR(Frontend, "Could not find game list folder at %s", dir_path.toLatin1().data()); + LOG_ERROR(Frontend, "Could not find game list folder at %s", dir_path.toLocal8Bit().data()); return; } diff --git a/src/citra_qt/main.cpp b/src/citra_qt/main.cpp index e5ed01a11..d6c27f0df 100644 --- a/src/citra_qt/main.cpp +++ b/src/citra_qt/main.cpp @@ -247,7 +247,7 @@ void GMainWindow::OnDisplayTitleBars(bool show) } void GMainWindow::BootGame(const std::string& filename) { - LOG_INFO(Frontend, "Citra starting...\n"); + LOG_INFO(Frontend, "Citra starting..."); // Shutdown previous session if the emu thread is still active... if (emu_thread != nullptr) @@ -362,7 +362,7 @@ void GMainWindow::UpdateRecentFiles() { } void GMainWindow::OnGameListLoadFile(QString game_path) { - BootGame(game_path.toLatin1().data()); + BootGame(game_path.toLocal8Bit().data()); } void GMainWindow::OnMenuLoadFile() { @@ -374,7 +374,7 @@ void GMainWindow::OnMenuLoadFile() { settings.setValue("romsPath", QFileInfo(filename).path()); StoreRecentFile(filename); - BootGame(filename.toLatin1().data()); + BootGame(filename.toLocal8Bit().data()); } } @@ -386,7 +386,7 @@ void GMainWindow::OnMenuLoadSymbolMap() { if (!filename.isEmpty()) { settings.setValue("symbolsPath", QFileInfo(filename).path()); - LoadSymbolMap(filename.toLatin1().data()); + LoadSymbolMap(filename.toLocal8Bit().data()); } } @@ -407,7 +407,7 @@ void GMainWindow::OnMenuRecentFile() { QString filename = action->data().toString(); QFileInfo file_info(filename); if (file_info.exists()) { - BootGame(filename.toLatin1().data()); + BootGame(filename.toLocal8Bit().data()); StoreRecentFile(filename); // Put the filename on top of the list } else { // Display an error message and remove the file from the list. @@ -450,6 +450,10 @@ void GMainWindow::OnOpenHotkeysDialog() { void GMainWindow::SetHardwareRendererEnabled(bool enabled) { VideoCore::g_hw_renderer_enabled = enabled; + + Config config; + Settings::values.use_hw_renderer = enabled; + config.Save(); } void GMainWindow::SetGdbstubEnabled(bool enabled) { @@ -458,6 +462,10 @@ void GMainWindow::SetGdbstubEnabled(bool enabled) { void GMainWindow::SetShaderJITEnabled(bool enabled) { VideoCore::g_shader_jit_enabled = enabled; + + Config config; + Settings::values.use_shader_jit = enabled; + config.Save(); } void GMainWindow::ToggleWindowMode() { @@ -469,6 +477,7 @@ void GMainWindow::ToggleWindowMode() { if (emulation_running) { render_window->setVisible(true); render_window->setFocus(); + game_list->hide(); } } else { |