The main menu's Settings with no player profile asks for a new one's name

With no player profile, Settings opened nothing and showed "event handler
'new campaign decision' failed", where Campaign, Multiplayer and Profiles
open the new profile's name screen. Reported on Android; the menus' code is
every build's, and the Windows build did the same.

Settings runs the PC version's "profile set edit begin", which only failed
with no profile. The screens its <conditional> then opens run the game's
"new campaign decision", and that makes a profile only once "new campaign
chosen" has asked for its name: the other items' "new game if no plyr
profiles" asks, and "profile set edit begin" did not.

- "profile set edit begin" with no profile, in the main menu, asks for the
  name (the game's "new campaign chosen") and fails as before, so that the
  same screens make the profile. A game's pause menu runs the function too
  and has no such screens: there it only fails, as before.
- "new campaign decision" is the port's for the menus' widgets: it runs
  the game's, and for Settings' screen then begins editing the profile
  made. The PC version's screens open Settings with nothing more run, and
  Settings closed at once with no profile being edited ("close if not
  editing profile"). For the other items' screens it is the game's alone.

The menus' files are as tools/ce_menus.py writes them: nothing in them
changes, nor in the game's sources.

Checked on a Windows build, by keys posted to the game's hidden window, on
save folders with no profile: Settings opens the name screen, then
"Creating player profile", then Settings with the new profile being
edited; the name screen left without a name goes back to the main menu
with no profile made (and the game's "new campaign decision" failure shown,
as for the other items); Profiles makes its profile and opens the profile
list as before. With a profile, Settings opens at once. The pause menu's
Settings with no profile does nothing, as before. The menus' checks of
tools/test_linux_port.py pass. Not run on Android or Linux.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Jonas VolmanandClaude Opus 5.5 committed 2026-10-10 01:40:27 -07:00
1 parent c9e4f13fdb
commit 3dcacc9530
3 files changed
+65 -4

No files matched your search

+4 -1
View File
@@ -167,7 +167,10 @@ The port's functions: `port quit game` quits; `port setting load` (on a
spinner's `created`) shows its setting's value and `port setting save` (on
its `deleted`) writes the value shown to `config.toml`, if it changed. Of
the PC version's: `main menu quit game` quits, `profile set edit begin`
begins editing the first player profile, `mouse emit back event` and
begins editing the first player profile (with none it fails, and the main
menu's asks for a new one's name first, as `new game if no plyr profiles`
does, for its `<conditional>` to make the profile, which the port's `new
campaign decision` then has Settings edit), `mouse emit back event` and
`mouse emit x event` push B and X, `emit custom activation event` and
`single prev cl item activated` run the screen's or the list's
`custom_activation` handlers, and its back handlers go back. Its
+58 -3
View File
@@ -8,8 +8,10 @@ calls them from PC_MENU_FUNCTION_BASE on):
- "port quit game" (and the PC version's "main menu quit game") quits, as
closing the window does;
- the PC version's "profile set edit begin" begins editing the first player
profile, as its settings screens need, and fails with none (its handlers
then open the screens that make one);
profile, as its settings screens need, and fails with none: the main
menu's then asks for a new one's name, as the menu's other items do, and
its handlers open the screens that make the profile ("new campaign
decision", after which Settings' is the one being edited);
- "gamespy screen init" hides the server browser's error and filter panels,
and the title of the mode "mp type set mode" did not choose (Internet or
LAN);
@@ -68,6 +70,7 @@ their handlers open opens.
#include "interface/event_manager.h"
#include "interface/player_ui.h"
#include "interface/ui_widget.h"
#include "interface/ui_widget_event_handler_functions.h"
#include "main/main.h"
#include "networking/network_game_manager.h"
#include "saved games/player_profile.h"
@@ -112,6 +115,7 @@ boolean ui_widget_port_dispatch_event(struct widget_instance *widget, short even
void ui_widget_port_go_back(struct widget_instance *widget);
short ui_widget_port_list_index(struct widget_instance *list_widget);
boolean ui_widget_port_saved_game(char const **map_name, short *level, short *difficulty);
char const *ui_widget_event_handler_function_name(long function_index);
short main_get_solo_level_from_name(char const *name);
boolean player_name_clean(wchar_t *name, long count);
short players_port_local_player_count(void);
@@ -515,6 +519,53 @@ boolean pc_menu_profile_edit_begin(void)
return TRUE;
}
/* the game's own function of the name (as its tags name it), run for the
widget: for ours of a name of the game's, which do more than it */
static boolean game_function(char const *name, struct widget_instance *widget, struct event_record *event,
boolean *widget_deleted)
{
char const *function;
long index;
for (index = 0; (function = ui_widget_event_handler_function_name(index)) != NULL; index++)
{
if (!strcmp(function, name))
return ui_widget_event_handler_function_invoke(widget, event, (word)index, widget_deleted);
}
return FALSE;
}
/* "profile set edit begin": Settings, the main menu's and a game's pause
menu's. With no profile, the main menu's asks for a new one's name, as the
menu's other items do ("new game if no plyr profiles"), and fails: the
screens its handler then opens make the profile and edit it
(new_profile_decision). Without the name asked, they made none, and showed
"new campaign decision" as failed. The pause menu's has no such screens,
and only fails. */
static boolean profile_edit_begin(struct widget_instance *widget, struct event_record *event,
boolean *widget_deleted)
{
if (pc_menu_profile_edit_begin())
return TRUE;
/* (a press: the profile is made on its controller) */
if (main_menu_is_active() && event && event->controller_index >= 0 && event->controller_index < 4)
game_function("new campaign chosen", widget, event, widget_deleted);
return FALSE;
}
/* "new campaign decision" (the screen after a new profile's name, each of
the main menu's items having its own): the game's makes the profile, if the
name was entered. Settings' then begins editing it: the PC version's screens
open Settings with nothing more run, and its screen closes at once with no
profile being edited ("close if not editing profile"). */
static boolean new_profile_decision(struct widget_instance *widget, struct event_record *event,
boolean *widget_deleted)
{
if (!game_function("new campaign decision", widget, event, widget_deleted))
return FALSE;
return strcmp(widget->name, "settings_creating_profile") || pc_menu_profile_edit_begin();
}
/* ---------- the campaign */
/* the rows of its lists (main_menu/new_select/list_item_0 to 10) */
@@ -5338,7 +5389,11 @@ boolean pc_menu_event_function_invoke(
}
else if (!strcmp(name, "profile set edit begin"))
{
return pc_menu_profile_edit_begin();
return profile_edit_begin(widget, event, widget_deleted);
}
else if (!strcmp(name, "new campaign decision"))
{
return new_profile_decision(widget, event, widget_deleted);
}
/* (the press posted is the controller's that chose the button: a
split screen player's LEAVE is theirs) */
+3
View File
@@ -384,6 +384,9 @@ static char const *const port_function_names[] =
"port password init", "port password edit", "port password join", "port password back",
/* (Gamepads' OK in a single-player campaign: pause_settings_patch) */
"port profile settings save",
/* (a new profile's screens: Settings' is then being edited, which the
Xbox's leaves to its own screens) */
"new campaign decision",
};
/* the PC version's game data functions that the Xbox's have not, from