├── .gitignore ├── Config.cs ├── LICENSE ├── Notification.cs ├── Patch.cs ├── Plugin.cs ├── PluginBehavior.cs ├── README.md ├── README_TC.md ├── SS_Notification.ps1 ├── TSKHook.csproj ├── TSKHook.sln ├── Translation.cs ├── Translation.md ├── Window.cs ├── config.json └── img ├── 3x.gif ├── tsk_translation1.png ├── tsk_translation2.png ├── tsk_translation3.png └── tsk_translation4.png /.gitignore: -------------------------------------------------------------------------------- 1 | .vs/ 2 | bin/ 3 | obj/ 4 | -------------------------------------------------------------------------------- /Config.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json; 2 | using Il2CppSystem.IO; 3 | using Il2CppSystem.Text; 4 | 5 | namespace TSKHook; 6 | 7 | public class TSKConfig 8 | { 9 | public static double Speed; 10 | public static int FPS; 11 | public static bool TranslationEnabled; 12 | public static int width; 13 | public static int height; 14 | public static float zoom; 15 | 16 | public static void Read() 17 | { 18 | if (File.Exists("./BepInEx/plugins/config.json")) 19 | { 20 | var content = File.InternalReadAllText("./BepInEx/plugins/config.json", Encoding.UTF8); 21 | var doc = JsonDocument.Parse(content); 22 | var config = doc.RootElement; 23 | 24 | var needWrite = false; 25 | 26 | if (config.TryGetProperty("speed", out var sValue)) 27 | { 28 | Speed = sValue.GetDouble(); 29 | } 30 | else 31 | { 32 | Speed = 0.5; 33 | needWrite = true; 34 | } 35 | 36 | if (config.TryGetProperty("fps", out var fValue)) 37 | { 38 | FPS = fValue.GetInt32(); 39 | } 40 | else 41 | { 42 | FPS = 60; 43 | needWrite = true; 44 | } 45 | 46 | if (config.TryGetProperty("translation", out var tValue)) 47 | { 48 | TranslationEnabled = tValue.GetBoolean(); 49 | } 50 | else 51 | { 52 | TranslationEnabled = true; 53 | needWrite = true; 54 | } 55 | 56 | if (config.TryGetProperty("width", out var wValue)) 57 | { 58 | width = wValue.GetInt32(); 59 | } 60 | else 61 | { 62 | width = 1280; 63 | needWrite = true; 64 | } 65 | 66 | if (config.TryGetProperty("height", out var hValue)) 67 | { 68 | height = hValue.GetInt32(); 69 | } 70 | else 71 | { 72 | height = 720; 73 | needWrite = true; 74 | } 75 | 76 | if (config.TryGetProperty("zoom", out var zValue)) 77 | { 78 | zoom = (float)zValue.GetDouble(); 79 | } 80 | else 81 | { 82 | zoom = 1.0f; 83 | needWrite = true; 84 | } 85 | 86 | if (needWrite) WriteJsonFile(Speed, FPS, TranslationEnabled, width, width, zoom); 87 | 88 | Plugin.Global.Log.LogInfo("Current setting:"); 89 | Plugin.Global.Log.LogInfo("Game speed(each step): " + Speed); 90 | Plugin.Global.Log.LogInfo("FPS: " + FPS); 91 | Plugin.Global.Log.LogInfo("Translation: " + (TranslationEnabled ? "Enabled" : "Disabled")); 92 | Plugin.Global.Log.LogInfo("Zoom ratio: " + zoom); 93 | } 94 | else 95 | { 96 | Plugin.Global.Log.LogWarning("config.json not found!!!"); 97 | Plugin.Global.Log.LogWarning("Using default config."); 98 | Speed = 0.5; 99 | FPS = 60; 100 | TranslationEnabled = true; 101 | width = 1280; 102 | height = 720; 103 | zoom = 1.0f; 104 | 105 | // Create default JSON file 106 | WriteJsonFile(0.5, 60, true, width, height, zoom); 107 | } 108 | } 109 | 110 | public static void WriteJsonFile(double speed, int fps, bool enabled, int w, int h, float z) 111 | { 112 | var config = new config 113 | { 114 | speed = speed, 115 | fps = fps, 116 | translation = enabled, 117 | width = w, 118 | height = h, 119 | zoom = z 120 | }; 121 | 122 | var json = JsonSerializer.Serialize(config, new JsonSerializerOptions { WriteIndented = true }); 123 | File.WriteAllText("./BepInEx/plugins/config.json", json); 124 | } 125 | 126 | public class config 127 | { 128 | public double speed { get; set; } 129 | public int fps { get; set; } 130 | public bool translation { get; set; } 131 | public int width { get; set; } 132 | public int height { get; set; } 133 | public float zoom { get; set; } 134 | } 135 | } -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 2, June 1991 3 | 4 | Copyright (C) 1989, 1991 Free Software Foundation, Inc., 5 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 6 | Everyone is permitted to copy and distribute verbatim copies 7 | of this license document, but changing it is not allowed. 8 | 9 | Preamble 10 | 11 | The licenses for most software are designed to take away your 12 | freedom to share and change it. By contrast, the GNU General Public 13 | License is intended to guarantee your freedom to share and change free 14 | software--to make sure the software is free for all its users. This 15 | General Public License applies to most of the Free Software 16 | Foundation's software and to any other program whose authors commit to 17 | using it. (Some other Free Software Foundation software is covered by 18 | the GNU Lesser General Public License instead.) You can apply it to 19 | your programs, too. 20 | 21 | When we speak of free software, we are referring to freedom, not 22 | price. Our General Public Licenses are designed to make sure that you 23 | have the freedom to distribute copies of free software (and charge for 24 | this service if you wish), that you receive source code or can get it 25 | if you want it, that you can change the software or use pieces of it 26 | in new free programs; and that you know you can do these things. 27 | 28 | To protect your rights, we need to make restrictions that forbid 29 | anyone to deny you these rights or to ask you to surrender the rights. 30 | These restrictions translate to certain responsibilities for you if you 31 | distribute copies of the software, or if you modify it. 32 | 33 | For example, if you distribute copies of such a program, whether 34 | gratis or for a fee, you must give the recipients all the rights that 35 | you have. You must make sure that they, too, receive or can get the 36 | source code. And you must show them these terms so they know their 37 | rights. 38 | 39 | We protect your rights with two steps: (1) copyright the software, and 40 | (2) offer you this license which gives you legal permission to copy, 41 | distribute and/or modify the software. 42 | 43 | Also, for each author's protection and ours, we want to make certain 44 | that everyone understands that there is no warranty for this free 45 | software. If the software is modified by someone else and passed on, we 46 | want its recipients to know that what they have is not the original, so 47 | that any problems introduced by others will not reflect on the original 48 | authors' reputations. 49 | 50 | Finally, any free program is threatened constantly by software 51 | patents. We wish to avoid the danger that redistributors of a free 52 | program will individually obtain patent licenses, in effect making the 53 | program proprietary. To prevent this, we have made it clear that any 54 | patent must be licensed for everyone's free use or not licensed at all. 55 | 56 | The precise terms and conditions for copying, distribution and 57 | modification follow. 58 | 59 | GNU GENERAL PUBLIC LICENSE 60 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 61 | 62 | 0. This License applies to any program or other work which contains 63 | a notice placed by the copyright holder saying it may be distributed 64 | under the terms of this General Public License. The "Program", below, 65 | refers to any such program or work, and a "work based on the Program" 66 | means either the Program or any derivative work under copyright law: 67 | that is to say, a work containing the Program or a portion of it, 68 | either verbatim or with modifications and/or translated into another 69 | language. (Hereinafter, translation is included without limitation in 70 | the term "modification".) Each licensee is addressed as "you". 71 | 72 | Activities other than copying, distribution and modification are not 73 | covered by this License; they are outside its scope. The act of 74 | running the Program is not restricted, and the output from the Program 75 | is covered only if its contents constitute a work based on the 76 | Program (independent of having been made by running the Program). 77 | Whether that is true depends on what the Program does. 78 | 79 | 1. You may copy and distribute verbatim copies of the Program's 80 | source code as you receive it, in any medium, provided that you 81 | conspicuously and appropriately publish on each copy an appropriate 82 | copyright notice and disclaimer of warranty; keep intact all the 83 | notices that refer to this License and to the absence of any warranty; 84 | and give any other recipients of the Program a copy of this License 85 | along with the Program. 86 | 87 | You may charge a fee for the physical act of transferring a copy, and 88 | you may at your option offer warranty protection in exchange for a fee. 89 | 90 | 2. You may modify your copy or copies of the Program or any portion 91 | of it, thus forming a work based on the Program, and copy and 92 | distribute such modifications or work under the terms of Section 1 93 | above, provided that you also meet all of these conditions: 94 | 95 | a) You must cause the modified files to carry prominent notices 96 | stating that you changed the files and the date of any change. 97 | 98 | b) You must cause any work that you distribute or publish, that in 99 | whole or in part contains or is derived from the Program or any 100 | part thereof, to be licensed as a whole at no charge to all third 101 | parties under the terms of this License. 102 | 103 | c) If the modified program normally reads commands interactively 104 | when run, you must cause it, when started running for such 105 | interactive use in the most ordinary way, to print or display an 106 | announcement including an appropriate copyright notice and a 107 | notice that there is no warranty (or else, saying that you provide 108 | a warranty) and that users may redistribute the program under 109 | these conditions, and telling the user how to view a copy of this 110 | License. (Exception: if the Program itself is interactive but 111 | does not normally print such an announcement, your work based on 112 | the Program is not required to print an announcement.) 113 | 114 | These requirements apply to the modified work as a whole. If 115 | identifiable sections of that work are not derived from the Program, 116 | and can be reasonably considered independent and separate works in 117 | themselves, then this License, and its terms, do not apply to those 118 | sections when you distribute them as separate works. But when you 119 | distribute the same sections as part of a whole which is a work based 120 | on the Program, the distribution of the whole must be on the terms of 121 | this License, whose permissions for other licensees extend to the 122 | entire whole, and thus to each and every part regardless of who wrote it. 123 | 124 | Thus, it is not the intent of this section to claim rights or contest 125 | your rights to work written entirely by you; rather, the intent is to 126 | exercise the right to control the distribution of derivative or 127 | collective works based on the Program. 128 | 129 | In addition, mere aggregation of another work not based on the Program 130 | with the Program (or with a work based on the Program) on a volume of 131 | a storage or distribution medium does not bring the other work under 132 | the scope of this License. 133 | 134 | 3. You may copy and distribute the Program (or a work based on it, 135 | under Section 2) in object code or executable form under the terms of 136 | Sections 1 and 2 above provided that you also do one of the following: 137 | 138 | a) Accompany it with the complete corresponding machine-readable 139 | source code, which must be distributed under the terms of Sections 140 | 1 and 2 above on a medium customarily used for software interchange; or, 141 | 142 | b) Accompany it with a written offer, valid for at least three 143 | years, to give any third party, for a charge no more than your 144 | cost of physically performing source distribution, a complete 145 | machine-readable copy of the corresponding source code, to be 146 | distributed under the terms of Sections 1 and 2 above on a medium 147 | customarily used for software interchange; or, 148 | 149 | c) Accompany it with the information you received as to the offer 150 | to distribute corresponding source code. (This alternative is 151 | allowed only for noncommercial distribution and only if you 152 | received the program in object code or executable form with such 153 | an offer, in accord with Subsection b above.) 154 | 155 | The source code for a work means the preferred form of the work for 156 | making modifications to it. For an executable work, complete source 157 | code means all the source code for all modules it contains, plus any 158 | associated interface definition files, plus the scripts used to 159 | control compilation and installation of the executable. However, as a 160 | special exception, the source code distributed need not include 161 | anything that is normally distributed (in either source or binary 162 | form) with the major components (compiler, kernel, and so on) of the 163 | operating system on which the executable runs, unless that component 164 | itself accompanies the executable. 165 | 166 | If distribution of executable or object code is made by offering 167 | access to copy from a designated place, then offering equivalent 168 | access to copy the source code from the same place counts as 169 | distribution of the source code, even though third parties are not 170 | compelled to copy the source along with the object code. 171 | 172 | 4. You may not copy, modify, sublicense, or distribute the Program 173 | except as expressly provided under this License. Any attempt 174 | otherwise to copy, modify, sublicense or distribute the Program is 175 | void, and will automatically terminate your rights under this License. 176 | However, parties who have received copies, or rights, from you under 177 | this License will not have their licenses terminated so long as such 178 | parties remain in full compliance. 179 | 180 | 5. You are not required to accept this License, since you have not 181 | signed it. However, nothing else grants you permission to modify or 182 | distribute the Program or its derivative works. These actions are 183 | prohibited by law if you do not accept this License. Therefore, by 184 | modifying or distributing the Program (or any work based on the 185 | Program), you indicate your acceptance of this License to do so, and 186 | all its terms and conditions for copying, distributing or modifying 187 | the Program or works based on it. 188 | 189 | 6. Each time you redistribute the Program (or any work based on the 190 | Program), the recipient automatically receives a license from the 191 | original licensor to copy, distribute or modify the Program subject to 192 | these terms and conditions. You may not impose any further 193 | restrictions on the recipients' exercise of the rights granted herein. 194 | You are not responsible for enforcing compliance by third parties to 195 | this License. 196 | 197 | 7. If, as a consequence of a court judgment or allegation of patent 198 | infringement or for any other reason (not limited to patent issues), 199 | conditions are imposed on you (whether by court order, agreement or 200 | otherwise) that contradict the conditions of this License, they do not 201 | excuse you from the conditions of this License. If you cannot 202 | distribute so as to satisfy simultaneously your obligations under this 203 | License and any other pertinent obligations, then as a consequence you 204 | may not distribute the Program at all. For example, if a patent 205 | license would not permit royalty-free redistribution of the Program by 206 | all those who receive copies directly or indirectly through you, then 207 | the only way you could satisfy both it and this License would be to 208 | refrain entirely from distribution of the Program. 209 | 210 | If any portion of this section is held invalid or unenforceable under 211 | any particular circumstance, the balance of the section is intended to 212 | apply and the section as a whole is intended to apply in other 213 | circumstances. 214 | 215 | It is not the purpose of this section to induce you to infringe any 216 | patents or other property right claims or to contest validity of any 217 | such claims; this section has the sole purpose of protecting the 218 | integrity of the free software distribution system, which is 219 | implemented by public license practices. Many people have made 220 | generous contributions to the wide range of software distributed 221 | through that system in reliance on consistent application of that 222 | system; it is up to the author/donor to decide if he or she is willing 223 | to distribute software through any other system and a licensee cannot 224 | impose that choice. 225 | 226 | This section is intended to make thoroughly clear what is believed to 227 | be a consequence of the rest of this License. 228 | 229 | 8. If the distribution and/or use of the Program is restricted in 230 | certain countries either by patents or by copyrighted interfaces, the 231 | original copyright holder who places the Program under this License 232 | may add an explicit geographical distribution limitation excluding 233 | those countries, so that distribution is permitted only in or among 234 | countries not thus excluded. In such case, this License incorporates 235 | the limitation as if written in the body of this License. 236 | 237 | 9. The Free Software Foundation may publish revised and/or new versions 238 | of the General Public License from time to time. Such new versions will 239 | be similar in spirit to the present version, but may differ in detail to 240 | address new problems or concerns. 241 | 242 | Each version is given a distinguishing version number. If the Program 243 | specifies a version number of this License which applies to it and "any 244 | later version", you have the option of following the terms and conditions 245 | either of that version or of any later version published by the Free 246 | Software Foundation. If the Program does not specify a version number of 247 | this License, you may choose any version ever published by the Free Software 248 | Foundation. 249 | 250 | 10. If you wish to incorporate parts of the Program into other free 251 | programs whose distribution conditions are different, write to the author 252 | to ask for permission. For software which is copyrighted by the Free 253 | Software Foundation, write to the Free Software Foundation; we sometimes 254 | make exceptions for this. Our decision will be guided by the two goals 255 | of preserving the free status of all derivatives of our free software and 256 | of promoting the sharing and reuse of software generally. 257 | 258 | NO WARRANTY 259 | 260 | 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY 261 | FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN 262 | OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES 263 | PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED 264 | OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 265 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS 266 | TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE 267 | PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, 268 | REPAIR OR CORRECTION. 269 | 270 | 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 271 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR 272 | REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, 273 | INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING 274 | OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED 275 | TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY 276 | YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER 277 | PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE 278 | POSSIBILITY OF SUCH DAMAGES. 279 | 280 | END OF TERMS AND CONDITIONS 281 | 282 | How to Apply These Terms to Your New Programs 283 | 284 | If you develop a new program, and you want it to be of the greatest 285 | possible use to the public, the best way to achieve this is to make it 286 | free software which everyone can redistribute and change under these terms. 287 | 288 | To do so, attach the following notices to the program. It is safest 289 | to attach them to the start of each source file to most effectively 290 | convey the exclusion of warranty; and each file should have at least 291 | the "copyright" line and a pointer to where the full notice is found. 292 | 293 | 294 | Copyright (C) 295 | 296 | This program is free software; you can redistribute it and/or modify 297 | it under the terms of the GNU General Public License as published by 298 | the Free Software Foundation; either version 2 of the License, or 299 | (at your option) any later version. 300 | 301 | This program is distributed in the hope that it will be useful, 302 | but WITHOUT ANY WARRANTY; without even the implied warranty of 303 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 304 | GNU General Public License for more details. 305 | 306 | You should have received a copy of the GNU General Public License along 307 | with this program; if not, write to the Free Software Foundation, Inc., 308 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 309 | 310 | Also add information on how to contact you by electronic and paper mail. 311 | 312 | If the program is interactive, make it output a short notice like this 313 | when it starts in an interactive mode: 314 | 315 | Gnomovision version 69, Copyright (C) year name of author 316 | Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 317 | This is free software, and you are welcome to redistribute it 318 | under certain conditions; type `show c' for details. 319 | 320 | The hypothetical commands `show w' and `show c' should show the appropriate 321 | parts of the General Public License. Of course, the commands you use may 322 | be called something other than `show w' and `show c'; they could even be 323 | mouse-clicks or menu items--whatever suits your program. 324 | 325 | You should also get your employer (if you work as a programmer) or your 326 | school, if any, to sign a "copyright disclaimer" for the program, if 327 | necessary. Here is a sample; alter the names: 328 | 329 | Yoyodyne, Inc., hereby disclaims all copyright interest in the program 330 | `Gnomovision' (which makes passes at compilers) written by James Hacker. 331 | 332 | , 1 April 1989 333 | Ty Coon, President of Vice 334 | 335 | This General Public License does not permit incorporating your program into 336 | proprietary programs. If your program is a subroutine library, you may 337 | consider it more useful to permit linking proprietary applications with the 338 | library. If this is what you want to do, use the GNU Lesser General 339 | Public License instead of this License. -------------------------------------------------------------------------------- /Notification.cs: -------------------------------------------------------------------------------- 1 | using System.Diagnostics; 2 | 3 | namespace TSKHook; 4 | 5 | public class Notification 6 | { 7 | public static void Popup(string title, string text) 8 | { 9 | var script = string.Format("$headlineText = '{0}';", title) + 10 | string.Format("$bodyText = '{0}';", text) + 11 | "$ToastText02 = [Windows.UI.Notifications.ToastTemplateType, Windows.UI.Notifications, ContentType = WindowsRuntime]::ToastText02;" + 12 | "$TemplateContent = [Windows.UI.Notifications.ToastNotificationManager, Windows.UI.Notifications, ContentType = WindowsRuntime]::GetTemplateContent($ToastText02);" + 13 | "$TemplateContent.SelectSingleNode('//text[@id=\"1\"]').InnerText = $headlineText;" + 14 | "$TemplateContent.SelectSingleNode('//text[@id=\"2\"]').InnerText = $bodyText;" + 15 | "$AppId = 'Twinkle Star Knight';" + 16 | "[Windows.UI.Notifications.ToastNotificationManager]::CreateToastNotifier($AppId).Show($TemplateContent);"; 17 | 18 | var start = new ProcessStartInfo("powershell.exe") 19 | { 20 | UseShellExecute = false, 21 | Arguments = script 22 | }; 23 | Process.Start(start); 24 | } 25 | 26 | public static void SsPopup(string location) 27 | { 28 | var scriptArgs = "-ExecutionPolicy Bypass -F ./BepInEx/plugins/SS_Notification.ps1 " + location + ""; 29 | 30 | var start = new ProcessStartInfo("powershell.exe") 31 | { 32 | UseShellExecute = false, 33 | Arguments = scriptArgs 34 | }; 35 | Process.Start(start); 36 | } 37 | } -------------------------------------------------------------------------------- /Patch.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using BepInEx; 3 | using HarmonyLib; 4 | using TMPro; 5 | using UnityEngine; 6 | using Utage; 7 | using UtageExtensions; 8 | 9 | namespace TSKHook; 10 | 11 | public class Patch 12 | { 13 | private static string currentAdvId; 14 | public static string fontName = "notosanscjktc"; 15 | public static AssetBundle fontBundle; 16 | public static Font TranslateFont; 17 | public static TMP_FontAsset TMPTranslateFont; 18 | 19 | public static void Initialize() 20 | { 21 | Harmony.CreateAndPatchAll(typeof(Patch)); 22 | } 23 | 24 | [HarmonyPrefix] 25 | [HarmonyPatch(typeof(GameConfig), "set_FixedFrameRate")] 26 | public static void set_FixedFrameRate(ref int value) 27 | { 28 | if (TSKConfig.FPS > 60) 29 | { 30 | value = TSKConfig.FPS; 31 | Plugin.Global.Log.LogInfo("FPS setting was overridden: " + value); 32 | } 33 | } 34 | 35 | [HarmonyPrefix] 36 | [HarmonyPatch(typeof(AdvDataManager), "DownloadChaperKeyFileUsed")] 37 | public static void DownloadChaperKeyFileUsed(ref string scenarioLabel) 38 | { 39 | if (!TSKConfig.TranslationEnabled) 40 | { 41 | return; 42 | } 43 | 44 | if (scenarioLabel != null) 45 | { 46 | if ((TranslateFont == null || TMPTranslateFont == null) && File.Exists($"{Paths.PluginPath}/font/{fontName}")) 47 | { 48 | if (fontBundle == null) 49 | { 50 | fontBundle = AssetBundle.LoadFromFile($"{Paths.PluginPath}/font/{fontName}"); 51 | } 52 | TranslateFont = fontBundle.LoadAsset(fontName).Cast(); 53 | TMPTranslateFont = fontBundle.LoadAsset(fontName + " SDF").TryCast(); 54 | fontBundle.Unload(false); 55 | 56 | if (TranslateFont != null && TMPTranslateFont != null) 57 | { 58 | Plugin.Global.Log.LogInfo("Font loaded."); 59 | } 60 | } 61 | 62 | currentAdvId = scenarioLabel.ToLower(); 63 | if (!Translation.chapterDicts.ContainsKey(currentAdvId)) 64 | { 65 | Translation.FetchChapterTranslationAsync(currentAdvId).Wait(); 66 | } 67 | Plugin.Global.Log.LogInfo(scenarioLabel); 68 | } 69 | } 70 | 71 | [HarmonyPrefix] 72 | [HarmonyPatch(typeof(AdventureTitleBandView), "Initialize")] 73 | public static void AdvIniPre(AdventureTitleBandView __instance) 74 | { 75 | if (!TSKConfig.TranslationEnabled) 76 | { 77 | return; 78 | } 79 | 80 | string value; 81 | if (Translation.chapterDicts.ContainsKey(currentAdvId) && Translation.chapterDicts[currentAdvId].TryGetValue(__instance.TitleText, out value)) 82 | { 83 | __instance.TitleText = value.IsNullOrEmpty() ? __instance.TitleText : value; 84 | } 85 | } 86 | 87 | [HarmonyPostfix] 88 | [HarmonyPatch(typeof(AdventureTitleBandView), "Initialize")] 89 | public static void AdvInitPost(AdventureTitleBandView __instance) 90 | { 91 | if (!TSKConfig.TranslationEnabled) 92 | { 93 | return; 94 | } 95 | 96 | if (TMPTranslateFont != null) 97 | { 98 | __instance.upTextComp.text.font = TMPTranslateFont; 99 | __instance.donwTextComp.text.font = TMPTranslateFont; 100 | 101 | for (int i = 0; i < __instance.titleText.Length; i++) 102 | { 103 | __instance.titleText[i].font = TMPTranslateFont; 104 | } 105 | 106 | for (int i = 0; i < __instance.donwTextObject.Length; i++) 107 | { 108 | TKSTextTMPGUI component = __instance.donwTextObject[i].GetComponent(); 109 | component.text.font = TMPTranslateFont; 110 | } 111 | } 112 | } 113 | 114 | [HarmonyPostfix] 115 | [HarmonyPatch(typeof(UguiNovelText), "OnEnable")] 116 | public static void FontPatch(ref UguiNovelText __instance) 117 | { 118 | if (!TSKConfig.TranslationEnabled) 119 | { 120 | return; 121 | } 122 | 123 | if (TranslateFont != null) 124 | { 125 | __instance.font = TranslateFont; 126 | } 127 | } 128 | 129 | [HarmonyPostfix] 130 | [HarmonyPatch(typeof(AdvPage), "get_NameText")] 131 | public static void get_NameText(ref string __result) 132 | { 133 | if (!TSKConfig.TranslationEnabled) 134 | { 135 | return; 136 | } 137 | 138 | string value; 139 | if (Translation.nameDicts.TryGetValue(__result, out value)) 140 | { 141 | __result = value.IsNullOrEmpty() ? __result : value; 142 | } 143 | } 144 | 145 | [HarmonyPostfix] 146 | [HarmonyPatch(typeof(AdvBacklog), "get_MainCharacterNameText")] 147 | public static void get_MainCharacterNameText(ref string __result) 148 | { 149 | if (!TSKConfig.TranslationEnabled) 150 | { 151 | return; 152 | } 153 | 154 | string value; 155 | if (Translation.nameDicts.TryGetValue(__result, out value)) 156 | { 157 | __result = value.IsNullOrEmpty() ? __result : value; 158 | } 159 | } 160 | 161 | [HarmonyPostfix] 162 | [HarmonyPatch(typeof(LanguageManagerBase), "ParseCellLocalizedTextBySwapDefaultLanguage")] 163 | public static void ParseCellLocalizedTextBySwapDefaultLanguage(ref StringGridRow row, ref string defaultColumnName, 164 | ref string __result) 165 | { 166 | if (!TSKConfig.TranslationEnabled) 167 | { 168 | return; 169 | } 170 | 171 | string value; 172 | if (Translation.chapterDicts.ContainsKey(currentAdvId) && Translation.chapterDicts[currentAdvId].TryGetValue(__result, out value)) 173 | { 174 | __result = value.IsNullOrEmpty() ? __result : value; 175 | } 176 | } 177 | 178 | [HarmonyPrefix] 179 | [HarmonyPatch(typeof(Screen), "SetResolution", new[] { typeof(int), typeof(int), typeof(bool) })] 180 | public static bool SetWindowSize(ref int width, ref int height, ref bool fullscreen) 181 | { 182 | return false; 183 | } 184 | 185 | [HarmonyPrefix] 186 | [HarmonyPatch(typeof(MaximizeCharaView), "SetCharaRoot_Scale")] 187 | public static void SetCharaRoot_Scale(ref MaximizeZoomEventData _zoomData) 188 | { 189 | if (_zoomData.PinchData > 0) 190 | { 191 | _zoomData.PinchData = TSKConfig.zoom; 192 | } 193 | else 194 | { 195 | _zoomData.PinchData = -TSKConfig.zoom; 196 | } 197 | } 198 | 199 | [HarmonyPostfix] 200 | [HarmonyPatch(typeof(MaximizeCharaView), "initialize")] 201 | public static void CharaViewInit(ref MaximizeCharaView __instance) 202 | { 203 | __instance.maximizeMinSize = 0.1f; 204 | } 205 | } -------------------------------------------------------------------------------- /Plugin.cs: -------------------------------------------------------------------------------- 1 | using BepInEx; 2 | using BepInEx.Logging; 3 | using BepInEx.Unity.IL2CPP; 4 | using System; 5 | using System.Text; 6 | 7 | namespace TSKHook; 8 | 9 | [BepInPlugin(MyPluginInfo.PLUGIN_GUID, MyPluginInfo.PLUGIN_NAME, MyPluginInfo.PLUGIN_VERSION)] 10 | public class Plugin : BasePlugin 11 | { 12 | public override void Load() 13 | { 14 | Console.OutputEncoding = Encoding.UTF8; 15 | 16 | Global.Log = Log; 17 | Log.LogInfo($"Plugin {MyPluginInfo.PLUGIN_GUID} is loaded!"); 18 | 19 | TSKConfig.Read(); 20 | Window.Init(); 21 | Translation.InitAsync().Wait(); 22 | Patch.Initialize(); 23 | 24 | AddComponent(); 25 | } 26 | 27 | public class Global 28 | { 29 | public static ManualLogSource Log { get; set; } 30 | } 31 | } -------------------------------------------------------------------------------- /PluginBehavior.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine; 3 | using Utage; 4 | 5 | namespace TSKHook; 6 | 7 | public class PluginBehavior : MonoBehaviour 8 | { 9 | private static readonly float WaitTime = 1.0f; 10 | private static readonly float CtrlWaitTime = 0.1f; 11 | public static bool IsGameSpeedChanged { get; set; } 12 | public static float CurrentGameSpeed { get; set; } 13 | private static float LastGSExecuteTime { get; set; } 14 | private static float LastFPSExecuteTime { get; set; } 15 | private static float LastSkipExecuteTime { get; set; } 16 | 17 | private void Update() 18 | { 19 | if (Input.GetKeyDown(KeyCode.F8)) 20 | { 21 | CurrentGameSpeed = Time.timeScale + (float)TSKConfig.Speed; 22 | Time.timeScale += (float)TSKConfig.Speed; 23 | IsGameSpeedChanged = (int)Time.timeScale != 1; 24 | LastGSExecuteTime = Time.deltaTime; 25 | var currSpeed = Time.timeScale.ToString(); 26 | var text = "Game speed increased. Current: " + currSpeed + "x"; 27 | Plugin.Global.Log.LogInfo(text); 28 | 29 | Notification.Popup("Game Speed", text); 30 | } 31 | 32 | if (Input.GetKeyDown(KeyCode.F7)) 33 | { 34 | CurrentGameSpeed = Time.timeScale - (float)TSKConfig.Speed; 35 | Time.timeScale -= (float)TSKConfig.Speed; 36 | IsGameSpeedChanged = (int)Time.timeScale != 1; 37 | LastGSExecuteTime = Time.deltaTime; 38 | var currSpeed = Time.timeScale.ToString(); 39 | var text = "Game speed decreased. Current: " + currSpeed + "x"; 40 | Plugin.Global.Log.LogInfo(text); 41 | 42 | Notification.Popup("Game Speed", text); 43 | } 44 | 45 | if (Input.GetKeyDown(KeyCode.F6)) 46 | { 47 | CurrentGameSpeed = 1.0f; 48 | Time.timeScale = 1.0f; 49 | IsGameSpeedChanged = (int)Time.timeScale != 1; 50 | var currSpeed = Time.timeScale.ToString(); 51 | var text = "Game speed restored. Current: " + currSpeed + "x"; 52 | Plugin.Global.Log.LogInfo(text); 53 | 54 | Notification.Popup("Game Speed", text); 55 | } 56 | 57 | if (Input.GetKeyDown(KeyCode.F5)) 58 | { 59 | CurrentGameSpeed = 0.0f; 60 | Time.timeScale = 0.0f; 61 | IsGameSpeedChanged = (int)Time.timeScale != 1; 62 | LastGSExecuteTime = Time.deltaTime; 63 | var currSpeed = Time.timeScale.ToString(); 64 | var text = "Game speed freezed. Current: " + currSpeed + "x"; 65 | Plugin.Global.Log.LogInfo(text); 66 | 67 | Notification.Popup("Game Speed", text); 68 | } 69 | 70 | if (Input.GetKeyDown(KeyCode.F10)) 71 | { 72 | Translation.chapterDicts = new(); 73 | Plugin.Global.Log.LogInfo("[Translator] cache cleared."); 74 | Notification.Popup("Translation", "Translation cache cleared."); 75 | } 76 | 77 | if (Input.GetKeyDown(KeyCode.F11)) 78 | { 79 | TSKConfig.TranslationEnabled = !TSKConfig.TranslationEnabled; 80 | Plugin.Global.Log.LogInfo("Translation: " + (TSKConfig.TranslationEnabled ? "Enabled" : "Disabled")); 81 | Notification.Popup("Translation", TSKConfig.TranslationEnabled ? "Enabled" : "Disabled"); 82 | } 83 | 84 | if (Input.GetKeyDown(KeyCode.F12)) 85 | { 86 | var username = Environment.UserName; 87 | var timeFormat = DateTime.Now.ToString("yyyyMMdd_HHmmssff"); 88 | var location = string.Format("C:\\Users\\{0}\\Pictures\\tsk_{1}.png", username, timeFormat); 89 | ScreenCapture.CaptureScreenshot(location); 90 | 91 | Notification.SsPopup(location); 92 | } 93 | 94 | if (Input.GetKeyDown(KeyCode.F1)) 95 | { 96 | TSKConfig.Read(); 97 | Window.Init(); 98 | Plugin.Global.Log.LogInfo("[Config] reloaded."); 99 | } 100 | 101 | LastSkipExecuteTime += Time.deltaTime; 102 | if (LastSkipExecuteTime >= CtrlWaitTime && Input.GetKey(KeyCode.LeftControl) || LastSkipExecuteTime >= CtrlWaitTime && Input.GetKey(KeyCode.RightControl)) 103 | { 104 | LastSkipExecuteTime = 0.0f; 105 | AdvEngine advEngine = FindObjectOfType() as AdvEngine; 106 | if (advEngine != null) 107 | { 108 | advEngine.page.EndPage(); 109 | } 110 | } 111 | 112 | LastGSExecuteTime += Time.deltaTime; 113 | if (IsGameSpeedChanged && LastGSExecuteTime >= WaitTime && Time.timeScale != CurrentGameSpeed) 114 | { 115 | LastGSExecuteTime = 0.0f; 116 | Time.timeScale = CurrentGameSpeed; 117 | Plugin.Global.Log.LogInfo("Game speed changed. Reset to: " + CurrentGameSpeed + "x"); 118 | } 119 | 120 | LastFPSExecuteTime += Time.deltaTime; 121 | if (TSKConfig.FPS > 60 && LastFPSExecuteTime >= WaitTime && Application.targetFrameRate < TSKConfig.FPS) 122 | { 123 | LastFPSExecuteTime = 0.0f; 124 | Application.targetFrameRate = TSKConfig.FPS; 125 | Plugin.Global.Log.LogInfo("FPS changed. Reset to: " + TSKConfig.FPS); 126 | } 127 | } 128 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # TSKHook 2 | 3 | ## [中文](README_TC.md) 4 | 5 | Twinkle Star Knights mod for DMM Game Player version 6 | 7 | ## Feature 8 | 9 | 1. Game speed (more fun if Ready Go is faster, is not?^^) 10 | ![3x speed](./img/3x.gif) 11 | 2. In-game Screenshot 12 | 3. FPS setting 13 | 4. [Translation](Translation.md) (Traditional Chinese only) 14 | 5. Game window size setting 15 | 6. Picture Book zoom ratio 16 | 17 | ## Requirement 18 | 19 | 1. Windows 10 or newer 20 | 2. Twinkle Star Knights DMM Game Player version 21 | 22 | ## Installation 23 | 24 | Download and extract [Release](https://github.com/TSKModding/TSKHook/releases) zip to your Twinkle Star Knights install 25 | location `C:\Users\\Twinkle_StarKnightsX` 26 | 27 | ## Config 28 | 29 | You can edit config.json(`./BepInEx/plugins/config.json`) if you don't like default settings. 30 | 31 | | Name | Default Value | Description | 32 | |-----------|---------------|--------------------------------------------------------------| 33 | | speed | 0.5 | Increase/Decrease game speed each step (per click) | 34 | | fps | 60 | Override FPS setting, take effects when value bigger than 60 | 35 | | translate | true | Enable/Disable translation feature | 36 | | width | 1280 | Game window width | 37 | | height | 720 | Game window height | 38 | | zoom | 1.0 | Character standing zoom in/out ratio | 39 | 40 | ## Key binding 41 | 42 | | Key | Type | Description | 43 | |------|-------------|-------------------------------------------------------------------------------| 44 | | F1 | Reload | Reload TSKHook config, useful when you need to resize game window size | 45 | | F5 | Freeze | Freeze game, mean set game speed to 0x | 46 | | F6 | Reset | Reset game speed to 1x/normal | 47 | | F7 | Decrease | Decrease game speed (2-0.5 etc), depends on your `speed` config | 48 | | F8 | Increase | Increase game speed (1+0.5 etc), depends on your `speed` config | 49 | | F10 | Translation | Clear translation cache | 50 | | F11 | Translation | Enable/Disable translation feature | 51 | | F12 | Screenshot | Screenshot current frame and save to Pictures(`C:\Users\\Pictures`) | 52 | | Ctrl | Skip text | Skip text via Ctrl button, just like Galgame control system | 53 | 54 | ## Contributing 55 | 56 | You're free to contribute to TSKHook as long as the features are useful, such as battle stats log, 360 stamina alert or 57 | something else, except modifying battle data. 58 | 59 | ## Disclaimer 60 | 61 | Using TSKHook violates Twinkle Star Knights and DMM's terms of service. 62 | 63 | I will NOT be held responsible for any bans! 64 | -------------------------------------------------------------------------------- /README_TC.md: -------------------------------------------------------------------------------- 1 | # TSKHook 2 | 3 | ## [English](README.md) 4 | 5 | 星騎士mod (DMM Game Player版) 6 | 7 | ## 功能 8 | 9 | 1. 更改遊戲速度 (更快的Ready GO不好玩嗎?^^) 10 | ![3x speed](./img/3x.gif) 11 | 2. 內置遊戲截圖 12 | 3. FPS設定 13 | 4. [中文翻譯](Translation.md) 14 | 5. 遊戲視窗大小設定 15 | 6. 更改圖鑑放大縮小倍率 16 | 17 | ## 需求 18 | 19 | 1. Windows 10或以上 20 | 2. 星騎士 DMM Game Player版本 21 | 22 | ## 安裝方法 23 | 24 | 下載[Release](https://github.com/TSKModding/TSKHook/releases) 25 | 並解壓縮至您的星騎士安裝位置 `C:\Users\\Twinkle_StarKnightsX` 26 | 27 | ## 設定 28 | 29 | 如果您不喜歡預設設定,可以編輯config.json(`./BepInEx/plugins/config.json`). 30 | 31 | | 欄位 | 預設值 | 說明 | 32 | |-----------|------|----------------------------| 33 | | speed | 0.5 | 加快/減慢遊戲速度 (每按一下) | 34 | | fps | 60 | 更改FPS值, 只會在遊戲開啟60FPS的情況下生效 | 35 | | translate | true | 閣啟/關閉中文翻譯功能 | 36 | | width | 1280 | 遊戲視窗寬度 | 37 | | height | 720 | 遊戲視窗高度 | 38 | | zoom | 1.0 | 角色立繪放大縮小倍率 | 39 | 40 | ## 綁定鍵 41 | 42 | | 按鍵 | 類型 | 說明 | 43 | |------|----|------------------------------------------| 44 | | F1 | 重載 | 重載TSKHook設定,可用於即時更改遊戲視窗大小 | 45 | | F5 | 靜止 | 將遊戲暫時凍結 | 46 | | F6 | 重設 | 將遊戲重設至正常速度 | 47 | | F7 | 減少 | 減慢遊戲速度,視乎您的 `speed` 設定 | 48 | | F8 | 增加 | 加快遊戲速度,視乎您的 `speed` 設定 | 49 | | F10 | 翻譯 | 刪除翻譯快取 | 50 | | F11 | 翻譯 | 開啟/關閉中文翻譯功能 | 51 | | F12 | 截圖 | 截取當前的遊戲畫面至`C:\Users\\Pictures` | 52 | | Ctrl | 跳過 | 按Ctrl能跳過文字,就像Galgame的Ctrl skip功能 | 53 | 54 | ## 貢獻 55 | 56 | 您可以PR一些有用的功能,例如戰鬥紀錄、360滿體提示之類,除了修改戰鬥數值 57 | 58 | ## 免責聲明 59 | 60 | 使用修改程式進行遊戲,均屬違規行為,可能導致帳號被封鎖。 61 | 62 | 本人概不負責。 63 | -------------------------------------------------------------------------------- /SS_Notification.ps1: -------------------------------------------------------------------------------- 1 | if($Args.Count -gt 0) { 2 | $location = $args[0]; 3 | $xml = ' 4 | 5 | 6 | 7 | Click to view 8 | Screenshot saved at '+$location+' 9 | 10 | 11 | 12 | ' 13 | $XmlDocument = [Windows.Data.Xml.Dom.XmlDocument, Windows.Data.Xml.Dom.XmlDocument, ContentType = WindowsRuntime]::New() 14 | $XmlDocument.loadXml($xml) 15 | $AppId = 'Twinkle Star Knight' 16 | [Windows.UI.Notifications.ToastNotificationManager, Windows.UI.Notifications, ContentType = WindowsRuntime]::CreateToastNotifier($AppId).Show($XmlDocument) 17 | } -------------------------------------------------------------------------------- /TSKHook.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | net6.0 5 | TSKHook 6 | TSKHook 7 | 1.1.6 8 | true 9 | latest 10 | 11 | https://api.nuget.org/v3/index.json; 12 | https://nuget.bepinex.dev/v3/index.json 13 | 14 | TSKHook 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | C:\Users\husky\Twinkle_StarKnightsX 24 | 25 | 26 | 27 | 33 | 34 | 35 | false 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /TSKHook.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 17 4 | VisualStudioVersion = 17.7.34031.279 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TSKHook", "TSKHook.csproj", "{F7986F30-7970-4E36-917A-F89B417E88A6}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {F7986F30-7970-4E36-917A-F89B417E88A6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {F7986F30-7970-4E36-917A-F89B417E88A6}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {F7986F30-7970-4E36-917A-F89B417E88A6}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {F7986F30-7970-4E36-917A-F89B417E88A6}.Release|Any CPU.Build.0 = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | GlobalSection(ExtensibilityGlobals) = postSolution 23 | SolutionGuid = {B2336D15-EC63-41B6-999B-8A41696A80B0} 24 | EndGlobalSection 25 | EndGlobal 26 | -------------------------------------------------------------------------------- /Translation.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Net.Http; 3 | using System.Net.Http.Json; 4 | using System.Threading; 5 | using System.Threading.Tasks; 6 | 7 | namespace TSKHook; 8 | 9 | public class Translation 10 | { 11 | public static HttpClient client = new(); 12 | public static Dictionary nameDicts = []; 13 | public static Dictionary> chapterDicts = []; 14 | 15 | static Translation() 16 | { 17 | client.DefaultRequestHeaders.UserAgent.ParseAdd($"{MyPluginInfo.PLUGIN_NAME}/{MyPluginInfo.PLUGIN_VERSION}"); 18 | } 19 | 20 | public static async Task InitAsync(CancellationToken cancellationToken = default) 21 | { 22 | if (!TSKConfig.TranslationEnabled) return; 23 | 24 | var response = 25 | await client.GetAsync( 26 | "https://translation.lolida.best/download/tsk/tsk_name/zh_Hant/?format=json", cancellationToken); 27 | if (response.IsSuccessStatusCode) 28 | { 29 | var responseContent = response.Content; 30 | 31 | nameDicts = await responseContent.ReadFromJsonAsync>(options: null, cancellationToken); 32 | 33 | Plugin.Global.Log.LogInfo("[Translator] Character name translation loaded. Total: " + nameDicts.Count); 34 | } 35 | else 36 | { 37 | Plugin.Global.Log.LogWarning( 38 | "[Translator] Character name translation failed to load, character name wouldn't translate."); 39 | } 40 | 41 | var response2 = 42 | await client.GetAsync( 43 | "https://translation.lolida.best/download/tsk/tsk_subname/zh_Hant/?format=json", cancellationToken); 44 | if (response2.IsSuccessStatusCode) 45 | { 46 | var responseContent2 = response2.Content; 47 | 48 | var subNameDicts = await responseContent2.ReadFromJsonAsync>(options: null, cancellationToken); 49 | 50 | foreach (var pair in subNameDicts) 51 | { 52 | nameDicts.Add(pair.Key, pair.Value); 53 | } 54 | 55 | Plugin.Global.Log.LogInfo("[Translator] Rando name translation loaded. Total: " + subNameDicts.Count); 56 | } 57 | else 58 | { 59 | Plugin.Global.Log.LogWarning( 60 | "[Translator] Rando name translation failed to load, rando name wouldn't translate."); 61 | } 62 | } 63 | 64 | public static async Task FetchChapterTranslationAsync(string label, CancellationToken cancellationToken = default) 65 | { 66 | var response = await client.GetAsync($"https://translation.lolida.best/download/tsk/{label}/zh_Hant/?format=json", cancellationToken); 67 | if (response.IsSuccessStatusCode) 68 | { 69 | var responseContent = response.Content; 70 | 71 | chapterDicts[label] = await responseContent.ReadFromJsonAsync>(options: null, cancellationToken); 72 | Plugin.Global.Log.LogInfo("[Translator] Chapter translation loaded. Total: " + chapterDicts[label].Count); 73 | } 74 | else 75 | { 76 | chapterDicts[label] = []; 77 | Plugin.Global.Log.LogWarning( 78 | "[Translator] Chapter translation failed to load, chapter text wouldn't translate."); 79 | } 80 | } 81 | 82 | } -------------------------------------------------------------------------------- /Translation.md: -------------------------------------------------------------------------------- 1 | ## 禁止利用相關資源作為商業用途 2 | 3 | ## 禁止利用相關資源作為商業用途 4 | 5 | ## 禁止利用相關資源作為商業用途 6 | 7 | ## 很重要所以說三次 8 | 9 | ### 翻譯討論群: [Discord](https://discord.gg/XAgHS4zAAk) 10 | 11 | ### 翻譯狀況 12 | 13 | 首先,全文翻譯是皆由機器翻譯所得,所以不喜歡可以上一頁 :) 14 | 15 | 但同時,也是由愛好者共同維護的翻譯 16 | 17 | 目前使用的翻譯模型: [SakuraLLM](https://github.com/SakuraLLM/Sakura-13B-Galgame) 18 | 19 | **已知問題:** 20 | 21 | 1. ~~字體缺失~~ (已於[v1.1.3](https://github.com/TSKModding/TSKHook/releases/tag/v1.1.3)加入中文字體) 22 | 23 | ### 翻譯修正 24 | 25 | 部分文本已經在發佈前進行過一次人手修正 26 | 27 | 但因為目前全劇情字數高達[120萬字](https://translation.lolida.best/projects/tsk/#information) 28 | 29 | 在單人維護的情況下,實在無能為力。 30 | 31 | 如果您有日文能力的話,可以為這份翻譯貢獻一己之力 32 | 33 | 任何人都可以到我們的[協作翻譯平台](https://translation.lolida.best/projects/tsk/)查看及修正,感激不盡! 34 | 35 | ### 翻譯修改教學 36 | 37 | 問: 我找到某處翻譯有錯,要怎麼修正? 38 | 39 | 答: 假設,你在看菲歐娜第1話劇情發現其中一句有問題 40 | 41 | ![tsk_translation2.png](./img/tsk_translation1.png) 42 | 43 | 這時候可以切換至控制台,你會看到一個Ch10010011的文字 44 | 45 | 這個就是劇情ID 46 | 47 | ![tsk_translation3.png](./img/tsk_translation2.png) 48 | 49 | 你可以在翻譯平台搜尋這個ID,也可以複製下列網址並修改劇情ID為Ch10010011即可進入相關的翻譯文本位置 50 | 51 | `https://translation.lolida.best/browse/tsk/劇情ID/zh_Hant/` 52 | 53 | 點擊相關句子後會進修改界面 54 | 55 | ![tsk_translation4.png](./img/tsk_translation3.png) 56 | 57 | 修改後,按**Save and stay**即可 (PS: 進行修改需要註冊帳號) 58 | 59 | ![tsk_translation5.png](./img/tsk_translation4.png) 60 | 61 | 完成! 62 | -------------------------------------------------------------------------------- /Window.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | namespace TSKHook; 4 | 5 | public class Window 6 | { 7 | public static void Init() 8 | { 9 | Screen.SetResolution(TSKConfig.width, TSKConfig.height, false, TSKConfig.FPS); 10 | Plugin.Global.Log.LogInfo("Game window size: " + TSKConfig.width + "x" + TSKConfig.height); 11 | } 12 | } -------------------------------------------------------------------------------- /config.json: -------------------------------------------------------------------------------- 1 | { 2 | "speed": 0.5, 3 | "fps": 60, 4 | "translation": true, 5 | "width": 1280, 6 | "height": 720, 7 | "zoom": 1.0 8 | } -------------------------------------------------------------------------------- /img/3x.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TSKModding/TSKHook/0a21bc2bb09afde537d9b975b39ff6feab08f5c8/img/3x.gif -------------------------------------------------------------------------------- /img/tsk_translation1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TSKModding/TSKHook/0a21bc2bb09afde537d9b975b39ff6feab08f5c8/img/tsk_translation1.png -------------------------------------------------------------------------------- /img/tsk_translation2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TSKModding/TSKHook/0a21bc2bb09afde537d9b975b39ff6feab08f5c8/img/tsk_translation2.png -------------------------------------------------------------------------------- /img/tsk_translation3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TSKModding/TSKHook/0a21bc2bb09afde537d9b975b39ff6feab08f5c8/img/tsk_translation3.png -------------------------------------------------------------------------------- /img/tsk_translation4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TSKModding/TSKHook/0a21bc2bb09afde537d9b975b39ff6feab08f5c8/img/tsk_translation4.png --------------------------------------------------------------------------------