Skip to content

Commit

Permalink
misc: Code cleanups & remove references to Patreon & Twitter.
Browse files Browse the repository at this point in the history
  • Loading branch information
GreemDev committed Oct 11, 2024
1 parent 26e9aa1 commit 4c237c4
Show file tree
Hide file tree
Showing 27 changed files with 92 additions and 308 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
env:
POWERSHELL_TELEMETRY_OPTOUT: 1
DOTNET_CLI_TELEMETRY_OPTOUT: 1
RYUJINX_BASE_VERSION: "1.1.0"
RYUJINX_BASE_VERSION: "1.2.0"

jobs:
build:
Expand Down
6 changes: 0 additions & 6 deletions .github/workflows/nightly_pr_comment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ jobs:
pr_comment:
if: github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.conclusion == 'success'
runs-on: ubuntu-latest
timeout-minutes: ${{ fromJSON(vars.JOB_TIMEOUT) }}
steps:
- uses: actions/github-script@v6
with:
Expand Down Expand Up @@ -39,24 +38,19 @@ jobs:
return core.error(`No artifacts found`);
}
let body = `Download the artifacts for this pull request:\n`;
let hidden_gtk_artifacts = `\n\n <details><summary>Old GUI (GTK3)</summary>\n`;
let hidden_headless_artifacts = `\n\n <details><summary>GUI-less (SDL2)</summary>\n`;
let hidden_debug_artifacts = `\n\n <details><summary>Only for Developers</summary>\n`;
for (const art of artifacts) {
if(art.name.includes('Debug')) {
hidden_debug_artifacts += `\n* [${art.name}](https://nightly.link/${owner}/${repo}/actions/artifacts/${art.id}.zip)`;
} else if(art.name.includes('gtk-ryujinx')) {
hidden_gtk_artifacts += `\n* [${art.name}](https://nightly.link/${owner}/${repo}/actions/artifacts/${art.id}.zip)`;
} else if(art.name.includes('sdl2-ryujinx-headless')) {
hidden_headless_artifacts += `\n* [${art.name}](https://nightly.link/${owner}/${repo}/actions/artifacts/${art.id}.zip)`;
} else {
body += `\n* [${art.name}](https://nightly.link/${owner}/${repo}/actions/artifacts/${art.id}.zip)`;
}
}
hidden_gtk_artifacts += `\n</details>`;
hidden_headless_artifacts += `\n</details>`;
hidden_debug_artifacts += `\n</details>`;
body += hidden_gtk_artifacts;
body += hidden_headless_artifacts;
body += hidden_debug_artifacts;
Expand Down
14 changes: 3 additions & 11 deletions src/Ryujinx.Common/Pools/ObjectPool.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,11 @@

namespace Ryujinx.Common
{
public class ObjectPool<T>
public class ObjectPool<T>(Func<T> factory, int size)
where T : class
{
private T _firstItem;
private readonly T[] _items;

private readonly Func<T> _factory;

public ObjectPool(Func<T> factory, int size)
{
_items = new T[size - 1];
_factory = factory;
}
private readonly T[] _items = new T[size - 1];

public T Allocate()
{
Expand Down Expand Up @@ -43,7 +35,7 @@ private T AllocateInternal()
}
}

return _factory();
return factory();
}

public void Release(T obj)
Expand Down
12 changes: 3 additions & 9 deletions src/Ryujinx.Common/ReactiveObject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,9 @@ public static implicit operator T(ReactiveObject<T> obj)
}
}

public class ReactiveEventArgs<T>
public class ReactiveEventArgs<T>(T oldValue, T newValue)
{
public T OldValue { get; }
public T NewValue { get; }

public ReactiveEventArgs(T oldValue, T newValue)
{
OldValue = oldValue;
NewValue = newValue;
}
public T OldValue { get; } = oldValue;
public T NewValue { get; } = newValue;
}
}
5 changes: 1 addition & 4 deletions src/Ryujinx.HLE/HOS/Applets/Error/ErrorApplet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -158,10 +158,7 @@ private void ParseErrorCommonArg()

if (message == "")
{
message = "An error has occured.\n\n"
+ "Please try again later.\n\n"
+ "If the problem persists, please refer to the Ryujinx website.\n"
+ "www.ryujinx.org";
message = "An error has occured.\n\nPlease try again later.";
}

string[] buttons = GetButtonsText(module, description, "DlgBtn");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -659,7 +659,7 @@ public ResultCode PrepareForJit(ServiceCtx context)

if (string.IsNullOrWhiteSpace(filePath))
{
throw new InvalidSystemResourceException("JIT (010000000000003B) system title not found! The JIT will not work, provide the system archive to fix this error. (See https://github.com/Ryujinx/Ryujinx#requirements for more information)");
throw new InvalidSystemResourceException("JIT (010000000000003B) system title not found! The JIT will not work, provide the system archive to fix this error. (See https://github.com/GreemDev/Ryujinx#requirements for more information)");
}

