Skip to content

Commit

Permalink
Merge branch 'main' into compatibility-rework-2
Browse files Browse the repository at this point in the history
  • Loading branch information
rankynbass committed Mar 14, 2024
2 parents 2d5e980 + 0e69121 commit 6cfff13
Show file tree
Hide file tree
Showing 12 changed files with 234 additions and 104 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,8 @@ jobs:
- name: Dotnet Build (Fedora)
run: dotnet publish -r linux-x64 --sc --configuration Release -p:DefineConstants=WINE_XIV_FEDORA_LINUX --no-restore -o ./dist/XIVLauncher.Core-fedora

- name: Dotnet Build (Windows)
run: dotnet publish -r win10-x64 --sc --configuration Release -o ./dist/XIVLauncher.Core-win10x64

- name: Dotnet Test
run: dotnet test --no-build --verbosity normal
6 changes: 6 additions & 0 deletions .github/workflows/make-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ jobs:
working-directory: ./src/XIVLauncher.Core/
run: dotnet publish -r linux-x64 --sc --configuration Release -p:DefineConstants=WINE_XIV_FEDORA_LINUX --no-restore -o ./dist/XIVLauncher.Core-fedora

- name: Dotnet Build (Windows)
working-directory: ./src/XIVLauncher.Core/
run: dotnet publish -r win10-x64 --sc --configuration Release -o ./dist/XIVLauncher.Core-win10x64

