Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
4786607
using default argument instead of duplicated function
dorin-ga Feb 27, 2025
cec686e
Update Main.cpp
Gogoshika-ga Mar 13, 2025
bcde102
set ubuntu-24.04 and clang version to 16
Gogoshika-ga Mar 13, 2025
5c6d7e7
Update cmake.yml
Gogoshika-ga Mar 13, 2025
5586240
Update cmake.yml
Gogoshika-ga Mar 13, 2025
2f751e4
Update cmake.yml
Gogoshika-ga Mar 13, 2025
b79e828
Update CMakeLists.txt
Gogoshika-ga Mar 13, 2025
2f2c2eb
Update cmake.yml
Gogoshika-ga Mar 13, 2025
ebbf72f
Update cmake.yml
Gogoshika-ga Mar 13, 2025
9a6867a
Update CMakeLists.txt
Gogoshika-ga Mar 13, 2025
fc62e19
Update CMakeLists.txt
Gogoshika-ga Mar 13, 2025
1225840
Update CMakeLists.txt
Gogoshika-ga Mar 13, 2025
691a618
Update CMakeLists.txt
Gogoshika-ga Mar 13, 2025
bd08d61
Update CMakeLists.txt
Gogoshika-ga Mar 13, 2025
792a871
Update CMakeLists.txt
Gogoshika-ga Mar 13, 2025
df964bd
Update CMakeLists.txt
Gogoshika-ga Mar 13, 2025
876f32b
Update CMakeLists.txt
Gogoshika-ga Mar 13, 2025
e1b552e
Update guid.cpp
Gogoshika-ga Mar 13, 2025
cf493e7
Update guid.cpp
Gogoshika-ga Mar 13, 2025
ebca0f4
Update CMakeLists.txt
Gogoshika-ga Mar 13, 2025
6d771f5
try and fix libc++ compatibility issues for linux
Gogoshika-ga Mar 14, 2025
0d8ecb4
Update cmake.yml
Gogoshika-ga Mar 14, 2025
409966e
Update cmake.yml
Gogoshika-ga Mar 14, 2025
4e00501
Update GALinux.cpp
Gogoshika-ga Mar 14, 2025
884ae5d
Update CMakeLists.txt
Gogoshika-ga Mar 14, 2025
2cd685c
Update CMakeLists.txt
Gogoshika-ga Mar 14, 2025
ed36c73
Merge branch 'development' of https://github.com/GameAnalytics/gamean…
Gogoshika-ga Mar 14, 2025
c1dbc7d
Update CMakeLists.txt
Gogoshika-ga Mar 14, 2025
2da61b0
Update cmake.yml
Gogoshika-ga Mar 14, 2025
02e2364
use with older ubuntu 20.04
Gogoshika-ga Mar 14, 2025
2cca217
Update cmake.yml
Gogoshika-ga Mar 14, 2025
733ef2a
Update cmake.yml
Gogoshika-ga Mar 14, 2025
2a4ad72
Update cmake.yml
Gogoshika-ga Mar 14, 2025
72a65ad
Update cmake.yml
Gogoshika-ga Mar 14, 2025
fd84651
Merge branch 'development' of https://github.com/GameAnalytics/gamean…
Gogoshika-ga Mar 14, 2025
43f2de4
Update CMakeLists.txt
Gogoshika-ga Mar 26, 2025
3a572cf
expose identifiers
dorin-ga Mar 26, 2025
4eb45a4
renamed getUserId
dorin-ga Mar 26, 2025
dc86721
added gpu model
dorin-ga May 22, 2025
b57c305
playtime support
dorin-ga May 22, 2025
22beea3
playtime support
dorin-ga May 22, 2025
9a88dce
removed redudant function declaration
dorin-ga May 22, 2025
8904879
remote configs v3
dorin-ga Jun 6, 2025
bea3925
remote configs v3 support
dorin-ga Jun 6, 2025
f4f36eb
do not drop fps values outside range
dorin-ga Jun 6, 2025
796c6c9
features for remote configs v3
dorin-ga Jun 6, 2025
6d1e591
track gpu model
dorin-ga Jun 6, 2025
01b4543
fixed gpu model retrieval for windows
dorin-ga Jun 6, 2025
d76234d
Fix zlib issues (#28)
Gogoshika-ga Jun 23, 2025
d0ce873
5.0.0 release prep (#30)
Gogoshika-ga Aug 22, 2025
f7c058f
use default arguments instead of duplicated functions
dorin-ga Aug 22, 2025
855d731
remove redudndant functions
dorin-ga Aug 22, 2025
7f03bd0
remove old function
dorin-ga Aug 22, 2025
3cea19b
Merge branch 'main' into development
dorin-ga Aug 22, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelog

## 5.0.0

### Added

- **Remote Configs With JSON**: Remote Configs now support JSON values, allowing for more complex configurations.
- **Playtime Metrics API**: Introduced new API to get total playtime and playtime in the current session.

## 4.1.1

### Added
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ Example:
Example:

``` c++
gameanalytics::GameAnalytics::initialize("<your game key>", "<your secret key");
gameanalytics::GameAnalytics::initialize("<your game key>", "<your secret key>");
```

### Send events
Expand Down
12 changes: 8 additions & 4 deletions include/GameAnalytics/GameAnalytics.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@ namespace gameanalytics
static void endSession();

static std::string getRemoteConfigsValueAsString(std::string const& key, std::string const& defaultValue = "");
static std::string getRemoteConfigsValueAsJson(std::string const& key);


static bool isRemoteConfigsReady();
static void addRemoteConfigsListener(const std::shared_ptr<IRemoteConfigsListener> &listener);
Expand All @@ -116,6 +118,9 @@ namespace gameanalytics
static std::string getABTestingId();
static std::string getABTestingVariantId();

static int64_t getElapsedSessionTime();
static int64_t getElapsedTimeFromAllSessions();

// game state changes
// will affect how session is started / ended
static void onResume();
Expand All @@ -125,10 +130,9 @@ namespace gameanalytics
static bool isThreadEnding();

private:
static bool _endThread;

static bool isSdkReady(bool needsInitialized);
static bool isSdkReady(bool needsInitialized, bool warn);
static bool isSdkReady(bool needsInitialized, bool warn, std::string const& message);
static bool _endThread;
static bool isSdkReady(bool needsInitialized, bool warn = true, std::string const& message = "");
};

} // namespace gameanalytics
Original file line number Diff line number Diff line change
Expand Up @@ -219,9 +219,9 @@
#define MINIZ_HAS_64BIT_REGISTERS 1
#endif

