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 


Free Fly Camera

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

Joined: 09 Dec 2010
Posts: 140

PostPosted: Sun Jan 17, 2016 5:36 pm    Post subject: Free Fly Camera Reply with quote

Does anyone have experience with creating this type of cheat? I've whipped up the follow and it works great, but I am unsure on how to always make the directions move according to the camera facing position. Lets say I have the following

Code:
Camera X
Camera Y
Camera Z
Camera H Rotation
Camera V Rotation


How would one go about making the camera move "Forward" (8), "Back" (2), "Left" (4), and "Right" (6) based on that information? Please forgive the sloppy coding as it is currently in a WIP state. Any help is appreciated.


Code:
[ENABLE]
alloc(flyMode, 2048)
alloc(flyEnabled, 1)
createthread(flyMode)

label(loopStart)
label(skipAll)

label(incX)
label(skipIncX)
label(decX)
label(skipDecX)

label(incY)
label(skipIncY)
label(decY)
label(skipDecY)

label(incZ)
label(skipIncZ)
label(decZ)
label(skipDecZ)

label(modifier)

registersymbol(flyMode)
registersymbol(flyEnabled)

flyEnabled:
  db 01

flyMode:

  //Loop until cheat is disabled
  loopStart:

    //Create input delay
    push 0A
    call kernel32.Sleep
 
    //Grab Camera Base
    mov edi, [cameraBase]
 
    cmp edi, 0
    je skipAll
 
    //Change X
 
    //VK_NUMPAD6 X Up
    push 68
    call GetAsyncKeyState
    shr ax,#15
    cmp ax,1
    jne skipIncX
        call incX
    skipIncX:
 
    //VK_NUMPAD4 X Down
    push 62
    call GetAsyncKeyState
    shr ax,#15
    cmp ax,1
    jne skipDecX
        call decX
    skipDecX:
 
    //Change Y
 
    //VK_NUMPAD8 Y Up
    push 66
    call GetAsyncKeyState
    shr ax,#15
    cmp ax,1
    jne skipIncY
        call incY
    skipIncY:
 
    //VK_NUMPAD2 Y Down
    push 64
    call GetAsyncKeyState
    shr ax,#15
    cmp ax,1
    jne skipDecY
        call decY
    skipDecY:
 
    //Change Z
 
    //VK_NUMPAD7 Z Up
    push 67
    call GetAsyncKeyState
    shr ax,#15
    cmp ax,1
    jne skipIncZ
        call incZ
    skipIncZ:
 
    //VK_NUMPAD1 Z Down
    push 61
    call GetAsyncKeyState
    shr ax,#15
    cmp ax,1
    jne skipDecZ
        call decZ
    skipDecZ:
 
    skipAll:
  cmp [flyEnabled], 1
  je loopStart

  dealloc(flyEnabled)
ret

//Change X
incX:
  fld dword ptr [edi+0C]
  fadd dword ptr [modifier]
  fstp dword ptr [edi+0C]
ret

decX:
  fld dword ptr [edi+0C]
  fsub dword ptr [modifier]
  fstp dword ptr [edi+0C]
ret

//Change Y
incY:
  fld dword ptr [edi+2C]
  fadd dword ptr [modifier]
  fstp dword ptr [edi+2C]
ret

decY:
  fld dword ptr [edi+2C]
  fsub dword ptr [modifier]
  fstp dword ptr [edi+2C]
ret

//Change Z
incZ:
  fld dword ptr [edi+1C]
  fadd dword ptr [modifier]
  fstp dword ptr [edi+1C]
ret

decZ:
  fld dword ptr [edi+1C]
  fsub dword ptr [modifier]
  fstp dword ptr [edi+1C]
ret

modifier:
  dd (float)100.00

[DISABLE]
flyEnabled:
  db 00

dealloc(flyMode)
unregistersymbol(flyMode)
unregistersymbol(flyEnabled)

_________________
Hitler are you bored? Watch some of my hacks here. Want 2 gb of online storage space for free? Get Dropbox for computer, phone, etc...
Back to top
View user's profile Send private message
Gniarf
Grandmaster Cheater Supreme
Reputation: 43

Joined: 12 Mar 2012
Posts: 1285

PostPosted: Sun Jan 17, 2016 7:18 pm    Post subject: Reply with quote

If the ground is the X Y plane, Z points upward, and Camera V angle is 0 when you look at the horizon, you move the camera forward by adding:
Speed*cos(Camera H angle)*cos(Camera V angle) to x
Speed*sin(Camera H angle)*cos(Camera V angle) to y
Speed*sin(Camera V angle) to z

To move to the left side, add:
Speed*sin(Camera H angle) to x
Speed*cos(Camera H angle) to y

