Hacking Help hacPack repacking failed

WindyXu

Member
OP
Newcomer
Joined
Aug 25, 2022
Messages
8
Trophies
0
Location
Los Angeles
XP
46
Country
United States
I don't know exactly what went wrong so I will briefly introduce the whole process

Step1. Unpacking, using the tool: NCA-NSP-XCI_TO_LayeredFS_v1.6
  1. NSP extract, get tik and nca files
  2. Use the above tik to split the biggest nca file into exefs and romfs

Step2. modified and replaced part of the files inside the above romfs

Step3. Repacking, using the tool: hacpack GUI 1.36
  1. Set up the output path, keys file, title ID, exefs folder path, romfs folder path
  2. Click Build NCA

If I don't do the second step of the modification and directly repacking, everything works fine.

However, if I do the second step, replacing some files in the romfs. Repacking will fail.

The hacpack GUI performance is getting nothing in log box, and then there is only a pragram.nca file which size is only about 9MB in the output dir.

Because the GUI did not have any hints, I repack it again with the command line, here is the output

Code:
----> Preparing:
[WARN]: Failed to match key "xci_header_key", (value "01C58FE7002D135AB29A3F69339574B1")
[WARN]: Failed to match key "bis_kek_source", (value "34c1a0c48258f8b4fa9e5e6adafc7e4f")
[WARN]: Failed to match key "eticket_rsa_kek", (value "19c8b441d318802bad63a5beda283a84")
[WARN]: Failed to match key "eticket_rsa_kek_source", (value "dba451124ca0a9836814f5ed95e3125b")
[WARN]: Failed to match key "eticket_rsa_kekek_source", (value "466e57b74a447f02f321cde58f2f5535")
[WARN]: Failed to match key "per_console_key_source", (value "4f025f0eb66d110edc327d4186c2f478")
[WARN]: Failed to match key "retail_specific_aes_key_source", (value "e2d6b87a119cb880e822888a46fba195")
[WARN]: Failed to match key "rsa_oaep_kek_generation_source", (value "a8ca938434127fda82cc1aa5e807b112")
[WARN]: Failed to match key "rsa_private_kek_generation_source", (value "ef2cb61a56729b9157c38b9316784ddd")
[WARN]: Failed to match key "save_mac_key", (value "536b210e185bccae8e36c622891bf7f6")
[WARN]: Failed to match key "sd_seed", (value "fd324d2dcf64f196f78b83f66786f71d")
[WARN]: Failed to match key "ssl_rsa_kek", (value "b011100660d1dccbad1b1b733afa9f95")
[WARN]: Failed to match key "ssl_rsa_kek_source_x", (value "7f5bb0847b25aa67fac84be23d7b6903")
[WARN]: Failed to match key "ssl_rsa_kek_source_y", (value "9a383bf431d0bd8132534ba964397de3")
Removing existing temp directory
Creating temp directory
Creating out directory
Creating backup directory

----> Processing NPDM
Validating NPDM
Backing up main.npdm
Zeroing ACID sig
Zeroing ACID key

----> Creating Program NCA:
===> Creating NCA header
Writing NCA header placeholder to C:\Users\Administrator\Desktop\output\Program.nca

---> Creating Section 0:
===> Building ExeFS
Writing C:\Users\Administrator\Desktop\Extracted_NCA\exefs\main to hacpack_temp\program_sec0_exefs
Writing C:\Users\Administrator\Desktop\Extracted_NCA\exefs\main.npdm to hacpack_temp\program_sec0_exefs
Writing C:\Users\Administrator\Desktop\Extracted_NCA\exefs\rtld to hacpack_temp\program_sec0_exefs
Writing C:\Users\Administrator\Desktop\Extracted_NCA\exefs\sdk to hacpack_temp\program_sec0_exefs
Calculating hash table

===> Writing ExeFS
Writing PFS0 hash table
Writing PFS0

===> Calculating Hashes:
Calculating Master hash
Calculating Section hash

---> Creating Section 1:
===> Building RomFS
Visiting directories
Calculating metadata


