summary refs log tree commit diff stats
path: root/vendor/fmod/inc/fmod_studio_common.h
blob: e22d9930a03bf1f2549a1ef80ab1caa8609d4ca3 (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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
/* ======================================================================================== */
/* FMOD Studio API - Common C/C++ header file.                                              */
/* Copyright (c), Firelight Technologies Pty, Ltd. 2004-2021.                               */
/*                                                                                          */
/* This header defines common enumerations, structs and callbacks that are shared between   */
/* the C and C++ interfaces.                                                                */
/*                                                                                          */
/* For more detail visit:                                                                   */
/* https://fmod.com/resources/documentation-api?version=2.0&page=page=studio-api.html       */
/* ======================================================================================== */
#ifndef FMOD_STUDIO_COMMON_H
#define FMOD_STUDIO_COMMON_H

#include "fmod.h"

/*
    FMOD Studio types.
*/
typedef struct          FMOD_STUDIO_SYSTEM           FMOD_STUDIO_SYSTEM;
typedef struct          FMOD_STUDIO_EVENTDESCRIPTION FMOD_STUDIO_EVENTDESCRIPTION;
typedef struct          FMOD_STUDIO_EVENTINSTANCE    FMOD_STUDIO_EVENTINSTANCE;
typedef struct          FMOD_STUDIO_BUS              FMOD_STUDIO_BUS;
typedef struct          FMOD_STUDIO_VCA              FMOD_STUDIO_VCA;
typedef struct          FMOD_STUDIO_BANK             FMOD_STUDIO_BANK;
typedef struct          FMOD_STUDIO_COMMANDREPLAY    FMOD_STUDIO_COMMANDREPLAY;

/*
    FMOD Studio constants
*/
#define FMOD_STUDIO_LOAD_MEMORY_ALIGNMENT                   32

typedef unsigned int FMOD_STUDIO_INITFLAGS;
#define FMOD_STUDIO_INIT_NORMAL                             0x00000000
#define FMOD_STUDIO_INIT_LIVEUPDATE                         0x00000001
#define FMOD_STUDIO_INIT_ALLOW_MISSING_PLUGINS              0x00000002
#define FMOD_STUDIO_INIT_SYNCHRONOUS_UPDATE                 0x00000004
#define FMOD_STUDIO_INIT_DEFERRED_CALLBACKS                 0x00000008
#define FMOD_STUDIO_INIT_LOAD_FROM_UPDATE                   0x00000010
#define FMOD_STUDIO_INIT_MEMORY_TRACKING                    0x00000020

typedef unsigned int FMOD_STUDIO_PARAMETER_FLAGS;
#define FMOD_STUDIO_PARAMETER_READONLY                      0x00000001
#define FMOD_STUDIO_PARAMETER_AUTOMATIC                     0x00000002
#define FMOD_STUDIO_PARAMETER_GLOBAL                        0x00000004
#define FMOD_STUDIO_PARAMETER_DISCRETE                      0x00000008
#define FMOD_STUDIO_PARAMETER_LABELED                       0x00000010

typedef unsigned int FMOD_STUDIO_SYSTEM_CALLBACK_TYPE;
#define FMOD_STUDIO_SYSTEM_CALLBACK_PREUPDATE               0x00000001
#define FMOD_STUDIO_SYSTEM_CALLBACK_POSTUPDATE              0x00000002
#define FMOD_STUDIO_SYSTEM_CALLBACK_BANK_UNLOAD             0x00000004
#define FMOD_STUDIO_SYSTEM_CALLBACK_LIVEUPDATE_CONNECTED    0x00000008
#define FMOD_STUDIO_SYSTEM_CALLBACK_LIVEUPDATE_DISCONNECTED 0x00000010
#define FMOD_STUDIO_SYSTEM_CALLBACK_ALL                     0xFFFFFFFF

typedef unsigned int FMOD_STUDIO_EVENT_CALLBACK_TYPE;
#define FMOD_STUDIO_EVENT_CALLBACK_CREATED                  0x00000001
#define FMOD_STUDIO_EVENT_CALLBACK_DESTROYED                0x00000002
#define FMOD_STUDIO_EVENT_CALLBACK_STARTING                 0x00000004
#define FMOD_STUDIO_EVENT_CALLBACK_STARTED                  0x00000008
#define FMOD_STUDIO_EVENT_CALLBACK_RESTARTED                0x00000010
#define FMOD_STUDIO_EVENT_CALLBACK_STOPPED                  0x00000020
#define FMOD_STUDIO_EVENT_CALLBACK_START_FAILED             0x00000040
#define FMOD_STUDIO_EVENT_CALLBACK_CREATE_PROGRAMMER_SOUND  0x00000080
#define FMOD_STUDIO_EVENT_CALLBACK_DESTROY_PROGRAMMER_SOUND 0x00000100
#define FMOD_STUDIO_EVENT_CALLBACK_PLUGIN_CREATED           0x00000200
#define FMOD_STUDIO_EVENT_CALLBACK_PLUGIN_DESTROYED         0x00000400
#define FMOD_STUDIO_EVENT_CALLBACK_TIMELINE_MARKER          0x00000800
#define FMOD_STUDIO_EVENT_CALLBACK_TIMELINE_BEAT            0x00001000
#define FMOD_STUDIO_EVENT_CALLBACK_SOUND_PLAYED             0x00002000
#define FMOD_STUDIO_EVENT_CALLBACK_SOUND_STOPPED            0x00004000
#define FMOD_STUDIO_EVENT_CALLBACK_REAL_TO_VIRTUAL          0x00008000
#define FMOD_STUDIO_EVENT_CALLBACK_VIRTUAL_TO_REAL          0x00010000
#define FMOD_STUDIO_EVENT_CALLBACK_START_EVENT_COMMAND      0x00020000
#define FMOD_STUDIO_EVENT_CALLBACK_NESTED_TIMELINE_BEAT     0x00040000
#define FMOD_STUDIO_EVENT_CALLBACK_ALL                      0xFFFFFFFF

typedef unsigned int FMOD_STUDIO_LOAD_BANK_FLAGS;
#define FMOD_STUDIO_LOAD_BANK_NORMAL                        0x00000000
#define FMOD_STUDIO_LOAD_BANK_NONBLOCKING                   0x00000001
#define FMOD_STUDIO_LOAD_BANK_DECOMPRESS_SAMPLES            0x00000002
#define FMOD_STUDIO_LOAD_BANK_UNENCRYPTED                   0x00000004

typedef unsigned int FMOD_STUDIO_COMMANDCAPTURE_FLAGS;
#define FMOD_STUDIO_COMMANDCAPTURE_NORMAL                   0x00000000
#define FMOD_STUDIO_COMMANDCAPTURE_FILEFLUSH                0x00000001
#define FMOD_STUDIO_COMMANDCAPTURE_SKIP_INITIAL_STATE       0x00000002

typedef unsigned int FMOD_STUDIO_COMMANDREPLAY_FLAGS;
#define FMOD_STUDIO_COMMANDREPLAY_NORMAL                    0x00000000
#define FMOD_STUDIO_COMMANDREPLAY_SKIP_CLEANUP              0x00000001
#define FMOD_STUDIO_COMMANDREPLAY_FAST_FORWARD              0x00000002
#define FMOD_STUDIO_COMMANDREPLAY_SKIP_BANK_LOAD            0x00000004

typedef enum FMOD_STUDIO_LOADING_STATE
{
    FMOD_STUDIO_LOADING_STATE_UNLOADING,
    FMOD_STUDIO_LOADING_STATE_UNLOADED,
    FMOD_STUDIO_LOADING_STATE_LOADING,
    FMOD_STUDIO_LOADING_STATE_LOADED,
    FMOD_STUDIO_LOADING_STATE_ERROR,

    FMOD_STUDIO_LOADING_STATE_FORCEINT = 65536  /* Makes sure this enum is signed 32bit. */
} FMOD_STUDIO_LOADING_STATE;

typedef enum FMOD_STUDIO_LOAD_MEMORY_MODE
{
    FMOD_STUDIO_LOAD_MEMORY,
    FMOD_STUDIO_LOAD_MEMORY_POINT,

    FMOD_STUDIO_LOAD_MEMORY_FORCEINT = 65536    /* Makes sure this enum is signed 32bit. */
} FMOD_STUDIO_LOAD_MEMORY_MODE;

typedef enum FMOD_STUDIO_PARAMETER_TYPE
{
    FMOD_STUDIO_PARAMETER_GAME_CONTROLLED,
    FMOD_STUDIO_PARAMETER_AUTOMATIC_DISTANCE,
    FMOD_STUDIO_PARAMETER_AUTOMATIC_EVENT_CONE_ANGLE,
    FMOD_STUDIO_PARAMETER_AUTOMATIC_EVENT_ORIENTATION,
    FMOD_STUDIO_PARAMETER_AUTOMATIC_DIRECTION,
    FMOD_STUDIO_PARAMETER_AUTOMATIC_ELEVATION,
    FMOD_STUDIO_PARAMETER_AUTOMATIC_LISTENER_ORIENTATION,
    FMOD_STUDIO_PARAMETER_AUTOMATIC_SPEED,
    FMOD_STUDIO_PARAMETER_AUTOMATIC_SPEED_ABSOLUTE,
    FMOD_STUDIO_PARAMETER_AUTOMATIC_DISTANCE_NORMALIZED,

    FMOD_STUDIO_PARAMETER_MAX,
    FMOD_STUDIO_PARAMETER_FORCEINT = 65536                  /* Makes sure this enum is signed 32bit. */
} FMOD_STUDIO_PARAMETER_TYPE;

typedef enum FMOD_STUDIO_USER_PROPERTY_TYPE
{
    FMOD_STUDIO_USER_PROPERTY_TYPE_INTEGER,
    FMOD_STUDIO_USER_PROPERTY_TYPE_BOOLEAN,
    FMOD_STUDIO_USER_PROPERTY_TYPE_FLOAT,
    FMOD_STUDIO_USER_PROPERTY_TYPE_STRING,

    FMOD_STUDIO_USER_PROPERTY_TYPE_FORCEINT = 65536 /* Makes sure this enum is signed 32bit. */
} FMOD_STUDIO_USER_PROPERTY_TYPE;

typedef enum FMOD_STUDIO_EVENT_PROPERTY
{
    FMOD_STUDIO_EVENT_PROPERTY_CHANNELPRIORITY,
    FMOD_STUDIO_EVENT_PROPERTY_SCHEDULE_DELAY,
    FMOD_STUDIO_EVENT_PROPERTY_SCHEDULE_LOOKAHEAD,
    FMOD_STUDIO_EVENT_PROPERTY_MINIMUM_DISTANCE,
    FMOD_STUDIO_EVENT_PROPERTY_MAXIMUM_DISTANCE,
    FMOD_STUDIO_EVENT_PROPERTY_COOLDOWN,
    FMOD_STUDIO_EVENT_PROPERTY_MAX,

    FMOD_STUDIO_EVENT_PROPERTY_FORCEINT = 65536     /* Makes sure this enum is signed 32bit. */
} FMOD_STUDIO_EVENT_PROPERTY;

typedef enum FMOD_STUDIO_PLAYBACK_STATE
{
    FMOD_STUDIO_PLAYBACK_PLAYING,
    FMOD_STUDIO_PLAYBACK_SUSTAINING,
    FMOD_STUDIO_PLAYBACK_STOPPED,
    FMOD_STUDIO_PLAYBACK_STARTING,
    FMOD_STUDIO_PLAYBACK_STOPPING,

    FMOD_STUDIO_PLAYBACK_FORCEINT = 65536
} FMOD_STUDIO_PLAYBACK_STATE;

typedef enum FMOD_STUDIO_STOP_MODE
{
    FMOD_STUDIO_STOP_ALLOWFADEOUT,
    FMOD_STUDIO_STOP_IMMEDIATE,

    FMOD_STUDIO_STOP_FORCEINT = 65536           /* Makes sure this enum is signed 32bit. */
} FMOD_STUDIO_STOP_MODE;

typedef enum FMOD_STUDIO_INSTANCETYPE
{
    FMOD_STUDIO_INSTANCETYPE_NONE,
    FMOD_STUDIO_INSTANCETYPE_SYSTEM,
    FMOD_STUDIO_INSTANCETYPE_EVENTDESCRIPTION,
    FMOD_STUDIO_INSTANCETYPE_EVENTINSTANCE,
    FMOD_STUDIO_INSTANCETYPE_PARAMETERINSTANCE,
    FMOD_STUDIO_INSTANCETYPE_BUS,
    FMOD_STUDIO_INSTANCETYPE_VCA,
    FMOD_STUDIO_INSTANCETYPE_BANK,
    FMOD_STUDIO_INSTANCETYPE_COMMANDREPLAY,

    FMOD_STUDIO_INSTANCETYPE_FORCEINT = 65536    /* Makes sure this enum is signed 32bit. */
} FMOD_STUDIO_INSTANCETYPE;

/*
    FMOD Studio structures
*/
typedef struct FMOD_STUDIO_BANK_INFO
{
    int                      size;
    void                    *userdata;
    int                      userdatalength;
    FMOD_FILE_OPEN_CALLBACK  opencallback;
    FMOD_FILE_CLOSE_CALLBACK closecallback;
    FMOD_FILE_READ_CALLBACK  readcallback;
    FMOD_FILE_SEEK_CALLBACK  seekcallback;
} FMOD_STUDIO_BANK_INFO;

typedef struct FMOD_STUDIO_PARAMETER_ID
{
    unsigned int data1;
    unsigned int data2;
} FMOD_STUDIO_PARAMETER_ID;

typedef struct FMOD_STUDIO_PARAMETER_DESCRIPTION
{
    const char                 *name;
    FMOD_STUDIO_PARAMETER_ID    id;
    float                       minimum;
    float                       maximum;
    float                       defaultvalue;
    FMOD_STUDIO_PARAMETER_TYPE  type;
    FMOD_STUDIO_PARAMETER_FLAGS flags;
    FMOD_GUID                   guid;
} FMOD_STUDIO_PARAMETER_DESCRIPTION;

typedef struct FMOD_STUDIO_USER_PROPERTY
{
    const char                     *name;
    FMOD_STUDIO_USER_PROPERTY_TYPE  type;

    union
    {
        int         intvalue;
        FMOD_BOOL   boolvalue;
        float       floatvalue;
        const char *stringvalue;
    };
} FMOD_STUDIO_USER_PROPERTY;

typedef struct FMOD_STUDIO_PROGRAMMER_SOUND_PROPERTIES
{
    const char  *name;
    FMOD_SOUND  *sound;
    int          subsoundIndex;
} FMOD_STUDIO_PROGRAMMER_SOUND_PROPERTIES;

typedef struct FMOD_STUDIO_PLUGIN_INSTANCE_PROPERTIES
{
    const char *name;
    FMOD_DSP   *dsp;
} FMOD_STUDIO_PLUGIN_INSTANCE_PROPERTIES;

typedef struct FMOD_STUDIO_TIMELINE_MARKER_PROPERTIES
{
    const char *name;
    int         position;
} FMOD_STUDIO_TIMELINE_MARKER_PROPERTIES;

typedef struct FMOD_STUDIO_TIMELINE_BEAT_PROPERTIES
{
    int     bar;
    int     beat;
    int     position;
    float   tempo;
    int     timesignatureupper;
    int     timesignaturelower;
} FMOD_STUDIO_TIMELINE_BEAT_PROPERTIES;

typedef struct FMOD_STUDIO_TIMELINE_NESTED_BEAT_PROPERTIES
{
    FMOD_GUID                               eventid;
    FMOD_STUDIO_TIMELINE_BEAT_PROPERTIES    properties;
} FMOD_STUDIO_TIMELINE_NESTED_BEAT_PROPERTIES;

typedef struct FMOD_STUDIO_ADVANCEDSETTINGS
{
    int             cbsize;
    unsigned int    commandqueuesize;
    unsigned int    handleinitialsize;
    int             studioupdateperiod;
    int             idlesampledatapoolsize;
    unsigned int    streamingscheduledelay;
    const char*     encryptionkey;
} FMOD_STUDIO_ADVANCEDSETTINGS;

typedef struct FMOD_STUDIO_CPU_USAGE
{
    float           update;
} FMOD_STUDIO_CPU_USAGE;

typedef struct FMOD_STUDIO_BUFFER_INFO
{
    int             currentusage;
    int             peakusage;
    int             capacity;
    int             stallcount;
    float           stalltime;
} FMOD_STUDIO_BUFFER_INFO;

typedef struct FMOD_STUDIO_BUFFER_USAGE
{
    FMOD_STUDIO_BUFFER_INFO studiocommandqueue;
    FMOD_STUDIO_BUFFER_INFO studiohandle;
} FMOD_STUDIO_BUFFER_USAGE;

typedef struct FMOD_STUDIO_SOUND_INFO
{
    const char             *name_or_data;
    FMOD_MODE               mode;
    FMOD_CREATESOUNDEXINFO  exinfo;
    int                     subsoundindex;
} FMOD_STUDIO_SOUND_INFO;

typedef struct FMOD_STUDIO_COMMAND_INFO
{
    const char                 *commandname;
    int                         parentcommandindex;
    int                         framenumber;
    float                       frametime;
    FMOD_STUDIO_INSTANCETYPE    instancetype;
    FMOD_STUDIO_INSTANCETYPE    outputtype;
    unsigned int                instancehandle;
    unsigned int                outputhandle;
} FMOD_STUDIO_COMMAND_INFO;

typedef struct FMOD_STUDIO_MEMORY_USAGE
{
    int exclusive;
    int inclusive;
    int sampledata;
} FMOD_STUDIO_MEMORY_USAGE;

/*
    FMOD Studio callbacks.
*/
typedef FMOD_RESULT (F_CALLBACK *FMOD_STUDIO_SYSTEM_CALLBACK)                           (FMOD_STUDIO_SYSTEM *system, FMOD_STUDIO_SYSTEM_CALLBACK_TYPE type, void *commanddata, void *userdata);
typedef FMOD_RESULT (F_CALLBACK *FMOD_STUDIO_EVENT_CALLBACK)                            (FMOD_STUDIO_EVENT_CALLBACK_TYPE type, FMOD_STUDIO_EVENTINSTANCE *event, void *parameters);
typedef FMOD_RESULT (F_CALLBACK *FMOD_STUDIO_COMMANDREPLAY_FRAME_CALLBACK)              (FMOD_STUDIO_COMMANDREPLAY *replay, int commandindex, float currenttime, void *userdata);
typedef FMOD_RESULT (F_CALLBACK *FMOD_STUDIO_COMMANDREPLAY_LOAD_BANK_CALLBACK)          (FMOD_STUDIO_COMMANDREPLAY *replay, int commandindex, const FMOD_GUID *bankguid, const char *bankfilename, FMOD_STUDIO_LOAD_BANK_FLAGS flags, FMOD_STUDIO_BANK **bank, void *userdata);
typedef FMOD_RESULT (F_CALLBACK *FMOD_STUDIO_COMMANDREPLAY_CREATE_INSTANCE_CALLBACK)    (FMOD_STUDIO_COMMANDREPLAY *replay, int commandindex, FMOD_STUDIO_EVENTDESCRIPTION *eventdescription, FMOD_STUDIO_EVENTINSTANCE **instance, void *userdata);

#endif // FMOD_STUDIO_COMMON_H
ass="n">painting_mapping[mapping_it.key()] = mapping_it.value(); } } connected = true; has_connection_result = true; RefreshTracker(); apclient->Get(tracked_data_storage_keys); apclient->SetNotify(tracked_data_storage_keys); }); apclient->set_slot_refused_handler( [this](const std::list<std::string>& errors) { connected = false; has_connection_result = true; tracker_frame->SetStatusMessage("Disconnected from Archipelago."); std::vector<std::string> error_messages; error_messages.push_back("Could not connect to Archipelago."); for (const std::string& error : errors) { if (error == "InvalidSlot") { error_messages.push_back("Invalid player name."); } else if (error == "InvalidGame") { error_messages.push_back( "The specified player is not playing Lingo."); } else if (error == "IncompatibleVersion") { error_messages.push_back( "The Archipelago server is not the correct version for this " "client."); } else if (error == "InvalidPassword") { error_messages.push_back("Incorrect password."); } else if (error == "InvalidItemsHandling") { error_messages.push_back( "Invalid item handling flag. This is a bug with the tracker. " "Please report it to the lingo-ap-tracker GitHub."); } else { error_messages.push_back("Unknown error."); } } std::string full_message = hatkirby::implode(error_messages, " "); TrackerLog(full_message); wxMessageBox(full_message, "Connection failed", wxOK | wxICON_ERROR); }); client_active = true; int timeout = 5000; // 5 seconds int interval = 100; int remaining_loops = timeout / interval; while (!has_connection_result) { if (interval == 0) { connected = false; has_connection_result = true; DestroyClient(); tracker_frame->SetStatusMessage("Disconnected from Archipelago."); TrackerLog("Timeout while connecting to Archipelago server."); wxMessageBox("Timeout while connecting to Archipelago server.", "Connection failed", wxOK | wxICON_ERROR); } std::this_thread::sleep_for(std::chrono::milliseconds(100)); interval--; } if (connected) { for (const MapArea& map_area : GD_GetMapAreas()) { for (int section_id = 0; section_id < map_area.locations.size(); section_id++) { const Location& location = map_area.locations.at(section_id); int64_t ap_id = apclient->get_location_id(location.ap_location_name); if (ap_id == APClient::INVALID_NAME_ID) { TrackerLog("Could not find AP location ID for " + location.ap_location_name); } else { ap_id_by_location_id[{map_area.id, section_id}] = ap_id; } } } for (const Door& door : GD_GetDoors()) { if (!door.skip_item) { ap_id_by_item_name[door.item_name] = GetItemId(door.item_name); if (!door.group_name.empty() && !ap_id_by_item_name.count(door.group_name)) { ap_id_by_item_name[door.group_name] = GetItemId(door.group_name); } for (const ProgressiveRequirement& prog_req : door.progressives) { ap_id_by_item_name[prog_req.item_name] = GetItemId(prog_req.item_name); } } } ap_id_by_color[LingoColor::kBlack] = GetItemId("Black"); ap_id_by_color[LingoColor::kRed] = GetItemId("Red"); ap_id_by_color[LingoColor::kBlue] = GetItemId("Blue"); ap_id_by_color[LingoColor::kYellow] = GetItemId("Yellow"); ap_id_by_color[LingoColor::kPurple] = GetItemId("Purple"); ap_id_by_color[LingoColor::kOrange] = GetItemId("Orange"); ap_id_by_color[LingoColor::kGreen] = GetItemId("Green"); ap_id_by_color[LingoColor::kBrown] = GetItemId("Brown"); ap_id_by_color[LingoColor::kGray] = GetItemId("Gray"); RefreshTracker(); } else { client_active = false; } } bool HasCheckedGameLocation(int area_id, int section_id) { std::tuple<int, int> location_key = {area_id, section_id}; if (ap_id_by_location_id.count(location_key)) { return checked_locations.count(ap_id_by_location_id.at(location_key)); } else { return false; } } bool HasColorItem(LingoColor color) { if (ap_id_by_color.count(color)) { return inventory.count(ap_id_by_color.at(color)); } else { return false; } } bool HasItem(const std::string& item, int quantity) { if (ap_id_by_item_name.count(item)) { int64_t ap_id = ap_id_by_item_name.at(item); return inventory.count(ap_id) && inventory.at(ap_id) >= quantity; } else { return false; } } bool HasAchievement(const std::string& name) { std::string key = "Achievement|" + name; return data_storage.count(key) && data_storage.at(key); } void RefreshTracker() { TrackerLog("Refreshing display..."); RecalculateReachability(); tracker_frame->UpdateIndicators(); } int64_t GetItemId(const std::string& item_name) { int64_t ap_id = apclient->get_item_id(item_name); if (ap_id == APClient::INVALID_NAME_ID) { TrackerLog("Could not find AP item ID for " + item_name); } return ap_id; } void DestroyClient() { client_active = false; apclient->reset(); apclient.reset(); } }; APState& GetState() { static APState* instance = new APState(); return *instance; } } // namespace void AP_SetTrackerFrame(TrackerFrame* arg) { GetState().tracker_frame = arg; } void AP_Connect(std::string server, std::string player, std::string password) { GetState().Connect(server, player, password); } bool AP_HasCheckedGameLocation(int area_id, int section_id) { return GetState().HasCheckedGameLocation(area_id, section_id); } bool AP_HasColorItem(LingoColor color) { return GetState().HasColorItem(color); } bool AP_HasItem(const std::string& item, int quantity) { return GetState().HasItem(item, quantity); } DoorShuffleMode AP_GetDoorShuffleMode() { return GetState().door_shuffle_mode; } bool AP_IsColorShuffle() { return GetState().color_shuffle; } bool AP_IsPaintingShuffle() { return GetState().painting_shuffle; } const std::map<std::string, std::string> AP_GetPaintingMapping() { return GetState().painting_mapping; } int AP_GetMasteryRequirement() { return GetState().mastery_requirement; } bool AP_IsReduceChecks() { return GetState().reduce_checks; } bool AP_HasAchievement(const std::string& achievement_name) { return GetState().HasAchievement(achievement_name); }