Skip to content

Instantly share code, notes, and snippets.

@withmorten
withmorten / submerge.php
Last active August 21, 2016 13:58
merges duplicate lines in a subtitle file that are meant to be one with proper timings
<?php
define('SRT_STATE_SUBNUMBER', 0);
define('SRT_STATE_TIME', 1);
define('SRT_STATE_TEXT', 2);
define('SRT_STATE_BLANK', 3);
function parseSrt($lines) {
$subs = array();
$state = SRT_STATE_SUBNUMBER;
@withmorten
withmorten / frogger.CT
Last active August 16, 2016 16:40
frogger invincibility
<?xml version="1.0" encoding="utf-8"?>
<CheatTable CheatEngineTableVersion="18">
<CheatEntries>
<CheatEntry>
<ID>2</ID>
<Description>"infinite lives"</Description>
<LastState Value="1" Activated="0" RealAddress="0046B218"/>
<Color>80000008</Color>
<VariableType>4 Bytes</VariableType>
<Address>0046b218</Address>
@withmorten
withmorten / cod5ff.php
Last active February 18, 2017 03:01
cod5ff extract
<?php
const WAV_NEEDLE = "RIFF";
const WAVE = "WAVE";
const XWMA = "XWMA";
const FMT = "fmt ";
const DEFAULTPATH = "sound";
$ffdump = file_get_contents($argv[1]);
$lastpos = 0;
@withmorten
withmorten / parseffmpeg.php
Created July 9, 2016 13:33
for cod4/cod5 ff extraction
<?php
$handle = fopen("convertmorewavs.bat", "r");
$ffmpeg = array();
while($line = fgets($handle)) {
if(!in_array($line, $ffmpeg)) {
$ffmpeg[] = $line;
}
}
foreach($ffmpeg as $command) {
@withmorten
withmorten / cod4ff.php
Last active February 18, 2017 02:57
cod4ff extract
<?php
const WAV_NEEDLE = ".wav";
const WAV_PACKID = "feffffff";
const DEFAULTPATH = "sound";
$ffdump = file_get_contents($argv[1]);
$lastpos = 0;
$wav_pathid = hex2bin("FFFFFF");
$wavs = array();
@withmorten
withmorten / stdin.bat
Last active August 27, 2017 16:48
drag & drop input parser
@echo off
setlocal disableDelayedExpansion
set args=%*
set "dragDrop="
set aac=0
setlocal enableDelayedExpansion
set "cmd=!cmdcmdline!"
set "cmd2=!cmd:*%~f0=!"