-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild_arc.ps1
94 lines (90 loc) · 4.16 KB
/
build_arc.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
Param(
[string]$haruhiCli = $env:CHOKURETSU_CLI_PATH,
[string]$stringsFolder = "$env:CHOKURETSU_STRINGS_ROOT",
[string]$assetsFolder = $env:CHOKURETSU_ASSETS_ROOT,
[string]$devkitArm = $env:DEVKITARM,
[string]$resxLangCode = "en",
[string]$version,
[switch]$dub,
[switch]$noGraphics
)
$charset = "$assetsFolder/misc/charset/shared.json"
if (Test-Path "$assetsFolder/misc/charset/$resxLangCode.json") {
$charset = "$assetsFolder/misc/charset/$resxLangCode.json"
}
$splashScreenArgs = @("version-screen", "-v", "$version", "-s", "$assetsFolder/graphics/$resxLangCode/splash/splash_screen.png", "-f", "$assetsFolder/graphics/$resxLangCode/splash/Nunito-Black.ttf", "-o", "$assetsFolder/graphics/$resxLangCode/8b7_newpal_tidx0_splash_screen.png")
$datResxArgs = @("import-resx", "-i", "original/archives/dat.bin", "-o", "rom/data/dat.bin", "-r", "$stringsFolder/strings_dat", "-l", $resxLangCode, "-f", $charset, "-w", "dat.log")
$datArgs = @("replace", "-i", "rom/data/dat.bin", "-o", "rom/data/dat.bin", "-r", "$assetsFolder/data/shared")
$datLocArgs = @("replace", "-i", "rom/data/dat.bin", "-o", "rom/data/dat.bin", "-r", "$assetsFolder/data/$resxLangCode", "-s", "$assetsFolder/misc/spellcheck/$resxLangCode/")
$evtReplArgs = @("replace", "-i", "original/archives/evt.bin", "-o", "rom/data/evt.bin", "-r", "$assetsFolder/events", "-v", "original/voice")
$evtResxArgs = @("import-resx", "-i", "rom/data/evt.bin", "-o", "rom/data/evt.bin", "-r", "$stringsFolder/strings", "-l", $resxLangCode, "-f", $charset, "-s", "$assetsFolder/misc/spellcheck/$resxLangCode/", "-w", "evt.log")
$grpArgs = @("replace", "-i", "original/archives/grp.bin", "-o", "rom/data/grp.bin", "-r", "$assetsFolder/graphics/shared")
$grpLocArgs = @("replace", "-i", "rom/data/grp.bin", "-o", "rom/data/grp.bin", "-r", "$assetsFolder/graphics/$resxLangCode")
$scnArgs = @("replace", "-i", "original/archives/scn.bin", "-o", "rom/data/scn.bin", "-r", "$assetsFolder/scn")
$vceArgs = @("replace", "-i", "original/voice/", "-o", "rom/data/vce", "-r", "$assetsFolder/voice/$resxLangCode")
if ($devkitArm) {
$datArgs += ("-d", "$devkitArm")
$datLocArgs += ("-d", "$devkitArm")
$evtReplArgs += ("-d", "$devkitArm")
$scnArgs += ("-d", "$devkitArm")
}
if (-not $noGraphics) {
& $haruhiCli $splashScreenArgs
if ($LASTEXITCODE -ne 0) {
Write-Error "HaruhiChokuretsuCLI failed on creating splash screen with exit code $LASTEXITCODE."
exit 1
}
}
& $haruhiCli $datResxArgs
if ($LASTEXITCODE -ne 0) {
Write-Error "HaruhiChokuretsuCLI failed on string replacement in dat.bin with exit code $LASTEXITCODE."
exit 1
}
& $haruhiCli $datArgs
if ($LASTEXITCODE -ne 0) {
Write-Error "HaruhiChokuretsuCLI failed on global file replacement in dat.bin with exit code $LASTEXITCODE."
exit 1
}
& $haruhiCli $datLocArgs
if ($LASTEXITCODE -ne 0) {
Write-Error "HaruhiChokuretsuCLI failed on localized file replacement in dat.bin with exit code $LASTEXITCODE."
exit 1
}
& $haruhiCli $evtReplArgs
if ($LASTEXITCODE -ne 0) {
Write-Error "HaruhiChokuretsuCLI failed on file replacement in evt.bin with exit code $LASTEXITCODE."
exit 1
}
& $haruhiCli $evtResxArgs
if ($LASTEXITCODE -ne 0) {
Write-Error "HaruhiChokuretsuCLI failed on string replacement in evt.bin with exit code $LASTEXITCODE."
exit 1
}
if (-not $noGraphics) {
& $haruhiCli $grpArgs
if ($LASTEXITCODE -ne 0) {
Write-Error "HaruhiChokuretsuCLI failed on global image replacement in grp.bin with exit code $LASTEXITCODE."
exit 1
}
& $haruhiCli $grpLocArgs
if ($LASTEXITCODE -ne 0) {
Write-Error "HaruhiChokuretsuCLI failed on localized image replacement in grp.bin with exit code $LASTEXITCODE."
exit 1
}
}
& $haruhiCli $scnArgs
if ($LASTEXITCODE -ne 0) {
Write-Error "HaruhiChokuretsuCLI failed on file replacement in scn.bin with exit code $LASTEXITCODE."
exit 1
}
if ($dub) {
& $haruhiCli $vceArgs
if ($LASTEXITCODE -ne 0) {
Write-Error "HaruhiChokuretsuCLI failed on file replacement in vce/ with exit code $LASTEXITCODE."
exit 1
}
}
Copy-Item -Path "$assetsFolder/misc/banner/$resxLangCode.bin" -Destination "rom/banner.bin"
if (-not $noGraphics) {
Remove-Item -Path "$assetsFolder/graphics/$resxLangCode/8b7_newpal_tidx0_splash_screen.png"
}