Skip to content

Commit

Permalink
Added initial mod files
Browse files Browse the repository at this point in the history
  • Loading branch information
Argent77 committed Mar 11, 2018
1 parent b21c39e commit 08726a7
Show file tree
Hide file tree
Showing 10 changed files with 697 additions and 1 deletion.
28 changes: 28 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
*.2da text
*.baf text
*.bat text eol=crlf
*.d text
*.ini text
*.sh text eol=lf
*.tp2 text
*.tpa text
*.tph text
*.tpp text
*.tra text

*.are binary
*.bam binary
*.bmp binary
*.cre binary
*.eff binary
*.itm binary
*.key binary
*.pvrz binary
*.pro binary
*.spl binary
*.sto binary
*.tlk binary
*.vef binary
*.vvc binary
*.wav binary
*.wed binary
23 changes: 23 additions & 0 deletions A7-DlcMerger/languages/english/setup.tra
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
@0 = ~Merge DLC into game~
@1 = ~"Siege of Dragonspear" DLC~
@2 = ~User-defined DLC~
@3 = ~All available DLCs~

@50 = ~Baldur's Gate: Enhanced Edition required.~
@51 = ~Siege of Dragonspear DLC required.~
@52 = ~Enhanced Edition game required.~

@100 = ~Merging keys...~
@101 = ~Unpacking DLC archive. This may take a while...~

@200 = ~DLC archive is corrupt or incomplete.~
@201 = ~Unable to merge keys.~
@202 = ~Could not unpack DLC archive.~

@300 = ~Enter DLC filename (without path or extension):~
@301 = ~Please enter DLC filename without path or extension.~
@302 = ~Could not find DLC "%dlc_name%". Try again (y/n)?~
@303 = ~Merge operation cancelled.~

@400 = ~Merging DLC "%dlc_name%"...~
@401 = ~No DLC archives found. Installation cancelled.~
60 changes: 60 additions & 0 deletions A7-DlcMerger/lib/dlcmerge.tph
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
INCLUDE ~%MOD_FOLDER%/lib/functions.tph~

DEFINE_ACTION_FUNCTION MERGE_DLC
STR_VAR
dlc_res = ~sod-dlc~
path_temp = ~~
path_unzip = ~unzip~
BEGIN
ACTION_IF (~%path_temp%~ STR_EQ ~~) BEGIN
OUTER_TEXT_SPRINT path_temp ~%MOD_FOLDER%/temp~
END

LAF GET_DLC_INFO
STR_VAR dlc_res
RET dlc_filespec dlc_directory dlc_ext
END

PRINT @101 // Unpacking DLC archive. This may take a while...
AT_NOW ret_val ~%unzip% -oqq "%dlc_filespec%" -x mod.key -d "%path_temp%"~
ACTION_IF (ret_val != 0) BEGIN
DELETE + ~%path_temp%~
FAIL @202 // Could not unpack DLC archive.
END
LAF COPY_RECURSIVE
INT_VAR
delete = 1 // delete file after copy operation
STR_VAR
source_dir = EVAL ~%path_temp%~
dest_dir = ~~
biff_folder = EVAL ~%dlc_res%~
END

PRINT @100 // Merging keys...
MKDIR ~%path_temp%~
AT_NOW ret_val ~%unzip% -oqq "%dlc_filespec%" mod.key -d "%path_temp%"~
ACTION_IF (ret_val != 0 || NOT FILE_EXISTS ~%path_temp%/mod.key~) BEGIN
DELETE + ~%path_temp%~
FAIL @200 // DLC archive is corrupt or incomplete.
END
LAF MERGE_KEYS
STR_VAR
chitin_key = ~chitin.key~
mod_key = EVAL ~%path_temp%/mod.key~
biff_folder = EVAL ~%dlc_res%~
RET
success
END
ACTION_IF (NOT success) BEGIN
DELETE + ~%path_temp%~
FAIL @201 // Unable to merge keys.
END

DELETE + ~%path_temp%~
// TODO: MOVE currently fails if paths contain spaces
ACTION_IF (~%dlc_filespec%~ STRING_CONTAINS_REGEXP ~[ %TAB%]~ = 0) BEGIN
PRINT ~IMPORTANT: Please rename "%dlc_filespec%" to "%dlc_res%.disabled", so that it doesn't interfere with the merged DLC resources.~
END ELSE BEGIN
MOVE ~%dlc_filespec%~ ~%dlc_directory%/%dlc_res%.disabled~
END
END
Loading

0 comments on commit 08726a7

Please sign in to comment.