diff --git a/LICENSE b/LICENSE deleted file mode 100644 index 75e56d7..0000000 --- a/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2017 num0005 - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. \ No newline at end of file diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 0000000..baa3adc --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,149 @@ +Copyright (c) 2017 num0005 +Copyright (c) 2022 Osoyoos Launcher Contributors + +Unless otherwise noted files in this repository are licensed under the terms of the MIT license (reproduced below). +Placeholder shader files ("default.shader", "default_odst.shader" and "defaultH2.shader") are licensed under the terms of the CC0 1.0 Universal license (also reproduced below) + +You can find plain language summaries of your rights and obligations at https://choosealicense.com/licenses/mit/ and https://creativecommons.org/publicdomain/zero/1.0/ + +# MIT License + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +# Creative Commons Legal Code + +CC0 1.0 Universal + + CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE + LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN + ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS + INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES + REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS + PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM + THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED + HEREUNDER. + +Statement of Purpose + +The laws of most jurisdictions throughout the world automatically confer +exclusive Copyright and Related Rights (defined below) upon the creator +and subsequent owner(s) (each and all, an "owner") of an original work of +authorship and/or a database (each, a "Work"). + +Certain owners wish to permanently relinquish those rights to a Work for +the purpose of contributing to a commons of creative, cultural and +scientific works ("Commons") that the public can reliably and without fear +of later claims of infringement build upon, modify, incorporate in other +works, reuse and redistribute as freely as possible in any form whatsoever +and for any purposes, including without limitation commercial purposes. +These owners may contribute to the Commons to promote the ideal of a free +culture and the further production of creative, cultural and scientific +works, or to gain reputation or greater distribution for their Work in +part through the use and efforts of others. + +For these and/or other purposes and motivations, and without any +expectation of additional consideration or compensation, the person +associating CC0 with a Work (the "Affirmer"), to the extent that he or she +is an owner of Copyright and Related Rights in the Work, voluntarily +elects to apply CC0 to the Work and publicly distribute the Work under its +terms, with knowledge of his or her Copyright and Related Rights in the +Work and the meaning and intended legal effect of CC0 on those rights. + +1. Copyright and Related Rights. A Work made available under CC0 may be +protected by copyright and related or neighboring rights ("Copyright and +Related Rights"). Copyright and Related Rights include, but are not +limited to, the following: + + i. the right to reproduce, adapt, distribute, perform, display, + communicate, and translate a Work; + ii. moral rights retained by the original author(s) and/or performer(s); +iii. publicity and privacy rights pertaining to a person's image or + likeness depicted in a Work; + iv. rights protecting against unfair competition in regards to a Work, + subject to the limitations in paragraph 4(a), below; + v. rights protecting the extraction, dissemination, use and reuse of data + in a Work; + vi. database rights (such as those arising under Directive 96/9/EC of the + European Parliament and of the Council of 11 March 1996 on the legal + protection of databases, and under any national implementation + thereof, including any amended or successor version of such + directive); and +vii. other similar, equivalent or corresponding rights throughout the + world based on applicable law or treaty, and any national + implementations thereof. + +2. Waiver. To the greatest extent permitted by, but not in contravention +of, applicable law, Affirmer hereby overtly, fully, permanently, +irrevocably and unconditionally waives, abandons, and surrenders all of +Affirmer's Copyright and Related Rights and associated claims and causes +of action, whether now known or unknown (including existing as well as +future claims and causes of action), in the Work (i) in all territories +worldwide, (ii) for the maximum duration provided by applicable law or +treaty (including future time extensions), (iii) in any current or future +medium and for any number of copies, and (iv) for any purpose whatsoever, +including without limitation commercial, advertising or promotional +purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each +member of the public at large and to the detriment of Affirmer's heirs and +successors, fully intending that such Waiver shall not be subject to +revocation, rescission, cancellation, termination, or any other legal or +equitable action to disrupt the quiet enjoyment of the Work by the public +as contemplated by Affirmer's express Statement of Purpose. + +3. Public License Fallback. Should any part of the Waiver for any reason +be judged legally invalid or ineffective under applicable law, then the +Waiver shall be preserved to the maximum extent permitted taking into +account Affirmer's express Statement of Purpose. In addition, to the +extent the Waiver is so judged Affirmer hereby grants to each affected +person a royalty-free, non transferable, non sublicensable, non exclusive, +irrevocable and unconditional license to exercise Affirmer's Copyright and +Related Rights in the Work (i) in all territories worldwide, (ii) for the +maximum duration provided by applicable law or treaty (including future +time extensions), (iii) in any current or future medium and for any number +of copies, and (iv) for any purpose whatsoever, including without +limitation commercial, advertising or promotional purposes (the +"License"). The License shall be deemed effective as of the date CC0 was +applied by Affirmer to the Work. Should any part of the License for any +reason be judged legally invalid or ineffective under applicable law, such +partial invalidity or ineffectiveness shall not invalidate the remainder +of the License, and in such case Affirmer hereby affirms that he or she +will not (i) exercise any of his or her remaining Copyright and Related +Rights in the Work or (ii) assert any associated claims and causes of +action with respect to the Work, in either case contrary to Affirmer's +express Statement of Purpose. + +4. Limitations and Disclaimers. + + a. No trademark or patent rights held by Affirmer are waived, abandoned, + surrendered, licensed or otherwise affected by this document. + b. Affirmer offers the Work as-is and makes no representations or + warranties of any kind concerning the Work, express, implied, + statutory or otherwise, including without limitation warranties of + title, merchantability, fitness for a particular purpose, non + infringement, or the absence of latent or other defects, accuracy, or + the present or absence of errors, whether or not discoverable, all to + the greatest extent permissible under applicable law. + c. Affirmer disclaims responsibility for clearing rights of other persons + that may apply to the Work or any use thereof, including without + limitation any person's Copyright and Related Rights in the Work. + Further, Affirmer disclaims responsibility for obtaining any necessary + consents, permissions or other rights required for any use of the + Work. + d. Affirmer understands and acknowledges that Creative Commons is not a + party to this document and has no duty or obligation with respect to + this CC0 or use of the Work. \ No newline at end of file diff --git a/Launcher/Credits.xaml b/Launcher/Credits.xaml index 3c35bb1..c5a7a9a 100644 --- a/Launcher/Credits.xaml +++ b/Launcher/Credits.xaml @@ -41,7 +41,7 @@ - + + diff --git a/Launcher/Credits.xaml.cs b/Launcher/Credits.xaml.cs index 2a62084..440993b 100644 --- a/Launcher/Credits.xaml.cs +++ b/Launcher/Credits.xaml.cs @@ -150,5 +150,20 @@ private async void update_button_Click(object sender, RoutedEventArgs e) } + + private void license_info_open_Click(object sender, RoutedEventArgs e) + { + string license_file_name = Path.Combine(Path.GetTempPath(), $"launcher_copyright_{Guid.NewGuid()}.txt"); + Assembly assembly = Assembly.GetExecutingAssembly(); + string resourceName = assembly.GetManifestResourceNames().Single(str => str.EndsWith("LicenseInfoFull.txt")); + using Stream stream = assembly.GetManifestResourceStream(resourceName); + using (StreamWriter fileStream = File.CreateText(license_file_name)) + { + stream.CopyTo(fileStream.BaseStream); + } + ProcessStartInfo startInfo = new(license_file_name); + startInfo.UseShellExecute = true; + System.Diagnostics.Process.Start(startInfo); + } } } diff --git a/Launcher/FilePicker.cs b/Launcher/FilePicker.cs index 013bb9c..d8fc063 100644 --- a/Launcher/FilePicker.cs +++ b/Launcher/FilePicker.cs @@ -1,5 +1,4 @@ -using Microsoft.WindowsAPICodePack.Dialogs; -using System; +using System; using System.IO; using System.Windows.Forms; using ToolkitLauncher.ToolkitInterface; @@ -59,16 +58,10 @@ public FilePicker(System.Windows.Controls.TextBox box, ToolkitBase toolkit, Opti this.toolkitInterface = toolkit; this.options = options; if (options.IsFolderSelect()) { - folderDialog = new CommonOpenFileDialog(); - folderDialog.Title = options.title; - folderDialog.IsFolderPicker = true; + folderDialog = new FolderBrowserDialog(); + folderDialog.Description = options.title; - folderDialog.AllowNonFileSystemItems = false; - folderDialog.EnsureFileExists = true; - folderDialog.EnsurePathExists = true; - folderDialog.Multiselect = false; - folderDialog.ShowPlacesList = true; - folderDialog.InitialDirectory = InitialDirectory; + folderDialog.SelectedPath = InitialDirectory; } else { fileDialog = new OpenFileDialog(); fileDialog.Title = options.title; @@ -80,9 +73,9 @@ public bool Prompt() { if (folderDialog is null && fileDialog is null) throw new InvalidOperationException("No valid dialog"); - if (folderDialog is not null && folderDialog.ShowDialog() == CommonFileDialogResult.Ok) + if (folderDialog is not null && folderDialog.ShowDialog() == DialogResult.OK) { - return ProcessInput(folderDialog.FileName); + return ProcessInput(folderDialog.SelectedPath); } if (fileDialog is not null && fileDialog.ShowDialog() == DialogResult.OK) { @@ -144,7 +137,7 @@ bool ProcessInput(string path) #nullable restore private OpenFileDialog fileDialog; - private CommonOpenFileDialog folderDialog; + private FolderBrowserDialog folderDialog; private System.Windows.Controls.TextBox textBox; private ToolkitBase toolkitInterface; private Options options; diff --git a/Launcher/MainWindow.xaml b/Launcher/MainWindow.xaml index d5a7569..3d8d9de 100644 --- a/Launcher/MainWindow.xaml +++ b/Launcher/MainWindow.xaml @@ -608,18 +608,24 @@ + + + + + - - - - - + + + + + + @@ -627,6 +633,8 @@ + + diff --git a/Launcher/MainWindow.xaml.cs b/Launcher/MainWindow.xaml.cs index f1a2955..2853339 100644 --- a/Launcher/MainWindow.xaml.cs +++ b/Launcher/MainWindow.xaml.cs @@ -933,7 +933,7 @@ private void model_compile_render_Checked(object sender, RoutedEventArgs e) private async void compile_model_Click(object sender, RoutedEventArgs e) { - await toolkit.ImportModel(compile_model_path.Text, model_compile_type, phantom_hack_collision.IsChecked ?? false, h2_lod_logic.IsChecked ?? false, prt_enabled.IsChecked ?? false, fp_anim.IsChecked ?? false, character_fp_path.Text, weapon_fp_path.Text, accurate_render.IsChecked ?? false, verbose_anim.IsChecked ?? false, uncompressed_anim.IsChecked ?? false, sky_model.IsChecked ?? false, pda_model.IsChecked ?? false, reset_compression.IsChecked ?? false, model_auto_fbx.IsChecked ?? false); + await toolkit.ImportModel(compile_model_path.Text, model_compile_type, phantom_hack_collision.IsChecked ?? false, h2_lod_logic.IsChecked ?? false, prt_enabled.IsChecked ?? false, fp_anim.IsChecked ?? false, character_fp_path.Text, weapon_fp_path.Text, accurate_render.IsChecked ?? false, verbose_anim.IsChecked ?? false, uncompressed_anim.IsChecked ?? false, sky_model.IsChecked ?? false, pda_model.IsChecked ?? false, reset_compression.IsChecked ?? false, model_auto_fbx.IsChecked ?? false, model_generate_shaders.IsChecked ?? false); } private async void import_sound_Click(object sender, RoutedEventArgs e) diff --git a/Launcher/Resources/LicenseInfoFull.txt b/Launcher/Resources/LicenseInfoFull.txt new file mode 100644 index 0000000..ae3c123 --- /dev/null +++ b/Launcher/Resources/LicenseInfoFull.txt @@ -0,0 +1,257 @@ +# Osoyoos Launcher Copyright + +Launcher source code is licensed under the terms of the MIT license + +## MIT License + +Copyright (c) 2017 num0005 +Copyright (c) 2022 Osoyoos Launcher Contributers + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +# Osoyoos Content Copyright +Blank shader files ("default.shader", "default_odst.shader", "defaultH2.shader") included with the launcher are licensed under the CC0 license for a non legal summary see https://creativecommons.org/publicdomain/zero/1.0/ + +## CC0 +Creative Commons Legal Code + +CC0 1.0 Universal + + CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE + LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN + ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS + INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES + REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS + PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM + THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED + HEREUNDER. + +Statement of Purpose + +The laws of most jurisdictions throughout the world automatically confer +exclusive Copyright and Related Rights (defined below) upon the creator +and subsequent owner(s) (each and all, an "owner") of an original work of +authorship and/or a database (each, a "Work"). + +Certain owners wish to permanently relinquish those rights to a Work for +the purpose of contributing to a commons of creative, cultural and +scientific works ("Commons") that the public can reliably and without fear +of later claims of infringement build upon, modify, incorporate in other +works, reuse and redistribute as freely as possible in any form whatsoever +and for any purposes, including without limitation commercial purposes. +These owners may contribute to the Commons to promote the ideal of a free +culture and the further production of creative, cultural and scientific +works, or to gain reputation or greater distribution for their Work in +part through the use and efforts of others. + +For these and/or other purposes and motivations, and without any +expectation of additional consideration or compensation, the person +associating CC0 with a Work (the "Affirmer"), to the extent that he or she +is an owner of Copyright and Related Rights in the Work, voluntarily +elects to apply CC0 to the Work and publicly distribute the Work under its +terms, with knowledge of his or her Copyright and Related Rights in the +Work and the meaning and intended legal effect of CC0 on those rights. + +1. Copyright and Related Rights. A Work made available under CC0 may be +protected by copyright and related or neighboring rights ("Copyright and +Related Rights"). Copyright and Related Rights include, but are not +limited to, the following: + + i. the right to reproduce, adapt, distribute, perform, display, + communicate, and translate a Work; + ii. moral rights retained by the original author(s) and/or performer(s); +iii. publicity and privacy rights pertaining to a person's image or + likeness depicted in a Work; + iv. rights protecting against unfair competition in regards to a Work, + subject to the limitations in paragraph 4(a), below; + v. rights protecting the extraction, dissemination, use and reuse of data + in a Work; + vi. database rights (such as those arising under Directive 96/9/EC of the + European Parliament and of the Council of 11 March 1996 on the legal + protection of databases, and under any national implementation + thereof, including any amended or successor version of such + directive); and +vii. other similar, equivalent or corresponding rights throughout the + world based on applicable law or treaty, and any national + implementations thereof. + +2. Waiver. To the greatest extent permitted by, but not in contravention +of, applicable law, Affirmer hereby overtly, fully, permanently, +irrevocably and unconditionally waives, abandons, and surrenders all of +Affirmer's Copyright and Related Rights and associated claims and causes +of action, whether now known or unknown (including existing as well as +future claims and causes of action), in the Work (i) in all territories +worldwide, (ii) for the maximum duration provided by applicable law or +treaty (including future time extensions), (iii) in any current or future +medium and for any number of copies, and (iv) for any purpose whatsoever, +including without limitation commercial, advertising or promotional +purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each +member of the public at large and to the detriment of Affirmer's heirs and +successors, fully intending that such Waiver shall not be subject to +revocation, rescission, cancellation, termination, or any other legal or +equitable action to disrupt the quiet enjoyment of the Work by the public +as contemplated by Affirmer's express Statement of Purpose. + +3. Public License Fallback. Should any part of the Waiver for any reason +be judged legally invalid or ineffective under applicable law, then the +Waiver shall be preserved to the maximum extent permitted taking into +account Affirmer's express Statement of Purpose. In addition, to the +extent the Waiver is so judged Affirmer hereby grants to each affected +person a royalty-free, non transferable, non sublicensable, non exclusive, +irrevocable and unconditional license to exercise Affirmer's Copyright and +Related Rights in the Work (i) in all territories worldwide, (ii) for the +maximum duration provided by applicable law or treaty (including future +time extensions), (iii) in any current or future medium and for any number +of copies, and (iv) for any purpose whatsoever, including without +limitation commercial, advertising or promotional purposes (the +"License"). The License shall be deemed effective as of the date CC0 was +applied by Affirmer to the Work. Should any part of the License for any +reason be judged legally invalid or ineffective under applicable law, such +partial invalidity or ineffectiveness shall not invalidate the remainder +of the License, and in such case Affirmer hereby affirms that he or she +will not (i) exercise any of his or her remaining Copyright and Related +Rights in the Work or (ii) assert any associated claims and causes of +action with respect to the Work, in either case contrary to Affirmer's +express Statement of Purpose. + +4. Limitations and Disclaimers. + + a. No trademark or patent rights held by Affirmer are waived, abandoned, + surrendered, licensed or otherwise affected by this document. + b. Affirmer offers the Work as-is and makes no representations or + warranties of any kind concerning the Work, express, implied, + statutory or otherwise, including without limitation warranties of + title, merchantability, fitness for a particular purpose, non + infringement, or the absence of latent or other defects, accuracy, or + the present or absence of errors, whether or not discoverable, all to + the greatest extent permissible under applicable law. + c. Affirmer disclaims responsibility for clearing rights of other persons + that may apply to the Work or any use thereof, including without + limitation any person's Copyright and Related Rights in the Work. + Further, Affirmer disclaims responsibility for obtaining any necessary + consents, permissions or other rights required for any use of the + Work. + d. Affirmer understands and acknowledges that Creative Commons is not a + party to this document and has no duty or obligation with respect to + this CC0 or use of the Work. + + +# Nerdbank.GitVersioning + +The MIT License (MIT) + +Copyright (c) .NET Foundation and Contributors + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +# Octokit + +Copyright (c) 2017 GitHub, Inc. + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +# TlshSharp + +/* =========== + * BSD License + * =========== + * Copyright (c) 2017, Trend Micro Incorporated + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of the copyright holder nor the names of its contributors + * may be used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + # DOTNET + The MIT License (MIT) + +Copyright (c) .NET Foundation and Contributors + +All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + diff --git a/Launcher/Resources/default.shader b/Launcher/Resources/default.shader new file mode 100644 index 0000000..44213c8 Binary files /dev/null and b/Launcher/Resources/default.shader differ diff --git a/Launcher/Resources/defaultH2.shader b/Launcher/Resources/defaultH2.shader new file mode 100644 index 0000000..82a39b7 Binary files /dev/null and b/Launcher/Resources/defaultH2.shader differ diff --git a/Launcher/Resources/default_odst.shader b/Launcher/Resources/default_odst.shader new file mode 100644 index 0000000..1dee6a7 Binary files /dev/null and b/Launcher/Resources/default_odst.shader differ diff --git a/Launcher/ToolkitInterface/H1AToolkit.cs b/Launcher/ToolkitInterface/H1AToolkit.cs index 61ab54d..2572a39 100644 --- a/Launcher/ToolkitInterface/H1AToolkit.cs +++ b/Launcher/ToolkitInterface/H1AToolkit.cs @@ -68,7 +68,7 @@ protected override string sapienWindowClass /// /// /// - public override async Task ImportModel(string path, ModelCompile importType, bool phantomFix, bool h2SelectionLogic, bool renderPRT, bool FPAnim, string characterFPPath, string weaponFPPath, bool accurateRender, bool verboseAnim, bool uncompressedAnim, bool skyRender, bool PDARender, bool resetCompression, bool autoFBX) + public override async Task ImportModel(string path, ModelCompile importType, bool phantomFix, bool h2SelectionLogic, bool renderPRT, bool FPAnim, string characterFPPath, string weaponFPPath, bool accurateRender, bool verboseAnim, bool uncompressedAnim, bool skyRender, bool PDARender, bool resetCompression, bool autoFBX, bool genShaders) { if (autoFBX) { await AutoFBX.Model(this, path, importType); } diff --git a/Launcher/ToolkitInterface/H1Toolkit.cs b/Launcher/ToolkitInterface/H1Toolkit.cs index c99cb80..7c4275e 100644 --- a/Launcher/ToolkitInterface/H1Toolkit.cs +++ b/Launcher/ToolkitInterface/H1Toolkit.cs @@ -57,7 +57,7 @@ public async Task ImportHUDStrings(string path, string scenario_name) /// /// /// - public override async Task ImportModel(string path, ModelCompile importType, bool phantomFix, bool h2SelectionLogic, bool renderPRT, bool FPAnim, string characterFPPath, string weaponFPPath, bool accurateRender, bool verboseAnim, bool uncompressedAnim, bool skyRender, bool PDARender, bool resetCompression, bool autoFBX) + public override async Task ImportModel(string path, ModelCompile importType, bool phantomFix, bool h2SelectionLogic, bool renderPRT, bool FPAnim, string characterFPPath, string weaponFPPath, bool accurateRender, bool verboseAnim, bool uncompressedAnim, bool skyRender, bool PDARender, bool resetCompression, bool autoFBX, bool genShaders) { if (importType.HasFlag(ModelCompile.render)) await RunTool(ToolType.Tool, new() { "model", path }); diff --git a/Launcher/ToolkitInterface/H2AToolkit.cs b/Launcher/ToolkitInterface/H2AToolkit.cs index 8c28375..bf0656f 100644 --- a/Launcher/ToolkitInterface/H2AToolkit.cs +++ b/Launcher/ToolkitInterface/H2AToolkit.cs @@ -86,7 +86,7 @@ private string set_flags(string flag_string, string flag_name) return flag_string; } - public override async Task ImportModel(string path, ModelCompile importType, bool phantomFix, bool h2SelectionLogic, bool renderPRT, bool FPAnim, string characterFPPath, string weaponFPPath, bool accurateRender, bool verboseAnim, bool uncompressedAnim, bool skyRender, bool PDARender, bool resetCompression, bool autoFBX) + public override async Task ImportModel(string path, ModelCompile importType, bool phantomFix, bool h2SelectionLogic, bool renderPRT, bool FPAnim, string characterFPPath, string weaponFPPath, bool accurateRender, bool verboseAnim, bool uncompressedAnim, bool skyRender, bool PDARender, bool resetCompression, bool autoFBX, bool genShaders) { #if !DEBUG renderPRT = false; // broken right now @@ -108,6 +108,8 @@ public override async Task ImportModel(string path, ModelCompile importType, boo if (autoFBX) { await AutoFBX.Model(this, path, importType); } if (importType.HasFlag(ModelCompile.render)) + // Generate shaders if requested + if (genShaders) { if (!AutoShaders.CreateEmptyShaders(BaseDirectory, path, "H2")) { return; }; } await RunTool(ToolType.Tool, new() { "render", path, accurateRender.ToString(), renderPRT.ToString() }); if (importType.HasFlag(ModelCompile.collision)) await RunTool(ToolType.Tool, new() { "collision", path }); diff --git a/Launcher/ToolkitInterface/H2Toolkit.cs b/Launcher/ToolkitInterface/H2Toolkit.cs index 99ac533..e31f6f0 100644 --- a/Launcher/ToolkitInterface/H2Toolkit.cs +++ b/Launcher/ToolkitInterface/H2Toolkit.cs @@ -188,7 +188,7 @@ private async Task RunMergeLightmap(string scenario, string bsp, int workerCount /// /// /// - public override async Task ImportModel(string path, ModelCompile importType, bool phantomFix, bool h2SelectionLogic, bool renderPRT, bool FPAnim, string characterFPPath, string weaponFPPath, bool accurateRender, bool verboseAnim, bool uncompressedAnim, bool skyRender, bool PDARender, bool resetCompression, bool autoFBX) + public override async Task ImportModel(string path, ModelCompile importType, bool phantomFix, bool h2SelectionLogic, bool renderPRT, bool FPAnim, string characterFPPath, string weaponFPPath, bool accurateRender, bool verboseAnim, bool uncompressedAnim, bool skyRender, bool PDARender, bool resetCompression, bool autoFBX, bool genShaders) { if (importType.HasFlag(ModelCompile.render)) await RunTool(ToolType.Tool, new() { "model-render", path }); diff --git a/Launcher/ToolkitInterface/H3ODSTToolkit.cs b/Launcher/ToolkitInterface/H3ODSTToolkit.cs index 9667e39..1dfdcee 100644 --- a/Launcher/ToolkitInterface/H3ODSTToolkit.cs +++ b/Launcher/ToolkitInterface/H3ODSTToolkit.cs @@ -21,7 +21,7 @@ public H3ODSTToolkit(ProfileSettingsLauncher profile, string baseDirectory, Dict /// /// /// - public override async Task ImportModel(string path, ModelCompile importType, bool phantomFix, bool h2SelectionLogic, bool renderPRT, bool FPAnim, string characterFPPath, string weaponFPPath, bool accurateRender, bool verboseAnim, bool uncompressedAnim, bool skyRender, bool PDARender, bool resetCompression, bool autoFBX) + public override async Task ImportModel(string path, ModelCompile importType, bool phantomFix, bool h2SelectionLogic, bool renderPRT, bool FPAnim, string characterFPPath, string weaponFPPath, bool accurateRender, bool verboseAnim, bool uncompressedAnim, bool skyRender, bool PDARender, bool resetCompression, bool autoFBX, bool genShaders) { string type = ""; if (verboseAnim) @@ -37,9 +37,11 @@ public override async Task ImportModel(string path, ModelCompile importType, boo type = "-reset"; } - if(autoFBX) { await AutoFBX.Model(this, path, importType); } + if (autoFBX) { await AutoFBX.Model(this, path, importType); } if (importType.HasFlag(ModelCompile.render)) + // Generate shaders if requested + if (genShaders) { if (!AutoShaders.CreateEmptyShaders(BaseDirectory, path, "H3ODST")) { return; }; } if (skyRender) await RunTool(ToolType.Tool, new() { "render-sky", path }); else if (accurateRender) diff --git a/Launcher/ToolkitInterface/H3Toolkit.cs b/Launcher/ToolkitInterface/H3Toolkit.cs index 3ab7f9e..c677779 100644 --- a/Launcher/ToolkitInterface/H3Toolkit.cs +++ b/Launcher/ToolkitInterface/H3Toolkit.cs @@ -36,7 +36,7 @@ override public async Task ImportUnicodeStrings(string path) override public async Task ImportStructure(StructureType structure_command, string data_file, bool phantom_fix, bool release, bool useFast, bool autoFBX) { - if(autoFBX) { await AutoFBX.Structure(this, data_file, false); } + if (autoFBX) { await AutoFBX.Structure(this, data_file, false); } ToolType tool = useFast ? ToolType.ToolFast : ToolType.Tool; string tool_command = structure_command.ToString().Replace("_", "-"); @@ -172,7 +172,8 @@ public override async Task BuildLightmap(string scenario, string bsp, LightmapAr try { await FauxLocalFarm(scenario, bsp, lightmap_group, quality, args.instanceCount, args.NoAssert, args.instanceOutput, progress); - } catch (OperationCanceledException) + } + catch (OperationCanceledException) { } @@ -184,7 +185,7 @@ public override async Task BuildLightmap(string scenario, string bsp, LightmapAr /// /// /// - public override async Task ImportModel(string path, ModelCompile importType, bool phantomFix, bool h2SelectionLogic, bool renderPRT, bool FPAnim, string characterFPPath, string weaponFPPath, bool accurateRender, bool verboseAnim, bool uncompressedAnim, bool skyRender, bool PDARender, bool resetCompression, bool autoFBX) + public override async Task ImportModel(string path, ModelCompile importType, bool phantomFix, bool h2SelectionLogic, bool renderPRT, bool FPAnim, string characterFPPath, string weaponFPPath, bool accurateRender, bool verboseAnim, bool uncompressedAnim, bool skyRender, bool PDARender, bool resetCompression, bool autoFBX, bool genShaders) { string type = ""; if (verboseAnim) @@ -200,9 +201,11 @@ public override async Task ImportModel(string path, ModelCompile importType, boo type = "-reset"; } - if(autoFBX) { await AutoFBX.Model(this, path, importType); } + if (autoFBX) { await AutoFBX.Model(this, path, importType); } if (importType.HasFlag(ModelCompile.render)) + // Generate shaders if requested + if (genShaders) { if (!AutoShaders.CreateEmptyShaders(BaseDirectory, path, "H3")) { return; }; } if (skyRender) await RunTool(ToolType.Tool, new() { "render-sky", path }); else if (accurateRender) diff --git a/Launcher/ToolkitInterface/ToolkitBase.cs b/Launcher/ToolkitInterface/ToolkitBase.cs index 525f686..84bd48b 100644 --- a/Launcher/ToolkitInterface/ToolkitBase.cs +++ b/Launcher/ToolkitInterface/ToolkitBase.cs @@ -169,8 +169,9 @@ public enum ResourceMapUsage /// /// /// + /// /// - public abstract Task ImportModel(string path, ModelCompile importType, bool phantomFix, bool h2SelectionLogic, bool renderPRT, bool FPAnim, string characterFPPath, string weaponFPPath, bool accurateRender, bool verboseAnim, bool uncompressedAnim, bool skyRender, bool PDARender, bool resetCompression, bool autoFBX); + public abstract Task ImportModel(string path, ModelCompile importType, bool phantomFix, bool h2SelectionLogic, bool renderPRT, bool FPAnim, string characterFPPath, string weaponFPPath, bool accurateRender, bool verboseAnim, bool uncompressedAnim, bool skyRender, bool PDARender, bool resetCompression, bool autoFBX, bool genShaders); /// /// Import a WAV file to generate a sound tag diff --git a/Launcher/ToolkitLauncher.csproj b/Launcher/ToolkitLauncher.csproj index 3f92be4..5157fd6 100644 --- a/Launcher/ToolkitLauncher.csproj +++ b/Launcher/ToolkitLauncher.csproj @@ -32,6 +32,7 @@ false true annotations + DEBUG;TRACE @@ -40,12 +41,14 @@ + PreserveNewest + @@ -74,9 +77,6 @@ - - 1.1.1 - @@ -88,12 +88,23 @@ Code + + True + True + Resources.resx + True True Settings.settings + + + ResXFileCodeGenerator + Resources.Designer.cs + + SettingsSingleFileGenerator diff --git a/Launcher/Utility/AutoShaders.cs b/Launcher/Utility/AutoShaders.cs new file mode 100644 index 0000000..d8023d3 --- /dev/null +++ b/Launcher/Utility/AutoShaders.cs @@ -0,0 +1,283 @@ +using System; +using System.IO; +using System.Linq; +using System.Diagnostics; +using System.Windows.Forms; +using System.Collections.Generic; +using System.Text.RegularExpressions; + +internal class AutoShaders +{ + public static bool CreateEmptyShaders(string BaseDirectory, string path, string gameType) + { + // Variables + string full_jms_path = ""; + int counter = 0; + + //Grabbing full path from drive letter to render folder + string jmsPath = (BaseDirectory + @"\data\" + path + @"\render").Replace("\\\\", "\\"); + + // Get all files in render folder + string[] files = Array.Empty(); + try + { + files = Directory.GetFiles(jmsPath); + } + catch (DirectoryNotFoundException) + { + MessageBox.Show("Unable to find JMS filepath!\nThis usually happens if your filepath contains invalid characters.\nAborting model import and shader generation...", "Fatal Error", MessageBoxButtons.OK, MessageBoxIcon.Error); + return false; + } + + string destinationShadersFolder = BaseDirectory + @"\tags\" + path + @"\shaders"; + + // Checking if shaders already exist, if so don't re-gen them + try + { + if (!(Directory.GetFiles(destinationShadersFolder) == Array.Empty())) + { + Debug.WriteLine("Shaders already exist!"); + if (MessageBox.Show("Shaders for this model already exist!\nWould you like to generate any missing shaders?", "Shader Gen. Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes) + { + string[] shaders = JMSMaterialReader.ReadAllMaterials(files, counter, full_jms_path, BaseDirectory, gameType); + shaderGen(shaders, counter, full_jms_path, destinationShadersFolder, BaseDirectory, gameType); + } + else + { + return true; + } + } + else + { + string[] shaders = JMSMaterialReader.ReadAllMaterials(files, counter, full_jms_path, BaseDirectory, gameType); + shaderGen(shaders, counter, full_jms_path, destinationShadersFolder, BaseDirectory, gameType); + } + } + catch (DirectoryNotFoundException) + { + Debug.WriteLine("No folders exist, proceeding with shader gen"); + string[] shaders = JMSMaterialReader.ReadAllMaterials(files, counter, full_jms_path, BaseDirectory, gameType); + shaderGen(shaders, counter, full_jms_path, destinationShadersFolder, BaseDirectory, gameType); + } + + static void shaderGen(string[] shaders, int counter, string full_jms_path, string destinationShadersFolder, string BaseDirectory, string gameType) + { + string defaultShaderLocation = ""; + + // Create directories + Directory.CreateDirectory(destinationShadersFolder); + + // Make sure default.shader exists, if not, create it + defaultShaderLocation = gameType == "H2" + ? BaseDirectory + @"\tags\shaders\default.shader" + : BaseDirectory + @"\tags\levels\shared\shaders\simple\default.shader"; + + if (!File.Exists(defaultShaderLocation)) + { + if (gameType == "H3") + { + File.WriteAllBytes(defaultShaderLocation, ToolkitLauncher.Utility.Resources.defaultH3); + } + else if (gameType == "H3ODST") + { + File.WriteAllBytes(defaultShaderLocation, ToolkitLauncher.Utility.Resources.defaultODST); + } + else + { + File.WriteAllBytes(defaultShaderLocation, ToolkitLauncher.Utility.Resources.defaultH2); + } + } + + // Write each shader + foreach (string shader in shaders) + { + string shaderName = shader + ".shader"; + if (shaderName == ".shader") + { + MessageBox.Show("Detected an invalid (possibly blank) shader name!\nThis shader will not be generated.\nThis won't work well in-game.", "Shader Gen. Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); + try { File.Copy(defaultShaderLocation, Path.Combine(destinationShadersFolder, "im.too.dumb.to.name.my.shader")); } catch { Debug.WriteLine("ah well"); }; + continue; + } + if (!File.Exists(Path.Combine(destinationShadersFolder, shaderName))) + { + try + { + File.Copy(defaultShaderLocation, Path.Combine(destinationShadersFolder, shaderName)); + } + catch (FileNotFoundException) + { + // Will probably only occur if user somehow deletes default.shader after the check for its existence occurs, + // but before shaders are generated + if (MessageBox.Show("Unable to find shader to copy from!\nThis really shouldn't have happened.\nPress OK to try again, or Cancel to skip shader generation.", "Shader Gen. Error", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) == DialogResult.OK) + { + if (gameType == "H3") + { + File.WriteAllBytes(defaultShaderLocation, ToolkitLauncher.Utility.Resources.defaultH3); + } + else if (gameType == "H3ODST") + { + File.WriteAllBytes(defaultShaderLocation, ToolkitLauncher.Utility.Resources.defaultODST); + } + else + { + File.WriteAllBytes(defaultShaderLocation, ToolkitLauncher.Utility.Resources.defaultH2); + } + counter = 0; + shaderGen(shaders, counter, full_jms_path, destinationShadersFolder, BaseDirectory, gameType); + break; + } + else + { + break; + } + } + } + } + } + + // Default fall-through + return true; + } +} + +// JMS Material Parser +// TODO (PepperMan) - Make this less hardcoded, changes to line positions in JMS format will break this +internal class JMSMaterialReader +{ + public static string[] ReadAllMaterials(string[] files, int counter, string full_jms_path, string BaseDirectory, string gameType) + { + string line; + List shaders = new(); + // Find name of each jms file, then grab every material name from it + foreach (string file in files) + { + counter = 0; + if (file[^4..] is ".JMS" or ".jms") + { + full_jms_path = file; + + StreamReader sr = new(full_jms_path); + + // Find Materials definition header in JMS file + while ((line = sr.ReadLine()) != null) + { + if (line.Contains(";### MATERIALS ###")) + { + break; + } + counter++; + } + + //Grab number of materials from file + int numMats = int.Parse(File.ReadLines(full_jms_path).Skip(counter + 1).Take(1).First()); + // Line number of first shader name + int currentLine = counter + 7; + + // Open shader_collections.txt + List collections = new(); + if (gameType == "H3" || gameType == "H3ODST") + { + try + { + sr = new(BaseDirectory + @"\tags\levels\shader_collections.txt"); + } + catch (Exception) + { + MessageBox.Show("Could not find shader_collections.txt!\nMake sure you have shader_collections.txt in\n\"H3EK/tags/levels\"", "Shader Gen. Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); + } + } + else + { + try + { + sr = new(BaseDirectory + @"\tags\scenarios\shaders\shader_collections.shader_collections"); + } + catch (DirectoryNotFoundException) + { + MessageBox.Show("Could not find shader_collections file!\nMake sure you have shader_collections.shader_collections in\n\"H2EK/tags/scenarios/shaders\"", "Shader Gen. Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); + } + } + + + // Grab every shader collection prefix + if (gameType == "H3" || gameType == "H3ODST") + { + while ((line = sr.ReadLine()) != null) + { + if ((line.Contains("levels") || line.Contains("scenarios") || line.Contains("objects")) && !line.Contains("shader_collections.txt")) + { + if (line.Contains('\t')) + { + collections.Add(line.Substring(0, line.IndexOf('\t'))); + } + else + { + collections.Add(line.Substring(0, line.IndexOf(' '))); + } + } + } + } + else + { + while ((line = sr.ReadLine()) != null) + { + if ((line.Contains("scenarios") || line.Contains("objects") || line.Contains("test")) && !line.Contains('=')) + { + if (line.Contains('\t')) + { + collections.Add(line.Substring(0, line.IndexOf('\t'))); + } + else + { + collections.Add(line.Substring(0, line.IndexOf(' '))); + } + } + } + } + + // Take each material name, strip symbols, add to list + // Typically the most "complex" materials come in the format: prefix name extra1 extra2 extra3... + // So if a prefix exists, check that it is a valid collection, if so ignore it as shader will be grabbed from collection, + // but if it isn't, it should be treated as part of the full shader name + string[] extras = { "lm:", "lp:", "hl:", "ds:", "pf:", "lt:", "to:", "at:", "ro:" }; + string shaderNameStripped; + for (int i = 0; i < numMats; i++) + { + string[] shaderNameSections = File.ReadLines(full_jms_path).Skip(currentLine - 1).Take(1).First().Split(' '); + if (shaderNameSections.Length < 2) + { + shaderNameStripped = Regex.Replace(shaderNameSections[0], "[^0-9a-zA-Z_.]", string.Empty); + shaders.Add(shaderNameStripped); + } + else // Shader name has spaces in it + { + // Check if section before first space is a valid shader collection prefix + if (!collections.Contains(shaderNameSections[0])) + { + // Shader is not in a collection, so probably just has a space in the name + string shaderPrefixAndName = ""; + // Check if any section is an "extra" material property, if so don't include it + foreach (string part in shaderNameSections) + { + if (!extras.Any(part.Contains)) + { + shaderPrefixAndName += part + ' '; + } + } + shaderNameStripped = Regex.Replace(shaderPrefixAndName, "[^0-9a-zA-Z_. ]", string.Empty).Trim(); + shaders.Add(shaderNameStripped); + } + // Otherwise shader is part of an existing collection, so no need to create a new tag for it + } + // Skip to next shader name + currentLine += 4; + } + } + } + + // Remove duplicate shader names + shaders = shaders.Distinct().ToList(); + + return shaders.ToArray(); + } +} \ No newline at end of file diff --git a/Launcher/Utility/Resources.Designer.cs b/Launcher/Utility/Resources.Designer.cs new file mode 100644 index 0000000..6ddd8bd --- /dev/null +++ b/Launcher/Utility/Resources.Designer.cs @@ -0,0 +1,93 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace ToolkitLauncher.Utility { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ToolkitLauncher.Utility.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + + /// + /// Looks up a localized resource of type System.Byte[]. + /// + internal static byte[] defaultH2 { + get { + object obj = ResourceManager.GetObject("defaultH2", resourceCulture); + return ((byte[])(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Byte[]. + /// + internal static byte[] defaultH3 { + get { + object obj = ResourceManager.GetObject("defaultH3", resourceCulture); + return ((byte[])(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Byte[]. + /// + internal static byte[] defaultODST { + get { + object obj = ResourceManager.GetObject("defaultODST", resourceCulture); + return ((byte[])(obj)); + } + } + } +} diff --git a/Launcher/Utility/Resources.resx b/Launcher/Utility/Resources.resx new file mode 100644 index 0000000..017b82b --- /dev/null +++ b/Launcher/Utility/Resources.resx @@ -0,0 +1,130 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + + ..\Resources\defaultH2.shader;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + ..\Resources\default.shader;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + ..\Resources\default_odst.shader;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/README.md b/README.md index 15b08e4..3bb10b6 100644 --- a/README.md +++ b/README.md @@ -32,6 +32,7 @@ Launcher can do the following: * Create profiles to manage many different toolsets from one UI * Run a Guerilla or Sapien instance from the UI * Run tool commands from the UI or open command prompt in the root of the toolkit + * Automatically generate blank .shader tags for new models to save you time (H2/H3/ODST) ## Usage