Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor internals of CelesteTAS #91

Open
wants to merge 84 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
84 commits
Select commit Hold shift + click to select a range
366802c
feat: Setup the JetBrains.Annotations package
psyGamer Jul 21, 2024
8997ad8
refactor: Start refactor of Manager / InputController
psyGamer Aug 7, 2024
3c72b5e
refactor: Fix some issues with input handling
psyGamer Aug 7, 2024
db04978
refactor: Re-add fast-forwards
psyGamer Aug 7, 2024
f0baa9c
refactor: Fix some playback issues
psyGamer Aug 7, 2024
dee2265
refactor: Re-add command support
psyGamer Aug 7, 2024
ace413d
refactor: Send current TAS-state to studio
psyGamer Aug 7, 2024
9fe7b12
refactor: Remove Celeste v1.3.1.2 support
psyGamer Aug 8, 2024
c732520
refactor: Remove old disabled code
psyGamer Aug 8, 2024
e67054a
refactor: Upgrade to MonoMod reorg
psyGamer Aug 8, 2024
3dd8adc
refactor: Rework how SaveAndQuitReenter command works
psyGamer Aug 13, 2024
348c031
refactor: Fix some more playback issues
psyGamer Aug 13, 2024
460090b
refactor: Fix many TODOs caused by the refactor, re-adding save-state…
psyGamer Aug 16, 2024
bcfa2c8
fix: Compilation errors caused by refactor
psyGamer Oct 28, 2024
cad238a
docs: Fix AnalogMode.Precise documentation
psyGamer Oct 28, 2024
04605b7
refactor: Start refactoring custom infos / related commands
psyGamer Aug 16, 2024
f1ba4fe
refactor: Set-command for new info templating
psyGamer Aug 16, 2024
25a3356
refactor: Invoke-command for new info templating
psyGamer Aug 16, 2024
41ae390
style: New-line at end of files
psyGamer Oct 28, 2024
95c8217
refactor: Fix a few issues and remove old Set/Invoke command code
psyGamer Aug 16, 2024
136f914
refactor: Rename InfoTemplate to TargetQuery
psyGamer Oct 28, 2024
6e8a8d0
refactor: Custom Info to use target-query
psyGamer Oct 28, 2024
4cb2dcb
refactor: Re-add formatting to custom info
psyGamer Oct 28, 2024
f97d38c
refactor: Re-add Lua support
psyGamer Oct 28, 2024
68c9073
feat: Get/Set/Invoke support for components
psyGamer Oct 28, 2024
e64358f
refactor: Fully replace old InfoCustom
psyGamer Oct 28, 2024
0bd7137
Merge branch 'master' into refactor
psyGamer Dec 14, 2024
8cee539
refactor: Use a dedicated type for subpixel positions
psyGamer Dec 14, 2024
7852cc2
refactor: Various tweaks for TAS Helper
psyGamer Dec 14, 2024
54349c2
feat: Add EmitStaticDelegate helper method
psyGamer Dec 15, 2024
2436d3f
style: Enable nullable across the entire project
psyGamer Dec 15, 2024
aead1c6
Merge pull request #2 from EverestAPI/refactor
LozenChen Dec 16, 2024
7c3bcc7
fix: Some issues with hook changes
psyGamer Dec 16, 2024
ef435fc
tweak: Collect methods from other mods as well
psyGamer Dec 16, 2024
1274e7f
Merge pull request #3 from EverestAPI/refactor
LozenChen Dec 29, 2024
8f48cba
refactor: various tweaks for TAS Helper
LozenChen Dec 29, 2024
9addd12
Merge branch 'master' into refactor
psyGamer Dec 30, 2024
1720f21
fix: Crash by loading types of optional dependencies
psyGamer Dec 30, 2024
2ca9870
fix: Separate collection of CelesteTAS and global invocation-attributes
psyGamer Dec 30, 2024
5eec268
fix: Method signature assertions when hooking
psyGamer Dec 30, 2024
9640435
refactor: Replace DefaultButtonBinding2 with DefaultButtonBinding
psyGamer Dec 30, 2024
2c404c1
ci: Bump .NET version to 9
psyGamer Dec 30, 2024
872c7a7
chore: Bump lib-stripped to Everest v1.5105.0
psyGamer Dec 30, 2024
d029544
Merge branch 'refactor' of https://github.com/LozenChen/CelesteTAS-Ev…
LozenChen Dec 31, 2024
51a02d4
refactor: various tweaks for TAS Helper
LozenChen Dec 31, 2024
c971303
merge tas helper console enhancement
LozenChen Dec 31, 2024
4740979
refactor: support TAS Helper predictor
LozenChen Dec 31, 2024
9ecb9a7
merge tas helper better invincible
LozenChen Dec 31, 2024
56a9e4e
fix: Featherline submodule
psyGamer Dec 31, 2024
8703654
refactor: Better-Invincible mode
psyGamer Dec 31, 2024
8e7537b
refactor: Provide proper API for mods to define custom settings-resto…
psyGamer Dec 31, 2024
7e7efca
refactor: Remove CenterCamera.CenterCameraPosition export
psyGamer Dec 31, 2024
c2c5acb
refactor: Merge ActualEntityCollideHitbox and ActualPlayerCollideHitb…
psyGamer Dec 31, 2024
ab2bf20
refactor: Info HUD entity watching
psyGamer Dec 31, 2024
d72c66d
provide chinese description for better invincible
LozenChen Dec 31, 2024
ba04397
some tweaks to make tas helper compile
LozenChen Dec 31, 2024
76613fd
tweak: Method naming and drop TAS Helper settings migration
psyGamer Jan 1, 2025
10506d2
feat: Allow opening debug-console during TAS
psyGamer Jan 1, 2025
431cf50
feat: Hide unimportant trigger hitboxes
psyGamer Jan 1, 2025
6454557
feat: Use unique color for camera triggers
psyGamer Jan 1, 2025
bfbaa1c
fix: Code hot-reloading support
psyGamer Jan 1, 2025
3ff6768
feat: Hide unimportant trigger-like entities as well
psyGamer Jan 1, 2025
3bfbd11
fix: Hide remaining unimportant variant changes
psyGamer Jan 1, 2025
38b8ea2
Merge pull request #94 from LozenChen/refactor
psyGamer Jan 1, 2025
3bb151e
fix: Save-stating every frame before the breakpoint
psyGamer Jan 1, 2025
e99cb4a
refactor: Perform UpdateMeta call every real-time frame
psyGamer Jan 1, 2025
41008b7
refactor: Hotkey system to work in real-time
psyGamer Jan 1, 2025
4076971
fix: Playback control issues
psyGamer Jan 1, 2025
5a502be
feat: Repeat hotkeys when holding them
psyGamer Jan 1, 2025
4c0b118
feat: Re-add right thumb-stick speed control
psyGamer Jan 1, 2025
15b9486
fix: DefaultButtonBindings not being applied while loading hotkeys
psyGamer Jan 1, 2025
87929dc
fix: "--tas" CLI argument not working
psyGamer Jan 1, 2025
bdb6681
fix: Enum types for target queries not being supported
psyGamer Jan 1, 2025
59e8aa0
fix: Analog inputs without an angle
psyGamer Jan 1, 2025
b5bc582
refactor: Re-add CompleteInfo command with comments
psyGamer Jan 2, 2025
27f1534
fix: Hotkeys being re-initialized when starting a TAS
psyGamer Jan 2, 2025
12270a5
refactor: Format Custom-Info with tables and collections
psyGamer Jan 3, 2025
e41911c
fix: Properly format string in Custom-Info
psyGamer Jan 3, 2025
8ac391d
fix: Set/Invoke commands targeting components
psyGamer Jan 3, 2025
752f054
fix: Account for AbstractExtendedVariantTrigger<T> triggers
psyGamer Jan 3, 2025
1edad78
feat: Hide camera triggers while not showing camera hitbox
psyGamer Jan 3, 2025
7c7ee23
tweak: Avoid deleting and re-creating symlinks on each build
psyGamer Jan 3, 2025
fb74560
fix: Remove duplicate trigger-hitbox check
psyGamer Jan 3, 2025
92f693c
fix: Studio-installation with nested archive from GitHub Actions
psyGamer Jan 3, 2025
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
18 changes: 17 additions & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -118,12 +118,28 @@ csharp_style_prefer_readonly_struct = true
csharp_style_prefer_readonly_struct_member = true