And the log without second step(Everything is performed well)
Code:
----> Preparing:
Removing existing temp directory
Creating temp directory
Creating out directory
Creating backup directory

----> Processing NPDM
Validating NPDM
Backing up main.npdm
Zeroing ACID sig
Zeroing ACID key

----> Creating Program NCA:
===> Creating NCA header
Writing NCA header placeholder to C:\Users\Administrator\Desktop\output\Program.nca

---> Creating Section 0:
===> Building ExeFS
Writing C:\Users\Administrator\Desktop\Extracted_NCA1\exefs\main to hacpack_temp\program_sec0_exefs
Writing C:\Users\Administrator\Desktop\Extracted_NCA1\exefs\main.npdm to hacpack_temp\program_sec0_exefs
Writing C:\Users\Administrator\Desktop\Extracted_NCA1\exefs\rtld to hacpack_temp\program_sec0_exefs
Writing C:\Users\Administrator\Desktop\Extracted_NCA1\exefs\sdk to hacpack_temp\program_sec0_exefs
Calculating hash table

===> Writing ExeFS
Writing PFS0 hash table
Writing PFS0

===> Calculating Hashes:
Calculating Master hash
Calculating Section hash

---> Creating Section 1:
===> Building RomFS
Visiting directories
Calculating metadata
Writing C:\Users\Administrator\Desktop\Extracted_NCA1\romfs\Data\NX\TestBin.bin to hacpack_temp\program_sec1_ivfc_lvl6
Writing C:\Users\Administrator\Desktop\Extracted_NCA1\romfs\Data\NX\datatable\don3d_anim.bin to hacpack_temp\program_sec1_ivfc_lvl6
Writing C:\Users\Administrator\Desktop\Extracted_NCA1\romfs\Data\NX\datatable\don_color.bin to hacpack_temp\program_sec1_ivfc_lvl6
Writing C:\Users\Administrator\Desktop\Extracted_NCA1\romfs\Data\NX\datatable\don_cos.bin to hacpack_temp\program_sec1_ivfc_lvl6
Writing C:\Users\Administrator\Desktop\Extracted_NCA1\romfs\Data\NX\datatable\enso_chara.bin to hacpack_temp\program_sec1_ivfc_lvl6
Writing C:\Users\Administrator\Desktop\Extracted_NCA1\romfs\Data\NX\datatable\enso_post.bin to hacpack_temp\program_sec1_ivfc_lvl6
Writing C:\Users\Administrator\Desktop\Extracted_NCA1\romfs\Data\NX\datatable\enso_rand_part.bin to hacpack_temp\program_sec1_ivfc_lvl6
Writing C:\Users\Administrator\Desktop\Extracted_NCA1\romfs\Data\NX\datatable\general.bin to hacpack_temp\program_sec1_ivfc_lvl6
Writing C:\Users\Administrator\Desktop\Extracted_NCA1\romfs\Data\NX\datatable\minigame_info.bin to hacpack_temp\program_sec1_ivfc_lvl6
Writing C:\Users\Administrator\Desktop\Extracted_NCA1\romfs\Data\NX\datatable\musicinfo.bin to hacpack_temp\program_sec1_ivfc_lvl6
Writing C:\Users\Administrator\Desktop\Extracted_NCA1\romfs\Data\NX\datatable\neiro.bin to hacpack_temp\program_sec1_ivfc_lvl6
Writing C:\Users\Administrator\Desktop\Extracted_NCA1\romfs\Data\NX\datatable\shougou.bin to hacpack_temp\program_sec1_ivfc_lvl6
Writing C:\Users\Administrator\Desktop\Extracted_NCA1\romfs\Data\NX\datatable\tips.bin to hacpack_temp\program_sec1_ivfc_lvl6
Writing C:\Users\Administrator\Desktop\Extracted_NCA1\romfs\Data\NX\datatable\unlock_data.bin to hacpack_temp\program_sec1_ivfc_lvl6
Writing C:\Users\Administrator\Desktop\Extracted_NCA1\romfs\Data\NX\datatable\unusual_flash_list.bin to hacpack_temp\program_sec1_ivfc_lvl6
Writing C:\Users\Administrator\Desktop\Extracted_NCA1\romfs\Data\NX\datatable\wordlist.bin to hacpack_temp\program_sec1_ivfc_lvl6
Writing C:\Users\Administrator\Desktop\Extracted_NCA1\romfs\Data\NX\font\efigs_normal.nutexb to hacpack_temp\program_sec1_ivfc_lvl6
Writing C:\Users\Administrator\Desktop\Extracted_NCA1\romfs\Data\NX\font\efigs_normal.xml to hacpack_temp\program_sec1_ivfc_lvl6
Writing C:\Users\Administrator\Desktop\Extracted_NCA1\romfs\Data\NX\font\efigs_small.nutexb to hacpack_temp\program_sec1_ivfc_lvl6
Writing C:\Users\Administrator\Desktop\Extracted_NCA1\romfs\Data\NX\font\efigs_small.xml to hacpack_temp\program_sec1_ivfc_lvl6
Writing C:\Users\Administrator\Desktop\Extracted_NCA1\romfs\Data\NX\font\efigs_ui.nutexb to hacpack_temp\program_sec1_ivfc_lvl6
Writing C:\Users\Administrator\Desktop\Extracted_NCA1\romfs\Data\NX\font\efigs_ui.xml to hacpack_temp\program_sec1_ivfc_lvl6
Writing C:\Users\Administrator\Desktop\Extracted_NCA1\romfs\Data\NX\font\jp_normal.nutexb to hacpack_temp\program_sec1_ivfc_lvl6
Writing C:\Users\Administrator\Desktop\Extracted_NCA1\romfs\Data\NX\font\jp_normal.xml to hacpack_temp\program_sec1_ivfc_lvl6
Writing C:\Users\Administrator\Desktop\Extracted_NCA1\romfs\Data\NX\font\jp_small.nutexb to hacpack_temp\program_sec1_ivfc_lvl6
Writing C:\Users\Administrator\Desktop\Extracted_NCA1\romfs\Data\NX\font\jp_small.xml to hacpack_temp\program_sec1_ivfc_lvl6
Writing C:\Users\Administrator\Desktop\Extracted_NCA1\romfs\Data\NX\font\jp_ui.nutexb to hacpack_temp\program_sec1_ivfc_lvl6
Writing C:\Users\Administrator\Desktop\Extracted_NCA1\romfs\Data\NX\font\jp_ui.xml to hacpack_temp\program_sec1_ivfc_lvl6
....

