mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2024-11-24 13:05:12 +00:00
4aa2a20f72
- Only inited `smlua_audio_utils` if needed, since there will probably be plenty of people who play without ever using mods with custom audio. - Fixed the pause anywhere setting - this ended up not being fully accurate to ex-coop, which it was originally intended to be. - Stopped regenerating dynos collision bin on start up every time therefore giving a slight start up speed boost for some people. - Added a config file setting that lets people choose to compress dynos bins on startup (disabled by default). - Fixed a warning that shows on non macs during compiling. - Properly fixed the chat box focus. - Made the public lobby rules panel "temporary". - Added a cleaner loading screen design. - Added an ex-coop theme easter egg, can only be activated from the config file. - Cleaned up the Lua traceback logging, now shows the folder and file the error occurred in, rather than the full path. - Added a way to set `gCheckingSurfaceCollisionsForCamera`, so mods can specify to surface finding functions to ignore `SURFACE_FLAG_NO_CAM_COLLISION` internally. - Rewrote the way smlua pushes CObjects/CPointers to Lua. Now using the C Lua API entirely to connect to Lua. - Fixed a use-after-free bug that could easily crash the game through Lua (explained further in one of my comments below). - Fixed a common crash in `audio_sanity_check`.
85 lines
3.2 KiB
C++
85 lines
3.2 KiB
C++
#include "dynos.cpp.h"
|
|
extern "C" {
|
|
#include "pc/loading.h"
|
|
}
|
|
|
|
void DynOS_Gfx_GeneratePacks(const char* directory) {
|
|
LOADING_SCREEN_MUTEX(
|
|
loading_screen_reset_progress_bar();
|
|
snprintf(gCurrLoadingSegment.str, 256, "Generating DynOS Packs In Path:\n\\#808080\\%s", directory);
|
|
);
|
|
|
|
DIR *modsDir = opendir(directory);
|
|
if (!modsDir) { return; }
|
|
|
|
struct dirent *dir = NULL;
|
|
DIR* d = opendir(directory);
|
|
u32 pathCount = 0;
|
|
while ((dir = readdir(d)) != NULL) pathCount++;
|
|
closedir(d);
|
|
|
|
for (u32 i = 0; (dir = readdir(modsDir)) != NULL; ++i) {
|
|
// Skip . and ..
|
|
if (SysPath(dir->d_name) == ".") continue;
|
|
if (SysPath(dir->d_name) == "..") continue;
|
|
|
|
// If pack folder exists, generate bins
|
|
SysPath _LevelPackFolder = fstring("%s/%s/levels", directory, dir->d_name);
|
|
if (fs_sys_dir_exists(_LevelPackFolder.c_str())) {
|
|
DynOS_Lvl_GeneratePack(_LevelPackFolder);
|
|
}
|
|
|
|
SysPath _ActorPackFolder = fstring("%s/%s/actors", directory, dir->d_name);
|
|
if (fs_sys_dir_exists(_ActorPackFolder.c_str())) {
|
|
DynOS_Actor_GeneratePack(_ActorPackFolder);
|
|
}
|
|
|
|
SysPath _BehaviorPackFolder = fstring("%s/%s/data", directory, dir->d_name);
|
|
if (fs_sys_dir_exists(_BehaviorPackFolder.c_str())) {
|
|
DynOS_Bhv_GeneratePack(_BehaviorPackFolder);
|
|
}
|
|
|
|
SysPath _TexturePackFolder = fstring("%s/%s", directory, dir->d_name);
|
|
SysPath _TexturePackOutputFolder = fstring("%s/%s/textures", directory, dir->d_name);
|
|
if (fs_sys_dir_exists(_TexturePackFolder.c_str())) {
|
|
DynOS_Tex_GeneratePack(_TexturePackFolder, _TexturePackOutputFolder, true);
|
|
}
|
|
|
|
LOADING_SCREEN_MUTEX(gCurrLoadingSegment.percentage = (f32) i / (f32) pathCount);
|
|
}
|
|
|
|
closedir(modsDir);
|
|
}
|
|
|
|
static void ScanPacksFolder(SysPath _DynosPacksFolder) {
|
|
DIR *_DynosPacksDir = opendir(_DynosPacksFolder.c_str());
|
|
if (_DynosPacksDir) {
|
|
struct dirent *_DynosPacksEnt = NULL;
|
|
while ((_DynosPacksEnt = readdir(_DynosPacksDir)) != NULL) {
|
|
|
|
// Skip . and ..
|
|
if (SysPath(_DynosPacksEnt->d_name) == ".") continue;
|
|
if (SysPath(_DynosPacksEnt->d_name) == "..") continue;
|
|
|
|
// 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())) {
|
|
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);
|
|
}
|
|
}
|
|
closedir(_DynosPacksDir);
|
|
}
|
|
}
|
|
|
|
void DynOS_Gfx_Init() {
|
|
// Scan the DynOS packs folder
|
|
SysPath _DynosPacksFolder = fstring("%s/%s", DYNOS_EXE_FOLDER, DYNOS_PACKS_FOLDER);
|
|
ScanPacksFolder(_DynosPacksFolder);
|
|
|
|
// Scan the user path folder
|
|
SysPath _DynosPacksUserFolder = fstring("%s%s", DYNOS_USER_FOLDER, DYNOS_PACKS_FOLDER);
|
|
ScanPacksFolder(_DynosPacksUserFolder);
|
|
}
|