Thread Rating:
  • 0 Vote(s) - 0 Average
Kodi, Retroplayer and Player class
#1
Forgive me if this is documented somewhere else, but is there some info available on the Player class where Retroplayer is involved? Specifically, I'm wondering how to:
1) Tell Retroplayer which core to use without the user being prompted
2) Any additional options for passing config stuff to retroplayer depending on the core

Thanks!
Reply
#2
I couldn't do much recently, so my answer will not be sufficient.

ad 1)
As I only worked with NES, SNES and N64 all games started without prompting me.
I think it's because they use different file extensions - afaik this is coded into addon.xml of the game addon.
What I had a problem with was with the ppsspp core (there is no working game addon so far) - the games for this emulator (at least the ones I tried)
are ISO files - as videoplayer (former dvdplayer) also assumes this are movies, it did not start in Retroplayer.
I did no further work on this so far.

ad 2)
What additional options do you mean?
There are several options that can be specified in one of the xml files.
They show up when you go into the addon section through settings and click on "configure".
This is where you can change the gfx plugin of mupen64 for example.

Hope this helps a bit.
Reply
#3
(2016-01-02, 17:09)a1rwulf Wrote: I couldn't do much recently, so my answer will not be sufficient.

ad 1)
As I only worked with NES, SNES and N64 all games started without prompting me.
I think it's because they use different file extensions - afaik this is coded into addon.xml of the game addon.
What I had a problem with was with the ppsspp core (there is no working game addon so far) - the games for this emulator (at least the ones I tried)
are ISO files - as videoplayer (former dvdplayer) also assumes this are movies, it did not start in Retroplayer.
I did no further work on this so far.

ad 2)
What additional options do you mean?
There are several options that can be specified in one of the xml files.
They show up when you go into the addon section through settings and click on "configure".
This is where you can change the gfx plugin of mupen64 for example.

Hope this helps a bit.


Thanks a1rwulf,
For #1, I'm thinking about cases where there is one or more cores for the same platform. SNES Mercury is a good example. Instead of the user choosing Performance or Accuracy every time a game is launched, I'd like to include an option from my addon to let them set it once, or remain with the prompt for core choice.

Something along the lines of:
Code:
listitem = xbmcgui.ListItem ('Super Mario Bros')
listitem.setInfo('game', {'Title': 'Super Mario Bros', 'core': 'game.libretro.bsnes-mercury-performance'})
xbmc.Player().play(listitem)

For #2, depending on the core, some of them utilize command line arguments in some cases for standalone retroarch. Some examples:
BlueMSX, the machine option being a key one. Since BlueMSX has multiple emulators internally (MSX1, MSX2, Coleco), it's possible to set the machine type via command line. The same I think is true for other cores like Final Burn Alpha or MESS (both not in Retroplayer yet but could be at some point).

Where this probably makes the most sense though is with the -appendconfig command that retroarch has. There's some cases where a particular game needs different configuration, but uses a common core. The -appendconfig command will override the default settings when called. Is there a similar method for Retroplayer?

Something along the lines of:
Code:
listitem = xbmcgui.ListItem ('ColecoVision Game')
listitem.setInfo('game', {'Title': 'ColecoVision Game', 'core': 'game.libretro.bluemsx', 'appendconfig': 'bluemsx_msxtype = COL - ColecoVision'})
xbmc.Player().play(listitem)
Reply
#4
(2016-01-01, 21:41)zachmorris Wrote: 1) Tell Retroplayer which core to use without the user being prompted
(2016-01-02, 17:09)a1rwulf Wrote: ad 1)
As I only worked with NES, SNES and N64 all games started without prompting me.
I think it's because they use different file extensions - afaik this is coded into addon.xml of the game addon.
What I had a problem with was with the ppsspp core (there is no working game addon so far) - the games for this emulator (at least the ones I tried)
are ISO files - as videoplayer (former dvdplayer) also assumes this are movies, it did not start in Retroplayer.
I did no further work on this so far.
(2016-01-02, 21:44)zachmorris Wrote: For #1, I'm thinking about cases where there is one or more cores for the same platform. SNES Mercury is a good example. Instead of the user choosing Performance or Accuracy every time a game is launched, I'd like to include an option from my addon to let them set it once, or remain with the prompt for core choice.

Something along the lines of:
Code:
listitem = xbmcgui.ListItem ('Super Mario Bros')
listitem.setInfo('game', {'Title': 'Super Mario Bros', 'core': 'game.libretro.bsnes-mercury-performance'})
xbmc.Player().play(listitem)

This already exists, but I haven't documented it yet because the API will most likely be changed. it guarantees that the game will be launched with that core or not at all.

