Skip to content

Commit

Permalink
removed binary patching
Browse files Browse the repository at this point in the history
- hardcoded SPIN649 removal countered via BALDUR25.BCS
- hardcoded DAYNITE/NITEDAY movies renamed and dummied (to avoid bugs in taverns), campaign specific movies triggered by area scripts (patching moved to EET_end)
  • Loading branch information
K4thos committed Jul 5, 2021
1 parent 9095830 commit df9954f
Show file tree
Hide file tree
Showing 9 changed files with 87 additions and 172 deletions.
46 changes: 7 additions & 39 deletions EET/EET.tp2
Original file line number Diff line number Diff line change
Expand Up @@ -1755,6 +1755,7 @@ COPY ~%MOD_FOLDER%/base/spl/SPWI123.SPL~ ~override~
~%MOD_FOLDER%/base/spl/SPCL342.SPL~ ~override~
~%MOD_FOLDER%/base/spl/K#FAMKIL.SPL~ ~override~
~%MOD_FOLDER%/base/spl/K#FAMREM.SPL~ ~override~
~%MOD_FOLDER%/base/spl/K#IN649.SPL~ ~override~
~%MOD_FOLDER%/base/spl/K#REMBHA.SPL~ ~override~
~%MOD_FOLDER%/base/spl/K#PP_ADD.SPL~ ~override~
~%MOD_FOLDER%/base/spl/K#PP_REM.SPL~ ~override~
Expand Down Expand Up @@ -1908,6 +1909,12 @@ ACTION_FOR_EACH dir IN ~%bgee_dir%/lang/%LANGUAGE_BG1%/movies~ ~%bgee_dir%/lang/
END
END

//disable hardcoded DAYNITE/NITEDAY playback
COPY ~movies/daynite.wbm~ ~movies/daynite_.wbm~
~movies/niteday.wbm~ ~movies/niteday_.wbm~
~.../blank.txt~ ~movies/daynite.wbm~
~.../blank.txt~ ~movies/niteday.wbm~

///// \\\\\
///// WED \\\\\
///// \\\\\
Expand Down Expand Up @@ -2521,45 +2528,6 @@ INCLUDE ~%MOD_FOLDER%/lib/transition.tph~

INCLUDE ~%MOD_FOLDER%/lib/bgee_fixpack.tph~

///// \\\\\
///// Exe patching \\\\\
///// \\\\\

OUTER_SET found_exe = 0
ACTION_IF ~%WEIDU_OS%~ STR_EQ ~win32~ BEGIN
ACTION_IF FILE_EXISTS ~Baldur.exe~ BEGIN
COPY ~Baldur.exe~ ~Baldur.exe~
AT_NOW ~%lua% %MOD_FOLDER%/lib/binary.lua Baldur.exe~
OUTER_SET found_exe = 1
END
END ELSE ACTION_IF ~%WEIDU_OS%~ STR_EQ ~osx~ BEGIN
ACTION_IF FILE_EXISTS ~BaldursGateIIEnhancedEdition.app/Contents/MacOS/BaldursGate-macOS~ BEGIN
OUTER_SPRINT exec ~./BaldursGateIIEnhancedEdition.app/Contents/MacOS/BaldursGate-macOS~
END ELSE ACTION_IF FILE_EXISTS ~../MacOS/BaldursGate-macOS~ BEGIN
OUTER_SPRINT exec ~../MacOS/BaldursGate-macOS~
END ELSE ACTION_IF FILE_EXISTS ~BaldursGateIIEnhancedEdition.app/Contents/MacOS/BaldursGateIIEnhancedEdition~ BEGIN
OUTER_SPRINT exec ~./BaldursGateIIEnhancedEdition.app/Contents/MacOS/BaldursGateIIEnhancedEdition~
END ELSE ACTION_IF FILE_EXISTS ~../MacOS/BaldursGateIIEnhancedEdition~ BEGIN
OUTER_SPRINT exec ~../MacOS/BaldursGateIIEnhancedEdition~
END
ACTION_IF VARIABLE_IS_SET exec BEGIN
COPY ~%exec%~ ~%exec%~
AT_NOW ~%lua% %MOD_FOLDER%/lib/binary.lua %exec%~
OUTER_SET found_exe = 1
END
END ELSE BEGIN //unix
ACTION_FOR_EACH file IN BaldursGateII BaldursGateII64 BaldursGateIIEnhancedEdition BaldursGateIIEnhancedEdition64 BEGIN
ACTION_IF FILE_EXISTS ~%file%~ BEGIN
COPY ~%file%~ ~%file%~
AT_NOW ~%lua% %MOD_FOLDER%/lib/binary.lua ./%file%~
OUTER_SET found_exe = 1
END
END
END
ACTION_IF found_exe = 0 BEGIN
FAIL ~Baldur's Gate II executable not found~
END

