Debian Codegraph @

xbmc/games/addons/GameClientInGameSaves.h

raw
1 /*
2 * Copyright (C) 2016-2018 Team Kodi
3 * This file is part of Kodi - https://kodi.tv
4 *
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 * See LICENSES/README.md for more information.
7 */
8
9 #pragma once
10
11 #include "addons/kodi-dev-kit/include/kodi/addon-instance/Game.h"
12
13 #include <string>
14
15 struct GameClient;
16
17 namespace KODI
18 {
19 namespace GAME
20 {
21 class CGameClient;
22
23 /*!
24 * \ingroup games
25 *
26 * \brief This class implements in-game saves.
27 *
28 * \details Some games do not implement state persistence on their own, but rely on the frontend for
29 * saving their current memory state to disk. This is mostly the case for emulators for SRAM
30 * (battery backed up ram on cartridges) or memory cards.
31 *
32 * Differences to save states:
33 * - Works only for supported games (e.g. emulated games with SRAM support)
34 * - Often works emulator independent (and can be used to start a game with one emulator and
35 * continue with another)
36 * - Visible in-game (e.g. in-game save game selection menus)
37 */
38 class CGameClientInGameSaves
39 {
40 public:
41 /*!
42 * \brief Constructor.
43 * \param addon The game client implementation.
44 * \param dllStruct The emulator or game for which the in-game saves are processed.
45 */
46 CGameClientInGameSaves(CGameClient* addon, const AddonInstance_Game* dllStruct);
47
48 /*!
49 * \brief Load in-game data.
50 */
51 void Load();
52
53 /*!
54 * \brief Save in-game data.
55 */
56 void Save();
57
58 private:
59 std::string GetPath(GAME_MEMORY memoryType);
60
61 void Load(GAME_MEMORY memoryType);
62 void Save(GAME_MEMORY memoryType);
63
64 const CGameClient* const m_gameClient;
65 const AddonInstance_Game* const m_dllStruct;
66 };
67 } // namespace GAME
68 } // namespace KODI