Пример #1
0
        public Sen1Form(string path, FileStorage storage)
        {
            Path    = path;
            Storage = storage;

            InitializeComponent();
            labelFile.Text = path;

            int assetPatchCount = Sen1Mods.GetAssetMods().Count;

            checkBoxAssetPatches.Text += " (" + assetPatchCount + " file" + (assetPatchCount == 1 ? "" : "s") + ")";

            comboBoxTurboModeKey.Items.Clear();
            comboBoxTurboModeKey.Items.Add("Square / X");
            comboBoxTurboModeKey.Items.Add("Cross / A");
            comboBoxTurboModeKey.Items.Add("Circle / B");
            comboBoxTurboModeKey.Items.Add("Triangle / Y");
            comboBoxTurboModeKey.Items.Add("L1 / LB");
            comboBoxTurboModeKey.Items.Add("R1 / RB");
            comboBoxTurboModeKey.Items.Add("L2 / LT");
            comboBoxTurboModeKey.Items.Add("R2 / RT");
            comboBoxTurboModeKey.Items.Add("Select / Back");
            comboBoxTurboModeKey.Items.Add("Start");
            comboBoxTurboModeKey.Items.Add("L3 / LS");
            comboBoxTurboModeKey.Items.Add("R3 / RS");
            comboBoxTurboModeKey.Items.Add("D-Pad Up");
            comboBoxTurboModeKey.Items.Add("D-Pad Right");
            comboBoxTurboModeKey.Items.Add("D-Pad Down");
            comboBoxTurboModeKey.Items.Add("D-Pad Left");
            comboBoxTurboModeKey.SelectedIndex = 7;
        }
Пример #2
0
        private void buttonPatch_Click(object sender, EventArgs e)
        {
            try {
                bool removeTurboSkip         = checkBoxBattleAutoSkip.Checked;
                bool allowR2NotebookShortcut = checkBoxAllowR2InTurboMode.Checked;
                int  turboKey                = comboBoxTurboModeKey.SelectedIndex;
                bool fixTextureIds           = checkBoxFixHdTextureId.Checked;
                bool fixVoiceTables          = checkBoxFixVoiceFileLang.Checked;
                bool patchAssets             = checkBoxAssetPatches.Checked;
                bool disableMouseCapture     = checkBoxDisableMouseCam.Checked;
                bool disablePauseOnFocusLoss = false;

                var mods = new List <FileMod>();
                mods.AddRange(Sen1Mods.GetExecutableMods(
                                  removeTurboSkip: removeTurboSkip,
                                  allowR2NotebookShortcut: allowR2NotebookShortcut,
                                  turboKey: turboKey,
                                  fixTextureIds: fixTextureIds,
                                  correctLanguageVoiceTables: fixVoiceTables,
                                  disableMouseCapture: disableMouseCapture,
                                  disablePauseOnFocusLoss: disablePauseOnFocusLoss
                                  ));
                if (patchAssets)
                {
                    mods.AddRange(Sen1Mods.GetAssetMods());
                }

                GamePatchClass.RunPatch(new GamePatchClass(Path, Storage, mods));
            } catch (Exception ex) {
                MessageBox.Show("Unknown error occurred: " + ex.Message);
            }
        }
Пример #3
0
 private void buttonUnpatch_Click(object sender, EventArgs e)
 {
     try {
         var mods = new List <FileMod>();
         mods.AddRange(Sen1Mods.GetExecutableMods());
         mods.AddRange(Sen1Mods.GetAssetMods());
         GameUnpatchClass.RunUnpatch(new GameUnpatchClass(Path, Storage, mods));
     } catch (Exception ex) {
         MessageBox.Show("Unknown error occurred: " + ex.Message);
     }
 }
Пример #4
0
 private void buttonAssetFixDetails_Click(object sender, EventArgs e)
 {
     new TextDisplayForm("Asset fix details for Cold Steel 1", SenUtils.ExtractUserFriendlyStringFromModDescriptions(Sen1Mods.GetAssetMods())).ShowDialog();
 }
Пример #5
0
        public static int Main(string[] args)
        {
            if (args.Length >= 2 && (args[0] == "--parse-script" || args[0] == "--parse-book"))
            {
                using (var fs = new HyoutaUtils.Streams.DuplicatableFileStream(args[1])) {
                    var funcs = ScriptParser.Parse(fs.CopyToByteArrayStreamAndDispose(), args[0] == "--parse-book");

                    using (var outfs = new FileStream(args.Length > 2 ? args[2] : args[1] + ".txt", FileMode.Create)) {
                        foreach (var func in funcs)
                        {
                            outfs.WriteUTF8(func.Name);
                            outfs.WriteUTF8("\n");
                            outfs.WriteUTF8("\n");
                            foreach (var op in func.Ops)
                            {
                                outfs.WriteUTF8(op);
                                outfs.WriteUTF8("\n");
                            }
                            outfs.WriteUTF8("\n");
                            outfs.WriteUTF8("\n");
                        }
                    }
                }
                return(0);
            }

            if (args.Length == 1 && args[0] == "__gen_voice_checks")
            {
                t_voice_tbl.CheckVoiceTable(
                    Path.Combine(SenCommonPaths.Sen1SteamDir, "data/text/dat_us/t_voice.tbl"),
                    Path.Combine(SenCommonPaths.Sen1SteamDir, "data/voice/wav"),
                    Path.Combine(SenCommonPaths.Sen1SteamDir, "voice_check_english.txt")
                    );
                t_voice_tbl.CheckVoiceTable(
                    Path.Combine(SenCommonPaths.Sen1SteamDir, "data/text/dat/t_voice.tbl"),
                    Path.Combine(SenCommonPaths.Sen1SteamDir, "data/voice/wav_jp"),
                    Path.Combine(SenCommonPaths.Sen1SteamDir, "voice_check_japanese.txt")
                    );
                t_voice_tbl.CheckVoiceTable(
                    Path.Combine(SenCommonPaths.Sen2SteamDir, "data/text/dat_us/t_voice.tbl"),
                    Path.Combine(SenCommonPaths.Sen2SteamDir, "data/voice/wav"),
                    Path.Combine(SenCommonPaths.Sen2SteamDir, "voice_check_english.txt")
                    );
                t_voice_tbl.CheckVoiceTable(
                    Path.Combine(SenCommonPaths.Sen2SteamDir, "data/text/dat/t_voice.tbl"),
                    Path.Combine(SenCommonPaths.Sen2SteamDir, "data/voice_jp/wav"),
                    Path.Combine(SenCommonPaths.Sen2SteamDir, "voice_check_japanese.txt")
                    );
                return(0);
            }

            if (args.Length == 0)
            {
                Console.WriteLine("No path to directory given.");
                return(-1);
            }

            string path = args[0];

            if (!Directory.Exists(path))
            {
                Console.WriteLine($"No directory found at {path}.");
                return(-1);
            }

            int sengame;

            if (File.Exists(System.IO.Path.Combine(path, "Sen1Launcher.exe")))
            {
                sengame = 1;
            }
            else if (File.Exists(System.IO.Path.Combine(path, "Sen2Launcher.exe")))
            {
                sengame = 2;
            }
            else
            {
                Console.WriteLine($"Failed to detect whether {path} is CS1 or 2.");
                return(-1);
            }

            FilenameFix.FixupIncorrectEncodingInFilenames(path, sengame, true, new CliProgressReporter());
            FileStorage storage = FileModExec.InitializeAndPersistFileStorage(path, sengame == 1 ? Sen1KnownFiles.Files : Sen2KnownFiles.Files, new CliProgressReporter())?.Storage;

            if (storage == null)
            {
                Console.WriteLine($"Failed to initialize file storage from {path}.");
                return(-1);
            }

            PatchResult result;

            if (sengame == 1)
            {
                var mods = new List <FileMod>();
                mods.AddRange(Sen1Mods.GetExecutableMods(
                                  removeTurboSkip: true,
                                  allowR2NotebookShortcut: true,
                                  turboKey: 0xA,
                                  fixTextureIds: true,
                                  correctLanguageVoiceTables: true,
                                  disableMouseCapture: true,
                                  disablePauseOnFocusLoss: true
                                  ));
                mods.AddRange(Sen1Mods.GetAssetMods());
                result = FileModExec.ExecuteMods(path, storage, mods, new CliProgressReporter());
            }
            else
            {
                var mods = new List <FileMod>();
                mods.AddRange(Sen2Mods.GetExecutableMods(
                                  removeTurboSkip: true,
                                  patchAudioThread: true,
                                  audioThreadDivisor: 1000,
                                  patchBgmQueueing: true,
                                  correctLanguageVoiceTables: true,
                                  disableMouseCapture: true,
                                  disablePauseOnFocusLoss: true
                                  ));
                mods.AddRange(Sen2Mods.GetAssetMods());
                result = FileModExec.ExecuteMods(path, storage, mods, new CliProgressReporter());
            }

            if (!result.AllSuccessful)
            {
                Console.WriteLine($"Failed to patch CS{sengame} at {path}.");
                return(-1);
            }

            Console.WriteLine($"Successfully patched CS{sengame} at {path}.");
            return(0);
        }