mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2024-11-22 03:55:11 +00:00
Implemented dynos model packs into configfile
This commit is contained in:
parent
e81808c314
commit
bc0868e80e
5 changed files with 44 additions and 7 deletions
|
@ -51,6 +51,10 @@ Array<String> DynOS_Gfx_Init() {
|
|||
|
||||
// Add pack to pack list
|
||||
pDynosPacks.Add(_Pack);
|
||||
#ifdef COOP
|
||||
// Add enabled flag
|
||||
DynOS_Gfx_GetPacksEnabled().Add(true);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
closedir(_DynosPacksDir);
|
||||
|
|
|
@ -106,9 +106,6 @@ void DynOS_Gfx_Update() {
|
|||
#ifdef COOP
|
||||
Array<bool> &_Enabled = DynOS_Gfx_GetPacksEnabled();
|
||||
const Array<PackData *> &pDynosPacks = DynOS_Gfx_GetPacks();
|
||||
while (_Enabled.Count() < pDynosPacks.Count()) {
|
||||
_Enabled.Add(true);
|
||||
}
|
||||
#else
|
||||
Array<bool> _Enabled;
|
||||
const Array<PackData *> &pDynosPacks = DynOS_Gfx_GetPacks();
|
||||
|
|
|
@ -332,6 +332,12 @@ extern "C" {
|
|||
#define STBIDEF extern
|
||||
#endif
|
||||
|
||||
#ifdef __GNUC__
|
||||
#define UNUSED __attribute__((unused))
|
||||
#else
|
||||
#define UNUSED
|
||||
#endif
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// PRIMARY API - works on images of any type
|
||||
|
@ -6336,7 +6342,7 @@ static stbi_uc *stbi__process_gif_raster(stbi__context *s, stbi__gif *g)
|
|||
|
||||
// this function is designed to support animated gifs, although stb_image doesn't support it
|
||||
// two back is the image from two frames ago, used for a very specific disposal format
|
||||
static stbi_uc *stbi__gif_load_next(stbi__context *s, stbi__gif *g, int *comp, int req_comp, stbi_uc *two_back)
|
||||
static stbi_uc *stbi__gif_load_next(stbi__context *s, stbi__gif *g, int *comp, UNUSED int req_comp, UNUSED stbi_uc *two_back)
|
||||
{
|
||||
int dispose;
|
||||
int first_frame;
|
||||
|
@ -6560,7 +6566,7 @@ static void *stbi__load_gif_main(stbi__context *s, int **delays, int *x, int *y,
|
|||
}
|
||||
}
|
||||
|
||||
static void *stbi__gif_load(stbi__context *s, int *x, int *y, int *comp, int req_comp, stbi__result_info *ri)
|
||||
static void *stbi__gif_load(stbi__context *s, int *x, int *y, int *comp, int req_comp, UNUSED stbi__result_info *ri)
|
||||
{
|
||||
stbi_uc *u = 0;
|
||||
stbi__gif g;
|
||||
|
|
|
@ -246,9 +246,38 @@ static void ban_write(FILE* file) {
|
|||
}
|
||||
}
|
||||
|
||||
static void dynos_pack_read(char** tokens, UNUSED int numTokens) {
|
||||
if (numTokens < 3) { return; }
|
||||
char fullPackName[256] = { 0 };
|
||||
for (int i = 1; i < numTokens - 1; i++) {
|
||||
strncat(fullPackName, tokens[i], 255);
|
||||
}
|
||||
|
||||
bool enabled = !(strcmp(tokens[numTokens-1], "true"));
|
||||
int packCount = dynos_packs_get_count();
|
||||
|
||||
for (int i = 0; i < packCount; i++) {
|
||||
const char* pack = dynos_packs_get(i);
|
||||
if (!strcmp(fullPackName, pack)) {
|
||||
dynos_packs_set_enabled(i, enabled);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void dynos_pack_write(FILE* file) {
|
||||
int packCount = dynos_packs_get_count();
|
||||
for (int i = 0; i < packCount; i++) {
|
||||
bool enabled = dynos_packs_get_enabled(i);
|
||||
const char* pack = dynos_packs_get(i);
|
||||
fprintf(file, "%s %s %s\n", "dynos-pack:", pack, enabled ? "true" : "false");
|
||||
}
|
||||
}
|
||||
|
||||
static const struct FunctionConfigOption functionOptions[] = {
|
||||
{ .name = "enable-mod:", .read = enable_mod_read, .write = enable_mod_write },
|
||||
{ .name = "ban:", .read = ban_read, .write = ban_write },
|
||||
{ .name = "dynos-pack:", .read = dynos_pack_read, .write = dynos_pack_write },
|
||||
};
|
||||
|
||||
// Reads an entire line from a file (excluding the newline character) and returns an allocated string
|
||||
|
|
|
@ -447,6 +447,7 @@ static CRASH_HANDLER_TYPE crash_handler(EXCEPTION_POINTERS *ExceptionInfo) {
|
|||
|
||||
crash_handler_add_info_int(&pText, 380, -4 + (8 * 0), "Id", (int)gPcDebug.id & 0xFF);
|
||||
crash_handler_add_info_int(&pText, 380, -4 + (8 * 1), "Ofs", (int)gPcDebug.bhvOffset & 0xFF);
|
||||
extern s16 gPrevFrameObjectCount;
|
||||
crash_handler_add_info_int(&pText, 315, -4 + (8 * 4), "Objs", gPrevFrameObjectCount);
|
||||
|
||||
int modCount = 0;
|
||||
|
@ -463,8 +464,8 @@ static CRASH_HANDLER_TYPE crash_handler(EXCEPTION_POINTERS *ExceptionInfo) {
|
|||
for (int i = 0; i < gModTableCurrent->entryCount; i++) {
|
||||
struct ModListEntry* entry = &gModTableCurrent->entries[i];
|
||||
if (entry == NULL || !entry->enabled) { continue; }
|
||||
u8 b = (gPcDebug.lastModRun == entry) ? 0 : 0xFF;
|
||||
crash_handler_set_text(x, y, 0xFF, 0xFF, 200, "%.21s", entry->name);
|
||||
u8 g = (gPcDebug.lastModRun == entry) ? 0 : 0xFF;
|
||||
crash_handler_set_text(x, y, 0xFF, g, 200, "%.21s", entry->name);
|
||||
y += 8;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue