2025-01-26 03:34:55 -05:00
|
|
|
def main [game_folder: path, version: int] {
|
2025-01-26 02:12:43 -05:00
|
|
|
let game = if $version == 10 {
|
2025-01-26 03:34:55 -05:00
|
|
|
{ folder: "mof", version: $version }
|
2025-01-26 02:12:43 -05:00
|
|
|
} else if $version == 11 {
|
2025-01-26 03:34:55 -05:00
|
|
|
{ folder: "sa", version: $version }
|
2025-01-26 02:12:43 -05:00
|
|
|
} else {
|
|
|
|
return (error make {msg: "version not supported", label: { text: "expected 10 or 11", span: (metadata $version).span } })
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
2025-01-26 03:34:55 -05:00
|
|
|
let assets = $"assets/($game.folder)"
|
2025-01-26 03:40:33 -05:00
|
|
|
mkdir $assets
|
2025-01-26 03:34:55 -05:00
|
|
|
let thver = $"th($game.version)"
|
|
|
|
thdat -C $assets -x $version $"($game_folder)/($thver).dat"
|
|
|
|
try {
|
|
|
|
ln -s $"($game_folder)/thbgm.dat" $"($assets)/thbgm.dat"
|
|
|
|
} catch { }
|
2025-01-26 02:12:43 -05:00
|
|
|
|
2025-01-26 03:34:55 -05:00
|
|
|
let research = $"research/dump/($game.folder)"
|
2025-01-26 03:40:33 -05:00
|
|
|
mkdir $research
|
2025-01-26 03:34:55 -05:00
|
|
|
let replt = {|ext| str replace $ext $"t($ext)"};
|
|
|
|
let dump = {|ext|
|
|
|
|
ls $assets | get name | where {str ends-with $".($ext)"} | each {path basename}
|
|
|
|
| each {|name| run-external $"tru($ext)" "decompile" "-g" $game.version $"($assets)/($name)" "-m" $"utils/($thver).($ext)m" | save -f $"($research)/($name | do $replt $ext)"}
|
|
|
|
};
|
|
|
|
|
|
|
|
do $dump "anm"
|
|
|
|
do $dump "ecl"
|
|
|
|
do $dump "std"
|
2025-01-26 02:12:43 -05:00
|
|
|
}
|