#!/usr/bin/perl

open(GTA,"+<$ARGV[0]") || die;
open(EXP,"<$ARGV[1]") || die;

# read up to 64k of exploit
read(EXP, $data, 0x10000);
die "exploit too big" unless eof(EXP);

# seek to proper offset
seek(GTA, 0xc4, SEEK_SET);
read(GTA, $offset, 4);
seek(GTA, unpack("V", $offset), SEEK_SET);

# put it in 
print GTA $data;
seek(GTA, 0, SEEK_END);

close(EXP);
close(GTA);
