I have one for AA scripts too. And in the lua one there's a function to "import" lua files that are stored as table files. But yeah, I tend to use a lot of lua. A teleporter, a table cea file module for external AA scripts to be added as table files when distributing the CT, a table updater, a logger, a module for saving and loading what scripts are enabled; and some general helper functions for auto attach, compact mode toggles, CE and game version checker. Just noticed this topic, so I'll try to post the most resent files. My Metal Gear Solid table is a good example with the most up to date files. But the teleporter and helper modules might make good additions.
EDIT:
Here's the modules I use. Includes I2CEHelpers, I2CETableCEA, I2CETableHelpers, I2CETeleporter, I2CETLogger, I2CETState, and I2CETUpdater.
- TableLua.7z
- Password: fearlessrevolution
- (20.68 KiB) Downloaded 167 times
An example of the table lua script I use as a starter:
Code: Select all
--DEBUG = true
--RELEASE_MODE = true
COMPACT_MODE = RELEASE_MODE
DISABLE_HEADER_SORTING = true
PROCESS_NAME = 'mgsvtpp.exe'
TABLE_TITLE = 'mgsvtpp CET'
TABLE_NAME = 'mgsvtpp'
TABLE_VERSION = '5.0.3'
GAME_TITLE = 'Metal Gear Solid 5 The Phantom Pain'
-- GAME_FILE_VERSION = '1.0.15.1'
GAME_VERSION = '1.15'
VERSION_FILE_URL = 'https://docs.google.com/document/d/1pPgHNGV1-EmIpfxxXp0vnoeoZxlCg11ofdV1x78bJEw/export?format=txt'
AUTO_UPDATE = RELEASE_MODE
local requiredCEVersion = 6.83
-- local requiredCEVersionCloseOnFail = true
-- local requiredGameVersion = '1.0.15.1'
-- local requiredGameVersionCloseOnFail = true
function tableSetup()
CETrequire('I2CETableCEA')
CETrequire('I2CETeleporter')
I2CETeleporter.AutoAllocate = false
CETrequire('I2CETState')
CETrequire('AddType_Int_Div2')
CETrequire('AddType_Short_Div10')
CETrequire('AddType_GameTime')
Logger.debugf('Table loaded: %s, %s', TABLE_TITLE, TABLE_VERSION)
if RELEASE_MODE then
--
-- Release mode
end
end
if MainForm == nil then
MainForm = getMainForm()
end
if AddressList == nil then
AddressList = getAddressList()
end
--------
-------- CE Table Require
--------
local tableLuaFilesDirectory = 'luaFiles'
local fileExt = '.lua'
function CETrequire(moduleStr)
if moduleStr ~= nil then
local localTableLuaFilePath = moduleStr
if tableLuaFilesDirectory ~= nil and tableLuaFilesDirectory ~= '' then
local sep = package.config:sub(1,1)
localTableLuaFilePath = tableLuaFilesDirectory .. sep .. moduleStr
end
local f, err = io.open(localTableLuaFilePath .. fileExt)
if f and not err then
f:close()
return dofile(localTableLuaFilePath .. fileExt)
else
local tableFile = findTableFile(moduleStr .. fileExt)
if tableFile == nil then
return nil
end
local stream = tableFile.getData()
local fileStr = nil
local bytes = stream.read(stream.Size)
for i = 1, #bytes do
if fileStr == nil then
fileStr = ''
end
fileStr = fileStr .. string.char(bytes[i])
end
if fileStr then
return loadstring(fileStr)()
end
end
end
return nil
end
--------
-------- Logger
--------
Logger = CETrequire('I2CETLogger')
Logger.LogName = 'CETlog'
--------
-------- Updater
--------
CETrequire('I2CETUpdater')
if AUTO_UPDATE then
CETUpdater.TableVersion = TABLE_VERSION
CETUpdater.TableName = TABLE_NAME
CETUpdater.VersionFileUrl = VERSION_FILE_URL
CETUpdater.checkTableVersion()
end
--------
-------- TableHelpers
--------
CETrequire('I2CETableHelpers')
I2CETableHelpers.init()
--------
-------- Auto Attach
--------
I2CETableHelpers.requireCEVersion(requiredCEVersion, requiredCEVersionCloseOnFail)
Logger.debugf('Useing CE version: %.1f', getCEVersion())
I2CETableHelpers.tableSetup = tableSetup
I2CETableHelpers.autoAttachCT(PROCESS_NAME, requiredGameVersion, requiredGameVersionCloseOnFail)
And a "Main Hooks" example that initializes the teleporter:
Code: Select all
{$lua}
if syntaxcheck then return end
I2CETableCEA.autoAssembleFile('PlayerHook.CEA', MemRec)
I2CETableCEA.autoAssembleFile('WaypointHook.CEA', MemRec)
I2CETableCEA.autoAssembleFile('SupplyDropCoordHook.CEA', MemRec)
I2CETableCEA.autoAssembleFile('VehicleHealthHook.CEA', MemRec)
I2CETableCEA.autoAssembleFile('PlayerVehicleCoordHook.CEA', MemRec)
-- I2CETableCEA.autoAssembleFile('SupplyDropCoordVehicleHook.CEA', MemRec)
I2CETableCEA.autoAssembleFile('SelectedMapIconCoordHook.CEA', MemRec)
----
I2CETableCEA.autoAssembleFile('DHorseCoordHook.CEA', MemRec)
I2CETableCEA.autoAssembleFile('DWalkerCoordHook.CEA', MemRec)
----
I2CETableCEA.autoAssembleFile('TimeHook.CEA', MemRec)
I2CETableCEA.autoAssembleFile('WeatherHook.CEA', MemRec)
I2CETableCEA.autoAssembleFile('AmmoHook.CEA', MemRec)
I2CETableCEA.autoAssembleFile('WeaponHook.CEA', MemRec)
I2CETableCEA.autoAssembleFile('SuppressorCapHook.CEA', MemRec)
I2CETableCEA.autoAssembleFile('BatteryMaxHook.CEA', MemRec)
I2CETableCEA.autoAssembleFile('ResourcesHook.CEA', MemRec)
I2CETableCEA.autoAssembleFile('ResourcesOnlineHook.CEA', MemRec)
I2CETableCEA.autoAssembleFile('ZoomHook.CEA', MemRec)
----
I2CETableCEA.autoAssembleFile('TankAmmoHook.CEA', MemRec)
I2CETableCEA.autoAssembleFile('DwHealthHook.CEA', MemRec)
------------------------------ ENABLE -------------------------------
[ENABLE]
I2CETeleporter.initMemory()
------------------------------ DISABLE ------------------------------
[DISABLE]
And then here is the call to auto generate the memory records for the teleportor:
Code: Select all
I2CETeleporter.generateMemoryRecords()
And here is an example of setting the bases and offsets for the teleportor:
Code: Select all
{$STRICT}
define(address, mgsvtpp.exe+9645D79)
define(bytes, 48 8B 41 38 48 8B 79 30)
////
//// ------------------------------ ENABLE ------------------------------
[ENABLE]
// aobScanModule(aobPlayerHook, mgsvtpp.exe, 48xxxxxx48xxxxxx4xxxxx4Cxxxxxx4Bxxxxxx4xxxxx49)
i2aobScanModule(aobPlayerHook, mgsvtpp.exe, 48xxxxxx48xxxxxx4xxxxx4Cxxxxxx4Bxxxxxx4xxxxx49)
define(injPlayerHook, aobPlayerHook)
// assert(injPlayerHook, bytes)
i2assert(injPlayerHook, bytes)
registerSymbol(injPlayerHook)
alloc(memPlayerHook, 0x400, injPlayerHook)
label(ptrPlayerHook)
registerSymbol(ptrPlayerHook)
label(n_code)
label(o_code)
label(exit)
label(return)
memPlayerHook:
ptrPlayerHook:
dq 0
align 10 CC
n_code:
mov [ptrPlayerHook],rcx
o_code:
mov rax,[rcx+38]
mov rdi,[rcx+30]
exit:
jmp return
////
//// ---------- Injection Point ----------
injPlayerHook:
jmp n_code
nop
nop
nop
return:
{$lua}
I2CETeleporter.CoordPointerSymbol = '[[ptrPlayerHook]+30]+48'
I2CETeleporter.Xoffset = 0x20
I2CETeleporter.Yoffset = 0x24
I2CETeleporter.Zoffset = 0x28
I2CETeleporter.PlayerRotationAnglePointerSymbol = '[[ptrPlayerHook]+30]+48'
I2CETeleporter.PlayerYawOffset = 0x84
I2CETeleporter.CamRotationAnglePointerSymbol = '[[ptrPlayerHook]+38]+B8'
I2CETeleporter.CamPitchOffset = 0x270
I2CETeleporter.CamYawOffset = 0x274
I2CETeleporter.CamYawToPlayerYaw = function(cY) return (cY / 3) end
{$asm}
////
//// ------------------------------ DISABLE ------------------------------
[DISABLE]
////
//// ---------- Injection Point ----------
injPlayerHook:
db bytes
unregisterSymbol(injPlayerHook)
unregisterSymbol(ptrPlayerHook)
dealloc(memPlayerHook)
And here's the latest Lua script generator, and AA script generator:
- I2Plugins.7z
- Password: fearlessrevolution
- (29.02 KiB) Downloaded 145 times