Mittens 2018 will be in Boston this September. There are three spaces left, so check out the thread for details!

Author Topic: ENGINE PLUGIN: AGSteam v3.3 - Steam overlay and keyboard input fix 15 Oct 2017  (Read 34860 times)

monkey0506

  • AGS Project Tracker Admins
  • Tasting the banhammer. Strangely, tastes like ham.
Re: ENGINE PLUGIN: AGSteam - Open-source! 20 August 2017
« Reply #120 on: 23 Aug 2017, 21:26 »
I realized there were some issues with the changes I made converting "AGSteamStub" to "AGS2ClientStub", but even after I corrected those and rebuilt the stub with the "v141_xp" toolchain, the stub still crashes with the exact same error. Based on the fact that "AGSteam-debug.exe" is running perfectly on Windows XP while both the AGSteam plugin and the stub plugin are resulting in a crash, I really feel that this is an error in the way that AGS is loading the plugin, possibly related to the fact that the plugins are built against a different VC++ runtime (despite static linkage, which is meant to prevent this kind of failure).
User was banned for this post.

Radiant

  • AGS Baker
  • Mittens Knight
  • Return once more to the Two Kingdoms!
    • I can help with publishing
    •  
    • I can help with story design
    •  
    • Radiant worked on a game that was nominated for an AGS Award!
      Radiant worked on a game that won an AGS Award!
Re: ENGINE PLUGIN: AGSteam - Open-source! 20 August 2017
« Reply #121 on: 23 Aug 2017, 23:16 »
Ok, so if I understand you correctly, AGS3 games using any kind of plugins will no longer run under Windows XP. Is that correct? Given that XP is fifteen years old by now, I'm actually ok with telling people to do an upgrade, since we now know what's causing it. Thank you both for looking into this issue.

I don't suppose it would help to build the plugin against the same VC++ runtime as the AGS main executable?

Crimson Wizard

  • AGS Project Tracker Admins
    • Best Innovation Award Winner 2013, for spearheading the AGS 3.3.0 project
    •  
    • Lifetime Achievement Award Winner
    •  
    • Crimson Wizard worked on a game that was nominated for an AGS Award!
      Crimson Wizard worked on a game that won an AGS Award!
Re: ENGINE PLUGIN: AGSteam - Open-source! 20 August 2017
« Reply #122 on: 24 Aug 2017, 02:08 »
I'd say more investigation may be needed. If no plugins were working on Windows XP we would receive reports earlier. That's not hard to test couple of existing plugins too.

Then maybe use some dummy plugin to debug the issue, like stub plugin (which is open source?).
« Last Edit: 24 Aug 2017, 02:11 by Crimson Wizard »

monkey0506

  • AGS Project Tracker Admins
  • Tasting the banhammer. Strangely, tastes like ham.
Re: ENGINE PLUGIN: AGSteam - Open-source! 20 August 2017
« Reply #123 on: 24 Aug 2017, 05:55 »
Then maybe use some dummy plugin to debug the issue, like stub plugin (which is open source?).

You might have misunderstood my most recent comments above, but I did actually test this with the stub. The stub does nothing more than register itself with the engine's plugin API. All of the functions are no-ops. But when built with Visual Studio 2017, using the "v141_xp" toolchain, the AGS engine fails to initialize the stub with the exact same error message.

Ok, so if I understand you correctly, AGS3 games using any kind of plugins will no longer run under Windows XP. Is that correct? Given that XP is fifteen years old by now, I'm actually ok with telling people to do an upgrade, since we now know what's causing it. Thank you both for looking into this issue.

I don't think it's "any kind of plugins", but I think it must have something to do with the VC++ runtime and the way the AGS engine is loading the plugins. My suspicion is that the engine is somehow expecting the plugin to have the same VC++ runtime libraries as it uses itself. I don't know if this is a limitation of the engine or the way it invokes the plugin functions, but it has always been my understanding that external libraries should be allowed to link against a different C++ runtime, so long as that linked runtime is available (which is the case, due to static linkage).