It seems to be the Key's problem, I tried to change the key file but it didn't work.
 
Last edited by WindyXu,
  • Haha
Reactions: switchhunter666

binkinator

Garfield’s Fitness Coach
Member
GBAtemp Patron
Joined
Mar 29, 2021
Messages
6,511
Trophies
2
XP
6,155
Country
United States
I don't know exactly what went wrong so I will briefly introduce the whole process

Step1. Unpacking, using the tool: NCA-NSP-XCI_TO_LayeredFS_v1.6
  1. NSP extract, get tik and nca files
  2. Use the above tik to split the biggest nca file into exefs and romfs

Step2. modified and replaced part of the files inside the above romfs

Step3. Repacking, using the tool: hacpack GUI 1.36
  1. Set up the output path, keys file, title ID, exefs folder path, romfs folder path
  2. Click Build NCA

If I don't do the second step of the modification and directly repacking, everything works fine.

However, if I do the second step, replacing some files in the romfs. Repacking will fail.

The hacpack GUI performance is getting nothing in log box, and then there is only a pragram.nca file which size is only about 9MB in the output dir.

Because the GUI did not have any hints, I repack it again with the command line, here is the output

Code:
----> Preparing:
<redacted>
Removing existing temp directory
Creating temp directory
Creating out directory
Creating backup directory

----> Processing NPDM
Validating NPDM
Backing up main.npdm
Zeroing ACID sig
Zeroing ACID key

----> Creating Program NCA:
===> Creating NCA header
Writing NCA header placeholder to C:\Users\Administrator\Desktop\output\Program.nca

