Prevent DynOS packs from being enabled then disabled on launch

This commit is contained in:
MysterD 2022-04-23 03:23:30 -07:00
parent 9e33ce39e6
commit 592df229b6
5 changed files with 20 additions and 1 deletions

View File

@ -26,6 +26,7 @@ int dynos_pack_get_count(void);
const char* dynos_pack_get_name(s32 index);
bool dynos_pack_get_enabled(s32 index);
void dynos_pack_set_enabled(s32 index, bool value);
void dynos_pack_init(void);
void dynos_generate_packs(const char* directory);
// -- geos -- //

View File

@ -452,6 +452,7 @@ struct ActorGfx {
struct PackData {
s32 mIndex;
bool mEnabled;
bool mEnabledSet;
SysPath mPath;
String mDisplayName;
Array<Pair<const char *, GfxData *>> mGfxData;
@ -730,6 +731,7 @@ void DynOS_Pack_SetEnabled(PackData* aPack, bool aEnabled);
PackData* DynOS_Pack_GetFromIndex(s32 aIndex);
PackData* DynOS_Pack_GetFromPath(const SysPath& aPath);
PackData* DynOS_Pack_Add(const SysPath& aPath);
void DynOS_Pack_Init();
Pair<const char *, GfxData *>* DynOS_Pack_GetActor(PackData* aPackData, const char* aActorName);
void DynOS_Pack_AddActor(PackData* aPackData, const char* aActorName, GfxData* aGfxData);

View File

@ -75,6 +75,10 @@ void dynos_pack_set_enabled(s32 index, bool value) {
}
}
void dynos_pack_init(void) {
DynOS_Pack_Init();
}
void dynos_generate_packs(const char* directory) {
DynOS_Gfx_GeneratePacks(directory);
}

View File

@ -64,6 +64,7 @@ s32 DynOS_Pack_GetCount() {
void DynOS_Pack_SetEnabled(PackData* aPack, bool aEnabled) {
if (aPack == NULL) { return; }
aPack->mEnabled = aEnabled;
aPack->mEnabledSet = true;
if (aEnabled) {
for (auto& pair : aPack->mGfxData) {
@ -121,11 +122,20 @@ PackData* DynOS_Pack_Add(const SysPath& aPath) {
}
_Pack->mDisplayName = cpath;
DynOS_Pack_SetEnabled(_Pack, true);
_Pack->mEnabled = true;
_Pack->mEnabledSet = false;
return _Pack;
}
void DynOS_Pack_Init() {
for (auto& pack : DynosPacks()) {
if (!pack.mEnabledSet) {
DynOS_Pack_SetEnabled(&pack, pack.mEnabled);
}
}
}
Pair<const char *, GfxData *>* DynOS_Pack_GetActor(PackData* aPackData, const char* aActorName) {
if (aPackData == NULL || aActorName == NULL) {
return NULL;

View File

@ -222,6 +222,8 @@ void main_func(void) {
mods_init();
configfile_load(configfile_name());
dynos_pack_init();
if (configPlayerModel >= CT_MAX) { configPlayerModel = 0; }
if (configPlayerPalette >= PALETTE_MAX) { configPlayerPalette = 0; }