I don't suppose it would help to build the plugin against the same VC++ runtime as the AGS main executable?

I will have to reinstall VS2008 to test this, but I will see what I can find out. (P.S. As an aside, I noted above that I had mucked some things up with the configuration settings of the stub when renaming the project (namely, when using the stub for "disjoint" builds, which I forgot to test). The stub should be able to build against VS2008, and I will upload relevant binaries and source once I'm sure that everything is working there properly.)
« Last Edit: 24 Aug 2017, 06:01 by monkey0506 »
User was banned for this post.

monkey0506

  • AGS Project Tracker Admins
  • Tasting the banhammer. Strangely, tastes like ham.
Re: ENGINE PLUGIN: AGSteam - Open-source! 20 August 2017
« Reply #124 on: 24 Aug 2017, 08:43 »
I can confirm that the issue is related to the VC++ runtime. Building the stub with VS2008 makes the game playable on Windows XP without Steam achievements. The AGSteam project itself is not currently compatible with VS2008, but I can see about adding the same compatibility measures used by the stub.

The stub download links have been built with VS2008 and work on Windows XP with AGS 3.3.0 engine. It also loads with the AGS 3.4.0-p4 engine, but the mouse goes absolutely insane and is unusable.
« Last Edit: 24 Aug 2017, 09:14 by monkey0506 »
User was banned for this post.

Re: ENGINE PLUGIN: AGSteam - Open-source! 20 August 2017
« Reply #125 on: 24 Aug 2017, 11:35 »
Thank you all for the efforts. :)

So, where does it leave me, because the talk got too technical? Is it doable to make HQ working under XP, I mean of course it's doable, but is the workload/time/purpose ratio acceptable, like adding few lines of code or is it an absolute waste of time?

