Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
dba3754
Fix sccache builds on MSVC
sruon Oct 10, 2026
6a63171
Adopt LSB clang-format config
sruon Oct 10, 2026
1a73909
Fall back to plain console menus under Wine
sruon Oct 10, 2026
7189f67
Move generated COM headers to client/sdk
sruon Oct 10, 2026
ac63a1c
Replace globals and magic numbers with structs and enums
sruon Oct 10, 2026
1849c65
Move trust tokens into TrustTokenManager
sruon Oct 10, 2026
0e768e0
Put menus behind a Menu interface
sruon Oct 10, 2026
dadc68a
Move the login flow into login/
sruon Oct 10, 2026
33cec2b
Replace the TLS globals with AuthConnection
sruon Oct 10, 2026
70f294d
Move QR code helpers into otp/
sruon Oct 10, 2026
f085e96
Move config loading out of main
sruon Oct 10, 2026
2532c9d
Use scope guards for main's resources
sruon Oct 10, 2026
f0f4021
Move the socket hooks and hairpin fix into hooks/
sruon Oct 10, 2026
bd45a4c
Replace network.cpp with LobbyDataConnection
sruon Oct 10, 2026
01ab7cd
Pass config and session instead of using globals
sruon Oct 10, 2026
015068b
Stop on failed polcore lookups instead of crashing
sruon Oct 10, 2026
8c34851
Make the hairpin patch sites writable before patching
sruon Oct 10, 2026
432db8f
Move the client code into client/
sruon Oct 10, 2026
e3c2fb9
Seed the PlayOnline option file so in-game settings persist
sruon Oct 1, 2026
710168b
Frame lobby data packets by their fixed sizes
sruon Oct 10, 2026
ed05b92
Size console messages to fit instead of truncating at 1024
sruon Oct 10, 2026
cf08a3e
Rename helpers.h to json_get.h
sruon Oct 10, 2026
a0aeb93
Document usage and the check target in the README
sruon Oct 10, 2026
7bd0a49
Keep a character list that arrives before polcore's buffer is known
sruon Oct 10, 2026
62689e9
Apply house style across the codebase
sruon Oct 10, 2026
2418158
Move to C++23 and drop ternaries
sruon Oct 10, 2026
57d679a
Format console output with std::format
sruon Oct 10, 2026
47310df
Return std::expected from config loading and the connect calls
sruon Oct 10, 2026
ac460e1
Fix clang-tidy findings and drop C-style casts
sruon Oct 10, 2026
466f392
Log each run, keep the window open on failure, add exit codes
sruon Oct 10, 2026
8ed180c
Check the install before login and add --diagnose
sruon Oct 10, 2026
e451af7
Check the server's key like ssh, with --fingerprint
sruon Oct 10, 2026
0f17927
Bind trust tokens to the server's key
sruon Oct 10, 2026
5d3343d
Fix review findings
sruon Oct 10, 2026
0b49f75
Treat Ctrl+C in a menu as cancel
sruon Oct 10, 2026
5b51e1a
Shorten messages and README
sruon Oct 10, 2026
e066502
Credit atom0s and add license to the README
sruon Oct 10, 2026
ec0835b
Move the lobby data and view connections to TLS
sruon Nov 5, 2026
947dff4
Bump version to 3.0.0
sruon Nov 5, 2026
30bfd9c
Fix issues from the TLS review
sruon Nov 5, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
143 changes: 126 additions & 17 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -1,33 +1,142 @@
---
---
# https://clang.llvm.org/docs/ClangFormatStyleOptions.html
# We base things of WebKit + Allman braces
# BasedOnStyle: WebKit
# Compatible with clang-format-22 (enforced by tools/run_clang_format.py)
Language: Cpp

# Access modifiers
AccessModifierOffset: -4
AlignConsecutiveMacros: true
EmptyLineAfterAccessModifier: Never
EmptyLineBeforeAccessModifier: LogicalBlock
IndentAccessModifiers: false

# Alignment settings
AlignAfterOpenBracket: Align
AlignArrayOfStructures: None
AlignConsecutiveAssignments: true
AlignConsecutiveDeclarations: true
AlignConsecutiveMacros: true
AlignEscapedNewlines: Right
AlignOperands: Align
AlignTrailingComments: true

# Short constructs
AllowShortBlocksOnASingleLine: Never
AllowShortCaseLabelsOnASingleLine: false
AllowShortEnumsOnASingleLine: false
AllowShortFunctionsOnASingleLine: None
AlwaysBreakTemplateDeclarations: true
AllowShortIfStatementsOnASingleLine: Never
AllowShortLambdasOnASingleLine: None
AllowShortLoopsOnASingleLine: false
LambdaBodyIndentation: Signature

# Template declarations
AlwaysBreakTemplateDeclarations: Yes

# Braces - Allman style
BreakBeforeBraces: Allman
BraceWrapping:
AfterCaseLabel: true
AfterClass: true
AfterControlStatement: Always
AfterEnum: true
AfterFunction: true
AfterNamespace: true
AfterStruct: true
AfterUnion: true
BeforeCatch: true
BeforeElse: true
BeforeLambdaBody: true
BeforeWhile: false
IndentBraces: false
SplitEmptyFunction: true
SplitEmptyRecord: true
SplitEmptyNamespace: true
AfterExternBlock: true

