<?xml version="1.0" encoding="utf-8"?>
<CheatTable CheatEngineTableVersion="45">
  <CheatEntries>
    <CheatEntry>
      <ID>64</ID>
      <Description>"Compact Mode"</Description>
      <VariableType>Auto Assembler Script</VariableType>
      <AssemblerScript>[ENABLE]
--https://forum.cheatengine.org/viewtopic.php?t=570055
LuaCall(function cycleFullCompact(sender,force) local state = not(compactmenuitem.Caption == 'Compact View Mode'); if force~=nil then state = not force end; compactmenuitem.Caption = state and 'Compact View Mode' or 'Full View Mode'; getMainForm().Splitter1.Visible = state; getMainForm().Panel4.Visible    = state; getMainForm().Panel5.Visible    = state; end; function addCompactMenu() if compactmenualreadyexists then return end; local parent = getMainForm().Menu.Items; compactmenuitem = createMenuItem(parent); parent.add(compactmenuitem); compactmenuitem.Caption = 'Compact View Mode'; compactmenuitem.OnClick = cycleFullCompact; compactmenualreadyexists = 'yes'; end; addCompactMenu(); cycleFullCompact(nil,true))

[DISABLE]
LuaCall(cycleFullCompact(nil,false))
</AssemblerScript>
    </CheatEntry>
    <CheatEntry>
      <ID>29</ID>
      <Description>"Scripts only available in shop only, or game may crash"</Description>
      <Color>8000FF</Color>
      <GroupHeader>1</GroupHeader>
    </CheatEntry>
    <CheatEntry>
      <ID>2</ID>
      <Description>"Get coin (Spend $ in shop)"</Description>
      <Options moHideChildren="1" moDeactivateChildrenAsWell="1"/>
      <VariableType>Auto Assembler Script</VariableType>
      <AssemblerScript>{ Game   : Brotato.exe
  Version: 
  Date   : 2022-10-02
  Author : bbfox@https://opencheattables.com
}

[ENABLE]

aobscanmodule(INJECT_GET_COIN,Brotato.exe,48 8B 53 08 48 2B 56 08) // should be unique
alloc(newmem,$1000,INJECT_GET_COIN)

label(code)
label(return)
label(i_base_coin_addr)

newmem:
  db EB 3B 54 68 69 73 20 74 61 62 6C 65 20 63 6F 6D 65 73 20 66 72 6F 6D 20 68 74 74 70 73 3A 2F 2F 6F 70 65 6E 63 68 65 61 74 74 61 62 6C 65 73 2E 63 6F 6D 20 2F 20 43 45 20 37 2E 34 2B
  push rax

  test r12, r12
  jne endp
  test r13, r13
  jne endp
  cmp r9,r14
  jne endp

  //mov rax, [rbx+08]

  mov eax, [rbx+18]
  cmp eax, 2
  jne endp
  mov eax, [rbx+00]
  cmp eax, 2
  jne endp
  mov eax, [rbx+0C]
  test eax, eax
  jne endp
  mov eax, [rbx+20]
  test eax, eax
  je endp

 {$try}
  mov rax, [rbx+E8]
  ////jmp _test1
 {$except}
  ////xor rax,rax

_test1:
  test rax, rax
  je endp

  mov [i_base_coin_addr], rbx

endp:
  pop rax

code:
  mov rdx,[rbx+08]
  sub rdx,[rsi+08]
  jmp return
align 10 cc
  i_base_coin_addr:
  dq 0

INJECT_GET_COIN:
  jmp newmem
  nop 3
return:
registersymbol(INJECT_GET_COIN)
registersymbol(i_base_coin_addr)

[DISABLE]

INJECT_GET_COIN:
  db 48 8B 53 08 48 2B 56 08

unregistersymbol(*)
dealloc(newmem)

