Ancurio / mkxp

Free Software implementation of the Ruby Game Scripting System (RGSS)
GNU General Public License v2.0
514 stars 131 forks source link

Steam API DLL failing #119

Closed PabloNeirotti closed 9 years ago

PabloNeirotti commented 9 years ago

Hi there!

I am trying to get the basics of the Steam API DLL to work.

First I tried a wrapper DLL I am using to interact with everything Steam has to offer. It was failing, but I figured it may have been that wrapper just not working.

So instead I tried to do a SteamAPI_Init directly: Win32API.new("steam_api.dll", "SteamAPI_Init", [], 'l')

However that still gets logged in terminal as a DLL Method that wasn't called, as defined here: MKXP.puts("[#{@dll}:#{@func}] #{args.to_s}") if !@called

Did anyone manage to get this to work? I am using the base Windows pre-compiled EXE you guys offer.

Thank you for your time! I really appreciate it.

Ancurio commented 9 years ago

MKXP.puts("[#{@dll}:#{@func}] #{args.to_s}") if !@called

This looks a lot like a line from the Win32API wrapper script that I wrote. That script is for redirecting Win32API calls to be implemented in Ruby (sometimes with MKXP extensions) in order to replicate them. If there is no implementation defined, it's supposed to do nothing so the game doesn't immediately crash.

If you take one of the commonly used Mouse Input scripts, the actual Win32API calls to query the cursor position and button state are often minimal compared to all the additional logic the script does. I figured it was easier to simply redirect those few Win32 calls and leave the original scripts unmodified than to maintain "mkxp ports" of them. Same goes for combing through every occurrence of "send two fake button presses via Win32 to trigger fullscreen" in scripts; it's easier to just recognize the Win32 calls instead.

Bottom line is, mkxp has no support for Win32API because it is not a Windows-only engine. I don't know if the module is available on the windows build or not; as far as I heard it's being deprecated by Ruby in favor of DL. @Daverball has steam api working in his game via ruby as far as I know.

PabloNeirotti commented 9 years ago

Hi @Ancurio ! I appreciate your response. I've read over 30 issues today on this GitHub trying to find as much information I can understand.

That line is in fact from the wrapper you wrote :) What I don't understand is... What does it mean if the call doesn't go through? As you say, no implementation is defined. Is that a problem with such DLL, or something I can do from my end?

As a matter of fact I tried to contact @Daverball today. Found him by accident on Steam while Googling how to compile MKXP on Windows by myself (no luck). Hopefully I get to exchange some words with him if he sees my Steam Friend Invite.

Cheers!

PabloNeirotti commented 9 years ago

Ok I think I understand. This wrapper will NOT call actual DLLs, ever, right?

Is there any way to call an actual library through Win32API or what have you?

Thank you!

Ancurio commented 9 years ago

Ok I think I understand. This wrapper will NOT call actual DLLs, ever, right?

Yes, the wrapper will not call into native DLLs because there is no way to do that in a cross platform manner. There are no DLLs on Linux. However, if all the game wants to know is the mouse cursor position, that can be arranged via unofficial mkxp extensions that go through SDL and thus are cross platform. That's what the wrapper script I wrote is for.

Is there any way to call an actual library through Win32API or what have you?

As I said, I don't know, it's not a concern of mkxp. The actual Win32API module as it is present in RPG Maker might work in the windows mkxp build, or it might not work. Another way would be the DL module.

PabloNeirotti commented 9 years ago

Daverball wonderfully helped me out on this one.

Indeed, I understand now a bit more really what this project is about. I'd say it's safe to close this thread, as what I needed is not part of the project (DLL Support).

Thank you for the responses, Ancurio!