Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

App returns error when attempting to fix the banner for a ROM with special characters on certain locales #7

Open
20SangHun00 opened this issue Apr 22, 2024 · 14 comments

Comments

@20SangHun00
Copy link

I have a couple of ROMs that I've modified the cartridge color within NSUI

Capture

When I try to supply such .cia files to the banner fixer, I am getting the following error

--- extracting cia
ERROR: extract file failed

ERROR: open file <path to .ciafile> failed

ERROR: the file type is mismatch

--- editing banner
ERROR: Was <.cia file> created with NSUI v28 using the 3D GBA banner?

All the other .cia files that I've supplied to the banner fixer worked fine, only the ones with modified colors failed, so the problem is not in the version of the NSUI app used for generating the said .cia files

@pivotiiii
Copy link
Owner

That does sound like a proper error. I'll try to replicate it and let you know when it is fixed.

@20SangHun00
Copy link
Author

Some more details on the issue. It looks like the problem is not the coloring, but rather the used GBA ROM. The problem I've mentioned happened only on the .cia files created using the Pokemon games for the NTSC region. I'll try to play around a little bit with other ROMs, and post here my findings

@pivotiiii
Copy link
Owner

I can't seem to replicate this problem. I tried a NTSC version of Emerald both with the regular and a colored cartridge and both get fixed just fine. How are you running the banner fixer? Are the CIAs in the same folder as the program? Are you running by double clicking or via command line? With what arguments if any?

@20SangHun00
Copy link
Author

Hmm... Try changing the publisher name within NSUI also, as the way I am running that, I am pasting a bunch of .cia files at the root of the project, and run the program

@pivotiiii
Copy link
Owner

pivotiiii commented Apr 22, 2024

I recreated your screenshot as close as possible, still works for me. Can you try running via command line? Open the folder containing nsui_banner_fixer.exe/.py and the .cia files, in the explorer address bar type cmd.exe and press enter. Then type nsui_banner_fixer.exe -v "Pokémon Emerald Version.cia" (Replace the .cia name if needed).

@20SangHun00
Copy link
Author

@pivotiiii Here is the output

--- extracting cia
Header size             0x00002020
Type                    0000
Version                 0000
Certificates offset:    0x2040
Certificates size:      0xa00
Ticket offset:          0x2a40
Ticket size             0x350
TMD offset:             0x2dc0
TMD size:               0xb34
Meta offset:            0x1097900
Meta size:              0x3ac0
Content offset:         0x3900
Content size:           0x1094000

