Skip to content

Commit

Permalink
refact
Browse files Browse the repository at this point in the history
  • Loading branch information
israpps committed Aug 30, 2024
1 parent 279259e commit 22f71f5
Show file tree
Hide file tree
Showing 6 changed files with 98 additions and 98 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,6 @@
**.o
**.obj
**.res
*.depend
*.layout
/build
52 changes: 52 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
{
"files.associations": {
"*.make": "makefile",
"array": "cpp",
"atomic": "cpp",
"bit": "cpp",
"*.tcc": "cpp",
"cctype": "cpp",
"clocale": "cpp",
"cmath": "cpp",
"compare": "cpp",
"concepts": "cpp",
"cstdarg": "cpp",
"cstddef": "cpp",
"cstdint": "cpp",
"cstdio": "cpp",
"cstdlib": "cpp",
"cstring": "cpp",
"cwchar": "cpp",
"cwctype": "cpp",
"deque": "cpp",
"unordered_map": "cpp",
"vector": "cpp",
"exception": "cpp",
"algorithm": "cpp",
"functional": "cpp",
"iterator": "cpp",
"memory": "cpp",
"memory_resource": "cpp",
"numeric": "cpp",
"optional": "cpp",
"random": "cpp",
"string": "cpp",
"string_view": "cpp",
"system_error": "cpp",
"tuple": "cpp",
"type_traits": "cpp",
"utility": "cpp",
"fstream": "cpp",
"initializer_list": "cpp",
"iosfwd": "cpp",
"iostream": "cpp",
"istream": "cpp",
"limits": "cpp",
"new": "cpp",
"ostream": "cpp",
"ranges": "cpp",
"stdexcept": "cpp",
"streambuf": "cpp",
"typeinfo": "cpp"
}
}
25 changes: 0 additions & 25 deletions exename.h

This file was deleted.

61 changes: 43 additions & 18 deletions main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,53 +22,54 @@
#if defined(_WIN32) || defined(WIN32)
#include <windows.h>
#define PATHCOMP strcasecmp //windows is case insensitive!
#define COLOR(args) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),stoi(#args,0,16)); //pass a hex value between 00 and ff (or integer equivalent)
#define COLOR(args) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), std::stoi(#args,0,16)) //pass a hex value between 00 and ff (or integer equivalent)
#else
#define PATHCOMP strcmp
#define COLOR(args)
void COLOR(int arg);
#endif

uint8_t *buffer;
std::string xor_data(uint8_t *buf, int size);
int main(int argc, char* argv[])
{
COLOR(0f)
std::cout;
COLOR(0x0f);
printf("Sheltered SaveFile Converter - By matias Israelson (AKA:El_isra)\n");
printf("Version [%s]\n",AutoVersion::FULLVERSION_STRING);
COLOR(07)
if(argc < 3) {
COLOR(0d)
COLOR(0x07);
if (argc < 3) {
COLOR(0x0d);
fprintf(stderr, "Sintax errror.\n\tUsage: %s infile outfile\n",argv[0]);
COLOR(07)
COLOR(0x07);
return 1;
}

if (!PATHCOMP(argv[1], argv[2]) {
if (!PATHCOMP(argv[1], argv[2])) {
fprintf(stderr, "error: input and output are the same!\n");
return -1
return -1;
}
vector<uint8_t> bytes;
std::vector<uint8_t> bytes;

ifstream file1(argv[1], ios_base::in | ios_base::binary);
std::ifstream file1(argv[1], std::ios_base::in | std::ios_base::binary);
if (!file1.is_open()) {
COLOR(0C)
COLOR(0x0C);
fprintf(stderr, "Could not open %s for input\n", argv[1]);
COLOR(07)
COLOR(0x07);
return 1;
}
COLOR(07)
COLOR(0x07);
while (file1.good())
{
bytes.push_back(file1.get());
}
size_t n = bytes.size();
uint8_t* buff = bytes.data();

std::ofstream out(argv[2], ios_base::binary);
printf("input file size: 0x%02lx", n);
std::ofstream out(argv[2], std::ios_base::binary);
if (!out.is_open()) {
COLOR(0C)
COLOR(0x0C);
fprintf(stderr, "Could not open %s for output\n", argv[2]);
COLOR(07)
COLOR(0x07);
return 1;
}
out << xor_data(buff, n);
Expand All @@ -90,3 +91,27 @@ std::string xor_data(uint8_t *buf,int size)
}
return output;
}


#if defined(_WIN32) || defined(WIN32)
#else
void COLOR(int arg) {
switch (arg)
{
case 0x0F:
puts("\e[0;97m"); //strong white
break;
case 0x0D:
puts("\e[0;95m"); //strong magenta
break;
case 0x0C:
puts("\e[0;91m"); //strong red
break;

case 0x07:
default:
puts("\e[0m");
break;
}
}
#endif
35 changes: 0 additions & 35 deletions shelteredsave2XML.depend

This file was deleted.

20 changes: 0 additions & 20 deletions shelteredsave2XML.layout

This file was deleted.

0 comments on commit 22f71f5

Please sign in to comment.