---> Creating Section 0:
===> Building ExeFS
Writing C:\Users\Administrator\Desktop\Extracted_NCA\exefs\main to hacpack_temp\program_sec0_exefs
Writing C:\Users\Administrator\Desktop\Extracted_NCA\exefs\main.npdm to hacpack_temp\program_sec0_exefs
Writing C:\Users\Administrator\Desktop\Extracted_NCA\exefs\rtld to hacpack_temp\program_sec0_exefs
Writing C:\Users\Administrator\Desktop\Extracted_NCA\exefs\sdk to hacpack_temp\program_sec0_exefs
Calculating hash table

===> Writing ExeFS
Writing PFS0 hash table
Writing PFS0

===> Calculating Hashes:
Calculating Master hash
Calculating Section hash

---> Creating Section 1:
===> Building RomFS
Visiting directories
Calculating metadata


And the log without second step(Everything is performed well)
Code:
----> Preparing:
Removing existing temp directory
Creating temp directory
Creating out directory
Creating backup directory

----> Processing NPDM
Validating NPDM
Backing up main.npdm
Zeroing ACID sig
Zeroing ACID key

----> Creating Program NCA:
===> Creating NCA header
Writing NCA header placeholder to C:\Users\Administrator\Desktop\output\Program.nca

---> Creating Section 0:
===> Building ExeFS
Writing C:\Users\Administrator\Desktop\Extracted_NCA1\exefs\main to hacpack_temp\program_sec0_exefs
Writing C:\Users\Administrator\Desktop\Extracted_NCA1\exefs\main.npdm to hacpack_temp\program_sec0_exefs
Writing C:\Users\Administrator\Desktop\Extracted_NCA1\exefs\rtld to hacpack_temp\program_sec0_exefs
Writing C:\Users\Administrator\Desktop\Extracted_NCA1\exefs\sdk to hacpack_temp\program_sec0_exefs
Calculating hash table

===> Writing ExeFS
Writing PFS0 hash table
Writing PFS0

===> Calculating Hashes:
Calculating Master hash
Calculating Section hash

