Application Termination problem

A nice (keyboard based) front end for Arcade / Console game emulators.

Moderator: battlecat

Application Termination problem

Postby Zombie » Tue Jan 04, 2011 12:48 am

Kioclient, the application which processes Linux shortcuts, is terminating pre-maturely. It is returning WahCade to the foreground allowing it to continue running behind the executed program. (as if you tacked a & at the end.) How do you prevent this.
User avatar
Zombie
 
Posts: 791
Joined: Mon Oct 06, 2008 2:52 pm

Re: Application Termination problem

Postby sairuk » Tue Jan 04, 2011 2:34 am

not being familar with kioclient i will hazard a guess as to what it going on. Kioclient is acting as a secondary launcher.

i assume it does his due to the fact that wahcade will register the PID of kioclient as the subprocess launched by the launch_game function. Once kioclient processes the shortcut I would assume it terminates itself triggering wahcade as though the 'emulator has exited'.

to prevent this you may be be able to
- symlink applications to a directory then build a game list from symlinked executables.
or
- execute kioclient as an app before launch.

I am about look at how to add native linux apps to wahcade (padman, scorched, etc) so I may look at kioclient in the process if it seems necessary.

I doubt wahcade processes windows shortcuts (.lnk) , or linux desktop shortcuts (.desktop) specifically at the moment. I can't recall seeing any code for that yet.
mameau - My random bits | Wah!Ki - A Wah!Cade wiki | Mah!Cade - Experimental Wah!cade Branch | ListGen | Lazarus
User avatar
sairuk
 
Posts: 432
Joined: Sat May 22, 2010 12:37 am

Re: Application Termination problem

Postby Zombie » Tue Jan 04, 2011 4:15 am

It doesn't, and this is a huge holdup. I've tried the symlinking method, sometimes it works for Linux apps, but Windows Apps and DOS usually fail entirely.
User avatar
Zombie
 
Posts: 791
Joined: Mon Oct 06, 2008 2:52 pm

Re: Application Termination problem

Postby sairuk » Wed Jan 05, 2011 11:33 pm

Zombie wrote:It doesn't, and this is a huge holdup. I've tried the symlinking method, sometimes it works for Linux apps, but Windows Apps and DOS usually fail entirely.


Can you explain in detail your current method for each of these scenarios?
mameau - My random bits | Wah!Ki - A Wah!Cade wiki | Mah!Cade - Experimental Wah!cade Branch | ListGen | Lazarus
User avatar
sairuk
 
Posts: 432
Joined: Sat May 22, 2010 12:37 am

Re: Application Termination problem

Postby Zombie » Thu Jan 06, 2011 2:33 am

Basically, it works like this, and they all basically work the same way. When a Wine, or Linux Application is installed, it creates a .desktop file. The .desktop file does all the leg-work, it tells the system all the necessary working directory information and environment space and parameters to pass (Which is critical for Dos, Windows, and Linux games.) I copy the shortcuts to a 'Roms' directory for Wine. I then tell Wine to look for files of type .desktop

kioclient exec /path/to/Neverball.desktop.

I then chmod +x the program, and tell kioclient to exec the shortcut. I used to use xdg-open, but that only worked under KDE 3.5
User avatar
Zombie
 
Posts: 791
Joined: Mon Oct 06, 2008 2:52 pm

Re: Application Termination problem

Postby codefenix » Thu Jan 06, 2011 3:17 am

I have a working solution for this that uses a bash script. Basically, you just pass the executable through as a parameter, and that's it.

Create the following file called passthru.sh in a directory called ~/bash:
Code: Select all
#!/bin/bash
# calls the executable specified by the $1 argument
$1


Make the file executable.
Code: Select all
chmod u+x passthru.sh


Add the ~/bash folder to your PATH.
Code: Select all
export PATH=$PATH:~/bash


Test the passthru bash script on a game. I used gnibbles.
Code: Select all
~/bash/passthru.sh /usr/games/gnibbles


If all went well, the game will come up. Exit the game.

Now we add a passthru.ini to Wah!Cade.
Code: Select all
### simple pass-through bash script for native Linux games (wahcade v0.99) ###
### by codefenix ###

emulator_title                          Linux Games

### List Generation Settings ###
rom_path                                /usr/games
rom_extension                           
dat_file                               
nms_file                               
catver_ini_file                         
list_generation_method                  rom_folder

