Skip to content

Commit

Permalink
UI: RPC: Fix asset image hover string version pointing to the Canary …
Browse files Browse the repository at this point in the history
…repo in Canary
  • Loading branch information
GreemDev committed Nov 11, 2024
1 parent 826ffd4 commit 79ba9d1
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 95 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/canary.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ env:
RYUJINX_BASE_VERSION: "1.2"
RYUJINX_TARGET_RELEASE_CHANNEL_NAME: "canary"
RYUJINX_TARGET_RELEASE_CHANNEL_OWNER: "GreemDev"
RYUJINX_TARGET_RELEASE_CHANNEL_SOURCE_REPO: "Ryujinx"
RYUJINX_TARGET_RELEASE_CHANNEL_REPO: "Ryujinx-Canary"
RELEASE: 1

Expand Down Expand Up @@ -92,7 +93,7 @@ jobs:
sed -r --in-place 's/\%\%RYUJINX_BUILD_GIT_HASH\%\%/${{ steps.version_info.outputs.git_short_hash }}/g;' src/Ryujinx.Common/ReleaseInformation.cs
sed -r --in-place 's/\%\%RYUJINX_TARGET_RELEASE_CHANNEL_NAME\%\%/${{ env.RYUJINX_TARGET_RELEASE_CHANNEL_NAME }}/g;' src/Ryujinx.Common/ReleaseInformation.cs
sed -r --in-place 's/\%\%RYUJINX_TARGET_RELEASE_CHANNEL_OWNER\%\%/${{ env.RYUJINX_TARGET_RELEASE_CHANNEL_OWNER }}/g;' src/Ryujinx.Common/ReleaseInformation.cs
sed -r --in-place 's/\%\%RYUJINX_TARGET_RELEASE_CHANNEL_REPO\%\%/${{ env.RYUJINX_TARGET_RELEASE_CHANNEL_REPO }}/g;' src/Ryujinx.Common/ReleaseInformation.cs
sed -r --in-place 's/\%\%RYUJINX_TARGET_RELEASE_CHANNEL_REPO\%\%/${{ env.RYUJINX_TARGET_RELEASE_CHANNEL_SOURCE_REPO }}/g;' src/Ryujinx.Common/ReleaseInformation.cs
sed -r --in-place 's/\%\%RYUJINX_CONFIG_FILE_NAME\%\%/Config\.json/g;' src/Ryujinx.Common/ReleaseInformation.cs
shell: bash

Expand Down Expand Up @@ -227,7 +228,7 @@ jobs:
sed -r --in-place 's/\%\%RYUJINX_BUILD_GIT_HASH\%\%/${{ steps.version_info.outputs.git_short_hash }}/g;' src/Ryujinx.Common/ReleaseInformation.cs
sed -r --in-place 's/\%\%RYUJINX_TARGET_RELEASE_CHANNEL_NAME\%\%/${{ env.RYUJINX_TARGET_RELEASE_CHANNEL_NAME }}/g;' src/Ryujinx.Common/ReleaseInformation.cs
sed -r --in-place 's/\%\%RYUJINX_TARGET_RELEASE_CHANNEL_OWNER\%\%/${{ env.RYUJINX_TARGET_RELEASE_CHANNEL_OWNER }}/g;' src/Ryujinx.Common/ReleaseInformation.cs
sed -r --in-place 's/\%\%RYUJINX_TARGET_RELEASE_CHANNEL_REPO\%\%/${{ env.RYUJINX_TARGET_RELEASE_CHANNEL_REPO }}/g;' src/Ryujinx.Common/ReleaseInformation.cs
sed -r --in-place 's/\%\%RYUJINX_TARGET_RELEASE_CHANNEL_REPO\%\%/${{ env.RYUJINX_TARGET_RELEASE_CHANNEL_SOURCE_REPO }}/g;' src/Ryujinx.Common/ReleaseInformation.cs
sed -r --in-place 's/\%\%RYUJINX_CONFIG_FILE_NAME\%\%/Config\.json/g;' src/Ryujinx.Common/ReleaseInformation.cs
shell: bash

Expand Down
2 changes: 1 addition & 1 deletion src/Ryujinx.Common/Logging/Targets/FileLogTarget.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public static FileStream PrepareLogFile(string path)
}

