Repository navigation
Expand Haven zoom while preserving road surface detail - #319
Conversation
| FieldInfo *HavenField(Il2CppClass *cls, const char *name, const char *type) | ||
| { | ||
| auto *field = cls != nullptr ? il2cpp_class_get_field_from_name(cls, name) : nullptr; | ||
| return field != nullptr && !(il2cpp_field_get_flags(field) & FIELD_ATTRIBUTE_STATIC) | ||
| && method_contract::Type(field->type, type) | ||
| ? field | ||
| : nullptr; | ||
| } |
There was a problem hiding this comment.
Why is this haven specific? We seem to be creating lots of little helpers all over the place doing unique things which leads to confusion as to which method to use. and some feel like duplicates.
| template <typename T> T ReadHavenField(Il2CppObject *object, FieldInfo *field) | ||
| { | ||
| T value{}; | ||
| il2cpp_field_get_value(object, field, &value); | ||
| return value; | ||
| } |
There was a problem hiding this comment.
Another duplicated mehtod I'm sure.
| for (auto *field : | ||
| {blend_source, blend_target, blend_curve, blend_minimum, blend_maximum, | ||
| blend_ratio, provider_pivot, provider_look_target, blend_source_frame, blend_target_frame, | ||
| blend_result_frame, provider_constraint, provider_radius, constraint_radius, radius_enabled, | ||
| radius_minimum, radius_maximum, frame_position, frame_rotation, frame_fov, | ||
| frame_far_clip, frame_orthographic}) { | ||
| if (field == nullptr) { | ||
| spdlog::warn("[HavenZoom] camera fields unavailable; keeping native zoom range"); | ||
| return; | ||
| } | ||
| } |
There was a problem hiding this comment.
Whilst this reduces duplicated code, it doesn't tell us what actually failed.
|
This is partly my coding style: when a broadly used helper doesn't quite provide the behavior I need, I've tended to keep that logic local rather than change its existing behavior. Here, the intent is to detect incompatible game-field changes and disable the affected feature gracefully, reducing the risk of taking down the game. But I understand the concern about accumulating similar helpers. I'm looking at whether we can extend the existing helper while preserving its current callers. I've been working to apply this feedback, though clearly I still need to be more consistent. I also agree that the failure diagnostics should identify the specific field or contract that failed. |
Haven's native zoom-out range makes it difficult to see larger layouts. Extend the camera's fresh output along its existing direction while preserving native input, panning and close-range selection. A small depth bias on the known Haven asphalt materials keeps road surface detail visible across the expanded range.
[graphics].haven_zoomsets the maximum camera distance: default4000.0, or0.0for native behavior.[patches].havenzoomhooksindependently controls hook installation and defaults totrue; it is separate from the ordinaryzoomhooksswitch.Validation: Windows
modsand release DLL builds, English example TOML parsing, andgit diff --checkpassed. The camera and road implementation passed Windows player testing at6000with full-out panning, roads, close-range selection and leave/reopen.