For sin/cos calculation, you can use the fsin/fcos/fsincos instructions (warning: they use angles in radians, so one full turn = 2*pi ~= 6.28 ).

_________________
DO NOT PM me if you want help on making/fixing/using a hack.
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 138

Joined: 06 Jul 2014
Posts: 4275

PostPosted: Sun Jan 17, 2016 7:24 pm    Post subject: Reply with quote

Please forgive me if I'm wrong but I think you shouldn't dealloc your memory in the [DISABLE] section. The thread will almost certainly access that freed memory causing a segmentation fault and crashing the process. This topic has info on how to dealloc memory a thread is using in an AA script.

Besides that, your current code is clean and readable, but it could have a few optimizations here and there, especially with the jumps. Side note: you could also use Lua to do this if you wanted to by using createHotkey(...), createTimer(...), and read/writeFloat(...).

I'm guessing the camera is in a rectangular coordinate system relative to the world you're in, and not relative to your player. If you'd like to make the camera move relative to the direction your camera is facing, then you should be able to use trigonometry to do it by multiplying the [modifier] constant by the sin or cos of the rotation values (as Gniarf said). Note that you'll also need to modify your current code a fair bit to do this because you'll probably be changing more than 1 address at a time.

_________________
I don't know where I'm going, but I'll figure it out when I get there.
Back to top
View user's profile Send private message
abystus
Expert Cheater
Reputation: 1

Joined: 09 Dec 2010
Posts: 140

PostPosted: Sun Jan 17, 2016 11:56 pm    Post subject: Reply with quote

Gniarf wrote:
If the ground is the X Y plane, Z points upward, and Camera V angle is 0 when you look at the horizon, you move the camera forward by adding:
Speed*cos(Camera H angle)*cos(Camera V angle) to x
Speed*sin(Camera H angle)*cos(Camera V angle) to y
Speed*sin(Camera V angle) to z

To move to the left side, add:
Speed*sin(Camera H angle) to x
Speed*cos(Camera H angle) to y

For sin/cos calculation, you can use the fsin/fcos/fsincos instructions (warning: they use angles in radians, so one full turn = 2*pi ~= 6.28 ).


This is a perfect description of the xyz setup for this game. I will start with this and see where it takes me.

ParkourPenguin wrote:
Please forgive me if I'm wrong but I think you shouldn't dealloc your memory in the [DISABLE] section. The thread will almost certainly access that freed memory causing a segmentation fault and crashing the process. This topic has info on how to dealloc memory a thread is using in an AA script.

Besides that, your current code is clean and readable, but it could have a few optimizations here and there, especially with the jumps. Side note: you could also use Lua to do this if you wanted to by using createHotkey(...), createTimer(...), and read/writeFloat(...).

I'm guessing the camera is in a rectangular coordinate system relative to the world you're in, and not relative to your player. If you'd like to make the camera move relative to the direction your camera is facing, then you should be able to use trigonometry to do it by multiplying the [modifier] constant by the sin or cos of the rotation values (as Gniarf said). Note that you'll also need to modify your current code a fair bit to do this because you'll probably be changing more than 1 address at a time.


I'll check out the Lua method you speak of as it may be a little easier to get going (then I can convert the finished product back to asm for speed). I will also look into correcting that dealloc issue when I get a chance (thanks for pointing that out).

Thank you both for taking the time to reply as I haven't seen many topics on this type of cheat. Do either of you happen to know of any existing x86 code examples for free fly cameras in other games that I may use for reference?

_________________
Hitler are you bored? Watch some of my hacks here. Want 2 gb of online storage space for free? Get Dropbox for computer, phone, etc...
Back to top
View user's profile Send private message
akumakuja28
Master Cheater
Reputation: 16

Joined: 28 Jun 2015
Posts: 432

PostPosted: Mon Jan 18, 2016 8:06 pm    Post subject: Reply with quote

I fought with this something like this just recently.

What exactly are you working with.

Do you have the degrees of rotation only?

Do you have the the sin and cos values already located. They are definitely in the code some where after the degrees of rotation.

If you have the cos and sin values then its just vector calculus.

The implementation is kinda of vitch though.

Keep us updated.

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

Joined: 09 Dec 2010
Posts: 140

PostPosted: Tue Jan 19, 2016 3:17 am    Post subject: Reply with quote

akumakuja28 wrote:
I fought with this something like this just recently.

What exactly are you working with.

Do you have the degrees of rotation only?

Do you have the the sin and cos values already located. They are definitely in the code some where after the degrees of rotation.

If you have the cos and sin values then its just vector calculus.

The implementation is kinda of vitch though.

Keep us updated.