# Constructor and inheritance
BreakConstructorInitializers: BeforeComma
# This is just to make clang-format chill out! Use your best judgement!
ColumnLimit: 0
CompactNamespaces: 'false'
BreakInheritanceList: BeforeColon
ConstructorInitializerIndentWidth: 0
Cpp11BracedListStyle: 'false'
IndentCaseLabels: 'true'
PackConstructorInitializers: BinPack

# Line limits and wrapping
ColumnLimit: 0 # Use your best judgement
AllowAllArgumentsOnNextLine: true
AllowAllParametersOfDeclarationOnNextLine: true
BinPackArguments: false
BinPackParameters: false

# Namespaces
CompactNamespaces: false
NamespaceIndentation: None
WrapNamespaceBodyWithEmptyLines: Always
SeparateDefinitionBlocks: Always

# Braced lists and initializers
Cpp11BracedListStyle: false

# Indentation
IndentWidth: 4
KeepEmptyLinesAtTheStartOfBlocks: 'false'
Language: Cpp
NamespaceIndentation: All
IndentCaseLabels: true
IndentPPDirectives: None
IndentWrappedFunctionNames: false
ContinuationIndentWidth: 4

# Empty lines
KeepEmptyLinesAtTheStartOfBlocks: false
MaxEmptyLinesToKeep: 1

# Pointer and reference alignment
PointerAlignment: Left
ReflowComments: true
SortIncludes: 'true'
SortUsingDeclarations: 'true'
SpaceBeforeParens: ControlStatements
ReferenceAlignment: Pointer
QualifierAlignment: Left # West Const

# Comments
ReflowComments: Always
SpacesBeforeTrailingComments: 1
Standard: Cpp11

# Include sorting
SortIncludes: true
SortUsingDeclarations: LexicographicNumeric

# Spacing
SpaceBeforeParens: ControlStatements
SpaceBeforeParensOptions:
AfterControlStatements: true
AfterForeachMacros: true
AfterFunctionDefinitionName: false
AfterFunctionDeclarationName: false
AfterIfMacros: true
BeforeNonEmptyParentheses: false
SpaceBeforeAssignmentOperators: true
SpaceBeforeCaseColon: false
SpaceBeforeCpp11BracedList: false
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeRangeBasedForLoopColon: true
SpaceBeforeSquareBrackets: false
SpaceInEmptyBlock: false
SpacesInAngles: Never
SpacesInContainerLiterals: true
SpacesInParens: Never
SpacesInSquareBrackets: false

# C++ standard
Standard: Latest

# Tabs
UseTab: Never
TabWidth: 4

# Binary operators
BreakBeforeBinaryOperators: None
BreakBeforeTernaryOperators: true

# String handling
BreakStringLiterals: true

# Other formatting options
FixNamespaceComments: true

...
1 change: 1 addition & 0 deletions .clang-format-ignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
src/client/sdk/*
33 changes: 33 additions & 0 deletions .clang-tidy
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
# https://releases.llvm.org/14.0.0/tools/clang/tools/extra/docs/clang-tidy/checks/list.html
Checks: >
-*,
cppcoreguidelines-avoid-goto,
cppcoreguidelines-init-variables,
cppcoreguidelines-no-malloc,
cppcoreguidelines-pro-type-const-cast,
cppcoreguidelines-pro-type-cstyle-cast,
google-readability-casting,
cppcoreguidelines-pro-type-member-init,

cppcoreguidelines-slicing,
cppcoreguidelines-special-member-functions,
cppcoreguidelines-virtual-class-destructor,
misc-definitions-in-headers,
modernize-pass-by-value,
modernize-use-emplace,
modernize-use-nullptr,
modernize-use-override,
performance-*,

# TODO: Enable these
# concurrency-mt-unsafe,
# cppcoreguidelines-prefer-member-initializer,
# cppcoreguidelines-pro-type-vararg,

# TODO: These are important, but they're destructive. Turn on one day.
# cppcoreguidelines-pro-type-static-cast-downcast,

HeaderFilterRegex: 'xiloader[/\](src|tests)[/\]'
ExcludeHeaderFilterRegex: 'client[/\]sdk[/\]'
...
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ xiloader.exe
xiloader.pdb
*.ilk
*.exe.manifest
.idea/
122 changes: 101 additions & 21 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
cmake_minimum_required(VERSION 3.15)
project(xiloader CXX)
cmake_minimum_required(VERSION 3.20)

set(CMAKE_CXX_STANDARD 20)
# C is enabled here so the flag fix below reaches the C dependencies
project(xiloader C CXX)

# Parallel compiles behind sccache or ccache cannot share one PDB (/Zi), so embed the debug info in the objects (/Z7)
if(MSVC AND (CMAKE_C_COMPILER_LAUNCHER OR CMAKE_CXX_COMPILER_LAUNCHER))
foreach(flags CMAKE_C_FLAGS_DEBUG CMAKE_CXX_FLAGS_DEBUG CMAKE_C_FLAGS_RELWITHDEBINFO CMAKE_CXX_FLAGS_RELWITHDEBINFO)
string(REPLACE "/Zi" "/Z7" ${flags} "${${flags}}")
endforeach()
endif()

set(CMAKE_CXX_STANDARD 23)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS ON)
set(LINKER_LANGUAGE CXX)
Expand Down Expand Up @@ -32,41 +41,91 @@ configure_file(

# xiloader
add_executable(xiloader
src/command_handler.h
src/app_data.cpp
src/app_data.h
src/client/game.cpp
src/client/game.h
src/client/registry.cpp
src/client/registry.h
src/client/sdk/ffxi.h
src/client/sdk/polcore.h
src/config.cpp
src/config.h
src/console.cpp
src/console.h
src/defines.h
src/diagnostics/checks.h
src/diagnostics/install_checks.cpp
src/diagnostics/runtime_checks.cpp
src/enums/check_status.h
src/enums/console_color.h
src/enums/exit_code.h
src/enums/lobby_command.h
src/enums/lobby_data.h
src/enums/login_command.h
src/enums/login_outcome.h
src/enums/login_result.h
src/enums/menu_selection.h
src/enums/pol_function.h
src/enums/pol_language.h
src/enums/polcon_state.h
src/FFXi.h
src/FFXiMain.h
src/functions.cpp
src/functions.h
src/enums/reconnect.h
src/enums/relay_phase.h
src/enums/server_trust.h
src/guards.h
src/hooks/hairpin_fix.cpp
src/hooks/hairpin_fix.h
src/hooks/socket_hooks.cpp
src/hooks/socket_hooks.h
src/json_get.h
src/lobby/data_connection.cpp
src/lobby/data_connection.h
src/login/auth_connection.cpp
src/login/auth_connection.h
src/login/known_servers.cpp
src/login/known_servers.h
src/login/login.cpp
src/login/login.h
src/login/session.h
src/login/verify_server.cpp
src/main.cpp
src/menus.h
src/network.cpp
src/network.h
src/polcore.h
src/playonline.cpp
src/playonline.h
src/polrelay.cpp
src/polrelay.h
src/trust_token.cpp
src/trust_token.h
src/net/resolve.cpp
src/net/resolve.h
src/net/tls_client_config.cpp
src/net/tls_client_config.h
src/otp/qr_code.cpp
src/otp/qr_code.h
src/otp/trust_token_manager.cpp
src/otp/trust_token_manager.h
src/client/pattern_scan.cpp
src/client/pattern_scan.h
src/client/playonline.cpp
src/client/playonline.h
src/client/polcore_ids.h
src/client/polrelay.cpp
src/client/polrelay.h
src/ui/ftxui_menu.cpp
src/ui/menu.cpp
src/ui/menu.h
src/ui/plain_menu.cpp
src/ui/prompts.cpp
src/ui/prompts.h
${CMAKE_CURRENT_BINARY_DIR}/src/xiloader.rc
xiloader.manifest
)

set_target_properties(xiloader PROPERTIES LINK_FLAGS "/LARGEADDRESSAWARE")

target_include_directories(xiloader PUBLIC ${PROJECT_SOURCE_DIR}/xiloader)
# Keeps windows.h from defining min/max and from pulling in winsock.h, so include order does not matter
target_compile_definitions(xiloader PRIVATE NOMINMAX WIN32_LEAN_AND_MEAN)

target_include_directories(xiloader PRIVATE ${PROJECT_SOURCE_DIR}/src)

target_link_libraries(xiloader PUBLIC
detours
argparse
crypt32
psapi
ws2_32
iphlpapi
MbedTLS::mbedtls
MbedTLS::mbedcrypto
MbedTLS::mbedx509
Expand All @@ -76,6 +135,27 @@ target_link_libraries(xiloader PUBLIC
ftxui::component
qr-code-generator)

# Assert-based checks for the parts that run without the game
add_executable(xiloader_check
src/app_data.cpp
src/client/pattern_scan.cpp
src/client/polrelay.cpp
src/config.cpp
src/client/registry.cpp
src/console.cpp
src/diagnostics/install_checks.cpp
src/lobby/data_connection.cpp
src/login/known_servers.cpp
src/otp/trust_token_manager.cpp
src/net/tls_client_config.cpp
src/ui/plain_menu.cpp
tests/check.cpp
)

target_include_directories(xiloader_check PRIVATE ${PROJECT_SOURCE_DIR}/src)
target_compile_definitions(xiloader_check PRIVATE NOMINMAX WIN32_LEAN_AND_MEAN)
target_link_libraries(xiloader_check PRIVATE crypt32 argparse nlohmann_json::nlohmann_json psapi ws2_32 MbedTLS::mbedtls MbedTLS::mbedcrypto MbedTLS::mbedx509)

message(STATUS "CMAKE_VERSION: ${CMAKE_VERSION}")
message(STATUS "CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}")
message(STATUS "CMAKE_C_COMPILER: ${CMAKE_C_COMPILER}")
Expand Down
Loading