Case in point, I changed "gameclient" to "Addon.ID" (a7a4c57) to make it consistent with another API property. It looks like that change got lost during a rebase. For the better IMO, as "Addon.ID" doesn't really belong.

So should we rename this to "core"? "Game client" was earlier verbiage that kind of lost meaning as the scope of the project grew. It's appropriate though, as not all game clients are libretro cores.

(2016-01-01, 21:41)zachmorris Wrote: 2) Any additional options for passing config stuff to retroplayer depending on the core
Thanks!
(2016-01-02, 17:09)a1rwulf Wrote: ad 2)
What additional options do you mean?
There are several options that can be specified in one of the xml files.
They show up when you go into the addon section through settings and click on "configure".
This is where you can change the gfx plugin of mupen64 for example.
(2016-01-02, 21:44)zachmorris Wrote: For #2, depending on the core, some of them utilize command line arguments in some cases for standalone retroarch. Some examples:
BlueMSX, the machine option being a key one. Since BlueMSX has multiple emulators internally (MSX1, MSX2, Coleco), it's possible to set the machine type via command line. The same I think is true for other cores like Final Burn Alpha or MESS (both not in Retroplayer yet but could be at some point).

Where this probably makes the most sense though is with the -appendconfig command that retroarch has. There's some cases where a particular game needs different configuration, but uses a common core. The -appendconfig command will override the default settings when called. Is there a similar method for Retroplayer?

Something along the lines of:
Code:
listitem = xbmcgui.ListItem ('ColecoVision Game')
listitem.setInfo('game', {'Title': 'ColecoVision Game', 'core': 'game.libretro.bluemsx', 'appendconfig': 'bluemsx_msxtype = COL - ColecoVision'})
xbmc.Player().play(listitem)

a1rwulf is correct. BlueMSX's command line parameters are exposed through Kodi's add-on settings. For example, see the settings.xml for Snes9x. These were extracted from the core's DLL using a small program I wrote called libretro-extract. When I return to the libretro wrapper (game.libretro) I'll merge this code and add settings.xml generation as a feature.

For now, you could create this file by hand. The variable name and list of values appear in libretro.c of the BlueMSX core.
BTC: 1JtXwJdGdE9YnYgThWBT2StFCU5sEYkbVD (personal), https://kodi.tv/contribute/donate-bitcoin (foundation). Donations in the form of controllers, especially ones that don't work in Kodi, are also appreciated.
Reply
#5
(2016-01-03, 23:22)garbear Wrote:
(2016-01-01, 21:41)zachmorris Wrote: 1) Tell Retroplayer which core to use without the user being prompted
(2016-01-02, 17:09)a1rwulf Wrote: ad 1)
As I only worked with NES, SNES and N64 all games started without prompting me.
I think it's because they use different file extensions - afaik this is coded into addon.xml of the game addon.
What I had a problem with was with the ppsspp core (there is no working game addon so far) - the games for this emulator (at least the ones I tried)
are ISO files - as videoplayer (former dvdplayer) also assumes this are movies, it did not start in Retroplayer.
I did no further work on this so far.
(2016-01-02, 21:44)zachmorris Wrote: For #1, I'm thinking about cases where there is one or more cores for the same platform. SNES Mercury is a good example. Instead of the user choosing Performance or Accuracy every time a game is launched, I'd like to include an option from my addon to let them set it once, or remain with the prompt for core choice.

Something along the lines of:
Code:
listitem = xbmcgui.ListItem ('Super Mario Bros')
listitem.setInfo('game', {'Title': 'Super Mario Bros', 'core': 'game.libretro.bsnes-mercury-performance'})
xbmc.Player().play(listitem)

This already exists, but I haven't documented it yet because the API will most likely be changed. it guarantees that the game will be launched with that core or not at all.

Case in point, I changed "gameclient" to "Addon.ID" (a7a4c57) to make it consistent with another API property. It looks like that change got lost during a rebase. For the better IMO, as "Addon.ID" doesn't really belong.

So should we rename this to "core"? "Game client" was earlier verbiage that kind of lost meaning as the scope of the project grew. It's appropriate though, as not all game clients are libretro cores.

(2016-01-01, 21:41)zachmorris Wrote: 2) Any additional options for passing config stuff to retroplayer depending on the core
Thanks!
(2016-01-02, 17:09)a1rwulf Wrote: ad 2)
What additional options do you mean?
There are several options that can be specified in one of the xml files.
They show up when you go into the addon section through settings and click on "configure".
This is where you can change the gfx plugin of mupen64 for example.
(2016-01-02, 21:44)zachmorris Wrote: For #2, depending on the core, some of them utilize command line arguments in some cases for standalone retroarch. Some examples:
BlueMSX, the machine option being a key one. Since BlueMSX has multiple emulators internally (MSX1, MSX2, Coleco), it's possible to set the machine type via command line. The same I think is true for other cores like Final Burn Alpha or MESS (both not in Retroplayer yet but could be at some point).

