Skip to content

Commit

Permalink
Merge pull request #94 from LozenChen/refactor
Browse files Browse the repository at this point in the history
Various tweaks for TAS Helper, and merges from TAS Helper
  • Loading branch information
psyGamer authored Jan 1, 2025
2 parents 872c7a7 + 3bfbd11 commit 38b8ea2
Show file tree
Hide file tree
Showing 33 changed files with 1,304 additions and 757 deletions.
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,6 +10,7 @@
using StudioCommunication.Util;
using TAS.EverestInterop;
using TAS.EverestInterop.InfoHUD;
using TAS.InfoHUD;
using TAS.Input;
using TAS.Input.Commands;
using TAS.ModInterop;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@
using System.Collections.Generic;
using Celeste;
using Celeste.Mod;
using Microsoft.Xna.Framework.Input;
using Monocle;
using MonoMod.Cil;
using TAS.EverestInterop.InfoHUD;
using TAS.ModInterop;
using TAS.Module;
using TAS.Utils;
using TAS.InfoHUD;

namespace TAS.EverestInterop;

Expand All @@ -32,20 +33,54 @@ private static void InitializeHelperMethods() {

[Load]
private static void Load() {
IL.Monocle.Commands.Render += Commands_Render;
IL.Monocle.Commands.Render += IL_Commands_Render;
}

[Unload]
private static void Unload() {
IL.Monocle.Commands.Render -= Commands_Render;
IL.Monocle.Commands.Render -= IL_Commands_Render;
}

[EnableRun]
private static void CloseCommand() {
private static void EnableRun() {
// Auto-close at start. Can be opened manually again
Engine.Commands.Open = false;
}

private static void Commands_Render(ILContext il) {
internal static void UpdateMeta() {
if (!Manager.Running) {
return;
}

if (Engine.Commands.Open) {
Engine.Commands.UpdateOpen();
} else if (Engine.Commands.Enabled) {
Engine.Commands.UpdateClosed();
}
}

internal static void OpenConsole() {
if (!Manager.Running) {
return; // Only allow inside a TAS, since outside it's already handled
}
if (Engine.Commands.Open) {
return;
}

// Copied from Commands.UpdateClosed
Engine.Commands.Open = true;
Engine.Commands.currentState = Keyboard.GetState();
if (!Engine.Commands.installedListener) {
Engine.Commands.installedListener = true;
TextInput.OnInput += Engine.Commands.HandleChar;
}
if (!Engine.Commands.printedInfoMessage) {
Engine.Commands.Log("Use the 'help' command for a list of debug commands. Press Esc or use the 'q' command to close the console.");
Engine.Commands.printedInfoMessage = true;
}
}

private static void IL_Commands_Render(ILContext il) {
// Hijack string.Format("\n level: {0}, {1}", xObj, yObj)
new ILCursor(il).FindNext(out ILCursor[] found,
i => i.MatchLdstr("\n level: {0}, {1}"),
Expand Down
2 changes: 1 addition & 1 deletion CelesteTAS-EverestInterop/Source/EverestInterop/Core.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ private static void Load() {
IL.Monocle.Engine.Update += IL_Engine_Update;

typeof(GameInput)
.GetMethod(nameof(GameInput.UpdateGrab))
.GetMethod(nameof(GameInput.UpdateGrab))!
.SkipMethod(IsPaused);

// The original mod makes the MInput.Update call conditional and invokes UpdateInputs afterwards.
Expand Down

This file was deleted.

This file was deleted.

Loading

0 comments on commit 38b8ea2

Please sign in to comment.