Skip to content

Commit 2720e5f

Browse files
committed
Add a new game launcher program
This is simplistic for now, but I want to expand it for quick offline testing.
1 parent 5fd94fc commit 2720e5f

File tree

15 files changed

+146
-5
lines changed

15 files changed

+146
-5
lines changed

.reuse/dep5

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ Upstream-Name: Novus
33
Upstream-Contact: Joshua Goins <josh@redstrate.com>
44
Source: https://git.sr.ht/~redstrate/novus
55

6-
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
6+
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
77
Copyright: Joshua Goins <josh@redstrate.com>
88
License: CC0-1.0
99

10-
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/*
10+
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/*
1111
Copyright: Joshua Goins <josh@redstrate.com>
1212
License: CC-BY-SA-4.0
1313

README.md

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

1920
## Usage
2021

apps/CMakeLists.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,6 @@ add_subdirectory(argcracker)
77
add_subdirectory(sagasu)
88
add_subdirectory(mapeditor)
99
add_subdirectory(mdlviewer)
10-
add_subdirectory(launcher)
11-
add_subdirectory(mateditor)
10+
add_subdirectory(sdklauncher)
11+
add_subdirectory(mateditor)
12+
add_subdirectory(gamelauncher)

apps/gamelauncher/CMakeLists.txt

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# SPDX-FileCopyrightText: 2024 Joshua Goins <josh@redstrate.com>
2+
# SPDX-License-Identifier: CC0-1.0
3+
4+
add_executable(novus-gamelauncher)
5+
target_sources(novus-gamelauncher
6+
PRIVATE
7+
include/mainwindow.h
8+
9+
src/main.cpp
10+
src/mainwindow.cpp)
11+
target_include_directories(novus-gamelauncher
12+
PUBLIC
13+
include)
14+
target_link_libraries(novus-gamelauncher
15+
PRIVATE
16+
Novus::Common
17+
Physis::Physis
18+
Physis::Logger
19+
KF6::I18n
20+
Qt6::Core
21+
Qt6::Widgets)
22+
23+
install(TARGETS novus-gamelauncher ${KF${QT_MAJOR_VERSION}_INSTALL_TARGETS_DEFAULT_ARGS})
24+
25+
if (WIN32)
26+
set_target_properties(novus-gamelauncher PROPERTIES
27+
WIN32_EXECUTABLE TRUE
28+
OUTPUT_NAME "GameLauncher")
29+
30+
install(FILES $<TARGET_RUNTIME_DLLS:novus-gamelauncher> DESTINATION ${CMAKE_INSTALL_BINDIR})
31+
endif()

apps/gamelauncher/README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Game Launcher
2+
3+
This tool can display and preview game materials.
4+
5+
## Note
6+
7+
Vulkan 1.3 or higher is currently required. This requirement is planned to be lifted in the future.
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// SPDX-FileCopyrightText: 2024 Joshua Goins <josh@redstrate.com>
2+
// SPDX-License-Identifier: GPL-3.0-or-later
3+
4+
#pragma once
5+
6+
#include <QProcess>
7+
8+
#include "novusmainwindow.h"
9+
10+
struct GameData;
11+
12+
class MainWindow : public NovusMainWindow
13+
{
14+
Q_OBJECT
15+
16+
public:
17+
explicit MainWindow();
18+
19+
private:
20+
QProcess *process = nullptr;
21+
};

apps/gamelauncher/src/main.cpp

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
// SPDX-FileCopyrightText: 2024 Joshua Goins <josh@redstrate.com>
2+
// SPDX-License-Identifier: GPL-3.0-or-later
3+
4+
#include <KLocalizedString>
5+
#include <QApplication>
6+
#include <physis.hpp>
7+
#include <physis_logger.h>
8+
9+
#include "aboutdata.h"
10+
#include "mainwindow.h"
11+
#include "settings.h"
12+
13+
int main(int argc, char *argv[])
14+
{
15+
QApplication app(argc, argv);
16+
17+
KLocalizedString::setApplicationDomain(QByteArrayLiteral("novus"));
18+
19+
customizeAboutData(QStringLiteral("gamelauncher"),
20+
QStringLiteral("zone.xiv.gamelauncher"),
21+
QStringLiteral("Game Launcher"),
22+
i18n("Program to launch the game for debug purposes."));
23+
24+
// Default to a sensible message pattern
25+
if (qEnvironmentVariableIsEmpty("QT_MESSAGE_PATTERN")) {
26+
qputenv("QT_MESSAGE_PATTERN", "[%{time yyyy-MM-dd h:mm:ss.zzz}] %{if-category}[%{category}] %{endif}[%{type}] %{message}");
27+
}
28+
29+
setup_physis_logging();
30+
31+
MainWindow w;
32+
w.show();
33+
34+
return app.exec();
35+
}

apps/gamelauncher/src/mainwindow.cpp

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
// SPDX-FileCopyrightText: 2024 Joshua Goins <josh@redstrate.com>
2+
// SPDX-License-Identifier: GPL-3.0-or-later
3+
4+
#include "mainwindow.h"
5+
#include "settings.h"
6+
7+
#include <KLocalizedString>
8+
#include <QApplication>
9+
#include <QListWidget>
10+
#include <QMenuBar>
11+
#include <QFormLayout>
12+
#include <QPushButton>
13+
#include <QProcess>
14+
#include <QLineEdit>
15+
16+
MainWindow::MainWindow() : NovusMainWindow()
17+
{
18+
setMinimumSize(1280, 720);
19+
setupMenubar();
20+
21+
process = new QProcess();
22+
process->setWorkingDirectory(getGameDirectory());
23+
process->setProgram(QStringLiteral("ffxiv_dx11.exe"));
24+
25+
auto dummyWidget = new QWidget();
26+
setCentralWidget(dummyWidget);
27+
28+
auto layout = new QFormLayout();
29+
dummyWidget->setLayout(layout);
30+
31+
auto argsBox = new QLineEdit();
32+
layout->addRow(i18n("Arguments"), argsBox);
33+
34+
auto launchGameButton = new QPushButton(i18n("Launch Game"));
35+
connect(launchGameButton, &QPushButton::clicked, this, [this, argsBox] {
36+
process->setArguments(argsBox->text().split(QLatin1Char(' ')));
37+
qInfo() << "Launching" << process->program() << process->arguments();
38+
process->start();
39+
});
40+
layout->addWidget(launchGameButton);
41+
}
42+
43+
#include "moc_mainwindow.cpp"

apps/launcher/CMakeLists.txt renamed to apps/sdklauncher/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ file (GENERATE
1313
#define MATEDITOR_EXECUTABLE QStringLiteral(\"$<TARGET_FILE_NAME:novus-mateditor>\")\n\
1414
#define MDLVIEWER_EXECUTABLE QStringLiteral(\"$<TARGET_FILE_NAME:novus-mdlviewer>\")\n\
1515
#define DATAEXPLORER_EXECUTABLE QStringLiteral(\"$<TARGET_FILE_NAME:novus-sagasu>\")\n\
16+
#define GAMELAUNCHER_EXECUTABLE QStringLiteral(\"$<TARGET_FILE_NAME:novus-gamelauncher>\")\n\
1617
"
1718
)
1819

File renamed without changes.
File renamed without changes.

apps/launcher/src/mainwindow.cpp renamed to apps/sdklauncher/src/mainwindow.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ static QMap<QString, QPair<QString, QString>> applications = {
2323
{QStringLiteral("Material Editor"), {QStringLiteral("zone.xiv.mateditor"), MATEDITOR_EXECUTABLE}},
2424
{QStringLiteral("Excel Editor"), {QStringLiteral("zone.xiv.karaku"), EXCELEDITOR_EXECUTABLE}},
2525
{QStringLiteral("Data Explorer"), {QStringLiteral("zone.xiv.sagasu"), DATAEXPLORER_EXECUTABLE}},
26-
{QStringLiteral("Model Viewer"), {QStringLiteral("zone.xiv.mdlviewer"), MDLVIEWER_EXECUTABLE}}};
26+
{QStringLiteral("Model Viewer"), {QStringLiteral("zone.xiv.mdlviewer"), MDLVIEWER_EXECUTABLE}},
27+
{QStringLiteral("Game Launcher"), {QStringLiteral("zone.xiv.gamelauncher"), GAMELAUNCHER_EXECUTABLE}}};
2728

2829
static QMap<QString, QString> links = {{QStringLiteral("XIV Dev Wiki"), QStringLiteral("https://xiv.dev")},
2930
{QStringLiteral("XIV Docs"), QStringLiteral("https://docs.xiv.zone")}};

0 commit comments

Comments
 (0)