---> Creating Section 1:
===> Building RomFS
Visiting directories
Calculating metadata
Writing C:\Users\Administrator\Desktop\Extracted_NCA1\romfs\Data\NX\TestBin.bin to hacpack_temp\program_sec1_ivfc_lvl6
Writing C:\Users\Administrator\Desktop\Extracted_NCA1\romfs\Data\NX\datatable\don3d_anim.bin to hacpack_temp\program_sec1_ivfc_lvl6
Writing C:\Users\Administrator\Desktop\Extracted_NCA1\romfs\Data\NX\datatable\don_color.bin to hacpack_temp\program_sec1_ivfc_lvl6
Writing C:\Users\Administrator\Desktop\Extracted_NCA1\romfs\Data\NX\datatable\don_cos.bin to hacpack_temp\program_sec1_ivfc_lvl6
Writing C:\Users\Administrator\Desktop\Extracted_NCA1\romfs\Data\NX\datatable\enso_chara.bin to hacpack_temp\program_sec1_ivfc_lvl6
Writing C:\Users\Administrator\Desktop\Extracted_NCA1\romfs\Data\NX\datatable\enso_post.bin to hacpack_temp\program_sec1_ivfc_lvl6
Writing C:\Users\Administrator\Desktop\Extracted_NCA1\romfs\Data\NX\datatable\enso_rand_part.bin to hacpack_temp\program_sec1_ivfc_lvl6
Writing C:\Users\Administrator\Desktop\Extracted_NCA1\romfs\Data\NX\datatable\general.bin to hacpack_temp\program_sec1_ivfc_lvl6
Writing C:\Users\Administrator\Desktop\Extracted_NCA1\romfs\Data\NX\datatable\minigame_info.bin to hacpack_temp\program_sec1_ivfc_lvl6
Writing C:\Users\Administrator\Desktop\Extracted_NCA1\romfs\Data\NX\datatable\musicinfo.bin to hacpack_temp\program_sec1_ivfc_lvl6
Writing C:\Users\Administrator\Desktop\Extracted_NCA1\romfs\Data\NX\datatable\neiro.bin to hacpack_temp\program_sec1_ivfc_lvl6
Writing C:\Users\Administrator\Desktop\Extracted_NCA1\romfs\Data\NX\datatable\shougou.bin to hacpack_temp\program_sec1_ivfc_lvl6
Writing C:\Users\Administrator\Desktop\Extracted_NCA1\romfs\Data\NX\datatable\tips.bin to hacpack_temp\program_sec1_ivfc_lvl6
Writing C:\Users\Administrator\Desktop\Extracted_NCA1\romfs\Data\NX\datatable\unlock_data.bin to hacpack_temp\program_sec1_ivfc_lvl6
Writing C:\Users\Administrator\Desktop\Extracted_NCA1\romfs\Data\NX\datatable\unusual_flash_list.bin to hacpack_temp\program_sec1_ivfc_lvl6
Writing C:\Users\Administrator\Desktop\Extracted_NCA1\romfs\Data\NX\datatable\wordlist.bin to hacpack_temp\program_sec1_ivfc_lvl6
Writing C:\Users\Administrator\Desktop\Extracted_NCA1\romfs\Data\NX\font\efigs_normal.nutexb to hacpack_temp\program_sec1_ivfc_lvl6
Writing C:\Users\Administrator\Desktop\Extracted_NCA1\romfs\Data\NX\font\efigs_normal.xml to hacpack_temp\program_sec1_ivfc_lvl6
Writing C:\Users\Administrator\Desktop\Extracted_NCA1\romfs\Data\NX\font\efigs_small.nutexb to hacpack_temp\program_sec1_ivfc_lvl6
Writing C:\Users\Administrator\Desktop\Extracted_NCA1\romfs\Data\NX\font\efigs_small.xml to hacpack_temp\program_sec1_ivfc_lvl6
Writing C:\Users\Administrator\Desktop\Extracted_NCA1\romfs\Data\NX\font\efigs_ui.nutexb to hacpack_temp\program_sec1_ivfc_lvl6
Writing C:\Users\Administrator\Desktop\Extracted_NCA1\romfs\Data\NX\font\efigs_ui.xml to hacpack_temp\program_sec1_ivfc_lvl6
Writing C:\Users\Administrator\Desktop\Extracted_NCA1\romfs\Data\NX\font\jp_normal.nutexb to hacpack_temp\program_sec1_ivfc_lvl6
Writing C:\Users\Administrator\Desktop\Extracted_NCA1\romfs\Data\NX\font\jp_normal.xml to hacpack_temp\program_sec1_ivfc_lvl6
Writing C:\Users\Administrator\Desktop\Extracted_NCA1\romfs\Data\NX\font\jp_small.nutexb to hacpack_temp\program_sec1_ivfc_lvl6
Writing C:\Users\Administrator\Desktop\Extracted_NCA1\romfs\Data\NX\font\jp_small.xml to hacpack_temp\program_sec1_ivfc_lvl6
Writing C:\Users\Administrator\Desktop\Extracted_NCA1\romfs\Data\NX\font\jp_ui.nutexb to hacpack_temp\program_sec1_ivfc_lvl6
Writing C:\Users\Administrator\Desktop\Extracted_NCA1\romfs\Data\NX\font\jp_ui.xml to hacpack_temp\program_sec1_ivfc_lvl6
....

It seems to be the Key's problem, I tried to change the key file but it didn't work.

Here is my key file
<Redacted>
Please delete the keys data. It is property of Nintendo and should not be posted on gbatemp.

It looks like a pretty old keys file because it doesn’t go up to “d”.

The key errors are normal. They are just specifying keys you have that they don’t know what to do with. You can test this by removing the lines from your keys file that pop up in the error. The next time you run it without those keys in your keys file it will run cleanly.

What is the end goal you are trying to achieve?
 
  • Like
Reactions: WindyXu

WindyXu

Member
OP
Newcomer
Joined
Aug 25, 2022
Messages
8
Trophies
0
Location
Los Angeles
XP
46
Country
United States
Please delete the keys data. It is property of Nintendo and should not be posted on gbatemp.