# Code-block preferences
csharp_prefer_braces = false:silent
csharp_prefer_braces = true:suggestion
csharp_prefer_simple_using_statement = true
csharp_style_namespace_declarations = file_scoped
csharp_style_prefer_method_group_conversion = true
csharp_style_prefer_primary_constructors = true
csharp_style_prefer_top_level_statements = true
resharper_braces_for_ifelse = required
resharper_braces_for_dowhile = required
resharper_braces_for_fixed = required
resharper_braces_for_for = required
resharper_braces_for_foreach = required
resharper_braces_for_lock = required
resharper_braces_for_using = required
resharper_braces_for_while = required
resharper_enforce_if_statement_braces_highlighting = suggestion
resharper_enforce_dowhile_statement_braces_highlighting = required
resharper_enforce_fixed_statement_braces_highlighting = required
resharper_enforce_for_statement_braces_highlighting = required
resharper_enforce_foreach_statement_braces_highlighting = required
resharper_enforce_lock_statement_braces_highlighting = required
resharper_enforce_using_statement_braces_highlighting = required
resharper_enforce_while_statement_braces_highlighting = required

# Expression-level preferences
csharp_prefer_simple_default_expression = true
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/Build.CelesteStudio.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0'
dotnet-version: '9.0'

- name: Set version suffix (release)
run: sed -i "s/-dev//" Studio/CelesteStudio/Studio.cs
Expand Down Expand Up @@ -69,7 +69,7 @@ jobs:
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0'
dotnet-version: '9.0'

