@@ -15,15 +15,11 @@ typedef HRESULT(__stdcall* pso2hDoLua)(const char* a1);
1515static pso2hDoLua _executeLua = 0 ;
1616
1717bool runLua (std::string a1);
18- void resetParam ();
18+
1919bool initLuaHook ();
2020
2121bool runLuaAsync (std::string a1);
2222
23- bool writeStructValue (int & addy, byte value);
24- bool writeStructValue (byte&, byte);
25- bool writeStructValue (int & addy, DWORD value);
26-
2723void menu_init (void *, LPDIRECT3DDEVICE9);
2824
2925static int currTab = 0 ;
@@ -35,12 +31,18 @@ static bool freeCamToggle = false;
3531
3632static DWORD oNearCullBytes = 0x0 ;
3733
34+
35+ static bool pushCamera ()
36+ {
37+ return runLuaAsync (" Camera.PushActorTest()" );
38+ }
39+
3840static bool adjustZoom () {
3941 std::stringstream ss;
4042 ss << " Camera.ActorTrackTestNormal.Offset.Dist = \" " << Camera::cameraBase.Offset .Dist << " \" " ;
4143 std::string dist (ss.str ());
4244 runLuaAsync (dist.c_str ());
43- runLuaAsync ( " ResetParam() " );
45+ pushCamera ( );
4446
4547 return true ;
4648}
@@ -59,7 +61,7 @@ static bool adjustFovy() {
5961 ss << " Camera.ActorTrackTestNormal.Fovy = " << Camera::cameraBase.Fovy ;
6062 std::string dist (ss.str ());
6163 runLuaAsync (dist.c_str ());
62- runLuaAsync ( " ResetParam() " );
64+ pushCamera ( );
6365
6466 return true ;
6567}
@@ -114,11 +116,11 @@ static void draw_menu(bool* status)
114116 // Honestly not quite sure what these two are, figured for culling but idk
115117 if (ImGui::Button (" Set DistMin" , ImVec2 (ImGui::GetContentRegionAvail ().x , 0 ))) {
116118 runLuaAsync (adjustDistmin ((float )Camera::cameraBase.Offset .DistMin ));
117- resetParam ();
119+ pushCamera ();
118120 }
119121 if (ImGui::Button (" Set DistMax" , ImVec2 (ImGui::GetContentRegionAvail ().x , 0 ))) {
120122 runLuaAsync (adjustDistmax ((float )Camera::cameraBase.Offset .DistMax ));
121- resetParam ();
123+ pushCamera ();
122124 }
123125 ImGui::EndColumns ();
124126
@@ -179,9 +181,9 @@ static void draw_menu(bool* status)
179181 *(DWORD*)(tNearCull) = (DWORD)(oNearCullBytes);
180182 }
181183 }
182- if (ImGui::Button (" ResetParam" , ImVec2 (ImGui::GetContentRegionAvail ().x , 0 ))) {
184+ /* if (ImGui::Button("ResetParam", ImVec2(ImGui::GetContentRegionAvail().x, 0))) {
183185 resetParam();
184- }
186+ }*/
185187 ImGui::EndColumns ();
186188 ImGui::Separator ();
187189
@@ -195,21 +197,24 @@ static void draw_menu(bool* status)
195197 if (ImGui::Checkbox (" ##freecamcheck" , &freeCamToggle))
196198 {
197199 DWORD funcStart = 0x04FD39D0 ;
198- if (freeCamToggle)
199- {
200- *(BYTE*)(funcStart) = 0x31 ; // xor eax,eax ret 0008
201- *(BYTE*)(funcStart + 1 ) = 0xC0 ;
202- *(BYTE*)(funcStart + 2 ) = 0xC2 ;
203- *(BYTE*)(funcStart + 3 ) = 0x08 ;
204- *(BYTE*)(funcStart + 4 ) = 0x00 ;
205- }
206- else
200+ if (*(BYTE*)(funcStart) != 0x55 )
207201 {
208- *(BYTE*)(funcStart) = 0x55 ; // restore entrance
209- *(BYTE*)(funcStart+1 ) = 0x8B ;
210- *(BYTE*)(funcStart+2 ) = 0xEC ;
211- *(BYTE*)(funcStart+3 ) = 0x83 ;
212- *(BYTE*)(funcStart+4 ) = 0xE4 ;
202+ if (freeCamToggle)
203+ {
204+ *(BYTE*)(funcStart) = 0x31 ; // xor eax,eax ret 0008
205+ *(BYTE*)(funcStart + 1 ) = 0xC0 ;
206+ *(BYTE*)(funcStart + 2 ) = 0xC2 ;
207+ *(BYTE*)(funcStart + 3 ) = 0x08 ;
208+ *(BYTE*)(funcStart + 4 ) = 0x00 ;
209+ }
210+ else
211+ {
212+ *(BYTE*)(funcStart) = 0x55 ; // restore entrance
213+ *(BYTE*)(funcStart + 1 ) = 0x8B ;
214+ *(BYTE*)(funcStart + 2 ) = 0xEC ;
215+ *(BYTE*)(funcStart + 3 ) = 0x83 ;
216+ *(BYTE*)(funcStart + 4 ) = 0xE4 ;
217+ }
213218 }
214219 }
215220 }
0 commit comments