#!/usr/bin/perl use strict; use warnings; use File::Spec; use File::Basename; use Cwd 'abs_path'; my @res = qw/convert interlace merge shadeboost tfx/; my $path = File::Spec->catdir(dirname(abs_path($0)), "..", "plugins", "GSdx", "res"); foreach my $r (@res) { glsl2h($path, $r, "glsl"); } glsl2h($path, "fxaa", "fx"); sub glsl2h { my $path = shift; my $glsl = shift; my $ext = shift; my $in = File::Spec->catfile($path, "${glsl}.$ext"); 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; print $H "\t\"$line\\n\"\n"; } print $H "\t;\n"; }