Kodi Community Forum
[RELEASE] Rom Collection Browser - Browse and launch emulator game ROMs - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Support (https://forum.kodi.tv/forumdisplay.php?fid=33)
+--- Forum: Add-on Support (https://forum.kodi.tv/forumdisplay.php?fid=27)
+---- Forum: Game Add-ons (https://forum.kodi.tv/forumdisplay.php?fid=291)
+---- Thread: [RELEASE] Rom Collection Browser - Browse and launch emulator game ROMs (/showthread.php?tid=70115)



RE: [RELEASE] Rom Collection Browser - Browse and launch emulator game ROMs - Adam7288 - 2013-11-18

Go to the start menu, type "cmd" and then you are going to have to take it from there. You may learn a thing or two in the process. God speed, don't be afraid to learn.


RE: [RELEASE] Rom Collection Browser - Browse and launch emulator game ROMs - jconway2002 - 2013-11-20

(2011-06-23, 23:32)blinken Wrote: I've been using this program for a while now and absolutely love it! Fantastic work!

However, I am now having a slight problem. I added epsxe to my rom collection and now when I try to launch playstation games XBMC minimizes and nothing happens. Epsxe opens but the game doesn't start.

Anyone have any idea why this is?

I am also having this problem. Every other emulator works, but EPSX doesnt launch into the game. What am I missing?


RE: [RELEASE] Rom Collection Browser - Browse and launch emulator game ROMs - teeedubb - 2013-11-20

Try mednafen, its PS one emulation is the best I've seen.


RE: [RELEASE] Rom Collection Browser - Browse and launch emulator game ROMs - malte - 2013-11-20

silvers46 Wrote:but when i try to launch the game a command prompt automatically shows up. what happens is it tries to load the core for the last game that i launched. ex if i launched a snes rom then exit and try to launch a genesis rom it will launch the genesis rom in snes9x which of course wont work.
Can you show me a log file of this behaviour? Sounds like a bug but I have never herad of this behaviour before.


RE: [RELEASE] Rom Collection Browser - Browse and launch emulator game ROMs - Litmusdragon - 2013-11-22

Just downloaded and set this up and have a couple of questions.

1. Does anyone have any tips on how to best scrape MAME roms using this thing? The scraper keeps pulling down the wrong version of the game, for example the sega master system version of Ms. Pac Man instead of the arcade version, and in the UI when I scrape they are both just listed as "Ms Pac Man" so I have no idea which one I'm choosing

2. Is there any way to input a name other than the filename to scrape? For example, the mame ROM for Hyper Street Fighter 2 is filenamed HSF2 which returns no hits in the scraper. If I could input the name manually I'd be able to find it.

edit:
Nevermind I found the answer here:
http://code.google.com/p/romcollectionbrowser/wiki/HowToAddMAMEOffline


Fixing applaunch.sh (solo mode) - DeJuan N. Onley - 2013-11-23

This is going to be a long post so bear with me, but it may be very useful to someone, including the author(s) of this addon. If this has been posted elsewhere I apologize. I couldn't find it.

I'm running Frodo on Ubuntu 13.10 (saucy) with RCB. I ran into issues with the script that launches solo mode which many users may have without even realizing it. (Beyond the need to "chmod +x".) The solo mode is a great idea, especially for those of us with the infamouse "no sound" issue with emulators running alongside XBMC who don't want to go screwing up our PulseAudio setup just to get it to work. So don't take any of this negatively. I just found a real problem here and want to post my thoughts (and a possible fix).

What I noticed was that XBMC was being sent a SIGTERM then immediately sent SIGKILL with no pause in between. For those who don't know, SIGTERM asks a program to shut down nicely so it can save data and close its child processes down without risking data corruption. Whereas SIGKILL will do just what it sounds like--immediately kill a process, which means a great risk of corruption. For example, if XBMC is in the middle of updating the library database when sent a SIGKILL it would almost certainly corrupt that database.

From another terminal (TTY1) I did "kill -15 xxxx" (SIGTERM signal, where xxxx was the PID of XBMC) and it was successful. As many of us know shutting down XBMC properly (especially with many addons) can fail. But after trying it dozens of times (I was bored), it worked 95-98% with a bunch of add-ons installed and 100% with a clean install. So this proved SIGTERM should work in theory.

Then I looked at the script that launches solo mode. On Linux systems this is normally located at:
Code:
~/.xbmc/userdata/addon_data/script.games.rom.collection.browser/scriptfiles/applaunch.sh
In here I found a few problems. First, the script only attempts one time to check if XBMC is running (lines 16-31). So even if it was able to properly detect whether SIGTERM was successful or not, it would always assume it was still running since the check is never run again. One solution for this would be to create a function for checking if the xbmc.bin process is running then call that function as needed in the script.

Second issue I saw was on lines 35 and 49. These are the ones that are supposed to check if the $XBMC_PID variable is a non-null value. Except they don't. As-is, this check will always evaluate as true, whether it is or not (even if we did check for the PID again between the two of them). That's because the variable needs to be in quotes as such:
Code:
if [ -n "$XBMC_PID" ]

Third issue is on line 45. There is a sleep command there to wait for SIGTERM to complete, but it is commented out (and doesn't have a value). This tells me the dev probably gave up on getting SIGTERM to work (more on that in a bit) and just lets it go right to SIGKILL further down in the script. Except this is worse than just sending SIGKILL to begin with, because we just sent a termination signal a few lines ago. This is a very bad idea. If we are just going to SIGKILL every time anyway, we shouldn't even attempt to SIGTERM to begin with (because XBMC will actually start to TRY to shut down properly and be immediately interrupted). Also, rather than assigning a sleep statement which waits x # of seconds, we should probably make a loop which keeps checking for up to a certain length of time. The reason for this is to be user-friendly. One person's system may shut down XBMC in 4 seconds and another person's might take 20 seconds. If we make everyone wait 25 seconds before checking if XBMC is shut down, that person with the 4 second shut down time will think something went wrong while they are staring at their desktop.

I was able to easily fix all of the above and my updated script looked something like this (you can read the comments I added to see where I made the fixes for the issues above):
Code:
#!/bin/bash
# App Launch script - Quit XBMC to launch another program
# Thanks to rodalpho @ # http://xbmc.org/forum/showthread.php?t=34635
# By Redsandro     2008-07-07
# By ryosaeba87    2010-08-24 (Added support for MacOSX)
#


# Check for agruments
if [ -z "$*" ]; then
    echo "No arguments provided."
    echo "Usage:"
    echo "applaunch.sh [/path/to/]executable [arguments]"
    exit
fi


# DNO: Just set an OS variable (if OSX) and the XBMC binary name for now
case "$(uname -s)" in
    Darwin)
        XBMC_BIN=$(ps -A | grep XBMC.app | grep -v Helper | grep -v grep | awk '{print $5}')
        OSX=1
        echo "MacOSX detected"
        ;;
    Linux)
        XBMC_BIN="xbmc"
        echo "Linux detected"
        ;;    
    *)
        echo "I don't support this OS!"
        exit 1
        ;;
esac

# DNO: Create a function to get the PID of XBMC since we will be doing this several times
function getpid(){
if [ $OSX ]
then
    XBMC_PID=$(ps -A | grep XBMC.app | grep -v Helper | grep -v grep | awk '{print $1}')
else
    XBMC_PID=$(pidof xbmc.bin)
fi
}

# DNO: Now, let's call that function so we can check if XBMC is running
getpid
echo "PID detected as $XBMC_PID"


# Is XBMC running?
if [ -n "$XBMC_PID" ] # DNO: Added quotes here to prevent statement always evaluating true
then
    kill -15 $XBMC_PID # Shutdown nice
    echo "Shutdown nice"
else
    echo "This script should only be run from within XBMC."
    exit
fi

# Wait for the kill
# DNO: Rather than try to guess how long we need to wait for XBMC to shut down...
# DNO: ... let's check every two seconds for up to 30 seconds
# DNO: Max wait time is x*2 in seconds, so you can adjust as needed
# DNO: Setting initial value for x to 0 or a negative number will ensure SIGKILL in most cases
# DNO: y is just there so you can see how long it took XBMC to shut down
x=15
y=2
while [ $x -gt 0 ]
do
    sleep 2
    getpid
    if [ -n "$XBMC_PID" ]
    then
        x=$(( $x - 1 ))
        y=$(( $y + 2 ))
    else
        x=0
        echo "XBMC shut down nicely in under $y seconds."
    fi
done


# Is XBMC still running?
if [ -n "$XBMC_PID" ] # DNO: Added quotes here to prevent statement always evaluating true
then
    kill -9 $XBMC_PID # Force immediate kill
    echo "Shutdown hard"
fi

echo "$@"

# Launch app - escaped!
"$@"


# SOMETIMES xbmc starts too fast, and on some hardware if there is still a millisecond of sound being used, XBMC starts witout sound and some emulators say there is a problem with the sound hardware. If so, remove comment:
#sleep 1


# Done? Restart XBMC
$XBMC_BIN &
Note: technically the "-15" switch is unnecessary for the first kill command since SIGTERM is the default signal sent by kill.

If that updated script works for you then great. But it still didn't work for me. Even though "kill -15" would work from a terminal, when run from within this script launched via RCB, XBMC would just hang and not quit until it was sent SIGKILL ("kill -9"). In fact, I could even run this script from a terminal and it would terminate XBMC properly nearly 100% of the time. If you want to test this yourself, comment out the last line that re-launches XBMC and do something like "sh ./applaunch.sh echo hello" from TTY1 (Ctrl-Alt-F1) while XBMC is running on your desktop (I found that sometimes it worked best if I immediately went back to XBMC while the script was executing with Ctrl-Alt-F7).

Debugging XBMC revealed that it was receiving the SIGTERM signal properly and attempting to shut down but it would sit and wait for the RCB addon to shut down... which of course it never will since it is running that script! Even worse, sometimes XBMC will throw an exception saying something like SYSTEMEXIT IGNORED. A Google search for that exception revealed dozens of people asking about it occurring for a large number of reasons with XBMC but no solutions at all. So we probably can't do anything when it throws that exception (unless we want to try sending the SIGTERM again when the exception occurs since it appears it only happens 5% of the time or so, at least on my system). But, we should be able to work around the issue of XBMC waiting in vain for RCB to close. This is what I stayed up last night for hours working on. (As I said, I was bored... and I may have had a little too much scotch.)

The best solution I've found so far is to have applaunch.sh launch another script in a new terminal window. So I copied/renamed my modified applaunch.sh to applaunch2.sh (make sure they are both executable) and here's what my new applaunch.sh looks like:
Code:
#!/bin/bash


# First, let's be absolutely sure we are in the right directory
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd "$DIR"
gnome-terminal -x ./applaunch2.sh "$@"

Important: You will also need to remove the ampersand (&) from the last line in applaunch2.sh. Otherwise the script will just close since it is running in a new terminal and XBMC will not re-start. Also, this points out a minor annoyance of this workaround--the new terminal window we launched will remain open until the script completes, which won't happen until we either quit XBMC or launch a new solo mode game. Of course, if you are running full screen you will never see that terminal window so who cares? It may be possible to leave the ampersand in there and insert a sleep command after it to give XBMC time to fully start before the script ends. I haven't tried that yet though.

This works fairly well, but still doesn't succeed in shutting down XBMC as often as executing "kill" directly in another terminal does. I would say it has a 60-70% success rate on my system. Also, obviously it would require the user actually has gnome-terminal. This could probably be tweaked to support multiple platforms. I tried other solutions (like "exec") and some would work sometimes, but this one seems the best so far. At least when done this way I no longer see XBMC waiting on RCB to close in the log, so the times when it doesn't shut down properly could just be something to do with my own configuration at this point.

Anyway, this is a start. Maybe someone out there who knows more about this stuff than I do can find a better solution. At least now I no longer have to worry about the script signaling SIGTERM then SIGKILL in quick successioin like it was and at least half the time it is shutting down XBMC properly. I would much rather have to wait up to 30 seconds for my emulator to launch than risk the kind of corruption that can occur from repeatedly doing SIGKILL. If the dev or someone else wants to PM me with input, maybe we can lick this problem once and for all.

Oh, and the dev has my full permission to use any or all of the modifications I've posted here. You can strip out all my comments too or replace them. I don't care. Just a little small acknowledgement for the hours I spent with a glass of scotch and Google last night would be appreciated.

Update: on a whim I decided to try adding "sleep 1" right before "kill -15 $XBMC_PID" in applaunch2.sh to see if maybe giving it a second to be sure the first script had finished might help. So far it does seem to be working slightly better, except now you see the new terminal window pop up while it is running until XBMC exits and your emulator program starts. Not a big deal. But this may be a possible hint towards a better working solution.

Another update: I did not get into the python scripts or whatever in RCB. I'm guessing this might be fixed by applying the script changes I show above to applaunch.sh then having RCB run the script as a new process. Or maybe there is some way for RCB to tell XBMC not to wait for it before shutting down? But that's all beyond me. I'm very new to XBMC.


RE: [RELEASE] Rom Collection Browser - Browse and launch emulator game ROMs - malte - 2013-11-23

Thank you very much for your effort. I really appreciate it. I am no expert when it comes to bash programming and was not aware of the issues that you mention. I will check if your modifications work on my Linux box and will include it in the next release of RCB.

Some time back I found this post in the forums: http://forum.xbmc.org/showthread.php?tid=134913&pid=1138686#pid1138686 (using the program "at"). But I never managed to try it out. Originally this is made to solve issues while restarting XBMC again but maybe we could also use this to do a nice "kill -15" from another process.


RE: [RELEASE] Rom Collection Browser - Browse and launch emulator game ROMs - DeJuan N. Onley - 2013-11-23

That could work. I'm no expert myself. It was just bugging me because I could tell something wasn't right. XBMC was closing much too fast. Maybe I will get bored again this weekend and work on it some more. By no means is my "fix" so far perfect. Just a place to start.


RE: [RELEASE] Rom Collection Browser - Browse and launch emulator game ROMs - dohnalradek - 2013-11-24

I have a problem with launching ZSNES game, that is packed in .7z files. I donwloaded and installed RCM addon from their homepage (not from repo) but Im still unable to launch game (*.zip files are without problem).
When I try to start the game, in xbmc.log, there is an error:

13:24:09 T:764 NOTICE: RCB_INFO: rom: D:\ROM\SNES_vyber\secret_of_mana.7z
13:24:09 T:764 NOTICE: RCB_INFO: Trying to delete temporary rom files
13:24:09 T:764 NOTICE: RCB_INFO: Treating file as a compressed archive
13:24:09 T:764 NOTICE: RCB_ERROR: Error handling compressed file: list index out of range
13:24:09 T:764 NOTICE: roms compressed = []
13:24:09 T:764 NOTICE: RCB_INFO: No cmd created. Game will not be launched.
13:24:09 T:764 NOTICE: RCB_INFO: End launchEmu
13:24:09 T:764 NOTICE: RCB_INFO: onAction: 100
13:24:10 T:764 NOTICE: RCB_INFO: onAction: 107
13:24:10 T:764 NOTICE: RCB_INFO: onAction: 107
13:24:10 T:764 NOTICE: RCB_INFO: onAction: 107
13:24:10 T:764 NOTICE: RCB_INFO: onAction: 107
13:24:10 T:764 NOTICE: RCB_INFO: onAction: 107
13:24:10 T:764 NOTICE: RCB_INFO: onAction: 107
13:24:10 T:764 NOTICE: RCB_INFO: onAction: 107
13:24:10 T:764 NOTICE: RCB_INFO: onAction: 107
13:24:10 T:764 NOTICE: RCB_INFO: onAction: 107
13:24:11 T:764 NOTICE: RCB_INFO: onAction: 0
13:24:11 T:764 NOTICE: RCB_INFO: actionId == 0. Input ignored


RE: [RELEASE] Rom Collection Browser - Browse and launch emulator game ROMs - zbuzanic - 2013-11-24

Excellent plugin, works great, thank you very much!!!! Love it Smile


RE: [RELEASE] Rom Collection Browser - Browse and launch emulator game ROMs - dron2000 - 2013-11-27

Thanks a lot for great plugin. I carefully read RCB Wiki and this but could not find answers to some questions.

1) Is it possible to modify data of single game by means of RCB? The games are already scrapped but some information is not suitable for me. The only possibility that I have now is to manually mode local nfo files and then scrap games again.
2) Is it possible on selecting the game not to start it but open fle folder where is rom of the game is kept? Maybe there is some argument like %ROMPATH% or something that can be set.

