aboutsummaryrefslogtreecommitdiff
path: root/samples/DX_APIUsage/GfeSDKWrapper.hpp
blob: f84a55cd488ed87f122cd54a73bab510299dc0fb (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
/* Copyright (c) 2018, NVIDIA CORPORATION.  All rights reserved.
*
* NVIDIA CORPORATION and its licensors retain all intellectual property
* and proprietary rights in and to this software, related documentation
* and any modifications thereto.  Any use, reproduction, disclosure or
* distribution of this software and related documentation without an express
* license agreement from NVIDIA CORPORATION is strictly prohibited.
*/

#pragma once

#include <codecvt>
#include <locale>
#include <memory>

#include <gfesdk/bindings/cpp/isdk_cpp_impl.h>
#include <gfesdk/bindings/cpp/highlights/ihighlights_cpp_impl.h>

namespace Json
{
class Value;
}

class GfeSdkWrapper
{
public:
    GfeSdkWrapper();

    void Init(char const* gameName, char const* defaultLocale, GfeSDK::NVGSDK_Highlight* highlights, size_t numHighlights, char const* targetPath, int targetPid);
    void DeInit();
    void OnTick(void);
    void OnNotification(GfeSDK::NVGSDK_NotificationType type, GfeSDK::NotificationBase const&);
    void OnOpenGroup(std::string const& id);
    void OnCloseGroup(std::string const& id, bool destroy = false);
    void OnSaveScreenshot(std::string const& highlightId, std::string const& groupId);
    void OnSaveVideo(std::string const& highlightId, std::string const& groupId, int startDelta, int endDelta);
    void OnGetNumHighlights(std::string const& groupId, GfeSDK::NVGSDK_HighlightSignificance sigFilter, GfeSDK::NVGSDK_HighlightType tagFilter);
    void OnOpenSummary(char const* groupIds[], size_t numGroups, GfeSDK::NVGSDK_HighlightSignificance sigFilter, GfeSDK::NVGSDK_HighlightType tagFilter);
    void OnRequestLanguage(void);
    void OnRequestUserSettings(void);

    wchar_t const* GetCurrentPermissionStr(void);
    wchar_t const* GetLastOverlayEvent(void);
    wchar_t const* GetLastResult(void);
    wchar_t const* GetLastQueryResult(void);

private:
    void ConfigureHighlights(char const* defaultLocale, GfeSDK::NVGSDK_Highlight* highlights, size_t numHighlights);
    void UpdateLastResultString(GfeSDK::NVGSDK_RetCode rc);

    std::unique_ptr<GfeSDK::Core> m_gfesdk;
    std::unique_ptr<GfeSDK::Highlights> m_highlights;

    std::wstring_convert<std::codecvt_utf8<wchar_t>> m_converter;
    std::wstring m_currentPermission;
    std::wstring m_lastOverlayEvent;
    std::wstring m_lastResult;
    std::wstring m_lastQueryResult;
};

inline void InitGfeSdkWrapper(GfeSdkWrapper* hl) {}