Switch homebrew team 2168-0002 releases dedbae xci2nsp: A smarter, faster XCI to NSP converter

Find xci2nsp releases here: https://gitlab.com/roothorick/dedbae/tags/

A pretty minor release for 2168, but don't ever say we hoard our creations!

This is an XCI to NSP converter that's smarter and faster than 4nxci.

  • A single, self-contained executable with no dependencies worth mentioning.
  • Reads and writes the game exe/assets -- the part that actually takes more than a few seconds -- only once, without decrypting/re-encrypting. No interstitial files. This is as fast as I can make it; the bottleneck is the throughput of your HDD.
  • Handles all known XCI/gamecard formats.
  • Produces output NSPs with the human-readable game name, title ID, and version ID in hex (much more readable than CDNSP's decimal translation).
  • Identifies and extracts embedded updates as a separate NSP.
  • No fake tickets, no recrypting with titlekey crypto, no cruft in your ticketdb. Only the update NSPs have tickets, and they're real, official tickets.

Use

An x86-64 Windows binary is provided; for non-Windows (note: little endian CPU required) you'll need to build it yourself (see below), and if you bought a Switch but your main computer doesn't have a 64bit processor you need to re-evaluate your life choices.

Place your keyfile in the correct location (this works a bit differently from most tools! See below). Put xci2nsp.exe just anywhere. Run it from the command line with file names as arguments. NSPs will be saved to the current working directory irrespective of the XCI's location.

Alternately, just drag-and-drop XCI files on top of the exe. In this case the NSPs will be saved to the same directory as the XCIs. You can select and drag multiple at once and it will batch-convert them in sequence.

When installing the produced NSPs, Tinfoil will print a warning about failing to install the ticket. This is normal; there is no ticket to install.

Keyfile location

I'm very tired of every tool expecting keys to be in a different place under a different name, usually in the current working directory so you have a dozen copies laying all around your system. So, I'm taking a step towards standardizing that by copying hactool's search paths.
You'll need your keyfile to be "~/.switch/prod.keys" (Linux) or "C:\Users\<username>\.switch\prod.keys" (Windows), unless you have a weird setup that moves the home dir/user profile dir, in which case I expect you to already know what you're doing.

I really would like current and future tools to either do the same, or adopt a different standard location for all apps to go to.

Known issues

  • File permissions related problems are handled poorly and may produce cryptic errors.
  • Disk space is not checked. If you're not paying attention, you may get most of the way through a conversion only to get a "No space left on device" error.
  • The output file names are deliberately ASCII only, to avoid a bug in Horizon. Non-ASCII characters are translated using a C++ version of Unidecode, which doesn't handle Japanese very well. Names composed mainly of kanji will be badly bastardized. (If you've used CDNSP in the past you may be familiar with what this looks like.)
  • On Windows, xci2nsp may fail to open XCI files if their filename contains "wide" characters (e.g. Japanese alphabets). Filenames with such characters tend to cause problems with a lot of things, so you really should just rename them.
  • If an English translation for a game was added in an update (e.g. Taiko), and the update is embedded in the XCI, the base game NSP's filename will have the game's name in the original language (e.g. Japanese), but the update NSP's filename will have the English name.

Building from source

If you're cloning the repository, note that there are two submodules; you will need to specify --recursive.

Dependencies are basically nonexistent; just the standard GNU toolchain and libc/libstdc++. On Windows you will need MinGW-W64 and MSYS2. Extract/clone wherever, cd into the dir and make. The binary will be copied into the bin/ folder.

OSX will probably not work without a special build environment as GCC extensions are in use. Either way, I don't intend to support OSX; don't have the hardware, don't want the hardware, and really really don't want to mess around with hackintosh.

Why?

When I first started working on this, 4nxci wasn't correctly handling a number of common cases resulting in NSPs that didn't work correctly. In addition, it was re-encrypting with titlekey crypto, something that really isn't necessary, correction: 4n informed me it was just a fake ticket to work around a bug in early Tinfoil, it still left extra cruft on the system in the form of fake tickets in the ticketdb. I think his current version has resolved most of those issues, but I've been using this instead for a while, and it is better, so I should share.

I'll fix any issues people run into, and make updates if we discover XCIs that change things up too much to not work. Beyond that, though, I'm moving on to something considerably more exciting. Expect Big Things from 2168 soon.

Changelog

1.0.0-1: libgcc and libstdc++ are now statically linked in the Windows build. There actually are no meaningful runtime dependencies now.
 

Attachments

  • 2168.png
    2168.png
    9.7 KB · Views: 3,492
Last edited by roothorick,

Adran_Marit

Walküre's Hacker
Member
Joined
Oct 3, 2015
Messages
3,781
Trophies
1
Location
42*South
XP
4,551
Country
Australia
Make it read keys from the folder it running from, instead of users/.switch, yada-yada. It's really out of hand.

the keys are in the users/.switch to help make it uniform so you don't have 10 different copies of the same file in different locations for different applications


Thanks for trying to help, I don't know why it's not working either since it's seems to put together a valid nsp.

No worries, I'm curious now as to why it isn't working.
 

Adran_Marit