It looks like a pretty old keys file because it doesn’t go up to “d”.

The key errors are normal. They are just specifying keys you have that they don’t know what to do with. You can test this by removing the lines from your keys file that pop up in the error. The next time you run it without those keys in your keys file it will run cleanly.

What is the end goal you are trying to achieve?

Thanks for your answer.

I deleted the lines that were reporting errors, and now there are no more error messages, but the program still ends after "Calculating metadata".

微信图片_20220826091730.jpg



I want to modify some game content, but I can't package resource files back to nca format after modifying .

This is all I got from repacking

123.png
 

WindyXu

Member
OP
Newcomer
Joined
Aug 25, 2022
Messages
8
Trophies
0
Location
Los Angeles
XP
46
Country
United States
Please delete the keys data. It is property of Nintendo and should not be posted on gbatemp.

It looks like a pretty old keys file because it doesn’t go up to “d”.

The key errors are normal. They are just specifying keys you have that they don’t know what to do with. You can test this by removing the lines from your keys file that pop up in the error. The next time you run it without those keys in your keys file it will run cleanly.

What is the end goal you are trying to achieve?

Attaching my workflow


1. I have a game NSP file

2. I want to modify this game

3. I unpack the nsp into some nca files and a tik file.

4. I unpack the largest nca file into resource files (exefs dir and romfs dir) using the tik file above.

5. I made some changes to the resource files (to be precise, I added and replaced some files in the romfs directory).

6. I repackaged the resource files into nca files, but it failed. (Now I stopped at this step)

7. Repacking the nsp file based on the modified nca and tik. (and of course include some of the files got in step 3)

8. Install & Enjoy the modified game.
 

binkinator

Garfield’s Fitness Coach
Member
GBAtemp Patron
Joined
Mar 29, 2021
Messages
6,511
Trophies
2
XP
6,155
Country
United States
Thanks for your answer.

I deleted the lines that were reporting errors, and now there are no more error messages, but the program still ends after "Calculating metadata".

View attachment 324361


I want to modify some game content, but I can't package resource files back to nca format after modifying .

This is all I got from repacking

View attachment 324362
Attaching my workflow


1. I have a game NSP file

2. I want to modify this game

3. I unpack the nsp into some nca files and a tik file.

4. I unpack the largest nca file into resource files (exefs dir and romfs dir) using the tik file above.

5. I made some changes to the resource files (to be precise, I added and replaced some files in the romfs directory).

6. I repackaged the resource files into nca files, but it failed. (Now I stopped at this step)

7. Repacking the nsp file based on the modified nca and tik. (and of course include some of the files got in step 3)

8. Install & Enjoy the modified game.
that was just to prove that keys weren’t the issue. I chased that around myself one time until somebody pointed it out to me.

I’ve not done this extraction/compression process myself but it does look like there is an updated version of the extraction tools:

https://gbatemp.net/threads/extract...tool-for-layeredfs.511156/page-9#post-9504162

Have you tried it by not doing anything? Meaning, just extract everything, do not change anything, and simply package everything back up and try to play the game. The purpose would be to ensure your process is correct. It should just work with all stock files. Eliminate anything you are doing from the process and take it one small step at a time.
 
  • Like
Reactions: WindyXu

WindyXu

Member
OP
Newcomer
Joined
Aug 25, 2022
Messages
8
Trophies
0
Location
Los Angeles
XP
46
Country
United States
that was just to prove that keys weren’t the issue. I chased that around myself one time until somebody pointed it out to me.

I’ve not done this extraction/compression process myself but it does look like there is an updated version of the extraction tools:

Have you tried it by not doing anything? Meaning, just extract everything, do not change anything, and simply package everything back up and try to play the game. The purpose would be to ensure your process is correct. It should just work with all stock files. Eliminate anything you are doing from the process and take it one small step at a time.

