Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
70 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
def7929
removed memory allocations from the C imports, add prefix
dorin-ga Sep 17, 2025
490b7e2
detect gpu model for MacOS
dorin-ga Sep 18, 2025
a108303
return string to avoid dangling ptrs
dorin-ga Sep 18, 2025
5c31b4d
playtime metrics
dorin-ga Sep 24, 2025
a69a65f
fix session time with multiple sessions during the same run
dorin-ga Sep 24, 2025
fe8d56b
filter info logs
dorin-ga Sep 24, 2025
9ec48cd
added previous session time
dorin-ga Sep 24, 2025
232a30a
wrong variable was set
dorin-ga Sep 24, 2025
fa2c2b8
allow progression2 and progression3 to be empty
dorin-ga Sep 26, 2025
9b1e7af
refactor event part validation
dorin-ga Sep 26, 2025
6b2357d
add missing functions in the external interface
dorin-ga Sep 29, 2025
b24ac14
fix extern interface
dorin-ga Sep 29, 2025
accc628
remove patch
dorin-ga Oct 9, 2025
d3b8752
Merge branch 'main' into development
dorin-ga Oct 9, 2025
8fabc1c
increase version
dorin-ga Oct 9, 2025
d8d84d2
5.1.0 changelog
dorin-ga Oct 9, 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
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
# Changelog

# 5.1.0

### Added

- **Previous session time**: functionality to get the last session time

### Fixed

- **Playtime Metrics**: Fixed annotations for session time and total session time
- **MacOS**: GPU model detection

## 5.0.0

### Added
Expand Down
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,8 @@ elseif(APPLE)
"-framework Foundation"
"-framework CoreServices"
"-framework SystemConfiguration"
"-framework Metal"
"-framework MetalKit"
)

create_source_groups(MACOS_SOURCES)
Expand Down
1 change: 1 addition & 0 deletions include/GameAnalytics/GameAnalytics.h
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ namespace gameanalytics

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

// game state changes
// will affect how session is started / ended
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 5.0.0";
constexpr const char* GA_VERSION_STR = "cpp 5.1.0";

constexpr int MAX_CUSTOM_FIELDS_COUNT = 50;
constexpr int MAX_CUSTOM_FIELDS_KEY_LENGTH = 64;
Expand Down
5 changes: 5 additions & 0 deletions source/gameanalytics/GALogger.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ namespace gameanalytics
return;
}

if(logType == LogInfo && !getInstance().infoLogEnabled)
{
return;
}

std::string tag = getInstance().tag;
tag += " :";

Expand Down
23 changes: 18 additions & 5 deletions source/gameanalytics/GAState.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,10 @@ namespace gameanalytics
out["session_num"] = getInstance()._sessionNum;
out["connection_type"] = device::GADevice::getConnectionType();

// playtime metrics
out["current_session_length"] = getInstance().calculateSessionLength();
out["lifetime_session_length"] = getInstance().getTotalSessionLength();

// ---- OPTIONAL ---- //

// A/B testing
Expand Down Expand Up @@ -535,6 +539,11 @@ namespace gameanalytics
return "";
}

int64_t GAState::getLastSessionLength() const
{
return _lastSessionTime;
}

int64_t GAState::getTotalSessionLength() const
{
return _totalElapsedSessionTime + calculateSessionLength<std::chrono::seconds>();
Expand Down Expand Up @@ -586,10 +595,11 @@ namespace gameanalytics

try
{
std::string cachedSessionTime = utilities::getOptionalValue<std::string>(state_dict, "total_session_time", "0");
std::string cachedLastSessionTime = utilities::getOptionalValue<std::string>(state_dict, "last_session_time", "0");
std::string cachedTotalSessionTime = utilities::getOptionalValue<std::string>(state_dict, "total_session_time", "0");

_totalElapsedSessionTime = std::stoull(cachedSessionTime);

_lastSessionTime = std::stoull(cachedLastSessionTime);
_totalElapsedSessionTime = std::stoull(cachedTotalSessionTime);
}
catch(const std::exception& e)
{
Expand Down Expand Up @@ -1090,8 +1100,11 @@ namespace gameanalytics

void GAState::updateTotalSessionTime()
{
int64_t totalSessionTime = getTotalSessionLength();
_gaStore.setState("total_session_time", std::to_string(totalSessionTime));
_lastSessionTime = calculateSessionLength();
_totalElapsedSessionTime += _lastSessionTime;

_gaStore.setState("last_session_time", std::to_string(_lastSessionTime));
_gaStore.setState("total_session_time", std::to_string(_totalElapsedSessionTime));
}

std::string GAState::getBuild()
Expand Down
3 changes: 3 additions & 0 deletions source/gameanalytics/GAState.h
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,8 @@ namespace gameanalytics

int64_t getTotalSessionLength() const;

int64_t getLastSessionLength() const;

void populateConfigurations(json& sdkConfig);

json getRemoteConfigAnnotations();
Expand Down Expand Up @@ -229,6 +231,7 @@ namespace gameanalytics
int64_t _sessionNum = 0;
int64_t _transactionNum = 0;

int64_t _lastSessionTime = 0;
int64_t _totalElapsedSessionTime = 0;
std::chrono::high_resolution_clock::time_point _startTimepoint;

Expand Down
26 changes: 0 additions & 26 deletions source/gameanalytics/GAStore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -206,30 +206,6 @@ namespace gameanalytics
{
return sqlDatabase;
}

bool GAStore::fixOldDatabase()
{
std::filesystem::path oldPath = dbPath;
std::filesystem::path filename = oldPath.filename();

oldPath = oldPath.parent_path() / ".." / filename;

if(std::filesystem::exists(oldPath) && !std::filesystem::exists(dbPath))
{
try
{
std::filesystem::rename(oldPath, dbPath);
}
catch(...)
{
return false;
}

return true;
}

return false;
}

bool GAStore::initDatabaseLocation()
{
Expand All @@ -244,8 +220,6 @@ namespace gameanalytics
{
if(!std::filesystem::create_directory(p))
return false;

fixOldDatabase();
}

return true;
Expand Down
14 changes: 6 additions & 8 deletions source/gameanalytics/GAValidator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,9 @@ namespace gameanalytics

bool validateProgressionString(std::string const& progression, ValidationResult& out, int progressionLvl)
{
if(progressionLvl > 0 && progression.empty())
return true;

if (!GAValidator::validateEventPartLength(progression, true))
{
logging::GALogger::w("Validation fail - progression event - - progression0%d: Cannot be empty or above 64 characters. String: %s", progressionLvl + 1, progression.c_str());
Expand Down Expand Up @@ -458,17 +461,12 @@ namespace gameanalytics
{
constexpr uint32_t MAX_SIZE = 64u;

size_t size = eventPart.length();
if (allowNull == true && size == 0)
if (eventPart.empty())
{
return true;
}

if (size == 0)
{
return false;
return allowNull;
}

size_t size = eventPart.length();
if (size > MAX_SIZE)
{
return false;
Expand Down
5 changes: 5 additions & 0 deletions source/gameanalytics/GameAnalytics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -998,4 +998,9 @@ namespace gameanalytics
return state::GAState::getInstance().calculateSessionLength<std::chrono::seconds>();
}

int64_t GameAnalytics::getElapsedTimeForPreviousSession()
{
return state::GAState::getInstance().getLastSessionLength();
}

} // namespace gameanalytics
Loading