sm64coopdx/src/pc/configfile.h
Isaac0-dev 4aa2a20f72
fixes, clean up and some new features (#259)
- 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`.
2024-09-12 19:09:01 +10:00

150 lines
5.2 KiB
C

#ifndef CONFIGFILE_H
#define CONFIGFILE_H
#include <stdbool.h>
#include <PR/ultratypes.h>
#include "game/player_palette.h"
#define CONFIGFILE_DEFAULT "sm64config.txt"
#define CONFIGFILE_BACKUP "sm64config-backup.txt"
#define MAX_BINDS 3
#define MAX_VOLUME 127
#define MAX_CONFIG_STRING 64
#define MAX_SAVE_NAME_STRING 32
#define DEFAULT_PORT 7777
#define DEFAULT_COOPNET_IP "net.coop64.us"
#define DEFAULT_COOPNET_PORT 34197
typedef struct {
unsigned int x, y, w, h;
bool vsync;
bool reset;
bool fullscreen;
bool exiting_fullscreen;
bool settings_changed;
unsigned int msaa;
} ConfigWindow;
extern char configSaveNames[4][MAX_SAVE_NAME_STRING];
// display settings
extern ConfigWindow configWindow;
extern unsigned int configFiltering;
extern bool configShowFPS;
extern bool configUncappedFramerate;
extern unsigned int configFrameLimit;
extern unsigned int configInterpolationMode;
extern unsigned int configDrawDistance;
// sound settings
extern unsigned int configMasterVolume;
extern unsigned int configMusicVolume;
extern unsigned int configSfxVolume;
extern unsigned int configEnvVolume;
extern bool configFadeoutDistantSounds;
extern bool configMuteFocusLoss;
// control binds
extern unsigned int configKeyA[MAX_BINDS];
extern unsigned int configKeyB[MAX_BINDS];
extern unsigned int configKeyX[MAX_BINDS];
extern unsigned int configKeyY[MAX_BINDS];
extern unsigned int configKeyStart[MAX_BINDS];
extern unsigned int configKeyL[MAX_BINDS];
extern unsigned int configKeyR[MAX_BINDS];
extern unsigned int configKeyZ[MAX_BINDS];
extern unsigned int configKeyCUp[MAX_BINDS];
extern unsigned int configKeyCDown[MAX_BINDS];
extern unsigned int configKeyCLeft[MAX_BINDS];
extern unsigned int configKeyCRight[MAX_BINDS];
extern unsigned int configKeyStickUp[MAX_BINDS];
extern unsigned int configKeyStickDown[MAX_BINDS];
extern unsigned int configKeyStickLeft[MAX_BINDS];
extern unsigned int configKeyStickRight[MAX_BINDS];
extern unsigned int configKeyChat[MAX_BINDS];
extern unsigned int configKeyPlayerList[MAX_BINDS];
extern unsigned int configKeyDUp[MAX_BINDS];
extern unsigned int configKeyDDown[MAX_BINDS];
extern unsigned int configKeyDLeft[MAX_BINDS];
extern unsigned int configKeyDRight[MAX_BINDS];
extern unsigned int configKeyConsole[MAX_BINDS];
extern unsigned int configKeyPrevPage[MAX_BINDS];
extern unsigned int configKeyNextPage[MAX_BINDS];
extern unsigned int configKeyDisconnect[MAX_BINDS];
extern unsigned int configStickDeadzone;
extern unsigned int configRumbleStrength;
extern unsigned int configGamepadNumber;
extern bool configBackgroundGamepad;
extern bool configDisableGamepads;
extern bool configUseStandardKeyBindingsChat;
// free camera settings
extern bool configEnableCamera;
extern bool configCameraAnalog;
extern bool configCameraMouse;
extern bool configCameraInvertX;
extern bool configCameraInvertY;
extern unsigned int configCameraXSens;
extern unsigned int configCameraYSens;
extern unsigned int configCameraAggr;
extern unsigned int configCameraPan;
extern unsigned int configCameraDegrade;
// debug
extern bool configLuaProfiler;
extern bool configDebugPrint;
extern bool configDebugInfo;
extern bool configDebugError;
#ifdef DEVELOPMENT
extern bool configCtxProfiler;
#endif
// player settings
extern char configPlayerName[MAX_CONFIG_STRING];
extern unsigned int configPlayerModel;
extern struct PlayerPalette configPlayerPalette;
// coop settings
extern unsigned int configAmountofPlayers;
extern bool configBubbleDeath;
extern unsigned int configHostPort;
extern unsigned int configHostSaveSlot;
extern char configJoinIp[MAX_CONFIG_STRING];
extern unsigned int configJoinPort;
extern unsigned int configNetworkSystem;
extern unsigned int configPlayerInteraction;
extern unsigned int configPlayerKnockbackStrength;
extern unsigned int configStayInLevelAfterStar;
extern bool configNametags;
extern unsigned int configBouncyLevelBounds;
extern bool configSkipIntro;
extern bool configPauseAnywhere;
extern bool configMenuStaffRoll;
extern unsigned int configMenuLevel;
extern unsigned int configMenuSound;
extern bool configMenuRandom;
extern bool configMenuDemos;
extern bool configDisablePopups;
extern char configLanguage[MAX_CONFIG_STRING];
extern bool configDynosLocalPlayerModelOnly;
// CoopNet settings
extern char configCoopNetIp[MAX_CONFIG_STRING];
extern unsigned int configCoopNetPort;
extern char configPassword[MAX_CONFIG_STRING];
extern char configDestId[MAX_CONFIG_STRING];
// DJUI settings
extern unsigned int configDjuiTheme;
extern bool configDjuiThemeCenter;
extern unsigned int configDjuiThemeFont;
extern unsigned int configDjuiScale;
// other
extern unsigned int configRulesVersion;
extern bool configCompressOnStartup;
// secrets
extern bool configExCoopTheme;
void enable_queued_mods(void);
void enable_queued_dynos_packs(void);
void configfile_load(void);
void configfile_save(const char *filename);
const char *configfile_name(void);
const char *configfile_backup_name(void);
#endif // CONFIGFILE_H