mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2024-11-22 03:55:11 +00:00
more loading screen fixes for non supported builds (#74)
This commit is contained in:
parent
1c495d8cd4
commit
eeebfecca4
8 changed files with 32 additions and 22 deletions
|
@ -9082,6 +9082,9 @@ WATER_STEP_HIT_WALL = 4
|
|||
--- @type integer
|
||||
WATER_STEP_NONE = 0
|
||||
|
||||
--- @type integer
|
||||
MAX_HOOKED_MOD_MENU_ELEMENTS = 256
|
||||
|
||||
--- @class LuaActionHookType
|
||||
|
||||
--- @type LuaActionHookType
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#include "pc/loading.h"
|
||||
|
||||
void DynOS_Gfx_GeneratePacks(const char* directory) {
|
||||
REFRESH_MUTEX(snprintf(gCurrLoadingSegment.str, 256, "Generating DynOS Packs In Path:\n\\#808080\\%s", directory));
|
||||
LOADING_SCREEN_MUTEX(snprintf(gCurrLoadingSegment.str, 256, "Generating DynOS Packs In Path:\n\\#808080\\%s", directory));
|
||||
|
||||
DIR *modsDir = opendir(directory);
|
||||
if (!modsDir) { return; }
|
||||
|
@ -40,7 +40,7 @@ void DynOS_Gfx_GeneratePacks(const char* directory) {
|
|||
DynOS_Tex_GeneratePack(_TexturePackFolder, _TexturePackOutputFolder, true);
|
||||
}
|
||||
|
||||
REFRESH_MUTEX(gCurrLoadingSegment.percentage = (f32) i / (f32) pathCount);
|
||||
LOADING_SCREEN_MUTEX(gCurrLoadingSegment.percentage = (f32) i / (f32) pathCount);
|
||||
}
|
||||
|
||||
closedir(modsDir);
|
||||
|
@ -59,7 +59,7 @@ static void ScanPacksFolder(SysPath _DynosPacksFolder) {
|
|||
// If pack folder exists, add it to the pack list
|
||||
SysPath _PackFolder = fstring("%s/%s", _DynosPacksFolder.c_str(), _DynosPacksEnt->d_name);
|
||||
if (fs_sys_dir_exists(_PackFolder.c_str())) {
|
||||
REFRESH_MUTEX(snprintf(gCurrLoadingSegment.str, 256, "Generating DynOS Pack:\n\\#808080\\%s", _PackFolder.c_str()));
|
||||
LOADING_SCREEN_MUTEX(snprintf(gCurrLoadingSegment.str, 256, "Generating DynOS Pack:\n\\#808080\\%s", _PackFolder.c_str()));
|
||||
DynOS_Pack_Add(_PackFolder);
|
||||
DynOS_Actor_GeneratePack(_PackFolder);
|
||||
DynOS_Tex_GeneratePack(_PackFolder, _PackFolder, false);
|
||||
|
|
|
@ -3239,6 +3239,7 @@
|
|||
<br />
|
||||
|
||||
## [smlua_hooks.h](#smlua_hooks.h)
|
||||
- MAX_HOOKED_MOD_MENU_ELEMENTS
|
||||
|
||||
### [enum LuaActionHookType](#LuaActionHookType)
|
||||
| Identifier | Value |
|
||||
|
|
|
@ -3,6 +3,8 @@
|
|||
|
||||
#include <pthread.h>
|
||||
|
||||
#include "cliopts.h"
|
||||
|
||||
struct LoadingSegment {
|
||||
char str[256];
|
||||
f32 percentage;
|
||||
|
@ -12,12 +14,19 @@ extern struct LoadingSegment gCurrLoadingSegment;
|
|||
|
||||
extern bool gIsThreaded;
|
||||
|
||||
#define REFRESH_MUTEX(...) \
|
||||
if (gIsThreaded) { \
|
||||
#if !defined(WAPI_DXGI) && !defined(WAPI_DUMMY)
|
||||
#define LOADING_SCREEN_SUPPORTED
|
||||
#endif
|
||||
|
||||
#ifdef LOADING_SCREEN_SUPPORTED
|
||||
#define LOADING_SCREEN_MUTEX(...) if (!gCLIOpts.hideLoadingScreen && gIsThreaded) { \
|
||||
pthread_mutex_lock(&gLoadingThreadMutex); \
|
||||
__VA_ARGS__; \
|
||||
pthread_mutex_unlock(&gLoadingThreadMutex); \
|
||||
} \
|
||||
}
|
||||
#else
|
||||
#define LOADING_SCREEN_MUTEX(...)
|
||||
#endif
|
||||
|
||||
extern pthread_t gLoadingThreadId;
|
||||
extern pthread_mutex_t gLoadingThreadMutex;
|
||||
|
|
|
@ -3296,6 +3296,7 @@ char gSmluaConstants[] = ""
|
|||
"ACTION_HOOK_EVERY_FRAME = 0\n"
|
||||
"ACTION_HOOK_GRAVITY = 1\n"
|
||||
"ACTION_HOOK_MAX = 2\n"
|
||||
"MAX_HOOKED_MOD_MENU_ELEMENTS = 256\n"
|
||||
"MOD_MENU_ELEMENT_BUTTON = 0\n"
|
||||
"MOD_MENU_ELEMENT_CHECKBOX = 1\n"
|
||||
"MOD_MENU_ELEMENT_SLIDER = 2\n"
|
||||
|
|
|
@ -201,8 +201,8 @@ static u32 mods_count_directory(char* modsBasePath) {
|
|||
return pathCount;
|
||||
}
|
||||
|
||||
static void mods_load(struct Mods* mods, char* modsBasePath, bool isUserModPath) {
|
||||
REFRESH_MUTEX(snprintf(gCurrLoadingSegment.str, 256, "Generating DynOS Packs In %s Mod Path:\n\\#808080\\%s", isUserModPath ? "User" : "Local", modsBasePath));
|
||||
static void mods_load(struct Mods* mods, char* modsBasePath, UNUSED bool isUserModPath) {
|
||||
LOADING_SCREEN_MUTEX(snprintf(gCurrLoadingSegment.str, 256, "Generating DynOS Packs In %s Mod Path:\n\\#808080\\%s", isUserModPath ? "User" : "Local", modsBasePath));
|
||||
|
||||
// generate bins
|
||||
dynos_generate_packs(modsBasePath);
|
||||
|
@ -230,9 +230,9 @@ static void mods_load(struct Mods* mods, char* modsBasePath, bool isUserModPath)
|
|||
LOG_ERROR("Could not open directory '%s'", modsBasePath);
|
||||
return;
|
||||
}
|
||||
f32 count = (f32) mods_count_directory(modsBasePath);
|
||||
UNUSED f32 count = (f32) mods_count_directory(modsBasePath);
|
||||
|
||||
REFRESH_MUTEX(snprintf(gCurrLoadingSegment.str, 256, "Loading Mods In %s Mod Path:\n\\#808080\\%s", isUserModPath ? "User" : "Local", modsBasePath));
|
||||
LOADING_SCREEN_MUTEX(snprintf(gCurrLoadingSegment.str, 256, "Loading Mods In %s Mod Path:\n\\#808080\\%s", isUserModPath ? "User" : "Local", modsBasePath));
|
||||
|
||||
// iterate
|
||||
char path[SYS_MAX_PATH] = { 0 };
|
||||
|
@ -241,18 +241,18 @@ static void mods_load(struct Mods* mods, char* modsBasePath, bool isUserModPath)
|
|||
// sanity check / fill path[]
|
||||
if (!directory_sanity_check(dir, modsBasePath, path)) { continue; }
|
||||
|
||||
REFRESH_MUTEX(snprintf(gCurrLoadingSegment.str, 256, "Loading Mod:\n\\#808080\\%s/%s", modsBasePath, dir->d_name));
|
||||
LOADING_SCREEN_MUTEX(snprintf(gCurrLoadingSegment.str, 256, "Loading Mod:\n\\#808080\\%s/%s", modsBasePath, dir->d_name));
|
||||
|
||||
// load the mod
|
||||
if (!mod_load(mods, modsBasePath, dir->d_name)) {
|
||||
break;
|
||||
}
|
||||
|
||||
REFRESH_MUTEX(gCurrLoadingSegment.percentage = (f32) i / count);
|
||||
LOADING_SCREEN_MUTEX(gCurrLoadingSegment.percentage = (f32) i / count);
|
||||
}
|
||||
|
||||
closedir(d);
|
||||
REFRESH_MUTEX(gCurrLoadingSegment.percentage = 1);
|
||||
LOADING_SCREEN_MUTEX(gCurrLoadingSegment.percentage = 1);
|
||||
}
|
||||
|
||||
void mods_refresh_local(void) {
|
||||
|
@ -306,7 +306,7 @@ void mods_enable(char* relativePath) {
|
|||
}
|
||||
|
||||
void mods_init(void) {
|
||||
REFRESH_MUTEX(loading_screen_set_segment_text("Caching Mods"));
|
||||
LOADING_SCREEN_MUTEX(loading_screen_set_segment_text("Caching Mods"));
|
||||
|
||||
// load mod cache
|
||||
mod_cache_load();
|
||||
|
|
|
@ -96,10 +96,6 @@ u8 gLuaVolumeEnv = 127;
|
|||
static struct AudioAPI *audio_api;
|
||||
struct GfxWindowManagerAPI *wm_api = &WAPI;
|
||||
|
||||
#if !defined(WAPI_DXGI) && !defined(WAPI_DUMMY)
|
||||
#define LOADING_SCREEN_SUPPORTED
|
||||
#endif
|
||||
|
||||
extern void gfx_run(Gfx *commands);
|
||||
extern void thread5_game_loop(void *arg);
|
||||
extern void create_next_audio_buffer(s16 *samples, u32 num_samples);
|
||||
|
@ -317,7 +313,7 @@ void* main_game_init(void* isThreaded) {
|
|||
// load language
|
||||
if (!djui_language_init(configLanguage)) { snprintf(configLanguage, MAX_CONFIG_STRING, "%s", ""); }
|
||||
|
||||
REFRESH_MUTEX(loading_screen_set_segment_text("Loading"));
|
||||
LOADING_SCREEN_MUTEX(loading_screen_set_segment_text("Loading"));
|
||||
dynos_gfx_init();
|
||||
enable_queued_dynos_packs();
|
||||
sync_objects_init_system();
|
||||
|
@ -326,13 +322,13 @@ void* main_game_init(void* isThreaded) {
|
|||
// check_for_updates();
|
||||
// }
|
||||
|
||||
REFRESH_MUTEX(loading_screen_set_segment_text("Loading ROM Assets"));
|
||||
LOADING_SCREEN_MUTEX(loading_screen_set_segment_text("Loading ROM Assets"));
|
||||
rom_assets_load();
|
||||
smlua_text_utils_init();
|
||||
|
||||
mods_init();
|
||||
enable_queued_mods();
|
||||
REFRESH_MUTEX(
|
||||
LOADING_SCREEN_MUTEX(
|
||||
gCurrLoadingSegment.percentage = 0;
|
||||
loading_screen_set_segment_text("Starting Game");
|
||||
);
|
||||
|
|
|
@ -115,7 +115,7 @@ void get_version_remote(void) {
|
|||
}
|
||||
|
||||
void check_for_updates(void) {
|
||||
REFRESH_MUTEX(loading_screen_set_segment_text("Checking For Updates"));
|
||||
LOADING_SCREEN_MUTEX(loading_screen_set_segment_text("Checking For Updates"));
|
||||
|
||||
get_version_remote();
|
||||
if (sRemoteVersion[0] != '\0' && strcmp(sRemoteVersion, get_version())) {
|
||||
|
|
Loading…
Reference in a new issue