Professional Documents
Culture Documents
Loot Api: Generated by Doxygen 1.8.10
Loot Api: Generated by Doxygen 1.8.10
CONTENTS
Contents
1
Main Page
1.1
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
1.2
Credits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
1.3
Version History . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2.1
Data Structures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
File Index
3.1
File List . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.1
4.1.1
Detailed Description
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.1.2
Field Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
File Documentation
5.1
5.1.1
Detailed Description
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5.1.2
Variable Types
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5.1.3
Memory Management
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5.1.4
Typedef Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5.1.5
Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5.1.6
Variable Documentation
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Index
13
17
Main Page
Author
WrinklyNinja
Version
0.8.1
Copyright
The LOOT API is distributed under the GNU General Public License v3.0. For the full text of the license, see
the "GNU GPL v3.txt" file included in the source archive.
1.1
Introduction
LOOT is a utility that helps users avoid serious conflicts between their mods by setting their plugins in an optimal
load order. It also provides tens of thousands of plugin-specific messages, including usage notes, requirements,
CONTENTS
incompatibilities, bug warnings and installation mistake notifications, and thousands of Bash Tag suggestions.
This metadata that LOOT supplies is stored in its masterlist, which is maintained by the LOOT team using information provided by mod authors and users. Users can also add to and modify the metadata used by LOOT through
the use of userlist files. The LOOT API provides a way for third-party developers to access this metadata for use in
their own programs.
All further API documentation is contained within the documentation for api.h.
1.2
Credits
The LOOT API is written by WrinklyNinja in C/C++ and makes use of the Boost, libespm, libgit2,
libloadorder, Pseudosem and yaml-cpp libraries. Copyright license information for all these may be
found in the "docs/licenses/Licenses.txt" file.
1.3
Version History
non-
2.1
Data Structures
File Index
3.1
File List
4.1
A structure that holds the type of a message and the message string itself.
#include <api.h>
Data Fields
unsigned int type
const char message
4.1.1
Detailed Description
A structure that holds the type of a message and the message string itself.
4.1.2
Field Documentation
4.1.2.1
message
The message string, which may be formatted using GitHub Flavored Markdown.
4.1.2.2
type
The type of the message, specified using one of the message type codes.
The documentation for this struct was generated from the following file:
api.h
File Documentation
5.1
CONTENTS
#include <stddef.h>
#include <stdbool.h>
Data Structures
struct loot_message
A structure that holds the type of a message and the message string itself.
Typedefs
typedef struct _loot_db_int loot_db
A structure that holds all game-specific data used by the API.
Functions
Error Handling Functions
unsigned int loot_get_error_message (const char const message)
Returns the message for the last error or warning encountered.
void loot_cleanup ()
Frees the memory allocated to the last error details string.
Version Functions
bool loot_is_compatible (const unsigned int versionMajor, const unsigned int versionMinor, const unsigned
int versionPatch)
Checks for API compatibility.
unsigned int loot_get_version (unsigned int const versionMajor, unsigned int const versionMinor, unsigned int const versionPatch)
Gets the API version.
5.1
Calculates a new load order for the game's installed plugins (including inactive plugins) and outputs the sorted
order.
unsigned int loot_apply_load_order (loot_db db, const char const const loadOrder, const size_t numPlugins)
Applies the given load order.
unsigned int loot_update_masterlist (loot_db db, const char const masterlistPath, const char const
remoteURL, const char const remoteBranch, bool const updated)
Update the given masterlist.
unsigned int loot_get_masterlist_revision (loot_db db, const char const masterlistPath, const bool getShortID, char const revisionID, char const revisionDate, bool const isModified)
Get the given masterlist's revision.
unsigned int loot_get_plugin_tags (loot_db db, const char const plugin, unsigned int const tags_added,
size_t const numTags_added, unsigned int const tags_removed, size_t const numTags_removed,
bool const userlistModified)
Outputs the Bash Tags suggested for addition and removal by the database for the given plugin.
unsigned int loot_get_plugin_messages (loot_db db, const char const plugin, loot_message const messages, size_t const numMessages)
Outputs the messages associated with the given plugin in the database.
unsigned int loot_get_dirty_info (loot_db db, const char const plugin, unsigned int const needsCleaning)
Determines the database's knowledge of a plugin's dirtiness.
unsigned int loot_write_minimal_list (loot_db db, const char const outputFile, const bool overwrite)
Writes a minimal metadata file that only contains plugins with Bash Tag suggestions and/or dirty info, plus the
suggestions and info themselves.
Variables
Return Codes
Error codes signify an issue that caused a function to exit prematurely. If a function exits prematurely, a reversal
of any changes made during its execution is attempted before it exits.
Game Codes
Used with loot_create_db().
CONTENTS
5.1.1
Detailed Description
5.1.2
Variable Types
The LOOT API uses character strings and integers for information input/output.
All strings are null-terminated byte character strings encoded in UTF-8.
All codes are unsigned integers at least 16 bits in size.
All array sizes are unsigned integers at least 16 bits in size.
File paths are case-sensitive if and only if the underlying file system is case-sensitive.
5.1.3
Memory Management
The LOOT API manages the memory of strings and arrays it returns, so such strings and arrays should not be
deallocated by the client.
Data returned by a function lasts until a function is called which returns data of the same type (eg. a string is
stored until the client calls another function which returns a string, an integer array lasts until another integer array
is returned, etc.).
All allocated memory is freed when loot_destroy_db() is called, except the string allocated by loot_get_error_message(), which must be freed by calling loot_cleanup().
5.1
5.1.4
Typedef Documentation
typedef struct _loot_db_int loot_db
5.1.4.1
5.1.5
Function Documentation
unsigned int loot_apply_load_order ( loot_db db, const char const const loadOrder, const size_t numPlugins )
5.1.5.1
Returns
A return code.
5.1.5.2
unsigned int loot_create_db ( loot_db const db, const unsigned int clientGame, const char const gamePath, const
char const gameLocalPath )
Returns
A return code.
5.1.5.3
CONTENTS
Parameters
db
5.1.5.4
Returns
A return code.
5.1.5.5
Get the Git revision of the code from which the binary was built.
Parameters
revision
Returns
A return code.
5.1.5.6
unsigned int loot_get_dirty_info ( loot_db db, const char const plugin, unsigned int const needsCleaning )
Returns
A return code.
5.1.5.7
5.1
Parameters
message
Returns
A return code.
unsigned int loot_get_masterlist_revision ( loot_db db, const char const masterlistPath, const bool getShortID,
char const revisionID, char const revisionDate, bool const isModified )
5.1.5.8
Returns
A return code.
5.1.5.9
unsigned int loot_get_plugin_messages ( loot_db db, const char const plugin, loot_message const messages,
size_t const numMessages )
Outputs the messages associated with the given plugin in the database.
Parameters
db
plugin
messages
numMessages
Returns
A return code.
5.1.5.10
unsigned int loot_get_plugin_tags ( loot_db db, const char const plugin, unsigned int const tags_added,
size_t const numTags_added, unsigned int const tags_removed, size_t const numTags_removed, bool const
userlistModified )
Outputs the Bash Tags suggested for addition and removal by the database for the given plugin.
loot_get_tag_map() must be called before this to ensure that the Bash Tag UIDs outputted by this function can be
matched up to name strings.
10
CONTENTS
Parameters
db
plugin
tags_added
numTags_added
tags_removed
numTags_removed
userlistModified
true if the Bash Tag suggestions were modified by the data in the userlist, false otherwise.
Returns
A return code.
5.1.5.11
unsigned int loot_get_tag_map ( loot_db db, char const tagMap, size_t const numTags )
Outputs an array of the Bash Tags that are suggested in the database.
This function must be called prior to calling loot_get_plugin_tags() to ensure that the latter can return the Tags using
the correct array indicies.
Parameters
db
tagMap
numTags
Returns
A return code.
5.1.5.12
unsigned int loot_get_version ( unsigned int const versionMajor, unsigned int const versionMinor, unsigned int
const versionPatch )
Gets the API version.
Outputs the major, minor and patch version numbers for the loaded API. The version numbering used is major.minor.patch.
Parameters
versionMajor
versionMinor
versionPatch
Returns
A return code.
5.1.5.13
bool loot_is_compatible ( const unsigned int versionMajor, const unsigned int versionMinor, const unsigned int
versionPatch )
5.1
11
Checks whether the loaded API is compatible with the given version of the API, abstracting API stability policy away
from clients. The version numbering used is major.minor.patch.
12
CONTENTS
Parameters
versionMajor
versionMinor
versionPatch
Returns
True if the API versions are compatible, false otherwise.
5.1.5.14
unsigned int loot_load_lists ( loot_db db, const char const masterlistPath, const char const userlistPath )
Returns
A return code.
5.1.5.15
unsigned int loot_sort_plugins ( loot_db db, char const sortedPlugins, size_t const numPlugins )
Calculates a new load order for the game's installed plugins (including inactive plugins) and outputs the sorted order.
Pulls metadata from the masterlist and userlist if they are loaded, and reads the contents of each plugin. No
changes are applied to the load order used by the game. This function does not load or evaluate the masterlist or
userlist.
Parameters
db
sortedPlugins
numPlugins
Returns
A return code.
5.1.5.16
unsigned int loot_update_masterlist ( loot_db db, const char const masterlistPath, const char const remoteURL,
const char const remoteBranch, bool const updated )
5.1
13
Parameters
db
masterlistPath
remoteURL
remoteBranch
updated
Returns
A return code.
5.1.5.17
unsigned int loot_write_minimal_list ( loot_db db, const char const outputFile, const bool overwrite )
Writes a minimal metadata file that only contains plugins with Bash Tag suggestions and/or dirty info, plus the
suggestions and info themselves.
Parameters
db
outputFile
overwrite
Returns
A return code.
5.1.6
5.1.6.1
Variable Documentation
const unsigned int loot_error_condition_eval_fail
An error occurred while performing a git operation (updating or getting the masterlist version).
5.1.6.4
14
5.1.6.7
CONTENTS
5.1
5.1.6.22
Denotes that the API is unable to determine whether or not the plugin queried needs cleaning.
5.1.6.35
15
16
5.1.6.37
CONTENTS
Index
api.h, 4
loot_apply_load_order, 7
loot_create_db, 7
loot_db, 7
loot_destroy_db, 7
loot_error_condition_eval_fail, 13
loot_error_file_write_fail, 13
loot_error_git_error, 13
loot_error_invalid_args, 13
loot_error_liblo_error, 13
loot_error_no_game_detected, 13
loot_error_no_mem, 13
loot_error_no_tag_map, 14
loot_error_parse_fail, 14
loot_error_path_not_found, 14
loot_error_regex_eval_fail, 14
loot_error_sorting_error, 14
loot_error_windows_error, 14
loot_eval_lists, 8
loot_game_fo3, 14
loot_game_fonv, 14
loot_game_tes4, 14
loot_game_tes5, 14
loot_get_build_id, 8
loot_get_dirty_info, 8
loot_get_error_message, 8
loot_get_masterlist_revision, 9
loot_get_plugin_messages, 9
loot_get_plugin_tags, 9
loot_get_tag_map, 10
loot_get_version, 10
loot_is_compatible, 10
loot_lang_any, 14
loot_lang_brazilian_portuguese, 14
loot_lang_chinese, 14
loot_lang_danish, 14
loot_lang_english, 14
loot_lang_finnish, 15
loot_lang_french, 15
loot_lang_german, 15
loot_lang_korean, 15
loot_lang_polish, 15
loot_lang_russian, 15
loot_lang_spanish, 15
loot_load_lists, 12
loot_message_error, 15
loot_message_say, 15
loot_message_warn, 15
loot_needs_cleaning_no, 15
loot_needs_cleaning_unknown, 15
loot_needs_cleaning_yes, 15
loot_ok, 15
loot_return_max, 15
loot_sort_plugins, 12
loot_update_masterlist, 12
loot_write_minimal_list, 13
loot_apply_load_order
api.h, 7
loot_create_db
api.h, 7
loot_db
api.h, 7
loot_destroy_db
api.h, 7
loot_error_condition_eval_fail
api.h, 13
loot_error_file_write_fail
api.h, 13
loot_error_git_error
api.h, 13
loot_error_invalid_args
api.h, 13
loot_error_liblo_error
api.h, 13
loot_error_no_game_detected
api.h, 13
loot_error_no_mem
api.h, 13
loot_error_no_tag_map
api.h, 14
loot_error_parse_fail
api.h, 14
loot_error_path_not_found
api.h, 14
loot_error_regex_eval_fail
api.h, 14
loot_error_sorting_error
api.h, 14
loot_error_windows_error
api.h, 14
loot_eval_lists
api.h, 8
loot_game_fo3
api.h, 14
loot_game_fonv
api.h, 14
loot_game_tes4
api.h, 14
loot_game_tes5
api.h, 14
loot_get_build_id
api.h, 8
loot_get_dirty_info
api.h, 8
loot_get_error_message
api.h, 8
loot_get_masterlist_revision
api.h, 9
loot_get_plugin_messages
18
api.h, 9
loot_get_plugin_tags
api.h, 9
loot_get_tag_map
api.h, 10
loot_get_version
api.h, 10
loot_is_compatible
api.h, 10
loot_lang_any
api.h, 14
loot_lang_brazilian_portuguese
api.h, 14
loot_lang_chinese
api.h, 14
loot_lang_danish
api.h, 14
loot_lang_english
api.h, 14
loot_lang_finnish
api.h, 15
loot_lang_french
api.h, 15
loot_lang_german
api.h, 15
loot_lang_korean
api.h, 15
loot_lang_polish
api.h, 15
loot_lang_russian
api.h, 15
loot_lang_spanish
api.h, 15
loot_load_lists
api.h, 12
loot_message, 3
message, 3
type, 3
loot_message_error
api.h, 15
loot_message_say
api.h, 15
loot_message_warn
api.h, 15
loot_needs_cleaning_no
api.h, 15
loot_needs_cleaning_unknown
api.h, 15
loot_needs_cleaning_yes
api.h, 15
loot_ok
api.h, 15
loot_return_max
api.h, 15
loot_sort_plugins
api.h, 12
loot_update_masterlist
api.h, 12
INDEX
loot_write_minimal_list
api.h, 13
message
loot_message, 3
type
loot_message, 3