d0k3 / GodMode9

GodMode9 Explorer - A full access file browser for the Nintendo 3DS console :godmode:
GNU General Public License v3.0
2.12k stars 191 forks source link

[FEATURE REQUEST] Install cifinish.bin files (for custom-install) #686

Closed ZeroSkill1 closed 3 years ago

ZeroSkill1 commented 3 years ago

Currently, you have to run the custom-install-finalize 3DSX homebrew application to finalize the installation for titles installed using custom-install. In practice, this installs a ticket for the title. It would be nice to see an option like Install CIFINISH file... that would install fake tickets for unfinished titles.

aspargas2 commented 3 years ago

Just a general comment, it seems like this would probably be more appropriate to be a script instead of a built-in feature. Though, depending on the format of cifinish.bin, the current scripting system may not practically be able to parse it.

ZeroSkill1 commented 3 years ago

It is a binary format and consists of title ids and spacing in between from what I can tell.

d0k3 commented 3 years ago

Is that a format created by @ihaveamac? I'm not against adding support for that.

ZeroSkill1 commented 3 years ago

It is.

d0k3 commented 3 years ago

Can you upload a sample file? Maybe there's also some kind of description somewhere?

ZeroSkill1 commented 3 years ago

The CIFINISH generation process can be seen in the custom-install source.

This is how the current file structure looks like (this is an example file.):

0000:0000 | 43 49 46 49 4E 49 53 48 | CIFINISH
0000:0008 | 03 00 00 00 03 00 00 00 | ........
0000:0010 | 54 49 54 4C 45 00 00 00 | TITLE...
0000:0018 | 00 FD 07 00 00 00 04 00 | .ý......
0000:0020 | 00 00 00 00 00 00 00 00 | ........
0000:0028 | 00 00 00 00 00 00 00 00 | ........
0000:0030 | 54 49 54 4C 45 00 01 00 | TITLE...
0000:0038 | 00 75 19 00 00 00 04 00 | .u......
0000:0040 | 09 98 04 18 8D F2 13 FE | .....ò.þ
0000:0048 | 66 5B 9B E5 43 7C 9B 65 | f[.åC|.e
0000:0050 | 54 49 54 4C 45 00 01 00 | TITLE...
0000:0058 | 01 FE 12 00 02 00 04 00 | .þ......
0000:0060 | 66 5B 9B E5 43 7C 9B 65 | f[.åC|.e
0000:0068 | 66 5B 9B E5 43 7C 9B 65 | f[.åC|.e

(Download this file here if you want)

0x0-0x8: magic - CIFINISH. 0x8-0xC: CIFINISH version (int32, little endian) 0xC-0xF: amount of titles to finalize. (int32, little endian) then, the title entries follow. the expected size of all title entries is title count * 0x20.

A title entry is 0x20 bytes long: 0x0-0x4: title entry magic, TITLE 0x5-0x5: single-byte padding 0x6-0x6: title uses seed? if yes, this value is 0x1. else, this value is 0x0 0x7-0x7: single-byte padding 0x8-0xF: title id (little endian) 0x10-0x1F: if the title uses a seed, these 20 bytes are the seed. else, this will be filled with zeroes.

I forgot to mention that it also installs a seed if necessary.

ihaveamac commented 3 years ago

C definitions: https://github.com/ihaveamac/custom-install/blob/ac0be9d61d7ebef9356df23036dc53e8e862011a/finalize/source/main.c#L11-L46

Only v3 really matters today, v1 is old and v2 is a mistake (hence packed).

ihaveamac commented 3 years ago

In addition, custom-install-finalize deletes cifinish.bin if there were no errors since the file becomes useless. Maybe this can be offered as an option too.

ZeroSkill1 commented 3 years ago

Maybe also a feature to check for installed titles that have no ticket, like a faketik but in GodMode9.

d0k3 commented 3 years ago

Add in current staging branch, will be merged to master later. Thanks @TimmSkiller and @ihaveamac !