- name: Generate nuget-dependencies.json
working-directory: ./src/XIVLauncher.Core/
run: |
Expand Down Expand Up @@ -132,6 +136,7 @@ jobs:
tar -czf ./dist/XIVLauncher.Core.tar.gz -C ./src/XIVLauncher.Core/dist/XIVLauncher.Core .
tar -czf ./dist/XIVLauncher.Core-arch.tar.gz -C ./src/XIVLauncher.Core/dist/XIVLauncher.Core-arch .
tar -czf ./dist/XIVLauncher.Core-fedora.tar.gz -C ./src/XIVLauncher.Core/dist/XIVLauncher.Core-fedora .
zip -r ./dist/XIVLauncher.Core-win10x64.zip ./src/XIVLauncher.Core/dist/XIVLauncher.Core-win10x64
- name: Release on GitHub
uses: softprops/action-gh-release@v1
Expand All @@ -143,3 +148,4 @@ jobs:
./dist/XIVLauncher.Core.tar.gz
./dist/XIVLauncher.Core-arch.tar.gz
./dist/XIVLauncher.Core-fedora.tar.gz
./dist/XIVLauncher.Core-win10x64.zip
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ If you want to use XIVLauncher on your Steam Deck, feel free to [follow our guid

## Building & Contributing
1. Clone this repository with submodules
2. Make sure you have a recent(.NET6+) version of the .NET SDK installed
2. Make sure you have a recent(.NET 6.0.400+) version of the .NET SDK installed
2. Run `dotnet build` or `dotnet publish`

Common components that are shared with the Windows version of XIVLauncher are linked as a submodule in the "lib" folder. XIVLauncher Core can run on Windows, but is by far not as polished as the original Windows version, as such we are not distributing it.
Common components that are shared with the Windows version of XIVLauncher are linked as a submodule in the "lib" folder. XIVLauncher Core can run on Windows, but is by far not as polished as the [original Windows version](https://github.com/goatcorp/FFXIVQuickLauncher). Windows users should not use this application unless for troubleshooting purposes or development work.

## Distribution
XIVLauncher Core has community packages for various Linux distributions. Please be aware that **only the Flathub version is official**, but the others are **packaged by trusted community members**. The community packages may not always be up-to-date, or may have versions that are broken or contain features under testing (especially if labeled as unstable or git). We can't take any responsibility for their safety or reliability.
Expand All @@ -22,9 +22,9 @@ XIVLauncher Core has community packages for various Linux distributions. Please
| [AUR](https://aur.archlinux.org/packages/xivlauncher) | ![AUR version](https://img.shields.io/aur/version/xivlauncher) |
| [AUR (git)](https://aur.archlinux.org/packages/xivlauncher-git) | ![AUR version](https://img.shields.io/aur/version/xivlauncher-git) |
| [Copr (Fedora+openSuse+EL9)](https://copr.fedorainfracloud.org/coprs/rankyn/xivlauncher/) | ![COPR version](https://img.shields.io/endpoint?url=https%3A%2F%2Fraw.githubusercontent.com%2Frankynbass%2FXIVLauncher4rpm%2Fmain%2Fbadge.json)|
| [GURU (Gentoo)](https://gitweb.gentoo.org/repo/proj/guru.git/tree/games-util/xivlauncher) | ![GURU version](https://repology.org/badge/version-for-repo/gentoo_ovl_guru/xivlauncher.svg?header=guru) |
| [MPR (Debian+Ubuntu)](https://mpr.makedeb.org/packages/xivlauncher) | ![MPR package](https://repology.org/badge/version-for-repo/mpr/xivlauncher.svg?header=MPR) |
| [MPR (git) (Debian+Ubuntu)](https://mpr.makedeb.org/packages/xivlauncher-git) | ![MPR package](https://repology.org/badge/version-for-repo/mpr/xivlauncher.svg?header=MPR) |
| [nixpkgs stable](https://search.nixos.org/packages?channel=23.05&from=0&size=50&sort=relevance&type=packages&query=xivlauncher) | ![nixpkgs stable version](https://repology.org/badge/version-for-repo/nix_stable_23_05/xivlauncher.svg?header=nixpkgs%2023.05) |
| [nixpkgs unstable](https://search.nixos.org/packages?channel=unstable&from=0&size=50&sort=relevance&type=packages&query=xivlauncher) | ![nixpkgs unstable version](https://repology.org/badge/version-for-repo/nix_unstable/xivlauncher.svg?header=nixpkgs%20unstable) |
| [GURU (Gentoo)](https://gitweb.gentoo.org/repo/proj/guru.git/tree/games-util/xivlauncher) | ![GURU version](https://repology.org/badge/version-for-repo/gentoo_ovl_guru/xivlauncher.core.svg?header=guru) |
| [MPR (Debian+Ubuntu)](https://mpr.makedeb.org/packages/xivlauncher) | ![MPR package](https://repology.org/badge/version-for-repo/mpr/xivlauncher.core.svg?header=MPR) |
| [MPR (git) (Debian+Ubuntu)](https://mpr.makedeb.org/packages/xivlauncher-git) | ![MPR package](https://repology.org/badge/version-for-repo/mpr/xivlauncher.core.svg?header=MPR) |
| [nixpkgs stable](https://search.nixos.org/packages?channel=23.11&from=0&size=50&sort=relevance&type=packages&query=xivlauncher) | ![nixpkgs stable version](https://repology.org/badge/version-for-repo/nix_stable_23_11/xivlauncher.core.svg?header=nixpkgs%2023.11) |
| [nixpkgs unstable](https://search.nixos.org/packages?channel=unstable&from=0&size=50&sort=relevance&type=packages&query=xivlauncher) | ![nixpkgs unstable version](https://repology.org/badge/version-for-repo/nix_unstable/xivlauncher.core.svg?header=nixpkgs%20unstable) |
| [PPA (Ubuntu)](https://launchpad.net/~linneris/+archive/ubuntu/xivlauncher-core-stable) | ![PPA version](https://img.shields.io/static/v1?label=PPA&message=1.0.5&color=brightgreen) |
Binary file modified misc/xlcore_screenshot_v2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
72 changes: 38 additions & 34 deletions src/XIVLauncher.Core/Components/MainPage/MainPage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -203,9 +203,8 @@ public async Task<bool> Login(string username, string password, bool isOtp, bool

private async Task<Launcher.LoginResult> TryLoginToGame(string username, string password, string otp, bool isSteam, LoginAction action)
{
bool? gateStatus = null;

#if !DEBUG
bool? gateStatus = null;
try
{
// TODO: Also apply the login status fix here
Expand All @@ -219,33 +218,7 @@ public async Task<bool> Login(string username, string password, bool isOtp, bool

if (gateStatus == null)
{
/*
CustomMessageBox.Builder.NewFrom(Loc.Localize("GateUnreachable", "The login servers could not be reached. This usually indicates that the game is under maintenance, or that your connection to the login servers is unstable.\n\nPlease try again later."))
.WithImage(MessageBoxImage.Asterisk)
.WithButtons(MessageBoxButton.OK)
.WithShowHelpLinks(true)
.WithCaption("XIVLauncher")
.WithParentWindow(_window)
.Show();
*/

App.ShowMessageBlocking("Login servers could not be reached or maintenance is in progress. This might be a problem with your connection.");

return null;
}

if (gateStatus == false)
{
/*
CustomMessageBox.Builder.NewFrom(Loc.Localize("GateClosed", "FFXIV is currently under maintenance. Please try again later or see official sources for more information."))
.WithImage(MessageBoxImage.Asterisk)
.WithButtons(MessageBoxButton.OK)
.WithCaption("XIVLauncher")
.WithParentWindow(_window)
.Show();*/

App.ShowMessageBlocking("Maintenance is in progress.");

return null;
}
#endif
Expand Down Expand Up @@ -367,6 +340,30 @@ private async Task<bool> TryProcessLoginResult(Launcher.LoginResult loginResult,
return false;
}

#if !DEBUG
bool? gateStatus = null;
try
{
// TODO: Also apply the login status fix here
var gate = await App.Launcher.GetGateStatus(App.Settings.ClientLanguage ?? ClientLanguage.English).ConfigureAwait(false);
gateStatus = gate.Status;
}
catch (Exception ex)
{
Log.Error(ex, "Could not obtain gate status");
}

switch (gateStatus)
{
case null:
App.ShowMessageBlocking("Login servers could not be reached or maintenance is in progress. This might be a problem with your connection.");
return false;
case false:
App.ShowMessageBlocking("Maintenance is in progress.");
return false;
}
#endif

Debug.Assert(loginResult.State == Launcher.LoginState.Ok);

while (true)
Expand Down Expand Up @@ -686,6 +683,13 @@ public async Task<Process> StartGameAndAddon(Launcher.LoginResult loginResult, b

IGameRunner runner;

// Hack: Force C.utf8 to fix incorrect unicode paths
if (App.Settings.FixLocale.Value && !string.IsNullOrEmpty(Program.CType))
{
System.Environment.SetEnvironmentVariable("LC_ALL", Program.CType);
System.Environment.SetEnvironmentVariable("LC_CTYPE", Program.CType);
}

// Hack: Strip out gameoverlayrenderer.so entries from LD_PRELOAD
if (App.Settings.FixLDP.Value)
{
Expand All @@ -707,7 +711,7 @@ public async Task<Process> StartGameAndAddon(Launcher.LoginResult loginResult, b
// If there's only one launch option (no %command%) figure out whether it's args or env variables.
if (launchOptions.Length == 1)
{
if(launchOptions[0].StartsWith('-'))
if (launchOptions[0].StartsWith('-'))
gameArgs = launchOptions[0];
else
launchEnv = launchOptions[0];
Expand Down Expand Up @@ -1196,11 +1200,11 @@ private async Task<bool> RepairGame(Launcher.LoginResult loginResult)
case PatchVerifier.VerifyState.Done:
// TODO: ask the user if they want to login or rerun after repair
App.ShowMessageBlocking(verify.NumBrokenFiles switch
{
0 => Loc.Localize("GameRepairSuccess0", "All game files seem to be valid."),
1 => Loc.Localize("GameRepairSuccess1", "XIVLauncher has successfully repaired 1 game file."),
_ => string.Format(Loc.Localize("GameRepairSuccessPlural", "XIVLauncher has successfully repaired {0} game files."), verify.NumBrokenFiles),
});
{
0 => Loc.Localize("GameRepairSuccess0", "All game files seem to be valid."),
1 => Loc.Localize("GameRepairSuccess1", "XIVLauncher has successfully repaired 1 game file."),
_ => string.Format(Loc.Localize("GameRepairSuccessPlural", "XIVLauncher has successfully repaired {0} game files."), verify.NumBrokenFiles),
});

doVerify = false;
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,57 @@ namespace XIVLauncher.Core.Components.SettingsPage.Tabs;

public class SettingsTabDalamud : SettingsTab
{
public override SettingsEntry[] Entries { get; } = {
new SettingsEntry<bool>("Enable Dalamud", "Enable the Dalamud plugin system", () => Program.Config.DalamudEnabled ?? true, b => Program.Config.DalamudEnabled = b),
public override string Title => "Dalamud";
public override SettingsEntry[] Entries { get; }
private SettingsEntry<bool> enableManualInjection;

new SettingsEntry<DalamudLoadMethod>("Load Method", "Choose how Dalamud is loaded.", () => Program.Config.DalamudLoadMethod ?? DalamudLoadMethod.DllInject, method => Program.Config.DalamudLoadMethod = method)
public SettingsTabDalamud()
{
this.Entries = new SettingsEntry[]
{
CheckValidity = x =>
{
if (x == DalamudLoadMethod.EntryPoint && !OperatingSystem.IsWindows())
return "Entry point injection is only supported on Windows.";

return null;
},
},
new SettingsEntry<bool>("Enable Dalamud", "Enable the Dalamud plugin system", () => Program.Config.DalamudEnabled ?? true, b => Program.Config.DalamudEnabled = b),

new NumericSettingsEntry("Injection Delay (ms)", "Choose how long to wait after the game has loaded before injecting.", () => Program.Config.DalamudLoadDelay, delay => Program.Config.DalamudLoadDelay = delay, 0, int.MaxValue, 1000),
};
new SettingsEntry<DalamudLoadMethod>("Load Method", "Choose how Dalamud is loaded.", () => Program.Config.DalamudLoadMethod ?? DalamudLoadMethod.DllInject, method => Program.Config.DalamudLoadMethod = method),

public override string Title => "Dalamud";
new NumericSettingsEntry("Injection Delay (ms)", "Choose how long to wait after the game has loaded before injecting.", () => Program.Config.DalamudLoadDelay, delay => Program.Config.DalamudLoadDelay = delay, 0, int.MaxValue, 1000),

enableManualInjection = new SettingsEntry<bool>("Enable Manual Injection", "Use a local build of Dalamud instead of the automatically provided one (For developers only!)", () => Program.Config.DalamudManualInjectionEnabled ?? false, (enabled) =>
{
Program.Config.DalamudManualInjectionEnabled = enabled;
if (!enabled)
{
Program.DalamudUpdater.RunnerOverride = null;
return;
}
if (Directory.Exists(Program.Config.DalamudManualInjectPath) && Directory.GetFiles(Program.Config.DalamudManualInjectPath).FirstOrDefault(x => x == "Dalamud.Injector.exe") is not null)
{
Program.DalamudUpdater.RunnerOverride = new FileInfo(Path.Combine(Program.Config.DalamudManualInjectPath, Program.DALAMUD_INJECTOR_NAME));
}
}),

new SettingsEntry<string>("Manual Injection Path", "The path to the local version of Dalamud where Dalamud.Injector.exe is located", () => Program.Config.DalamudManualInjectPath, (input) =>
{
Program.Config.DalamudManualInjectPath = input;
Program.DalamudUpdater.RunnerOverride = new FileInfo(Path.Combine(input, Program.DALAMUD_INJECTOR_NAME));
})
{
CheckVisibility = () => enableManualInjection.Value == true,
CheckValidity = input =>
{
if (!Directory.Exists(input))
{
return "There is no directory at that path.";
}
if (Directory.GetFiles(input).FirstOrDefault(x => x == Program.DALAMUD_INJECTOR_NAME) is not null)
{
return "Dalamud.Injector.exe was not found inside of the provided directory.";
}
return null;
},
},
};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,23 @@
namespace XIVLauncher.Core.Components.SettingsPage.Tabs;

public class SettingsTabTroubleshooting : SettingsTab
{
{
public override SettingsEntry[] Entries { get; } =
{
new SettingsEntry<bool>("Hack: Disable gameoverlayrenderer.so", "Fixes some stuttering issues after 40+ minutes, but may affect steam overlay and input.", () => Program.Config.FixLDP ?? false, x => Program.Config.FixLDP = x),
new SettingsEntry<bool>("Hack: XMODIFIERS=\"@im=null\"", "Fixes some mouse-related issues, some stuttering issues", () => Program.Config.FixIM ?? false, x => Program.Config.FixIM = x),
new SettingsEntry<bool>($"Hack: Force locale to {(!string.IsNullOrEmpty(Program.CType) ? Program.CType : "C.UTF-8 (exact value depends on distro)")}",
!string.IsNullOrEmpty(Program.CType) ? $"Sets LC_ALL and LC_CTYPE to \"{Program.CType}\". This can fix some issues with non-Latin unicode characters in file paths if LANG is not a UTF-8 type" : "Hack Disabled. Could not find a UTF-8 C locale. You may have to set LC_ALL manually if LANG is not a UTF-8 type.",
() => Program.Config.FixLocale ?? false, b => Program.Config.FixLocale = b)
{
CheckWarning = b =>
{
var lang = CoreEnvironmentSettings.GetCleanEnvironmentVariable("LANG");
if (lang.ToUpper().Contains("UTF") && b)
return $"Your locale is \"{lang}\". You probably don't need this hack.";
return null;
}
},
};
public override string Title => "Troubleshooting";

Expand Down
4 changes: 4 additions & 0 deletions src/XIVLauncher.Core/Configuration/ILauncherConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ public interface ILauncherConfig

public string? WineDebugVars { get; set; }

public bool? FixLocale { get; set; }

public bool? FixLDP { get; set; }

public bool? FixIM { get; set; }
Expand All @@ -104,6 +106,8 @@ public interface ILauncherConfig
public bool? DalamudEnabled { get; set; }

public DalamudLoadMethod? DalamudLoadMethod { get; set; }
public bool? DalamudManualInjectionEnabled { get; set; }
public string? DalamudManualInjectPath { get; set; }

public int DalamudLoadDelay { get; set; }

Expand Down
17 changes: 17 additions & 0 deletions src/XIVLauncher.Core/CoreEnvironmentSettings.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
using System;
using System.Diagnostics;
using System.Globalization;

namespace XIVLauncher.Core;

Expand Down Expand Up @@ -38,4 +40,19 @@ public static string GetCleanEnvironmentVariable(string envvar, string badstring
if (badstring.Equals("")) return dirty;
return string.Join(separator, Array.FindAll<string>(dirty.Split(separator, StringSplitOptions.RemoveEmptyEntries), s => !s.Contains(badstring)));
}

public static string GetCType()
{
if (System.OperatingSystem.IsWindows())
return "";
var psi = new ProcessStartInfo("sh");
psi.Arguments = "-c \"locale -a 2>/dev/null | grep -i utf\"";
psi.RedirectStandardOutput = true;

var proc = new Process();
proc.StartInfo = psi;
proc.Start();
var output = proc.StandardOutput.ReadToEnd().Split('\n', StringSplitOptions.RemoveEmptyEntries);
return Array.Find(output, s => s.ToUpper().StartsWith("C."));
}
}
Loading

0 comments on commit 6cfff13

Please sign in to comment.