Hajimari no Kiseki / Trails into Reverie camera script

Memory scanning, code injection, debugger internals and other gamemodding related discussion
amorrow28
Expert Cheater
Expert Cheater
Posts: 81
Joined: Mon Jul 04, 2022 9:42 pm
Reputation: 46

Hajimari no Kiseki / Trails into Reverie camera script

Post by amorrow28 »

I've ported Cyber's camera script from The Legend of Heroes: Trails of Cold Steel IV to [Link].

NOTE This is for Hajimari no Kiseki (CLE). For Trails into Reverie (NIS America) - please see this post.

It's now capable of pretty much everything Cyber's script can do! (some strange artifacts show up when you disable HUD in battle, but going into free cam mode removes all the artifacts.)

UPDATES:
v1.2 - Free camera can now be immediately activated upon loading the script (no need to turn on "camera status" to get coordinates) and more gracefully handles quitting the game while enabled, FOV now adjustable via hot keys (Home/End, enable with F4).
v1.1 - Adds FOV, Min Z
v1.0 - Initial release

Download here:

Hajimari no Kiseki Camera 1.2.CT
(46.87 KiB) Downloaded 1472 times
PRIOR RELEASES
Hajimari no Kiseki Camera 1.1.CT
(41.24 KiB) Downloaded 528 times
Hajimari no Kiseki Camera.CT
(38.08 KiB) Downloaded 648 times
Features:
  • Force Pause Animation: Must be activated first. In-game press F5 to pause the animation and F6 to resume the animation.
  • Set Field Min Z to zero: Normally the camera is restricted from going below waist-height. This lowers the limit to the floor.
  • Set Custom Field of View: F4 to enable. Press Home to zoom in, End to zoom out.
  • Hide HUD: Hide the user interface. Hotkey: F7. Turning off the HUD results in some strange visual artifacts in battle (due to graphical underlayers) when the menu is supposed to be showing. If you go into free cam mode, the artifacts disappear immediately. Also, if it's not your turn (e.g. animations, S-crafts, etc), the artifacts aren't there.
  • Disable Dialogue: No text or speech bubble will appear in cutscenes or when talking. Activates at the start of dialogue - if turned on in the middle of dialogue, you can turn off dialogue by changing the attached value from 1 to 0 (advance dialogue one time to get the 1 to appear).
  • Increase Tilt Limit (Field): Increase tilt limit to min -89 degrees and max 89 degrees.
  • Disable Tilt Limit (Battle): Disable camera tilt movement restriction during battle.

Code: Select all

Free Camera Controls:

Hotkey : Num 0 (Toggle On/Off)

Num 8 : Forward
Num 5 : Backward
Num 4 : Left
Num 6 : Right
Num - : Up
Num + : Down

Arrow Up : Tilt Up
Arrow Down : Tilt Down
Arrow Right : Pan Right
Arrow Left : Pan Left

Num 9 : Roll Right
Num 7 : Roll Left
Num 3 : Set Roll to 0

F1 : Decrease Camera Speed (Press and Hold)
F2 : Double Camera Speed (Press and Hold)
F3 : Quadruple Camera Speed (Press and Hold)
The free camera Lua code that manipulates the camera is from Cyber's CS4 table, and as always I am very thankful.

Enjoy!

My other free camera scripts: Trails of Cold Steel 1, Trails of Cold Steel 2, Trails of Cold Steel 3, Kuro no Kiseki CLE, Kuro no Kiseki 2 CLE, Tokyo Xanadu eX+, Ys VIII: Lacrimosa of Dana, Atelier Ryza, Atelier Ryza 2.
Last edited by amorrow28 on Fri Jul 14, 2023 4:54 pm, edited 14 times in total.

amorrow28
Expert Cheater
Expert Cheater
Posts: 81
Joined: Mon Jul 04, 2022 9:42 pm
Reputation: 46