Yes, I've tried that. The tools I used is also the updated version. If I don't do anything with the resource files (exefs dir and romfs dir) and just pack them back to NCA, everything works fine.It seems that my process and method is fine? But if I make some changes to the romfs dir, the packaging will fail. Maybe I should modify the contents of the romfs dir a little bit to determine exactly which file is causing the problem?

I don't have a clue, the repacking tools is supposed to just compress them together. Doing some replacements and modifications shouldn't cause the compression to fail. Or does the repacking tool also do something about validation?
 

WindyXu

Member
OP
Newcomer
Joined
Aug 25, 2022
Messages
8
Trophies
0
Location
Los Angeles
XP
46
Country
United States
that was just to prove that keys weren’t the issue. I chased that around myself one time until somebody pointed it out to me.

I’ve not done this extraction/compression process myself but it does look like there is an updated version of the extraction tools:

https://gbatemp.net/threads/extract...tool-for-layeredfs.511156/page-9#post-9504162

Have you tried it by not doing anything? Meaning, just extract everything, do not change anything, and simply package everything back up and try to play the game. The purpose would be to ensure your process is correct. It should just work with all stock files. Eliminate anything you are doing from the process and take it one small step at a time.

Hi, bro

I've done some tests and now I can almost figure out what the problem is

The problem is that there can only be a maximum of 506 folders under romfs\Data\NX, and if the number of folders exceeds that, the program will break.

I think the following may be the code that is causing the problem, but my C skills are not very good and I don't know how to fix it

hacPack/romfs.c

Could u provide some help? Thx~
 

WindyXu

Member
OP
Newcomer
Joined
Aug 25, 2022
Messages
8
Trophies
0
Location
Los Angeles
XP
46
Country
United States
Are you sure you have enough disk space? While running, the program takes 3 times the size of the game for another copies

yeah, I'm sure I have enough disk space.

If I create 66 new empty folders (the total number of folders is 507) , the program breaks. And if I delete an empty folder (the total becomes 506), everything runs fine.

I did not make any changes to the resource folders except for createing new empty folders.

It's really strange.
 

binkinator

Garfield’s Fitness Coach
Member
GBAtemp Patron
Joined
Mar 29, 2021
Messages
6,511
Trophies
2
XP
6,155
Country
United States
Yes, I've tried that. The tools I used is also the updated version. If I don't do anything with the resource files (exefs dir and romfs dir) and just pack them back to NCA, everything works fine.It seems that my process and method is fine? But if I make some changes to the romfs dir, the packaging will fail. Maybe I should modify the contents of the romfs dir a little bit to determine exactly which file is causing the problem?
that’s a good sign that your process is sound.
I don't have a clue, the repacking tools is supposed to just compress them together. Doing some replacements and modifications shouldn't cause the compression to fail. Or does the repacking tool also do something about validation?
Hi, bro

I've done some tests and now I can almost figure out what the problem is

The problem is that there can only be a maximum of 506 folders under romfs\Data\NX, and if the number of folders exceeds that, the program will break.
This is pretty wild actually. Had not heard of this. Maybe you can compress package some of the files (reverse the order) before you try and repack? I dunno. Totally guessing.
I think the following may be the code that is causing the problem, but my C skills are not very good and I don't know how to fix it

hacPack/romfs.c

Could u provide some help? Thx~
One of the more talented Devs here are going to have to help with this, I’m afraid. @masagrator may know off the top of his head?
 
  • Like
Reactions: WindyXu

botik

Well-Known Member
Member
Joined
Sep 22, 2017
Messages
138
Trophies
0
XP
2,216
Country
Russia
Try through hacbrewpack

folders control,exefs,roms,logo should be next to the program

set title=0100D9A005ED6000
set name="Taiko no Tatsujin: Drum’n’Fun!"
set publisher="BANDAI NAMCO Entertainment"
hacbrewpack.exe --titleid %title% --titlename %name% --titlepublisher %publisher% --nspdir nsp -k keys.dat
 

WindyXu

Member
OP
Newcomer
Joined
Aug 25, 2022
Messages
8
Trophies
0
Location
Los Angeles
XP
46
Country
United States
Try through hacbrewpack

folders control,exefs,roms,logo should be next to the program

