From 69cb215219baaf0cc1c2882c2eb46f4c51f9aa70 Mon Sep 17 00:00:00 2001 From: Agent X <44549182+AgentXLP@users.noreply.github.com> Date: Sat, 22 Jun 2024 17:30:54 -0400 Subject: [PATCH] Add bounds checks to skybox get/set functions --- src/pc/lua/utils/smlua_gfx_utils.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/pc/lua/utils/smlua_gfx_utils.c b/src/pc/lua/utils/smlua_gfx_utils.c index 67fea012..5d107a3c 100644 --- a/src/pc/lua/utils/smlua_gfx_utils.c +++ b/src/pc/lua/utils/smlua_gfx_utils.c @@ -2,6 +2,7 @@ #include "pc/gfx/gfx_pc.h" #include "game/rendering_graph_node.h" #include "game/skybox.h" +#include "geo_commands.h" void set_override_fov(f32 fov) { gOverrideFOV = fov; @@ -76,10 +77,12 @@ void set_fog_intensity(f32 intensity) { /// s8 get_skybox(void) { + if (gOverrideBackground != -1) { return gOverrideBackground; } return gReadOnlyBackground; } void set_override_skybox(s8 background) { + if (background < -1 || background > BACKGROUND_CUSTOM) { return; } gOverrideBackground = background; }