Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30,474 changes: 30,474 additions & 0 deletions mgs-spec-bank/charset/steins_gate_hd.json

Large diffs are not rendered by default.

38 changes: 37 additions & 1 deletion mgs-spec-bank/data.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ instructions:
- instructions/chaos_child.yaml
- instructions/chaos_head_lcc.yaml
- instructions/iwakura_aria.yaml
- instructions/steins_gate_hd.yaml

macros:
- macros/chaos_head_noah.yaml
Expand All @@ -36,6 +37,7 @@ charset:
iwakura_aria: charset/iwakura_aria.json
lcc_double_pack: charset/lcc_double_pack.json
lcc_double_pack-extended: charset/lcc_double_pack-extended.json
steins_gate_hd: charset/steins_gate_hd.json

flags:
memories_off_6_old:
Expand Down Expand Up @@ -130,6 +132,7 @@ flags:
new_setevflag: no
new_setflag: no
new_sseplay: no
new_sseinit: no
new_titlemenu: no
new_voiceplay: no
new_voicestop: no
Expand Down Expand Up @@ -428,4 +431,37 @@ flags:
return_labels: yes
multisystemmes: no
option_default_arg: no
stringid_16: no
stringid_16: no

steins_gate_hd:
game_sghd: yes

new_bgmplay: yes
new_bgmstop: yes
new_createsurface: yes
new_createthread: no
new_messetid: no
new_playmovie: no
new_presence: yes
new_pressstart: yes
new_resetflag: no
new_save: yes
new_scriptload: no
new_seplay: yes
new_setdic: yes
new_setevflag: no
new_setflag: no
new_sseplay: no
new_sseinit: no
new_titlemenu: yes
new_voiceplay: no
new_voicestop: yes
add_contents: no
bgrelease: yes

achchktitle: no
effyuge: no
chaload: yes
mescls: yes
movie_01_27: yes
return_labels: yes
20 changes: 20 additions & 0 deletions mgs-spec-bank/instructions/base/base_10.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -663,6 +663,16 @@
operands: []
flags: []

- pattern: 10 3F 0F
name: MouseMode_0F
operands: []
flags: []

- pattern: 10 3F 10
name: MouseMode_10
operands: []
flags: []

- pattern: 10 3F 11
name: MouseModeSetSysMenu
operands: []
Expand Down Expand Up @@ -703,6 +713,16 @@
operands: []
flags: []

- pattern: 10 3F 19
name: MouseMode_19
operands: []
flags: []

- pattern: 10 3F 1A
name: MouseMode_1A
operands: []
flags: []

- pattern: 10 3F 1B
name: MouseModeSetClearList
operands: []
Expand Down
109 changes: 109 additions & 0 deletions mgs-spec-bank/instructions/steins_gate_hd.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
- pattern: 10 37 00
name: PhoneSG_00
operands: [int8, expr]
flags: [game_sghd]

- pattern: 10 37 01
name: PhoneSG_01
operands: [int8, expr]
flags: [game_sghd]

- pattern: 10 37 02
name: PhoneSG_02
operands: [int8, expr, int16]
flags: [game_sghd]

- pattern: 10 37 03
name: PhoneSG_03
operands: [int8, expr, int16]
flags: [game_sghd]

- pattern: 10 37 04
name: PhoneSG_04
operands: [int16, int16, int16, int16, int16, int16]
flags: [game_sghd]

- pattern: 10 37 05
name: PhoneSG_05
operands: []
flags: [game_sghd]

- pattern: 10 37 06
name: PhoneSG_06
operands: []
flags: [game_sghd]

- pattern: 10 37 07
name: PhoneSG_07
operands: []
flags: [game_sghd]

- pattern: 10 37 08
name: PhoneSG_08
operands: []
flags: [game_sghd]

- pattern: 10 37 09
name: PhoneSG_09
operands: []
flags: [game_sghd]

- pattern: 10 37 0F
name: PhoneSG_0F
operands: [expr]
flags: [game_sghd]

- pattern: 10 37 10
name: PhoneSG_10
operands: [expr]
flags: [game_sghd]

- pattern: 10 37 11
name: PhoneSG_11
operands: []
flags: [game_sghd]

- pattern: 10 37 12
name: PhoneSG_12
operands: [expr, expr]
flags: [game_sghd]

- pattern: 10 37 13
name: PhoneSG_13
operands: []
flags: [game_sghd]

- pattern: 10 37 14
name: PhoneSG_14
operands: [expr, expr, expr, expr]
flags: [game_sghd]

- pattern: 10 37 15
name: PhoneSG_15
operands: [expr, expr, expr, expr]
flags: [game_sghd]

- pattern: 10 37 16
name: PhoneSG_16
operands: []
flags: [game_sghd]

- pattern: 10 37 17
name: PhoneSG_17
operands: []
flags: [game_sghd]

- pattern: 10 37 18
name: PhoneSG_18
operands: []
flags: [game_sghd]

- pattern: 10 37 19
name: PhoneSG_19
operands: []
flags: [game_sghd]

