can it be done using Lua string address variable or do I need assembler symbol for the address of the new string ?
Code: Select all
function UI_Water_Cost_LeftStation(params)
local WaterFuelPrice = readInteger(params)
local PermitStringTemplateAddr = readInteger(params+0x4)
local NoPermitStringTemplateAddr = readInteger(params+0x8)
local AOBAddr = readInteger(params+0xC) // 0x80 before Push PermitString template 0xB9 before NoPermitString template push instruction
local tempstring =string.format("WF: %d$ TL: %%d Permit: %%d STP: %%d", WaterFuelPrice)
writeString(PermitStringTemplateAddr, tempstring)
writeByte(PermitStringTemplateAddr + string.len(tempstring)+1,0)
tempstring = string.format("WF: %d$ TL: %%d STP: %%d", WaterFuelPrice)
writeString(NoPermitStringTemplateAddr, tempstring)
writeByte(NoPermitStringTemplateAddr + string.len(tempstring)+1,0)
--debug verification
-- print(string.format("[%s] || [%s] || AOB addr %x ", readString(PermitStringTemplateAddr), readString(NoPermitStringTemplateAddr), AOBAddr ))
// would like to overwrite 2 push instructions (they push addresses of string printf template)
push StarTradersFrontiersMods.exe+7135C0 { ("Trade Law: %d Permit: %d Starport: %d") }
with
push PermitStringTemplateAddr // at addr AOBAddr + 0x80
and
push StarTradersFrontiersMods.exe+713670 { ("Trade Law: %d Starport: %d") }
with
push NoPermitStringTemplateAddr // at addr AOBAddr + 0xB9
end
EDIT can I add stuff here ?
Code: Select all
....
AOB_UI_Add_Water_Cost_Hover_LeftStation:
jmp code
return:
registersymbol(AOB_UI_Add_Water_Cost_Hover_LeftStation)
AOB_UI_Add_Water_Cost_Hover_LeftStation+80:
push PermitString
AOB_UI_Add_Water_Cost_Hover_LeftStation+B9:
push NoPermitString
[DISABLE]
AOB_UI_Add_Water_Cost_Hover_LeftStation:
readmem(bytes_save_UI_water_Left_Station,5) // db E8 75 F4 01 00 // will need save-restore 5 bytes
AOB_UI_Add_Water_Cost_Hover_LeftStation+80:
readmem(,5) // Restore Push str addr
AOB_UI_Add_Water_Cost_Hover_LeftStation+B9:
readmem(,5) // Restore second Push str addr
unregistersymbol(AOB_UI_Add_Water_Cost_Hover_LeftStation)
unregisterSymbol(bytes_save_UI_water_Left_Station)
dealloc(newmem)
dealloc(LUA_UI_Water_Cost_LeftStation)
dealloc(UI_Water_Cost_LeftStation_Params)
Just occurred to me , No matter how i do it I will need to (SAVE /) RESTORE those original pushes in For the disable function