TSA layout engine: Refactor the final TextOut call into its own function.
Cleanup.
patch_update(): Return prematurely if a patch contains no "servers" object.

Avoids the misleading log message that was previously printed in that case.
Rename the "inet" functions and variables to "http".

Yup, we'd like to go multi-protocol.
ServerDownloadFile: Refactor the HTTP-specific code into its own function.
ServerDownloadFile: Fix potential memory leaks.
thcrap_update: Ensure graceful termination while an update is in progress.
Fix a potential buffer overflow when determining the .msg.jdiff slot key.

One of the few last fixed char arrays, and it was susceptible to a buffer overflow. Hooray.

... yes, I would redesign that format if I had the chance.
MSG patching: Advance the line counter in any case.

What a fucking mess this is.
MSG patching: Don't patch in invalid TSA ruby syntax due to utter plebbery.

Well, of COURSE we can't expect ZUN to apply BASIC PROGRAMMING PRINCIPLES to check the return values of that fucking strchr() calls he uses to get to his cute little absolute ruby positioning parameters. So we just got to do that for him! Or would we *really* want to binary hack that into every game anew? I certainly don't.

And don't tell me "well OK, the almighty ZUN got everything under his drunken control, and if it crashes, he knows where". This is a MINOR TEXT PARSER SYNTAX ISSUE, and if YOU tell ME that this should IN ANY WAY be a reason for a FATAL PROGRAM TERMINATION (especially in a fucking shmup where that kind of thing plays a rather minor role anyway), I just cannot take you seriously.

I can already imagine a future Touhou game where dialog is triggered by some rare condition, ZUN derps around and forgets that fucking comma, doesn't manage to fix the bug due to HURR DURR COMIKET DEADLINE AND ALREADY REACHED TIME QUOTA OF STAGE X, and then this issue stays unpatched until ZUN cured his fucking hangover from the fucking Comiket after-party.

Or in other words: Let someone audit your code, ZUN. Please.
MSG patching: Make the 'lines' key optional.

Time to get rid of this ancient wart.
MSG patching: Add a helper function to get the next instruction.