Skip to content

Instantly share code, notes, and snippets.

@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=!"
@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 / 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 / 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 / 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 / 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 / 1launcher_shockwave.bat
Last active November 1, 2016 02:35
custom c&c shockwave launcher
@echo off
set /P c=Do you want Superweapons? [Y/n]
if /I "%c%" NEQ "N" goto :launcher else goto :nosuperweapons
echo Launching Shockwave ...
echo.
:nosuperweapons
move !!!NoSuperWeaponsSHW.gib !!!NoSuperWeaponsSHW.big
@withmorten
withmorten / 2launcher_vanilla.bat
Last active November 1, 2016 02:35
custom c&c zero hour launcher
@echo off
set /P c=Do you want Superweapons? [Y/n]
if /I "%c%" NEQ "N" goto :launcher else goto :nosuperweapons
echo Launching Zero Hour ...
echo.
:nosuperweapons
move !NoSuperWeaponsVanilla.gib !NoSuperWeaponsVanilla.big
@withmorten
withmorten / 0createshortcuts.bat
Created November 1, 2016 01:05
c&c shortcut creator
@setlocal enableextensions enabledelayedexpansion
@echo off
set wdir="%~dp0"
set wdir=!wdir:~0,-2!
xxmklink "%USERPROFILE%\Desktop\C&C ZH Shockwave Launcher" %wdir%\1launcher_shockwave.bat" "" %wdir%" "Command & Conquer Generals: Zero Hour - Shockwave Launcher" "1" "Shockwave.ico" /q
xxmklink "%USERPROFILE%\Desktop\C&C Zero Hour Launcher" %wdir%\2launcher_vanilla.bat" "" %wdir%" "Command & Conquer Generals: Zero Hour Launcher" "1" "generals.exe" /q
echo "Shortcuts to Desktop created!"
echo.
PAUSE
@withmorten
withmorten / g2a_music.txt
Created January 23, 2017 18:34
All Gothic 2 + addon music instances, as defined in MusicInst.d
name segment description
DEF_Day_Std nw_daystd DEFAULT
DEF_Day_Thr nw_daythr DEFAULT
DEF_Day_Fgt nw_dayfgt DEFAULT
DEF_Ngt_Std nw_daystd DEFAULT
DEF_Ngt_Thr nw_daythr DEFAULT
DEF_Ngt_Fgt nw_dayfgt DEFAULT
OWD_Day_Std owd_daystd DEFAULT_OLDWORLD
OWD_Day_Thr owd_daystd DEFAULT_OLDWORLD