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 


Expanding the scope of the Cheat Engine

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine
View previous topic :: View next topic  
Author Message
Razi
Expert Cheater
Reputation: 1

Joined: 17 Jan 2018
Posts: 205

PostPosted: Fri Jun 26, 2020 4:36 pm    Post subject: Expanding the scope of the Cheat Engine Reply with quote

I want to make the Cheat Engine see the PSX assembler (MIPS R3000A) instructions in the "memory view" window, instead of PC assembler instructions. All PSX assembler instructions are 4 bytes long and are located in memory as follows: 0x00, 0x04, 0x08, 0x0C, 0x10, etc. One user said that it is possible to write a plugin for CE in Lua. How do you think this can take a lot of time, month or 3 months? Is it possible to do? If so, what is needed for this, source code?
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 467

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

PostPosted: Fri Jun 26, 2020 5:16 pm    Post subject: Reply with quote

see if you can find a binutils for mips r3000A
You can then register that with CE and then use it like the normal disassembler

You will still not be able to debug though

_________________
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
Razi
Expert Cheater
Reputation: 1

Joined: 17 Jan 2018
Posts: 205

PostPosted: Sat Jun 27, 2020 5:46 am    Post subject: Reply with quote

Dark Byte wrote:
see if you can find a binutils for mips r3000A
You can then register that with CE and then use it like the normal disassembler

So far, the search has shown only something similar: mips-linux-gnu-as. I will answer later if I can find something.
What tools (or something else) are needed to make a full PSX debugger in CE?
Back to top
View user's profile Send private message
panraven
Grandmaster Cheater
Reputation: 61

Joined: 01 Oct 2008
Posts: 958

PostPosted: Sat Jun 27, 2020 6:33 am    Post subject: Reply with quote

https://www.dropbox.com/s/t2289k8ndfji4oy/mips-oldy.zip?dl=1
This my tool used on making ps cheat more than a decade before (its version show 1997 Smile
I'm same have problem find a modern version~_~

This my config, not working, not sure how.
Code:

registerBinUtil{
  Path = [[D:\00EXE\00_CMD\mips-oldies\]],
  Name = 'MIPS3K',
  Description = 'mips test',
  ASParam = '',
  LDParam = '',
  OBJDUMPParam = '',
  Prefix='',  --- should be 'mips-linux-gnu-' for mips-linux-gnu-as etc
  Architecture = 'mips',
  DisassemblerCommentChar='#',
-- OnDisassemble = function(addr)return some-objdump-param-in-str end
}


and
binutils.pas
https://github.com/cheat-engine/cheat-engine/blob/acc6cefd0f18d9dd97040e6cc0a5339e9f056e2e/Cheat%20Engine/binutils.pas

ADDED:
I suspect my old pack is not complete, only have as,ar,ld,objdump,
there seem need other like objcopy which used in binutil.pas

ADDED2:
if run the registerBinUtil, there will be option in memory view/view to switch binutil option.
Each run create an extra option; should it be replace by the same Name?

_________________
- Retarded.
Back to top
View user's profile Send private message
mgr.inz.Player
I post too much
Reputation: 221

Joined: 07 Nov 2008
Posts: 4438
Location: W kraju nad Wisla. UTC+01:00

PostPosted: Sat Jun 27, 2020 9:09 am    Post subject: Reply with quote

For tools from MSYS2-MinGW-W64, I'm using this:
Code:
local mingw32={}
mingw32.Name="MinGW-W64"
mingw32.Description="32bit"
mingw32.Architecture="i386:intel"
mingw32.OBJDUMPParam='-Mi386,intel,intel-mnemonic'
mingw32.ASParam='"-n" "-msyntax=intel" "-mmnemonic=intel" "-mnaked-reg"'
mingw32.LDParam=''
mingw32.Path=[[C:\msys32\mingw32\bin]]
mingw32.Prefix=""
mingw32.DisassemblerCommentChar="#"
registerBinUtil(mingw32)


local mingw64={}
mingw64.Name="MinGW-W64"
mingw64.Description="64bit"
mingw64.Architecture="x86-64:intel"
mingw64.OBJDUMPParam='-Mx86-64,intel,intel-mnemonic'
mingw64.ASParam='"--64" "-n" "-msyntax=intel" "-mmnemonic=intel" "-mnaked-reg"'
mingw64.LDParam=''
mingw64.Path=[[C:\msys32\mingw64\bin]]
mingw64.Prefix=""
mingw64.DisassemblerCommentChar="#"
registerBinUtil(mingw64)

_________________
Back to top
View user's profile Send private message MSN Messenger
Razi
Expert Cheater
Reputation: 1

Joined: 17 Jan 2018
Posts: 205

PostPosted: Sat Jun 27, 2020 9:47 am    Post subject: Reply with quote

panraven wrote:
https://www.dropbox.com/s/t2289k8ndfji4oy/mips-oldy.zip?dl=1
This my tool used on making ps cheat more than a decade before (its version show 1997 Smile

The archive requires a password.
Back to top
View user's profile Send private message
panraven
Grandmaster Cheater
Reputation: 61

Joined: 01 Oct 2008
Posts: 958

PostPosted: Sat Jun 27, 2020 9:58 am    Post subject: Reply with quote

Razi wrote:
panraven wrote:
https://www.dropbox.com/s/t2289k8ndfji4oy/mips-oldy.zip?dl=1
This my tool used on making ps cheat more than a decade before (its version show 1997 Smile

The archive requires a password.

oops, sry, it is [mips], 4 small letter.

_________________
- Retarded.
Back to top
View user's profile Send private message
Razi
Expert Cheater
Reputation: 1

Joined: 17 Jan 2018
Posts: 205

PostPosted: Sat Jun 27, 2020 2:43 pm    Post subject: Reply with quote

panraven wrote:

and
binutils.pas
https://github.com/cheat-engine/cheat-engine/blob/acc6cefd0f18d9dd97040e6cc0a5339e9f056e2e/Cheat%20Engine/binutils.pas

Can you explain what to do next? I put the file binutils.pas in CE plugins folder. Is it right?

panraven wrote:

This my config, not working, not sure how.
Code:

registerBinUtil{
  Path = [[D:\00EXE\00_CMD\mips-oldies\]],
  Name = 'MIPS3K',
  Description = 'mips test',
  ASParam = '',
  LDParam = '',
  OBJDUMPParam = '',
  Prefix='',  --- should be 'mips-linux-gnu-' for mips-linux-gnu-as etc
  Architecture = 'mips',
  DisassemblerCommentChar='#',
-- OnDisassemble = function(addr)return some-objdump-param-in-str end
}


created mips.lua in CE autorun folder with code:
Code:
local mips={}
mips.Name="MIPS3K"
mips.Description="mips test"
mips.Architecture="mips"
mips.OBJDUMPParam=''
mips.ASParam=''
mips.LDParam=''
mips.Path=[[H:\mips-oldy]]
mips.Prefix=""
mips.DisassemblerCommentChar="#"
registerBinUtil(mips)


Is it right code? Then in CE Memory Viewer window I choose: View-->BinUtils-->MIPS3K - mips test , but an error appears and CE closes. Where is the mistake?
Back to top
View user's profile Send private message
panraven
Grandmaster Cheater
Reputation: 61

Joined: 01 Oct 2008
Posts: 958

PostPosted: Sat Jun 27, 2020 3:41 pm    Post subject: Reply with quote

My setup (the incomplete binutils) and config is not working.
But I'm not causing ce closed, only the memory view disassemble show 'invalid' in every address, slowing ce, yet still possible to turn off binutils in ce menu.

I'm lazy, so expecting someone compile a recent binutil and share with us Smile






ADDED:

Finally got one seemly working Smile
In this page https://sourcery.mentor.com/GNUToolchain/release3133
download IA32 Windows TAR
It seem we only need the bin directory and set Prefix='mips-linux-gnu-'.

btw, Assemble a line show error message.

ADDED2:

Quote:
Can you explain what to do next? I put the file binutils.pas in CE plugins folder. Is it right?


sry, missed this one. It is ce source code to show how ce handle binutil feature.



mips-binutil.png
 Description:
 Filesize:  62.5 KB
 Viewed:  4852 Time(s)

mips-binutil.png



_________________
- Retarded.
Back to top
View user's profile Send private message
Razi
Expert Cheater
Reputation: 1

Joined: 17 Jan 2018
Posts: 205

PostPosted: Sun Jun 28, 2020 5:55 am    Post subject: Reply with quote

panraven wrote:

Finally got one seemly working Smile
In this page https://sourcery.mentor.com/GNUToolchain/release3133
download IA32 Windows TAR
It seem we only need the bin directory and set Prefix='mips-linux-gnu-'.


This is very good.
Is there an option to display bytes not in reverse order, in the top side of Memory Viewer window? Not like this (reverse: 23104300), but like this (forward: 00431023) ?

panraven wrote:
btw, Assemble a line show error message.

There is a tool "PSIG", that generates bytes from instructions. Screenshot below. But tool is sensitive to capital and small letters. Need to write insructions like this: SUBU v0,v0,v1. Need to write SUBU with capital letters and v0,v0,v1 with small letters.
We can change the instructions (I mean bytes) in Memory Viewer window below, where the raw memory is shown.



7.JPG
 Description:
 Filesize:  190.14 KB
 Viewed:  4840 Time(s)

7.JPG



8.JPG
 Description:
 Filesize:  35.21 KB
 Viewed:  4837 Time(s)

8.JPG


Back to top
View user's profile Send private message
panraven
Grandmaster Cheater
Reputation: 61

Joined: 01 Oct 2008
Posts: 958

PostPosted: Sun Jun 28, 2020 7:15 am    Post subject: Reply with quote

Something like?
Code:

local mv = getMemoryViewForm()
local dis = mv.DisassemblerView
local force = true
if force or not dis.OnDisassemblerViewOverride then
  local opTransForm = {
    move = 'ADDU',
    li = 'ORI',
  }
  dis.OnDisassemblerViewOverride = function(address, addressstring, bytestring, opcodestring, parameterstring, specialstring)
    if bytestring and bytestring:match'%x%x%s*%x%x%x%x%x%x'--[[8 hex--> from binutil ??]]then

      opcodestring = opTransForm[opcodestring] or opcodestring

      local r = {}
      bytestring:gsub('%x%x',function(hx) r[1+#r]=hx end)
      r[1],r[2],r[3],r[4]=r[4],r[3],r[2],r[1]--reverse
      bytestring = table.concat(r,'')
      local decs ={}
      parameterstring = parameterstring:
        gsub('%f[%w]0x(%x+)','0%1'):
        gsub('%f[%w](%-?[1-9]%d*)',function(dec) return '0'..string.format('%X',tonumber(dec)) end):
        gsub('%f[-%w](%-?0[1-9a-fA-F]%x*)',function(hex)
          local dec = tonumber(hex,16)
          decs[1+#decs] = string.format('%s',  dec>0x7fff and dec-0x10000 or dec)
          return string.format('0%X',tonumber(dec) & 0xffff)
        end):
        gsub('%f[%x]0(%x%x%x?%x?)',' %1')
      if #decs>0 then
        local pad = #parameterstring>20 and '' or string.rep(' ',20-#parameterstring)
        parameterstring=parameterstring..pad..' ; dec:'..table.concat(decs,', ')
      end
      return addressstring, bytestring, opcodestring, parameterstring, specialstring
    end
  end
end
--[[-- at celua.txt
  OnDisassemblerViewOverride: Called when a line is about to be rendered
    funtion(address, addressstring, bytestring, opcodestring, parameterstring, specialstring)
      return addressstring, bytestring, opcodestring, parameterstring, specialstring
    end
--]]



Changed few line of my previous pic:
Code:

__      - 00 00 0C 24           - li t4,0
02520004- 0E 80 08 3C           - lui t0,0x800e
02520008- 00 B9 08 85           - lh t0,-18176(t0)/// display as : lh t0,8900(t0)  ; -ve : 4700
0252000C- 00 00 00 00           - nop
02520010- 20 01 09 31           - andi t1,t0,0x120
02520014- 20 01 01 24           - li at,288


note: copy bytes don't copy change of parameterstring



mips-binuti2l.png
 Description:
 Filesize:  12.03 KB
 Viewed:  4818 Time(s)

mips-binuti2l.png



_________________
- Retarded.


Last edited by panraven on Sun Jun 28, 2020 11:16 am; edited 6 times in total
Back to top
View user's profile Send private message
Razi
Expert Cheater
Reputation: 1

Joined: 17 Jan 2018
Posts: 205

PostPosted: Sun Jun 28, 2020 8:37 am    Post subject: Reply with quote

panraven wrote:
Something like?

Yes, now displays instructions better.

Can we change?:
1) "move" to "ADDU"
2) "li'' to "ORI".
3) 1 bytes values from decimal to hexadecimal: example: 15 to 0F
4) "zero" to "r0"
To instructions were more like the original Playstation 1.
Back to top
View user's profile Send private message
panraven
Grandmaster Cheater
Reputation: 61

Joined: 01 Oct 2008
Posts: 958

PostPosted: Sun Jun 28, 2020 9:21 am    Post subject: Reply with quote

This part of usage from objdump.exe
Code:

The following MIPS specific disassembler options are supported for use
with the -M switch (multiple options should be separated by commas):

  msa             Recognize MSA instructions.

  virt            Recognize the virtualization ASE instructions.

  xpa            Recognize the eXtended Physical Address (XPA) ASE instructions.

  gpr-names=ABI            Print GPR names according to  specified ABI.
                           Default: based on binary being disassembled.

  fpr-names=ABI            Print FPR names according to specified ABI.
                           Default: numeric.

  cp0-names=ARCH           Print CP0 register names according to
                           specified architecture.
                           Default: based on binary being disassembled.

  hwr-names=ARCH           Print HWR names according to specified
                           architecture.
                           Default: based on binary being disassembled.

  reg-names=ABI            Print GPR and FPR names according to
                           specified ABI.

  reg-names=ARCH           Print CP0 register and HWR names according to
                           specified architecture.

  For the options above, the following values are supported for "ABI":
    numeric 32 n32 64

  For the options above, The following values are supported for "ARCH":
    numeric r3000 r3900 r4000 r4010 vr4100 vr4111 vr4120 r4300 r4400 r4600 r4650 r5000 vr5400 vr5500 r5900 r6000 rm7000 rm9000 r8000 r10000 r12000 r14000 r16000 mips5 mips32 mips32r2 mips32r3 mips32r5 mips32r6 mips64 mips64r2 mips64r3 mips64r5 mips64r6 sb1 loongson2e loongson2f loongson3a octeon octeon+ octeon2 octeon3 xlr xlp

These options are for disassemble sending with -M <option>,
I've not check you may try on the config params, eg.
mips.OBJDUMPParam='-Mreg-names=numeric',
show significant differently with
'-Mreg-names=32', or
'',

NOTE: it seems not set it at all match better on reg-name (#4).

btw, you may need a assembler that help to assemble like lh t0,($800db900) as in my l5.s source code.
I forget how I assemble l5.s into l5.bin (contain only raw instruction bytes, no extra data) ~_~

For #1,#2, please check above modified OnDisassemblerViewOverride,
opTransForm operation.

_________________
- Retarded.
Back to top
View user's profile Send private message
Razi
Expert Cheater
Reputation: 1

Joined: 17 Jan 2018
Posts: 205

PostPosted: Mon Jun 29, 2020 11:48 am    Post subject: Reply with quote

panraven wrote:
btw, you may need a assembler that help to assemble like lh t0,($800db900) as in my l5.s source code.
I forget how I assemble l5.s into l5.bin (contain only raw instruction bytes, no extra data)


How to use this l5.bin ? Put it in the "bin" folder, where are files like "mips-linux-gnu-objdump.exe" located?
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 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