Where this probably makes the most sense though is with the -appendconfig command that retroarch has. There's some cases where a particular game needs different configuration, but uses a common core. The -appendconfig command will override the default settings when called. Is there a similar method for Retroplayer?

Something along the lines of:
Code:
listitem = xbmcgui.ListItem ('ColecoVision Game')
listitem.setInfo('game', {'Title': 'ColecoVision Game', 'core': 'game.libretro.bluemsx', 'appendconfig': 'bluemsx_msxtype = COL - ColecoVision'})
xbmc.Player().play(listitem)

a1rwulf is correct. BlueMSX's command line parameters are exposed through Kodi's add-on settings. For example, see the settings.xml for Snes9x. These were extracted from the core's DLL using a small program I wrote called libretro-extract. When I return to the libretro wrapper (game.libretro) I'll merge this code and add settings.xml generation as a feature.

For now, you could create this file by hand. The variable name and list of values appear in libretro.c of the BlueMSX core.

Thanks for the reply and explanations. I understand this is still kind of a moving target, so I'll hold off until the API is stable.
Reply
#6
As we get closer to RetroPlayer's PR I'll start a dialog about exposing such functionality properly. Things will stabilize around then.

In the meantime realize that the API is totally mutable. If you need a new feature or see something that should be done differently, let me know.

Reverting a7a4c57 should give you back control over emulator selection. For your convenience, here's the entire list of API editions atm:

  1. New listitem properties for Games (see here)
  2. Ability to construct xbmc.Addon object for uninstalled add-on (see here)
  3. Expose "extensions" and "platforms" tags from addon.xml to xbmc.Addon.getAddonInfo() (see here)
  4. Add "uninstalled" parameter to JSON-RPC Addons.GetAddons() (see here)
BTC: 1JtXwJdGdE9YnYgThWBT2StFCU5sEYkbVD (personal), https://kodi.tv/contribute/donate-bitcoin (foundation). Donations in the form of controllers, especially ones that don't work in Kodi, are also appreciated.
Reply
#7
I thought I'd revisit this again. I'm adding a number of game systems to my addon, like Coleco, Commodore 64, X6800, Apple 2GS, etc, all of which can be emulated using the libretro MAME core now. Using standalone retroarch, it's a bit complicated but it's possible using MAME softlists. A game can be launched via the command line with a command like this:
Code:
"App_Path/RetroArch" -- -L "Core_Path/mame_libretro.dylib" -rompath "Game_File_Base_Path/coleco/" coleco -cart "Game_File_Base_Path/coleco/Game_File.zip"

How would I launch this game using retroplayer with all that extra stuff in the command line?
Reply
#8
Hm, I'm not sure. I don't see those options in MAME's settings, but the settings could be incomplete. Somehow RetroArch sends those parameters through the libretro API. I'll have a look and update our APIs so that we can pass those parameters through.
BTC: 1JtXwJdGdE9YnYgThWBT2StFCU5sEYkbVD (personal), https://kodi.tv/contribute/donate-bitcoin (foundation). Donations in the form of controllers, especially ones that don't work in Kodi, are also appreciated.
Reply
#9
Heads up, you'll need the latest build from today. I fixed a bug that broke launching games from IARL
BTC: 1JtXwJdGdE9YnYgThWBT2StFCU5sEYkbVD (personal), https://kodi.tv/contribute/donate-bitcoin (foundation). Donations in the form of controllers, especially ones that don't work in Kodi, are also appreciated.
Reply
#10
It looks like these options are sent to the core via a combination of add-on settings and path scanning. One of MAME's options is "mess_media_type":

Code:
Core option:
     Description: Media type
     Key: mess_media_type
     Possible values:
             cart
             flop
             cdrm
             cass
             hard
             serl
             prin

I've been trying to track down the code that forwards these options to the core, but I'm not having much luck.

Do you have more examples of softlist commands and non-softlist commands?
BTC: 1JtXwJdGdE9YnYgThWBT2StFCU5sEYkbVD (personal), https://kodi.tv/contribute/donate-bitcoin (foundation). Donations in the form of controllers, especially ones that don't work in Kodi, are also appreciated.
Reply
#11
(2016-05-16, 09:20)garbear Wrote: Do you have more examples of softlist commands and non-softlist commands?

I'm not an expert, but here's a database I've started building for my addon. The softlist commands require the hash xml file to sort out launching the game correctly, in addition the media type and rompath needs to match the machine type (the folder has to be named exactly the way the MAME core expects it to be named or it wont launch). This is important since I had the hardest time getting some of these to work (x68000 and Neo Geo CD folder name was not as you would expected it to be named based on the convention they're using).