- name: Set version suffix (release)
run: sed -i "s/-dev//" Studio/CelesteStudio/Studio.cs
Expand Down Expand Up @@ -118,7 +118,7 @@ jobs:
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0'
dotnet-version: '9.0'
- name: Install macOS workflow
run: dotnet workload install macos
- name: Switch XCode
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/Build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0'
dotnet-version: '9.0'

- name: Download Studio builds
uses: actions/download-artifact@v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/Release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ jobs:
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0'
dotnet-version: '9.0'
- name: Setup Python
uses: actions/[email protected]
with:
Expand Down
24 changes: 16 additions & 8 deletions CelesteTAS-EverestInterop/CelesteTAS-EverestInterop.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<RootNamespace>TAS</RootNamespace>
<TargetFramework>net7.0</TargetFramework>
<LangVersion>latest</LangVersion>
<Nullable>enable</Nullable>

<CelestePrefix Condition="'$(CelestePrefix)' == '' And Exists('../../../Celeste.dll')">../../..</CelestePrefix>
<CelestePrefix Condition="'$(CelestePrefix)' == ''">lib-stripped</CelestePrefix>
Expand All @@ -28,21 +29,24 @@

<ItemGroup>
<Reference Include="$(CelestePrefix)\Celeste.dll" Publicize="true" />
<Reference Include="$(CelestePrefix)\FNA.dll" />
<Reference Include="$(CelestePrefix)\FNA.dll" Publicize="true" />
<Reference Include="$(CelestePrefix)\MMHOOK_Celeste.dll" />

<Reference Include="lib-stripped\SpeedrunTool.dll" />
<Reference Include="lib-stripped\TASRecorder.dll" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="MonoMod.RuntimeDetour" Version="22.01.04.03" />
<PackageReference Include="CelesteAnalyzer" Version="*" />

<PackageReference Include="MonoMod.RuntimeDetour" Version="25.0.2" />
<PackageReference Include="BepInEx.AssemblyPublicizer.MSBuild" Version="0.4.1" PrivateAssets="all" />