#ifdef __cplusplus
extern "C" {
#endif
namespace gameanalytics {
namespace utilities {
namespace zip {

// ------------------- zlib-style API Definitions.

Expand Down Expand Up @@ -919,10 +919,6 @@ mz_uint32 tdefl_get_adler32(tdefl_compressor *d);
mz_uint tdefl_create_comp_flags_from_zip_params(int level, int window_bits, int strategy);
#endif // #ifndef MINIZ_NO_ZLIB_APIS

#ifdef __cplusplus
}
#endif

#endif // MINIZ_HEADER_INCLUDED

// ------------------- End of Header: Implementation follows. (If you only want the header, define MINIZ_HEADER_FILE_ONLY.)
Expand Down Expand Up @@ -968,10 +964,6 @@ typedef unsigned char mz_validate_uint64[sizeof(mz_uint64)==8 ? 1 : -1];
#define MZ_FORCEINLINE inline
#endif

#ifdef __cplusplus
extern "C" {
#endif

// ------------------- zlib-style API's

mz_ulong mz_adler32(mz_ulong adler, const unsigned char *ptr, size_t buf_len)
Expand Down Expand Up @@ -4882,12 +4874,12 @@ void *mz_zip_extract_archive_file_to_heap(const char *pZip_filename, const char

#endif // #ifndef MINIZ_NO_ARCHIVE_APIS

#ifdef __cplusplus
}
#endif

#endif // MINIZ_HEADER_FILE_ONLY

} // namespace zip
} // namespace utilities
} // namespace gameanalytics

/*
This is free and unencumbered software released into the public domain.

Expand Down
2 changes: 1 addition & 1 deletion source/gameanalytics/GACommon.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ namespace gameanalytics
class GAState;
}

constexpr const char* GA_VERSION_STR = "cpp 4.1.1";
constexpr const char* GA_VERSION_STR = "cpp 5.0.0";

constexpr int MAX_CUSTOM_FIELDS_COUNT = 50;
constexpr int MAX_CUSTOM_FIELDS_KEY_LENGTH = 64;
Expand Down
1 change: 1 addition & 0 deletions source/gameanalytics/GADevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ namespace gameanalytics
std::string _osVersion;
std::string _deviceModel;
std::string _deviceManufacturer;
std::string _gpu;

std::string _writablepath;
bool _writablepathStatus{false};
Expand Down
3 changes: 2 additions & 1 deletion source/gameanalytics/GAEvents.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,8 @@ namespace gameanalytics

try
{
int64_t sessionLength = state.calculateSessionLength();
// get session length in seconds
int64_t sessionLength = state.calculateSessionLength<std::chrono::seconds>();

if(sessionLength < 0ll)
{
Expand Down
2 changes: 1 addition & 1 deletion source/gameanalytics/GAHTTPApi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ namespace gameanalytics
std::string gameKey = state::GAState::getGameKey();

// Generate URL
std::string url = remoteConfigsBaseUrl + "/" + initializeUrlPath + "?game_key=" + gameKey + "&interval_seconds=0&configs_hash=" + configsHash;
std::string url = remoteConfigsBaseUrl + "/" + initializeUrlPath + "?game_key=" + gameKey + "&interval_seconds=0&configs_hash=" + configsHash + "&config_vsn_supported=3";

logging::GALogger::d("Sending 'init' URL: %s", url.c_str());

Expand Down
9 changes: 4 additions & 5 deletions source/gameanalytics/GAHealth.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,9 @@ namespace gameanalytics
void GAHealth::doFpsReading(float fps)
{
int fpsBucket = std::round(fps);
if(fpsBucket >= 0 && fpsBucket < MAX_FPS_COUNT)
{
_fpsReadings[fpsBucket]++;
}
fpsBucket = std::clamp(fpsBucket, 0, MAX_FPS_VALUE);

_fpsReadings[fpsBucket]++;
}

int GAHealth::getMemoryPercent(int64_t memory)
Expand Down Expand Up @@ -65,6 +64,7 @@ namespace gameanalytics
{
utilities::addIfNotEmpty(out, "cpu_model", _cpuModel);
utilities::addIfNotEmpty(out, "hardware", _hardware);
utilities::addIfNotEmpty(out, "gpu_model", _gpuModel);

if(_numCores > 0)
{
Expand Down Expand Up @@ -169,7 +169,6 @@ namespace gameanalytics
}
}
);

}
}
}
3 changes: 2 additions & 1 deletion source/gameanalytics/GAHealth.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ namespace gameanalytics

protected:

static constexpr size_t MAX_FPS_COUNT = 120 + 1;
static constexpr int MAX_FPS_VALUE = 120;
static constexpr size_t MAX_FPS_COUNT = MAX_FPS_VALUE + 1;
static constexpr size_t MAX_MEMORY_COUNT = 100 + 1;

static constexpr std::chrono::milliseconds MEMORY_TRACK_FREQ {5000};
Expand Down
Loading
Loading