aboutsummaryrefslogtreecommitdiff
path: root/src/sst.c
Commit message (Collapse)AuthorAgeFilesLines
* Fix the infamous Swamp Fever "god mode glitch"Gravatar Hayden K 2025-04-071-0/+1
| | | | | | | | | | | | | | | | | | Turns out this was fixed in version 2112 (October 2012), so it was fairly easy to isolate in Ghidra (I had previously thought this was fixed by TLS). The CDirector::FinaleEscapeState member is used in CDirector::IsFinaleWon (and maybe another function, I don't remember). Prior to Valve's fix, the value was never reset to 0 after finishing a campaign, so when the Swamp (or Crash Course) "minifinale" events ran, the game would behave as though the player was entering the end-of-finale cutscene and block votes, make players invincible etc. 2112 fixed this bug by setting the member back to 0 in CDirector::Reset, so here we just set it to 0 when quickreset is used, since that is essentially the recommended way to start a run at this point. Now co-op hosts won't need to restart their game after finishing a campaign anymore!
* Remove years from copyright headersGravatar Michael Smith 2025-04-071-1/+1
| | | | | | | | They're legally unnecessary as far as I know, and kind of annoying to maintain on a long-term basis. This was done with the consent of all 3 other contributors, in case anyone was wondering.
* Fix quickreset not working on L4D1 ApartmentsGravatar Hayden K 2025-04-071-0/+1
| | | | | | Confusingly, the old matchmaking interface refers to No Mercy as apartments (plural), but refers to the first level as apartment (singular). Good meme.
* Write the update notes for 0.9Gravatar Michael Smith 2025-04-061-1/+12
|
* Inform users of incorrect usage of plugin_unloadGravatar Michael Smith 2025-04-061-1/+20
|
* Use C23 void-argument-free prototypesGravatar Michael Smith 2025-04-061-8/+8
| | | | | | | In the future we can also consider moving to {} instead of {0} for initialisers, but my old Clang (16) doesn't support this, so it might be wise to wait longer on that one so people don't need too bleeding-edge of a compiler just to build this thing.
* Rewrite and redesign codegen and feature systemGravatar Michael Smith 2025-04-061-8/+30
| | | | | | | | | | | | | | | | | | | | | | | | | Also switch to somewhat proper C23 flags while we're at it. This is a huge change. It took me forever, in between being really busy. Sorry about that. But the good news is I'm now free to start integrating the various patches that have accumulated since last release. Well, at least in between still being really busy. Gotta manage expectations. The main benefit of introducing GAMESPECIFIC() is that features that don't apply to a particular game no longer show up *at all*, and less time is wasted on init. It also enables a cool optimisation wherein unnecessary REQUIRE_GAMEDATA() checks can elided at compile time whenever the gamedata is known up-front to always exist in supported games. The DEF_FEAT_CVAR macro family meanwhile makes it easier to manage the lifecycle of cvars/ccmds, with less manual registering, unhiding and such. Originally I was going to try and just hack these features into the existing codegen abomination, but it just got too terrible. This rewrite should make it easier to continue tweaking codegen behaviour in future. It also has slightly better error messages.
* Fix an include-what-you-use omissionGravatar Michael Smith 2024-09-081-0/+1
|
* Add very basic client console messaging for L4D2Gravatar Michael Smith 2024-08-291-2/+0
| | | | | | | | This isn't totally ideal - it'd be nice to have a way to get colours working, at least for errors/warnings. But it might not really be possible to do that without custom networking stuff, so this will do for the forseeable future. The main goal is just to be able to have CON_SERVERSIDE commands actually give output to the relevant player.
* Begin the new version cycle yet again at 0.9Gravatar Michael Smith 2024-08-261-3/+3
|
* Add the one update note to release again, alreadyv0.8-BETAGravatar Michael Smith 2024-08-261-1/+1
|
* Bump version to 0.8 for next releaseGravatar Michael Smith 2024-08-261-5/+3
|
* Add update notes and bump zip version for releasev0.7-BETAGravatar Michael Smith 2024-08-261-1/+3
|
* Revise syntax macros and add a ton of branch hintsGravatar Michael Smith 2024-08-231-39/+40
| | | | | | | | | My new programming style is branch hints. All non-confusing branches must be hinted when I can be bothered. It's faster, sometimes, maybe. Also, start trying to use more signed sizes in at least some of the places where it makes sense. Unsigned sizes are surprisingly error-prone!
* Rework OS abstractionsGravatar Michael Smith 2024-08-221-34/+48
| | | | | | | | | | | | | | | | | | | | | | - As much as possible avoid dragging system headers into translation units. This should avoid namespace pollution and, hopefully, speed up builds a little bit. - Avoid leaning on the UCRT so much on Windows - prefer native win32 calls and native file handles except where doing so is inconvenient (in particular, for stat(), which we might try and replace later). - Also, switch from SystemFunction036 to ProcessPrng on Windows. This requires us to generate a stub for bcryptprimitives.dll because Microsoft haven't bothered to provide a link library, but the function is better-documented and seems to be a more direct under-the-hood call as well. Apparently it's what's used by the major web browsers these days, which seems like a good indication it's stable and trusted. - Lastly, remove a bunch of functions and macros and stuff that weren't actually being used. It seems good to try and keep the scope of OS-dependent stuff relatively contained and only add to it when actually required.
* Bump the version to 0.7, ahead of next releaseGravatar Michael Smith 2024-08-051-10/+3
|
* Prepare a changelog for next releaseGravatar Michael Smith 2024-05-221-1/+8
|
* Add temporary plugin version identifier to demosGravatar Michael Smith 2024-05-211-1/+11
| | | | | | | | | | | | I've resisted doing this for a long time but it's getting to the point where blocking a release indefinitely is a real problem, and this satisfies the original request from some leaderboard people to just make SST identifiable in some way or another. It means the demo stuff can happen at whatever pace it happens at and other stuff can happen independently. Less stress and sadness. Of course, it'll only be kept in as long as required, but there'll be no rush to get rid of it for any particular release either.
* Fix CPlugin ABI on newer L4D2 versionsGravatar Michael Smith 2023-11-261-8/+24
| | | | | Thanks bill for spotting this issue. It was causing crashes on unload, which is obviously no good.
* Perform very minor load/unload optimisationsGravatar Michael Smith 2023-08-301-13/+11
| | | | Because why not.
* Get things at least compiling under LinuxGravatar Michael Smith 2023-08-271-9/+35
| | | | | | | | | | | Nothing really works yet, but at least test.h and fastspin are fixed and some of the issues with RTTI and libdl and stuff are maybe kind of sorted, subject to more testing later. The main issue now seems to be the cvar interface not quite lining up and crashing pretty much immediately. That'll probably take a lot more debugging to figure out, which likely still won't be a priority for quite a while.
* Make various preparations for upcoming featuresGravatar Michael Smith 2023-08-021-39/+70
| | | | | | | | | | | | | | | | | | | | | | A lot of this is random WIP from a while back, at least a month ago, and is being committed now to get it out of the way so that other patches can be brought in and integrated against it without causing headaches. Also rolled into this commit is a way to distinguish plugin_unload from exiting the game. This is required for another soon-to-be-integrated feature to avoid crashing on exit, and could in theory also be used to speed up unloading on exit in future. While we're at it, this also avoids the need to linearly scan through the plugin list to do the old branch unloading fix, because we can. Rough summary of the other smaller stuff I can remember doing: - Rework bitbuf a bit - Add some cryptographic nonsense in ac.c (not final at all) - Introduce the first couple of "chunklets" libraries as a sort-of subproject of this one - Tidy up random small bits and bobs - Add source for a small keypair generation tool - Rework democustom to be very marginally more useful
* Fix VDF creation for old branchesGravatar Michael Smith 2023-08-021-1/+7
| | | | Absolutely no idea how long this has been broken for!
* Bump version to 0.6 and reset changelog stringGravatar Michael Smith 2023-06-121-11/+1
|
* Remove the terrible gameinfo.txt garbage at lastGravatar Michael Smith 2023-06-121-45/+70
| | | | | | This also tidies up library handle grabbing with more os.h stuff, and improves the VDF creation logic - since we no longer store a couple of paths which makes it necessary to change that a bit anyway.
* Add update changelog and bump zip dateGravatar Michael Smith 2023-06-101-1/+11
| | | | | | The zip date is tomorrow as that's the expected release date pending some testing and hearing back from Portal people re official approval for use in runs. With any luck it won't need to be bumped further.
* Prune some comments and tidy up other minor thingsGravatar Michael Smith 2023-06-101-17/+11
|
* Adapt vote reset code into fast campaign resettingGravatar Michael Smith 2023-06-031-36/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | This is kind of a breaking change but the other code was obviously never released or relied on by anyone - it will be pushed at the same time as this in fact. It still seems worth having the original committed separately to show the progression of development of the feature, however. Technically the standalone vote cooldown resetting could also be added back if ever desired however there doesn't seem to be that much of a use case for that at the moment. This feature ought to be a lot more convenient now as it allows for resetting back to a set starting point no matter where the player is in a run. It isn't universally useful as All Campaigns Legacy solo runs require switching to a different type of server and Main Campaigns co-op runs require restarting the game after Swamp Fever to work around the god mode bug, however it is still useful in a good few situations. Unfortunately this turned out to be pretty complex to implement, first requiring a bunch of interop with valve's rather wacky KeyValues stuff, and then requiring a bunch of especially difficult reverse engineering of L4D1 v1.0.0.5 because it doesn't use said KeyValues stuff and does something else completely different instead. A side effect of all this work is that the nag removal hack is now part of the KeyValues stuff in kvsys.c, which is kind of a comfier place for it than just kind of dumped in the middle of sst.c.
* Improve os_dlfile() interfaceGravatar Michael Smith 2023-05-211-1/+1
| | | | | | Might as well return the length since we have it anyway. Also this maybe fixes the totally busted Linux code but it's still untested and probably doesn't work for reasons that will be discovered later on.
* Add a hack for features to distinguish VDF loadingGravatar Michael Smith 2023-05-171-0/+3
|
* Do some pedantic spring cleaningGravatar Michael Smith 2023-05-161-22/+1
| | | | | | | | | | | | | | | | | | | | | | | - Use const in more places where it makes sense - not absolutely everywhere because it can get a bit annoying - Make all the instruction search loops a bit more readable by casting the function pointer into a temporary variable to loop over - Add a few more doc comments and fix a typo or two - Make that RTTI thing flexibly-sized, finally - Don't include gamedata.h in vcall.h for no reason; consequently include gamedata.h in a bunch of places where it was implictly pulled in before - Fix dbg_toghidra() and ent_getedict() having mismatched return types between their headers and respective source files - Remove that one broken, hacky, secret Portal non-feature that probably nobody even ended up using; it can be implemented properly later if required
* Refactor the RGBA colour struct into engineapi.hGravatar Michael Smith 2023-05-041-5/+3
| | | | | | In both the engine and SST it's used in more places than just console printing, so it makes more sense to give it a more appropriate nanme and location.
* Fix deferred init for Portal 2 compatibilityGravatar Michael Smith 2023-01-151-28/+22
| | | | Thanks Bill for figuring out what the problem was.
* Add basic mouse input scalingGravatar Michael Smith 2022-12-251-32/+31
|
* Fix some lingering idiocyGravatar Michael Smith 2022-09-131-1/+0
| | | | | | Thanks Aciidz for pointing out the strings with no newline in them, and thanks Clang for warning me I wasn't using a function for ages while I was too lazy to delete it.
* Move towards C23, improve events and vcall macrosGravatar Michael Smith 2022-09-131-9/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | Another big one. Here's a list of things: - Since the upcoming C23 standardises typeof(), use it as an extension for the time being in order to allow passing arbitrary types as macro/codegen parameters. It wouldn't have been a big leap to do this even without standardisation since it's apparently an easy extension to implement - and also, to be honest, this project is essentially glued to Clang anyway so who cares. - Likewise, bool, true and false are becoming pre-defined, so pre-pre-define them now in order to get the benefit of not having to remember one header everywhere. - Really ungodly/amazing vcall macro stuff now allows us to call C++ virtual functions like regular C functions. It's pretty cool! - Events can now take arbitrary parameters and come in two types: regular events and predicates. All this makes the base code even uglier but makes the feature implementation nicer. In other words, it places more of the cognitive burden on myself and less on other people who might want to contribute. This is a good tradeoff, because I'm a genius.
* Add magical feature codegen system, at long lastGravatar Michael Smith 2022-08-101-54/+16
|
* Add event systemGravatar Michael Smith 2022-07-231-1/+7
|
* Split custom demo data into its own file/featureGravatar Michael Smith 2022-07-231-3/+3
| | | | Copyright note: the stuff Bill wrote is all still in the other file.
* Add stuff to track keypressesGravatar Willian Henrique 2022-07-231-1/+1
| | | | | | Committer's note: this is somewhat adapted from Bill's original code, written a while back, but he gets full credit for actually doing the hard part.
* Add keybind lookup codeGravatar Michael Smith 2022-07-231-1/+3
| | | | Also centralise NEXT_INSN macro, into its own header at least for now.
* Add alias management plus input filtering skeletonGravatar Michael Smith 2022-07-231-2/+7
| | | | | Some of the alias stuff was kind of stolen from earlier figuring-out Bill did. More Bill code is also on the way. :^)
* Add update detection, clean up minor stuffGravatar Michael Smith 2022-06-271-0/+28
|
* Solve the error logging situationGravatar Michael Smith 2022-06-021-18/+18
|
* Add basic Portal crosshair colour customisationGravatar Michael Smith 2022-05-301-4/+5
| | | | | | | | | | | Currently only works in 3420 and 5135 and uses hardcoded offsets with a byte pattern sanity check. Future work includes making it more widely compatible, and also doing the crazy thing I wanted to do but gave up on wherein the actual textures and stuff get patched in memory to sync up all the colours. Oh also, a couple of vtables were erroneously made executable, so I went ahead and fixed that while I was at it.
* Remove some dodgy whitespaceGravatar Michael Smith 2022-05-261-1/+1
|
* Fix wonky comparisons in CreateInterfaceGravatar Michael Smith 2022-05-251-1/+1
| | | | | A stupid, stupid bug I'd probably never have caught for years and years. Thanks Evan Lin in the Portal Discord for pointing it out!
* Properly solve load order issues via deferred initGravatar Michael Smith 2022-05-191-43/+86
|
* Add a quick stopgap hack for Portal purposesGravatar Michael Smith 2022-05-191-0/+24
| | | | | | | | | | People want to be able to write a scheduled-release passphrase to demos to prove that said demos were recorded during a timeboxed event. Ideally this is something that'd be part of the custom demo data and general RTA run management stuff that's planned, but of course that doesn't exist yet. When it does exist, we'd probably want rid of this nonsense, so it's marked hidden and I don't plan to document it anywhere "official." It's just here for people who really need it in the short term.
* Rerun L4D1 console spam fix after config loadingGravatar Michael Smith 2022-05-121-0/+16
| | | | | | This was the simplest way I could think of to solve this issue. Thanks again Aciidz for pointing the issue out, and thanks Turtle Rock for shipping such a broken game.