- pattern: 10 37 1A
name: PhoneSG_1A
operands: []
flags: [game_sghd]
22 changes: 11 additions & 11 deletions src/MagesScriptTool/ParseUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@ public static bool TrySkip(TextStream reader, char c) {
}

public static bool TrySkip(TextStream reader, string s) {
if (!reader.Has(s.Length - 1)) {
return false;
}
for (int i = 0; i < s.Length; i++) {
if (reader.Peek(i) != s[i]) {
return false;
}
}
reader.Skip(s.Length);
return true;
}
var runes = s.EnumerateRunes();
int i = 0;
foreach (var rune in runes) {
if (!reader.Has(i) || reader.PeekRune(i) != rune) {
return false;
}
i++;
}
reader.Skip(i);
return true;
}

public static bool SkipSpaceComments(TextStream reader) {
bool consumed = false;
Expand Down
4 changes: 2 additions & 2 deletions src/MagesScriptTool/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -211,10 +211,10 @@ static async Task<int> DoDecompile(Tool tool) {
continue;
}
string extension = Path.GetExtension(compiledPath);
if (extension == tool.CompiledScriptPackageExtension) {
if (extension.ToLower() == tool.CompiledScriptPackageExtension) {
errorOccurred |= !await DecompileScriptPackage(tool, compiledName);
}
if (extension == tool.CompiledStringTableExtension) {
if (extension.ToLower() == tool.CompiledStringTableExtension) {
errorOccurred |= !await DecompileStringTable(tool, compiledName);
}
}
Expand Down
22 changes: 18 additions & 4 deletions src/MagesScriptTool/SpecBank.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,24 @@ static ImmutableArray<GlyphSpec> toGlyphSpecs(JsonElement json) {
GlyphStyle? style = toStyle(parametersJson.GetProperty("style"));

List<GlyphSpec> glyphs = [];
foreach (JsonElement glyphJson in json.GetProperty("glyphs").EnumerateArray()) {
ImmutableArray<int> units = toUnits(glyphJson.GetProperty("units"));
string text = toText(glyphJson.GetProperty("text"));
glyphs.Add(new(units, text, style));
JsonElement glyphsJson = json.GetProperty("glyphs");
if(glyphsJson.ValueKind == JsonValueKind.Object) {
Int16 unitsOffset = glyphsJson.GetProperty("unitsOffset").GetInt16();
string text = toText(glyphsJson.GetProperty("text"));
int index = 0;
TextElementEnumerator charEnum = StringInfo.GetTextElementEnumerator(text);
while (charEnum.MoveNext()) {
glyphs.Add(new([unitsOffset + index], charEnum.GetTextElement(), style));
index++;
}
} else if (glyphsJson.ValueKind == JsonValueKind.Array) {
foreach (JsonElement glyphJson in glyphsJson.EnumerateArray()) {
ImmutableArray<int> units = toUnits(glyphJson.GetProperty("units"));
string text = toText(glyphJson.GetProperty("text"));
glyphs.Add(new(units, text, style));
}
} else {
throw new NotImplementedException($"{glyphsJson.ValueKind} is not implemented.");
}
return [..glyphs];
}
Expand Down
24 changes: 12 additions & 12 deletions src/MagesScriptTool/UncompiledStringSyntax.cs
Original file line number Diff line number Diff line change
Expand Up @@ -102,28 +102,28 @@ public UncompiledStringParser(TextStream reader) {
public ImmutableArray<StringToken> Parse() {
List<StringToken> tokens = [];
GlyphStyle style = GlyphStyle.Normal;
while (_reader.Has(0) && _reader.Peek(0) != '\n') {
if (_reader.Peek(0) == '〔') {
_reader.Next();
while (_reader.Has(0) && _reader.PeekRune(0) != new Rune('\n')) {
if (_reader.PeekRune(0) == new Rune('〔')) {
_reader.NextRune();
tokens.Add(new StringTokenTag("nameStart", []));
} else if (_reader.Peek(0) == '〕') {
_reader.Next();
} else if (_reader.PeekRune(0) == new Rune('〕')) {
_reader.NextRune();
tokens.Add(new StringTokenTag("nameEnd", []));
} else if (_reader.Peek(0) == '\\') {
if (_reader.Has(1) && _reader.Peek(1) is '\\' or '〔' or '〕') {
} else if (_reader.PeekRune(0) == new Rune('\\')) {
if (_reader.Has(1) && (_reader.PeekRune(1) == new Rune('\\') || _reader.PeekRune(1) == new Rune('〔') || _reader.PeekRune(1) == new Rune('〕'))) {
_reader.Skip(1);
tokens.Add(new StringTokenRune(_reader.NextRune(), style));
} else {
tokens.Add(ParseTag());
tokens.Add(ParseTag());
}
} else if (ParseUtils.TrySkip(_reader, "<i>")) {
style = GlyphStyle.Italic;
style = GlyphStyle.Italic;
} else if (ParseUtils.TrySkip(_reader, "</i>")) {
style = GlyphStyle.Normal;
style = GlyphStyle.Normal;
} else {
tokens.Add(new StringTokenRune(_reader.NextRune(), style));
tokens.Add(new StringTokenRune(_reader.NextRune(), style));
}
}
}
return [..tokens];
}

Expand Down
Loading