Skip to content

Commit cf8fa2b

Browse files
committed
Improve mod settings to allow bool to be used in if checks & more
And more cleanup!
1 parent 10e2939 commit cf8fa2b

File tree

6 files changed

+123
-136
lines changed

6 files changed

+123
-136
lines changed

resources/BreathOfTheWild_BetterVR/patch_RND_Find3DFrameBuffer.asm

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,7 @@ lwz r3, 0x86C(r3)
194194
li r4, 1
195195
stb r4, 0x318(r3)
196196

197+
; also uses r0 which contains the LR register to decide if this is the camera or a save game snapshot
197198
lis r4, currentFrameCounter@ha
198199
lwz r4, currentFrameCounter@l(r4)
199200
lis r5, currentEyeSide@ha

src/hooking/framebuffer.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,12 @@ void VkDeviceOverrides::DestroyImage(const vkroots::VkDeviceDispatch& pDispatch,
4545
void CemuHooks::hook_FixCameraSaveFilesAndInventory(PPCInterpreter_t* hCPU) {
4646
hCPU->instructionPointer = hCPU->sprNew.LR;
4747

48+
uint32_t originCaller = hCPU->gpr[0];
4849
uint32_t isEnabling3DFramebufferCapture = hCPU->gpr[3];
4950
EyeSide side = (EyeSide)hCPU->gpr[4];
5051
uint32_t frameIdx = hCPU->gpr[5];
5152

52-
Log::print<PPC>("hook_FixCameraSaveFilesAndInventory: isEnabling3DFramebufferCapture={}, side={}, frameIdx={}", isEnabling3DFramebufferCapture, side, frameIdx);
53+
Log::print<PPC>("[{:08X}] hook_FixCameraSaveFilesAndInventory: isEnabling3DFramebufferCapture={:08X}, side={}, frameIdx={}", originCaller, isEnabling3DFramebufferCapture, side, frameIdx);
5354
VRManager::instance().XR->GetRenderer()->SignalGameCapturing3DFrameBuffer();
5455
}
5556

src/rendering/renderer.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -453,7 +453,7 @@ std::vector<XrCompositionLayerQuad> RND_Renderer::Layer2D::FinishRendering(XrTim
453453
glm::vec3 headPosition = (ToGLM(leftPose.position) + ToGLM(rightPose.position)) * 0.5f;
454454
glm::quat headOrientation = glm::slerp(ToGLM(leftPose.orientation), ToGLM(rightPose.orientation), 0.5f);
455455

456-
const float DISTANCE = GetSettings().hudDistance.Get();
456+
const float DISTANCE = GetSettings().hudDistance;
457457
constexpr float LERP_SPEED = 0.05f;
458458

459459
XrPosef layerPose = { { 0.0f, 0.0f, 0.0f, 1.0f }, { 0.0f, 0.0f, 0.0f } };
@@ -492,7 +492,7 @@ std::vector<XrCompositionLayerQuad> RND_Renderer::Layer2D::FinishRendering(XrTim
492492
const float height = aspectRatio <= 1.0f ? 1.0f / aspectRatio : 1.0f;
493493

494494
// todo: change space to head space if we want to follow the head
495-
const float LAYER_SIZE = GetSettings().hudSize.Get();
495+
const float LAYER_SIZE = GetSettings().hudSize;
496496

497497
std::vector<XrCompositionLayerQuad> layers;
498498

src/rendering/vulkan_imgui.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -667,12 +667,12 @@ void RND_Renderer::ImGuiOverlay::DrawHelpMenu() {
667667
auto DrawLayerSettingsRow = [&](const char* label, bool* changed, FloatSetting<float>& distanceSetting, FloatSetting<float>& scaleSetting) {
668668
DrawSettingRow(label, [&]() {
669669
auto applyValues = [&](float distance, float scale) {
670-
distanceSetting.Set(distance);
671-
scaleSetting.Set(scale);
670+
distanceSetting = distance;
671+
scaleSetting = scale;
672672
};
673673

674-
float distance = distanceSetting.Get();
675-
float scale = scaleSetting.Get();
674+
float distance = distanceSetting;
675+
float scale = scaleSetting;
676676
std::string distanceIdStr = std::format("##{}_Distance", label);
677677
std::string scaleIdStr = std::format("##{}_Scale", label);
678678

@@ -683,15 +683,15 @@ void RND_Renderer::ImGuiOverlay::DrawHelpMenu() {
683683

684684
ImGui::PushItemWidth(sliderWidth);
685685
if (ImGui::SliderFloat(distanceIdStr.c_str(), &distance, distanceSetting.min, distanceSetting.max, formatDistance(distance).c_str())) {
686-
applyValues(std::clamp(distance, distanceSetting.min, distanceSetting.max), scaleSetting.Get());
686+
applyValues(std::clamp(distance, distanceSetting.min, distanceSetting.max), scaleSetting);
687687
*changed = true;
688688
}
689689
ImGui::PopItemWidth();
690690
ImGui::SameLine();
691691

692692
ImGui::PushItemWidth(sliderWidth);
693693
if (ImGui::SliderFloat(scaleIdStr.c_str(), &scale, scaleSetting.min, scaleSetting.max, "%.2fx scale")) {
694-
applyValues(distanceSetting.Get(), std::clamp(scale, scaleSetting.min, scaleSetting.max));
694+
applyValues(distanceSetting, std::clamp(scale, scaleSetting.min, scaleSetting.max));
695695
*changed = true;
696696
}
697697
ImGui::PopItemWidth();
@@ -726,7 +726,7 @@ void RND_Renderer::ImGuiOverlay::DrawHelpMenu() {
726726
ImGui::PopStyleVar();
727727
if (DrawStyledTab(ICON_KI_COG "Settings", 0)) {
728728
ImGui::Separator();
729-
CameraMode cameraMode = settings.cameraMode.Get();
729+
CameraMode cameraMode = settings.cameraMode;
730730
DrawSettingRow("Camera Mode", [&]() {
731731
settings.cameraMode.AddRadioToGUI(&changed, ModSettings::toDisplayString);
732732
});
@@ -878,8 +878,8 @@ void RND_Renderer::ImGuiOverlay::DrawHelpMenu() {
878878
});
879879

880880
if (settings.performanceOverlay != PerformanceOverlayMode::DISABLE) {
881-
static const int freqOptions[] = { 30, 60, 72, 80, 90, 120, 144 };
882-
int currentFreq = (int)settings.performanceOverlayFrequency.Get();
881+
static const uint32_t freqOptions[] = { 30, 60, 72, 80, 90, 120, 144 };
882+
uint32_t currentFreq = settings.performanceOverlayFrequency;
883883
int freqIdx = 5; // Default to 90
884884
for (int i = 0; i < std::size(freqOptions); i++) {
885885
if (freqOptions[i] == currentFreq) {

0 commit comments

Comments
 (0)