Mercurial > repos > blastem
comparison render_sdl.c @ 2702:0a6d644c47aa
Avoid crash if using an older SDL2 DLL than the one we compiled with
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Fri, 04 Jul 2025 21:23:48 -0700 |
parents | 89c06782589f |
children |
comparison
equal
deleted
inserted
replaced
2701:5ca4e0fd761b | 2702:0a6d644c47aa |
---|---|
2634 { | 2634 { |
2635 static tern_node *button_lookup; | 2635 static tern_node *button_lookup; |
2636 if (!button_lookup) { | 2636 if (!button_lookup) { |
2637 for (int i = SDL_CONTROLLER_BUTTON_A; i < SDL_CONTROLLER_BUTTON_MAX; i++) | 2637 for (int i = SDL_CONTROLLER_BUTTON_A; i < SDL_CONTROLLER_BUTTON_MAX; i++) |
2638 { | 2638 { |
2639 button_lookup = tern_insert_int(button_lookup, SDL_GameControllerGetStringForButton(i), i); | 2639 const char *bname = SDL_GameControllerGetStringForButton(i); |
2640 if (bname) { | |
2641 button_lookup = tern_insert_int(button_lookup, bname, i); | |
2642 } | |
2640 } | 2643 } |
2641 //alternative Playstation-style names | 2644 //alternative Playstation-style names |
2642 button_lookup = tern_insert_int(button_lookup, "cross", SDL_CONTROLLER_BUTTON_A); | 2645 button_lookup = tern_insert_int(button_lookup, "cross", SDL_CONTROLLER_BUTTON_A); |
2643 button_lookup = tern_insert_int(button_lookup, "circle", SDL_CONTROLLER_BUTTON_B); | 2646 button_lookup = tern_insert_int(button_lookup, "circle", SDL_CONTROLLER_BUTTON_B); |
2644 button_lookup = tern_insert_int(button_lookup, "square", SDL_CONTROLLER_BUTTON_X); | 2647 button_lookup = tern_insert_int(button_lookup, "square", SDL_CONTROLLER_BUTTON_X); |