├── .gitignore ├── LICENCE.md ├── README.md ├── allocator.py ├── app.py ├── bnk.py ├── extract.py ├── filereader.py ├── gui.ui ├── mapper.py ├── maps ├── hk4e.map ├── hkrpg.map └── nap.map ├── requirements.txt ├── tools ├── ffmpeg │ ├── LICENSE.txt │ ├── README.txt │ └── ffmpeg.exe ├── hpatchz │ ├── hdiff LICENSE.txt │ └── hpatchz.exe └── vgmstream │ ├── COPYING │ ├── README.md │ ├── USAGE.md │ ├── avcodec-vgmstream-59.dll │ ├── avformat-vgmstream-59.dll │ ├── avutil-vgmstream-57.dll │ ├── in_vgmstream.dll │ ├── jansson.dll │ ├── libatrac9.dll │ ├── libcelt-0061.dll │ ├── libcelt-0110.dll │ ├── libg719_decode.dll │ ├── libmpg123-0.dll │ ├── libspeex-1.dll │ ├── libvorbis.dll │ ├── swresample-vgmstream-4.dll │ ├── vgmstream-cli.exe │ └── xmp-vgmstream.dll ├── updater.ui ├── version.json ├── wavescan.py └── wwise.py /.gitignore: -------------------------------------------------------------------------------- 1 | output/ 2 | input/ 3 | temp/ 4 | *.pck 5 | *.hdiff 6 | tools.zip 7 | __pycache__/ 8 | old/ -------------------------------------------------------------------------------- /LICENCE.md: -------------------------------------------------------------------------------- 1 | Attribution-NonCommercial-ShareAlike 4.0 International 2 | 3 | ======================================================================= 4 | 5 | Creative Commons Corporation ("Creative Commons") is not a law firm and 6 | does not provide legal services or legal advice. Distribution of 7 | Creative Commons public licenses does not create a lawyer-client or 8 | other relationship. Creative Commons makes its licenses and related 9 | information available on an "as-is" basis. Creative Commons gives no 10 | warranties regarding its licenses, any material licensed under their 11 | terms and conditions, or any related information. Creative Commons 12 | disclaims all liability for damages resulting from their use to the 13 | fullest extent possible. 14 | 15 | Using Creative Commons Public Licenses 16 | 17 | Creative Commons public licenses provide a standard set of terms and 18 | conditions that creators and other rights holders may use to share 19 | original works of authorship and other material subject to copyright 20 | and certain other rights specified in the public license below. The 21 | following considerations are for informational purposes only, are not 22 | exhaustive, and do not form part of our licenses. 23 | 24 | Considerations for licensors: Our public licenses are 25 | intended for use by those authorized to give the public 26 | permission to use material in ways otherwise restricted by 27 | copyright and certain other rights. Our licenses are 28 | irrevocable. Licensors should read and understand the terms 29 | and conditions of the license they choose before applying it. 30 | Licensors should also secure all rights necessary before 31 | applying our licenses so that the public can reuse the 32 | material as expected. Licensors should clearly mark any 33 | material not subject to the license. This includes other CC- 34 | licensed material, or material used under an exception or 35 | limitation to copyright. More considerations for licensors: 36 | wiki.creativecommons.org/Considerations_for_licensors 37 | 38 | Considerations for the public: By using one of our public 39 | licenses, a licensor grants the public permission to use the 40 | licensed material under specified terms and conditions. If 41 | the licensor's permission is not necessary for any reason--for 42 | example, because of any applicable exception or limitation to 43 | copyright--then that use is not regulated by the license. Our 44 | licenses grant only permissions under copyright and certain 45 | other rights that a licensor has authority to grant. Use of 46 | the licensed material may still be restricted for other 47 | reasons, including because others have copyright or other 48 | rights in the material. A licensor may make special requests, 49 | such as asking that all changes be marked or described. 50 | Although not required by our licenses, you are encouraged to 51 | respect those requests where reasonable. More considerations 52 | for the public: 53 | wiki.creativecommons.org/Considerations_for_licensees 54 | 55 | ======================================================================= 56 | 57 | Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International 58 | Public License 59 | 60 | By exercising the Licensed Rights (defined below), You accept and agree 61 | to be bound by the terms and conditions of this Creative Commons 62 | Attribution-NonCommercial-ShareAlike 4.0 International Public License 63 | ("Public License"). To the extent this Public License may be 64 | interpreted as a contract, You are granted the Licensed Rights in 65 | consideration of Your acceptance of these terms and conditions, and the 66 | Licensor grants You such rights in consideration of benefits the 67 | Licensor receives from making the Licensed Material available under 68 | these terms and conditions. 69 | 70 | 71 | Section 1 -- Definitions. 72 | 73 | a. Adapted Material means material subject to Copyright and Similar 74 | Rights that is derived from or based upon the Licensed Material 75 | and in which the Licensed Material is translated, altered, 76 | arranged, transformed, or otherwise modified in a manner requiring 77 | permission under the Copyright and Similar Rights held by the 78 | Licensor. For purposes of this Public License, where the Licensed 79 | Material is a musical work, performance, or sound recording, 80 | Adapted Material is always produced where the Licensed Material is 81 | synched in timed relation with a moving image. 82 | 83 | b. Adapter's License means the license You apply to Your Copyright 84 | and Similar Rights in Your contributions to Adapted Material in 85 | accordance with the terms and conditions of this Public License. 86 | 87 | c. BY-NC-SA Compatible License means a license listed at 88 | creativecommons.org/compatiblelicenses, approved by Creative 89 | Commons as essentially the equivalent of this Public License. 90 | 91 | d. Copyright and Similar Rights means copyright and/or similar rights 92 | closely related to copyright including, without limitation, 93 | performance, broadcast, sound recording, and Sui Generis Database 94 | Rights, without regard to how the rights are labeled or 95 | categorized. For purposes of this Public License, the rights 96 | specified in Section 2(b)(1)-(2) are not Copyright and Similar 97 | Rights. 98 | 99 | e. Effective Technological Measures means those measures that, in the 100 | absence of proper authority, may not be circumvented under laws 101 | fulfilling obligations under Article 11 of the WIPO Copyright 102 | Treaty adopted on December 20, 1996, and/or similar international 103 | agreements. 104 | 105 | f. Exceptions and Limitations means fair use, fair dealing, and/or 106 | any other exception or limitation to Copyright and Similar Rights 107 | that applies to Your use of the Licensed Material. 108 | 109 | g. License Elements means the license attributes listed in the name 110 | of a Creative Commons Public License. The License Elements of this 111 | Public License are Attribution, NonCommercial, and ShareAlike. 112 | 113 | h. Licensed Material means the artistic or literary work, database, 114 | or other material to which the Licensor applied this Public 115 | License. 116 | 117 | i. Licensed Rights means the rights granted to You subject to the 118 | terms and conditions of this Public License, which are limited to 119 | all Copyright and Similar Rights that apply to Your use of the 120 | Licensed Material and that the Licensor has authority to license. 121 | 122 | j. Licensor means the individual(s) or entity(ies) granting rights 123 | under this Public License. 124 | 125 | k. NonCommercial means not primarily intended for or directed towards 126 | commercial advantage or monetary compensation. For purposes of 127 | this Public License, the exchange of the Licensed Material for 128 | other material subject to Copyright and Similar Rights by digital 129 | file-sharing or similar means is NonCommercial provided there is 130 | no payment of monetary compensation in connection with the 131 | exchange. 132 | 133 | l. Share means to provide material to the public by any means or 134 | process that requires permission under the Licensed Rights, such 135 | as reproduction, public display, public performance, distribution, 136 | dissemination, communication, or importation, and to make material 137 | available to the public including in ways that members of the 138 | public may access the material from a place and at a time 139 | individually chosen by them. 140 | 141 | m. Sui Generis Database Rights means rights other than copyright 142 | resulting from Directive 96/9/EC of the European Parliament and of 143 | the Council of 11 March 1996 on the legal protection of databases, 144 | as amended and/or succeeded, as well as other essentially 145 | equivalent rights anywhere in the world. 146 | 147 | n. You means the individual or entity exercising the Licensed Rights 148 | under this Public License. Your has a corresponding meaning. 149 | 150 | 151 | Section 2 -- Scope. 152 | 153 | a. License grant. 154 | 155 | 1. Subject to the terms and conditions of this Public License, 156 | the Licensor hereby grants You a worldwide, royalty-free, 157 | non-sublicensable, non-exclusive, irrevocable license to 158 | exercise the Licensed Rights in the Licensed Material to: 159 | 160 | a. reproduce and Share the Licensed Material, in whole or 161 | in part, for NonCommercial purposes only; and 162 | 163 | b. produce, reproduce, and Share Adapted Material for 164 | NonCommercial purposes only. 165 | 166 | 2. Exceptions and Limitations. For the avoidance of doubt, where 167 | Exceptions and Limitations apply to Your use, this Public 168 | License does not apply, and You do not need to comply with 169 | its terms and conditions. 170 | 171 | 3. Term. The term of this Public License is specified in Section 172 | 6(a). 173 | 174 | 4. Media and formats; technical modifications allowed. The 175 | Licensor authorizes You to exercise the Licensed Rights in 176 | all media and formats whether now known or hereafter created, 177 | and to make technical modifications necessary to do so. The 178 | Licensor waives and/or agrees not to assert any right or 179 | authority to forbid You from making technical modifications 180 | necessary to exercise the Licensed Rights, including 181 | technical modifications necessary to circumvent Effective 182 | Technological Measures. For purposes of this Public License, 183 | simply making modifications authorized by this Section 2(a) 184 | (4) never produces Adapted Material. 185 | 186 | 5. Downstream recipients. 187 | 188 | a. Offer from the Licensor -- Licensed Material. Every 189 | recipient of the Licensed Material automatically 190 | receives an offer from the Licensor to exercise the 191 | Licensed Rights under the terms and conditions of this 192 | Public License. 193 | 194 | b. Additional offer from the Licensor -- Adapted Material. 195 | Every recipient of Adapted Material from You 196 | automatically receives an offer from the Licensor to 197 | exercise the Licensed Rights in the Adapted Material 198 | under the conditions of the Adapter's License You apply. 199 | 200 | c. No downstream restrictions. You may not offer or impose 201 | any additional or different terms or conditions on, or 202 | apply any Effective Technological Measures to, the 203 | Licensed Material if doing so restricts exercise of the 204 | Licensed Rights by any recipient of the Licensed 205 | Material. 206 | 207 | 6. No endorsement. Nothing in this Public License constitutes or 208 | may be construed as permission to assert or imply that You 209 | are, or that Your use of the Licensed Material is, connected 210 | with, or sponsored, endorsed, or granted official status by, 211 | the Licensor or others designated to receive attribution as 212 | provided in Section 3(a)(1)(A)(i). 213 | 214 | b. Other rights. 215 | 216 | 1. Moral rights, such as the right of integrity, are not 217 | licensed under this Public License, nor are publicity, 218 | privacy, and/or other similar personality rights; however, to 219 | the extent possible, the Licensor waives and/or agrees not to 220 | assert any such rights held by the Licensor to the limited 221 | extent necessary to allow You to exercise the Licensed 222 | Rights, but not otherwise. 223 | 224 | 2. Patent and trademark rights are not licensed under this 225 | Public License. 226 | 227 | 3. To the extent possible, the Licensor waives any right to 228 | collect royalties from You for the exercise of the Licensed 229 | Rights, whether directly or through a collecting society 230 | under any voluntary or waivable statutory or compulsory 231 | licensing scheme. In all other cases the Licensor expressly 232 | reserves any right to collect such royalties, including when 233 | the Licensed Material is used other than for NonCommercial 234 | purposes. 235 | 236 | 237 | Section 3 -- License Conditions. 238 | 239 | Your exercise of the Licensed Rights is expressly made subject to the 240 | following conditions. 241 | 242 | a. Attribution. 243 | 244 | 1. If You Share the Licensed Material (including in modified 245 | form), You must: 246 | 247 | a. retain the following if it is supplied by the Licensor 248 | with the Licensed Material: 249 | 250 | i. identification of the creator(s) of the Licensed 251 | Material and any others designated to receive 252 | attribution, in any reasonable manner requested by 253 | the Licensor (including by pseudonym if 254 | designated); 255 | 256 | ii. a copyright notice; 257 | 258 | iii. a notice that refers to this Public License; 259 | 260 | iv. a notice that refers to the disclaimer of 261 | warranties; 262 | 263 | v. a URI or hyperlink to the Licensed Material to the 264 | extent reasonably practicable; 265 | 266 | b. indicate if You modified the Licensed Material and 267 | retain an indication of any previous modifications; and 268 | 269 | c. indicate the Licensed Material is licensed under this 270 | Public License, and include the text of, or the URI or 271 | hyperlink to, this Public License. 272 | 273 | 2. You may satisfy the conditions in Section 3(a)(1) in any 274 | reasonable manner based on the medium, means, and context in 275 | which You Share the Licensed Material. For example, it may be 276 | reasonable to satisfy the conditions by providing a URI or 277 | hyperlink to a resource that includes the required 278 | information. 279 | 3. If requested by the Licensor, You must remove any of the 280 | information required by Section 3(a)(1)(A) to the extent 281 | reasonably practicable. 282 | 283 | b. ShareAlike. 284 | 285 | In addition to the conditions in Section 3(a), if You Share 286 | Adapted Material You produce, the following conditions also apply. 287 | 288 | 1. The Adapter's License You apply must be a Creative Commons 289 | license with the same License Elements, this version or 290 | later, or a BY-NC-SA Compatible License. 291 | 292 | 2. You must include the text of, or the URI or hyperlink to, the 293 | Adapter's License You apply. You may satisfy this condition 294 | in any reasonable manner based on the medium, means, and 295 | context in which You Share Adapted Material. 296 | 297 | 3. You may not offer or impose any additional or different terms 298 | or conditions on, or apply any Effective Technological 299 | Measures to, Adapted Material that restrict exercise of the 300 | rights granted under the Adapter's License You apply. 301 | 302 | 303 | Section 4 -- Sui Generis Database Rights. 304 | 305 | Where the Licensed Rights include Sui Generis Database Rights that 306 | apply to Your use of the Licensed Material: 307 | 308 | a. for the avoidance of doubt, Section 2(a)(1) grants You the right 309 | to extract, reuse, reproduce, and Share all or a substantial 310 | portion of the contents of the database for NonCommercial purposes 311 | only; 312 | 313 | b. if You include all or a substantial portion of the database 314 | contents in a database in which You have Sui Generis Database 315 | Rights, then the database in which You have Sui Generis Database 316 | Rights (but not its individual contents) is Adapted Material, 317 | including for purposes of Section 3(b); and 318 | 319 | c. You must comply with the conditions in Section 3(a) if You Share 320 | all or a substantial portion of the contents of the database. 321 | 322 | For the avoidance of doubt, this Section 4 supplements and does not 323 | replace Your obligations under this Public License where the Licensed 324 | Rights include other Copyright and Similar Rights. 325 | 326 | 327 | Section 5 -- Disclaimer of Warranties and Limitation of Liability. 328 | 329 | a. UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE 330 | EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS 331 | AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF 332 | ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS, 333 | IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION, 334 | WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR 335 | PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS, 336 | ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT 337 | KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT 338 | ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU. 339 | 340 | b. TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE 341 | TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION, 342 | NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT, 343 | INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES, 344 | COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR 345 | USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN 346 | ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR 347 | DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR 348 | IN PART, THIS LIMITATION MAY NOT APPLY TO YOU. 349 | 350 | c. The disclaimer of warranties and limitation of liability provided 351 | above shall be interpreted in a manner that, to the extent 352 | possible, most closely approximates an absolute disclaimer and 353 | waiver of all liability. 354 | 355 | 356 | Section 6 -- Term and Termination. 357 | 358 | a. This Public License applies for the term of the Copyright and 359 | Similar Rights licensed here. However, if You fail to comply with 360 | this Public License, then Your rights under this Public License 361 | terminate automatically. 362 | 363 | b. Where Your right to use the Licensed Material has terminated under 364 | Section 6(a), it reinstates: 365 | 366 | 1. automatically as of the date the violation is cured, provided 367 | it is cured within 30 days of Your discovery of the 368 | violation; or 369 | 370 | 2. upon express reinstatement by the Licensor. 371 | 372 | For the avoidance of doubt, this Section 6(b) does not affect any 373 | right the Licensor may have to seek remedies for Your violations 374 | of this Public License. 375 | 376 | c. For the avoidance of doubt, the Licensor may also offer the 377 | Licensed Material under separate terms or conditions or stop 378 | distributing the Licensed Material at any time; however, doing so 379 | will not terminate this Public License. 380 | 381 | d. Sections 1, 5, 6, 7, and 8 survive termination of this Public 382 | License. 383 | 384 | 385 | Section 7 -- Other Terms and Conditions. 386 | 387 | a. The Licensor shall not be bound by any additional or different 388 | terms or conditions communicated by You unless expressly agreed. 389 | 390 | b. Any arrangements, understandings, or agreements regarding the 391 | Licensed Material not stated herein are separate from and 392 | independent of the terms and conditions of this Public License. 393 | 394 | 395 | Section 8 -- Interpretation. 396 | 397 | a. For the avoidance of doubt, this Public License does not, and 398 | shall not be interpreted to, reduce, limit, restrict, or impose 399 | conditions on any use of the Licensed Material that could lawfully 400 | be made without permission under this Public License. 401 | 402 | b. To the extent possible, if any provision of this Public License is 403 | deemed unenforceable, it shall be automatically reformed to the 404 | minimum extent necessary to make it enforceable. If the provision 405 | cannot be reformed, it shall be severed from this Public License 406 | without affecting the enforceability of the remaining terms and 407 | conditions. 408 | 409 | c. No term or condition of this Public License will be waived and no 410 | failure to comply consented to unless expressly agreed to by the 411 | Licensor. 412 | 413 | d. Nothing in this Public License constitutes or may be interpreted 414 | as a limitation upon, or waiver of, any privileges and immunities 415 | that apply to the Licensor or You, including from the legal 416 | processes of any jurisdiction or authority. 417 | 418 | ======================================================================= 419 | 420 | Creative Commons is not a party to its public 421 | licenses. Notwithstanding, Creative Commons may elect to apply one of 422 | its public licenses to material it publishes and in those instances 423 | will be considered the “Licensor.” The text of the Creative Commons 424 | public licenses is dedicated to the public domain under the CC0 Public 425 | Domain Dedication. Except for the limited purpose of indicating that 426 | material is shared under a Creative Commons public license or as 427 | otherwise permitted by the Creative Commons policies published at 428 | creativecommons.org/policies, Creative Commons does not authorize the 429 | use of the trademark "Creative Commons" or any other trademark or logo 430 | of Creative Commons without its prior written consent including, 431 | without limitation, in connection with any unauthorized modifications 432 | to any of its public licenses or any other arrangements, 433 | understandings, or agreements concerning use of licensed material. For 434 | the avoidance of doubt, this paragraph does not form part of the 435 | public licenses. 436 | 437 | Creative Commons may be contacted at creativecommons.org. 438 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # AnimeWwise 2 | An easy to use tool to extract audio from some anime games, with the original filenames and paths. 3 | 4 | 5 | ![image](https://github.com/user-attachments/assets/ce2c8b19-82a2-42fc-a149-ed9ffbb7c54b) 6 | 7 | ### ⚠️ Only Genshin, Star Rail and Zenless supported ! 8 | 9 | ### :x: As of Genshin 5.5+, the audio data is no longer recoverable until a new workaround is found. The latest map have audio for 5.4 and music names for 5.3. Statement by Dimbreath regarding the situation : 10 | 11 | `As of 5.5.0 they implemented a new encryption and shuffle of field order of which the former is incredibly hard to dump so BinOutput will be currently unavailable [...] the field order shuffle has completely harmed deobfuscation so for the time being fields will stay obfuscated` 12 | 13 | 14 | # Usage 15 | 16 | 1. Get the repo by [downloading it](https://github.com/Escartem/WwiseExtract/archive/refs/heads/master.zip) or cloning it (`git clone https://github.com/Escartem/AnimeWwise`) 17 | > [!NOTE] 18 | > This project uses ffmpeg version *3.4.2* which is the latest under 50MB. But it is also slower, if you want to slightly improve extraction speed, consider updating the ffmpeg binary to a [newer version](https://github.com/BtbN/FFmpeg-Builds/releases) 19 | 2. Install dependencies -> `pip install -r requirements.txt` 20 | 3. Run the app with `python app.py` 21 | 4. Select your input folder containing your `.pck` files, it can be your game audio folder directly (if you decide to use this one, make sure the game is not running) 22 | ![image](https://github.com/user-attachments/assets/e877a57a-a115-4c2e-beac-27d927d1a37e) 23 | > [!TIP] 24 | > The audio folder can be found in the following locations 25 | > - `GenshinImpact_Data\StreamingAssets\AudioAsset\...` 26 | > - `StarRail_Data\Persistent\Audio\AudioPackage\Windows\... ` 27 | > - `ZenlessZoneZero_Data\StreamingAssets\Audio\Windows\Full\...` 28 | 5. Select your hdiff folder if needed 29 | > [!NOTE] 30 | > Diff files are `.hdiff` present in the update patches of the games. If you want to extract an hdiff content, you must have the pck file with the *same name before patch* in the input folder, pck's that do not have a corresponding hdiff file will be extracted normally, when they do have a corresponding hdiff file, *only the hdiff file content is extracted* and not the full pck 31 | 6. Select a mapping 32 | > [!WARNING] 33 | > By default, the files extracted from the game don't have names, the mappings are here to help restore the original filenames and paths so it's easier to search, there are only mappings for hoyo games and their coverage varies. 34 | > The mapping does NOT guarantee to recover all the names ! 35 | 7. After that, you can browse the files you loaded, if you messed up and wanna go back, you can select File > Reset to unload everything and go back to the starting screen. 36 | ![image](https://github.com/user-attachments/assets/73e2ece9-9fa7-4149-8674-762adb1ef50c) 37 | > [!WARNING] 38 | > The duration indicator is known to produce wrong results on music files or sfx, please take note when using it 39 | 8. In the `Extract` menu, you will be able to select what audio you want, choosing the output folder and audio format. You can extract everything or extract the files you selected 40 | > [!NOTE] 41 | > The program does not check for existing files in the output folder, it will overwrite them, make sure to check your folder before starting the extraction 42 | 9. Extract your files, and enjoy ! 43 | 44 | # Why was this made 45 | 46 | I know there is already dozens of tools that have the exact same purpose, being to extract audio from games or hoyo games, however, I made this anyway because of one functionality that others don't possess, which is file name recovery using mappings, because extracting is cool but browsing thousands of files with no names is just a pain, every single voiceline is a unique file. And I'm also planning a second unique functionality being a lookup tool, giving the user the ability to see every file inside the game, search the ones he needs and then extract them automatically, instead of having to load files and see what's in them. Stay tuned for that one :3 47 | 48 | # Performance 49 | 50 | The program has been tested and proved to be very efficient with extraction (not conversion), I've loaded the entire english package from genshin at 4.8 (around 17gb) and it took around 15 seconds to load and map every single of the ~100k files inside. And upon extracting them to .wem, it took around 10 seconds as well and during the entire process the program did not exceeded 500mb or so of ram usage. So I would say that it si good enough, however conversion is much slower, especially with ffmpeg (mp3 & ogg), some tweaks may be required to improve the speed. 51 | 52 | # Contribute 53 | 54 | Feel free to contribute to this project as much as you want, a share would be very appreciated aswell, I'll be glad to know if this helped anyone <3 55 | 56 | # Credits 57 | 58 | - [@Razmoth](https://github.com/Razmoth) - help on figuring out keys parsing to recover names for genshin and zzz 59 | - [@Dimbreath](https://github.com/Dimbreath) - AnimeGameData, TurnBasedGameData and ZZZData 60 | - [@Kei-Luna](https://github.com/Kei-Luna) - instructions on recovering names for genshin music 61 | - [@davispuh](https://github.com/davispuh) - star rail keys bruteforce tool 62 | - [@bnnm](https://github.com/bnnm) - wwise audio exploration tool 63 | - @hcs - wwise audio extraction script 64 | - [@vgmstream](https://github.com/vgmstream) and their contributors - wwise headers parsing 65 | -------------------------------------------------------------------------------- /allocator.py: -------------------------------------------------------------------------------- 1 | # memory manager to prevent redundant calls to files and save up disk usage 2 | import os 3 | import mmap 4 | 5 | class Allocator: 6 | def __init__(self): 7 | self.files = {} 8 | 9 | def load_file(self, path, name): 10 | with open(path, "rb") as f: 11 | mmap_object = mmap.mmap(f.fileno(), 0, access=mmap.ACCESS_READ) 12 | 13 | self.files[name] = mmap_object 14 | 15 | def unload_file(self, name): 16 | self.files[name].close() 17 | 18 | def read_at(self, file, offset, size): 19 | mmap_object = self.files[file] 20 | mmap_object.seek(offset) 21 | data = mmap_object.read(size) 22 | return data 23 | 24 | def free_mem(self): 25 | for file in list(self.files.keys()): 26 | self.files[file].close() 27 | self.files.clear() 28 | -------------------------------------------------------------------------------- /app.py: -------------------------------------------------------------------------------- 1 | import os 2 | import sys 3 | import json 4 | import math 5 | import time 6 | import extract 7 | import platform 8 | import urllib 9 | import webbrowser 10 | from PyQt5 import uic 11 | from requests import get 12 | from PyQt5.QtGui import QTextCursor 13 | from PyQt5.QtCore import QObject, pyqtSignal, pyqtSlot, QThread, QMetaType, Qt 14 | from PyQt5.QtWidgets import QDesktopWidget, QDialog, QMessageBox, QMainWindow, QApplication, QFileDialog, QHeaderView, QAbstractItemView, QTreeWidgetItem, QAction, QActionGroup 15 | 16 | QMetaType.type("QTextCursor") 17 | 18 | class TextEditStream(QObject): 19 | append_text = pyqtSignal(str) 20 | 21 | def __init__(self, text_edit): 22 | super().__init__() 23 | self.text_edit = text_edit 24 | self.append_text.connect(self._append_text) 25 | 26 | def write(self, text): 27 | self.append_text.emit(text) 28 | 29 | def flush(self): 30 | pass 31 | 32 | def _append_text(self, text): 33 | self.text_edit.moveCursor(QTextCursor.End) 34 | self.text_edit.insertPlainText(text) 35 | self.text_edit.moveCursor(QTextCursor.End) 36 | 37 | class BackgroundWorker(QObject): 38 | finished = pyqtSignal(dict) 39 | progress = pyqtSignal(list) 40 | 41 | def __init__(self, action, extract, data): 42 | super().__init__() 43 | self.action = action 44 | self.extract = extract 45 | 46 | if action == "load": 47 | self.base = data["base"] 48 | self.input = data["input"] 49 | self.map = data["map"] 50 | self.diff = data["diff"] 51 | if action == "extract": 52 | self.input = data["input"] 53 | self.files = data["files"] 54 | self.format = data["format"] 55 | self.output = data["output"] 56 | 57 | def run(self): 58 | if self.action == "load": 59 | print("Loading files and mapping if necessary...") 60 | fileStructure = self.extract.load_folder(self.map, self.input, self.diff, self.base, progress=self.progress.emit) 61 | if fileStructure is None: 62 | self.finished.emit({"action": "error", "content": {"msg": "Nothing found !", "state": 1}}) 63 | print("Nothing found !") 64 | return 65 | print("Building file structure...") 66 | self.finished.emit({"action": "load", "content": fileStructure}) 67 | if self.action == "extract": 68 | if len(self.files) == 0: 69 | self.finished.emit({"action": "error", "content": {"msg": "Nothing selected !", "state": 2}}) 70 | return 71 | print(f"Extracting {len(self.files)} files...") 72 | self.extract.extract_files(self.input, self.files, self.output, self.format, progress=self.progress.emit) 73 | self.finished.emit({"action": "extract"}) 74 | 75 | class UpdaterWorker(QObject): 76 | finished = pyqtSignal(bool) 77 | progress = pyqtSignal(list) 78 | 79 | def __init__(self): 80 | super().__init__() 81 | 82 | def run(self): 83 | try: 84 | # know current and latest maps 85 | self.progress.emit([0, "Fetching index..."]) 86 | ver = lambda s: int(s.replace(".", "")) 87 | 88 | index = open("version.json", "r") 89 | currentMaps = json.loads(index.read()) 90 | index.close() 91 | 92 | latestMaps = get("https://raw.githubusercontent.com/Escartem/AnimeWwise/master/version.json") 93 | 94 | if latestMaps.status_code == 200: 95 | latestMaps = json.loads(latestMaps.text) 96 | 97 | # do each game 98 | n_games = len(latestMaps["maps"]) 99 | game_size = 95 // n_games 100 | for i in range(n_games): 101 | current = currentMaps["maps"][i] 102 | latest = latestMaps["maps"][i] 103 | name = f"maps/{latest['name']}" 104 | 105 | if (ver(current["version"]) < ver(latest["version"])) or not os.path.isfile(name): 106 | self.progress.emit([5 + game_size * i, f'Updating {latest["game"]} to {latest["version"]}']) 107 | 108 | url = f"https://raw.githubusercontent.com/Escartem/AnimeWwise/master/{name}" 109 | urllib.request.urlretrieve(url, "maps/temp.map") 110 | 111 | if os.path.isfile(name): 112 | os.remove(name) 113 | os.rename("maps/temp.map", name) 114 | 115 | # update index 116 | currentMaps["maps"][i]["version"] = latest["version"] 117 | 118 | # save new index 119 | index_sum = sum([ver(e["version"]) for e in currentMaps["maps"]]) 120 | 121 | with open("version.json", "r+") as f: 122 | data = json.loads(f.read()) 123 | data["mapsVersion"] = index_sum 124 | data["maps"] = currentMaps["maps"] 125 | f.seek(0) 126 | f.write(json.dumps(data, indent=4)) 127 | f.truncate() 128 | f.close() 129 | 130 | # done 131 | self.progress.emit([100, "Update finished ! The program will start shortly..."]) 132 | except Exception as e: 133 | # failure :( 134 | self.progress.emit([100, f"Update failed ! The program will start shortly... | {e}"]) 135 | 136 | time.sleep(3) 137 | self.finished.emit(True) 138 | 139 | 140 | class Updater(QDialog): 141 | def __init__(self): 142 | super(Updater, self).__init__() 143 | uic.loadUi("updater.ui", self) 144 | self.setWindowFlag(Qt.WindowCloseButtonHint, False) 145 | self.center() 146 | self.update() 147 | 148 | def center(self): 149 | qr = self.frameGeometry() 150 | cp = QDesktopWidget().availableGeometry().center() 151 | qr.moveCenter(cp) 152 | self.move(qr.topLeft()) 153 | 154 | def update(self): 155 | self.backgroundThread = QThread() 156 | self.backgroundWorker = UpdaterWorker() 157 | self.backgroundWorker.moveToThread(self.backgroundThread) 158 | self.backgroundThread.started.connect(self.backgroundWorker.run) 159 | self.backgroundWorker.finished.connect(self.updateFinished) 160 | self.backgroundWorker.finished.connect(self.backgroundThread.quit) 161 | self.backgroundWorker.finished.connect(self.backgroundWorker.deleteLater) 162 | self.backgroundThread.finished.connect(self.backgroundThread.deleteLater) 163 | 164 | self.backgroundWorker.progress.connect(self.updateProgress) 165 | self.backgroundThread.start() 166 | 167 | @pyqtSlot(bool) 168 | def updateFinished(self): 169 | self.close() 170 | 171 | @pyqtSlot(list) 172 | def updateProgress(self, data): 173 | self.progressBar.setValue(data[0]) 174 | if len(data) == 2: 175 | self.status.setText(data[1]) 176 | 177 | class AnimeWwise(QMainWindow): 178 | def __init__(self): 179 | super(AnimeWwise, self).__init__() 180 | uic.loadUi("gui.ui", self) 181 | self.versions = self.getJson("version") 182 | self.version = self.versions["version"] 183 | self.maps = self.versions["maps"] 184 | self.setWindowTitle(f'AnimeWwise | v{".".join(list(str(self.version)))}') 185 | self.folders = { 186 | "input": "", 187 | "output": "", 188 | "diff": "" 189 | } 190 | self.format = "wav" 191 | self.fileStructure = {"folders": {}, "files": []} 192 | self.setupActions() 193 | sys.stdout = TextEditStream(self.console) 194 | self.extract = extract.WwiseExtract() 195 | self.checkUpdates() 196 | self.totalProgress.setMaximum(10000) 197 | self.fileProgress.setMaximum(10000) 198 | 199 | # utils 200 | self.selectFolder = lambda: QFileDialog.getExistingDirectory(self, "Select Folder") 201 | 202 | def checkUpdates(self): 203 | print("Checking for updates...") 204 | try: 205 | currentVersion = self.versions 206 | latestVersionReq = get("https://raw.githubusercontent.com/Escartem/AnimeWwise/master/version.json") 207 | 208 | if latestVersionReq.status_code == 200: 209 | latestVersion = json.loads(latestVersionReq.text) 210 | 211 | if currentVersion["version"] < latestVersion["version"]: 212 | print("Update found !") 213 | QMessageBox.information(None, "Info", "Newer version of the program is availble, please update it.", QMessageBox.Ok) 214 | elif currentVersion["mapsVersion"] < latestVersion["mapsVersion"]: 215 | print("Update found !") 216 | QMessageBox.information(None, "Info", "Newer version of the mappings are availble, the program will update them now.", QMessageBox.Ok) 217 | self.updaterWindow = Updater() 218 | self.updaterWindow.exec_() 219 | self.maps = latestVersion["maps"] 220 | else: 221 | print("No updates") 222 | except: 223 | print("Failed to check updates :(") 224 | 225 | def getJson(self, path): 226 | with open(f"{path}.json", "r") as f: 227 | data = json.loads(f.read()) 228 | f.close() 229 | 230 | return data 231 | 232 | def setFolder(self, elem=None, folder=None): 233 | path = self.selectFolder() 234 | self.folders[folder] = path 235 | if elem: 236 | elem.setText(path) 237 | 238 | def setupActions(self): 239 | self.changeAltInput.clicked.connect(lambda: self.setFolder(self.altInputPath, "diff")) 240 | 241 | self.pckLoadTypeCombo.addItems(["Folder", "File"]) 242 | self.pckLoadTypeCombo.currentIndexChanged.connect(self.loadTypeChange) 243 | self.loadType = "folder" 244 | 245 | self.assetMap.addItems(["No map", *[f'{e["game"]} - v{e["version"]}' for e in self.maps]]) 246 | 247 | self.setExtractionState(False) 248 | 249 | self.updateTreeWidget(self.fileStructure) 250 | 251 | self.loadFilesButton.clicked.connect(lambda: self.loadFiles()) 252 | 253 | self.actionReset.triggered.connect(lambda: self.resetApp()) 254 | self.actionExit.triggered.connect(lambda: self.close()) 255 | 256 | self.actionExpand_all.triggered.connect(lambda: self.treeWidget.expandAll()) 257 | self.actionCollapse_all.triggered.connect(lambda: self.treeWidget.collapseAll()) 258 | 259 | self.actionExtract_Selected.triggered.connect(lambda: self.extractItems(False)) 260 | self.actionExtract_All.triggered.connect(lambda: self.extractItems(True)) 261 | 262 | self.actionReport_a_bug.triggered.connect(lambda: self.openLink(0)) 263 | self.actionSource_code.triggered.connect(lambda: self.openLink(1)) 264 | self.actionDiscord.triggered.connect(lambda: self.openLink(2)) 265 | 266 | self.searchAsset.textChanged.connect(lambda: self.filterAsset()) 267 | 268 | # output format 269 | formats = ["wem (fastest)", "wav (fast)", "mp3 (slow)", "ogg (slow)"] 270 | action_group = QActionGroup(self) 271 | action_group.setExclusive(True) 272 | 273 | for index, item_name in enumerate(formats): 274 | action = QAction(item_name, self) 275 | action.setCheckable(True) 276 | if index == 1: 277 | action.setChecked(True) 278 | self.menuOutput_format.addAction(action) 279 | action_group.addAction(action) 280 | 281 | action_group.triggered.connect(self.updateFormat) 282 | 283 | # utils 284 | def loadTypeChange(self, event): 285 | if event == 0: 286 | self.pckSubFold.setEnabled(True) 287 | self.loadType = "folder" 288 | elif event == 1: 289 | self.pckSubFold.setEnabled(False) 290 | self.loadType = "file" 291 | 292 | def updateFormat(self, event): 293 | text = event.text() 294 | self.format = text.split(" ")[0] 295 | 296 | def openLink(self, id): 297 | urls = [ 298 | "https://github.com/Escartem/AnimeWwise/issues/new", 299 | "https://github.com/Escartem/AnimeWwise", 300 | "https://discord.gg/fzRdtVh" 301 | ] 302 | 303 | webbrowser.open(urls[id]) 304 | 305 | def setExtractionState(self, state): 306 | self.actionExtract_Selected.setEnabled(state) 307 | self.actionExtract_All.setEnabled(state) 308 | self.actionExpand_all.setEnabled(state) 309 | self.actionCollapse_all.setEnabled(state) 310 | 311 | def displaySize(self, size): 312 | if size < 1024: 313 | return f"{size} b" 314 | elif size > 1024 and size < 1048576: 315 | return f"{size//1024} KiB" 316 | elif size > 1048576 and size < 1073741824: 317 | return f"{size//1048576} MiB" 318 | elif size > 1073741824: 319 | return f"{size//1073741824} GiB" 320 | 321 | # workers 322 | @pyqtSlot(list) 323 | def progressBarSlot(self, progress): 324 | progress_value = math.ceil(progress[1]*100) 325 | if progress[0] == "total": 326 | self.totalProgress.setValue(progress_value) 327 | self.totalProgress.setFormat("%.02f %%" % (progress_value / 100)) 328 | elif progress[0] == "file": 329 | self.fileProgress.setValue(progress_value) 330 | self.fileProgress.setFormat("%.02f %%" % (progress_value / 100)) 331 | 332 | @pyqtSlot(dict) 333 | def handleFinished(self, data): 334 | if data["action"] == "load": 335 | self.fileStructure = data["content"] 336 | self.updateTreeWidget(self.fileStructure) 337 | self.loadFilesButton.setEnabled(True) 338 | self.setExtractionState(True) 339 | self.tabs.setCurrentIndex(1) 340 | print("Done !") 341 | if data["action"] == "error": 342 | QMessageBox.warning(None, "Warning", data["content"]["msg"], QMessageBox.Ok) 343 | state = data["content"]["state"] 344 | if state == 1: 345 | self.loadFilesButton.setEnabled(True) 346 | if state == 2: 347 | self.setExtractionState(True) 348 | if data["action"] == "extract": 349 | self.setExtractionState(True) 350 | print("Finished extracting everything !") 351 | 352 | if platform.system() == "Windows": 353 | os.startfile(self.folders["output"]) 354 | 355 | # page 1 - config 356 | def loadFiles(self): 357 | if self.loadType == "folder": 358 | self.setFolder(folder="input") 359 | files = [] 360 | if self.folders["input"]: 361 | if self.pckSubFold.isChecked(): 362 | files = [os.path.join(root, f) for root, dirs, files_in_dir in os.walk(self.folders["input"]) for f in files_in_dir if f.endswith(".pck")] 363 | else: 364 | files = [os.path.join(self.folders["input"], f) for f in os.listdir(self.folders["input"]) if f.endswith(".pck")] 365 | elif self.loadType == "file": 366 | path = QFileDialog.getOpenFileName(self, "Select .pck File", "", "PCK Files (*.pck)", options=QFileDialog.Options()) 367 | self.folders["input"] = os.path.dirname(path[0]) 368 | files = [path[0]] 369 | 370 | if len(files) == 0 or files[0] == "": 371 | QMessageBox.warning(None, "Warning", "Nothing to load !", QMessageBox.Ok) 372 | return 373 | 374 | self.currentInput = self.folders["input"] 375 | if not self.folders["input"]: 376 | self.currentInput = os.path.dirname(path[0]) 377 | 378 | _map = self.assetMap.currentIndex() 379 | if _map != 0: 380 | _map = self.maps[_map-1]["name"] 381 | else: 382 | _map = None 383 | 384 | self.resetTreeWidget() 385 | self.loadFilesButton.setEnabled(False) 386 | 387 | # why is all this required for threading damnit 388 | self.backgroundThread = QThread() 389 | self.backgroundWorker = BackgroundWorker("load", self.extract, {"base": self.folders["input"], "input": files, "map": _map, "diff": self.folders["diff"]}) 390 | self.backgroundWorker.moveToThread(self.backgroundThread) 391 | self.backgroundThread.started.connect(self.backgroundWorker.run) 392 | self.backgroundWorker.finished.connect(self.handleFinished) 393 | self.backgroundWorker.finished.connect(self.backgroundThread.quit) 394 | self.backgroundWorker.finished.connect(self.backgroundWorker.deleteLater) 395 | self.backgroundThread.finished.connect(self.backgroundThread.deleteLater) 396 | 397 | self.backgroundWorker.progress.connect(self.progressBarSlot) 398 | self.backgroundThread.start() 399 | 400 | # page 2 - browsing 401 | def filterAsset(self): 402 | search = self.searchAsset.text() 403 | if search == "": 404 | self.updateTreeWidget(self.fileStructure) 405 | return 406 | result = self.searchFiles(self.fileStructure, search) 407 | self.updateTreeWidget(result) 408 | 409 | def searchFiles(self, data, substring, current_path="", flatten=False): 410 | result = {"folders": {}, "files": []} 411 | 412 | result["files"] = [file for file in data.get("files", []) if substring in file[0]] 413 | 414 | for folder_name, folder_data in data.get("folders", {}).items(): 415 | subfolder_result = self.searchFiles(folder_data, substring) 416 | if subfolder_result["files"] or subfolder_result["folders"]: 417 | result["folders"][folder_name] = subfolder_result 418 | 419 | if flatten: 420 | while result["files"] == []: 421 | if len(result["folders"]) == 0: 422 | break 423 | result = list(result["folders"].values())[0] 424 | 425 | return result 426 | 427 | def resetTreeWidget(self): 428 | self.treeWidget.clear() 429 | self.fileStructure = {"folders": {}, "files": []} 430 | self.audioInfoLabel.setText("Click on an audio file to get more infos !") 431 | self.setExtractionState(False) 432 | 433 | def updateTreeWidget(self, structure): 434 | self.treeWidget.clear() 435 | self.treeWidget.setColumnCount(4) 436 | self.treeWidget.setHeaderLabels(["Name", "Duration", "Compressed Size", "Source", "Offset"]) 437 | 438 | self.addItems(None, structure) 439 | 440 | self.treeWidget.expandAll() 441 | 442 | self.treeWidget.header().setSectionResizeMode(0, QHeaderView.ResizeToContents) 443 | self.treeWidget.header().setSectionResizeMode(1, QHeaderView.Stretch) 444 | self.treeWidget.header().setSectionResizeMode(2, QHeaderView.Stretch) 445 | self.treeWidget.header().setSectionResizeMode(3, QHeaderView.Stretch) 446 | 447 | self.treeWidget.setHeaderHidden(False) 448 | 449 | self.treeWidget.setEditTriggers(QAbstractItemView.NoEditTriggers) 450 | self.treeWidget.setDragDropMode(QAbstractItemView.NoDragDrop) 451 | self.treeWidget.itemClicked.connect(self.updateAudioPreview) 452 | 453 | def computeFolderSize(self, folder): 454 | total_size = 0 455 | 456 | for file in folder.get("files", []): 457 | total_size += file[1]["size"] 458 | 459 | for subfolder_name, subfolder in folder.get("folders", {}).items(): 460 | subfolder_size = self.computeFolderSize(subfolder) 461 | total_size += subfolder_size 462 | 463 | return total_size 464 | 465 | def updateAudioPreview(self, item, column): 466 | file_data = self.searchFiles(self.fileStructure, item.text(0), flatten=True) 467 | 468 | if file_data == {"folders": {}, "files": []}: 469 | self.audioInfoLabel.setText("Click on an audio file to get more infos !") 470 | return 471 | 472 | meta = file_data["files"][0][1]["metadata"] 473 | 474 | # show meta 475 | text = f'Infos for {item.text(0)} => Channels : {meta["channels"]} | Sample rate : {meta["sampleRate"]} Hz | Bitrate : {meta["avgBitrate"]} kbps | Codec : {meta["codecDisplay"]} | Layout type : {meta["layoutType"]}' 476 | self.audioInfoLabel.setText(text) 477 | 478 | def addItems(self, parent, element): 479 | for folder_name in sorted(element.get("folders", {}).keys()): 480 | folder_content = element["folders"][folder_name] 481 | folder_item = QTreeWidgetItem([folder_name, "", self.displaySize(self.computeFolderSize(folder_content)), "", ""]) 482 | folder_item.setFlags(folder_item.flags() | Qt.ItemIsTristate | Qt.ItemIsUserCheckable) 483 | folder_item.setCheckState(0, Qt.Unchecked) 484 | if parent is None: 485 | self.treeWidget.addTopLevelItem(folder_item) 486 | else: 487 | parent.addChild(folder_item) 488 | self.addItems(folder_item, folder_content) 489 | 490 | for file in sorted(element.get("files", []), key=lambda x: x[0]): 491 | file_meta = file[1] 492 | file_item = QTreeWidgetItem([file[0], f'{round(file_meta["metadata"]["duration"], 1)} seconds', self.displaySize(file_meta["size"]), file_meta["source"], str(hex(file_meta["offset"]))]) 493 | file_item.setFlags(file_item.flags() | Qt.ItemIsUserCheckable) 494 | file_item.setCheckState(0, Qt.Unchecked) 495 | if parent is None: 496 | self.treeWidget.addTopLevelItem(file_item) 497 | else: 498 | parent.addChild(file_item) 499 | 500 | # page 3 - extraction 501 | def extractItems(self, _all): 502 | self.setFolder(folder="output") 503 | 504 | checked_items = [] 505 | 506 | def check_items(item, _all): 507 | if item.checkState(0) == Qt.Checked or _all: 508 | if item.text(1) != "": 509 | checked_items.append(self.getFileMeta(item)) 510 | for i in range(item.childCount()): 511 | check_items(item.child(i), _all) 512 | 513 | for i in range(self.treeWidget.topLevelItemCount()): 514 | check_items(self.treeWidget.topLevelItem(i), _all) 515 | 516 | self.setExtractionState(False) 517 | 518 | # yet another block of threading bs 519 | self.backgroundThread = QThread() 520 | self.backgroundWorker = BackgroundWorker("extract", self.extract, {"input": self.currentInput, "files": checked_items, "format": self.format, "output": self.folders["output"]}) 521 | self.backgroundWorker.moveToThread(self.backgroundThread) 522 | self.backgroundThread.started.connect(self.backgroundWorker.run) 523 | self.backgroundWorker.finished.connect(self.handleFinished) 524 | self.backgroundWorker.finished.connect(self.backgroundThread.quit) 525 | self.backgroundWorker.finished.connect(self.backgroundWorker.deleteLater) 526 | self.backgroundThread.finished.connect(self.backgroundThread.deleteLater) 527 | 528 | self.backgroundWorker.progress.connect(self.progressBarSlot) 529 | self.backgroundThread.start() 530 | 531 | def getFileMeta(self, item): 532 | path = [] 533 | current_item = item 534 | 535 | while current_item is not None: 536 | path.insert(0, current_item.text(0)) 537 | current_item = current_item.parent() 538 | 539 | meta = self.searchFiles(self.fileStructure, item.text(0), flatten=True)["files"][0] 540 | name = meta[0] 541 | meta = meta[1] # move inside 542 | 543 | return { 544 | "name": item.text(0), 545 | "path": path[:-1], 546 | "source": meta["source"], 547 | "offset": meta["offset"], 548 | "size": meta["size"] 549 | } 550 | 551 | # misc 552 | def resetApp(self): 553 | self.resetTreeWidget() 554 | self.extract.reset() 555 | self.currentInput = None 556 | self.setExtractionState(False) 557 | self.tabs.setCurrentIndex(0) 558 | self.totalProgress.setValue(0) 559 | self.fileProgress.setValue(0) 560 | print("Reset !") 561 | 562 | def _appendText(self, text): 563 | cursor = self.console.textCursor() 564 | cursor.movePosition(cursor.End) 565 | cursor.insertText(text) 566 | self.console.setTextCursor(cursor) 567 | self.console.ensureCursorVisible() 568 | 569 | if __name__ == "__main__": 570 | app = QApplication(sys.argv) 571 | window = AnimeWwise() 572 | window.show() 573 | sys.exit(app.exec_()) 574 | -------------------------------------------------------------------------------- /bnk.py: -------------------------------------------------------------------------------- 1 | # bnk reader because they exist in the game 2 | import io 3 | from filereader import FileReader 4 | 5 | def bnk2wem(data, name): 6 | # gets raw data from object 7 | reader = FileReader(io.BytesIO(data), "little", name=name) 8 | 9 | bkhd_signature = reader.ReadBytes(4) 10 | 11 | if bkhd_signature != b"\x42\x4B\x48\x44": 12 | print(f"[WARNING] invalid bkhd signature at {reader.GetName()}") 13 | return [] 14 | 15 | bkhd_size = reader.ReadUInt32() 16 | reader.ReadBytes(bkhd_size) 17 | 18 | if reader.GetBufferPos() == reader.GetStreamLength(): 19 | print(f"[WARNING] empty bnk file at {reader.GetName()}") 20 | return [] # empty bnk 21 | 22 | didx_signature = reader.ReadBytes(4) 23 | 24 | if didx_signature != b"\x44\x49\x44\x58": 25 | print(f"[WARNING] invalid didx signature at {reader.GetName()}") 26 | return [] # invalid index signature (hirc block instead ?) 27 | 28 | didx_size = reader.ReadUInt32() 29 | n_wems = didx_size // 12 30 | wems = [] 31 | 32 | for i in range(n_wems): 33 | wem_id = reader.ReadUInt32() 34 | wem_offset = reader.ReadUInt32() 35 | wem_size = reader.ReadUInt32() 36 | wems.append([wem_id, wem_offset, wem_size]) 37 | 38 | data_signature = reader.ReadBytes(4) 39 | 40 | if data_signature != b"\x44\x41\x54\x41": 41 | print(f"[WARNING] invalid data signature at {reader.GetName()}") 42 | return [] # invalid data signature (missing sector ?) 43 | 44 | data_size = reader.ReadUInt32() 45 | data_offset = reader.GetBufferPos() 46 | 47 | for wem in wems: 48 | wem[1] += data_offset 49 | 50 | return wems 51 | -------------------------------------------------------------------------------- /extract.py: -------------------------------------------------------------------------------- 1 | import os 2 | import io 3 | import json 4 | import wwise 5 | import tempfile 6 | import wavescan 7 | import platform 8 | import subprocess 9 | from mapper import Mapper 10 | from allocator import Allocator 11 | from filereader import FileReader 12 | 13 | cwd = os.getcwd() 14 | path = lambda *args: os.path.join(*args) 15 | 16 | def call(args): 17 | try: 18 | subprocess.call(args, stdout=subprocess.DEVNULL, stderr=subprocess.STDOUT) 19 | except Exception as e: 20 | print(f"[WARNING] failed to extract, {e}") 21 | 22 | class WwiseExtract: 23 | def __init__(self): 24 | self.allocator = Allocator() 25 | self.hdiff_dir = None 26 | self.maps = {} 27 | 28 | ### loading files ### 29 | 30 | def load_map(self, _map): 31 | map_name = _map.split(".")[0] 32 | 33 | if map_name not in self.maps or self.maps[map_name] is None: 34 | print("Map load required !") 35 | mapper = Mapper(path(cwd, f"maps/{_map}")) 36 | self.maps[map_name] = mapper 37 | else: 38 | print("Mapping already loaded, skipping") 39 | 40 | return self.maps[map_name] 41 | 42 | def load_folder(self, _map, files, diff_path, base_path, progress): 43 | self.progress = progress 44 | self.steps = 1 45 | 46 | self.mapper = None 47 | if _map is not None: 48 | self.mapper = self.load_map(_map) 49 | 50 | self.file_structure = {"folders": {}, "files": []} 51 | 52 | hdiff_files = [] 53 | if diff_path != "": 54 | hdiff_files = [f for f in os.listdir(diff_path) if f.endswith(".pck.hdiff")] 55 | 56 | # TODO: hdiff mode will only use .hdiff files and ignore .pck even in the update folder, i need to implement it, eventually 57 | 58 | # remove alone pck / hdiff 59 | base_files = [os.path.basename(f) for f in files] 60 | hdiff_files = [f for f in hdiff_files if os.path.basename(f.replace(".hdiff", "")) in base_files] 61 | base_hfiles = [os.path.basename(f) for f in hdiff_files] 62 | files = [f for f in files if f"{os.path.basename(f)}.hdiff" in base_hfiles] 63 | 64 | if len(files) == 0: 65 | return None 66 | 67 | pos = 0 68 | print(f"\nLoading {len(files)} files...") 69 | for file in files: 70 | pos += 1 71 | self.update_progress(pos, len(files), 1) 72 | 73 | hdiff = None 74 | if f"{os.path.basename(file)}.hdiff" in hdiff_files: 75 | hdiff = path(diff_path, hdiff_files[hdiff_files.index(f"{os.path.basename(file)}.hdiff")]) 76 | self.load_file(file, hdiff, base_path) 77 | 78 | return self.file_structure 79 | 80 | def load_file(self, _input, hdiff, base_path): 81 | with open(_input, "rb") as f: 82 | data = f.read() 83 | f.close() 84 | 85 | self.get_wems(data, os.path.basename(_input), hdiff, os.path.relpath(_input, start=base_path)) 86 | 87 | def get_wems(self, data, filename, hdiff, relpath): 88 | reader = FileReader(io.BytesIO(data), "little") 89 | files = wavescan.get_data(reader, filename) 90 | 91 | if hdiff is not None: 92 | with open(hdiff, "rb") as f: 93 | hdiff_data = f.read() 94 | f.close() 95 | 96 | hdiff_files, data = self.get_hdiff_files(data, hdiff_data, filename) 97 | files = self.compare_diff(files, hdiff_files) 98 | 99 | self.map_names(files, filename, relpath, hdiff is not None, data) 100 | 101 | def compare_diff(self, old, new): 102 | old_dict = {file[0]:file[2] for file in old} 103 | new_files = [file for file in new if file[0] not in list(old_dict.keys())] 104 | changed_files = [file for file in new if file[0] in list(old_dict.keys()) and file[2] != old_dict[file[0]]] 105 | 106 | return [new_files, changed_files] 107 | 108 | def get_hdiff_files(self, data, hdiff_data, source_name): 109 | working_dir = tempfile.TemporaryDirectory() 110 | if self.hdiff_dir is None: 111 | self.hdiff_dir = tempfile.TemporaryDirectory() 112 | 113 | with open(path(working_dir.name, "source.pck"), "wb") as f: 114 | f.write(data) 115 | f.close() 116 | 117 | with open(path(working_dir.name, "patch.pck.hdiff"), "wb") as f: 118 | f.write(hdiff_data) 119 | f.close() 120 | 121 | args = [ 122 | path(cwd, "tools/hpatchz/hpatchz.exe"), 123 | "-f", 124 | path(working_dir.name, "source.pck"), 125 | path(working_dir.name, "patch.pck.hdiff"), 126 | path(working_dir.name, "patch.pck") 127 | ] 128 | 129 | if platform.system() != "Windows": 130 | args.insert(0, "wine") 131 | 132 | call(args) 133 | 134 | if not os.path.exists(path(working_dir.name, "patch.pck")): 135 | print(f"[ERROR] failed to patch {source_name}, skipping") 136 | return [] 137 | 138 | with open(path(working_dir.name, "patch.pck"), "rb") as f: 139 | data = f.read() 140 | f.close() 141 | 142 | with open(path(self.hdiff_dir.name, source_name), "wb") as f: 143 | f.write(data) 144 | f.close() 145 | 146 | reader = FileReader(io.BytesIO(data), "little") 147 | files = wavescan.get_data(reader, source_name) 148 | 149 | working_dir.cleanup() 150 | 151 | return files, data 152 | 153 | def map_names(self, files, filename, relpath, hdiff=False, data=None, skip_source=True): 154 | # disable skip source if required 155 | mapper = self.mapper 156 | base = self.file_structure 157 | 158 | if hdiff: 159 | old_files = files 160 | filename = f"{filename} (hdiff)" 161 | files = [*files[0], *files[1]] 162 | 163 | # in case of manual use of mapping, use this 164 | # load json here 165 | 166 | # handle = open("banks.json", "r") 167 | # banks = json.loads(handle.read()) 168 | # handle.close() 169 | 170 | for file in files: 171 | if mapper is not None: 172 | key = mapper.get_key(file[0].split(".")[0]) 173 | 174 | # and override the method with a manual dict lookup 175 | 176 | # _id = file[0].split(".")[0] 177 | # if _id in list(banks["banks"].keys()): 178 | # key = [banks["banks"][_id], ""] 179 | else: 180 | key = None 181 | 182 | file_data = { 183 | "source": relpath, 184 | "size": file[2], 185 | "offset": file[1], 186 | "metadata": {} 187 | } 188 | 189 | wem_data = data[file_data["offset"]:file_data["offset"]+file_data["size"]] 190 | parsed_wem = wwise.parse_wwise(FileReader(io.BytesIO(wem_data), "little", name=f"{file[3]}:{file[0]}:{file[1]}")) 191 | 192 | if not parsed_wem: 193 | continue 194 | 195 | file_data["metadata"] = parsed_wem 196 | 197 | if key is not None: 198 | if hdiff: 199 | if file in old_files[0]: 200 | key[0] = f"new_files\\{key[0]}" 201 | else: 202 | key[0] = f"changed_files\\{key[0]}" 203 | 204 | parts = f"{filename}\\{key[0]}.wem".split("\\") 205 | if skip_source: 206 | parts = parts[1:] 207 | 208 | self.add_to_structure(parts, file_data) 209 | else: 210 | temp = base["folders"] 211 | 212 | if not skip_source: 213 | if filename not in temp: 214 | temp[filename] = {"folders": {}, "files": []} 215 | temp = temp[filename]["folders"] 216 | 217 | if hdiff: 218 | if file in old_files[0]: 219 | if "new_files" not in temp: 220 | temp["new_files"] = {"folders": {}, "files": []} 221 | temp = temp["new_files"]["folders"] 222 | 223 | if file in old_files[1]: 224 | if "changed_files" not in temp: 225 | temp["changed_files"] = {"folders": {}, "files": []} 226 | temp = temp["changed_files"]["folders"] 227 | 228 | if "unmapped" not in temp: 229 | temp["unmapped"] = {"folders": {}, "files": []} 230 | temp["unmapped"]["files"].append([file[0], file_data]) 231 | 232 | self.file_structure = base 233 | 234 | def add_to_structure(self, parts, meta): 235 | current_level = self.file_structure 236 | for part in parts[:-1]: 237 | if "folders" not in current_level: 238 | current_level["folders"] = {} 239 | if part not in current_level["folders"]: 240 | current_level["folders"][part] = {"folders": {}, "files": []} 241 | current_level = current_level["folders"][part] 242 | if "files" not in current_level: 243 | current_level["files"] = [] 244 | current_level["files"].append([parts[-1], meta]) 245 | 246 | ### extracting files ### 247 | 248 | def extract_files(self, _input, files, output, _format, progress): 249 | temp_dir = tempfile.TemporaryDirectory() 250 | self.progress = progress 251 | self.steps = { 252 | "wem": 1, 253 | "wav": 2, 254 | "mp3": 3, 255 | "ogg": 3 256 | }[_format] 257 | 258 | # wem 259 | if _format == "wem": 260 | output_folder = output 261 | else: 262 | output_folder = path(temp_dir.name, "wem") 263 | 264 | self.extract_wem(_input, files, output_folder) 265 | 266 | if _format == "wem": 267 | temp_dir.cleanup() 268 | return 269 | 270 | # wav 271 | new_input = output_folder 272 | files = [path("/".join(file["path"]), file["name"]) for file in files] 273 | 274 | if _format == "wav": 275 | output_folder = output 276 | else: 277 | output_folder = path(temp_dir.name, "wav") 278 | 279 | self.extract_wav(new_input, files, output_folder) 280 | 281 | if _format == "wav": 282 | temp_dir.cleanup() 283 | return 284 | 285 | # mp3 & ogg 286 | files = [path(os.path.dirname(file), f'{os.path.basename(file).split(".")[0]}.wav') for file in files] 287 | new_input = output_folder 288 | output_folder = output 289 | 290 | self.extract_ffmpeg(new_input, files, output_folder, _format) 291 | 292 | temp_dir.cleanup() 293 | return 294 | 295 | def extract_wem(self, _input, files, output): 296 | print(": Extracting audio as wem") 297 | all_sources = list(set([e["source"] for e in files])) 298 | 299 | pos = 0 300 | for source in all_sources: 301 | # load source 302 | load_path = path(_input, source) 303 | if self.hdiff_dir is not None: 304 | source = source.split(" (hdiff)")[0] 305 | hdiff_path = path(self.hdiff_dir.name, source) 306 | 307 | if os.path.isfile(hdiff_path): 308 | load_path = hdiff_path 309 | 310 | self.allocator.load_file(load_path, source) 311 | 312 | # extract every file from this one 313 | for file in [file for file in files if file["source"] == source]: 314 | pos += 1 315 | self.update_progress(pos, len(files), 1) 316 | 317 | file["source"] = file["source"].split(" (hdiff)")[0] 318 | data = self.allocator.read_at(file["source"], file["offset"], file["size"]) 319 | 320 | filepath = path("/".join(file["path"]), file["name"]) 321 | fullpath = path(output, filepath) 322 | os.makedirs(os.path.dirname(fullpath), exist_ok=True) 323 | 324 | with open(fullpath, "wb") as f: 325 | f.write(data) 326 | f.close() 327 | 328 | # unload source 329 | self.allocator.unload_file(source) 330 | 331 | # security 332 | self.allocator.free_mem() 333 | 334 | def extract_wav(self, _input, files, output): 335 | print(": Converting audio to wav") 336 | pos = 0 337 | for file in files: 338 | pos += 1 339 | self.update_progress(pos, len(files), 2) 340 | 341 | filename = f'{os.path.basename(file).split(".")[0]}.wav' 342 | filepath = path(output, os.path.dirname(file), filename) 343 | os.makedirs(os.path.dirname(filepath), exist_ok=True) 344 | 345 | args = [ 346 | path(cwd, "tools/vgmstream/vgmstream-cli.exe"), 347 | "-o", 348 | filepath, 349 | path(_input, file) 350 | ] 351 | 352 | if platform.system() != "Windows": 353 | args.insert(0, "wine") 354 | 355 | call(args) 356 | 357 | def extract_ffmpeg(self, _input, files, output, _format): 358 | print(f": Converting audio to {_format}") 359 | 360 | encoders = { 361 | "mp3": "libmp3lame", 362 | "ogg": "libvorbis" 363 | } 364 | 365 | encoder = encoders[_format] 366 | 367 | pos = 0 368 | for file in files: 369 | pos += 1 370 | self.update_progress(pos, len(files), 3) 371 | 372 | filename = f'{os.path.basename(file).split(".")[0]}.{_format}' 373 | filepath = path(output, os.path.dirname(file), filename) 374 | os.makedirs(os.path.dirname(filepath), exist_ok=True) 375 | 376 | args = [ 377 | path(cwd, "tools/ffmpeg/ffmpeg.exe"), 378 | "-i", 379 | path(_input, file), 380 | "-acodec", 381 | encoder, 382 | "-b:a", 383 | "192k", # 192|4 384 | filepath 385 | ] 386 | 387 | if platform.system() != "Windows": 388 | args.insert(0, "wine") 389 | 390 | call(args) 391 | 392 | ### other ### 393 | 394 | def update_progress(self, current, total, step): 395 | base = 100 / self.steps 396 | self.progress(["total", current * base / total + base * (step - 1)]) 397 | self.progress(["file", current * 100 / total]) 398 | 399 | def reset(self): 400 | self.mapper = None 401 | for e in self.maps.values(): 402 | e.reset() 403 | self.maps.clear() 404 | self.allocator.free_mem() 405 | if self.hdiff_dir is not None: 406 | self.hdiff_dir.cleanup() 407 | self.hdiff_dir = None 408 | -------------------------------------------------------------------------------- /filereader.py: -------------------------------------------------------------------------------- 1 | import io 2 | import os 3 | import struct 4 | 5 | 6 | class FileReader: 7 | """ 8 | File reader for files, not much too say 9 | """ 10 | 11 | def __init__(self, file, endianness:str, name:str=None): 12 | self.stream = file 13 | self.endianness = endianness 14 | self.name = name 15 | 16 | def _read(self, mode:str, bufferLength:int, endianness:str=None, pos:int=None) -> bytes: 17 | # endianness override 18 | if endianness is None: 19 | endianness = self.endianness 20 | 21 | endianness = "<" if endianness == "little" else ">" 22 | 23 | if pos: 24 | pos_backup = self.GetBufferPos() 25 | self.SetBufferPos(pos) 26 | 27 | data = struct.unpack(f"{endianness}{mode}", bytearray(self.stream.read(bufferLength)))[0] 28 | 29 | if pos: 30 | self.SetBufferPos(pos_backup) 31 | 32 | return data 33 | 34 | # read methods 35 | def ReadInt8(self, endianness:str=None, pos:int=None) -> int: 36 | return self._read("b", 1, endianness, pos) 37 | 38 | def ReadUInt8(self, endianness:str=None, pos:int=None) -> int: 39 | return self._read("B", 1, endianness, pos) 40 | 41 | def ReadInt16(self, endianness:str=None, pos:int=None) -> int: 42 | return self._read("h", 2, endianness, pos) 43 | 44 | def ReadUInt16(self, endianness:str=None, pos:int=None) -> int: 45 | return self._read("H", 2, endianness, pos) 46 | 47 | def ReadInt32(self, endianness:str=None, pos:int=None) -> int: 48 | return self._read("i", 4, endianness, pos) 49 | 50 | def ReadUInt32(self, endianness:str=None, pos:int=None) -> int: 51 | return self._read("I", 4, endianness, pos) 52 | 53 | def ReadLong(self, endianness:str=None, pos:int=None) -> int: 54 | return self._read("l", 4, endianness, pos) 55 | 56 | def ReadULong(self, endianness:str=None, pos:int=None) -> int: 57 | return self._read("L", 4, endianness, pos) 58 | 59 | def ReadLongLong(self, endianness:str=None, pos:int=None) -> int: 60 | return self._read("q", 8, endianness, pos) 61 | 62 | def ReadULongLong(self, endianness:str=None, pos:int=None) -> int: 63 | return self._read("Q", 8, endianness, pos) 64 | 65 | def ReadBytes(self, length:int, endianness:str=None, pos:int=None) -> bytes: 66 | return self._read(f"{str(length)}s", int(length), endianness, pos) 67 | 68 | # buffer utils 69 | def GetBufferPos(self) -> int: 70 | return self.stream.tell() 71 | 72 | def SetBufferPos(self, pos:int): 73 | self.stream.seek(pos) 74 | 75 | def GetStreamLength(self) -> int: 76 | if isinstance(self.stream, io.BytesIO): 77 | return self.stream.getbuffer().nbytes 78 | elif isinstance(self.stream, io.BufferedReader): 79 | pos = self.GetBufferPos() 80 | self.stream.seek(0, os.SEEK_END) 81 | length = self.GetBufferPos() 82 | self.SetBufferPos(pos) 83 | return length 84 | else: 85 | raise Exception("unknown buffer type") 86 | 87 | def GetRemainingLength(self) -> int: 88 | return self.GetStreamLength() - self.GetBufferPos() 89 | 90 | def GetName(self) -> str: 91 | if self.name: 92 | return self.name 93 | return "" 94 | -------------------------------------------------------------------------------- /gui.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | AnimeWwise 4 | 5 | 6 | Qt::NonModal 7 | 8 | 9 | true 10 | 11 | 12 | 13 | 0 14 | 0 15 | 1100 16 | 900 17 | 18 | 19 | 20 | 21 | 1100 22 | 900 23 | 24 | 25 | 26 | 27 | 1100 28 | 900 29 | 30 | 31 | 32 | AnimeWwise 33 | 34 | 35 | 36 | 37 | 38 | 4 39 | -1 40 | 1091 41 | 641 42 | 43 | 44 | 45 | 0 46 | 47 | 48 | true 49 | 50 | 51 | false 52 | 53 | 54 | false 55 | 56 | 57 | false 58 | 59 | 60 | false 61 | 62 | 63 | 64 | true 65 | 66 | 67 | Config 68 | 69 | 70 | 71 | 72 | 9 73 | 9 74 | 1071 75 | 601 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 2 90 | 91 | 92 | 93 | 94 | 95 | 32 96 | 75 97 | true 98 | 99 | 100 | 101 | Welcome to AnimeWwise ! 102 | 103 | 104 | Qt::AlignCenter 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | Qt::Horizontal 125 | 126 | 127 | 128 | 129 | 130 | 131 | true 132 | 133 | 134 | 0 135 | 136 | 137 | 138 | Extract audio package (.pck) 139 | 140 | 141 | 142 | 143 | 10 144 | 10 145 | 1041 146 | 111 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | What to load : 157 | 158 | 159 | 160 | 161 | 162 | 163 | true 164 | 165 | 166 | Include subfolders ? 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | Extract update package (.hdiff) 183 | 184 | 185 | 186 | 187 | 10 188 | 10 189 | 1041 190 | 131 191 | 192 | 193 | 194 | 195 | 196 | 197 | Diff folder 198 | 199 | 200 | 201 | 202 | 203 | 204 | true 205 | 206 | 207 | Select 208 | 209 | 210 | 211 | 212 | 213 | 214 | true 215 | 216 | 217 | true 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 75 226 | true 227 | 228 | 229 | 230 | Select here the folder containing the .hdiff files present in the game update package. And for the input folder asked upon loading, select the game audio folder before the update ! 231 | Subfolders are disabled in this mode, make sure to be in the correct place. For any help check the README.md or ask on discord. 232 | 233 | 234 | Qt::AlignCenter 235 | 236 | 237 | true 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | Qt::Horizontal 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | Asset map 266 | 267 | 268 | 269 | 270 | 271 | 272 | 273 | 274 | 275 | 276 | 277 | 278 | 279 | 280 | 281 | 282 | 283 | 284 | Qt::Horizontal 285 | 286 | 287 | 288 | 289 | 290 | 291 | 292 | 293 | 294 | 295 | 296 | 297 | 298 | 299 | 300 | Load file(s) 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308 | 309 | 310 | 311 | 312 | 313 | 314 | 315 | 316 | 317 | 318 | Browse 319 | 320 | 321 | 322 | 323 | 0 324 | 20 325 | 1081 326 | 551 327 | 328 | 329 | 330 | 1 331 | 332 | 333 | 334 | 1 335 | 336 | 337 | 338 | 339 | 340 | 341 | 2 342 | 1 343 | 1081 344 | 21 345 | 346 | 347 | 348 | Search something... 349 | 350 | 351 | 352 | 353 | 354 | 10 355 | 580 356 | 1061 357 | 31 358 | 359 | 360 | 361 | 362 | 363 | 364 | Click on an audio file to get more infos ! 365 | 366 | 367 | 368 | 369 | 370 | 371 | 372 | 373 | 374 | 375 | 10 376 | 720 377 | 1081 378 | 151 379 | 380 | 381 | 382 | 383 | 16777215 384 | 220 385 | 386 | 387 | 388 | false 389 | 390 | 391 | 0 392 | 393 | 394 | true 395 | 396 | 397 | 398 | 399 | 400 | 16 401 | 650 402 | 1071 403 | 61 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | Total progress 413 | 414 | 415 | 416 | 417 | 418 | 419 | 0 420 | 421 | 422 | 423 | 424 | 425 | 426 | 427 | 428 | 429 | 430 | Per file progress 431 | 432 | 433 | 434 | 435 | 436 | 437 | 0 438 | 439 | 440 | 441 | 442 | 443 | 444 | 445 | 446 | 447 | 448 | 449 | 0 450 | 0 451 | 1100 452 | 26 453 | 454 | 455 | 456 | 457 | File 458 | 459 | 460 | 461 | 462 | 463 | 464 | 465 | Extract 466 | 467 | 468 | 469 | Output format 470 | 471 | 472 | 473 | 474 | 475 | 476 | 477 | 478 | 479 | 480 | Other 481 | 482 | 483 | 484 | 485 | 486 | 487 | 488 | View 489 | 490 | 491 | 492 | 493 | 494 | 495 | 496 | 497 | 498 | 499 | 500 | not working here yet 501 | 502 | 503 | 504 | 505 | All files 506 | 507 | 508 | 509 | 510 | Selected files 511 | 512 | 513 | 514 | 515 | Reset 516 | 517 | 518 | 519 | 520 | Exit 521 | 522 | 523 | 524 | 525 | false 526 | 527 | 528 | Extract All 529 | 530 | 531 | 532 | 533 | false 534 | 535 | 536 | Extract Selected 537 | 538 | 539 | 540 | 541 | Report a bug 542 | 543 | 544 | 545 | 546 | Source code 547 | 548 | 549 | 550 | 551 | Discord 552 | 553 | 554 | 555 | 556 | false 557 | 558 | 559 | format 560 | 561 | 562 | false 563 | 564 | 565 | 566 | 567 | false 568 | 569 | 570 | Expand all 571 | 572 | 573 | 574 | 575 | false 576 | 577 | 578 | Collapse all 579 | 580 | 581 | 582 | 583 | tabs 584 | 585 | 586 | 587 | 588 | -------------------------------------------------------------------------------- /mapper.py: -------------------------------------------------------------------------------- 1 | # reader for the .map format i've made to improve reading speed and mapping size 2 | from filereader import FileReader 3 | 4 | 5 | class Mapper: 6 | def __init__(self, mapping_file): 7 | file = open(mapping_file, "rb") 8 | reader = FileReader(file, "little") # encoded as little 9 | 10 | # check file 11 | if reader.ReadBytes(4) != b"ESFM": 12 | file.close() 13 | raise Exception("mapping was invalid") 14 | 15 | reader.ReadBytes(2) 16 | 17 | map_version = reader.ReadBytes(2) 18 | if map_version != b"\x32\x31": 19 | print(f"Warning: you are using an unknown / unsupported version of the mapping that is no longer supported, please use a newer one or download an older version of this tool.") 20 | raise Exception("incompatible mapping") 21 | 22 | self.reader = reader 23 | self.process_map() 24 | 25 | def process_map(self): 26 | reader = self.reader 27 | 28 | # utils 29 | val = lambda length: vl2(reader.ReadBytes(length)) 30 | vl2 = lambda data: int.from_bytes(data, "little") 31 | raw = lambda length: rw2(reader.ReadBytes(length)) 32 | rw2 = lambda data: data.rstrip(b"\x00").decode("utf-8") 33 | 34 | # get map meta 35 | reader.ReadBytes(2) 36 | 37 | games = { 38 | "hk4e": "Genshin", 39 | "hkrpg": "Star Rail", 40 | "nap": "Zenless Zone Zero" 41 | # more later 42 | } 43 | 44 | coverages = [ 45 | "english voicelines", 46 | "chinese voicelines", 47 | "japanese voicelines", 48 | "korean voicelines", 49 | "music", 50 | "sfx" 51 | ] 52 | 53 | # read sectors 54 | sectors_signature = reader.ReadBytes(9) 55 | if sectors_signature != b"\xFF\x53\x45\x43\x54\x4F\x52\x53\xFF": # ff sectors ff 56 | raise Exception("invalid mapping sectors signature") 57 | 58 | n_sectors = val(1) 59 | sectors = {} 60 | 61 | for i in range(n_sectors): 62 | name_length = val(1) 63 | name = raw(name_length) 64 | offset = val(4) 65 | size = val(4) 66 | 67 | sectors[name] = { 68 | "offset": offset, 69 | "size": size 70 | } 71 | 72 | # read config 73 | reader.SetBufferPos(sectors["HEADER"]["offset"]) 74 | 75 | header_sig = reader.ReadBytes(8) # hardcoded but lazy, this value is for this sector only 76 | 77 | n_configs = val(1) 78 | config = {} 79 | for i in range(n_configs): 80 | name = raw(4) 81 | value = raw(5) 82 | config[name] = value 83 | 84 | infos = { 85 | "game": games[config["game"]], 86 | "version": config["verS"], 87 | # "coverage": config["covR"], 88 | "useBanksSector": config["bnkS"], 89 | # "bankSectorCoverage": config["bCov"] 90 | } 91 | 92 | print(f"> Loading mapping for {infos['game']} v{infos['version']}, this may take a few seconds...") 93 | 94 | # read prefixes 95 | prefixes = {} 96 | n_prefixes = reader.ReadUInt8() 97 | l_prefixes = reader.ReadUInt8() 98 | 99 | for i in range(n_prefixes): 100 | prefix = raw(l_prefixes) 101 | marker = reader.ReadBytes(1) 102 | prefixes[marker] = prefix 103 | 104 | # sector jump here 105 | reader.SetBufferPos(sectors["ITEMS"]["offset"]) 106 | 107 | items_sec_sig = reader.ReadBytes(7) # hardcoded too 108 | 109 | # read languages 110 | langs_offsets = {} 111 | n_langs = reader.ReadUInt8() 112 | l_langs = reader.ReadUInt8() 113 | 114 | for i in range(n_langs): 115 | offset = reader.GetBufferPos() 116 | langs_offsets[offset] = raw(l_langs) 117 | 118 | self.langs_offsets = langs_offsets 119 | 120 | # read folders 121 | folder_offsets = {} 122 | n_folders = reader.ReadUInt16() 123 | 124 | for i in range(n_folders): 125 | offset = reader.GetBufferPos() 126 | length = reader.ReadUInt8() 127 | prefix = reader.ReadBytes(1) 128 | folder = raw(length) 129 | folder = f"{prefixes[prefix]}{folder}" 130 | folder_offsets[offset] = folder 131 | 132 | # read files 133 | files_offsets = {} 134 | n_files = val(3) 135 | 136 | for i in range(n_files): 137 | offset = reader.GetBufferPos() 138 | path_length = reader.ReadUInt8() 139 | path = [] 140 | for i in range(path_length): 141 | path.append(folder_offsets[reader.ReadUInt16()]) 142 | 143 | name_length = reader.ReadUInt8() 144 | prefix = reader.ReadBytes(1) 145 | if prefix != b"\x00": 146 | prefix = prefixes[prefix] 147 | else: 148 | prefix = "" 149 | name = raw(name_length) 150 | 151 | name = f"{prefix}{name}" 152 | path.append(name) 153 | path = "\\".join(path) 154 | 155 | files_offsets[offset] = path 156 | 157 | self.files_offsets = files_offsets 158 | 159 | # read keys 160 | # GI 3649050 (outdated value, use items sector size instead) 161 | keys_data = {} 162 | n_keys = val(3) 163 | 164 | left = reader.GetRemainingLength() 165 | if infos["useBanksSector"] == "TRUE": 166 | left -= sectors["BANKS"]["size"] 167 | 168 | data = bytearray(reader.ReadBytes(left)) 169 | keys_data = {rw2(data[i:i+16]): bytes(data[i+16:i+21]) for i in range(0, len(data), 21)} 170 | 171 | self.keys_data = keys_data 172 | 173 | # read banks sector 174 | bank_keys = {} 175 | if infos["useBanksSector"] == "TRUE": 176 | reader.SetBufferPos(sectors["BANKS"]["offset"]) 177 | 178 | banks_sec_sig = reader.ReadBytes(7) # hardcoded 179 | 180 | global_path_size = val(1) 181 | global_path = raw(global_path_size) 182 | 183 | n_bank_keys = val(2) 184 | 185 | for i in range(n_bank_keys): 186 | key_length = val(1) 187 | key = raw(key_length) 188 | value_length = val(1) 189 | value = raw(value_length) 190 | 191 | bank_keys[key] = f"{global_path}\\{value}" 192 | 193 | self.bank_keys = bank_keys 194 | 195 | # done 196 | print(f"> Finished loading mapping") 197 | print(f"=-=-= Voicelines sector =-=-=") 198 | print(f": {n_langs} languages") 199 | print(f": {n_files} mapped files") 200 | print(f": {n_keys} keys") 201 | if infos["useBanksSector"] == "TRUE": 202 | print(f"=-=-= Music sector =-=-=") 203 | print(f": {n_bank_keys} keys") 204 | 205 | def get_key(self, key, lang=False): 206 | keys_data = self.keys_data 207 | banks_data = self.bank_keys 208 | 209 | if key in keys_data.keys(): 210 | key_data = keys_data[key] 211 | data = [self.files_offsets[int.from_bytes(key_data[2:], "little")]] 212 | 213 | if lang: 214 | data.append(self.langs_offsets[int.from_bytes(key_data[:1], "little")]) 215 | 216 | return data 217 | 218 | if key in banks_data.keys(): 219 | return [banks_data[str(key)], ""] 220 | 221 | return None 222 | 223 | def reset(self): 224 | self.reader = None 225 | self.langs_offsets.clear() 226 | self.files_offsets.clear() 227 | self.keys_data.clear() 228 | -------------------------------------------------------------------------------- /maps/hk4e.map: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Escartem/AnimeWwise/86b92cec81a20de843a8a8b4c8be827010980b76/maps/hk4e.map -------------------------------------------------------------------------------- /maps/hkrpg.map: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Escartem/AnimeWwise/86b92cec81a20de843a8a8b4c8be827010980b76/maps/hkrpg.map -------------------------------------------------------------------------------- /maps/nap.map: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Escartem/AnimeWwise/86b92cec81a20de843a8a8b4c8be827010980b76/maps/nap.map -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | PyQt5==5.15.11 2 | PyQt5_sip==12.15.0 3 | requests==2.32.3 4 | -------------------------------------------------------------------------------- /tools/ffmpeg/LICENSE.txt: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | -------------------------------------------------------------------------------- /tools/ffmpeg/README.txt: -------------------------------------------------------------------------------- 1 | Zeranoe FFmpeg Builds 2 | 3 | Build: ffmpeg-3.4.2-win64-static 4 | 5 | Configuration: 6 | --enable-gpl 7 | --enable-version3 8 | --enable-sdl2 9 | --enable-bzlib 10 | --enable-fontconfig 11 | --enable-gnutls 12 | --enable-iconv 13 | --enable-libass 14 | --enable-libbluray 15 | --enable-libfreetype 16 | --enable-libmp3lame 17 | --enable-libopencore-amrnb 18 | --enable-libopencore-amrwb 19 | --enable-libopenjpeg 20 | --enable-libopus 21 | --enable-libshine 22 | --enable-libsnappy 23 | --enable-libsoxr 24 | --enable-libtheora 25 | --enable-libtwolame 26 | --enable-libvpx 27 | --enable-libwavpack 28 | --enable-libwebp 29 | --enable-libx264 30 | --enable-libx265 31 | --enable-libxml2 32 | --enable-libzimg 33 | --enable-lzma 34 | --enable-zlib 35 | --enable-gmp 36 | --enable-libvidstab 37 | --enable-libvorbis 38 | --enable-libvo-amrwbenc 39 | --enable-libmysofa 40 | --enable-libspeex 41 | --enable-libxvid 42 | --enable-libmfx 43 | --enable-cuda 44 | --enable-cuvid 45 | --enable-d3d11va 46 | --enable-nvenc 47 | --enable-dxva2 48 | --enable-avisynth 49 | 50 | Libraries: 51 | SDL 2.0.7 52 | bzip2 1.0.6 53 | Fontconfig 2.12.6 54 | GnuTLS 3.5.18 55 | libiconv 1.15 56 | libass 0.14.0 57 | libbluray 20180123-6021ff9 58 | FreeType 2.9 59 | LAME 3.100 60 | OpenCORE AMR 20170731-07a5be4 61 | OpenJPEG 2.3.0 62 | Opus 1.2.1 63 | shine 3.1.1 64 | Snappy 1.1.7 65 | libsoxr 20160605-5fa7eeb 66 | Theora 1.1.1 67 | TwoLAME 0.3.13 68 | vpx 1.7.0 69 | WavPack 5.1.0 70 | WebP 0.6.1 71 | x264 20180118-7d0ff22 72 | x265 20180215-7219376 73 | libxml2 2.9.7 74 | z.lib 20180119-5f24b48 75 | XZ Utils 5.2.3 76 | zlib 1.2.11 77 | GMP 6.1.2 78 | vid.stab 20170830-afc8ea9 79 | Vorbis 1.3.5 80 | VisualOn AMR-WB 20141107-3b3fcd0 81 | libmysofa 20171120-cec6eea 82 | Speex 1.2.0 83 | Xvid 1.3.5 84 | libmfx 1.23 85 | 86 | Copyright (C) 2018 Kyle Schwarz 87 | 88 | This program is free software: you can redistribute it and/or modify 89 | it under the terms of the GNU General Public License as published by 90 | the Free Software Foundation, either version 3 of the License, or 91 | (at your option) any later version. 92 | 93 | This program is distributed in the hope that it will be useful, 94 | but WITHOUT ANY WARRANTY; without even the implied warranty of 95 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 96 | GNU General Public License for more details. 97 | 98 | You should have received a copy of the GNU General Public License 99 | along with this program. If not, see . 100 | -------------------------------------------------------------------------------- /tools/ffmpeg/ffmpeg.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Escartem/AnimeWwise/86b92cec81a20de843a8a8b4c8be827010980b76/tools/ffmpeg/ffmpeg.exe -------------------------------------------------------------------------------- /tools/hpatchz/hdiff LICENSE.txt: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | HDiffPatch 4 | Copyright (c) 2012-2021 housisong 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | 24 | ---------------------------------------------------------------------------------- 25 | 26 | libdivsufsort 27 | Copyright (c) 2003-2008 Yuta Mori All Rights Reserved. 28 | 29 | Permission is hereby granted, free of charge, to any person 30 | obtaining a copy of this software and associated documentation 31 | files (the "Software"), to deal in the Software without 32 | restriction, including without limitation the rights to use, 33 | copy, modify, merge, publish, distribute, sublicense, and/or sell 34 | copies of the Software, and to permit persons to whom the 35 | Software is furnished to do so, subject to the following 36 | conditions: 37 | 38 | The above copyright notice and this permission notice shall be 39 | included in all copies or substantial portions of the Software. 40 | 41 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 42 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 43 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 44 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 45 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 46 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 47 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 48 | OTHER DEALINGS IN THE SOFTWARE. 49 | -------------------------------------------------------------------------------- /tools/hpatchz/hpatchz.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Escartem/AnimeWwise/86b92cec81a20de843a8a8b4c8be827010980b76/tools/hpatchz/hpatchz.exe -------------------------------------------------------------------------------- /tools/vgmstream/COPYING: -------------------------------------------------------------------------------- 1 | Copyright (c) 2008-2019 Adam Gashlin, Fastelbja, Ronny Elfert, bnnm, 2 | Christopher Snowhill, NicknineTheEagle, bxaimc, 3 | Thealexbarney, CyberBotX, et al 4 | 5 | Portions Copyright (c) 2004-2008, Marko Kreen 6 | Portions Copyright 2001-2007 jagarl / Kazunori Ueno 7 | Portions Copyright (c) 1998, Justin Frankel/Nullsoft Inc. 8 | Portions Copyright (C) 2006 Nullsoft, Inc. 9 | Portions Copyright (c) 2005-2007 Paul Hsieh 10 | Portions Public Domain originating with Sun Microsystems 11 | 12 | Permission to use, copy, modify, and distribute this software for any 13 | purpose with or without fee is hereby granted, provided that the above 14 | copyright notice and this permission notice appear in all copies. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 17 | WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 18 | MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 19 | ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 20 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 21 | ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 22 | OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 23 | -------------------------------------------------------------------------------- /tools/vgmstream/README.md: -------------------------------------------------------------------------------- 1 | # vgmstream 2 | This is vgmstream, a library for playing streamed (prerecorded) video game audio. 3 | 4 | Some of vgmstream's features: 5 | - [Hundreds of video game music formats and codecs](doc/FORMATS.md), from typical game engine files 6 | to obscure single-game codecs, aiming for high accuracy and compatibility. 7 | - Support for looped BGM, using file's internal metadata for smooth transitions, with accurate 8 | sample counts. 9 | - [Subsongs](doc/USAGE.md#subsongs), playing a format's multiple internal songs separately. 10 | - Many types of companion files (data split into multiple files) and custom containers. 11 | - Encryption keys, internal stream names, and many other unusual cases found in game audio. 12 | - [TXTH](doc/TXTH.md) function, to add external support for extra formats, including raw audio in 13 | many forms. 14 | - [TXTP](doc/TXTP.md) function, for real-time and per-file config, like forced looping, removing 15 | channels, playing certain subsong, or fusing multiple files into a single one. 16 | - Simple [external tagging](doc/USAGE.md#tagging) via .m3u files. 17 | - [Plugins](#getting-vgmstream) are available for various media player software and operating systems. 18 | 19 | The main development repository: https://github.com/vgmstream/vgmstream/ 20 | 21 | Automated builds with the latest changes: https://vgmstream.org 22 | (https://github.com/vgmstream/vgmstream-releases/releases/tag/nightly) 23 | 24 | Common releases: https://github.com/vgmstream/vgmstream/releases 25 | 26 | Help can be found here: https://www.hcs64.com/ 27 | 28 | More documentation: https://github.com/vgmstream/vgmstream/tree/master/doc 29 | 30 | ## Getting vgmstream 31 | There are multiple end-user components: 32 | - [vgmstream-cli](doc/USAGE.md#testexevgmstream-cli-command-line-decoder): A command-line decoder. 33 | - [in_vgmstream](doc/USAGE.md#in_vgmstream-winamp-plugin): A Winamp plugin. 34 | - [foo_input_vgmstream](doc/USAGE.md#foo_input_vgmstream-foobar2000-plugin): A foobar2000 component. 35 | - [xmp-vgmstream](doc/USAGE.md#xmp-vgmstream-xmplay-plugin): An XMPlay plugin. 36 | - [vgmstream.so](doc/USAGE.md#audacious-plugin): An Audacious plugin. 37 | - [vgmstream123](doc/USAGE.md#vgmstream123-command-line-player): A command-line player. 38 | 39 | The main library (plain *vgmstream*) is the code that handles the internal conversion, while the 40 | above components are what you use to get sound. 41 | 42 | If you want to convert game audio to `.wav`, try getting *vgmstream-cli* (see below) then 43 | drag-and-drop one or more files to the executable (support may vary per O.S. or distro). 44 | This should create `(file.extension).wav`, if the format is supported. More user-friendly 45 | would be installing a player like *foobar2000* (for Windows) or *Audacious* (for Linux) 46 | and the vgmstream plugin. Then you can directly listen your files and set options like infinite 47 | looping, or convert to `.wav` with the player's options (also easier if your file has multiple 48 | "subsongs"). 49 | 50 | See [components](doc/USAGE.md#components) in the *usage guide* for full install instructions and 51 | explanations. The aim is feature parity, but there are a few differences between them due to 52 | missing parts on vgmstream's side or lack of support in the player. 53 | 54 | Note that vgmstream cannot *encode* (convert from `.wav` to a video game format), it only *decodes* 55 | (plays game audio). 56 | 57 | 58 | ### Windows 59 | Get the latest prebuilt binaries (CLI/plugins/etc) on our website: 60 | - https://vgmstream.org 61 | 62 | Or the less frequent "official" releases on GitHub: 63 | - https://github.com/vgmstream/vgmstream/releases 64 | 65 | The foobar2000 component is also available on https://www.foobar2000.org based on current 66 | release. 67 | 68 | If the above links fail, you may also try the alternative versions built by 69 | [bnnm](https://github.com/bnnm): 70 | - https://github.com/bnnm/vgmstream-builds/raw/master/bin/vgmstream-latest-test-u.zip 71 | 72 | You may compile from source as well, see the [build guide](doc/BUILD.md). 73 | 74 | ### Linux 75 | A prebuilt CLI binary is available. It's statically linked and should work on systems running 76 | Linux kernel v3.2 and above: 77 | - https://vgmstream.org 78 | - https://github.com/vgmstream/vgmstream/releases 79 | 80 | Building from source will also give you *vgmstream.so* (Audacious plugin), and *vgmstream123* 81 | (command-line player). 82 | 83 | When building, many extra components have to be installed or compiled separately, which the 84 | [build guide](doc/BUILD.md) describes in detail. For a quick build on Debian and Ubuntu-style 85 | distributions run `./make-build-cmake.sh`. The script will need to install various dependencies, 86 | so you may prefer to copy commands and run them manually. 87 | 88 | ### macOS 89 | A prebuilt CLI binary is available as well: 90 | - https://vgmstream.org 91 | - https://github.com/vgmstream/vgmstream/releases 92 | 93 | Otherwise follow the [build guide](doc/BUILD.md). 94 | 95 | 96 | ## More info 97 | - [Usage guide](doc/USAGE.md) 98 | - [List of supported audio formats](doc/FORMATS.md) 99 | - [Build guide](doc/BUILD.md) 100 | - [TXTH file format](doc/TXTH.md) 101 | - [TXTP file format](doc/TXTP.md) 102 | 103 | 104 | Enjoy! *hcs* 105 | -------------------------------------------------------------------------------- /tools/vgmstream/USAGE.md: -------------------------------------------------------------------------------- 1 | # Usage 2 | 3 | ## Needed extra files 4 | On Windows support for some codecs (Ogg Vorbis, MPEG audio, etc.) is done with external 5 | libraries, so you will need to put certain DLL files together. 6 | 7 | In the case of components like foobar2000 they are all bundled for convenience, 8 | while other components include them but must be installed manually. You can also 9 | get them here: https://github.com/vgmstream/vgmstream/tree/master/ext_libs 10 | or compile them manually, even (see tech docs). 11 | 12 | Put the following files somewhere Windows can find them: 13 | - `libvorbis.dll` 14 | - `libmpg123-0.dll` 15 | - `libg719_decode.dll` 16 | - `avcodec-vgmstream-59.dll` 17 | - `avformat-vgmstream-59.dll` 18 | - `avutil-vgmstream-57.dll` 19 | - `swresample-vgmstream-4.dll` 20 | - `libatrac9.dll` 21 | - `libcelt-0061.dll` 22 | - `libcelt-0110.dll` 23 | - `libspeex-1.dll` 24 | 25 | For command line (`vgmstream-cli.exe`) and XMPlay this means in the directory with the main 26 | `.exe`, or possibly a directory in the PATH variable. 27 | 28 | For Winamp, the above `.dll` also go near main `winamp.exe`, but note that `in_vgmstream.dll` 29 | plugin itself goes in `Plugins`. 30 | 31 | On other OSs like Linux/Mac, libs need to be installed before compiling, then should be used 32 | automatically, though not all may enabled at the moment due to build scripts issues. 33 | 34 | 35 | ## Components 36 | 37 | ### vgmstream-cli (command line decoder) 38 | *Windows*: unzip `vgmstream-cli` and follow the above instructions for installing needed extra files. 39 | This tool was called `test.exe` before for historical reasons (rename back if needed). 40 | 41 | *Others*: build instructions can be found in the [BUILD.md](BUILD.md) document (can be compiled 42 | with CMake/Make/autotools). 43 | 44 | Converts playable files to `.wav`. Typical usage would be: 45 | - `vgmstream-cli -o happy.wav happy.adx` to decode `happy.adx` to `happy.wav`. 46 | 47 | If command-line isn't your thing you can simply drag and drop one or multiple 48 | files to the executable to decode them as `(filename.ext).wav`. 49 | 50 | There are multiple options that alter how the file is converted, for example: 51 | - `vgmstream-cli -m file.adx`: print info but don't decode 52 | - `vgmstream-cli -i -o file_noloop.wav file.hca`: convert without looping 53 | - `vgmstream-cli -s 2 -F file.fsb`: write 2nd subsong + ending after 2.0 loops 54 | - `vgmstream-cli -l 3.0 -f 5.0 -d 3.0 file.wem`: 3 loops, 3s delay, 5s fade 55 | - `vgmstream-cli -o bgm_?f.wav file1.adx file2.adx`: convert multiple files to `bgm_(name).wav` 56 | 57 | Available commands are printed when run with no flags. Note that you can also 58 | achieve similar results for other plugins using TXTP, described later. 59 | 60 | Output filename in `-o` may use wildcards: 61 | - `?s`: sets current subsong (or 0 if format doesn't have subsongs) 62 | - `?0Ns`: same, but left pads subsong with up to `N` zeroes 63 | - `?n`: internal stream name, or input filename if format doesn't have name 64 | - `?f`: input filename 65 | 66 | For example `vgmstream-cli -s 2 -o ?04s_?n.wav file.fsb` could generate `0002_song1.wav`. 67 | Default output filename is `?f.wav`, or `?f#?s.wav` if you set subsongs (`-s/-S`). 68 | 69 | 70 | ### in_vgmstream (Winamp plugin) 71 | *Windows*: drop the `in_vgmstream.dll` in your Winamp Plugins directory, 72 | and follow the above instructions for installing needed extra files. 73 | 74 | *Others*: may be possible to use through *Wine*. 75 | 76 | Once installed, supported files should be playable. There is a simple config 77 | menu to tweak some options too. If the *Preferences... > Plug-ins > Input* shows 78 | vgmstream as *"NOT LOADED"* that means extra DLL files aren't in the correct 79 | place. 80 | 81 | #### Plugin priority 82 | An (uncommon) issue is clashing extensions. When opening a file, Winamp first 83 | asks all plugins if they support the file. Here vgmstream accepts files it can 84 | play and rejects anything it can't, but if no plugin "claims" the file (and most 85 | don't), Winamp will just pass it to the *first* `.dll` in the plugin folder that 86 | reports the extension. Since vgmstream supports tons of extensions sometimes it 87 | may receive files it can't play (even after rejecting them before). This oddness 88 | can be solved by renaming the plugins' `.dll` so vgmstream goes *last*. 89 | 90 | For example, vgmstream ignores sequenced `.vgm` but supports streamed `.vgm` (another 91 | format). If your *in_vgm* plugin version doesn't "claim" sequenced `.vgm` Winamp 92 | may send it to vgmstream by mistake (so won't be playable), depending on how it's 93 | named. Here vgmstream has higher priority and fail: 94 | ``` 95 | in_vgmstream.dll 96 | in_vgmW.dll 97 | ``` 98 | And here has lower and will be playable: 99 | ``` 100 | in_vgm.dll 101 | in_vgmstream.dll 102 | ``` 103 | 104 | Note the above is also affected by vgmstream's options *Enable common exts* (vgmstream 105 | will accept and play common files like `.wav` or `.ogg`), and *Enable unknown exts* (will 106 | try to play files outside the known extension list, which is often possible through *TXTH*). 107 | 108 | 109 | ### foo_input_vgmstream (foobar2000 plugin) 110 | *Windows*: every file should be installed automatically when opening the `.fb2k-component` 111 | bundle. 112 | 113 | *Others*: may be possible to use through *Wine*. 114 | 115 | Note that vgmstream currently requires at least foobar v1.5 to run. 116 | 117 | #### Plugin priority 118 | If multiple plugins supports the same format, which plugin is used depends on config. 119 | You can change plugin's priority in **options > Playback > Decoding**. Due to the 120 | huge amount of supported formats, you may want to set it low enough. 121 | 122 | Note the above is also affected by vgmstream's options *Enable common exts* (vgmstream 123 | will accept and play common files like `.wav` or `.ogg`), and *Enable unknown exts* (will 124 | try to play files outside the known extension list, which is often possible through *TXTH*). 125 | 126 | #### Default title 127 | By default *vgmstream* auto-generates a `title` tag depending on subsongs, stream name 128 | and other details. You can change this by setting *"override title"* in the options, 129 | that uses foobar's default (filename without extension) and tweating the display format 130 | in *Preferences > Display > Default User Interface* (may need to add some conditionals 131 | to handle files with/out subsongs). *vgmstream* automatically exports these tags: 132 | - `STREAM_INDEX`: current subsong, if file has subsongs, starts from 1 133 | - `STREAM_COUNT`: total subsongs, if file has subsongs 134 | - `STREAM_NAME`: internal name, that also exists in some formats without subsongs 135 | For example: `[%artist% - ]%title% [%stream_index%][/ %stream_name%]` 136 | 137 | You can also set an unique *Destination* pattern when converting to .wav (even without) 138 | setting *override title*). For example `[$num(%stream_index%,2)] %filename%[-%stream_name%]` 139 | may create a name like `02 BGM-EVENT_SAD`. 140 | 141 | #### Playlist issues 142 | A known quirk is that when loop options or tags change, playlist time/info won't 143 | update automatically. You need to manually refresh it by selecting songs and doing 144 | **shift + right click > Tagging > Reload info from file(s)**. 145 | 146 | 147 | ### xmp-vgmstream (XMPlay plugin) 148 | *Windows*: drop the `xmp-vgmstream.dll` in your XMPlay plugins directory, 149 | and follow the above instructions for installing the other files needed. 150 | 151 | *Others*: may be possible to use through *Wine*. 152 | 153 | Note that this has less features compared to *in_vgmstream* and has no config. 154 | Since XMPlay supports Winamp plugins you may also use `in_vgmstream.dll` instead. 155 | 156 | #### Plugin priority 157 | Because the XMPlay MP3 decoder incorrectly tries to play some vgmstream extensions, 158 | you need to manually fix it by going to **options > plugins > input > vgmstream** 159 | and in the "priority filetypes" put: `ahx,asf,awc,ckd,fsb,genh,lwav,msf,p3d,rak,scd,txth,xvag` 160 | (or any other similar case). 161 | 162 | #### Missing subsongs 163 | XMPlay cannot support vgmstream's type of mixed subsongs due to player limitations 164 | (with neither *xmp-vgmstream* nor *in_vgmstream* plugins). You can make one *TXTP* 165 | per subsong to play them instead (explained below). 166 | 167 | 168 | ### Audacious plugin 169 | *Windows*: not possible at the moment. 170 | 171 | *Others*: needs to be manually built. Instructions can be found in [BUILD.md](BUILD.md) 172 | document in vgmstream's source code (can be done with CMake or autotools). 173 | 174 | #### Plugin priority 175 | vgmstream sets its priority on compile time, low enough for most other plugins to 176 | go first (but not all). Can be changed with `AUDACIOUS_VGMSTREAM_PRIORITY`. 177 | 178 | 179 | ### vgmstream123 (command line player) 180 | *Windows/Linux*: needs to be manually built. Instructions can be found in the 181 | *[BUILD.md](BUILD.md)* document. On Windows it needs `libao.dll` and appropriate includes. 182 | 183 | Usage: `vgmstream123 [options] INFILE ...` 184 | 185 | The program is meant to be a simple stand-alone player, supporting playback of 186 | vgmstream files through libao. Most options should be similar to CLI's 187 | (`-m`, `-i`, `-s N` and so on, though not fully equivalent), use `-h` for full info. 188 | 189 | #### Extra features 190 | On Linux, files compressed with gzip/bzip2/xz also work, as identified by a 191 | `.gz/.bz2/.xz` extension. The file will be decompressed to a temp dir using the 192 | respective utility program (which must be installed and accessible) and then 193 | loaded. 194 | 195 | It also supports playlists, and will recognize a special extended-M3U tag 196 | specific to vgmstream of the following form: 197 | ``` 198 | #EXT-X-VGMSTREAM:LOOPCOUNT=2,FADETIME=10.0,FADEDELAY=0.0,STREAMINDEX=0 199 | ``` 200 | (Any subset of these four parameters may appear in the line, in any order) 201 | 202 | When this "magic comment" appears in the playlist before a vgmstream-compatible 203 | file, the given parameters will be applied to the playback of said file. This makes 204 | it feasible to play vgmstream files directly instead of needing to make "arranged" 205 | WAV/MP3 conversions ahead of time. 206 | 207 | The tag syntax follows the conventions established in Apple's HTTP Live Streaming 208 | standard, whose docs discuss extending M3U with arbitrary tags. 209 | 210 | 211 | ## Special cases 212 | vgmstream aims to support most audio formats as-is, but some files require extra 213 | handling. 214 | 215 | ### Subsongs 216 | Certain container formats have multiple audio files, usually called "subsongs", often 217 | not meant to be extracted (no simple separation from container). 218 | 219 | By default vgmstream plays first subsong and reports total subsongs, if the format 220 | is able to contain them. Easiest to use would be the *foobar/winamp/Audacious* 221 | plugins, that are able to "unpack" those subsongs automatically into the playlist. 222 | 223 | With CLI tools, you can select a subsong using the `-s` flag followed by a number, 224 | for example: `vgmstream-cli -s 5 file.bank` or `vgmstream123 -s 5 file.bank`. 225 | 226 | Using *vgmstream-cli* you can convert multiple subsongs at once using the `-S` flag. 227 | **WARNING, MAY TAKE A LOT OF SPACE!** Some files have been observed to contain +20000 228 | subsongs, so don't use this lightly. Remember to set an output name (`-o`) with subsong 229 | wildcards (or leave it alone for the defaults). 230 | - `vgmstream-cli -s 1 -S 100 file.bank`: writes from subsong 1 to subsong 100 231 | - `vgmstream-cli -s 101 -S 0 file.bank`: writes from subsong 101 to max subsong (automatically changes 0 to max) 232 | - `vgmstream-cli -S 0 file.bank`: writes from subsong 1 to max subsong 233 | - `vgmstream-cli -s 1 -S 5 -o bgm.wav file.bank`: writes 5 subsongs, but all overwrite the same file = wrong. 234 | - `vgmstream-cli -s 1 -S 5 -o bgm_?02s.wav file.bank`: writes 5 subsongs, each named differently = correct. 235 | 236 | For other players without support, or to play only a few choice subsongs, you 237 | can create multiple `.txtp` (explained later) to select one, like `bgm.sxd#10.txtp` 238 | (plays subsong 10 in `bgm.sxd`). 239 | 240 | You can use this python script to autogenerate one `.txtp` per subsong: 241 | https://github.com/vgmstream/vgmstream/tree/master/cli/tools/txtp_maker.py 242 | Put in the same dir as *vgmstream-cli*, then to drag-and-drop files with 243 | subsongs to `txtp_maker.py` (it has CLI options to control output too). 244 | 245 | ### Common and unknown extensions 246 | A few extensions that vgmstream supports clash with common ones. Since players 247 | like foobar or Winamp don't react well to that, they may be renamed to these 248 | "designated fake extensions" to make them playable through vgmstream. 249 | - `.aac` to `.laac` (tri-Ace games) 250 | - `.ac3` to `.lac3` (standard AC3) 251 | - `.aif` to `.laif` (standard Mac AIF, Asobo AIF, Ogg) 252 | - `.aiff/aifc` to `.laiff/laifc` (standard Mac AIF) 253 | - `.asf` to `.lasf` (EA games, Argonaut ASF) 254 | - `.bin` to `.lbin` (various formats) 255 | - `.flac` to `.lflac` (standard FLAC) 256 | - `.mp2` to `.lmp2` (standard MP2) 257 | - `.mp3` to `.lmp3` (standard MP3) 258 | - `.mp4` to `.lmp4` (standard M4A) 259 | - `.mpc` to `.lmpc` (standard MPC) 260 | - `.ogg` to `.logg` (standard OGG) 261 | - `.opus` to `.lopus` (standard OPUS or Switch OPUS) 262 | - `.stm` to `.lstm` (Rockstar STM) 263 | - `.wav` to `.lwav` (standard WAV, various formats) 264 | - `.wma` to `.lwma` (standard WMA) 265 | - `.(any)` to `.vgmstream` (FFmpeg formats or TXTH) 266 | 267 | Command line tools don't have this restriction and will accept the original 268 | filename. 269 | 270 | The main advantage of renaming here is that vgmstream may use the file's internal 271 | loop info, or apply subtle fixes, but is also limited in some ways (like ignoring 272 | standard tags). `.vgmstream` is a catch-all extension that may work as a last resort 273 | to make a file playable. 274 | 275 | Some plugins have options that allow "*common extensions*" to be played, making any 276 | renaming unnecessary. You may need to adjust plugin priority in player's options 277 | first. Note that vgmstream also accepts certain extension-less files as-is too. 278 | 279 | Similarly, vgmstream has a curated list of known extensions, that plugins may take 280 | into account and ignore unknowns. Through *TXTH* you can make unknown files playable, 281 | but you also need to either rename or set plugin options to allow "*unknown extensions*" 282 | (or, preferably, report this new extension so it can be added to the known list). 283 | 284 | It's also possible to make a .txtp file that opens files with those common/unknown 285 | extensions as a way to force them into vgmstream without renaming. 286 | 287 | #### Related issues 288 | Also be aware that other plugins (not vgmstream) can tell the player they handle 289 | some extension, then not actually play it. This makes the file unplayable as 290 | vgmstream doesn't even get the chance to parse it, so you may need to disable 291 | the offending plugin or rename the file to the fake extension shown above (for 292 | example this may happen with `.asf` in foobar2000/Winamp, may be fixed in newer 293 | versions). 294 | 295 | When extracting from a bigfile, sometimes internal files don't have a proper 296 | extension. Those should be renamed to its correct one when possible, as the 297 | extractor program may guess wrong (like `.wav` instead of `.at3` or `.wem`). 298 | If there is no known extension, usually the header id/magic string may be used instead. 299 | 300 | #### Windows 10 folder bugs 301 | Windows 10's *Web Media Extensions* is a pre-installed package seems to read metadata 302 | from files like `.ogg`, `.opus`, `.flac` and so on when opening a folder. However 303 | it tends to noticeably slow down opening folders, also seems to crash and leave files 304 | unusable when reading unsupported formats like Switch Opus (rather than Ogg Opus). 305 | 306 | Renaming extensions should prevent those issues, or just uninstall those *Web 307 | Media Extension* for better experience anyway. 308 | 309 | #### Fallout SFX .ACM 310 | Due to technical limitations, to play Fallout 1/2 SFX you need to rename them from 311 | `.acm` to `.wavc` (forces mono). 312 | 313 | ### Demuxed videos 314 | vgmstream also supports audio from videos, but usually must be demuxed (extracted 315 | without modification) first, since vgmstream doesn't attempt to support most of them 316 | (it does support a few video formats as-is though). 317 | 318 | The easiest way to do this is using *VGMToolBox*'s "Video Demultiplexer" option 319 | for common game video formats (`.bik`, `.vp6`, `.pss`, `.pam`, `.pmf`, `.usm`, `.xmv`, etc). 320 | 321 | For standard videos formats (`.avi`, `.mp4`, `.webm`, `.m2v`, `.ogv`, etc) not supported 322 | by VGMToolBox, FFmpeg binary may work: 323 | - `ffmpeg.exe -i (input file) -vn -acodec copy (output file)` 324 | Output extension may need to be adjusted to some appropriate audio file depending 325 | on the audio codec used. `ffprobe.exe` can list this codec, though the correct audio 326 | extension depends on the video itself (like `.avi` to `.wav/mp2/mp3` or `.ogv` to `.ogg`). 327 | 328 | Some games use custom video formats, demuxer scripts in `.bms` format may be found 329 | on the internet. 330 | 331 | ### Companion files 332 | Some formats have companion files with external info, that should be left together: 333 | - `.mus`: playlist with `.acm` 334 | - `.ogg.sli` or `.sli`: loop info for `.ogg` 335 | - `.ogg.sfl` : loop info for `.ogg` 336 | - `.opus.sli`: loop info for `.opus` 337 | - `.pos`: loop info for .wav 338 | - `.acb`: names for `.awb` 339 | - `.xsb`: names for `.xwb` 340 | 341 | Similarly some formats split header+body data in separate files, examples: 342 | - `.abk`+`.ast` 343 | - `.bnm`+`.apm/wav` 344 | - `.ktsl2asbin`+`.ktsl2stbin` 345 | - `.mih`+`.mib` 346 | - `.mpf`+`.mus` 347 | - `.pk`+`.spk` 348 | - `.sb0`+`.sp0` (or other numbers instead of `0`) 349 | - `.sgh`+`.sgd` 350 | - `.snr`+`.sns` 351 | - `.spt`+`.spd` 352 | - `.sts`+`.int` 353 | - `.xwh`+`.xwb` 354 | - `.xps`+`dat` 355 | - `.wav.str`+`.wav` 356 | - `.wav`+`.dcs` 357 | - `.wbh`+`.wbd` 358 | 359 | Both are needed to play and must be together. The usual rule is you open the 360 | bigger file (body), save a few formats where the smaller (header) file is opened 361 | instead for technical reasons (mainly some bank formats). 362 | 363 | Generally companion files are named the same (`bgm.awb`+`bgm.acb`), or internally 364 | point to another file `sfx.sb0`+`STREAM.sb0`. A few formats may have different names 365 | which are hardcoded instead of being listed in the header file (e.g. `.mpf+.mus`). 366 | In these cases, you can use *TXTM* format to specify associated companion files. 367 | See *Artificial files* below for more information. 368 | 369 | #### Dual stereo 370 | A special case of the above is "dual file stereo", where 2 similarly named mono 371 | files are fused together to make 1 stereo song. 372 | - `(file)_L.dsp`+`(file)_R.dsp` 373 | - `(file)-l.dsp`+`(file)-l.dsp` 374 | - `(file).L`+`(file).R` 375 | - `(file)_0.dsp`+`(file)_1.dsp` 376 | - `(file)_Left.dsp`+`(file)_Right.dsp` 377 | - `(file).v0`+`(file).v1` 378 | 379 | vgmstream automatically detects these pairs and makes a stereo song from `L` + `R`. 380 | You can open either `L` or `R` and you'll get the same stereo. If you rename one 381 | of the files the "pair" won't be found, and both will be played as mono. This 382 | is only done for a few choice formats (mainly `.dsp` and `.vag`) that commonly 383 | split audio like that, though. 384 | 385 | #### OS case sensitiveness 386 | When using OS with case sensitive filesystem (mainly Linux), a known issue with 387 | companion files is that vgmstream generally tries to find them using lowercase 388 | extension. 389 | 390 | This means that if the developer used uppercase instead (e.g. `bgm.ABK`+`bgm.AST`) 391 | loading will fail. It's technically complex to fix this, so for the time being 392 | the only option is renaming the companion extension to lowercase. 393 | 394 | A particularly nasty variation of that is that some formats load files by full 395 | name (e.g. `STREAM.SS0`), but sometimes the actual filename is in other case 396 | (`Stream.ss0`), and some files could even point to that with yet another case. 397 | You could try adding *symlinks* in various upper/lower/mixed cases to handle this, 398 | though only a few formats do this, mainly *Ubisoft* banks. 399 | 400 | Regular formats without companion files should work fine in upper/lowercase. For 401 | `.(ext).txth` files make sure `(ext)` matches case too. 402 | 403 | ### Decryption keys 404 | Certain formats have encrypted data, and need a key to decrypt. vgmstream 405 | will try to find the correct key from a list, but it can be provided by 406 | a companion file: 407 | - `.adx`: `.adxkey` (keystring, 8-byte keycode, or derived 6 byte start/mult/add key) 408 | - `.ahx`: `.ahxkey` (keystring, or derived 6-byte start/mult/add key) 409 | - `.hca`: `.hcakey` (8-byte decryption key, a 64-bit number) 410 | - `.awb`/`.acb` also may use `.hcakey`, and will combine with an internal AWB subkey 411 | - May set a 8-byte key followed a 2-byte AWB subkey for newer HCA 412 | - `.fsb`: `.fsbkey` (decryption key in hex, usually between 8-32 bytes) 413 | - `.bnsf`: `.bnsfkey` (decryption key, a string up to 24 chars) 414 | 415 | The key file can be `.(ext)key` (for the whole folder), or `(name).(ext)key" 416 | (for a single file). The format is made up to suit vgmstream. 417 | 418 | ### Artificial files 419 | In some cases a file only has raw data, while important header info (codec type, 420 | sample rate, channels, etc) is stored in the .exe or other hard to locate places. 421 | Or maybe the file plays normally, but has many layers at once that are silenced 422 | dynamically during gameplay, or looping metadata is stored externally. 423 | 424 | Cases like those can be supported using an artificial files with info vgmstream 425 | needs. 426 | 427 | Creation of these files is meant for advanced users, full docs can be found in 428 | vgmstream source. 429 | 430 | #### TXTH 431 | Text files describing a format's header, to make unsupported files playable 432 | (helps vgmstream understand the file you are trying to open). 433 | 434 | Must be named `.txth` or `.(ext).txth` (used for the whole folder), or 435 | `(name.ext).txth` (used for a single file). `.txth` are indirectly used when 436 | a `(file.ext)` is opened but vgmstream can't play it by default. 437 | 438 | `.txth` contains static values, or dynamic text commands to read data from the 439 | original file, serving as a fake header of sorts. 440 | 441 | Usage example (used when opening an unknown file named `bgm_01.pcm`): 442 | 443 | **.pcm.txth** 444 | ``` 445 | codec = PCM16LE #standard PCM wave data 446 | channels = @0x04 #read in the file, at offset 4 447 | sample_rate = 48000 #hardcoded 448 | start_offset = 0x10 #first 0x10 bytes are the header 449 | num_samples = data_size #auto 450 | ``` 451 | 452 | #### TXTP 453 | Text files that apply playback parameters, to customize how other files are 454 | played. 455 | 456 | Must be named `(any name).txtp` and opened directly. Useful when games play songs 457 | in various non-standard ways, so we can tell vgmstream to handle files differently. 458 | 459 | `.txtp` can do multiple things (can be combined, too): 460 | - join a playlist of files (for separate intro + loop songs) 461 | - play a list of single-channel files as a single multichannel file 462 | - install looping to any file (for files with looping done in code) 463 | - remove unwanted channels (for layered exploration + action songs) 464 | - select a subsong in an audio bank 465 | - playback config such as volume or max playable time 466 | - apply complex real-time mixing 467 | - many other features 468 | 469 | Usage examples (open directly, name can be set freely): 470 | 471 | **bgm01-full.txtp** 472 | ``` 473 | # plays 2 files as a single one 474 | bgm01_intro.vag 475 | bgm01_loop.vag 476 | loop_mode = auto 477 | ``` 478 | 479 | **bgm-subsong10.txtp** 480 | ``` 481 | # plays subsong number 10 482 | bgm.sxd#10 483 | ``` 484 | 485 | **song01-looped.txtp** 486 | ``` 487 | # force looping an .mp3 from 10 seconds up to file end 488 | song02.mp3 #I 10.0 489 | ``` 490 | 491 | **music01-demux2.txtp** 492 | ``` 493 | # plays channels 3 and 4 only, removes rest 494 | music01.bfstm #C3,4 495 | ``` 496 | 497 | #### TXTM 498 | A text file named `.txtm` for some formats with companion files. It lists 499 | name combos determining which companion files to load for each main file. 500 | 501 | It is needed for formats where name combos are hardcoded, so vgmstream doesn't 502 | know which companion file(s) to load if its name doesn't match the main file. 503 | Note that companion file order is usually important. 504 | 505 | Usage example (used when opening files in the left part of the list): 506 | ``` 507 | # Harry Potter and the Chamber of Secrets (PS2) 508 | exterior.mpf: exterior.mus,ext_o.mus 509 | willow.mpf: willow.mus,willow_o.mus 510 | ``` 511 | ``` 512 | # Metal Gear Solid: Snake Eater 3D (3DS) names for .awb 513 | bgm_2_streamfiles.awb: bgm_2.acb 514 | ``` 515 | ``` 516 | # Snack World (Switch) names for .awb (single .acb for all .awb, order matters) 517 | bgm.awb: bgm.acb 518 | bgm_DLC1.awb: bgm.acb 519 | ``` 520 | In rare cases you need to setup some extra flags 521 | ``` 522 | event_stream2.awb: event_stream2.acb 523 | event_stream2_dlc1.awb: event_stream2.acb 524 | event_stream2_dlc2.awb: event_stream2.acb 525 | event_stream2_dlc3.awb: event_stream2.acb 526 | # next "flag" allows both effect.acb and even_stream2.acb in the same file 527 | #@reset-pos 528 | effect.awb: effect.acb 529 | effect_dlc2.awb: effect.acb 530 | effect_dlc3.awb: effect.acb 531 | ``` 532 | 533 | #### GENH 534 | A byte header placed right before the original data, modifying it. 535 | The resulting file must be `(name).genh`. Contains static header data. 536 | 537 | Programs like VGMToolbox can help to create *GENH*, but consider using *TXTH* 538 | instead, *GENH* is mostly deprecated. *TXTH* is recommended over *GENH* as 539 | it's far easier to create and has many more functions, plus doesn't modify 540 | original data. 541 | 542 | 543 | ### Plugin conflicts 544 | Since vgmstream supports a huge amount of formats it's possibly that some of 545 | them are also supported in other plugins, and this sometimes causes conflicts. 546 | If a file that should isn't playing or looping, first make sure vgmstream is 547 | really opening it (should show "VGMSTREAM" somewhere in the file info), and 548 | try to remove a few other plugins. 549 | 550 | foobar's FFmpeg plugin and foo_adpcm are known to cause issues, but in 551 | modern versions (+1.4.x) you can configure plugin priority (go to *Preferences* 552 | then *playback > decoding* and move *vgmstream* higher or other plugins lower). 553 | 554 | In Audacious, vgmstream is set with slightly higher priority than FFmpeg, 555 | since it steals many formats that you normally want to loop (like `.adx`). 556 | However other plugins may set themselves higher, stealing formats instead. 557 | If current Audacious version doesn't let to change plugin priority you may 558 | need to disable some plugins (requires restart) or set priority on compile 559 | time. Particularly, mpg123 plugin may steal formats that aren't even MP3, 560 | making impossible for vgmstream to play them properly. 561 | 562 | ### Channel issues 563 | Some games layer a huge number of channels, that are disabled or downmixed 564 | during gameplay. The player may be unable to play those files (for example 565 | foobar can only play up to 8 channels, and Winamp depends on your sound 566 | card). For those files you can set the "downmix" option in vgmstream, that 567 | can reduce the number of channels to a playable amount. 568 | 569 | Note that this type of downmixing is very generic (not meant to be used when 570 | converting to other formats), channels are re-assigned and volumes modified 571 | in simplistic ways, since it can't guess how the file should be properly 572 | adjusted. Most likely it will sound a bit quieter than usual. 573 | 574 | You can also choose which channels to play using *TXTP*. For example, create 575 | a file named `song.adx#C1,2.txtp` to play only channels 1 and 2 from `song.adx`. 576 | *TXTP* also has command to set how files are downmixed, like `song.adx #@downmix.txtp` 577 | for standard 5.1/4.0/etc audio to stereo, or manual (per-channel) mixing. 578 | 579 | ### Average bitrate 580 | Note that vgmstream shows the "file bitrate" (counts all data) as opposed to 581 | "codec bitrate" (counts pure audio-only parts). This means bitrate may be 582 | slightly higher (or much higher, if file is bloated) than what encoder 583 | tools or other players may report. 584 | 585 | Calculating 100% correct codec bitrate usually needs manual reading of the whole 586 | file, slowing down opening files and needing extra effort by devs for minimal 587 | benefit, so it's not done. 588 | 589 | In some cases it's debatable what the codec bitrate is. Unlike MP3/AAC, 48kbps 590 | of raw Vorbis/Opus is unplayable/unusable unless it's packed into .ogg/wem/etc 591 | with extra data, that does increase final file size (thus bitrate) by some percent. 592 | 593 | Also, keep in mind video game audio bitrate isn't always a great indicator of quality. 594 | There are many factors in play like encoder, type of codec, sample rate and so on. 595 | A higher bitrate `.wav` can sound worse than a lower `.ogg` (like mono 22050hz `.wav` 596 | vs stereo 48000hz `.ogg`). 597 | 598 | ### Containers 599 | Some formats are *audio containers* of other common audio formats. For example 600 | `.acb`/`.awb` may contain standard `.hca` inside. Rather than extracting the 601 | internal "files", it's recommended that you keep data unmodified for preservation 602 | purposes. Sometimes containers have useful data (like loop info or names), that 603 | you may be unknowingly throwing away if you extract internal files. 604 | 605 | It's a good practice (and simpler) to just let containers be and play them 606 | directly with vgmstream. Newer `.acb`/`.awb` have extra data needed to decrypt 607 | the `.hca`, so if you are already used to those containers you don't need to 608 | worry about extracted `.hca` not working later. Plus you can use TXTH's "subfile" 609 | function to easily make unsupported containers playable: 610 | ``` 611 | # Simple container with an Ogg inside. Maybe values 0x00..0x10 could contain 612 | # loops or other useful info, that other users are able to figure out: 613 | subfile_extension = ogg 614 | subfile_offset = 0x10 615 | ``` 616 | With unmodified data, you can always extract the internal files later if you 617 | change your mind, but you can't get the (potentially useful) container data back 618 | once extracted. 619 | 620 | However, if your file is a *generic container* (like a `.zip`, that could hold 621 | graphics or audio) you may safely extract the internal files without worry. 622 | 623 | Note that some formats are *audio banks* rather than *containers* (like `.fsb`), 624 | in that info for playing the audio is part of the bank header, and extracting 625 | internal files as-is isn't really possible. Or, perhaps you could to transmogrify 626 | the original header into something else, but for data preservation purposes 627 | it's preferable to leave it as-is (plus can use TXTH to play unsupported formats). 628 | 629 | If your main motivation for extracting is to rename or have loose files, remember 630 | you can simply use TXTP to point to a subsong, and name that `.txtp` whatever you 631 | want, without having to touch original data or needing custom extractors. 632 | 633 | ### Cue formats 634 | Some formats that vgmstream supports (SQEX's .sab, CRI's .acb+awb, Wwise's .bnk+wem, 635 | Microsoft's .xss+.xwb....) are "cue" formats. The way these work is (more or less), 636 | they have a bunch of named audio "cues"/"events" in a section of the file, that are 637 | called to play one or multiple audio "waves"/"materials" in another section. 638 | 639 | Rather than handling cues, vgmstream shows and plays waves, then assigns cue names 640 | that point to the wave if possible, since vgmstream mainly deals with streamed/wave 641 | audio and simulating cues is out of scope. Figuring out a whole cue format can be a 642 | *huge* time investment, so handling waves only is often enough. 643 | 644 | Cues can be *very* complex, like N cues pointing to 1 wave with varying pitch, or 645 | 1 cue playing one random wave out of 3. Sometimes not all waves are referenced by 646 | cues, or cues do undesirable effects that make only playing waves a good compromise. 647 | Simulating cues is better handled with external tools that allow more flexibility 648 | (for example, this project simulates Wwise's extremely complex cues/events by creating 649 | .TXTP telling vgmstream which config and waves to play, and one can filter desired 650 | cues/TXTP: https://github.com/bnnm/wwiser). 651 | 652 | ## Logged errors and unplayable supported files 653 | Some formats should normally play, but somehow don't. In those cases plugins 654 | can print vgmstream's error info to console (for example, `.fsb` with an unknown 655 | codec, `.hca/awb` with missing decryption key, bank has no audio, `.txth` is 656 | malformed, or `.wav` has an incorrectly ripped size). 657 | 658 | Console location and format depends on plugin: 659 | - *foobar2000*: found in *View menu > Console* 660 | - *Winamp*: open vgmstream's config (*Preferences... > Plug-ins > vgmstream* + *Configure* 661 | button) then press "Open Log" 662 | - *Audacious*: start with `audacious -V` from terminal 663 | - CLI utils: printed to stdout directly 664 | 665 | Only a few errors types are printed but may be helpful for more common cases. 666 | 667 | ## Tagging 668 | Some of vgmstream's plugins support simple read-only tagging via external files. 669 | 670 | Tags are loaded from a text/M3U-like file named *!tags.m3u* in the song folder. 671 | You don't have to load your songs with this M3U though, but you can (for pre-made 672 | order). The format is meant to be both a quick playlist and tags, but the tagfile 673 | itself just 'looks' like an M3U. you can load files manually or using other playlists 674 | and still get tags. 675 | 676 | Format is: 677 | ``` 678 | # ignored comment 679 | # $GLOBAL_COMMAND (extra features) 680 | # @GLOBAL_TAG text (applies all following tracks) 681 | 682 | # %LOCAL_TAG text (applies to next track only) 683 | filename1 684 | # %LOCAL_TAG text (applies to next track only) 685 | filename2 686 | ``` 687 | Accepted tags depend on the player (foobar: any; Winamp: see ATF config, Audacious: 688 | few standard ones), typically *ALBUM/ARTIST/TITLE/DISC/TRACK/COMPOSER/etc*, lower 689 | or uppercase, separated by one or multiple spaces. Repeated tags overwrite previous 690 | (ex.- may define *@COMPOSER* multiple times for "sections"). It only reads up to 691 | current *filename* though, so any *@TAG* below would be ignored. 692 | 693 | *GLOBAL_COMMAND*s currently can be: 694 | - *AUTOTRACK*: sets *%TRACK* tag automatically (1..N as files are encountered 695 | in the tag file). 696 | - *AUTOALBUM*: sets *%ALBUM* tag automatically using the containing dir as album. 697 | - *EXACTMATCH*: disables matching .txtp with regular files (explained below). 698 | 699 | Playlist title formatting (how tags are shown) should follow player's config, as 700 | vgmstream simply passes tags to the player. It's better to name the file lowercase 701 | `!tags.m3u` rather than `!Tags.m3u` (Windows accepts both but Linux is case sensitive). 702 | 703 | Example: 704 | ``` 705 | # @ALBUM God Hand 706 | # @ARTIST Masafumi Takada, Jun Fukuda 707 | # * Global tags apply to all songs, unless overwritten 708 | # Better use ARTIST instead of ALBUMARTIST (more compatible) 709 | # Tags usually go in CAPS for readability but no differences 710 | 711 | # $AUTOTRACK 712 | # * This adds TRACK tags automatically from 1 to N 713 | 714 | # %ARTIST Masafumi Takada 715 | # %TITLE Be ready for it 716 | godhand_ver1.adx 717 | 718 | #... (more songs) 719 | 720 | # %ARTIST Jun Fukuda 721 | # %TITLE Duel Storm 722 | Boss8_DevilHandHONKI_Ver9.adx 723 | 724 | #... (more songs) 725 | 726 | ``` 727 | 728 | Note that with global tags you don't need to put all files or info inside. This would be 729 | a perfectly valid *!tags.m3u*: 730 | ``` 731 | # @ALBUM Game 732 | # @ARTIST Various Artists 733 | ``` 734 | 735 | ### Compatibility and non-English filenames and tags 736 | For best compatibility save `!tags.m3u` as *"ANSI"* or *"UTF-8" (with BOM)*. 737 | 738 | Tags and filenames using extended characters (like Japanese) should work, as long 739 | as `!tags.m3u` is saved as *"UTF-8 with BOM"* (UTF-8 is a way to define non-English 740 | characters, and BOM is a helper "byte-order" mark). Windows' *notepad* creates files 741 | *"with BOM"* when selecting UTF-8 encoding in *save as* dialog, or you may use other 742 | programs like *notepad++.exe* to convert them. 743 | 744 | More exactly, vgmstream needs the file saved in *UTF-8* to match tags and filenames 745 | (and ignores *BOM*), while foobar/Winamp won't understand UTF-8 *filenames* unless 746 | `.m3u` is saved *with BOM* (ignoring tags). Whereas if saved in what Windows calls 747 | "Unicode" (UTF-16) neither may work. 748 | 749 | Conversely, if your *filenames* only use English/ANSI characters you may ommit *BOM*, 750 | and if your tags are English only you may save the `.m3u` as ANSI. Or if you only use 751 | `!tags.m3u` for tags and not for opening files (for example opening them manually 752 | or with a `playlist.m3u8`) you won't need BOM either. 753 | 754 | Other players may not need BOM (or CRLF), but for consistency use them when dealing 755 | with non-ASCII names and tags. 756 | 757 | ### Tags with spaces 758 | Some players like foobar accept tags with spaces. To use them surround the tag 759 | with both characters. 760 | ``` 761 | # @GLOBAL TAG WITH SPACES@ text 762 | # ... 763 | # %LOCAL TAG WITH SPACES% text 764 | filename1 765 | ``` 766 | As a side effect if text has @/% inside you also need them: `# @ALBUMARTIST@ Tom-H@ck` 767 | 768 | For interoperability with other plugins, consider using only common tags without spaces, 769 | and tags that are commonly accepted in all players like ARTIST instead of ALBUMARTIST. 770 | 771 | ### ReplayGain 772 | foobar2000/Winamp can apply the following replaygain tags (if ReplayGain is 773 | enabled in preferences): 774 | ``` 775 | # %replaygain_track_gain N.NN dB 776 | # %replaygain_track_peak N.NNN 777 | # @replaygain_album_gain N.NN dB 778 | # @replaygain_album_peak N.NNN 779 | ``` 780 | 781 | ### TXTP matching 782 | To ease *TXTP* config, tags with plain files will match `.txtp` with config, and tags 783 | with `.txtp` config also match plain files: 784 | 785 | **!tags.m3u** 786 | ``` 787 | # @TITLE Title1 788 | BGM01.adx #P 3.0.txtp 789 | # @TITLE Title2 790 | BGM02.wav 791 | ``` 792 | **config.m3u** 793 | ``` 794 | # matches "Title1" (1:1) 795 | BGM01.adx #P 3.0.txtp 796 | # matches "Title1" (plain file matches config tag) 797 | BGM01.adx 798 | # matches "Title2" (config file matches plain tag) 799 | BGM02.wav #P 3.0.txtp 800 | # doesn't match anything (different config can't match) 801 | BGM01.adx #P 10.0.txtp 802 | ``` 803 | 804 | Since it matches when a tag is found, some cases that depend on order won't work. 805 | You can disable this feature manually then: 806 | 807 | **!tags.m3u** 808 | ``` 809 | # $EXACTMATCH 810 | # 811 | # %TITLE Title3 (without config) 812 | BGM01.adx 813 | # %TITLE Title3 (with config) 814 | BGM01.adx #I 1.0 90.0 .txtp 815 | ``` 816 | **config.m3u** 817 | ``` 818 | # Would match "Title3 (without config)" without "$EXACTMATCH", as it's found first 819 | # Could use "BGM01.adx.txtp" as first entry in !tags.m3u instead (different configs won't match) 820 | BGM01.adx #I 1.0 90.0 .txtp 821 | ``` 822 | 823 | ### Issues 824 | If your player isn't picking tags make sure vgmstream is detecting the song 825 | (as other plugins can steal its extensions, see above), `.m3u` is properly 826 | named and that filenames inside match the song filename. For Winamp you need 827 | to make sure *options > titles > advanced title formatting* checkbox is set and 828 | the format defined. 829 | 830 | When tags change behavior varies depending on player: 831 | - *Winamp*: should refresh tags when a different file is played. 832 | - *foobar2000*: needs to force refresh (for reasons outside vgmstream's control) 833 | - **select songs > shift + right click > Tagging > Reload info from file(s)**. 834 | - *Audacious*: files need to be re-added to the playlist 835 | 836 | Currently there is no tool to aid in the creation of these tags, but you can create 837 | a base `.m3u` and edit as a text file. You may try this python script to make the 838 | base file: https://raw.githubusercontent.com/bnnm/vgm-tools/master/py/tags-maker.py 839 | 840 | vgmstream's "m3u tagging" is meant to be simple to make and share (just a text 841 | file), easier to support in multiple players (rather than needing a custom plugin), 842 | allow OST-like ordering but also mixable with other `.m3u`, and be flexible enough 843 | to have commands. If you are not satisfied with vgmstream's tagging format, 844 | foobar2000 has other plugins (with write support) that may be of use: 845 | - m-TAGS: http://www.m-tags.org/ 846 | - foo_external_tags: https://foobar.hyv.fi/?view=foo_external_tags 847 | 848 | 849 | ## Virtual TXTP files 850 | Some of vgmstream's plugins (and CLI) allow you to use virtual `.txtp` files, that 851 | combined with playlists let you make quick song configs. 852 | 853 | Normally you can create a physical .txtp file that points to another file with 854 | config, and `.txtp` have a "mini-txtp" mode that configures files with only the 855 | filename. 856 | 857 | Instead of manually creating `.txtp` files you can put non-existing virtual `.txtp` 858 | in a `.m3u` playlist: 859 | ``` 860 | # playlist that opens subsongs directly without having to create .txtp 861 | # notice the full filename, then #(config), then ".txtp" (spaces are optional) 862 | bank_bgm_full.nub #s1 .txtp 863 | bank_bgm_full.nub #s10 .txtp 864 | ``` 865 | 866 | Combine with tagging (see above) for extra fun OST-like config. 867 | ``` 868 | # @ALBUM GOD HAND 869 | 870 | # play 1 loop, delay and do a longer fade 871 | # %TITLE Too Hot !! 872 | circus_a_mix_ver2.adx #l 1.0 #d 5.0 #f 15.0 .txtp 873 | 874 | # play 1 loop instead of the default 2 then fade with the song's internal fading 875 | # %TITLE Yet... Oh see mind 876 | boss2_3ningumi_ver6.adx #l 1.0 #F .txtp 877 | 878 | ... 879 | ``` 880 | 881 | You can also use it in CLI for quick access to some txtp-exclusive functions: 882 | ``` 883 | # force change sample rate to 22050 (don't forget to use " with spaces) 884 | vgmstream-cli -o btl_koopa1_44k_lp.wav "btl_koopa1_44k_lp.brstm #h22050.txtp" 885 | ``` 886 | 887 | Support for this feature is limited by player itself, as foobar and Winamp allow 888 | non-existent files referenced in a `.m3u`, while other players may filter them 889 | first. 890 | 891 | You can use this python script to autogenerate one `.txtp` per virtual-txtp: 892 | https://github.com/vgmstream/vgmstream/tree/master/cli/tools/txtp_dumper.py 893 | Drag and drop the `.m3u`, or any text file with .txtp (it has CLI options 894 | to control output too). 895 | 896 | 897 | ## Sequences and streams 898 | Roughly, there are two types of game audio: 899 | - streams: prerecorded audio where all instruments are pre-mixed into a single 900 | file, often compressed with some custom format. 901 | - sequences: series of instrument notes, typically in MIDI-like formats with 902 | a bank of instrument sounds. 903 | 904 | As the name implies, vgmstream plays "streams". Old games mainly use sequences 905 | (very small and more dynamic), while other games use streams (easier to handle 906 | but lot bigger and sometimes CPU-intensive). 907 | 908 | vgmstream's internals are tailored to play streams so, in other words, it's not 909 | possible to add support for sequenced audio unless massive changes were done, 910 | basically becoming another program entirely. There are other projects better 911 | suited for playing sequences. 912 | -------------------------------------------------------------------------------- /tools/vgmstream/avcodec-vgmstream-59.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Escartem/AnimeWwise/86b92cec81a20de843a8a8b4c8be827010980b76/tools/vgmstream/avcodec-vgmstream-59.dll -------------------------------------------------------------------------------- /tools/vgmstream/avformat-vgmstream-59.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Escartem/AnimeWwise/86b92cec81a20de843a8a8b4c8be827010980b76/tools/vgmstream/avformat-vgmstream-59.dll -------------------------------------------------------------------------------- /tools/vgmstream/avutil-vgmstream-57.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Escartem/AnimeWwise/86b92cec81a20de843a8a8b4c8be827010980b76/tools/vgmstream/avutil-vgmstream-57.dll -------------------------------------------------------------------------------- /tools/vgmstream/in_vgmstream.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Escartem/AnimeWwise/86b92cec81a20de843a8a8b4c8be827010980b76/tools/vgmstream/in_vgmstream.dll -------------------------------------------------------------------------------- /tools/vgmstream/jansson.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Escartem/AnimeWwise/86b92cec81a20de843a8a8b4c8be827010980b76/tools/vgmstream/jansson.dll -------------------------------------------------------------------------------- /tools/vgmstream/libatrac9.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Escartem/AnimeWwise/86b92cec81a20de843a8a8b4c8be827010980b76/tools/vgmstream/libatrac9.dll -------------------------------------------------------------------------------- /tools/vgmstream/libcelt-0061.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Escartem/AnimeWwise/86b92cec81a20de843a8a8b4c8be827010980b76/tools/vgmstream/libcelt-0061.dll -------------------------------------------------------------------------------- /tools/vgmstream/libcelt-0110.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Escartem/AnimeWwise/86b92cec81a20de843a8a8b4c8be827010980b76/tools/vgmstream/libcelt-0110.dll -------------------------------------------------------------------------------- /tools/vgmstream/libg719_decode.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Escartem/AnimeWwise/86b92cec81a20de843a8a8b4c8be827010980b76/tools/vgmstream/libg719_decode.dll -------------------------------------------------------------------------------- /tools/vgmstream/libmpg123-0.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Escartem/AnimeWwise/86b92cec81a20de843a8a8b4c8be827010980b76/tools/vgmstream/libmpg123-0.dll -------------------------------------------------------------------------------- /tools/vgmstream/libspeex-1.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Escartem/AnimeWwise/86b92cec81a20de843a8a8b4c8be827010980b76/tools/vgmstream/libspeex-1.dll -------------------------------------------------------------------------------- /tools/vgmstream/libvorbis.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Escartem/AnimeWwise/86b92cec81a20de843a8a8b4c8be827010980b76/tools/vgmstream/libvorbis.dll -------------------------------------------------------------------------------- /tools/vgmstream/swresample-vgmstream-4.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Escartem/AnimeWwise/86b92cec81a20de843a8a8b4c8be827010980b76/tools/vgmstream/swresample-vgmstream-4.dll -------------------------------------------------------------------------------- /tools/vgmstream/vgmstream-cli.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Escartem/AnimeWwise/86b92cec81a20de843a8a8b4c8be827010980b76/tools/vgmstream/vgmstream-cli.exe -------------------------------------------------------------------------------- /tools/vgmstream/xmp-vgmstream.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Escartem/AnimeWwise/86b92cec81a20de843a8a8b4c8be827010980b76/tools/vgmstream/xmp-vgmstream.dll -------------------------------------------------------------------------------- /updater.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | UpdaterWindow 4 | 5 | 6 | 7 | 0 8 | 0 9 | 400 10 | 100 11 | 12 | 13 | 14 | 15 | 400 16 | 100 17 | 18 | 19 | 20 | 21 | 400 22 | 100 23 | 24 | 25 | 26 | Updater 27 | 28 | 29 | 30 | 31 | 0 32 | 0 33 | 404 34 | 83 35 | 36 | 37 | 38 | 39 | 40 | 6 41 | 0 42 | 391 43 | 31 44 | 45 | 46 | 47 | 48 | 16 49 | 75 50 | true 51 | true 52 | 53 | 54 | 55 | Updating... 56 | 57 | 58 | 59 | 60 | 61 | 7 62 | 42 63 | 381 64 | 16 65 | 66 | 67 | 68 | 0 69 | 70 | 71 | false 72 | 73 | 74 | 75 | 76 | 77 | 16 78 | 62 79 | 361 80 | 21 81 | 82 | 83 | 84 | Status 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /version.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": 221, 3 | "mapsVersion": 104, 4 | "maps": [ 5 | { 6 | "name": "hk4e.map", 7 | "game": "Genshin Impact", 8 | "version": "5.4" 9 | }, 10 | { 11 | "name": "hkrpg.map", 12 | "game": "Honkai: Star Rail", 13 | "version": "3.3" 14 | }, 15 | { 16 | "name": "nap.map", 17 | "game": "Zenless Zone Zero", 18 | "version": "1.7" 19 | } 20 | ] 21 | } -------------------------------------------------------------------------------- /wavescan.py: -------------------------------------------------------------------------------- 1 | # Custom rewrite of the Wwise AKPK packages extractor, original by Nicknine and bnnm 2 | import os 3 | import traceback 4 | from bnk import bnk2wem 5 | 6 | 7 | reader = None 8 | bank_version = 0 9 | wwise_data = [] 10 | filename = "" 11 | 12 | 13 | def get_data(_reader, _filename): 14 | global wwise_data 15 | global bank_version 16 | global reader 17 | global filename 18 | 19 | filename = _filename 20 | wwise_data = [] 21 | reader = _reader 22 | 23 | # check file 24 | if reader.ReadBytes(4) != b"AKPK": 25 | # file.close() 26 | raise Exception("not a valid audio file") 27 | 28 | # check endianness 29 | reader.SetBufferPos(0x08) 30 | endian_check = reader.ReadLong() # this is the same bytes as the flag sector, which seems to be always 1 31 | 32 | if endian_check == 1: 33 | endianness = 0 # little 34 | elif endian_check == 0x1000000: 35 | endianness = 1 # big 36 | else: 37 | raise Exception("couldn't detect endianness") 38 | 39 | # retrieve sectors in header 40 | reader.SetBufferPos(0x04) 41 | 42 | header_size = reader.ReadLong() 43 | flag = reader.ReadLong() 44 | 45 | languages_sector_size = reader.ReadLong() 46 | banks_sector_size = reader.ReadLong() 47 | sounds_sector_size = reader.ReadLong() 48 | externals_sector_size = 0 49 | 50 | if languages_sector_size + banks_sector_size + sounds_sector_size + 0x10 < header_size: 51 | externals_sector_size = reader.ReadLong() 52 | 53 | sectors = [[True, banks_sector_size, 0, 0, "bnk"], [False, sounds_sector_size, 1, 0, "wem"], [False, externals_sector_size, 1, 1, "wem"]] 54 | 55 | # get langs in the file 56 | try: 57 | lang_array = get_langs(languages_sector_size) 58 | except Exception as e: 59 | raise Exception(f"failed to read languages, {e}, {traceback.format_exc()}") 60 | 61 | # extract each sector 62 | curr_sector = None 63 | try: 64 | for sector in sectors: 65 | curr_sector = sector 66 | extract_sector(*sector[1:], endianness, lang_array, bank_version) 67 | 68 | if sector[0] and bank_version == 0: 69 | if externals_sector_size == 0: 70 | print("can't detect bank version") 71 | bank_version = 62 72 | except Exception as e: 73 | raise Exception(f"failed to extract sector {curr_sector}, {e}, {traceback.format_exc()}") 74 | 75 | return wwise_data 76 | 77 | def get_langs(langs_sector_size): 78 | string_offset = reader.GetBufferPos() 79 | lang_array = {} 80 | langs = reader.ReadLong() 81 | 82 | for i in range(langs): 83 | lang_offset = reader.ReadLong() 84 | lang_id = reader.ReadLong() 85 | 86 | lang_offset += string_offset 87 | 88 | current = reader.GetBufferPos() 89 | 90 | reader.SetBufferPos(lang_offset) 91 | 92 | # get dummy bytes to detect encoding 93 | test_byte_1 = reader.ReadBytes(1) 94 | test_byte_2 = reader.ReadBytes(1) 95 | 96 | reader.SetBufferPos(lang_offset) 97 | 98 | if test_byte_1 == 0 or test_byte_2 == 0: 99 | lang_name = reader.ReadBytes(0x20).decode("utf-16le", "ignore").replace("\x00", "") 100 | else: 101 | lang_name = reader.ReadBytes(0x10).decode("utf-8", "ignore").replace("\x00", "") 102 | 103 | lang_array[lang_id] = lang_name 104 | 105 | reader.SetBufferPos(current) 106 | 107 | reader.SetBufferPos(string_offset + langs_sector_size) 108 | 109 | return lang_array 110 | 111 | def detect_bank_version(offset): 112 | global bank_version 113 | 114 | current = reader.GetBufferPos() 115 | reader.SetBufferPos(offset) 116 | 117 | # maybe update buffer pos instead 118 | dummy = reader.ReadLong() 119 | dummy = reader.ReadLong() 120 | 121 | bank_version = reader.ReadLong() 122 | 123 | if bank_version > 0x1000: 124 | print("wrong bank version") 125 | bank_version = 62 126 | 127 | reader.SetBufferPos(current) 128 | 129 | def extract_sector(section_size, is_sounds, is_externals, ext, endianness, lang_array, bank_version, filter_bnk_only=0, filter_wem_only=0, include_name=False): 130 | global wwise_data 131 | 132 | # check sector validity 133 | if section_size == 0: 134 | return 135 | files = reader.ReadLong() 136 | if files == 0: 137 | return 138 | 139 | entry_size = (section_size - 0x04) / files 140 | 141 | if entry_size == 0x18: 142 | alt_mode = 1 143 | else: 144 | alt_mode = 0 145 | 146 | for i in range(files): 147 | # ids must be unsigned here, if signed you need to do id += 2**32 afterwards 148 | if alt_mode == 1 and is_externals == 1: 149 | if endianness == 0: 150 | file_id_2 = reader.ReadULong() 151 | file_id_1 = reader.ReadULong() 152 | else: 153 | file_id_1 = reader.ReadULong() 154 | file_id_2 = reader.ReadULong() 155 | else: 156 | file_id = reader.ReadULong() 157 | 158 | block_size = reader.ReadLong() 159 | 160 | # get file size 161 | if alt_mode == 1 and is_externals == 1: 162 | size = reader.ReadLong() 163 | elif alt_mode == 1: 164 | size = reader.ReadLongLong() 165 | else: 166 | size = reader.ReadLong() 167 | 168 | offset = reader.ReadLong() 169 | lang_id = reader.ReadLong() 170 | 171 | if block_size != 0: 172 | offset *= block_size 173 | 174 | # bank version must be detected at this offset 175 | if is_sounds == 0 and bank_version == 0: 176 | detect_bank_version(offset) 177 | 178 | # update extension for olders banks using differents codecs 179 | if is_sounds == 1 and bank_version < 62: 180 | current = reader.GetBufferPos() 181 | 182 | codec_offset = offset + 0x14 183 | reader.SetBufferPos(codec_offset) 184 | 185 | codec = reader.ReadInt16() 186 | 187 | if codec == 0x0401 or codec == 0x0166: 188 | ext = "xma" 189 | elif codec == 0xFFFF: 190 | ext = "ogg" 191 | else: 192 | ext = "wav" 193 | 194 | reader.SetBufferPos(current) 195 | 196 | # set file path 197 | if lang_id == 0: 198 | path = "" 199 | else: 200 | path = "".join([f"{e}/" for e in list(lang_array.values())]) 201 | 202 | # set file name 203 | if alt_mode == 1 and is_externals == 1: 204 | name = f"externals/{path}{file_id_1:08x}{file_id_2:08x}.{ext}" 205 | else: 206 | name = f"{path}{file_id}.{ext}" 207 | 208 | # filtering utilities 209 | if filter_bnk_only == 1 and ext != "bnk": 210 | continue 211 | 212 | if filter_wem_only == 1 and ext != "wem": 213 | continue 214 | 215 | # file infos 216 | if ext == "bnk": 217 | # get data from bnk 218 | pos = reader.GetBufferPos() 219 | reader.SetBufferPos(offset) 220 | bnk_data = reader.ReadBytes(size) 221 | reader.SetBufferPos(pos) 222 | 223 | wems = bnk2wem(bnk_data, f"{filename}@{pos}.{size}") 224 | 225 | for wem in wems: 226 | wwise_data.append([f"{os.path.basename(name).split('.')[0]}_{wem[0]}.wem", offset+wem[1], wem[2], filename]) 227 | else: 228 | wwise_data.append([os.path.basename(name), offset, size, filename]) 229 | -------------------------------------------------------------------------------- /wwise.py: -------------------------------------------------------------------------------- 1 | # wwise riff header parser 2 | # thanks to hcs and bnnm work 3 | 4 | def parse_wwise(reader): 5 | # default meta config 6 | metadata = { 7 | "format": 0, 8 | "channels": 0, 9 | "sampleRate": 0, 10 | "avgBitrate": 0, 11 | "blockSize": 0, 12 | "bitsPerSample": 0, 13 | "extraSize": 0, 14 | "channelLayout": None, 15 | "channelType": None, 16 | "codec": None, 17 | "codecDisplay": None, 18 | "layoutType": None, 19 | "interleaveBlockSize": None, 20 | "numSamples": None, 21 | "duration": 0 22 | } 23 | 24 | if reader.GetStreamLength() == 0: 25 | print(f"[WARNING] null stream size at {reader.GetName()}, unreadable block") 26 | return None 27 | 28 | header = reader.ReadBytes(4) 29 | 30 | # endian check header 31 | if header == b"RIFX": 32 | reader.endianness = "big" 33 | elif header == b"RIFF": 34 | reader.endianness = "little" 35 | else: 36 | print(f"[WARNING] invalid header {header} at {reader.GetName()}, assuming unreadable") 37 | return None 38 | 39 | # additional check 40 | reader.SetBufferPos(0x08) 41 | check = reader.ReadBytes(4) 42 | 43 | if check != b"WAVE" and check != "XWMA": 44 | print(f"[WARNING] invalid check mark {check}, assuming unreadable") 45 | return None 46 | 47 | # read chunks 48 | reader.SetBufferPos(0x0C) 49 | 50 | chunks = {} 51 | 52 | while reader.GetBufferPos() < reader.GetStreamLength(): 53 | chunk_type = reader.ReadBytes(4) 54 | 55 | if chunk_type not in [b"fmt ", b"JUNK", b"data", b"akd ", b"cue ", b"LIST", b"smpl"]: 56 | print(f"[WARNING] unexpected chunk {chunk_type} at {reader.GetName()}") 57 | 58 | formatted_chunk_type = chunk_type.decode("utf-8").replace(" ", "") 59 | chunk_length = reader.ReadUInt32() 60 | 61 | if chunk_length > reader.GetRemainingLength(): 62 | chunk_length = reader.GetRemainingLength() 63 | 64 | chunks[formatted_chunk_type] = { 65 | "length": chunk_length, 66 | "offset": reader.GetBufferPos(), 67 | "data": reader.ReadBytes(chunk_length) 68 | } 69 | 70 | # reader fmt header 71 | fmt_length = chunks["fmt"]["length"] 72 | if fmt_length < 0x10: 73 | print(f"[WARNING] invalid fmt chunk length {fmt_length} at {reader.GetName()}, skipping") 74 | return None 75 | 76 | reader.SetBufferPos(chunks["fmt"]["offset"]) 77 | 78 | metadata["format"] = reader.ReadUInt16() 79 | metadata["channels"] = reader.ReadUInt16() 80 | metadata["sampleRate"] = reader.ReadUInt32() 81 | metadata["avgBitrate"] = reader.ReadUInt32() 82 | metadata["blockSize"] = reader.ReadUInt16() 83 | metadata["bitsPerSample"] = reader.ReadUInt16() 84 | 85 | if chunks["fmt"]["length"] > 0x10 and metadata["format"] != 0x0165 and metadata["format"] != 0x0166: 86 | metadata["extraSize"] = reader.ReadUInt16() 87 | 88 | if metadata["extraSize"] >= 0x06: 89 | metadata["channelLayout"] = reader.ReadUInt32() 90 | 91 | if metadata["channelLayout"] & 0xFF == metadata["channels"]: 92 | metadata["channelType"] = (metadata["channelLayout"] >> 8) & 0x0F 93 | metadata["channelLayout"] = metadata["channelLayout"] >> 12 94 | 95 | if metadata["format"] == 0x0166: 96 | print(f"[WARNING] XMA2WAVEFORMATEX in fmt at {reader.GetName()}") 97 | return None 98 | 99 | # parse codec 100 | codecs = { 101 | 0x0001: "PCM", 102 | 0x0002: "IMA", 103 | 0x0069: "IMA", 104 | 0x0161: "XWLA", 105 | 0x0162: "XWMA", 106 | 0x0165: "XMA2", 107 | 0x0166: "XMA2", 108 | 0xAAC0: "AAC", 109 | 0xFFF0: "DSP", 110 | 0xFFFB: "HEVAG", 111 | 0xFFFC: "ATRAC9", 112 | 0xFFFE: "PCM", 113 | 0xFFFF: "VORBIS", 114 | 0x3039: "OPUSNX", 115 | 0x3040: "OPUS", 116 | 0x3041: "OPUSWW", 117 | 0x8311: "PTADPCM" 118 | } 119 | 120 | # genshin should be *mostly* PTADPCM 121 | # hsr and zzz should be VORBIS 122 | 123 | if metadata["format"] not in codecs: 124 | print(f'[WARNING] unknown codec {metadata["format"]} at {reader.GetName()}') 125 | return None 126 | 127 | codec = codecs[metadata["format"]] 128 | 129 | if codec not in ["PTADPCM", "VORBIS"]: # Platinum "PtADPCM" custom ADPCM for Wwise 130 | print(f"[WARNING] unhandled codec {codec}, need to implement this later") 131 | 132 | metadata["codec"] = codec 133 | 134 | # codec name 135 | codecs_names = { 136 | "PTADPCM": "Platinum 4-bit ADPCM", 137 | "VORBIS": "Custom Vorbis" 138 | } 139 | 140 | if codec in codecs_names: 141 | metadata["codecDisplay"] = codecs_names[codec] 142 | else: 143 | metadata["codecDisplay"] = codec 144 | 145 | # parse duration 146 | if metadata["codec"] == "PTADPCM": 147 | metadata["layoutType"] = "interleave" 148 | metadata["interleaveBlockSize"] = metadata["blockSize"] // metadata["channels"] 149 | 150 | metadata["numSamples"] = int((chunks["data"]["length"] / (metadata["channels"] * metadata["interleaveBlockSize"])) * (2 + (metadata["interleaveBlockSize"] - 0x05) * 2)) 151 | metadata["duration"] = metadata["numSamples"] / metadata["sampleRate"] 152 | 153 | elif metadata["codec"] == "VORBIS": 154 | if (metadata["blockSize"] != 0 or metadata["bitsPerSample"] != 0): 155 | print(f"[WARNING] worbis type at {reader.GetName()}, skipping") 156 | return None 157 | 158 | if "vorb" in chunks: 159 | # vorb chunk only in wwise earlier to 2012, therefore impossible for mihoyo games 160 | print(f"[WARNING] found vorb chunk at {reader.GetName()}, is this the correct game ?") 161 | return None 162 | 163 | extra_offset = chunks["fmt"]["offset"] + 0x18 164 | 165 | if metadata["extraSize"] != 0x30: 166 | print(f"[WARNING] unknown extra wwise size at {reader.GetName()}, skipping") 167 | return None 168 | 169 | data_offset = 0x10 170 | blocks_offset = 0x28 171 | # define header to type 2, packet to modified and codebook to aoTuV603, required ? 172 | 173 | # this somehow breaks and don't read correctly, why :c 174 | # stream_size * 8 * sample_rate / num_samples = bitrate * 1000 175 | metadata["numSamples"] = reader.ReadInt32(extra_offset) 176 | setup_offset = reader.ReadUInt32(extra_offset + data_offset) 177 | audio_offset = reader.ReadUInt32(extra_offset + data_offset + 0x04) 178 | 179 | block_size_1_exp = reader.ReadUInt8(extra_offset + blocks_offset) 180 | block_size_0_exp = reader.ReadUInt8(extra_offset + blocks_offset + 0x01) 181 | # if both exp are equals and extra size is 0x30, then reset packet type to standard 182 | 183 | chunks["data"]["offset"] -= audio_offset 184 | 185 | # ignore packets update and codebooks parse attempts, not implemented 186 | metadata["layoutType"] = "none" 187 | metadata["duration"] = metadata["numSamples"] / metadata["sampleRate"] 188 | 189 | return metadata 190 | --------------------------------------------------------------------------------