This repository has been archived on 2021-06-27. You can view files and clone it, but cannot push or open issues or pull requests.
modetw/src/calibrate.h

43 lines
1.1 KiB
C

#ifndef CALIBRATE_H
#define CALIBRATE_H
#include "exception_t.h"
/**
* Replace a string of text with another in a text file
* @param file Absolute path to file
* @param before before
* @param after after
* @return 1 if error
* 0 otherwise
*/
int
replace_text(const char *file, const char *before, const char *after, const char *enc, exception_t *e);
// int parse_group(xmlNode *cur, exception_t *e);
/**
* Check if each file has the same MD5hash sum as the one in paths.xml
* @return 1 if error
* 0 otherwise
*/
int
verify(exception_t *e);
int
edit(exception_t *e);
/**
* @brief Calibrate game files for mod installation
* First, it uses modetw's configuration file (located at $HOME/.config/modetw/modetw.conf) to locate the game directory and game's config directory.
* Second, modetw's paths XML file (located at $HOME/.local/modetw/paths.xml) is used to verify the MD5hash sum of all the files are correct.
* Third, replaces certain strings in the game's data files to make it compatible to mods.
* @param e exception pointer
* @return 1 if error
* 0 otherwise
*/
int
calibrate(exception_t *e);
#endif