// Clean up old logs, should only keep 3
FileInfo[] files = logDir.GetFiles("*.log").OrderBy((info => info.CreationTime)).ToArray();
FileInfo[] files = logDir.GetFiles("*.log").OrderBy(info => info.CreationTime).ToArray();
for (int i = 0; i < files.Length - 2; i++)
{
try
Expand Down
143 changes: 54 additions & 89 deletions src/Ryujinx.UI.Common/Configuration/LoggerModule.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
using Ryujinx.Common;
using Ryujinx.Common.Configuration;
using Ryujinx.Common.Logging;
using Ryujinx.Common.Logging.Targets;
Expand All @@ -11,103 +10,69 @@ public static class LoggerModule
{
public static void Initialize()
{
ConfigurationState.Instance.Logger.EnableDebug.Event += ReloadEnableDebug;
ConfigurationState.Instance.Logger.EnableStub.Event += ReloadEnableStub;
ConfigurationState.Instance.Logger.EnableInfo.Event += ReloadEnableInfo;
ConfigurationState.Instance.Logger.EnableWarn.Event += ReloadEnableWarning;
ConfigurationState.Instance.Logger.EnableError.Event += ReloadEnableError;
ConfigurationState.Instance.Logger.EnableTrace.Event += ReloadEnableTrace;
ConfigurationState.Instance.Logger.EnableGuest.Event += ReloadEnableGuest;
ConfigurationState.Instance.Logger.EnableFsAccessLog.Event += ReloadEnableFsAccessLog;
ConfigurationState.Instance.Logger.FilteredClasses.Event += ReloadFilteredClasses;
ConfigurationState.Instance.Logger.EnableFileLog.Event += ReloadFileLogger;
}

private static void ReloadEnableDebug(object sender, ReactiveEventArgs<bool> e)
{
Logger.SetEnable(LogLevel.Debug, e.NewValue);
}

private static void ReloadEnableStub(object sender, ReactiveEventArgs<bool> e)
{
Logger.SetEnable(LogLevel.Stub, e.NewValue);
}

private static void ReloadEnableInfo(object sender, ReactiveEventArgs<bool> e)
{
Logger.SetEnable(LogLevel.Info, e.NewValue);
}

private static void ReloadEnableWarning(object sender, ReactiveEventArgs<bool> e)
{
Logger.SetEnable(LogLevel.Warning, e.NewValue);
}

private static void ReloadEnableError(object sender, ReactiveEventArgs<bool> e)
{
Logger.SetEnable(LogLevel.Error, e.NewValue);
}

private static void ReloadEnableTrace(object sender, ReactiveEventArgs<bool> e)
{
Logger.SetEnable(LogLevel.Trace, e.NewValue);
}

private static void ReloadEnableGuest(object sender, ReactiveEventArgs<bool> e)
{
Logger.SetEnable(LogLevel.Guest, e.NewValue);
}

private static void ReloadEnableFsAccessLog(object sender, ReactiveEventArgs<bool> e)
{
Logger.SetEnable(LogLevel.AccessLog, e.NewValue);
}

private static void ReloadFilteredClasses(object sender, ReactiveEventArgs<LogClass[]> e)
{
bool noFilter = e.NewValue.Length == 0;

foreach (var logClass in Enum.GetValues<LogClass>())
{
Logger.SetEnable(logClass, noFilter);
}

foreach (var logClass in e.NewValue)
{
Logger.SetEnable(logClass, true);
}
}

private static void ReloadFileLogger(object sender, ReactiveEventArgs<bool> e)
{
if (e.NewValue)
ConfigurationState.Instance.Logger.EnableDebug.Event +=
(_, e) => Logger.SetEnable(LogLevel.Debug, e.NewValue);
ConfigurationState.Instance.Logger.EnableStub.Event +=
(_, e) => Logger.SetEnable(LogLevel.Stub, e.NewValue);
ConfigurationState.Instance.Logger.EnableInfo.Event +=
(_, e) => Logger.SetEnable(LogLevel.Info, e.NewValue);
ConfigurationState.Instance.Logger.EnableWarn.Event +=
(_, e) => Logger.SetEnable(LogLevel.Warning, e.NewValue);
ConfigurationState.Instance.Logger.EnableError.Event +=
(_, e) => Logger.SetEnable(LogLevel.Error, e.NewValue);
ConfigurationState.Instance.Logger.EnableTrace.Event +=

This comment has been minimized.

Copy link
@gr3ger

gr3ger Nov 11, 2024

Contributor

You might have made a mistake here.
Was trying to find out why I always got gigabyte sized log files, and noticed that "Trace" was always enabled no matter the configuration, unsure if this is the cause.

ConfigurationState.Instance.Logger.EnableTrace.Event += 
    (_, e) => Logger.SetEnable(LogLevel.Error, e.NewValue);

should be

ConfigurationState.Instance.Logger.EnableTrace.Event += 
    (_, e) => Logger.SetEnable(LogLevel.Trace, e.NewValue);

This comment has been minimized.

Copy link
@gr3ger

gr3ger Nov 11, 2024

Contributor

Confirmed that this was the issue. I'll make a fork and PR shortly.

(_, e) => Logger.SetEnable(LogLevel.Error, e.NewValue);
ConfigurationState.Instance.Logger.EnableGuest.Event +=
(_, e) => Logger.SetEnable(LogLevel.Guest, e.NewValue);
ConfigurationState.Instance.Logger.EnableFsAccessLog.Event +=
(_, e) => Logger.SetEnable(LogLevel.AccessLog, e.NewValue);

ConfigurationState.Instance.Logger.FilteredClasses.Event += (_, e) =>
{
string logDir = AppDataManager.LogsDirPath;
FileStream logFile = null;
bool noFilter = e.NewValue.Length == 0;

if (!string.IsNullOrEmpty(logDir))
foreach (var logClass in Enum.GetValues<LogClass>())
{
logFile = FileLogTarget.PrepareLogFile(logDir);
Logger.SetEnable(logClass, noFilter);
}

if (logFile == null)
foreach (var logClass in e.NewValue)
{
Logger.Error?.Print(LogClass.Application, "No writable log directory available. Make sure either the Logs directory, Application Data, or the Ryujinx directory is writable.");
Logger.RemoveTarget("file");

return;
Logger.SetEnable(logClass, true);
}
};

Logger.AddTarget(new AsyncLogTargetWrapper(
new FileLogTarget("file", logFile),
1000,
AsyncLogTargetOverflowAction.Block
));
}
else
ConfigurationState.Instance.Logger.EnableFileLog.Event += (_, e) =>
{
Logger.RemoveTarget("file");
}
if (e.NewValue)
{
string logDir = AppDataManager.LogsDirPath;
FileStream logFile = null;

if (!string.IsNullOrEmpty(logDir))
{
logFile = FileLogTarget.PrepareLogFile(logDir);
}

if (logFile == null)
{
Logger.Error?.Print(LogClass.Application,
"No writable log directory available. Make sure either the Logs directory, Application Data, or the Ryujinx directory is writable.");
Logger.RemoveTarget("file");

return;
}

Logger.AddTarget(new AsyncLogTargetWrapper(
new FileLogTarget("file", logFile),
1000
));
}
else
{
Logger.RemoveTarget("file");
}
};
}
}
}
10 changes: 7 additions & 3 deletions src/Ryujinx.UI.Common/DiscordIntegrationModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,13 @@ public static class DiscordIntegrationModule
{
public static Timestamps StartedAt { get; set; }

private static readonly string _description = ReleaseInformation.IsValid
? $"v{ReleaseInformation.Version} {ReleaseInformation.ReleaseChannelOwner}/{ReleaseInformation.ReleaseChannelRepo}@{ReleaseInformation.BuildGitHash}"
: "dev build";
private static string VersionString
=> (ReleaseInformation.IsCanaryBuild ? "Canary " : string.Empty) + $"v{ReleaseInformation.Version}";

private static readonly string _description =
ReleaseInformation.IsValid
? $"{VersionString} {ReleaseInformation.ReleaseChannelOwner}/{ReleaseInformation.ReleaseChannelRepo}@{ReleaseInformation.BuildGitHash}"
: "dev build";

private const string ApplicationId = "1293250299716173864";

Expand Down

0 comments on commit 79ba9d1

Please sign in to comment.