Welcome
Ladies and Gents:

These forums are now closed and registration disabled.

Please join us at our new forum on Proboards. Our hope is that these new forums are more stable, provide more and better features, and allow continuation of the project forums in a safer, more secure, long term environment.

me3explorer.proboards.com

--The ME3Explorer Team

ME3 Logging Utility

Coder-centric area for programming advice and questions.

ME3 Logging Utility

Postby FemShep » 11 Oct 2014, 18:11

I've been looking through a lot of pcc files lately and they have things like "Outer.ClientMessage('TestSquads:',,), which to me implies that there is some sort of logger that ME3 used internally. The Default debug console in UE3 that you can make popup doesn't show anything. Has anyone figured out what this is?

Image
Image
ME3Tweaks has modding guides, tools, forums for mods, a modding wiki, and ModMaker, an online mod creation tool.
ME3 Mod Manager, the civilized way of installing and managing ME3 mods.
ME3Tweaks Facebook Page
User avatar
FemShep
Modder
 
Posts: 1101
Joined: 18 Oct 2012, 20:48
Has thanked: 42 time
Have thanks: 76 time

Re: ME3 Logging Utility

Postby Erik JS » 16 Oct 2014, 22:28

Outer.ClientMessage caught my attention in the past, but only now I tried to actually restore it. I'll tell you what I've been doing.

Short story: I failed.

Long story: Outer.ClientMessage is used by various functions/methods in order to give feedback to the player (example: God - 'God mode on', Ghost - 'You feel ethereal').
The original behavior (what Epic did in UT3 and other Unreal games I played) makes the game write the message on the screen (temporally) and on the console.

Its actual "identity" is PlayerController.ClientMessage, from the Engine package. I have here screens of a test I did with it using UDK-2011-12:

http://www.mediafire.com/view/5oa8bw8jask10a2/ue3_cheattestmessage1.png -> CheatTestMessage was created by me, and it uses Outer.ClientMessage. The message was shown.

http://www.mediafire.com/view/ctir8dyy86tppnt/ue3_cheattestmessage2.png -> Here I opened PlayerController.uc (not actually recommended unless you know what you're doing, even Unreal X-Editor warns about this) and I put everything from ClientMessage into a comment tag. The message was not shown.

So you may ask "What about ME3?" - well, let's take a look at Engine.pcc with PCC Editor 2...
Spoiler:
Image


I saw two solutions:
1) Rebuild ClientMessage from scratch via hex.
2) Change all references in all PCC's, from Outer.ClientMessage to something else.

...and I went with #1.

After some tests here and there, I finally found what actually has to be coded into ClientMessage:
LocalPlayer(Player).ViewportClient.ViewportConsole.OutputText(S);

This was found in the TeamMessage from UDK. ME3's PlayerController.TeamMessage is as "empty" as ClientMessage. I figured I had to use Console.OutputText earlier, but only after downloading UDK I realized how it is supposed to be called.


Here, a code for demonstration with ME3 On The Hook:
Spoiler:
else if(!strncmp(szBuff,"showmsg",7))
{
USFXLocalPlayer * locplaya = (USFXLocalPlayer*)UObject::FindObject<UObject>("SFXLocalPlayer Transient.SFXEngine.SFXLocalPlayer");
char * msg = szBuff + 8;
wchar_t str[256];
ctow(msg, str);
if(locplaya)
{
locplaya->ViewportClient->ViewportConsole->OutputTextLine(str);
sprintf(szBuff, "Done\n");
ret = send(sock, szBuff, 256, 0);
while(recv(sock, szBuff, 1, 0)==0) {}
}
else
{
sprintf(szBuff, "USFXLocalPlayer not found!\n");
ret = send(sock, szBuff, 256, 0);
while(recv(sock, szBuff, 1, 0)==0) {}
}
}

Note that I'm using OutputTextLine here. In order to use OutputText, it would have to be written like this:
locplaya->ViewportClient->ViewportConsole->eventOutputText(str);
Both methods work.

Image


I attempted this:
Spoiler:
Image
Image


The game loads normally, but when I use a command which calls Outer.ClientMessage, the game hangs. I guess something is wrong with the hex, and I'm currently trying to figure out what is it.
ME3 Private Server Emulator: @ ME3Tweaks | @ SourceForge | @ GitHub | @ Dropbox
Image
User avatar
Erik JS
User
 
Posts: 124
Joined: 31 Jul 2014, 14:44
Has thanked: 13 time
Have thanks: 77 time

Re: ME3 Logging Utility

Postby WarrantyVoider » 16 Oct 2014, 22:45

so if I got you right, using the sdk, you can output text?! can you also get the inputs (from clientmessagef.e.)? then why not restore it by c&p with sdk? I could include it then into the binkw32.dll. anyway, good work so far^^

greetz WV
always backup your files!
mess with the best or die like the rest!
"I tried everything!" - "mkay, please list that..." ; please dont pm me for help, we have a help section
User avatar
WarrantyVoider
Emeritus
 
Posts: 2270
Joined: 22 Aug 2012, 11:33
Has thanked: 480 time
Have thanks: 626 time

Re: ME3 Logging Utility

Postby Erik JS » 16 Oct 2014, 23:12

I can't get the inputs... and this whole Outer.ClientMessage thing is why I asked you before, about how to redirect functions (I just didn't tell you which function I wanted to redirect...). I figured it isn't as simple as 4E F9 XX XX XX XX like in 68K machine code...

Well, I have this on the log: "Function Engine.PlayerController.ClientMessage"

What can I do with this? Should I "UFunction*" it or something?
ME3 Private Server Emulator: @ ME3Tweaks | @ SourceForge | @ GitHub | @ Dropbox
Image
User avatar
Erik JS
User
 
Posts: 124
Joined: 31 Jul 2014, 14:44
Has thanked: 13 time
Have thanks: 77 time

Re: ME3 Logging Utility

Postby FemShep » 17 Oct 2014, 01:40

Not going to lie, I understood it but it's well over my head. I don't understand unreal engine's internals much beyond packages and some basic pcc edits.
Image
ME3Tweaks has modding guides, tools, forums for mods, a modding wiki, and ModMaker, an online mod creation tool.
ME3 Mod Manager, the civilized way of installing and managing ME3 mods.
ME3Tweaks Facebook Page
User avatar
FemShep
Modder
 
Posts: 1101
Joined: 18 Oct 2012, 20:48
Has thanked: 42 time
Have thanks: 76 time

Re: ME3 Logging Utility

Postby WarrantyVoider » 17 Oct 2014, 08:36

