Skip to content

Instantly share code, notes, and snippets.

View ProdigySim's full-sized avatar

Michael Busby ProdigySim

View GitHub Profile
@ProdigySim
ProdigySim / enquirer-names-and-types.patch
Created April 25, 2022 16:31
First pass at enabling inferred names and types on output answers object for enquirer library
diff --git a/module-type-overrides/enquirer.d.ts b/module-type-overrides/enquirer.d.ts
index 27dee4e90..5172f0c5c 100644
--- a/module-type-overrides/enquirer.d.ts
+++ b/module-type-overrides/enquirer.d.ts
@@ -67,6 +67,21 @@ declare namespace Enquirer {
...args: ConstructorParameters<new (...args: any) => T>
) => T;
+ export function prompt<Name extends string, Q extends prompt.Question>(
+ question: Q & { name: Name }
/* TerrorNavArea::SpawnAttributeFromString(char const*) */
uint TerrorNavArea::SpawnAttributeFromString(char *param_1)
{
char cVar1;
int iVar2;
uint uVar3;
@ProdigySim
ProdigySim / sgspread_linux.asm
Last active January 13, 2021 20:48
Previous iteration of sgspread patch
0: 8d 8d 54 ff ff ff lea ecx,[ebp-0xac]
6: f3 0f 11 01 movss DWORD PTR [ecx],xmm0
a: 8b 55 20 mov edx,DWORD PTR [ebp+0x20]
d: 8b c4 mov eax,esp
f: 83 fa 04 cmp edx,0x4 ; "Bullet offset 0"
12: 7f 02 jg 0x16
14: eb 16 jmp 0x2c
16: 89 10 mov DWORD PTR [eax],edx
18: 01 38 add DWORD PTR [eax],edi
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;
@ProdigySim
ProdigySim / 1.l4d2-2200-gamedata-fixes.md
Last active April 30, 2023 18:18
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
@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 #
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 / 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;
@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"?
};