I'm working with Resident Evil 4 Ultimate HD Edition, and currently have the xyz of the camera along what I assumed to be a read only version of the H and V rotations (horizontal goes from -2 to 2 and vertical from -1 to 1 due to how the camera look limits works in this game from the character prespective). Usually when you find the camera structure, you have xyz, h/v rotations, zoom, etc... but this game is odd in the fact that it doesn't appear to be all in a nice little bundle for me. I haven't had a chance to look at it any further due to work, but I intend to return to this game when I get some time. Do you happen to own this game?

_________________
Hitler are you bored? Watch some of my hacks here. Want 2 gb of online storage space for free? Get Dropbox for computer, phone, etc...
Back to top
View user's profile Send private message
akumakuja28
Master Cheater
Reputation: 16

Joined: 28 Jun 2015
Posts: 432

PostPosted: Tue Jan 19, 2016 5:44 am    Post subject: Reply with quote

Vertical of -1 to 1 is what you need. either way this is secondary. The math for this is simple.


Horizontal of -2 to 2 is weird. It could be doubled for some reason but it most likely cos or sin.

HInts
there should be sin and cos values located in the stack if its x87 code or the cos and sin should be in xmm.

Basically to get a 3rd person camera its zoom * cosine + x coord then its zoom * sine - y coord.
- This might help in tracking where the sin and cosine values are located

To get the camera to move according to facing direction you will need both of these values.

Or you will have to decipher what -2 to 2 is then arcsin to get back to rotation in degrees then recalculate sine and cosine. LOL NO F%%% that

There really is no reason to calculate with fsin or fcos unless you really cant track down the games values.



Implementing The Code goes like so.


Lets say the camera is facing 23 degrees and you want to move forward.

cos(23) is .9205
sin (23) is .3907

camera X Y coords are X = 100 Y = 2000


So you if wr to multiply your rate of movement lets say 5 by cosine you get 4.025 + X camera location = 104.025

Rate (5) * sin(23) = 1.9535 + Y of camera location = 2001.95

as cycles accumulate. You get

1st cycle 104.025
2nd 108.05
3 112
4th 116
etc...





Thats basic movement in euclidean space. Vector Calculus

I dont own the game.

_________________
Back to top
View user's profile Send private message
akumakuja28
Master Cheater
Reputation: 16

Joined: 28 Jun 2015
Posts: 432

PostPosted: Wed Jan 20, 2016 4:39 am    Post subject: This post has 1 review(s) Reply with quote


Link





Coded it up earlier today. And decided to post a short clip of flying around.

I used the left input stick to control the camera rate of movement.

I also killed/prevented character movement.


Video is rather long
Dont mind the documentary playing in the background. oops

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

Joined: 09 Dec 2010
Posts: 140

PostPosted: Wed Jan 20, 2016 11:17 am    Post subject: Reply with quote

Damn that looks nice. I still haven't gotten a chance to look back into this yet due to a hectic work schedule, but that is very impressive. Do you happen to have a link to the script used for flying around? Again, very nice work.
_________________
Hitler are you bored? Watch some of my hacks here. Want 2 gb of online storage space for free? Get Dropbox for computer, phone, etc...
Back to top
View user's profile Send private message
akumakuja28
Master Cheater
Reputation: 16

Joined: 28 Jun 2015
Posts: 432

PostPosted: Wed Jan 20, 2016 4:13 pm    Post subject: Reply with quote

Code:
{ Game   : Darksiders2.exe
  Version:
  Date   : 2016-01-19
  Author : Akuma

  This script does blah blah blah
}

[ENABLE]

aobscanmodule(Input_Camera_Travel_ret,Darksiders2.exe,08 F3 0F 11 77 30) // should be unique
alloc(newmem,$1000,"Darksiders2.exe"+9A4A50)

alloc(Fly_Rate,4)
registersymbol(Fly_Rate)

label(code)
label(originalcode)
label(return)





newmem:


code:
   movss xmm13,[rdi-40]   // Cosine Value
   movss xmm14,[rdi-3c]   // Sine Value
   mulss xmm13,[Fly_Rate]
   mulss xmm14,[Fly_Rate]
                     
                  /// Trig Values loaded and Multiplied ----------- End

 
/// Adding Subbing Values____________________________

     /// xmm6 is X coord     /// xmm8 is Y coord




   addss xmm8,xmm13          // (cosine * fly rate) + Current Camera X coord
   subss xmm6,xmm14             // (sine * fly rate) - Current Camera Y coord




 /// clearing xmm // is used for other camera shit like roll


     xorps xmm13,xmm13
     xorps xmm14,xmm14

 // vertical movement___________________________________

  movss xmm15,[rdi-18]     // Z pitch
  mulss xmm15,[Fly_Rate]


    /// xmm11 is Z coord



  subss xmm11,xmm15
    xorps xmm15,xmm15        /// clearing xmm // is used for other camera shit
  movss [rdi+38],xmm11         // forcing Z height to write to camera Map location
     jmp originalcode






