mirror of
https://github.com/clearlinux/linux-steam-integration.git
synced 2026-09-06 22:01:27 +00:00
redirect: Begin working on new Profile bits
The Profile will allow us to construct reusable/extendable rules to handle various game issues. Signed-off-by: Ikey Doherty <ikey@solus-project.com>
This commit is contained in:
@@ -7,6 +7,7 @@ if with_libredirect == true
|
||||
|
||||
redirect_sources = [
|
||||
'main.c',
|
||||
'profile.c',
|
||||
]
|
||||
|
||||
main_redirect = shared_library(
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
/*
|
||||
* This file is part of linux-steam-integration.
|
||||
*
|
||||
* Copyright © 2017 Ikey Doherty <ikey@solus-project.com>
|
||||
*
|
||||
* linux-steam-integration is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public License as
|
||||
* published by the Free Software Foundation; either version 2.1
|
||||
* of the License, or (at your option) any later version.
|
||||
*/
|
||||
|
||||
#define _GNU_SOURCE
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "redirect.h"
|
||||
|
||||
LsiRedirectProfile *lsi_redirect_profile_new(const char *name)
|
||||
{
|
||||
LsiRedirectProfile p = {
|
||||
.name = strdup(name),
|
||||
.op_table = {{ 0 }},
|
||||
};
|
||||
LsiRedirectProfile *ret = NULL;
|
||||
if (!p.name) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ret = calloc(1, sizeof(LsiRedirectProfile));
|
||||
if (!ret) {
|
||||
return NULL;
|
||||
}
|
||||
*ret = p;
|
||||
return ret;
|
||||
}
|
||||
|
||||
void lsi_redirect_profile_free(LsiRedirectProfile *self)
|
||||
{
|
||||
if (!self) {
|
||||
return;
|
||||
}
|
||||
free(self->name);
|
||||
free(self);
|
||||
}
|
||||
|
||||
/*
|
||||
* Editor modelines - https://www.wireshark.org/tools/modelines.html
|
||||
*
|
||||
* Local variables:
|
||||
* c-basic-offset: 8
|
||||
* tab-width: 8
|
||||
* indent-tabs-mode: nil
|
||||
* End:
|
||||
*
|
||||
* vi: set shiftwidth=8 tabstop=8 expandtab:
|
||||
* :indentSize=8:tabSize=8:noTabs=true:
|
||||
*/
|
||||
+21
-1
@@ -11,6 +11,9 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
/**
|
||||
* The type of redirect required
|
||||
*/
|
||||
@@ -48,11 +51,28 @@ typedef enum { LSI_OPERATION_OPEN = 0, LSI_NUM_OPERATIONS } LsiRedirectOperation
|
||||
* op_table[LSI_OPERATION_OPEN]
|
||||
*/
|
||||
typedef struct LsiRedirectProfile {
|
||||
const char *name; /**< Name for this profile */
|
||||
char *name; /**< Name for this profile */
|
||||
|
||||
LsiRedirect op_table[LSI_NUM_OPERATIONS]; /* vtable information */
|
||||
} LsiRedirectProfile;
|
||||
|
||||
|
||||
/**
|
||||
* Construct a new LsiRedirectProfile
|
||||
*
|
||||
* @param name Profile name
|
||||
* @returns A newly allocated LsiRedirectProfile
|
||||
*/
|
||||
LsiRedirectProfile *lsi_redirect_profile_new(const char *name);
|
||||
|
||||
/**
|
||||
* Free a previously allocated LsiRedirectProfile
|
||||
*
|
||||
* @param profile Pointer to an allocated LsiRedirectProfile
|
||||
*/
|
||||
void lsi_redirect_profile_free(LsiRedirectProfile *profile);
|
||||
|
||||
|
||||
/*
|
||||
* Editor modelines - https://www.wireshark.org/tools/modelines.html
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user