Re: Request for help finding camera coordinates (Hajimari no Kiseki, CLE release on Steam)

Post by amorrow28 »

Reserved

misterwashimashi
Cheater
Cheater
Posts: 37
Joined: Sat Jul 23, 2022 12:52 pm
Reputation: 7

Re: Hajimari no Kiseki camera script (CLE release on Steam)

Post by misterwashimashi »

thank you for your hard work man! any chance of a camera script for kuro ni kiseki once it comes out on 27?

amorrow28
Expert Cheater
Expert Cheater
Posts: 81
Joined: Mon Jul 04, 2022 9:42 pm
Reputation: 46

Re: Hajimari no Kiseki camera script (CLE release on Steam)

Post by amorrow28 »

misterwashimashi wrote:
Sat Jul 23, 2022 12:55 pm
thank you for your hard work man! any chance of a camera script for kuro ni kiseki once it comes out on 27?
I’d like to at some point!

misterwashimashi
Cheater
Cheater
Posts: 37
Joined: Sat Jul 23, 2022 12:52 pm
Reputation: 7

Re: Hajimari no Kiseki camera script (CLE release on Steam)

Post by misterwashimashi »

amorrow28 wrote:
Sat Jul 23, 2022 3:40 pm
misterwashimashi wrote:
Sat Jul 23, 2022 12:55 pm
thank you for your hard work man! any chance of a camera script for kuro ni kiseki once it comes out on 27?
I’d like to at some point!
that's pretty cool! will definitely look forward to that!

amorrow28
Expert Cheater
Expert Cheater
Posts: 81
Joined: Mon Jul 04, 2022 9:42 pm
Reputation: 46

Re: Hajimari no Kiseki camera script (CLE release on Steam)

Post by amorrow28 »

Update posted, added FOV adjustment and set minimum Z to floor.

misterwashimashi
Cheater
Cheater
Posts: 37
Joined: Sat Jul 23, 2022 12:52 pm
Reputation: 7

Re: Hajimari no Kiseki camera script (CLE release on Steam)

Post by misterwashimashi »

Hey man it's me again haha. Got some free time this weekend so I decided to experiment on ur cam script for Hajimari.

I noticed that the DoF during the cutscenes disappear whenever I try to move the camera on the character's left or right side. They will be blurred again if I move the cam to their front or back. Perhaps it's possible that the DoF is tied to the camera?

On another note, I managed to track down the shader for the DoF using SpecialK and 3dmigoto. But when I try to disable it the DoF turns into color black for some reason.

I'd love to hear your insights!

amorrow28
Expert Cheater
Expert Cheater
Posts: 81
Joined: Mon Jul 04, 2022 9:42 pm
Reputation: 46

Re: Hajimari no Kiseki camera script (CLE release on Steam)

Post by amorrow28 »

misterwashimashi wrote:
Sat Aug 20, 2022 5:33 pm
Hey man it's me again haha. Got some free time this weekend so I decided to experiment on ur cam script for Hajimari.

I noticed that the DoF during the cutscenes disappear whenever I try to move the camera on the character's left or right side. They will be blurred again if I move the cam to their front or back. Perhaps it's possible that the DoF is tied to the camera?

On another note, I managed to track down the shader for the DoF using SpecialK and 3dmigoto. But when I try to disable it the DoF turns into color black for some reason.

I'd love to hear your insights!
I think you're right in that DOF is probably tied to the camera, but it may also be tied to objects. Is this an effect that also happens in CS4? (I'm not currently playing Hajimari and I haven't started it, so I don't exactly want to spend time watching cutscenes.)

If you want to try to manipulate the camera, take a look through the structure in the memory viewer, you might get lucky!
Getting_to_camera_values.zip
password: hajimari
(130.13 KiB) Downloaded 350 times
I put some screenshots to show how to get to the camera structure in memory. Load up Hajimari, load my camera script, turn on Camera Status, then go into the game so that the pointer to the structure gets written to memory. Then go into memory viewer, go to [camerastatus], and change view type to float. You'll see all the values (it's several screens long). Double-click a value to change it. Be warned, many of the values are constantly overwritten, so you may need to add them to the address list and attempt to freeze them. Some values I know about:

