-
Contributor
Originally Posted by
hycolyte
I have it (OSX 15662). It wasn't my first thought to go and compare to that, but once I did, I identified the function based on a unique string. I would be pretty confident that I have the right function except that it takes 4 arguments instead of the 3 I was expecting unless there was a recent change to the client. I'll have to compare to some other clients I have, but it seems like a valid candidate for FS_GetText when decompiling. I was expecting 3 arguments passed based on krycess's repos (not sure how to tag a user
). I feel I'm pretty close instead of no cigar, so I'll keep trying to get a return value working. It could be just how I'm dealing with the lua command.
Update: Hells yeah! I got it working. I was real close yesterday, but I was doing std::to_string(getTextResultAddr) which was just turning the address to a string instead of that actual result.
I do it like this
Code:
inline std::string ExecuteGetResult(const std::string& com, const std::string& arg)
{
reinterpret_cast<uintptr_t(__fastcall*)(const char*, const char*, int64_t)>(Base + FrameScriptExecute)(com.c_str(), "teacup", 0);
return std::string(reinterpret_cast<const char*>(reinterpret_cast<uintptr_t(__fastcall*)(const char*, int64_t, int32_t, uint8_t)>(Base + FrameScriptGetText)(arg.c_str(), -1, 0, 0)));
}
Code:
auto Name = ExecuteGetResult("myname = UnitName('player')", "myname")
Last edited by Icesythe7; 06-18-2020 at 11:05 PM.
-
Post Thanks / Like - 1 Thanks
GlittPrizes (1 members gave Thanks to Icesythe7 for this useful post)
-
Originally Posted by
Icesythe7
I do it like this
Code:
inline std::string ExecuteGetResult(const std::string& com, const std::string& arg)
{
reinterpret_cast<uintptr_t(__fastcall*)(const char*, const char*, int64_t)>(Base + FrameScriptExecute)(com.c_str(), "teacup", 0);
return std::string(reinterpret_cast<const char*>(reinterpret_cast<uintptr_t(__fastcall*)(const char*, int64_t, int32_t, uint8_t)>(Base + FrameScriptGetText)(arg.c_str(), -1, 0, 0)));
}
Code:
auto Name = ExecuteGetResult("myname = UnitName('player')", "myname")
Excellent. I didn't think about combining the calls to get it in one shot.
Do you mind sharing how you handle Execute in the main thread? My IPC changes a global value, and when that change is detected, it will fire the call but I imagine there is a better way to do this.
Code:
void PresentWork()
{
if (Globals::luaCommand[0] != 0)
{
GameMethods::Execute(Globals::luaCommand);
}
Globals::luaCommand = "";
}
long __stdcall Present12Hook(IDXGISwapChain* pSwapChain, UINT syncInterval, UINT flags)
{
if (initOnce)
{
initOnce = false;
//get device
if (SUCCEEDED(pSwapChain->GetDevice(__uuidof(ID3D12Device), reinterpret_cast<void**>(&dDevice))))
{
pSwapChain->GetDevice(__uuidof(dDevice), reinterpret_cast<void**>(&dDevice));
}
}
PresentWork();
return oPresent12(pSwapChain, syncInterval, flags);
}
update: I was making this hard on myself like this. I'm now using the pipes server inside the present hook, so I don't have to do any fancy traps for lua in/out.
Last edited by GlittPrizes; 06-22-2020 at 01:47 PM.
Reason: update
-
Contributor
I just execute lua with button presses from imgui or other lua hooks (ie hooking combat log via lua, when triggers callsback my own registered lua function which then could execute if i wanted it too but most generally I use LuaC api directly, the only thing i really use execute for is just initial setup stuff that runs once similar to you initOnce check above)
-
Member
Originally Posted by
Icesythe7
I just execute lua with button presses from imgui or other lua hooks (ie hooking combat log via lua, when triggers callsback my own registered lua function which then could execute if i wanted it too but most generally I use LuaC api directly, the only thing i really use execute for is just initial setup stuff that runs once similar to you initOnce check above)
If I want to use luac, do I need lua 5.x header files?