atom0s
8 years ago
commit
ffecc4ddaf
9 changed files with 779 additions and 0 deletions
@ -0,0 +1,221 @@
@@ -0,0 +1,221 @@
|
||||
# ---> VisualStudio |
||||
## Ignore Visual Studio temporary files, build results, and |
||||
## files generated by popular Visual Studio add-ons. |
||||
|
||||
# User-specific files |
||||
*.suo |
||||
*.user |
||||
*.userosscache |
||||
*.sln.docstates |
||||
|
||||
# User-specific files (MonoDevelop/Xamarin Studio) |
||||
*.userprefs |
||||
|
||||
# Build results |
||||
[Dd]ebug/ |
||||
[Dd]ebugPublic/ |
||||
[Rr]elease/ |
||||
[Rr]eleases/ |
||||
x64/ |
||||
x86/ |
||||
build/ |
||||
bld/ |
||||
[Bb]in/ |
||||
[Oo]bj/ |
||||
|
||||
# Visual Studio 2015 cache/options directory |
||||
.vs/ |
||||
# Uncomment if you have tasks that create the project's static files in wwwroot |
||||
#wwwroot/ |
||||
|
||||
# MSTest test Results |
||||
[Tt]est[Rr]esult*/ |
||||
[Bb]uild[Ll]og.* |
||||
|
||||
# NUNIT |
||||
*.VisualState.xml |
||||
TestResult.xml |
||||
|
||||
# Build Results of an ATL Project |
||||
[Dd]ebugPS/ |
||||
[Rr]eleasePS/ |
||||
dlldata.c |
||||
|
||||
# DNX |
||||
project.lock.json |
||||
artifacts/ |
||||
|
||||
*_i.c |
||||
*_p.c |
||||
*_i.h |
||||
*.ilk |
||||
*.meta |
||||
*.obj |
||||
*.pch |
||||
*.pdb |
||||
*.pgc |
||||
*.pgd |
||||
*.rsp |
||||
*.sbr |
||||
*.tlb |
||||
*.tli |
||||
*.tlh |
||||
*.tmp |
||||
*.tmp_proj |
||||
*.log |
||||
*.vspscc |
||||
*.vssscc |
||||
.builds |
||||
*.pidb |
||||
*.svclog |
||||
*.scc |
||||
|
||||
# Chutzpah Test files |
||||
_Chutzpah* |
||||
|
||||
# Visual C++ cache files |
||||
ipch/ |
||||
*.aps |
||||
*.ncb |
||||
*.opensdf |
||||
*.sdf |
||||
*.cachefile |
||||
|
||||
# Visual Studio profiler |
||||
*.psess |
||||
*.vsp |
||||
*.vspx |
||||
*.sap |
||||
|
||||
# TFS 2012 Local Workspace |
||||
$tf/ |
||||
|
||||
# Guidance Automation Toolkit |
||||
*.gpState |
||||
|
||||
# ReSharper is a .NET coding add-in |
||||
_ReSharper*/ |
||||
*.[Rr]e[Ss]harper |
||||
*.DotSettings.user |
||||
|
||||
# JustCode is a .NET coding add-in |
||||
.JustCode |
||||
|
||||
# TeamCity is a build add-in |
||||
_TeamCity* |
||||
|
||||
# DotCover is a Code Coverage Tool |
||||
*.dotCover |
||||
|
||||
# NCrunch |
||||
_NCrunch_* |
||||
.*crunch*.local.xml |
||||
nCrunchTemp_* |
||||
|
||||
# MightyMoose |
||||
*.mm.* |
||||
AutoTest.Net/ |
||||
|
||||
# Web workbench (sass) |
||||
.sass-cache/ |
||||
|
||||
# Installshield output folder |
||||
[Ee]xpress/ |
||||
|
||||
# DocProject is a documentation generator add-in |
||||
DocProject/buildhelp/ |
||||
DocProject/Help/*.HxT |
||||
DocProject/Help/*.HxC |
||||
DocProject/Help/*.hhc |
||||
DocProject/Help/*.hhk |
||||
DocProject/Help/*.hhp |
||||
DocProject/Help/Html2 |
||||
DocProject/Help/html |
||||
|
||||
# Click-Once directory |
||||
publish/ |
||||
|
||||
# Publish Web Output |
||||
*.[Pp]ublish.xml |
||||
*.azurePubxml |
||||
# TODO: Comment the next line if you want to checkin your web deploy settings |
||||
# but database connection strings (with potential passwords) will be unencrypted |
||||
*.pubxml |
||||
*.publishproj |
||||
|
||||
# NuGet Packages |
||||
*.nupkg |
||||
# The packages folder can be ignored because of Package Restore |
||||
**/packages/* |
||||
# except build/, which is used as an MSBuild target. |
||||
!**/packages/build/ |
||||
# Uncomment if necessary however generally it will be regenerated when needed |
||||
#!**/packages/repositories.config |
||||
|
||||
# Windows Azure Build Output |
||||
csx/ |
||||
*.build.csdef |
||||
|
||||
# Windows Store app package directory |
||||
AppPackages/ |
||||
|
||||
# Visual Studio cache files |
||||
# files ending in .cache can be ignored |
||||
*.[Cc]ache |
||||
# but keep track of directories ending in .cache |
||||
!*.[Cc]ache/ |
||||
|
||||
# Others |
||||
ClientBin/ |
||||
[Ss]tyle[Cc]op.* |
||||
~$* |
||||
*~ |
||||
*.dbmdl |
||||
*.dbproj.schemaview |
||||
*.pfx |
||||
*.publishsettings |
||||
node_modules/ |
||||
orleans.codegen.cs |
||||
|
||||
# RIA/Silverlight projects |
||||
Generated_Code/ |
||||
|
||||
# Backup & report files from converting an old project file |
||||
# to a newer Visual Studio version. Backup files are not needed, |
||||
# because we have git ;-) |
||||
_UpgradeReport_Files/ |
||||
Backup*/ |
||||
UpgradeLog*.XML |
||||
UpgradeLog*.htm |
||||
|
||||
# SQL Server files |
||||
*.mdf |
||||
*.ldf |
||||
|
||||
# Business Intelligence projects |
||||
*.rdl.data |
||||
*.bim.layout |
||||
*.bim_*.settings |
||||
|
||||
# Microsoft Fakes |
||||
FakesAssemblies/ |
||||
|
||||
# Node.js Tools for Visual Studio |
||||
.ntvs_analysis.dat |
||||
|
||||
# Visual Studio 6 build log |
||||
*.plg |
||||
|
||||
# Visual Studio 6 workspace options file |
||||
*.opt |
||||
|
||||
# Visual Studio LightSwitch build output |
||||
**/*.HTMLClient/GeneratedArtifacts |
||||
**/*.DesktopClient/GeneratedArtifacts |
||||
**/*.DesktopClient/ModelManifest.xml |
||||
**/*.Server/GeneratedArtifacts |
||||
**/*.Server/ModelManifest.xml |
||||
_Pvt_Extensions |
||||
|
||||
/Ashita.exp |
||||
/Ashita.lib |
@ -0,0 +1,219 @@
@@ -0,0 +1,219 @@
|
||||
#define RBUFP(p,pos) (((uint8_t*)(p)) + (pos)) |
||||
#define RBUFB(p,pos) (*(uint8_t*)RBUFP((p),(pos))) |
||||
#define RBUFW(p,pos) (*(uint16_t*)RBUFP((p),(pos))) |
||||
#define RBUFL(p,pos) (*(uint32_t*)RBUFP((p),(pos))) |
||||
#define RBUFF(p,pos) (*(float*)RBUFP((p),(pos))) |
||||
|
||||
#define WBUFP(p,pos) (((uint8_t*)(p)) + (pos)) |
||||
#define WBUFB(p,pos) (*(uint8_t*)WBUFP((p),(pos))) |
||||
#define WBUFW(p,pos) (*(uint16_t*)WBUFP((p),(pos))) |
||||
#define WBUFL(p,pos) (*(uint32_t*)WBUFP((p),(pos))) |
||||
#define WBUFF(p,pos) (*(float*)WBUFP((p),(pos))) |
||||
|
||||
#include <stdint.h> |
||||
|
||||
uint32_t packBitsBE(uint8_t* target, uint64_t value, int32_t byteOffset, int32_t bitOffset, uint8_t lengthInBit) |
||||
{ |
||||
byteOffset += (bitOffset >> 3); //correct bitOffsets>=8
|
||||
bitOffset %= 8; |
||||
|
||||
uint64_t bitmask = 0xFFFFFFFFFFFFFFFFLL; //Generate bitmask
|
||||
|
||||
bitmask >>= (64 - lengthInBit); |
||||
bitmask <<= bitOffset; |
||||
|
||||
value <<= bitOffset; //shift value
|
||||
value &= bitmask; |
||||
|
||||
bitmask ^= 0xFFFFFFFFFFFFFFFFLL; //invert bitmask
|
||||
|
||||
if ((lengthInBit + bitOffset) <= 8) //write shifted value to target
|
||||
{ |
||||
uint8_t* dataPointer = (uint8_t*)&target[byteOffset]; |
||||
|
||||
uint8_t bitmaskUC = (uint8_t)bitmask; |
||||
uint8_t valueUC = (uint8_t)value; |
||||
|
||||
*dataPointer &= bitmaskUC; |
||||
*dataPointer |= valueUC; |
||||
} |
||||
else if ((lengthInBit + bitOffset) <= 16) |
||||
{ |
||||
uint16_t* dataPointer = (uint16_t*)&target[byteOffset]; |
||||
|
||||
uint16_t bitmaskUC = (uint16_t)bitmask; |
||||
uint16_t valueUC = (uint16_t)value; |
||||
|
||||
*dataPointer &= bitmaskUC; |
||||
*dataPointer |= valueUC; |
||||
} |
||||
else if ((lengthInBit + bitOffset) <= 32) |
||||
{ |
||||
uint32_t* dataPointer = (uint32_t*)&target[byteOffset]; |
||||
|
||||
uint32_t bitmaskUC = (uint32_t)bitmask; |
||||
uint32_t valueUC = (uint32_t)value; |
||||
|
||||
*dataPointer &= bitmaskUC; |
||||
*dataPointer |= valueUC; |
||||
} |
||||
else if ((lengthInBit + bitOffset) <= 64) |
||||
{ |
||||
uint64_t* dataPointer = (uint64_t*)&target[byteOffset]; |
||||
|
||||
*dataPointer &= bitmask; |
||||
*dataPointer |= value; |
||||
} |
||||
else |
||||
{ |
||||
//ShowError("Pack Bits Error: packBitsBE(...) not implemented for targetsizes above 64 bits.\n Targetsize: %d\n", (lengthInBit + bitOffset));
|
||||
} |
||||
return ((byteOffset << 3) + bitOffset + lengthInBit); |
||||
} |
||||
|
||||
uint32_t packBitsBE(uint8_t* target, uint64_t value, int32_t bitOffset, uint8_t lengthInBit) |
||||
{ |
||||
return packBitsBE(target, value, 0, bitOffset, lengthInBit); |
||||
} |
||||
|
||||
uint64_t unpackBitsBE(uint8_t* target, int32_t byteOffset, int32_t bitOffset, uint8_t lengthInBit) |
||||
{ |
||||
byteOffset += (bitOffset >> 3); |
||||
bitOffset %= 8; |
||||
|
||||
uint64_t bitmask = 0xFFFFFFFFFFFFFFFFLL; |
||||
|
||||
bitmask >>= (64 - lengthInBit); |
||||
bitmask <<= bitOffset; |
||||
|
||||
uint64_t retVal; |
||||
|
||||
if ((lengthInBit + bitOffset) <= 8) |
||||
{ |
||||
uint8_t* dataPointer = (uint8_t*)&target[byteOffset]; |
||||
|
||||
retVal = ((*dataPointer)&(uint8_t)bitmask) >> bitOffset; |
||||
} |
||||
else if ((lengthInBit + bitOffset) <= 16) |
||||
{ |
||||
uint16_t* dataPointer = (uint16_t*)&target[byteOffset]; |
||||
|
||||
retVal = ((*dataPointer)&(uint16_t)bitmask) >> bitOffset; |
||||
} |
||||
else if ((lengthInBit + bitOffset) <= 32) |
||||
{ |
||||
uint32_t* dataPointer = (uint32_t*)&target[byteOffset]; |
||||
|
||||
retVal = ((*dataPointer)&(uint32_t)bitmask) >> bitOffset; |
||||
} |
||||
else if ((lengthInBit + bitOffset) <= 64) |
||||
{ |
||||
uint64_t* dataPointer = (uint64_t*)&target[byteOffset]; |
||||
|
||||
retVal = ((*dataPointer)&(uint64_t)bitmask) >> bitOffset; |
||||
} |
||||
else |
||||
{ |
||||
//ShowError("Unpack Bits Error: unpackBits(...) not implemented for targetsizes above 64 bits.\n Targetsize: %d\n", (lengthInBit + bitOffset));
|
||||
return 0; |
||||
} |
||||
return retVal; |
||||
} |
||||
|
||||
uint64_t unpackBitsBE(uint8_t* target, int32_t bitOffset, uint8_t lengthInBit) |
||||
{ |
||||
return unpackBitsBE(target, 0, bitOffset, lengthInBit); |
||||
} |
||||
|
||||
uint32_t packBitsLE(uint8_t* target, uint64_t value, int32_t byteOffset, int32_t bitOffset, uint8_t lengthInBit) |
||||
{ |
||||
byteOffset += (bitOffset >> 3); //correct bitOffsets >= 8
|
||||
bitOffset %= 8; |
||||
|
||||
uint8_t bytesNeeded; //calculate how many bytes are needed
|
||||
if ((bitOffset + lengthInBit) <= 8) |
||||
bytesNeeded = 1; |
||||
else if ((bitOffset + lengthInBit) <= 16) |
||||
bytesNeeded = 2; |
||||
else if ((bitOffset + lengthInBit) <= 32) |
||||
bytesNeeded = 4; |
||||
else if ((bitOffset + lengthInBit) <= 64) |
||||
bytesNeeded = 8; |
||||
else |
||||
{ |
||||
//ShowError("Pack Bits Error: packBitsLE(...) not implemented for targetsizes above 64 bits.\n Targetsize: %d\n", (lengthInBit + bitOffset));
|
||||
return 0; |
||||
} |
||||
|
||||
uint8_t* modifiedTarget = new uint8_t[bytesNeeded]; //convert byteOrder to Big Endian
|
||||
|
||||
for (uint8_t curByte = 0; curByte < bytesNeeded; ++curByte) |
||||
{ |
||||
modifiedTarget[curByte] = target[byteOffset + (bytesNeeded - 1) - curByte]; |
||||
} |
||||
|
||||
int32_t newBitOffset = (bytesNeeded << 3) - (bitOffset + lengthInBit); //calculate new bitOffset
|
||||
|
||||
packBitsBE(&modifiedTarget[0], value, 0, newBitOffset, lengthInBit); //write data to modified array
|
||||
|
||||
for (uint8_t curByte = 0; curByte < bytesNeeded; ++curByte) //copy back to target
|
||||
{ |
||||
target[byteOffset + (bytesNeeded - 1) - curByte] = modifiedTarget[curByte]; |
||||
} |
||||
|
||||
if (modifiedTarget) delete[] modifiedTarget; |
||||
return ((byteOffset << 3) + bitOffset + lengthInBit); |
||||
} |
||||
|
||||
uint32_t packBitsLE(uint8_t* target, uint64_t value, int32_t bitOffset, uint8_t lengthInBit) |
||||
{ |
||||
return packBitsLE(target, value, 0, bitOffset, lengthInBit); |
||||
} |
||||
|
||||
uint64_t unpackBitsLE(uint8_t* target, int32_t byteOffset, int32_t bitOffset, uint8_t lengthInBit) |
||||
{ |
||||
byteOffset += (bitOffset >> 3); |
||||
bitOffset %= 8; |
||||
|
||||
uint8_t bytesNeeded; |
||||
if ((bitOffset + lengthInBit) <= 8) |
||||
bytesNeeded = 1; |
||||
else if ((bitOffset + lengthInBit) <= 16) |
||||
bytesNeeded = 2; |
||||
else if ((bitOffset + lengthInBit) <= 32) |
||||
bytesNeeded = 4; |
||||
else if ((bitOffset + lengthInBit) <= 64) |
||||
bytesNeeded = 8; |
||||
else |
||||
{ |
||||
//ShowError("Unpack Bits Error: packBitsLE(...) not implemented for targetsizes above 64 bits.\n Targetsize: %d\n", (lengthInBit + bitOffset));
|
||||
return 0; |
||||
} |
||||
|
||||
uint64_t retVal; |
||||
|
||||
uint8_t* modifiedTarget = new uint8_t[bytesNeeded]; |
||||
|
||||
for (uint8_t curByte = 0; curByte < bytesNeeded; ++curByte) |
||||
{ |
||||
modifiedTarget[curByte] = target[byteOffset + (bytesNeeded - 1) - curByte]; |
||||
} |
||||
if (bytesNeeded == 1) |
||||
{ |
||||
uint8_t bitmask = 0xFF >> bitOffset; |
||||
retVal = (modifiedTarget[0] & bitmask) >> (8 - (lengthInBit + bitOffset)); |
||||
} |
||||
else |
||||
{ |
||||
int32_t newBitOffset = (bytesNeeded * 8) - (bitOffset + lengthInBit); |
||||
retVal = unpackBitsBE(&modifiedTarget[0], 0, newBitOffset, lengthInBit); |
||||
} |
||||
|
||||
if (modifiedTarget) delete[]modifiedTarget; |
||||
return retVal; |
||||
} |
||||
|
||||
uint64_t unpackBitsLE(uint8_t* target, int32_t bitOffset, uint8_t lengthInBit) |
||||
{ |
||||
return unpackBitsLE(target, 0, bitOffset, lengthInBit); |
||||
} |
@ -0,0 +1,5 @@
@@ -0,0 +1,5 @@
|
||||
LIBRARY "No-ckback" |
||||
EXPORTS |
||||
GetInterfaceVersion |
||||
CreatePluginInfo |
||||
CreatePlugin |
@ -0,0 +1,74 @@
@@ -0,0 +1,74 @@
|
||||
#include "No-ckback.h" |
||||
#include "DSP-Utils.h" |
||||
|
||||
#include <windows.h> |
||||
#include <stdio.h> |
||||
|
||||
plugininfo_t* g_PluginInfo; |
||||
|
||||
bool Nockback::Initialize(IAshitaCore* core, ILogManager* log, uint32_t id) |
||||
{ |
||||
this->m_AshitaCore = core; |
||||
this->m_PluginId = id; |
||||
this->m_LogManager = log; |
||||
|
||||
return true; |
||||
} |
||||
|
||||
void Nockback::Release() |
||||
{ |
||||
} |
||||
|
||||
plugininfo_t Nockback::GetPluginInfo() |
||||
{ |
||||
return *g_PluginInfo; |
||||
} |
||||
|
||||
bool Nockback::HandleIncomingPacket(uint16_t id, uint32_t size, void* data, void* modified, bool blocked) |
||||
{ |
||||
if (id == 0x28) |
||||
{ |
||||
uint8_t actionType = (uint8_t)(unpackBitsBE((unsigned char*)data, 82, 4)); |
||||
|
||||
if (actionType == 11) |
||||
{ |
||||
uint8_t targetNum = RBUFB(data, 0x09); |
||||
uint16_t startBit = 150; |
||||
for (int i = 0; i < targetNum; i++) |
||||
{ |
||||
packBitsBE((unsigned char*)data, 0, startBit + 60, 3); |
||||
if (unpackBitsBE((unsigned char*)data, startBit + 121, 1) & 0x1) |
||||
{ |
||||
startBit += 37; |
||||
} |
||||
if (unpackBitsBE((unsigned char*)data, startBit + 122, 1) & 0x1) |
||||
{ |
||||
startBit += 34; |
||||
} |
||||
startBit += 123; |
||||
} |
||||
} |
||||
} |
||||
return false; |
||||
} |
||||
|
||||
__declspec(dllexport) double __stdcall GetInterfaceVersion(void) |
||||
{ |
||||
return ASHITA_INTERFACE_VERSION; |
||||
} |
||||
|
||||
__declspec(dllexport) void __stdcall CreatePluginInfo(plugininfo_t* Data) |
||||
{ |
||||
g_PluginInfo = Data; |
||||
g_PluginInfo->PluginVersion = 1.05; |
||||
g_PluginInfo->InterfaceVersion = ASHITA_INTERFACE_VERSION; |
||||
g_PluginInfo->Priority = 0; |
||||
|
||||
strncpy_s(g_PluginInfo->Name, "No-ckback", 256); |
||||
strncpy_s(g_PluginInfo->Author, "kjLotus", 256); |
||||
} |
||||
|
||||
__declspec(dllexport) IPlugin* __stdcall CreatePlugin(void) |
||||
{ |
||||
return (IPlugin*)new Nockback(); |
||||
} |
@ -0,0 +1,27 @@
@@ -0,0 +1,27 @@
|
||||
#include "C:\Ashita 3\plugins\ADK\Ashita.h" |
||||
#include <stdint.h> |
||||
|
||||
class Nockback : public IPlugin |
||||
{ |
||||
private: |
||||
IAshitaCore* m_AshitaCore; |
||||
ILogManager* m_LogManager; |
||||
DWORD m_PluginId; |
||||
IDirect3DDevice8* m_Direct3DDevice; |
||||
|
||||
public: |
||||
Nockback() {} |
||||
virtual ~Nockback() {} |
||||
bool Initialize(IAshitaCore* core, ILogManager* log, uint32_t id); |
||||
|
||||
void Release(); |
||||
|
||||
plugininfo_t GetPluginInfo(); |
||||
|
||||
bool HandleIncomingPacket(uint16_t id, uint32_t size, void* data, void* modified, bool blocked); |
||||
}; |
||||
|
||||
//Exports
|
||||
__declspec(dllexport) double __stdcall GetInterfaceVersion(void); |
||||
__declspec(dllexport) void __stdcall CreatePluginInfo(plugininfo_t* lpPluginData); |
||||
__declspec(dllexport) IPlugin* __stdcall CreatePlugin(void); |
Loading…
Reference in new issue