private void InitializeList() { //Parse data from resources ImportCSVToSJIS(Properties.Resources.SLPS_016); foreach (HardCodedText text in HardCodedText.Texts) { HardCodedText foundText = _scriptFile.HardCodedTexts.FirstOrDefault(t => t.Offset == text.Offset); if (foundText != null) { listBox_HardcodedTexts.Items.Add(foundText); } else { _scriptFile.HardCodedTexts.Add(text); listBox_HardcodedTexts.Items.Add(_scriptFile.HardCodedTexts.Last()); } } listBox_HardcodedTexts.SelectedIndex = 0; }
private void listBox_HardcodedTexts_SelectedIndexChanged(object sender, EventArgs e) { if (listBox_HardcodedTexts.SelectedItem != null) { HardCodedText text = (HardCodedText)listBox_HardcodedTexts.SelectedItem; textBox_OriginalString.Text = text.OriginalString; textBox_NewString.Text = text.NewString; textBox_NewString.MaxLength = text.Length; if (ApplicationState.Instance.ProjectFile == null) { textBox_CurrentString.Text = "PROJECT BINARY IS NOT LOADED!"; } else { textBox_CurrentString.Text = text.CurrentString; } textBox_Translation.Text = text.Translation; } }
private void textBox_NewString_TextChanged(object sender, EventArgs e) { HardCodedText text = (HardCodedText)listBox_HardcodedTexts.SelectedItem; text.NewString = textBox_NewString.Text; }
public void ImportCSVToSJIS(string content) { HardCodedText.Texts = new List <HardCodedText>(); List <string> lines = content.Split( new[] { "\r\n", "\r", "\n" }, StringSplitOptions.None ).ToList(); lines.RemoveAt(0); //remove header foreach (var line in lines) { try { string[] fields = line.Split(';'); //Ignore empty lines or other stuff that can happen if (fields.Count() >= 4) { var hardctxt = new HardCodedText { Offset = Convert.ToInt32(fields[0]), Length = Convert.ToInt32(fields[1]), OriginalString = fields[2], Translation = fields[3], //[4] for english }; //String blacklist (breaks game engine or looks ugly) //14368; 14; 孤島の宝物事件; Schatzinsel; ; Speicherstand: Inhalt; //14384; 14; 同級生殺人事件; Mädchenschule; ; Speicherstand: Inhalt; if (hardctxt.Offset == 14368 || hardctxt.Offset == 14384 || hardctxt.Offset == 9736 || hardctxt.Offset == 13476 || hardctxt.Offset == 18984 || hardctxt.Offset == 26248 || hardctxt.Offset == 684784 //lade/load ) { continue; } HardCodedText.Texts.Add(hardctxt); } } catch (Exception e) { Debug.WriteLine("Something is wrong with a Hardcoded String: " + e.ToString()); } } int CodeCaveSegment = 585512; //Prototype stuff //NOTE: never forget to increase the length, so that as null terminator is included (this is only for codecave strings) //NOTE2: it seems the engine wants sometime the null terminator as 2 byte or it will crash? //Labels that have already allocated extra space and require only a read count increase have always already a double null term in place HardCodedText.Texts.Add(new HardCodedText(684784, 6, "ロード", "Laden")); HardCodedText.Texts.Add(new HardCodedText(29124, 12, "This is not SEQ Data.", "Speichern")); HardCodedText.Texts.Add(new HardCodedText(29136, 10, "This is not SEQ Data.", "Wohnheim")); //85 chars is limit for this codecave HardCodedText.Texts.Add(new HardCodedText(CodeCaveSegment, 12, "Library Program...", "ausbreiten")); CodeCaveSegment += 12; HardCodedText.Texts.Add(new HardCodedText(CodeCaveSegment, 22, "Library Programs...", "mit Wasser benetzen ")); CodeCaveSegment += 22; HardCodedText.Texts.Add(new HardCodedText(CodeCaveSegment, 22, "Library Programs...", "mit Stein beschweren")); CodeCaveSegment += 22; HardCodedText.Texts.Add(new HardCodedText(CodeCaveSegment, 12, "Library Programs...", "aufrichten")); CodeCaveSegment += 12; HardCodedText.Texts.Add(new HardCodedText(CodeCaveSegment, 16, "Library Program...", "zusammenknoten")); CodeCaveSegment += 16; }