well if you tell me that clientmessage "takes" the input, you should hook it. luckily for you, it doesnt need microsofts detour, but VMT hacking. the objects you access (engine, playercontroller) are classes and as unreal sticks to c++ standards, they use VMTs too (virtual method table). so you could take over the function by just replacing a pointer (http://www.unknowncheats.me/forum/unreal-3-engine/69951-tutorial-vtable-hooking-vmt-hooking-unreal-engine-c.html), just look how I took over the rendering function, it should work similar. you maybe have to virtual(un)protect the vmt, so you change from execute only to execute and write. also very helpfull for debugging hooked functions is this
printf("%p\n%p\n%p\n%p\n%p\n%p\n%p\n");
this will show the values from the stack when the function got called. the idea is that printf always pops a value from stack for every variable and if you didnt included variables, it will use the ones already on stack

greetz WV
always backup your files!
mess with the best or die like the rest!
"I tried everything!" - "mkay, please list that..." ; please dont pm me for help, we have a help section
User avatar
WarrantyVoider
Emeritus
 
Posts: 2270
Joined: 22 Aug 2012, 11:33
Has thanked: 480 time
Have thanks: 626 time

Re: ME3 Logging Utility

Postby WarrantyVoider » 21 Oct 2014, 22:22

Well im working on tool to log ALL function calls, but clientmessage isnt used as far as I can see
(Filtered out, stuff that contains {"Tick", "PreRender", "PostRender", "GetPlayerViewPoint", "GetFOVAngle", "UpdateCamera"})

Image

the idea would be to wait for the ClientMessage call and simply do it ourselfs, (in code you see I used your function to print into ingame console), but as it never gets called... dunno

Download Source, inject dll with Winject or something

The dll is hardcoded to MD5 3BD1A01979478587F28949B7E78194C2 with offset 01AAF304, if you have another MD5 for your me3.exe please use offset as written in OP of ME3OTH

greetz WV

PS:what it does: get the HUD object, find ProcessEvent function from VMT, not hooking VMT but detouring PE this time... profit^^ one get ALL calls to the PE and with that ALL calls to ALL unreal functions :D
always backup your files!
mess with the best or die like the rest!
"I tried everything!" - "mkay, please list that..." ; please dont pm me for help, we have a help section
User avatar
WarrantyVoider
Emeritus
 
Posts: 2270
Joined: 22 Aug 2012, 11:33
Has thanked: 480 time
Have thanks: 626 time

Re: ME3 Logging Utility

Postby Erik JS » 22 Oct 2014, 13:41

Alright, I'll download your code once I'm finished with this post. (I really need to stop verifying my posts so much...)

I suppose that's the AllocConsole() which cannot be closed without having the whole application coming down with it, right?

I used my own method of logging:

if ( pUFunc ) {
fopen_s ( &L, "ProcEvent1.txt", "a+" );
fprintf (L, "%s\n", pUFunc->GetFullName() );
fclose (L);
}


What I found:
http://www.mediafire.com/view/fu9r1bvtz ... ctions.txt

What I didn't find: Function Engine.PlayerController.ClientMessage :(

Is ClientMessage even being called?

Short answer: yes.

Long answer:
else if(!strncmp(szBuff,"applyfix",8))
{
UFunction * cm = (UFunction*)UObject::FindObject<UObject>("Function Engine.PlayerController.ClientMessage");
if(cm)
{
*(PDWORD*)cm = 0;
sprintf(szBuff, "Done\n");
ret = send(sock, szBuff, 256, 0);
while(recv(sock, szBuff, 1, 0)==0) {}
}
else
{
sprintf(szBuff, "UFunction not found!\n");
ret = send(sock, szBuff, 256, 0);
while(recv(sock, szBuff, 1, 0)==0) {}
}
}

After sending "applyfix", the game will hang (as intended) if I attempt to use a cheat that calls ClientMessage (like god or ghost).

ClientMessage is definitely being called.

I also set up one of those "find what access this address" through Cheat Engine, and I located the instruction which reads ClientMessage's pointer, but I didn't save anything to show here.

This function hooking issue is old... do you remember this?
http://me3explorer.freeforums.org/post3405.html#p3405
The link to gamedeception.net is actually broken, but anyone can access it through here.
It would help if Tamimego showed some actual usable example.

You threw me a link to UnknownCheats earlier. I looked around that place, and found those:

http://www.unknowncheats.me/forum/unreal-3-engine/79006-changing-ufunction-behavior.html
Slight0 (the creator of that GameDeception's thread) appears here. And, again, no one responds with anything usable.

http://www.unknowncheats.me/forum/unreal-3-engine/89430-there-any-method-can-hook-functions-playercontroller-other-class.html
This seems to have the answer, but I didn't understand what HyPeR-X posted (I admit I'm not good at reading other people's source codes).

Spoiler:
wwwc wrote:Quote:
Originally Posted by Slight0 View Post
Pretty sure you're in the wrong thread.

sorry then...

I can't leave this unquoted. Sorry, WV. :lol:

Since you're online all the time registered at that place, can't you talk to those people directly about this?
ME3 Private Server Emulator: @ ME3Tweaks | @ SourceForge | @ GitHub | @ Dropbox
Image
User avatar
Erik JS
User
 
Posts: 124
Joined: 31 Jul 2014, 14:44
Has thanked: 13 time
Have thanks: 77 time

Re: ME3 Logging Utility

Postby WarrantyVoider » 22 Oct 2014, 15:29

just a guess here...

EX_VirtualFunction		= 0x1B,	// A function call with parameters.
EX_FinalFunction = 0x1C, // A prebound function call with parameters.


looks like we need to hook the other function handlers in the VM, so not entry #70 in VMT but these, just a guess, and I dunno when Ill have time again to look into it

greetz WV
always backup your files!
mess with the best or die like the rest!
"I tried everything!" - "mkay, please list that..." ; please dont pm me for help, we have a help section
User avatar
WarrantyVoider
Emeritus
 
Posts: 2270
Joined: 22 Aug 2012, 11:33
Has thanked: 480 time
Have thanks: 626 time

Re: ME3 Logging Utility

Postby WarrantyVoider » 22 Oct 2014, 16:18

the topic you mentioned is too old (+500 days) I had to made a new thread, and you too, can register there! ;P dunno, maybe add some details I forgot or additional questions

http://www.unknowncheats.me/forum/unrea ... ction.html

I suppose that's the AllocConsole() which cannot be closed without having the whole application coming down with it, right?


FreeConsole();
:D

greetz WV
always backup your files!
mess with the best or die like the rest!
"I tried everything!" - "mkay, please list that..." ; please dont pm me for help, we have a help section
User avatar
WarrantyVoider
Emeritus
 
Posts: 2270
Joined: 22 Aug 2012, 11:33
Has thanked: 480 time
Have thanks: 626 time

Next

Return to Coders' Help

Who is online

Users browsing this forum: No registered users and 1 guest

suspicion-preferred