context.Device.LoadNca(filePath);
Expand Down
2 changes: 1 addition & 1 deletion src/Ryujinx.HLE/HOS/Services/Sdb/Pl/SharedFontManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ FontInfo CreateFont(string name)
titleName = "Unknown";
}

throw new InvalidSystemResourceException($"{titleName} ({fontTitle:x8}) system title not found! This font will not work, provide the system archive to fix this error. (See https://github.com/Ryujinx/Ryujinx#requirements for more information)");
throw new InvalidSystemResourceException($"{titleName} ({fontTitle:x8}) system title not found! This font will not work, provide the system archive to fix this error. (See https://github.com/GreemDev/Ryujinx#requirements for more information)");
}
}
else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class BuiltInCertificateManager
{
private const long CertStoreTitleId = 0x0100000000000800;

private const string CertStoreTitleMissingErrorMessage = "CertStore system title not found! SSL CA retrieving will not work, provide the system archive to fix this error. (See https://github.com/Ryujinx/Ryujinx/wiki/Ryujinx-Setup-&-Configuration-Guide#initial-setup-continued---installation-of-firmware for more information)";
private const string CertStoreTitleMissingErrorMessage = "CertStore system title not found! SSL CA retrieving will not work, provide the system archive to fix this error.";

private static BuiltInCertificateManager _instance;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public class TimeZoneContentManager
{
private const long TimeZoneBinaryTitleId = 0x010000000000080E;

private const string TimeZoneSystemTitleMissingErrorMessage = "TimeZoneBinary system title not found! TimeZone conversions will not work, provide the system archive to fix this error. (See https://github.com/Ryujinx/Ryujinx/wiki/Ryujinx-Setup-&-Configuration-Guide#initial-setup-continued---installation-of-firmware for more information)";
private const string TimeZoneSystemTitleMissingErrorMessage = "TimeZoneBinary system title not found! TimeZone conversions will not work, provide the system archive to fix this error.";

private VirtualFileSystem _virtualFileSystem;
private IntegrityCheckLevel _fsIntegrityCheckLevel;
Expand Down
2 changes: 1 addition & 1 deletion src/Ryujinx.UI.Common/Helper/FileAssociationHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace Ryujinx.UI.Common.Helper
{
public static partial class FileAssociationHelper
{
private static readonly string[] _fileExtensions = { ".nca", ".nro", ".nso", ".nsp", ".xci" };
private static readonly string[] _fileExtensions = [".nca", ".nro", ".nso", ".nsp", ".xci"];

[SupportedOSPlatform("linux")]
private static readonly string _mimeDbPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), ".local", "share", "mime");
Expand Down
Binary file not shown.
Binary file not shown.
Binary file modified src/Ryujinx.UI.Common/Resources/Logo_Ryujinx.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
6 changes: 0 additions & 6 deletions src/Ryujinx.UI.Common/Ryujinx.UI.Common.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@
<None Remove="Resources\Logo_Amiibo.png" />
<None Remove="Resources\Logo_Discord.png" />
<None Remove="Resources\Logo_GitHub.png" />
<None Remove="Resources\Logo_Patreon.png" />
<None Remove="Resources\Logo_Ryujinx.png" />
<None Remove="Resources\Logo_Twitter.png" />
</ItemGroup>

<ItemGroup>
Expand All @@ -39,10 +37,6 @@
<EmbeddedResource Include="Resources\Logo_Discord_Light.png" />
<EmbeddedResource Include="Resources\Logo_GitHub_Dark.png" />
<EmbeddedResource Include="Resources\Logo_GitHub_Light.png" />
<EmbeddedResource Include="Resources\Logo_Patreon_Dark.png" />
<EmbeddedResource Include="Resources\Logo_Patreon_Light.png" />
<EmbeddedResource Include="Resources\Logo_Twitter_Dark.png" />
<EmbeddedResource Include="Resources\Logo_Twitter_Light.png" />
</ItemGroup>

<ItemGroup Condition="'$(RuntimeIdentifier)' == 'linux-x64' OR '$(RuntimeIdentifier)' == 'linux-arm64' OR '$(RuntimeIdentifier)' == ''">
Expand Down
12 changes: 4 additions & 8 deletions src/Ryujinx.UI.Common/SystemInfo/SystemInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,13 @@ public void Print()
public static SystemInfo Gather()
{
if (OperatingSystem.IsWindows())
{
return new WindowsSystemInfo();
}
else if (OperatingSystem.IsLinux())
{

if (OperatingSystem.IsLinux())
return new LinuxSystemInfo();
}
else if (OperatingSystem.IsMacOS())
{

if (OperatingSystem.IsMacOS())
return new MacOSSystemInfo();
}

Logger.Error?.Print(LogClass.Application, "SystemInfo unsupported on this platform");

Expand Down
2 changes: 1 addition & 1 deletion src/Ryujinx.UI.Common/SystemInfo/WindowsSystemInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ private static string GetCpuNameWMI()
}
}

return Environment.GetEnvironmentVariable("PROCESSOR_IDENTIFIER").Trim();
return Environment.GetEnvironmentVariable("PROCESSOR_IDENTIFIER")?.Trim();
}