<PackageReference Include="SharpZipLib" Version="1.4.2" IncludeAssets="all" />
<PackageReference Include="YamlDotNet" Version="13.1.1" />

<PackageReference Include="JetBrains.Profiler.Api" Version="1.1.8" Condition="'$(Configuration)' == 'Debug'" />
<PackageReference Include="JetBrains.Annotations" Version="2024.2.0" />
<PackageReference Include="JetBrains.Profiler.Api" Version="1.4.6" Condition="'$(Configuration)' == 'Debug'" />
</ItemGroup>

<!-- Assemblies -->
Expand All @@ -54,18 +58,22 @@

<Copy SourceFiles="$(OutputPath)ICSharpCode.SharpZipLib.dll" DestinationFolder="..\bin" />
<Copy SourceFiles="$(OutputPath)MemoryPack.Core.dll" DestinationFolder="..\bin" />

<Copy SourceFiles="$(OutputPath)JetBrains.Profiler.Api.dll" DestinationFolder="..\bin" Condition="'$(Configuration)' == 'Debug'" />
<Copy SourceFiles="$(OutputPath)JetBrains.HabitatDetector.dll" DestinationFolder="..\bin" Condition="'$(Configuration)' == 'Debug'" />
<Copy SourceFiles="$(OutputPath)JetBrains.FormatRipper.dll" DestinationFolder="..\bin" Condition="'$(Configuration)' == 'Debug'" />
</Target>

<!-- Assets (use symlinks in debug builds on POSIX, since MSBuild is useless) -->
<!-- Assets (use symlinks in debug builds - only on UNIX, since MSBuild is useless) -->
<Target Name="LinkAssets" AfterTargets="Build" Condition="'$(Configuration)' == 'Debug' and '$(OS)' == 'Unix' and $(UseSymlinks) != false">
<Copy SourceFiles="" DestinationFiles="..\bin\env.lua" UseSymboliclinksIfPossible="true" />

<Exec Command="rm -rf ../bin/env.lua &amp;&amp; ln -s CelesteTAS-EverestInterop/Source/EverestInterop/Lua/env.lua ../bin/env.lua"/>
<Exec Command="rm -rf ../bin/env.lua &amp;&amp; ln -s ../CelesteTAS-EverestInterop/Source/EverestInterop/Lua/env.lua ../bin/env.lua"/>

