Skip to content

Instantly share code, notes, and snippets.

View ProdigySim's full-sized avatar

Michael Busby ProdigySim

View GitHub Profile
// build a safe, comparable string from a semver!
function semver(str) {
const bits = str.split('.');
const padLength = 1 + Math.max(...bits.map(s => s.length));
return bits.map(s => s.padStart(padLength, '0')).join('');
}
@ProdigySim
ProdigySim / fake_hook_impl.ts
Created July 1, 2019 18:48
Here's my naiive assumption of how hooks are implemented.
let global_currentHooks: object[] | null = null;
let global_currentHookIndex: number | null = null;
function getNextHook() {
return global_currentHooks![global_currentHookIndex!];
}
const state = new Map();
@ProdigySim
ProdigySim / fix-amplify-jank.sh
Created July 15, 2019 17:31
Some junk that nobody should have to use
#!/bin/bash
## aws-amplify-react-native uses a weird export syntax that breaks our jest/babel config:
## https://github.com/aws-amplify/amplify-js/issues/2686
## https://github.com/aws-amplify/amplify-js/pull/3102
## This fix just edits those files to use a more normal syntax.
function fix_imports() {
@ProdigySim
ProdigySim / moment-timezone-test.js
Last active June 26, 2020 22:27
Add 1 Day is timezone sensitive in moment
function addDayTest(day, tz) {
const start = moment.tz(day, 'YYYY-MM-DD', tz);
const plusDay = start.clone().add(1, 'day'); // Next calendar day at same time.
const plusHours = start.clone().add(24, 'hours'); // 24 hours in the future.
return {
start: start.valueOf() / 1000,
plusDay: plusDay.valueOf() / 1000,
plusHours: plusHours.valueOf() / 1000,
diff: (plusHours - plusDay) / 1000, // How different are "1 day" and "24 hours"?
};
@ProdigySim
ProdigySim / hooks-transpilation-demo.tsx
Last active August 7, 2020 14:57
Thinking about making hooks a language generic feature supported by transpilation
// Stateful object used to track hook execution order
class HookStack {
private stack: unknown[]
private stackPtr: number = 0;
private isInitialStack: boolean;
constructor(stackMemo?: unknown[]) {
if (stackMemo) {
this.stack = [...stackMemo];
this.isInitialStack = true;
sm_cvarlist /file
--------------
_autosave : cmd : : Autosave
_autosavedangerous : cmd : : AutoSaveDangerous
_bugreporter_restart : cmd : : Restarts bug reporter .dll
_fov : 0 : , "cl", "launcher" : Automates fov command to server.
_record : cmd : , "norecord" : Record a demo incrementally.
_resetgamestats : cmd : , "sv" : Erases current game stats and writes out a blank stats file
_restart : cmd : : Shutdown and restart the engine.
achievement_debug : 0 : , "cheat", "rep", "cl" : Turn on achievement debug msgs.
sm_cvarlist /file
--------------
_autosave : cmd : : Autosave
_autosavedangerous : cmd : : AutoSaveDangerous
_bugreporter_restart : cmd : : Restarts bug reporter .dll
_fov : 0 : , "cl", "launcher" : Automates fov command to server.
_record : cmd : , "norecord" : Record a demo incrementally.
_resetgamestats : cmd : , "sv" : Erases current game stats and writes out a blank stats file
_restart : cmd : : Shutdown and restart the engine.
achievement_debug : 0 : , "cheat", "rep", "cl" : Turn on achievement debug msgs.
@ProdigySim
ProdigySim / hidden_cvars.txt
Created August 29, 2020 15:08
hidden client cvars from 2041 dump l4d2
_fov : 0 : , "cl", "launcher" : Automates fov command to server.
achievement_evaluate : cmd : , "cl", "launcher" : <internal name> Causes failable achievement to be evaluated
achievement_mark_dirty : cmd : , "cl", "launcher" : Mark achievement data as dirty
achievement_notification_test : cmd : , "cheat", "cl", "launcher" : Test the hud notification UI
achievement_reset : cmd : , "cl", "launcher" : <internal name> Clears specified achievement
achievement_reset_all : cmd : , "cl", "launcher" : Clears all achievements
achievement_status : cmd : , "cl", "launcher" : Shows status of all achievement
achievement_test_clan_count : cmd : , "cl", "launcher" : Determines if specified # of teammates belong to same clan w/local player
achievement_test_friend_count : cmd : , "cl", "launcher" : Counts the #
@ProdigySim
ProdigySim / 1.l4d2-2200-gamedata-fixes.md
Last active April 6, 2025 03:43
L4D2 2.2.0.0 gamedata fixes

Introduction

SirPlease and ProdigySim were allowed early access to the Last Stand beta to check mod compatibility. We have been working on testing some sourcemod extensions and plugins, as well as reverse engineering some of the server code to discover necessary GameData changes.

These are the high level results of our investigations. Be aware that the server binaries could change up to the release day an these may no be perfectly accurate. I hope these will be a helpful starting point and/or reference for other plugin makers who are validating their gamedata and patches.

Breaking Changes

CBaseEntity Vtable

CBaseEntity vtable has a new member:

  • Linux: 14 CBaseEntity::ScriptGetModelName(void)const
void CGameclient::ExecuteStringcommand() {
double now = getRealTime();
int maxCmdsPerSecond = sv_quota_stringcmdspersecond->GetInt();
if ( now - this->m_dLastCmdTime < 1.0 )
{
this->m_cmdQuotaCount = this->m_cmdQuotaCount + 1;
}
else
{
this->m_dLastCmdTime = now;