{
// ORIGINAL CODE - INJECTION POINT: Brotato.exe+1AB03BB

Brotato.exe+1AB0392: 48 63 03                    - movsxd  rax,dword ptr [rbx]
Brotato.exe+1AB0395: 83 F8 1A                    - cmp eax,1A
Brotato.exe+1AB0398: 0F 87 F3 02 00 00           - ja Brotato.exe+1AB0691
Brotato.exe+1AB039E: 41 0F B6 84 00 44 28 AB 01  - movzx eax,byte ptr [r8+rax+01AB2844]
Brotato.exe+1AB03A7: 41 8B 8C 80 28 28 AB 01     - mov ecx,[r8+rax*4+01AB2828]
Brotato.exe+1AB03AF: 49 03 C8                    - add rcx,r8
Brotato.exe+1AB03B2: FF E1                       - jmp rcx
Brotato.exe+1AB03B4: 8B 06                       - mov eax,[rsi]
Brotato.exe+1AB03B6: 83 F8 02                    - cmp eax,02
Brotato.exe+1AB03B9: 75 3E                       - jne Brotato.exe+1AB03F9
// ---------- INJECTING HERE ----------
Brotato.exe+1AB03BB: 48 8B 53 08                 - mov rdx,[rbx+08]
// ---------- DONE INJECTING  ----------
Brotato.exe+1AB03BF: 48 2B 56 08                 - sub rdx,[rsi+08]
Brotato.exe+1AB03C3: 48 8D 8D 78 1B 00 00        - lea rcx,[rbp+00001B78]
Brotato.exe+1AB03CA: E8 C1 ED FD FF              - call Brotato.exe+1A8F190
Brotato.exe+1AB03CF: 90                          - nop
Brotato.exe+1AB03D0: 48 8D 95 78 1B 00 00        - lea rdx,[rbp+00001B78]
Brotato.exe+1AB03D7: 49 8B CE                    - mov rcx,r14
Brotato.exe+1AB03DA: E8 B1 76 FE FF              - call Brotato.exe+1A97A90
Brotato.exe+1AB03DF: 90                          - nop
Brotato.exe+1AB03E0: 83 BD 78 1B 00 00 00        - cmp dword ptr [rbp+00001B78],00
Brotato.exe+1AB03E7: 0F 84 DF 20 00 00           - je Brotato.exe+1AB24CC
}
</AssemblerScript>
      <CheatEntries>
        <CheatEntry>
          <ID>8</ID>
          <Description>"Available in shop only / disable after done"</Description>
          <Color>8000FF</Color>
          <GroupHeader>1</GroupHeader>
        </CheatEntry>
        <CheatEntry>
          <ID>31</ID>
          <Description>"Base addr."</Description>
          <ShowAsHex>1</ShowAsHex>
          <ShowAsSigned>0</ShowAsSigned>
          <Color>808080</Color>
          <VariableType>8 Bytes</VariableType>
          <Address>i_base_coin_addr</Address>
        </CheatEntry>
        <CheatEntry>
          <ID>3</ID>
          <Description>"Coin"</Description>
          <ShowAsSigned>0</ShowAsSigned>
          <Color>FF8080</Color>
          <VariableType>4 Bytes</VariableType>
          <Address>i_base_coin_addr</Address>
          <Offsets>
            <Offset>8</Offset>
          </Offsets>
        </CheatEntry>
      </CheatEntries>
    </CheatEntry>
    <CheatEntry>
      <ID>6</ID>
      <Description>"Get last changed stats"</Description>
      <Options moHideChildren="1" moDeactivateChildrenAsWell="1"/>
      <VariableType>Auto Assembler Script</VariableType>
      <AssemblerScript Async="1">{ Game   : Brotato.exe
  Version:
  Date   : 2023-06-29
  Author : bbfox@https://opencheattables.com
}

[ENABLE]

aobscanmodule(INJECT_GET_HP,Brotato.exe,48 8B 47 08 48 89 43 08 48 83) // should be unique
alloc(newmem,$1000,INJECT_GET_HP)

