Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions mods/src/config.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1109,6 +1109,8 @@ void Config::Load()

this->system_pan_momentum_falloff = get_config_or_default(config, parsed, "graphics", "system_pan_momentum_falloff",
DCG::system_pan_momentum_falloff, write_log);
this->disable_target_camera_lock = get_config_or_default(config, parsed, "graphics", "disable_target_camera_lock",
DCG::disable_target_camera_lock, write_log);
this->borderless_fullscreen =
get_config_or_default(config, parsed, "graphics", "borderless_fullscreen", DCG::borderless_fullscreen, write_log);
this->transition_time =
Expand Down
1 change: 1 addition & 0 deletions mods/src/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ class Config final
bool use_out_of_dock_power;
float system_pan_momentum;
float system_pan_momentum_falloff;
bool disable_target_camera_lock;

float keyboard_zoom_speed;
int select_timer;
Expand Down
1 change: 1 addition & 0 deletions mods/src/defaultconfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ namespace Graphics
constexpr bool free_resize = true;
constexpr auto keyboard_zoom_speed = 350;
constexpr auto system_pan_momentum_falloff = 0.8;
constexpr bool disable_target_camera_lock = false;
constexpr auto system_pan_momentum = 0.4;
constexpr auto system_zoom_preset_1 = 50;
constexpr auto system_zoom_preset_2 = 500;
Expand Down
8 changes: 6 additions & 2 deletions mods/src/patches/parts/fix_pan.cc
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,15 @@ bool KeyboardPanAllowed()
bool NavigationPan_LateUpdate_Hook(auto original, NavigationPan* _this)
{
auto d = _this->_lastDelta;
const auto& config = Config::Get();
const bool disable_target_camera_lock = config.disable_target_camera_lock;

if (disable_target_camera_lock && _this->_trackingPOI) {
_this->_trackingPOI = nullptr;
}
static auto GetMouseButton = il2cpp_resolve_icall_typed<bool(int)>("UnityEngine.Input::GetMouseButton(System.Int32)");
static auto GetTouchCount = il2cpp_resolve_icall_typed<int()>("UnityEngine.Input::get_touchCount()");

const auto& config = Config::Get();
if (!config.disable_move_keys && config.hotkeys_enabled && !Key::IsDirectionalInputClaimed()) {
if (config.use_scopely_hotkeys || !config.installHotkeyHooks) {
original(_this);
Expand All @@ -64,7 +68,7 @@ bool NavigationPan_LateUpdate_Hook(auto original, NavigationPan* _this)
}
}

if (_this->BlockPan() || _this->_trackingPOI) {
if (_this->BlockPan() || (_this->_trackingPOI && !disable_target_camera_lock)) {
d->x = 0.0f;
d->y = 0.0f;
} else if (GetMouseButton(0) || GetTouchCount() > 0) {
Expand Down
8 changes: 7 additions & 1 deletion mods/src/prime/NavigationPan.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ struct NavigationPan {
__declspec(property(get = __get__lastDelta)) Vector2* _lastDelta;
__declspec(property(get = __get__deltaScaler)) float _deltaScaler;
__declspec(property(get = __get__keyboardDeltaScaler)) float _keyboardDeltaScaler;
__declspec(property(get = __get__trackingPOI)) uintptr_t* _trackingPOI;
__declspec(property(get = __get__trackingPOI, put = __set__trackingPOI)) uintptr_t* _trackingPOI;

__declspec(property(get = __get__farMagRadiusRatioSystemNormal,
put = __set__farMagRadiusRatioSystemNormal)) float _farMagRadiusRatioSystemNormal;
Expand Down Expand Up @@ -48,6 +48,12 @@ struct NavigationPan {
return *(uintptr_t**)((ptrdiff_t)this + field.offset());
}

void __set__trackingPOI(uintptr_t* value)
{
static auto field = get_class_helper().GetField("_trackingPOI");
*(uintptr_t**)((ptrdiff_t)this + field.offset()) = value;
}

Vector2* __get__lastDelta()
{
static auto field = get_class_helper().GetField("_lastDelta");
Expand Down