etra0 / botw-freecam

Freecam for the game Zelda: Breath of the Wild for the Wii U using the Cemu emulator
MIT License
67 stars 12 forks source link

Feature Request: Make areas use camera position instead of link's position #30

Open S41L0R opened 3 years ago

S41L0R commented 3 years ago

Hey!

So I had an idea: In Botw Areas control LODs for some actors, and can trigger events. I imagine that Breath of the Wild must have a pointer somewhere to link's position so that areas can access it. Could you make a togglable option to swap this out with a pointer to the camera position? That way, all LODs would work correctly and a lot of other game features would work as well.

etra0 commented 3 years ago

Hi,

I'm not sure I understand what you're trying to say. Are you suggesting to clip link to the camera's coordinate?

S41L0R commented 3 years ago

No, not quite.

I'm sure you're familiar with area actors. But in order to work, they obviously need to have a pointer somewhere in memory to link's position. I'm suggesting you see if you can find that theoretical pointer and point it to the camera's position.

S41L0R commented 3 years ago

Are you suggesting to clip link to the camera's coordinate?

This would work for activating areas, but it wouldn't preserve link's location, which could be a disadvantage when all you want to do is make the camera activate areas.

etra0 commented 3 years ago

I'm sure you're familiar with area actors.

Not that much, honestly.

they obviously need to have a pointer somewhere in memory to link's position.

There are several places where link's position is stored. I could bruteforce the way through but that would involve too much try and error for me (I saw at least 9 places of link's coordinate, which means write a ton of different injections because instructions are quite likely all different).

If you have a proof of concept I'd gladly look at it. I'd love to invest more time on reverse engineering this game more properly but time is a restriction (as this project, like many others, it's only supported by love lol).

S41L0R commented 3 years ago

Ok, if I find anything I'll let you know. I might work on a proof-of-concept if I find time.

etra0 commented 3 years ago

Ok, if I find anything I'll let you know. I might work on a proof-of-concept if I find time.

Cool! as a head start (maybe you already know this but anyway~) at the offset 0x113444F0 in WiiU's memory (that's it, Cemu's base memory + 0x113444F0 if you want to check it out in the actual emulator) seems to be a set of link's coordinate that you can use to teleport him.

Happy to wait for your poc!

S41L0R commented 3 years ago

How would you recommend editing memory?

etra0 commented 3 years ago

I can highly recommend you using Cheat Engine for any kind of memory editing. It's really a powerful tool to write PoC injections and mess with game's memory.

Here's a quick CT that may help you to get started with. You can get CEMU's base address (that will be stored at [base_addr]) and you can offset that pointer like if it were Wii U's memory.

zelda_link_position.zip

S41L0R commented 3 years ago

Thanks!