Loader:yabause loader0910

From Wah!ki
Revision as of 23:55, 8 January 2011 by Sairuk (talk | contribs)
Jump to navigation Jump to search

About

This script addresses an issue with the broken commandline in Yabause 0.9.10. To work around this issue the loader rewrites the ini file at launch time with the required options.

The script itself is very much in an alpha state, use at your own risk.

Installation

  1. Save the script below to <filename>.pl
  2. Make the script executable. chmod +x <filename>.pl
  3. Add the loader into Wah!Cade
  4. Configure the commandline_format as per the Usage section
  5. Start Yabause manually and config all the required option so a new ini is written
  6. Copy ~/.config/yabause.ini to ~/.config/yabause-template.ini

Usage

Execute the script with the following commandline

''<full path to bios file> "[rompath]/[name].[romext]"


Perl Script

#!/usr/bin/perl
#
# Yabause Loader
# Work around to launch yabause 0.9.10

use IO::Handle;
my $home = "/home/" . `whoami`;
chomp($home);

######## CONFIG OPTIONS ########

my $cdromcore = "1";
my $yabpath = $home . "/.config/";
#my $yabpath = $home . "/.yabause/";
my $command = `which yabause-gtk`;
#my $command = `which yabause-qt`;

######## END CONFIG OPT ########

chomp($command);

my $cdrom = $ARGV[1];
my $biosfile = $ARGV[0];
my $procfile = $yabpath . "yabause-template.ini";
my $destfile = $yabpath . "yabause.ini";

# Pickup last used yabuse.ini at runtime
if ( -e $destfile ) {   
        system( "cp", "-u", $destfile, $procfile );
}

if ( -e $procfile && @ARGV > 1 ) {

        open (YABINI, ">", $destfile) or die $!;
        open (YABTINI, "<", $procfile) or die $!;
        while ($line = <YABTINI>) {
        if ($line =~ m/^CDROMCore\=/) {
                print YABINI "CDROMCore=1\n";
        } elsif ( $line =~ m/^CDROMDrive\=/ ) {
                print YABINI "CDROMDrive=".$cdrom."\n";
        } elsif ( $line =~ m/^BiosPath\=/ ) {
                print YABINI "BiosPath=".$biosfile."\n";
        } else {
                print YABINI $line;
        }
}
        system($command, "-a", "-f");
} else {
        print "Yabause Loader v0.1 by sairuk";
        print "\n";
        print "Usage: $0 BIOSFILE ISO\n";
}