Results 1 to 5 of 5
  1. #1
    radnomguywfq3's Avatar
    Join Date
    Jan 2007
    Gender
    male
    Location
    J:\E\T\A\M\A\Y.exe
    Posts
    8,858
    Reputation
    381
    Thanks
    1,823
    My Mood
    Sad

    stringTools Includes I created.

    Anyways, when I was building my game engine I needed some way to open and read configuration files, and later when I was trying to develop the scripting system this proved quite useful. I'm also building a method hooker to hook multiple methods. I will be posting the source code for the method hooker a little later. Anyways, here's an example of I'm using them for(given you divide each line into a buffer) :

    //START//
    [GENEREL_CONFIG]
    MS_EXECUTION_DELAY:10;
    MS_BYTE_WRITE_LOOP_SLEEP:10;
    RESTORE_PAGE_ACCESS:NO;
    LOOP_BYTE_WRITE:YES;
    CHECK_REHOOKS:NO;
    CONSOLE_OUTPUT:NO;
    METHOD_HOOKS:3; //careful with this, if I'm too lazy or I forget about this, changing this to a bad number can == buffer overflow :X
    HOOK_LOGS_DIR:*logs; //Will create seperate text files for each method
    SEG_END;
    [HOOK_DEFINITIONS]
    HOOKID:Nigz;
    ADR_TYPE:-1;
    REDIRECT:NO;
    LOG:YES;
    TGT_ADDRESS:115548;
    PARAMS:2;
    PARAM0:%d;
    PARAM1:%s;
    END_DEF;

    HOOKID:Nigz2;
    ADR_TYPE:1;
    REDIRECT:NO;
    LOG:YES;
    EXPORT_MODULE:KERNEL32.DLL;
    SYMBOL_NAME:OutputDebugStringA;
    PARAMS:1;
    PARAM1:%d;
    END_DEF;

    HOOKID:REDIR;
    ADR_TYPE:1;
    REDIRECT_ADR_TYPE:1;
    REDIRECT:YES;
    LOG:YES;
    EXPORT_MODULE:KERNEL32.DLL;
    SYMBOL_NAME:OutputDebugStringA;
    REDIRECT_ADRSPACE:HookCode.exe;
    REDIRECT_MODULE:someniggahz.dll;
    REDIRECT_SYMBOL:SomeSymbolName;
    PARAMS:1;
    PARAM1:%s;
    END_DEF;
    SEG_END;

    [BYTE_WRITE]

    //END//
    With a couple lines of C++ code using the methods you can load all that into an array of structs or however you want to organize them.
    Here's the headers :
    [php]
    #pragma once
    #include <windows.h>
    char* splitString (char* secondHalfBuffer, char* stringToSplit, char devideChar = ':');
    bool startsWith (char* prefix , char* msg);
    int extractInt (char* msg , char split = ':');
    char* extractString(char* msg , char split = ':');
    bool extractBool(char* msg, char split = ':', char* trueVal = "YES");
    DWORD extractHexDword(char* msg, char split = ':');
    [/php]

    The source files
    [php]
    #include "stdafx.h"
    #include "stdlib.h"
    #include "stringTools.h"
    #include <windows.h>

    char* splitString(char* secondHalfBuffer, char* stringToSplit,char devideChar) {
    char* buffer = new char[strlen(stringToSplit)];
    memset(buffer, 0, strlen(stringToSplit));

    for(unsigned int i = 0; i < strlen(stringToSplit); i++) {
    if(stringToSplit[i] == devideChar) {
    for(unsigned int x = i + 1; x < strlen(stringToSplit) + i; x++)
    buffer[x - i - 1] = stringToSplit[x];
    break;
    }else
    if(secondHalfBuffer != NULL)
    secondHalfBuffer[i] = stringToSplit[i];
    }
    return buffer;
    }

    bool startsWith(char* prefix, char* msg) {
    for(unsigned int i = 0; i < strlen(prefix); i++)
    if(prefix[i] != msg[i])
    return false;
    return true;
    }

    int extractInt(char* msg, char split) {
    char* buffer = new char[sizeof(msg)];
    char* returnBuffer = new char[sizeof(msg)];
    memset(buffer, 0, sizeof(buffer));
    memset(returnBuffer, 0, sizeof(returnBuffer));

    if(split != NULL)
    buffer = splitString(NULL, msg, split);
    else
    buffer = msg;

    for(unsigned int i = 0;i < strlen(buffer); i++)
    if(buffer[i] == ';')
    break;
    else
    returnBuffer[i] = buffer[i];

    return (atoi(returnBuffer));

    }

    char* extractString(char* msg, char split) {
    char* buffer = new char[strlen(msg)];
    char* returnBuffer = new char[strlen(msg)];
    memset(buffer, 0, strlen(msg));
    memset(returnBuffer, 0, strlen(msg));

    if(split != NULL)
    buffer = splitString(NULL, msg, split);
    else
    buffer = msg;

    for(unsigned int i = 0;i < strlen(buffer); i++)
    if(buffer[i] == ';')
    break;
    else
    returnBuffer[i] = buffer[i];

    return returnBuffer;

    }
    DWORD extractHexDword(char* msg, char split) {
    DWORD returnVar;
    char* buffer = extractString(msg, split);
    sscanf(buffer,"%u",&returnVar);
    return returnVar;
    }

    bool extractBool(char* msg, char split, char* trueVal) {
    if(strcmp(extractString(msg, split), trueVal) == 0)
    return true;
    else
    return false;
    }
    [/php]

    Their functions should be self-explanatory.



    There are two types of tragedies in life. One is not getting what you want, the other is getting it.

    If you wake up at a different time in a different place, could you wake up as a different person?


  2. #2
    Toymaker's Avatar
    Join Date
    Feb 2008
    Gender
    male
    Location
    Hannah, Montana
    Posts
    659
    Reputation
    14
    Thanks
    193
    My Mood
    Amused
    Yo, aside from this looking good, you're into game design sir?

  3. #3
    radnomguywfq3's Avatar
    Join Date
    Jan 2007
    Gender
    male
    Location
    J:\E\T\A\M\A\Y.exe
    Posts
    8,858
    Reputation
    381
    Thanks
    1,823
    My Mood
    Sad
    Yeah, quite a bit. I've been working on a 2D side-scroller engine with the DirectX9 SDK. I can't do any of the 3D math, it confuses the hell out of me. In a month or two though I'm going to pickup a book on it.
    Last edited by radnomguywfq3; 04-11-2009 at 11:55 AM.



    There are two types of tragedies in life. One is not getting what you want, the other is getting it.

    If you wake up at a different time in a different place, could you wake up as a different person?


  4. #4
    Obama's Avatar
    Join Date
    Dec 2008
    Gender
    male
    Location
    The Black house
    Posts
    22,195
    Reputation
    870
    Thanks
    6,076
    My Mood
    Cool
    Quote Originally Posted by Jetamay View Post
    Yeah, quite a bit. I've been working on a 2D side-scroller engine with the DirectX9 SDK. I can't do any of the 3D math, it confuses the hell out of me. In a month or two though I'm going to pickup a book on it.
    No you havent. Stop lying.

  5. #5
    Toymaker's Avatar
    Join Date
    Feb 2008
    Gender
    male
    Location
    Hannah, Montana
    Posts
    659
    Reputation
    14
    Thanks
    193
    My Mood
    Amused
    I've only finished my Bleach Trading Card game, Haha. I of course plan to move on. Let us chat on this subject sometime.

Similar Threads

  1. My created Sig.
    By The_Enigma in forum Art & Graphic Design
    Replies: 9
    Last Post: 05-26-2006, 05:45 AM
  2. teach program writing or creating to me?
    By Kirashima in forum Programming
    Replies: 3
    Last Post: 02-22-2006, 06:51 AM
  3. Replies: 13
    Last Post: 02-09-2006, 10:25 PM
  4. how to create speedhacks?
    By LiLLeO in forum General Game Hacking
    Replies: 5
    Last Post: 01-28-2006, 08:52 AM
  5. Creating A GunzRunnable
    By CrazyDeath in forum Game Hacking Tutorials
    Replies: 7
    Last Post: 01-01-2006, 11:20 PM

Tags for this Thread