[StructLayout(LayoutKind.Sequential)]
Expand Down
3 changes: 1 addition & 2 deletions src/Ryujinx/App.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,7 @@ private void ShowRestartDialog()

if (result == UserResult.Yes)
{
var path = Environment.ProcessPath;
var proc = Process.Start(path, CommandLineState.Arguments);
_ = Process.Start(Environment.ProcessPath!, CommandLineState.Arguments);
desktop.Shutdown();
Environment.Exit(0);
}
Expand Down
65 changes: 34 additions & 31 deletions src/Ryujinx/AppHost.cs
Original file line number Diff line number Diff line change
Expand Up @@ -825,7 +825,7 @@ private void InitializeSwitchInstance()
{
renderer = new VulkanRenderer(
Vk.GetApi(),
(RendererHost.EmbeddedWindow as EmbeddedWindowVulkan).CreateSurface,
(RendererHost.EmbeddedWindow as EmbeddedWindowVulkan)!.CreateSurface,
VulkanHelper.GetRequiredInstanceExtensions,
ConfigurationState.Instance.Graphics.PreferredGpu.Value);
}
Expand All @@ -845,36 +845,39 @@ private void InitializeSwitchInstance()
Logger.Info?.PrintMsg(LogClass.Gpu, $"Backend Threading ({threadingMode}): {isGALThreaded}");

// Initialize Configuration.
var memoryConfiguration = ConfigurationState.Instance.System.ExpandRam.Value ? MemoryConfiguration.MemoryConfiguration8GiB : MemoryConfiguration.MemoryConfiguration4GiB;

HLEConfiguration configuration = new(VirtualFileSystem,
_viewModel.LibHacHorizonManager,
ContentManager,
_accountManager,
_userChannelPersistence,
renderer,
InitializeAudio(),
memoryConfiguration,
_viewModel.UiHandler,
(SystemLanguage)ConfigurationState.Instance.System.Language.Value,
(RegionCode)ConfigurationState.Instance.System.Region.Value,
ConfigurationState.Instance.Graphics.EnableVsync,
ConfigurationState.Instance.System.EnableDockedMode,
ConfigurationState.Instance.System.EnablePtc,
ConfigurationState.Instance.System.EnableInternetAccess,
ConfigurationState.Instance.System.EnableFsIntegrityChecks ? IntegrityCheckLevel.ErrorOnInvalid : IntegrityCheckLevel.None,
ConfigurationState.Instance.System.FsGlobalAccessLogMode,
ConfigurationState.Instance.System.SystemTimeOffset,
ConfigurationState.Instance.System.TimeZone,
ConfigurationState.Instance.System.MemoryManagerMode,
ConfigurationState.Instance.System.IgnoreMissingServices,
ConfigurationState.Instance.Graphics.AspectRatio,
ConfigurationState.Instance.System.AudioVolume,
ConfigurationState.Instance.System.UseHypervisor,
ConfigurationState.Instance.Multiplayer.LanInterfaceId.Value,
ConfigurationState.Instance.Multiplayer.Mode);

Device = new Switch(configuration);
var memoryConfiguration = ConfigurationState.Instance.System.ExpandRam
? MemoryConfiguration.MemoryConfiguration8GiB
: MemoryConfiguration.MemoryConfiguration4GiB;

Device = new Switch(new HLEConfiguration(
VirtualFileSystem,
_viewModel.LibHacHorizonManager,
ContentManager,
_accountManager,
_userChannelPersistence,
renderer,
InitializeAudio(),
memoryConfiguration,
_viewModel.UiHandler,
(SystemLanguage)ConfigurationState.Instance.System.Language.Value,
(RegionCode)ConfigurationState.Instance.System.Region.Value,
ConfigurationState.Instance.Graphics.EnableVsync,
ConfigurationState.Instance.System.EnableDockedMode,
ConfigurationState.Instance.System.EnablePtc,
ConfigurationState.Instance.System.EnableInternetAccess,
ConfigurationState.Instance.System.EnableFsIntegrityChecks ? IntegrityCheckLevel.ErrorOnInvalid : IntegrityCheckLevel.None,
ConfigurationState.Instance.System.FsGlobalAccessLogMode,
ConfigurationState.Instance.System.SystemTimeOffset,
ConfigurationState.Instance.System.TimeZone,
ConfigurationState.Instance.System.MemoryManagerMode,
ConfigurationState.Instance.System.IgnoreMissingServices,
ConfigurationState.Instance.Graphics.AspectRatio,
ConfigurationState.Instance.System.AudioVolume,
ConfigurationState.Instance.System.UseHypervisor,
ConfigurationState.Instance.Multiplayer.LanInterfaceId,
ConfigurationState.Instance.Multiplayer.Mode
)
);
}

private static IHardwareDeviceDriver InitializeAudio()
Expand Down
30 changes: 10 additions & 20 deletions src/Ryujinx/Common/Locale/LocaleExtension.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,33 +6,23 @@

namespace Ryujinx.Ava.Common.Locale
{
internal class LocaleExtension : MarkupExtension
internal class LocaleExtension(LocaleKeys key) : MarkupExtension
{
public LocaleExtension(LocaleKeys key)
{
Key = key;
}

public LocaleKeys Key { get; }
public LocaleKeys Key { get; } = key;

public override object ProvideValue(IServiceProvider serviceProvider)
{
LocaleKeys keyToUse = Key;

var builder = new CompiledBindingPathBuilder();

builder
.Property(new ClrPropertyInfo("Item",
obj => (LocaleManager.Instance[keyToUse]),
null,
typeof(string)), (weakRef, iPropInfo) =>
{
return PropertyInfoAccessorFactory.CreateInpcPropertyAccessor(weakRef, iPropInfo);
});

var path = builder.Build();
builder.Property(
new ClrPropertyInfo("Item",
_ => LocaleManager.Instance[Key],
null,
typeof(string)
),
PropertyInfoAccessorFactory.CreateInpcPropertyAccessor);

var binding = new CompiledBindingExtension(path)
var binding = new CompiledBindingExtension(builder.Build())
{
Source = LocaleManager.Instance
};
Expand Down
4 changes: 2 additions & 2 deletions src/Ryujinx/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ internal partial class Program

private const uint MbIconwarning = 0x30;

public static void Main(string[] args)
public static int Main(string[] args)
{
Version = ReleaseInformation.Version;

Expand All @@ -51,7 +51,7 @@ public static void Main(string[] args)

LoggerAdapter.Register();

BuildAvaloniaApp().StartWithClassicDesktopLifetime(args);
return BuildAvaloniaApp().StartWithClassicDesktopLifetime(args);
}

public static AppBuilder BuildAvaloniaApp()
Expand Down
24 changes: 7 additions & 17 deletions src/Ryujinx/UI/Applet/AvaloniaHostUITheme.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,15 @@

namespace Ryujinx.Ava.UI.Applet
{
class AvaloniaHostUITheme : IHostUITheme
class AvaloniaHostUITheme(MainWindow parent) : IHostUITheme
{
public AvaloniaHostUITheme(MainWindow parent)
{
FontFamily = OperatingSystem.IsWindows() && OperatingSystem.IsWindowsVersionAtLeast(10, 0, 22000) ? "Segoe UI Variable" : parent.FontFamily.Name;
DefaultBackgroundColor = BrushToThemeColor(parent.Background);
DefaultForegroundColor = BrushToThemeColor(parent.Foreground);
DefaultBorderColor = BrushToThemeColor(parent.BorderBrush);
SelectionBackgroundColor = BrushToThemeColor(parent.ViewControls.SearchBox.SelectionBrush);
SelectionForegroundColor = BrushToThemeColor(parent.ViewControls.SearchBox.SelectionForegroundBrush);
}

public string FontFamily { get; }
public string FontFamily { get; } = OperatingSystem.IsWindows() && OperatingSystem.IsWindowsVersionAtLeast(10, 0, 22000) ? "Segoe UI Variable" : parent.FontFamily.Name;

public ThemeColor DefaultBackgroundColor { get; }
public ThemeColor DefaultForegroundColor { get; }
public ThemeColor DefaultBorderColor { get; }
public ThemeColor SelectionBackgroundColor { get; }
public ThemeColor SelectionForegroundColor { get; }
public ThemeColor DefaultBackgroundColor { get; } = BrushToThemeColor(parent.Background);
public ThemeColor DefaultForegroundColor { get; } = BrushToThemeColor(parent.Foreground);
public ThemeColor DefaultBorderColor { get; } = BrushToThemeColor(parent.BorderBrush);
public ThemeColor SelectionBackgroundColor { get; } = BrushToThemeColor(parent.ViewControls.SearchBox.SelectionBrush);
public ThemeColor SelectionForegroundColor { get; } = BrushToThemeColor(parent.ViewControls.SearchBox.SelectionForegroundBrush);

private static ThemeColor BrushToThemeColor(IBrush brush)
{
Expand Down
Loading

0 comments on commit 4c237c4

Please sign in to comment.