Skip to content

Commit

Permalink
Merge pull request #29 from EtoShinya/main
Browse files Browse the repository at this point in the history
feat: Added FovChanger
  • Loading branch information
Taiga74164 authored Apr 2, 2024
2 parents 32c00e2 + be6cce8 commit b1b6fea
Show file tree
Hide file tree
Showing 8 changed files with 48 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ The DLL will automatically be loaded by the game itself if the dll is in the gam
- Mission Time
- Time Scale
- FPS Unlocker
- Fov Changer
- Skip Intro Movie

## Screenshot
Expand Down
2 changes: 2 additions & 0 deletions src/SoloLevelling.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ if %errorlevel% == 0 (
<ClInclude Include="game\cheat\cheat.h" />
<ClInclude Include="game\cheat\features\DamageHack.h" />
<ClInclude Include="game\cheat\features\DumbEnemies.h" />
<ClInclude Include="game\cheat\features\FovChanger.h" />
<ClInclude Include="game\cheat\features\FPSUnlock.h" />
<ClInclude Include="game\cheat\features\MissionTime.h" />
<ClInclude Include="game\cheat\features\NoCooldown.h" />
Expand Down Expand Up @@ -166,6 +167,7 @@ if %errorlevel% == 0 (
<ClCompile Include="game\cheat\cheat.cpp" />
<ClCompile Include="game\cheat\features\DamageHack.cpp" />
<ClCompile Include="game\cheat\features\DumbEnemies.cpp" />
<ClCompile Include="game\cheat\features\FovChanger.cpp" />
<ClCompile Include="game\cheat\features\FPSUnlock.cpp" />
<ClCompile Include="game\cheat\features\MissionTime.cpp" />
<ClCompile Include="game\cheat\features\NoCooldown.cpp" />
Expand Down
3 changes: 3 additions & 0 deletions src/game/Render/Gui/gui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@ void Gui::Render()
ImGui::CheckboxFill("FPS Unlock", &vars.b_FPSUnlock);
if (vars.b_FPSUnlock)
ImGui::SliderInt("FPS", &vars.i_FPS, 5, 360, "%d");
ImGui::CheckboxFill("Fov Changer", &vars.b_FovChanger);
if (vars.b_FovChanger)
ImGui::SliderFloat("Fov", &vars.f_Fov, 1.0f, 360.0f, "%.1f");

ImGui::CheckboxFill("Skip Intro Movie", &vars.b_SkipIntroMovie); HELPMAKER("This will skip the intro movie when you start the game");

Expand Down
3 changes: 3 additions & 0 deletions src/game/appdata/il2cpp-functions.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ DO_APP_FUNC(0x00454960, void, GameFrameWork_Update, (GameFrameWork* __this, Meth
DO_APP_FUNC(0x0202DAF0, String*, Marshal_PtrToStringAnsi, (void* ptr, MethodInfo* method));
DO_APP_FUNC(0x0202DB10, String*, Marshal_PtrToStringUni, (void* ptr, MethodInfo* method));

// FovChanger
DO_APP_FUNC(0x0301C600, void, Camera_set_fieldOfView, (void* __this, float value, MethodInfo* method));

// FPSUnlock
DO_APP_FUNC(0x03015300, int, Application_get_targetFrameRate, (MethodInfo* method));
DO_APP_FUNC(0x03015A20, void, Application_set_targetFrameRate, (int value, MethodInfo* method));
Expand Down
2 changes: 2 additions & 0 deletions src/game/cheat/cheat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include "features/NoCooldown.h"
#include "features/DamageHack.h"
#include "features/DumbEnemies.h"
#include "features/FovChanger.h"
#include "features/FPSUnlock.h"
#include "features/MissionTime.h"
#include "features/TimeScale.h"
Expand All @@ -27,6 +28,7 @@ void init_cheat()
INIT_FEATURE(TimeScale);
INIT_FEATURE(SkipIntroMovie);
INIT_FEATURE(FPSUnlock);
INIT_FEATURE(FovChanger);
#undef INIT_FEATURE

HookManager::install(app::GameFrameWork_Update, GameFrameWork_Update_Hook);
Expand Down
20 changes: 20 additions & 0 deletions src/game/cheat/features/FovChanger.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#include "FovChanger.h"
#include "HookManager.h"
#include "Utils.h"
#include "game-utils.hpp"
#include "events.h"

namespace Cheat::Features
{
FovChanger::FovChanger()
{
HookManager::install(app::Camera_set_fieldOfView, Camera_set_fieldOfView_Hook);
}

void FovChanger::Camera_set_fieldOfView_Hook(void* __this, float value, MethodInfo* method)
{
if (vars.b_FovChanger)
value = vars.f_Fov;
CALL_ORIGIN(Camera_set_fieldOfView_Hook, __this, value, method);
}
}
15 changes: 15 additions & 0 deletions src/game/cheat/features/FovChanger.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#pragma once
#include "Singleton.h"
#include "global.h"

namespace Cheat::Features
{
class FovChanger : public Singleton<FovChanger>
{
public:
FovChanger();

private:
static void Camera_set_fieldOfView_Hook(void* __this, float value, MethodInfo* method);
};
}
2 changes: 2 additions & 0 deletions src/game/cheat/vars.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ struct Vars
float f_TimeScaleSpeed = 2.0f;
bool b_FPSUnlock = true;
int i_FPS = 120;
bool b_FovChanger = false;
float f_Fov = 60.0f;

bool b_SkipIntroMovie = true;
};
Expand Down

0 comments on commit b1b6fea

Please sign in to comment.