set title=0100D9A005ED6000
set name="Taiko no Tatsujin: Drum’n’Fun!"
set publisher="BANDAI NAMCO Entertainment"
hacbrewpack.exe --titleid %title% --titlename %name% --titlepublisher %publisher% --nspdir nsp -k keys.dat
Thanks!! It works!!

But when I install the packaged nsp, I only get an icon with a question mark on my switch, and when I click to run it, it prompts me to download an update and I can't get into the game.

I think I've made a mistake somewhere.

Let me review the whole process.

1. Use NCA-NSP-XCI_TO_LayeredFS_v1.6 to extra the nca and tik file from nsp.

2. Get the secret key from tik file.

3. Use NCA-NSP-XCI_TO_LayeredFS_v1.6 and secret key to get resource files from the largest nca file.

4. Use NCA-NSP-XCI_TO_LayeredFS_v1.6 to get logo folder from the largest nca file.
(command hactool.exe 1adf729f7da40d33b068997adbac355c.nca -x -t nca --section2dir=logo -k prod.keys)

5. Use NCA-NSP-XCI_TO_LayeredFS_v1.6 to get the control.nacp from one of the nca files(size 375Kb).

6. Put control.nacp into the control folder

7. Place control, logo, exefs, romfs folder and keys.dat next to hacbrewpack.exe.

8. Run the command

set title=0100D9A005ED6000
set name="Taiko no Tatsujin: Drum'n'Fun!"
set publisher="BANDAI NAMCO Entertainment"
hacbrewpack.exe --titleid %title% --titlename %name% --titlepublisher %publisher% --nspdir nsp -k keys.dat

9. Get an nsp

10. Install nsp, But cann't open.

By the way, there are some nca files that I don't use, and I don't know if that's normal.



Snipaste_2022-08-26_20-51-38.jpg


Snipaste_2022-08-26_20-52-04.jpg




Snipaste_2022-08-26_20-59-51.jpg


Snipaste_2022-08-26_21-00-01.jpg
 
Last edited by WindyXu,
  • Like
Reactions: binkinator

WindyXu

Member
OP
Newcomer
Joined
Aug 25, 2022
Messages
8
Trophies
0
Location
Los Angeles
XP
46
Country
United States
that’s a good sign that your process is sound.


This is pretty wild actually. Had not heard of this. Maybe you can compress package some of the files (reverse the order) before you try and repack? I dunno. Totally guessing.

One of the more talented Devs here are going to have to help with this, I’m afraid. @masagrator may know off the top of his head?

Yeah, This is really weird. I mean 506 is not a normal number, if it was 512, maybe I could accept it better:rofl2:.

By the way, only the romfs/Data/NX folder has this limit, and if you put folders in romfs/Data, there is nothing wrong with exceeding 506 folders.

As far as I know romfs.c file in hacpack and hacbrewpack was borrowed from switch-tools repo in 2018. However since then it was updated there with bug fixes, but not in hacpack and hacbrewpack.

I compared repositories romfs.c .

Copy strings (479-495) from romfs.c (switch-tools) and paste after string 472 in romfs.c (hacpack)

To be honest, my C skills don't support me in determining that the error is coming from this file.

However, the last two lines of the output log when the program breaks are from line 276 and line 327 of this file.

The program breaks immediately after printing the log of line 327, so I suspect that the error may have occurred in the while function after line 327. Totally guessing.
 
  • Like
Reactions: binkinator

Impossible_Igntiz

Well-Known Member
Member
Joined
Nov 16, 2018
Messages
422
Trophies
0
Location
Bonerville
XP
1,181
Country
United States
anyone know how to use the hacbrewpack naming? i'm repacking of a mod i'd made for a game, and everytime i rename it, it only shows only one word and not the entire words i've entered in the program... any idea how and why it messes up?
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • K3Nv2
  • BakerMan
    I rather enjoy a life of taking it easy. I haven't reached that life yet though.
    K3Nv2 @ K3Nv2: https://gbatemp.net/threads/ps5-m2sdd-quit-working-in-ps5.622567/page-2 guess I'm not the only...