Ticket content:
Signature Type:         04000100
Issuer:                 Root-CA00000003-XS0000000c
Signature:
000000: 25 33 69 a2 45 d9 5d 42 ac 91 3d 8b 09 9c 37 d4  %3i.E.]B..=...7.
000010: 2e 3a 74 ae 68 27 05 8c 6c 67 f0 78 d2 7b 4b 80  .:t.h'..lg.x.{K.
000020: 7b f4 1e ce 4f f8 76 93 18 4e dc 0a 3b 04 56 fc  {...O.v..N..;.V.
000030: c5 07 52 70 88 19 e4 dc 81 2f 4d 59 a3 6e 9f 4b  ..Rp...../MY.n.K
000040: d0 d2 3a b3 64 5a 16 53 7d 0a 34 c3 a1 db 0b d6  ..:.dZ.S}.4.....
000050: 92 37 35 f3 5b 21 13 40 23 af 0e 55 cb 1f cb 5a  .75.[!.@#..U...Z
000060: dc c3 67 5e 0b a3 04 3f ea c9 d5 98 9e 7e 12 90  ..g^...?.....~..
000070: 22 c0 69 a6 04 c9 b3 a6 76 4f 26 1e ee f2 ef c0  ".i.....vO&.....
000080: 00 75 5e b5 f4 a0 31 83 d8 42 f2 26 76 f2 d1 0e  .u^...1..B.&v...
000090: 7e 43 9f 8b e1 e9 c9 7c a6 73 88 bb 78 99 85 d8  ~C.....|.s..x...
0000a0: 30 c9 fe e5 53 7b be 58 e4 f9 f6 73 a3 73 99 7d  0...S{.X...s.s.}
0000b0: 21 fb 21 87 eb b2 99 dd d7 12 c5 b9 13 bb 3b 40  !.!...........;@
0000c0: a1 a7 ca 0b da a9 9e 68 99 3f 25 f7 9f 7c 0c 17  .......h.?%..|..
0000d0: 70 24 6f f9 5e f5 be 28 88 71 07 6a e5 bf 10 58  p$o.^..(.q.j...X
0000e0: 34 b2 da b9 45 cc 8c f8 f2 18 51 21 d4 26 cc 51  4...E.....Q!.&.Q
0000f0: 16 e2 a1 06 23 d0 6b 89 09 fa 66 29 56 0f 9c 6e  ....#.k...f)V..n

Encrypted Titlekey:     022B4D10FA50C056F3F6293FA992F9CE
Decrypted Titlekey:     ED3F290CD8BF462181651ADE1726E7E3
Ticket ID:              0004283B2520018E
Ticket Version:         0
Title ID:               00040000011E2500
Common Key Index:       0
Content permission map:
 00 00 00 00 00 00 00 00
 00 00 00 00 00 00 00 00
 00 00 00 00 00 00 00 00
 00 00 00 00 00 00 00 00
 00 00 00 00 00 00 00 00
 00 00 00 00 00 00 00 00
 00 00 00 00 00 00 00 00
 00 00 00 00 00 00 00 00


TMD header:
Signature type:         RSA 2048 - SHA256
Issuer:                 Root-CA00000003-CP0000000b
Version:                1
CA CRL version:         0
Signer CRL version:     0
System version:         0000000000000000
Title id:               00040000011E2500
Title type:             00000040
Group id:               0000
Save Size:              257KB (00040400)
Access rights:          00000000
Title version:          0.0.0 (v0)
Content count:          0001
Boot content:           0000
Hash:                   CBEDEFD7B0FA7A20E7E075D07F3E5DCA4CBCF1247F3E9E1D2387F65BE5F43591

TMD content info:
Content index:          0000
Command count:          0001
Unknown:                44C2A5EE952917B0D7334AC22117EB8EC72BE2052D04D5008205C3C44519DC19

TMD contents:
Content id:             00000000
Content index:          0000
Content type:           0000
Content size:           0000000001094000
Content hash:           2636076AAB6A48E07BBBD9F965A8C39AE86BAF34EF4F19A12821DC094D99CAA0

Saving content #0000 to C:\Users\00sanghun\Desktop\NSUI Banner Fixer\temp\Pokémon Emerald Version/contents.0000.00000000
save: C:\Users\00sanghun\Desktop\NSUI Banner Fixer\temp\Pokémon Emerald Version/ncch.header
save: C:\Users\00sanghun\Desktop\NSUI Banner Fixer\temp\Pokémon Emerald Version/exheader.bin
save: C:\Users\00sanghun\Desktop\NSUI Banner Fixer\temp\Pokémon Emerald Version/exefs.bin
save: C:\Users\00sanghun\Desktop\NSUI Banner Fixer\temp\Pokémon Emerald Version/romfs.bin
ERROR: extract file failed

ERROR: open file C:\Users\00sanghun\Desktop\NSUI Banner Fixer\temp\Pokémon Emerald Version/exefs/banner.bin failed

ERROR: the file type is mismatch

--- editing banner
ERROR: Was Pokémon Emerald Version.cia created with NSUI v28 using the 3D GBA banner?

WARNING! Overwriting an injected GBA game will overwrite its save file.
Consider backing up your saves before, e.g. with GBAVCSM (https://github.com/TurdPooCharger/GBAVCSM)

I do not know if that will be of any help, but I could also send the .cia that I am using currently

@20SangHun00
Copy link
Author

20SangHun00 commented Apr 22, 2024

@pivotiiii On a second look, the issue seems to be the .cia filename, I am using there a special character in the Pokémon word, é to be more precise. And it looks like the program cannot recognize files which filenames contain any special characters. After remaining the file, everything went well.

Good to know that the problem is so minor 😄

@pivotiiii
Copy link
Owner

The é seems to be the problem but it's really weird. It is working for me with the same character in the file name. Maybe it is a locale dependent issue. Glad you got it to work though.

@20SangHun00
Copy link
Author

Most probable, the PC I was running the whole job on was acquired roughly a month ago, and I've changed the locale as it had issues displaying Cyrillic characters, maybe that somehow messed the logic of some other apps, as initially the OS was installed using EN-US. I will be closing the issue then, as it mostly looks like a problem with my PC, than an issue with the app itself

@pivotiiii pivotiiii changed the title App returns error, when attempting to fix the banner for a ROM with a modified GBA or cartridge color App returns error when attempting to fix the banner for a ROM with special characters on certain locales Apr 23, 2024
@pivotiiii
Copy link
Owner

This still shouldn't be happening, I'll reopen this just to remind myself to strip any special characters in general.

@pivotiiii pivotiiii reopened this Apr 23, 2024
@pivotiiii
Copy link
Owner

Hey, I just uploaded a new version which was rewritten in C++. From my (very limited) testing is seems to properly handle special characters, but then again so did the Python version on my machine/locale. It would be nice if you could check how it works for you, thanks :)

You can get it here.

@20SangHun00
Copy link
Author

Hey, I just uploaded a new version which was rewritten in C++. From my (very limited) testing is seems to properly handle special characters, but then again so did the Python version on my machine/locale. It would be nice if you could check how it works for you, thanks :)

You can get it here.

Sure, will take a look at it today. Will give a response upon the result tomorrow, in the worst case

@20SangHun00
Copy link
Author

@pivotiiii It looks like there is another issue with this version

C:\Users\00sanghun\Desktop\nsui_banner_fixer-2.0.0-win32>nsui_banner_fixer.exe -v "Pokémon Emerald Version.cia"
Pokémon Emerald Version
Detected version: 0.0.0
--- C:\Users\00sanghun\Desktop\nsui_banner_fixer-2.0.0-win32\Pokémon Emerald Version.cia
--- extracting cia
Header size             0x00002020
Type                    0000
Version                 0000
Certificates offset:    0x2040
Certificates size:      0xa00
Ticket offset:          0x2a40nTicket size             0x350
TMD offset:             0x2dc0
TMD size:               0xb34
Meta offset:            0x1097900
Meta size:              0x3ac0
Content offset:         0x3900
Content size:           0x1094000
Warning, could not read common key.

Ticket content:
Signature Type:         04000100
Issuer:                 Root-CA00000003-XS0000000c
Signature:
000000: aa 17 35 98 db f8 6a d5 ca 6f 24 ae df 84 32 15  ..5...j..o$...2.
000010: ea ed e5 63 f5 17 9f f2 4e a1 0d 06 06 2c 6e e1  ...c....N....,n.
000020: 32 37 f0 83 51 3a f0 63 50 c0 98 0e 3e aa 82 ad  27..Q:.cP...>...
000030: a1 4b fa 51 17 92 f9 5a 8a 9b ba cb 6f b1 4e 72  .K.Q...Z....o.Nr
000040: a0 2a 8c f8 17 b2 64 1b ff a6 0f b1 3e 5a 53 b6  .*....d.....>ZS.
000050: ef 63 59 c7 78 84 89 24 54 42 b2 c3 21 bf 45 4b  .cY.x..$TB..!.EK
000060: 54 4f f7 99 10 6e 5e b5 34 52 b4 f9 08 65 bd 76  TO...n^.4R...e.v
000070: ed 9f e9 52 c0 c7 24 f0 a0 5b 25 ee a3 17 6d 2d  ...R..$..[%...m-
000080: 07 34 8d 67 30 36 4c 7b 2a 69 26 07 b5 b9 ed a5  .4.g06L{*i&.....
000090: 7b 19 3e 0b bb 40 58 9e 5d d9 8d 5a 90 46 b8 db  {.>..@X.]..Z.F..
0000a0: 8a a7 5f b1 b1 32 a3 3d c3 ad 8b 1d 54 f9 a7 c8  .._..2.=....T...
0000b0: c5 c1 46 fd 6e 54 e7 17 59 9d c3 e6 4e d9 98 fc  ..F.nT..Y...N...
0000c0: ea 61 0f 40 b6 29 05 ff bb 75 4b 46 4b 50 d6 34  .a.@.)...uKFKP.4
0000d0: 19 65 35 47 54 a6 40 12 a8 fe 63 66 49 99 01 85  [email protected]...
0000e0: 4e f3 60 c3 b2 b9 c5 00 fb e8 ab 37 3b 2b fb 93  N.`........7;+..
0000f0: 77 51 33 21 36 50 5d 6f ad 23 dd bf c8 39 54 10  wQ3!6P]o.#...9T.

Encrypted Titlekey:     AA667EBC6911A8A455D95338A8002482
Ticket ID:              00041D0D3AF77AA7
Ticket Version:         0
Title ID:               0004000008E38400
Common Key Index:       0
Content permission map:
 00 00 00 00 00 00 00 00
 00 00 00 00 00 00 00 00
 00 00 00 00 00 00 00 00
 00 00 00 00 00 00 00 00
 00 00 00 00 00 00 00 00
 00 00 00 00 00 00 00 00
 00 00 00 00 00 00 00 00
 00 00 00 00 00 00 00 00


TMD header:
Signature type:         RSA 2048 - SHA256
Issuer:                 Root-CA00000003-CP0000000b
Version:                1
CA CRL version:         0
Signer CRL version:     0
System version:         0000000000000000
Title id:               0004000008E38400
Title type:             00000040
Group id:               0000
Save Size:              257KB (00040400)
Access rights:          00000000
Title version:          0.0.0 (v0)
Content count:          0001
Boot content:           0000
Hash:                   D04A3FF05EAB43C53CFED5B9598345A6E8BDE0D2A7AC43037AEF08E10985BA89

TMD content info:
Content index:          0000
Command count:          0001
Unknown:                73F95AC117A900C9427BAF07F5D5F69E60A2594A04EE1AA3DBCA59ECE58D2DCA

TMD contents:
Content id:             00000000
Content index:          0000
Content type:           0000
Content size:           0000000001094000
Content hash:           24447DD71F705E00FFC8CB3DAFE87C1BEE058F930E7A7A810FC7E96174515C19

Saving content #0000 to C:\Users\00sanghun\Desktop\nsui_banner_fixer-2.0.0-win32\temp\Pokémon Emerald Version\contents.0000.00000000
save: C:\Users\00sanghun\Desktop\nsui_banner_fixer-2.0.0-win32\temp\Pokémon Emerald Version\ncch.header
save: C:\Users\00sanghun\Desktop\nsui_banner_fixer-2.0.0-win32\temp\Pokémon Emerald Version\exheader.bin
save: C:\Users\00sanghun\Desktop\nsui_banner_fixer-2.0.0-win32\temp\Pokémon Emerald Version\exefs.bin
save: C:\Users\00sanghun\Desktop\nsui_banner_fixer-2.0.0-win32\temp\Pokémon Emerald Version\romfs.bin
ERROR: extract file failed

ERROR: Failed to extract exefs from contents (1)
ERROR: Failed to extract CIA

Ping me if you'll need any additional info

@pivotiiii
Copy link
Owner

It's the same problem. I guess I'll have to bite the bullet and set up a VM for checking different locales at some point.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants