├── GCC-Collector ├── deps │ ├── lib │ │ ├── DirectXTK.lib │ │ └── ScriptHookV.lib │ ├── ScriptHookVInc │ │ ├── types.h │ │ └── main.h │ └── DirectXTKInc │ │ ├── GraphicsMemory.h │ │ ├── ScreenGrab.h │ │ ├── XboxDDSTextureLoader.h │ │ ├── CommonStates.h │ │ ├── SpriteFont.h │ │ ├── Mouse.h │ │ ├── SpriteBatch.h │ │ ├── PrimitiveBatch.h │ │ ├── DirectXHelpers.h │ │ ├── WICTextureLoader.h │ │ ├── DDSTextureLoader.h │ │ ├── GeometricPrimitive.h │ │ ├── Model.h │ │ ├── PostProcess.h │ │ └── GamePad.h ├── GCC-Collector │ ├── GCC-Collector.vcxproj.user │ ├── script.h │ ├── defineArea.h │ ├── animation.h │ ├── keyboard.h │ ├── camera.h │ ├── setLevel.h │ ├── utils.h │ ├── export.h │ ├── animation.cpp │ ├── setLevel.cpp │ ├── infoIO.h │ ├── GCC-Collector.vcxproj.filters │ ├── createCrowd.h │ ├── keyboard.cpp │ ├── script.cpp │ ├── utils.cpp │ ├── defineArea.cpp │ ├── camera.cpp │ ├── GCC-Collector.vcxproj │ ├── infoIO.cpp │ └── export.cpp └── GCC-Collector.sln ├── noVehicle ├── noVehicle │ ├── lib │ │ └── ScriptHookV.lib │ ├── noVehicle.vcxproj.user │ ├── src │ │ ├── script.h │ │ ├── keyboard.h │ │ ├── main.cpp │ │ ├── script.cpp │ │ ├── types.h │ │ ├── keyboard.cpp │ │ └── main.h │ ├── noVehicle.vcxproj.filters │ └── noVehicle.vcxproj └── noVehicle.sln ├── unlimitedLife ├── unlimitedLife │ ├── lib │ │ └── ScriptHookV.lib │ ├── unlimitedLife.vcxproj.user │ ├── src │ │ ├── script.h │ │ ├── keyboard.h │ │ ├── main.cpp │ │ ├── script.cpp │ │ ├── types.h │ │ ├── keyboard.cpp │ │ └── main.h │ ├── unlimitedLife.vcxproj.filters │ └── unlimitedLife.vcxproj └── unlimitedLife.sln ├── .gitignore ├── LICENSE ├── GCC-Labeler ├── mkInfo.py ├── getHead.py ├── main.py └── combine.py └── README.md /GCC-Collector/deps/lib/DirectXTK.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gjy3035/GCC-CL/HEAD/GCC-Collector/deps/lib/DirectXTK.lib -------------------------------------------------------------------------------- /GCC-Collector/deps/lib/ScriptHookV.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gjy3035/GCC-CL/HEAD/GCC-Collector/deps/lib/ScriptHookV.lib -------------------------------------------------------------------------------- /noVehicle/noVehicle/lib/ScriptHookV.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gjy3035/GCC-CL/HEAD/noVehicle/noVehicle/lib/ScriptHookV.lib -------------------------------------------------------------------------------- /unlimitedLife/unlimitedLife/lib/ScriptHookV.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gjy3035/GCC-CL/HEAD/unlimitedLife/unlimitedLife/lib/ScriptHookV.lib -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # root 2 | .vscode 3 | 4 | # GCC-Collector 5 | x64 6 | .vs 7 | packages 8 | packages.config 9 | 10 | # GCC-Labeler 11 | source 12 | target 13 | -------------------------------------------------------------------------------- /noVehicle/noVehicle/noVehicle.vcxproj.user: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /GCC-Collector/GCC-Collector/GCC-Collector.vcxproj.user: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /unlimitedLife/unlimitedLife/unlimitedLife.vcxproj.user: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /noVehicle/noVehicle/src/script.h: -------------------------------------------------------------------------------- 1 | /* 2 | THIS FILE IS A PART OF GTA V SCRIPT HOOK SDK 3 | http://dev-c.com 4 | (C) Alexander Blade 2015 5 | */ 6 | 7 | #pragma once 8 | 9 | #include "natives.h" 10 | #include "types.h" 11 | #include "enums.h" 12 | #include "main.h" 13 | 14 | void ScriptMain(); -------------------------------------------------------------------------------- /unlimitedLife/unlimitedLife/src/script.h: -------------------------------------------------------------------------------- 1 | /* 2 | THIS FILE IS A PART OF GTA V SCRIPT HOOK SDK 3 | http://dev-c.com 4 | (C) Alexander Blade 2015 5 | */ 6 | 7 | #pragma once 8 | 9 | #include "natives.h" 10 | #include "types.h" 11 | #include "enums.h" 12 | #include "main.h" 13 | 14 | void ScriptMain(); -------------------------------------------------------------------------------- /GCC-Collector/GCC-Collector/script.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "natives.h" 3 | #include "types.h" 4 | #include "enums.h" 5 | #include "main.h" 6 | 7 | enum scriptStatusEnum { 8 | scriptStart, 9 | scriptStop, 10 | scriptReady, 11 | scriptReadyCamera, 12 | cameraMode, 13 | cameraModeEnd, 14 | scriptReadyDefineArea, 15 | defineArea, 16 | defineAreaEnd, 17 | scriptReadySetLevel, 18 | setLevel, 19 | setLevelEnd, 20 | scriptEndReady 21 | }; 22 | extern scriptStatusEnum scriptStatus; 23 | void scriptMain(); -------------------------------------------------------------------------------- /noVehicle/noVehicle/src/keyboard.h: -------------------------------------------------------------------------------- 1 | /* 2 | THIS FILE IS A PART OF GTA V SCRIPT HOOK SDK 3 | http://dev-c.com 4 | (C) Alexander Blade 2015 5 | */ 6 | 7 | #pragma once 8 | 9 | #include 10 | 11 | // parameters are the same as with aru's ScriptHook for IV 12 | void OnKeyboardMessage(DWORD key, WORD repeats, BYTE scanCode, BOOL isExtended, BOOL isWithAlt, BOOL wasDownBefore, BOOL isUpNow); 13 | 14 | bool IsKeyDown(DWORD key); 15 | bool IsKeyJustUp(DWORD key, bool exclusive = true); 16 | void ResetKeyState(DWORD key); -------------------------------------------------------------------------------- /GCC-Collector/GCC-Collector/defineArea.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "natives.h" 3 | #include "infoIO.h" 4 | #include 5 | 6 | extern bool defineAreaMode; 7 | 8 | bool setPoint(); 9 | bool resetPoint(); 10 | int saveOneArea(); 11 | void deleteBddefer(); 12 | 13 | struct pedLocation { 14 | float x, y; 15 | 16 | pedLocation(); 17 | pedLocation(float _x, float _y); 18 | }; 19 | 20 | void startDefineArea(); 21 | float cross(pedLocation &p0, pedLocation &p1, pedLocation &p2); 22 | bool inCircle(float x, float y); 23 | void showArea(); -------------------------------------------------------------------------------- /unlimitedLife/unlimitedLife/src/keyboard.h: -------------------------------------------------------------------------------- 1 | /* 2 | THIS FILE IS A PART OF GTA V SCRIPT HOOK SDK 3 | http://dev-c.com 4 | (C) Alexander Blade 2015 5 | */ 6 | 7 | #pragma once 8 | 9 | #include 10 | 11 | // parameters are the same as with aru's ScriptHook for IV 12 | void OnKeyboardMessage(DWORD key, WORD repeats, BYTE scanCode, BOOL isExtended, BOOL isWithAlt, BOOL wasDownBefore, BOOL isUpNow); 13 | 14 | bool IsKeyDown(DWORD key); 15 | bool IsKeyJustUp(DWORD key, bool exclusive = true); 16 | void ResetKeyState(DWORD key); -------------------------------------------------------------------------------- /GCC-Collector/GCC-Collector/animation.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | struct Animation 6 | { 7 | int shortcutIndex; 8 | std::string strShortcutIndex; 9 | char* animLibrary; 10 | char* animName; 11 | int duration; 12 | 13 | std::string toString() { 14 | return strShortcutIndex + " " + std::string(animLibrary) + " " + std::string(animName) + " " + std::to_string(duration); 15 | } 16 | }; 17 | 18 | bool initAnimations(std::string fileName); 19 | 20 | Animation randomAnimation(); 21 | int animNum(); 22 | 23 | Animation getAnim(int id); -------------------------------------------------------------------------------- /GCC-Collector/GCC-Collector/keyboard.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "types.h" 3 | #include 4 | #include 5 | struct keyInfo { 6 | const static int MAX_DOWN; 7 | DWORD time; 8 | BOOL isWithAlt; 9 | BOOL wasDownBefore; 10 | BOOL isUpNow; 11 | 12 | keyInfo(); 13 | bool isKeyDown(); 14 | void pushDown(BOOL _isUpNow, BOOL _isWithAlt, BOOL _wasDownBefore); 15 | }; 16 | extern keyInfo W, A, S, D, V, shift, ctrl, tab, oemPlus, oemMinus, F10, I, F11, numKey[10]; 17 | 18 | void OnKeyboardMessage(DWORD key, WORD repeats, BYTE scanCode, BOOL isExtended, BOOL isWithAlt, BOOL wasDownBefore, BOOL isUpNow); -------------------------------------------------------------------------------- /noVehicle/noVehicle/src/main.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | THIS FILE IS A PART OF GTA V SCRIPT HOOK SDK 3 | http://dev-c.com 4 | (C) Alexander Blade 2015 5 | */ 6 | 7 | #include "main.h" 8 | #include "script.h" 9 | #include "keyboard.h" 10 | 11 | BOOL APIENTRY DllMain(HMODULE hInstance, DWORD reason, LPVOID lpReserved) 12 | { 13 | switch (reason) 14 | { 15 | case DLL_PROCESS_ATTACH: 16 | scriptRegister(hInstance, ScriptMain); 17 | keyboardHandlerRegister(OnKeyboardMessage); 18 | break; 19 | case DLL_PROCESS_DETACH: 20 | scriptUnregister(hInstance); 21 | keyboardHandlerUnregister(OnKeyboardMessage); 22 | break; 23 | } 24 | return TRUE; 25 | } -------------------------------------------------------------------------------- /noVehicle/noVehicle/src/script.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | THIS FILE IS A PART OF GTA V SCRIPT HOOK SDK 3 | http://dev-c.com 4 | (C) Alexander Blade 2015 5 | */ 6 | 7 | /* 8 | F4 activate 9 | NUM2/8/4/6 navigate thru the menus and lists (numlock must be on) 10 | NUM5 select 11 | NUM0/BACKSPACE/F4 back 12 | NUM9/3 use vehicle boost when active 13 | NUM+ use vehicle rockets when active 14 | */ 15 | 16 | #include "script.h" 17 | 18 | void ScriptMain() 19 | { 20 | while (true) { 21 | VEHICLE::SET_VEHICLE_DENSITY_MULTIPLIER_THIS_FRAME(0.0f); 22 | PED::SET_PED_DENSITY_MULTIPLIER_THIS_FRAME(0.0f); 23 | WAIT(0); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /unlimitedLife/unlimitedLife/src/main.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | THIS FILE IS A PART OF GTA V SCRIPT HOOK SDK 3 | http://dev-c.com 4 | (C) Alexander Blade 2015 5 | */ 6 | 7 | #include "main.h" 8 | #include "script.h" 9 | #include "keyboard.h" 10 | 11 | BOOL APIENTRY DllMain(HMODULE hInstance, DWORD reason, LPVOID lpReserved) 12 | { 13 | switch (reason) 14 | { 15 | case DLL_PROCESS_ATTACH: 16 | scriptRegister(hInstance, ScriptMain); 17 | keyboardHandlerRegister(OnKeyboardMessage); 18 | break; 19 | case DLL_PROCESS_DETACH: 20 | scriptUnregister(hInstance); 21 | keyboardHandlerUnregister(OnKeyboardMessage); 22 | break; 23 | } 24 | return TRUE; 25 | } -------------------------------------------------------------------------------- /unlimitedLife/unlimitedLife/src/script.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | THIS FILE IS A PART OF GTA V SCRIPT HOOK SDK 3 | http://dev-c.com 4 | (C) Alexander Blade 2015 5 | */ 6 | 7 | /* 8 | F4 activate 9 | NUM2/8/4/6 navigate thru the menus and lists (numlock must be on) 10 | NUM5 select 11 | NUM0/BACKSPACE/F4 back 12 | NUM9/3 use vehicle boost when active 13 | NUM+ use vehicle rockets when active 14 | */ 15 | 16 | #include "script.h" 17 | 18 | void ScriptMain() 19 | { 20 | while (true) { 21 | Ped myPed = PLAYER::PLAYER_PED_ID(); 22 | int health = PED::GET_PED_MAX_HEALTH(myPed); 23 | ENTITY::SET_ENTITY_HEALTH(myPed, health); 24 | PED::CLEAR_PED_BLOOD_DAMAGE(myPed); 25 | WAIT(0); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /GCC-Collector/GCC-Collector/camera.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "natives.h" 4 | #include "types.h" 5 | #include "enums.h" 6 | #include "main.h" 7 | #include 8 | 9 | const float PI = acos(1.0) * 2; 10 | const float cameraSpeedFactor = 0.1; 11 | 12 | extern bool CameraMode; 13 | extern int adjustCameraFinished; 14 | 15 | void startNewCamera(); 16 | void adjustCamera(); 17 | void StopCamera(int foldNo = 0); 18 | 19 | bool showCamera(); 20 | void showCamera(float &camX, float &camY); 21 | 22 | void getCameraLoc(float &camX, float &camY); 23 | void getCameraLoc(float &camX, float &camY, float &camZ); 24 | 25 | void show2False(); 26 | void showCamera4(int No = adjustCameraFinished); 27 | bool saveCamera4(int No = adjustCameraFinished); 28 | void gobackcamera(); 29 | //bool cameraToOrigin(); -------------------------------------------------------------------------------- /GCC-Collector/GCC-Collector/setLevel.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include "keyboard.h" 4 | extern bool setLevelMode; 5 | 6 | struct levelStruct { 7 | static int now; 8 | int lev, maxNum; 9 | std::string levShow; 10 | keyInfo *setKey; 11 | 12 | levelStruct(); 13 | levelStruct(int _lev, int _maxNum, std::string _levShow); 14 | }; 15 | 16 | const levelStruct level[] = { 17 | levelStruct(), // no use 18 | levelStruct(1, 10, "1-(1:10)"), 19 | levelStruct(2, 20, "2-(1:20)"), 20 | levelStruct(3, 50, "3-(1:50)"), 21 | levelStruct(4, 100, "4-(1:100)"), 22 | levelStruct(5, 300, "5-(1:300)"), 23 | levelStruct(6, 600, "6-(1:600)"), 24 | levelStruct(7, 1000, "7-(1:1000)"), 25 | levelStruct(8, 2000, "8-(1:2000)"), 26 | levelStruct(9, 4000, "9-(1:4000)") 27 | }; 28 | 29 | const int levelNum = int(sizeof(level) / sizeof(levelStruct)); 30 | 31 | void createLevelSaveFile(); 32 | void setSceneLevel(); 33 | void stopSetLevel(); 34 | -------------------------------------------------------------------------------- /GCC-Collector/GCC-Collector/utils.h: -------------------------------------------------------------------------------- 1 | /* 2 | THIS FILE IS A PART OF GTA V SCRIPT HOOK SDK 3 | http://dev-c.com 4 | (C) Alexander Blade 2015 5 | */ 6 | 7 | #pragma once 8 | 9 | #include 10 | #include 11 | #include 12 | #include "types.h" 13 | #include "natives.h" 14 | 15 | // returns module load path with trailing slash 16 | std::string GetCurrentModulePath(); 17 | std::string roundNumber(float number); 18 | 19 | std::string actionInputString(int maxLength); 20 | DWORD actionInputDword(); 21 | float actionInputFloat(); 22 | 23 | 24 | class StringUtils { 25 | public: 26 | static void split(const std::string &s, char delim, std::vector &elems); 27 | static std::vector split(const std::string &s, char delim); 28 | }; 29 | 30 | 31 | 32 | class MathUtils { 33 | public: 34 | static Vector3 rotationToDirection(Vector3 rotation); 35 | static Vector3 crossProduct(Vector3 a, Vector3 b); 36 | }; -------------------------------------------------------------------------------- /noVehicle/noVehicle/src/types.h: -------------------------------------------------------------------------------- 1 | /* 2 | THIS FILE IS A PART OF GTA V SCRIPT HOOK SDK 3 | http://dev-c.com 4 | (C) Alexander Blade 2015 5 | */ 6 | 7 | #pragma once 8 | 9 | #include 10 | 11 | typedef DWORD Void; 12 | typedef DWORD Any; 13 | typedef DWORD uint; 14 | typedef DWORD Hash; 15 | typedef int Entity; 16 | typedef int Player; 17 | typedef int FireId; 18 | typedef int Ped; 19 | typedef int Vehicle; 20 | typedef int Cam; 21 | typedef int CarGenerator; 22 | typedef int Group; 23 | typedef int Train; 24 | typedef int Pickup; 25 | typedef int Object; 26 | typedef int Weapon; 27 | typedef int Interior; 28 | typedef int Blip; 29 | typedef int Texture; 30 | typedef int TextureDict; 31 | typedef int CoverPoint; 32 | typedef int Camera; 33 | typedef int TaskSequence; 34 | typedef int ColourIndex; 35 | typedef int Sphere; 36 | typedef int ScrHandle; 37 | 38 | #pragma pack(push, 1) 39 | typedef struct 40 | { 41 | float x; 42 | DWORD _paddingx; 43 | float y; 44 | DWORD _paddingy; 45 | float z; 46 | DWORD _paddingz; 47 | } Vector3; 48 | #pragma pack(pop) -------------------------------------------------------------------------------- /unlimitedLife/unlimitedLife/src/types.h: -------------------------------------------------------------------------------- 1 | /* 2 | THIS FILE IS A PART OF GTA V SCRIPT HOOK SDK 3 | http://dev-c.com 4 | (C) Alexander Blade 2015 5 | */ 6 | 7 | #pragma once 8 | 9 | #include 10 | 11 | typedef DWORD Void; 12 | typedef DWORD Any; 13 | typedef DWORD uint; 14 | typedef DWORD Hash; 15 | typedef int Entity; 16 | typedef int Player; 17 | typedef int FireId; 18 | typedef int Ped; 19 | typedef int Vehicle; 20 | typedef int Cam; 21 | typedef int CarGenerator; 22 | typedef int Group; 23 | typedef int Train; 24 | typedef int Pickup; 25 | typedef int Object; 26 | typedef int Weapon; 27 | typedef int Interior; 28 | typedef int Blip; 29 | typedef int Texture; 30 | typedef int TextureDict; 31 | typedef int CoverPoint; 32 | typedef int Camera; 33 | typedef int TaskSequence; 34 | typedef int ColourIndex; 35 | typedef int Sphere; 36 | typedef int ScrHandle; 37 | 38 | #pragma pack(push, 1) 39 | typedef struct 40 | { 41 | float x; 42 | DWORD _paddingx; 43 | float y; 44 | DWORD _paddingy; 45 | float z; 46 | DWORD _paddingz; 47 | } Vector3; 48 | #pragma pack(pop) -------------------------------------------------------------------------------- /GCC-Collector/deps/ScriptHookVInc/types.h: -------------------------------------------------------------------------------- 1 | /* 2 | THIS FILE IS A PART OF GTA V SCRIPT HOOK SDK 3 | http://dev-c.com 4 | (C) Alexander Blade 2015 5 | */ 6 | 7 | #pragma once 8 | 9 | #include 10 | 11 | typedef DWORD Void; 12 | typedef DWORD Any; 13 | typedef DWORD uint; 14 | typedef DWORD Hash; 15 | typedef int Entity; 16 | typedef int Player; 17 | typedef int FireId; 18 | typedef int Ped; 19 | typedef int Vehicle; 20 | typedef int Cam; 21 | typedef int CarGenerator; 22 | typedef int Group; 23 | typedef int Train; 24 | typedef int Pickup; 25 | typedef int Object; 26 | typedef int Weapon; 27 | typedef int Interior; 28 | typedef int Blip; 29 | typedef int Texture; 30 | typedef int TextureDict; 31 | typedef int CoverPoint; 32 | typedef int Camera; 33 | typedef int TaskSequence; 34 | typedef int ColourIndex; 35 | typedef int Sphere; 36 | typedef int ScrHandle; 37 | 38 | #pragma pack(push, 1) 39 | typedef struct 40 | { 41 | float x; 42 | DWORD _paddingx; 43 | float y; 44 | DWORD _paddingy; 45 | float z; 46 | DWORD _paddingz; 47 | } Vector3; 48 | #pragma pack(pop) -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Junyu Gao 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /GCC-Collector/GCC-Collector/export.h: -------------------------------------------------------------------------------- 1 | #ifndef GTA_VISION_NATIVE_EXPORT_H 2 | #define GTA_VISION_NATIVE_EXPORT_H 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | void ExtractDepthBuffer(ID3D11Device* dev, ID3D11DeviceContext* ctx, ID3D11Resource* tex); 9 | void ExtractColorBuffer(ID3D11Device* dev, ID3D11DeviceContext* ctx, ID3D11Resource* tex); 10 | void ExtractConstantBuffer(ID3D11Device* dev, ID3D11DeviceContext* ctx, ID3D11Buffer* buf); 11 | void ExtractScreenBuffer(ID3D11DeviceContext* ctx, ID3D11Texture2D* back, HRESULT hr); 12 | void CopyIfRequested(); 13 | void writeLog(std::string); 14 | 15 | struct rage_matrices { 16 | Eigen::Matrix4f M; 17 | Eigen::Matrix4f MV; 18 | Eigen::Matrix4f MVP; 19 | Eigen::Matrix4f Vinv; 20 | }; 21 | 22 | extern "C" { 23 | __declspec(dllexport) int export_get_depth_buffer(void** buf); 24 | __declspec(dllexport) int export_get_color_buffer(void** buf); 25 | __declspec(dllexport) int export_get_stencil_buffer(void** buf); 26 | __declspec(dllexport) int export_get_constant_buffer(rage_matrices* buf); 27 | __declspec(dllexport) int export_get_screen_buffer(WCHAR *pictureName); 28 | } 29 | #endif -------------------------------------------------------------------------------- /GCC-Collector/GCC-Collector/animation.cpp: -------------------------------------------------------------------------------- 1 | #include "animation.h" 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include "natives.h" 7 | 8 | std::vector gtaAnimations; 9 | 10 | bool initAnimations(std::string fileName) { 11 | gtaAnimations.reserve(97101 + 10); 12 | 13 | 14 | std::ifstream animationsFile; 15 | animationsFile.open(fileName); 16 | 17 | if (!animationsFile) { 18 | return false; 19 | } 20 | int index = 1; 21 | std::string strShortcutIndex; 22 | std::string animLibrary; 23 | std::string animName; 24 | int duration; 25 | 26 | std::ofstream ss("exist.txt", std::ios_base::app); 27 | while (animationsFile >> strShortcutIndex >> animLibrary >> animName >> duration) 28 | { 29 | gtaAnimations.push_back({ index,strShortcutIndex,_strdup(animLibrary.c_str()), _strdup(animName.c_str()),duration }); 30 | index++; 31 | bool ex = STREAMING::DOES_ANIM_DICT_EXIST(_strdup(animLibrary.c_str())); 32 | ss << ex << std::endl; 33 | } 34 | ss.close(); 35 | 36 | return true; 37 | } 38 | 39 | Animation randomAnimation() 40 | { 41 | int l = gtaAnimations.size(); 42 | return gtaAnimations[rand() % l]; 43 | } 44 | 45 | int animNum() 46 | { 47 | return gtaAnimations.size(); 48 | } 49 | 50 | Animation getAnim(int id) 51 | { 52 | return gtaAnimations[id]; 53 | } -------------------------------------------------------------------------------- /noVehicle/noVehicle/src/keyboard.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | THIS FILE IS A PART OF GTA V SCRIPT HOOK SDK 3 | http://dev-c.com 4 | (C) Alexander Blade 2015 5 | */ 6 | 7 | #include "keyboard.h" 8 | 9 | const int KEYS_SIZE = 255; 10 | 11 | struct { 12 | DWORD time; 13 | BOOL isWithAlt; 14 | BOOL wasDownBefore; 15 | BOOL isUpNow; 16 | } keyStates[KEYS_SIZE]; 17 | 18 | void OnKeyboardMessage(DWORD key, WORD repeats, BYTE scanCode, BOOL isExtended, BOOL isWithAlt, BOOL wasDownBefore, BOOL isUpNow) 19 | { 20 | if (key < KEYS_SIZE) 21 | { 22 | keyStates[key].time = GetTickCount(); 23 | keyStates[key].isWithAlt = isWithAlt; 24 | keyStates[key].wasDownBefore = wasDownBefore; 25 | keyStates[key].isUpNow = isUpNow; 26 | } 27 | } 28 | 29 | const int NOW_PERIOD = 100, MAX_DOWN = 5000; // ms 30 | 31 | bool IsKeyDown(DWORD key) 32 | { 33 | return (key < KEYS_SIZE) ? ((GetTickCount() < keyStates[key].time + MAX_DOWN) && !keyStates[key].isUpNow) : false; 34 | } 35 | 36 | bool IsKeyJustUp(DWORD key, bool exclusive) 37 | { 38 | bool b = (key < KEYS_SIZE) ? (GetTickCount() < keyStates[key].time + NOW_PERIOD && keyStates[key].isUpNow) : false; 39 | if (b && exclusive) 40 | ResetKeyState(key); 41 | return b; 42 | } 43 | 44 | void ResetKeyState(DWORD key) 45 | { 46 | if (key < KEYS_SIZE) 47 | memset(&keyStates[key], 0, sizeof(keyStates[0])); 48 | } -------------------------------------------------------------------------------- /unlimitedLife/unlimitedLife/src/keyboard.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | THIS FILE IS A PART OF GTA V SCRIPT HOOK SDK 3 | http://dev-c.com 4 | (C) Alexander Blade 2015 5 | */ 6 | 7 | #include "keyboard.h" 8 | 9 | const int KEYS_SIZE = 255; 10 | 11 | struct { 12 | DWORD time; 13 | BOOL isWithAlt; 14 | BOOL wasDownBefore; 15 | BOOL isUpNow; 16 | } keyStates[KEYS_SIZE]; 17 | 18 | void OnKeyboardMessage(DWORD key, WORD repeats, BYTE scanCode, BOOL isExtended, BOOL isWithAlt, BOOL wasDownBefore, BOOL isUpNow) 19 | { 20 | if (key < KEYS_SIZE) 21 | { 22 | keyStates[key].time = GetTickCount(); 23 | keyStates[key].isWithAlt = isWithAlt; 24 | keyStates[key].wasDownBefore = wasDownBefore; 25 | keyStates[key].isUpNow = isUpNow; 26 | } 27 | } 28 | 29 | const int NOW_PERIOD = 100, MAX_DOWN = 5000; // ms 30 | 31 | bool IsKeyDown(DWORD key) 32 | { 33 | return (key < KEYS_SIZE) ? ((GetTickCount() < keyStates[key].time + MAX_DOWN) && !keyStates[key].isUpNow) : false; 34 | } 35 | 36 | bool IsKeyJustUp(DWORD key, bool exclusive) 37 | { 38 | bool b = (key < KEYS_SIZE) ? (GetTickCount() < keyStates[key].time + NOW_PERIOD && keyStates[key].isUpNow) : false; 39 | if (b && exclusive) 40 | ResetKeyState(key); 41 | return b; 42 | } 43 | 44 | void ResetKeyState(DWORD key) 45 | { 46 | if (key < KEYS_SIZE) 47 | memset(&keyStates[key], 0, sizeof(keyStates[0])); 48 | } -------------------------------------------------------------------------------- /GCC-Collector/GCC-Collector/setLevel.cpp: -------------------------------------------------------------------------------- 1 | #include "setLevel.h" 2 | #include "infoIO.h" 3 | #include "keyboard.h" 4 | #include 5 | 6 | bool setLevelMode = false; 7 | int levelStruct::now = 0; 8 | 9 | void showLevel() 10 | { 11 | for (int i = 1; i < levelNum; i++) { 12 | set_status_text("level " + std::to_string(level[i].lev) + " : " + level[i].levShow); 13 | } 14 | } 15 | 16 | void createLevelSaveFile() 17 | { 18 | levelStruct::now = 0; 19 | set_status_text("select scene level..."); 20 | showLevel(); 21 | set_status_text("press down number key 1 to " + std::to_string(levelNum) + " to select one"); 22 | set_status_text("press down '0' to show level table again."); 23 | } 24 | 25 | void setSceneLevel() 26 | { 27 | if (numKey[0].isKeyDown()) { 28 | showLevel(); 29 | } 30 | for (int i = 1; i < levelNum; i++) { 31 | if (numKey[i].isKeyDown()) { 32 | levelStruct::now = i; 33 | set_status_text("now the level is " + level[i].levShow); 34 | set_status_text("press F12 to save, or press another number for another level"); 35 | break; 36 | } 37 | } 38 | } 39 | 40 | void stopSetLevel() 41 | { 42 | writeLeveFile(levelStruct::now); 43 | setLevelMode = false; 44 | } 45 | 46 | levelStruct::levelStruct() { 47 | lev = 0, maxNum = 0, levShow = "", setKey = NULL; 48 | } 49 | 50 | levelStruct::levelStruct(int _lev, int _maxNum, std::string _levShow) 51 | :lev(_lev), maxNum(_maxNum), levShow(_levShow) 52 | { 53 | setKey = lev < 10 ? numKey + lev : NULL; 54 | } -------------------------------------------------------------------------------- /noVehicle/noVehicle.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 15 4 | VisualStudioVersion = 15.0.27428.2043 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "noVehicle", "noVehicle\noVehicle.vcxproj", "{6AD7722A-142B-499E-8204-5F79FB123EE9}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|x64 = Debug|x64 11 | Debug|x86 = Debug|x86 12 | Release|x64 = Release|x64 13 | Release|x86 = Release|x86 14 | EndGlobalSection 15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 16 | {6AD7722A-142B-499E-8204-5F79FB123EE9}.Debug|x64.ActiveCfg = Debug|x64 17 | {6AD7722A-142B-499E-8204-5F79FB123EE9}.Debug|x64.Build.0 = Debug|x64 18 | {6AD7722A-142B-499E-8204-5F79FB123EE9}.Debug|x86.ActiveCfg = Debug|Win32 19 | {6AD7722A-142B-499E-8204-5F79FB123EE9}.Debug|x86.Build.0 = Debug|Win32 20 | {6AD7722A-142B-499E-8204-5F79FB123EE9}.Release|x64.ActiveCfg = Release|x64 21 | {6AD7722A-142B-499E-8204-5F79FB123EE9}.Release|x64.Build.0 = Release|x64 22 | {6AD7722A-142B-499E-8204-5F79FB123EE9}.Release|x86.ActiveCfg = Release|Win32 23 | {6AD7722A-142B-499E-8204-5F79FB123EE9}.Release|x86.Build.0 = Release|Win32 24 | EndGlobalSection 25 | GlobalSection(SolutionProperties) = preSolution 26 | HideSolutionNode = FALSE 27 | EndGlobalSection 28 | GlobalSection(ExtensibilityGlobals) = postSolution 29 | SolutionGuid = {81F9253C-E3AD-42CC-AAF1-80CC9A1A2F5F} 30 | EndGlobalSection 31 | EndGlobal 32 | -------------------------------------------------------------------------------- /GCC-Collector/GCC-Collector/infoIO.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "types.h" 3 | #include "natives.h" 4 | #include "defineArea.h" 5 | #include 6 | #include 7 | 8 | #define console_log log_to_file 9 | 10 | const size_t fileLength(50); 11 | const int partLength = 1000; 12 | 13 | void set_status_text(std::string text); 14 | 15 | void log_to_file(std::string msg); 16 | void log_to_pedTxt(std::string message, char *fileName); 17 | 18 | const unsigned long dirMark = 16; 19 | bool initDataDir(); 20 | bool InitPartNo(); 21 | 22 | int defaultFold(); 23 | void markAddOneImage(); 24 | void createNewFold(); 25 | void changeFoldNo(int No); 26 | void foldCat(char *subString); 27 | void foldCat(WCHAR *substring); 28 | 29 | void writeCamInfo(const Vector3 &loc, const Vector3 &rot, const float &fov, int foldNo); 30 | void writeCamInfo(const Vector3 &loc, const Vector3 &rot, const float &fov); 31 | void wriet4Camera(); 32 | void readCamInfo(float &locx, float &locy, float &locz, float rotx, float &roty, float &rotz, float &fov); 33 | void readCamInfo(Vector3 &loc, Vector3 &rot, float &fov); 34 | 35 | void writeAreaInfo(const Vector3 &loc); 36 | void writeAreaInfo(const int &n); 37 | void writeZheight(float z); 38 | float readZheight(); 39 | void readAreaInfo(int &n, std::vector &pedLocations); 40 | void readAreaBorder(float &mix, float &mxx, float &miy, float &mxy); 41 | 42 | bool fileExist(WCHAR *path); 43 | bool fileExist(char *path); 44 | 45 | void writeLeveFile(int level = 1); 46 | int readLevelFile(); 47 | 48 | int readImgNum(); -------------------------------------------------------------------------------- /GCC-Collector/GCC-Collector.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 15 4 | VisualStudioVersion = 15.0.28307.271 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "GCC-Collector", "GCC-Collector\GCC-Collector.vcxproj", "{AC023A72-4938-4FE3-9BFC-57CEADFD6ACC}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|x64 = Debug|x64 11 | Debug|x86 = Debug|x86 12 | Release|x64 = Release|x64 13 | Release|x86 = Release|x86 14 | EndGlobalSection 15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 16 | {AC023A72-4938-4FE3-9BFC-57CEADFD6ACC}.Debug|x64.ActiveCfg = Debug|x64 17 | {AC023A72-4938-4FE3-9BFC-57CEADFD6ACC}.Debug|x64.Build.0 = Debug|x64 18 | {AC023A72-4938-4FE3-9BFC-57CEADFD6ACC}.Debug|x86.ActiveCfg = Debug|Win32 19 | {AC023A72-4938-4FE3-9BFC-57CEADFD6ACC}.Debug|x86.Build.0 = Debug|Win32 20 | {AC023A72-4938-4FE3-9BFC-57CEADFD6ACC}.Release|x64.ActiveCfg = Release|x64 21 | {AC023A72-4938-4FE3-9BFC-57CEADFD6ACC}.Release|x64.Build.0 = Release|x64 22 | {AC023A72-4938-4FE3-9BFC-57CEADFD6ACC}.Release|x86.ActiveCfg = Release|Win32 23 | {AC023A72-4938-4FE3-9BFC-57CEADFD6ACC}.Release|x86.Build.0 = Release|Win32 24 | EndGlobalSection 25 | GlobalSection(SolutionProperties) = preSolution 26 | HideSolutionNode = FALSE 27 | EndGlobalSection 28 | GlobalSection(ExtensibilityGlobals) = postSolution 29 | SolutionGuid = {8BC3E937-0EE8-497F-8351-2CCEC3CAF8A9} 30 | EndGlobalSection 31 | EndGlobal 32 | -------------------------------------------------------------------------------- /unlimitedLife/unlimitedLife.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 15 4 | VisualStudioVersion = 15.0.27428.2043 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "unlimitedLife", "unlimitedLife\unlimitedLife.vcxproj", "{594DE3DD-60B9-421E-9C41-F1345BE2D0FC}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|x64 = Debug|x64 11 | Debug|x86 = Debug|x86 12 | Release|x64 = Release|x64 13 | Release|x86 = Release|x86 14 | EndGlobalSection 15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 16 | {594DE3DD-60B9-421E-9C41-F1345BE2D0FC}.Debug|x64.ActiveCfg = Debug|x64 17 | {594DE3DD-60B9-421E-9C41-F1345BE2D0FC}.Debug|x64.Build.0 = Debug|x64 18 | {594DE3DD-60B9-421E-9C41-F1345BE2D0FC}.Debug|x86.ActiveCfg = Debug|Win32 19 | {594DE3DD-60B9-421E-9C41-F1345BE2D0FC}.Debug|x86.Build.0 = Debug|Win32 20 | {594DE3DD-60B9-421E-9C41-F1345BE2D0FC}.Release|x64.ActiveCfg = Release|x64 21 | {594DE3DD-60B9-421E-9C41-F1345BE2D0FC}.Release|x64.Build.0 = Release|x64 22 | {594DE3DD-60B9-421E-9C41-F1345BE2D0FC}.Release|x86.ActiveCfg = Release|Win32 23 | {594DE3DD-60B9-421E-9C41-F1345BE2D0FC}.Release|x86.Build.0 = Release|Win32 24 | EndGlobalSection 25 | GlobalSection(SolutionProperties) = preSolution 26 | HideSolutionNode = FALSE 27 | EndGlobalSection 28 | GlobalSection(ExtensibilityGlobals) = postSolution 29 | SolutionGuid = {D2CDB2E1-365C-43D5-A43C-19E5A24FD3F7} 30 | EndGlobalSection 31 | EndGlobal 32 | -------------------------------------------------------------------------------- /GCC-Collector/deps/DirectXTKInc/GraphicsMemory.h: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------------------------- 2 | // File: GraphicsMemory.h 3 | // 4 | // Copyright (c) Microsoft Corporation. All rights reserved. 5 | // Licensed under the MIT License. 6 | // 7 | // http://go.microsoft.com/fwlink/?LinkId=248929 8 | //-------------------------------------------------------------------------------------- 9 | 10 | #pragma once 11 | 12 | #if defined(_XBOX_ONE) && defined(_TITLE) 13 | #include 14 | #else 15 | #include 16 | #endif 17 | 18 | #include 19 | 20 | 21 | namespace DirectX 22 | { 23 | class GraphicsMemory 24 | { 25 | public: 26 | #if defined(_XBOX_ONE) && defined(_TITLE) 27 | GraphicsMemory(_In_ ID3D11DeviceX* device, UINT backBufferCount = 2); 28 | #else 29 | GraphicsMemory(_In_ ID3D11Device* device, UINT backBufferCount = 2); 30 | #endif 31 | GraphicsMemory(GraphicsMemory&& moveFrom) throw(); 32 | GraphicsMemory& operator= (GraphicsMemory&& moveFrom) throw(); 33 | 34 | GraphicsMemory(GraphicsMemory const&) = delete; 35 | GraphicsMemory& operator=(GraphicsMemory const&) = delete; 36 | 37 | virtual ~GraphicsMemory(); 38 | 39 | void* __cdecl Allocate(_In_opt_ ID3D11DeviceContext* context, size_t size, int alignment); 40 | 41 | void __cdecl Commit(); 42 | 43 | // Singleton 44 | static GraphicsMemory& __cdecl Get(); 45 | 46 | private: 47 | // Private implementation. 48 | class Impl; 49 | 50 | std::unique_ptr pImpl; 51 | }; 52 | } 53 | -------------------------------------------------------------------------------- /GCC-Collector/deps/DirectXTKInc/ScreenGrab.h: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------------------------- 2 | // File: ScreenGrab.h 3 | // 4 | // Function for capturing a 2D texture and saving it to a file (aka a 'screenshot' 5 | // when used on a Direct3D Render Target). 6 | // 7 | // Note these functions are useful as a light-weight runtime screen grabber. For 8 | // full-featured texture capture, DDS writer, and texture processing pipeline, 9 | // see the 'Texconv' sample and the 'DirectXTex' library. 10 | // 11 | // Copyright (c) Microsoft Corporation. All rights reserved. 12 | // Licensed under the MIT License. 13 | // 14 | // http://go.microsoft.com/fwlink/?LinkId=248926 15 | // http://go.microsoft.com/fwlink/?LinkId=248929 16 | //-------------------------------------------------------------------------------------- 17 | 18 | #pragma once 19 | 20 | #if defined(_XBOX_ONE) && defined(_TITLE) 21 | #include 22 | #else 23 | #include 24 | #endif 25 | 26 | #include 27 | 28 | #include 29 | #include 30 | 31 | 32 | namespace DirectX 33 | { 34 | HRESULT __cdecl SaveDDSTextureToFile( 35 | _In_ ID3D11DeviceContext* pContext, 36 | _In_ ID3D11Resource* pSource, 37 | _In_z_ const wchar_t* fileName); 38 | 39 | HRESULT __cdecl SaveWICTextureToFile( 40 | _In_ ID3D11DeviceContext* pContext, 41 | _In_ ID3D11Resource* pSource, 42 | _In_ REFGUID guidContainerFormat, 43 | _In_z_ const wchar_t* fileName, 44 | _In_opt_ const GUID* targetFormat = nullptr, 45 | _In_opt_ std::function setCustomProps = nullptr); 46 | } -------------------------------------------------------------------------------- /noVehicle/noVehicle/noVehicle.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;hm;inl;inc;ipp;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | 头文件 20 | 21 | 22 | 头文件 23 | 24 | 25 | 头文件 26 | 27 | 28 | 头文件 29 | 30 | 31 | 头文件 32 | 33 | 34 | 头文件 35 | 36 | 37 | 头文件 38 | 39 | 40 | 41 | 42 | 源文件 43 | 44 | 45 | 源文件 46 | 47 | 48 | 源文件 49 | 50 | 51 | -------------------------------------------------------------------------------- /unlimitedLife/unlimitedLife/unlimitedLife.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;hm;inl;inc;ipp;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | 头文件 20 | 21 | 22 | 头文件 23 | 24 | 25 | 头文件 26 | 27 | 28 | 头文件 29 | 30 | 31 | 头文件 32 | 33 | 34 | 头文件 35 | 36 | 37 | 头文件 38 | 39 | 40 | 41 | 42 | 源文件 43 | 44 | 45 | 源文件 46 | 47 | 48 | 源文件 49 | 50 | 51 | -------------------------------------------------------------------------------- /GCC-Collector/deps/DirectXTKInc/XboxDDSTextureLoader.h: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------------------------- 2 | // File: XboxDDSTextureLoader.h 3 | // 4 | // Functions for loading a DDS texture using the XBOX extended header and creating a 5 | // Direct3D11.X runtime resource for it via the CreatePlacement APIs 6 | // 7 | // Note these functions will not load standard DDS files. Use the DDSTextureLoader 8 | // module in the DirectXTex package or as part of the DirectXTK library to load 9 | // these files which use standard Direct3D resource creation APIs. 10 | // 11 | // Copyright (c) Microsoft Corporation. All rights reserved. 12 | // Licensed under the MIT License. 13 | // 14 | // http://go.microsoft.com/fwlink/?LinkId=248926 15 | // http://go.microsoft.com/fwlink/?LinkId=248929 16 | //-------------------------------------------------------------------------------------- 17 | 18 | #pragma once 19 | 20 | #if !defined(_XBOX_ONE) || !defined(_TITLE) 21 | #error This module only supports Xbox One exclusive apps 22 | #endif 23 | 24 | #include 25 | 26 | #include 27 | 28 | namespace Xbox 29 | { 30 | enum DDS_ALPHA_MODE 31 | { 32 | DDS_ALPHA_MODE_UNKNOWN = 0, 33 | DDS_ALPHA_MODE_STRAIGHT = 1, 34 | DDS_ALPHA_MODE_PREMULTIPLIED = 2, 35 | DDS_ALPHA_MODE_OPAQUE = 3, 36 | DDS_ALPHA_MODE_CUSTOM = 4, 37 | }; 38 | 39 | HRESULT __cdecl CreateDDSTextureFromMemory( 40 | _In_ ID3D11DeviceX* d3dDevice, 41 | _In_reads_bytes_(ddsDataSize) const uint8_t* ddsData, 42 | _In_ size_t ddsDataSize, 43 | _Outptr_opt_ ID3D11Resource** texture, 44 | _Outptr_opt_ ID3D11ShaderResourceView** textureView, 45 | _Outptr_ void** grfxMemory, 46 | _Out_opt_ DDS_ALPHA_MODE* alphaMode = nullptr, 47 | _In_ bool forceSRGB = false); 48 | 49 | HRESULT __cdecl CreateDDSTextureFromFile( _In_ ID3D11DeviceX* d3dDevice, 50 | _In_z_ const wchar_t* szFileName, 51 | _Outptr_opt_ ID3D11Resource** texture, 52 | _Outptr_opt_ ID3D11ShaderResourceView** textureView, 53 | _Outptr_ void** grfxMemory, 54 | _Out_opt_ DDS_ALPHA_MODE* alphaMode = nullptr, 55 | _In_ bool forceSRGB = false); 56 | 57 | void FreeDDSTextureMemory( _In_opt_ void* grfxMemory ); 58 | } -------------------------------------------------------------------------------- /GCC-Collector/deps/DirectXTKInc/CommonStates.h: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------------------------- 2 | // File: CommonStates.h 3 | // 4 | // Copyright (c) Microsoft Corporation. All rights reserved. 5 | // Licensed under the MIT License. 6 | // 7 | // http://go.microsoft.com/fwlink/?LinkId=248929 8 | //-------------------------------------------------------------------------------------- 9 | 10 | #pragma once 11 | 12 | #if defined(_XBOX_ONE) && defined(_TITLE) 13 | #include 14 | #else 15 | #include 16 | #endif 17 | 18 | #include 19 | 20 | 21 | namespace DirectX 22 | { 23 | class CommonStates 24 | { 25 | public: 26 | explicit CommonStates(_In_ ID3D11Device* device); 27 | CommonStates(CommonStates&& moveFrom) throw(); 28 | CommonStates& operator= (CommonStates&& moveFrom) throw(); 29 | 30 | CommonStates(CommonStates const&) = delete; 31 | CommonStates& operator= (CommonStates const&) = delete; 32 | 33 | virtual ~CommonStates(); 34 | 35 | // Blend states. 36 | ID3D11BlendState* __cdecl Opaque() const; 37 | ID3D11BlendState* __cdecl AlphaBlend() const; 38 | ID3D11BlendState* __cdecl Additive() const; 39 | ID3D11BlendState* __cdecl NonPremultiplied() const; 40 | 41 | // Depth stencil states. 42 | ID3D11DepthStencilState* __cdecl DepthNone() const; 43 | ID3D11DepthStencilState* __cdecl DepthDefault() const; 44 | ID3D11DepthStencilState* __cdecl DepthRead() const; 45 | 46 | // Rasterizer states. 47 | ID3D11RasterizerState* __cdecl CullNone() const; 48 | ID3D11RasterizerState* __cdecl CullClockwise() const; 49 | ID3D11RasterizerState* __cdecl CullCounterClockwise() const; 50 | ID3D11RasterizerState* __cdecl Wireframe() const; 51 | 52 | // Sampler states. 53 | ID3D11SamplerState* __cdecl PointWrap() const; 54 | ID3D11SamplerState* __cdecl PointClamp() const; 55 | ID3D11SamplerState* __cdecl LinearWrap() const; 56 | ID3D11SamplerState* __cdecl LinearClamp() const; 57 | ID3D11SamplerState* __cdecl AnisotropicWrap() const; 58 | ID3D11SamplerState* __cdecl AnisotropicClamp() const; 59 | 60 | private: 61 | // Private implementation. 62 | class Impl; 63 | 64 | std::shared_ptr pImpl; 65 | }; 66 | } 67 | -------------------------------------------------------------------------------- /GCC-Labeler/mkInfo.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | import scipy.io as scio 4 | import numpy as np 5 | import json 6 | import re 7 | import os 8 | 9 | def getInfo(fold, subfold): 10 | global weather, timeInfo, roi, camera, headMatrix 11 | with open(os.path.join(subfold, 'pedInfo.xml')) as f: 12 | txt = f.read() 13 | weather = re.findall(r'(.*?)', txt)[0] 14 | timeInfo = re.findall(r'time hour=(\d*?)minutes=(\d*?) />', txt)[0] 15 | timeInfo = list(map(int, timeInfo)) 16 | with open(os.path.join(fold, 'areaInfo.log')) as f: 17 | txt = f.read().split() 18 | number, location = int(txt[0]), list(map(float, txt[1:])) 19 | roix, roiy = location[:number], location[number:] 20 | roi = list(zip(roix, roiy)) 21 | with open(os.path.join(fold, 'eyeInfo.log')) as f: 22 | txt = f.read().split('\n') 23 | camera = { 24 | 'location': list(map(float, txt[0].split())), 25 | 'rotation': list(map(float, txt[1].split())), 26 | 'fov': float(txt[2]) 27 | } 28 | with open(os.path.join(subfold, 'pedInfo.json')) as f: 29 | headMatrix = json.load(f) 30 | 31 | 32 | 33 | 34 | def mkMat(savePath): 35 | # head location 36 | location = np.array(headMatrix, dtype='int') 37 | number = np.array([[len(headMatrix)]], dtype='int') 38 | image_info = (location, number) 39 | matMatrix = np.array(image_info, dtype=np.dtype([('location', 'O'), ('number', 'O')])) 40 | # weatehr 41 | matWeather = np.array([[weather]]) 42 | # time infomation 43 | matTime = np.array([timeInfo], dtype='uint8') 44 | # roi 45 | matRoi = np.array(roi) 46 | # camera 47 | matCamera = np.array([[( 48 | np.array([camera['location']]), 49 | np.array([camera['rotation']]), 50 | np.array([[camera['fov']]]) 51 | )]], 52 | dtype = ([('location', 'O'), ('rotation', 'O'), ('fov', 'O')]) 53 | ) 54 | scio.savemat(savePath, {'image_info': matMatrix, 55 | 'weather_info': matWeather, 56 | 'time_info': matTime, 57 | 'roi_info': matRoi, 58 | 'camera_info': matCamera 59 | }) 60 | 61 | def mkJson(savePath): 62 | jsdict = { 63 | 'image_info': headMatrix, 64 | 'weather': weather, 65 | 'timeInfo': timeInfo, 66 | 'roi': roi, 67 | 'camera': camera 68 | } 69 | with open(savePath, 'w+') as f: 70 | json.dump(jsdict, f) 71 | -------------------------------------------------------------------------------- /GCC-Labeler/getHead.py: -------------------------------------------------------------------------------- 1 | from PIL import Image 2 | import numpy as np 3 | import matplotlib.pyplot as plt 4 | import time 5 | import re 6 | import sys 7 | import os 8 | import os.path as path 9 | import json 10 | 11 | headJson = [] 12 | 13 | class pedestrian: 14 | def __init__(self, info): 15 | self.id = int(info[0]) 16 | boneLoc = map(lambda x: re.findall(r" x=(.*?) y=(.*?) />", x)[0], info[1].strip().split('\n\t')) 17 | bones = boneLoc 18 | self.bones = np.array(list(bones), dtype='float32') 19 | 20 | def render(stencil, origin): 21 | x, y, z = origin.shape 22 | nshape = np.array([255, 255, 0], dtype='uint8') 23 | psize = 3 24 | top, bottom = max(0, stencil[0] - psize), min(x, stencil[0] + psize) 25 | left, right = max(0, stencil[1] - psize), min(y, stencil[1] + psize) 26 | # print(stencil, top, bottom, left, right) 27 | mark = np.ones((bottom - top, right - left), dtype='uint8') 28 | mark = np.pad(mark, ((top, x - bottom), (left, y - right)), 'constant') 29 | for i in range(z): 30 | origin[:, :, i] = np.where(mark == 1, nshape[i], origin[:, :, i]) 31 | return origin 32 | 33 | def multiRender(bmp, p, stencil): 34 | boneLoc = np.dot(p.bones, np.array([[0, 1920], [1080, 0]])).round().astype('int') 35 | headLoc = (boneLoc[0] - 1).tolist() 36 | x, y = headLoc 37 | # print(p.bones, ':', headLoc) 38 | if x >= 0 and y >= 0 and stencil[x, y]: 39 | bmp = render(headLoc, bmp) 40 | headJson.append(headLoc) 41 | return bmp 42 | 43 | def runRender(fold, peds, rendfunc, bmpName='result_1'): 44 | bmpArray = np.array(Image.open(path.join(fold, 'combination.bmp'))) 45 | stencil = np.fromfile(path.join(fold, 'combination.npy'), 'uint8') 46 | stencil = stencil.reshape(1080, 1920) 47 | for p in peds: 48 | if p.bones.shape[0] == 0: 49 | continue 50 | # print("No.{} Ok.".format(i)) 51 | bmpArray = rendfunc(bmpArray, p, stencil) 52 | bmp = Image.fromarray(bmpArray) 53 | bmp.save(path.join(fold, bmpName+'.jpg')) 54 | 55 | def main(fold): 56 | peds = [] 57 | with open(path.join(fold, 'pedInfo.xml')) as f: 58 | info = re.findall( 59 | r'([\s\S]*?)', f.read()) 60 | peds = list(map(pedestrian, info)) 61 | runRender(fold, peds, multiRender, bmpName='result') 62 | with open(path.join(fold, 'pedInfo.json'), 'w+') as f: 63 | global headJson 64 | json.dump(headJson, f) 65 | headJson = [] 66 | 67 | 68 | if __name__ == '__main__': 69 | main(sys.argv[1]) 70 | -------------------------------------------------------------------------------- /GCC-Labeler/main.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | import sys, time, os, shutil 4 | import os.path as path 5 | import re 6 | 7 | from combine import combine 8 | from getHead import main as getHeadMain 9 | from mkInfo import getInfo, mkJson, mkMat 10 | 11 | def deleteFile(fold): 12 | for fi in os.listdir(fold): 13 | if 'part' in fi or fi == 'pedInfo.xml': 14 | continue 15 | os.remove(path.join(fold, fi)) 16 | 17 | def mkdir(goal_dir): 18 | if not path.exists(goal_dir): 19 | os.makedirs(goal_dir) 20 | 21 | if __name__ == '__main__': 22 | source_dir = 'source' 23 | target_dir = 'target' 24 | mkdir(target_dir) 25 | for part_dir in os.listdir(source_dir): 26 | if re.match(r'part_\d+_\d', part_dir) == None: 27 | continue 28 | print('---', part_dir, '---') 29 | start, foldNo = time.time(), 1 30 | 31 | goal_dir = path.join(target_dir, 'scene' + part_dir[4:]) 32 | mkdir(goal_dir) 33 | 34 | 35 | subFolds = ('pngs', 'jpgs', 'jsons', 'mats', 'vis', 'segs') 36 | for subFold in subFolds: 37 | mkdir(path.join(goal_dir, subFold)) 38 | 39 | for foldName in os.listdir(os.path.join(source_dir, part_dir)): 40 | fold = path.join(source_dir, part_dir, foldName) 41 | if path.isdir(fold) and "result" not in fold: 42 | try: 43 | combine(fold) 44 | getHeadMain(fold) 45 | 46 | # move image 47 | shutil.move(path.join(fold, 'combination.png'), path.join(goal_dir, 'pngs', foldName + '.png')) 48 | shutil.move(path.join(fold, 'combination.jpg'), path.join(goal_dir, 'jpgs', foldName + '.jpg')) 49 | 50 | # write json and mat 51 | getInfo(os.path.join(source_dir, part_dir), fold) 52 | mkJson(path.join(goal_dir, 'jsons', foldName + '.json')) 53 | mkMat(path.join(goal_dir, 'mats', foldName + '.mat')) 54 | 55 | # move seg 56 | shutil.move(path.join(fold, 'combination.npy'), path.join(goal_dir, 'segs', foldName + '.raw')) 57 | 58 | # move vis 59 | shutil.move(path.join(fold, 'result.jpg'), path.join(goal_dir, 'vis', foldName + '.jpg')) 60 | except : 61 | with open('error.log', 'a+') as f: 62 | print('catch error in fold [' + fold + ']', file=f) 63 | print('[fold No.{}]'.format(foldNo), foldName, 'error.') 64 | else: 65 | print('[fold No.{}]'.format(foldNo), foldName, 'done.') 66 | deleteFile(fold) 67 | finally: 68 | foldNo += 1 69 | end = time.time() 70 | print('cost time:', end - start) -------------------------------------------------------------------------------- /GCC-Labeler/combine.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | from PIL import Image 4 | import numpy as np 5 | # import matplotlib.pyplot as plt 6 | import time 7 | import re 8 | import os 9 | import sys 10 | import os.path as path 11 | from functools import reduce 12 | 13 | 14 | getImgArray = lambda img: np.array(Image.open(img)) 15 | 16 | def getCurve(name): 17 | stencil = np.fromfile(name, 'uint8') 18 | stencil = stencil.reshape(1080, 1920) 19 | stencil = np.where(np.isin(stencil, (1, 17)), 1, 0).astype('uint8')# OUTDOOR 20 | # stencil = np.where(np.isin(stencil, (9, 25)), 1, 0).astype('uint8')# INDOOR 21 | return stencil 22 | 23 | def getorder(fileNames): 24 | filterFunc = lambda img: '.raw' in img 25 | imgFileNames = filter(filterFunc, fileNames) 26 | order = sorted(int(re.findall(r'(\d+?).raw', imgFileName)[0]) 27 | for imgFileName in imgFileNames) 28 | return order 29 | 30 | def backMask(fold, order): 31 | mask = np.full((1080, 1920), len(order), dtype='uint8') 32 | rgbDis = np.zeros((1080, 1920), dtype='int') 33 | imgTemp = path.join(fold, 'part_{}_{}.bmp') 34 | for o in order: 35 | # cutout background 36 | back = getImgArray(imgTemp.format(o, 0)).astype('int') 37 | fore = getImgArray(imgTemp.format(o, 1)).astype('int') 38 | diff = np.sum((fore - back) ** 2, axis=2) 39 | mask = np.where(diff > rgbDis, o, mask) 40 | rgbDis = np.where(diff > rgbDis, diff, rgbDis) 41 | return mask 42 | 43 | def combine(fold): 44 | # get image order 45 | order = getorder(os.listdir(fold)) 46 | # get background 47 | mask= backMask(fold, order) 48 | curveTemp = path.join(fold, 'part_{}.raw') 49 | for o in order: 50 | curve = getCurve(curveTemp.format(o)) 51 | mask = np.where(curve==1, o, mask) 52 | mask = np.concatenate([mask[:,:,np.newaxis]]*3, axis=2) 53 | 54 | imgTemp = path.join(fold, 'part_{}_{}.bmp') 55 | fimg = getImgArray(imgTemp.format(0, 1)) 56 | for o in order[1:]: 57 | img = getImgArray(imgTemp.format(o, 1)) 58 | fimg = np.where(mask==o, img, fimg) 59 | fimg = Image.fromarray(fimg) 60 | fimg.save(path.join(fold, 'combination.png')) 61 | fimg.save(path.join(fold, 'combination.jpg')) 62 | fimg.save(path.join(fold, 'combination.bmp')) 63 | 64 | raw = getCurve(curveTemp.format(order[0])) 65 | for o in order[1:]: 66 | part = getCurve(curveTemp.format(o)) 67 | raw = np.where(part == 1, part, raw) 68 | raw.reshape(-1).tofile(path.join(fold, 'combination.npy')) 69 | 70 | 71 | def renderCurve(fold, No): 72 | stencil = getCurve(path.join(fold, "base_{}.raw".format(No))) 73 | stencil = stencil[:, :, np.newaxis] 74 | stencil = np.concatenate([stencil] * 3, axis=2) 75 | bmp = np.array(Image.open(path.join(fold, "base_{}.bmp".format(No)))) 76 | combImg = np.where(stencil == 1, bmp, 0) 77 | bmp = Image.fromarray(combImg) 78 | bmp.save(path.join(fold, 'combination_{}.png'.format(No))) 79 | bmp.save(path.join(fold, 'combination_{}.jpg'.format(No))) 80 | 81 | if __name__ == '__main__': 82 | # combine(sys.argv[1]) 83 | combine('source/part_11_2/1534540881') 84 | -------------------------------------------------------------------------------- /GCC-Collector/GCC-Collector/GCC-Collector.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;hm;inl;inc;ipp;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | Header Files 23 | 24 | 25 | Header Files 26 | 27 | 28 | Header Files 29 | 30 | 31 | Header Files 32 | 33 | 34 | Header Files 35 | 36 | 37 | Header Files 38 | 39 | 40 | Header Files 41 | 42 | 43 | Header Files 44 | 45 | 46 | Header Files 47 | 48 | 49 | Header Files 50 | 51 | 52 | 53 | 54 | Resource Files 55 | 56 | 57 | Resource Files 58 | 59 | 60 | Resource Files 61 | 62 | 63 | Resource Files 64 | 65 | 66 | Resource Files 67 | 68 | 69 | Resource Files 70 | 71 | 72 | Resource Files 73 | 74 | 75 | Resource Files 76 | 77 | 78 | Resource Files 79 | 80 | 81 | Resource Files 82 | 83 | 84 | Resource Files 85 | 86 | 87 | -------------------------------------------------------------------------------- /GCC-Collector/GCC-Collector/createCrowd.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #pragma once 4 | #include "natives.h" 5 | #include "types.h" 6 | #include "enums.h" 7 | #include "main.h" 8 | #include 9 | 10 | // pedHash.size() = 265 11 | const Hash pedHashes[] = { 3716251309, 4209271110, 3886638041, 664399832, 1498487404, 2680389410, 2064532783, 3100414644, 2869588309, 846439045, 1746653202, 3756278757, 2992445106, 623927022, 2563194959, 2515474659, 2775713665, 1330042375, 2240226444, 452351020, 1768677545, 588969535, 103106535, 2206530719, 3609190705, 1809430156, 390939205, 3579522037, 4049719826, 1334976110, 1146800212, 51789996, 115168927, 2255803900, 999748158, 653210662, 2111372120, 3284966005, 2688103263, 2374966032, 4206136267, 1684083350, 549978415, 3072929548, 4079145784, 2359345766, 3394697810, 3290105390, 1750583735, 2459507570, 1099825042, 1546450936, 2549481101, 2276611093, 1567728751, 2255894993, 949295643, 1191403201, 3887273010, 3365863812, 793439294, 1561705728, 2217749257, 3271294718, 435429221, 2651349821, 2756120947, 534725268, 3835149295, 2638072698, 2633130371, 1206185632, 1312913862, 3990661997, 2952446692, 3349113128, 1032073858, 117698822, 3669401835, 1423699487, 516505552, 2346291386, 3767780806, 951767867, 1446741360, 3519864886, 3247667175, 469792763, 4033578141, 429425116, 2842568196, 2766184958, 4246489531, 3812756443, 1382414087, 3523131524, 3065114024, 3008586398, 1519319503, 4198014287, 1240094341, 1482427218, 2047212121, 3877027275, 599294057, 3938633710, 3529955798, 2512875213, 321657486, 1890499016, 1055701597, 3367442045, 2896414922, 1090617681, 941695432, 826475330, 4096714883, 411102470, 70821038, 62440720, 3640249671, 3972697109, 2557996913, 2218630415, 3502104854, 1650288984, 503621995, 2674735073, 355916122, 1426880966, 3988550982, 3684436375, 797459875, 2602752943, 891398354, 3881519900, 3374523516, 2928082356, 365775923, 696250687, 3189832196, 3083210802, 2494442380, 663522487, 3881194279, 4121954205, 2705543429, 261586155, 32417469, 1720428295, 331645324, 1640504453, 579932932, 479578891, 131961260, 2988916046, 1459905209, 2363277399, 2780469782, 4255728232, 3014915558, 1226102803, 3064628686, 1674107025, 3499148112, 3896218551, 2231547570, 3512565361, 2423691919, 2962707003, 1846684678, 1039800368, 1830688247, 2120901815, 330231874, 225514697, 3621428889, 3613962792, 3454621138, 767028979, 373000027, 744758650, 2923947184, 919005580, 1264851357, 1641152947, 1466037421, 2185745201, 1863555924, 3681718840, 3367706194, 3321821918, 835315305, 2435054400, 3782053633, 1644266841, 3482496489, 2608926626, 1165780219, 2021631368, 1371553700, 2908022696, 920595805, 2681481517, 3513928062, 1767892582, 832784782, 1068876755, 815693290, 1530648845, 238213328, 3265820418, 3250873975, 4030826507, 587703123, 894928436, 1951946145, 3680420864, 600300561, 1082572151, 228715206, 1982350912, 3882958867, 803106487, 377976310, 788622594, 349680864, 1204772502, 3728026165, 1347814329, 808859815, 1581098148, 2318861297, 193817059, 1752208920, 4131252449, 988062523, 466359675, 1416254276, 1388848350, 3343476521, 349505262, 1380197501, 2114544056, 2340239206, 1520708641, 766375082, 68070371, 2981205682, 1699403886, 42647445, 1404403376, 101298480, 2422005962, 3019107892, 3654768780, 2597531625, 824925120, 2659242702, 810804565, 2124742566, 933092024, 1142162924, 3188223741, 4058522530 }; 12 | 13 | std::string setTimeAndWeather(); 14 | void createScene(int nowHave); -------------------------------------------------------------------------------- /GCC-Collector/deps/DirectXTKInc/SpriteFont.h: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------------------------- 2 | // File: SpriteFont.h 3 | // 4 | // Copyright (c) Microsoft Corporation. All rights reserved. 5 | // Licensed under the MIT License. 6 | // 7 | // http://go.microsoft.com/fwlink/?LinkId=248929 8 | //-------------------------------------------------------------------------------------- 9 | 10 | #pragma once 11 | 12 | #include "SpriteBatch.h" 13 | 14 | 15 | namespace DirectX 16 | { 17 | class SpriteFont 18 | { 19 | public: 20 | struct Glyph; 21 | 22 | SpriteFont(_In_ ID3D11Device* device, _In_z_ wchar_t const* fileName, bool forceSRGB = false); 23 | SpriteFont(_In_ ID3D11Device* device, _In_reads_bytes_(dataSize) uint8_t const* dataBlob, _In_ size_t dataSize, bool forceSRGB = false); 24 | SpriteFont(_In_ ID3D11ShaderResourceView* texture, _In_reads_(glyphCount) Glyph const* glyphs, _In_ size_t glyphCount, _In_ float lineSpacing); 25 | 26 | SpriteFont(SpriteFont&& moveFrom) throw(); 27 | SpriteFont& operator= (SpriteFont&& moveFrom) throw(); 28 | 29 | SpriteFont(SpriteFont const&) = delete; 30 | SpriteFont& operator= (SpriteFont const&) = delete; 31 | 32 | virtual ~SpriteFont(); 33 | 34 | void XM_CALLCONV DrawString(_In_ SpriteBatch* spriteBatch, _In_z_ wchar_t const* text, XMFLOAT2 const& position, FXMVECTOR color = Colors::White, float rotation = 0, XMFLOAT2 const& origin = Float2Zero, float scale = 1, SpriteEffects effects = SpriteEffects_None, float layerDepth = 0) const; 35 | void XM_CALLCONV DrawString(_In_ SpriteBatch* spriteBatch, _In_z_ wchar_t const* text, XMFLOAT2 const& position, FXMVECTOR color, float rotation, XMFLOAT2 const& origin, XMFLOAT2 const& scale, SpriteEffects effects = SpriteEffects_None, float layerDepth = 0) const; 36 | void XM_CALLCONV DrawString(_In_ SpriteBatch* spriteBatch, _In_z_ wchar_t const* text, FXMVECTOR position, FXMVECTOR color = Colors::White, float rotation = 0, FXMVECTOR origin = g_XMZero, float scale = 1, SpriteEffects effects = SpriteEffects_None, float layerDepth = 0) const; 37 | void XM_CALLCONV DrawString(_In_ SpriteBatch* spriteBatch, _In_z_ wchar_t const* text, FXMVECTOR position, FXMVECTOR color, float rotation, FXMVECTOR origin, GXMVECTOR scale, SpriteEffects effects = SpriteEffects_None, float layerDepth = 0) const; 38 | 39 | XMVECTOR XM_CALLCONV MeasureString(_In_z_ wchar_t const* text) const; 40 | 41 | RECT __cdecl MeasureDrawBounds(_In_z_ wchar_t const* text, XMFLOAT2 const& position) const; 42 | RECT XM_CALLCONV MeasureDrawBounds(_In_z_ wchar_t const* text, FXMVECTOR position) const; 43 | 44 | // Spacing properties 45 | float __cdecl GetLineSpacing() const; 46 | void __cdecl SetLineSpacing(float spacing); 47 | 48 | // Font properties 49 | wchar_t __cdecl GetDefaultCharacter() const; 50 | void __cdecl SetDefaultCharacter(wchar_t character); 51 | 52 | bool __cdecl ContainsCharacter(wchar_t character) const; 53 | 54 | // Custom layout/rendering 55 | Glyph const* __cdecl FindGlyph(wchar_t character) const; 56 | void __cdecl GetSpriteSheet(ID3D11ShaderResourceView** texture) const; 57 | 58 | // Describes a single character glyph. 59 | struct Glyph 60 | { 61 | uint32_t Character; 62 | RECT Subrect; 63 | float XOffset; 64 | float YOffset; 65 | float XAdvance; 66 | }; 67 | 68 | 69 | private: 70 | // Private implementation. 71 | class Impl; 72 | 73 | std::unique_ptr pImpl; 74 | 75 | static const XMFLOAT2 Float2Zero; 76 | }; 77 | } 78 | -------------------------------------------------------------------------------- /GCC-Collector/GCC-Collector/keyboard.cpp: -------------------------------------------------------------------------------- 1 | #include "keyboard.h" 2 | #include "types.h" 3 | #include "script.h" 4 | #include "main.h" 5 | #include "camera.h" 6 | #include "defineArea.h" 7 | #include "infoIO.h" 8 | #include "setLevel.h" 9 | 10 | const int keyInfo::MAX_DOWN = 500; //ms 11 | 12 | keyInfo::keyInfo() { 13 | time = 0; 14 | } 15 | bool keyInfo::isKeyDown() { 16 | return ((GetTickCount() < time + MAX_DOWN) && !isUpNow); 17 | } 18 | void keyInfo::pushDown(BOOL _isUpNow, BOOL _isWithAlt, BOOL _wasDownBefore) { 19 | time = GetTickCount(); 20 | isWithAlt = _isWithAlt; 21 | wasDownBefore = _wasDownBefore; 22 | isUpNow = _isUpNow; 23 | } 24 | keyInfo W, A, S, D, V, shift, ctrl, tab, oemPlus, oemMinus, F10, I, F11, numKey[10]; 25 | 26 | void OnKeyboardMessage(DWORD key, WORD repeats, BYTE scanCode, BOOL isExtended, BOOL isWithAlt, BOOL wasDownBefore, BOOL isUpNow) 27 | { 28 | bool updown = !wasDownBefore && !isUpNow; 29 | auto push = [&key, &updown](char mykey) { 30 | return key == mykey && updown; 31 | }; 32 | 33 | if (scriptStatus == scriptStop && push(VK_F9)) { 34 | scriptStatus = scriptReady; 35 | } 36 | if (scriptStatus == scriptReadyCamera && push(VK_F10)) { 37 | scriptStatus = cameraMode; 38 | } 39 | if (scriptStatus == scriptReadyDefineArea && push(VK_F11)) { 40 | scriptStatus = defineArea; 41 | } 42 | if (scriptStatus == scriptReadySetLevel && push(VK_F12)) { 43 | scriptStatus = setLevel; 44 | } 45 | if (scriptStatus == cameraMode && CameraMode == true) { 46 | if (key == 'W') W.pushDown(isUpNow, isWithAlt, wasDownBefore); 47 | if (key == 'A') A.pushDown(isUpNow, isWithAlt, wasDownBefore); 48 | if (key == 'S') S.pushDown(isUpNow, isWithAlt, wasDownBefore); 49 | if (key == 'D') D.pushDown(isUpNow, isWithAlt, wasDownBefore); 50 | if (key == 'V') V.pushDown(isUpNow, isWithAlt, wasDownBefore); 51 | if (key == VK_OEM_PLUS) oemPlus.pushDown(isUpNow, isWithAlt, wasDownBefore); 52 | if (key == VK_OEM_MINUS) oemMinus.pushDown(isUpNow, isWithAlt, wasDownBefore); 53 | if (key == VK_SHIFT) shift.pushDown(isUpNow, isWithAlt, wasDownBefore); 54 | if (key == VK_CONTROL) ctrl.pushDown(isUpNow, isWithAlt, wasDownBefore); 55 | if (push(VK_F10)) scriptStatus = cameraModeEnd; 56 | if (key == VK_TAB) tab.pushDown(isUpNow, isWithAlt, wasDownBefore); 57 | } 58 | if (scriptStatus == defineArea && defineAreaMode == true) { 59 | if (key == VK_F10) F10.pushDown(isUpNow, isWithAlt, wasDownBefore); 60 | if (push(VK_F11)) F11.pushDown(isUpNow, isWithAlt, wasDownBefore); 61 | if (key == 'I') I.pushDown(isUpNow, isWithAlt, wasDownBefore); 62 | if (key == VK_TAB) tab.pushDown(isUpNow, isWithAlt, wasDownBefore); 63 | } 64 | if (scriptStatus == defineAreaEnd && CameraMode == true) { 65 | if (key == VK_CONTROL) ctrl.pushDown(isUpNow, isWithAlt, wasDownBefore); 66 | if (key == 'W') W.pushDown(isUpNow, isWithAlt, wasDownBefore); 67 | if (key == 'A') A.pushDown(isUpNow, isWithAlt, wasDownBefore); 68 | if (key == 'S') S.pushDown(isUpNow, isWithAlt, wasDownBefore); 69 | if (key == 'D') D.pushDown(isUpNow, isWithAlt, wasDownBefore); 70 | if (key == VK_OEM_PLUS) oemPlus.pushDown(isUpNow, isWithAlt, wasDownBefore); 71 | if (key == VK_OEM_MINUS) oemMinus.pushDown(isUpNow, isWithAlt, wasDownBefore); 72 | if (key == VK_SHIFT) shift.pushDown(isUpNow, isWithAlt, wasDownBefore); 73 | if (push(VK_F11)) F11.pushDown(isUpNow, isWithAlt, wasDownBefore); 74 | } 75 | if (scriptStatus == setLevel && setLevelMode == true) { 76 | for (char i = '0'; i <= '9'; i++) { 77 | if (key == i) { 78 | numKey[i - '0'].pushDown(isUpNow, isWithAlt, wasDownBefore); 79 | break; 80 | } 81 | } 82 | if (key == VK_F12) { 83 | scriptStatus = setLevelEnd; 84 | } 85 | } 86 | if(push('L')) { 87 | scriptStatus = scriptStart; 88 | } 89 | if (push(VK_F5)) { 90 | scriptStatus = scriptStop; 91 | } 92 | } 93 | -------------------------------------------------------------------------------- /GCC-Collector/GCC-Collector/script.cpp: -------------------------------------------------------------------------------- 1 | #include "script.h" 2 | #include "export.h" 3 | #include "main.h" 4 | #include "infoIO.h" 5 | #include "camera.h" 6 | #include "defineArea.h" 7 | #include "animation.h" 8 | #include "setLevel.h" 9 | #include "createCrowd.h" 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | 19 | scriptStatusEnum scriptStatus = scriptStop; 20 | 21 | void scriptMain() 22 | { 23 | initDataDir(); 24 | 25 | int sleepTime = 0; 26 | bool aniGet = initAnimations("SceneDirectorAnim.txt"); 27 | bool partGet = InitPartNo(); 28 | set_status_text("GCC-CL start fine!!!"); 29 | while (true) 30 | { 31 | if (scriptStatus == scriptStart) { 32 | while (1) { 33 | int nowHave = defaultFold(); 34 | log_to_file("now have = " + std::to_string(nowHave)); 35 | if (nowHave != -1) { 36 | createScene(nowHave); 37 | 38 | } 39 | WAIT(1000); 40 | if (scriptStatus == scriptStop) { break; } 41 | } 42 | scriptStatus = scriptStop, sleepTime = 0; 43 | } 44 | else if (scriptStatus == scriptReady) { 45 | createNewFold(); 46 | scriptStatus = scriptReadyCamera; 47 | set_status_text("scene fold has been ready. Now push F10 to set the camera"); 48 | } 49 | else if (scriptStatus == cameraMode) { 50 | if (CameraMode == false) { 51 | startNewCamera(); 52 | set_status_text("Now you can set the camera location."); 53 | } 54 | else { 55 | adjustCamera(); 56 | } 57 | 58 | } 59 | else if (scriptStatus == cameraModeEnd && CameraMode == true) { 60 | StopCamera(); 61 | scriptStatus = scriptReadyDefineArea; 62 | } 63 | else if (scriptStatus == defineArea) { 64 | if (defineAreaMode == false) { 65 | set_status_text("now you can start define the area boundary."); 66 | startDefineArea(); 67 | defineAreaMode = true; 68 | } 69 | if (setPoint() || resetPoint()) { 70 | WAIT(500); 71 | } 72 | if(showCamera()) { 73 | WAIT(2000); 74 | } 75 | showArea(); 76 | 77 | int save = saveOneArea(); 78 | if (save > 0) { 79 | if (save < 3) { 80 | set_status_text("at least 3 points for boundary defination"); 81 | } 82 | else { 83 | scriptStatus = defineAreaEnd; 84 | show2False(); 85 | set_status_text("finished boundary defination"); 86 | } 87 | WAIT(500); 88 | } 89 | } 90 | else if (scriptStatus == defineAreaEnd) { 91 | if (adjustCameraFinished == 0 && CameraMode == false) { 92 | wriet4Camera(); 93 | } 94 | if (adjustCameraFinished >= 4) { 95 | deleteBddefer(); 96 | gobackcamera(); 97 | scriptStatus = scriptReadySetLevel; 98 | adjustCameraFinished = 0; 99 | log_to_file("end defineArea"); 100 | set_status_text("end defineArea, push F12 to set crowd number level"); 101 | } 102 | else { 103 | if (CameraMode == false) { 104 | showCamera4(); 105 | set_status_text("adjust No." + std::to_string(adjustCameraFinished + 1) + " camera"); 106 | } 107 | else { 108 | adjustCamera(); 109 | if (saveCamera4()) { 110 | set_status_text("No." + std::to_string(adjustCameraFinished) + " save Ok."); 111 | WAIT(1000); 112 | } 113 | } 114 | showArea(); 115 | } 116 | } 117 | else if (scriptStatus == setLevel) { 118 | if (!setLevelMode) { 119 | createLevelSaveFile(); 120 | WAIT(1000); 121 | setLevelMode = true; 122 | } 123 | else setSceneLevel(); 124 | } 125 | else if (scriptStatus == setLevelEnd) { 126 | stopSetLevel(); 127 | scriptStatus = scriptEndReady; 128 | set_status_text("level has been setted, now you can press F5 to end this and go to next scene to create new one."); 129 | } 130 | else { 131 | if (++sleepTime == 2000) { 132 | log_to_file("sleep 2000 game ms..."); 133 | log_to_file(std::to_string(scriptStatus)); 134 | sleepTime = 0; 135 | } 136 | WAIT(1); 137 | } 138 | WAIT(0); 139 | 140 | } 141 | } 142 | -------------------------------------------------------------------------------- /GCC-Collector/deps/DirectXTKInc/Mouse.h: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------------------------- 2 | // File: Mouse.h 3 | // 4 | // Copyright (c) Microsoft Corporation. All rights reserved. 5 | // Licensed under the MIT License. 6 | // 7 | // http://go.microsoft.com/fwlink/?LinkId=248929 8 | // http://go.microsoft.com/fwlink/?LinkID=615561 9 | //-------------------------------------------------------------------------------------- 10 | 11 | #pragma once 12 | 13 | #include 14 | 15 | #if (defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_APP)) || (defined(_XBOX_ONE) && defined(_TITLE) && (_XDK_VER >= 0x42D907D1)) 16 | namespace ABI { namespace Windows { namespace UI { namespace Core { struct ICoreWindow; } } } } 17 | #endif 18 | 19 | 20 | namespace DirectX 21 | { 22 | class Mouse 23 | { 24 | public: 25 | Mouse(); 26 | Mouse(Mouse&& moveFrom) throw(); 27 | Mouse& operator= (Mouse&& moveFrom) throw(); 28 | 29 | Mouse(Mouse const&) = delete; 30 | Mouse& operator=(Mouse const&) = delete; 31 | 32 | virtual ~Mouse(); 33 | 34 | enum Mode 35 | { 36 | MODE_ABSOLUTE = 0, 37 | MODE_RELATIVE, 38 | }; 39 | 40 | struct State 41 | { 42 | bool leftButton; 43 | bool middleButton; 44 | bool rightButton; 45 | bool xButton1; 46 | bool xButton2; 47 | int x; 48 | int y; 49 | int scrollWheelValue; 50 | Mode positionMode; 51 | }; 52 | 53 | class ButtonStateTracker 54 | { 55 | public: 56 | enum ButtonState 57 | { 58 | UP = 0, // Button is up 59 | HELD = 1, // Button is held down 60 | RELEASED = 2, // Button was just released 61 | PRESSED = 3, // Buton was just pressed 62 | }; 63 | 64 | ButtonState leftButton; 65 | ButtonState middleButton; 66 | ButtonState rightButton; 67 | ButtonState xButton1; 68 | ButtonState xButton2; 69 | 70 | ButtonStateTracker() throw() { Reset(); } 71 | 72 | void __cdecl Update(const State& state); 73 | 74 | void __cdecl Reset(); 75 | 76 | State __cdecl GetLastState() const { return lastState; } 77 | 78 | private: 79 | State lastState; 80 | }; 81 | 82 | // Retrieve the current state of the mouse 83 | State __cdecl GetState() const; 84 | 85 | // Resets the accumulated scroll wheel value 86 | void __cdecl ResetScrollWheelValue(); 87 | 88 | // Sets mouse mode (defaults to absolute) 89 | void __cdecl SetMode(Mode mode); 90 | 91 | // Feature detection 92 | bool __cdecl IsConnected() const; 93 | 94 | // Cursor visibility 95 | bool __cdecl IsVisible() const; 96 | void __cdecl SetVisible(bool visible); 97 | 98 | #if !defined(WINAPI_FAMILY) || (WINAPI_FAMILY == WINAPI_FAMILY_DESKTOP_APP) && defined(WM_USER) 99 | void __cdecl SetWindow(HWND window); 100 | static void __cdecl ProcessMessage(UINT message, WPARAM wParam, LPARAM lParam); 101 | #endif 102 | 103 | #if (defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_APP)) || (defined(_XBOX_ONE) && defined(_TITLE) && (_XDK_VER >= 0x42D907D1)) 104 | void __cdecl SetWindow(ABI::Windows::UI::Core::ICoreWindow* window); 105 | #ifdef __cplusplus_winrt 106 | void __cdecl SetWindow(Windows::UI::Core::CoreWindow^ window) 107 | { 108 | // See https://msdn.microsoft.com/en-us/library/hh755802.aspx 109 | SetWindow(reinterpret_cast(window)); 110 | } 111 | #endif 112 | static void __cdecl SetDpi(float dpi); 113 | #endif 114 | 115 | // Singleton 116 | static Mouse& __cdecl Get(); 117 | 118 | private: 119 | // Private implementation. 120 | class Impl; 121 | 122 | std::unique_ptr pImpl; 123 | }; 124 | } 125 | -------------------------------------------------------------------------------- /GCC-Collector/GCC-Collector/utils.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | THIS FILE IS A PART OF GTA V SCRIPT HOOK SDK 3 | http://dev-c.com 4 | (C) Alexander Blade 2015 5 | */ 6 | 7 | #include "utils.h" 8 | 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include "script.h" 15 | #include "infoIO.h" 16 | 17 | extern "C" IMAGE_DOS_HEADER __ImageBase; // MSVC specific, with other compilers use HMODULE from DllMain 18 | 19 | std::string cachedModulePath; 20 | 21 | std::string GetCurrentModulePath() 22 | { 23 | if (cachedModulePath.empty()) 24 | { 25 | // get module path 26 | char modPath[MAX_PATH]; 27 | memset(modPath, 0, sizeof(modPath)); 28 | GetModuleFileNameA((HMODULE)&__ImageBase, modPath, sizeof(modPath)); 29 | for (size_t i = strlen(modPath); i > 0; i--) 30 | { 31 | if (modPath[i - 1] == '\\') 32 | { 33 | modPath[i] = 0; 34 | break; 35 | } 36 | } 37 | cachedModulePath = modPath; 38 | } 39 | return cachedModulePath; 40 | } 41 | 42 | std::string roundNumber(float number) 43 | { 44 | std::ostringstream out; 45 | out << std::setprecision(1) << std::fixed << std::showpoint << number; 46 | std::string roundResult = out.str(); 47 | return roundResult; 48 | } 49 | 50 | float actionInputFloat() 51 | { 52 | GAMEPLAY::DISPLAY_ONSCREEN_KEYBOARD(true, "FMMC_KEY_TIP8", "", "", "", "", "", 6); 53 | 54 | while (GAMEPLAY::UPDATE_ONSCREEN_KEYBOARD() == 0) { 55 | WAIT(0); 56 | } 57 | 58 | 59 | if (GAMEPLAY::IS_STRING_NULL_OR_EMPTY(GAMEPLAY::GET_ONSCREEN_KEYBOARD_RESULT())) { 60 | log_to_file("Got null keyboard value"); 61 | return -1.0f; 62 | } 63 | char * keyboardValue = GAMEPLAY::GET_ONSCREEN_KEYBOARD_RESULT(); 64 | std::string strValue = std::string(keyboardValue); 65 | log_to_file("Got keyboard value " + strValue); 66 | return atof(keyboardValue); 67 | } 68 | 69 | DWORD actionInputDword() 70 | { 71 | GAMEPLAY::DISPLAY_ONSCREEN_KEYBOARD(true, "FMMC_KEY_TIP8", "", "", "", "", "", 6); 72 | 73 | while (GAMEPLAY::UPDATE_ONSCREEN_KEYBOARD() == 0) { 74 | WAIT(0); 75 | } 76 | 77 | 78 | if (GAMEPLAY::IS_STRING_NULL_OR_EMPTY(GAMEPLAY::GET_ONSCREEN_KEYBOARD_RESULT())) { 79 | log_to_file("Got null keyboard value"); 80 | return 0; 81 | } 82 | char * keyboardValue = GAMEPLAY::GET_ONSCREEN_KEYBOARD_RESULT(); 83 | std::string strValue = std::string(keyboardValue); 84 | log_to_file("Got keyboard value " + strValue); 85 | return atoi(keyboardValue); 86 | } 87 | 88 | std::string actionInputString(int maxLength) 89 | { 90 | GAMEPLAY::DISPLAY_ONSCREEN_KEYBOARD(true, "FMMC_KEY_TIP8", "", "", "", "", "", maxLength); 91 | 92 | while (GAMEPLAY::UPDATE_ONSCREEN_KEYBOARD() == 0) { 93 | WAIT(0); 94 | } 95 | 96 | 97 | if (GAMEPLAY::IS_STRING_NULL_OR_EMPTY(GAMEPLAY::GET_ONSCREEN_KEYBOARD_RESULT())) { 98 | log_to_file("Got null keyboard value"); 99 | return std::string(); 100 | } 101 | char * keyboardValue = GAMEPLAY::GET_ONSCREEN_KEYBOARD_RESULT(); 102 | std::string strValue = std::string(keyboardValue); 103 | log_to_file("Got keyboard value " + strValue); 104 | return strValue; 105 | } 106 | //from http://stackoverflow.com/a/236803 107 | 108 | 109 | 110 | Vector3 MathUtils::rotationToDirection(Vector3 rotation) 111 | { 112 | //big thanks to camxxcore's C# code https://github.com/CamxxCore/ScriptCamTool/blob/master/GTAV_ScriptCamTool/Utils.cs 113 | float retZ = rotation.z * 0.01745329f; 114 | float retX = rotation.x * 0.01745329f; 115 | float absX = abs(cos(retX)); 116 | Vector3 retVector = { 0.0,0.0,0.0 }; 117 | retVector.x = (float)-(sin(retZ) * absX); 118 | retVector.y = (float)cos(retZ) * absX; 119 | retVector.z = (float)sin(retX); 120 | return retVector; 121 | } 122 | 123 | Vector3 MathUtils::crossProduct(Vector3 a, Vector3 b) 124 | { 125 | //http://onlinemschool.com/math/assistance/vector/multiply1/ 126 | Vector3 retVector = { 0.0,0.0,0.0 }; 127 | retVector.x = a.y*b.z - a.z*b.y; 128 | retVector.y = a.z*b.x - a.x*b.z; 129 | retVector.z = a.x*b.y - a.y*b.x; 130 | return retVector; 131 | } 132 | 133 | 134 | void StringUtils::split(const std::string &s, char delim, std::vector &elems) { 135 | std::stringstream ss; 136 | ss.str(s); 137 | std::string item; 138 | while (std::getline(ss, item, delim)) { 139 | elems.push_back(item); 140 | } 141 | } 142 | 143 | 144 | std::vector StringUtils::split(const std::string &s, char delim) { 145 | std::vector elems; 146 | split(s, delim, elems); 147 | return elems; 148 | } -------------------------------------------------------------------------------- /GCC-Collector/GCC-Collector/defineArea.cpp: -------------------------------------------------------------------------------- 1 | #include "defineArea.h" 2 | #include "infoIO.h" 3 | #include "keyboard.h" 4 | #include 5 | 6 | bool defineAreaMode = false; 7 | 8 | const Hash pedHashes[] = { 664399832, 4209271110, 3886638041 }; 9 | static Ped myPed, bddefer; 10 | std::vector areaPoints; 11 | static int now = 0; 12 | 13 | void startDefineArea() 14 | { 15 | myPed = PLAYER::PLAYER_PED_ID(); 16 | areaPoints.clear(); 17 | areaPoints.resize(0); 18 | 19 | //boundary definer 20 | Vector3 loc = ENTITY::GET_OFFSET_FROM_ENTITY_IN_WORLD_COORDS(myPed, 0.0, 1.0, 0.0); 21 | float startHeading = ENTITY::GET_ENTITY_HEADING(myPed); 22 | const Hash ha = 664399832; 23 | STREAMING::REQUEST_MODEL(ha); 24 | while (!STREAMING::HAS_MODEL_LOADED(ha)) WAIT(0); 25 | bddefer = PED::CREATE_PED(4, ha, loc.x, loc.y, loc.z, startHeading, false, true); 26 | PLAYER::CHANGE_PLAYER_PED(PLAYER::PLAYER_ID(), bddefer, false, false); 27 | now = 0; 28 | areaPoints.push_back(loc); 29 | log_to_file("set points No." + std::to_string(now)); 30 | set_status_text("set points No." + std::to_string(now + 1)); 31 | } 32 | 33 | void defineAreaDisableControls() 34 | { 35 | std::vector disabledControls = { 36 | 17, 18, 19, 20, 21, 22, 42, 58, 59, 61, 104, 105, 120, 121, 162, 163, 164, 165, 166, 167, 37 | 168, 169, 170, 266, 267 38 | }; 39 | 40 | for (auto & controlCode : disabledControls) { 41 | CONTROLS::DISABLE_CONTROL_ACTION(0, controlCode - 5, 1); 42 | } 43 | } 44 | 45 | bool setPoint() 46 | { 47 | if (I.isKeyDown()) { 48 | Vector3 newLoc = ENTITY::GET_OFFSET_FROM_ENTITY_IN_WORLD_COORDS(bddefer, 0.0, 0.0, 0.0); 49 | areaPoints.push_back(newLoc); 50 | now++; 51 | log_to_file("set points No." + std::to_string(now)); 52 | set_status_text("set points No." + std::to_string(now + 1)); 53 | return true; 54 | } 55 | return false; 56 | } 57 | 58 | bool resetPoint() 59 | { 60 | defineAreaDisableControls(); 61 | if (tab.isKeyDown()) { 62 | if(areaPoints.empty()) return false; 63 | 64 | now = (now + 1) % areaPoints.size(); 65 | Vector3 tp = areaPoints[now]; 66 | ENTITY::SET_ENTITY_COORDS_NO_OFFSET(bddefer, tp.x, tp.y, tp.z + 0.2, 0, 0, 1); 67 | WAIT(500); 68 | log_to_file("re-set point No." + std::to_string(now) ); 69 | set_status_text("re-set points No." + std::to_string(now + 1)); 70 | return true; 71 | } 72 | return false; 73 | } 74 | 75 | void deleteBddefer() 76 | { 77 | PLAYER::CHANGE_PLAYER_PED(PLAYER::PLAYER_ID(), myPed, false, false); 78 | float h = -1000; 79 | const int n = areaPoints.size(); 80 | for (int i = 0; i < n; i++) { 81 | Vector3 vecpo = areaPoints[i]; 82 | h = max(h, vecpo.z); 83 | } 84 | PED::DELETE_PED(&bddefer); 85 | writeZheight(h); 86 | defineAreaMode = false; 87 | } 88 | 89 | int saveOneArea() 90 | { 91 | if (F11.isKeyDown()) { 92 | int n = areaPoints.size(); 93 | writeAreaInfo(n); 94 | for (int i = 0; i < n; i++) { 95 | Vector3 pointLoc = areaPoints[i]; 96 | writeAreaInfo(pointLoc); 97 | } 98 | log_to_file("Points write into file done."); 99 | return n; 100 | } 101 | return -1; 102 | } 103 | 104 | void showArea() 105 | { 106 | int n = areaPoints.size(); 107 | if (n > 0) { 108 | Vector3 nowLoc = ENTITY::GET_OFFSET_FROM_ENTITY_IN_WORLD_COORDS(bddefer, 0.0, 0.0, 0.0); 109 | areaPoints[now] = nowLoc; 110 | } 111 | if (n < 2) return; 112 | for (int c = 0; c < n; c++) { 113 | Vector3 &loc_A = areaPoints[c]; 114 | Vector3 &loc_B = areaPoints[(c + 1) % n]; 115 | GRAPHICS::DRAW_LINE(loc_A.x, loc_A.y, loc_A.z, 116 | loc_B.x, loc_B.y, loc_B.z, 117 | 255, 0, 0, 150); 118 | } 119 | } 120 | 121 | /******* pedestrian in defined area judger **********/ 122 | 123 | pedLocation::pedLocation() { 124 | x = 0, y = 0; 125 | } 126 | 127 | pedLocation::pedLocation(float _x, float _y) : x(_x), y(_y) { } 128 | 129 | float cross(pedLocation &p0, pedLocation &p1, pedLocation &p2) { 130 | return (p1.x - p0.x) * (p2.y - p0.y) - (p2.x - p0.x) * (p1.y - p0.y); 131 | } 132 | 133 | bool inCircle(float x, float y) { 134 | int n, crossing = 0; 135 | std::vector pedLocations; 136 | readAreaInfo(n, pedLocations); 137 | pedLocations.push_back(*pedLocations.begin()); 138 | for (int i = 0; i < n; i++) { 139 | double slope = (pedLocations[i + 1].y - pedLocations[i].y) / (pedLocations[i + 1].x - pedLocations[i].x); 140 | bool cond1 = (pedLocations[i].x <= x) && (x < pedLocations[i + 1].x); 141 | bool cond2 = (pedLocations[i + 1].x <= x) && (x < pedLocations[i].x); 142 | bool above = (y < slope * (x - pedLocations[i].x) + pedLocations[i].y); 143 | if ((cond1 || cond2) && above) crossing++; 144 | } 145 | return crossing & 1; 146 | } -------------------------------------------------------------------------------- /GCC-Collector/deps/DirectXTKInc/SpriteBatch.h: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------------------------- 2 | // File: SpriteBatch.h 3 | // 4 | // Copyright (c) Microsoft Corporation. All rights reserved. 5 | // Licensed under the MIT License. 6 | // 7 | // http://go.microsoft.com/fwlink/?LinkId=248929 8 | //-------------------------------------------------------------------------------------- 9 | 10 | #pragma once 11 | 12 | #if defined(_XBOX_ONE) && defined(_TITLE) 13 | #include 14 | #else 15 | #include 16 | #endif 17 | 18 | #include 19 | #include 20 | #include 21 | #include 22 | 23 | 24 | namespace DirectX 25 | { 26 | enum SpriteSortMode 27 | { 28 | SpriteSortMode_Deferred, 29 | SpriteSortMode_Immediate, 30 | SpriteSortMode_Texture, 31 | SpriteSortMode_BackToFront, 32 | SpriteSortMode_FrontToBack, 33 | }; 34 | 35 | 36 | enum SpriteEffects 37 | { 38 | SpriteEffects_None = 0, 39 | SpriteEffects_FlipHorizontally = 1, 40 | SpriteEffects_FlipVertically = 2, 41 | SpriteEffects_FlipBoth = SpriteEffects_FlipHorizontally | SpriteEffects_FlipVertically, 42 | }; 43 | 44 | 45 | class SpriteBatch 46 | { 47 | public: 48 | explicit SpriteBatch(_In_ ID3D11DeviceContext* deviceContext); 49 | SpriteBatch(SpriteBatch&& moveFrom) throw(); 50 | SpriteBatch& operator= (SpriteBatch&& moveFrom) throw(); 51 | 52 | SpriteBatch(SpriteBatch const&) = delete; 53 | SpriteBatch& operator= (SpriteBatch const&) = delete; 54 | 55 | virtual ~SpriteBatch(); 56 | 57 | // Begin/End a batch of sprite drawing operations. 58 | void XM_CALLCONV Begin(SpriteSortMode sortMode = SpriteSortMode_Deferred, _In_opt_ ID3D11BlendState* blendState = nullptr, _In_opt_ ID3D11SamplerState* samplerState = nullptr, _In_opt_ ID3D11DepthStencilState* depthStencilState = nullptr, _In_opt_ ID3D11RasterizerState* rasterizerState = nullptr, 59 | _In_opt_ std::function setCustomShaders = nullptr, FXMMATRIX transformMatrix = MatrixIdentity); 60 | void __cdecl End(); 61 | 62 | // Draw overloads specifying position, origin and scale as XMFLOAT2. 63 | void XM_CALLCONV Draw(_In_ ID3D11ShaderResourceView* texture, XMFLOAT2 const& position, FXMVECTOR color = Colors::White); 64 | void XM_CALLCONV Draw(_In_ ID3D11ShaderResourceView* texture, XMFLOAT2 const& position, _In_opt_ RECT const* sourceRectangle, FXMVECTOR color = Colors::White, float rotation = 0, XMFLOAT2 const& origin = Float2Zero, float scale = 1, SpriteEffects effects = SpriteEffects_None, float layerDepth = 0); 65 | void XM_CALLCONV Draw(_In_ ID3D11ShaderResourceView* texture, XMFLOAT2 const& position, _In_opt_ RECT const* sourceRectangle, FXMVECTOR color, float rotation, XMFLOAT2 const& origin, XMFLOAT2 const& scale, SpriteEffects effects = SpriteEffects_None, float layerDepth = 0); 66 | 67 | // Draw overloads specifying position, origin and scale via the first two components of an XMVECTOR. 68 | void XM_CALLCONV Draw(_In_ ID3D11ShaderResourceView* texture, FXMVECTOR position, FXMVECTOR color = Colors::White); 69 | void XM_CALLCONV Draw(_In_ ID3D11ShaderResourceView* texture, FXMVECTOR position, _In_opt_ RECT const* sourceRectangle, FXMVECTOR color = Colors::White, float rotation = 0, FXMVECTOR origin = g_XMZero, float scale = 1, SpriteEffects effects = SpriteEffects_None, float layerDepth = 0); 70 | void XM_CALLCONV Draw(_In_ ID3D11ShaderResourceView* texture, FXMVECTOR position, _In_opt_ RECT const* sourceRectangle, FXMVECTOR color, float rotation, FXMVECTOR origin, GXMVECTOR scale, SpriteEffects effects = SpriteEffects_None, float layerDepth = 0); 71 | 72 | // Draw overloads specifying position as a RECT. 73 | void XM_CALLCONV Draw(_In_ ID3D11ShaderResourceView* texture, RECT const& destinationRectangle, FXMVECTOR color = Colors::White); 74 | void XM_CALLCONV Draw(_In_ ID3D11ShaderResourceView* texture, RECT const& destinationRectangle, _In_opt_ RECT const* sourceRectangle, FXMVECTOR color = Colors::White, float rotation = 0, XMFLOAT2 const& origin = Float2Zero, SpriteEffects effects = SpriteEffects_None, float layerDepth = 0); 75 | 76 | // Rotation mode to be applied to the sprite transformation 77 | void __cdecl SetRotation(DXGI_MODE_ROTATION mode); 78 | DXGI_MODE_ROTATION __cdecl GetRotation() const; 79 | 80 | // Set viewport for sprite transformation 81 | void __cdecl SetViewport(const D3D11_VIEWPORT& viewPort); 82 | 83 | private: 84 | // Private implementation. 85 | class Impl; 86 | 87 | std::unique_ptr pImpl; 88 | 89 | static const XMMATRIX MatrixIdentity; 90 | static const XMFLOAT2 Float2Zero; 91 | }; 92 | } 93 | -------------------------------------------------------------------------------- /GCC-Collector/deps/DirectXTKInc/PrimitiveBatch.h: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------------------------- 2 | // File: PrimitiveBatch.h 3 | // 4 | // Copyright (c) Microsoft Corporation. All rights reserved. 5 | // Licensed under the MIT License. 6 | // 7 | // http://go.microsoft.com/fwlink/?LinkId=248929 8 | //-------------------------------------------------------------------------------------- 9 | 10 | #pragma once 11 | 12 | #if defined(_XBOX_ONE) && defined(_TITLE) 13 | #include 14 | #else 15 | #include 16 | #endif 17 | 18 | #include 19 | #include 20 | #include 21 | 22 | 23 | namespace DirectX 24 | { 25 | namespace Internal 26 | { 27 | // Base class, not to be used directly: clients should access this via the derived PrimitiveBatch. 28 | class PrimitiveBatchBase 29 | { 30 | protected: 31 | PrimitiveBatchBase(_In_ ID3D11DeviceContext* deviceContext, size_t maxIndices, size_t maxVertices, size_t vertexSize); 32 | PrimitiveBatchBase(PrimitiveBatchBase&& moveFrom) throw(); 33 | PrimitiveBatchBase& operator= (PrimitiveBatchBase&& moveFrom) throw(); 34 | 35 | PrimitiveBatchBase(PrimitiveBatchBase const&) = delete; 36 | PrimitiveBatchBase& operator= (PrimitiveBatchBase const&) = delete; 37 | 38 | virtual ~PrimitiveBatchBase(); 39 | 40 | public: 41 | // Begin/End a batch of primitive drawing operations. 42 | void __cdecl Begin(); 43 | void __cdecl End(); 44 | 45 | protected: 46 | // Internal, untyped drawing method. 47 | void __cdecl Draw(D3D11_PRIMITIVE_TOPOLOGY topology, bool isIndexed, _In_opt_count_(indexCount) uint16_t const* indices, size_t indexCount, size_t vertexCount, _Out_ void** pMappedVertices); 48 | 49 | private: 50 | // Private implementation. 51 | class Impl; 52 | 53 | std::unique_ptr pImpl; 54 | }; 55 | } 56 | 57 | 58 | // Template makes the API typesafe, eg. PrimitiveBatch. 59 | template 60 | class PrimitiveBatch : public Internal::PrimitiveBatchBase 61 | { 62 | static const size_t DefaultBatchSize = 2048; 63 | 64 | public: 65 | explicit PrimitiveBatch(_In_ ID3D11DeviceContext* deviceContext, size_t maxIndices = DefaultBatchSize * 3, size_t maxVertices = DefaultBatchSize) 66 | : PrimitiveBatchBase(deviceContext, maxIndices, maxVertices, sizeof(TVertex)) 67 | { } 68 | 69 | PrimitiveBatch(PrimitiveBatch&& moveFrom) throw() 70 | : PrimitiveBatchBase(std::move(moveFrom)) 71 | { } 72 | 73 | PrimitiveBatch& operator= (PrimitiveBatch&& moveFrom) throw() 74 | { 75 | PrimitiveBatchBase::operator=(std::move(moveFrom)); 76 | return *this; 77 | } 78 | 79 | 80 | // Similar to the D3D9 API DrawPrimitiveUP. 81 | void Draw(D3D11_PRIMITIVE_TOPOLOGY topology, _In_reads_(vertexCount) TVertex const* vertices, size_t vertexCount) 82 | { 83 | void* mappedVertices; 84 | 85 | PrimitiveBatchBase::Draw(topology, false, nullptr, 0, vertexCount, &mappedVertices); 86 | 87 | memcpy(mappedVertices, vertices, vertexCount * sizeof(TVertex)); 88 | } 89 | 90 | 91 | // Similar to the D3D9 API DrawIndexedPrimitiveUP. 92 | void DrawIndexed(D3D11_PRIMITIVE_TOPOLOGY topology, _In_reads_(indexCount) uint16_t const* indices, size_t indexCount, _In_reads_(vertexCount) TVertex const* vertices, size_t vertexCount) 93 | { 94 | void* mappedVertices; 95 | 96 | PrimitiveBatchBase::Draw(topology, true, indices, indexCount, vertexCount, &mappedVertices); 97 | 98 | memcpy(mappedVertices, vertices, vertexCount * sizeof(TVertex)); 99 | } 100 | 101 | 102 | void DrawLine(TVertex const& v1, TVertex const& v2) 103 | { 104 | TVertex* mappedVertices; 105 | 106 | PrimitiveBatchBase::Draw(D3D11_PRIMITIVE_TOPOLOGY_LINELIST, false, nullptr, 0, 2, reinterpret_cast(&mappedVertices)); 107 | 108 | mappedVertices[0] = v1; 109 | mappedVertices[1] = v2; 110 | } 111 | 112 | 113 | void DrawTriangle(TVertex const& v1, TVertex const& v2, TVertex const& v3) 114 | { 115 | TVertex* mappedVertices; 116 | 117 | PrimitiveBatchBase::Draw(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST, false, nullptr, 0, 3, reinterpret_cast(&mappedVertices)); 118 | 119 | mappedVertices[0] = v1; 120 | mappedVertices[1] = v2; 121 | mappedVertices[2] = v3; 122 | } 123 | 124 | 125 | void DrawQuad(TVertex const& v1, TVertex const& v2, TVertex const& v3, TVertex const& v4) 126 | { 127 | static const uint16_t quadIndices[] = { 0, 1, 2, 0, 2, 3 }; 128 | 129 | TVertex* mappedVertices; 130 | 131 | PrimitiveBatchBase::Draw(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST, true, quadIndices, 6, 4, reinterpret_cast(&mappedVertices)); 132 | 133 | mappedVertices[0] = v1; 134 | mappedVertices[1] = v2; 135 | mappedVertices[2] = v3; 136 | mappedVertices[3] = v4; 137 | } 138 | }; 139 | } 140 | -------------------------------------------------------------------------------- /noVehicle/noVehicle/src/main.h: -------------------------------------------------------------------------------- 1 | /* 2 | THIS FILE IS A PART OF GTA V SCRIPT HOOK SDK 3 | http://dev-c.com 4 | (C) Alexander Blade 2015-2016 5 | */ 6 | 7 | #pragma once 8 | 9 | #include 10 | #define IMPORT __declspec(dllimport) 11 | 12 | /* textures */ 13 | 14 | // Create texture 15 | // texFileName - texture file name, it's best to specify full texture path and use PNG textures 16 | // returns internal texture id 17 | // Texture deletion is performed automatically when game reloads scripts 18 | // Can be called only in the same thread as natives 19 | 20 | IMPORT int createTexture(const char *texFileName); 21 | 22 | // Draw texture 23 | // id - texture id recieved from createTexture() 24 | // index - each texture can have up to 64 different instances on screen at one time 25 | // level - draw level, being used in global draw order, texture instance with least level draws first 26 | // time - how much time (ms) texture instance will stay on screen, the amount of time should be enough 27 | // for it to stay on screen until the next corresponding drawTexture() call 28 | // sizeX,Y - size in screen space, should be in the range from 0.0 to 1.0, e.g setting this to 0.2 means that 29 | // texture instance will take 20% of the screen space 30 | // centerX,Y - center position in texture space, e.g. 0.5 means real texture center 31 | // posX,Y - position in screen space, [0.0, 0.0] - top left corner, [1.0, 1.0] - bottom right, 32 | // texture instance is positioned according to it's center 33 | // rotation - should be in the range from 0.0 to 1.0 34 | // screenHeightScaleFactor - screen aspect ratio, used for texture size correction, you can get it using natives 35 | // r,g,b,a - color, should be in the range from 0.0 to 1.0 36 | // 37 | // Texture instance draw parameters are updated each time script performs corresponding call to drawTexture() 38 | // You should always check your textures layout for 16:9, 16:10 and 4:3 screen aspects, for ex. in 1280x720, 39 | // 1440x900 and 1024x768 screen resolutions, use windowed mode for this 40 | // Can be called only in the same thread as natives 41 | 42 | IMPORT void drawTexture(int id, int index, int level, int time, 43 | float sizeX, float sizeY, float centerX, float centerY, 44 | float posX, float posY, float rotation, float screenHeightScaleFactor, 45 | float r, float g, float b, float a); 46 | 47 | // IDXGISwapChain::Present callback 48 | // Called right before the actual Present method call, render test calls don't trigger callbacks 49 | // When the game uses DX10 it actually uses DX11 with DX10 feature level 50 | // Remember that you can't call natives inside 51 | // void OnPresent(IDXGISwapChain *swapChain); 52 | typedef void(*PresentCallback)(void *); 53 | 54 | // Register IDXGISwapChain::Present callback 55 | // must be called on dll attach 56 | IMPORT void presentCallbackRegister(PresentCallback cb); 57 | 58 | // Unregister IDXGISwapChain::Present callback 59 | // must be called on dll detach 60 | IMPORT void presentCallbackUnregister(PresentCallback cb); 61 | 62 | /* keyboard */ 63 | 64 | // DWORD key, WORD repeats, BYTE scanCode, BOOL isExtended, BOOL isWithAlt, BOOL wasDownBefore, BOOL isUpNow 65 | typedef void(*KeyboardHandler)(DWORD, WORD, BYTE, BOOL, BOOL, BOOL, BOOL); 66 | 67 | // Register keyboard handler 68 | // must be called on dll attach 69 | IMPORT void keyboardHandlerRegister(KeyboardHandler handler); 70 | 71 | // Unregister keyboard handler 72 | // must be called on dll detach 73 | IMPORT void keyboardHandlerUnregister(KeyboardHandler handler); 74 | 75 | /* scripts */ 76 | 77 | IMPORT void scriptWait(DWORD time); 78 | IMPORT void scriptRegister(HMODULE module, void(*LP_SCRIPT_MAIN)()); 79 | IMPORT void scriptRegisterAdditionalThread(HMODULE module, void(*LP_SCRIPT_MAIN)()); 80 | IMPORT void scriptUnregister(HMODULE module); 81 | IMPORT void scriptUnregister(void(*LP_SCRIPT_MAIN)()); // deprecated 82 | 83 | IMPORT void nativeInit(UINT64 hash); 84 | IMPORT void nativePush64(UINT64 val); 85 | IMPORT PUINT64 nativeCall(); 86 | 87 | static void WAIT(DWORD time) { scriptWait(time); } 88 | static void TERMINATE() { WAIT(MAXDWORD); } 89 | 90 | // Returns pointer to global variable 91 | // make sure that you check game version before accessing globals because 92 | // ids may differ between patches 93 | IMPORT UINT64 *getGlobalPtr(int globalId); 94 | 95 | /* world */ 96 | 97 | // Get entities from internal pools 98 | // return value represents filled array elements count 99 | // can be called only in the same thread as natives 100 | IMPORT int worldGetAllVehicles(int *arr, int arrSize); 101 | IMPORT int worldGetAllPeds(int *arr, int arrSize); 102 | IMPORT int worldGetAllObjects(int *arr, int arrSize); 103 | IMPORT int worldGetAllPickups(int *arr, int arrSize); 104 | 105 | /* misc */ 106 | 107 | // Returns base object pointer using it's script handle 108 | // make sure that you check game version before accessing object fields because 109 | // offsets may differ between patches 110 | IMPORT BYTE *getScriptHandleBaseAddress(int handle); 111 | 112 | enum eGameVersion : int 113 | { 114 | VER_1_0_335_2_STEAM, 115 | VER_1_0_335_2_NOSTEAM, 116 | 117 | VER_1_0_350_1_STEAM, 118 | VER_1_0_350_2_NOSTEAM, 119 | 120 | VER_1_0_372_2_STEAM, 121 | VER_1_0_372_2_NOSTEAM, 122 | 123 | VER_1_0_393_2_STEAM, 124 | VER_1_0_393_2_NOSTEAM, 125 | 126 | VER_1_0_393_4_STEAM, 127 | VER_1_0_393_4_NOSTEAM, 128 | 129 | VER_1_0_463_1_STEAM, 130 | VER_1_0_463_1_NOSTEAM, 131 | 132 | VER_1_0_505_2_STEAM, 133 | VER_1_0_505_2_NOSTEAM, 134 | 135 | VER_1_0_573_1_STEAM, 136 | VER_1_0_573_1_NOSTEAM, 137 | 138 | VER_1_0_617_1_STEAM, 139 | VER_1_0_617_1_NOSTEAM, 140 | 141 | VER_SIZE, 142 | VER_UNK = -1 143 | }; 144 | 145 | IMPORT eGameVersion getGameVersion(); 146 | -------------------------------------------------------------------------------- /unlimitedLife/unlimitedLife/src/main.h: -------------------------------------------------------------------------------- 1 | /* 2 | THIS FILE IS A PART OF GTA V SCRIPT HOOK SDK 3 | http://dev-c.com 4 | (C) Alexander Blade 2015-2016 5 | */ 6 | 7 | #pragma once 8 | 9 | #include 10 | #define IMPORT __declspec(dllimport) 11 | 12 | /* textures */ 13 | 14 | // Create texture 15 | // texFileName - texture file name, it's best to specify full texture path and use PNG textures 16 | // returns internal texture id 17 | // Texture deletion is performed automatically when game reloads scripts 18 | // Can be called only in the same thread as natives 19 | 20 | IMPORT int createTexture(const char *texFileName); 21 | 22 | // Draw texture 23 | // id - texture id recieved from createTexture() 24 | // index - each texture can have up to 64 different instances on screen at one time 25 | // level - draw level, being used in global draw order, texture instance with least level draws first 26 | // time - how much time (ms) texture instance will stay on screen, the amount of time should be enough 27 | // for it to stay on screen until the next corresponding drawTexture() call 28 | // sizeX,Y - size in screen space, should be in the range from 0.0 to 1.0, e.g setting this to 0.2 means that 29 | // texture instance will take 20% of the screen space 30 | // centerX,Y - center position in texture space, e.g. 0.5 means real texture center 31 | // posX,Y - position in screen space, [0.0, 0.0] - top left corner, [1.0, 1.0] - bottom right, 32 | // texture instance is positioned according to it's center 33 | // rotation - should be in the range from 0.0 to 1.0 34 | // screenHeightScaleFactor - screen aspect ratio, used for texture size correction, you can get it using natives 35 | // r,g,b,a - color, should be in the range from 0.0 to 1.0 36 | // 37 | // Texture instance draw parameters are updated each time script performs corresponding call to drawTexture() 38 | // You should always check your textures layout for 16:9, 16:10 and 4:3 screen aspects, for ex. in 1280x720, 39 | // 1440x900 and 1024x768 screen resolutions, use windowed mode for this 40 | // Can be called only in the same thread as natives 41 | 42 | IMPORT void drawTexture(int id, int index, int level, int time, 43 | float sizeX, float sizeY, float centerX, float centerY, 44 | float posX, float posY, float rotation, float screenHeightScaleFactor, 45 | float r, float g, float b, float a); 46 | 47 | // IDXGISwapChain::Present callback 48 | // Called right before the actual Present method call, render test calls don't trigger callbacks 49 | // When the game uses DX10 it actually uses DX11 with DX10 feature level 50 | // Remember that you can't call natives inside 51 | // void OnPresent(IDXGISwapChain *swapChain); 52 | typedef void(*PresentCallback)(void *); 53 | 54 | // Register IDXGISwapChain::Present callback 55 | // must be called on dll attach 56 | IMPORT void presentCallbackRegister(PresentCallback cb); 57 | 58 | // Unregister IDXGISwapChain::Present callback 59 | // must be called on dll detach 60 | IMPORT void presentCallbackUnregister(PresentCallback cb); 61 | 62 | /* keyboard */ 63 | 64 | // DWORD key, WORD repeats, BYTE scanCode, BOOL isExtended, BOOL isWithAlt, BOOL wasDownBefore, BOOL isUpNow 65 | typedef void(*KeyboardHandler)(DWORD, WORD, BYTE, BOOL, BOOL, BOOL, BOOL); 66 | 67 | // Register keyboard handler 68 | // must be called on dll attach 69 | IMPORT void keyboardHandlerRegister(KeyboardHandler handler); 70 | 71 | // Unregister keyboard handler 72 | // must be called on dll detach 73 | IMPORT void keyboardHandlerUnregister(KeyboardHandler handler); 74 | 75 | /* scripts */ 76 | 77 | IMPORT void scriptWait(DWORD time); 78 | IMPORT void scriptRegister(HMODULE module, void(*LP_SCRIPT_MAIN)()); 79 | IMPORT void scriptRegisterAdditionalThread(HMODULE module, void(*LP_SCRIPT_MAIN)()); 80 | IMPORT void scriptUnregister(HMODULE module); 81 | IMPORT void scriptUnregister(void(*LP_SCRIPT_MAIN)()); // deprecated 82 | 83 | IMPORT void nativeInit(UINT64 hash); 84 | IMPORT void nativePush64(UINT64 val); 85 | IMPORT PUINT64 nativeCall(); 86 | 87 | static void WAIT(DWORD time) { scriptWait(time); } 88 | static void TERMINATE() { WAIT(MAXDWORD); } 89 | 90 | // Returns pointer to global variable 91 | // make sure that you check game version before accessing globals because 92 | // ids may differ between patches 93 | IMPORT UINT64 *getGlobalPtr(int globalId); 94 | 95 | /* world */ 96 | 97 | // Get entities from internal pools 98 | // return value represents filled array elements count 99 | // can be called only in the same thread as natives 100 | IMPORT int worldGetAllVehicles(int *arr, int arrSize); 101 | IMPORT int worldGetAllPeds(int *arr, int arrSize); 102 | IMPORT int worldGetAllObjects(int *arr, int arrSize); 103 | IMPORT int worldGetAllPickups(int *arr, int arrSize); 104 | 105 | /* misc */ 106 | 107 | // Returns base object pointer using it's script handle 108 | // make sure that you check game version before accessing object fields because 109 | // offsets may differ between patches 110 | IMPORT BYTE *getScriptHandleBaseAddress(int handle); 111 | 112 | enum eGameVersion : int 113 | { 114 | VER_1_0_335_2_STEAM, 115 | VER_1_0_335_2_NOSTEAM, 116 | 117 | VER_1_0_350_1_STEAM, 118 | VER_1_0_350_2_NOSTEAM, 119 | 120 | VER_1_0_372_2_STEAM, 121 | VER_1_0_372_2_NOSTEAM, 122 | 123 | VER_1_0_393_2_STEAM, 124 | VER_1_0_393_2_NOSTEAM, 125 | 126 | VER_1_0_393_4_STEAM, 127 | VER_1_0_393_4_NOSTEAM, 128 | 129 | VER_1_0_463_1_STEAM, 130 | VER_1_0_463_1_NOSTEAM, 131 | 132 | VER_1_0_505_2_STEAM, 133 | VER_1_0_505_2_NOSTEAM, 134 | 135 | VER_1_0_573_1_STEAM, 136 | VER_1_0_573_1_NOSTEAM, 137 | 138 | VER_1_0_617_1_STEAM, 139 | VER_1_0_617_1_NOSTEAM, 140 | 141 | VER_SIZE, 142 | VER_UNK = -1 143 | }; 144 | 145 | IMPORT eGameVersion getGameVersion(); 146 | -------------------------------------------------------------------------------- /GCC-Collector/deps/ScriptHookVInc/main.h: -------------------------------------------------------------------------------- 1 | /* 2 | THIS FILE IS A PART OF GTA V SCRIPT HOOK SDK 3 | http://dev-c.com 4 | (C) Alexander Blade 2015-2016 5 | */ 6 | 7 | #pragma once 8 | 9 | #include 10 | 11 | #define IMPORT __declspec(dllimport) 12 | 13 | /* textures */ 14 | 15 | // Create texture 16 | // texFileName - texture file name, it's best to specify full texture path and use PNG textures 17 | // returns internal texture id 18 | // Texture deletion is performed automatically when game reloads scripts 19 | // Can be called only in the same thread as natives 20 | 21 | IMPORT int createTexture(const char *texFileName); 22 | 23 | // Draw texture 24 | // id - texture id recieved from createTexture() 25 | // index - each texture can have up to 64 different instances on screen at one time 26 | // level - draw level, being used in global draw order, texture instance with least level draws first 27 | // time - how much time (ms) texture instance will stay on screen, the amount of time should be enough 28 | // for it to stay on screen until the next corresponding drawTexture() call 29 | // sizeX,Y - size in screen space, should be in the range from 0.0 to 1.0, e.g setting this to 0.2 means that 30 | // texture instance will take 20% of the screen space 31 | // centerX,Y - center position in texture space, e.g. 0.5 means real texture center 32 | // posX,Y - position in screen space, [0.0, 0.0] - top left corner, [1.0, 1.0] - bottom right, 33 | // texture instance is positioned according to it's center 34 | // rotation - should be in the range from 0.0 to 1.0 35 | // screenHeightScaleFactor - screen aspect ratio, used for texture size correction, you can get it using natives 36 | // r,g,b,a - color, should be in the range from 0.0 to 1.0 37 | // 38 | // Texture instance draw parameters are updated each time script performs corresponding call to drawTexture() 39 | // You should always check your textures layout for 16:9, 16:10 and 4:3 screen aspects, for ex. in 1280x720, 40 | // 1440x900 and 1024x768 screen resolutions, use windowed mode for this 41 | // Can be called only in the same thread as natives 42 | 43 | IMPORT void drawTexture(int id, int index, int level, int time, 44 | float sizeX, float sizeY, float centerX, float centerY, 45 | float posX, float posY, float rotation, float screenHeightScaleFactor, 46 | float r, float g, float b, float a); 47 | 48 | // IDXGISwapChain::Present callback 49 | // Called right before the actual Present method call, render test calls don't trigger callbacks 50 | // When the game uses DX10 it actually uses DX11 with DX10 feature level 51 | // Remember that you can't call natives inside 52 | // void OnPresent(IDXGISwapChain *swapChain); 53 | typedef void(*PresentCallback)(void *); 54 | 55 | // Register IDXGISwapChain::Present callback 56 | // must be called on dll attach 57 | IMPORT void presentCallbackRegister(PresentCallback cb); 58 | 59 | // Unregister IDXGISwapChain::Present callback 60 | // must be called on dll detach 61 | IMPORT void presentCallbackUnregister(PresentCallback cb); 62 | 63 | /* keyboard */ 64 | 65 | // DWORD key, WORD repeats, BYTE scanCode, BOOL isExtended, BOOL isWithAlt, BOOL wasDownBefore, BOOL isUpNow 66 | typedef void(*KeyboardHandler)(DWORD, WORD, BYTE, BOOL, BOOL, BOOL, BOOL); 67 | 68 | // Register keyboard handler 69 | // must be called on dll attach 70 | IMPORT void keyboardHandlerRegister(KeyboardHandler handler); 71 | 72 | // Unregister keyboard handler 73 | // must be called on dll detach 74 | IMPORT void keyboardHandlerUnregister(KeyboardHandler handler); 75 | 76 | /* scripts */ 77 | 78 | IMPORT void scriptWait(DWORD time); 79 | IMPORT void scriptRegister(HMODULE module, void(*LP_SCRIPT_MAIN)()); 80 | IMPORT void scriptRegisterAdditionalThread(HMODULE module, void(*LP_SCRIPT_MAIN)()); 81 | IMPORT void scriptUnregister(HMODULE module); 82 | IMPORT void scriptUnregister(void(*LP_SCRIPT_MAIN)()); // deprecated 83 | 84 | IMPORT void nativeInit(UINT64 hash); 85 | IMPORT void nativePush64(UINT64 val); 86 | IMPORT PUINT64 nativeCall(); 87 | 88 | static void WAIT(DWORD time) { scriptWait(time); } 89 | static void TERMINATE() { WAIT(MAXDWORD); } 90 | 91 | // Returns pointer to global variable 92 | // make sure that you check game version before accessing globals because 93 | // ids may differ between patches 94 | IMPORT UINT64 *getGlobalPtr(int globalId); 95 | 96 | /* world */ 97 | 98 | // Get entities from internal pools 99 | // return value represents filled array elements count 100 | // can be called only in the same thread as natives 101 | IMPORT int worldGetAllVehicles(int *arr, int arrSize); 102 | IMPORT int worldGetAllPeds(int *arr, int arrSize); 103 | IMPORT int worldGetAllObjects(int *arr, int arrSize); 104 | IMPORT int worldGetAllPickups(int *arr, int arrSize); 105 | 106 | /* misc */ 107 | 108 | // Returns base object pointer using it's script handle 109 | // make sure that you check game version before accessing object fields because 110 | // offsets may differ between patches 111 | IMPORT BYTE *getScriptHandleBaseAddress(int handle); 112 | 113 | enum eGameVersion : int 114 | { 115 | VER_1_0_335_2_STEAM, 116 | VER_1_0_335_2_NOSTEAM, 117 | 118 | VER_1_0_350_1_STEAM, 119 | VER_1_0_350_2_NOSTEAM, 120 | 121 | VER_1_0_372_2_STEAM, 122 | VER_1_0_372_2_NOSTEAM, 123 | 124 | VER_1_0_393_2_STEAM, 125 | VER_1_0_393_2_NOSTEAM, 126 | 127 | VER_1_0_393_4_STEAM, 128 | VER_1_0_393_4_NOSTEAM, 129 | 130 | VER_1_0_463_1_STEAM, 131 | VER_1_0_463_1_NOSTEAM, 132 | 133 | VER_1_0_505_2_STEAM, 134 | VER_1_0_505_2_NOSTEAM, 135 | 136 | VER_1_0_573_1_STEAM, 137 | VER_1_0_573_1_NOSTEAM, 138 | 139 | VER_1_0_617_1_STEAM, 140 | VER_1_0_617_1_NOSTEAM, 141 | 142 | VER_SIZE, 143 | VER_UNK = -1 144 | }; 145 | 146 | IMPORT eGameVersion getGameVersion(); 147 | 148 | void catchCurveAndScreen(WCHAR *_imgpath, char *_rawPath, bool _forceSave, bool _onlyScreen = false); 149 | inline void makeCmdStart(); -------------------------------------------------------------------------------- /GCC-Collector/deps/DirectXTKInc/DirectXHelpers.h: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------------------------- 2 | // File: DirectXHelpers.h 3 | // 4 | // Copyright (c) Microsoft Corporation. All rights reserved. 5 | // Licensed under the MIT License. 6 | // 7 | // http://go.microsoft.com/fwlink/?LinkId=248929 8 | //-------------------------------------------------------------------------------------- 9 | 10 | #pragma once 11 | 12 | #if defined(_XBOX_ONE) && defined(_TITLE) 13 | #include 14 | #else 15 | #include 16 | #endif 17 | 18 | #if !defined(NO_D3D11_DEBUG_NAME) && ( defined(_DEBUG) || defined(PROFILE) ) 19 | #if !defined(_XBOX_ONE) || !defined(_TITLE) 20 | #pragma comment(lib,"dxguid.lib") 21 | #endif 22 | #endif 23 | 24 | #ifndef IID_GRAPHICS_PPV_ARGS 25 | #define IID_GRAPHICS_PPV_ARGS(x) IID_PPV_ARGS(x) 26 | #endif 27 | 28 | #include 29 | #include 30 | 31 | // 32 | // The core Direct3D headers provide the following helper C++ classes 33 | // CD3D11_RECT 34 | // CD3D11_BOX 35 | // CD3D11_DEPTH_STENCIL_DESC 36 | // CD3D11_BLEND_DESC, CD3D11_BLEND_DESC1 37 | // CD3D11_RASTERIZER_DESC, CD3D11_RASTERIZER_DESC1 38 | // CD3D11_BUFFER_DESC 39 | // CD3D11_TEXTURE1D_DESC 40 | // CD3D11_TEXTURE2D_DESC 41 | // CD3D11_TEXTURE3D_DESC 42 | // CD3D11_SHADER_RESOURCE_VIEW_DESC 43 | // CD3D11_RENDER_TARGET_VIEW_DESC 44 | // CD3D11_VIEWPORT 45 | // CD3D11_DEPTH_STENCIL_VIEW_DESC 46 | // CD3D11_UNORDERED_ACCESS_VIEW_DESC 47 | // CD3D11_SAMPLER_DESC 48 | // CD3D11_QUERY_DESC 49 | // CD3D11_COUNTER_DESC 50 | // 51 | 52 | 53 | namespace DirectX 54 | { 55 | // simliar to std::lock_guard for exception-safe Direct3D resource locking 56 | class MapGuard : public D3D11_MAPPED_SUBRESOURCE 57 | { 58 | public: 59 | MapGuard(_In_ ID3D11DeviceContext* context, 60 | _In_ ID3D11Resource *resource, 61 | _In_ UINT subresource, 62 | _In_ D3D11_MAP mapType, 63 | _In_ UINT mapFlags) 64 | : mContext(context), mResource(resource), mSubresource(subresource) 65 | { 66 | HRESULT hr = mContext->Map(resource, subresource, mapType, mapFlags, this); 67 | if (FAILED(hr)) 68 | { 69 | throw std::exception(); 70 | } 71 | } 72 | 73 | ~MapGuard() 74 | { 75 | mContext->Unmap(mResource, mSubresource); 76 | } 77 | 78 | uint8_t* get() const 79 | { 80 | return static_cast(pData); 81 | } 82 | uint8_t* get(size_t slice) const 83 | { 84 | return static_cast(pData) + (slice * DepthPitch); 85 | } 86 | 87 | uint8_t* scanline(size_t row) const 88 | { 89 | return static_cast(pData) + (row * RowPitch); 90 | } 91 | uint8_t* scanline(size_t slice, size_t row) const 92 | { 93 | return static_cast(pData) + (slice * DepthPitch) + (row * RowPitch); 94 | } 95 | 96 | private: 97 | ID3D11DeviceContext* mContext; 98 | ID3D11Resource* mResource; 99 | UINT mSubresource; 100 | 101 | MapGuard(MapGuard const&); 102 | MapGuard& operator= (MapGuard const&); 103 | }; 104 | 105 | 106 | // Helper sets a D3D resource name string (used by PIX and debug layer leak reporting). 107 | template 108 | inline void SetDebugObjectName(_In_ ID3D11DeviceChild* resource, _In_z_ const char (&name)[TNameLength]) 109 | { 110 | #if !defined(NO_D3D11_DEBUG_NAME) && ( defined(_DEBUG) || defined(PROFILE) ) 111 | #if defined(_XBOX_ONE) && defined(_TITLE) 112 | wchar_t wname[MAX_PATH]; 113 | int result = MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, name, TNameLength, wname, MAX_PATH); 114 | if (result > 0) 115 | { 116 | resource->SetName(wname); 117 | } 118 | #else 119 | resource->SetPrivateData(WKPDID_D3DDebugObjectName, TNameLength - 1, name); 120 | #endif 121 | #else 122 | UNREFERENCED_PARAMETER(resource); 123 | UNREFERENCED_PARAMETER(name); 124 | #endif 125 | } 126 | 127 | template 128 | inline void SetDebugObjectName(_In_ ID3D11DeviceChild* resource, _In_z_ const wchar_t (&name)[TNameLength]) 129 | { 130 | #if !defined(NO_D3D11_DEBUG_NAME) && ( defined(_DEBUG) || defined(PROFILE) ) 131 | #if defined(_XBOX_ONE) && defined(_TITLE) 132 | resource->SetName( name ); 133 | #else 134 | char aname[MAX_PATH]; 135 | int result = WideCharToMultiByte(CP_ACP, 0, name, TNameLength, aname, MAX_PATH, nullptr, nullptr); 136 | if (result > 0) 137 | { 138 | resource->SetPrivateData(WKPDID_D3DDebugObjectName, TNameLength - 1, aname); 139 | } 140 | #endif 141 | #else 142 | UNREFERENCED_PARAMETER(resource); 143 | UNREFERENCED_PARAMETER(name); 144 | #endif 145 | } 146 | 147 | // Helpers for aligning values by a power of 2 148 | template 149 | inline T AlignDown(T size, size_t alignment) 150 | { 151 | if (alignment > 0) 152 | { 153 | assert(((alignment - 1) & alignment) == 0); 154 | T mask = static_cast(alignment - 1); 155 | return size & ~mask; 156 | } 157 | return size; 158 | } 159 | 160 | template 161 | inline T AlignUp(T size, size_t alignment) 162 | { 163 | if (alignment > 0) 164 | { 165 | assert(((alignment - 1) & alignment) == 0); 166 | T mask = static_cast(alignment - 1); 167 | return (size + mask) & ~mask; 168 | } 169 | return size; 170 | } 171 | } 172 | -------------------------------------------------------------------------------- /GCC-Collector/deps/DirectXTKInc/WICTextureLoader.h: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------------------------- 2 | // File: WICTextureLoader.h 3 | // 4 | // Function for loading a WIC image and creating a Direct3D runtime texture for it 5 | // (auto-generating mipmaps if possible) 6 | // 7 | // Note: Assumes application has already called CoInitializeEx 8 | // 9 | // Warning: CreateWICTexture* functions are not thread-safe if given a d3dContext instance for 10 | // auto-gen mipmap support. 11 | // 12 | // Note these functions are useful for images created as simple 2D textures. For 13 | // more complex resources, DDSTextureLoader is an excellent light-weight runtime loader. 14 | // For a full-featured DDS file reader, writer, and texture processing pipeline see 15 | // the 'Texconv' sample and the 'DirectXTex' library. 16 | // 17 | // Copyright (c) Microsoft Corporation. All rights reserved. 18 | // Licensed under the MIT License. 19 | // 20 | // http://go.microsoft.com/fwlink/?LinkId=248926 21 | // http://go.microsoft.com/fwlink/?LinkId=248929 22 | //-------------------------------------------------------------------------------------- 23 | 24 | #pragma once 25 | 26 | #if defined(_XBOX_ONE) && defined(_TITLE) 27 | #include 28 | #else 29 | #include 30 | #endif 31 | 32 | #include 33 | 34 | 35 | namespace DirectX 36 | { 37 | enum WIC_LOADER_FLAGS 38 | { 39 | WIC_LOADER_DEFAULT = 0, 40 | WIC_LOADER_FORCE_SRGB = 0x1, 41 | WIC_LOADER_IGNORE_SRGB = 0x2, 42 | }; 43 | 44 | // Standard version 45 | HRESULT __cdecl CreateWICTextureFromMemory( 46 | _In_ ID3D11Device* d3dDevice, 47 | _In_reads_bytes_(wicDataSize) const uint8_t* wicData, 48 | _In_ size_t wicDataSize, 49 | _Outptr_opt_ ID3D11Resource** texture, 50 | _Outptr_opt_ ID3D11ShaderResourceView** textureView, 51 | _In_ size_t maxsize = 0); 52 | 53 | HRESULT __cdecl CreateWICTextureFromFile( 54 | _In_ ID3D11Device* d3dDevice, 55 | _In_z_ const wchar_t* szFileName, 56 | _Outptr_opt_ ID3D11Resource** texture, 57 | _Outptr_opt_ ID3D11ShaderResourceView** textureView, 58 | _In_ size_t maxsize = 0); 59 | 60 | // Standard version with optional auto-gen mipmap support 61 | HRESULT __cdecl CreateWICTextureFromMemory( 62 | #if defined(_XBOX_ONE) && defined(_TITLE) 63 | _In_ ID3D11DeviceX* d3dDevice, 64 | _In_opt_ ID3D11DeviceContextX* d3dContext, 65 | #else 66 | _In_ ID3D11Device* d3dDevice, 67 | _In_opt_ ID3D11DeviceContext* d3dContext, 68 | #endif 69 | _In_reads_bytes_(wicDataSize) const uint8_t* wicData, 70 | _In_ size_t wicDataSize, 71 | _Outptr_opt_ ID3D11Resource** texture, 72 | _Outptr_opt_ ID3D11ShaderResourceView** textureView, 73 | _In_ size_t maxsize = 0); 74 | 75 | HRESULT __cdecl CreateWICTextureFromFile( 76 | #if defined(_XBOX_ONE) && defined(_TITLE) 77 | _In_ ID3D11DeviceX* d3dDevice, 78 | _In_opt_ ID3D11DeviceContextX* d3dContext, 79 | #else 80 | _In_ ID3D11Device* d3dDevice, 81 | _In_opt_ ID3D11DeviceContext* d3dContext, 82 | #endif 83 | _In_z_ const wchar_t* szFileName, 84 | _Outptr_opt_ ID3D11Resource** texture, 85 | _Outptr_opt_ ID3D11ShaderResourceView** textureView, 86 | _In_ size_t maxsize = 0); 87 | 88 | // Extended version 89 | HRESULT __cdecl CreateWICTextureFromMemoryEx( 90 | _In_ ID3D11Device* d3dDevice, 91 | _In_reads_bytes_(wicDataSize) const uint8_t* wicData, 92 | _In_ size_t wicDataSize, 93 | _In_ size_t maxsize, 94 | _In_ D3D11_USAGE usage, 95 | _In_ unsigned int bindFlags, 96 | _In_ unsigned int cpuAccessFlags, 97 | _In_ unsigned int miscFlags, 98 | _In_ unsigned int loadFlags, 99 | _Outptr_opt_ ID3D11Resource** texture, 100 | _Outptr_opt_ ID3D11ShaderResourceView** textureView); 101 | 102 | HRESULT __cdecl CreateWICTextureFromFileEx( 103 | _In_ ID3D11Device* d3dDevice, 104 | _In_z_ const wchar_t* szFileName, 105 | _In_ size_t maxsize, 106 | _In_ D3D11_USAGE usage, 107 | _In_ unsigned int bindFlags, 108 | _In_ unsigned int cpuAccessFlags, 109 | _In_ unsigned int miscFlags, 110 | _In_ unsigned int loadFlags, 111 | _Outptr_opt_ ID3D11Resource** texture, 112 | _Outptr_opt_ ID3D11ShaderResourceView** textureView); 113 | 114 | // Extended version with optional auto-gen mipmap support 115 | HRESULT __cdecl CreateWICTextureFromMemoryEx( 116 | #if defined(_XBOX_ONE) && defined(_TITLE) 117 | _In_ ID3D11DeviceX* d3dDevice, 118 | _In_opt_ ID3D11DeviceContextX* d3dContext, 119 | #else 120 | _In_ ID3D11Device* d3dDevice, 121 | _In_opt_ ID3D11DeviceContext* d3dContext, 122 | #endif 123 | _In_reads_bytes_(wicDataSize) const uint8_t* wicData, 124 | _In_ size_t wicDataSize, 125 | _In_ size_t maxsize, 126 | _In_ D3D11_USAGE usage, 127 | _In_ unsigned int bindFlags, 128 | _In_ unsigned int cpuAccessFlags, 129 | _In_ unsigned int miscFlags, 130 | _In_ unsigned int loadFlags, 131 | _Outptr_opt_ ID3D11Resource** texture, 132 | _Outptr_opt_ ID3D11ShaderResourceView** textureView); 133 | 134 | HRESULT __cdecl CreateWICTextureFromFileEx( 135 | #if defined(_XBOX_ONE) && defined(_TITLE) 136 | _In_ ID3D11DeviceX* d3dDevice, 137 | _In_opt_ ID3D11DeviceContextX* d3dContext, 138 | #else 139 | _In_ ID3D11Device* d3dDevice, 140 | _In_opt_ ID3D11DeviceContext* d3dContext, 141 | #endif 142 | _In_z_ const wchar_t* szFileName, 143 | _In_ size_t maxsize, 144 | _In_ D3D11_USAGE usage, 145 | _In_ unsigned int bindFlags, 146 | _In_ unsigned int cpuAccessFlags, 147 | _In_ unsigned int miscFlags, 148 | _In_ unsigned int loadFlags, 149 | _Outptr_opt_ ID3D11Resource** texture, 150 | _Outptr_opt_ ID3D11ShaderResourceView** textureView); 151 | } -------------------------------------------------------------------------------- /GCC-Collector/deps/DirectXTKInc/DDSTextureLoader.h: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------------------------- 2 | // File: DDSTextureLoader.h 3 | // 4 | // Functions for loading a DDS texture and creating a Direct3D runtime resource for it 5 | // 6 | // Note these functions are useful as a light-weight runtime loader for DDS files. For 7 | // a full-featured DDS file reader, writer, and texture processing pipeline see 8 | // the 'Texconv' sample and the 'DirectXTex' library. 9 | // 10 | // Copyright (c) Microsoft Corporation. All rights reserved. 11 | // Licensed under the MIT License. 12 | // 13 | // http://go.microsoft.com/fwlink/?LinkId=248926 14 | // http://go.microsoft.com/fwlink/?LinkId=248929 15 | //-------------------------------------------------------------------------------------- 16 | 17 | #pragma once 18 | 19 | #if defined(_XBOX_ONE) && defined(_TITLE) 20 | #include 21 | #else 22 | #include 23 | #endif 24 | 25 | #include 26 | 27 | 28 | namespace DirectX 29 | { 30 | enum DDS_ALPHA_MODE 31 | { 32 | DDS_ALPHA_MODE_UNKNOWN = 0, 33 | DDS_ALPHA_MODE_STRAIGHT = 1, 34 | DDS_ALPHA_MODE_PREMULTIPLIED = 2, 35 | DDS_ALPHA_MODE_OPAQUE = 3, 36 | DDS_ALPHA_MODE_CUSTOM = 4, 37 | }; 38 | 39 | // Standard version 40 | HRESULT __cdecl CreateDDSTextureFromMemory( 41 | _In_ ID3D11Device* d3dDevice, 42 | _In_reads_bytes_(ddsDataSize) const uint8_t* ddsData, 43 | _In_ size_t ddsDataSize, 44 | _Outptr_opt_ ID3D11Resource** texture, 45 | _Outptr_opt_ ID3D11ShaderResourceView** textureView, 46 | _In_ size_t maxsize = 0, 47 | _Out_opt_ DDS_ALPHA_MODE* alphaMode = nullptr); 48 | 49 | HRESULT __cdecl CreateDDSTextureFromFile( 50 | _In_ ID3D11Device* d3dDevice, 51 | _In_z_ const wchar_t* szFileName, 52 | _Outptr_opt_ ID3D11Resource** texture, 53 | _Outptr_opt_ ID3D11ShaderResourceView** textureView, 54 | _In_ size_t maxsize = 0, 55 | _Out_opt_ DDS_ALPHA_MODE* alphaMode = nullptr); 56 | 57 | // Standard version with optional auto-gen mipmap support 58 | HRESULT __cdecl CreateDDSTextureFromMemory( 59 | #if defined(_XBOX_ONE) && defined(_TITLE) 60 | _In_ ID3D11DeviceX* d3dDevice, 61 | _In_opt_ ID3D11DeviceContextX* d3dContext, 62 | #else 63 | _In_ ID3D11Device* d3dDevice, 64 | _In_opt_ ID3D11DeviceContext* d3dContext, 65 | #endif 66 | _In_reads_bytes_(ddsDataSize) const uint8_t* ddsData, 67 | _In_ size_t ddsDataSize, 68 | _Outptr_opt_ ID3D11Resource** texture, 69 | _Outptr_opt_ ID3D11ShaderResourceView** textureView, 70 | _In_ size_t maxsize = 0, 71 | _Out_opt_ DDS_ALPHA_MODE* alphaMode = nullptr); 72 | 73 | HRESULT __cdecl CreateDDSTextureFromFile( 74 | #if defined(_XBOX_ONE) && defined(_TITLE) 75 | _In_ ID3D11DeviceX* d3dDevice, 76 | _In_opt_ ID3D11DeviceContextX* d3dContext, 77 | #else 78 | _In_ ID3D11Device* d3dDevice, 79 | _In_opt_ ID3D11DeviceContext* d3dContext, 80 | #endif 81 | _In_z_ const wchar_t* szFileName, 82 | _Outptr_opt_ ID3D11Resource** texture, 83 | _Outptr_opt_ ID3D11ShaderResourceView** textureView, 84 | _In_ size_t maxsize = 0, 85 | _Out_opt_ DDS_ALPHA_MODE* alphaMode = nullptr); 86 | 87 | // Extended version 88 | HRESULT __cdecl CreateDDSTextureFromMemoryEx( 89 | _In_ ID3D11Device* d3dDevice, 90 | _In_reads_bytes_(ddsDataSize) const uint8_t* ddsData, 91 | _In_ size_t ddsDataSize, 92 | _In_ size_t maxsize, 93 | _In_ D3D11_USAGE usage, 94 | _In_ unsigned int bindFlags, 95 | _In_ unsigned int cpuAccessFlags, 96 | _In_ unsigned int miscFlags, 97 | _In_ bool forceSRGB, 98 | _Outptr_opt_ ID3D11Resource** texture, 99 | _Outptr_opt_ ID3D11ShaderResourceView** textureView, 100 | _Out_opt_ DDS_ALPHA_MODE* alphaMode = nullptr); 101 | 102 | HRESULT __cdecl CreateDDSTextureFromFileEx( 103 | _In_ ID3D11Device* d3dDevice, 104 | _In_z_ const wchar_t* szFileName, 105 | _In_ size_t maxsize, 106 | _In_ D3D11_USAGE usage, 107 | _In_ unsigned int bindFlags, 108 | _In_ unsigned int cpuAccessFlags, 109 | _In_ unsigned int miscFlags, 110 | _In_ bool forceSRGB, 111 | _Outptr_opt_ ID3D11Resource** texture, 112 | _Outptr_opt_ ID3D11ShaderResourceView** textureView, 113 | _Out_opt_ DDS_ALPHA_MODE* alphaMode = nullptr); 114 | 115 | // Extended version with optional auto-gen mipmap support 116 | HRESULT __cdecl CreateDDSTextureFromMemoryEx( 117 | #if defined(_XBOX_ONE) && defined(_TITLE) 118 | _In_ ID3D11DeviceX* d3dDevice, 119 | _In_opt_ ID3D11DeviceContextX* d3dContext, 120 | #else 121 | _In_ ID3D11Device* d3dDevice, 122 | _In_opt_ ID3D11DeviceContext* d3dContext, 123 | #endif 124 | _In_reads_bytes_(ddsDataSize) const uint8_t* ddsData, 125 | _In_ size_t ddsDataSize, 126 | _In_ size_t maxsize, 127 | _In_ D3D11_USAGE usage, 128 | _In_ unsigned int bindFlags, 129 | _In_ unsigned int cpuAccessFlags, 130 | _In_ unsigned int miscFlags, 131 | _In_ bool forceSRGB, 132 | _Outptr_opt_ ID3D11Resource** texture, 133 | _Outptr_opt_ ID3D11ShaderResourceView** textureView, 134 | _Out_opt_ DDS_ALPHA_MODE* alphaMode = nullptr); 135 | 136 | HRESULT __cdecl CreateDDSTextureFromFileEx( 137 | #if defined(_XBOX_ONE) && defined(_TITLE) 138 | _In_ ID3D11DeviceX* d3dDevice, 139 | _In_opt_ ID3D11DeviceContextX* d3dContext, 140 | #else 141 | _In_ ID3D11Device* d3dDevice, 142 | _In_opt_ ID3D11DeviceContext* d3dContext, 143 | #endif 144 | _In_z_ const wchar_t* szFileName, 145 | _In_ size_t maxsize, 146 | _In_ D3D11_USAGE usage, 147 | _In_ unsigned int bindFlags, 148 | _In_ unsigned int cpuAccessFlags, 149 | _In_ unsigned int miscFlags, 150 | _In_ bool forceSRGB, 151 | _Outptr_opt_ ID3D11Resource** texture, 152 | _Outptr_opt_ ID3D11ShaderResourceView** textureView, 153 | _Out_opt_ DDS_ALPHA_MODE* alphaMode = nullptr); 154 | } -------------------------------------------------------------------------------- /GCC-Collector/deps/DirectXTKInc/GeometricPrimitive.h: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------------------------- 2 | // File: GeometricPrimitive.h 3 | // 4 | // Copyright (c) Microsoft Corporation. All rights reserved. 5 | // Licensed under the MIT License. 6 | // 7 | // http://go.microsoft.com/fwlink/?LinkId=248929 8 | //-------------------------------------------------------------------------------------- 9 | 10 | #pragma once 11 | 12 | #include "VertexTypes.h" 13 | 14 | #include 15 | #include 16 | #include 17 | #include 18 | 19 | 20 | namespace DirectX 21 | { 22 | class IEffect; 23 | 24 | class GeometricPrimitive 25 | { 26 | public: 27 | GeometricPrimitive(GeometricPrimitive const&) = delete; 28 | GeometricPrimitive& operator= (GeometricPrimitive const&) = delete; 29 | 30 | using VertexType = VertexPositionNormalTexture; 31 | 32 | virtual ~GeometricPrimitive(); 33 | 34 | // Factory methods. 35 | static std::unique_ptr __cdecl CreateCube(_In_ ID3D11DeviceContext* deviceContext, float size = 1, bool rhcoords = true); 36 | static std::unique_ptr __cdecl CreateBox(_In_ ID3D11DeviceContext* deviceContext, const XMFLOAT3& size, bool rhcoords = true, bool invertn = false); 37 | static std::unique_ptr __cdecl CreateSphere(_In_ ID3D11DeviceContext* deviceContext, float diameter = 1, size_t tessellation = 16, bool rhcoords = true, bool invertn = false); 38 | static std::unique_ptr __cdecl CreateGeoSphere(_In_ ID3D11DeviceContext* deviceContext, float diameter = 1, size_t tessellation = 3, bool rhcoords = true); 39 | static std::unique_ptr __cdecl CreateCylinder(_In_ ID3D11DeviceContext* deviceContext, float height = 1, float diameter = 1, size_t tessellation = 32, bool rhcoords = true); 40 | static std::unique_ptr __cdecl CreateCone(_In_ ID3D11DeviceContext* deviceContext, float diameter = 1, float height = 1, size_t tessellation = 32, bool rhcoords = true); 41 | static std::unique_ptr __cdecl CreateTorus(_In_ ID3D11DeviceContext* deviceContext, float diameter = 1, float thickness = 0.333f, size_t tessellation = 32, bool rhcoords = true); 42 | static std::unique_ptr __cdecl CreateTetrahedron(_In_ ID3D11DeviceContext* deviceContext, float size = 1, bool rhcoords = true); 43 | static std::unique_ptr __cdecl CreateOctahedron(_In_ ID3D11DeviceContext* deviceContext, float size = 1, bool rhcoords = true); 44 | static std::unique_ptr __cdecl CreateDodecahedron(_In_ ID3D11DeviceContext* deviceContext, float size = 1, bool rhcoords = true); 45 | static std::unique_ptr __cdecl CreateIcosahedron(_In_ ID3D11DeviceContext* deviceContext, float size = 1, bool rhcoords = true); 46 | static std::unique_ptr __cdecl CreateTeapot(_In_ ID3D11DeviceContext* deviceContext, float size = 1, size_t tessellation = 8, bool rhcoords = true); 47 | static std::unique_ptr __cdecl CreateCustom(_In_ ID3D11DeviceContext* deviceContext, const std::vector& vertices, const std::vector& indices); 48 | 49 | static void __cdecl CreateCube(std::vector& vertices, std::vector& indices, float size = 1, bool rhcoords = true); 50 | static void __cdecl CreateBox(std::vector& vertices, std::vector& indices, const XMFLOAT3& size, bool rhcoords = true, bool invertn = false); 51 | static void __cdecl CreateSphere(std::vector& vertices, std::vector& indices, float diameter = 1, size_t tessellation = 16, bool rhcoords = true, bool invertn = false); 52 | static void __cdecl CreateGeoSphere(std::vector& vertices, std::vector& indices, float diameter = 1, size_t tessellation = 3, bool rhcoords = true); 53 | static void __cdecl CreateCylinder(std::vector& vertices, std::vector& indices, float height = 1, float diameter = 1, size_t tessellation = 32, bool rhcoords = true); 54 | static void __cdecl CreateCone(std::vector& vertices, std::vector& indices, float diameter = 1, float height = 1, size_t tessellation = 32, bool rhcoords = true); 55 | static void __cdecl CreateTorus(std::vector& vertices, std::vector& indices, float diameter = 1, float thickness = 0.333f, size_t tessellation = 32, bool rhcoords = true); 56 | static void __cdecl CreateTetrahedron(std::vector& vertices, std::vector& indices, float size = 1, bool rhcoords = true); 57 | static void __cdecl CreateOctahedron(std::vector& vertices, std::vector& indices, float size = 1, bool rhcoords = true); 58 | static void __cdecl CreateDodecahedron(std::vector& vertices, std::vector& indices, float size = 1, bool rhcoords = true); 59 | static void __cdecl CreateIcosahedron(std::vector& vertices, std::vector& indices, float size = 1, bool rhcoords = true); 60 | static void __cdecl CreateTeapot(std::vector& vertices, std::vector& indices, float size = 1, size_t tessellation = 8, bool rhcoords = true); 61 | 62 | // Draw the primitive. 63 | void XM_CALLCONV Draw(FXMMATRIX world, CXMMATRIX view, CXMMATRIX projection, FXMVECTOR color = Colors::White, _In_opt_ ID3D11ShaderResourceView* texture = nullptr, bool wireframe = false, 64 | _In_opt_ std::function setCustomState = nullptr) const; 65 | 66 | // Draw the primitive using a custom effect. 67 | void __cdecl Draw(_In_ IEffect* effect, _In_ ID3D11InputLayout* inputLayout, bool alpha = false, bool wireframe = false, 68 | _In_opt_ std::function setCustomState = nullptr) const; 69 | 70 | // Create input layout for drawing with a custom effect. 71 | void __cdecl CreateInputLayout(_In_ IEffect* effect, _Outptr_ ID3D11InputLayout** inputLayout) const; 72 | 73 | private: 74 | GeometricPrimitive(); 75 | 76 | // Private implementation. 77 | class Impl; 78 | 79 | std::unique_ptr pImpl; 80 | }; 81 | } 82 | -------------------------------------------------------------------------------- /unlimitedLife/unlimitedLife/unlimitedLife.vcxproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | Debug 14 | x64 15 | 16 | 17 | Release 18 | x64 19 | 20 | 21 | 22 | 15.0 23 | {594DE3DD-60B9-421E-9C41-F1345BE2D0FC} 24 | unlimitedLife 25 | 10.0.17134.0 26 | 27 | 28 | 29 | DynamicLibrary 30 | true 31 | v141 32 | MultiByte 33 | 34 | 35 | Application 36 | false 37 | v141 38 | true 39 | MultiByte 40 | 41 | 42 | Application 43 | true 44 | v141 45 | MultiByte 46 | 47 | 48 | DynamicLibrary 49 | false 50 | v141 51 | true 52 | Unicode 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | .asi 74 | 75 | 76 | .asi 77 | 78 | 79 | 80 | Level3 81 | Disabled 82 | true 83 | true 84 | 85 | 86 | 87 | 88 | Level3 89 | Disabled 90 | true 91 | true 92 | 93 | 94 | 95 | 96 | Level3 97 | MaxSpeed 98 | true 99 | true 100 | true 101 | true 102 | 103 | 104 | true 105 | true 106 | 107 | 108 | 109 | 110 | Level3 111 | MaxSpeed 112 | true 113 | true 114 | true 115 | true 116 | 117 | 118 | true 119 | true 120 | .\lib\ScriptHookV.lib 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | -------------------------------------------------------------------------------- /GCC-Collector/deps/DirectXTKInc/Model.h: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------------------------- 2 | // File: Model.h 3 | // 4 | // Copyright (c) Microsoft Corporation. All rights reserved. 5 | // Licensed under the MIT License. 6 | // 7 | // http://go.microsoft.com/fwlink/?LinkId=248929 8 | //-------------------------------------------------------------------------------------- 9 | 10 | #pragma once 11 | 12 | #if defined(_XBOX_ONE) && defined(_TITLE) 13 | #include 14 | #else 15 | #include 16 | #endif 17 | 18 | #include 19 | #include 20 | 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | 27 | #include 28 | 29 | #include 30 | 31 | 32 | namespace DirectX 33 | { 34 | class IEffect; 35 | class IEffectFactory; 36 | class CommonStates; 37 | class ModelMesh; 38 | 39 | //---------------------------------------------------------------------------------- 40 | // Each mesh part is a submesh with a single effect 41 | class ModelMeshPart 42 | { 43 | public: 44 | ModelMeshPart() throw(); 45 | virtual ~ModelMeshPart(); 46 | 47 | uint32_t indexCount; 48 | uint32_t startIndex; 49 | uint32_t vertexOffset; 50 | uint32_t vertexStride; 51 | D3D_PRIMITIVE_TOPOLOGY primitiveType; 52 | DXGI_FORMAT indexFormat; 53 | Microsoft::WRL::ComPtr inputLayout; 54 | Microsoft::WRL::ComPtr indexBuffer; 55 | Microsoft::WRL::ComPtr vertexBuffer; 56 | std::shared_ptr effect; 57 | std::shared_ptr> vbDecl; 58 | bool isAlpha; 59 | 60 | typedef std::vector> Collection; 61 | 62 | // Draw mesh part with custom effect 63 | void __cdecl Draw(_In_ ID3D11DeviceContext* deviceContext, _In_ IEffect* ieffect, _In_ ID3D11InputLayout* iinputLayout, 64 | _In_opt_ std::function setCustomState = nullptr) const; 65 | 66 | // Create input layout for drawing with a custom effect. 67 | void __cdecl CreateInputLayout(_In_ ID3D11Device* d3dDevice, _In_ IEffect* ieffect, _Outptr_ ID3D11InputLayout** iinputLayout) const; 68 | 69 | // Change effect used by part and regenerate input layout (be sure to call Model::Modified as well) 70 | void __cdecl ModifyEffect(_In_ ID3D11Device* d3dDevice, _In_ std::shared_ptr& ieffect, bool isalpha = false); 71 | }; 72 | 73 | 74 | //---------------------------------------------------------------------------------- 75 | // A mesh consists of one or more model mesh parts 76 | class ModelMesh 77 | { 78 | public: 79 | ModelMesh() throw(); 80 | virtual ~ModelMesh(); 81 | 82 | BoundingSphere boundingSphere; 83 | BoundingBox boundingBox; 84 | ModelMeshPart::Collection meshParts; 85 | std::wstring name; 86 | bool ccw; 87 | bool pmalpha; 88 | 89 | typedef std::vector> Collection; 90 | 91 | // Setup states for drawing mesh 92 | void __cdecl PrepareForRendering(_In_ ID3D11DeviceContext* deviceContext, const CommonStates& states, bool alpha = false, bool wireframe = false) const; 93 | 94 | // Draw the mesh 95 | void XM_CALLCONV Draw(_In_ ID3D11DeviceContext* deviceContext, FXMMATRIX world, CXMMATRIX view, CXMMATRIX projection, 96 | bool alpha = false, _In_opt_ std::function setCustomState = nullptr) const; 97 | }; 98 | 99 | 100 | //---------------------------------------------------------------------------------- 101 | // A model consists of one or more meshes 102 | class Model 103 | { 104 | public: 105 | virtual ~Model(); 106 | 107 | ModelMesh::Collection meshes; 108 | std::wstring name; 109 | 110 | // Draw all the meshes in the model 111 | void XM_CALLCONV Draw(_In_ ID3D11DeviceContext* deviceContext, const CommonStates& states, FXMMATRIX world, CXMMATRIX view, CXMMATRIX projection, 112 | bool wireframe = false, _In_opt_ std::function setCustomState = nullptr) const; 113 | 114 | // Notify model that effects, parts list, or mesh list has changed 115 | void __cdecl Modified() { mEffectCache.clear(); } 116 | 117 | // Update all effects used by the model 118 | void __cdecl UpdateEffects(_In_ std::function setEffect); 119 | 120 | // Loads a model from a Visual Studio Starter Kit .CMO file 121 | static std::unique_ptr __cdecl CreateFromCMO(_In_ ID3D11Device* d3dDevice, _In_reads_bytes_(dataSize) const uint8_t* meshData, size_t dataSize, 122 | _In_ IEffectFactory& fxFactory, bool ccw = true, bool pmalpha = false); 123 | static std::unique_ptr __cdecl CreateFromCMO(_In_ ID3D11Device* d3dDevice, _In_z_ const wchar_t* szFileName, 124 | _In_ IEffectFactory& fxFactory, bool ccw = true, bool pmalpha = false); 125 | 126 | // Loads a model from a DirectX SDK .SDKMESH file 127 | static std::unique_ptr __cdecl CreateFromSDKMESH(_In_ ID3D11Device* d3dDevice, _In_reads_bytes_(dataSize) const uint8_t* meshData, _In_ size_t dataSize, 128 | _In_ IEffectFactory& fxFactory, bool ccw = false, bool pmalpha = false); 129 | static std::unique_ptr __cdecl CreateFromSDKMESH(_In_ ID3D11Device* d3dDevice, _In_z_ const wchar_t* szFileName, 130 | _In_ IEffectFactory& fxFactory, bool ccw = false, bool pmalpha = false); 131 | 132 | // Loads a model from a .VBO file 133 | static std::unique_ptr __cdecl CreateFromVBO(_In_ ID3D11Device* d3dDevice, _In_reads_bytes_(dataSize) const uint8_t* meshData, _In_ size_t dataSize, 134 | _In_opt_ std::shared_ptr ieffect = nullptr, bool ccw = false, bool pmalpha = false); 135 | static std::unique_ptr __cdecl CreateFromVBO(_In_ ID3D11Device* d3dDevice, _In_z_ const wchar_t* szFileName, 136 | _In_opt_ std::shared_ptr ieffect = nullptr, bool ccw = false, bool pmalpha = false); 137 | 138 | private: 139 | std::set mEffectCache; 140 | }; 141 | } -------------------------------------------------------------------------------- /noVehicle/noVehicle/noVehicle.vcxproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | Debug 14 | x64 15 | 16 | 17 | Release 18 | x64 19 | 20 | 21 | 22 | 15.0 23 | {6AD7722A-142B-499E-8204-5F79FB123EE9} 24 | noVehicle 25 | 10.0.17134.0 26 | 27 | 28 | 29 | DynamicLibrary 30 | true 31 | v141 32 | Unicode 33 | 34 | 35 | Application 36 | false 37 | v141 38 | true 39 | MultiByte 40 | 41 | 42 | Application 43 | true 44 | v141 45 | MultiByte 46 | 47 | 48 | DynamicLibrary 49 | false 50 | v141 51 | true 52 | MultiByte 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | .asi 74 | 75 | 76 | .asi 77 | 78 | 79 | 80 | Level3 81 | Disabled 82 | true 83 | true 84 | 85 | 86 | .\lib\ScriptHookV.lib;%(AdditionalDependencies) 87 | 88 | 89 | 90 | 91 | Level3 92 | Disabled 93 | true 94 | true 95 | 96 | 97 | 98 | 99 | Level3 100 | MaxSpeed 101 | true 102 | true 103 | true 104 | true 105 | 106 | 107 | true 108 | true 109 | 110 | 111 | 112 | 113 | Level3 114 | MaxSpeed 115 | true 116 | true 117 | true 118 | true 119 | 120 | 121 | true 122 | true 123 | .\lib\ScriptHookV.lib;%(AdditionalDependencies) 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | -------------------------------------------------------------------------------- /GCC-Collector/deps/DirectXTKInc/PostProcess.h: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------------------------- 2 | // File: PostProcess.h 3 | // 4 | // Copyright (c) Microsoft Corporation. All rights reserved. 5 | // Licensed under the MIT License. 6 | // 7 | // http://go.microsoft.com/fwlink/?LinkId=248929 8 | //-------------------------------------------------------------------------------------- 9 | 10 | #pragma once 11 | 12 | #if defined(WINAPI_FAMILY) && WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP 13 | #error Post-processing not supported for Windows Phone 8.x; requires Direct3D hardware Feature Level 10.0 or better 14 | #endif 15 | 16 | #if defined(_XBOX_ONE) && defined(_TITLE) 17 | #include 18 | #else 19 | #include 20 | #endif 21 | 22 | #include 23 | #include 24 | #include 25 | 26 | 27 | namespace DirectX 28 | { 29 | //---------------------------------------------------------------------------------- 30 | // Abstract interface representing a post-process pass 31 | class IPostProcess 32 | { 33 | public: 34 | virtual ~IPostProcess() { } 35 | 36 | virtual void __cdecl Process(_In_ ID3D11DeviceContext* deviceContext, _In_opt_ std::function setCustomState = nullptr) = 0; 37 | }; 38 | 39 | 40 | //---------------------------------------------------------------------------------- 41 | // Basic post-process 42 | class BasicPostProcess : public IPostProcess 43 | { 44 | public: 45 | enum Effect 46 | { 47 | Copy, 48 | Monochrome, 49 | Sepia, 50 | DownScale_2x2, 51 | DownScale_4x4, 52 | GaussianBlur_5x5, 53 | BloomExtract, 54 | BloomBlur, 55 | Effect_Max 56 | }; 57 | 58 | explicit BasicPostProcess(_In_ ID3D11Device* device); 59 | BasicPostProcess(BasicPostProcess&& moveFrom) throw(); 60 | BasicPostProcess& operator= (BasicPostProcess&& moveFrom) throw(); 61 | 62 | BasicPostProcess(BasicPostProcess const&) = delete; 63 | BasicPostProcess& operator= (BasicPostProcess const&) = delete; 64 | 65 | virtual ~BasicPostProcess(); 66 | 67 | // IPostProcess methods. 68 | void __cdecl Process(_In_ ID3D11DeviceContext* deviceContext, _In_opt_ std::function setCustomState = nullptr) override; 69 | 70 | // Shader control 71 | void __cdecl SetEffect(Effect fx); 72 | 73 | // Properties 74 | void __cdecl SetSourceTexture(_In_opt_ ID3D11ShaderResourceView* value); 75 | 76 | // Sets multiplier for GaussianBlur_5x5 77 | void __cdecl SetGaussianParameter(float multiplier); 78 | 79 | // Sets parameters for BloomExtract 80 | void __cdecl SetBloomExtractParameter(float threshold); 81 | 82 | // Sets parameters for BloomBlur 83 | void __cdecl SetBloomBlurParameters(bool horizontal, float size, float brightness); 84 | 85 | private: 86 | // Private implementation. 87 | class Impl; 88 | 89 | std::unique_ptr pImpl; 90 | }; 91 | 92 | 93 | //---------------------------------------------------------------------------------- 94 | // Dual-texure post-process 95 | class DualPostProcess : public IPostProcess 96 | { 97 | public: 98 | enum Effect 99 | { 100 | Merge, 101 | BloomCombine, 102 | Effect_Max 103 | }; 104 | 105 | explicit DualPostProcess(_In_ ID3D11Device* device); 106 | DualPostProcess(DualPostProcess&& moveFrom) throw(); 107 | DualPostProcess& operator= (DualPostProcess&& moveFrom) throw(); 108 | 109 | DualPostProcess(DualPostProcess const&) = delete; 110 | DualPostProcess& operator= (DualPostProcess const&) = delete; 111 | 112 | virtual ~DualPostProcess(); 113 | 114 | // IPostProcess methods. 115 | void __cdecl Process(_In_ ID3D11DeviceContext* deviceContext, _In_opt_ std::function setCustomState = nullptr) override; 116 | 117 | // Shader control 118 | void __cdecl SetEffect(Effect fx); 119 | 120 | // Properties 121 | void __cdecl SetSourceTexture(_In_opt_ ID3D11ShaderResourceView* value); 122 | void __cdecl SetSourceTexture2(_In_opt_ ID3D11ShaderResourceView* value); 123 | 124 | // Sets parameters for Merge 125 | void __cdecl SetMergeParameters(float weight1, float weight2); 126 | 127 | // Sets parameters for BloomCombine 128 | void __cdecl SetBloomCombineParameters(float bloom, float base, float bloomSaturation, float baseSaturation); 129 | 130 | private: 131 | // Private implementation. 132 | class Impl; 133 | 134 | std::unique_ptr pImpl; 135 | }; 136 | 137 | 138 | //---------------------------------------------------------------------------------- 139 | // Tone-map post-process 140 | class ToneMapPostProcess : public IPostProcess 141 | { 142 | public: 143 | enum Operator // Tone-mapping operator 144 | { 145 | None, // Pass-through 146 | Saturate, // Clamp [0,1] 147 | Reinhard, // x/(1+x) 148 | ACESFilmic, 149 | Operator_Max 150 | }; 151 | 152 | enum TransferFunction // Electro-Optical Transfer Function (EOTF) 153 | { 154 | Linear, // Pass-through 155 | SRGB, // sRGB (Rec.709 and approximate sRGB display curve) 156 | ST2084, // HDR10 (Rec.2020 color primaries and ST.2084 display curve) 157 | TransferFunction_Max 158 | }; 159 | 160 | explicit ToneMapPostProcess(_In_ ID3D11Device* device); 161 | ToneMapPostProcess(ToneMapPostProcess&& moveFrom) throw(); 162 | ToneMapPostProcess& operator= (ToneMapPostProcess&& moveFrom) throw(); 163 | 164 | ToneMapPostProcess(ToneMapPostProcess const&) = delete; 165 | ToneMapPostProcess& operator= (ToneMapPostProcess const&) = delete; 166 | 167 | virtual ~ToneMapPostProcess(); 168 | 169 | // IPostProcess methods. 170 | void __cdecl Process(_In_ ID3D11DeviceContext* deviceContext, _In_opt_ std::function setCustomState = nullptr) override; 171 | 172 | // Shader control 173 | void __cdecl SetOperator(Operator op); 174 | 175 | void __cdecl SetTransferFunction(TransferFunction func); 176 | 177 | #if defined(_XBOX_ONE) && defined(_TITLE) 178 | // Uses Multiple Render Targets to generate both HDR10 and GameDVR SDR signals 179 | void __cdecl SetMRTOutput(bool value = true); 180 | #endif 181 | 182 | // Properties 183 | void __cdecl SetHDRSourceTexture(_In_opt_ ID3D11ShaderResourceView* value); 184 | 185 | // Sets exposure value for LDR tonemap operators 186 | void SetExposure(float exposureValue); 187 | 188 | // Sets ST.2084 parameter for how bright white should be in nits 189 | void SetST2084Parameter(float paperWhiteNits); 190 | 191 | private: 192 | // Private implementation. 193 | class Impl; 194 | 195 | std::unique_ptr pImpl; 196 | }; 197 | } 198 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # GCC-CL 2 | 3 | GCC-CL(**GCC** dataset **C**ollector and **L**abeler) is a tool for generating synethic crowd image datasets. It consists of two parts, collector and labeler. The former is used to generate crowd image information; the latter produce input and output file through those information for crowd count models. 4 | 5 | ## Demonstration 6 | 7 | [![GCC-CL video](https://github.com/gjy3035/GCC-CL/blob/gh-pages/images/video.jpg?raw=true)](https://youtu.be/Hvl7xWkIueo "GCC dataset Collector and Labeler") 8 | 9 | ## GCC-Collector 10 | 11 | GCC-Collector is a tool to generate crowd image and head points in GTA V. It is a custom plugin running along with GTAV, written in **C++**. 12 | 13 | **Attention!!!** All mods must be used in the offline version of GTA V. 14 | 15 | ### Request 16 | - [ScriptHookV](http://www.dev-c.com/gtav/scripthookv/) 17 | - [DirectXTK](https://github.com/Microsoft/DirectXTK) 18 | - [minhook](https://github.com/TsudaKageyu/minhook) 19 | - [eigen](http://eigen.tuxfamily.org/index.php?title=Main_Page) 20 | 21 | ### Compilation 22 | 23 | 1. Navigate to GCC-Collector directory, use Visual Studio to open the project `GCC-Collector.sln`. 24 | 2. Open the project (GCC-Collector) property pages, `General/Windos SDK Version`, select **the latest win10 SDK** existed in your computer. 25 | 3. Install `minhook` and `eigen` using **NuGet**. 26 | 4. Make sure Configution is **release**, Platform is **x64**, and then use hot key `ctrl + shift + B` to compile the project. As a result, asi file `GCC-Collector.asi` will be generated in */GCC-CL/GCC-Collector/x64/Release* 27 | 28 | ### Installation 29 | 30 | 1. Following [Script Hook V](http://www.dev-c.com/gtav/scripthookv/) installation steps, copy `ScriptHookV.dll`, `dinput8.dll` and compiled `GCC-Collector.asi` to the game's root folder (where GTA5.exe is located); 31 | 2. Use [this mod(No Chromatic aberration & Lens distortion)](https://www.gta5-mods.com/misc/no-chromatic-aberration-lens-distortion-1-41) to avoid chromatic aberration and lens distortion; 32 | 3. Compile or directly use the compiled plugin-in `unlimitedLife.asi`, `noVehicle.asi`. Just copy these two asi to the games's root folder. 33 | > - `unlimitedLife.asi` makes sure the player undead. 34 | > - `noVehicle.asi` is optional. When you are creating some crowd images in the street, this plugin-in helps you avoid accidents caused by vehicles entering the scene. And it also set the number of pedestrians created by game scenario close to zero. 35 | 36 | ### How to work 37 | 38 | To create a series of crowd images in one scene, You should follow the steps below: 39 | 1. download [GCC-COllector-Tool](https://github.com/gjy3035/GCC-CL/releases) and put `SceneDirectorAnim.txt` in the game's root folder. 40 | 2. Create a directory named `data` in the game's root folder. 41 | 3. Open GTA V in the **offline version**. 42 | 4. Control your role in GTAV go to the scene where you want use it as the background of the crowd images which would be generated. 43 | 5. Press `F9` to start a scene script; 44 | 6. Press `F10` to adjust the camera. use `W, A, S, D` to move the camera forward, left, backward and right, mouse button(left or right button both works) to move up or down, `shift/ctrl` to speed up or slow down, and `+/-` to adjust the field of view. When the camera has the desired angle, press `F10` again to stop adjust camera and record camera location information automatically. 45 | 7. Press `F11` to start drawing the crowd generation area. Use the method of connecting multiple points to form a polygon by moving your game character in the scene. Press `I` to set a polygon vertex at current position. Press `F11` again to end the drawing. The program automatically connects the points in a sequence set by the user. In the process of setting the vertices, you can press `Tab` to move the focus to a specific vertex, and then you can reset that point. During setting the vertices, you can press `F10` to enter the camera view to observe the vertices or modify the camera settings. Press `F10` again to return to set vertices. (Note that it will be better to set a convex polygon area, do not let the sides of the polygon cross.) Following the guide to readjust the camera, and other three cameras (from four different angle). 46 | 8. At last, you should confirm how many pedestrians you want to generate in the scene. Press `F12` and follow the guide in the game, you will know how to do it. 47 | 9. Now one scene has been created and saved, press `F5` to go back to original state, and do above steps(except step 1) again to recorded another scene. 48 | 49 | After a series of scene have been created. restart the game, after the opening animation 50 | 1. colse the minimap if it is shown in the lower left corner of screen, or generating segement maps do not work well, as [issue#7](https://github.com/gjy3035/GCC-CL/issues/7) demonstrated; 51 | 2. press `L` to launch the GCC-Collector to generate crowd with recorded.information 52 | 3. press 'F5' if you want to leave the process and go back to normal. The process would end after one-round of collecting.(Not immediately) 53 | 54 | ## GCC-Labeler 55 | 56 | GCC-Labeler is written in Python3. It needs the following Python libraries: 57 | - scipy 58 | - numpy 59 | - matplotlib 60 | - PIL 61 | 62 | You can install these libraries using `pip`. 63 | 64 | `main.py` is the entrance of the project. Line 22 and 23 define the source path and the target path. 65 | ``` python 66 | source_dir = 'source' 67 | target_dir = 'target' 68 | ``` 69 | Source path is the path where the file you generated using GCC-Collector is located. The target path is used to specify where to store the final produced image files and the annotation files. Change two paths according to your actual situation. Just run `python main.py`, the final crowd count images and labels will be generated in `target_dir`. 70 | 71 | For example, the source directory(the data folder we created in GCC-Collector) like this: 72 | ``` 73 | source/ 74 | `-- part_11_2 75 | |-- 1534540881 76 | | |-- part_0.raw 77 | | |-- part_0_0.bmp 78 | | |-- part_0_1.bmp 79 | | |-- part_180.raw 80 | | |-- part_180_0.bmp 81 | | |-- part_180_1.bmp 82 | | |-- part_360.raw 83 | | |-- part_360_0.bmp 84 | | |-- part_360_1.bmp 85 | | `-- pedInfo.xml 86 | |-- 1534575913 87 | | |-- part_0.raw 88 | | |-- part_0_0.bmp 89 | | |-- part_0_1.bmp 90 | | |-- part_180.raw 91 | | |-- part_180_0.bmp 92 | | |-- part_180_1.bmp 93 | | |-- part_360.raw 94 | | |-- part_360_0.bmp 95 | | |-- part_360_1.bmp 96 | | `-- pedInfo.xml 97 | |-- Zheight.log 98 | |-- areaInfo.log 99 | |-- eyeInfo.log 100 | `-- levelInfo.log 101 | 102 | 3 directories, 24 files 103 | ``` 104 | After we run the `main.py`, we can get the target directory like this: 105 | ``` 106 | target/ 107 | `-- scene_11_2 108 | |-- jpgs 109 | | |-- 1534540881.jpg 110 | | `-- 1534575913.jpg 111 | |-- jsons 112 | | |-- 1534540881.json 113 | | `-- 1534575913.json 114 | |-- mats 115 | | |-- 1534540881.mat 116 | | `-- 1534575913.mat 117 | |-- pngs 118 | | |-- 1534540881.png 119 | | `-- 1534575913.png 120 | |-- segs 121 | | |-- 1534540881.raw 122 | | `-- 1534575913.raw 123 | `-- vis 124 | |-- 1534540881.jpg 125 | `-- 1534575913.jpg 126 | 127 | 7 directories, 12 files 128 | ``` 129 | 130 | ## Acknowledgments 131 | 132 | Some code borrows from [gtav-mod-scene-director](https://github.com/elsewhat/gtav-mod-scene-director) and [GTAVisionExport](https://github.com/umautobots/GTAVisionExport). The former gave us so many examples for how to use these functions in Script Hook V. The latter inspired us to extract crowd mask. 133 | 134 | ## Citation 135 | 136 | If you find this project useful for your research, please cite: 137 | ``` 138 | @inproceedings{wang2019learning, 139 | title={Learning from Synthetic Data for Crowd Counting in the Wild}, 140 | author={Wang, Qi and Gao, Junyu and Lin, Wei and Yuan, Yuan}, 141 | booktitle={Proceedings of IEEE Conference on Computer Vision and Pattern Recognition (CVPR)}, 142 | pages={8198--8207}, 143 | year={2019} 144 | } 145 | ``` 146 | -------------------------------------------------------------------------------- /GCC-Collector/GCC-Collector/camera.cpp: -------------------------------------------------------------------------------- 1 | #include "camera.h" 2 | #include "script.h" 3 | #include "utils.h" 4 | #include "infoIO.h" 5 | #include "keyboard.h" 6 | #include "natives.h" 7 | #include 8 | 9 | int adjustCameraFinished = 0; 10 | bool CameraMode = false; 11 | 12 | static Any cameraHandle; 13 | 14 | void disableControls() { 15 | std::vector disabledControls = { 16 | 0,2,3,4,5,6,16,17,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,44,45,71,72,75,140,141,142,143,156,243,257,261,262,263,264,267,268,269,270,271,272,273 17 | }; 18 | 19 | for (auto & controlCode : disabledControls) { 20 | CONTROLS::DISABLE_CONTROL_ACTION(0, controlCode, 1); 21 | } 22 | } 23 | 24 | void startNewCamera() 25 | { 26 | //Find the location of our camera based on the current actor 27 | Ped actorPed = PLAYER::PLAYER_PED_ID(); 28 | Vector3 startLocation = ENTITY::GET_ENTITY_COORDS(actorPed, true); 29 | float startHeading = ENTITY::GET_ENTITY_HEADING(actorPed); 30 | log_to_file("heading : " + std::to_string(startHeading)); 31 | 32 | Vector3 camOffset; 33 | camOffset.x = (float)sin((startHeading *PI / 180.0f))*10.0f; 34 | camOffset.y = (float)cos((startHeading *PI / 180.0f))*10.0f; 35 | camOffset.z = 6.4; 36 | if (startLocation.x < 0) { 37 | camOffset.x = -camOffset.x; 38 | } 39 | if (startLocation.y < 0) { 40 | camOffset.y = -camOffset.y; 41 | } 42 | 43 | log_to_file("actor location (" + std::to_string(startLocation.x) + ", " + std::to_string(startLocation.y) + ", " + std::to_string(startLocation.z) + ")"); 44 | log_to_file("Camera offset (" + std::to_string(camOffset.x) + ", " + std::to_string(camOffset.y) + ", " + std::to_string(camOffset.z) + ")"); 45 | 46 | Vector3 camLocation = ENTITY::GET_OFFSET_FROM_ENTITY_IN_WORLD_COORDS(actorPed, camOffset.x, camOffset.y, camOffset.z); 47 | log_to_file("Camera location (" + std::to_string(camLocation.x) + ", " + std::to_string(camLocation.y) + ", " + std::to_string(camLocation.z) + ")"); 48 | cameraHandle = CAM::CREATE_CAM_WITH_PARAMS("DEFAULT_SCRIPTED_CAMERA", camLocation.x, camLocation.y, camLocation.z, 0.0, 0.0, 0.0, 40.0, 1, 2); 49 | 50 | CAM::POINT_CAM_AT_ENTITY(cameraHandle, actorPed, 0.0f, 0.0f, 0.0f, true); 51 | WAIT(100); 52 | CAM::STOP_CAM_POINTING(cameraHandle); 53 | 54 | CAM::RENDER_SCRIPT_CAMS(true, 1, 1800, 1, 0); 55 | WAIT(2000); 56 | 57 | CameraMode = true; 58 | } 59 | 60 | void adjustCamera() 61 | { 62 | disableControls(); 63 | 64 | // movement 65 | Vector3 camDelta = {}; 66 | float nfov = 0.0; 67 | bool isMovement = false; 68 | if (W.isKeyDown()) { 69 | camDelta.x = 1.0; 70 | isMovement = true; 71 | } 72 | if (S.isKeyDown()) { 73 | camDelta.x = -1.0; 74 | isMovement = true; 75 | } 76 | if (A.isKeyDown()) { 77 | camDelta.y = -1.0; 78 | isMovement = true; 79 | } 80 | if (D.isKeyDown()) { 81 | camDelta.y = 1.0; 82 | isMovement = true; 83 | } 84 | if (CONTROLS::IS_DISABLED_CONTROL_PRESSED(2, 329)) {//LMouseBtn 85 | camDelta.z = 0.3; 86 | isMovement = true; 87 | } 88 | if (CONTROLS::IS_DISABLED_CONTROL_PRESSED(2, 330)) {//RMouseBtn 89 | camDelta.z = -0.3; 90 | isMovement = true; 91 | } 92 | if (oemPlus.isKeyDown()) { 93 | nfov = 1.0; 94 | isMovement = true; 95 | } 96 | if (oemMinus.isKeyDown()) { 97 | nfov = -1.0; 98 | isMovement = true; 99 | } 100 | if (isMovement) { 101 | if (shift.isKeyDown()) { 102 | camDelta.x *= 3; 103 | camDelta.y *= 3; 104 | camDelta.z *= 3; 105 | nfov *= 3; 106 | } 107 | else if (ctrl.isKeyDown()) { 108 | camDelta.x /= 20; 109 | camDelta.y /= 20; 110 | camDelta.z /= 20; 111 | nfov /= 20; 112 | } 113 | 114 | Vector3 camNewPos = CAM::GET_CAM_COORD(cameraHandle); 115 | float fov = CAM::GET_CAM_FOV(cameraHandle); 116 | /*camLastPos.x = camNewPos.x; 117 | camLastPos.y = camNewPos.y; 118 | camLastPos.z = camNewPos.z;*/ 119 | 120 | Vector3 camRot = {}; 121 | camRot = CAM::GET_CAM_ROT(cameraHandle, 2); 122 | //camera rotation is not as expected. .x value is rotation in the z-plane (view up/down) and third paramter is the rotation in the x,y plane. 123 | 124 | Vector3 direction = {}; 125 | direction = MathUtils::rotationToDirection(camRot); 126 | 127 | //forward motion 128 | if (camDelta.x != 0.0) { 129 | camNewPos.x += direction.x * camDelta.x * cameraSpeedFactor; 130 | camNewPos.y += direction.y * camDelta.x * cameraSpeedFactor; 131 | camNewPos.z += direction.z * camDelta.x * cameraSpeedFactor; 132 | } 133 | 134 | //sideways motion 135 | if (camDelta.y != 0.0) { 136 | //straight up 137 | Vector3 b = {}; 138 | b.z = 1.0; 139 | 140 | Vector3 sideWays = {}; 141 | sideWays = MathUtils::crossProduct(direction, b); 142 | 143 | camNewPos.x += sideWays.x * camDelta.y * cameraSpeedFactor; 144 | camNewPos.y += sideWays.y * camDelta.y * cameraSpeedFactor; 145 | } 146 | 147 | //up/down 148 | if (camDelta.z != 0.0) { 149 | camNewPos.z += camDelta.z * cameraSpeedFactor; 150 | } 151 | 152 | if (nfov != 0.0) { 153 | fov += nfov; 154 | } 155 | 156 | CAM::SET_CAM_COORD(cameraHandle, camNewPos.x, camNewPos.y, camNewPos.z); 157 | CAM::SET_CAM_FOV(cameraHandle, fov); 158 | } 159 | 160 | // rotation 161 | float rightAxisX = CONTROLS::GET_DISABLED_CONTROL_NORMAL(0, 220); 162 | float rightAxisY = CONTROLS::GET_DISABLED_CONTROL_NORMAL(0, 221); 163 | 164 | if (rightAxisX != 0.0 || rightAxisY != 0.0) { 165 | //Rotate camera - Multiply by sensitivity settings 166 | Vector3 currentRotation = CAM::GET_CAM_ROT(cameraHandle, 2); 167 | currentRotation.x += rightAxisY * -5.0f; 168 | currentRotation.z += rightAxisX * -10.0f; 169 | CAM::SET_CAM_ROT(cameraHandle, currentRotation.x, currentRotation.y, currentRotation.z, 2); 170 | } 171 | } 172 | 173 | void StopCamera(int foldNo) 174 | { 175 | // write info into file 176 | Vector3 loc = CAM::GET_CAM_COORD(cameraHandle); 177 | Vector3 rot = CAM::GET_CAM_ROT(cameraHandle, 2); 178 | float fov = CAM::GET_CAM_FOV(cameraHandle); 179 | writeCamInfo(loc, rot, fov, foldNo); 180 | 181 | CAM::RENDER_SCRIPT_CAMS(false, 1, 1500, 1, 0); 182 | CameraMode = false; 183 | WAIT(1000); 184 | } 185 | 186 | static bool show = false; 187 | 188 | bool showCamera() 189 | { 190 | if (F10.isKeyDown()) { 191 | if (!show) { 192 | Vector3 loc, rot; 193 | float fov; 194 | readCamInfo(loc, rot, fov); 195 | log_to_file("get eye info done."); 196 | log_to_file(std::to_string(loc.x) + " " + std::to_string(loc.y) + " " + std::to_string(loc.z)); 197 | log_to_file(std::to_string(rot.x) + " " + std::to_string(rot.y) + " " + std::to_string(rot.z)); 198 | log_to_file(std::to_string(fov)); 199 | cameraHandle = CAM::CREATE_CAM_WITH_PARAMS("DEFAULT_SCRIPTED_CAMERA", loc.x, loc.y, loc.z, rot.x, rot.y, rot.z, fov, 1, 2); 200 | WAIT(100); 201 | CAM::STOP_CAM_POINTING(cameraHandle); 202 | CAM::RENDER_SCRIPT_CAMS(true, 1, 2000, 1, 0); 203 | log_to_file("finished keep camera..."); 204 | } 205 | else { 206 | CAM::RENDER_SCRIPT_CAMS(false, 1, 2000, 1, 0); 207 | } 208 | show = !show; 209 | return true; 210 | } 211 | else { 212 | return false; 213 | } 214 | } 215 | 216 | void showCamera(float &camX, float &camY) 217 | { 218 | Vector3 loc, rot; 219 | float fov; 220 | readCamInfo(loc, rot, fov); 221 | cameraHandle = CAM::CREATE_CAM_WITH_PARAMS("DEFAULT_SCRIPTED_CAMERA", loc.x, loc.y, loc.z, rot.x, rot.y, rot.z, fov, 1, 2); 222 | WAIT(100); 223 | CAM::STOP_CAM_POINTING(cameraHandle); 224 | CAM::RENDER_SCRIPT_CAMS(true, 1, 2000, 1, 0); 225 | camX = loc.x, camY = loc.y; 226 | WAIT(2000); 227 | log_to_file("finished keep camera..."); 228 | } 229 | 230 | void show2False() 231 | { 232 | show = false; 233 | } 234 | 235 | void getCameraLoc(float &camX, float &camY) 236 | { 237 | Vector3 loc, rot; 238 | float fov; 239 | readCamInfo(loc, rot, fov); 240 | camX = loc.x, camY = loc.y; 241 | } 242 | 243 | void getCameraLoc(float &camX, float &camY, float &camZ) 244 | { 245 | Vector3 loc, rot; 246 | float fov; 247 | readCamInfo(loc, rot, fov); 248 | camX = loc.x, camY = loc.y, camZ = loc.z; 249 | } 250 | 251 | void showCamera4(int No) 252 | { 253 | Vector3 loc, rot; 254 | float fov; 255 | changeFoldNo(No); 256 | readCamInfo(loc, rot, fov); 257 | log_to_file("get eye info done."); 258 | log_to_file(std::to_string(loc.x) + " " + std::to_string(loc.y) + " " + std::to_string(loc.z)); 259 | log_to_file(std::to_string(rot.x) + " " + std::to_string(rot.y) + " " + std::to_string(rot.z)); 260 | log_to_file(std::to_string(fov)); 261 | cameraHandle = CAM::CREATE_CAM_WITH_PARAMS("DEFAULT_SCRIPTED_CAMERA", loc.x, loc.y, loc.z, rot.x, rot.y, rot.z, fov, 1, 2); 262 | WAIT(100); 263 | CAM::STOP_CAM_POINTING(cameraHandle); 264 | CAM::RENDER_SCRIPT_CAMS(true, 1, 2000, 1, 0); 265 | log_to_file("finished keep camera..."); 266 | CameraMode = true; 267 | } 268 | 269 | bool saveCamera4(int No) 270 | { 271 | if (F11.isKeyDown()) { 272 | CameraMode = false; 273 | Vector3 loc = CAM::GET_CAM_COORD(cameraHandle); 274 | Vector3 rot = CAM::GET_CAM_ROT(cameraHandle, 2); 275 | float fov = CAM::GET_CAM_FOV(cameraHandle); 276 | writeCamInfo(loc, rot, fov, No); 277 | adjustCameraFinished++; 278 | return true; 279 | } 280 | return false; 281 | } 282 | 283 | void gobackcamera() 284 | { 285 | CAM::RENDER_SCRIPT_CAMS(false, 1, 2000, 1, 0); 286 | WAIT(2000); 287 | } 288 | -------------------------------------------------------------------------------- /GCC-Collector/deps/DirectXTKInc/GamePad.h: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------------------------- 2 | // File: GamePad.h 3 | // 4 | // Copyright (c) Microsoft Corporation. All rights reserved. 5 | // Licensed under the MIT License. 6 | // 7 | // http://go.microsoft.com/fwlink/?LinkId=248929 8 | // http://go.microsoft.com/fwlink/?LinkID=615561 9 | //-------------------------------------------------------------------------------------- 10 | 11 | #pragma once 12 | 13 | #if (_WIN32_WINNT < 0x0A00 /*_WIN32_WINNT_WIN10*/) 14 | #ifndef _XBOX_ONE 15 | #if !defined(WINAPI_FAMILY) || (WINAPI_FAMILY != WINAPI_FAMILY_PHONE_APP) 16 | #if (_WIN32_WINNT >= 0x0602 /*_WIN32_WINNT_WIN8*/ ) 17 | #pragma comment(lib,"xinput.lib") 18 | #else 19 | #pragma comment(lib,"xinput9_1_0.lib") 20 | #endif 21 | #endif 22 | #endif 23 | #endif 24 | 25 | #include 26 | #include 27 | 28 | #if (_WIN32_WINNT >= _WIN32_WINNT_WIN10) 29 | #include 30 | #endif 31 | 32 | 33 | namespace DirectX 34 | { 35 | class GamePad 36 | { 37 | public: 38 | GamePad(); 39 | GamePad(GamePad&& moveFrom) throw(); 40 | GamePad& operator= (GamePad&& moveFrom) throw(); 41 | 42 | GamePad(GamePad const&) = delete; 43 | GamePad& operator=(GamePad const&) = delete; 44 | 45 | virtual ~GamePad(); 46 | 47 | #if (_WIN32_WINNT >= 0x0A00 /*_WIN32_WINNT_WIN10*/ ) || defined(_XBOX_ONE) 48 | static const int MAX_PLAYER_COUNT = 8; 49 | #else 50 | static const int MAX_PLAYER_COUNT = 4; 51 | #endif 52 | 53 | enum DeadZone 54 | { 55 | DEAD_ZONE_INDEPENDENT_AXES = 0, 56 | DEAD_ZONE_CIRCULAR, 57 | DEAD_ZONE_NONE, 58 | }; 59 | 60 | struct Buttons 61 | { 62 | bool a; 63 | bool b; 64 | bool x; 65 | bool y; 66 | bool leftStick; 67 | bool rightStick; 68 | bool leftShoulder; 69 | bool rightShoulder; 70 | union 71 | { 72 | bool back; 73 | bool view; 74 | }; 75 | union 76 | { 77 | bool start; 78 | bool menu; 79 | }; 80 | }; 81 | 82 | struct DPad 83 | { 84 | bool up; 85 | bool down; 86 | bool right; 87 | bool left; 88 | }; 89 | 90 | struct ThumbSticks 91 | { 92 | float leftX; 93 | float leftY; 94 | float rightX; 95 | float rightY; 96 | }; 97 | 98 | struct Triggers 99 | { 100 | float left; 101 | float right; 102 | }; 103 | 104 | struct State 105 | { 106 | bool connected; 107 | uint64_t packet; 108 | Buttons buttons; 109 | DPad dpad; 110 | ThumbSticks thumbSticks; 111 | Triggers triggers; 112 | 113 | bool __cdecl IsConnected() const { return connected; } 114 | 115 | // Is the button pressed currently? 116 | bool __cdecl IsAPressed() const { return buttons.a; } 117 | bool __cdecl IsBPressed() const { return buttons.b; } 118 | bool __cdecl IsXPressed() const { return buttons.x; } 119 | bool __cdecl IsYPressed() const { return buttons.y; } 120 | 121 | bool __cdecl IsLeftStickPressed() const { return buttons.leftStick; } 122 | bool __cdecl IsRightStickPressed() const { return buttons.rightStick; } 123 | 124 | bool __cdecl IsLeftShoulderPressed() const { return buttons.leftShoulder; } 125 | bool __cdecl IsRightShoulderPressed() const { return buttons.rightShoulder; } 126 | 127 | bool __cdecl IsBackPressed() const { return buttons.back; } 128 | bool __cdecl IsViewPressed() const { return buttons.view; } 129 | bool __cdecl IsStartPressed() const { return buttons.start; } 130 | bool __cdecl IsMenuPressed() const { return buttons.menu; } 131 | 132 | bool __cdecl IsDPadDownPressed() const { return dpad.down; }; 133 | bool __cdecl IsDPadUpPressed() const { return dpad.up; }; 134 | bool __cdecl IsDPadLeftPressed() const { return dpad.left; }; 135 | bool __cdecl IsDPadRightPressed() const { return dpad.right; }; 136 | 137 | bool __cdecl IsLeftThumbStickUp() const { return (thumbSticks.leftY > 0.5f) != 0; } 138 | bool __cdecl IsLeftThumbStickDown() const { return (thumbSticks.leftY < -0.5f) != 0; } 139 | bool __cdecl IsLeftThumbStickLeft() const { return (thumbSticks.leftX < -0.5f) != 0; } 140 | bool __cdecl IsLeftThumbStickRight() const { return (thumbSticks.leftX > 0.5f) != 0; } 141 | 142 | bool __cdecl IsRightThumbStickUp() const { return (thumbSticks.rightY > 0.5f) != 0; } 143 | bool __cdecl IsRightThumbStickDown() const { return (thumbSticks.rightY < -0.5f) != 0; } 144 | bool __cdecl IsRightThumbStickLeft() const { return (thumbSticks.rightX < -0.5f) != 0; } 145 | bool __cdecl IsRightThumbStickRight() const { return (thumbSticks.rightX > 0.5f) != 0; } 146 | 147 | bool __cdecl IsLeftTriggerPressed() const { return (triggers.left > 0.5f) != 0; } 148 | bool __cdecl IsRightTriggerPressed() const { return (triggers.right > 0.5f) != 0; } 149 | }; 150 | 151 | struct Capabilities 152 | { 153 | enum Type 154 | { 155 | UNKNOWN = 0, 156 | GAMEPAD, 157 | WHEEL, 158 | ARCADE_STICK, 159 | FLIGHT_STICK, 160 | DANCE_PAD, 161 | GUITAR, 162 | GUITAR_ALTERNATE, 163 | DRUM_KIT, 164 | GUITAR_BASS = 11, 165 | ARCADE_PAD = 19, 166 | }; 167 | 168 | bool connected; 169 | Type gamepadType; 170 | #if (_WIN32_WINNT >= 0x0A00 /*_WIN32_WINNT_WIN10*/) 171 | std::wstring id; 172 | #else 173 | uint64_t id; 174 | #endif 175 | 176 | bool __cdecl IsConnected() const { return connected; } 177 | }; 178 | 179 | class ButtonStateTracker 180 | { 181 | public: 182 | enum ButtonState 183 | { 184 | UP = 0, // Button is up 185 | HELD = 1, // Button is held down 186 | RELEASED = 2, // Button was just released 187 | PRESSED = 3, // Buton was just pressed 188 | }; 189 | 190 | ButtonState a; 191 | ButtonState b; 192 | ButtonState x; 193 | ButtonState y; 194 | 195 | ButtonState leftStick; 196 | ButtonState rightStick; 197 | 198 | ButtonState leftShoulder; 199 | ButtonState rightShoulder; 200 | 201 | union 202 | { 203 | ButtonState back; 204 | ButtonState view; 205 | }; 206 | 207 | union 208 | { 209 | ButtonState start; 210 | ButtonState menu; 211 | }; 212 | 213 | ButtonState dpadUp; 214 | ButtonState dpadDown; 215 | ButtonState dpadLeft; 216 | ButtonState dpadRight; 217 | 218 | ButtonState leftStickUp; 219 | ButtonState leftStickDown; 220 | ButtonState leftStickLeft; 221 | ButtonState leftStickRight; 222 | 223 | ButtonState rightStickUp; 224 | ButtonState rightStickDown; 225 | ButtonState rightStickLeft; 226 | ButtonState rightStickRight; 227 | 228 | ButtonState leftTrigger; 229 | ButtonState rightTrigger; 230 | 231 | ButtonStateTracker() throw() { Reset(); } 232 | 233 | void __cdecl Update(const State& state); 234 | 235 | void __cdecl Reset(); 236 | 237 | State __cdecl GetLastState() const { return lastState; } 238 | 239 | private: 240 | State lastState; 241 | }; 242 | 243 | // Retrieve the current state of the gamepad of the associated player index 244 | State __cdecl GetState(int player, DeadZone deadZoneMode = DEAD_ZONE_INDEPENDENT_AXES); 245 | 246 | // Retrieve the current capabilities of the gamepad of the associated player index 247 | Capabilities __cdecl GetCapabilities(int player); 248 | 249 | // Set the vibration motor speeds of the gamepad 250 | bool __cdecl SetVibration(int player, float leftMotor, float rightMotor, float leftTrigger = 0.f, float rightTrigger = 0.f); 251 | 252 | // Handle suspending/resuming 253 | void __cdecl Suspend(); 254 | void __cdecl Resume(); 255 | 256 | #if (_WIN32_WINNT >= 0x0A00 /*_WIN32_WINNT_WIN10*/ ) || defined(_XBOX_ONE) 257 | void __cdecl RegisterEvents(void* ctrlChanged, void* userChanged); 258 | #endif 259 | 260 | // Singleton 261 | static GamePad& __cdecl Get(); 262 | 263 | private: 264 | // Private implementation. 265 | class Impl; 266 | 267 | std::unique_ptr pImpl; 268 | }; 269 | } 270 | -------------------------------------------------------------------------------- /GCC-Collector/GCC-Collector/GCC-Collector.vcxproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | Debug 14 | x64 15 | 16 | 17 | Release 18 | x64 19 | 20 | 21 | 22 | 15.0 23 | {AC023A72-4938-4FE3-9BFC-57CEADFD6ACC} 24 | GCCCollector 25 | 10.0.17763.0 26 | 27 | 28 | 29 | DynamicLibrary 30 | true 31 | v141 32 | Unicode 33 | 34 | 35 | DynamicLibrary 36 | false 37 | v141 38 | true 39 | Unicode 40 | 41 | 42 | DynamicLibrary 43 | true 44 | v141 45 | Unicode 46 | 47 | 48 | DynamicLibrary 49 | false 50 | v141 51 | true 52 | MultiByte 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | .asi 74 | 75 | 76 | .asi 77 | 78 | 79 | .asi 80 | 81 | 82 | .asi 83 | 84 | 85 | 86 | Level3 87 | Disabled 88 | true 89 | true 90 | .\deps\DirectXTKInc;%(AdditionalIncludeDirectories) 91 | 92 | 93 | .\deps\lib\DirectXTK.lib;.\deps\lib\ScriptHookV.lib;%(AdditionalDependencies) 94 | 95 | 96 | 97 | 98 | Level3 99 | Disabled 100 | true 101 | true 102 | .\deps\DirectXTKInc;%(AdditionalIncludeDirectories) 103 | 104 | 105 | .\deps\lib\DirectXTK.lib;.\deps\lib\ScriptHookV.lib;%(AdditionalDependencies) 106 | 107 | 108 | 109 | 110 | Level3 111 | MaxSpeed 112 | true 113 | true 114 | true 115 | true 116 | .\deps\DirectXTKInc;%(AdditionalIncludeDirectories) 117 | 118 | 119 | true 120 | true 121 | .\deps\lib\DirectXTK.lib;.\deps\lib\ScriptHookV.lib;%(AdditionalDependencies) 122 | 123 | 124 | 125 | 126 | TurnOffAllWarnings 127 | MaxSpeed 128 | true 129 | true 130 | true 131 | false 132 | ..\deps\DirectXTKInc;..\deps\ScriptHookVInc;%(AdditionalIncludeDirectories) 133 | false 134 | _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) 135 | 136 | 137 | true 138 | true 139 | ..\deps\lib\DirectXTK.lib;..\deps\lib\ScriptHookV.lib;%(AdditionalDependencies) 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. 178 | 179 | 180 | 181 | 182 | -------------------------------------------------------------------------------- /GCC-Collector/GCC-Collector/infoIO.cpp: -------------------------------------------------------------------------------- 1 | #include "types.h" 2 | #include "infoIO.h" 3 | #include "camera.h" 4 | #include "setLevel.h" 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | 13 | void set_status_text(std::string text) 14 | { 15 | UI::_SET_NOTIFICATION_TEXT_ENTRY("STRING"); 16 | UI::_ADD_TEXT_COMPONENT_STRING((LPSTR)text.c_str()); 17 | UI::_DRAW_NOTIFICATION(1, 1); 18 | } 19 | 20 | void log_to_pedTxt(std::string message, char *fileName) { 21 | std::ofstream logfile(fileName, std::ios_base::app); 22 | logfile << message + "\n"; 23 | logfile.close(); 24 | } 25 | 26 | void log_to_file(std::string msg) 27 | { 28 | char *logfile = "GCC-CL.log"; 29 | std::chrono::milliseconds ms = std::chrono::duration_cast< std::chrono::milliseconds >( 30 | std::chrono::system_clock::now().time_since_epoch() 31 | ); 32 | char sec[20]; 33 | sprintf(sec, "[%I64d] : ", ms); 34 | msg = std::string(sec) + msg; 35 | log_to_pedTxt(msg, logfile); 36 | } 37 | 38 | bool initDataDir() 39 | { 40 | LPCSTR dataroot = "data"; 41 | return GetFileAttributesA(dataroot) == dirMark || CreateDirectory(dataroot, NULL); 42 | } 43 | 44 | char nowFold[fileLength] = "data\\"; 45 | char nowFolds[4][fileLength] = { "data\\", "data\\", "data\\", "data\\" }; 46 | 47 | std::vector parts, subParts, imageNums; 48 | bool InitPartNo() 49 | { 50 | parts.clear(); subParts.clear(); imageNums.clear(); 51 | 52 | std::string root_dir = ".\\data\\", subFold; 53 | for (auto & p : std::experimental::filesystem::v1::directory_iterator(root_dir)) { 54 | std::stringstream conv; 55 | conv << p; conv >> subFold; 56 | int st = subFold.find("part_"); 57 | if (st != -1) { 58 | st += 5; 59 | int foldLen = subFold.length(); 60 | int subLen = foldLen - 2 - st; 61 | if (subFold.find("_", st + 5) == -1) subLen += 2; 62 | 63 | parts.push_back(std::stoi(subFold.substr(st, subLen))); 64 | subParts.push_back(std::stoi(subFold.substr(subFold.length() - 1))); 65 | std::string imgFold; 66 | int thisImgNum = 0; 67 | log_to_file("subFold = " + subFold); 68 | for (auto & subP : std::experimental::filesystem::v1::directory_iterator(subFold)) { 69 | std::stringstream subconv; 70 | subconv << subP; subconv >> imgFold; 71 | log_to_file(imgFold); 72 | if(GetFileAttributesA(imgFold.c_str()) == dirMark) thisImgNum ++; 73 | } 74 | imageNums.push_back(thisImgNum); 75 | log_to_file(subFold.substr(st, subLen) + " " + subFold.substr(subFold.length() - 1) + " " + std::to_string(thisImgNum)); 76 | } 77 | } 78 | return true; 79 | } 80 | 81 | int workId = -1; 82 | int defaultFold() 83 | { 84 | int imgNum = readImgNum(), sceneNum = parts.size(); 85 | if(workId == -1) { 86 | for(workId = 0; workId < sceneNum; workId++) { 87 | if(imageNums[workId] < imgNum) break; 88 | } 89 | if(workId >= sceneNum) return -1; 90 | } 91 | 92 | std::string foldName = "part_" + std::to_string(parts[workId]) + "_" + std::to_string(subParts[workId]); 93 | strcpy(nowFold, "data\\"); 94 | strcat(nowFold, foldName.c_str()); 95 | log_to_file("deault fold is " + std::string(foldName)); 96 | return imageNums[workId]; 97 | } 98 | 99 | void markAddOneImage() { 100 | int thisImgNum = ++ imageNums[workId]; 101 | if(readImgNum() == thisImgNum) workId = -1; 102 | } 103 | 104 | void createNewFold() 105 | { 106 | std::string root_dir = ".\\data\\", subFold; 107 | bool exist[partLength] = {false}; 108 | for (auto & p : std::experimental::filesystem::v1::directory_iterator(root_dir)) { 109 | std::stringstream conv; 110 | conv << p; conv >> subFold; 111 | int st = subFold.find("part_"); 112 | if (st != -1) { 113 | st += 5; 114 | 115 | int subLen = subFold.length() - 2 - st; 116 | if (subFold.find("_", st + 5) == -1) subLen += 2; 117 | int foldNo = std::stoi(subFold.substr(st, subLen)); 118 | exist[foldNo] = true; 119 | } 120 | } 121 | 122 | auto createFoldExe = [](int part) { 123 | for (int subpart = 0; subpart < 4; subpart++) { 124 | strcpy(nowFolds[subpart], "data\\"); 125 | strcat(nowFolds[subpart], ("part_" + std::to_string(part)).c_str()); 126 | strcat(nowFolds[subpart], ("_" + std::to_string(subpart)).c_str()); 127 | CreateDirectory(nowFolds[subpart], NULL); 128 | log_to_file("create new fold = " + std::string(nowFold)); 129 | } 130 | }; 131 | 132 | for (int i = partLength - 1; i > 0; i--) { 133 | if (exist[i]) { 134 | i = i + 1; 135 | createFoldExe(i); 136 | strcpy(nowFold, nowFolds[0]); 137 | return; 138 | } 139 | } 140 | createFoldExe(1); 141 | } 142 | 143 | void changeFoldNo(int No) 144 | { 145 | strcpy(nowFold, nowFolds[No]); 146 | } 147 | 148 | void foldCat(char *subString, char *useFold) 149 | { 150 | char newString[fileLength] = "\\"; 151 | strcat(newString, subString); 152 | strcpy(subString, useFold); 153 | strcat(subString, newString); 154 | } 155 | 156 | void foldCat(char *subString) 157 | { 158 | foldCat(subString, nowFold); 159 | } 160 | 161 | void foldCat(WCHAR *substring, char *useFold) 162 | { 163 | WCHAR newString[fileLength]; 164 | swprintf(newString, fileLength, L"%hs\\", useFold); 165 | wcscat(newString, substring); 166 | wcscpy(substring, newString); 167 | } 168 | 169 | void foldCat(WCHAR *substring) 170 | { 171 | foldCat(substring, nowFold); 172 | } 173 | 174 | void writeCamInfo(const Vector3 &loc, const Vector3 &rot, const float &fov, int foldNo) 175 | { 176 | char eyeInfoFile[fileLength] = "eyeInfo.log"; 177 | foldCat(eyeInfoFile, nowFolds[foldNo]); 178 | std::ofstream info(eyeInfoFile); 179 | info << loc.x << " " << loc.y << " " << loc.z << std::endl; 180 | info << rot.x << " " << rot.y << " " << rot.z << std::endl; 181 | info << fov; 182 | info.close(); 183 | } 184 | 185 | void writeCamInfo(const Vector3 &loc, const Vector3 &rot, const float &fov) 186 | { 187 | writeCamInfo(loc, rot, fov, 0); 188 | } 189 | 190 | void wriet4Camera() 191 | { 192 | char cpNowFold[fileLength]; 193 | strcpy(cpNowFold, nowFold); 194 | strcpy(nowFold, nowFolds[0]); 195 | Vector3 loc, rot; float fov; 196 | readCamInfo(loc, rot, fov); 197 | 198 | float mix, mxx, miy, mxy; 199 | readAreaBorder(mix, mxx, miy, mxy); 200 | float cx = (mxx + mix) / 2; 201 | float cy = (mxy + miy) / 2; 202 | log_to_file(std::to_string(cx) + " " + std::to_string(cy)); 203 | 204 | for (int i = 0; i < 4; i++) { 205 | writeCamInfo(loc, rot, fov, i); 206 | 207 | float nx = -(loc.y - cy) + cx; 208 | float ny = cy + loc.x - cx; 209 | loc.x = nx, loc.y = ny; 210 | 211 | float &r = rot.z; 212 | r += 90; 213 | if (r > 180) r - 180 - 180; 214 | } 215 | strcpy(nowFold, cpNowFold); 216 | } 217 | 218 | void readCamInfo(float &locx, float &locy, float &locz, float rotx, float &roty, float &rotz, float &fov) 219 | { 220 | char eyeInfoFile[fileLength] = "eyeInfo.log"; 221 | foldCat(eyeInfoFile); 222 | std::ifstream camInput(eyeInfoFile); 223 | camInput >> locx >> locy >> locz; 224 | camInput >> rotx >> roty >> rotz; 225 | camInput >> fov; 226 | camInput.close(); 227 | } 228 | 229 | 230 | void readCamInfo(Vector3 &loc, Vector3 &rot, float &fov) 231 | { 232 | char eyeInfoFile[fileLength] = "eyeInfo.log"; 233 | foldCat(eyeInfoFile); 234 | log_to_file(eyeInfoFile); 235 | std::ifstream camInput(eyeInfoFile); 236 | camInput >> loc.x >> loc.y >> loc.z; 237 | camInput >> rot.x >> rot.y >> rot.z; 238 | camInput >> fov; 239 | camInput.close(); 240 | } 241 | 242 | void writeAreaInfo(const int &n) 243 | { 244 | for (int i = 0; i < 4; i++) { 245 | char areaInfoFile[fileLength] = "areaInfo.log"; 246 | foldCat(areaInfoFile, nowFolds[i]); 247 | log_to_file(areaInfoFile); 248 | std::ofstream info(areaInfoFile); 249 | info << n << std::endl; 250 | info.close(); 251 | } 252 | } 253 | 254 | void writeAreaInfo(const Vector3 &loc) 255 | { 256 | for (int i = 0; i < 4; i++) { 257 | char areaInfoFile[fileLength] = "areaInfo.log"; 258 | foldCat(areaInfoFile, nowFolds[i]); 259 | std::ofstream info(areaInfoFile, std::ios_base::app); 260 | info << loc.x << ' ' << loc.y << std::endl; 261 | info.close(); 262 | } 263 | } 264 | 265 | void writeZheight(float z) 266 | { 267 | for (int i = 0; i < 4; i++) { 268 | char areaInfoFile[fileLength] = "Zheight.log"; 269 | foldCat(areaInfoFile, nowFolds[i]); 270 | std::ofstream info(areaInfoFile); 271 | info << z << std::endl; 272 | info.close(); 273 | } 274 | } 275 | 276 | 277 | void readAreaInfo(int &n, std::vector &pedLocations) 278 | { 279 | char areaInfoFile[fileLength] = "areaInfo.log"; 280 | foldCat(areaInfoFile); 281 | std::ifstream info(areaInfoFile); 282 | pedLocation po; 283 | info >> n; 284 | for (int i = 0; i < n; i++) { 285 | info >> po.x >> po.y; 286 | pedLocations.push_back(po); 287 | } 288 | info.close(); 289 | } 290 | 291 | float readZheight() 292 | { 293 | float z; 294 | char areaInfoFile[fileLength] = "Zheight.log"; 295 | foldCat(areaInfoFile); 296 | std::ifstream info(areaInfoFile); 297 | info >> z; 298 | info.close(); 299 | 300 | return z; 301 | } 302 | 303 | void readAreaBorder(float &mix, float &mxx, float &miy, float &mxy) 304 | { 305 | char areaInfoFile[fileLength] = "areaInfo.log"; 306 | foldCat(areaInfoFile); 307 | log_to_file(areaInfoFile); 308 | std::ifstream circle(areaInfoFile); 309 | int n; float x, y; 310 | bool first = true; 311 | while (circle >> n) { 312 | while (n--) { 313 | circle >> x >> y; 314 | if (first) { 315 | mix = mxx = x, miy = mxy = y; 316 | first = false; 317 | } 318 | else { 319 | mix = min(x, mix), mxx = max(x, mxx); 320 | miy = min(y, miy), mxy = max(y, mxy); 321 | } 322 | } 323 | } 324 | circle.close(); 325 | } 326 | 327 | bool fileExist(char *path) 328 | { 329 | FILE* fh = fopen(path, "r"); 330 | return fh != NULL; 331 | } 332 | 333 | bool fileExist(WCHAR *path) 334 | { 335 | char cpath[fileLength]; 336 | sprintf(cpath, "%ws", path); 337 | return fileExist(cpath); 338 | } 339 | 340 | void writeLeveFile(int level) 341 | { 342 | for (int i = 0; i < 4; i++) { 343 | char levelFile[fileLength] = "levelInfo.log"; 344 | foldCat(levelFile, nowFolds[i]); 345 | std::ofstream levelInfo(levelFile); 346 | levelInfo << level; 347 | levelInfo.close(); 348 | } 349 | } 350 | 351 | int readLevelFile() 352 | { 353 | char levelfile[fileLength] = "levelInfo.log"; 354 | foldCat(levelfile); 355 | std::ifstream info(levelfile); 356 | int levNo; 357 | info >> levNo; 358 | info.close(); 359 | return level[levNo].maxNum; 360 | } 361 | 362 | int readImgNum() 363 | { 364 | int imgNum = 5; 365 | char* imgNumFile = "imageNum.txt"; 366 | if(fileExist(imgNumFile)) { 367 | std::ifstream imgf(imgNumFile); 368 | imgf >> imgNum; 369 | imgf.close(); 370 | } 371 | return imgNum; 372 | } 373 | -------------------------------------------------------------------------------- /GCC-Collector/GCC-Collector/export.cpp: -------------------------------------------------------------------------------- 1 | #include "export.h" 2 | #include "nativeCaller.h" 3 | #include "natives.h" 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | 21 | using Microsoft::WRL::ComPtr; 22 | using std::unique_ptr; 23 | using std::vector; 24 | using std::mutex; 25 | using std::condition_variable; 26 | using std::unique_lock; 27 | using std::swap; 28 | using Eigen::Matrix4f; 29 | using std::chrono::high_resolution_clock; 30 | using std::chrono::time_point; 31 | using std::chrono::duration; 32 | using std::chrono::duration_cast; 33 | using std::chrono::milliseconds; 34 | static ComPtr lastDev; 35 | static ComPtr lastCtx; 36 | static ComPtr depthRes; 37 | static ComPtr colorRes; 38 | static ComPtr constantBuf; 39 | static ComPtr backBuf; 40 | static vector depthBuf; 41 | static vector colorBuf; 42 | static vector stencilBuf; 43 | static rage_matrices constants; 44 | static bool request_copy = false; 45 | static mutex copy_mtx; 46 | static condition_variable copy_cv; 47 | static HRESULT screenHr; 48 | static time_point last_depth_time; 49 | static time_point last_color_time; 50 | static time_point last_constant_time; 51 | static time_point last_screen_time; 52 | static std::chrono::milliseconds capScreen; 53 | 54 | void writeLog(std::string msg) 55 | { 56 | std::chrono::milliseconds ms = std::chrono::duration_cast< std::chrono::milliseconds >( 57 | std::chrono::system_clock::now().time_since_epoch() 58 | ); 59 | std::ofstream log("export.log", std::ios_base::app); 60 | log << ms.count() << " : " << msg << std::endl; 61 | log.close(); 62 | 63 | } 64 | 65 | static void unpack_depth(ID3D11Device* dev, ID3D11DeviceContext* ctx, ID3D11Resource* src, vector& dst, vector& stencil) 66 | { 67 | HRESULT hr = S_OK; 68 | 69 | ComPtr src_tex; 70 | 71 | hr = src->QueryInterface(__uuidof(ID3D11Texture2D), &src_tex); 72 | if (hr != S_OK) throw std::system_error(hr, std::system_category()); 73 | D3D11_TEXTURE2D_DESC src_desc; 74 | 75 | src_tex->GetDesc(&src_desc); 76 | // assert(src_desc.Format == DXGI_FORMAT_R32G8X24_TYPELESS); 77 | D3D11_MAPPED_SUBRESOURCE src_map = { 0 }; 78 | hr = ctx->Map(src, 0, D3D11_MAP_READ, 0, &src_map); 79 | if (hr != S_OK) throw std::system_error(hr, std::system_category()); 80 | if (dst.size() != src_desc.Height * src_desc.Width * 4) dst = vector(src_desc.Height * src_desc.Width * 4); 81 | if (stencil.size() != src_desc.Height * src_desc.Width) stencil = vector(src_desc.Height * src_desc.Width); 82 | for (int x = 0; x < src_desc.Width; ++x) 83 | { 84 | for (int y = 0; y < src_desc.Height; ++y) 85 | { 86 | const float* src_f = (const float*)((const char*)src_map.pData + src_map.RowPitch*y + (x * 8)); 87 | unsigned char* dst_p = &dst[src_desc.Width * 4 * y + (x * 4)]; 88 | unsigned char* stencil_p = &stencil[src_desc.Width * y + x]; 89 | memmove(dst_p, src_f, 4); 90 | memmove(stencil_p, src_f + 1, 1); 91 | } 92 | } 93 | ctx->Unmap(src, 0); 94 | } 95 | static ComPtr CreateTexHelper(ID3D11Device* dev, DXGI_FORMAT fmt, int width, int height, int samples) 96 | { 97 | D3D11_TEXTURE2D_DESC desc = { 0 }; 98 | desc.Format = fmt; 99 | desc.ArraySize = 1; 100 | desc.BindFlags = 0; 101 | desc.CPUAccessFlags = D3D11_CPU_ACCESS_READ; 102 | desc.Height = height; 103 | desc.Width = width; 104 | desc.MipLevels = 1; 105 | desc.MiscFlags = 0; 106 | desc.SampleDesc.Count = 1; 107 | desc.SampleDesc.Quality = 0; 108 | desc.Usage = D3D11_USAGE_STAGING; 109 | ComPtr result; 110 | HRESULT hr = S_OK; 111 | hr = dev->CreateTexture2D(&desc, nullptr, &result); 112 | if (hr != S_OK) throw std::system_error(hr, std::system_category()); 113 | return result; 114 | 115 | } 116 | static ComPtr CreateStagingBuffer(ID3D11Device* dev, int size) { 117 | ComPtr result; 118 | D3D11_BUFFER_DESC desc = { 0 }; 119 | desc.BindFlags = 0; 120 | desc.ByteWidth = size; 121 | desc.CPUAccessFlags = D3D11_CPU_ACCESS_READ; 122 | desc.MiscFlags = 0; 123 | desc.Usage = D3D11_USAGE_STAGING; 124 | dev->CreateBuffer(&desc, nullptr, &result); 125 | return result; 126 | } 127 | 128 | void CreateTextureIfNeeded(ID3D11Device* dev, ID3D11Resource* for_res, ComPtr* tex_target) 129 | { 130 | ComPtr tex; 131 | HRESULT hr = S_OK; 132 | D3D11_TEXTURE2D_DESC desc = { 0 }; 133 | hr = for_res->QueryInterface(__uuidof(ID3D11Texture2D), &tex); 134 | if (hr != S_OK) throw std::system_error(hr, std::system_category()); 135 | tex->GetDesc(&desc); 136 | if(*tex_target == nullptr) 137 | { 138 | *tex_target = CreateTexHelper(dev, desc.Format, desc.Width, desc.Height, desc.SampleDesc.Count); 139 | } 140 | D3D11_TEXTURE2D_DESC tex_desc; 141 | (*tex_target)->GetDesc(&tex_desc); 142 | if (tex_desc.Width != desc.Width || tex_desc.Height != desc.Height) 143 | { 144 | *tex_target = CreateTexHelper(dev, desc.Format, desc.Width, desc.Height, desc.SampleDesc.Count); 145 | } 146 | } 147 | int getBitsPerPixel(DXGI_FORMAT fmt) 148 | { 149 | switch(fmt) 150 | { 151 | case DXGI_FORMAT_B8G8R8A8_UNORM: 152 | return 4; 153 | default: 154 | return -1; 155 | } 156 | } 157 | void copyTexToVector(ID3D11Device* dev, ID3D11DeviceContext* ctx, ID3D11Resource* res, vector& buffer) 158 | { 159 | ComPtr tex; 160 | HRESULT hr; 161 | hr = res->QueryInterface(__uuidof(ID3D11Texture2D), &tex); 162 | D3D11_TEXTURE2D_DESC desc; 163 | if (hr != S_OK) throw std::system_error(hr, std::system_category()); 164 | tex->GetDesc(&desc); 165 | ComPtr tex_copy; 166 | CreateTextureIfNeeded(dev, tex.Get(), &tex_copy); 167 | ctx->CopyResource(tex_copy.Get(), tex.Get()); 168 | D3D11_MAPPED_SUBRESOURCE map; 169 | auto bpp = getBitsPerPixel(desc.Format); 170 | if (bpp == -1) throw std::invalid_argument("unsupported resource type"); 171 | hr = ctx->Map(tex_copy.Get(), 0, D3D11_MAP_READ, 0, &map); 172 | if (hr != S_OK) throw std::system_error(hr, std::system_category()); 173 | if (buffer.size() != desc.Height * desc.Width * bpp) buffer = vector(desc.Height * desc.Width * bpp); 174 | for(int y = 0; y < desc.Height; ++y) 175 | { 176 | for (int x = 0; x < desc.Width; ++x) { 177 | unsigned char* p = &buffer[y * desc.Width * bpp + (x*4)]; 178 | unsigned char* b = (unsigned char*)map.pData + map.RowPitch*y + (x*4); 179 | p[0] = b[2]; 180 | p[1] = b[1]; 181 | p[2] = b[0]; 182 | p[3] = b[3]; 183 | //memmove(p, b, desc.Width * bpp); 184 | } 185 | 186 | } 187 | ctx->Unmap(tex_copy.Get(), 0); 188 | 189 | } 190 | void CopyIfRequested() 191 | { 192 | unique_lock lk(copy_mtx); 193 | if(request_copy) 194 | { 195 | unpack_depth(lastDev.Get(), lastCtx.Get(), depthRes.Get(), depthBuf, stencilBuf); 196 | copyTexToVector(lastDev.Get(), lastCtx.Get(), colorRes.Get(), colorBuf); 197 | request_copy = false; 198 | lk.unlock(); //unlock the mutex so that and woken threads don't immediately block on it 199 | copy_cv.notify_all(); 200 | } 201 | } 202 | 203 | void ExtractDepthBuffer(ID3D11Device* dev, ID3D11DeviceContext* ctx, ID3D11Resource* res) 204 | { 205 | lastDev = dev; 206 | lastCtx = ctx; 207 | CreateTextureIfNeeded(dev, res, &depthRes); 208 | ctx->CopyResource(depthRes.Get(), res); 209 | last_depth_time = std::chrono::high_resolution_clock::now(); 210 | //unpack_depth(dev, ctx, res, depthBuf, stencilBuf, screenBuf); 211 | } 212 | 213 | void ExtractColorBuffer(ID3D11Device* dev, ID3D11DeviceContext* ctx, ID3D11Resource* tex) 214 | { 215 | lastDev = dev; 216 | lastCtx = ctx; 217 | CreateTextureIfNeeded(dev, tex, &colorRes); 218 | ctx->CopyResource(colorRes.Get(), tex); 219 | last_color_time = high_resolution_clock::now(); 220 | //copyTexToVector(dev, ctx, tex, colorBuf); 221 | 222 | } 223 | 224 | void ExtractConstantBuffer(ID3D11Device* dev, ID3D11DeviceContext* ctx, ID3D11Buffer* buf) { 225 | lastDev = dev; 226 | lastCtx = ctx; 227 | D3D11_BUFFER_DESC desc = { 0 }; 228 | buf->GetDesc(&desc); 229 | if (constantBuf == nullptr) { 230 | constantBuf = CreateStagingBuffer(dev, desc.ByteWidth); 231 | } 232 | ctx->CopyResource(constantBuf.Get(), buf); 233 | last_constant_time = high_resolution_clock::now(); 234 | 235 | } 236 | 237 | 238 | //auto screenCap = [](int id) { 239 | // WCHAR imgPath[35]; 240 | // swprintf(imgPath, 35, L"screen_%d.bmp", id); 241 | // if (!(export_get_screen_buffer(imgPath, 0))) { 242 | // } 243 | // else { 244 | // std::wstring ws1(imgPath); 245 | // } 246 | //}; 247 | 248 | void ExtractScreenBuffer(ID3D11DeviceContext* ctx, ID3D11Texture2D* back, HRESULT hr) 249 | { 250 | lastCtx = ctx; 251 | backBuf = back; 252 | screenHr = hr; 253 | last_screen_time = high_resolution_clock::now(); 254 | } 255 | 256 | extern "C" { 257 | __declspec(dllexport) int export_get_depth_buffer(void** buf) 258 | { 259 | if (lastDev == nullptr || lastCtx == nullptr || depthRes == nullptr) return -1; 260 | unpack_depth(lastDev.Get(), lastCtx.Get(), depthRes.Get(), depthBuf, stencilBuf); 261 | *buf = &depthBuf[0]; 262 | return depthBuf.size(); 263 | } 264 | __declspec(dllexport) int export_get_color_buffer(void** buf) 265 | { 266 | if (lastDev == nullptr || lastCtx == nullptr || colorRes == nullptr) return -1; 267 | copyTexToVector(lastDev.Get(), lastCtx.Get(), colorRes.Get(), colorBuf); 268 | *buf = &colorBuf[0]; 269 | return colorBuf.size(); 270 | } 271 | __declspec(dllexport) int export_get_stencil_buffer(void** buf) 272 | { 273 | if (lastDev == nullptr || lastCtx == nullptr || depthRes == nullptr) return -1; 274 | unpack_depth(lastDev.Get(), lastCtx.Get(), depthRes.Get(), depthBuf, stencilBuf); 275 | *buf = &stencilBuf[0]; 276 | return stencilBuf.size(); 277 | } 278 | __declspec(dllexport) int export_get_constant_buffer(rage_matrices* buf) { 279 | if (constantBuf == nullptr) return -1; 280 | D3D11_MAPPED_SUBRESOURCE res = { 0 }; 281 | lastCtx->Map(constantBuf.Get(), 0, D3D11_MAP_READ, 0, &res); 282 | memmove(buf, res.pData, sizeof(constants)); 283 | lastCtx->Unmap(constantBuf.Get(), 0); 284 | return sizeof(rage_matrices); 285 | } 286 | __declspec(dllexport) int export_get_screen_buffer(WCHAR *pictureName) 287 | { 288 | if (lastCtx == nullptr || backBuf == nullptr || !SUCCEEDED(screenHr)) return 0; 289 | HRESULT hr = DirectX::SaveWICTextureToFile(lastCtx.Get(), backBuf.Get(), 290 | GUID_ContainerFormatBmp, pictureName); 291 | if (SUCCEEDED(hr)) { 292 | return 1; 293 | } 294 | else return 2; 295 | } 296 | 297 | __declspec(dllexport) long long int export_get_last_depth_time() { 298 | return duration_cast(last_depth_time.time_since_epoch()).count(); 299 | } 300 | __declspec(dllexport) long long int export_get_last_color_time() { 301 | return duration_cast(last_color_time.time_since_epoch()).count(); 302 | } 303 | __declspec(dllexport) long long int export_get_last_constant_time() { 304 | return duration_cast(last_constant_time.time_since_epoch()).count(); 305 | } 306 | 307 | __declspec(dllexport) long long int export_get_current_time() { 308 | return duration_cast(high_resolution_clock::now().time_since_epoch()).count(); 309 | } 310 | } 311 | --------------------------------------------------------------------------------