Walküre's Hacker
Member
Joined
Oct 3, 2015
Messages
3,781
Trophies
1
Location
42*South
XP
4,551
Country
Australia
Any reason why I can't make a folder with a . in the name?
Follow the instructions below
  • Step 1: Open Command Prompt in Windows. Open Run window [Windows key + R] and type cmd and hit Enter. or Press Windows Key + X and Open Command Prompt.
  • Step 2: Now navigate to the path in which you want to create folder name starting with dot(.)
  • Step 3: Now type mkdir<space>.FolderName
example mkdir .switch

windows thinks its an exe otherwise
 

roothorick

Well-Known Member
OP
Newcomer
Joined
Jan 30, 2008
Messages
51
Trophies
0
XP
479
Country
United States
Because of the whole "Windows Explorer doesn't like dotfiles" thing and just Windows user profiles being structured differently, I'm thinking that hactool probably has the wrong idea there. Thinking about changing the keyfile location. I'll have the tool try both paths for backwards compatibility's sake. Open to suggestions. Other than "current working directory" / "same dir as the exe".

Thanks for sharing! Compatibility seems to be low though, I tried this on 3 different xcis (Touhou Kobuto V Burst Battle, Neo Atlas 1469, and MUSYNX) and although it created a NSP for all of them, only Touhou Kobuto V Burst Battle was able to run properly, everything else crashed on application start.

Could you post hashes of the two XCIs you had issues with? Did you dump them yourself, are they scene release, etc? I'll hunt down those two and look into it.

I have ~11 XCIs here I've tested with and they've all worked perfectly; I wonder if there's something a tad odd about those.
 

Euphonique

Active Member
Newcomer
Joined
Sep 6, 2018
Messages
32
Trophies
0
Age
43
XP
471
Country
Germany
Thanks for sharing this tool with us but I have to say the .switch folder isn‘t a good idea. You can not create it with the explorer, you have to use the command line. It would really be simpler to put it in the application folder. Or check if it‘s there and load it from there. Keep it simple.
I‘ve tried it with a Snipperclips dump but the install breaks with an error. Don‘t know whats causing this.
 
  • Like
Reactions: Zeriel and peteruk

whateverg1012

Well-Known Member
Member
Joined
Sep 23, 2016
Messages
573
Trophies
0
XP
1,426
Country
United States
Because of the whole "Windows Explorer doesn't like dotfiles" thing and just Windows user profiles being structured differently, I'm thinking that hactool probably has the wrong idea there. Thinking about changing the keyfile location. I'll have the tool try both paths for backwards compatibility's sake. Open to suggestions. Other than "current working directory" / "same dir as the exe".



Could you post hashes of the two XCIs you had issues with? Did you dump them yourself, are they scene release, etc? I'll hunt down those two and look into it.

I have ~11 XCIs here I've tested with and they've all worked perfectly; I wonder if there's something a tad odd about those.

You're a member of a discord I'm in, I dm'd you there.
 

blawar

Developer
Developer
Joined
Nov 21, 2016
Messages
1,708
Trophies
1
Age
40
XP
4,311
Country
United States
zerotwoxci uses an old version of this, and is probably gonna be updated with this
same team, man, we share stuff around

I know zerotwoxci uses the base of this lib for manipulating the XCI themselves. But zerotwoxci did a LOT of dumb shit. and I mean A LOT, thats why it has a high chance of SD corruption. Zerotwoxci is literal garbage.
 

s-arash

Well-Known Member
Member
Joined
Sep 3, 2013
Messages
185
Trophies
0
Age
32
XP
364
Country
United States
is gbatemp getting paid by this fake team? there are many great homebrews but only useless applications of this team post in front page
 
  • Like
Reactions: blahblah

Crusatyr

Well-Known Member
Member
Joined
Jul 31, 2016
Messages
197
Trophies
0
XP
901
Country
United States
there are many great homebrews but only useless applications of this team post in front page

You know what? That's the beauty of it. Message the mods. Let them know what homebrew apps are coming out. They'll front page anything if you give them enough info about it. That's why SX OS posts are so popular because every release, garyopa gives them a press release. You can literally write any app and ask for it to be front paged and the mods will do it if you give them enough to work with and enough time. They LOVE the Switch scene as much as any of us and would LOVE to write more about it.
 

s-arash

Well-Known Member
Member
Joined
Sep 3, 2013
Messages
185
Trophies
0
Age
32
XP
364
Country
United States
You know what? That's the beauty of it. Message the mods. Let them know what homebrew apps are coming out. They'll front page anything if you give them enough info about it. That's why SX OS posts are so popular because every release, garyopa gives them a press release. You can literally write any app and ask for it to be front paged and the mods will do it if you give them enough to work with and enough time. They LOVE the Switch scene as much as any of us and would LOVE to write more about it.

oh wait
so retroarch devs messaged mods too? what about rei?
this is a joke
it is clear that you are paying gbatemp mods or maybe you have some gbatemp mods on your team cause it seems there are many people in your team
 

Crusatyr

Well-Known Member
Member
Joined
Jul 31, 2016
Messages
197
Trophies
0
XP
901
Country
United States
oh wait
so retroarch devs messaged mods too? what about rei?
this is a joke
it is clear that you are paying gbatemp mods or maybe you have some gbatemp mods on your team cause it seems there are many people in your team

I can't speak for the retroarch devs, but Chary and Quantumcat have been seen idling in the ReiNX discord so Rei/Kilim/whoever can get a hold of them pretty easily.
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
    Xdqwerty @ Xdqwerty: I'm back