[Q] - Trouble building .CIA from example code

Discussion in '3DS - Homebrew Development and Emulators' started by shizaep, Apr 27, 2015.

  1. shizaep
    OP

    shizaep Newbie

    Newcomer
    7
    3
    Dec 7, 2014
    Canada
    Hello, I seem to be having a bit of trouble building the ctrulib examples as a .cia file. I've been trying to use the instructions at http://3dbrew.org/wiki/Makerom but still unable to produce a .cia that I am able to install on my 3DS.

    This is what I've done so far.

    -build the project
    -
    Code:
    arm-none-eabi-strip [ELF file]
    on the generated elf file

    Now, I have a .3dsx, .elf and .smdh files in my directory.

    I have gotten the latest makerom from https://github.com/Relys/Project_CTR/tree/master/makerom and have been attempting to use the tool to produce a working .cia file using the documentation at http://3dbrew.org/wiki/Makerom

    The rsf file I am using is this:
    Warning: Spoilers inside!

    Then I attempt to do the following in this order:
    Code:
    makerom -o sample.cxi -rsf sample.rsf -target t -elf sample.elf -icon sample.icn -banner sample.bnr -desc app:4
    which yeilds a warning:
    Code:
    [NCCH WARNING] NCCH AES Key could not be loaded, NCCH will not be encrypted
    
    Then:
    Code:
    makerom -o sample.cfa -rsf sample.rsf -target t
    which yields a warning:
    Code:
    [NCCH WARNING] NCCH AES Key could not be loaded, NCCH will not be encrypted
    
    Then:
    Code:
    makerom -f cci -o sample.cci -target t -i sample.cxi:0 -i sample.cfa:1
    Lastly:
    Code:
    makerom -f cia -o sample.cia -target t -i sample.cxi:0:0 -i sample.cfa:1:1
    which yields a warning:
    Code:
    [CIA WARNING] Common Key could not be loaded, CIA will not be encrypted
    
    Now I have a .cia file and I attempt to install it in the same way as any other .cia on gateway but I get the following error when attempting to install it:
    Code:
    Import failed. File: xxx.cia This CIA is invalid (0xD8E08025)
    Someone please tell me what I am doing wrong and what I should do to produce a .cia file that I can correctly install.

    btw, I am developing on linux. But I am a bit of a noob and don't have a god understanding of the produced filetypes.

    Thank you for your help and understanding.
     
  2. daxtsu

    daxtsu GBAtemp Guru

    Member
    5,491
    3,878
    Jun 9, 2007

    If you want a somewhat pre-packaged homebrew template, I highly suggest using Steveice10's Homebrew Template, which can be found here: https://github.com/Steveice10/3DSHomebrewTemplate; it includes pretty much everything you need to output to .3ds, .3dsx, .cia, etc., all in one handy place. It does use his ctrcommon library, but you don't have to use it if you don't want to. If you don't want to use his ctrcommon stuff, just use this commit: https://github.com/Steveice10/3DSHomebrewTemplate/tree/657512a382ad325fc883e8542899f0427e2a71c0 and then comment out the ctrucommon stuff in the makefile. It should give you a good working base.
     
    WhoAmI? likes this.
  3. shizaep
    OP

    shizaep Newbie

    Newcomer
    7
    3
    Dec 7, 2014
    Canada
    daxtsu thanks. This is a great set of tools by Steveice10. Despite having pretty marginal knowledge of makefiles, I've managed to hack together a working .cia of the first example, with an icon and everything. I am going to look into it with more detail though.

    But I've managed to get code to run on my 3ds and that is a big milestone. Get ready for some fresh homebrew coming your way lads
     
    mid-kid and daxtsu like this.
  4. daxtsu

    daxtsu GBAtemp Guru

    Member
    5,491
    3,878
    Jun 9, 2007
    I forked his homebrew template and simply removed the ctrucommon stuff, for anyone else who stumbles across this topic: https://github.com/thedax/3DSHomebrewTemplate/commits/master

    I have nothing against ctrucommon at all, but I don't really use or need anything out of it, so I have no reason to use it in a template that I'd personally start from.
     
    shizaep and VinsCool like this.