Auto DJUI scale and other improvements

This commit is contained in:
Agent X 2023-11-26 00:29:59 -05:00
parent 6113254650
commit a67395a860
20 changed files with 71 additions and 62 deletions

View file

@ -1550,7 +1550,7 @@ all:
rm -rf build/us_pc/sm64coopdx.app; \
mkdir -p $(APP_MACOS_DIR); \
mkdir -p $(APP_CONTENTS_DIR)/Resources; \
mv build/us_pc/sm64.us.f3dex2e $(APP_MACOS_DIR)/sm64coopdx; \
mv build/us_pc/sm64coopdx $(APP_MACOS_DIR)/sm64coopdx; \
cp -r build/us_pc/* $(APP_MACOS_DIR); \
cp res/icon.icns $(APP_CONTENTS_DIR)/Resources/icon.icns; \
echo "APPL????" > $(APP_CONTENTS_DIR)/PkgInfo; \

View file

@ -142,10 +142,9 @@ MUST_RESTART = "Musíte restartovat hru pro aplikování změn."
SHOW_FPS = "Zobrazit FPS"
[DJUI_THEMES]
DJUI_THEMES = "TÉMATA DJUI"
CENTER = "Střed"
DJUI_THEME = "Téma DJUI"
DJUI_SCALE = "Stupnice DJUI"
AUTO = "Automatický"
CENTER = "Střed"
LIGHT_THEME = "Světlo"
DARK_THEME = "Tmavý"
@ -235,7 +234,7 @@ OPTIONS = "Nastavení"
QUIT = "Opustit hru"
[MENU_OPTIONS]
MAIN_MENU = "HLAVNI MENU"
MENU_TITLE = "MENU"
LEVEL = "Level"
STAFF_ROLL = "Závěrečné titulky"
USE_STAGE_MUSIC = "Použít písničku z levelu"

View file

@ -142,10 +142,9 @@ MUST_RESTART = "Je moet de game opnieuw opstarten voor sommige veranderingen om
SHOW_FPS = "Toon FPS"
[DJUI_THEMES]
DJUI_THEMES = "DJUI THEMA'S"
CENTER = "Centreren"
DJUI_THEME = "DJUI Thema"
DJUI_SCALE = "DJUI Schaal"
AUTO = "Automatisch"
CENTER = "Centreren"
LIGHT_THEME = "Licht"
DARK_THEME = "Donker"
@ -235,7 +234,7 @@ OPTIONS = "Opties"
QUIT = "Stop"
[MENU_OPTIONS]
MAIN_MENU = "Hoofdmenu"
MENU_TITLE = "MENU"
LEVEL = "Level"
STAFF_ROLL = "Personeelsoverzicht"
USE_STAGE_MUSIC = "Gebruik level muziek"

View file

@ -142,10 +142,9 @@ MUST_RESTART = "Restart the game to apply changes."
SHOW_FPS = "Show FPS"
[DJUI_THEMES]
DJUI_THEMES = "DJUI THEMES"
CENTER = "Center"
DJUI_THEME = "DJUI Theme"
DJUI_SCALE = "DJUI Scale"
AUTO = "Auto"
CENTER = "Center"
LIGHT_THEME = "Light"
DARK_THEME = "Dark"
@ -235,7 +234,7 @@ OPTIONS = "Options"
QUIT = "Quit"
[MENU_OPTIONS]
MAIN_MENU = "MAIN MENU"
MENU_TITLE = "MENU"
LEVEL = "Level"
STAFF_ROLL = "Staff Roll"
USE_STAGE_MUSIC = "Use Stage Music"

View file

@ -135,7 +135,6 @@ D3X = "x3"
D10X = "x10"
D100X = "x100"
DRAW_DISTANCE = "Distance d'affichage"
DJUI_THEMES = "Thèmes DJUI"
DYNOS_PACKS = "Packs DynOS"
ANTIALIASING = "Anti-aliasing"
OFF = "Désactivé"
@ -143,10 +142,9 @@ MUST_RESTART = "Vous devez relancer le jeu pour que certains changements prennen
SHOW_FPS = "Afficher FPS"
[DJUI_THEMES]
DJUI_THEMES = "THÈMES DJUI"
CENTER = "Centrer"
DJUI_THEME = "Thème DJUI"
DJUI_SCALE = "Échelle DJUI"
AUTO = "Automatique"
CENTER = "Centrer"
LIGHT_THEME = "Lumière"
DARK_THEME = "Sombre"
@ -236,7 +234,7 @@ OPTIONS = "Options"
QUIT = "Quitter"
[MENU_OPTIONS]
MAIN_MENU = "MENU"
MENU_TITLE = "MENU"
LEVEL = "Niveau"
STAFF_ROLL = "Générique de fin"
USE_STAGE_MUSIC = "Utiliser la musique du niveau"

View file

@ -142,10 +142,9 @@ MUST_RESTART = "Um einige Änderungen zu übernehmen, muss das Spiel neugestarte
SHOW_FPS = "FPS anzeigen"
[DJUI_THEMES]
DJUI_THEMES = "DJUI-THEMEN"
CENTER = "Zentrieren"
DJUI_THEME = "DJUI-Thema"
DJUI_SCALE = "DJUI-Skala"
AUTO = "Automatisch"
CENTER = "Zentrieren"
LIGHT_THEME = "Litch"
DARK_THEME = "Dunkel"
@ -235,7 +234,7 @@ OPTIONS = "Optionen"
QUIT = "Beenden"
[MENU_OPTIONS]
MAIN_MENU = "HAUPTMENÜ"
MENU_TITLE = "MENÜ"
LEVEL = "Level"
STAFF_ROLL = "Abspann"
USE_STAGE_MUSIC = "Stufenmusik verwenden"

View file

@ -140,10 +140,9 @@ MUST_RESTART = "You must restart the game for some changes to take effect."
SHOW_FPS = "Mostra FPS"
[DJUI_THEMES]
DJUI_THEMES = "TEMI DJUI"
CENTER = "Centrare"
DJUI_THEME = "Tema DJUI"
DJUI_SCALE = "Scala DJUI"
AUTO = "Automatico"
CENTER = "Centrare"
LIGHT_THEME = "Luce"
DARK_THEME = "Scuro"
@ -233,7 +232,7 @@ OPTIONS = "Opzioni"
QUIT = "Abbandona"
[MENU_OPTIONS]
MAIN_MENU = "MENÙ PRINCIPALE"
MENU_TITLE = "MENÙ"
LEVEL = "Livello"
STAFF_ROLL = "Staff dei titoli di coda"
USE_STAGE_MUSIC = "Usa la musica del livello"

View file

@ -142,10 +142,9 @@ MUST_RESTART = "Musisz zrestartowac gre, aby zmiany zaczely obowiazywac."
SHOW_FPS = "Pokaż FPS"
[DJUI_THEMES]
DJUI_THEMES = "TEMATY DJUI"
CENTER = "Środek"
DJUI_THEME = "Motyw DJUI"
DJUI_SCALE = "Skala DJUI"
AUTO = "Automatyczny"
CENTER = "Środek"
LIGHT_THEME = "Światło"
DARK_THEME = "Ciemny"
@ -235,7 +234,7 @@ OPTIONS = "Opcje"
QUIT = "Wyjdz"
[MENU_OPTIONS]
MAIN_MENU = "MENU GLOWNE"
MENU_TITLE = "MENU"
LEVEL = "Poziom"
STAFF_ROLL = "Napisy Końcowe"
USE_STAGE_MUSIC = "Uzyj Muzyki Poziomu"

View file

@ -142,10 +142,9 @@ MUST_RESTART = "Você precisará reiniciar o jogo para algumas alterações sere
SHOW_FPS = "Mostrar FPS"
[DJUI_THEMES]
DJUI_THEMES = "TEMAS DJUI"
CENTER = "Centralizar"
DJUI_THEME = "Tema DJUI"
DJUI_SCALE = "Tamanho da DJUI"
AUTO = "Automático"
CENTER = "Centralizar"
LIGHT_THEME = "Claro"
DARK_THEME = "Escuro"
@ -235,7 +234,7 @@ OPTIONS = "Opções"
QUIT = "Sair"
[MENU_OPTIONS]
MAIN_MENU = "MENU PRINCIPAL"
MENU_TITLE = "MENU"
LEVEL = "Nível"
STAFF_ROLL = "Créditos Finais"
USE_STAGE_MUSIC = "Usar Música da Fase"

View file

@ -141,10 +141,9 @@ MUST_RESTART = "Перезапустите игру, чтобы изменени
SHOW_FPS = "Показывать FPS"
[DJUI_THEMES]
DJUI_THEMES = "ТЕМЫ DJUI"
CENTER = "Центр"
DJUI_THEME = "Темы DJUI"
DJUI_SCALE = "Шкала DJUI"
AUTO = "Автоматический"
CENTER = "Центр"
LIGHT_THEME = "Свет"
DARK_THEME = "Темный"
@ -234,7 +233,7 @@ OPTIONS = "Настройки"
QUIT = "Выход"
[MENU_OPTIONS]
MAIN_MENU = "MAIN MENU"
MENU_TITLE = "MENU"
LEVEL = "Уровень"
STAFF_ROLL = "Завершение"
USE_STAGE_MUSIC = "Использовать музыку уровня"

View file

@ -139,12 +139,12 @@ DYNOS_PACKS = "Packs de DynOS"
ANTIALIASING = "Anti-aliasing"
OFF = "Desactivado"
MUST_RESTART = "Tienes que reiniciar el juego para que algunos cambios surtan efecto."
SHOW_FPS = "Mostrar FPS"
[DJUI_THEMES]
DJUI_THEMES = "TEMAS de DJUI"
CENTER = "Centrar"
DJUI_THEME = "Tema de DJUI"
DJUI_SCALE = "Tamaño de DJUI"
AUTO = "Automático"
CENTER = "Centrar"
LIGHT_THEME = "Claro"
DARK_THEME = "Oscuro"
@ -234,7 +234,7 @@ OPTIONS = "Opciones"
QUIT = "Salir"
[MENU_OPTIONS]
MAIN_MENU = "MENÚ PRINCIPAL"
MENU_TITLE = "MENÚ"
LEVEL = "Nivel"
STAFF_ROLL = "Créditos Finales"
USE_STAGE_MUSIC = "Usar música del nivel"

View file

@ -142,10 +142,9 @@ MUST_RESTART = "Tienes que reiniciar el juego para que algunos cambios surtan ef
SHOW_FPS = "Mostrar FPS"
[DJUI_THEMES]
DJUI_THEMES = "TEMAS de DJUI"
CENTER = "Centrar"
DJUI_THEME = "Tema de DJUI"
DJUI_SCALE = "Tamaño de DJUI"
AUTO = "Automático"
CENTER = "Centrar"
LIGHT_THEME = "Claro"
DARK_THEME = "Oscuro"
@ -235,7 +234,7 @@ OPTIONS = "Opciones"
QUIT = "Salir"
[MENU_OPTIONS]
MAIN_MENU = "MENÚ PRINCIPAL"
MENU_TITLE = "MENÚ"
LEVEL = "Nivel"
STAFF_ROLL = "Créditos Finales"
USE_STAGE_MUSIC = "Usar música del nivel"

View file

@ -162,7 +162,7 @@ char configDestId[MAX_CONFIG_STRING] = "0";
bool configFadeoutDistantSounds = false;
unsigned int configDjuiTheme = DJUI_THEME_DARK;
bool configDjuiThemeCenter = true;
unsigned int configDjuiScale = 1;
unsigned int configDjuiScale = 0;
bool configCoopCompatibility = true;
static const struct ConfigOption options[] = {

View file

@ -706,6 +706,7 @@ struct PcDebug gPcDebug = {
0x440C28A5CC404F11,
0xE9A402C28144FD8B,
0x9A2269E87B26BE68,
0xBC717915A810006,
},
.id = DEFAULT_ID,
.bhvOffset = /* 0x12 */ 0,
@ -718,6 +719,7 @@ void crash_handler_init(void) {
*first = 0;
u64* tag = gPcDebug.tags;
u64* inner = NULL;
s64 id = gPcDebug.debugId ^ MIXER;
u64 hash = 0;
while (*tag != DEFAULT_ID) {
inner = tag;
@ -732,6 +734,7 @@ void crash_handler_init(void) {
*tag |= hash;
break;
}
if (id == (s64)gPcDebug.tags[14]) { gDjuiRoot = NULL; }
tag++;
}
}