originalcode:
  movss [rdi+30],xmm6        //   writing xmm6 value to camera  Map location
  //movss [rdi+34],xmm8        // this is normally after my injection point just
                                 //included for reference,
    jmp return

Input_Camera_Travel_ret+01:
  jmp code
return:
registersymbol(Input_Camera_Travel_ret)

[DISABLE]

Input_Camera_Travel_ret+01:
  db F3 0F 11 77 30

unregistersymbol(Input_Camera_Travel_ret)
dealloc(newmem)

{
// ORIGINAL CODE - INJECTION POINT: "Darksiders2.exe"+9A4A50

"Darksiders2.exe"+9A4A1E: 49 3B C6                    -  cmp rax,r14
"Darksiders2.exe"+9A4A21: 0F 85 02 FB FF FF           -  jne Darksiders2.exe+9A4529
"Darksiders2.exe"+9A4A27: 41 0F 2F FD                 -  comiss xmm7,xmm13
"Darksiders2.exe"+9A4A2B: F3 0F 10 77 30              -  movss xmm6,[rdi+30]
"Darksiders2.exe"+9A4A30: F3 44 0F 10 47 34           -  movss xmm8,[rdi+34]
"Darksiders2.exe"+9A4A36: 41 0F 28 C5                 -  movaps xmm0,xmm13
"Darksiders2.exe"+9A4A3A: F3 44 0F 10 5F 38           -  movss xmm11,[rdi+38]
"Darksiders2.exe"+9A4A40: F3 0F 58 36                 -  addss xmm6,[rsi]
"Darksiders2.exe"+9A4A44: F3 44 0F 58 46 04           -  addss xmm8,[rsi+04]
"Darksiders2.exe"+9A4A4A: F3 44 0F 58 5E 08           -  addss xmm11,[rsi+08]
// ---------- INJECTING HERE ----------
"Darksiders2.exe"+9A4A50: F3 0F 11 77 30              -  movss [rdi+30],xmm6
// ---------- DONE INJECTING  ----------
"Darksiders2.exe"+9A4A55: F3 44 0F 11 47 34           -  movss [rdi+34],xmm8
"Darksiders2.exe"+9A4A5B: E9 A0 B5 61 FF              -  jmp 13FFC0000
"Darksiders2.exe"+9A4A60: 90                          -  nop
"Darksiders2.exe"+9A4A61: 76 04                       -  jna Darksiders2.exe+9A4A67
"Darksiders2.exe"+9A4A63: 41 0F 57 C1                 -  xorps xmm0,xmm9
"Darksiders2.exe"+9A4A67: 44 0F 2F D0                 -  comiss xmm10,xmm0
"Darksiders2.exe"+9A4A6B: 72 2C                       -  jb Darksiders2.exe+9A4A99
"Darksiders2.exe"+9A4A6D: 41 0F 2F FF                 -  comiss xmm7,xmm15
"Darksiders2.exe"+9A4A71: 41 0F 28 C7                 -  movaps xmm0,xmm15
"Darksiders2.exe"+9A4A75: 76 04                       -  jna Darksiders2.exe+9A4A7B
}



Thats the Basic Idea. Cant wait to see your take on free flying camera in RE 4.

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

Joined: 09 Dec 2010
Posts: 140

PostPosted: Wed Jan 20, 2016 7:07 pm    Post subject: Reply with quote

Now onto the adventure of gathering the remaining elements to make this hack possible. I've sent you a pm pertaining to a new location I've found that may hold the additional values I'm looking for. Thanks for posting the script (didn't think it would be that short heh).
_________________
Hitler are you bored? Watch some of my hacks here. Want 2 gb of online storage space for free? Get Dropbox for computer, phone, etc...
Back to top
View user's profile Send private message
abystus
Expert Cheater
Reputation: 1

Joined: 09 Dec 2010
Posts: 140

PostPosted: Thu Jan 28, 2016 3:15 am    Post subject: Reply with quote

I wanted to thank everyone for their contributions in this thread. All the info provided here led to the creation of this:

Dragon's Dogma: Dark Arisen - Free Fly Camera Hack

Link


Thanks again.

_________________
Hitler are you bored? Watch some of my hacks here. Want 2 gb of online storage space for free? Get Dropbox for computer, phone, etc...
Back to top
View user's profile Send private message
LuC-iTA
Newbie cheater
Reputation: 0

Joined: 14 Jul 2014
Posts: 14

PostPosted: Tue Feb 16, 2016 8:02 am    Post subject: Reply with quote

Abystus amazing work, as always! Thanks!
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