-
Notifications
You must be signed in to change notification settings - Fork 193
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
Add writeable virtual mounting of BDRI filesystems #604
Conversation
the title size field in a title info entry is infact not in bytes
* fix a bug in ReadTicketFromDB that would fail to read tickets that were not a specific size * fix the endianness of the title IDs outputted by ListBDRIEntryTitleIDs * improve the speed of ReadBDRIEntry and GetBDRIEntrySize by taking advantage of the hash table
this would cause an uninitialized u64 to be used for the entry size in certain circumstances
This should now be ready for final review and merge. |
Oh, I guess I should also mention this fixes #596. |
previously, it was possible to select and deselect drives on the root menu by using the shortcut keys to select all files, but this would not functionally do anything
@aspargas2 sorry about the radio silence. I'll look though your changes this week and will hopefully be able to merge it. |
Does this PR rejects or filters out nonlegit or fake tickets? If they're visible, is it possible to distinguish and separate these from system and eshop/update tickets like this?
|
It adds a |
@aspargas2, there is a specific scenario that I am worried about regarding system tickets. Let's say there's a noob who's clueless about not knowing that it's a bad idea to randomly delete system titles or tickets off from FBI. The thought process behind this action is that those supposedly random red colored TitleIDs are not needed (haha! yikes..) because they kinda remind him of preinstalled bloatware on Windows. Maybe this noob knows a thing or two about firmware or data recovery techniques, such as faketik app being able to restore missing tickets... Anyway, noob keeps noobing to the point he softbricks his 3DS firmware. And to make matters worse, he never backed up a SysNAND *.bin image because (surprise, surprise!) his 3DS was hacked using a YouTube tutorial that didn't cover that subject. If said noob was to visit Nintendo Homebrew discord, this scenario would likely play out where the locals there suggest that he fixes his 3DS with CTRTransfer. However, if the noob was to look for help on GBAtemp, there is a good chance I might be the one he encounters where he's instead told to fix the 3DS with CTRTransfer (Type D9). The reason for my asking is that there's a potential pitfall in how CTRTransfer (Type D9) currently works. Unlike standard CTRTransfer, CTRTransfer (Type D9) leaves in place the user's original I found out when system titles with missing tickets are restored with faketik, the Index to the common KeyY at offset 0x1F1 is set to Here's a mini tutorial on how to produce a fresh
I want to be certain those changes to how When the PR encounters fake system tickets, are these also separately sorted to Side Note: I don't expect GodMode9 to sort out fake tickets that look convincingly real, or are mostly real but off edited by one or few points. Anyone who bothers to put that much effort purposely trying to install and pass off fake system tickets as real ones to the CDN probably at that point deserves to keep their softbrick. |
@TurdPooCharger Yeah, that story you told of the noob deleting system titles is painfully familiar. The only thing about a ticket that this code uses to decide whether a ticket is said system ticket or an eshop/homebrew ticket is the However, the more I think about it, the more I think it makes more sense to sort all unsigned tickets (aside from those with a cky_idx > 1) into the homebrew directory, regardless of whether or not we can see it causing any issues in any practical circumstances. This would be more consistent with the behavior of the original ticket.db mounting system in any case, and would ensure no scripts would need adjustment. I would like to hear @d0k3's take on this, but if you and I are in agreement, I'll go ahead and change this behavior and push the commit, as it's a very simple logic change. Regarding your side note, this PR will actually be able to sort out tickets whose signatures are invalid in any way, no matter how small the edit from a ticket's legit form was. GodMode9 already had a function implemented which uses the 3DS's RSA hardware to verify a ticket's signature ( On an unrelated note, I've just found another bug in this PR, so be expecting a commit to fix that. |
attempting to open a file in a bdri mount for reading only which did not exist but had a valid name would create the file without ever unlocking appropriate write permissions
Sounds good to me. I have no further questions with the Now about the write aspect. Hadn't had time to compile your PR fork yet and try this on my n3DSXL, but does [CLIPBOARD] selecting Or, is installing tickets done by doing something like pressing (A) on the |
@TurdPooCharger I'm not sure if you saw this, but I removed the Regarding the write aspect, you can indeed install tickets by using the Y button to copy them into the T: drive. It expects the ticket to be named in the same format as other tickets in the mount: Here's a build of commit 226ea9c if you'd like to try any of this. |
Reviewed it and found no issues - it's working great, too. So I already merged it to master. Thanks a lot @aspargas2, and thanks a lot @TurdPooCharger for always helpful comments, too. I of course agree about all tickets with invalid signature being shown inside the |
Sorry, late reporting back. Was still undergoing testing while coming up with ideas of unintended usage. I wanted to present potential pitfalls that were found and possible solutions to noob proof them. Here's an informal write-up of build Issues Found
Strong Points / Noted observation
To be tested / unanswered
Comment / suggestion
, should not be implemented or considered at this time. If considered, does ease of installation outweigh the risk of bricking
|
Issues 1 and 4 are certainly bugs; I'm not sure why either of those happen, but I will look into them and get them sorted out ASAP. With that said, there are some restrictions that disallow copying literally anything into there, as you have observed. Going through the noted strong points/observations: There's no reason that injecting one ticket to another to replace the ticket shouldn't work fine, but please do let me know if you find any problems with it. At the present time, I see no reason to disallow it. I actually like the idea of also adding a context menu "install" option on ticket files. I don't know what you mean regarding potential bricking of the entire title.db. Setting aside the fact that I can't see anything one could do with one ticket that would affect any other ticket (again, this is a proper FAT filesystem), I would consider it more appropriate to put more FBI-like restrictions/warnings on such an install option. I'm all for having noob-proofing in what the noobs are going to be instructed to use; I just don't feel like it needs to be in the virtual mounting layer. Of course, none of this up to me anyway. I'll go ahead and start working on issues 1 and 4, and if @d0k3 wants anything else changed, I'll do that too. PS: Sorry that my posts aren't as nicely markdown-formatted as yours; I'm just bad at organizing things like that. |
This replaces the old brute-force parsing system for "mounting" ticket.db files, but maintains backwards compatibility with any scripts and tutorials assuming the old directory structure of the
T:
drive, aside from thehidden
directory. These changes are fully functional as is; this PR is only a draft PR because there are still some remaining features that use the old brute-force ticket.db parsing method, and I wish to move away from that completely before this is merged. Feel free to go ahead and review the changes I've already pushed, as those parts shouldn't be changing any further from here.