Super Mecha Crows - server kit for Super Mecha Champions
========================================================

In short: start the game once without the kit and let it update until it says it can't
connect. Close it, unzip this folder, double-click Install-SMC.cmd, click Yes when Windows
asks, then start the game from Steam again and pick the server SMC-Steam-US.

NetEase switched off the servers for Super Mecha Champions, so the game on Steam has nothing
to connect to any more. Super Mecha Crows is a fan-run replacement server. This kit makes your
copy of the game connect to the Crows server instead. The game itself stays as it is.

Time needed: about two minutes.
Need help? Write to smc-help@horsecock.art and attach a photo or screenshot of what you see.


BEFORE YOU START
----------------
You need:

  - Super Mecha Champions installed through Steam, and fully updated. To update it, start the
    game once WITHOUT the kit and let it download every update until it says it can't
    connect. Then close the game. Do this before you install the kit: an update that runs
    after the kit can undo it.
  - Steam running and logged in. The game still logs in through your Steam account.
  - Windows 10 or 11.

Unzip the kit first: right-click the zip file, choose "Extract All...", and open the new folder.
Double-clicking inside the zip window does not work.


INSTALL
-------
1. Close the game if it is open. (It should have finished updating first; see above.)

2. Double-click  Install-SMC.cmd

   A black window opens and reports each step. Two pop-ups may appear:

   - A blue box, "Windows protected your PC". Click "More info", then "Run anyway".
     Windows shows this for any program it has not seen before.

   - "Do you want to allow this app to make changes to your device?" for Windows PowerShell.
     Click Yes. This is for the one change outside the game folder (the hosts file, see below).

   The window ends with "Done." Press any key to close it.

3. Start Super Mecha Champions from Steam as usual.

   On the login screen, pick the server SMC-Steam-US. The first time, the game asks you to
   make a character. After that you land in the lobby.

The game stays a normal Steam game: same shortcut, same Steam account, no extra launcher.


IF SOMETHING GOES WRONG
-----------------------
The black window shows red text.
   Read it. It says what is wrong and what to do. Fix that, then double-click Install-SMC.cmd
   again. Running it more than once is safe.

The window says a game file is missing or is not the expected one.
   In Steam: right-click Super Mecha Champions > Properties > Installed Files > "Verify
   integrity of game files". Wait until it finishes, then run Install-SMC.cmd again.

The game starts but shows a gray screen, or closes after half a minute.
   Windows Security has probably removed the game's video player (a file called
   MLiveCCPlayer.dll) or stopped the game from writing its own files. Double-click
   Allow-SMC-Defender.cmd. It asks for permission once, brings the file back, and tells
   Windows Security to leave the game folder alone. Then start the game again.
   If you use another antivirus program, add the game folder to its exceptions yourself.

The game loops on the login screen, or the text is suddenly Chinese.
   Steam was not running, or not logged in, when the game started. Close the game, start
   Steam and log in, then start the game again.

The game says it cannot connect, or waits forever on the login screen.
   Either the server is down, or the hosts file change did not stick (some antivirus programs
   guard that file). Ask at smc-help@horsecock.art whether the server is up. If it is, run
   Install-SMC.cmd again and click Yes when Windows asks.

Anything else.
   Send a photo or screenshot of the black window to smc-help@horsecock.art. The game also
   writes a log to  <game folder>\package\log.txt  and that file helps too.


UPDATING THE KIT
----------------
The server only takes the current kit. When the game says on login that the client version is
outdated, download the kit again from the download page and double-click Install-SMC.cmd again.
Running it over an older kit is safe: it swaps in the new script and keeps everything else. Your
account and progress stay.

The game must start through Steam, with the files Steam installed. Copies that start without
Steam, or with a replaced Steam file, are refused. Kits repackaged by other people are not ours.


UNDO
----
Double-click  Uninstall-SMC.cmd  (it asks for permission once).
Every file goes back to how it was, and the game has nothing to connect to again.


WHAT THE INSTALLER CHANGES, EXACTLY
-----------------------------------
Three things. Each one is backed up first, and the uninstaller puts all three back.

1. One file in the game folder:  package\patch_npk\p_script.npk
   This is the game's own update file. NetEase used it to ship game updates, and the game
   reads it every time it starts. The installer adds two entries to it and leaves everything
   that was already in it as it was. Backup: p_script.npk.orig, in the same folder.
   What the two entries are is explained in the next section.

2. One file in the game folder:  package\Documents\cacert.pem
   The game's list of trusted certificates, the same idea as the padlock in a browser. The
   Crows server's certificate (ca.crt in this kit) is added at the end, so the game accepts
   the server's web address. Backup: cacert.pem.orig.

3. One Windows file:  C:\Windows\System32\drivers\etc\hosts
   The game has NetEase's web addresses built in, with no setting to change them. The hosts
   file is where Windows lets you say where an address leads. The installer adds a marked
   block that sends those NetEase addresses (the list is in hostnames.txt) to the Crows
   server. Everything else in the file stays. Backup: hosts.smc-backup, in the same folder.
   This is the step that needs the permission prompt.

   While the block is there, any program on this PC that tries one of those NetEase addresses
   reaches the Crows server instead. As far as we know no program other than the game uses
   them, but you should know it applies to the whole PC.

Nothing is installed anywhere else. No program keeps running in the background. Steam and
your Steam account are not touched.


THE TWO ENTRIES
---------------
The game only talks to a server that can prove it is NetEase's, using a key that only NetEase
had. NetEase's servers are gone, so out of the box the game refuses every server. The fix is
to give the game the Crows server's key. The installer does that like this:

  1. It copies the game's own connection script (a part called ConnectHelper) out of your
     game's main script file, package\script.npk, and stores that copy in p_script.npk under
     a second name, ConnectHelper_original. The copy is not changed.

  2. It adds our script under the name ConnectHelper. That script is revival-ConnectHelper.py
     in this kit, and you can open it in Notepad. When the game starts, it loads the original,
     puts in the Crows server's key, and writes one line to package\log.txt so you can see it
     was active:

        [REVIVAL] ConnectHelper override active, gate key swapped

Our script reads no files, sends nothing anywhere and changes nothing else. The key is a
public key: it lets the game check who the server is, and cannot unlock or read anything on
your PC.

Because the game's own script is copied from your PC, this kit contains no game files at all.
Only the files listed at the bottom.


WHAT THE SERVER SEES
--------------------
The server receives your Steam ID and what you do in the game: your character's name, your
matches, your chat. It never receives your Steam password. The game's built-in reporting
(crash reports and usage logs it used to send to NetEase) now goes to the Crows server too,
because those addresses are in the hosts block.


FILES IN THIS KIT
-----------------
README.txt                  this file
Install-SMC.cmd             double-click to install (it runs Install-SMC.ps1)
Uninstall-SMC.cmd           double-click to undo everything
Install-SMC.ps1             the installer. A plain text file with an explanation at every step:
                            open it in Notepad to read exactly what it does.
Allow-SMC-Defender.cmd      only if Windows Security removed game files or blocks the game.
Allow-SMC-Defender.ps1      Brings the files back and adds the game folder to the exceptions.
revival-ConnectHelper.py    the one game script we add, in readable form
revival-ConnectHelper.nxs   the same script in the game's own compiled format. This is what
                            gets installed.
ca.crt                      the Crows server's certificate
hostnames.txt               the NetEase web addresses that the hosts block sends to the server
server.txt                  the server's address. If it ever changes, put the new one in here
                            and run Install-SMC.cmd again.
