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 


Beginner help: Formula use in Auto Assembler? RPCS

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
Lc*d
How do I cheat?
Reputation: 0

Joined: 03 Dec 2023
Posts: 2

PostPosted: Sun Dec 03, 2023 4:43 am    Post subject: Beginner help: Formula use in Auto Assembler? RPCS Reply with quote

Hello guys,

I'm new to coding in Assembly and could realy use some help.
I'm playing a game through RPCS3 with static adresses.
The 'max hp' value seems formula-based as i can't find an adress for it.

So the thing i'm trying to do seemd simple, but found out is realy hard as a beginner.
I've tried to find out information on how to write this scipt in the CEForums and ChatGPT but can't seem to make it work:


Read an adress on 4010AF27E as Byte as "Lvl"
Read an adress on 4010AF50C as 2 Byte Big Endian as "BonusHP"

Then use this formula:
-0,07*Lvl^2 + 9*Lvl + 75 + BonusHP

And write it to 4010AF27E as 2 Byte Big Endian


Hoping someone could help me or give me some good advice.
Back to top
View user's profile Send private message
LeFiXER
Grandmaster Cheater Supreme
Reputation: 20

Joined: 02 Sep 2011
Posts: 1046
Location: 0x90

PostPosted: Sun Dec 03, 2023 11:33 am    Post subject: Reply with quote

I don't want to be rude, but emulators should not be the first target of a beginner.
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 134

Joined: 06 Jul 2014
Posts: 4214

PostPosted: Sun Dec 03, 2023 12:59 pm    Post subject: Reply with quote

Why do you want to use the auto assembler? You're not doing a code injection. Just use Lua.
Code:
local function readSmallIntegerBigEndian(addr, signed)
  local b1, b2 = readBytes(addr, 2)
  if not b1 then return nil end

  return byteTableToWord({b2, b1}, signed)
end

local function writeSmallIntegerBigEndian(addr, val)
  local bt = wordToByteTable(val)
 
  return writeBytes(addr, bt[2], bt[1])
end

local lvl = readByte(0x4010AF27E)
local bonusHP = readSmallIntegerBigEndian(0x4010AF50C)

writeSmallIntegerBigEndian(0x4010AF27E, -0.07*lvl*lvl + 9*lvl + 75 + bonusHP)

_________________
I don't know where I'm going, but I'll figure it out when I get there.
Back to top
View user's profile Send private message
Lc*d
How do I cheat?
Reputation: 0

Joined: 03 Dec 2023
Posts: 2

PostPosted: Sun Dec 03, 2023 1:15 pm    Post subject: Reply with quote

LeFiXER wrote:
I don't want to be rude, but emulators should not be the first target of a beginner.


Not rude taken, thanks for the advice. I found out there's not much online about it. But the intent seemed simple.

ParkourPenguin wrote:
Why do you want to use the auto assembler? You're not doing a code injection. Just use Lua.
Code:
local function readSmallIntegerBigEndian(addr, signed)
  local b1, b2 = readBytes(addr, 2)
  if not b1 then return nil end

  return byteTableToWord({b2, b1}, signed)
end

local function writeSmallIntegerBigEndian(addr, val)
  local bt = wordToByteTable(val)
 
  return writeBytes(addr, bt[2], bt[1])
end

local lvl = readByte(0x4010AF27E)
local bonusHP = readSmallIntegerBigEndian(0x4010AF50C)

writeSmallIntegerBigEndian(0x4010AF27E, -0.07*lvl*lvl + 9*lvl + 75 + bonusHP)


Thanks this is just what is was looking for, a simple way without having to inject. The outcome is not yet the expected one, but i will manage from here.
Thanks again!
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 Lua Scripting All times are GMT - 6 Hours
Page 1 of 1

 
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