label(code)
label(return)
label(i_temp_addr)
label(i_base_hp_addr1)
label(i_base_hp_addr2)
label(i_base_hp_addr3)
label(i_base_hp_addr4)
label(i_base_hp_addr5)
label(i_base_hp_addr6)
label(i_base_hp_addr7)
label(i_base_hp_addr8)
label(i_base_hp_addr9)
label(i_base_hp_addr10)
label(i_display_idx)
label(is_auto_set)
label(i_auto_set_value)

newmem:
  db EB 3B 54 68 69 73 20 74 61 62 6C 65 20 63 6F 6D 65 73 20 66 72 6F 6D 20 68 74 74 70 73 3A 2F
  db 2F 6F 70 65 6E 63 68 65 61 74 74 61 62 6C 65 73 2E 63 6F 6D 20 2F 20 43 45 20 37 2E 34 2B

  pushfq
  push rax
  push rcx
  push r14

  cmp r13, 5
  jne endp
  test r12, r12
  jz endp
  test r8, r8
  jz endp
  cmp r8, 10000
  jae endp
  cmp r8d, F0
  jae endp

  //mov eax, [rbx+0C] // garbage code for debug
  xor rcx, rcx
  mov ecx, [i_idx]
  mov rax, i_base_hp_addr1
  lea r14, [rax+rcx]
  mov [r14], rdi

  cmp dword ptr [is_auto_set], 1
  jne @F
  mov rcx, [i_auto_set_value]
  cmp [rdi+08], rcx
  jge @F
  mov [rdi+08], rcx



@@:
  add dword ptr [i_idx], 8
  cmp dword ptr [i_idx], #80
  jbe endp
  mov dword ptr [i_idx], 0

endp:
  vmovss xmm14, [vf_8]
  cvtsi2ss xmm15, dword ptr [i_idx]
  vdivss xmm15, xmm15, xmm14
  vcvtss2si ecx, xmm15
  mov [i_display_idx], ecx

  pop r14
  pop rcx
  pop rax
  popfq


code:
  mov rax,[rdi+08]
  mov [rbx+08],rax
  jmp return
align 10 cc
  is_auto_set:
  dd 0
  i_auto_set_value:
  dq 32
  i_temp_addr:
  dq 0
  i_base_hp_addr1:
  dq 0
  i_base_hp_addr2:
  dq 0
  i_base_hp_addr3:
  dq 0
  i_base_hp_addr4:
  dq 0
  i_base_hp_addr5:
  dq 0
  i_base_hp_addr6:
  dq 0
  i_base_hp_addr7:
  dq 0
  i_base_hp_addr8:
  dq 0
  i_base_hp_addr9:
  dq 0
  i_base_hp_addr10:
  dq 0
  i_idx:
  dd 0
  i_display_idx:
  dd 0
  vf_8:
  dd (float)8

INJECT_GET_HP:
  jmp newmem
  nop 3
return:
registersymbol(INJECT_GET_HP)
registersymbol(i_base_hp_addr1)
registersymbol(i_base_hp_addr2)
registersymbol(i_base_hp_addr3)
registersymbol(i_base_hp_addr4)
registersymbol(i_base_hp_addr5)
registersymbol(i_base_hp_addr6)
registersymbol(i_base_hp_addr7)
registersymbol(i_base_hp_addr8)
registersymbol(i_base_hp_addr9)
registersymbol(i_base_hp_addr10)
registersymbol(i_display_idx)
registersymbol(is_auto_set)
registersymbol(i_auto_set_value)

[DISABLE]

INJECT_GET_HP:
  db 48 8B 47 08 48 89 43 08

unregistersymbol(*)
dealloc(newmem)