Especially with me being the only user reporting the issue. :(

monkey0506

  • AGS Project Tracker Admins
  • Tasting the banhammer. Strangely, tastes like ham.
Re: ENGINE PLUGIN: AGSteam - Open-source! 20 August 2017
« Reply #126 on: 24 Aug 2017, 17:52 »
Okay, so this build of AGSteam (built using VS2008) loads on WinXP without crashing, but I don't seem to be getting the Steam API to initialize. This is a release build, not a debug build, so it doesn't include any debug info about what result is returned by the call to initialize Steam. Effectively, it's functioning the same way as the stub at the moment, which is to say that the game is playable, but you won't get Steam achievements.

Technical discussion: I think there may have been some misunderstanding on my part regarding how C++ assemblies with differing ABIs can communicate. And while the core functions are all implemented as free functions, it's possible that they are being mangled in some unexpected way between the different VS versions, or that there is some other ABI incompatibility (probably the changes in the STL would make the ABIs incompatible, I might think). Based on this thread on Stack Overflow, I have some hope that perhaps forcing the DLL exports to use the C ABI instead could solve the runtime issues, though I'm honestly not sure about this. I'll look into porting the stub to the C ABI and see if I can get it to load that way when compiled from VS2017. If I can't, then I'll probably just call it all a wash and only maintain project files for AGSteam (etc.) that match the current AGS project files' VS version.

Edit: Unfortunately, even with every single free function marked as extern "C", the AGS engine is still crashing when trying to load the VS2017 plugin from WinXP. I even went as far as wrapping every single entire file in an extern "C" block (sans #include lines), to absolutely no avail.
« Last Edit: 24 Aug 2017, 19:04 by monkey0506 »
User was banned for this post.

monkey0506

  • AGS Project Tracker Admins
  • Tasting the banhammer. Strangely, tastes like ham.
Re: ENGINE PLUGIN: AGSteam - Open-source! 20 August 2017
« Reply #127 on: 24 Aug 2017, 20:35 »
I've managed to track this down to the use of "static" variables inside functions. STL, free, and class functions are all working, until it encounters a static definition inside a function. Using the more traditional approach of static struct/class members with external storage defined in a .cpp file works. It will take a short time to port the code, but it seems that I should be able to get this fully working on XP.
User was banned for this post.

Radiant

  • AGS Baker
  • Mittens Knight
  • Return once more to the Two Kingdoms!
    • I can help with publishing
    •  
    • I can help with story design
    •  
    • Radiant worked on a game that was nominated for an AGS Award!
      Radiant worked on a game that won an AGS Award!
Re: ENGINE PLUGIN: AGSteam - Open-source! 20 August 2017
« Reply #128 on: 24 Aug 2017, 22:17 »
Wow, I'm impressed! That's some serious code puzzling there :)

monkey0506

  • AGS Project Tracker Admins
  • Tasting the banhammer. Strangely, tastes like ham.
Re: ENGINE PLUGIN: AGSteam - Open-source! 20 August 2017
« Reply #129 on: 24 Aug 2017, 23:34 »
Huh... Actually, I think that the plugin I linked above is initializing the Steam API, it's just not showing the Steam Overlay. Which is also the behavior I'm now getting with the VS2017 plugin. := I'll investigate the overlay issue, but if nothing turns up soon then I'll just push up a new build with the fixed VS2017 code.

Edit: The Steam overlay works with the 3.4.1-b7 engine on Windows XP under D3D9 and OpenGL, but not software renderer. Oh, and it crashes with a segfault when I close the window via the red 'X'. Not sure if that's related to the plugin, nor if it would cause crashes during playing. Oh boy.
« Last Edit: 24 Aug 2017, 23:44 by monkey0506 »
User was banned for this post.

Radiant

  • AGS Baker
  • Mittens Knight
  • Return once more to the Two Kingdoms!
    • I can help with publishing
    •  
    • I can help with story design
    •  
    • Radiant worked on a game that was nominated for an AGS Award!
      Radiant worked on a game that won an AGS Award!
Re: ENGINE PLUGIN: AGSteam - Open-source! 20 August 2017
« Reply #130 on: 27 Aug 2017, 21:13 »
Latest builds

There was an issue reported by Dave Gilbert that has been patched in this version, but I got distracted before I updated links and such. This is only the "unified" build (use "AGS2Client.Function()" instead of "AGSteam.Function()"), but I can make sure that the "disjoint" build is uploaded as well in case you're using that. The issue Dave reported may have been the same one regarding a null pointer, which would occur if Steam failed to initialize (namely, if Steam wasn't running).

I will make sure that GetCurrentGameLanguage is added back to the plugin(s).

Edit: As of this writing, I am uploading the latest builds, which have GetCurrentGameLanguage added back in.

Aside from the above, there appears to be an issue with your latest version of the Steam plugin (the one from the quoted post). Specifically, it prevents the game from accepting keyboard input, when ran from Steam. If I log out from Steam and run the game directly from Windows, it works normally. Earlier versions of the plugin did not have this issue.

Problem

  • Cavefish
    • I can help with animation
    •  
    • I can help with characters
    •  
    • I can help with making music
    •  
    • I can help with play testing
    •  
    • I can help with scripting
    •  
    • I can help with translating
    •  
Re: ENGINE PLUGIN: AGSteam - Open-source! 20 August 2017
« Reply #131 on: 28 Aug 2017, 08:08 »
I can confirm this bug - I've updated to the latest version of the plugin, and people are reporting keyboard issues. I can't reproduce it myself though.

Re: ENGINE PLUGIN: AGSteam - Open-source! 20 August 2017
« Reply #132 on: 24 Sep 2017, 11:25 »
What i have to do to use this plugins? There are 4 .dll files.
My game will not have achievements or cards, just i want put in Steam the game. What should do i?
« Last Edit: 24 Sep 2017, 15:24 by Neo_One »

Re: ENGINE PLUGIN: AGSteam - Open-source! 20 August 2017
« Reply #133 on: 28 Sep 2017, 12:27 »


Edit: OK, i have found https://bitbucket.org/monkey0506/ags2client/wiki/Using_the_plugin_interface#markdown-header-setachievementachieved
I forget the answer of other user about :P. I don't have to use the plugin to sell the game in Steam.
« Last Edit: 29 Sep 2017, 12:40 by MJL »

Radiant

  • AGS Baker
  • Mittens Knight
  • Return once more to the Two Kingdoms!
    • I can help with publishing
    •  
    • I can help with story design
    •  
    • Radiant worked on a game that was nominated for an AGS Award!
      Radiant worked on a game that won an AGS Award!
Re: ENGINE PLUGIN: AGSteam - Open-source! 20 August 2017
« Reply #134 on: 15 Oct 2017, 10:41 »
Aside from the above, there appears to be an issue with your latest version of the Steam plugin (the one from the quoted post). Specifically, it prevents the game from accepting keyboard input, when ran from Steam. If I log out from Steam and run the game directly from Windows, it works normally. Earlier versions of the plugin did not have this issue.

Hi Monkey, I was wondering if you had some time to look into this? I would like to upgrade to the newest version of AGS2client but I'm stuck with the old one because of this keyboard bug. Thank you for your time!

monkey0506

  • AGS Project Tracker Admins
  • Tasting the banhammer. Strangely, tastes like ham.
Re: ENGINE PLUGIN: AGSteam - Open-source! 20 August 2017
« Reply #135 on: 15 Oct 2017, 13:50 »
Aside from the above, there appears to be an issue with your latest version of the Steam plugin (the one from the quoted post). Specifically, it prevents the game from accepting keyboard input, when ran from Steam. If I log out from Steam and run the game directly from Windows, it works normally. Earlier versions of the plugin did not have this issue.

Hi Monkey, I was wondering if you had some time to look into this? I would like to upgrade to the newest version of AGS2client but I'm stuck with the old one because of this keyboard bug. Thank you for your time!

Hi, sorry about that. It was a breaking change I introduced due to my own misunderstanding. Dave actually had asked me recently about the same, and I realized what the issue was. I'm doing some refactoring of the code currently, but I'll push up a new build with the fix.

Edit: Fixed build v3.3 should be available via Github. There's no binary for the Linux builds yet (but the Code::Blocks project for Linux is provided; never got around to authoring a Makefile from scratch).
« Last Edit: 15 Oct 2017, 23:09 by monkey0506 »
User was banned for this post.

Radiant

  • AGS Baker
  • Mittens Knight
  • Return once more to the Two Kingdoms!
    • I can help with publishing
    •  
    • I can help with story design
    •  
    • Radiant worked on a game that was nominated for an AGS Award!
      Radiant worked on a game that won an AGS Award!
Ok, that appears to fix the issue, thank you. I'll be using the disjoint version for now, to keep the game in sync with the Linux build.

Radiant

  • AGS Baker
  • Mittens Knight
  • Return once more to the Two Kingdoms!
    • I can help with publishing
    •  
    • I can help with story design
    •  
    • Radiant worked on a game that was nominated for an AGS Award!
      Radiant worked on a game that won an AGS Award!
A windows XP user reports that using the previous version of the plugin fails with an unresolved import error, whereas the current version aborts with "An exception 0xC0000005 occurred in ACWIN.EXE at EIP = 0x100011BC ; program pointer is -23, ACI version 3.3.0.1162, gtags (0,0)"  We can probably get a dump file if you think that helps.

Radiant

  • AGS Baker
  • Mittens Knight
  • Return once more to the Two Kingdoms!
    • I can help with publishing
    •  
    • I can help with story design
    •  
    • Radiant worked on a game that was nominated for an AGS Award!
      Radiant worked on a game that won an AGS Award!
Could someone please advice me on how to add the Steam plugin to an OSX game in xcode?