added a bit of doc and some games
This commit is contained in:
+32
-1
@@ -4,13 +4,44 @@
|
|||||||
#ifndef __FILE_H__
|
#ifndef __FILE_H__
|
||||||
#define __FILE_H__
|
#define __FILE_H__
|
||||||
|
|
||||||
|
|
||||||
|
//valid copy flags
|
||||||
|
#define cp_DEFAULT 0
|
||||||
#define CP_LINK 1
|
#define CP_LINK 1
|
||||||
#define CP_RECURSIVE 2
|
#define CP_RECURSIVE 2
|
||||||
#define CP_NO_TARGET_DIR 4
|
#define CP_NO_TARGET_DIR 4
|
||||||
|
|
||||||
int copy(const char * path, const char * dest, u_int32_t flags);
|
/**
|
||||||
|
* @brief execute the cp command from the source to the dest
|
||||||
|
* @param source path to the source files
|
||||||
|
* @param dest path to the destination folder
|
||||||
|
* @param flags refer to the "valid copy flags" use them like this CP_LINK | CP_RECURSIVE
|
||||||
|
* @return status code
|
||||||
|
*/
|
||||||
|
int copy(const char * source, const char * dest, u_int32_t flags);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief execute the cp command from the source to the dest
|
||||||
|
* @param source path to the source files
|
||||||
|
* @param dest path to the destination folder
|
||||||
|
* @param bool enable recursive rm -r
|
||||||
|
* @return status code
|
||||||
|
*/
|
||||||
int delete(const char * path, bool recursive);
|
int delete(const char * path, bool recursive);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Run the mv command
|
||||||
|
* @param source
|
||||||
|
* @param destination
|
||||||
|
* @return mv's exit value
|
||||||
|
*/
|
||||||
int move(const char * source, const char * destination);
|
int move(const char * source, const char * destination);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Recursively rename all file and folder to lowercase.
|
||||||
|
*
|
||||||
|
* @param folder
|
||||||
|
*/
|
||||||
void casefold(const char * folder);
|
void casefold(const char * folder);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
#include "fomod/group.h"
|
#include "fomod/group.h"
|
||||||
#include "fomod/xmlUtil.h"
|
#include "fomod/xmlUtil.h"
|
||||||
|
|
||||||
|
|
||||||
int installFOMod(const char * modFolder, const char * destination);
|
int installFOMod(const char * modFolder, const char * destination);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -1 +1,8 @@
|
|||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Get the user home dir regardless if he used sudo.
|
||||||
|
*
|
||||||
|
* @return char* path to the home dir
|
||||||
|
*/
|
||||||
char * getHome();
|
char * getHome();
|
||||||
|
|||||||
@@ -1,6 +1,15 @@
|
|||||||
#ifndef __INSTALL_H__
|
#ifndef __INSTALL_H__
|
||||||
#define __INSTALL_H__
|
#define __INSTALL_H__
|
||||||
|
#include <stdlib.h>
|
||||||
#define INSTALLED_FLAG_FILE "__DO_NOT_REMOVE__"
|
#define INSTALLED_FLAG_FILE "__DO_NOT_REMOVE__"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Add a mod to the folder defined in main.h
|
||||||
|
*
|
||||||
|
* @param filePath path to the mod file
|
||||||
|
* @param appId game for which the mod is destined to be used with.
|
||||||
|
* @return EXIT_SUCCESS or EXIT_FAILURE
|
||||||
|
*/
|
||||||
int addMod(char * filePath, int appId);
|
int addMod(char * filePath, int appId);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
#ifndef __MACRO_H__
|
#ifndef __MACRO_H__
|
||||||
#define __MACRO_H__
|
#define __MACRO_H__
|
||||||
|
|
||||||
//cannot be empty it's made for fixed size array
|
//cannot be empty it's made for fixed size array like the ones in steam.h
|
||||||
#define LEN(array) sizeof(array) / sizeof(array[0])
|
#define LEN(array) sizeof(array) / sizeof(array[0])
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -5,6 +5,9 @@
|
|||||||
// in c "A" "B" is the same as "AB"
|
// in c "A" "B" is the same as "AB"
|
||||||
#define MANAGER_FILES ".local/share/" APP_NAME
|
#define MANAGER_FILES ".local/share/" APP_NAME
|
||||||
#define MOD_FOLDER_NAME "MOD_FOLDER"
|
#define MOD_FOLDER_NAME "MOD_FOLDER"
|
||||||
|
//the folder in which the games file will be linked or copied
|
||||||
#define GAME_FOLDER_NAME "GAME_FOLDER"
|
#define GAME_FOLDER_NAME "GAME_FOLDER"
|
||||||
|
//the director that will contain all modifications to game files while being deployed
|
||||||
#define GAME_UPPER_DIR_NAME "UPPER_DIRS"
|
#define GAME_UPPER_DIR_NAME "UPPER_DIRS"
|
||||||
|
//overlayfs temporary dir.
|
||||||
#define GAME_WORK_DIR_NAME "WORK_DIRS"
|
#define GAME_WORK_DIR_NAME "WORK_DIRS"
|
||||||
|
|||||||
@@ -96,6 +96,5 @@ void swapPlace(int appid, int modId, int modId2) {
|
|||||||
GList * list = listMods(appid);
|
GList * list = listMods(appid);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
g_list_free(list);
|
g_list_free(list);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,6 +15,15 @@
|
|||||||
* @return GList of char containing the name of the mod folder in order
|
* @return GList of char containing the name of the mod folder in order
|
||||||
*/
|
*/
|
||||||
GList * listMods(int appid);
|
GList * listMods(int appid);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Change the mod order by swaping two mod
|
||||||
|
*
|
||||||
|
* @param appid the game
|
||||||
|
* index of the mod in the mod list.
|
||||||
|
* @param modId
|
||||||
|
* @param modId2
|
||||||
|
*/
|
||||||
void swapPlace(int appid, int modId, int modId2);
|
void swapPlace(int appid, int modId, int modId2);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -1,6 +1,15 @@
|
|||||||
#ifndef __OVERLAY_H__
|
#ifndef __OVERLAY_H__
|
||||||
#define __OVERLAY_H__
|
#define __OVERLAY_H__
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Overlayfs is what make it possible to deploy to the game files without altering anything.
|
||||||
|
* it allows us to overlay multiple folder over the game files. like appling filters to an image.
|
||||||
|
* @param sources a null ended table of folder that will overlay of the game files
|
||||||
|
* @param dest the overlayed folder(the game data folder)
|
||||||
|
* @param upperdir the director that will store the changed files
|
||||||
|
* @param workdir a directory that will contains only temporary files.
|
||||||
|
* @return int error code
|
||||||
|
*/
|
||||||
int overlayMount(char ** sources, const char * dest, const char * upperdir, const char * workdir);
|
int overlayMount(char ** sources, const char * dest, const char * upperdir, const char * workdir);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
+2
-2
@@ -223,9 +223,9 @@ GHashTable* search_games(int * status) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int getGameIdFromAppId(u_int32_t id) {
|
int getGameIdFromAppId(u_int32_t appid) {
|
||||||
for(int k = 0; k < LEN(GAMES_APPIDS); k++) {
|
for(int k = 0; k < LEN(GAMES_APPIDS); k++) {
|
||||||
if(id == GAMES_APPIDS[k]) {
|
if(appid == GAMES_APPIDS[k]) {
|
||||||
return k;
|
return k;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+19
-1
@@ -36,14 +36,32 @@ const static char * steamLibraries[] = {
|
|||||||
// order has to be the same as in GAMES_NAMES
|
// order has to be the same as in GAMES_NAMES
|
||||||
const static u_int32_t GAMES_APPIDS[] = {
|
const static u_int32_t GAMES_APPIDS[] = {
|
||||||
489830,
|
489830,
|
||||||
|
22330,
|
||||||
|
377160
|
||||||
};
|
};
|
||||||
|
|
||||||
//the name of the game in the steamapps/common folder
|
//the name of the game in the steamapps/common folder
|
||||||
const static char * GAMES_NAMES[] = {
|
const static char * GAMES_NAMES[] = {
|
||||||
"Skyrim Special Edition",
|
"Skyrim Special Edition",
|
||||||
|
"Oblivion",
|
||||||
|
"Fallout 4"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief list all installed games and the paths to the game's files
|
||||||
|
*
|
||||||
|
* @param status pointer to a status variable that will be modified to EXIT_SUCCESS or EXIT_FAILURE
|
||||||
|
* @return GHashTable* a map appid(int) => path(char *)
|
||||||
|
*/
|
||||||
|
//TODO: flip the return value and parameter
|
||||||
GHashTable* search_games(int * status);
|
GHashTable* search_games(int * status);
|
||||||
int getGameIdFromAppId(u_int32_t id);
|
|
||||||
|
/**
|
||||||
|
* @brief search the index of the game inside GAMES_NAMES or GAMES_APPIDS
|
||||||
|
*
|
||||||
|
* @param appid
|
||||||
|
* @return -1 in case of failure or the index of the game.
|
||||||
|
*/
|
||||||
|
int getGameIdFromAppId(u_int32_t appid);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user