Skip to content

fix: initialize Steam with configurable AppID#12

Merged
veeeanti merged 5 commits into
UnionCrax-Team:mainfrom
NakHalal:fix/custom-appid-config
May 9, 2026
Merged

fix: initialize Steam with configurable AppID#12
veeeanti merged 5 commits into
UnionCrax-Team:mainfrom
NakHalal:fix/custom-appid-config

Conversation

@NakHalal

@NakHalal NakHalal commented Apr 25, 2026

Copy link
Copy Markdown
Contributor

Summary

This PR updates the launcher to initialize Steam with a configurable AppID, launch the configured game executable, and keep Steam callbacks running until the user presses Enter.

Current behavior

  • The launcher reads the Steam app id from the canonical AppID key in config.ini.
  • AppID defaults to 480 (Spacewar) in newly generated configs.
  • SteamAppId and SteamGameId environment variables are set only when the configured AppID is nonzero.
  • steam_appid.txt is created at the configured SteamAppIdFile path before Steam initialization.
  • If a game executable is configured and exists, a best-effort steam_appid.txt copy is also written next to the game executable.
  • Game executable paths are resolved relative to the launcher when they are not absolute.
  • If Steam requests a relaunch through SteamAPI_RestartAppIfNecessary(), the launcher exits successfully with a clear restart message.
  • After launching the game, the launcher keeps Steam callbacks running and exits when Enter is pressed.

Error handling

  • Missing or invalid AppID values no longer cause SteamAppId=0 / SteamGameId=0 to be exported.
  • Failure to write the configured steam_appid.txt path fails initialization with a clear error.
  • Failure to write the optional game-directory steam_appid.txt copy is logged as a warning and does not block launch.
  • Steam initialization failures show the configured AppID and suggest using AppID=480 when ownership is the likely issue.

Files changed

File Current role
include/ini_config.hpp Exposes config accessors, including SteamAppIdFile
include/uc_online.hpp 32-bit launcher interface, restart state, appid file status reporting
include/uc_online64.hpp 64-bit launcher interface, restart state, appid file status reporting
src/ini_config.cpp Reads/writes canonical AppID, generates default config, stores SteamAppIdFile
src/main.cpp 32-bit launcher entry point, restart handling, game launch, Enter-key callback loop
src/main64.cpp 64-bit launcher entry point, restart handling, game launch, Enter-key callback loop
src/uc_online.cpp 32-bit Steam initialization, env var setup, appid file creation, game launch path resolution
src/uc_online64.cpp 64-bit Steam initialization, env var setup, appid file creation, game launch path resolution

Testing

  • cmake --build "build64" --config Release
  • cmake --build "build32" --config Release

Both builds pass locally.

- Fix readme limitation: appid was forced to 480, now configurable via config.ini with clear error when appid requires ownership
- Restore SteamAPI_InitEx call that was removed by uncommitted changes, leaving the launcher unable to connect to Steam at all
- Replace broken 5s timeout with Enter-key polling via GetAsyncKeyState so the launcher exits on user request
- Create steam_appid.txt in both launcher and game directories, fix LaunchGame relative path resolution
- Target: launcher
@NakHalal NakHalal force-pushed the fix/custom-appid-config branch from e2d335e to 1be5011 Compare April 25, 2026 19:50
- Consistently use AppID instead of AppId across GetAppID(), SetAppID(), default config key, and comments
- Target: config
@NakHalal NakHalal force-pushed the fix/custom-appid-config branch 2 times, most recently from d53bb99 to 38dc8aa Compare April 25, 2026 19:58
- Avoid setting SteamAppId/SteamGameId when AppID is 0 so the launcher only writes env vars for valid app IDs.
- Target: root
@NakHalal NakHalal force-pushed the fix/custom-appid-config branch from 38dc8aa to ae184cb Compare April 25, 2026 20:00
- Treat Steam restart requests as a successful relaunch path so init failures are not reported when Steam intends to restart the app.
- Target: root
- Make appid file creation fail fast for the configured file while treating the optional game-directory copy as non-fatal, so initialization surfaces real write errors without breaking the fallback path.
- Target: root
@NakHalal NakHalal changed the title fix: restore Steam init, configurable AppId, Enter-key exit fix: restore Steam init, configurable AppID, Enter-key exit Apr 25, 2026
@NakHalal NakHalal changed the title fix: restore Steam init, configurable AppID, Enter-key exit fix: initialize Steam with configurable AppID Apr 25, 2026
@veeeanti

veeeanti commented May 4, 2026

Copy link
Copy Markdown
Member

Whoa, holy shit, thank you!! I'm sorry I didn't see this at all,give me a moment to see what you did and merge

@NakHalal

NakHalal commented May 6, 2026

Copy link
Copy Markdown
Contributor Author

Whoa, holy shit, thank you!! I'm sorry I didn't see this at all, give me a moment to see what you did and merge

No problem! You don’t have to merge all of them if you don’t want to. I mostly made these changes because I tried using uc-online2, but it didn’t work with the game I wanted to test.

When I checked both uc-online and uc-online2, neither of them had a configurable AppID feature, so I made those changes. It works now, and Steam shows the game as intended, but sadly the game still can’t be played online. I’m not sure why.

@veeeanti

veeeanti commented May 9, 2026

Copy link
Copy Markdown
Member

When I checked both uc-online and uc-online2, neither of them had a configurable AppID feature,

That's not the case for uc-online2, it has one - but 480 is the default for when it's either set to 0 or isn't set at all. It's controlled by an ini, there's more in the readme though.

@veeeanti veeeanti merged commit 19ef75b into UnionCrax-Team:main May 9, 2026
1 check passed
@NakHalal

Copy link
Copy Markdown
Contributor Author

When I checked both uc-online and uc-online2, neither of them had a configurable AppID feature,

That's not the case for uc-online2, it has one - but 480 is the default for when it's either set to 0 or isn't set at all. It's controlled by an ini, there's more in the readme though.

Oh mybad, I tried with SW5 game but the game wont launch i think i misconfigured it or something

PS: the latest build after commit is failed

@veeeanti

Copy link
Copy Markdown
Member

PS: the latest build after commit is failed

I noticed that, i'll look more into why that happened even though it worked fine in the test before merging, shits weird lol

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants