Show Ping option (#889)

---------

Co-authored-by: NoNameWasDefined <nonename@outlook.fr>
Co-authored-by: PeachyPeachSM64 <72323920+PeachyPeachSM64@users.noreply.github.com>
Co-authored-by: rPhase <github@rphase.net>
This commit is contained in:
ManIsCat2 2025-07-29 16:09:36 +03:30 committed by GitHub
parent 3d458d0212
commit b93e5e17fd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
30 changed files with 134 additions and 6 deletions

View file

@ -11022,6 +11022,12 @@ function djui_menu_get_theme()
-- ...
end
--- @return boolean
--- Checks if the DJUI playerlist ping icon is visible
function djui_is_playerlist_ping_visible()
-- ...
end
--- @return integer
--- Gets the current state of the dialog box
function get_dialog_box_state()

View file

@ -34,3 +34,27 @@ ALIGNED8 const Texture texture_selectionbox_forward_icon[] = {
ALIGNED8 const Texture texture_coopdx_logo[] = {
#include "textures/segment2/custom_coopdx_logo.rgba32.inc.c"
};
ALIGNED8 const Texture texture_ping_empty[] = {
#include "textures/segment2/custom_ping_empty.rgba16.inc.c"
};
ALIGNED8 const Texture texture_ping_one[] = {
#include "textures/segment2/custom_ping_one.rgba16.inc.c"
};
ALIGNED8 const Texture texture_ping_two[] = {
#include "textures/segment2/custom_ping_two.rgba16.inc.c"
};
ALIGNED8 const Texture texture_ping_three[] = {
#include "textures/segment2/custom_ping_three.rgba16.inc.c"
};
ALIGNED8 const Texture texture_ping_four[] = {
#include "textures/segment2/custom_ping_four.rgba16.inc.c"
};
ALIGNED8 const Texture texture_ping_full[] = {
#include "textures/segment2/custom_ping_full.rgba16.inc.c"
};

View file

@ -1554,6 +1554,12 @@ extern ALIGNED8 const Texture texture_selectionbox_forward_icon[];
extern ALIGNED8 const Texture texture_font_jp[];
extern ALIGNED8 const Texture texture_font_jp_aliased[];
extern ALIGNED8 const Texture texture_coopdx_logo[];
extern ALIGNED8 const Texture texture_ping_empty[];
extern ALIGNED8 const Texture texture_ping_one[];
extern ALIGNED8 const Texture texture_ping_two[];
extern ALIGNED8 const Texture texture_ping_three[];
extern ALIGNED8 const Texture texture_ping_four[];
extern ALIGNED8 const Texture texture_ping_full[];
extern ALIGNED8 const Texture pss_seg7_texture_07000000[];
extern ALIGNED8 const Texture pss_seg7_texture_07000800[];
extern ALIGNED8 const Texture pss_seg7_texture_07001000[];

View file

@ -1154,6 +1154,14 @@ static const struct BuiltinTexInfo sDynosBuiltinTexs[] = {
define_builtin_tex(texture_selectionbox_forward_icon, "textures/segment2/custom_selectionbox_forward_icon.rgba16.png", 16, 16, 16),
define_builtin_tex(texture_coopdx_logo, "textures/segment2/custom_coopdx_logo.rgba32.png", 2048, 1024, 32),
// Playerlist Exclusives
define_builtin_tex(texture_ping_empty, "textures/segment2/custom_ping_empty.rgba16.png", 16, 16, 16),
define_builtin_tex(texture_ping_one, "textures/segment2/custom_ping_one.rgba16.png", 16, 16, 16),
define_builtin_tex(texture_ping_two, "textures/segment2/custom_ping_two.rgba16.png", 16, 16, 16),
define_builtin_tex(texture_ping_three, "textures/segment2/custom_ping_three.rgba16.png", 16, 16, 16),
define_builtin_tex(texture_ping_four, "textures/segment2/custom_ping_four.rgba16.png", 16, 16, 16),
define_builtin_tex(texture_ping_full, "textures/segment2/custom_ping_full.rgba16.png", 16, 16, 16),
// Goddard
define_builtin_tex(gd_texture_hand_open, "textures/intro_raw/hand_open.rgba16.png", 32, 32, 16),
define_builtin_tex(gd_texture_hand_closed, "textures/intro_raw/hand_closed.rgba16.png", 32, 32, 16),

View file

@ -4407,6 +4407,27 @@ Gets the DJUI menu theme
<br />
## [djui_is_playerlist_ping_visible](#djui_is_playerlist_ping_visible)
### Description
Checks if the DJUI playerlist ping icon is visible
### Lua Example
`local booleanValue = djui_is_playerlist_ping_visible()`
### Parameters
- None
### Returns
- `boolean`
### C Prototype
`bool djui_is_playerlist_ping_visible(void);`
[:arrow_up_small:](#)
<br />
## [get_dialog_box_state](#get_dialog_box_state)
### Description

View file

@ -1977,6 +1977,7 @@
- [djui_get_playerlist_page_index](functions-6.md#djui_get_playerlist_page_index)
- [djui_menu_get_font](functions-6.md#djui_menu_get_font)
- [djui_menu_get_theme](functions-6.md#djui_menu_get_theme)
- [djui_is_playerlist_ping_visible](functions-6.md#djui_is_playerlist_ping_visible)
- [get_dialog_box_state](functions-6.md#get_dialog_box_state)
- [get_dialog_id](functions-6.md#get_dialog_id)
- [get_last_star_or_key](functions-6.md#get_last_star_or_key)

View file

@ -171,6 +171,7 @@ ANTIALIASING = "Anti-aliasing"
OFF = "Vypnuto"
MUST_RESTART = "Musíte restartovat hru pro aplikování změn."
SHOW_FPS = "Zobrazit FPS"
SHOW_PING = "Zobrazit Ping"
[DJUI_THEMES]
DJUI_THEME = "Téma DJUI"

View file

@ -171,6 +171,7 @@ ANTIALIASING = "Anti-aliasing"
OFF = "UIT"
MUST_RESTART = "Je moet de game opnieuw opstarten voor sommige veranderingen om effect te hebben."
SHOW_FPS = "Toon FPS"
SHOW_PING = "Toon Ping"
[DJUI_THEMES]
DJUI_THEME = "DJUI Thema"

View file

@ -171,6 +171,7 @@ ANTIALIASING = "Anti-aliasing"
OFF = "Off"
MUST_RESTART = "Restart the game to apply changes."
SHOW_FPS = "Show FPS"
SHOW_PING = "Show Ping"
[DJUI_THEMES]
DJUI_THEME = "DJUI Theme"

View file

@ -171,6 +171,7 @@ ANTIALIASING = "Anti-aliasing"
OFF = "Désactivé"
MUST_RESTART = "Vous devez relancer le jeu pour que certains changements prennent effet."
SHOW_FPS = "Afficher FPS"
SHOW_PING = "Afficher Ping"
[DJUI_THEMES]
DJUI_THEME = "Thème DJUI"

View file

@ -171,6 +171,7 @@ ANTIALIASING = "Kantenglättung"
OFF = "Aus"
MUST_RESTART = "Um einige Änderungen zu übernehmen, muss das Spiel neugestartet werden."
SHOW_FPS = "FPS anzeigen"
SHOW_PING = "Ping anzeigen"
[DJUI_THEMES]
DJUI_THEME = "DJUI-Theme"

View file

@ -169,6 +169,7 @@ ANTIALIASING = "Anti-aliasing"
OFF = "Off"
MUST_RESTART = "Devi riavviare il gioco perché alcuni cambiamenti abbiano effetto."
SHOW_FPS = "Mostra FPS"
SHOW_PING = "Mostra Ping"
[DJUI_THEMES]
DJUI_THEME = "Tema DJUI"

View file

@ -172,6 +172,7 @@ ANTIALIASING = "アンチエイリアス"
OFF = "オフ"
MUST_RESTART = "変更を適用するにはゲームを再起動してください。"
SHOW_FPS = "FPSを表示する"
SHOW_PING = "Pingを表示する"
[DJUI_THEMES]
DJUI_THEME = "DJUIのテーマ"

View file

@ -171,6 +171,7 @@ ANTIALIASING = "Anti-aliasing"
OFF = "Wyłączone"
MUST_RESTART = "Musisz zrestartować grę, aby zastosować zmiany."
SHOW_FPS = "Pokaż Klatki na Sekundę"
SHOW_PING = "Pokaż Ping"
[DJUI_THEMES]
DJUI_THEME = "Motyw DJUI"

View file

@ -171,6 +171,7 @@ ANTIALIASING = "Antisserrilhamento"
OFF = "Desligado"
MUST_RESTART = "Reinicie o jogo para aplicar as mudanças."
SHOW_FPS = "Mostrar FPS"
SHOW_PING = "Mostrar Ping"
[DJUI_THEMES]
DJUI_THEME = "Tema da DJUI"

View file

@ -170,6 +170,7 @@ ANTIALIASING = "Анизотропная фильтрация"
OFF = "Выкл"
MUST_RESTART = "Перезапустите игру, чтобы изменения вступили в силу"
SHOW_FPS = "Показывать FPS"
SHOW_PING = "Показывать пинг"
[DJUI_THEMES]
DJUI_THEME = "Темы DJUI"

View file

@ -171,6 +171,7 @@ ANTIALIASING = "Anti-aliasing"
OFF = "Desactivado"
MUST_RESTART = "Tienes que reiniciar el juego para que algunos cambios surtan efecto."
SHOW_FPS = "Mostrar FPS"
SHOW_PING = "Mostrar Ping"
[DJUI_THEMES]
DJUI_THEME = "Tema de DJUI"

View file

@ -84,6 +84,7 @@ ConfigStick configStick = { 0 };
// display settings
unsigned int configFiltering = 2; // 0 = Nearest, 1 = Bilinear, 2 = Trilinear
bool configShowFPS = false;
bool configShowPing = false;
enum RefreshRateMode configFramerateMode = RRM_AUTO;
unsigned int configFrameLimit = 60;
unsigned int configInterpolationMode = 1;
@ -226,6 +227,7 @@ static const struct ConfigOption options[] = {
// display settings
{.name = "texture_filtering", .type = CONFIG_TYPE_UINT, .uintValue = &configFiltering},
{.name = "show_fps", .type = CONFIG_TYPE_BOOL, .boolValue = &configShowFPS},
{.name = "show_ping", .type = CONFIG_TYPE_BOOL, .boolValue = &configShowPing},
{.name = "framerate_mode", .type = CONFIG_TYPE_UINT, .uintValue = &configFramerateMode},
{.name = "frame_limit", .type = CONFIG_TYPE_UINT, .uintValue = &configFrameLimit},
{.name = "interpolation_mode", .type = CONFIG_TYPE_UINT, .uintValue = &configInterpolationMode},

View file

@ -50,6 +50,7 @@ extern ConfigWindow configWindow;
extern ConfigStick configStick;
extern unsigned int configFiltering;
extern bool configShowFPS;
extern bool configShowPing;
extern enum RefreshRateMode configFramerateMode;
extern unsigned int configFrameLimit;
extern unsigned int configInterpolationMode;

View file

@ -63,6 +63,7 @@ void djui_panel_display_create(struct DjuiBase* caller) {
djui_checkbox_create(body, DLANG(DISPLAY, FULLSCREEN), &configWindow.fullscreen, djui_panel_display_apply);
djui_checkbox_create(body, DLANG(DISPLAY, FORCE_4BY3), &configForce4By3, djui_panel_display_apply);
djui_checkbox_create(body, DLANG(DISPLAY, SHOW_FPS), &configShowFPS, NULL);
djui_checkbox_create(body, DLANG(DISPLAY, SHOW_PING), &configShowPing, NULL);
djui_checkbox_create(body, DLANG(DISPLAY, VSYNC), &configWindow.vsync, djui_panel_display_apply);
char* framerateModeChoices[3] = { DLANG(DISPLAY, AUTO), DLANG(DISPLAY, MANUAL), DLANG(DISPLAY, UNCAPPED) };

View file

@ -10,11 +10,21 @@
#include "pc/network/network.h"
#include "pc/utils/misc.h"
extern ALIGNED8 const u8 texture_hud_char_mario_head[];
extern ALIGNED8 const Texture texture_ping_empty[];
extern ALIGNED8 const Texture texture_ping_one[];
extern ALIGNED8 const Texture texture_ping_two[];
extern ALIGNED8 const Texture texture_ping_three[];
extern ALIGNED8 const Texture texture_ping_four[];
extern ALIGNED8 const Texture texture_ping_full[];
struct DjuiThreePanel* gDjuiPlayerList = NULL;
bool gAttemptingToOpenPlayerlist = false;
static struct DjuiFlowLayout* djuiRow[MAX_PLAYERS] = { 0 };
static struct DjuiImage* djuiImages[MAX_PLAYERS] = { 0 };
static struct DjuiImage* djuiHeadIconImages[MAX_PLAYERS] = { 0 };
static struct DjuiImage* djuiPingImages[MAX_PLAYERS] = { 0 };
static struct DjuiText* djuiTextNames[MAX_PLAYERS] = { 0 };
static struct DjuiText* djuiTextDescriptions[MAX_PLAYERS] = { 0 };
static struct DjuiText* djuiTextLocations[MAX_PLAYERS] = { 0 };
@ -35,7 +45,17 @@ static void playerlist_update_row(u8 i, struct NetworkPlayer *np) {
snprintf(sActNum, 7, "Done");
}
if (charIndex >= CT_MAX) { charIndex = 0; }
djuiImages[i]->texture = gCharacters[charIndex].hudHeadTexture.texture;
djuiHeadIconImages[i]->texture = gCharacters[charIndex].hudHeadTexture.texture;
s16 pingValue = np->ping / 150;
switch (pingValue) {
case 0: djuiPingImages[i]->texture = texture_ping_full; break;
case 1: djuiPingImages[i]->texture = texture_ping_four; break;
case 2: djuiPingImages[i]->texture = texture_ping_three; break;
case 3: djuiPingImages[i]->texture = texture_ping_two; break;
case 4: djuiPingImages[i]->texture = texture_ping_one; break;
default: djuiPingImages[i]->texture = texture_ping_empty; break;
}
u8 visible = np->connected;
if (np == gNetworkPlayerServer && gServerSettings.headlessServer) {
@ -46,6 +66,7 @@ static void playerlist_update_row(u8 i, struct NetworkPlayer *np) {
}
djui_base_set_visible(&djuiRow[i]->base, visible);
djui_base_set_visible(&djuiPingImages[i]->base, configShowPing);
u8* rgb = network_get_player_text_color(np->localIndex);
djui_base_set_color(&djuiTextNames[i]->base, rgb[0], rgb[1], rgb[2], 255);
@ -60,6 +81,7 @@ static void playerlist_update_row(u8 i, struct NetworkPlayer *np) {
: np->overrideLocation
);
djui_text_set_text(djuiTextAct[i], sActNum);
djui_base_set_size(&djuiTextAct[i]->base, configShowPing ? 65 : 100, 32.0f);
}
void djui_panel_playerlist_on_render_pre(UNUSED struct DjuiBase* base, UNUSED bool* skipRender) {
@ -94,7 +116,7 @@ void djui_panel_playerlist_create(UNUSED struct DjuiBase* caller) {
// delete old player list
if (gDjuiPlayerList != NULL) {
djui_base_destroy(&gDjuiPlayerList->base);
gDjuiPlayerList= NULL;
gDjuiPlayerList = NULL;
}
struct DjuiThreePanel* panel = djui_panel_menu_create(DLANG(PLAYER_LIST, PLAYERS), false);
@ -119,10 +141,13 @@ void djui_panel_playerlist_create(UNUSED struct DjuiBase* caller) {
djui_base_set_visible(&row->base, false);
djuiRow[i] = row;
extern ALIGNED8 const u8 texture_hud_char_mario_head[];
struct DjuiImage* i1 = djui_image_create(&row->base, texture_hud_char_mario_head, 16, 16, 8);
struct DjuiImage* i1 = djui_image_create(&row->base, texture_ping_empty, 16, 16, 8);
djui_base_set_size(&i1->base, 32, 32);
djuiImages[i] = i1;
djuiPingImages[i] = i1;
struct DjuiImage* i2 = djui_image_create(&row->base, texture_hud_char_mario_head, 16, 16, 8);
djui_base_set_size(&i2->base, 32, 32);
djuiHeadIconImages[i] = i2;
int t = 220;
struct DjuiText* t2 = djui_text_create(&row->base, DLANG(PLAYER_LIST, NAME));

View file

@ -33082,6 +33082,21 @@ int smlua_func_djui_menu_get_theme(UNUSED lua_State* L) {
return 1;
}
int smlua_func_djui_is_playerlist_ping_visible(UNUSED lua_State* L) {
if (L == NULL) { return 0; }
int top = lua_gettop(L);
if (top != 0) {
LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "djui_is_playerlist_ping_visible", 0, top);
return 0;
}
lua_pushboolean(L, djui_is_playerlist_ping_visible());
return 1;
}
int smlua_func_get_dialog_box_state(UNUSED lua_State* L) {
if (L == NULL) { return 0; }
@ -38236,6 +38251,7 @@ void smlua_bind_functions_autogen(void) {
smlua_bind_function(L, "djui_get_playerlist_page_index", smlua_func_djui_get_playerlist_page_index);
smlua_bind_function(L, "djui_menu_get_font", smlua_func_djui_menu_get_font);
smlua_bind_function(L, "djui_menu_get_theme", smlua_func_djui_menu_get_theme);
smlua_bind_function(L, "djui_is_playerlist_ping_visible", smlua_func_djui_is_playerlist_ping_visible);
smlua_bind_function(L, "get_dialog_box_state", smlua_func_get_dialog_box_state);
smlua_bind_function(L, "get_dialog_id", smlua_func_get_dialog_id);
smlua_bind_function(L, "get_last_star_or_key", smlua_func_get_last_star_or_key);

View file

@ -118,6 +118,10 @@ struct DjuiTheme* djui_menu_get_theme(void) {
return gDjuiThemes[configDjuiTheme];
}
bool djui_is_playerlist_ping_visible(void) {
return configShowPing;
}
///
extern s8 gDialogBoxState;

View file

@ -79,6 +79,8 @@ u8 djui_get_playerlist_page_index(void);
enum DjuiFontType djui_menu_get_font(void);
/* |description|Gets the DJUI menu theme|descriptionEnd| */
struct DjuiTheme* djui_menu_get_theme(void);
/* |description|Checks if the DJUI playerlist ping icon is visible|descriptionEnd| */
bool djui_is_playerlist_ping_visible(void);
/* |description|Gets the current state of the dialog box|descriptionEnd| */
s8 get_dialog_box_state(void);

Binary file not shown.

After

Width:  |  Height:  |  Size: 315 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 319 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 295 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 313 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 314 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 313 B