Code Monkey home page Code Monkey logo

automatic-bars-patcher's Introduction

Automatic BARS patcher

A tool for patching BARS files when modding custom music into games that use BWAV files.

This is an improved version of the original BARS patcher that can automatically patch from full directories of BWAV files in one run.

What does this do?

Nintendo's modern Nintendo Switch games use BWAV audio files to store music and other audio data, but the information about those files is also stored in a separate BARS archive.

When replacing the BWAV files with your own custom files, you will also need to replace the information about the BWAV files in the BARS file.

This tool makes the process very easy, it can run directly on your Nintendo Switch and it has pre-made configurations with the file/directory paths for specific games.

Supported games

Currently, the only supported game is Animal Crossing: New Horizons.

You can add your own game configurations with the config file, see this page for more information about using the config file.

Usage

To use this tool, you will need these things:

  • An original legal copy of the game you are modding.
  • The dumped sound files from the game, including any updates. You can dump your game's files with nxdumptool, the BARS patcher's default configuration uses the default RomFS dump locations of nxdumptool. It's very important that your dumped files are from the same update version of the game that you will be using the mod with!
  • Custom BWAV files for the mod.

When you open the homebrew app, you will be asked to choose the game and to confirm or edit the paths for the needed directories and files.

  • "Original BARS file" should be the path to the original unmodified base BARS file in the dumped files of your game.
  • "Original BWAV folder" should be the path to the directory with the original unmodified BWAV files dumped from your game.
  • "Modded BWAV folder" should be the path to the directory where you store your custom BWAV files for the game.
  • "Patched BARS output" is the path to the location where the patched BARS file will be saved.

After confirming the settings, the patcher will run and show how many tracks it patched. If it finished without any errors, you can now exit the tool and the modded BWAV files should work in the game.

automatic-bars-patcher's People

Contributors

ic-scm avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

automatic-bars-patcher's Issues

Automatic Bars Patcher for sound files + problems.

ABP = Automatic Bars Patcher

So there's 2 things to address here.

  1. The ABP asks for the Original BWAV file. This is a problem because only Stream/BGM really have original BWAVs. Sound effects for everything in the game exist only in the respective BARS files.

