Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


{$luacode} {$ccode} CE 7.3+
Goto page Previous  1, 2
 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Tutorials -> Auto Assembler tutorials
View previous topic :: View next topic  
Author Message
Dark Byte
Site Admin
Reputation: 465

Joined: 09 May 2003
Posts: 25509
Location: The netherlands

PostPosted: Tue Mar 08, 2022 3:17 am    Post subject: Reply with quote

No. Not at the moment and not sure it will be added

The ST(X) registers are saved though, and you can access ST(0) at the address of "parameters+0x20", ST(1) at "parameters+0x30" etc...

the main issue is that it's stored as a 80 bit float. Not 32 (single) or 64 (double) and the other issue is that the c compiler doesn't support the 80 bit float type, so you're going to have to convert that value to a double or single first using software, and then use it.

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
dharmang1910
Expert Cheater
Reputation: 0

Joined: 09 May 2010
Posts: 102

PostPosted: Sun Mar 13, 2022 11:50 pm    Post subject: Reply with quote

Dark Byte wrote:
No. Not at the moment and not sure it will be added

The ST(X) registers are saved though, and you can access ST(0) at the address of "parameters+0x20", ST(1) at "parameters+0x30" etc...

the main issue is that it's stored as a 80 bit float. Not 32 (single) or 64 (double) and the other issue is that the c compiler doesn't support the 80 bit float type, so you're going to have to convert that value to a double or single first using software, and then use it.


Thanks for reply,
So I can use ST(X) register directly by name like writeFloat(ST(0),99) or I have to use another method??

I also want to request you to solve this error as whenever I try to add script to the table with luacode I got this error. So I have to add script without luacode to the table and then edit it with luacode. Is there any temporary solution for this error that I can directly add script with luacode.

Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 465

Joined: 09 May 2003
Posts: 25509
Location: The netherlands

PostPosted: Mon Mar 14, 2022 1:10 am    Post subject: Reply with quote

Quote:

So I can use ST(X) register directly by name like writeFloat(ST(0),99) or I have to use another method

no, writeFloat uses 32 bit floats, st(0) is 80 bit so that won't work
you'd have to convert the float to a bytetable and then binary convert it to a 80 bit fp.

i guess the syntaxcheck doesn't skip the generated asm
for now first inject the luaclient dll into the target process and then it should work

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
dharmang1910
Expert Cheater
Reputation: 0

Joined: 09 May 2010
Posts: 102

PostPosted: Mon Mar 14, 2022 7:43 am    Post subject: Reply with quote

Dark Byte wrote:

no, writeFloat uses 32 bit floats, st(0) is 80 bit so that won't work
you'd have to convert the float to a bytetable and then binary convert it to a 80 bit fp.

Thank you very much for reply. That is complicated thing, instead use of old school type fstp st(0) and fld is speedy one.
Back to top
View user's profile Send private message
dharmang1910
Expert Cheater
Reputation: 0

Joined: 09 May 2010
Posts: 102

PostPosted: Sat Apr 23, 2022 5:18 am    Post subject: unicode compare in CCode Reply with quote

Is it possible to compare in CCode?
I have tried to use wchar_t but it says it is undefined. I have tried this but now I got different error.
Code:
{$c}
#include <wchar.h>
{$asm}


Now I got this error
<<ccode section compilation failed:<string-0>:15: warning: assignment from incompatible pointer type
<string-0>:17: warning: assignment from incompatible pointer type
tcc: error: undefined symbol '_vsnwprintf'
tcc: error: undefined symbol '_wctime64'
tcc: error: undefined symbol '_wctime64_s'
>>
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 465

Joined: 09 May 2003
Posts: 25509
Location: The netherlands

PostPosted: Sat Apr 23, 2022 6:14 am    Post subject: Reply with quote

yes, but don't use any of the existing includes.

Just define what you need yourself

Code:

typedef unsigned short wchar_t;
int wcscmp(
   const wchar_t *string1,
   const wchar_t *string2
);

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
dharmang1910
Expert Cheater
Reputation: 0

Joined: 09 May 2010
Posts: 102

PostPosted: Sat Apr 23, 2022 8:24 am    Post subject: Reply with quote

Dark Byte wrote:
yes, but don't use any of the existing includes.

Just define what you need yourself

Code:

typedef unsigned short wchar_t;
int wcscmp(
   const wchar_t *string1,
   const wchar_t *string2
);

Thank you very much for reply. Is this valid define for Unicode compare in CCode??

Code:
{$ccode mBase=rdi iBase=r8 sBase=r9}
typedef unsigned short wchar_t;
extern int moneYyy;
const wchar_t *str = (const wchar_t *)(sBase+0x4);
if (*str)
{
if (wcscmp(str,"money")==0 && iBase==5)
{
   moneYyy = mBase+0x8;

}
}
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 465

Joined: 09 May 2003
Posts: 25509
Location: The netherlands

PostPosted: Sat Apr 23, 2022 10:02 am    Post subject: Reply with quote

not on a comp but try "money"L and *str

and i suggest adding more roundbraces to the if statement just to be sure

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
sgsgwv$6263
Advanced Cheater
Reputation: 0

Joined: 05 Aug 2020
Posts: 75

PostPosted: Mon May 15, 2023 11:04 pm    Post subject: Reply with quote

[quote="Dark Byte"]
Quote:

i guess the syntaxcheck doesn't skip the generated asm
for now first inject the luaclient dll into the target process and then it should work


I am not that aware of injecting luaclient dll. I dont know how to. But I found another way to add the script to the table.
First, hit the execute button. When it asks for the confirmation simply deny it. And then go on with "add this to the cheat table" (or whatever the actual option is).

But can anybody explajn it clearly how to inject luaclient dll to the target process or maybe a better way to avoid this error.
Back to top
View user's profile Send private message
Dave_Scream
Cheater
Reputation: 0

Joined: 06 Dec 2009
Posts: 36

PostPosted: Fri Apr 26, 2024 6:25 am    Post subject: Reply with quote

Is it possible to use OutputDebugString from $ccode block?

On wiki there is example about sprintf function:
Code:
extern __cdecl int sprintf(char *, char *, ...);  //will likely pick ntdll.sprintf


Can I call somehow OutputDebugString?

On stackoverflow I found this:
Code:
extern "C" __declspec(dllimport) void __stdcall OutputDebugStringA(const char* lpOutputString);


should I use this?


UPD.
I just used format from example and this worked for me
Code:

extern __cdecl void OutputDebugStringA(const char* lpOutputString);

OutputDebugStringA("testing hd2");
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Tutorials -> Auto Assembler tutorials All times are GMT - 6 Hours
Goto page Previous  1, 2
Page 2 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites