Skip to content

Instantly share code, notes, and snippets.

@JoinedSenses
JoinedSenses / parsetargetpath.sp
Created November 16, 2019 19:43 — forked from assyrianic/parsetargetpath.sp
parses a target path
public bool ParseTargetPath(const char[] key, char[] buffer, int buffer_len)
{
/// parse something like: "root.section1.section2.section3.\\..dotsection"
int i = strlen(key) - 1;
while( i > 0 ) {
/// Patch: allow keys to use dot without interfering with dot path.
/// check if we hit a dot.
if( key[i]=='.' ) {
/// if we hit a dot, check if the previous char is an "escape" char.
if( key[i-1]=='\\' )
@JoinedSenses
JoinedSenses / bsp_lzma.py
Created August 3, 2019 10:08 — forked from nosoop/bsp_lzma.py
Unpacking LZMA-compressed files from BSPs
#!/usr/bin/python3
import struct, lzma, sys
def unpack(fmt, stream):
'''
unpacks values from a stream
source: https://stackoverflow.com/a/17537253
'''
size = struct.calcsize(fmt)