Forum Replies Created

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • in reply to: hotkey button "stuck" in RetroArch #83970
    rev138
    Participant

    Thanks for the comparison file. I tried mimicking your config somewhat in that I put

    input_hotkey_enable = escape

    in the main retroarch.cfg, and moved all the actual hotkey bindings to my controller-specific config file. This seems to work!

    Thanks again!

    in reply to: hotkey button "stuck" in RetroArch #83951
    rev138
    Participant

    After finding a couple more posts on this exact issue (which different people seem to have different working solutions to), I was finally able to make this work by moving these options out of the controller-specific config and into the main retroarch.cfg

    input_enable_hotkey = "tab"
    input_enable_hotkey_btn = 8
    input_exit_emulator_btn = 9
    input_save_state_btn = 4
    input_load_state_btn = 5

    Now it only exits on select+start, as it should. However, this is not ideal because if I use a different controller, those will map to different buttons :(

    Progress.

    in reply to: hotkey button "stuck" in RetroArch #83762
    rev138
    Participant

    @thex: I tried that. No dice. Are you using those same gamepads?


    @floob
    : I don’t have start mapped to exit right now because I need to be able to use the start button. It doesn’t matter what button I use though, it exits without holding down the hotkey.

    in reply to: hotkey button "stuck" in RetroArch #83751
    rev138
    Participant
    input_device = "Performance Designed Products Rock Candy Wireless Gamepad for PS"
    input_driver = "udev"
    
    input_b_btn = "1"
    input_y_btn = "0"
    input_select_btn = "8"
    input_start_btn = "9"
    input_up_btn = "h0up"
    input_down_btn = "h0down"
    input_left_btn = "h0left"
    input_right_btn = "h0right"
    input_a_btn = "2"
    input_x_btn = "3"
    input_l_btn = "4"
    input_r_btn = "5"
    input_l2_btn = "6"
    input_r2_btn = "7"
    input_l_x_plus_axis = "+0"
    input_l_x_minus_axis = "-0"
    input_l_y_plus_axis = "+1"
    input_l_y_minus_axis = "-1"
    input_r_x_plus_axis = "+2"
    input_r_x_minus_axis = "-2"
    input_r_y_plus_axis = "+3"
    input_r_y_minus_axis = "-3"
    
    input_enable_hotkey_btn = "8"
    input_exit_emulator_btn = "6"
    input_save_state_btn = "4"
    input_load_state_btn = "5"
    
    in reply to: hotkey button "stuck" in RetroArch #83569
    rev138
    Participant

    Upon further testing, it seems the auto-detection IS working. When I launch a game, I see a message in yellow flash on the bottom identifying the controller. However, when I do this, pressing “start” exits the game as if I had been holding down “select”. If I move the exact same settings directly into my retroarch.cfg, it works properly. Very weird.

    in reply to: hotkey button "stuck" in RetroArch #83522
    rev138
    Participant

    Well, it looks like my problem was that I had followed this blog post: http://weekendengineer.wordpress.com/2014/09/02/auto-detecting-controllers-in-emulationstation-2-0

    I had to deviate slightly from the instructions because the controller detection option in retroarch-config doesn’t seem to work (no output), so I ran joyconfig manually and copied the output to a file in /opt/retropie/emulators/RetroArch/configs. This apparently does not work properly.

    I appended the contents of my custom config file to the main retroarch.cfg, and now the controller behaves properly (though it doesn’t switch mappings when I plug in a different controller, as was implied by that how-to.

    in reply to: Very Large Screens #83310
    rev138
    Participant

    I checked that file. It looks like it’s already set to 4 :(

    Thanks.

    in reply to: Improved(?) Scraper Script #83283
    rev138
    Participant

    Looks like that failed to attach, here it is:

    #!/usr/bin/perl
    
    ###
    ### Point this script at a ROM/directory full of ROMs and it will generate a 
    ### gamelist.xml file for EmulationStation and download the box cover art.
    ###
    ### 20141202 
    ###
    
    use strict;
    use warnings;
    use LWP::Simple 'getstore';
    use LWP::UserAgent;
    use XML::Simple;
    use JSON;
    use Digest::MD5;
    use Cwd qw( getcwd abs_path );
    use Image::Magick;
    use File::Path 'make_path';
    use Getopt::Long;
    
    my $opts = {
            'api-key'       => '7TTRM4MNTIKR2NNAGASURHJOZJ3QXQC5',  # RetroPie's API key
            'api-url'       => 'http://api.archive.vg/2.0',         # VG Archive API
            'downloads'     => getcwd . '/downloaded_images',       # Folder for downloaded box cover art
            'in-file'       => getcwd . '/gamelist.xml',
            'out-file'      => getcwd . '/gamelist.xml',
    };
    
    GetOptions(
            $opts,
            'api-key|k=s',
            'api-url|u=s',
            'downloads|d=s',
            'in-file|i=s',
            'out-file|o=s',
            'help|h'        => sub{ &help },
            'no-images|n',
            'stdout|s',
    );
    
    my @files = glob( $ARGV[0] );
    my $game_list = {};
    my $xs = XML::Simple->new;
    
    # read in the existing gamelist if there is one
    if( -r $opts->{'in-file'} ){
            my $in_file = IO::File->new( $opts->{'in-file'} ) or die $!;
            foreach my $game ( @{$xs->XMLin( $in_file, SuppressEmpty => 1, KeyAttr => { 'name' => "+name" } )->{'game'}} ){
                    $game_list->{$game->{'path'}} = $game if -e $game->{'path'};
            }
    }
    
    my $ua = LWP::UserAgent->new;
    
    # ;)
    $ua->agent('RetroPie Scraper Browser');
    
    # ensure file paths are absolute
    @files = map { abs_path( $_ ) } @files;
    
    foreach my $filename ( @files ){
            # get the MD5 digest for the ROM
            my $md5 = get_md5( $filename );
            # look up the ROM by its digest
            my $response = $ua->get( $opts->{'api-url'} . '/Game.getInfoByMD5/xml/' . $opts->{'api-key'} . "/$md5" );
    
            if( $response->is_success ){
                    my $data = XMLin( $response->decoded_content );
    
                    # make sure the API returned data in the format we expect
                    if( defined $data->{'games'} and defined $data->{'games'}->{'game'} and ref $data->{'games'}->{'game'} eq 'HASH' ){
                            my $game_data = $data->{'games'}->{'game'};
                            my $rating = 0;
                            my $image_file;
    
                            print "Found $game_data->{'title'}\n" unless $opts->{'stdout'};
    
                            $rating = $game_data->{'rating'} if defined $game_data->{'rating'} and $game_data->{'rating'} =~ /^[0-9.]$/;
    
                            # get the box cover if any
                            if( not $opts->{'no-images'} and ( defined $game_data->{'box_front'} and ref $game_data->{'box_front'} ne 'HASH' ) or ( defined $game_data->{'box_front_small'} and ref $game_data->{'box_front_small'} ne 'HASH' ) ){
                                    # parse out the filename
                                    $game_data->{'box_front'} =~ /\/([^\/]+)$/;
                                    $game_data->{'box_front_small'} =~ /\/([^\/]+)$/ unless defined $1;
    
                                    # set a temporary download location
                                    my $temp_file = "/tmp/$1" if defined $1;
    
                                    # download the box cover
                                    my $response_code = '';
                                    $response_code =  getstore( $game_data->{'box_front'}, $temp_file ) if defined $game_data->{'box_front'} and ref $game_data->{'box_front'} ne 'HASH';
    
                                    # if that didn't work, try to get the small version
                                    if( $response_code !~ /^(2|3)[0-9]{2}$/ ){
                                            $response_code = getstore( $game_data->{'box_front_small'}, $temp_file ) if defined $game_data->{'box_front_small'} and ref $game_data->{'box_front_small'} ne 'HASH';
                                    }
    
                                    # if that didn't work, try google
                                    if( $response_code !~ /^(2|3)[0-9]{2}$/ ){
                                            my $google_result = google_image_search( $ua, $game_data->{'title'} . ' ' . $game_data->{'system_title'} . ' box art' );
                                            $response_code = getstore( $google_result, $temp_file ) if defined $google_result;
                                    }
    
                                    # how about now?
                                    if( $response_code =~ /^(2|3)[0-9]{2}$/ ){
                                            # set the post-processed file location
                                            $image_file = $opts->{'downloads'} . "/$md5.jpg";
    
                                            my $im = Image::Magick->new;
                                            my $image = $im->Read( $temp_file );
    
                                            # scale to 350px width
                                            $im->AdaptiveResize( geometry => '350x' );
                                            # write out the scaled image in JPEG format at 50% quality
                                            make_path( $opts->{'downloads'} );
                                            $im->Write( filename => $image_file, compression => 'JPEG', quality => 50 ) ;
                                            # remove the temp file
                                            unlink $temp_file;
                                    }
                            }
    
                            # set/overwrite the attributes of the current rom
                            $game_list->{$filename}->{'name'} = $game_data->{'title'};
                            $game_list->{$filename}->{'path'} = $filename;
                            $game_list->{$filename}->{'image'} = $image_file if defined $image_file;
                            $game_list->{$filename}->{'description'} = $game_data->{'description'};
                            $game_list->{$filename}->{'developer'} = $game_data->{'developer'};
                            $game_list->{$filename}->{'publisher'} = $game_data->{'developer'};
                            $game_list->{$filename}->{'genre'} = $game_data->{'genre'};
                            $game_list->{$filename}->{'rating'} = $rating;
                    }
            }
            else {
                    die $response->code . ' ' . $response->message . "\n";
            }
    }
    
    # manually printing this because getting XML::Simple to reproduce the same formatting is baffling
    open STDOUT, ">$opts->{'out-file'}" or die "Can't write to $opts->{'out-file'}: $!" unless $opts->{'stdout'};
    print "<gameList>\n";
    
    foreach my $file ( sort { $game_list->{$a}->{'name'} cmp $game_list->{$b}->{'name'} } keys %$game_list ){
            print "\t<game>\n";
    
            foreach my $key ( sort keys %{$game_list->{$file}} ){
                    print "\t\t" . $xs->XMLout( { $key => $game_list->{$file}->{$key} }, NoAttr => 1, KeepRoot => 1 );
            }
    
            print "\t</game>\n";
    }
    
    print "</gameList>\n";
    
    ###
    
    sub get_md5 {
            my ( $filename ) = @_;
            my $ctx = Digest::MD5->new;
    
            open( FILE, '<', $filename );
            $ctx->addfile( *FILE );
            close( FILE );
    
            my $md5 = $ctx->hexdigest;
    
            return $md5 if defined $md5;
    }
    
    sub google_image_search {
            my ( $ua, $search_string ) = @_;
            my $response = $ua->get( 'https://ajax.googleapis.com/ajax/services/search/images?v=1.0&rsz=1&q=' . $search_string );
    
            if( $response->is_success ){
                    my $data = from_json( $response->decoded_content );
                    if( defined $data->{'responseData'} and @{$data->{'responseData'}->{'results'}} ){
                            return $data->{'responseData'}->{'results'}->[0]->{'url'};
                    }
            }
    }
    
    sub help {
            print "usage: es_scraper.pl [OPTIONS] /path/to/roms\n";
            print "options:\n";
            print "\t--api-key\tVG Archive API key\n";
            print "\t--api-url\tVG Archive API URL\n";
            print "\t--downloads\tBox cover art download folder\n";
            print "\t--in-file\tgamelist XML file to read in\n";
            print "\t--no-images\tSkip downloading box covers\n";
            print "\t--out-file\tgamelist XML file to write out\n";
            print "\t--stdout\tWrite to stdout instead of --out-file\n";
            print "\n";
            print "All options have sane defaults\n";
            exit;
    }
Viewing 8 posts - 1 through 8 (of 8 total)