Results 1 to 11 of 11

Thread: Infracta Launcher + Tools

  1. #1
    Durintwz's Avatar Ashigaru
    Join Date
    Feb 2009
    Location
    BADEN / Germany
    Posts
    81

    Default Infracta Launcher + Tools

    Hey guys,

    I'm presenting you our Infracta Launcher, which is a simple Launcher programm, to launch your Mods out of one programm. Beside, it got some features. At the moment there is only a german version, which is why the text on the pictures is in german. An english version is planned:

    (couse of a few pictures in spoiler)

    Spoiler Alert, click show to read: 
    First of all the basic: After installation of the Launcher he should find your Medievall II Folder by reading the registry. If he doesn't, he will tell you like this:




    Ok, now he got his path, and this the Launcher. He plays some Medieval Sound, you can turn it off, presents you the Infracta News, which are downloaded from our server and let you choose a mod to play:



    Here we got a nice feature: If you got a Mod, which supportes the Infracta Patch Programm, you will automatically get warnings, if there is a new patch. You can also download and install out of the Launcher:



    Another nice thing: You can let the launcher count your playtime, and he will output you a chart, which mod is played how long. Of course you can turn it off




    This is the actual status, but at the moment, like i said, only avaible in german. You can download here:
    http://www.infracta.de/wbb/forum/ind...e=Database&c=7

    Currently I'm writing a patch to the next version, which will got a new feature ( did i mention, that the launcher will of course update itself by displaying you new versions? ): A M2TW Script Editor

    The Editor is designed to write new Scripts and got features like autocomplete, text folding, a databrowser, find and replace, a lot of shortcuts to use the editor just with your keyboard and much more...

    There is no release date at the moment, but the biggest part is done, so i would say it's 75% done.

    With the patch there will be the english version of the launcher and the editor. To present you the Editor, i will let pics talk. Like before: There are in german, but you will get an impression it think


















    Ah: Because of our own Server we are always happy if someone want to support us. So if you want to donate to us, you can do it here: http://www.infracta.de/wbb/forum/ind...stom&pageID=15

    Greetings,
    Durin
    Last edited by Durintwz; January 06, 2012 at 07:30 AM.
    “The only problem with Microsoft is they just have no taste. They have absolutely no taste. And I don’t mean that in a small way, I mean that in a big way, in the sense that they don’t think of original ideas, and they don’t bring much culture into their products."

    Steven „Steve“ Paul Jobs
    (* 24. Februar 1955 in San Francisco, Kalifornien; † 5. Oktober 2011 in Palo Alto, Kalifornien)

  2. #2
    Ataegina's Avatar Old Solid Snake
    Join Date
    Dec 2006
    Location
    Shadow Moses
    Posts
    7,643

    Default Re: Infracta Launcher + Tools

    interesting i will keep an eye on it

  3. #3
    Squid's Avatar Opifex
    Join Date
    Feb 2007
    Location
    Frozen waste lands of the north
    Posts
    15,795

    Default Re: Infracta Launcher + Tools

    What does the data browser do in the script editor? Is the auto-complete context sensitive? Does the script editor do any actual error checking? Does the launcher work with Steam installs?


    Under the patronage of Roman_Man#3, Patron of Ishan
    Click for my tools and tutorials
    "Two things are infinite: the universe and human stupidity; and I'm not sure about the universe." -----Albert Einstein

  4. #4
    Shisai
    Join Date
    Nov 2008
    Posts
    371

    Default Re: Infracta Launcher + Tools

    Looks interesting. I would split off the Script editor into its own application if I were you, because you'd want a launcher to be as lean as possible (for the common case where all you want to do is launch a mod).

    It seems a lot of these launcher type apps get written, I for one wrote a prototype launcher which focuses on being an interstitial for EB2 (allowing M2TW to launch the mod through that demo launcher). IMO there is an opportunity for code reuse and avoiding duplicate efforts in there somewhere if we could collaborate on getting the best of both?

    My launcher focuses on the following, so I have working algorithms for:
    • Integration with M2TW. It, too, has code to detect M2TW installations through the registry which has been tested and shown to work for 32bit and 64bit flavours of Windows with some resilience against broken Windows heuristics. (That is: if you have a 64bit app installed inside say “Program Files (x86)” Windows will still redirect registry queries by default.)
    • Work as an interstitial. The launcher can be used in place of a M2TW/Kingdoms exe in the “GameExe” field of the registry entries of mods, in which role it will be able to perform a number of services such as:
    • Patch up command lines. It intercepts commands created by the M2TW/Kingdoms launcher and fixes them so that mods with spaces in their name (for instance) would work. This also helps when mods are outside of the Vanilla M2TW/Kingdoms tree -- which in turn is a much preferable way of installing mods.
    • Patch up command lines II. It can intercept very similar command lines as may be generated through a batch file, and perform similar fixes.
    • Generate appropriate config files on first use by merging the user's M2TW preferences with mod templates. This will mean that the user does not have to set all his preferences on first run, but that the essential ones for a mod to work are also automatically inserted and it even allows for a mod to make recommendations should the user not have configured a particular setting. It also has support for different scenario's (e.g. normal use, and cineedit) by means of additional templates.
    • Specific to EB2 it can also run a command to update last modified time stamps of certain files and delete others. This is useful for preventing the game from trying to regenerate certain files (we use a more complex description format which the game cannot translate by itself).
    -Tellos Athenaios
    CUF tool - XIDX - PACK tool - SD tool - EVT tool

    ὁ δ᾽ ἠλίθιος ὣσπερ πρόβατον βῆ βῆ λέγων βαδίζει” – Kratinos in Dionysalexandros.

  5. #5
    Durintwz's Avatar Ashigaru
    Join Date
    Feb 2009
    Location
    BADEN / Germany
    Posts
    81

    Default Re: Infracta Launcher + Tools

    Quote Originally Posted by Squid View Post
    What does the data browser do in the script editor? Is the auto-complete context sensitive? Does the script editor do any actual error checking? Does the launcher work with Steam installs?
    The databrowser simply shows all .txt files inside the m2tw/mods folder. At the moment i'm focusing on the scripting part, but the project is rather young and i can imagine a lot of features, including the other .txt files of m2. It's also at the moment only possible to load file inside the mods folder. I'm not sure if i let it like this, or if i add a dialog to load files out of the mods folder, like desktop or wherever.

    I also try to let everthing be easy to modify for me. for example i'm looking forward to skyrim modding tools, maybe i can need the editor there, too.

    At the very moment: it's not context sensitive. But i'm interested to implement it. The editor does no i/o on harddisks ( except of loading and saving ) and stores everything in RAM, so he's very fast and i'm confident to let him be much more powerfull without loosing performance. 1 MB loaded text consumes about 6 MB RAM

    No, there is no code validating . This is something i would really like, but it's not planned at the moment, maybe in future. Gigantus also told me there is already a tool which validates the script, maybe i will contact the author and can make use of it.

    Weather your m2 installation is on an extern drive, in your programms folder or in steam, this doesn't matter, the launcher will get the path out of registry or if not: he will ask you where your installation is. The editor becomes the information about the path by the launcher, so it will work steam

    Quote Originally Posted by Tellos Athenaios View Post
    Looks interesting. I would split off the Script editor into its own application if I were you, because you'd want a launcher to be as lean as possible (for the common case where all you want to do is launch a mod).

    It seems a lot of these launcher type apps get written, I for one wrote a prototype launcher which focuses on being an interstitial for EB2 (allowing M2TW to launch the mod through that demo launcher). IMO there is an opportunity for code reuse and avoiding duplicate efforts in there somewhere if we could collaborate on getting the best of both?

    My launcher focuses on the following, so I have working algorithms for:
    • Integration with M2TW. It, too, has code to detect M2TW installations through the registry which has been tested and shown to work for 32bit and 64bit flavours of Windows with some resilience against broken Windows heuristics. (That is: if you have a 64bit app installed inside say “Program Files (x86)” Windows will still redirect registry queries by default.)
    • Work as an interstitial. The launcher can be used in place of a M2TW/Kingdoms exe in the “GameExe” field of the registry entries of mods, in which role it will be able to perform a number of services such as:
    • Patch up command lines. It intercepts commands created by the M2TW/Kingdoms launcher and fixes them so that mods with spaces in their name (for instance) would work. This also helps when mods are outside of the Vanilla M2TW/Kingdoms tree -- which in turn is a much preferable way of installing mods.
    • Patch up command lines II. It can intercept very similar command lines as may be generated through a batch file, and perform similar fixes.
    • Generate appropriate config files on first use by merging the user's M2TW preferences with mod templates. This will mean that the user does not have to set all his preferences on first run, but that the essential ones for a mod to work are also automatically inserted and it even allows for a mod to make recommendations should the user not have configured a particular setting. It also has support for different scenario's (e.g. normal use, and cineedit) by means of additional templates.
    • Specific to EB2 it can also run a command to update last modified time stamps of certain files and delete others. This is useful for preventing the game from trying to regenerate certain files (we use a more complex description format which the game cannot translate by itself).
    The launcher got basic functionallity like updating, which i use in the script editor. The idea was to have one basic application: the launcher, on which i will build my tools. So maybe the needed memory of the hardisk will raise, but processor and ram are very performant, the script editor will only start if you start it out of the launcher. So the launcher is not only a mod launcher, this is why we call it infracta launcher it's also made to start tools.

    The infracta launcher is written in .net c# what is yours? A collaboration could be a nice idea, but on the very moment i'm not working on the launcher itself. to be onest the next week i have no time to work on any project but later, when i've time, we can talk about that
    Last edited by Durintwz; January 06, 2012 at 07:21 AM.
    “The only problem with Microsoft is they just have no taste. They have absolutely no taste. And I don’t mean that in a small way, I mean that in a big way, in the sense that they don’t think of original ideas, and they don’t bring much culture into their products."

    Steven „Steve“ Paul Jobs
    (* 24. Februar 1955 in San Francisco, Kalifornien; † 5. Oktober 2011 in Palo Alto, Kalifornien)

  6. #6
    Squid's Avatar Opifex
    Join Date
    Feb 2007
    Location
    Frozen waste lands of the north
    Posts
    15,795

    Default Re: Infracta Launcher + Tools

    Quote Originally Posted by Durintwz View Post
    The databrowser simply shows all .txt files inside the m2tw/mods folder. At the moment i'm focusing on the scripting part, but the project is rather young and i can imagine a lot of features, including the other .txt files of m2. It's also at the moment only possible to load file inside the mods folder. I'm not sure if i let it like this, or if i add a dialog to load files out of the mods folder, like desktop or wherever.

    I also try to let everthing be easy to modify for me. for example i'm looking forward to skyrim modding tools, maybe i can need the editor there, too.

    At the very moment: it's not context sensitive. But i'm interested to implement it. The editor does no i/o on harddisks ( except of loading and saving ) and stores everything in RAM, so he's very fast and i'm confident to let him be much more powerfull without loosing performance. 1 MB loaded text consumes about 6 MB RAM

    No, there is no code validating . This is something i would really like, but it's not planned at the moment, maybe in future. Gigantus also told me there is already a tool which validates the script, maybe i will contact the author and can make use of it.
    I am the auther that's why I was asking because if you've already implemented things that I haven't yet, such as the autocomplete, though if it isn't case sensitive I could do it easily as it would just be attaching a list of all items I've loaded from the various game files. If you want to look at the tools I've created take a look at the tools link in my sig it will link to all tools and tutorials.

    Weather your m2 installation is on an extern drive, in your programms folder or in steam, this doesn't matter, the launcher will get the path out of registry or if not: he will ask you where your installation is. The editor becomes the information about the path by the launcher, so it will work steam
    Launching through steam is slightly different because steam, IIRC won't let you run the exe directly, which is why I ask. The built in launcher with Kingdoms does most of what you do, I think, its hard to tell since I don't speak or read German, and with my Launcher editing tool the built in launcher can launch any mod with little to no problems.

    The launcher got basic functionallity like updating, which i use in the script editor. The idea was to have one basic application: the launcher, on which i will build my tools. So maybe the needed memory of the hardisk will raise, but processor and ram are very performant, the script editor will only start if you start it out of the launcher. So the launcher is not only a mod launcher, this is why we call it infracta launcher it's also made to start tools.

    The infracta launcher is written in .net c# what is yours? A collaboration could be a nice idea, but on the very moment i'm not working on the launcher itself. to be onest the next week i have no time to work on any project but later, when i've time, we can talk about that
    My tools are all written in c#. The next week or so is also a busy one for me but we can chat after.


    Under the patronage of Roman_Man#3, Patron of Ishan
    Click for my tools and tutorials
    "Two things are infinite: the universe and human stupidity; and I'm not sure about the universe." -----Albert Einstein

  7. #7
    Durintwz's Avatar Ashigaru
    Join Date
    Feb 2009
    Location
    BADEN / Germany
    Posts
    81

    Default Re: Infracta Launcher + Tools

    Quote Originally Posted by Squid View Post
    I am the auther that's why I was asking because if you've already implemented things that I haven't yet, such as the autocomplete, though if it isn't case sensitive I could do it easily as it would just be attaching a list of all items I've loaded from the various game files. If you want to look at the tools I've created take a look at the tools link in my sig it will link to all tools and tutorials.
    Ah right, nice to meet you . About context sensitivity: I already have various lists, so i can detect a command and could now suggest a condition. But i'm not sure, if it is that easy, cause not every command gets every condition.


    Quote Originally Posted by Squid View Post
    Launching through steam is slightly different because steam, IIRC won't let you run the exe directly, which is why I ask. The built in launcher with Kingdoms does most of what you do, I think, its hard to tell since I don't speak or read German, and with my Launcher editing tool the built in launcher can launch any mod with little to no problems.
    Thanks for the hint, i will look at this. the build in laucher wouldn't support patching our mods, or presenting our news. Beside our Launcher is already finished and avaible (in german):

    http://www.megaupload.com/?d=M1LQPKM0

    Quote Originally Posted by Squid View Post
    My tools are all written in c#. The next week or so is also a busy one for me but we can chat after.
    This sounds very nice! We should talk about collaboration, a script editor with text folding, code hilighting, code validating and autocomplete would be a really nice thing in my opinion

    I'll pm you at the end of the next week
    “The only problem with Microsoft is they just have no taste. They have absolutely no taste. And I don’t mean that in a small way, I mean that in a big way, in the sense that they don’t think of original ideas, and they don’t bring much culture into their products."

    Steven „Steve“ Paul Jobs
    (* 24. Februar 1955 in San Francisco, Kalifornien; † 5. Oktober 2011 in Palo Alto, Kalifornien)

  8. #8
    Shisai
    Join Date
    Nov 2008
    Posts
    371

    Default Re: Infracta Launcher + Tools

    Quote Originally Posted by Durintwz View Post
    Weather your m2 installation is on an extern drive, in your programms folder or in steam, this doesn't matter, the launcher will get the path out of registry or if not: he will ask you where your installation is. The editor becomes the information about the path by the launcher, so it will work steam
    Thanks for the hint, i will look at this. the build in laucher wouldn't support patching our mods, or presenting our news. Beside our Launcher is already finished and avaible (in german):
    What Squid is getting is that CA wrote its own launcher, which can launch mods. It is also the program which is actually run when a Steam user runs “M2TW” or “Kingdoms”. So it would be a good idea to have integration with it, by which I mean that the user can continue to use the CA launcher as before, and all that would be different is that instead of the CA launcher running M2TW or Kingdoms it would run your Launcher. This can be accomplished by writing the full path to your launcher executable in the GameExe field of a mod entry in the registry. Your launcher would then act as an interstitial so it could provide some additional features not offered by the CA launcher.

    This is coincidentally exactly how my demo launcher works.

    The launcher got basic functionallity like updating, which i use in the script editor. The idea was to have one basic application: the launcher, on which i will build my tools. So maybe the needed memory of the hardisk will raise, but processor and ram are very performant, the script editor will only start if you start it out of the launcher. So the launcher is not only a mod launcher, this is why we call it infracta launcher it's also made to start tools.
    I see, but then doesn't it make more sense to write each tool as its own exe but have them share in a common library? As far as I know PE executables (Windows exes) can double as a DLL, too.

    At this point it is probably not really important yet anyway, but once its fame start to spread other people might actually want to bundle the launcher with their mods and they just want the smallest possible startup time and the lowest disk foot print for that. (At that point they don't really care about script editors, because they have their users who only play the mod in mind.)

    The infracta launcher is written in .net c# what is yours? A collaboration could be a nice idea, but on the very moment i'm not working on the launcher itself. to be onest the next week i have no time to work on any project but later, when i've time, we can talk about that
    JScript for the Windows Script Host environment, basically JavaScript with some hooks/objects supplied by the interpreter to interact with Windows services. (Think better than batch files but a bit limited beyond that. Not really suitable for fully featured applications.)

    So I am all for rewriting that from prototype into proper application in C# (or a combination of C, and C# with P/invoke).
    -Tellos Athenaios
    CUF tool - XIDX - PACK tool - SD tool - EVT tool

    ὁ δ᾽ ἠλίθιος ὣσπερ πρόβατον βῆ βῆ λέγων βαδίζει” – Kratinos in Dionysalexandros.

  9. #9
    gracul's Avatar 404 Not Found
    Join Date
    Dec 2007
    Location
    Poland
    Posts
    2,013

    Default Re: Infracta Launcher + Tools

    I haven't seen any steam compatible launcher for mtw2 here on twc, except the one i made for stainless steel. Could you post a link to your launcher?

  10. #10
    Shisai
    Join Date
    Nov 2008
    Posts
    371

    Default Re: Infracta Launcher + Tools

    It's not released, because EBII isn't. ~

    Anyway just to see what it'd take I decided to port the interstitial functions to plain C. Reasons for that are...:
    Spoiler Alert, click show to read: 

    The goal is to minimise start up time and resource footprint. The majority of startup time that we can affect is the time it takes for the launcher to do its job. C offers the `exec` family of functions which allow us to load Kingdoms in the context of the current process -- without having `fork` first. This saves us the cost of one process and all the attending OS resources.

    C is also the lingua franca for FFI, which is to say bindings to C from other languages tend to be a relatively well understood problem for nearly all languages. In particular for C# interoperability with C code from within Mono is robust whereas the same for, say, C++ is decidedly less mature.


    The code is quite simple. All it does (currently) is fixup of the command line so we can have values with spaces for the `Path' fields of Mods in the registry, and minimal sanity checking. It also guesses which exe to use based on the name of the CFG file, it defaults to kingdoms.exe.

    Code is split over 5 files:
    Spoiler Alert, click show to read: 

    Utility functions:
    src/util.h
    Code:
    #ifndef LAUNCHER_UTIL_H
    #define LAUNCHER_UTIL_H
    #define MAGIC_LENGTH(magic) (sizeof(magic) / sizeof(char))
    void * l_calloc(size_t, size_t);
    char * str_alloc(size_t);
    
    int dir_exists(const char*); 
    int file_exists(const char*);
    #endif
    src/util.c
    Code:
    #ifndef __LAUNCHER_UTIL_C
    #define __LAUNCHER_UTIL_C
    #include <stdlib.h>
    #include <sys/types.h>
    #include <sys/stat.h>
    #include "util.h"
    
    void * l_calloc(size_t len, size_t elem)
    {
        void* buf = calloc(len, elem);
        if( buf == NULL )
        {
    	exit(-1);
        }
        return buf;
    }
    
    char * str_alloc(size_t len)
    {
        return (char*) l_calloc(len, sizeof(char));
    }
    
    int dir_exists(const char* dir) 
    {
        struct stat st;
        if (stat(dir, &st) == 0) 
        {
    	return S_ISDIR(st.st_mode) ? 1 : 0;
        }
        return -1;
    }
    
    int file_exists(const char* dir) 
    {
        struct stat st;
        if (stat(dir, &st) == 0) 
        {
    	return S_ISREG(st.st_mode) ? 1 : 0;
        }
        return -1;
    }
    #endif
    Functions to do with mods: (including the actual launching bit)
    src/mod.h
    Code:
    #ifndef LAUNCHER_MOD_H
    #define LAUNCHER_MOD_H
    
    #define M2TW_EXE "medieval2.exe"
    #define KGDM_EXE "kingdoms.exe"
    #define MOD_FLAG "--features.mod="
    
    typedef struct {
      char * cfg;
      char * dir;
    } Mod;
    
    Mod* allocate_mod(unsigned int, unsigned int);
    Mod* create_mod(char*, char*);
    void free_mod(Mod*);
    void launch_mod(Mod*);
    const char* exe_for_mod(Mod*);
    #endif
    src/mod.c
    Code:
    #ifndef LAUNCHER_MOD_C
    #define LAUNCHER_MOD_C
    #ifdef _WIN32
    #include <process.h>
    #else
    #include <libgen.h>
    #endif
    #include <stdio.h>
    #include <stdlib.h>
    #include <string.h>
    #include <strings.h>
    #include <unistd.h>
    #include "mod.h"
    #include "util.h"
    
    #define EXE_CMP(cfg, cmp, ret) if(strncasecmp((cfg), (cmp), MAGIC_LENGTH(cmp) -1) == 0) { return (ret); }
    
    Mod* allocate_mod(unsigned int cfg_length, unsigned int dir_length) 
    {
        Mod* mod = (Mod*) l_calloc(1, sizeof(Mod));
        char *c  = str_alloc(cfg_length + sizeof(char)), 
    	 *m  = str_alloc(dir_length + sizeof(char));
        mod->cfg = c;
        mod->dir = m;
        return mod;
    }
    
    Mod* create_mod(char *cfg, char* dir)
    {
        Mod* mod = (Mod*) l_calloc(1, sizeof(Mod));
        mod->cfg = cfg;
        mod->dir = dir;
        return mod;
    }
    
    void free_mod(Mod* m)
    {
        free(m->cfg);
        free(m->dir);
        free(m);
    }
    
    void launch_mod(Mod* m)
    {
        const char* exe=exe_for_mod(m);
        if(exe == NULL)
        {
    	exe = KGDM_EXE;
    	fprintf(stderr, "Fallback to: %s\n", exe);
        }
        
        char * cfg_a = m->cfg, * dir_a = m->dir;
        free(m);
        
        if(execl(exe, exe, cfg_a, dir_a, NULL) == -1)
        {
    	fputs("Unable to launch the mod\n", stderr);
    	free(cfg_a);
    	free(dir_a);
        }
    }
    
    const char* exe_for_mod(Mod* mod)
    {
    #ifdef _WIN32 
        char abs_path[_MAX_PATH] = {0};
        
        if(_fullpath(abs_path, mod->cfg + sizeof(char), _MAX_PATH) == NULL) 
        {
    	fprintf(stderr, "Unable to resolve basename for: %s\n", mod->cfg + sizeof(char));
    	return NULL;
        }
        
        char c[_MAX_FNAME] = {0};
        _splitpath(abs_path, NULL, NULL, c, NULL);
    #else
        char * c = basename(mod->cfg + sizeof(char));
    #endif 
        
        EXE_CMP(c, "kingdoms", KGDM_EXE);
        EXE_CMP(c, "kgdm", KGDM_EXE);
        EXE_CMP(c, "medieval", M2TW_EXE);
        EXE_CMP(c, "m2", M2TW_EXE);
        
        fprintf(stderr, "No program name prefix in: %s\n", c);
        return NULL;
    }
    #endif
    The actual program:
    src/main.c
    Code:
    #ifndef __LAUNCHER_MAIN_C
    #define __LAUNCHER_MAIN_C
    #include <stdio.h>
    #include <string.h>
    #include "mod.h"
    #include "util.h"
    
    #define CLI_SYNTAX_ERROR(cond, msg) if (cond) { msg; return -2; }
    #define CLI_VALUE_ERROR(cond, mod, msg) if (cond) { msg; free_mod(mod); return -3; }
    
    
    int main (int argc, char** argv) 
    {
        CLI_SYNTAX_ERROR(argc == 1, fputs("Missing CFG argument\n", stderr));
        CLI_SYNTAX_ERROR((*argv[1]) !=  '@', fprintf(stderr, "Bad CFG argument: %s\n", argv[1]));
        
        unsigned int k=1, cfg_len, count = 1, sz = MAGIC_LENGTH(MOD_FLAG) - 1, dir_len = 0;
        
        for(cfg_len = strlen(argv[k]) /*-1*/, ++k; k <argc && strncmp(argv[k], MOD_FLAG, sz) != 0; ++k, ++count) 
        {
    	cfg_len += strlen(argv[k]) + 1;
        }
        
        CLI_SYNTAX_ERROR(k == argc, fputs("Missing --features.mod argument.\n", stderr));
        CLI_SYNTAX_ERROR(cfg_len == 1 /*0*/, fputs("Empty CFG argument.\n", stderr));
        
        dir_len = strlen(argv[k]) /*- sz*/;
        
        CLI_SYNTAX_ERROR(dir_len == sz /*0*/, fputs("Empty --features.mod argument.\n", stderr));
        
        char* last=strrchr(argv[k], '/');
    #ifdef _WIN32    
        if(last == NULL || (*(last + 1)) != '\0')
        {
    	last = strrchr(argv[k], '\\');
        }
    #endif
        if(last != NULL && (*(last + 1)) == '\0')
        {
    	dir_len --;
        }
        
        Mod *mod= allocate_mod(cfg_len, dir_len);
        
        mod->dir = strncpy(mod->dir, argv[k] /*+ sz * sizeof(char)*/, dir_len);
        
        char* d=mod->dir + sz * sizeof(char);
        CLI_VALUE_ERROR(dir_exists(d) != 1, mod, fprintf(stderr, "Mod directory does not exist: %s\n", d));
        
        mod->cfg = strcpy(mod->cfg, argv[1] /*+ sizeof(char)*/);  
        for(k = 2; k <= count; ++k)
        {
    	strcat(strcat(mod->cfg, " "), argv[k]);
        }
        
        char* c=mod->cfg + sizeof(char);
        CLI_VALUE_ERROR(file_exists(c) != 1, mod, fprintf(stderr, "Mod CFG does not exist: %s\n", c));
        
        launch_mod(mod);
    	
        return -4;
    }
    #endif

    And of course there's a makefile:
    Spoiler Alert, click show to read: 
    Code:
    #!/usr/bin/make
    # Makefile to build the launcher program from source 
    # on POSIX systems. 
    #
    # --Tellos Athenaios
    
    SRC = src/main.c src/mod.c src/util.c
    OUT = bin/launcher
    mingw_i586 = $(shell which i586-mingw32msvc-gcc)
    mingw_i686 = $(shell which i686-w64-mingw32-gcc)
    mingw_amd64 = $(shell which x86_64-w64-mingw32-gcc)
    gcc = $(shell which gcc)
    CFLAGS = -Wall -Os -s
    
    build : bin $(SRC)
    ifneq "$(gcc)" ""
    	$(gcc) $(CFLAGS) $(SRC) -o $(OUT)
    else
    	echo "Skipping compiler: GCC (Native)"
    endif
    ifneq "$(mingw_amd64)" ""
    	$(mingw_amd64) $(CFLAGS) $(SRC) -o $(OUT)_amd64.exe
    else
    	echo "Skipping compiler: (MinGW 64bit AMD64)"
    endif
    ifneq "$(mingw_i686)" "" 
    ifeq "$(mingw_i586)" ""
    	$(mingw_i686) $(CFLAGS) $(SRC) -o $(OUT)_x86.exe
    else
    	echo "Skipping compiler: (MinGW 32bit i686). Using i586 instead."
    endif
    else
    	echo "Skipping compiler: (MinGW 32bit i686)"
    endif
    ifneq "$(mingw_i586)" ""
    	$(mingw_i586) $(CFLAGS) $(SRC) -o $(OUT)_x86.exe
    else
    	echo "Skipping compiler: (MinGW 32bit i586)"
    endif
    
    bin :
    	mkdir bin
    
    clean :
    	rm -rf bin


    This size of the binary isn't too bad, according to `ls -l':
    Code:
    -rwxrwxr-x 1 prometheus prometheus 10448 Jan 13 00:01 launcher
    -rwxrwxr-x 1 prometheus prometheus 17920 Jan 13 00:01 launcher_amd64.exe
    -rwxrwxr-x 1 prometheus prometheus 14848 Jan 13 00:01 launcher_x86.exe
    Last edited by Tellos Athenaios; January 16, 2012 at 06:50 AM.
    -Tellos Athenaios
    CUF tool - XIDX - PACK tool - SD tool - EVT tool

    ὁ δ᾽ ἠλίθιος ὣσπερ πρόβατον βῆ βῆ λέγων βαδίζει” – Kratinos in Dionysalexandros.

  11. #11
    Durintwz's Avatar Ashigaru
    Join Date
    Feb 2009
    Location
    BADEN / Germany
    Posts
    81

    Default Re: Infracta Launcher + Tools

    Sry was very busy and also ill and in hospital this week,

    think i'll have more time next week to get this thing going further.


    Greetings
    Durin
    “The only problem with Microsoft is they just have no taste. They have absolutely no taste. And I don’t mean that in a small way, I mean that in a big way, in the sense that they don’t think of original ideas, and they don’t bring much culture into their products."

    Steven „Steve“ Paul Jobs
    (* 24. Februar 1955 in San Francisco, Kalifornien; † 5. Oktober 2011 in Palo Alto, Kalifornien)

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •