Kodi Community Forum

Full Version: How are standalone game providers launched?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I can't seem to work out how to launch a non-emulator addon. For example the 2048 game that comes build with kodi-game now will only show up if I try to view all addons, and then it is unlaunchable. As far as I can tell, the only way to use the extra functionality provided by kodi-game and the whole Game API system is by launching emulators by browsing to ROMs in the filesystem.

The reason that I want to do this is that have made some changes to game.moonlight to allow it to compile, but now that it's back in Kodi, I can't seem to launch it. As far as I can tell, kodi-game standalone addons need the extension point="kodi.gameclient", but then these won't launch for me.

Thanks for any additional info!
Looks like something broke in the last rebase. If an add-on specifies supports_standalone like game.moonlight, then it should show up under Game Add-ons (along with game scripts and game plugins). I'll get this bug fixed and push out a new build.

Another bug is that you can't launch standalone add-ons from the add-on info window. I'll try to fix this as well. I'll post back when both bugs are fixed.
This has been fixed in my retroplayer-17beta3 branch. I'll upload builds for windows and osx to the builds thread.
Hey thanks for fixing the issue. I've pulled and built the latest version and its working perfectly.

Unfortunately, it looks like the fixes I made to game.moonlight allowed it to compile but are causing it to crash with
GAME - LoadStandalone() - addon 'game.moonlight' returned an error: the command failed

How do you go about debugging with Kodi, and Kodi plugins in general? I can find a lot of information on the wiki about compiling but nothing about debugging. I'm happy to work in Visual Studio in Windows or Eclipse in Ubuntu, or ...?
Debugging on windows will get a lot easier once PR10753 is merged. For now, I avoid debugging on windows and use either Eclipse or Xcode.

In Eclipse, debugging is possible if you compile game.moonlight in debug mode. See the updated build instructions at https://github.com/garbear/game.moonlight (section "Developing on Linux")
Okay thanks for the details. I have both Kodi and game.moonlight debuggable in Eclipse. However, the addon won't run on its own without Kodi.

I can build the addon and install, which copies the libraries over so the addon is present in Kodi. However, I can't make breakpoints in the addon code, because the source files aren't in the Kodi project.

How can I test addons (with breakpoints etc) in Eclipse which are launched from within a Kodi instance?

Hope this makes sense! Thanks again.
You can set a breakpoint in CGameClient and then step into the add-on. This will pull the source file up in Eclipse, and then you can set breakpoints in that file. There's two main points you'll want to start with:

Add-on initialization:

In Initialize(), set a breakpoint before Create(). Then step into Create() and proceed until this line (hint: it's 6 steps). At this point, m_pDll->Create() will step into the add-on's initialization function here in game.moonlight.

Game loading:

The next time the add-on is entered is when a game is loaded in standalone mode. You should set a breakpoint here. Stepping into m_pStruct->LoadStandalone() will take you here in game.moonlight where gameplay is initialized.

Hope that helps.