#!/usr/bin/perl use strict; use warnings; use File::Spec; my @res = qw/convert interlace merge shadeboost tfx/; my $path = File::Spec->catdir("plugins", "GSdx", "res"); foreach my $r (@res) { glsl2h($path, $r); } sub glsl2h { my $path = shift; my $glsl = shift; my $in = File::Spec->catfile($path, "${glsl}.glsl"); my $out = File::Spec->catfile($path, "${glsl}.h"); open(my $GLSL, "<$in") or die; open(my $H, ">$out") or die; my $header = <)) { chomp $line; $line =~ s/%/\\%/g; $line =~ s/"/\\"/g; print $H "\t\"$line\\n\"\n"; } print $H "\t;\n"; }