mirror of
https://github.com/izzy2lost/2ship2harkinian-Android.git
synced 2026-06-19 01:20:08 -07:00
Add ability to configure motion blur (#266)
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
#include <unordered_map>
|
||||
#include <string>
|
||||
#include "2s2h/Enhancements/Enhancements.h"
|
||||
#include "2s2h/Enhancements/Graphics/MotionBlur.h"
|
||||
#include "2s2h/DeveloperTools/DeveloperTools.h"
|
||||
#include "HudEditor.h"
|
||||
|
||||
@@ -296,6 +297,11 @@ void DrawEnhancementsMenu() {
|
||||
|
||||
ImGui::EndMenu();
|
||||
}
|
||||
|
||||
if (UIWidgets::BeginMenu("Graphics")) {
|
||||
MotionBlur_RenderMenuOptions();
|
||||
ImGui::EndMenu();
|
||||
}
|
||||
|
||||
UIWidgets::CVarCheckbox("Fast Text", "gEnhancements.TimeSavers.FastText", {
|
||||
.tooltip = "Speeds up text rendering, and enables holding of B progress to next message"
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
#include "MotionBlur.h"
|
||||
#include <libultraship/bridge.h>
|
||||
|
||||
#include "2s2h/BenGui/UIWidgets.hpp"
|
||||
|
||||
extern "C" {
|
||||
#include "z64.h"
|
||||
}
|
||||
|
||||
const char* motionBlurOptions[] = { "Dynamic (default)", "Always Off", "Always On" };
|
||||
|
||||
void MotionBlur_RenderMenuOptions() {
|
||||
ImGui::SeparatorText("Motion Blur");
|
||||
UIWidgets::CVarCombobox("Motion Blur Mode", "gEnhancements.Graphics.MotionBlur.Mode", motionBlurOptions, {
|
||||
.labelPosition = UIWidgets::LabelPosition::None,
|
||||
});
|
||||
if (CVarGetInteger("gEnhancements.Graphics.MotionBlur.Mode", 0) == 0) {
|
||||
UIWidgets::Checkbox("On/Off", (bool*)&R_MOTION_BLUR_ENABLED);
|
||||
if (R_MOTION_BLUR_ENABLED) {
|
||||
int32_t motionBlurStrength = R_MOTION_BLUR_ALPHA;
|
||||
if (UIWidgets::SliderInt("Strength", &motionBlurStrength, 0, 255)) {
|
||||
R_MOTION_BLUR_ALPHA = motionBlurStrength;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (CVarGetInteger("gEnhancements.Graphics.MotionBlur.Mode", 0) == 2) {
|
||||
UIWidgets::CVarSliderInt("Strength", "gEnhancements.Graphics.MotionBlur.Strength", 0, 255, 180);
|
||||
}
|
||||
}
|
||||
|
||||
extern "C" void MotionBlur_Override(u8* status, s32* alpha) {
|
||||
if (CVarGetInteger("gEnhancements.Graphics.MotionBlur.Mode", 0) == 1) {
|
||||
*status = 0;
|
||||
*alpha = 0;
|
||||
} else if (CVarGetInteger("gEnhancements.Graphics.MotionBlur.Mode", 0) == 2) {
|
||||
if (*status == 0) *status = 2;
|
||||
*alpha = CVarGetInteger("gEnhancements.Graphics.MotionBlur.Strength", 180);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
#ifndef MOTION_BLUR_H
|
||||
#define MOTION_BLUR_H
|
||||
|
||||
void MotionBlur_RenderMenuOptions();
|
||||
|
||||
#ifdef __cplusplus
|
||||
#include <libultraship/libultraship.h>
|
||||
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
void MotionBlur_Override(u8* status, s32* alpha);
|
||||
|
||||
#ifdef __cplusplus
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif // MOTION_BLUR_H
|
||||
@@ -36,6 +36,7 @@ u8 sMotionBlurStatus;
|
||||
#include "debug.h"
|
||||
#include "2s2h/Enhancements/GameInteractor/GameInteractor.h"
|
||||
#include "2s2h/Enhancements/FrameInterpolation/FrameInterpolation.h"
|
||||
#include "2s2h/Enhancements/Graphics/MotionBlur.h"
|
||||
#include "2s2h/DeveloperTools/CollisionViewer.h"
|
||||
#include "2s2h/framebuffer_effects.h"
|
||||
#include <string.h>
|
||||
@@ -85,6 +86,8 @@ void Play_DrawMotionBlur(PlayState* this) {
|
||||
sMotionBlurStatus = MOTION_BLUR_OFF;
|
||||
}
|
||||
|
||||
MotionBlur_Override(&sMotionBlurStatus, &alpha);
|
||||
|
||||
if (sMotionBlurStatus != MOTION_BLUR_OFF) {
|
||||
OPEN_DISPS(gfxCtx);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user