From 74f1703faa1af8e28c762b42617cf0b55970b68e Mon Sep 17 00:00:00 2001 From: David Date: Sun, 7 Apr 2024 15:00:14 -0400 Subject: [PATCH] Finished comicfans mod example --- .../fonts/game_fonts/ComicFans.meta.json | 1133 ++++++++++++++++- mods/assets/examples/ComicFansFont/meta.json | 5 +- .../textures/2d/font/comicfans/comicfans.json | 4 +- .../textures/2d/font/comicfans/comicfans.png | Bin 679 -> 1052 bytes .../builder/buildTypes/buildFonts.cpp | 9 +- .../builder/buildTypes/buildTexture.cpp | 2 + .../helpers/fileHelper.cpp | 6 + .../dkr_assets_tool_src/helpers/fileHelper.h | 2 + .../prebuild/compileAssets/compile.cpp | 6 +- 9 files changed, 1157 insertions(+), 10 deletions(-) diff --git a/mods/assets/examples/ComicFansFont/fonts/game_fonts/ComicFans.meta.json b/mods/assets/examples/ComicFansFont/fonts/game_fonts/ComicFans.meta.json index 23225576..d31c2aa1 100644 --- a/mods/assets/examples/ComicFansFont/fonts/game_fonts/ComicFans.meta.json +++ b/mods/assets/examples/ComicFansFont/fonts/game_fonts/ComicFans.meta.json @@ -1,6 +1,210 @@ { "characters": { - "A": { + " ": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 0, + "v": 0 + } + }, + "!": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 8, + "v": 0 + } + }, + "\"": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 16, + "v": 0 + } + }, + "#": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 24, + "v": 0 + } + }, + "$": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 32, + "v": 0 + } + }, + "%": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 40, + "v": 0 + } + }, + "&": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 48, + "v": 0 + } + }, + "'": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 56, + "v": 0 + } + }, + "(": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 64, + "v": 0 + } + }, + ")": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 72, + "v": 0 + } + }, + "*": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 80, + "v": 0 + } + }, + "+": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 88, + "v": 0 + } + }, + ",": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 96, + "v": 0 + } + }, + "-": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 104, + "v": 0 + } + }, + ".": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 112, + "v": 0 + } + }, + "/": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 120, + "v": 0 + } + }, + "0": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 0, + "v": 8 + } + }, + "1": { "char-width": 8, "tex-index": 0, "tex-size": { @@ -11,10 +215,935 @@ "u": 8, "v": 8 } + }, + "2": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 16, + "v": 8 + } + }, + "3": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 24, + "v": 8 + } + }, + "4": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 32, + "v": 8 + } + }, + "5": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 40, + "v": 8 + } + }, + "6": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 48, + "v": 8 + } + }, + "7": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 56, + "v": 8 + } + }, + "8": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 64, + "v": 8 + } + }, + "9": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 72, + "v": 8 + } + }, + ":": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 80, + "v": 8 + } + }, + ";": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 88, + "v": 8 + } + }, + "<": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 96, + "v": 8 + } + }, + "=": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 104, + "v": 8 + } + }, + ">": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 112, + "v": 8 + } + }, + "?": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 120, + "v": 8 + } + }, + "@": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 0, + "v": 16 + } + }, + "A": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 8, + "v": 16 + } + }, + "B": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 16, + "v": 16 + } + }, + "C": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 24, + "v": 16 + } + }, + "D": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 32, + "v": 16 + } + }, + "E": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 40, + "v": 16 + } + }, + "F": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 48, + "v": 16 + } + }, + "G": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 56, + "v": 16 + } + }, + "H": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 64, + "v": 16 + } + }, + "I": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 72, + "v": 16 + } + }, + "J": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 80, + "v": 16 + } + }, + "K": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 88, + "v": 16 + } + }, + "L": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 96, + "v": 16 + } + }, + "M": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 104, + "v": 16 + } + }, + "N": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 112, + "v": 16 + } + }, + "O": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 120, + "v": 16 + } + }, + "P": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 0, + "v": 24 + } + }, + "Q": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 8, + "v": 24 + } + }, + "R": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 16, + "v": 24 + } + }, + "S": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 24, + "v": 24 + } + }, + "T": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 32, + "v": 24 + } + }, + "U": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 40, + "v": 24 + } + }, + "V": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 48, + "v": 24 + } + }, + "W": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 56, + "v": 24 + } + }, + "X": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 64, + "v": 24 + } + }, + "Y": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 72, + "v": 24 + } + }, + "Z": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 80, + "v": 24 + } + }, + "[": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 88, + "v": 24 + } + }, + "\\": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 96, + "v": 24 + } + }, + "]": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 104, + "v": 24 + } + }, + "^": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 112, + "v": 24 + } + }, + "_": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 120, + "v": 24 + } + }, + "`": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 0, + "v": 32 + } + }, + "a": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 8, + "v": 32 + } + }, + "b": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 16, + "v": 32 + } + }, + "c": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 24, + "v": 32 + } + }, + "d": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 32, + "v": 32 + } + }, + "e": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 40, + "v": 32 + } + }, + "f": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 48, + "v": 32 + } + }, + "g": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 56, + "v": 32 + } + }, + "h": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 64, + "v": 32 + } + }, + "i": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 72, + "v": 32 + } + }, + "j": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 80, + "v": 32 + } + }, + "k": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 88, + "v": 32 + } + }, + "l": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 96, + "v": 32 + } + }, + "m": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 104, + "v": 32 + } + }, + "n": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 112, + "v": 32 + } + }, + "o": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 120, + "v": 32 + } + }, + "p": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 0, + "v": 40 + } + }, + "q": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 8, + "v": 40 + } + }, + "r": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 16, + "v": 40 + } + }, + "s": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 24, + "v": 40 + } + }, + "t": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 32, + "v": 40 + } + }, + "u": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 40, + "v": 40 + } + }, + "v": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 48, + "v": 40 + } + }, + "w": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 56, + "v": 40 + } + }, + "x": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 64, + "v": 40 + } + }, + "y": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 72, + "v": 40 + } + }, + "z": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 80, + "v": 40 + } + }, + "{": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 88, + "v": 40 + } + }, + "|": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 96, + "v": 40 + } + }, + "}": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 104, + "v": 40 + } + }, + "~": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 112, + "v": 40 + } } }, + "fixed-width": 0, "name": "ComicFans", - "special-character-width": 3, + "special-character-width": 8, "tab-width": 32, "textures": [ "ASSET_TEX2D_COMICFANS" diff --git a/mods/assets/examples/ComicFansFont/meta.json b/mods/assets/examples/ComicFansFont/meta.json index 485e18c9..034bd83b 100644 --- a/mods/assets/examples/ComicFansFont/meta.json +++ b/mods/assets/examples/ComicFansFont/meta.json @@ -1,6 +1,5 @@ { "name": "Comic Fans Font", - "author" : "Example", - "revision": 3, - "description": "Font that was made by damieng. See: https://damieng.com/typography/zx-origins/comic-fans/" + "authors" : ["Example", "Damien Guard"], + "description": "A fun 8x8 font that was created by Damien Guard. See: https://damieng.com/typography/zx-origins/comic-fans/" } \ No newline at end of file diff --git a/mods/assets/examples/ComicFansFont/textures/2d/font/comicfans/comicfans.json b/mods/assets/examples/ComicFansFont/textures/2d/font/comicfans/comicfans.json index 34bcce5d..69e54338 100644 --- a/mods/assets/examples/ComicFansFont/textures/2d/font/comicfans/comicfans.json +++ b/mods/assets/examples/ComicFansFont/textures/2d/font/comicfans/comicfans.json @@ -1,8 +1,8 @@ { "compressed": true, "flags": { - "wrap-s": "Wrap", - "wrap-t": "Wrap" + "wrap-s": "CLAMP", + "wrap-t": "CLAMP" }, "format": "IA4", "images": [ diff --git a/mods/assets/examples/ComicFansFont/textures/2d/font/comicfans/comicfans.png b/mods/assets/examples/ComicFansFont/textures/2d/font/comicfans/comicfans.png index 323b98c1521dca99dd36b068932d19a5cb4a0c79..caa743aa96830332c61f94607fc1c4035e651c3a 100644 GIT binary patch delta 1036 zcmZ3^I)_8CGr-TCmrII^fq{Y7)59f*fq|icfq}t*gPDPW;hk1f&qPIqdbR+c5ZC|z z|1&T!gdVzF$H2hAR1)MD{GZ|Jb^|X41_sUokH}&M2EIce%qXhi)xf~OJkis|F(ktM zXi#L?Z3CX1cl9rm%ovuuv3st3Hspv7gXXET^VhS^vJc%TrZ&A`_i`DP|1zfaIgKZk zJYPJ}+VVN-GspK$`KEEqf0OH<-I<_2cgtJD9ldHr$CKZ%UZ{T~cc#6?cjwH4H(Jf} zu9=qKV!GS6Zrk&~ZyD9e*`}Z8E&kkc>wWt*{t1B`FOo0+(>dk;pXJKE-S=}}c=|n< zZmIUW={?_$Pd%I8asLtd_m`{W_p3!UiV;kyzh^dk@i_hyxb>XfdT)G?4)ez+U$)kl zzf?bWr7!x!cc=9m*p+Qm(u{ai-tXgjoiy2QXYIl%{o&L4EbS+DeZT(6GVy877f$K( zI-K90uF;bfteJhEVYa+aoR#WXcAGoLQ@Yj^nBOVezID&y&e*UE>nwK`?%o%1u1Mfq z-;KWTeb1$)*B&??_+P1@@u$k&mHS_OF)zQbJ+GcCb#1`Z0@0qIg;}qjc0Rj%xGSWP zHB4Xe{0FbaCjVca<*=IWcTMMK!b_FbNmXiJPyZ?~|60_tOsnexyT*>0xdO*kp5C0H zdpRa?|LRaDy^!yB6>gW;85VK0W@?I;p5RbDoq2!r%#w;zi}|yCpGVO!zrIsyZrd#G@GVxU zw?5`Cw)fh{s}Z*ERY{j%<5&)qMPu^{}lM5ST9 z+uwBco}I^gjO_yV&b&NbH@|G#o(Sgb-VTc&w5xkn?uN27IiQpll) zTSFRpx-YFaW!d^n<;`5NMQSe-V-&vcskh9M%97b$FT$_#qFYsS zH+zEO=3QxzOC7A87oIaX*O>o!_wB-i>(}qEj1lIQIk4ZJfq{X+)78&qol`;+0DBee A)Bpeg delta 660 zcmbQkv7A-0Gr-TCmrII^fq{Y7)59f*fq{{Mfq_ASk(q&kLEmp<`b0&Add>om$YKTt zzQZ8Qcszea3IhWJTYyi9>;M1%85kHs4_&TfU|?V@3GxeOaCmkjje&tl*3-o?L_)Il z;Kr=rKneB__S2nzObD`bYHObJ@NogBq*2SIhkWg)KNe`LOnDKqBv@lmdD?B$_aQv%dh;7oFbI<%nP+QE&rFwG@PGiov zXzaiI&|Epj1$BiYE-G`rGd9UEvZ#wF&QxR&@mR_IK9nb__#{^XkID28H=k;&e3*1% z%ggq{@P>wO3~r*ThtgS@C$zcWTz_uPA;klolG5r&3mR8S88Ad{o*%sXnPsMLy#Rx9 zgF2@xV@6NS(elpKUBb=`Js->u+Rv~}pHqBnR^L>C9^-R+wkh5Ska}-&;r-2jfg36p z==?hU`Cr>o0q4A_9YqHs?Klrs%UeqSUj2E4qDa!>VxhqPM*Yd+r9Z;<`mRa)dNb2F zQ>|_G$E|W340Ic3i~HWaR=PWF>x%XHvv1ZPk8HpF@j7F-dQ!sHS?lw{zOI_;x;yLs zn%7@_4{uk$zqrExh(p%9OXowDmziY;-wykF+RW3m_WG}ol`|jI*Bx${n8@GL!)e`8 z{ky>6MbpHGj1i3>p3kauMYodh&&~(qru((KyPg+WPZeD*_`QyVXgf( zmXXg?oLcx-@OASBPCVW?ZR3iQ;WZlPmDSyiS>F6$l1N;g_J(8I9r>9PI;TqWOwidth = imgWidth; header->height = imgHeight; + // TODO: Check if width and/or height is greater than 255, and error if it is! + if(writeSize) { header->textureSize = DataHelper::align16(sizeof(TextureHeader) + ImageHelper::image_size(imgWidth, imgHeight, format)); } else { diff --git a/tools/dkr_assets_tool_src/helpers/fileHelper.cpp b/tools/dkr_assets_tool_src/helpers/fileHelper.cpp index ebb3969c..e3efeeab 100644 --- a/tools/dkr_assets_tool_src/helpers/fileHelper.cpp +++ b/tools/dkr_assets_tool_src/helpers/fileHelper.cpp @@ -305,6 +305,12 @@ fs::path FileHelper::get_directory(const fs::path &path) { return path.parent_path(); } +void FileHelper::delete_directory(const fs::path &path) { + if(fs::exists(path)) { + fs::remove_all(path); + } +} + void FileHelper::rename(const fs::path &oldPath, const fs::path &newPath) { fs::rename(oldPath, newPath); } diff --git a/tools/dkr_assets_tool_src/helpers/fileHelper.h b/tools/dkr_assets_tool_src/helpers/fileHelper.h index d21bf31a..2c75cb1b 100644 --- a/tools/dkr_assets_tool_src/helpers/fileHelper.h +++ b/tools/dkr_assets_tool_src/helpers/fileHelper.h @@ -46,6 +46,8 @@ public: static fs::path get_directory(const fs::path &path); + static void delete_directory(const fs::path &path); + static void rename(const fs::path &oldPath, const fs::path &newPath); static void copy(const fs::path &oldPath, const fs::path &newPath, bool recursive = false); diff --git a/tools/dkr_assets_tool_src/prebuild/compileAssets/compile.cpp b/tools/dkr_assets_tool_src/prebuild/compileAssets/compile.cpp index 260cec49..3ddef8df 100644 --- a/tools/dkr_assets_tool_src/prebuild/compileAssets/compile.cpp +++ b/tools/dkr_assets_tool_src/prebuild/compileAssets/compile.cpp @@ -127,8 +127,10 @@ void CompileAssets::_compile_assets() { _statFile->set_value("/last-order-size", _modOrderCount); - // First copy the vanilla path to the out path. - // This seems to be the slowest part, mainly limited by IO speed (copying thousands of small files). + // First clear the output directory (if it exists) + FileHelper::delete_directory(_outAssetsPath); + + // Copy all the vanilla files over to the output directory FileHelper::copy(_vanillaAssetsPath, _outAssetsPath, true); if(_modOrderCount == 0) {