libultraship
Reimplementations of libultra (N64 SDK) functions for modern hardware
Loading...
Searching...
No Matches
consolevariablebridge.h File Reference
#include "stdint.h"
#include "libultraship/color.h"
#include "ship/Api.h"
#include <memory>
#include "ship/config/ConsoleVariable.h"
Include dependency graph for consolevariablebridge.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void CVarSetConsoleVariable (std::shared_ptr< Ship::ConsoleVariable > consoleVariable)
 
std::shared_ptr< Ship::ConsoleVariableCVarGetConsoleVariable ()
 
std::shared_ptr< Ship::CVarCVarGet (const char *name)
 Returns a shared pointer to the CVar with the given name, or nullptr if it does not exist.
 
API_EXPORT int32_t CVarGetInteger (const char *name, int32_t defaultValue)
 Returns the integer value of the named CVar, or defaultValue if it is not set.
 
API_EXPORT float CVarGetFloat (const char *name, float defaultValue)
 Returns the float value of the named CVar, or defaultValue if it is not set.
 
API_EXPORT const char * CVarGetString (const char *name, const char *defaultValue)
 Returns the string value of the named CVar, or defaultValue if it is not set.
 
API_EXPORT Color_RGBA8 CVarGetColor (const char *name, Color_RGBA8 defaultValue)
 Returns the RGBA colour value of the named CVar, or defaultValue if it is not set.
 
API_EXPORT Color_RGB8 CVarGetColor24 (const char *name, Color_RGB8 defaultValue)
 Returns the RGB colour value of the named CVar, or defaultValue if it is not set.
 
API_EXPORT void CVarSetInteger (const char *name, int32_t value)
 Sets the named CVar to an integer value (creates it if it does not exist).
 
API_EXPORT void CVarSetFloat (const char *name, float value)
 Sets the named CVar to a float value (creates it if it does not exist).
 
API_EXPORT void CVarSetString (const char *name, const char *value)
 Sets the named CVar to a string value (creates it if it does not exist).
 
API_EXPORT void CVarSetColor (const char *name, Color_RGBA8 value)
 Sets the named CVar to an RGBA colour value (creates it if it does not exist).
 
API_EXPORT void CVarSetColor24 (const char *name, Color_RGB8 value)
 Sets the named CVar to an RGB colour value (creates it if it does not exist).
 
API_EXPORT void CVarRegisterInteger (const char *name, int32_t defaultValue)
 Registers an integer CVar with a default value if it has not been set before.
 
API_EXPORT void CVarRegisterFloat (const char *name, float defaultValue)
 Registers a float CVar with a default value if it has not been set before.
 
API_EXPORT void CVarRegisterString (const char *name, const char *defaultValue)
 Registers a string CVar with a default value if it has not been set before.
 
API_EXPORT void CVarRegisterColor (const char *name, Color_RGBA8 defaultValue)
 Registers an RGBA colour CVar with a default value if it has not been set before.
 
API_EXPORT void CVarRegisterColor24 (const char *name, Color_RGB8 defaultValue)
 Registers an RGB colour CVar with a default value if it has not been set before.
 
API_EXPORT void CVarClear (const char *name)
 Removes the named CVar from the runtime store (does not affect persisted config).
 
API_EXPORT bool CVarExists (const char *name)
 Returns true if the named CVar currently has a value in the runtime store.
 
API_EXPORT void CVarClearBlock (const char *name)
 Removes all CVars whose names begin with the given prefix.
 
API_EXPORT void CVarCopy (const char *from, const char *to)
 Copies the value of the CVar named from to a new CVar named to.
 
API_EXPORT void CVarLoad ()
 Loads all CVar values from the persisted config file into the runtime store.
 
API_EXPORT void CVarSave ()
 Saves all runtime CVar values to the persisted config file.
 

Function Documentation

◆ CVarClear()

API_EXPORT void CVarClear ( const char *  name)

Removes the named CVar from the runtime store (does not affect persisted config).

Parameters
nameCVar name to remove.

◆ CVarClearBlock()

API_EXPORT void CVarClearBlock ( const char *  name)

Removes all CVars whose names begin with the given prefix.

Parameters
namePrefix string (e.g. "gMod.").

◆ CVarCopy()

API_EXPORT void CVarCopy ( const char *  from,
const char *  to 
)

Copies the value of the CVar named from to a new CVar named to.

Parameters
fromSource CVar name.
toDestination CVar name (created if it does not exist).

◆ CVarExists()

API_EXPORT bool CVarExists ( const char *  name)

Returns true if the named CVar currently has a value in the runtime store.

Parameters
nameCVar name.

◆ CVarGet()

std::shared_ptr< Ship::CVar > CVarGet ( const char *  name)

Returns a shared pointer to the CVar with the given name, or nullptr if it does not exist.

Parameters
nameCVar name (e.g. "gMyOption").

◆ CVarGetColor()

API_EXPORT Color_RGBA8 CVarGetColor ( const char *  name,
Color_RGBA8  defaultValue 
)

Returns the RGBA colour value of the named CVar, or defaultValue if it is not set.

Parameters
nameCVar name.
defaultValueDefault RGBA colour.

◆ CVarGetColor24()

API_EXPORT Color_RGB8 CVarGetColor24 ( const char *  name,
Color_RGB8  defaultValue 
)

Returns the RGB colour value of the named CVar, or defaultValue if it is not set.

Parameters
nameCVar name.
defaultValueDefault RGB colour.

◆ CVarGetConsoleVariable()

std::shared_ptr< Ship::ConsoleVariable > CVarGetConsoleVariable ( )

◆ CVarGetFloat()

API_EXPORT float CVarGetFloat ( const char *  name,
float  defaultValue 
)

Returns the float value of the named CVar, or defaultValue if it is not set.

Parameters
nameCVar name.
defaultValueValue returned when the CVar does not exist.

◆ CVarGetInteger()

API_EXPORT int32_t CVarGetInteger ( const char *  name,
int32_t  defaultValue 
)

Returns the integer value of the named CVar, or defaultValue if it is not set.

Parameters
nameCVar name.
defaultValueValue returned when the CVar does not exist.

◆ CVarGetString()

API_EXPORT const char * CVarGetString ( const char *  name,
const char *  defaultValue 
)

Returns the string value of the named CVar, or defaultValue if it is not set.

Parameters
nameCVar name.
defaultValueValue returned when the CVar does not exist (must outlive the call).

◆ CVarLoad()

API_EXPORT void CVarLoad ( )

Loads all CVar values from the persisted config file into the runtime store.

◆ CVarRegisterColor()

API_EXPORT void CVarRegisterColor ( const char *  name,
Color_RGBA8  defaultValue 
)

Registers an RGBA colour CVar with a default value if it has not been set before.

Parameters
nameCVar name.
defaultValueDefault RGBA colour.

◆ CVarRegisterColor24()

API_EXPORT void CVarRegisterColor24 ( const char *  name,
Color_RGB8  defaultValue 
)

Registers an RGB colour CVar with a default value if it has not been set before.

Parameters
nameCVar name.
defaultValueDefault RGB colour.

◆ CVarRegisterFloat()

API_EXPORT void CVarRegisterFloat ( const char *  name,
float  defaultValue 
)

Registers a float CVar with a default value if it has not been set before.

Parameters
nameCVar name.
defaultValueDefault float value.

◆ CVarRegisterInteger()

API_EXPORT void CVarRegisterInteger ( const char *  name,
int32_t  defaultValue 
)

Registers an integer CVar with a default value if it has not been set before.

Unlike CVarSetInteger(), this is a no-op when the CVar already has a value.

Parameters
nameCVar name.
defaultValueDefault value to use when the CVar is absent.

◆ CVarRegisterString()

API_EXPORT void CVarRegisterString ( const char *  name,
const char *  defaultValue 
)

Registers a string CVar with a default value if it has not been set before.

Parameters
nameCVar name.
defaultValueDefault string value.

◆ CVarSave()

API_EXPORT void CVarSave ( )

Saves all runtime CVar values to the persisted config file.

◆ CVarSetColor()

API_EXPORT void CVarSetColor ( const char *  name,
Color_RGBA8  value 
)

Sets the named CVar to an RGBA colour value (creates it if it does not exist).

Parameters
nameCVar name.
valueNew RGBA colour.

◆ CVarSetColor24()

API_EXPORT void CVarSetColor24 ( const char *  name,
Color_RGB8  value 
)

Sets the named CVar to an RGB colour value (creates it if it does not exist).

Parameters
nameCVar name.
valueNew RGB colour.

◆ CVarSetConsoleVariable()

void CVarSetConsoleVariable ( std::shared_ptr< Ship::ConsoleVariable consoleVariable)

◆ CVarSetFloat()

API_EXPORT void CVarSetFloat ( const char *  name,
float  value 
)

Sets the named CVar to a float value (creates it if it does not exist).

Parameters
nameCVar name.
valueNew float value.

◆ CVarSetInteger()

API_EXPORT void CVarSetInteger ( const char *  name,
int32_t  value 
)

Sets the named CVar to an integer value (creates it if it does not exist).

Parameters
nameCVar name.
valueNew integer value.

◆ CVarSetString()

API_EXPORT void CVarSetString ( const char *  name,
const char *  value 
)

Sets the named CVar to a string value (creates it if it does not exist).

Parameters
nameCVar name.
valueNew string value (copied internally).