### Execution Settings ###
emulator_executable                     ~/bash/passthru.sh
commandline_format                      "[rompath]/[name]"
alt_commandline_format_1               
alt_commandline_format_2               
game_specific_config_path               

### Artwork Locations ###
artwork_1_image_path                   
artwork_2_image_path                   
artwork_3_image_path                   
artwork_4_image_path                   
artwork_5_image_path                   
artwork_6_image_path                   
artwork_7_image_path                   
artwork_8_image_path                   
artwork_9_image_path                   
artwork_10_image_path                   
movie_preview_path                     
movie_artwork_no                        1

### Screen-Saver Settings ###
enable_music_in_screensaver             0
saver_type                              slideshow
movie_path                             
movie_fullscreen                        1
quit_delay                              30
wrapper_executable                     
wrapper_commandline_format              [name]
scr_file                               

### External Application Settings ###
ipc_file_or_path                       
app_1_executable                       
app_1_commandline_format               
app_2_executable                       
app_2_commandline_format               
app_3_executable                       
app_3_commandline_format               
auto_launch_apps                       

### Additional Settings ###
music_path                             
lcd_display_file_path                   
lcd_fe_text                             

### Settings used by MAMEWAH ###
current_list                            0


This will pull all games in your /usr/games directory.

Run wahcade, and change to the newly created Linux Games platform. Select a game and hit start. The game will come up. Make the game full-screen if you need to. Exit the game and you will be returned to Wah!Cade.

This works swimmingly for me under Xubuntu 10.04. Please give it a try and see if it works for you on your system.

Stand by for a Linux games layout for Wah!Cade, sporting none other than Tux himself!
User avatar
codefenix
 
Posts: 219
Joined: Fri Sep 25, 2009 3:45 pm
Location: USA

Re: Application Termination problem

Postby sairuk » Thu Jan 06, 2011 4:19 am

This is my current solution for launching linux titles from mahcade, it is quite similar to codefenix's solution. I have a directory of symlinks under ~/emulators/pcgames/roms/.

loader script
Code: Select all
#!/bin/sh
"$@"
wait



pcgames.ini setup
Code: Select all
emulator_title                          Linux Games

### List Generation Settings ###
rom_path                                ~/emulators/pcgames/roms
rom_extension                           *
dat_file
nms_file
catver_ini_file
list_generation_method                  rom_folder

### Execution Settings ###
emulator_executable                     ~/emulators/pcgames/loader
commandline_format                      "[rompath]/[name][romext]"


There is a bug in the way mahcade currently handles multiple file extensions forcing a requirement for file extensions.
mameau - My random bits | Wah!Ki - A Wah!Cade wiki | Mah!Cade - Experimental Wah!cade Branch | ListGen | Lazarus
User avatar
sairuk
 
Posts: 432
Joined: Sat May 22, 2010 12:37 am

Re: Application Termination problem

Postby Zombie » Thu Jan 06, 2011 7:47 am

Well, this works fine and dady for Linux games, but what about DOS and Windows games? They have to have to be started in their own working directory, AND they can have to have parameters for Joypad support and Fullscreen in some cases.
User avatar
Zombie
 
Posts: 791
Joined: Mon Oct 06, 2008 2:52 pm

Re: Application Termination problem

Postby sairuk » Thu Jan 06, 2011 9:22 am

Zombie wrote:Well, this works fine and dady for Linux games, but what about DOS and Windows games? They have to have to be started in their own working directory, AND they can have to have parameters for Joypad support and Fullscreen in some cases.


one problem at a time,

my initial thoughts on those topics are you would create bash scripts per game as required then use the same setups codefenix or I are using to launch native linux games. Yet to be proven of course. Unless you mean dos and windows games under windows, which you create and autohotkey launcher or batch file to do the equivalent.

The "$@" used in my script should pass through all args from wah!cade to the launched title.

wine games: If you give us some specific examples of the games (and command lines required for those games) then maybe we can then work out an alternative. You appear to have alot of experience with titles that don't work directly and some info on which titles they are would go along way to help find alternatives to desktop file launchers, right now i personally have no interest in running wine games so I wont be looking at any games specifically, the only one I can think of might be street fighter 4. I am in no rush to run windows games in linux.

dos games: I will be looking at games through dosbox at some point. There are only perhaps 5 or so games I'm truly interested in getting running. I have no idea how to use dosbox, although I know you used to be able to run commands from a conf file using the commandline. so that may be one method.

I would like info on games which do/do not launch for the wiki also. Not sure how to compile that info yet.
mameau - My random bits | Wah!Ki - A Wah!Cade wiki | Mah!Cade - Experimental Wah!cade Branch | ListGen | Lazarus
User avatar
sairuk
 
Posts: 432
Joined: Sat May 22, 2010 12:37 am

Re: Application Termination problem

Postby codefenix » Thu Jan 06, 2011 2:23 pm

Zombie wrote:but what about DOS...They have to have to be started in their own working directory


I use DOSBox for DOS games. The method I use is outlined below, and I believe it addresses all the issues you mentioned. I'm not in front of my cabinet at the moment, so I'll have to go from memory here. My apologies in advance for any inaccuracies. I'll correct later if necessary.

EDIT: I posted a DOSBox configuration guide on Wah!Ki that goes more in-depth into proper setup.

  • I have a subfolder called dosgames in my home folder (~/dosgames).
  • I have a subfolder for each of my dos games in my dos subfolder (~/dosgames/ROUND42, ~/dosgames/XCUTE, etc).
  • In the subfolder (working directory) of each game, I have a BAT file named the same as the subfolder, which runs the game's executable:
  • In the ~/dosgames folder, for each game I have a BAT file named the same as the game's subfolder, which runs the game's executable:

    ROUND42.BAT
    Code: Select all
    @echo off
    cd round42
    round42.com

    XCUTE.BAT
    Code: Select all
    @echo off
    cd xcute
    xcute.exe


    This solves the issue of DOS games having multiple file extensions (.COM, .EXE). This also runs the game from its working directory.
  • I have a conf subfolder in my ~/dosgames folder that contains the dosbox config files for each game (ROUND42.conf, XCUTE.conf), and I tweak the settings for each game independently this way (for example, fullscreen=true).
  • I also have a keymap subfolder in my ~/dosgames folder that contains the keymap file for each game. These files are auto-generated and named as specified by the mapperfile option in the conf file. In my case I have my mapper files named the same as the game filename (mapper_ROUND42.txt, mapper_XCUTE.txt).
  • My dosbox INI file goes something like this:
    Code: Select all
    ### dosbox.ini (wahcade v0.99) ###
    ### by codefenix ###

    emulator_title                          DOSBox

    ### List Generation Settings ###
    rom_path                                ~/dosgames
    rom_extension                           BAT
    dat_file                               
    nms_file                               
    catver_ini_file                         
    list_generation_method                  rom_folder

    ### Execution Settings ###
    emulator_executable                     /usr/bin/dosbox
    commandline_format                      "[rompath]/[name].[romext]" -exit -conf "[rompath]/conf/[name].conf"
    alt_commandline_format_1               
    alt_commandline_format_2               
    game_specific_config_path               
     
    ### Artwork Locations ###
    artwork_1_image_path                   
    artwork_2_image_path                   
    artwork_3_image_path                   
    artwork_4_image_path                   
    artwork_5_image_path                   
    artwork_6_image_path                   
    artwork_7_image_path                   
    artwork_8_image_path                   
    artwork_9_image_path                   
    artwork_10_image_path                   
    movie_preview_path                     
    movie_artwork_no                        1

    ### Screen-Saver Settings ###
    enable_music_in_screensaver             0
    saver_type                              slideshow
    movie_path                             
    movie_fullscreen                        1
    quit_delay                              30
    wrapper_executable                     
    wrapper_commandline_format              [name]
    scr_file                               

    ### External Application Settings ###
    ipc_file_or_path                       
    app_1_executable                       
    app_1_commandline_format               
    app_2_executable                       
    app_2_commandline_format               
    app_3_executable                       
    app_3_commandline_format               
    auto_launch_apps                       

    ### Additional Settings ###
    music_path                             
    lcd_display_file_path                   
    lcd_fe_text                             

    ### Settings used by MAMEWAH ###
    current_list                            0

EDIT: No double-quotes in the commandline_format.

So now, Wah!Cade will make DOSBox call the BAT file, which in turn calls the appropriate executable you specified for the game. This method works wonderfully for me. I've been enjoying DOS games on my cabinet for many months now with no problems.

Zombie wrote:AND they can have to have parameters for Joypad support

