mirror of
https://github.com/lifegpc/msg-tool.git
synced 2026-06-06 21:08:48 +08:00
Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| c25bd62ff1 | |||
| 3820dbb194 | |||
| d6581b597f | |||
| 243394db6c | |||
| b5189695df | |||
| 2a098d2af2 |
5
.github/workflows/github-pages.yml
vendored
5
.github/workflows/github-pages.yml
vendored
@@ -50,9 +50,12 @@ jobs:
|
||||
with:
|
||||
fetch-depth: 0
|
||||
submodules: true
|
||||
- name: Install Nightly Rust
|
||||
run: |
|
||||
curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain nightly -y
|
||||
- name: Document
|
||||
run: |
|
||||
cargo doc --bins -vv || exit 1
|
||||
cargo doc --features unstable --document-private-items -vv || exit 1
|
||||
- name: Add index files
|
||||
run: |
|
||||
echo '<!DOCTYPE HTML><html><head><script>window.location.href="msg_tool/"</script></head><body><a href="msg_tool/">Content Moved</a></body></html>' > target/doc/index.html
|
||||
|
||||
174
Cargo.lock
generated
174
Cargo.lock
generated
@@ -25,9 +25,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "anstream"
|
||||
version = "0.6.19"
|
||||
version = "0.6.20"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "301af1932e46185686725e0fad2f8f2aa7da69dd70bf6ecc44d6b703844a3933"
|
||||
checksum = "3ae563653d1938f79b1ab1b5e668c87c76a9930414574a6583a7b7e11a8e6192"
|
||||
dependencies = [
|
||||
"anstyle",
|
||||
"anstyle-parse",
|
||||
@@ -55,29 +55,29 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "anstyle-query"
|
||||
version = "1.1.3"
|
||||
version = "1.1.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6c8bdeb6047d8983be085bab0ba1472e6dc604e7041dbf6fcd5e71523014fae9"
|
||||
checksum = "9e231f6134f61b71076a3eab506c379d4f36122f2af15a9ff04415ea4c3339e2"
|
||||
dependencies = [
|
||||
"windows-sys",
|
||||
"windows-sys 0.60.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "anstyle-wincon"
|
||||
version = "3.0.9"
|
||||
version = "3.0.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "403f75924867bb1033c59fbf0797484329750cfbe3c4325cd33127941fabc882"
|
||||
checksum = "3e0633414522a32ffaac8ac6cc8f748e090c5717661fddeea04219e2344f5f2a"
|
||||
dependencies = [
|
||||
"anstyle",
|
||||
"once_cell_polyfill",
|
||||
"windows-sys",
|
||||
"windows-sys 0.60.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "anyhow"
|
||||
version = "1.0.98"
|
||||
version = "1.0.99"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e16d2d3311acee920a9eb8d33b8cbc1787ce4a264e85f964c2404b969bdcd487"
|
||||
checksum = "b0674a1ddeecb70197781e945de4b3b8ffb61fa939a5597bcf48503737663100"
|
||||
|
||||
[[package]]
|
||||
name = "arrayvec"
|
||||
@@ -129,9 +129,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "bytemuck"
|
||||
version = "1.23.1"
|
||||
version = "1.23.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5c76a5792e44e4abe34d3abf15636779261d45a7450612059293d1d2cfc63422"
|
||||
checksum = "3995eaeebcdf32f91f980d360f78732ddc061097ab4e39991ae7a6ace9194677"
|
||||
|
||||
[[package]]
|
||||
name = "byteorder"
|
||||
@@ -141,9 +141,9 @@ checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b"
|
||||
|
||||
[[package]]
|
||||
name = "cc"
|
||||
version = "1.2.31"
|
||||
version = "1.2.32"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c3a42d84bb6b69d3a8b3eaacf0d88f179e1929695e1ad012b6cf64d9caaa5fd2"
|
||||
checksum = "2352e5597e9c544d5e6d9c95190d5d27738ade584fa8db0a16e130e5c2b5296e"
|
||||
dependencies = [
|
||||
"jobserver",
|
||||
"libc",
|
||||
@@ -164,9 +164,9 @@ checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724"
|
||||
|
||||
[[package]]
|
||||
name = "clap"
|
||||
version = "4.5.42"
|
||||
version = "4.5.45"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ed87a9d530bb41a67537289bafcac159cb3ee28460e0a4571123d2a778a6a882"
|
||||
checksum = "1fc0e74a703892159f5ae7d3aac52c8e6c392f5ae5f359c70b5881d60aaac318"
|
||||
dependencies = [
|
||||
"clap_builder",
|
||||
"clap_derive",
|
||||
@@ -183,9 +183,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "clap_builder"
|
||||
version = "4.5.42"
|
||||
version = "4.5.44"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "64f4f3f3c77c94aff3c7e9aac9a2ca1974a5adf392a8bb751e827d6d127ab966"
|
||||
checksum = "b3e7f4214277f3c7aa526a59dd3fbe306a370daee1f8b7b8c987069cd8e888a8"
|
||||
dependencies = [
|
||||
"anstream",
|
||||
"anstyle",
|
||||
@@ -195,9 +195,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "clap_derive"
|
||||
version = "4.5.41"
|
||||
version = "4.5.45"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ef4f52386a59ca4c860f7393bcf8abd8dfd91ecccc0f774635ff68e92eeef491"
|
||||
checksum = "14cb31bb0a7d536caef2639baa7fad459e15c3144efefa6dbd1c84562c4739f6"
|
||||
dependencies = [
|
||||
"heck",
|
||||
"proc-macro2",
|
||||
@@ -273,7 +273,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "46f93780a459b7d656ef7f071fe699c4d3d2cb201c4b24d085b6ddc505276e73"
|
||||
dependencies = [
|
||||
"nix",
|
||||
"windows-sys",
|
||||
"windows-sys 0.59.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -466,9 +466,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "glob"
|
||||
version = "0.3.2"
|
||||
version = "0.3.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a8d1add55171497b4705a648c6b583acafb01d58050a51727785f0b2c8e0a2b2"
|
||||
checksum = "0cc23270f6e1808e30a928bdc84dea0b9b4136a8bc82338574f23baf47bbd280"
|
||||
|
||||
[[package]]
|
||||
name = "hashbrown"
|
||||
@@ -667,15 +667,15 @@ checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe"
|
||||
|
||||
[[package]]
|
||||
name = "libc"
|
||||
version = "0.2.174"
|
||||
version = "0.2.175"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1171693293099992e19cddea4e8b849964e9846f4acee11b3948bcc337be8776"
|
||||
checksum = "6a82ae493e598baaea5209805c49bbf2ea7de956d50d7da0da1164f9c6d28543"
|
||||
|
||||
[[package]]
|
||||
name = "libtlg-rs"
|
||||
version = "0.1.3"
|
||||
version = "0.2.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "be080c5fe779454ef960a60f614b3a38f8da3c6541bad3a90fa87083aa449245"
|
||||
checksum = "5522473f86515bf34cee870455c62f93e83bc9beb4089c5681ca2dcb5cd2b476"
|
||||
dependencies = [
|
||||
"lazy_static",
|
||||
"overf",
|
||||
@@ -796,7 +796,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "msg_tool"
|
||||
version = "0.1.3"
|
||||
version = "0.1.4"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"byteorder",
|
||||
@@ -828,16 +828,16 @@ dependencies = [
|
||||
"url",
|
||||
"utf16string",
|
||||
"webp",
|
||||
"windows-sys",
|
||||
"windows-sys 0.60.2",
|
||||
"xml5ever",
|
||||
"zstd",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "msg_tool_macro"
|
||||
version = "0.1.0"
|
||||
version = "0.1.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5977a64deff9e0d3a55e15533e8b35ee28dcb3699bbcf74c08fd0064f62a2afe"
|
||||
checksum = "c194c0fd349cbd1c96b3771da400464a2f1f68b82335d0043a36d9326884c8db"
|
||||
dependencies = [
|
||||
"quote",
|
||||
"syn",
|
||||
@@ -916,7 +916,7 @@ dependencies = [
|
||||
"libc",
|
||||
"redox_syscall",
|
||||
"smallvec",
|
||||
"windows-targets",
|
||||
"windows-targets 0.52.6",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -1008,9 +1008,9 @@ checksum = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c"
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro2"
|
||||
version = "1.0.95"
|
||||
version = "1.0.97"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "02b3e5e68a3a1a02aad3ec490a98007cbc13c37cbe84a3cd7b8e406d76e7f778"
|
||||
checksum = "d61789d7719defeb74ea5fe81f2fdfdbd28a803847077cecce2ff14e1472f6f1"
|
||||
dependencies = [
|
||||
"unicode-ident",
|
||||
]
|
||||
@@ -1252,9 +1252,9 @@ checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f"
|
||||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "2.0.104"
|
||||
version = "2.0.105"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "17b6f705963418cdb9927482fa304bc562ece2fdd4f616084c50b7023b435a40"
|
||||
checksum = "7bc3fcb250e53458e712715cf74285c1f889686520d79294a9ef3bd7aa1fc619"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
@@ -1391,13 +1391,28 @@ dependencies = [
|
||||
"libwebp-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-link"
|
||||
version = "0.1.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5e6ad25900d524eaabdbbb96d20b4311e1e7ae1699af4fb28c17ae66c80d798a"
|
||||
|
||||
[[package]]
|
||||
name = "windows-sys"
|
||||
version = "0.59.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b"
|
||||
dependencies = [
|
||||
"windows-targets",
|
||||
"windows-targets 0.52.6",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-sys"
|
||||
version = "0.60.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f2f500e4d28234f72040990ec9d39e3a6b950f9f22d3dba18416c35882612bcb"
|
||||
dependencies = [
|
||||
"windows-targets 0.53.3",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -1406,14 +1421,31 @@ version = "0.52.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973"
|
||||
dependencies = [
|
||||
"windows_aarch64_gnullvm",
|
||||
"windows_aarch64_msvc",
|
||||
"windows_i686_gnu",
|
||||
"windows_i686_gnullvm",
|
||||
"windows_i686_msvc",
|
||||
"windows_x86_64_gnu",
|
||||
"windows_x86_64_gnullvm",
|
||||
"windows_x86_64_msvc",
|
||||
"windows_aarch64_gnullvm 0.52.6",
|
||||
"windows_aarch64_msvc 0.52.6",
|
||||
"windows_i686_gnu 0.52.6",
|
||||
"windows_i686_gnullvm 0.52.6",
|
||||
"windows_i686_msvc 0.52.6",
|
||||
"windows_x86_64_gnu 0.52.6",
|
||||
"windows_x86_64_gnullvm 0.52.6",
|
||||
"windows_x86_64_msvc 0.52.6",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-targets"
|
||||
version = "0.53.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d5fe6031c4041849d7c496a8ded650796e7b6ecc19df1a431c1a363342e5dc91"
|
||||
dependencies = [
|
||||
"windows-link",
|
||||
"windows_aarch64_gnullvm 0.53.0",
|
||||
"windows_aarch64_msvc 0.53.0",
|
||||
"windows_i686_gnu 0.53.0",
|
||||
"windows_i686_gnullvm 0.53.0",
|
||||
"windows_i686_msvc 0.53.0",
|
||||
"windows_x86_64_gnu 0.53.0",
|
||||
"windows_x86_64_gnullvm 0.53.0",
|
||||
"windows_x86_64_msvc 0.53.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -1422,48 +1454,96 @@ version = "0.52.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3"
|
||||
|
||||
[[package]]
|
||||
name = "windows_aarch64_gnullvm"
|
||||
version = "0.53.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "86b8d5f90ddd19cb4a147a5fa63ca848db3df085e25fee3cc10b39b6eebae764"
|
||||
|
||||
[[package]]
|
||||
name = "windows_aarch64_msvc"
|
||||
version = "0.52.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469"
|
||||
|
||||
[[package]]
|
||||
name = "windows_aarch64_msvc"
|
||||
version = "0.53.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c7651a1f62a11b8cbd5e0d42526e55f2c99886c77e007179efff86c2b137e66c"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_gnu"
|
||||
version = "0.52.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_gnu"
|
||||
version = "0.53.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c1dc67659d35f387f5f6c479dc4e28f1d4bb90ddd1a5d3da2e5d97b42d6272c3"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_gnullvm"
|
||||
version = "0.52.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_gnullvm"
|
||||
version = "0.53.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9ce6ccbdedbf6d6354471319e781c0dfef054c81fbc7cf83f338a4296c0cae11"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_msvc"
|
||||
version = "0.52.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_msvc"
|
||||
version = "0.53.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "581fee95406bb13382d2f65cd4a908ca7b1e4c2f1917f143ba16efe98a589b5d"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_gnu"
|
||||
version = "0.52.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_gnu"
|
||||
version = "0.53.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2e55b5ac9ea33f2fc1716d1742db15574fd6fc8dadc51caab1c16a3d3b4190ba"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_gnullvm"
|
||||
version = "0.52.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_gnullvm"
|
||||
version = "0.53.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0a6e035dd0599267ce1ee132e51c27dd29437f63325753051e71dd9e42406c57"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_msvc"
|
||||
version = "0.52.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_msvc"
|
||||
version = "0.53.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "271414315aff87387382ec3d271b52d7ae78726f5d44ac98b4f4030c91880486"
|
||||
|
||||
[[package]]
|
||||
name = "wit-bindgen-rt"
|
||||
version = "0.39.0"
|
||||
@@ -1567,9 +1647,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "zerovec"
|
||||
version = "0.11.2"
|
||||
version = "0.11.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4a05eb080e015ba39cc9e23bbe5e7fb04d5fb040350f99f34e338d5fdd294428"
|
||||
checksum = "e7aa2bd55086f1ab526693ecbe444205da57e25f4489879da80635a46d90e73b"
|
||||
dependencies = [
|
||||
"yoke",
|
||||
"zerofrom",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "msg_tool"
|
||||
version = "0.1.3"
|
||||
version = "0.1.4"
|
||||
edition = "2024"
|
||||
repository = "https://github.com/lifegpc/msg-tool"
|
||||
description = "A command-line tool for exporting, importing, packing, and unpacking script files."
|
||||
@@ -21,12 +21,12 @@ flate2 = { version = "1.1", optional = true }
|
||||
int-enum = { version = "1.2", optional = true }
|
||||
json = { version = "0.12", optional = true }
|
||||
lazy_static = "1.5.0"
|
||||
libtlg-rs = { version = "0.1", optional = true }
|
||||
libtlg-rs = { version = "0.2", optional = true, features = ["encode"] }
|
||||
markup5ever = { version = "0.35", optional = true }
|
||||
markup5ever_rcdom = { version = "0.35", optional = true }
|
||||
memchr = { version = "2.7", optional = true }
|
||||
mozjpeg = { version = "0.10", optional = true }
|
||||
msg_tool_macro = { version = "0.1.0" }
|
||||
msg_tool_macro = { version = "0.1.5" }
|
||||
overf = "0.1"
|
||||
png = { version = "0.17", optional = true }
|
||||
rand = { version = "0.9", optional = true }
|
||||
@@ -75,6 +75,7 @@ yaneurao-itufuru = ["yaneurao"]
|
||||
image = ["png"]
|
||||
image-jpg = ["mozjpeg"]
|
||||
image-webp = ["webp"]
|
||||
unstable = ["msg_tool_macro/unstable"]
|
||||
# utils feature
|
||||
utils-bit-stream = []
|
||||
utils-blowfish = ["byteorder"]
|
||||
|
||||
@@ -155,7 +155,7 @@ msg-tool create -t <script-type> <input> <output>
|
||||
|
||||
| Image Type | Feature Name | Name | Export | Import | Export Multiple | Import Multiple | Create | Remarks |
|
||||
|---|---|---|---|---|---|---|---|---|
|
||||
| `kirikiri-tlg`/`kr-tlg` | `kirikiri-img` | Kirikiri TLG Image File (.tlg) | ✔️ | ❌ | ❌ | ❌ | ❌ | |
|
||||
| `kirikiri-tlg`/`kr-tlg` | `kirikiri-img` | Kirikiri TLG Image File (.tlg) | ✔️ | ✔️ | ❌ | ❌ | ✔️ | tlg6 is not supported when importing/creating image |
|
||||
| `kirikiri-pimg`/`kr-pimg` | `kirikiri-img` | Kirikiri Multiple Image File (.pimg) | ❌ | ❌ | ✔️ | ❌ | ❌ | |
|
||||
| `kirikiri-dref`/`kr-dref` | `kirikiri-img` | Kirikiri DPAK-referenced Image File (.dref) | ✔️ | ❌ | ❌ | ❌ | ❌ | |
|
||||
### WillPlus / AdvHD
|
||||
|
||||
@@ -7,6 +7,8 @@ def filter_name(name):
|
||||
return False
|
||||
if name.startswith("all-"):
|
||||
return False
|
||||
if name == "unstable":
|
||||
return False
|
||||
return True
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "msg_tool_macro"
|
||||
version = "0.1.0"
|
||||
version = "0.1.5"
|
||||
edition = "2024"
|
||||
repository = "https://github.com/lifegpc/msg-tool"
|
||||
description = "A procedural macro for the msg-tool project."
|
||||
@@ -11,7 +11,11 @@ proc-macro = true
|
||||
|
||||
[features]
|
||||
artemis-arc = []
|
||||
unstable = []
|
||||
|
||||
[dependencies]
|
||||
syn = { version = "2", features = ["full"] }
|
||||
quote = "1"
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
all-features = true
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
|
||||
#![cfg_attr(feature = "unstable", feature(doc_auto_cfg))]
|
||||
use proc_macro::TokenStream;
|
||||
use syn::parse::discouraged::Speculative;
|
||||
use syn::spanned::Spanned;
|
||||
@@ -197,10 +199,10 @@ pub fn struct_pack_derive(input: TokenStream) -> TokenStream {
|
||||
}
|
||||
});
|
||||
} else if let Some(pstring_type) = pstring_type {
|
||||
let write_fn = syn::Ident::new(format!("write_{}", pstring_type).as_str(), pstring_type.span());
|
||||
cur = Some(quote::quote! {
|
||||
let encoded = crate::utils::encoding::encode_string(encoding, &self.#field_name, true)?;
|
||||
writer.#write_fn(encoded.len() as #pstring_type)?;
|
||||
let len = encoded.len() as #pstring_type;
|
||||
len.pack(writer, big, encoding)?;
|
||||
writer.write_all(&encoded)?;
|
||||
});
|
||||
}
|
||||
@@ -218,10 +220,9 @@ pub fn struct_pack_derive(input: TokenStream) -> TokenStream {
|
||||
}
|
||||
});
|
||||
} else if let Some(pvec_type) = pvec_type {
|
||||
let write_fn = syn::Ident::new(format!("write_{}", pvec_type).as_str(), pvec_type.span());
|
||||
cur = Some(quote::quote! {
|
||||
let len = self.#field_name.len() as #pvec_type;
|
||||
writer.#write_fn(len)?;
|
||||
len.pack(writer, big, encoding)?;
|
||||
for item in &self.#field_name {
|
||||
item.pack(writer, big, encoding)?;
|
||||
}
|
||||
@@ -381,10 +382,10 @@ pub fn struct_pack_derive(input: TokenStream) -> TokenStream {
|
||||
}
|
||||
});
|
||||
} else if let Some(pstring_type) = pstring_type {
|
||||
let write_fn = syn::Ident::new(format!("write_{}", pstring_type).as_str(), pstring_type.span());
|
||||
cur = Some(quote::quote! {
|
||||
let encoded = crate::utils::encoding::encode_string(encoding, &#field_name, true)?;
|
||||
writer.#write_fn(encoded.len() as #pstring_type)?;
|
||||
let len = encoded.len() as #pstring_type;
|
||||
len.pack(writer, big, encoding)?;
|
||||
writer.write_all(&encoded)?;
|
||||
});
|
||||
}
|
||||
@@ -402,10 +403,9 @@ pub fn struct_pack_derive(input: TokenStream) -> TokenStream {
|
||||
}
|
||||
});
|
||||
} else if let Some(pvec_type) = pvec_type {
|
||||
let write_fn = syn::Ident::new(format!("write_{}", pvec_type).as_str(), pvec_type.span());
|
||||
cur = Some(quote::quote! {
|
||||
let len = #field_name.len() as #pvec_type;
|
||||
writer.#write_fn(len)?;
|
||||
len.pack(writer, big, encoding)?;
|
||||
for item in &#field_name {
|
||||
item.pack(writer, big, encoding)?;
|
||||
}
|
||||
@@ -587,9 +587,8 @@ pub fn struct_unpack_derive(input: TokenStream) -> TokenStream {
|
||||
let #field_name = reader.read_fstring(#fixed_string, encoding, #trim)?;
|
||||
});
|
||||
} else if let Some(pstring_type) = pstring_type {
|
||||
let read_fn = syn::Ident::new(format!("read_{}", pstring_type).as_str(), pstring_type.span());
|
||||
cur = Some(quote::quote! {
|
||||
let len = reader.#read_fn()? as usize;
|
||||
let len = <#pstring_type>::unpack(&mut reader, big, encoding)? as usize;
|
||||
let #field_name = reader.read_exact_vec(len)?;
|
||||
let #field_name = crate::utils::encoding::decode_to_string(encoding, &#field_name, true)?;
|
||||
});
|
||||
@@ -603,9 +602,8 @@ pub fn struct_unpack_derive(input: TokenStream) -> TokenStream {
|
||||
let #field_name = reader.read_struct_vec(#fixed_vec, big, encoding)?;
|
||||
});
|
||||
} else if let Some(pvec_type) = pvec_type {
|
||||
let read_fn = syn::Ident::new(format!("read_{}", pvec_type).as_str(), pvec_type.span());
|
||||
cur = Some(quote::quote! {
|
||||
let len = reader.#read_fn()? as usize;
|
||||
let len = <#pvec_type>::unpack(&mut reader, big, encoding)? as usize;
|
||||
let #field_name = reader.read_struct_vec(len, big, encoding)?;
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
//! A Rust library for exporting, importing, packing, and unpacking script files.
|
||||
//!
|
||||
//! For more information, please visit the [GitHub repository](https://github.com/lifegpc/msg-tool).
|
||||
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
|
||||
#![cfg_attr(feature = "unstable", feature(doc_auto_cfg))]
|
||||
pub mod ext;
|
||||
pub mod format;
|
||||
pub mod output_scripts;
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
use crate::ext::io::*;
|
||||
use crate::scripts::base::*;
|
||||
use crate::types::*;
|
||||
use crate::utils::img::*;
|
||||
use anyhow::Result;
|
||||
use libtlg_rs::*;
|
||||
use std::io::{Read, Seek};
|
||||
@@ -54,6 +55,44 @@ impl ScriptBuilder for TlgImageBuilder {
|
||||
}
|
||||
None
|
||||
}
|
||||
|
||||
fn can_create_image_file(&self) -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
fn create_image_file<'a>(
|
||||
&'a self,
|
||||
mut data: ImageData,
|
||||
writer: Box<dyn WriteSeek + 'a>,
|
||||
_options: &ExtraConfig,
|
||||
) -> Result<()> {
|
||||
if data.depth != 8 {
|
||||
return Err(anyhow::anyhow!("Unsupported image depth: {}", data.depth));
|
||||
}
|
||||
let color_type = match data.color_type {
|
||||
ImageColorType::Bgr => TlgColorType::Bgr24,
|
||||
ImageColorType::Bgra => TlgColorType::Bgra32,
|
||||
ImageColorType::Grayscale => TlgColorType::Grayscale8,
|
||||
ImageColorType::Rgb => {
|
||||
convert_rgb_to_bgr(&mut data)?;
|
||||
TlgColorType::Bgr24
|
||||
}
|
||||
ImageColorType::Rgba => {
|
||||
convert_rgba_to_bgra(&mut data)?;
|
||||
TlgColorType::Bgra32
|
||||
}
|
||||
};
|
||||
let tlg = Tlg {
|
||||
width: data.width,
|
||||
height: data.height,
|
||||
color: color_type,
|
||||
data: data.data,
|
||||
tags: Default::default(),
|
||||
version: 5, // Currently only version 5 is supported
|
||||
};
|
||||
save_tlg(&tlg, writer)?;
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
@@ -99,4 +138,37 @@ impl Script for TlgImage {
|
||||
data: self.data.data.clone(),
|
||||
})
|
||||
}
|
||||
|
||||
fn import_image<'a>(
|
||||
&'a self,
|
||||
mut data: ImageData,
|
||||
file: Box<dyn WriteSeek + 'a>,
|
||||
) -> Result<()> {
|
||||
if data.depth != 8 {
|
||||
return Err(anyhow::anyhow!("Unsupported image depth: {}", data.depth));
|
||||
}
|
||||
let color_type = match data.color_type {
|
||||
ImageColorType::Bgr => TlgColorType::Bgr24,
|
||||
ImageColorType::Bgra => TlgColorType::Bgra32,
|
||||
ImageColorType::Grayscale => TlgColorType::Grayscale8,
|
||||
ImageColorType::Rgb => {
|
||||
convert_rgb_to_bgr(&mut data)?;
|
||||
TlgColorType::Bgr24
|
||||
}
|
||||
ImageColorType::Rgba => {
|
||||
convert_rgba_to_bgra(&mut data)?;
|
||||
TlgColorType::Bgra32
|
||||
}
|
||||
};
|
||||
let tlg = Tlg {
|
||||
width: data.width,
|
||||
height: data.height,
|
||||
color: color_type,
|
||||
data: data.data,
|
||||
tags: self.data.tags.clone(),
|
||||
version: 5, // Currently only version 5 is supported
|
||||
};
|
||||
save_tlg(&tlg, file)?;
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
use windows_sys::Win32::Foundation::{ERROR_NO_UNICODE_TRANSLATION, GetLastError};
|
||||
use windows_sys::Win32::Globalization::{
|
||||
CP_UTF7, CP_UTF8, MB_ERR_INVALID_CHARS, MultiByteToWideChar, WC_ERR_INVALID_CHARS,
|
||||
WideCharToMultiByte,
|
||||
CP_UTF7, CP_UTF8, MB_ERR_INVALID_CHARS, MultiByteToWideChar, WideCharToMultiByte,
|
||||
};
|
||||
use windows_sys::Win32::System::Diagnostics::Debug::{
|
||||
FORMAT_MESSAGE_FROM_SYSTEM, FORMAT_MESSAGE_IGNORE_INSERTS, FormatMessageW,
|
||||
@@ -100,16 +99,11 @@ pub fn encode_string(cp: u32, data: &str, check: bool) -> Result<Vec<u8>, WinErr
|
||||
if data.is_empty() {
|
||||
return Ok(Vec::new());
|
||||
}
|
||||
let dwflags = if check && cp == 65001 {
|
||||
WC_ERR_INVALID_CHARS
|
||||
} else {
|
||||
0
|
||||
};
|
||||
let wstr = data.encode_utf16().collect::<Vec<u16>>();
|
||||
let needed_len = unsafe {
|
||||
WideCharToMultiByte(
|
||||
cp,
|
||||
dwflags,
|
||||
0,
|
||||
wstr.as_ptr(),
|
||||
wstr.len() as i32,
|
||||
std::ptr::null_mut(),
|
||||
@@ -127,7 +121,7 @@ pub fn encode_string(cp: u32, data: &str, check: bool) -> Result<Vec<u8>, WinErr
|
||||
let result = unsafe {
|
||||
WideCharToMultiByte(
|
||||
cp,
|
||||
dwflags,
|
||||
0,
|
||||
wstr.as_ptr(),
|
||||
wstr.len() as i32,
|
||||
mb.as_mut_ptr(),
|
||||
|
||||
Reference in New Issue
Block a user