+0x20: Camera X
+0x24: Camera Z
+0x28: Camera Y
+0x70C: Tilt
+0x710: Pan
+0x714: Roll
+0x7AC: Zoom-1
+0x7B0: Zoom-2

I saw values like -45 and +50 right next to each other in there, those are probably tilt limits, for example (but they are not the true values - at least those are not the ones I had to change to actually change the limits. They are probably copied from the camera module elsewhere.). What you can do is go into different scenarios and see what numbers change. Another option is to randomly change values and see what happens - that's literally how I found the zoom values. If you change and number and it changes right back, try adding a number to the address list, then freeze and change the value. Even though the engine will keep changing it back, cheat engine will keep trying to change it. In game, the effect will be flickering (like if you did that with camera Z, the camera will flicker like crazy as it keeps jumping between two locations). So see if you can get the DOF to flicker on and off. I would start by looking for values that are 1.00 and change them to 0.00 in a scene with DOF.

Disabling the shader in 3DMigito is another way to go about it, and pretty clever! You're right, you can't just disable it, because it's drawing the picture. What you'll need to do is rewrite the shader to draw the picture without the blur effect. That's easier said than done, and I certainly don't have the skills to change shaders in HLSL. I did a quick web search, and I found this: [Link]

I don't really understand HLSL, but what I *think* is going on is that there is code where it will draw pixels using information from the pixels around it. In the example provided in that link, there's a section of code that looks like this:

Code: Select all

for (int i = 1; i < 5; i++) {
    FragmentColor +=
        SceneTexture.Sample(PointSample, ppIn.UV + float2(hstep*offset[i], vstep*offset[i]))*weight[i] +
        SceneTexture.Sample(PointSample, ppIn.UV - float2(hstep*offset[i], vstep*offset[i]))*weight[i];      
    }
ppColour += FragmentColor;
So it's sampling color from a pixel nearby (the offset), and then adding it to the pixel it's drawing. If you can find equivalent code from the shader and delete it, that could achieve the effect you want? Maybe? I dunno.

misterwashimashi
Cheater
Cheater
Posts: 37
Joined: Sat Jul 23, 2022 12:52 pm
Reputation: 7

Re: Hajimari no Kiseki camera script (CLE release on Steam)

Post by misterwashimashi »

I'm not sure, it's been quite a while since I last played CS4 and I haven't tried Cyber's camera script for it. I just tried experimenting the camera on the prologue cutscenes just to be safe since I've already seen it.

Anyway, I will spend the rest of the day tinkering with the camera using the files you sent haha as you said I might get lucky.
About HLSL, programming is one of my weakest areas so I'm not sure I will instantly understand this. But I appreciate the help my man!

amorrow28
Expert Cheater
Expert Cheater
Posts: 81
Joined: Mon Jul 04, 2022 9:42 pm
Reputation: 46

Re: Hajimari no Kiseki camera script (CLE release on Steam)

Post by amorrow28 »

Uploaded a new release, to catch up with my Tokyo Xanadu eX+ and Trails of Cold Steel III camera updates. Download is in the top post!

(misterwashimashi, any luck with the DOF effect?)

misterwashimashi
Cheater
Cheater
Posts: 37
Joined: Sat Jul 23, 2022 12:52 pm
Reputation: 7

Re: Hajimari no Kiseki camera script (CLE release on Steam)

Post by misterwashimashi »

amorrow28 wrote:
Tue Aug 30, 2022 5:42 am
Uploaded a new release, to catch up with my Tokyo Xanadu eX+ and Trails of Cold Steel III camera updates. Download is in the top post!