Here's some more examples for soflist launching:
Code:
Neo Geo CD (note that I used -cdrom and not -cdrm and it seems to work):
"/PATH_TO_RETROARCH/RetroArch" -- -L "/PATH_TO_RETROARCH_CORES/mame_libretro.dylib" -rompath "/PATH_TO_ROMS/neocdz/" neocdz -cdrom "/PATH_TO_ROMS/neocdz/neodrift.zip"

Commodore 64 Cart Games:
"/PATH_TO_RETROARCH/RetroArch" -- -L "/PATH_TO_RETROARCH_CORES/mame_libretro.dylib" -rompath "/PATH_TO_ROMS/c64/" c64 -cart "/PATH_TO_ROMS/c64/buckrog.zip"

Commodore 64 Floppy Games:
"/PATH_TO_RETROARCH/RetroArch" -- -L "/PATH_TO_RETROARCH_CORES/mame_libretro.dylib" -rompath "/PATH_TO_ROMS/c64/" c64 -flop "/PATH_TO_ROMS/c64/rambo3.zip"

Apple 2GS:
"/PATH_TO_RETROARCH/RetroArch" -- -L "/PATH_TO_RETROARCH_CORES/mame_libretro.dylib" -rompath "/PATH_TO_ROMS/apple2gs/" apple2gs -flop "/PATH_TO_ROMS/apple2gs/zanygolf.zip"

CDi ( yes, I know this system is notoriously bad, but I don't descriminate against bad games ;-) )
"/PATH_TO_RETROARCH/RetroArch" -- -L "/PATH_TO_RETROARCH_CORES/mame_libretro.dylib" -rompath "/PATH_TO_ROMS/cdimono1/" cdimono1 -cdrom "/PATH_TO_ROMS/cdimono1/zeldaadv.zip"

PC9821:
"/PATH_TO_RETROARCH/RetroArch" -- -L "/PATH_TO_RETROARCH_CORES/mame_libretro.dylib" -rompath "/PATH_TO_ROMS/pc9821/" pc9821 -flop "/PATH_TO_ROMS/pc9821/planetdr.zip"

Sharp X1 Cassette:
"/PATH_TO_RETROARCH/RetroArch" -- -L "/PATH_TO_RETROARCH_CORES/mame_libretro.dylib" -rompath "/PATH_TO_ROMS/x1/" x1 -cass "/PATH_TO_ROMS/x1/digdug.zip"

Sharp X1 Floppy:
"/PATH_TO_RETROARCH/RetroArch" -- -L "/PATH_TO_RETROARCH_CORES/mame_libretro.dylib" -rompath "/PATH_TO_ROMS/x1/" x1 -flop "/PATH_TO_ROMS/x1/1942.zip"


For non-soflist launching you simply point to the file and the game launches, and I believe the MAME core assumes it should then use the non-MESS (arcade) machine type
Code:
/PATH_TO_RETROARCH/RetroArch" -- -L "/PATH_TO_RETROARCH_CORES/mame_libretro.dylib" "PATH_TO_ROMS/game.zip"
Reply
#12
Thanks for the MAME info. I'll start putting this to use.

Unrelated, but you can call ActivateWindow(GameSavestates,path_to_game.rom) to show the savestate manager for the given rom path.
BTC: 1JtXwJdGdE9YnYgThWBT2StFCU5sEYkbVD (personal), https://kodi.tv/contribute/donate-bitcoin (foundation). Donations in the form of controllers, especially ones that don't work in Kodi, are also appreciated.
Reply
#13
Well, I may have spoke too soon on these commands. I've found that actually the game will launch if the hash file is in the retroarch system directory and you just launch normally using:
Code:
"/PATH_TO_RETROARCH/RetroArch" -- -L "/PATH_TO_ROMS/c64/buckrog.zip"

Seems like it works so long as there isn't a rom named exactly the same in a different machine? It's confusing on how it should work to say the least.
Reply
#14
@garbear, @all

Hi all. I would like to push forward a bit the discussion of the metadata fields and the assets for games. The reason is that I think it would be great for everyone to have a standard for games in Kodi ASAP to finally fix the database format for Advanced Emulator Launcher and Advanced MAME Launcher.

For example, in this commit @garbear instroduced some initial fields (title, platform, region, publisher and gameclient). Currently AEL/AML use a custom list of platforms. I tried to locate the file GameManager.cpp in github to make my list of platforms same as Kodi but didn't find it.

I have compiled some information about metadata and assets available for games in this document.
Reply



Kodi, Retroplayer and Player class00