I wrote a Python script that will parse a BARS file and extract all BWAVs, so I actually got my hands on what is technically THE original BWAV file to satisfy the ABP.

  1. Whether using ABP or the old online one here (https://smashcustommusic.net/onlinetools/bars-patcher/), the newly patched BARS file does not include my custom BWAV. It contains what appears to be the original BWAV file.....however, it's distorted sounding.

Since ABP asks for an original BWAV, what is the appropriate way to patch BARS files for sound effects? If I did it correctly by extracting the BWAV from the BARS file and feeding it to ABP, what is the cause for the new BARS file not including the new BWAV file, but a distorted copy of the original?

ACNH 7PM/6PM (sunny only?) unique incompatibility

Having the 6 PM hourlies (from ACNH) renamed to instead play at 7 PM, causes broken audio playback, with no apparent differences in the file known, having checked in HxD, even if said files are converted to .wav, then back to .bwav.
In-game, it sounds like both channels of stereo are playing the same song at different points. Shortly after this occurs, the game softlocks/freezes & crashes, along with audio stuttering.
The ACNH 5 PM playing at 6 PM plays normally, maybe worth noting?
Any conversions I did were done using openrevolution, I have not experienced any other crashes using other tracks during 7PM, or otherwise to my memory.

2021012619392301-02CB906EA538A35643C1E1484C4B947D.mp4

Error I/O

i keep getting this error no matter what i do i am trying to do a music mod for splatoon at first it was successful and now i keep getting this error now
image_2023-02-23_164211609

Patched ACNH music in indoor areas crashes game

When I try to patch in new music files for indoor areas such as the airport or town hall, ACNH crashes when I try to enter those areas. I've paid close attention to making sure the new files have the right amount of channels, so that should not be an issue.

I play ACNH v2.0.6 (emulated using Yuzu) and use the PC version of the ABP tool using a Linux Mint virtual machine, in case this matters.

Compiler Error When Running build.sh

I'm a bit of a newbie with C++, and I'm not sure if I'm doing something wrong, but when I try to run 'build.sh', nothing happens, and when I run it on the Terminal, I get the following compiler error:

`PS C:\Users\MYUSERNAME\Downloads\automatic-bars-patcher-1.0.0\automatic-bars-patcher-1.0.0\pc> g++ -O2 -pipe main.cpp -o auto_bars_patcher -Wall -Wextra

In file included from main.cpp:9:
../bars-patcher-core/bars-patcher.h: In function 'unsigned char barspatcher_run(bool, const char*, const char*, const char*, const char*)':
../bars-patcher-core/bars-patcher.h:101:5: error: 'uint64_t' was not declared in this scope
101 | uint64_t bars_size;
| ^~~~~~~~
../bars-patcher-core/bars-patcher.h:22:1: note: 'uint64_t' is defined in header ''; did you forget to '#include '?
21 | #include <dirent.h>
+++ |+#include
22 | #elif defined BARSPATCHER_VERSION_NX
../bars-patcher-core/bars-patcher.h:111:9: error: 'bars_size' was not declared in this scope
111 | bars_size = ifile.tellg();
| ^~~~~~~~~
../bars-patcher-core/bars-patcher.h:147:5: error: 'uint16_t' was not declared in this scope
147 | uint16_t mod_dir_list_count = 0;
| ^~~~~~~~
../bars-patcher-core/bars-patcher.h:147:5: note: 'uint16_t' is defined in header ''; did you forget to '#include '?
../bars-patcher-core/bars-patcher.h:163:27: error: 'struct dirent' has no member named 'd_type'
163 | if(mod_dir_entry->d_type != DT_REG) continue;
| ^~~~~~
../bars-patcher-core/bars-patcher.h:163:37: error: 'DT_REG' was not declared in this scope
163 | if(mod_dir_entry->d_type != DT_REG) continue;
| ^~~~~~
../bars-patcher-core/bars-patcher.h:165:22: error: 'mod_dir_list_count' was not declared in this scope; did you mean 'mod_dir_list'?
165 | mod_dir_list[mod_dir_list_count] = (char*)malloc(strlen(mod_dir_entry->d_name)+1);
| ^~~~~~~~~~~~~~~~~~
| mod_dir_list
../bars-patcher-core/bars-patcher.h:173:25: error: expected ';' before 'i'
173 | for(uint16_t i=0; mod_dir_list[i] != NULL; i++) free(mod_dir_list[i]);
| ^~
| ;
../bars-patcher-core/bars-patcher.h:173:44: error: 'i' was not declared in this scope
173 | for(uint16_t i=0; mod_dir_list[i] != NULL; i++) free(mod_dir_list[i]);
| ^
../bars-patcher-core/bars-patcher.h:191:25: error: expected ';' before 'i'
191 | for(uint16_t i=0; mod_dir_list[i] != NULL; i++) free(mod_dir_list[i]);
| ^~
| ;
../bars-patcher-core/bars-patcher.h:191:44: error: 'i' was not declared in this scope
191 | for(uint16_t i=0; mod_dir_list[i] != NULL; i++) free(mod_dir_list[i]);
| ^
../bars-patcher-core/bars-patcher.h:200:8: error: 'mod_dir_list_count' was not declared in this scope; did you mean 'mod_dir_list'?
200 | if(mod_dir_list_count == 0) {
| ^~~~~~~~~~~~~~~~~~
| mod_dir_list
../bars-patcher-core/bars-patcher.h:211:13: error: expected ';' before 'patched_files'
211 | uint16_t patched_files = 0, skipped_files = 0;
| ^~~~~~~~~~~~~~
| ;
../bars-patcher-core/bars-patcher.h:235:17: error: expected ';' before 'entry'
235 | for(uint16_t entry=0; mod_dir_list[entry] != NULL; entry++) {
| ^~~~~~
| ;
../bars-patcher-core/bars-patcher.h:235:40: error: 'entry' was not declared in this scope
235 | for(uint16_t entry=0; mod_dir_list[entry] != NULL; entry++) {
| ^~~~~
../bars-patcher-core/bars-patcher.h:241:17: error: expected ';' before 'og_bwav_size'
241 | uint64_t og_bwav_size;
| ^~~~~~~~~~~~~
| ;
../bars-patcher-core/bars-patcher.h:248:17: error: 'skipped_files' was not declared in this scope
248 | skipped_files++;
| ^~~~~~~~~~~~~
../bars-patcher-core/bars-patcher.h:257:25: error: expected ';' before 'i'
257 | for(uint16_t i=0; mod_dir_list[i] != NULL; i++) free(mod_dir_list[i]);
| ^~
| ;
../bars-patcher-core/bars-patcher.h:257:44: error: 'i' was not declared in this scope
257 | for(uint16_t i=0; mod_dir_list[i] != NULL; i++) free(mod_dir_list[i]);
| ^
../bars-patcher-core/bars-patcher.h:263:17: error: expected ';' before 'mod_bwav_size'
263 | uint64_t mod_bwav_size;
| ^~~~~~~~~~~~~~
| ;
../bars-patcher-core/bars-patcher.h:272:25: error: expected ';' before 'i'
272 | for(uint16_t i=0; mod_dir_list[i] != NULL; i++) free(mod_dir_list[i]);
| ^~
| ;
../bars-patcher-core/bars-patcher.h:272:44: error: 'i' was not declared in this scope
272 | for(uint16_t i=0; mod_dir_list[i] != NULL; i++) free(mod_dir_list[i]);
| ^
../bars-patcher-core/bars-patcher.h:278:9: error: 'og_bwav_size' was not declared in this scope; did you mean 'og_bwav_data'?
278 | og_bwav_size = og_bwav.tellg();
| ^~~~~~~~~~~~
| og_bwav_data
../bars-patcher-core/bars-patcher.h:279:9: error: 'mod_bwav_size' was not declared in this scope; did you mean 'mod_bwav_data'?
279 | mod_bwav_size = mod_bwav.tellg();
| ^~~~~~~~~~~~~
| mod_bwav_data
../bars-patcher-core/bars-patcher.h:296:25: error: expected ';' before 'i'
296 | for(uint16_t i=0; mod_dir_list[i] != NULL; i++) free(mod_dir_list[i]);
| ^~
| ;
../bars-patcher-core/bars-patcher.h:296:44: error: 'i' was not declared in this scope
296 | for(uint16_t i=0; mod_dir_list[i] != NULL; i++) free(mod_dir_list[i]);
| ^
../bars-patcher-core/bars-patcher.h:308:13: error: 'skipped_files' was not declared in this scope
308 | skipped_files++;
| ^~~~~~~~~~~~~
../bars-patcher-core/bars-patcher.h:313:13: error: 'skipped_files' was not declared in this scope
313 | skipped_files++;
| ^~~~~~~~~~~~~
../bars-patcher-core/bars-patcher.h:327:17: error: expected ';' before 'og_bwav_chnum'
327 | uint16_t og_bwav_chnum, mod_bwav_chnum;
| ^~~~~~~~~~~~~~
| ;
../bars-patcher-core/bars-patcher.h:328:9: error: 'og_bwav_chnum' was not declared in this scope; did you mean 'og_bwav_bom'?
328 | og_bwav_chnum = barspatcher_getSliceAsNumber(slice_output, og_bwav_data, 0x0E, 2, og_bwav_bom);
| ^~~~~~~~~~~~~
| og_bwav_bom
../bars-patcher-core/bars-patcher.h:329:9: error: 'mod_bwav_chnum' was not declared in this scope; did you mean 'mod_bwav_bom'?
329 | mod_bwav_chnum = barspatcher_getSliceAsNumber(slice_output, mod_bwav_data, 0x0E, 2, mod_bwav_bom);
| ^~~~~~~~~~~~~~
| mod_bwav_bom
../bars-patcher-core/bars-patcher.h:333:13: error: 'skipped_files' was not declared in this scope
333 | skipped_files++;
| ^~~~~~~~~~~~~
../bars-patcher-core/bars-patcher.h:338:9: error: 'uint32_t' was not declared in this scope
338 | uint32_t og_bwav_crc32;
| ^~~~~~~~
../bars-patcher-core/bars-patcher.h:338:9: note: 'uint32_t' is defined in header ''; did you forget to '#include '?
../bars-patcher-core/bars-patcher.h:339:9: error: 'uint8_t' was not declared in this scope
339 | uint8_t og_bwav_crc32_bytes[4];
| ^~~~~~~
../bars-patcher-core/bars-patcher.h:339:9: note: 'uint8_t' is defined in header ''; did you forget to '#include '?
../bars-patcher-core/bars-patcher.h:342:16: error: 'og_bwav_crc32_bytes' was not declared in this scope
342 | memcpy(og_bwav_crc32_bytes, slice_output, 4);
| ^~~~~~~~~~~~~~~~~~~
../bars-patcher-core/bars-patcher.h:343:9: error: 'og_bwav_crc32' was not declared in this scope; did you mean 'og_bwav_bom'?
343 | og_bwav_crc32 = barspatcher_getSliceAsNumber(slice_output, og_bwav_crc32_bytes, 0, 4, og_bwav_bom);
| ^~~~~~~~~~~~~
| og_bwav_bom
../bars-patcher-core/bars-patcher.h:346:17: error: expected ';' before 'patch_length'
346 | uint32_t patch_length = 0x10 + 0x4Cmod_bwav_chnum;
| ^~~~~~~~~~~~~
| ;
../bars-patcher-core/bars-patcher.h:347:12: error: 'patch_length' was not declared in this scope
347 | if(patch_length > BARSPATCHER_MODBWAV_MEMBLOCK_SIZE) {
| ^~~~~~~~~~~~
../bars-patcher-core/bars-patcher.h:349:13: error: 'skipped_files' was not declared in this scope
349 | skipped_files++;
| ^~~~~~~~~~~~~
../bars-patcher-core/bars-patcher.h:357:17: error: expected ';' before 'patches_written'
357 | uint16_t patches_written = 0;
| ^~~~~~~~~~~~~~~~
| ;
../bars-patcher-core/bars-patcher.h:358:17: error: expected ';' before 'c'
358 | uint16_t c;
| ^~
| ;
../bars-patcher-core/bars-patcher.h:361:21: error: expected ';' before 'bars_pos'
361 | for(uint32_t bars_pos=0; bars_pos < bars_size; bars_pos++) {
| ^~~~~~~~~
| ;
../bars-patcher-core/bars-patcher.h:361:34: error: 'bars_pos' was not declared in this scope
361 | for(uint32_t bars_pos=0; bars_pos < bars_size; bars_pos++) {
| ^~~~~~~~
../bars-patcher-core/bars-patcher.h:361:45: error: 'bars_size' was not declared in this scope
361 | for(uint32_t bars_pos=0; bars_pos < bars_size; bars_pos++) {
| ^~~~~~~~~
../bars-patcher-core/bars-patcher.h:363:17: error: 'c' was not declared in this scope
363 | for(c = 0; c < 4; c++) {
| ^
../bars-patcher-core/bars-patcher.h:372:25: error: expected ';' before 'bars_bwav_offset'
372 | uint32_t bars_bwav_offset = bars_pos - 0x08;
| ^~~~~~~~~~~~~~~~~
| ;
../bars-patcher-core/bars-patcher.h:373:65: error: 'bars_bwav_offset' was not declared in this scope
373 | if(verbose) printf("Found at 0x%08X in BARS, ", bars_bwav_offset);
| ^~~~~~~~~~~~~~~~
../bars-patcher-core/bars-patcher.h:375:32: error: 'bars_bwav_offset' was not declared in this scope
375 | if(bars_size - bars_bwav_offset < patch_length) {
| ^~~~~~~~~~~~~~~~
../bars-patcher-core/bars-patcher.h:375:51: error: 'patch_length' was not declared in this scope
375 | if(bars_size - bars_bwav_offset < patch_length) {
| ^~~~~~~~~~~~
../bars-patcher-core/bars-patcher.h:381:29: error: expected ';' before 'i'
381 | for(uint32_t i=0; i < patch_length; i++) {
| ^~
| ;
../bars-patcher-core/bars-patcher.h:381:35: error: 'i' was not declared in this scope
381 | for(uint32_t i=0; i < patch_length; i++) {
| ^
../bars-patcher-core/bars-patcher.h:381:39: error: 'patch_length' was not declared in this scope
381 | for(uint32_t i=0; i < patch_length; i++) {
| ^~~~~~~~~~~~
../bars-patcher-core/bars-patcher.h:382:31: error: 'bars_bwav_offset' was not declared in this scope
382 | bars_data[bars_bwav_offset + i] = mod_bwav_data[i];
| ^~~~~~~~~~~~~~~~
../bars-patcher-core/bars-patcher.h:386:17: error: 'patches_written' was not declared in this scope
386 | patches_written++;
| ^~~~~~~~~~~~~~~
../bars-patcher-core/bars-patcher.h:393:12: error: 'patches_written' was not declared in this scope
393 | if(patches_written > 0) patched_files++;
| ^~~~~~~~~~~~~~~
../bars-patcher-core/bars-patcher.h:393:33: error: 'patched_files' was not declared in this scope
393 | if(patches_written > 0) patched_files++;
| ^~~~~~~~~~~~~
../bars-patcher-core/bars-patcher.h:395:13: error: 'skipped_files' was not declared in this scope
395 | skipped_files++;
| ^~~~~~~~~~~~~
../bars-patcher-core/bars-patcher.h:400:8: error: 'patched_files' was not declared in this scope
400 | if(patched_files == 0) {
| ^~~~~~~~~~~~~
../bars-patcher-core/bars-patcher.h:405:21: error: expected ';' before 'i'
405 | for(uint16_t i=0; mod_dir_list[i] != NULL; i++) free(mod_dir_list[i]);
| ^~
| ;
../bars-patcher-core/bars-patcher.h:405:40: error: 'i' was not declared in this scope
405 | for(uint16_t i=0; mod_dir_list[i] != NULL; i++) free(mod_dir_list[i]);
| ^
../bars-patcher-core/bars-patcher.h:418:21: error: expected ';' before 'i'
418 | for(uint16_t i=0; mod_dir_list[i] != NULL; i++) free(mod_dir_list[i]);
| ^~
| ;
../bars-patcher-core/bars-patcher.h:418:40: error: 'i' was not declared in this scope
418 | for(uint16_t i=0; mod_dir_list[i] != NULL; i++) free(mod_dir_list[i]);
| ^
../bars-patcher-core/bars-patcher.h:423:35: error: 'bars_size' was not declared in this scope
423 | ofile.write((char
)bars_data, bars_size);
| ^~~~~~~~~
../bars-patcher-core/bars-patcher.h:431:21: error: expected ';' before 'i'
431 | for(uint16_t i=0; mod_dir_list[i] != NULL; i++) free(mod_dir_list[i]);
| ^~
| ;
../bars-patcher-core/bars-patcher.h:431:40: error: 'i' was not declared in this scope
431 | for(uint16_t i=0; mod_dir_list[i] != NULL; i++) free(mod_dir_list[i]);
| ^
../bars-patcher-core/bars-patcher.h:439:57: error: 'patched_files' was not declared in this scope
439 | printf("%d track%s patched, %d track%s skipped.\n", patched_files, (patched_files == 1 ? "" : "s"), skipped_files, (skipped_files == 1 ? "" : "s"));
| ^~~~~~~~~~~~~
../bars-patcher-core/bars-patcher.h:439:105: error: 'skipped_files' was not declared in this scope
439 | printf("%d track%s patched, %d track%s skipped.\n", patched_files, (patched_files == 1 ? "" : "s"), skipped_files, (skipped_files == 1 ? "" : "s"));
| ^~~~~~~~~~~~~
../bars-patcher-core/bars-patcher.h:443:17: error: expected ';' before 'i'
443 | for(uint16_t i=0; mod_dir_list[i] != NULL; i++) free(mod_dir_list[i]);
| ^~
| ;
../bars-patcher-core/bars-patcher.h:443:36: error: 'i' was not declared in this scope
443 | for(uint16_t i=0; mod_dir_list[i] != NULL; i++) free(mod_dir_list[i]);
| ^`

Where am I going wrong?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.