 |
Cheat Engine The Official Site of Cheat Engine
|
| View previous topic :: View next topic |
| Author |
Message |
kubinka0505 How do I cheat?
Reputation: 0
Joined: 23 Jun 2024 Posts: 1
|
Posted: Sun Jun 23, 2024 4:48 pm Post subject: Scan and replace found - Hard issue with simple solution?? |
|
|
Long story short - I was messing around with extracted game audio files. I enhanced them, packed to archive and ran the game. To my surprise, the game actually has hard-coded value: 22050 , and it is responsible for sample rate of these files, which is quite low.
When I ran the game and selected its executable process on cheat engine, I've run a scan for that values, and numerous results were detected. I replaced it and as expected the sound sample rate went to normal.
I've created a cheat table file, because I couldn't patch the executable, and relaunched the game. Loading a cheat table did not return the values that I've set before, so I assumed that they are dynamic.
The problem is that I want to automate it by some sort of trainer or script, because I think I won't be able to patch the original game due to lack of my knowledge.
I'd like to make following tasks at that trainer/script:
- perform a scan for "22050" value
- for all found occurrences, replace it with "44100"
I've got an example code, but it crashes entire cheat engine, probably due to iterations amount.
| Code: | function scanAndReplace()
AOBScan(22050, function(scanResult)
for i = 0, scanResult.Count - 1 do
local address = scanResult[i]
local value = readInteger(address)
if value == 22050 then
writeInteger(address, 44100)
end
end
scanResult.Destroy()
end)
end
if openProcess('VideoGame.exe') then
scanAndReplace()
else
print("Failed to open the game process.")
end
|
How can I make it happen?
also please Move this thread if wrong board
|
|
| Back to top |
|
 |
AylinCE Grandmaster Cheater Supreme
Reputation: 37
Joined: 16 Feb 2017 Posts: 1533
|
Posted: Sun Jun 23, 2024 10:18 pm Post subject: |
|
|
This code will give you the option to query all results found with changes of 50 units.
After every 50 changes, it will return to the application and test whether it was successful or not, and then return to the message and give the option to continue or ok.
If there are many results or you want more variation, you can decrease or increase the value of "cnt = 50" in the code.
This way you can see what you can do before the game crashes.
| Code: | local resTbl = {}
local resindex = 0
function replaceTbl(to)
local cnt = 50
for i=1,cnt do
if resindex==#resTbl then
return showMessage("All results have been changed!\nIf still no success, start new scan!")
elseif i==cnt then
local answer = messageDialog("Check the application and test the change!\nFound: "..#resTbl.." -- Changed: "..resindex.."\nDo you want to continue the change?", mtWarning, mbYes, mbNo)
if answer == mrYes then
replaceTbl(to)
else
showMessage("Total: "..resindex.." addresses have been changed!")
end
else
resindex = tonumber(resindex) + 1
autoAssemble(resTbl[tonumber(resindex)]..":\ndb "..tostring(to))
end
end
end
function multiReplace(from)
resindex = 0
if getOpenedProcessID()==getProcessIDFromProcessName('VideoGame.exe') then
aob = AOBScan(from,"+W")
if (aob == nil) then
showMessage("Code not found..!")
else
for i=0,aob.Count-1 do
resTbl[#resTbl + 1] = aob[i]
end
replaceTbl("44 AC 00 00") -- 44100
aob.Destroy()
end
else
showMessage("Failed to open the game process.")
end
end
multiReplace("22 56 00 00") -- 22050 |
_________________
|
|
| Back to top |
|
 |
|
|
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
|
|