-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New gameplay behaviors are now disabled by default
- Loading branch information
Showing
8 changed files
with
273 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
|
||
function B3Books_InstallBookChanges() | ||
|
||
EEex_DisableCodeProtection() | ||
|
||
EEex_WriteAssembly(0x6870F6, {"!jmp_byte"}) -- force bookMode to true | ||
EEex_WriteAssembly(0x709287, {"!jmp_byte"}) -- force hasMageBook to true | ||
|
||
EEex_EnableCodeProtection() | ||
end | ||
B3Books_InstallBookChanges() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
|
||
B3Hotkey_PrintKeys = false | ||
function B3Hotkey_TogglePrintKeys() | ||
if not B3Hotkey_PrintKeys then | ||
B3Hotkey_PrintKeys = true | ||
Infinity_DisplayString("[EEex] Enabled Key-Pressed Output") | ||
else | ||
B3Hotkey_PrintKeys = false | ||
Infinity_DisplayString("[EEex] Disabled Key-Pressed Output") | ||
end | ||
end | ||
|
||
B3Hotkey_Hotkeys = { | ||
{B3Hotkey_TogglePrintKeys, 3, 0x60}, -- Key-Pressed Output Toggle | ||
--{"SPWI112", 3, 0x61, 0x73, 0x64}, -- Example keybinding... | ||
} | ||
|
||
function B3Hotkey_AttemptToCastViaHotkey(resref) | ||
local actorID = EEex_GetActorIDSelected() | ||
if actorID ~= 0x0 then | ||
local useCGameButtonList = function(m_CGameSprite, m_CGameButtonList) | ||
local found = false | ||
EEex_IterateCPtrList(m_CGameButtonList, function(m_CButtonData) | ||
-- m_CButtonData.m_abilityId.m_res | ||
local m_res = EEex_ReadLString(m_CButtonData + 0x1C + 0x6, 0x8) | ||
if m_res == resref then | ||
-- Unlike most other functions, CGameSprite::ReadySpell() expects the CButtonData | ||
-- arg to be passed by VALUE, not by reference. EEex's call() function isn't designed | ||
-- to do that, so the hacky hilarity that follows is required... | ||
local stackArgs = {} | ||
table.insert(stackArgs, 0x0) | ||
for i = 0x30, 0x0, -0x4 do | ||
table.insert(stackArgs, EEex_ReadDword(m_CButtonData + i)) | ||
end | ||
EEex_Call(EEex_Label("CGameSprite::ReadySpell"), stackArgs, m_CGameSprite, 0x0) | ||
found = true | ||
return true -- breaks out of EEex_IterateCPtrList() | ||
end | ||
end) | ||
EEex_FreeCPtrList(m_CGameButtonList) | ||
return found | ||
end | ||
local m_CGameSprite = EEex_GetActorShare(actorID) | ||
local spellButtonDataList = EEex_Call(EEex_Label("CGameSprite::GetQuickButtons"), {0, 2}, m_CGameSprite, 0x0) | ||
if useCGameButtonList(m_CGameSprite, spellButtonDataList) then return end | ||
local innateButtonDataList = EEex_Call(EEex_Label("CGameSprite::GetQuickButtons"), {0, 4}, m_CGameSprite, 0x0) | ||
useCGameButtonList(m_CGameSprite, innateButtonDataList) | ||
end | ||
end | ||
|
||
B3Hotkey_LastSuccessfulHotkey = nil | ||
|
||
function B3Hotkey_KeyPressedListener(key) | ||
if worldScreen == e:GetActiveEngine() then | ||
if B3Hotkey_PrintKeys then | ||
Infinity_DisplayString("[EEex] Pressed: "..EEex_ToHex(key)) | ||
end | ||
local completedMatch = false | ||
for _, hotkeyDef in ipairs(B3Hotkey_Hotkeys) do | ||
local stage = hotkeyDef[2] | ||
if stage ~= 0 then | ||
if hotkeyDef[stage] == key then | ||
if stage ~= #hotkeyDef then | ||
hotkeyDef[2] = stage + 1 -- Advance | ||
else | ||
-- Success | ||
hotkeyDef[2] = 0 -- Stop Processing | ||
B3Hotkey_LastSuccessfulHotkey = hotkeyDef | ||
completedMatch = true | ||
end | ||
|
||
else | ||
-- Fail | ||
hotkeyDef[2] = 0 -- Stop Processing | ||
end | ||
end | ||
end | ||
if not completedMatch then | ||
B3Hotkey_LastSuccessfulHotkey = nil | ||
end | ||
end | ||
end | ||
EEex_AddKeyPressedListener(B3Hotkey_KeyPressedListener) | ||
|
||
function B3Hotkey_KeyReleasedListener(key) | ||
if B3Hotkey_LastSuccessfulHotkey ~= nil then | ||
local hotkeyValue = B3Hotkey_LastSuccessfulHotkey[1] | ||
local hotkeyValueType = type(hotkeyValue) | ||
if hotkeyValueType == "string" then | ||
B3Hotkey_AttemptToCastViaHotkey(hotkeyValue) | ||
elseif hotkeyValueType == "function" then | ||
hotkeyValue() | ||
end | ||
end | ||
B3Hotkey_LastSuccessfulHotkey = nil | ||
for _, hotkeyDef in ipairs(B3Hotkey_Hotkeys) do | ||
hotkeyDef[2] = 3 | ||
end | ||
end | ||
EEex_AddKeyReleasedListener(B3Hotkey_KeyReleasedListener) | ||
|
||
function B3Hotkey_ResetListener() | ||
EEex_AddKeyPressedListener(B3Hotkey_KeyPressedListener) | ||
EEex_AddKeyReleasedListener(B3Hotkey_KeyReleasedListener) | ||
EEex_AddResetListener(B3Hotkey_ResetListener) | ||
end | ||
EEex_AddResetListener(B3Hotkey_ResetListener) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
|
||
B3Invis_RenderAsInvisible = false | ||
|
||
function B3Invis_InstallOpcode193Changes() | ||
|
||
EEex_DisableCodeProtection() | ||
|
||
local canSeeInvisAddress = EEex_WriteAssemblyAuto({[[ | ||
!build_stack_frame | ||
!sub_esp_byte 04 | ||
!push_registers | ||
!mov_eax_[dword] *g_pBaldurChitin | ||
!mov_eax_[eax+dword] #D14 | ||
!mov_esi_[eax+dword] #3E54 | ||
!test_esi_esi | ||
!je_dword >fail | ||
!xor_ebx_ebx | ||
@loop | ||
!lea_ecx_[ebp+byte] FC | ||
!push_ecx | ||
!push_[esi+byte] 08 | ||
!call >CGameObjectArray::GetShare | ||
!mov_ecx_[ebp+byte] FC | ||
!cmp_[ecx+dword]_byte #C08 00 | ||
!jne_dword >found | ||
!mov_esi_[esi] | ||
!test_esi_esi | ||
!jne_dword >loop | ||
@fail | ||
!mov_ebx #01 | ||
@found | ||
!mov_eax_ebx | ||
!restore_stack_frame | ||
!ret | ||
]]}) | ||
|
||
local invisCheckHook1 = EEex_WriteAssemblyAuto({[[ | ||
!push_complete_state | ||
!cmp_[esi+dword]_byte #2D07 00 | ||
!je_dword >ret | ||
!call ]], {canSeeInvisAddress, 4, 4}, [[ | ||
!cmp_eax_byte 00 | ||
@ret | ||
!pop_complete_state | ||
!ret | ||
]]}) | ||
|
||
local invisCheckHook2 = EEex_WriteAssemblyAuto({[[ | ||
!push_complete_state | ||
!cmp_[ebx+dword]_byte #2D07 00 | ||
!je_dword >ret | ||
!call ]], {canSeeInvisAddress, 4, 4}, [[ | ||
!cmp_eax_byte 00 | ||
@ret | ||
!pop_complete_state | ||
!ret | ||
]]}) | ||
|
||
local forceCircleHook = EEex_WriteAssemblyAuto({[[ | ||
!push_complete_state | ||
!cmp_[eax+dword]_byte #9B 00 | ||
!jne_dword >ret | ||
!cmp_[ebx+dword]_byte #2D07 00 | ||
!je_dword >ret | ||
!call ]], {canSeeInvisAddress, 4, 4}, [[ | ||
!cmp_eax_byte 01 | ||
@ret | ||
!pop_complete_state | ||
!ret | ||
]]}) | ||
|
||
EEex_WriteAssembly(0x6EE5F1, {"!call", {invisCheckHook1, 4, 4}, "!nop !nop"}) | ||
EEex_WriteAssembly(0x6FC1C2, {"!call", {invisCheckHook2, 4, 4}, "!nop !nop"}) | ||
EEex_WriteAssembly(0x6FC237, {"!call", {forceCircleHook, 4, 4}, "!nop !nop"}) | ||
|
||
if B3Invis_RenderAsInvisible then | ||
|
||
local invisCheckHook3 = EEex_WriteAssemblyAuto({[[ | ||
!push_complete_state | ||
!cmp_[ebx+dword]_byte #2D07 00 | ||
!je_dword >ret | ||
!call ]], {canSeeInvisAddress, 4, 4}, [[ | ||
!cmp_eax_byte 01 | ||
@ret | ||
!pop_complete_state | ||
!ret | ||
]]}) | ||
|
||
EEex_WriteAssembly(0x6F9170, {"!call", {invisCheckHook2, 4, 4}, "!nop !nop"}) | ||
EEex_WriteAssembly(0x6F9970, {"!call", {invisCheckHook3, 4, 4}, "!nop !nop"}) | ||
end | ||
EEex_EnableCodeProtection() | ||
end | ||
B3Invis_InstallOpcode193Changes() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
|
||
EEex_Modules = { | ||
["B3_Books"] = false, | ||
["B3_Hotke"] = false, | ||
["B3_Invis"] = false, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.