Skip to content

Commit

Permalink
Fixed Free Camera
Browse files Browse the repository at this point in the history
  • Loading branch information
inuNorii committed Jan 18, 2024
1 parent f70928f commit 2fecd69
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 12 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
### Fixed
- by [Dasaav](https://github.com/Dasaav-dsv):
- Last Hit Npc Info
- Free Camera

## [v1.7.0] - 2023-11-21
### Added
Expand Down
47 changes: 35 additions & 12 deletions ER_TGA.CT
Original file line number Diff line number Diff line change
Expand Up @@ -123449,14 +123449,37 @@ end
<VariableType>Auto Assembler Script</VariableType>
<AssemblerScript>// Author: pav
// Activate via A+L3 or by setting "Free camera mode"
[ENABLE]

{$lua}
if syntaxcheck then return end
address_version("2.00")
local key_toggle_addr = "$process+0x44ff72e"
local fix_controls_addr = "$process+0x229df5"
writeByte(key_toggle_addr,1)
writeBytes(fix_controls_addr,"B0 01") -- mov al,01

local function getCallTarget(address)
if not address then return nil end
return address + readInteger(address + 1) + 5
end

local function applyReturnPatch(address, value)
writeBytes(address, {0xB0, value and 1 or 0, 0xC3})
end

local function applyPatches(value)
local patches = {}
local patchAOBs = {
"E8 ?? ?? ?? ?? 84 C0 74 ?? 41 B0 01 BA ?? ?? ?? ?? 48 8B CE E8",
"E8 ?? ?? ?? ?? 84 C0 74 ?? 8B 83 ?? ?? ?? ?? 83 C0",
"E8 ?? ?? ?? ?? 84 C0 0F 85 ?? ?? ?? ?? 38 03"
}
for _,AOB in ipairs(patchAOBs) do
table.insert(patches, assert(getCallTarget(AOBScanModuleUnique(process, AOB))))
end
applyReturnPatch(table.remove(patches), value)
for _,patch in ipairs(patches) do
applyReturnPatch(getCallTarget(patch + 9), value)
end
end

[ENABLE]
applyPatches(true)
{$asm}
aobscanmodule(inject,$process,8b 83 c8 00 00 00 ff c8 83 f8 01 0f 87)
alloc(newmem,$100,inject)
Expand Down Expand Up @@ -123484,16 +123507,16 @@ inject:
jmp newmem
nop
returnhere:

[DISABLE]
applyPatches(false)
writeByte("[[FieldArea]+20]+C8",0)
writeByte("[GameMan]+0xB94",0)

{$asm}
dealloc(newmem)
inject:
db 8b 83 c8 00 00 00 //mov eax,[rbx+000000C8]
{$lua}
if syntaxcheck then return end
writeByte("[[FieldArea]+20]+C8",0)
writeByte("[GameMan]+0xB94",0)
writeByte(key_toggle_addr,0)
writeBytes(fix_controls_addr,"32 C0") -- xor al,al
</AssemblerScript>
<CheatEntries>
<CheatEntry>
Expand Down

0 comments on commit 2fecd69

Please sign in to comment.