{
// ORIGINAL CODE - INJECTION POINT: Brotato.exe+1A894E4

Brotato.exe+1A894C9: 8B 8C 82 1C 98 A8 01  - mov ecx,[rdx+rax*4+01A8981C]
Brotato.exe+1A894D0: 48 03 CA              - add rcx,rdx
Brotato.exe+1A894D3: FF E1                 - jmp rcx
Brotato.exe+1A894D5: 0F B6 47 08           - movzx eax,byte ptr [rdi+08]
Brotato.exe+1A894D9: 88 43 08              - mov [rbx+08],al
Brotato.exe+1A894DC: 48 83 C4 20           - add rsp,20
Brotato.exe+1A894E0: 5F                    - pop rdi
Brotato.exe+1A894E1: 5E                    - pop rsi
Brotato.exe+1A894E2: 5B                    - pop rbx
Brotato.exe+1A894E3: C3                    - ret
// ---------- INJECTING HERE ----------
Brotato.exe+1A894E4: 48 8B 47 08           - mov rax,[rdi+08]
// ---------- DONE INJECTING  ----------
Brotato.exe+1A894E8: 48 89 43 08           - mov [rbx+08],rax
Brotato.exe+1A894EC: 48 83 C4 20           - add rsp,20
Brotato.exe+1A894F0: 5F                    - pop rdi
Brotato.exe+1A894F1: 5E                    - pop rsi
Brotato.exe+1A894F2: 5B                    - pop rbx
Brotato.exe+1A894F3: C3                    - ret
Brotato.exe+1A894F4: 48 8D 4B 08           - lea rcx,[rbx+08]
Brotato.exe+1A894F8: 48 89 4C 24 48        - mov [rsp+48],rcx
Brotato.exe+1A894FD: 48 85 C9              - test rcx,rcx
Brotato.exe+1A89500: 0F 84 0C 03 00 00     - je Brotato.exe+1A89812
}
</AssemblerScript>
      <CheatEntries>
        <CheatEntry>
          <ID>72</ID>
          <Description>"Usage: move cursor over attributes (in right corner) in shop"</Description>
          <Color>8000FF</Color>
          <GroupHeader>1</GroupHeader>
        </CheatEntry>
        <CheatEntry>
          <ID>70</ID>
          <Description>"Next overwrite position#"</Description>
          <ShowAsSigned>0</ShowAsSigned>
          <Color>808080</Color>
          <VariableType>4 Bytes</VariableType>
          <Address>i_display_idx</Address>
        </CheatEntry>
        <CheatEntry>
          <ID>73</ID>
          <Description>"Auto set value?"</Description>
          <DropDownList DescriptionOnly="1" DisplayValueAsItem="1">0:No
