garbear / xbmc

XBMC Main Repository
http://xbmc.org
Other
132 stars 53 forks source link

RetroPlayer: Add Achievements #126

Closed Shardul555 closed 2 months ago

Shardul555 commented 3 years ago

Description

This Pull request adds support for Achievements in RetroPlayer, data fetched from RetroAchievements API have information about the achievements provided for a particular game, so we used that data for activating achievements, obtaining achievement state for every frame and then awarding it whenever it triggered. User will be notified about an unlocked achievement through a pop-up notification and also through their RetroAchievement.org profile. This PR will use https://github.com/kodi-game/game.libretro/pull/73 for calling rcheevos functions.

Motivation and Context

Last year we have added support for RCheevos in RetroPlayer, so adding support for Achievements is one another task that was needed to be accomplished.

How Has This Been Tested?

Screenshots (if appropriate):

Notifying user through pop-up notification: image Information updated in RetroAchievements profile: image

Types of change

Checklist:

garbear commented 3 years ago

Sorry, I missed this PR when you opened it 6 days ago. Congratulations on the first PR of the summer, even if it is for debugging purposes! It helps greatly to see your progress as time goes on. It looks like you're on the right track. Let me know when you want more specific feedback on the code.

Shardul555 commented 3 years ago

Hey @garbear , I am facing an issue while building these functions in VS 2019, as soon as I am opening any game, Kodi execution is breaking. Because of it, I am not able to debug various changes done till now. As soon as I am removing the functions I have written, Kodi is running fine. If you have any idea related to it then please guide. Screenshot for the issue: image log file for it: https://paste.kodi.tv/pejiqepuyi.kodi

garbear commented 3 years ago

I've had this happen before. The problem is a mismatch in the API used for game.libretro and the API used in Kodi. Kodi is definitely loading a stale version of game.libretro.

When you add a function to the API, then the "ABI", application binary interface, is changed. Adding a function means you have to recompile against the correct headers. You're seeing 0x000000 because the added function pointer is missing in the stale game.libretro - it doesn't know about the new functions, so it doesn't assign them pointers, leaving them NULL.

Because adding a function breaks ABI in an incompatible way, to follow semver, you should change this version to 3.0.0: https://github.com/garbear/xbmc/blob/retroplayer-19.1/xbmc/addons/kodi-dev-kit/include/kodi/versions.h#L100. This change to 3.0.0 should appear in the diff of this PR.

You know you bumped to 3.0.0 correctly when the generated addon.xml file replaces ADDON_DEPENDS here with kodi.game 3.0.0. Look in the game.libretro folder for addon.xml to make sure it's generated against the correct version of Kodi's Game API.

There are two ways to build binary add-ons for Windows, which way are you using to build game.libretro? One way is better suited for development - once you get that working, it'll be easier to keep game.libretro in sync.

Shardul555 commented 3 years ago

@garbear ,Firstly commenting on how I build game.libretro : I followed https://github.com/NikosSiak/game.libretro#developing-on-windows it for developing and after these commands one additional command: cmake --install . --config Debug --prefix {path_to_kodi_build_folder}\addons from location {path_to_kodi_source_folder}\cmake\addons\build\game.libretro-prefix\src\game.libretro-build. This procedure builds my game.libretro.

Now about changing version to 3.0.0, even after changing version to 3.0.0 and building it again, the generated addon.xml file in xbmc\cmake\addons\build\game.libretro\game.libretro location does not change as expected, it is same as previous. addon.xml.in file content:

`<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <addon id="game.libretro" name="Libretro Compatibility" version="2.3.0" provider-name="Team Kodi">

@ADDON_DEPENDS@

<extension point="kodi.gameclient" library_@PLATFORM@="@LIBRARY_FILENAME@">

Libretro-Kompatibilitätsschicht für Kodi's Spiele API Libretro compatibility layer for Kodi's Game API Dieses Add-On bietet einen Umwandler für Libretro-Kerne, mit dem sie als Spielsystem Add-On's für Kodi geladen und genutzt werden können. This add-on provides a wrapper for libretro cores, allowing them to be loaded as game add-ons. @PLATFORM@ GPL-2.0-or-later https://github.com/kodi-game/game.libretro icon.png

`

garbear commented 2 years ago

@Shardul555 Can you hit "Edit" next to the PR title and change the base target branch to feature_achievements?

Shardul555 commented 2 years ago

@Shardul555 Can you hit "Edit" next to the PR title and change the base target branch to feature_achievements?

Sorry @garbear , I was not active on the github account so I missed this message , but yes I will do it till tomorrow

garbear commented 2 years ago

@Shardul555 Aside from the two files I commented on, can you squash everything into a single commit? Besides needing Kodi to compile between all commits for bisection, for major add-on version bumps, I try to keep all the code for a feature together.

After squashing, I would expect the first commit to the feature addition, followed by the two commits I commented on. The expectation is that the "temporary" commits will be upstreamed or discarded before merge.

Finally, your squashed commit should follow good commit message style. A possible commit title is Add Achievements in RetroPlayer, short and simple. Extra detail can go in a description.

garbear commented 2 years ago

Technically, review should have continued in this PR instead of creating a new, clean one, but it's not a problem because PRs can be linked. Can you close this PR and link to the new one?

Hedda commented 2 years ago

Any updates/news on https://github.com/kodi-game/game.libretro/pull/73 and https://github.com/garbear/xbmc/pull/126 or https://github.com/garbear/xbmc/pull/127 now that https://github.com/kodi-game/game.libretro/pull/67 has been merged?

garbear commented 2 years ago

Keep an eye on master!

garbear commented 2 months ago

Superseded by https://github.com/garbear/xbmc/pull/127