dailydose

Include/Config.h

Jul 30th, 2016
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #pragma once
  2. #ifndef CONFIG_H
  3. #define CONFIG_H
  4.  
  5. #include <fstream>
  6. #include <windows.h>
  7. #include <string>
  8. #include <vector>
  9.  
  10. class Config {
  11. public:
  12.     std::string processName;
  13.  
  14.     struct cheats
  15.     {
  16.         bool exists;
  17.         DWORD instructionAddress, returnAddress;
  18.         std::string instructionModule, returnModule;
  19.         std::vector<byte> original, inject, jump;
  20.         cheats() : exists(false) {}
  21.     } ohk, nr;
  22.  
  23.     struct entrys
  24.     {
  25.         std::string type;
  26.         short size;
  27.         std::string module;
  28.         DWORD_PTR address;
  29.         DWORD offsets[5];
  30.         short count;
  31.         entrys() : size(0), count(0) {}
  32.     } health, data1n2, data2n1, data2n2, data2n3, money, experience;
  33.  
  34.     struct hot {
  35.         struct keys
  36.         {
  37.             int code;
  38.             std::string name;
  39.             keys() : code(-1) {}
  40.         } data1, data2, money, experience, ohk, nr;
  41.     } hotkey;
  42.  
  43.     struct amount
  44.     {
  45.         union v
  46.         {
  47.             int i;
  48.             float f;
  49.             v() : i(0) {}
  50.         } value;
  51.         std::string type;
  52.     } maxHealth, amountMoney, amountExperience;
  53.  
  54.     Config(std::string file);
  55.     ~Config();
  56.     static BOOL FileExists(LPCTSTR szPath);
  57.  
  58. private:
  59.     size_t offset, size;
  60.     std::string buff;
  61.     std::ifstream ini, xml;
  62.  
  63.     void ParseIni(std::string fileName);
  64.     void _ReadKey(hot::keys& hotkey);
  65.     int _Key2code(std::string key);
  66.     void _ReadAmount(amount& data, std::string& type);
  67.  
  68.     void ParseXml(std::string& fileName);
  69.     void _ReadCheat(cheats& cheat);
  70.     void _ReadInstruction(std::string& module, DWORD& address);
  71.     void _ReadEntry(entrys& data);
  72.     void _ReadType(entrys& data);
  73.     void _ReadAddress(entrys& data);
  74.     void _ReadOffsets(entrys& data);
  75.     void _ReadValue(amount& amount);
  76.     std::string _ReadSettings();
  77. };
  78. #endif
Add Comment
Please, Sign In to add comment