1:Yes
</DropDownList>
          <ShowAsSigned>0</ShowAsSigned>
          <Color>C08000</Color>
          <VariableType>4 Bytes</VariableType>
          <Address>is_auto_set</Address>
        </CheatEntry>
        <CheatEntry>
          <ID>74</ID>
          <Description>"Auto set value target:"</Description>
          <ShowAsSigned>1</ShowAsSigned>
          <Color>C08000</Color>
          <VariableType>4 Bytes</VariableType>
          <Address>i_auto_set_value</Address>
        </CheatEntry>
        <CheatEntry>
          <ID>7</ID>
          <Description>"Last stats value #0"</Description>
          <ShowAsSigned>1</ShowAsSigned>
          <Color>FF8080</Color>
          <VariableType>4 Bytes</VariableType>
          <Address>i_base_hp_addr1</Address>
          <Offsets>
            <Offset>8</Offset>
          </Offsets>
        </CheatEntry>
        <CheatEntry>
          <ID>12</ID>
          <Description>"Last stats value #1"</Description>
          <ShowAsSigned>1</ShowAsSigned>
          <Color>FF8080</Color>
          <VariableType>4 Bytes</VariableType>
          <Address>i_base_hp_addr2</Address>
          <Offsets>
            <Offset>8</Offset>
          </Offsets>
        </CheatEntry>
        <CheatEntry>
          <ID>24</ID>
          <Description>"Last stats value #2"</Description>
          <ShowAsSigned>1</ShowAsSigned>
          <Color>FF8080</Color>
          <VariableType>4 Bytes</VariableType>
          <Address>i_base_hp_addr3</Address>
          <Offsets>
            <Offset>8</Offset>
          </Offsets>
        </CheatEntry>
        <CheatEntry>
          <ID>25</ID>
          <Description>"Last stats value #3"</Description>
          <ShowAsSigned>1</ShowAsSigned>
          <Color>FF8080</Color>
          <VariableType>4 Bytes</VariableType>
          <Address>i_base_hp_addr4</Address>
          <Offsets>
            <Offset>8</Offset>
          </Offsets>
        </CheatEntry>
        <CheatEntry>
          <ID>26</ID>
          <Description>"Last stats value #4"</Description>
          <ShowAsSigned>1</ShowAsSigned>
          <Color>FF8080</Color>
          <VariableType>4 Bytes</VariableType>
          <Address>i_base_hp_addr5</Address>
          <Offsets>
            <Offset>8</Offset>
          </Offsets>
        </CheatEntry>
        <CheatEntry>
          <ID>65</ID>
          <Description>"Last stats value #5"</Description>
          <ShowAsSigned>1</ShowAsSigned>
          <Color>FF8080</Color>
          <VariableType>4 Bytes</VariableType>
          <Address>i_base_hp_addr6</Address>
          <Offsets>
            <Offset>8</Offset>
          </Offsets>
        </CheatEntry>
        <CheatEntry>
          <ID>66</ID>
          <Description>"Last stats value #6"</Description>
          <ShowAsSigned>1</ShowAsSigned>
          <Color>FF8080</Color>
          <VariableType>4 Bytes</VariableType>
          <Address>i_base_hp_addr7</Address>
          <Offsets>
            <Offset>8</Offset>
          </Offsets>
        </CheatEntry>
        <CheatEntry>
          <ID>67</ID>
          <Description>"Last stats value #7"</Description>
          <ShowAsSigned>1</ShowAsSigned>
          <Color>FF8080</Color>
          <VariableType>4 Bytes</VariableType>
          <Address>i_base_hp_addr8</Address>
          <Offsets>
            <Offset>8</Offset>
          </Offsets>
        </CheatEntry>
        <CheatEntry>
          <ID>68</ID>
          <Description>"Last stats value #8"</Description>
          <ShowAsSigned>1</ShowAsSigned>
          <Color>FF8080</Color>
          <VariableType>4 Bytes</VariableType>
          <Address>i_base_hp_addr9</Address>
          <Offsets>
            <Offset>8</Offset>
          </Offsets>
        </CheatEntry>
        <CheatEntry>
          <ID>69</ID>
          <Description>"Last stats value #9"</Description>
          <ShowAsSigned>1</ShowAsSigned>
          <Color>FF8080</Color>
          <VariableType>4 Bytes</VariableType>
          <Address>i_base_hp_addr10</Address>
          <Offsets>
            <Offset>8</Offset>
          </Offsets>
        </CheatEntry>
      </CheatEntries>
    </CheatEntry>
    <CheatEntry>
      <ID>56</ID>
      <Description>"Get wave timer"</Description>
      <Options moHideChildren="1"/>
      <VariableType>Auto Assembler Script</VariableType>
      <AssemblerScript>{ Game   : Brotato.exe
  Version: 
  Date   : 2022-10-04
  Author : bbfox@https://opencheattablesc.com
}

[ENABLE]

aobscanmodule(INJECT_WAVE_TIMER,Brotato.exe,F2 0F 5C C8 F2 0F 11 89 E0 01 00 00 0F 57 C0 66 0F 2F C1 0F 86 51) // should be unique
alloc(newmem,$1000,INJECT_WAVE_TIMER)

label(code)
label(return)
label(i_base_timer_addr)
label(vf_timer_threshold)

newmem:
  vmovss xmm15, [rcx+000001D8]
  vmovss xmm14, [vf_timer_threshold]
  vucomiss xmm15, xmm14
  jb code
  // should be wave timer
  push rax
  mov ax, [rcx+000001DC]
  cmp ax, 1
  jne endp
  mov ax, [rcx+000001DE]
  cmp ax, 1
  jne endp
  mov eax, [rcx+000001E8]
  cmp eax, 1
  jne endp

  mov [i_base_timer_addr], rcx

endp:
  pop rax

code:
  subsd xmm1,xmm0
  movsd [rcx+000001E0],xmm1
  jmp return
align 10 cc
  vf_timer_threshold:
  dd (float)20
  i_base_timer_addr:
  dq 0

INJECT_WAVE_TIMER:
  jmp newmem
  nop 7
return:
registersymbol(INJECT_WAVE_TIMER)
registersymbol(i_base_timer_addr)
registersymbol(vf_timer_threshold)

[DISABLE]

INJECT_WAVE_TIMER:
  db F2 0F 5C C8 F2 0F 11 89 E0 01 00 00

unregistersymbol(*)
dealloc(newmem)

{
// ORIGINAL CODE - INJECTION POINT: Brotato.exe+119D0A3

Brotato.exe+119D072: F6 81 B8 01 00 00 08     - test byte ptr [rcx+000001B8],08
Brotato.exe+119D079: 0F 84 8E 01 00 00        - je Brotato.exe+119D20D
Brotato.exe+119D07F: 48 8B 81 38 01 00 00     - mov rax,[rcx+00000138]
Brotato.exe+119D086: 48 85 C0                 - test rax,rax
Brotato.exe+119D089: 74 0A                    - je Brotato.exe+119D095
Brotato.exe+119D08B: F3 0F 10 80 5C 01 00 00  - movss xmm0,[rax+0000015C]
Brotato.exe+119D093: EB 03                    - jmp Brotato.exe+119D098
Brotato.exe+119D095: 0F 57 C0                 - xorps xmm0,xmm0
Brotato.exe+119D098: 0F 5A C0                 - cvtps2pd xmm0,xmm0
Brotato.exe+119D09B: F2 0F 10 89 E0 01 00 00  - movsd xmm1,[rcx+000001E0]
// ---------- INJECTING HERE ----------
Brotato.exe+119D0A3: F2 0F 5C C8              - subsd xmm1,xmm0
// ---------- DONE INJECTING  ----------
Brotato.exe+119D0A7: F2 0F 11 89 E0 01 00 00  - movsd [rcx+000001E0],xmm1
Brotato.exe+119D0AF: 0F 57 C0                 - xorps xmm0,xmm0
Brotato.exe+119D0B2: 66 0F 2F C1              - comisd xmm0,xmm1
Brotato.exe+119D0B6: 0F 86 51 01 00 00        - jbe Brotato.exe+119D20D
Brotato.exe+119D0BC: 80 B9 DC 01 00 00 00     - cmp byte ptr [rcx+000001DC],00
Brotato.exe+119D0C3: 75 19                    - jne Brotato.exe+119D0DE
Brotato.exe+119D0C5: F3 0F 10 81 D8 01 00 00  - movss xmm0,[rcx+000001D8]
Brotato.exe+119D0CD: 0F 5A C0                 - cvtps2pd xmm0,xmm0
Brotato.exe+119D0D0: F2 0F 58 C1              - addsd xmm0,xmm1
Brotato.exe+119D0D4: F2 0F 11 81 E0 01 00 00  - movsd [rcx+000001E0],xmm0
}
</AssemblerScript>
      <CheatEntries>
        <CheatEntry>
          <ID>57</ID>
          <Description>"Timer identifies threshold"</Description>
          <ShowAsSigned>0</ShowAsSigned>
          <VariableType>Float</VariableType>
          <Address>vf_timer_threshold</Address>
        </CheatEntry>
        <CheatEntry>
          <ID>54</ID>
          <Description>"Timer"</Description>
          <ShowAsSigned>0</ShowAsSigned>
          <VariableType>Double</VariableType>
          <Address>i_base_timer_addr</Address>
          <Offsets>
            <Offset>1E0</Offset>
          </Offsets>
        </CheatEntry>
      </CheatEntries>
    </CheatEntry>
    <CheatEntry>
      <ID>30</ID>
      <Description>"Brotato 1.0.0.3 /  https://opencheattables.com  /  CE 7.5+"</Description>
      <Color>400080</Color>
      <GroupHeader>1</GroupHeader>
    </CheatEntry>
  </CheatEntries>
  <UserdefinedSymbols/>
</CheatTable>
