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 


All TableToAobs Format Plugin

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Extensions
View previous topic :: View next topic  
Author Message
AylinCE
Grandmaster Cheater Supreme
Reputation: 30

Joined: 16 Feb 2017
Posts: 1234

PostPosted: Sun Mar 24, 2019 11:41 am    Post subject: All TableToAobs Format Plugin Reply with quote

It is not clear when this function will be needed.
But it is archived here to reach the moment of need.
The following Format Trainer: Independent
or use as a CE plug-in if you want.

It has a fully collated code profile and
those who have contributed are mentioned.

General Source: CEF as CE.lua
Contributors to codes: @FreeER and @Corroder and @atom0s (Text to String Format Code: https://forum.cheatengine.org/viewtopic.php?p=5706979#5706979 )
Creator: @Aylin
A few additions can be made. Watch: https://youtu.be/HFm4awVV1SQ

Paste the following code into a .lua file.
Example Name: AobsFormat.lua
And leave this file in the CE-Autorun folder.


Code:
local mf = getMainForm()
local mainMenu = mf.Menu.Items
local AobsFormat = createMenuItem(mf.MainMenu)
AobsFormat.Name = 'AobsFormat'
   AobsFormat.Caption = 'AobsFormat'
   mainMenu.insert(mainMenu.Count-1,AobsFormat)
   AobsFormat.onClick = AobsFormatClick
--======================================--
AobsFormat.onClick = function()
local f = createForm(true)
f.Position = poDesktopCenter
f.Width = 350
f.Height = 310
f.Caption = "All Table To Aobs Format Trainer"

local l1 = createLabel(f) l1.Height = 23 l1.Left = 110 l1.Top = 5 l1.Width = 340 l1.Font.Style = "fsBold,fsUnderline" l1.Font.Size = 14 l1.Caption = "Format Trainer"
local l2 = createLabel(f) l2.Height = 23 l2.Left = 115 l2.Top = 40 l2.Width = 340 l2.Font.Style = "fsBold" l2.Font.Size = 10 l2.Caption = "ByteTable / (Value)"
local l3 = createLabel(f) l3.Height = 23 l3.Left = 90 l3.Top = 96 l3.Width = 340 l3.Font.Style = "fsBold" l3.Font.Size = 10 l3.Caption = "Format / Aobs  (New Value)"
local l6 = createLabel(f) l6.Height = 23 l6.Left = 100 l6.Top = 184 l6.Width = 340 l6.Font.Style = "fsBold" l6.Font.Size = 10 l6.Caption = "Code  Search  /  Replace"

local e1 = createEdit(f) e1.Height = 23 e1.Left = 5 e1.Top = 60 e1.Width = 340
local e2 = createEdit(f) e2.Height = 23 e2.Left = 5 e2.Top = 146 e2.Width = 340
local e3 = createEdit(f) e3.Height = 23 e3.Left = 5 e3.Top = 212 e3.Width = 340
local e4 = createEdit(f) e4.Height = 23 e4.Left = 5 e4.Top = 242 e4.Width = 340

local b1 = createButton(f) b1.Height = 25 b1.Left = 5 b1.Top = 115 b1.Width = 60 b1.Caption = "4 Bytes"
local b2 = createButton(f) b2.Height = 25 b2.Left = 75 b2.Top = 115 b2.Width = 60 b2.Caption = "8 Bytes"
local b3 = createButton(f) b3.Height = 25 b3.Left = 145 b3.Top = 115 b3.Width = 60 b3.Caption = "Float"
local b4 = createButton(f) b4.Height = 25 b4.Left = 215 b4.Top = 115 b4.Width = 60 b4.Caption = "Double"
local b5 = createButton(f) b5.Height = 25 b5.Left = 285 b5.Top = 115 b5.Width = 60 b5.Caption = "String"
local b6 = createButton(f) b6.Height = 25 b6.Left = 47 b6.Top = 274 b6.Width = 75 b6.Caption = "Replace"
local b7 = createButton(f) b7.Height = 25 b7.Left = 237 b7.Top = 274 b7.Width = 75 b7.Caption = "AllReset"

--===================================--
--===== Code and Click Function =====--
--DoubleClick / Print: Search/Replace--
e2.OnDblClick = function() if e3.Text=="" then e3.Text = e2.Text else e4.Text = e2.Text end end
--===================================--
--==== ByteTable / Aobs Function ====--
--======= Code Author: CE.lua =======--
--==== Edit: FreeER and Corroder ====--
--===================================--
function byteTableToAobString(t)
  for k,v in ipairs(t) do
    t[k] = ('%02X'):format(v)
  end
  return table.concat(t, ' ')
end
--============ 4 Bytes ===============--
b1.OnClick = function()
  newvalue = e1.Text
  newvalue = tonumber(newvalue)
  if not newvalue then return end
newvalue = dwordToByteTable(newvalue)
  newvalue = byteTableToAobString(newvalue, newvalue)

e2.Text=('%s'):format(newvalue, newvalue)
if e3.Text=="" then e3.Text = e2.Text else e4.Text = e2.Text end --Opsional
end
--============ 8 Bytes ===============--
b2.OnClick = function()
  newvalue = e1.Text
  newvalue = tonumber(newvalue)
  if not newvalue then return end
newvalue = qwordToByteTable(newvalue)
  newvalue = byteTableToAobString(newvalue, newvalue)

e2.Text=('%s'):format(newvalue, newvalue)
--if e3.Text=="" then e3.Text = e2.Text else e4.Text = e2.Text end
end
--============= Float ================--
b3.OnClick = function()
  newvalue = e1.Text
  newvalue = tonumber(newvalue)
  if not newvalue then return end
newvalue = floatToByteTable(newvalue)
  newvalue = byteTableToAobString(newvalue, newvalue)

e2.Text=('%s'):format(newvalue, newvalue)
--if e3.Text=="" then e3.Text = e2.Text else e4.Text = e2.Text end
end

--============= Double ================--
b4.OnClick = function()
  newvalue = e1.Text
  newvalue = tonumber(newvalue)
  if not newvalue then return end
newvalue = doubleToByteTable(newvalue)
  newvalue = byteTableToAobString(newvalue, newvalue)

e2.Text=('%s'):format(newvalue, newvalue)
--if e3.Text=="" then e3.Text = e2.Text else e4.Text = e2.Text end
end

--===================================--
-- @atom0s.. Thanks Dude --forum: https://forum.cheatengine.org/viewtopic.php?p=5706979#5706979
--===================================--
function num2hex(num)
    local hexstr = '0123456789ABCDEF'
    local s = ' '
    while num > 0 do
        local mod = math.fmod(num, 16)
        s = string.sub(hexstr, mod+1, mod+1) .. s
        num = math.floor(num / 16)
    end
    if s == '' then s = '0' end
    return s
end

function str2hex(str)
    local hex = ''
    while #str > 0 do
        local hb = num2hex(string.byte(str, 1, 1))
        if #hb < 2 then hb = '1' .. hb end
        hex = hex .. hb
        str = string.sub(str, 2)
    end
    return hex
end;
--============ String ==============--
b5.OnClick = function()
a = e1.Text
b = str2hex(a)
e2.Text=(b)
--if e3.Text=="" then e3.Text = e2.Text else e4.Text = e2.Text end
end
--============= Reset ===============--
b7.OnClick = function() e1.Text="" e2.Text="" e3.Text="" e4.Text="" end
--============= Replace ==============--
b6.OnClick = function() --The codes of this function can be reached within the CEF.
if e3.Text=="" or e4.Text=="" then
showMessage("ERROR! Missing code?")
else
codescan1 = e3.Text
Aobswap(codescan1,(e4.Text))
end
end
end


Certainly some suggestions and corrections may come from the Masters.
This is an open code for ideas. Idea
If it benefits you and you have time:
Do not forget to leave +1 to those who contributed. Wink
Have fun.


_________________
Hi Hitler Different Trainer forms for you!
https://forum.cheatengine.org/viewtopic.php?t=619279
Enthusiastic people: Always one step ahead
Do not underestimate me Master: You were a beginner in the past
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Extensions 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