Page 1 of 1

DX's Client starter

Posted: Fri Feb 13, 2015 1:36 am
by dx876234
Attached is my "start the client" function as a Lua plugin to Micromacro. It will start client directly with arguments (NoCheckVersion) or through a link and return the PID and HWND of the client which can be used directly for attaching Micromacro to the client.

This enables Micromacro to start client without reserving the window/mouse.

Usage:

Code: Select all

mmext = require("mmext")

--local pid, win = mmext.Client("C:\\Games\\rom\\ClientRun.lnk")
local pid, win = mmext.Client("C:\\Games\\rom\\Client.exe", "NoCheckVersion", "C:\\Games\\rom")

-- Open client memory space 
proc = openProcess(pid)

-- Attach keyboard/mouse to client
attach(win)
To compile you compile as a Lua 5.2 extension and link as a .dll to
micromacro /lua52.dll, then put mmext.dll into micromacro/lib/mods directory.

I'm using MinGW for compilation, my makefile is as below.

Best regards
DX

Changes:
- Added a mmext.KillClient(pid) function

Re: DX's Client starter

Posted: Fri Feb 13, 2015 1:54 am
by rock5
Nice. So we wont need to use the locking mechanism in the login userfunction, right? Cool.

Does it accept relative paths?

Re: DX's Client starter

Posted: Fri Feb 13, 2015 5:27 am
by dx876234
I haven't tested relative paths but on the other hand, I don't do anything with paths at all, it's
all delivered to the Windows ShellExecuteEx command so I'd guess it accepts them.

-dx

I have inserted into my local copy of userfunction_login and it runs nicely without any locking.
But, I have been hesitant to publish as it's makes a prerequisite beyond what most ppl
can or are willing to build. I am also hesitant to distribute a binary as ppl should't run
"unknown" binaries.

Re: DX's Client starter

Posted: Fri Feb 13, 2015 6:13 am
by rock5
There is that. It sort of feels like something that should be built into Micromacro. Then it would just require people to update Micromacro.

Re: DX's Client starter

Posted: Fri Feb 13, 2015 4:13 pm
by dx876234
Ye, I pretty much agree. Micromacro needs a proper process started, something better
than os.execute()/system().

-dx