[Scummvm-git-logs] scummvm master -> 42b92554bd2224ca3b4f7c34f13063b8ee7c6ec3

tag2015 noreply at scummvm.org
Mon May 15 21:26:39 UTC 2023


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
42b92554bd AGS: Improve GetCurrentGameLanguage Steam stub


Commit: 42b92554bd2224ca3b4f7c34f13063b8ee7c6ec3
    https://github.com/scummvm/scummvm/commit/42b92554bd2224ca3b4f7c34f13063b8ee7c6ec3
Author: Walter Agazzi (walter.agazzi at protonmail.com)
Date: 2023-05-15T23:21:15+02:00

Commit Message:
AGS: Improve GetCurrentGameLanguage Steam stub

Enables achievements in Heroine's Quest, fixing  TRAC 13591

Changed paths:
    engines/ags/plugins/ags_galaxy_steam/ags_galaxy_steam.cpp


diff --git a/engines/ags/plugins/ags_galaxy_steam/ags_galaxy_steam.cpp b/engines/ags/plugins/ags_galaxy_steam/ags_galaxy_steam.cpp
index d952ca2f44c..7fa9a7cd521 100644
--- a/engines/ags/plugins/ags_galaxy_steam/ags_galaxy_steam.cpp
+++ b/engines/ags/plugins/ags_galaxy_steam/ags_galaxy_steam.cpp
@@ -28,6 +28,24 @@ namespace AGS3 {
 namespace Plugins {
 namespace AGSGalaxySteam {
 
+struct SteamData : public IAGSScriptManagedObject {
+public:
+	Common::String steamLanguage = "english";
+
+	int Dispose(const char *address, bool force) override {
+		delete this;
+		return true;
+	}
+
+	const char *GetType() override {
+		return "SteamData";
+	};
+
+	int Serialize(const char *address, char *buffer, int bufsize) override {
+		return 0;
+	}
+};
+
 void AGS2Client::AGS_EngineStartup(IAGSEngine *engine) {
 	PluginBase::AGS_EngineStartup(engine);
 
@@ -109,15 +127,6 @@ void AGS2Client::ResetStatsAndAchievements(ScriptMethodParams &params) {
 }
 
 void AGS2Client::get_Initialized(ScriptMethodParams &params) {
-	// TODO: remove this after GetCurrentGameLanguage() is implemented
-	if (ConfMan.get("gameid") == "heroinesquest" ||
-		ConfMan.get("gameid") == "killyourself"
-	) {
-		warning("AGS2Client::get_Initialized() is returning fake value to avoid calling GetCurrentGameLanguage() by game");
-		params._result = 0;
-		return;
-	}
-
 	params._result = AchMan.isReady();
 }
 
@@ -157,8 +166,10 @@ void AGS2Client::GetUserName(ScriptMethodParams &params) {
 }
 
 void AGS2Client::GetCurrentGameLanguage(ScriptMethodParams &params) {
-	warning("AGS2Client::GetCurrentGameLanguage() is not implemented");
-	params._result = 0;
+	SteamData *steam_data = new SteamData();
+	_engine->RegisterManagedObject(steam_data, steam_data);
+	warning("AGS2Client::GetCurrentGameLanguage() is not implemented - Returning \'%s\'", steam_data->steamLanguage.c_str());
+	params._result = steam_data->steamLanguage.c_str();
 }
 
 void AGS2Client::FindLeaderboard(ScriptMethodParams &params) {




More information about the Scummvm-git-logs mailing list