Kodi Community Forum

Full Version: Advanced Launcher Game Emulation Set Up Configuration Help
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Hello,

I recently installed the Advanced Launcher add-on with the intent to use it solely for game emulation. The add-on installed fine but I am having some trouble in the configuration department. I was able to scan my rom files and point the launcher to my emulator and it scraped all the artwork and everything perfectly. The problem I am having is when I select a game to play. It will launch my emulator (Nestopia) but it doesnt bring it to the front and does not select the game I chose in XBMC. Nestopia will just sit in the background and show whatever game was last played. In addition, if I select another game to play it will launch ANOTHER instance of Nestopia. So before you know it i could have like 5 Nestopia applications open in the background while XBMC is still in front. What am I missing here? Does the Advanced Launcher only work on certain applications? or is it not 100% compatible with Mac OS X? If it is any help here are my specs; I am running Mac OS X 10.7.3 (Lion) with XBMC v11.0. I would like to use Nestopia as my NES emulator of choice. If possible, I would also like to use BSNES as my super nintendo emulator. I appreciate any help anyone can give. Thanks! Smile
(2012-04-26, 03:50)mido Wrote: [ -> ]Hello,

I recently installed the Advanced Launcher add-on with the intent to use it solely for game emulation. The add-on installed fine but I am having some trouble in the configuration department. I was able to scan my rom files and point the launcher to my emulator and it scraped all the artwork and everything perfectly. The problem I am having is when I select a game to play. It will launch my emulator (Nestopia) but it doesnt bring it to the front and does not select the game I chose in XBMC. Nestopia will just sit in the background and show whatever game was last played. In addition, if I select another game to play it will launch ANOTHER instance of Nestopia. So before you know it i could have like 5 Nestopia applications open in the background while XBMC is still in front. What am I missing here? Does the Advanced Launcher only work on certain applications? or is it not 100% compatible with Mac OS X? If it is any help here are my specs; I am running Mac OS X 10.7.3 (Lion) with XBMC v11.0. I would like to use Nestopia as my NES emulator of choice. If possible, I would also like to use BSNES as my super nintendo emulator. I appreciate any help anyone can give. Thanks! Smile
Advanced Launcher is normally able to start all kind of application. That's its goal. Now Advanced Launcher is not able to automatically start all application correctly. For this, you generally need to use a right command line to start the emulator. I think it is the problem you have actually. Advanced Launcher is effectively able to start Nestopia but the command line you used seems not the right one to start Nestopia into fullscreen with a specific rom. Now... does the Mac OS X version of Nestopia support command line? If so, what is the right command line to use to start Nestopia with a selected roms into fullscreen? Once you will know the right command line, you just have to indicate it into Advanced Launcher and it will works.

There is few support for Advanced Launcher on Mac OS X, because I do not have any Mac OS X system at home and also because there is few Advanced Launcher users who use it on Mac OS X system. The only information existing are here : http://www.gwenael.org/forum/viewtopic.php?id=54
Thanks for the swift response. I did some further research and unfortunately all emulators made / ported by Richard Bannister (Nestopia, BSNES) are not command line supported on Mac OS X. Here's what he had to say:

Quote:Hi Mido,

I'm afraid that none of my projects support command line launches.

If you can figure out a way of making XBMC launch your games via Apple Events that should work - and you can achieve automatic full screen by turning on the required option in Preferences.

Cheers
Richard

Is there someway to launch the games via apple events within advanced launcher? After reading some of the posts on the link you provided, it doesn't seem like there are any solid alternative solutions based on Twiggaloo's tests.
(2012-04-26, 19:58)mido Wrote: [ -> ]Is there someway to launch the games via apple events within advanced launcher? After reading some of the posts on the link you provided, it doesn't seem like there are any solid alternative solutions based on Twiggaloo's tests.
If you can start Apple Events using command lines... Yes, it may be possible.

For applications that do not support command line, under windows, I was able to create some launcher scripts, using AutoIT application, to emulate keys and mouse actions. The idea was to emulate actions needed to start a rom into a specific emulator. But the launcher script need to support command line to be started by Advanced Launcher. Here an example with the old version of FreeDO : http://www.gwenael.org/forum/viewtopic.php?id=36

Maybe there is similar applications to AutoIT under Mac OS X. Mac OS X is based on UNIX, which use command line... so I cannot beleive that there is no application like this... Maybe by using AppleScript...Undecided