<Exec Command="rm -rf ../everest.yaml &amp;&amp; ln -s CelesteTAS-EverestInterop/everest.yaml ../everest.yaml"/>
<Exec Command="rm -rf ../Dialog &amp;&amp; ln -s CelesteTAS-EverestInterop/Dialog ../Dialog"/>
<Exec Command="rm -rf ../Graphics &amp;&amp; ln -s CelesteTAS-EverestInterop/Graphics ../Graphics"/>
<!-- Replace with symlinks if they aren't already -->
<Exec Command="if [ ! -L ../everest.yaml ]; then rm -rf ../everest.yaml &amp;&amp; ln -s CelesteTAS-EverestInterop/everest.yaml ../everest.yaml; fi"/>
<Exec Command="if [ ! -L ../Dialog ]; then rm -rf ../Dialog &amp;&amp; ln -s CelesteTAS-EverestInterop/Dialog ../Dialog; fi"/>
<Exec Command="if [ ! -L ../Graphics ]; then rm -rf ../Graphics &amp;&amp; ln -s CelesteTAS-EverestInterop/Graphics ../Graphics; fi"/>
</Target>
<Target Name="CopyAssets" AfterTargets="Build" Condition="'$(Configuration)' != 'Debug' or '$(OS)' != 'Unix' or $(UseSymlinks) == false">
<ItemGroup>
Expand Down
5 changes: 5 additions & 0 deletions CelesteTAS-EverestInterop/Dialog/English.txt
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,11 @@ TAS_RESTORE_SETTINGS= Restore All Settings when TAS Stop
TAS_LAUNCH_STUDIO_AT_BOOT= Launch Studio at Boot
TAS_ATTEMPT_TO_CONNECT_TO_STUDIO= Attempt To Connect To Studio
TAS_SHOW_STUDIO_UPDATE_BANNER= Show Studio Update Banner
TAS_OPEN_CONSOLE_IN_TAS= Allow Opening Console in TAS
TAS_SCROLLABLE_HISTORY_LOG= Scrollable Console History Log
TAS_BETTER_INVINCIBILITY= Better Invincibility
TAS_BETTER_INVINCIBLE_DESCRIPTION= Running "Set Invincible true" will still prevent dying, but avoids gameplay changes like bouncing of the death plane,{n}
to avoid accidentally desyncing the TAS. Applies only while a TAS is active.
TAS_HIDE_FREEZE_FRAMES= Hide Freeze Frames during TAS
TAS_HIDE_FREEZE_FRAMES_DESCRIPTION_1=When a freeze frame is encountered, run it and continue to the next frame
TAS_HIDE_FREEZE_FRAMES_DESCRIPTION_2=before rendering. Applies only while a TAS is active.
Expand Down
5 changes: 5 additions & 0 deletions CelesteTAS-EverestInterop/Dialog/Simplified Chinese.txt
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,11 @@ TAS_CENTER_CAMERA_HORIZONTALLY_ONLY= 镜头只水平居中
TAS_RESTORE_SETTINGS= TAS 停止时恢复所有设置
TAS_LAUNCH_STUDIO_AT_BOOT= 启动游戏时打开 Studio
TAS_ATTEMPT_TO_CONNECT_TO_STUDIO= 尝试连接 Studio
TAS_OPEN_CONSOLE_IN_TAS= 允许在 TAS 中打开控制台
TAS_SCROLLABLE_HISTORY_LOG= 可滚动的控制台历史记录
TAS_BETTER_INVINCIBILITY= 更好的无敌
TAS_BETTER_INVINCIBLE_DESCRIPTION= 运行 "Set Invincible true" 既会阻止死亡, 同时也会避免例如在掉落致死时自动弹跳的游戏物理变化,{n}
从而避免 TAS 意外 desync. 仅在 TAS 运行期间生效.
TAS_HIDE_FREEZE_FRAMES= TAS 时跳过冻结帧
TAS_HIDE_FREEZE_FRAMES_DESCRIPTION_1=运行到冻结帧时自动跳过进入下一帧
TAS_HIDE_FREEZE_FRAMES_DESCRIPTION_2=仅在 TAS 时启用
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@
using StudioCommunication.Util;
using TAS.EverestInterop;
using TAS.EverestInterop.InfoHUD;
using TAS.InfoHUD;
using TAS.Input;
using TAS.Input.Commands;
using TAS.ModInterop;
using TAS.Module;
using TAS.Utils;

#nullable enable

namespace TAS.Communication;

