Skip to content

Commit

Permalink
Add a new game launcher program
Browse files Browse the repository at this point in the history
This is simplistic for now, but I want to expand it for quick offline
testing.
  • Loading branch information
redstrate committed May 18, 2024
1 parent 5fd94fc commit 2720e5f
Show file tree
Hide file tree
Showing 15 changed files with 146 additions and 5 deletions.
4 changes: 2 additions & 2 deletions .reuse/dep5
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ Upstream-Name: Novus
Upstream-Contact: Joshua Goins <[email protected]>
Source: https://git.sr.ht/~redstrate/novus

Files: .gitmodules scripts/* README.md BUILDING.md CONTRIBUTING.md apps/argcracker/README.md apps/armoury/README.md apps/karuku/README.md apps/sagasu/README.md apps/mdlviewer/README.md renderer/README.md apps/launcher/README.md .clang-format .build.yml misc/* renderer/shaders/*.spv apps/mapeditor/README.md .github/* apps/mateditor/README.md
Files: .gitmodules scripts/* README.md BUILDING.md CONTRIBUTING.md apps/argcracker/README.md apps/armoury/README.md apps/gamelauncher/README.md apps/karuku/README.md apps/sagasu/README.md apps/mdlviewer/README.md renderer/README.md apps/sdklauncher/README.md .clang-format .build.yml misc/* renderer/shaders/*.spv apps/mapeditor/README.md .github/* apps/mateditor/README.md
Copyright: Joshua Goins <[email protected]>
License: CC0-1.0

Files: apps/armoury/zone.xiv.armoury.svg apps/karuku/zone.xiv.karaku.svg apps/launcher/zone.xiv.novus.svg apps/mapeditor/zone.xiv.mapeditor.svg apps/mdlviewer/zone.xiv.mdlviewer.svg apps/sagasu/zone.xiv.sagasu.svg resources/*
Files: apps/armoury/zone.xiv.armoury.svg apps/karuku/zone.xiv.karaku.svg apps/sdklauncher/zone.xiv.novus.svg apps/mapeditor/zone.xiv.mapeditor.svg apps/mdlviewer/zone.xiv.mdlviewer.svg apps/sagasu/zone.xiv.sagasu.svg resources/*
Copyright: Joshua Goins <[email protected]>
License: CC-BY-SA-4.0

Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ Here is an exhaustive list of tooling available here:
* [Model Viewer](apps/mdlviewer), a graphical model viewer for MDL files.
* [Data Viewer](apps/sagasu), a graphical interface to explore FFXIV data archive files.
* [Material Editor](apps/mateditor), a program to view material files.
* [Game Launcher](apps/gamelauncher), a program to quickly launch the game for testing.

## Usage

Expand Down
5 changes: 3 additions & 2 deletions apps/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@ add_subdirectory(argcracker)
add_subdirectory(sagasu)
add_subdirectory(mapeditor)
add_subdirectory(mdlviewer)
add_subdirectory(launcher)
add_subdirectory(mateditor)
add_subdirectory(sdklauncher)
add_subdirectory(mateditor)
add_subdirectory(gamelauncher)
31 changes: 31 additions & 0 deletions apps/gamelauncher/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# SPDX-FileCopyrightText: 2024 Joshua Goins <[email protected]>
# SPDX-License-Identifier: CC0-1.0

add_executable(novus-gamelauncher)
target_sources(novus-gamelauncher
PRIVATE
include/mainwindow.h

src/main.cpp
src/mainwindow.cpp)
target_include_directories(novus-gamelauncher
PUBLIC
include)
target_link_libraries(novus-gamelauncher
PRIVATE
Novus::Common
Physis::Physis
Physis::Logger
KF6::I18n
Qt6::Core
Qt6::Widgets)

install(TARGETS novus-gamelauncher ${KF${QT_MAJOR_VERSION}_INSTALL_TARGETS_DEFAULT_ARGS})

if (WIN32)
set_target_properties(novus-gamelauncher PROPERTIES
WIN32_EXECUTABLE TRUE
OUTPUT_NAME "GameLauncher")

install(FILES $<TARGET_RUNTIME_DLLS:novus-gamelauncher> DESTINATION ${CMAKE_INSTALL_BINDIR})
endif()
7 changes: 7 additions & 0 deletions apps/gamelauncher/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Game Launcher

This tool can display and preview game materials.

## Note

Vulkan 1.3 or higher is currently required. This requirement is planned to be lifted in the future.
21 changes: 21 additions & 0 deletions apps/gamelauncher/include/mainwindow.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// SPDX-FileCopyrightText: 2024 Joshua Goins <[email protected]>
// SPDX-License-Identifier: GPL-3.0-or-later

#pragma once

#include <QProcess>

#include "novusmainwindow.h"

struct GameData;

class MainWindow : public NovusMainWindow
{
Q_OBJECT

public:
explicit MainWindow();

private:
QProcess *process = nullptr;
};
35 changes: 35 additions & 0 deletions apps/gamelauncher/src/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// SPDX-FileCopyrightText: 2024 Joshua Goins <[email protected]>
// SPDX-License-Identifier: GPL-3.0-or-later

#include <KLocalizedString>
#include <QApplication>
#include <physis.hpp>
#include <physis_logger.h>

#include "aboutdata.h"
#include "mainwindow.h"
#include "settings.h"

int main(int argc, char *argv[])
{
QApplication app(argc, argv);

KLocalizedString::setApplicationDomain(QByteArrayLiteral("novus"));

customizeAboutData(QStringLiteral("gamelauncher"),
QStringLiteral("zone.xiv.gamelauncher"),
QStringLiteral("Game Launcher"),
i18n("Program to launch the game for debug purposes."));

// Default to a sensible message pattern
if (qEnvironmentVariableIsEmpty("QT_MESSAGE_PATTERN")) {
qputenv("QT_MESSAGE_PATTERN", "[%{time yyyy-MM-dd h:mm:ss.zzz}] %{if-category}[%{category}] %{endif}[%{type}] %{message}");
}

setup_physis_logging();

MainWindow w;
w.show();

return app.exec();
}
43 changes: 43 additions & 0 deletions apps/gamelauncher/src/mainwindow.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
// SPDX-FileCopyrightText: 2024 Joshua Goins <[email protected]>
// SPDX-License-Identifier: GPL-3.0-or-later

#include "mainwindow.h"
#include "settings.h"

#include <KLocalizedString>
#include <QApplication>
#include <QListWidget>
#include <QMenuBar>
#include <QFormLayout>
#include <QPushButton>
#include <QProcess>
#include <QLineEdit>

MainWindow::MainWindow() : NovusMainWindow()
{
setMinimumSize(1280, 720);
setupMenubar();

process = new QProcess();
process->setWorkingDirectory(getGameDirectory());
process->setProgram(QStringLiteral("ffxiv_dx11.exe"));

auto dummyWidget = new QWidget();
setCentralWidget(dummyWidget);

auto layout = new QFormLayout();
dummyWidget->setLayout(layout);

auto argsBox = new QLineEdit();
layout->addRow(i18n("Arguments"), argsBox);

auto launchGameButton = new QPushButton(i18n("Launch Game"));
connect(launchGameButton, &QPushButton::clicked, this, [this, argsBox] {
process->setArguments(argsBox->text().split(QLatin1Char(' ')));
qInfo() << "Launching" << process->program() << process->arguments();
process->start();
});
layout->addWidget(launchGameButton);
}

#include "moc_mainwindow.cpp"
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ file (GENERATE
#define MATEDITOR_EXECUTABLE QStringLiteral(\"$<TARGET_FILE_NAME:novus-mateditor>\")\n\
#define MDLVIEWER_EXECUTABLE QStringLiteral(\"$<TARGET_FILE_NAME:novus-mdlviewer>\")\n\
#define DATAEXPLORER_EXECUTABLE QStringLiteral(\"$<TARGET_FILE_NAME:novus-sagasu>\")\n\
#define GAMELAUNCHER_EXECUTABLE QStringLiteral(\"$<TARGET_FILE_NAME:novus-gamelauncher>\")\n\
"
)

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ static QMap<QString, QPair<QString, QString>> applications = {
{QStringLiteral("Material Editor"), {QStringLiteral("zone.xiv.mateditor"), MATEDITOR_EXECUTABLE}},
{QStringLiteral("Excel Editor"), {QStringLiteral("zone.xiv.karaku"), EXCELEDITOR_EXECUTABLE}},
{QStringLiteral("Data Explorer"), {QStringLiteral("zone.xiv.sagasu"), DATAEXPLORER_EXECUTABLE}},
{QStringLiteral("Model Viewer"), {QStringLiteral("zone.xiv.mdlviewer"), MDLVIEWER_EXECUTABLE}}};
{QStringLiteral("Model Viewer"), {QStringLiteral("zone.xiv.mdlviewer"), MDLVIEWER_EXECUTABLE}},
{QStringLiteral("Game Launcher"), {QStringLiteral("zone.xiv.gamelauncher"), GAMELAUNCHER_EXECUTABLE}}};

static QMap<QString, QString> links = {{QStringLiteral("XIV Dev Wiki"), QStringLiteral("https://xiv.dev")},
{QStringLiteral("XIV Docs"), QStringLiteral("https://docs.xiv.zone")}};
Expand Down
File renamed without changes.
File renamed without changes

0 comments on commit 2720e5f

Please sign in to comment.