(misterwashimashi, any luck with the DOF effect?)
Hey man I'm back, I apologize for the late reply I got a bit busy with school haha.
Anyway yeah no luck, I tried freezing every address that is near the free camera values but I still can't track down the cutscene DOF values. There are too many numbers and addresses, so I got overwhelmed lmaoooo.

amorrow28
Expert Cheater
Expert Cheater
Posts: 81
Joined: Mon Jul 04, 2022 9:42 pm
Reputation: 46

Re: Hajimari no Kiseki camera script (CLE release on Steam)

Post by amorrow28 »

misterwashimashi wrote:
Thu Sep 08, 2022 11:42 am
Hey man I'm back, I apologize for the late reply I got a bit busy with school haha.
Anyway yeah no luck, I tried freezing every address that is near the free camera values but I still can't track down the cutscene DOF values. There are too many numbers and addresses, so I got overwhelmed lmaoooo.
Ok, I think I might be able to find a clue to help you move forward.

I did a code dissection (Memory Viewer -> Tools -> Dissect Code) on the executable, then searched through referenced strings (Memory Viewer -> View -> Referenced Strings). I searched for "blur" and most are function references that don't seem to help, but "_Particle_Blur" had two locations, and I opened the first one 1403D30EE and did a break and trace and it is running during screen draw. Tracing backwards 3 levels, I found:

ed8_ps5_D3D11.exe+1720F2 - FF 50 20 - call qword ptr [rax+20]

If you NOP this instruction, the screen stops refreshing. That instruction jumps to ed8_ps5_D3D11.exe+3CDD00, which is a *huge* function (+3CDD00 to +3D6F91). I think that your function is in here somewhere.

I started NOPing function calls to see what happens. There are dozens of function calls to explore. One example I found was this function call:

ed8_ps5_D3D11.exe+3D6921 - E8 5A2C4000 - call ed8_ps5_D3D11.exe+7D9580

If you NOP this, then the effect of darkening the screen and rendering dialogue goes away. You can try it yourself in the introduction. (Some other weird stuff happens too.)

I hunted for a while but got tired of crashing my computer. So... happy hunting! :D

The other way is to find the structure Phyre::PPostProcessing::PDepthOfField, but I have no idea how to hunt for structures by name. I've seen other people do it though.

misterwashimashi
Cheater
Cheater
Posts: 37
Joined: Sat Jul 23, 2022 12:52 pm
Reputation: 7

Re: Hajimari no Kiseki camera script (CLE release on Steam)

Post by misterwashimashi »

Nice! That definitely narrows it down, thanks man! Trying it atm, just experienced my first crash lmao. At least I'm getting the hang of using CE xD
Anyway, do you have a Discord? So I can consult you there if I ever find something of interest or encounter a problem, if you don't mind of course :D

amorrow28
Expert Cheater
Expert Cheater
Posts: 81
Joined: Mon Jul 04, 2022 9:42 pm
Reputation: 46

Re: Hajimari no Kiseki camera script (CLE release on Steam)

Post by amorrow28 »

No, I don’t have a discord. I’m not that fancy. Also, I have a day job and family, so I can only do this in my spare time, which comes in spurts depending on how little sleep I can get away with, haha.

misterwashimashi
Cheater
Cheater
Posts: 37
Joined: Sat Jul 23, 2022 12:52 pm
Reputation: 7

Re: Hajimari no Kiseki camera script (CLE release on Steam)

Post by misterwashimashi »

hey man i'm back! and still can't find the blur function. i tried noping most of the function calls and there are those that has the same operation (eg. noping few different function calls yielding the same exact result). got a bit tired of the constant crashes too loool.

2 months ago i asked on discord and someone told me Durante's release next year might have the option to disable the depth of field completely. imma just wait for that then. thank you for teaching me my good man!

Post Reply

Who is online

Users browsing this forum: No registered users