Release checklist: no cheat console for players, Steam required, Steam's language wins when changed, menu links, head bob toggle

- The cheat console opens only in the editor, a development build, or with -gcdev
- Without steam_appid.txt next to the exe, a failed Steam start says so and quits instead of running offline; -nosteam only works in our own builds
- A language picked in the game's Steam properties overrides the one saved in the game, if it changed since
- Main menu: language button, Steam page (overlay, else browser), feedback (Steam discussions); "early build" and the AppID gone from the footer
- Settings > Game: head bob on/off
- The cursor stays inside the window while it's free
- -resetsettings puts every setting back as it comes out of the box

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
NiemandKG
2026-11-17 18:45:17 +06:00
parent d97f2e844d
commit ad2154b38c
21 changed files with 311 additions and 191 deletions

View File

@ -36,7 +36,9 @@ namespace GrassCutter
DontDestroyOnLoad(gameObject);
Debug.Log("[Steam] initializing…");
if (CommandLine.Has("-nosteam")) { Debug.Log("[Steam] disabled by -nosteam"); return; }
// Only our own builds carry steam_appid.txt; a player's copy must run through Steam, which checks it's theirs.
bool devAppId = Application.isEditor || System.IO.File.Exists(System.IO.Path.Combine(System.IO.Path.GetDirectoryName(Application.dataPath) ?? ".", "steam_appid.txt"));
if (CommandLine.Has("-nosteam") && devAppId) { Debug.Log("[Steam] disabled by -nosteam"); return; }
if (!Packsize.Test()) Debug.LogError("[Steam] Packsize test failed — wrong Steamworks.NET platform binaries.");
if (!DllCheck.Test()) Debug.LogError("[Steam] DllCheck failed — steam_api64.dll mismatch.");
@ -46,7 +48,6 @@ namespace GrassCutter
#if !UNITY_EDITOR
// When launched outside Steam without steam_appid.txt this relaunches through Steam.
// Dev builds ship steam_appid.txt next to the exe, so skip the check entirely there.
bool devAppId = System.IO.File.Exists(System.IO.Path.Combine(System.IO.Path.GetDirectoryName(Application.dataPath) ?? ".", "steam_appid.txt"));
if (!devAppId && SteamAPI.RestartAppIfNecessary(new AppId_t(AppId)))
{
Debug.Log("[Steam] Relaunching through Steam");
@ -59,12 +60,14 @@ namespace GrassCutter
if (!Initialized)
{
Debug.LogWarning($"[Steam] Init failed ({res}): {err}. Is Steam running? Falling back to offline mode.");
if (!devAppId) NeedSteam();
return;
}
}
catch (DllNotFoundException e)
{
Debug.LogError("[Steam] steam_api64.dll not found: " + e.Message);
if (!devAppId) NeedSteam();
return;
}
@ -103,6 +106,45 @@ namespace GrassCutter
if (Initialized) SteamAPI.RunCallbacks();
}
public static string StoreUrl => $"https://store.steampowered.com/app/{AppId}/";
public static string FeedbackUrl => $"https://steamcommunity.com/app/{AppId}/discussions/";
/// <summary>The game's store page (wishlist, follow, review): in the Steam overlay, else the browser.</summary>
public static void OpenStore()
{
try
{
if (Initialized && SteamUtils.IsOverlayEnabled()) { SteamFriends.ActivateGameOverlayToStore(new AppId_t(AppId), EOverlayToStoreFlag.k_EOverlayToStoreFlag_None); return; }
}
catch (Exception) { }
Application.OpenURL(StoreUrl);
}
/// <summary>A page in the Steam overlay's browser, else the system's.</summary>
public static void OpenWeb(string url)
{
try
{
if (Initialized && SteamUtils.IsOverlayEnabled()) { SteamFriends.ActivateGameOverlayToWebPage(url); return; }
}
catch (Exception) { }
Application.OpenURL(url);
}
[System.Runtime.InteropServices.DllImport("user32.dll", CharSet = System.Runtime.InteropServices.CharSet.Unicode)]
static extern int MessageBoxW(IntPtr hWnd, string text, string caption, uint type);
/// <summary>The game isn't running through Steam (or Steam can't vouch for it): say so and close.</summary>
static void NeedSteam()
{
Debug.LogError("[Steam] not started through Steam: quitting");
#if UNITY_STANDALONE_WIN && !UNITY_EDITOR
try { MessageBoxW(IntPtr.Zero, Loc.T("Grass Cutters Together needs Steam. Start Steam, sign in to the account that owns the game, and launch it from your library."), "Grass Cutters Together", 0x30); }
catch (Exception) { }
#endif
Application.Quit();
}
void OnApplicationQuit()
{
Shutdown();