mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2024-10-19 11:42:39 +00:00
Fix crash in djui_interactable_update
This commit is contained in:
parent
c60f9f3e46
commit
0ddb59c87c
3 changed files with 12 additions and 6 deletions
|
@ -329,6 +329,11 @@ void djui_base_destroy(struct DjuiBase* base) {
|
|||
gDjuiHovered = NULL;
|
||||
}
|
||||
|
||||
// remove binding
|
||||
if (gInteractableBinding == base) {
|
||||
gInteractableBinding = NULL;
|
||||
}
|
||||
|
||||
// remove myself from parent's linked list
|
||||
if (base->parent != NULL) {
|
||||
struct DjuiBaseChild* child = base->parent->child;
|
||||
|
|
|
@ -21,7 +21,7 @@ static bool sIgnoreInteractableUntilCursorReleased = false;
|
|||
struct DjuiBase* gDjuiHovered = NULL;
|
||||
struct DjuiBase* gDjuiCursorDownOn = NULL;
|
||||
struct DjuiBase* gInteractableFocus = NULL;
|
||||
static struct DjuiBase* sInteractableBinding = NULL;
|
||||
struct DjuiBase* gInteractableBinding = NULL;
|
||||
static struct DjuiBase* sMouseDown = NULL;
|
||||
bool gInteractableOverridePad = false;
|
||||
OSContPad gInteractablePad = { 0 };
|
||||
|
@ -163,11 +163,11 @@ static void djui_interactable_cursor_update_active(struct DjuiBase* base) {
|
|||
}
|
||||
|
||||
bool djui_interactable_is_binding(void) {
|
||||
return sInteractableBinding != NULL;
|
||||
return gInteractableBinding != NULL;
|
||||
}
|
||||
|
||||
void djui_interactable_set_binding(struct DjuiBase* base) {
|
||||
sInteractableBinding = base;
|
||||
gInteractableBinding = base;
|
||||
djui_cursor_set_visible(base == NULL);
|
||||
if (base == NULL) {
|
||||
sIgnoreInteractableUntilCursorReleased = true;
|
||||
|
@ -186,7 +186,7 @@ bool djui_interactable_is_input_focus(struct DjuiBase* base) {
|
|||
}
|
||||
|
||||
bool djui_interactable_on_key_down(int scancode) {
|
||||
if (sInteractableBinding != NULL) {
|
||||
if (gInteractableBinding != NULL) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -377,8 +377,8 @@ void djui_interactable_update(void) {
|
|||
if (gDjuiPanelPauseCreated) { djui_panel_shutdown(); }
|
||||
}
|
||||
|
||||
if (sInteractableBinding != NULL) {
|
||||
djui_interactable_on_bind(sInteractableBinding);
|
||||
if (gInteractableBinding != NULL) {
|
||||
djui_interactable_on_bind(gInteractableBinding);
|
||||
} else if ((padButtons & PAD_BUTTON_A) || (mouseButtons & MOUSE_BUTTON_1)) {
|
||||
// cursor down events
|
||||
if (gDjuiHovered != NULL) {
|
||||
|
|
|
@ -45,6 +45,7 @@ extern OSContPad gInteractablePad;
|
|||
extern struct DjuiBase* gDjuiHovered;
|
||||
extern struct DjuiBase* gDjuiCursorDownOn;
|
||||
extern struct DjuiBase* gInteractableFocus;
|
||||
extern struct DjuiBase* gInteractableBinding;
|
||||
|
||||
bool djui_interactable_is_binding(void);
|
||||
void djui_interactable_set_binding(struct DjuiBase* base);
|
||||
|
|
Loading…
Reference in a new issue