///// \\\\\
///// Biffing \\\\\
///// \\\\\
Expand Down
Binary file added EET/base/spl/K#IN649.SPL
Binary file not shown.
4 changes: 2 additions & 2 deletions EET/docs/Modder's Notes.html
Original file line number Diff line number Diff line change
Expand Up @@ -466,13 +466,13 @@ <h3>Adding AreaType to BG1 ARE files</h3>
<p>You can patch area files with WeiDU code during your mod installation. First retrieve the BIT number associated with BG1AREA from AREATYPE.IDS using this action command:</p>
<div class="code">
<pre>
ADD_AREA_TYPE BG1AREA
OUTER_SET BG1AREA = IDS_OF_SYMBOL (AREATYPE BG1AREA)
</pre>
</div>
<p>And than patch area files with this code:</p>
<div class="code">
<pre>
WRITE_SHORT 0x48 THIS | (1 << BG1AREA)
WRITE_SHORT 0x48 THIS BOR BG1AREA
</pre>
</div>

Expand Down
57 changes: 0 additions & 57 deletions EET/lib/bg1_BCS.tph
Original file line number Diff line number Diff line change
@@ -1,60 +1,3 @@
///// \\\\\
///// BGSUNRIS/BGSUNSET movies \\\\\
///// \\\\\

<<<<<<<< .../BGSUNRIS_BGSUNSET-eb.baf
IF
Time(DUSK_END)
!GlobalTimerNotExpired("K#TimerSunset","GLOBAL")
OR(6)
AreaCheckObject("%BASH_FOR_RES%",Player1)
AreaCheckObject("%BASH_FOR_RES%",Player2)
AreaCheckObject("%BASH_FOR_RES%",Player3)
AreaCheckObject("%BASH_FOR_RES%",Player4)
AreaCheckObject("%BASH_FOR_RES%",Player5)
AreaCheckObject("%BASH_FOR_RES%",Player6)
THEN
RESPONSE #100
StartMovie("BGSUNSET")
SetGlobalTimer("K#TimerSunset","GLOBAL",ONE_HOUR)
END

IF
Time(DAWN_END)
!GlobalTimerNotExpired("K#TimerSunrise","GLOBAL")
OR(6)
AreaCheckObject("%BASH_FOR_RES%",Player1)
AreaCheckObject("%BASH_FOR_RES%",Player2)
AreaCheckObject("%BASH_FOR_RES%",Player3)
AreaCheckObject("%BASH_FOR_RES%",Player4)
AreaCheckObject("%BASH_FOR_RES%",Player5)
AreaCheckObject("%BASH_FOR_RES%",Player6)
THEN
RESPONSE #100
StartMovie("BGSUNRIS")
SetGlobalTimer("K#TimerSunrise","GLOBAL",ONE_HOUR)
END
>>>>>>>>

COPY + ~%patch_dir%/are/BG2626.ARE~ ~%patch_dir%/are~ //Candlekeep
READ_BYTE 0x48 flags
PATCH_IF (~%flags%~ BAND BIT3) BEGIN
SET flags = flags - BIT3
WRITE_BYTE 0x48 "flags"
END
BUT_ONLY

ACTION_BASH_FOR ~%patch_dir%/are~ ~^.+\.are$~ BEGIN
COPY + ~%BASH_FOR_FILESPEC%~ ~%BASH_FOR_FILESPEC%~
READ_BYTE 0x48 flags
PATCH_IF (flags BAND BIT0) AND (flags BAND BIT1) AND (flags BAND BIT3) AND (flags BAND BIT6) BEGIN
INNER_ACTION BEGIN
EXTEND_BOTTOM ~%BASH_FOR_RES%.BCS~ ~.../BGSUNRIS_BGSUNSET-eb.baf~ EVALUATE_BUFFER
PRINT ~BGSUNRIS/BGSUNSET movies added to %BASH_FOR_RES%.BCS~
END
END
END

///// \\\\\
///// workaround for engine differences \\\\\
///// \\\\\
Expand Down
2 changes: 2 additions & 0 deletions EET/lib/bg2_2DA.tph
Original file line number Diff line number Diff line change
Expand Up @@ -811,6 +811,8 @@ ACTION_DEFINE_ASSOCIATIVE_ARRAY table_2DA_moviedesc BEGIN
END
COPY_EXISTING ~MOVIDESC.2DA~ ~override~
PRETTY_PRINT_2DA
REPLACE_TEXTUALLY ~^NITEDAY ~ ~NITEDAY_~
REPLACE_TEXTUALLY ~^DAYNITE ~ ~DAYNITE_~
READ_2DA_ENTRIES_NOW movidesc 2
FOR (index = 1; index < movidesc; ++index) BEGIN
READ_2DA_ENTRY_FORMER movidesc index 0 movie
Expand Down
70 changes: 13 additions & 57 deletions EET/lib/bg2_BCS.tph
Original file line number Diff line number Diff line change
Expand Up @@ -167,63 +167,6 @@ ACTION_FOR_EACH file IN AR0514 AR2001 BEGIN
BUT_ONLY
END

///// \\\\\
///// DAYNITE/NITEDAY movies \\\\\
///// \\\\\

<<<<<<<< .../DAYNITE_NITEDAY-eb.baf
IF
Time(DUSK_END)
!GlobalTimerNotExpired("K#TimerSunset","GLOBAL")
OR(6)
AreaCheckObject("%SOURCE_RES%",Player1)
AreaCheckObject("%SOURCE_RES%",Player2)
AreaCheckObject("%SOURCE_RES%",Player3)
AreaCheckObject("%SOURCE_RES%",Player4)
AreaCheckObject("%SOURCE_RES%",Player5)
AreaCheckObject("%SOURCE_RES%",Player6)
THEN
RESPONSE #100
StartMovie("DAYNITE")
SetGlobalTimer("K#TimerSunset","GLOBAL",ONE_HOUR)
END

IF
Time(DAWN_END)
!GlobalTimerNotExpired("K#TimerSunrise","GLOBAL")
OR(6)
AreaCheckObject("%SOURCE_RES%",Player1)
AreaCheckObject("%SOURCE_RES%",Player2)
AreaCheckObject("%SOURCE_RES%",Player3)
AreaCheckObject("%SOURCE_RES%",Player4)
AreaCheckObject("%SOURCE_RES%",Player5)
AreaCheckObject("%SOURCE_RES%",Player6)
THEN
RESPONSE #100
StartMovie("NITEDAY")
SetGlobalTimer("K#TimerSunrise","GLOBAL",ONE_HOUR)
END
>>>>>>>>

/*COPY_EXISTING ~AR2000.ARE~ ~override~ //Trademeet
~AR2800.ARE~ ~override~ //Suldanesselar
READ_BYTE 0x48 flags
PATCH_IF (~%flags%~ BAND BIT3) BEGIN
SET flags = flags - BIT3
WRITE_BYTE 0x48 "flags"
END
BUT_ONLY*/

COPY_EXISTING_REGEXP GLOB ~.*\.are~ ~override~
READ_BYTE 0x48 flags
PATCH_IF (flags BAND BIT0) AND (flags BAND BIT1) AND (flags BAND BIT3) AND (flags BAND BIT6) BEGIN
INNER_ACTION BEGIN
EXTEND_BOTTOM ~%SOURCE_RES%.BCS~ ~.../DAYNITE_NITEDAY-eb.baf~ EVALUATE_BUFFER
PRINT ~DAYNITE/NITEDAY movies added to %SOURCE_RES%.BCS~
END
END
BUT_ONLY

///// \\\\\
///// ACHIEVEM.BCS \\\\\
///// \\\\\
Expand Down Expand Up @@ -1432,8 +1375,21 @@ THEN
END
>>>>>>>>

<<<<<<<< .../baldur25-et.baf
//SPIN649 removal at game startup is hardcoded in executable
IF
!Global("GavePocketPlane","GLOBAL",0)
!TriggerOverride(Player1,HaveSpellRES("SPIN649"))
THEN
RESPONSE #100
ReallyForceSpellRES("K#IN649",Player1)
Continue()
END
>>>>>>>>

EXTEND_TOP ~BALDUR.BCS~ ~.../timers-et.baf~
EXTEND_TOP ~BALDUR25.BCS~ ~.../timers-et.baf~
EXTEND_TOP ~BALDUR25.BCS~ ~.../baldur25-et.baf~
EXTEND_TOP ~BDBALDUR.BCS~ ~.../timers-et.baf~

///// \\\\\
Expand Down
16 changes: 0 additions & 16 deletions EET/lib/binary.lua

This file was deleted.

2 changes: 1 addition & 1 deletion EET/tbl/compatibility.tbl
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ BWS-URL 0 //dummy entry from Big World Setup
DLCMERGER 0 //DLC Merger
BGEETEXTPACK 0 //RUS BG1
SODRUS 0 //RUS SOD

BG1AERIE 1 //Aerie for BG:EE
BG1NPC 1 //The BG1 NPC Project
BG1NPCMUSIC 0 //The BG1 NPC Project Music Pack
Expand All @@ -13,7 +14,6 @@ DRAKE 0 //Drake NPC Mod for BG:EE
DRIZZTSAGA 1 //Drizzt Saga (BP-BGT Worldmap version)
GARRICK-TT 1 //Garrick : Tales of a troubadour
MARGARITA 0 //Margarita for Baldur's Gate: Enhanced Edition
NEERA 0 //Neera Expansion
K9ROUGHWORLD 0 //Rough World
SARADAS_MAGIC 0 //saradas_magic
K9SHARTEELNPC 0 //Sharteel NPC mod for SoD
Expand Down
62 changes: 62 additions & 0 deletions EET_end/EET_end.tp2
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,67 @@ ACTION_PHP_EACH table_append_dlg AS file => var BEGIN
END
END

///// \\\\\
///// DAYNITE/NITEDAY movies \\\\\
///// \\\\\

ACTION_DEFINE_ASSOCIATIVE_ARRAY remapped_mve BEGIN
~DAYNITE~ => ~DAYNITE_~
~NITEDAY~ => ~NITEDAY_~
END

<<<<<<<< .../DAYNITE_NITEDAY-eb.baf
IF
Time(DUSK_END)
!GlobalTimerNotExpired("K#TimerSunset","GLOBAL")
OR(6)
AreaCheckObject("%SOURCE_RES%",Player1)
AreaCheckObject("%SOURCE_RES%",Player2)
AreaCheckObject("%SOURCE_RES%",Player3)
AreaCheckObject("%SOURCE_RES%",Player4)
AreaCheckObject("%SOURCE_RES%",Player5)
AreaCheckObject("%SOURCE_RES%",Player6)
THEN
RESPONSE #100
StartMovie("%DAYNITE%")
SetGlobalTimer("K#TimerSunset","GLOBAL",ONE_HOUR)
END

IF
Time(DAWN_END)
!GlobalTimerNotExpired("K#TimerSunrise","GLOBAL")
OR(6)
AreaCheckObject("%SOURCE_RES%",Player1)
AreaCheckObject("%SOURCE_RES%",Player2)
AreaCheckObject("%SOURCE_RES%",Player3)
AreaCheckObject("%SOURCE_RES%",Player4)
AreaCheckObject("%SOURCE_RES%",Player5)
AreaCheckObject("%SOURCE_RES%",Player6)
THEN
RESPONSE #100
StartMovie("%NITEDAY%")
SetGlobalTimer("K#TimerSunrise","GLOBAL",ONE_HOUR)
END
>>>>>>>>

OUTER_SET BG1AREA = IDS_OF_SYMBOL (AREATYPE BG1AREA)
COPY_EXISTING_REGEXP GLOB ~.*\.ARE~ ~override~
READ_SHORT 0x48 flags
PATCH_IF (flags BAND BIT0) AND (flags BAND BIT1) AND (flags BAND BIT3) AND (flags BAND BIT6) BEGIN
PATCH_IF (flags BAND BG1AREA) != 0 BEGIN
SPRINT ~DAYNITE~ ~BGSUNSET~
SPRINT ~NITEDAY~ ~BGSUNRIS~
END ELSE BEGIN
SPRINT ~DAYNITE~ ~DAYNITE_~
SPRINT ~NITEDAY~ ~NITEDAY_~
END
INNER_ACTION BEGIN
EXTEND_BOTTOM ~%SOURCE_RES%.BCS~ ~.../DAYNITE_NITEDAY-eb.baf~ EVALUATE_BUFFER
PRINT ~%DAYNITE%/%NITEDAY% movies added to %SOURCE_RES%.BCS~
END
END
BUT_ONLY

///// \\\\\
///// Patch files \\\\\
///// \\\\\
Expand All @@ -238,6 +299,7 @@ OUTER_SPRINT remappedPrefix ~remapped~
OUTER_SET strrefAdd = 0
OUTER_SET ddsClonning = 0
OUTER_SET traifyDLG = 0
OUTER_SET skipTpBafD = 0
INCLUDE ~EET/lib/macros.tph~

COPY_EXISTING_REGEXP GLOB ~.+\.DLG$~ ~override~
Expand Down

0 comments on commit df9954f

Please sign in to comment.