diff --git a/Maps/lua.w3m b/Maps/lua.w3m
deleted file mode 100644
index 6e7ef83..0000000
Binary files a/Maps/lua.w3m and /dev/null differ
diff --git a/README.md b/README.md
index eb23eb6..6778b25 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-# War3 Lua - 1.1.5 (Ashenvale - Experimental)
+# War3 Lua - 1.1.6 (Outland)
[![build](https://github.com/Ev3nt/war3_lua/actions/workflows/build.yml/badge.svg)](https://github.com/Ev3nt/war3_lua/actions/workflows/build.yml)
@@ -6,6 +6,8 @@ War3 Lua is a modification that allows you to run lua scripts at the JASS level.
Some natives doesn't work (thx jass for beautiful VM).
+Lua version: **5.4.4**
+
![](https://github.com/Ev3nt/war3_lua/blob/master/war3_lua.png)
---
@@ -23,5 +25,5 @@ Some natives doesn't work (thx jass for beautiful VM).
### Recommended build parameters
* Configuration **Release**
* Windows platform **x86**
-* Platform **10.0.19041.0**
+* Platform **10.0.19041.**0****
* Build tools **Visual Studio 2015 (v140)**
diff --git a/Scripts/blizzard.lua b/Scripts/blizzard.lua
index 212578b..797b5b6 100644
--- a/Scripts/blizzard.lua
+++ b/Scripts/blizzard.lua
@@ -9823,7 +9823,7 @@ function InitBlizzardGlobals()
end
bj_FORCE_ALL_PLAYERS = CreateForce()
- ForceEnumPlayers(bj_FORCE_ALL_PLAYERS, 0)
+ ForceEnumPlayers(bj_FORCE_ALL_PLAYERS, nil)
-- Init Cinematic Mode history
bj_cineModePriorSpeed = GetGameSpeed()
@@ -9897,17 +9897,17 @@ function InitSummonableCaps()
-- upgraded units
-- Note: Only do this if the corresponding upgrade is not yet researched
-- Barrage - Siege Engines
- if (not GetPlayerTechResearched(Player(index), 'Rhrt', true)) then
- SetPlayerTechMaxAllowed(Player(index), 'hrtt', 0)
+ if (not GetPlayerTechResearched(Player(index), StringToId('Rhrt'), true)) then
+ SetPlayerTechMaxAllowed(Player(index), StringToId('hrtt'), 0)
end
-- Berserker Upgrade - Troll Berserkers
- if (not GetPlayerTechResearched(Player(index), 'Robk', true)) then
- SetPlayerTechMaxAllowed(Player(index), 'otbk', 0)
+ if (not GetPlayerTechResearched(Player(index), StringToId('Robk'), true)) then
+ SetPlayerTechMaxAllowed(Player(index), StringToId('otbk'), 0)
end
-- max skeletons per player
- SetPlayerTechMaxAllowed(Player(index), 'uske', bj_MAX_SKELETONS)
+ SetPlayerTechMaxAllowed(Player(index), StringToId('uske'), bj_MAX_SKELETONS)
index = index + 1
if index == bj_MAX_PLAYERS then break end
@@ -10046,7 +10046,7 @@ function InitNeutralBuildings()
-- Set up a trigger to fire whenever an item is sold.
bj_stockItemPurchased = CreateTrigger()
- TriggerRegisterPlayerUnitEvent(bj_stockItemPurchased, Player(PLAYER_NEUTRAL_PASSIVE), EVENT_PLAYER_UNIT_SELL_ITEM, 0)
+ TriggerRegisterPlayerUnitEvent(bj_stockItemPurchased, Player(PLAYER_NEUTRAL_PASSIVE), EVENT_PLAYER_UNIT_SELL_ITEM, nil)
TriggerAddAction(bj_stockItemPurchased, RemovePurchasedItem)
end
-- ===========================================================================
@@ -10218,37 +10218,6 @@ end
--
-- ***************************************************************************
--- function GetEffectPos(effect)
--- return GetObjectPos(effect)
--- end
-
--- function GetEffectX(effect)
--- return GetObjectX(effect)
--- end
-
--- function GetEffectY(effect)
--- return GetObjectY(effect)
--- end
-
--- function GetEffectZ(effect)
--- return GetObjectZ(effect)
--- end
-
--- function SetEffectPos(effect, x, y, z)
--- SetObjectPos(effect, x, y, z)
--- end
-
--- function SetEffectX(effect, x)
--- SetObjectX(effect, x)
--- end
-
--- function SetEffectY(effect, y)
--- SetObjectY(effect, y)
--- end
--- function SetEffectZ(effect, z)
--- SetObjectZ(effect, z)
--- end
-
function _print(...)
local string = ""
diff --git a/Scripts/common.lua b/Scripts/common.lua
index f0b6ec6..76666c0 100644
--- a/Scripts/common.lua
+++ b/Scripts/common.lua
@@ -1,6 +1,6 @@
FALSE = false
TRUE = true
-JASS_MAX_ARRAY_SIZE = 32768
+JASS_MAX_ARRAY_SIZE = 8192
PLAYER_NEUTRAL_PASSIVE = 15
PLAYER_NEUTRAL_AGGRESSIVE = 12
PLAYER_COLOR_RED = ConvertPlayerColor(0)
diff --git a/Src Backup/.vscode/settings.json b/Src Backup/.vscode/settings.json
deleted file mode 100644
index 6f26099..0000000
--- a/Src Backup/.vscode/settings.json
+++ /dev/null
@@ -1,27 +0,0 @@
-{
- "files.associations": {
- "map": "cpp",
- "bit": "cpp",
- "compare": "cpp",
- "concepts": "cpp",
- "cstddef": "cpp",
- "cstdint": "cpp",
- "cstdio": "cpp",
- "cstdlib": "cpp",
- "cstring": "cpp",
- "cwchar": "cpp",
- "exception": "cpp",
- "initializer_list": "cpp",
- "limits": "cpp",
- "new": "cpp",
- "tuple": "cpp",
- "type_traits": "cpp",
- "utility": "cpp",
- "vector": "cpp",
- "xmemory": "cpp",
- "xstddef": "cpp",
- "xtr1common": "cpp",
- "xtree": "cpp",
- "xutility": "cpp"
- }
-}
\ No newline at end of file
diff --git a/Src Backup/FrameAPI.cpp b/Src Backup/FrameAPI.cpp
deleted file mode 100644
index b99317b..0000000
--- a/Src Backup/FrameAPI.cpp
+++ /dev/null
@@ -1,158 +0,0 @@
-#include "FrameAPI.h"
-#include "Variables.h"
-#include "fcalls.h"
-
-std::unordered_map> frameEventHashTable;
-
-UINT GetOriginFrame(EOriginFrame originframe, UINT index) {
- CGameUI* gameui = GetGameUI();
-
- switch (originframe) {
- case ORIGIN_FRAME_GAME_UI:
- return (UINT)gameui;
- case ORIGIN_FRAME_WORLD_FRAME:
- return (UINT)gameui->WorldFrameWar3;
- case ORIGIN_FRAME_HERO_BAR:
- return (UINT)gameui->HeroBar;
- case ORIGIN_FRAME_HERO_BUTTON:
- return (UINT)GetPanelButton((UINT)gameui->HeroBar, index, 0);
- case ORIGIN_FRAME_HERO_HP_BAR:
- return *(UINT*)((UINT)GetPanelButton((UINT)gameui->HeroBar, index, 0) + 0x1cc);
- case ORIGIN_FRAME_HERO_MANA_BAR:
- return *(UINT*)((UINT)GetPanelButton((UINT)gameui->HeroBar, index, 0) + 0x1d0);
- case ORIGIN_FRAME_HERO_BUTTON_INDICATOR:
- // Undefined
- break;
- case ORIGIN_FRAME_ITEM_BUTTON:
- return *(UINT*)(*(UINT*)(*(UINT*)(gameui->InfoBar + 0x148) + 0x130) + 8 * index + 4);
- case ORIGIN_FRAME_COMMAND_BUTTON:
- return (UINT)GetPanelButton((UINT)gameui->CommandBar, index / 4, index % 4);
- case ORIGIN_FRAME_SYSTEM_BUTTON:
- // Undefined
- break;
- case ORIGIN_FRAME_PORTRAIT:
- return (UINT)gameui->Portrait;
- case ORIGIN_FRAME_MINIMAP:
- return (UINT)gameui->Minimap;
- case ORIGIN_FRAME_MINIMAP_BUTTON:
- return (UINT)gameui->MinimapButtons[index];
- case ORIGIN_FRAME_TOOLTIP:
- return GetTooltipFrame();
- case ORIGIN_FRAME_UBERTOOLTIP:
- // Undefined
- break;
- case ORIGIN_FRAME_CHAT_MSG:
- return (UINT)gameui->ChatMessage;
- case ORIGIN_FRAME_UNIT_MSG:
- return (UINT)gameui->UnitMessage;
- case ORIGIN_FRAME_TOP_MSG:
- return (UINT)gameui->TopMessage;
- default:
- break;
- }
-
- return NULL;
-}
-
-UINT GetPanelButton(UINT frame, BYTE row, BYTE column) {
- return *(UINT*)(*(DWORD*)(16 * row + *((DWORD*)frame + 85) + 8) + 4 * column) - sizeof(CFrame);
-}
-
-UINT GetTooltipFrame(UINT unknown0) {
- return fastcall(MakePtr(gameBase, _getTooltipFrame), unknown0);
-}
-
-BOOL LoadTOCFile(LPCSTR filename) {
- DWORD stringHastTable = MakePtr(gameBase, _stringHastTable);
- DWORD FDFHashTable = MakePtr(gameBase, _FDFHashTable);
-
- if (*(int*)(stringHastTable + 0x14) < 0xFFFF) {
- thiscall(MakePtr(gameBase, _stringHashNodeGrowListArray), stringHastTable, 0xFFFF);
- }
-
- if (*(int*)(FDFHashTable + 0x14) < 0xFFFF) {
- thiscall(MakePtr(gameBase, _baseFrameHashNodeGrowListArray), FDFHashTable, 0xFFFF);
- }
-
- return fastcall(MakePtr(gameBase, _readFDFFile), filename, stringHastTable, FDFHashTable, MakePtr(gameBase, _CFrameDefStatus));
-}
-
-UINT GetFrameByName(LPCSTR framename, UINT id) {
- return fastcall(MakePtr(gameBase, _getCFrameByName), framename, id);
-}
-
-UINT CreateFrame(LPCSTR baseframe, UINT parentframe, EFramePoint point, EFramePoint relativepoint, UINT id) {
- return fastcall(MakePtr(gameBase, _createCFrame), baseframe, parentframe, point, relativepoint, id);
-}
-
-void SetFrameText(UINT frame, LPCSTR text) {
- thiscall(MakePtr(gameBase, _setCFrameText), *(UINT*)(FRAMELAYOUT(frame) + 0x130), text);
-}
-
-void SetFrameTextColor(UINT frame, BYTE red, BYTE green, BYTE blue, BYTE alpha) {
- DWORD color = ((alpha << 24) + (red << 16) + (green << 8) + blue);
- thiscall(MakePtr(gameBase, _setCFrameTextColor), FRAMELAYOUT(frame), &color);
-}
-
-float GetFrameTextHeight(UINT frame) {
- return thiscall(MakePtr(gameBase, _getCFrameTextHeight), FRAMELAYOUT(frame));
-}
-
-void SetFrameWidth(UINT frame, float width) {
- thiscall(MakePtr(gameBase, _setCLayoutFrameWidth), FRAMELAYOUT(frame), width);
-}
-
-void SetFrameHeight(UINT frame, float height) {
- thiscall(MakePtr(gameBase, _setCLayoutFrameHeight), FRAMELAYOUT(frame), height);
-}
-
-void SetFrameSize(UINT frame, float width, float height) {
- SetFrameWidth(frame, width);
- SetFrameHeight(frame, height);
-}
-
-void SetFrameScale(UINT frame, float scale) {
- thiscall(MakePtr(gameBase, _setCLayoutFrameScale), FRAMELAYOUT(frame), scale);
-}
-
-void SetFrameAbsolutePoint(UINT frame, EFramePoint point, float offsetX, float offsetY) {
- thiscall(MakePtr(gameBase, _setCLayoutFrameAbsolutePoint), FRAMELAYOUT(frame), point, offsetX, offsetY, 1);
-}
-
-void SetFramePoint(UINT frame, EFramePoint point, UINT parentframe, EFramePoint relativepoint, float offsetX, float offsetY) {
- thiscall(MakePtr(gameBase, _setCLayoutFramePoint), FRAMELAYOUT(frame), point, FRAMELAYOUT(parentframe), relativepoint, offsetX, offsetY, 1);
-}
-
-float GetFrameWidth(UINT frame) {
- return *(float*)(FRAMELAYOUT(frame) + 0x58);
-}
-
-float GetFrameHeight(UINT frame) {
- return *(float*)(FRAMELAYOUT(frame) + 0x5c);
-}
-
-UINT GetFramePoint(UINT frame, EFramePoint point) {
- return *(UINT*)(FRAMELAYOUT(frame) + 4 * (UINT)point + 8);
-}
-
-UINT GetFramePointParent(UINT frame, EFramePoint point) {
- return *(UINT*)(GetFramePoint(frame, point) + 4);
-}
-
-UINT GetFramePointRelativePoint(UINT frame, EFramePoint point) {
- return *(UINT*)(GetFramePoint(frame, point) + 8);
-}
-
-float GetFramePointX(UINT frame, EFramePoint point) {
- return *(float*)(GetFramePoint(frame, point) + 12);
-}
-
-float GetFramePointY(UINT frame, EFramePoint point) {
- return *(float*)(GetFramePoint(frame, point) + 16);
-}
-
-//---------------------------------------------------------------------------------------
-
-void TriggerRegisterFrameEvent(UINT trigger, UINT frame, EFrameEvent event) {
- frameEventHashTable[event][frame] = trigger;
-}
\ No newline at end of file
diff --git a/Src Backup/FrameAPI.h b/Src Backup/FrameAPI.h
deleted file mode 100644
index 49effa2..0000000
--- a/Src Backup/FrameAPI.h
+++ /dev/null
@@ -1,105 +0,0 @@
-#pragma once
-
-#include "Warcraft.h"
-#include "Mem.h"
-
-enum EFramePoint : UINT
-{
- TopLeft = 0,
- Top = 1,
- TopRight = 2,
- Left = 3,
- Center = 4,
- Right = 5,
- BottomLeft = 6,
- Bottom = 7,
- BottomRight = 8
-};
-
-enum EOriginFrame : UINT {
- ORIGIN_FRAME_GAME_UI,
- ORIGIN_FRAME_WORLD_FRAME,
- ORIGIN_FRAME_HERO_BAR,
- ORIGIN_FRAME_HERO_BUTTON,
- ORIGIN_FRAME_HERO_HP_BAR,
- ORIGIN_FRAME_HERO_MANA_BAR,
- ORIGIN_FRAME_HERO_BUTTON_INDICATOR,
- ORIGIN_FRAME_ITEM_BUTTON,
- ORIGIN_FRAME_COMMAND_BUTTON,
- ORIGIN_FRAME_SYSTEM_BUTTON,
- ORIGIN_FRAME_PORTRAIT,
- ORIGIN_FRAME_MINIMAP,
- ORIGIN_FRAME_MINIMAP_BUTTON,
- ORIGIN_FRAME_TOOLTIP,
- ORIGIN_FRAME_UBERTOOLTIP,
- ORIGIN_FRAME_CHAT_MSG,
- ORIGIN_FRAME_UNIT_MSG,
- ORIGIN_FRAME_TOP_MSG
-};
-
-enum EFrameEvent : UINT {
- FRAMEEVENT_CONTROL_CLICK = 1,
- FRAMEEVENT_MOUSE_ENTER,
- FRAMEEVENT_MOUSE_LEAVE,
- FRAMEEVENT_MOUSE_UP,
- FRAMEEVENT_MOUSE_DOWN,
- FRAMEEVENT_MOUSE_WHEEL,
- FRAMEEVENT_CHECKBOX_CHECKED,
- FRAMEEVENT_CHECKBOX_UNCHECKED,
- FRAMEEVENT_EDITBOX_TEXT_CHANGED,
- FRAMEEVENT_POPUPMENU_ITEM_CHANGED,
- FRAMEEVENT_MOUSE_DOUBLECLICK,
- FRAMEEVENT_SPRITE_ANIM_UPDATE,
- FRAMEEVENT_SLIDER_VALUE_CHANGED,
- FRAMEEVENT_DIALOG_CANCEL,
- FRAMEEVENT_DIALOG_ACCEPT,
- FRAMEEVENT_EDITBOX_ENTER
-};
-
-//DWORD eventType[16] = {MakePtr(gameBase, _frameevent_control_click), MakePtr(gameBase, _frameevent_control_mouseenter) };
-
-UINT GetOriginFrame(EOriginFrame originframe, UINT index);
-
-UINT GetPanelButton(UINT frame, BYTE row, BYTE column);
-
-UINT GetTooltipFrame(UINT unknown0 = NULL);
-
-BOOL LoadTOCFile(LPCSTR filename);
-
-UINT GetFrameByName(LPCSTR framename, UINT id);
-
-UINT CreateFrame(LPCSTR baseframe, UINT parentframe, EFramePoint point, EFramePoint relativepoint, UINT id);
-
-void SetFrameText(UINT frame, LPCSTR text);
-
-void SetFrameTextColor(UINT frame, BYTE red, BYTE green, BYTE blue, BYTE alpha);
-
-float GetFrameTextHeight(UINT frame);
-
-void SetFrameWidth(UINT frame, float width);
-
-void SetFrameHeight(UINT frame, float height);
-
-void SetFrameSize(UINT frame, float width, float height);
-
-void SetFrameScale(UINT frame, float scale);
-
-void SetFrameAbsolutePoint(UINT frame, EFramePoint point, float offsetX, float offsetY);
-
-void SetFramePoint(UINT frame, EFramePoint point, UINT parentframe, EFramePoint relativepoint, float offsetX, float offsetY);
-
-float GetFrameWidth(UINT frame);
-
-float GetFrameHeight(UINT frame);
-
-UINT GetFramePointParent(UINT frame, EFramePoint point);
-
-UINT GetFramePointRelativePoint(UINT frame, EFramePoint point);
-
-float GetFramePointX(UINT frame, EFramePoint point);
-
-float GetFramePointY(UINT frame, EFramePoint point);
-
-//---------------------------------------------------------------------------------------
-
-void TriggerRegisterFrameEvent(UINT trigger, UINT frame, EFrameEvent event);
\ No newline at end of file
diff --git a/Src Backup/Hooks.cpp b/Src Backup/Hooks.cpp
deleted file mode 100644
index da1cfa1..0000000
--- a/Src Backup/Hooks.cpp
+++ /dev/null
@@ -1,58 +0,0 @@
-#include "Hooks.h"
-
-#include "Variables.h"
-#include "Mem.h"
-#include "LuaMachine.h"
-#include
-
-DWORD __fastcall jassEntryPoint(DWORD a) {
- return (fastcall(MakePtr(gameBase, _jassEntryPointProc), a), startLua());
-}
-
-DWORD __stdcall getWarcraftID()
-{
- return *(DWORD*)GAME_ID;
-}
-
-BOOL __fastcall isFrameValid(UINT frame, UINT, UINT eventcode) {
- for (const auto& event : frameEventHashTable) {
- for (const auto& eventframe : event.second) {
- if (eventframe.first == frame) {
- // our code
-
- return TRUE;
- }
- }
- }
-
- if (!*(DWORD*)(frame + 8)) {
- return FALSE;
- }
-
- return thiscall(MakePtr(gameBase, 0x62a1c0), *(DWORD*)(frame + 8), eventcode, 0);
-}
-
-BOOL __fastcall frameEventObserver(UINT frame, UINT, DWORD eventaddress) {
- if (frameEventHashTable[(EFrameEvent)(*(DWORD*)(eventaddress + 8) - 0x40090063)].find(frame) != frameEventHashTable[(EFrameEvent)(*(DWORD*)(eventaddress + 8) - 0x40090063)].end()) {
- if (!running) {
- return FALSE;
- }
-
- lua_State* l = getMainLuaState();
- getFunctionByRef(l, frameEventHashTable[(EFrameEvent)(*(DWORD*)(eventaddress + 8) - 0x40090063)][frame]);
- lua_State* thread = createThread(l, -1);
- lua_xmove(l, thread, 1);
-
- int res;
- switch (lua_resume(thread, l, 0, &res)) {
- case LUA_ERRRUN:
- lua_throwerr(thread);
-
- break;
- }
-
- return TRUE;
- }
-
- return thiscall(*(DWORD*)(*(DWORD*)frame + 0x14), frame, *(DWORD*)(eventaddress + 8), eventaddress);
-}
\ No newline at end of file
diff --git a/Src Backup/Hooks.h b/Src Backup/Hooks.h
deleted file mode 100644
index 19103cf..0000000
--- a/Src Backup/Hooks.h
+++ /dev/null
@@ -1,11 +0,0 @@
-#pragma once
-
-#include
-
-DWORD __fastcall jassEntryPoint(DWORD a);
-
-DWORD __stdcall getWarcraftID();
-
-BOOL __fastcall isFrameValid(UINT frame, UINT, UINT eventcode);
-
-BOOL __fastcall frameEventObserver(UINT frame, UINT, DWORD eventaddress);
\ No newline at end of file
diff --git a/Src Backup/JassMachine.cpp b/Src Backup/JassMachine.cpp
deleted file mode 100644
index 0b11610..0000000
--- a/Src Backup/JassMachine.cpp
+++ /dev/null
@@ -1,44 +0,0 @@
-#include "JassMachine.h"
-
-#include "Variables.h"
-#include "Mem.h"
-#include "LuaMachine.h"
-
-DWORD OPCODES_FUNCTIONS[44];
-
-DWORD _declspec(naked) jassOpcodeStartLuaThread() {
- _asm {
- push edi
- push esi
- call startLuaThread
-
- sub esp, 8
- mov[esp], eax
- add esp, 8
- mov eax, gameBase
- add eax, 0x45f79a
- push eax
- sub esp, 4
- pop eax
-
- ret
- }
-}
-// game.dll + 45969d
-void jassOpcodeInitialize() {
- DWORD overflow = MakePtr(gameBase, _overflowOpcodeProc);
- memcpy(OPCODES_FUNCTIONS, (LPVOID)MakePtr(gameBase, _opcodeList), sizeof(OPCODES_FUNCTIONS));
- OPCODES_FUNCTIONS[42] = overflow;
- OPCODES_FUNCTIONS[43] = (DWORD)jassOpcodeStartLuaThread; // My own opcode function
-
- DWORD dwOldProtect;
- DWORD address = MakePtr(gameBase, _opcodeListSize);
- VirtualProtect((LPVOID)address, 1, PAGE_EXECUTE_READWRITE, &dwOldProtect);
- *(BYTE*)address = sizeof(OPCODES_FUNCTIONS) / 4 - 1;
- VirtualProtect((LPVOID)address, 1, dwOldProtect, &dwOldProtect);
-
- address = MakePtr(gameBase, _opcodeSwitch);
- VirtualProtect((LPVOID)address, 4, PAGE_EXECUTE_READWRITE, &dwOldProtect);
- *(DWORD*)address = (DWORD)OPCODES_FUNCTIONS;
- VirtualProtect((LPVOID)address, 4, dwOldProtect, &dwOldProtect);
-}
\ No newline at end of file
diff --git a/Src Backup/JassMachine.h b/Src Backup/JassMachine.h
deleted file mode 100644
index 0d2a12b..0000000
--- a/Src Backup/JassMachine.h
+++ /dev/null
@@ -1,148 +0,0 @@
-#pragma once
-
-#include
-#include
-
-#include "Warcraft.h"
-
-enum OPCODES {
- OPTYPE_MINLIMIT = 0x00,
- OPTYPE_ENDPROGRAM = 0x01,
- OPTYPE_OLDJUMP = 0x02,
- OPTYPE_FUNCTION = 0x03,
- OPTYPE_ENDFUNCTION = 0x04,
- OPTYPE_LOCAL = 0x05,
- OPTYPE_GLOBAL = 0x06,
- OPTYPE_CONSTANT = 0x07,
- OPTYPE_FUNCARG = 0x08,
- OPTYPE_EXTENDS = 0x09,
- OPTYPE_TYPE = 0x0A,
- OPTYPE_POPN = 0x0B,
- OPTYPE_MOVRLITERAL = 0x0C,
- OPTYPE_MOVRR = 0x0D,
- OPTYPE_MOVRV = 0x0E,
- OPTYPE_MOVRCODE = 0x0F,
- OPTYPE_MOVRA = 0x10,
- OPTYPE_MOVVR = 0x11,
- OPTYPE_MOVAR = 0x12,
- OPTYPE_PUSH = 0x13,
- OPTYPE_POP = 0x14,
- OPTYPE_CALLNATIVE = 0x15,
- OPTYPE_CALLJASS = 0x16,
- OPTYPE_I2R = 0x17,
- OPTYPE_AND = 0x18,
- OPTYPE_OR = 0x19,
- OPTYPE_EQUAL = 0x1A,
- OPTYPE_NOTEQUAL = 0x1B,
- OPTYPE_LESSEREQUAL = 0x1C,
- OPTYPE_GREATEREQUAL = 0x1D,
- OPTYPE_LESSER = 0x1E,
- OPTYPE_GREATER = 0x1F,
- OPTYPE_ADD = 0x20,
- OPTYPE_SUB = 0x21,
- OPTYPE_MUL = 0x22,
- OPTYPE_DIV = 0x23,
- OPTYPE_MOD = 0x24,
- OPTYPE_NEGATE = 0x25,
- OPTYPE_NOT = 0x26,
- OPTYPE_RETURN = 0x27,
- OPTYPE_LABEL = 0x28,
- OPTYPE_JUMPIFTRUE = 0x29,
- OPTYPE_JUMPIFFALSE = 0x2A,
- OPTYPE_JUMP = 0x2B,
- OPTYPE_MAXLIMIT = 0x2C,
- OPTYPE_STARTLUATHREAD = 0x2D
-};
-
-enum OPCODE_VARIABLE_TYPE {
- OPCODE_VARIABLE_NOTHING = 0,
- OPCODE_VARIABLE_UNKNOWN,
- OPCODE_VARIABLE_NULL,
- OPCODE_VARIABLE_CODE,
- OPCODE_VARIABLE_INTEGER,
- OPCODE_VARIABLE_REAL,
- OPCODE_VARIABLE_STRING,
- OPCODE_VARIABLE_HANDLE,
- OPCODE_VARIABLE_BOOLEAN,
- OPCODE_VARIABLE_INTEGER_ARRAY,
- OPCODE_VARIABLE_REAL_ARRAY,
- OPCODE_VARIABLE_STRING_ARRAY,
- OPCODE_VARIABLE_HANDLE_ARRAY,
- OPCODE_VARIABLE_BOOLEAN_ARRAY
-};
-
-#ifndef _JassMachine_h
-#define _JassMachine_h
-typedef struct {
- DWORD unk;
- DWORD zero1;
- DWORD zero2;
- DWORD zero3;
- DWORD zero4;
- DWORD zero5;
- DWORD type1;
- DWORD type2;
- DWORD value;
- DWORD zero6;
-
- void set(DWORD value, OPCODE_VARIABLE_TYPE type) {
- this->value = value;
- type1 = type;
- type2 = type;
- }
-
-} JASS_DATA_SLOT, * PJASS_DATA_SLOT;
-
-typedef struct {
-private:
- DWORD unk1;
- DWORD unk2;
- size_t stack_top; // Idk why it's here
- PJASS_DATA_SLOT stack[32];
- size_t size;
-public:
- PJASS_DATA_SLOT pop() {
- return stack[--size];
- }
-
- PJASS_DATA_SLOT& operator[](size_t index) {
- return stack[index];
- }
-
- void clear(size_t number) {
- size = number < size ? size - number : 0;
- }
-
- size_t Size() {
- return size;
- }
-} JASS_STACK, * PJASS_STACK;
-
-typedef struct {
-private:
- std::vector oplist;
-public:
- void addop(BYTE opcode, BYTE reg = 0, DWORD value = NULL, BYTE type = OPCODE_VARIABLE_NOTHING, BYTE rettype = OPCODE_VARIABLE_NOTHING) {
- JASS_OPCODE* _opcode = new JASS_OPCODE;
- _opcode->rettype = rettype;
- _opcode->type = type;
- _opcode->reg = reg;
- _opcode->opcode = opcode;
- _opcode->value = value;
-
- oplist.push_back(*_opcode);
- }
-
- DWORD getcode() {
- //return (DWORD)oplist.data();
- //printf("%08X\n", getJassMachine());
-
- return ((DWORD)&oplist - (DWORD)getJassMachine()->code_table->codes) / 4;
- }
-
-} JASS_OPLIST, * PJASS_OPLIST;
-#endif
-
-//---------------------------------------------------------
-
-void jassOpcodeInitialize();
\ No newline at end of file
diff --git a/Src Backup/JassNatives.cpp b/Src Backup/JassNatives.cpp
deleted file mode 100644
index 95aee39..0000000
--- a/Src Backup/JassNatives.cpp
+++ /dev/null
@@ -1,156 +0,0 @@
-#include "JassNatives.h"
-
-#include "Variables.h"
-#include "Mem.h"
-#include "JassMachine.h"
-
-std::map jassnatives;
-std::map triggers;
-
-DWORD to_Code(lua_State* l, int index) {
- DWORD key = (DWORD)lua_topointer(l, index);
-
- auto it = triggers.find(key);
-
- if (it != triggers.end()) {
- return (DWORD)&it->second;
- }
-
- JASS_OPLIST& oplist = triggers[key];
-
- BYTE reg = 0xD8;
- oplist.addop(OPTYPE_MOVRLITERAL, reg, pushFunctionRef(l, index), OPCODE_VARIABLE_INTEGER);
- oplist.addop(OPTYPE_PUSH, reg);
- oplist.addop(OPTYPE_MOVRLITERAL, reg, (DWORD)l, OPCODE_VARIABLE_INTEGER);
- oplist.addop(OPTYPE_PUSH, reg);
- oplist.addop(OPTYPE_STARTLUATHREAD);
- oplist.addop(OPTYPE_MOVRR);
- oplist.addop(OPTYPE_RETURN);
-
- return oplist.getcode();
-}
-
-//---------------------------------------------------------
-
-
-#pragma pack(push)
-#pragma pack(1)
-struct asm_opcode_5 {
- BYTE opcode;
- DWORD value;
-};
-#pragma pack(pop)
-
-struct asm_register_native_function {
-private:
- asm_opcode_5 push;
- asm_opcode_5 mov_edx;
- asm_opcode_5 mov_ecx;
- asm_opcode_5 call;
-public:
- bool verify() {
- return ((push.opcode == 0x68) && (mov_edx.opcode == 0xBA) && (mov_ecx.opcode == 0xB9) && (call.opcode == 0xE8));
- }
-
- const char* get_params() {
- return (const char*)(push.value);
- }
-
- const char* get_name() {
- return (const char*)(mov_edx.value);
- }
-
- uintptr_t get_address() {
- return (uintptr_t)(mov_ecx.value);
- }
-};
-
-//---------------------------------------------------------
-
-JASSNATIVE::JASSNATIVE(DWORD address, LPCSTR params) : _address(address) {
- LPCSTR it = params++;
- bool is_end = false;
-
- for (; *it; it++) {
- if (*it == ')') {
- is_end = true;
- }
- else if (isupper(*it)) {
- if (is_end) {
- _rettype = (JASS_TYPE)*it;
-
- break;
- }
- else {
- _params.push_back((JASS_TYPE)*it);
- }
- }
- }
-}
-
-JASSNATIVE::JASSNATIVE() : _address(NULL), _rettype(TYPE_NONE) {}
-
-bool JASSNATIVE::is_valid() {
- return _rettype != TYPE_NONE ? true : false;
-}
-
-bool JASSNATIVE::is_sleep() {
- return has_sleep;
-}
-
-void JASSNATIVE::set_sleep(bool sleep) {
- has_sleep = sleep;
-}
-
-const std::vector& JASSNATIVE::get_params() {
- return _params;
-}
-
-const JASS_TYPE& JASSNATIVE::get_rettype() {
- return _rettype;
-}
-
-DWORD JASSNATIVE::get_address() {
- return _address;
-}
-
-DWORD JASSNATIVE::call(DWORD* params, int size) {
- uintptr_t func_address = _address;
- DWORD retval;
- uintptr_t esp_ptr;
- size_t params_size = size * sizeof DWORD;
-
- _asm {
- sub esp, params_size
- mov esp_ptr, esp
- }
-
- memcpy((LPVOID)esp_ptr, params, params_size);
-
- _asm {
- call[func_address]
- mov esp, esp_ptr
- add esp, params_size
- mov retval, eax
- }
-
- return retval;
-}
-
-//---------------------------------------------------------
-
-JASSNATIVE& get_native(LPCSTR lpName) {
- for (auto& e : jassnatives) {
- if (!strcmp(e.first, lpName)) {
- return e.second;
- }
- }
-
- return *(JASSNATIVE*)NULL;
-}
-
-void jassNativesInitialize() {
- for (asm_register_native_function* ptr = (asm_register_native_function*)MakePtr(gameBase, _jassNativesList); ptr->verify(); ptr++) {
- jassnatives[ptr->get_name()] = JASSNATIVE(ptr->get_address(), ptr->get_params());
- }
-}
\ No newline at end of file
diff --git a/Src Backup/JassNatives.h b/Src Backup/JassNatives.h
deleted file mode 100644
index 7d70df0..0000000
--- a/Src Backup/JassNatives.h
+++ /dev/null
@@ -1,189 +0,0 @@
-#pragma once
-
-#include
-#include
-
-#include "LuaMachine.h"
-
-typedef void jNothing;
-typedef UINT32 jBoolean;
-typedef UINT32 jCode;
-typedef UINT32 jHandle;
-typedef INT32 jInteger;
-typedef UINT32 jReal;
-typedef UINT32 jString;
-typedef UINT32 jTrigger;
-
-const jBoolean jTrue = 1;
-const jBoolean jFalse = 0;
-const jHandle jNull = 0;
-
-typedef DWORD HUNIT;
-typedef DWORD HWIDGET;
-typedef DWORD HLIGHTNING;
-typedef DWORD HPLAYER;
-typedef DWORD HEFFECT;
-typedef DWORD HLOCATION;
-typedef DWORD HEFFECTTYPE;
-typedef DWORD HRECT;
-typedef DWORD HWEATHEREFFECT;
-typedef DWORD HCAMERAFIELD;
-typedef DWORD HBOOLEXPR;
-typedef DWORD HSOUND;
-typedef DWORD HCAMERASETUP;
-typedef DWORD HITEMTYPE;
-typedef DWORD HCONDITIONFUNC;
-typedef DWORD HAIDIFFICULTY;
-typedef DWORD HALLIANCETYPE;
-typedef DWORD HATTACKTYPE;
-typedef DWORD HBLENDMODE;
-typedef DWORD HDAMAGETYPE;
-typedef DWORD HDIALOGEVENT;
-typedef DWORD HFGAMESTATE;
-typedef DWORD HFOGSTATE;
-typedef DWORD HGAMEDIFFICULTY;
-typedef DWORD HGAMEEVENT;
-typedef DWORD HGAMESPEED;
-typedef DWORD HGAMETYPE;
-typedef DWORD HIGAMESTATE;
-typedef DWORD HLIMITOP;
-typedef DWORD HMAPCONTROL;
-typedef DWORD HMAPDENSITY;
-typedef DWORD HMAPFLAG;
-typedef DWORD HMAPSETTING;
-typedef DWORD HMAPVISIBILITY;
-typedef DWORD HPATHINGTYPE;
-typedef DWORD HPLACEMENT;
-typedef DWORD HPLAYERCOLOR;
-typedef DWORD HPLAYEREVENT;
-typedef DWORD HPLAYERGAMERESULT;
-typedef DWORD HPLAYERSCORE;
-typedef DWORD HPLAYERSLOTSTATE;
-typedef DWORD HPLAYERSTATE;
-typedef DWORD HPLAYERUNITEVENT;
-typedef DWORD HRACE;
-typedef DWORD HRACEPREFERENCE;
-typedef DWORD HRARITYCONTROL;
-typedef DWORD HSOUNDTYPE;
-typedef DWORD HSTARTLOCPRIO;
-typedef DWORD HTEXMAPFLAGS;
-typedef DWORD HUNITEVENT;
-typedef DWORD HUNITSTATE;
-typedef DWORD HUNITTYPE;
-typedef DWORD HVERSION;
-typedef DWORD HVOLUMEGROUP;
-typedef DWORD HWEAPONTYPE;
-typedef DWORD HWIDGETEVENT;
-typedef DWORD HDESTRUCTABLE;
-typedef DWORD HDEFEATCONDITION;
-typedef DWORD HFOGMODIFIER;
-typedef DWORD HFORCE;
-typedef DWORD HGROUP;
-typedef DWORD HIMAGE;
-typedef DWORD HITEM;
-typedef DWORD HITEMPOOL;
-typedef DWORD HLEADERBOARD;
-typedef DWORD HMULTIBOARD;
-typedef DWORD HQUEST;
-typedef DWORD HREGION;
-typedef DWORD HTEXTTAG;
-typedef DWORD HTIMER;
-typedef DWORD HTIMERDIALOG;
-typedef DWORD HTRACKABLE;
-typedef DWORD HUBERSPLAT;
-typedef DWORD HUNITPOOL;
-typedef DWORD HFILTERFUNC;
-typedef DWORD HDIALOG;
-typedef DWORD HBUTTON;
-typedef DWORD HHASHTABLE;
-typedef DWORD HGAMECACHE;
-typedef DWORD HGAMESTATE;
-typedef DWORD HHANDLE;
-typedef DWORD HABILITY;
-typedef DWORD HEVENTID;
-typedef DWORD HQUESTITEM;
-typedef DWORD HMULTIBOARDITEM;
-typedef DWORD HTRIGGERACTION;
-typedef DWORD HTRIGGERCONDITION;
-typedef DWORD HEVENT;
-typedef DWORD HAGENT;
-typedef DWORD HTERRAINDEFORMATION;
-
-enum JASS_TYPE {
- TYPE_NONE = 0,
- TYPE_BOOLEAN = 'B',
- TYPE_CODE = 'C',
- TYPE_HANDLE = 'H',
- TYPE_INTEGER = 'I',
- TYPE_REAL = 'R',
- TYPE_STRING = 'S',
- TYPE_NOTHING = 'V',
-};
-
-inline jReal to_jReal(float fX) {
- return *(jReal*)&fX;
-}
-
-inline float from_jReal(jReal val) {
- return *(float*)&val;
-}
-
-inline jString to_jString(LPCSTR lpString) {
- UINT32* string = new UINT32[8];
-
- string[2] = (UINT32)&string[0];
- string[7] = (UINT32)&lpString[0];
-
- return (jString)string;
-}
-
-inline LPCSTR from_jString(jString string) {
- if (!string) {
- return NULL;
- }
-
- string = ((jString*)string)[2];
-
- if (!string) {
- return NULL;
- }
-
- return (LPCSTR)((jString*)string)[7];
-}
-
-DWORD to_Code(lua_State* l, int index);
-
-inline jInteger to_ID(LPCSTR lpID) {
- return (lpID[0] << 24) + (lpID[1] << 16) + (lpID[2] << 8) + lpID[3];
-}
-
-//---------------------------------------------------------
-
-#ifndef _JassNatives_h
-#define _JassNatives_h
-class JASSNATIVE {
-public:
- JASSNATIVE(DWORD address, LPCSTR params);
- JASSNATIVE();
-
- bool is_valid();
- bool is_sleep();
- void set_sleep(bool sleep);
- const std::vector& get_params();
- const JASS_TYPE& get_rettype();
- DWORD get_address();
-
- DWORD call(DWORD* params, int size);
-private:
- DWORD _address;
- std::vector _params;
- JASS_TYPE _rettype;
- bool has_sleep = false;
-};
-#endif
-
-//---------------------------------------------------------
-
-JASSNATIVE& get_native(LPCSTR lpName);
-
-void jassNativesInitialize();
\ No newline at end of file
diff --git a/Src Backup/LuaMachine.cpp b/Src Backup/LuaMachine.cpp
deleted file mode 100644
index bccce79..0000000
--- a/Src Backup/LuaMachine.cpp
+++ /dev/null
@@ -1,438 +0,0 @@
-#include "LuaMachine.h"
-
-#include
-#include
-#pragma comment(lib, "storm.lib")
-
-#include "Variables.h"
-#include "LuaRegister.h"
-#include "Warcraft.h"
-#include "Mem.h"
-
-lua_State* mainLuaState = NULL;
-bool running = false;
-
-
-//---------------------------------------------------------------------------------
-// Utils
-
-BOOL isInGameCatalog(LPCSTR fileName) {
- char filepath[MAX_PATH] = { 0 };
- GetFullPathName(fileName, sizeof(filepath), filepath, NULL);
-
- char path[MAX_PATH] = { 0 };
- GetModuleFileName(GetModuleHandle(NULL), path, sizeof(path));
- for (int i = strlen(path); path[i] != '\\'; path[i] = NULL, i--);
-
- return !_strnicmp(filepath, path, strlen(path)) ? TRUE : FALSE;
-}
-
-BOOL isAllowedExtension(LPCSTR fileName) {
- char* fileextension = (char*)fileName + strlen(fileName);
-
- for (; fileextension[0] != '.'; fileextension--);
- fileextension++;
-
- std::vector extensions = { "exe", "dll", "asi", "mix", "m3d", "mpq", "w3x", "w3m", "w3n" };
- for (const auto& extension : extensions) {
- if (!_strnicmp(fileextension, extension, strlen(extension))) {
- return FALSE;
- }
- }
-
- return TRUE;
-}
-
-//---------------------------------------------------------------------------------
-// File stream only in catalog
-
-// Open
-luaL_Stream* newprefile(lua_State* L) {
- luaL_Stream* p = (luaL_Stream*)lua_newuserdatauv(L, sizeof(luaL_Stream), 0);
- p->closef = NULL;
- luaL_setmetatable(L, LUA_FILEHANDLE);
- return p;
-}
-
-int io_fclose(lua_State* L) {
- luaL_Stream* p = (luaL_Stream*)luaL_checkudata(L, 1, LUA_FILEHANDLE);
- int res = fclose(p->f);
- return luaL_fileresult(L, (res == 0), NULL);
-}
-
-luaL_Stream* newfile(lua_State* L) {
- luaL_Stream* p = newprefile(L);
- p->f = NULL;
- p->closef = &io_fclose;
- return p;
-}
-
-int l_checkmode(const char* mode) {
- return (*mode != '\0' && strchr("rwa", *(mode++)) != NULL && (*mode != '+' || ((void)(++mode), 1)) && (strspn(mode, "b") == strlen(mode)));
-}
-
-int io_open(lua_State* L) {
- const char* filename = luaL_checkstring(L, 1);
- const char* mode = luaL_optstring(L, 2, "r");
-
- if (!isInGameCatalog(filename) || !isAllowedExtension(filename)) {
- return luaL_fileresult(L, FALSE, filename);
- }
-
- luaL_Stream* p = newfile(L);
- const char* md = mode;
- luaL_argcheck(L, l_checkmode(md), 2, "invalid mode");
- fopen_s(&(p->f), filename, mode);
- return (p->f == NULL) ? luaL_fileresult(L, 0, filename) : 1;
-}
-
-// Remove
-int os_remove(lua_State* L) {
- const char* filename = luaL_checkstring(L, 1);
-
- if (!isInGameCatalog(filename) || !isAllowedExtension(filename)) {
- return luaL_fileresult(L, FALSE, filename);
- }
-
- return luaL_fileresult(L, remove(filename) == 0, filename);
-}
-
-// Rename
-int os_rename(lua_State* L) {
- const char* fromname = luaL_checkstring(L, 1);
- const char* toname = luaL_checkstring(L, 2);
-
- if (!isInGameCatalog(fromname) || !isAllowedExtension(fromname) || !isInGameCatalog(toname) || !isAllowedExtension(toname)) {
- return luaL_fileresult(L, FALSE, NULL);
- }
-
- return luaL_fileresult(L, rename(fromname, toname) == 0, NULL);
-}
-
-void lua_replaceFileStreamFunctions(lua_State* l) {
- lua_getglobal(l, "io");
- lua_pushcfunction(l, io_open);
- lua_setfield(l, -2, "open");
-
- lua_pop(l, 1);
-
- lua_getglobal(l, "os");
- lua_pushcfunction(l, os_remove);
- lua_setfield(l, -2, "remove");
-
- lua_pushcfunction(l, os_rename);
- lua_setfield(l, -2, "rename");
-
- lua_pop(l, 1);
-}
-
-//---------------------------------------------------------------------------------
-// Disabled functions
-
-void disable_functions(lua_State* l) {
- lua_getglobal(l, "os");
-
- std::vector functions = { "execute", "getenv", "setlocale", "tmpname" };
-
- for (const auto& function : functions) {
- lua_pushnil(l);
- lua_setfield(l, -2, function);
- }
-
- lua_pop(l, 1);
-
- lua_getglobal(l, "io");
-
- functions = { "stdin", "stdout", "stderr", "flush", "input", "lines", "output", "popen", "tmpfile", "type" };
-
- for (const auto& function : functions) {
- lua_pushnil(l);
- lua_setfield(l, -2, function);
- }
-
- lua_pop(l, 1);
-
- lua_pushnil(l);
- lua_setglobal(l, "dofile");
-
-}
-
-//---------------------------------------------------------------------------------
-// Loader lua from mpq
-
-
-// Lua
-int checkload(lua_State* L, int stat, const char* filename) {
- if (stat) {
- lua_pushstring(L, filename);
- return 2;
- }
- else {
- return luaL_error(L, "error loading module '%s' from file '%s':\n\t%s", lua_tostring(L, 1), filename, lua_tostring(L, -1));
- }
-}
-
-int searcher_Lua(lua_State* l) {
- HANDLE map = *(HANDLE*)MakePtr(gameBase, _mapMPQ);
-
- std::string scriptName = luaL_checkstring(l, 1) + std::string(".lua");
- lua_pop(l, 1);
-
- char mapName[MAX_PATH] = { 0 };
- SFileGetArchiveName(map, mapName, sizeof(mapName));
- std::string scriptPath = mapName;
-
- for (size_t i = scriptPath.size(); i > 0; i--) {
- if (scriptPath[i] == '\\') {
- scriptPath = scriptPath.substr(i + 1);
-
- break;
- }
- }
-
- scriptPath = "(" + scriptPath + "):\\" + scriptName;
-
- HANDLE script;
- if (SFileOpenFileEx(map, scriptName.c_str(), NULL, &script)) {
- int lenght = SFileGetFileSize(script, NULL);
- char* buffer = new char[lenght + 1];
-
- ZeroMemory(buffer, lenght + 1);
-
- SFileReadFile(script, buffer, lenght, NULL, NULL);
- SFileCloseFile(script);
-
- int result = checkload(l, (luaL_loadbuffer(l, buffer, strlen(buffer), ("@" + scriptPath).c_str()) == LUA_OK), scriptName.c_str());
- delete[] buffer;
-
- return result;
- }
-
- lua_pushstring(l, std::string("no file '" + scriptPath + "'").c_str());
-
- return 1;
-}
-
-void lua_replaceSearchers(lua_State* l) {
- std::vector searchers;
-
- lua_getglobal(l, "package");
- lua_getfield(l, -1, "searchers");
-
- lua_rawgeti(l, -1, 1);
- searchers.push_back(lua_tocfunction(l, -1));
- lua_pop(l, 2);
-
- searchers.push_back(searcher_Lua);
-
- lua_newtable(l);
-
- for (size_t i = 0; i < searchers.size(); i++) {
- lua_pushvalue(l, -2);
- lua_pushcclosure(l, searchers[i], 1);
- lua_rawseti(l, -2, i + 1);
- }
-
- lua_setfield(l, -2, "searchers");
-
- lua_pop(l, 1);
- searchers.clear();
-}
-
-//---------------------------------------------------------------------------------
-
-lua_State* getMainLuaState() {
- if (!mainLuaState) {
- lua_State* l = mainLuaState = luaL_newstate();
-
- luaL_openlibs(l);
- disable_functions(l);
- lua_open_jassnatives(l);
- lua_open_warcraftfunctions(l);
- lua_replaceSearchers(l);
- lua_replaceFileStreamFunctions(l);
- }
-
- return mainLuaState;
-}
-
-lua_State* createThread(lua_State* l, int index) {
- lua_pushvalue(l, index);
- getGlobalTable(l, "_LUA_THREADS", false);
- lua_pushvalue(l, -2);
-
- if (lua_rawget(l, -2) != LUA_TTHREAD) {
- lua_pop(l, 1);
- lua_newthread(l);
- lua_pushvalue(l, -3);
- lua_pushvalue(l, -2);
- lua_rawset(l, -4);
- }
-
- lua_State* thread = lua_tothread(l, -1);
- lua_pop(l, 3);
-
- return thread;
-}
-
-void clearScreen() {
- HANDLE hStdOut;
- CONSOLE_SCREEN_BUFFER_INFO csbi;
- DWORD count;
- DWORD cellCount;
- COORD homeCoords = { 0, 0 };
-
- hStdOut = GetStdHandle(STD_OUTPUT_HANDLE);
-
- if (hStdOut == INVALID_HANDLE_VALUE) {
- return;
- }
-
- if (!GetConsoleScreenBufferInfo(hStdOut, &csbi)) {
- return;
- }
-
- cellCount = csbi.dwSize.X * csbi.dwSize.Y;
-
- if (!FillConsoleOutputCharacter(hStdOut, ' ', cellCount, homeCoords, &count)) {
- return;
- }
-
- if (!FillConsoleOutputAttribute(hStdOut, csbi.wAttributes, cellCount, homeCoords, &count)) {
- return;
- }
-
- SetConsoleCursorPosition(hStdOut, homeCoords);
-}
-
-void destroyMainLuaState()
-{
- if (mainLuaState) {
- lua_close(mainLuaState);
- mainLuaState = NULL;
- running = false;
- triggers.clear();
- frameEventHashTable.clear();
- }
-
- clearScreen();
-}
-
-lua_State* getMainThread(lua_State* thread) {
- lua_rawgeti(thread, LUA_REGISTRYINDEX, LUA_RIDX_MAINTHREAD);
- lua_State* l = lua_tothread(thread, -1);
- lua_pop(thread, 1);
-
- return l;
-}
-
-BOOL getGlobalTable(lua_State* l, LPCSTR name, bool weak) {
- lua_getfield(l, LUA_REGISTRYINDEX, name);
-
- if (!lua_istable(l, -1)) {
- lua_pop(l, 1);
- lua_newtable(l);
-
- if (weak) {
- lua_newtable(l);
- lua_pushstring(l, "__mode");
- lua_pushstring(l, "kv");
- lua_rawset(l, -3);
-
- lua_setmetatable(l, -2);
- }
-
- lua_pushvalue(l, -1);
- lua_setfield(l, LUA_REGISTRYINDEX, name);
-
- return FALSE;
- }
-
- return TRUE;
-}
-
-int pushFunctionRef(lua_State* l, int index) {
- lua_pushvalue(l, index);
- getGlobalTable(l, "_LUA_FUNCTIONS_REF", false);
-
- int ref = (int)lua_rawlen(l, -1);
- lua_pushvalue(l, -2);
- lua_rawseti(l, -2, ++ref);
-
- lua_pop(l, 2);
-
- return ref;
-}
-
-void getFunctionByRef(lua_State* l, int ref) {
- getGlobalTable(l, "_LUA_FUNCTIONS_REF", false);
- lua_rawgeti(l, -1, ref);
- lua_remove(l, -2);
-}
-
-void lua_throwerr(lua_State* l) {
- running = false;
-
- LPCSTR error = lua_tostring(l, -1);
- printf("--------------------Lua Error--------------------\n%s\n-------------------------------------------------\n\n", error);
- MessageBox(FindWindow("Warcraft III", NULL), error, "Lua Error", MB_ICONHAND | MB_TOPMOST );
-}
-
-LUA stacktrace(lua_State* L)
-{
- luaL_traceback(L, L, lua_tostring(L, -1), 0);
-
- return 1;
-}
-
-DWORD startLua() {
- destroyMainLuaState();
-
- lua_State* l = getMainLuaState();
-
- HANDLE war3luaScript;
-
- if (SFileOpenFileEx(*(HANDLE*)MakePtr(gameBase, _mapMPQ), "war3map.lua", NULL, &war3luaScript)) {
- SFileCloseFile(war3luaScript);
-
- running = true;
-
- lua_pushcfunction(l, stacktrace);
- lua_getglobal(l, "require");
- lua_pushstring(l, "war3map");
- if (lua_pcall(l, 1, LUA_MULTRET, -3) != LUA_OK) {
- lua_throwerr(l);
- }
-
- lua_pop(l, 1);
- }
-
- return 0;
-}
-
-BOOL __stdcall startLuaThread(DWORD esi, DWORD edi) {
- if (!running) {
- return FALSE;
- }
-
- PJASS_STACK stack = (PJASS_STACK) * (DWORD*)(esi + 0x2868);
-
- lua_State* l = (lua_State*)stack->pop()->value;
- getFunctionByRef(l, stack->pop()->value);
- lua_State* thread = createThread(l, -1);
- lua_xmove(l, thread, 1);
-
- int res;
- switch (lua_resume(thread, l, 0, &res)) {
- case LUA_OK:
- ((PJASS_DATA_SLOT)(esi + 80))->set(lua_toboolean(thread, 1), OPCODE_VARIABLE_BOOLEAN);
-
- break;
- case LUA_ERRRUN:
- lua_throwerr(thread);
-
- break;
- }
-
- return TRUE;
-}
\ No newline at end of file
diff --git a/Src Backup/LuaMachine.h b/Src Backup/LuaMachine.h
deleted file mode 100644
index 30eea9d..0000000
--- a/Src Backup/LuaMachine.h
+++ /dev/null
@@ -1,28 +0,0 @@
-#pragma once
-
-#include
-
-#include
-#pragma comment(lib, "lua.lib")
-
-typedef int LUA;
-
-lua_State* getMainLuaState();
-
-void destroyMainLuaState();
-
-lua_State* getMainThread(lua_State* thread);
-
-lua_State* createThread(lua_State* l, int index);
-
-void lua_throwerr(lua_State* l);
-
-BOOL getGlobalTable(lua_State* l, LPCSTR name, bool weak);
-
-int pushFunctionRef(lua_State* l, int index);
-
-void getFunctionByRef(lua_State* l, int ref);
-
-DWORD startLua();
-
-BOOL CALLBACK startLuaThread(DWORD esi, DWORD edi);
\ No newline at end of file
diff --git a/Src Backup/LuaRegister.cpp b/Src Backup/LuaRegister.cpp
deleted file mode 100644
index 328f332..0000000
--- a/Src Backup/LuaRegister.cpp
+++ /dev/null
@@ -1,405 +0,0 @@
-#include "LuaRegister.h"
-
-#include "WarcraftFunctions.h"
-#include "Variables.h"
-#include "Warcraft.h"
-#include "JassNatives.h"
-#include "FrameAPI.h"
-
-#define lua_registerJassNative(L, n, f) (lua_pushstring(L, (n)), lua_pushcclosure(L, (f), 1), lua_setglobal(L, (n)))
-#define lua_setint(L, n, v) (lua_pushinteger(L, v), lua_setglobal(L, n))
-
-LUA lua_jCall(lua_State* l) {
- LPCSTR name = lua_tostring(l, lua_upvalueindex(1));
- JASSNATIVE native = get_native(name);
-
- if (!native.is_valid()) {
- return 0;
- }
-
- {
- std::vector params = native.get_params();
- int size = params.size();
- if (size > lua_gettop(l)) {
- return luaL_error(l, "function '%s' must have %d %s", name, size, size > 1 ? "arguments" : "argument");
- }
- }
-
- int size = lua_gettop(l);
- float* temp_params = new float[size];
- DWORD* params = new DWORD[size];
- ZeroMemory(temp_params, size);
- ZeroMemory(params, size);
- UINT i = 1;
-
- for (const auto& type : native.get_params()) {
- switch (type) {
- case TYPE_CODE:
- if (lua_isinteger(l, i)) {
- params[i - 1] = (DWORD)lua_tointeger(l, i);
- }
- else if (lua_isfunction(l, i)) {
- params[i - 1] = to_Code(l, i);
- }
-
- break;
- case TYPE_BOOLEAN:
- params[i - 1] = (DWORD)lua_toboolean(l, i);
-
- break;
- case TYPE_HANDLE:
- params[i - 1] = (DWORD)lua_tointeger(l, i);
-
- break;
- case TYPE_INTEGER:
- if (lua_isinteger(l, i)) {
- params[i - 1] = (DWORD)lua_tointeger(l, i);
- }
- else {
- params[i - 1] = to_ID(lua_tostring(l, i));
- }
-
- break;
- case TYPE_REAL: {
- temp_params[i - 1] = (float)lua_tonumber(l, i);
- params[i - 1] = (DWORD)&(temp_params[i - 1]);
-
- break;
- }
- case TYPE_STRING:
- params[i - 1] = to_jString(lua_tostring(l, i));
-
- break;
- default:
- params[i - 1] = NULL;
-
- break;
- }
-
- i++;
- }
-
- DWORD result = native.call(params, size);
- delete[] temp_params;
- delete[] params;
-
- switch (native.get_rettype()) {
- case TYPE_BOOLEAN:
- lua_pushboolean(l, result);
-
- break;
-
- case TYPE_CODE:
- case TYPE_HANDLE:
- case TYPE_INTEGER:
- lua_pushinteger(l, result);
-
- break;
- case TYPE_REAL:
- lua_pushnumber(l, from_jReal(result));
-
- break;
- case TYPE_STRING:
- lua_pushstring(l, from_jString(getJassMachine()->string_table->get(result)));
-
- break;
- }
-
- return native.get_rettype() != TYPE_NOTHING ? 1 : 0;
-}
-
-//-------------------------------------------------------------
-
-LUA lua_GetMouseWorldPos(lua_State* l) {
- PVECTOR3 mousePos = GetMouseWorldPos();
-
- lua_pushnumber(l, mousePos->_x);
- lua_pushnumber(l, mousePos->_y);
- lua_pushnumber(l, mousePos->_z);
-
- return 3;
-}
-
-LUA lua_GetMouseWorldX(lua_State* l) {
- lua_pushnumber(l, GetMouseWorldX());
-
- return 1;
-}
-
-LUA lua_GetMouseWorldY(lua_State* l) {
- lua_pushnumber(l, GetMouseWorldY());
-
- return 1;
-}
-
-LUA lua_GetMouseWorldZ(lua_State* l) {
- lua_pushnumber(l, GetMouseWorldZ());
-
- return 1;
-}
-
-LUA lua_GetObjectPos(lua_State* l) {
- PVECTOR3 objectPos = GetObjectPos(ConvertHandleToObject((UINT)lua_tointeger(l, 1)));
-
- lua_pushnumber(l, objectPos->_x);
- lua_pushnumber(l, objectPos->_y);
- lua_pushnumber(l, objectPos->_z);
-
- return 3;
-}
-
-LUA lua_GetObjectX(lua_State* l) {
- lua_pushnumber(l, GetObjectPos(ConvertHandleToObject((UINT)lua_tointeger(l, 1)))->_x);
-
- return 1;
-}
-
-LUA lua_GetObjectY(lua_State* l) {
- lua_pushnumber(l, GetObjectPos(ConvertHandleToObject((UINT)lua_tointeger(l, 1)))->_y);
-
- return 1;
-}
-
-LUA lua_GetObjectZ(lua_State* l) {
- lua_pushnumber(l, GetObjectPos(ConvertHandleToObject((UINT)lua_tointeger(l, 1)))->_z);
-
- return 1;
-}
-
-LUA lua_SetObjectPos(lua_State* l) {
- UINT_PTR object = ConvertHandleToObject((UINT)lua_tointeger(l, 1));
-
- switch (lua_gettop(l))
- {
- case 2:
- SetObjectX(object, (float)lua_tonumber(l, 2));
-
- break;
- case 3:
- SetObjectX(object, (float)lua_tonumber(l, 2));
- SetObjectY(object, (float)lua_tonumber(l, 3));
-
- break;
- case 4:
- SetObjectPos(object, VECTOR3((float)lua_tonumber(l, 2), (float)lua_tonumber(l, 3), (float)lua_tonumber(l, 4)));
-
- break;
- }
-
- return 0;
-}
-
-LUA lua_SetObjectX(lua_State* l) {
- SetObjectX(ConvertHandleToObject((UINT)lua_tointeger(l, 1)), (float)lua_tonumber(l, 2));
-
- return 0;
-}
-
-LUA lua_SetObjectY(lua_State* l) {
- SetObjectY(ConvertHandleToObject((UINT)lua_tointeger(l, 1)), (float)lua_tonumber(l, 2));
-
- return 0;
-}
-
-LUA lua_SetObjectZ(lua_State* l) {
- SetObjectZ(ConvertHandleToObject((UINT)lua_tointeger(l, 1)), (float)lua_tonumber(l, 2));
-
- return 0;
-}
-
-LUA lua_ConvertHandleToObject(lua_State* l) {
- lua_pushinteger(l, ConvertHandleToObject((UINT)lua_tointeger(l, 1)));
-
- return 1;
-}
-
-//-------------------------------------------------------------
-
-LUA lua_GetOriginFrame(lua_State* l) {
- lua_pushinteger(l, GetOriginFrame((EOriginFrame)lua_tointeger(l, 1), (UINT)lua_tointeger(l, 2)));
-
- return 1;
-}
-
-LUA lua_LoadTOCFile(lua_State* l) {
- lua_pushinteger(l, LoadTOCFile(lua_tostring(l, 1)));
-
- return 1;
-}
-
-LUA lua_GetFrameByName(lua_State* l) {
- lua_pushinteger(l, GetFrameByName(lua_tostring(l, 1), (UINT)lua_tointeger(l, 2)));
-
- return 1;
-}
-
-LUA lua_TriggerRegisterFrameEvent(lua_State* l) {
- TriggerRegisterFrameEvent(pushFunctionRef(l, 1), (UINT)lua_tointeger(l, 2), (EFrameEvent)lua_tointeger(l, 3));
-
- return 0;
-}
-
-LUA lua_CreateFrame(lua_State* l) {
- getGlobalTable(l, "_LUA_FRAMES", false);
- lua_pushinteger(l, CreateFrame(lua_tostring(l, 1), (UINT)lua_tointeger(l, 2), (EFramePoint)lua_tointeger(l, 3), (EFramePoint)lua_tointeger(l, 4), (UINT)lua_tointeger(l, 5)));
-
- return 1;
-}
-
-LUA lua_SetFrameText(lua_State* l) {
- SetFrameText((UINT)lua_tointeger(l, 1), lua_tostring(l, 2));
-
- return 0;
-}
-
-LUA lua_SetFrameTextColor(lua_State* l) {
- SetFrameTextColor((UINT)lua_tointeger(l, 1), (BYTE)lua_tointeger(l, 2), (BYTE)lua_tointeger(l, 3), (BYTE)lua_tointeger(l, 4), (BYTE)lua_tointeger(l, 5));
-
- return 0;
-}
-
-LUA lua_GetFrameTextHeight(lua_State* l) {
- lua_pushnumber(l, GetFrameTextHeight((UINT)lua_tointeger(l, 1)));
-
- return 1;
-}
-
-LUA lua_SetFrameWidth(lua_State* l) {
- SetFrameWidth((UINT)lua_tointeger(l, 1), (float)lua_tonumber(l, 2));
-
- return 0;
-}
-
-LUA lua_SetFrameHeight(lua_State* l) {
- SetFrameHeight((UINT)lua_tointeger(l, 1), (float)lua_tonumber(l, 2));
-
- return 0;
-}
-
-LUA lua_SetFrameSize(lua_State* l) {
- SetFrameSize((UINT)lua_tointeger(l, 1), (float)lua_tonumber(l, 2), (float)lua_tonumber(l, 3));
-
- return 0;
-}
-
-LUA lua_SetFrameScale(lua_State* l) {
- SetFrameScale((UINT)lua_tointeger(l, 1), (float)lua_tonumber(l, 2));
-
- return 0;
-}
-
-LUA lua_SetFrameAbsolutePoint(lua_State* l) {
- SetFrameAbsolutePoint((UINT)lua_tointeger(l, 1), (EFramePoint)lua_tointeger(l, 2), (float)lua_tonumber(l, 3), (float)lua_tonumber(l, 4));
-
- return 0;
-}
-
-LUA lua_SetFramePoint(lua_State* l) {
- SetFramePoint((UINT)lua_tointeger(l, 1), (EFramePoint)lua_tointeger(l, 2), (UINT)lua_tointeger(l, 3), (EFramePoint)lua_tointeger(l, 4), (float)lua_tonumber(l, 5), (float)lua_tonumber(l, 6));
-
- return 0;
-}
-
-LUA lua_GetFrameWidth(lua_State* l) {
- lua_pushnumber(l, GetFrameWidth((UINT)lua_tointeger(l, 1)));
-
- return 1;
-}
-
-LUA lua_GetFrameHeight(lua_State* l) {
- lua_pushnumber(l, GetFrameHeight((UINT)lua_tointeger(l, 1)));
-
- return 1;
-}
-
-LUA lua_GetFramePointParent(lua_State* l) {
- lua_pushinteger(l, GetFramePointParent((UINT)lua_tointeger(l, 1), (EFramePoint)lua_tointeger(l, 2)));
-
- return 1;
-}
-
-LUA lua_GetFramePointRelativePoint(lua_State* l) {
- lua_pushinteger(l, GetFramePointRelativePoint((UINT)lua_tointeger(l, 1), (EFramePoint)lua_tointeger(l, 2)));
-
- return 1;
-}
-
-LUA lua_GetFramePointX(lua_State* l) {
- lua_pushnumber(l, GetFramePointX((UINT)lua_tointeger(l, 1), (EFramePoint)lua_tointeger(l, 2)));
-
- return 1;
-}
-
-LUA lua_GetFramePointY(lua_State* l) {
- lua_pushnumber(l, GetFramePointY((UINT)lua_tointeger(l, 1), (EFramePoint)lua_tointeger(l, 2)));
-
- return 1;
-}
-
-//-------------------------------------------------------------
-
-void lua_open_jassnatives(lua_State* l) {
- for (const auto& native : jassnatives) {
- lua_registerJassNative(l, native.first, lua_jCall);
- }
-}
-
-void lua_open_warcraftfunctions(lua_State* l) {
- lua_register(l, "TriggerRegisterFrameEvent", lua_TriggerRegisterFrameEvent);
-
- lua_register(l, "GetMouseWorldPos", lua_GetMouseWorldPos);
- lua_register(l, "GetMouseWorldX", lua_GetMouseWorldX);
- lua_register(l, "GetMouseWorldY", lua_GetMouseWorldY);
- lua_register(l, "GetMouseWorldZ", lua_GetMouseWorldZ);
-
- lua_register(l, "GetObjectPos", lua_GetObjectPos);
- lua_register(l, "GetObjectX", lua_GetObjectX);
- lua_register(l, "GetObjectY", lua_GetObjectY);
- lua_register(l, "GetObjectZ", lua_GetObjectZ);
-
- lua_register(l, "SetObjectPos", lua_SetObjectPos);
- lua_register(l, "SetObjectX", lua_SetObjectX);
- lua_register(l, "SetObjectY", lua_SetObjectY);
- lua_register(l, "SetObjectZ", lua_SetObjectZ);
-
- lua_register(l, "ConvertHandleToObject", lua_ConvertHandleToObject);
-
- lua_setint(l, "ORIGIN_FRAME_GAME_UI", ORIGIN_FRAME_GAME_UI);
- lua_setint(l, "ORIGIN_FRAME_WORLD_FRAME", ORIGIN_FRAME_WORLD_FRAME);
- lua_setint(l, "ORIGIN_FRAME_HERO_BAR", ORIGIN_FRAME_HERO_BAR);
- lua_setint(l, "ORIGIN_FRAME_HERO_BUTTON", ORIGIN_FRAME_HERO_BUTTON);
- lua_setint(l, "ORIGIN_FRAME_HERO_HP_BAR", ORIGIN_FRAME_HERO_HP_BAR);
- lua_setint(l, "ORIGIN_FRAME_HERO_MANA_BAR", ORIGIN_FRAME_HERO_MANA_BAR);
- lua_setint(l, "ORIGIN_FRAME_HERO_BUTTON_INDICATOR", ORIGIN_FRAME_HERO_BUTTON_INDICATOR);
- lua_setint(l, "ORIGIN_FRAME_ITEM_BUTTON", ORIGIN_FRAME_ITEM_BUTTON);
- lua_setint(l, "ORIGIN_FRAME_COMMAND_BUTTON", ORIGIN_FRAME_COMMAND_BUTTON);
- lua_setint(l, "ORIGIN_FRAME_SYSTEM_BUTTON", ORIGIN_FRAME_SYSTEM_BUTTON);
- lua_setint(l, "ORIGIN_FRAME_PORTRAIT", ORIGIN_FRAME_PORTRAIT);
- lua_setint(l, "ORIGIN_FRAME_MINIMAP", ORIGIN_FRAME_MINIMAP);
- lua_setint(l, "ORIGIN_FRAME_MINIMAP_BUTTON", ORIGIN_FRAME_MINIMAP_BUTTON);
- lua_setint(l, "ORIGIN_FRAME_TOOLTIP", ORIGIN_FRAME_TOOLTIP);
- lua_setint(l, "ORIGIN_FRAME_UBERTOOLTIP", ORIGIN_FRAME_UBERTOOLTIP);
- lua_setint(l, "ORIGIN_FRAME_CHAT_MSG", ORIGIN_FRAME_CHAT_MSG);
- lua_setint(l, "ORIGIN_FRAME_UNIT_MSG", ORIGIN_FRAME_UNIT_MSG);
- lua_setint(l, "ORIGIN_FRAME_TOP_MSG", ORIGIN_FRAME_TOP_MSG);
-
- lua_register(l, "GetOriginFrame", lua_GetOriginFrame);
- lua_register(l, "LoadTOCFile", lua_LoadTOCFile);
- lua_register(l, "GetFrameByName", lua_GetFrameByName);
- lua_register(l, "CreateFrame", lua_CreateFrame);
- lua_register(l, "SetFrameText", lua_SetFrameText);
- lua_register(l, "SetFrameTextColor", lua_SetFrameTextColor);
- lua_register(l, "GetFrameTextHeight", lua_GetFrameTextHeight);
- lua_register(l, "SetFrameWidth", lua_SetFrameWidth);
- lua_register(l, "SetFrameHeight", lua_SetFrameHeight);
- lua_register(l, "SetFrameSize", lua_SetFrameSize);
- lua_register(l, "SetFrameScale", lua_SetFrameScale);
- lua_register(l, "SetFrameAbsolutePoint", lua_SetFrameAbsolutePoint);
- lua_register(l, "SetFramePoint", lua_SetFramePoint);
- lua_register(l, "GetFrameWidth", lua_GetFrameWidth);
- lua_register(l, "GetFrameHeight", lua_GetFrameHeight);
- lua_register(l, "GetFramePointParent", lua_GetFramePointParent);
- lua_register(l, "GetFramePointRelativePoint", lua_GetFramePointRelativePoint);
- lua_register(l, "GetFramePointX", lua_GetFramePointX);
- lua_register(l, "GetFramePointY", lua_GetFramePointY);
-}
\ No newline at end of file
diff --git a/Src Backup/LuaRegister.h b/Src Backup/LuaRegister.h
deleted file mode 100644
index 9d3905b..0000000
--- a/Src Backup/LuaRegister.h
+++ /dev/null
@@ -1,8 +0,0 @@
-#pragma once
-
-#include
-
-#include "LuaMachine.h"
-
-void lua_open_jassnatives(lua_State* l);
-void lua_open_warcraftfunctions(lua_State* l);
\ No newline at end of file
diff --git a/Src Backup/Main.cpp b/Src Backup/Main.cpp
deleted file mode 100644
index 6ca76a4..0000000
--- a/Src Backup/Main.cpp
+++ /dev/null
@@ -1,55 +0,0 @@
-#include
-#include
-
-#include "Variables.h"
-#include "Mem.h"
-#include "Hooks.h"
-#include "JassMachine.h"
-
-BOOL APIENTRY DllMain(HMODULE hModule, UINT ul_reason_for_call, LPVOID lpReserve)
-{
- switch (ul_reason_for_call)
- {
- case DLL_PROCESS_ATTACH:
- if (gameBase) {
- DisableThreadLibraryCalls(hModule);
-
- LPSTR cmdline = GetCommandLine();
- size_t i;
- for (i = strlen(cmdline); i > 0 && cmdline[i] != '\"'; i--);
-
- if (strstr(&cmdline[i + 1], "-console") || strstr(&cmdline[i + 1], "-debug")) {
- FILE* console;
- AllocConsole();
- freopen_s(&console, "CONOUT$", "w", stdout);
- SetConsoleTitle("Lua Console");
- }
-
- printf("%s\n%s\n", LUA_COPYRIGHT, WAR3_LUA);
-
- jassNativesInitialize();
- jassOpcodeInitialize();
-
- call(MakePtr(gameBase, _jassEntryPoint), jassEntryPoint);
- call(MakePtr(gameBase, _getWarcraftID1), getWarcraftID);
- call(MakePtr(gameBase, _getWarcraftID2), getWarcraftID);
- jmp(MakePtr(gameBase, 0x62a580), (DWORD)isFrameValid);
- jmp(MakePtr(gameBase, 0x629a90), (DWORD)frameEventObserver);
-
- break;
- }
- else {
- return FALSE;
- }
- case DLL_PROCESS_DETACH:
- BYTE originalFrameValid[] = { 0x8b, 0x49, 8, 0x33, 0xc0};
- patch(MakePtr(gameBase, 0x62a580), originalFrameValid,sizeof(originalFrameValid));
-
- BYTE originalFrameEventObserver[] = { 0x8b, 0x44, 0x24, 4, 0x8b };
- patch(MakePtr(gameBase, 0x629a90), originalFrameEventObserver, sizeof(originalFrameEventObserver));
-
- break;
- }
-
- return TRUE;
-}
\ No newline at end of file
diff --git a/Src Backup/Mem.h b/Src Backup/Mem.h
deleted file mode 100644
index e1a5e6a..0000000
--- a/Src Backup/Mem.h
+++ /dev/null
@@ -1,61 +0,0 @@
-#pragma once
-
-#include
-
-#define MakePtr(a, b) ((DWORD)a + (DWORD)b)
-
-inline bool patch(LPVOID lpAddress, LPVOID lpData, SIZE_T dwSize) {
- DWORD dwOldProtect;
-
- if (VirtualProtect(lpAddress, dwSize, PAGE_EXECUTE_READWRITE, &dwOldProtect)) {
- memcpy(lpAddress, lpData, dwSize);
-
- VirtualProtect(lpAddress, dwSize, dwOldProtect, NULL);
-
- return true;
- }
-
- return false;
-}
-
-inline bool patch(DWORD dwAddress, LPVOID lpData, SIZE_T dwSize) {
- return patch((LPVOID)dwAddress, lpData, dwSize);
-}
-
-inline bool call(LPVOID lpAddress, LPVOID lpProc) {
- DWORD dwOldProtect;
-
- if (VirtualProtect(lpAddress, 5, PAGE_EXECUTE_READWRITE, &dwOldProtect)) {
- *(CHAR*)lpAddress = (BYTE)0xE8;
- *(DWORD*)((DWORD)lpAddress + 1) = (DWORD)lpProc - ((DWORD)lpAddress + 5);
-
- VirtualProtect(lpAddress, 5, dwOldProtect, NULL);
-
- return true;
- }
-
- return false;
-}
-
-inline bool call(DWORD dwAddress, LPVOID lpProc) {
- return call((LPVOID)dwAddress, lpProc);
-}
-
-inline bool jmp(LPVOID lpAddress, LPVOID lpDestination) {
- DWORD dwOldProtect;
-
- if (VirtualProtect(lpAddress, 5, PAGE_EXECUTE_READWRITE, &dwOldProtect)) {
- *(CHAR*)lpAddress = (BYTE)0xE9;
- *(DWORD*)((DWORD)lpAddress + 1) = (DWORD)lpDestination - ((DWORD)lpAddress + 5);
-
- VirtualProtect(lpAddress, 5, dwOldProtect, NULL);
-
- return true;
- }
-
- return false;
-}
-
-inline bool jmp(DWORD dwAddress, DWORD lpDestination) {
- return jmp((LPVOID)dwAddress, (LPVOID)lpDestination);
-}
\ No newline at end of file
diff --git a/Src Backup/Variables.h b/Src Backup/Variables.h
deleted file mode 100644
index b61c47a..0000000
--- a/Src Backup/Variables.h
+++ /dev/null
@@ -1,76 +0,0 @@
-#pragma once
-
-#include
-#include