With respect to joypads, I suggest you familiarize yourself with DOSBox's joystick & gamepad support. You can do a lot with DOSBox's keymapper, like remap certain keys to joypad buttons, and vice versa. Again, if you followed the steps above, the appropraite conf and keymap file will be utilized when the game is executed.

With respect to running Windows games using Wine, I'd have to imagine a similar approach would work. Then of course, I haven't used Wine that much, so I can't really make an informed statement on the subject. I'll give it a whirl sometime if I can.
Last edited by codefenix on Thu Dec 29, 2011 2:37 pm, edited 3 times in total.
User avatar
codefenix
 
Posts: 219
Joined: Fri Sep 25, 2009 3:45 pm
Location: USA

Re: Application Termination problem

Postby codefenix » Fri Jan 07, 2011 3:39 am

I just installed and tested Wine. I copied sol.exe from my wife's PC to a folder on my cabinet PC, and ran it through Wine from the Terminal:
Code: Select all
wine sol.exe


And Solitaire came right up. I also tried another game I suggested on Zombie's Wine games thread titled "I'm OK.":
Code: Select all
wine "I'm OK.exe"


The game came right up and I managed to play through the first level. The game performed well and I experienced no discernible problems. On a side note, the game's an absolute pantload. I recommend it if you're up for a laugh.

Based on these findings there should be no problems using Wine directly with Wah!Cade. All this fuss with Kioclient and symlinking doesn't seem necessary.
User avatar
codefenix
 
Posts: 219
Joined: Fri Sep 25, 2009 3:45 pm
Location: USA

Re: Application Termination problem

Postby the_gamer » Sat Nov 08, 2014 2:21 pm

sairuk wrote:This is my current solution for launching linux titles from mahcade, it is quite similar to codefenix's solution. I have a directory of symlinks under ~/emulators/pcgames/roms/.

loader script
Code: Select all
#!/bin/sh
"$@"
wait



I tried this because my script starts the games but the game doesn't accept any keyboard input. I guess the game doesn't have the focus. It works fine when started from anywhere but wahcade.
What is the problem here?
the_gamer
 
Posts: 58
Joined: Wed May 04, 2011 8:45 pm

Re: Application Termination problem

Postby sairuk » Sun Nov 09, 2014 3:38 am

I run Demul (windowed) & m2emulator (fullscreen) under wine without any focus issues launched from wahcade. Only thing I can think off immediately is mine boots a qjoypad profile loader as part of the execution and a loader for a wine_prefix for the emulator.

wahcade emulator ini file
Code: Select all
### Execution Settings ###
emulator_executable                     ~/emulators/qjoypad_loader
commandline_format                      "altf4" ~/emulators/m2emulator/m2_loader [name]


qjoypad_loader
Code: Select all
#!/bin/bash
#############################
# Load QJoyPad profiles
# before executing application
#
#############################
#
# Check if qjoypad is installed
#
QJOYPAD=`which qjoypad`
#
if [ ! -e ${QJOYPAD} ]; then
        echo "Could not find qjoypad"
        exit
fi
#
# Check # of args
#
if [ $# -lt 2 ]; then
        echo "Usage: $0 <qjoypad_profile> <app-exe> <app-args>"
        exit
fi

if [ "$1" == "none" ]; then
        ${QJOYPAD} --update &
else
        #
        # Start QJoyPad with profile
        #
        ${QJOYPAD} $1 &
        #
fi
#
# Drop profile arg
#
shift
#
# Execute the remaining arguments
#
"$@"
#
# Switch to Wah!Cade profile
#
${QJOYPAD} "wahcade" &
#/usr/bin/qpad restart



m2_loader
Code: Select all
#!/bin/sh

EMULIN=~/emulators/m2emulator
EMUPATH=C:\\emulators\\m2emulator\\
EMUCMD=emulator_multicpu.EXE

WINEPREFIX=$HOME/.wine-emu/
WINECMD=`which wine`

cd ${EMULIN}
WINEPREFIX=${WINEPREFIX} ${WINECMD} "${EMUPATH}${EMUCMD}" $@



nothing overly special in regards to focus/window management here though. All still a WIP from a while back.
mameau - My random bits | Wah!Ki - A Wah!Cade wiki | Mah!Cade - Experimental Wah!cade Branch | ListGen | Lazarus
User avatar
sairuk
 
Posts: 432
Joined: Sat May 22, 2010 12:37 am


Return to Wah!Cade

Who is online

Users browsing this forum: No registered users and 4 guests

cron