public sealed class CommunicationAdapterCeleste() : CommunicationAdapterBase(Location.Celeste) {
Expand All @@ -28,7 +28,7 @@ protected override void FullReset() {
protected override void OnConnectionChanged() {
if (Connected) {
// Stall until input initialized to avoid sending invalid hotkey data
while (Hotkeys.KeysDict == null) {
while (Hotkeys.AllHotkeys == null) {
Thread.Sleep(UpdateRate);
}

Expand All @@ -44,15 +44,15 @@ protected override void HandleMessage(MessageID messageId, BinaryReader reader)
string path = reader.ReadString();
LogVerbose($"Received message FilePath: '{path}'");

InputController.StudioTasFilePath = path;
Manager.AddMainThreadAction(() => Manager.Controller.FilePath = path);
break;

case MessageID.Hotkey:
var hotkey = (HotkeyID)reader.ReadByte();
bool released = reader.ReadBoolean();
LogVerbose($"Received message Hotkey: {hotkey} ({(released ? "released" : "pressed")})");

Hotkeys.KeysDict[hotkey].OverrideCheck = !released;
Hotkeys.AllHotkeys[hotkey].OverrideCheck = !released;
break;

case MessageID.SetCustomInfoTemplate:
Expand Down Expand Up @@ -82,7 +82,6 @@ protected override void HandleMessage(MessageID messageId, BinaryReader reader)
object? arg = gameDataType switch {
GameDataType.ConsoleCommand => reader.ReadBoolean(),
GameDataType.SettingValue => reader.ReadString(),
GameDataType.RawInfo => reader.ReadObject<(string, bool)>(),
GameDataType.CommandHash => reader.ReadObject<(string, string[], string, int)>(),
_ => null,
};
Expand Down Expand Up @@ -114,9 +113,6 @@ protected override void HandleMessage(MessageID messageId, BinaryReader reader)
case GameDataType.CustomInfoTemplate:
gameData = !string.IsNullOrWhiteSpace(TasSettings.InfoCustomTemplate) ? TasSettings.InfoCustomTemplate : string.Empty;
break;
case GameDataType.RawInfo:
gameData = InfoCustom.GetRawInfo(((string, bool))arg!);
break;
case GameDataType.GameState:
gameData = GameData.GetGameState();
break;
Expand Down Expand Up @@ -158,18 +154,14 @@ protected override void HandleMessage(MessageID messageId, BinaryReader reader)
writer.Write((string?)gameData ?? string.Empty);
break;

case GameDataType.RawInfo:
writer.WriteObject(gameData);
break;

case GameDataType.GameState:
writer.WriteObject((GameState?)gameData);
break;

case GameDataType.CommandHash:
writer.Write((int)gameData!);
break;

case GameDataType.LevelInfo:
writer.WriteObject((LevelInfo)gameData!);
break;
Expand Down Expand Up @@ -317,42 +309,45 @@ public void WriteCommandList(CommandInfo[] commands) {
}

private void ProcessRecordTAS(string fileName) {
if (!TASRecorderUtils.Installed) {
if (!TASRecorderInterop.Installed) {
WriteRecordingFailed(RecordingFailedReason.TASRecorderNotInstalled);
return;
}
if (!TASRecorderUtils.FFmpegInstalled) {
if (!TASRecorderInterop.FFmpegInstalled) {
WriteRecordingFailed(RecordingFailedReason.FFmpegNotInstalled);
return;
}

Manager.Controller.RefreshInputs(enableRun: true);
if (RecordingCommand.RecordingTimes.IsNotEmpty()) {
AbortTas("Can't use StartRecording/StopRecording with \"Record TAS\"");
return;
}
Manager.NextStates |= States.Enable;
Manager.AddMainThreadAction(() => {
Manager.Controller.RefreshInputs();
if (RecordingCommand.RecordingTimes.IsNotEmpty()) {
AbortTas("Can't use StartRecording/StopRecording with \"Record TAS\"");
return;
}
Manager.EnableRun();

int totalFrames = Manager.Controller.Inputs.Count;
if (totalFrames <= 0) return;
int totalFrames = Manager.Controller.Inputs.Count;
if (totalFrames <= 0) return;

TASRecorderUtils.StartRecording(fileName);
TASRecorderUtils.SetDurationEstimate(totalFrames);
TASRecorderInterop.StartRecording(fileName);
TASRecorderInterop.SetDurationEstimate(totalFrames);

if (!Manager.Controller.Commands.TryGetValue(0, out var commands)) {
return;
}
bool startsWithConsoleLoad = commands.Any(c =>
c.Is("Console") &&
c.Args.Length >= 1 &&
ConsoleCommand.LoadCommandRegex.Match(c.Args[0].ToLower()) is { Success: true });

if (startsWithConsoleLoad) {
// Restart the music when we enter the level
Audio.SetMusic(null, startPlaying: false, allowFadeOut: false);
Audio.SetAmbience(null, startPlaying: false);
Audio.BusStopAll(Buses.GAMEPLAY, immediate: true);
}
if (!Manager.Controller.Commands.TryGetValue(0, out var commands)) {
return;
}

bool startsWithConsoleLoad = commands.Any(c =>
c.Attribute.Name.Equals("Console", StringComparison.OrdinalIgnoreCase) &&
c.Args.Length >= 1 &&
ConsoleCommand.LoadCommandRegex.Match(c.Args[0].ToLower()) is {Success: true});

if (startsWithConsoleLoad) {
// Restart the music when we enter the level
Audio.SetMusic(null, startPlaying: false, allowFadeOut: false);
Audio.SetAmbience(null, startPlaying: false);
Audio.BusStopAll(Buses.GAMEPLAY, immediate: true);
}
});
}

protected override void LogInfo(string message) => Logger.Log(LogLevel.Info, "CelesteTAS/StudioCom", message);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public static void SendCurrentBindings() {
return;
}

Dictionary<int, List<int>> nativeBindings = Hotkeys.KeysInteractWithStudio.ToDictionary(pair => (int) pair.Key, pair => pair.Value.Cast<int>().ToList());
Dictionary<int, List<int>> nativeBindings = Hotkeys.StudioHotkeys.ToDictionary(pair => (int) pair.Key, pair => pair.Value.Cast<int>().ToList());
comm.WriteCurrentBindings(nativeBindings);
}
public static void SendRecordingFailed(RecordingFailedReason reason) {
Expand Down
24 changes: 10 additions & 14 deletions CelesteTAS-EverestInterop/Source/EverestInterop/AreaCompleteInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
using StudioCommunication;
using TAS.Input;
using TAS.Input.Commands;
using TAS.ModInterop;
using TAS.Module;
using TAS.Utils;
using Comment = TAS.Input.Comment;
Expand All @@ -18,7 +19,7 @@ namespace TAS.EverestInterop;

public static class AreaCompleteInfo {
private class Meta : ITasCommandMeta {
public string Insert => $"CompleteInfo{CommandInfo.Separator}[0;A 1]";
public string Insert => $"CompleteInfo{CommandInfo.Separator}[0;A{CommandInfo.Separator}1]";
public bool HasArguments => true;
}

Expand Down Expand Up @@ -176,25 +177,20 @@ private static void CompleteInfoCommand(CommandLine commandLine, int studioLine,
key = new AreaKey(id, mode).ToString();
}

if (!completeInfos.TryGetValue(key, out StringBuilder info)) {
if (!completeInfos.TryGetValue(key, out var info)) {
completeInfos[key] = info = new StringBuilder();
}

info.Clear();
if (Manager.Controller.Comments.TryGetValue(filePath, out List<Comment> comments)) {

if (Manager.Controller.CurrentComments is { Count: > 0 } comments) {
bool firstComment = true;
foreach (Comment comment in comments.Where(c => c.Line > fileLine)) {
if (fileLine + 1 == comment.Line) {
if (!firstComment) {
info.AppendLine();
}

firstComment = false;
info.Append($"{comment.Text}");
fileLine++;
} else {
break;
foreach (var comment in comments) {
if (!firstComment) {
info.AppendLine();
}

info.AppendLine(comment.Text);
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions CelesteTAS-EverestInterop/Source/EverestInterop/AutoMute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ private static readonly IDictionary<WeakReference<EventInstance>, int>

private static bool settingMusic;
private static bool hasMuted;
private static bool ShouldBeMuted => Manager.FrameLoops >= 2 && !settingMusic;
private static bool FrameStep => Manager.Running && (Manager.States & States.FrameStep) != 0;
private static bool ShouldBeMuted => Manager.PlaybackSpeed >= 2.0f && !settingMusic;
private static bool FrameStep => Manager.CurrState == Manager.State.Paused;
private static WeakReference<EventInstance> dummy;

private static EventInstance DummyEventInstance {
Expand Down Expand Up @@ -197,4 +197,4 @@ private static void CelesteOnUpdate(On.Celeste.Celeste.orig_Update orig, Celeste
}
}
}
}
}
Loading
Loading