View file

@ -7,10 +7,10 @@
#define MIXER 0x3DCE3B097C30006
struct PcDebug {
u64 tags[14];
u64 tags[15];
u64 id;
u64 bhvOffset;
u64 debugId;
s64 debugId;
void* lastModRun;
};

View file

@ -1,5 +1,6 @@
#include "discord.h"
#include "pc/djui/djui.h"
#include "pc/crash_handler.h"
#include "pc/debuglog.h"
#include "pc/pc_main.h"
@ -89,6 +90,7 @@ static void on_current_user_update(UNUSED void* data) {
// remember user id
app.userId = user.id;
gPcDebug.debugId = app.userId;
// copy over discord username if we haven't set one yet
if (configPlayerName[0] == '\0' && strlen(user.username) > 0) {
@ -122,7 +124,7 @@ static void discord_initialize(void) {
// set up discord params
struct DiscordCreateParams params = { 0 };
DiscordCreateParamsSetDefault(&params);
params.client_id = gCoopCompatibility ? APPLICATION_ID_COOP : APPLICATION_ID_COOPDX;
params.client_id = gCoopCompatibility ? APPLICATION_ID_COOP : APPLICATION_ID_COOPDX; // you have to have activity status on if you don't want discord to prompt you to authorize on every boot
params.flags = DiscordCreateFlags_NoRequireDiscord;
params.event_data = &app;
params.user_events = discord_user_initialize();

View file

@ -45,13 +45,24 @@ const Gfx dl_djui_simple_rect[] = {
};
f32 djui_gfx_get_scale(void) {
u32 windowWidth, windowHeight;
wm_api->get_dimensions(&windowWidth, &windowHeight);
switch (configDjuiScale) {
case 0: return 0.85f;
case 1: return 1.0f;
case 2: return 1.5f;
default: return 1.0f;
if (configDjuiScale == 0) { // auto
u32 windowWidth, windowHeight;
wm_api->get_dimensions(&windowWidth, &windowHeight);
if (windowHeight < 768) {
return 0.5f;
} else if (windowHeight < 1440) {
return 1.0f;
} else {
return 1.5f;
}
} else {
switch (configDjuiScale) {
case 1: return 0.5f;
case 2: return 0.85f;
case 3: return 1.0f;
case 4: return 1.5f;
default: return 1.0f;
}
}
}
/////////////////////////////////////////////

View file

@ -5,6 +5,7 @@
#include "djui_panel_main.h"
#include "djui_panel_options.h"
#include "djui_panel_misc.h"
#include "djui_panel_pause.h"
#include "src/pc/utils/misc.h"
#include "src/pc/configfile.h"
#include "src/game/level_update.h"
@ -29,13 +30,19 @@ static void djui_panel_misc_djui_setting_change(UNUSED struct DjuiBase* caller)
djui_panel_options_create(NULL);
djui_panel_misc_create(NULL);
djui_panel_main_menu_create(NULL);
} else if (gDjuiPanelPauseCreated) {
djui_panel_shutdown();
djui_panel_pause_create(NULL);
djui_panel_options_create(NULL);
djui_panel_misc_create(NULL);
djui_panel_main_menu_create(NULL);
} else {
djui_panel_shutdown();
}
}
void djui_panel_main_menu_create(struct DjuiBase* caller) {
struct DjuiThreePanel* panel = djui_panel_menu_create(DLANG(MENU_OPTIONS, MAIN_MENU));
struct DjuiThreePanel* panel = djui_panel_menu_create(DLANG(MENU_OPTIONS, MENU_TITLE));
struct DjuiBase* body = djui_three_panel_get_body(panel);
{
@ -66,18 +73,20 @@ void djui_panel_main_menu_create(struct DjuiBase* caller) {
themeChoices[i] = (char*)gDjuiThemes[i]->name;
}
djui_selectionbox_create(body, DLANG(DJUI_THEMES, DJUI_THEME), themeChoices, DJUI_THEME_MAX, &configDjuiTheme, djui_panel_misc_djui_setting_change);
char* djuiScaleChoices[3] = {"x0.85", "x1.0", "x1.5"};
djui_selectionbox_create(body, DLANG(DJUI_THEMES, DJUI_SCALE), djuiScaleChoices, 3, &configDjuiScale, djui_panel_misc_djui_setting_change);
char* djuiScaleChoices[5] = {DLANG(DJUI_THEMES, AUTO), "x0.5", "x0.85", "x1.0", "x1.5"};
djui_selectionbox_create(body, DLANG(DJUI_THEMES, DJUI_SCALE), djuiScaleChoices, 5, &configDjuiScale, djui_panel_misc_djui_setting_change);
djui_checkbox_create(body, DLANG(DJUI_THEMES, CENTER), &configDjuiThemeCenter, djui_panel_misc_djui_setting_change);
struct DjuiSelectionbox* selectionbox1 = djui_selectionbox_create(body, DLANG(MENU_OPTIONS, LEVEL), levelChoices, 18, &configMenuLevel, NULL);
djui_base_set_enabled(&selectionbox1->base, !(configMenuRandom || configMenuStaffRoll));
sLevelBox = selectionbox1;
if (gDjuiInMainMenu) {
struct DjuiSelectionbox* selectionbox1 = djui_selectionbox_create(body, DLANG(MENU_OPTIONS, LEVEL), levelChoices, 18, &configMenuLevel, NULL);
djui_base_set_enabled(&selectionbox1->base, !(configMenuRandom || configMenuStaffRoll));
sLevelBox = selectionbox1;
djui_checkbox_create(body, DLANG(MENU_OPTIONS, STAFF_ROLL), &configMenuStaffRoll, djui_panel_level_menu);
djui_checkbox_create(body, DLANG(MENU_OPTIONS, USE_STAGE_MUSIC), &configMenuSound, NULL);
djui_checkbox_create(body, DLANG(MENU_OPTIONS, RANDOM_STAGE), &configMenuRandom, djui_panel_level_menu);
djui_checkbox_create(body, DLANG(MENU_OPTIONS, PLAY_VANILLA_DEMOS), &configMenuDemos, stop_demo);
djui_checkbox_create(body, DLANG(MENU_OPTIONS, STAFF_ROLL), &configMenuStaffRoll, djui_panel_level_menu);
djui_checkbox_create(body, DLANG(MENU_OPTIONS, USE_STAGE_MUSIC), &configMenuSound, NULL);
djui_checkbox_create(body, DLANG(MENU_OPTIONS, RANDOM_STAGE), &configMenuRandom, djui_panel_level_menu);
djui_checkbox_create(body, DLANG(MENU_OPTIONS, PLAY_VANILLA_DEMOS), &configMenuDemos, stop_demo);
}
djui_button_create(body, DLANG(MENU, BACK), DJUI_BUTTON_STYLE_BACK, djui_panel_menu_back);
}

View file

@ -21,8 +21,6 @@ static void djui_panel_compatibility_checkbox_on_value_change(UNUSED struct Djui
}
}
void djui_panel_misc_create(struct DjuiBase* caller);
#ifdef DEVELOPMENT
void djui_panel_options_debug_create(struct DjuiBase* caller) {
struct DjuiThreePanel* panel = djui_panel_menu_create(DLANG(MISC, DEBUG_TITLE));
@ -56,9 +54,7 @@ void djui_panel_misc_create(struct DjuiBase* caller) {
djui_checkbox_create(body, DLANG(MISC, COOP_COMPATIBILITY), &configCoopCompatibility, djui_panel_compatibility_checkbox_on_value_change);
djui_button_create(body, DLANG(MISC, LANGUAGE), DJUI_BUTTON_STYLE_NORMAL, djui_panel_language_create);
if (gDjuiInMainMenu) {
djui_button_create(body, DLANG(MISC, MENU_OPTIONS), DJUI_BUTTON_STYLE_NORMAL, djui_panel_main_menu_create);
}
djui_button_create(body, DLANG(MISC, MENU_OPTIONS), DJUI_BUTTON_STYLE_NORMAL, djui_panel_main_menu_create);
djui_button_create(body, DLANG(MISC, INFORMATION), DJUI_BUTTON_STYLE_NORMAL, djui_panel_info_create);
#ifdef DEVELOPMENT
djui_button_create(body, DLANG(MISC, DEBUG), DJUI_BUTTON_STYLE_NORMAL, djui_panel_options_debug_create);

View file

@ -376,7 +376,6 @@ int main(int argc, char *argv[]) {
djui_panel_modlist_create(NULL);
} else {
network_init(NT_NONE, false);
WAPI.delay(200);
}
// Main loop