Thank You again for wonderful plugin


RE: [RELEASE] Rom Collection Browser - Browse and launch emulator game ROMs - malte - 2013-11-28

dohnalradek Wrote:I have a problem with launching ZSNES game, that is packed in .7z files. I donwloaded and installed RCM addon from their homepage (not from repo) but Im still unable to launch game (*.zip files are without problem).
When I try to start the game, in xbmc.log, there is an error:
Sorry, no idea. Usually this is supposed to work. Only issue that I know of is that there are not always the correct 7z libs shipped with the addon but this error looks different.


dron2000 Wrote:1) Is it possible to modify data of single game by means of RCB? The games are already scrapped but some information is not suitable for me. The only possibility that I have now is to manually mode local nfo files and then scrap games again.
2) Is it possible on selecting the game not to start it but open fle folder where is rom of the game is kept? Maybe there is some argument like %ROMPATH% or something that can be set.
1) Editing nfo and rescraping is the only option to change game info atm. But you can just rescrape the selected game (2nd option in context menu). You don't have to rescrape the complete collection. Another option would be to edit the database directly. With a tool like SQLite Studio this is kind of working with Excel. But you should always make a backup of your database before you do this.
2) No, this is currently not possible. And I don't think it will be implementedSmile Why would you need this?


RE: [RELEASE] Rom Collection Browser - Browse and launch emulator game ROMs - MovieBird - 2013-11-30

MAWS seems to have been resurrected:

http://forum.arcadecontrols.com/index.php/topic,129498.0.html

Is there any way we could use this for MAME scraping?


RE: [RELEASE] Rom Collection Browser - Browse and launch emulator game ROMs - James_liv - 2013-12-01

Hello,

I've posted this in the main form but no-one seems to be able to help.

Just started playing around with RCB and XBMC and I'm hugely impressed.

I've got 6 roms. 3 N64. The games work fine when I load them but only 1 of them appears in RCB.

The others scrape, and all the pics are dropped into the folder if I manually check them but no matter what I do they don't show in RCB.
Same with a Genesis and Gamecube game but others work fine.

Help?

I'm new to all this so not even sure where I find the log file that everyone seems to ask for on other threads.

Its driving me crazy because a bit of patience with everything else has brough rewards but I'm really struggling with this.

Thanks in advance


RE: [RELEASE] Rom Collection Browser - Browse and launch emulator game ROMs - teeedubb - 2013-12-01

Are they all the same file extension?