Heroine Anthem [master]

Add tool to extract/replace EXE strings

cef52f5a0733acb413745e8bea84dd0f04bcee10
diff --git a/resources/ha1/exe.key b/resources/ha1/exe.key
new file mode 100644
index 0000000..219bf0e
--- /dev/null
+++ b/resources/ha1/exe.key
@@ -0,0 +1,90 @@
+1973560
+1973576
+1973588
+1973596
+1974092
+1974104
+1974116
+1974128
+1974140
+1974152
+1974168
+1974184
+1974204
+1974224
+1974244
+1974260
+1974284
+1974296
+1974312
+1974316
+1974336
+1974348
+1974364
+1974384
+1974400
+1974412
+1974432
+1974464
+1975404
+1975416
+1975424
+1975440
+1975448
+1975460
+1977280
+1977288
+1978144
+1978172
+1978208
+1978236
+2387072
+2387108
+2387144
+2387180
+2387216
+2387252
+2387288
+2387324
+2387360
+2387396
+2387432
+2387468
+2387576
+2387612
+2387648
+2387684
+2387720
+2387756
+2387792
+2387828
+2387864
+2387900
+2387936
+2387972
+2388008
+2388044
+2388080
+2388116
+2388152
+2388188
+2388224
+2388260
+2388296
+2387504
+2387540
+2388332
+2388368
+2388404
+2388440
+2388476
+2388512
+2388548
+2388584
+2388620
+2388656
+2388692
+2388728
+2388764
+2388800
+2388836
diff --git a/toolchain/exedump.php b/toolchain/exedump.php
new file mode 100755
index 0000000..812587d
--- /dev/null
+++ b/toolchain/exedump.php
@@ -0,0 +1,56 @@
+#!/usr/bin/php
+\n\n");
+}
+fclose($fo);
+fclose($fd);
+
+echo ("All done!...\n\n");
+
+function DisplayOptions() {
+	echo ("Extracts Unicode EXE strings from Heroine Anthem I&II.\n  usage: exedump [game_path] [out_file]\n\n");
+}
+
+?>
diff --git a/toolchain/exeinsert.php b/toolchain/exeinsert.php
new file mode 100755
index 0000000..72b0c96
--- /dev/null
+++ b/toolchain/exeinsert.php
@@ -0,0 +1,65 @@
+#!/usr/bin/php
+", str_replace("\r", "", file_get_contents($string)));
+array_pop($strings);
+
+foreach($strings as $patch) {
+	preg_match($regex, $patch, $pair);
+	$pair = $pair[1];
+	list($off, $len) = explode(":", $pair);
+	
+	// Convert remaining Chinese from UTF back to BIG5
+	$patch = utf_to_zh($patch);
+	
+	// Strip comments
+	while(preg_match($regex2, $patch))
+		$patch = preg_replace($regex2, "", $patch);
+	$patch = trim(preg_replace($regex, "", $patch), "\0\n\t\x0b");
+	$patch = str_replace("\n", "\r\n", $patch);
+	
+	//print("Offset: $off\nMax Length: $len\nString: $patch\nString Length:".strlen($patch)."\n");
+	
+	if(strlen($patch) > $len) {
+		echo("ERROR: EXE string at 0x".dechex($off)." exceeds bounds\n");
+		die;
+	}
+	
+	fseek($fo, $off, SEEK_SET);
+	$patch = str_pad($patch, $len, "\0");
+	fputs($fo, $patch);
+}
+fclose($fo);
+
+echo ("All done!...\n\n");
+
+function DisplayOptions() {
+	echo ("Extracts Unicode EXE strings from Heroine Anthem I&II.\n  usage: exeinsert [game_path] [out_file]\n\n");
+}
+
+?>
diff --git a/working/en/ha1/exe.txt b/working/en/ha1/exe.txt
new file mode 100644
index 0000000..9ba3e78
--- /dev/null
+++ b/working/en/ha1/exe.txt
@@ -0,0 +1,360 @@
+[1973560:15]
+# %s學到新招式:%s
+%s learned %s<>
+
+[1973576:11]
+# %s升級了
+%s's LV+<>
+
+[1973588:7]
+# EXP+%d
+EXP +%d<>
+
+[1973596:11]
+# 獲得金錢%dG
+Obtain %dG<>
+
+[1974092:11]
+# 魔法醫療
+Healing<>
+
+[1974104:11]
+# 魔法攻擊
+Sorcery<>
+
+[1974116:11]
+# 特殊攻擊
+Techniques<>
+
+[1974128:11]
+# 普通攻擊
+Basic<>
+
+[1974140:11]
+# %s x%2d
+%s x%2d<>
+
+[1974152:15]
+# 使用魔法醫療
+Use MP to heal<>
+
+[1974168:15]
+# 使用魔法攻擊
+Use MP attack<>
+
+[1974184:19]
+# 使用消耗SP的攻擊
+Use SP attack<>
+
+[1974204:19]
+# 只使用最基本的攻擊
+Normal combat<>
+
+[1974224:19]
+# 請選擇自動戰鬥模式
+Choose an auto mode<>
+
+[1974244:15]
+# 請選擇移動目標
+Select a target<>
+
+[1974260:23]
+# 請選擇使用道具的地點
+Use item where?<>
+
+[1974284:11]
+# 請選擇道具
+Inventory<>
+
+[1974296:15]
+# 請選擇施法目標
+Select a target<>
+
+[1974312:3]
+# %s
+%s<>
+
+[1974316:19]
+# 時間 %d MP %d/%d
+ACT %d MP %d/%d<>
+
+[1974336:11]
+# 請選擇法術
+Sorcery<>
+
+[1974348:15]
+# 請選擇攻擊位置
+Select a target<>
+
+[1974364:19]
+# %s 時間 %d SP %d/%d
+%s ACT %d SP %d/%d<>
+
+[1974384:15]
+# 請選擇攻擊招式
+Techniques<>
+
+[1974400:11]
+# 請選擇指令
+Action<>
+
+[1974412:19]
+# 請選擇%s作戰位置
+Select %s position<>
+
+[1974432:31]
+# 請選擇%s作戰位置,按右鍵自動配置
+Select %s's position (-> Auto)<>
+
+[1974464:19]
+# 請選擇角色時間格
+Select Action time<>
+
+[1975404:11]
+# %s  %s %d
+%s %s %d<>
+
+[1975416:7]
+# 金錢
+Gold<>
+
+[1975424:15]
+# %s  %s %d x %d
+%s %s %d x %d<>
+
+[1975440:7]
+# 魔石
+Rune<>
+
+[1975448:11]
+# %s  %s x %d
+%s %s x %d<>
+
+[1975460:7]
+# 取得
+Obtain<>
+
+[1977280:7]
+# %s:%s
+%s: %s<>
+
+[1977288:11]
+# 場景名稱
+Scene<>
+
+[1978144:27]
+# 請輸入所要購買物品的數量
+Enter quantity to buy<>
+
+[1978172:30]
+# 請輸入所要購買%s的數量
+Enter quantity of %s<>
+
+[1978208:27]
+# 請輸入所要販賣物品的數量
+Enter quantity to sell<>
+
+[1978236:23]
+# 請輸入所要販賣%s的數量
+Enter quantity of %s<>
+
+[2387072:35]
+# A
+A:<>
+
+[2387108:35]
+# :訊息、信號、智慧。
+Message/Signal/Wisdom<>
+
+[2387144:35]
+# B
+B:<>
+
+[2387180:35]
+# :土石、誕生、成長、重生。
+Earth/Growth/Birth<>
+
+[2387216:35]
+# D
+D:<>
+
+[2387252:35]
+# :突破、黎明、超越。
+Discover/Dawn/Surpass<>
+
+[2387288:35]
+# E
+E:<>
+
+[2387324:35]
+# :移動、進步、轉變。
+Move/Progress/Change<>
+
+[2387360:35]
+# F
+F:<>
+
+[2387396:35]
+# :財富、獲得、所有物。
+Wealth/Obtain/Belongings<>
+
+[2387432:35]
+# G
+G:<>
+
+[2387468:35]
+# :夥伴、贈與、自由。
+Partner/Donate/Freedom<>
+
+[2387504:35]
+# H
+H:<>
+
+[2387540:35]
+# :氣體、狂嵐、地震、豪雨。
+Gas/Madness/Quake/Storm<>
+
+[2387576:35]
+# I
+I:<>
+
+[2387612:35]
+# :冰凍、靜止、延遲、犧牲。
+Freeze/Stop/Slow/Sacrifice<>
+
+[2387648:35]
+# J
+J:<>
+
+[2387684:35]
+# :收穫、結果、時間。
+Harvest/Result/Time<>
+
+[2387720:35]
+# K
+K:<>
+
+[2387756:35]
+# :火焰、起始、開放、希望。
+Flame/Begin/Open/Hope<>
+
+[2387792:35]
+# L
+L:<>
+
+[2387828:35]
+# :液體、流動、引導、不穩。
+Liquid/Flow/Guide/Wobble<>
+
+[2387864:35]
+# M
+M:<>
+
+[2387900:35]
+# :自我、人道、謙虛。
+Ego/Humanity/Modesty<>
+
+[2387936:35]
+# N
+N:<>
+
+[2387972:35]
+# :黑暗、束縛、痛苦、停滯。
+Dark/Bind/Pain/Stagnate<>
+
+[2388008:35]
+# O
+O:<>
+
+[2388044:35]
+# :分離、退後、利益。
+Separate/Retreat/Benefit<>
+
+[2388080:35]
+# P
+P:<>
+
+[2388116:35]
+# :傳授、火鳳凰、奧祕。
+Impart/Phoenix/Mystery<>
+
+[2388152:35]
+# R
+R:<>
+
+[2388188:35]
+# :旅行、聯繫、融合、溝通。
+Travel/Connect/Fuse/Trade<>
+
+[2388224:35]
+# S
+S:<>
+
+[2388260:35]
+# :光明、生命力、太陽、能量。
+Light/Life/Sun/Energy<>
+
+[2388296:35]
+# T
+T:<>
+
+[2388332:35]
+# :戰士、持續、勇氣。
+Battle/Persevere/Courage<>
+
+[2388368:35]
+# U
+U:<>
+
+[2388404:35]
+# :力量、輪迴、結束。
+Power/Revive/Finality<>
+
+[2388440:35]
+# W
+W:<>
+
+[2388476:35]
+# :喜悅、洞察、復舊。
+Joy/Insight/Nostalgia<>
+
+[2388512:35]
+# Y
+Y:<>
+
+[2388548:35]
+# :防衛、迴避、死亡。
+Guard/Avoid/Die<>
+
+[2388584:35]
+# Z
+Z:<>
+
+[2388620:35]
+# :保護、耐力、隱蔽。
+Protect/Stamina/Conceal<>
+
+[2388656:35]
+# Ng
+Ng:<>
+
+[2388692:35]
+# :富饒、神祇、創造、召喚。
+Bounty/God/Create/Summon<>
+
+[2388728:35]
+# Th
+Th:<>
+
+[2388764:35]
+# :閃電、門戶、巨大、雷神。
+Shock/Portal/Huge/Thor<>
+
+[2388800:35]
+# Ul
+Ul:<>
+
+[2388836:35]
+# :究極、潛能、未知。
+Ultimate/Potential/Mystery<>
+
diff --git a/working/en/ha1/video/mpg05.ass b/working/en/ha1/video/mpg05.ass
index 6de7831..eb572be 100644
--- a/working/en/ha1/video/mpg05.ass
+++ b/working/en/ha1/video/mpg05.ass
@@ -40,7 +40,7 @@ Dialogue: 0,0:00:49.70,0:00:52.10,Default,,0000,0000,0000,,{\fad(200,200)}A new
 Dialogue: 0,0:00:52.80,0:00:56.00,Default,,0000,0000,0000,,{\fad(200,200)}And it quickly engulfed Eastern Scandinavia and its vassals.
 Dialogue: 0,0:00:57.70,0:01:00.10,Default,,0000,0000,0000,,{\fad(200,200)}Hulen was called upon by the royal family…
 Dialogue: 0,0:01:02.20,0:01:04.70,Default,,0000,0000,0000,,{\fad(200,200)}And soon departed for the crusade.
-Dialogue: 0,0:01:07.40,0:01:11.20,Default,,0000,0000,0000,,{\fad(200,200)}And so, Edda and Liv lost their best listener.
+Dialogue: 0,0:01:07.40,0:01:11.20,Default,,0000,0000,0000,,{\fad(200,200)}And so, Edda and Liv lost their best friend.
 Dialogue: 0,0:01:12.00,0:01:15.10,Default,,0000,0000,0000,,{\fad(200,200)}Was it freedom?
 Dialogue: 0,0:01:15.60,0:01:18.50,Default,,0000,0000,0000,,{\fad(200,200)}Or perhaps just a time to say goodbye.
 Dialogue: 0,0:01:19.30,0:01:22.50,Default,,0000,0000,0000,,{\fad(200,200)}When Edda turned seventeen…