What you describe with AutoIT sounds like the windows / pc version of Apple Script on Mac OS X. So essentially what you did was have Advanced Launcher launch a script designed to launch FreeDo.. cool. I understand Apple Script enough to know that you can save scripts as stand alone applications so it seems like the same thing can be achieved on Mac OS X. The only thing I can't wrap my head around is how you pass the "%rom%" argument to Apple Script to let it know which game to open. Scripting with Apple Script goes beyond my knowledge but maybe someone who has more experience can step in and whip one up that does exactly what you described on your link but for Nestopia. While researching I also discovered it is possible to execute apple scripts via the command line with 'osascript' I did some light googling and I came across some how to's like this. Again, this kind of scripting goes beyond my knowledge but this doesnt seem too far-fetched to get get any emulator up and running on Mac OS X. As an experiment I opened up AppleScript Editor, recorded my actions to open up a specific NES rom and saved the script as a stand alone application. Then, I changed the path of Nestopia emulator in Advanced Launcher to the path of the 'launch Nestopia application' script. Upon clicking on any game in Advanced Launcher it launches that game and brings Nestopia to the front. Of course when I click on any game in my list it will only launch the game I told Apple Script to launch. Anyone out there know how to modify the Apple Script to launch whatever game you click on in Advanced Launcher? Thanks for any help ya'll.
(2012-04-27, 05:05)mido Wrote: [ -> ]What you describe with AutoIT sounds like the windows / pc version of Apple Script on Mac OS X. So essentially what you did was have Advanced Launcher launch a script designed to launch FreeDo.. cool. I understand Apple Script enough to know that you can save scripts as stand alone applications so it seems like the same thing can be achieved on Mac OS X. The only thing I can't wrap my head around is how you pass the "%rom%" argument to Apple Script to let it know which game to open. Scripting with Apple Script goes beyond my knowledge but maybe someone who has more experience can step in and whip one up that does exactly what you described on your link but for Nestopia. While researching I also discovered it is possible to execute apple scripts via the command line with 'osascript' I did some light googling and I came across some how to's like this. Again, this kind of scripting goes beyond my knowledge but this doesnt seem too far-fetched to get get any emulator up and running on Mac OS X. As an experiment I opened up AppleScript Editor, recorded my actions to open up a specific NES rom and saved the script as a stand alone application. Then, I changed the path of Nestopia emulator in Advanced Launcher to the path of the 'launch Nestopia application' script. Upon clicking on any game in Advanced Launcher it launches that game and brings Nestopia to the front. Of course when I click on any game in my list it will only launch the game I told Apple Script to launch. Anyone out there know how to modify the Apple Script to launch whatever game you click on in Advanced Launcher? Thanks for any help ya'll.
According to your osascript links it seems possible to use the command line with arguments (argv):
a.scpt:
Code:
on run argv
    return "hello, " & item 1 of argv & "."
end run

Then you can pass the argument to the script (here world[i/])
Code:
% osascript a.scpt world
hello, world.

So it must be possible to adapt this to you case :
nestopia.scpt:
Code:
on run argv
    ....
    your script content    
    ....
end run

Then you call it like this from advanced launcher:
Code:
% osascript nestopia.scpt %rom%

Now the thing you still have to do in the [i]nestopia.scpt
script is to pass the item 1 of argv value into Nestopia. Like into AutoIt there must be an Apple script action to copy/paste text (here rom path) into a specific input field (here the rom path asked by Nestopia). If you port here the actual content of your nestopia apple script, maybe I will be able to help you to adapt it to make it works with Advanced Launcher Wink.
Something like this ?....
nestopia.scpt
Code:
on run argv
      tell application "Nestopia" to open item 1 of argv
end run
Putting Advanced Launcher aside a moment...

After a ton of trial and error I was able to come up with an Apple Script that launches whatever game I choose from Terminal (command line).

Apple Script (nestopia_launcher.scpt):

Code:
on run argv
    
    tell application "Nestopia"
        
        activate
        
        set rom to (item 1 of argv)
        set rompath to "/Users/Mido/Media/Roms/Nintendo Entertainment System/Roms/" & rom
        set gameon to POSIX path of rompath
        do shell script "open " & quoted form of gameon
        
    end tell
    
end run

Terminal:

Code:
osascript /Users/Mido/Desktop/nestopia_launcher.scpt "Paperboy.nes"

Now I am still unclear what to do in Advanced Launcher in order to use my script with XBMC. If I make the application 'nestopia_launcher.scpt' it doesnt work, nothing happens.

My Application and Modify Arguments for Advanced Launcher:

Change Application:
Code:
/Users/Mido/Desktop/nestopia_launcher.scpt
Modify Arguments:
Code:
% osascript nestopia_launcher.scpt %romfile%

I check my console log and it is saying:

Quote:4/28/12 3:44:11.892 PM [0x0-0x139139].com.teamxbmc.xbmc: sh: /Users/Mido/Desktop/nestopia_launcher.scpt: Permission denied

so I do this:

Quote:chmod +x /Users/Mido/Desktop/nestopia_launcher.scpt

then run again no luck and my console reads this now:

Quote:4/28/12 3:36:56.259 PM [0x0-0x139139].com.teamxbmc.xbmc: sh: /Users/Mido/Desktop/nestopia_launcher.scpt: cannot execute binary file

I go back to Apple Script and make my script a stand alone application.

This launches Nestopia this time but not the specified game. Apple Script opens up and returns the error : "Can't get Item 1"

My Application and Modify Arguments for Advanced Launcher this time:

Change Application:
Code:
/Users/Mido/Desktop/nestopia_launcher.app/Contents/MacOS/applet
Modify Arguments:
Code:
% osascript nestopia_launcher.app %romfile%

So on one hand I figured out how to launch nestopia roms from the command line, however configuration within Advanced Launcher is still troublesome. I have a feeling I'm screwing something up with the paths but I'm not sure.
But if your working command line is :

Code:
osascript /Users/Mido/Desktop/nestopia_launcher.scpt "Paperboy.nes"

Your starting application is osascript not nestopia_launcher.scpt. So your Advanced Launcher configuration must be :

Application:
Code:
osascript

Arguments:
Code:
/Users/Mido/Desktop/nestopia_launcher.scpt "%romfile%"
How can I set the application to 'osascript' when it only let's me SELECT the launcher application? Is there someway to type that in? in the edit launcher > advanced modifications preferences?
If I have well understand what you try to do : Advanced Launcher will start Osascript that will start your nestopia_launcher.scpt script that will start nestopia with the %romfile% game. So Advanced Launcher must have Osascript as launcher application and /Users/Mido/Desktop/nestopia_launcher.scpt "%romfile%" as arguments. Osascript application must be located here :
Code:
/usr/bin/osascript
SUCCESS! Big Grin

In order to navigate to osascript (to find where it was hiding at) I had to show hidden files in Mac OS X.

In Terminal:

Code:
defaults write com.apple.finder AppleShowAllFiles TRUE

Then relaunch the finder as described here.

This is very exciting. I'm sure many refinements can be made here and there but this is a solid start. Thanks a ton for your assistance and your hard work on Advanced Launcher. Cheers! Wink
Yeah !!!! Great news. I'm happy to see that there is a way to start applications not supporting command with Advanced Launcher under Mac OSX systems. Now you will surely not encounter so many difficulties to port this to others emulators and applications.

If you have time, maybe you can post a small tutorial of your method on the Advanced Launcher dedicated board : http://www.gwenael.org/forum/viewforum.php?id=4 . It will surely help other Mac OSX users. Then I will maybe also able to complete the Advanced Launcher WIKI pages : http://www.gwenael.org/xbmc/index.php?title=Nestopia

Now that I've focused my energy to trying to play the games, first thing I've noticed is that XBMC needs to be hidden in the finder in order for Nestopia to operate correctly. When XBMC is visible in the background, Nestopia will have choppy video and stuttering audio issues. When XMBC is hidden the games play flawlessly. I've experimented with hiding XBMC within the launcher Apple Script but I really cant get it to work right yet.

New Launcher Script:
Code:
on run argv
    
    tell application "Nestopia"
        
        activate
        
        set rom to (item 1 of argv)
        set rompath to "/Users/Mido/Media/Roms/Nintendo Entertainment System/Roms/" & rom
        set gameon to POSIX path of rompath
        do shell script "open " & quoted form of gameon
        
    end tell
    
    delay 3
    
    tell application "System Events"
        set visible of process "XBMC" to false
    end tell
    
end run

It seems to work only sometimes. I've included a delay since I thought there might be timing issues between when XBMC executes the script and launching the ROMs. I'm still playing around with this but I thought I throw my progress up here in the meantime. Anyone have any suggestions? It seems like games I've never opened before will work but ones that I have already opened seem to be problematic. Not sure what's going on here. Also, what are people's techniques for getting back to XBMC after they've left an application? Thanks.
For your problem delay it could be due between the moment you activate Nestopia and the moment you are starting setting parameters. If Nestopia take time to be activated, your parametrers will not be set correctly and you will have some problem. I do not know if Apple Script have a function like "Wait until application is activated".

Under Windows or Linux when XBMC take to many resources you have 3 options :

- minimize XBMC windows and maximize it when the started application is stopper.
- suspend XBMC process and restore it when the started application is stopper.
- close XBMC application and restart it when the started application is stopper.

There is surely AppleScript function to do it.

Pages: 1 2