Update loading screen

This commit is contained in:
Agent X 2023-11-06 18:51:08 -05:00
parent 521b0ab7a9
commit f58127a0bc
4 changed files with 20 additions and 21 deletions

View file

@ -10,11 +10,13 @@
#include "loading.h"
#include "pc/utils/misc.h"
extern ALIGNED8 u8 texture_coopdx_logo[];
struct LoadingSegment gCurrLoadingSegment = { "", 0 };
struct LoadingScreen {
struct DjuiBase base;
struct DjuiText* splashText;
struct DjuiImage* splashImage;
struct DjuiText* loadingText;
struct DjuiText* loadingDesc;
struct DjuiProgressBar *loadingBar;
@ -29,8 +31,7 @@ bool gIsThreaded = false;
extern Vp D_8032CF00;
extern u8 gRenderingInterpolated;
static void loading_screen_produce_one_frame() {
static void loading_screen_produce_one_frame(void) {
// Start frame
gfx_start_frame();
config_gfx_pool();
@ -73,9 +74,6 @@ static bool loading_screen_on_render(struct DjuiBase* base) {
// Fill the screen
djui_base_set_size(base, windowWidth, windowHeight);
// Splash text
djui_base_set_location(&sLoading->splashText->base, (windowWidth / 2) - 416, 0);
{
// Loading... text
char* loadingStr = DLANG(LOADING_SCREEN, LOADING);
@ -120,21 +118,20 @@ static void loading_screen_destroy(struct DjuiBase* base) {
sLoading = NULL;
}
void render_loading_screen() {
void render_loading_screen(void) {
struct LoadingScreen* load = malloc(sizeof(struct LoadingScreen));
struct DjuiBase* base = &load->base;
djui_base_init(NULL, base, loading_screen_on_render, loading_screen_destroy);
{
// Splash text
struct DjuiText* splashDjuiText = djui_text_create(base, "\\#ff0800\\SM\\#1be700\\64\\#00b3ff\\EX\\#ffef00\\COOP");
djui_text_set_font(splashDjuiText, gDjuiFonts[1]);
djui_text_set_font_scale(splashDjuiText, gDjuiFonts[1]->defaultFontScale * 4);
djui_text_set_alignment(splashDjuiText, DJUI_HALIGN_CENTER, DJUI_VALIGN_TOP);
djui_base_set_size(&splashDjuiText->base, 800, 800);
// Splash image
struct DjuiImage* splashImage = djui_image_create(base, texture_coopdx_logo, 2048, 1024, 32);
djui_base_set_size(&splashImage->base, 740.0f, 364.0f);
djui_base_set_alignment(&splashImage->base, DJUI_HALIGN_CENTER, DJUI_VALIGN_CENTER);
djui_base_set_location(&splashImage->base, 0, -100);
load->splashText = splashDjuiText;
load->splashImage = splashImage;
}
{
@ -143,7 +140,7 @@ void render_loading_screen() {
djui_base_set_size_type(&text->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE);
djui_base_set_size(&text->base, 1.0f, 32 * 4);
djui_base_set_color(&text->base, 200, 200, 200, 255);
djui_base_set_location(&text->base, 0, 400);
djui_base_set_location(&text->base, 0, 800);
djui_text_set_alignment(text, DJUI_HALIGN_CENTER, DJUI_VALIGN_CENTER);
djui_text_set_font(text, gDjuiFonts[0]);
djui_text_set_font_scale(text, gDjuiFonts[0]->defaultFontScale * 2);

View file

@ -20,6 +20,6 @@ extern pthread_mutex_t gLoadingThreadMutex;
extern bool gIsThreaded;
void render_loading_screen();
void render_loading_screen(void);
#endif

View file

@ -157,7 +157,7 @@ static u32 mods_count_directory(char* modsBasePath) {
}
static void mods_load(struct Mods* mods, char* modsBasePath, bool isUserModPath) {
if (gIsThreaded) { REFRESH_MUTEX(snprintf(gCurrLoadingSegment.str, 256, "Generating DynOS Packs in %s mod path (%s)", isUserModPath ? "user" : "local", modsBasePath)); }
if (gIsThreaded) { REFRESH_MUTEX(snprintf(gCurrLoadingSegment.str, 256, "Generating DynOS Packs In %s Path (%s)", isUserModPath ? "User" : "Local", modsBasePath)); }
// generate bins
dynos_generate_packs(modsBasePath);
@ -186,7 +186,7 @@ static void mods_load(struct Mods* mods, char* modsBasePath, bool isUserModPath)
return;
}
f32 count = (f32) mods_count_directory(modsBasePath);
if (gIsThreaded) { REFRESH_MUTEX(snprintf(gCurrLoadingSegment.str, 256, "Loading Mods in %s mod path (%s)", isUserModPath ? "user" : "local", modsBasePath)); }
if (gIsThreaded) { REFRESH_MUTEX(snprintf(gCurrLoadingSegment.str, 256, "Loading Mods In %s Mod Path (%s)", isUserModPath ? "User" : "Local", modsBasePath)); }
// iterate
char path[SYS_MAX_PATH] = { 0 };
@ -257,7 +257,7 @@ void mods_enable(char* relativePath) {
}
void mods_init(void) {
if (gIsThreaded) { REFRESH_MUTEX(snprintf(gCurrLoadingSegment.str, 256, "Caching mods")); }
if (gIsThreaded) { REFRESH_MUTEX(snprintf(gCurrLoadingSegment.str, 256, "Caching Mods")); }
// load mod cache
mod_cache_load();

View file

@ -278,12 +278,13 @@ void *main_game_init(void*) {
if (gIsThreaded) {
REFRESH_MUTEX(
gCurrLoadingSegment.percentage = 0;
snprintf(gCurrLoadingSegment.str, 256, "Starting game");
snprintf(gCurrLoadingSegment.str, 256, "Starting Game");
);
}
// If coop_custom_palette_* values are not found in sm64config.txt, the custom palette config will use the default values (Mario's palette)
// But if no preset is found, that means the current palette is a custom palette
// This is so terrible
for (int i = 0; i <= PALETTE_PRESET_MAX; i++) {
if (i == PALETTE_PRESET_MAX) {
configCustomPalette = configPlayerPalette;
@ -301,7 +302,6 @@ void *main_game_init(void*) {
if (gCLIOpts.PlayerName[0] != '\0') {
snprintf(configPlayerName, MAX_PLAYER_STRING, "%s", gCLIOpts.PlayerName);
printf("\nCustom Playername (Start-Parameter): %s\n\n", configPlayerName);
}
if (!gGfxInited) {
@ -373,6 +373,8 @@ int main(int argc, char *argv[]) {
network_init(NT_NONE, false);
}
WAPI.delay(200);
// Main loop
while (true) {
debug_context_reset();