This repository has been archived by the owner on Mar 8, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
36 changed files
with
476 additions
and
249 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
#include "base64.h" | ||
|
||
std::string base64::encode(std::string_view s) | ||
{ | ||
std::string ret; | ||
ret.reserve((s.length() + 2) / 3 * 4); | ||
|
||
size_t pos = 0; | ||
while (pos < s.length()) | ||
{ | ||
ret += encoder[(s[pos] & 0xFC) >> 2]; | ||
if (pos + 1 < s.length()) | ||
{ | ||
ret += encoder[((s[pos] & 0x03) << 4) + ((s[pos + 1] & 0xF0) >> 4)]; | ||
if (pos + 2 < s.length()) | ||
{ | ||
ret += encoder[((s[pos + 1] & 0x0F) << 2) + ((s[pos + 2] & 0xC0) >> 6)]; | ||
ret += encoder[s[pos + 2] & 0x3F]; | ||
} | ||
else | ||
{ | ||
ret += encoder[(s[pos + 1] & 0x0F) << 2]; | ||
ret += '='; | ||
} | ||
} | ||
else | ||
{ | ||
ret += encoder[(s[pos + 0] & 0x03) << 4]; | ||
ret += "=="; | ||
} | ||
pos += 3; | ||
} | ||
|
||
ret.shrink_to_fit(); | ||
return ret; | ||
} | ||
|
||
std::string base64::decode(std::string_view s) | ||
{ | ||
std::string ret; | ||
ret.reserve(s.length() / 4 * 3); | ||
|
||
size_t pos = 0; | ||
while (pos < s.length()) | ||
{ | ||
auto p1 = decoder[s[pos + 1]]; | ||
ret += ((decoder[s[pos]]) << 2) + ((p1 & 0x30) >> 4); | ||
if ((pos + 2 < s.length()) && s[pos + 2] != '=' && s[pos + 2] != '.') | ||
{ | ||
auto p2 = decoder[s[pos + 2]]; | ||
ret += ((p1 & 0x0F) << 4) + ((p2 & 0x3C) >> 2); | ||
if ((pos + 3 < s.length()) && s[pos + 3] != '=' && s[pos + 3] != '.') | ||
ret += (((p2 & 0x03) << 6) + decoder[s[pos + 3]]); | ||
} | ||
pos += 4; | ||
} | ||
|
||
ret.shrink_to_fit(); | ||
return ret; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#pragma once | ||
|
||
#include <string> | ||
|
||
class base64 | ||
{ | ||
public: | ||
static std::string encode(std::string_view s); | ||
static std::string decode(std::string_view s); | ||
private: | ||
static constexpr char encoder[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; | ||
static constexpr unsigned char const decoder[256] = | ||
{ | ||
0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, | ||
0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, | ||
0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, | ||
0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, | ||
0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xF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FE, 0xFE, 0xFE, 0xFE, | ||
0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, | ||
0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, | ||
0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, | ||
0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, | ||
0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, | ||
0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#pragma once | ||
|
||
extern "C" | ||
{ | ||
__declspec(dllimport) void* __stdcall CncImgMalloc(unsigned int sz); | ||
__declspec(dllimport) void __stdcall CncImgFree(void* ptr); | ||
|
||
__declspec(dllimport) void __stdcall CncImgCreate(); | ||
__declspec(dllimport) void __stdcall CncImgRelease(); | ||
|
||
__declspec(dllimport) void __stdcall CncImgSetMaxFacing(unsigned int nFacingCount); | ||
__declspec(dllimport) unsigned int __stdcall CncImgGetMaxFacing(); | ||
|
||
__declspec(dllimport) bool __stdcall CncImgLoadVPLFile(const unsigned char* pBuffer); | ||
__declspec(dllimport) bool __stdcall CncImgLoadVXLFile(const unsigned char* pBuffer); | ||
__declspec(dllimport) bool __stdcall CncImgLoadHVAFile(const unsigned char* pBuffer); | ||
|
||
__declspec(dllimport) bool __stdcall CncImgPrepareVXLCache(unsigned int nFacing, int F, int L, int H); | ||
__declspec(dllimport) int __stdcall CncImgGetImageWidth(unsigned int nFacing); | ||
__declspec(dllimport) int __stdcall CncImgGetImageHeight(unsigned int nFacing); | ||
__declspec(dllimport) void __stdcall CncImgGetImageFrame(unsigned int nFacing, int* width, int* height, int* x, int* y); | ||
__declspec(dllimport) void __stdcall CncImgGetImageSize(unsigned int nFacing, int* width, int* height); | ||
__declspec(dllimport) bool __stdcall CncImgGetImageData(unsigned int nFacing, unsigned char** ppBuffer); | ||
|
||
__declspec(dllimport) void __stdcall CncImgClearCurrentVXL(); | ||
__declspec(dllimport) bool __stdcall CncImgIsVXLLoaded(); | ||
__declspec(dllimport) bool __stdcall CncImgIsVPLLoaded(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#include <Helpers/Macro.h> | ||
#include <CCreateMap3A.h> | ||
|
||
// Issue #22 | ||
DEFINE_HOOK(42DF67, CCreateMap2_SkipEnableAITriggers, 7) | ||
{ | ||
return 0x42E0AA; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.