[Question] Dragon Quest 7 RSF CCI Building Help

Discussion in '3DS - ROM Hacking, Translations and Utilities' started by Helmax, Mar 18, 2015.

  1. Helmax
    OP

    Helmax GBAtemp Regular

    Member
    188
    276
    Feb 17, 2011
    United States
    I am having a heck of a time rebuilding an RSF to help recompile my CCI for this game.

    Here is my RSF

    Code:
    BasicInfo:
      Title                  : "CtrApp"
      CompanyCode            : "GD"
      ProductCode            : "CTR-P-AD7J"
      ContentType            : Application
      Logo                  : Nintendo
     
    TitleInfo:
      UniqueId              : 0x0065e
      Category              : Application
     
    CardInfo:
      MediaSize              : 2GB
      MediaType              : Card1
      CardDevice            : NorFlash
     
     
    Option:
      UseOnSD                : false
      EnableCompress        : true
      FreeProductCode        : true
      EnableCrypt            : false
      MediaFootPadding      : true # If true CCI files are created with padding
     
    ExeFs: # these are the program segments from the ELF, check your elf for the appropriate segment names
      ReadOnly:
      - .rodata
      - RO
      ReadWrite:
      - .data
      - RO
      Text:
      - .init
      - .text
      - STUP_ENTRY
     
    AccessControlInfo:
      UseOtherVariationSaveData : false
      #UseExtSaveData : true
      ExtSaveDataId: 0x00000000
      SystemSaveDataId1: 0x00000000
      SystemSaveDataId2: 0x00000000
      OtherUserSaveDataId1: 0x00000
      OtherUserSaveDataId2: 0x00000
      OtherUserSaveDataId3: 0x00000
      #UseExtendedSaveDataAccessControl: true
      #AccessibleSaveDataIds: [0x101, 0x202, 0x303, 0x404, 0x505, 0x606]
      FileSystemAccess:
      #- CategorySystemApplication
      #- CategoryHardwareCheck
      #- CategoryFileSystemTool
      - Debug
      #- TwlCardBackup
      #- TwlNandData
      #- Boss
      - DirectSdmc 
      #- Core
      #- CtrNandRo
      #- CtrNandRw
      #- CtrNandRoWrite
      #- CategorySystemSettings
      #- CardBoard
      #- ExportImportIvs
      #- DirectSdmcWrite
      #- SwitchCleanup
      #- SaveDataMove
      #- Shop
      #- Shell
      #- CategoryHomeMenu 
      IoAccessControl:
      - FsMountNand
      - FsMountNandRoWrite
      - FsMountTwln
      - FsMountWnand
      - FsMountCardSpi
      - UseSdif3
      - CreateSeed
      - UseCardSpi
     
      IdealProcessor                : 0
      AffinityMask                  : 1
     
      Priority                      : 48
     
      MaxCpu                        : 0x9E # Default
     
      DisableDebug                  : false
      EnableForceDebug              : false
      CanWriteSharedPage            : false
      CanUsePrivilegedPriority      : false
      CanUseNonAlphabetAndNumber    : false
      PermitMainFunctionArgument    : false
      CanShareDeviceMemory          : false
      RunnableOnSleep              : false
      SpecialMemoryArrange          : false
     
      CoreVersion                  : 2
      DescVersion                  : 2
     
      ReleaseKernelMajor            : "02"
      ReleaseKernelMinor            : "35"
      MemoryType                    : Application
      HandleTableSize: 200
      IORegisterMapping:
      - 1ff50000-1ff57fff
      - 1ff70000-1ff77fff
      MemoryMapping:
      - 1f000000-1f5fffff:r
      SystemCallAccess:
        ArbitrateAddress: 34
        Break: 60
        CancelTimer: 28
        ClearEvent: 25
        ClearTimer: 29
        CloseHandle: 35
        ConnectToPort: 45
        ControlMemory: 1
        CreateAddressArbiter: 33
        CreateEvent: 23
        CreateMemoryBlock: 30
        CreateMutex: 19
        CreateSemaphore: 21
        CreateThread: 8
        CreateTimer: 26
        DuplicateHandle: 39
        ExitProcess: 3
        ExitThread: 9
        GetCurrentProcessorNumber: 17
        GetHandleInfo: 41
        GetProcessId: 53
        GetProcessIdOfThread: 54
        GetProcessIdealProcessor: 6
        GetProcessInfo: 43
        GetResourceLimit: 56
        GetResourceLimitCurrentValues: 58
        GetResourceLimitLimitValues: 57
        GetSystemInfo: 42
        GetSystemTick: 40
        GetThreadContext: 59
        GetThreadId: 55
        GetThreadIdealProcessor: 15
        GetThreadInfo: 44
        GetThreadPriority: 11
        MapMemoryBlock: 31
        OutputDebugString: 61
        QueryMemory: 2
        ReleaseMutex: 20
        ReleaseSemaphore: 22
        SendSyncRequest1: 46
        SendSyncRequest2: 47
        SendSyncRequest3: 48
        SendSyncRequest4: 49
        SendSyncRequest: 50
        SetThreadPriority: 12
        SetTimer: 27
        SignalEvent: 24
        SleepThread: 10
        UnmapMemoryBlock: 32
        WaitSynchronization1: 36
        WaitSynchronizationN: 37
      InterruptNumbers:
      ServiceAccessControl:
      - APT:U
      - $hioFIO
      - $hostio0
      - $hostio1
      - ac:u
      - boss:U
      - cam:u
      - cecd:u
      - cfg:u
      - dlp:FKCL
      - dlp:SRVR
      - dsp::DSP
      - frd:u
      - fs:USER
      - gsp::Gpu
      - hid:USER
      - http:C
      - mic:u
      - ndm:u
      - news:u
      - nwm::UDS
      - ptm:u
      - pxi:dev
      - soc:U
      - ssl:C
      - y2r:u
      - ldr:ro
      - ir:USER
     
     
    SystemControlInfo:
      SaveDataSize: 128KB
      RemasterVersion: 0
      StackSize: 0x40000
      JumpId: 0x0004000000065e00
      Dependency:
        ac: 0x0004013000002402L
        am: 0x0004013000001502L
        boss: 0x0004013000003402L
        camera: 0x0004013000001602L
        cecd: 0x0004013000002602L
        cfg: 0x0004013000001702L
        codec: 0x0004013000001802L
        csnd: 0x0004013000002702L
        dlp: 0x0004013000002802L
        dsp: 0x0004013000001a02L
        friends: 0x0004013000003202L
        gpio: 0x0004013000001b02L
        gsp: 0x0004013000001c02L
        hid: 0x0004013000001d02L
        http: 0x0004013000002902L
        i2c: 0x0004013000001e02L
        ir: 0x0004013000003302L
        mcu: 0x0004013000001f02L
        mic: 0x0004013000002002L
        ndm: 0x0004013000002b02L
        news: 0x0004013000003502L
        nim: 0x0004013000002c02L
        nwm: 0x0004013000002d02L
        pdn: 0x0004013000002102L
        ps: 0x0004013000003102L
        ptm: 0x0004013000002202L
        ro: 0x0004013000003702L
        socket: 0x0004013000002e02L
        spi: 0x0004013000002302L
        ssl: 0x0004013000002f02L
    Here is my Rom Tool Information
    Code:
    [+] CCI Image Details
    Media Type:            CARD1
    Media Size:            2 GB (16 Gbit)
    CCI Data Size:        1439 MB (0x59f31200 bytes)
    CCI File:
      > Size                2048 MB
      > Status              Full Size
    Additional Device:    EEPROM
    Partition Count:      3
    Min 3DS Firm:          4.4.0-XJ
    Save Crypto:          2.2.0-4 KeyY Method
    [+] CXI Partition
    Product Code:          CTR-P-AD7J
    Company Code:          GD
    Unique ID:            0065e
    Build Type:            Release
    SDK Version:          4.2.3 Release
    Req. Kernel Version:  2.35-0
    [+] CFA Partitions
    E-Manual:              Yes
    DLP Child:            No
    Update Data:          Yes
    [*] Completed Successfully
    Here is my exheader text:
    Code:
    Extended header:
    Signature:              79FEB5CBC5C9FB606A1E836E60D8994A54D22C1818A076D60FCDB3556A526DEB
                            662B624DA9FEB7A72D3AFE39F3D2D0197DBFE39F0A7B81C1B1303D719AF5F97D
                            A06B3F38CDAB728E8C0C5B9623D7981E1AB3BFA8529A12C51EB10DB6183291E8
                            D0B045FFE0CF03B2601FCD3E9FCE2E892DAE58B6CB17A46ADA5E65D720D0B548
                            F70D9D9524A0A03695ACAA0A0C7DD04D3441691BE7B80DEBF3D830A2F3201103
                            DF02D08572AE9DFDC9A49FC8E8B0AF5127C49281CF274B25A789F8157BFA2E38
                            646485F453647A157D382D4EA9E2042617EA6AF1D9DC2D296D9F30A3B886A866
                            D827A2DE014F6C75F7A581230084053BFC1A00ECD627A8A631B6E179795DB062
     
    NCCH Hdr RSA Modulus:  B79C6AD97DF06536F8660CE772A55840B1007C4A7046D018C0DBE8129A31CAAB
                            A71ED278D1347BBB0429261A3696AE3FBC459B04EFDC3E96EDB19F5B33DBAB17
                            2D4A7338B13B085CE082B0082B25868A253EE3A6BEB5688CD5BEA3EB0716DD0B
                            B0F99969D4D5CD1AD8EC84D133C3731F14AAA0C8F46955CB42C40E80760049DC
                            9284AB7A3EE3ECFC485D50CB4551800064D965C683AA244B0D100A45B0DE1CD5
                            B43AB157CBDF837FEB381A6C9A1BE375695A8C1A1B03D256BAD681A0A4F14FDE
                            E2332914BD29DE09B3840A17A4A3B367BD0466A2FD97EF35E9ED3F119C816E37
                            863278C620FFEE4C1398244D3AF25D38C6B4AD62F7623C3575E73F160812A60D
    Name:                  CtrApp
    Flag:                  01 [compressed]
    Remaster version:      0000
    Code text address:      0x00100000
    Code text size:        0x002A683C
    Code text max pages:    0x000002A7 (0x002A7000)
    Code ro address:        0x003A7000
    Code ro size:          0x0003D1E0
    Code ro max pages:      0x0000003E (0x0003E000)
    Code data address:      0x003E5000
    Code data size:        0x00024FE0
    Code data max pages:    0x00000025 (0x00025000)
    Code bss size:          0x00AA870C
    Code stack size:        0x00040000
    Dependency:            0004013000002402
    Dependency:            0004013000001502
    Dependency:            0004013000003402
    Dependency:            0004013000001602
    Dependency:            0004013000002602
    Dependency:            0004013000001702
    Dependency:            0004013000001802
    Dependency:            0004013000002702
    Dependency:            0004013000002802
    Dependency:            0004013000001a02
    Dependency:            0004013000003202
    Dependency:            0004013000001b02
    Dependency:            0004013000001c02
    Dependency:            0004013000001d02
    Dependency:            0004013000002902
    Dependency:            0004013000001e02
    Dependency:            0004013000003302
    Dependency:            0004013000001f02
    Dependency:            0004013000002002
    Dependency:            0004013000002b02
    Dependency:            0004013000003502
    Dependency:            0004013000002c02
    Dependency:            0004013000002d02
    Dependency:            0004013000002102
    Dependency:            0004013000003102
    Dependency:            0004013000002202
    Dependency:            0004013000003702
    Dependency:            0004013000002e02
    Dependency:            0004013000002302
    Dependency:            0004013000002f02
    Savedata size:          128K
    Jump id:                0004000000065e00
    Program id:            0004000000065e00
    Core version:          0x2
    System mode:            0x0
    Ideal processor:        0
    Affinity mask:          1
    Main thread priority:  48
    Ext savedata id:        0x00000000
    System savedata id 1:  0x00000000
    System savedata id 2:  0x00000000
    OtherUserSaveDataId1:  0x00000
    OtherUserSaveDataId2:  0x00000
    OtherUserSaveDataId3:  0x00000
    Accessible Savedata Ids:
    Other Variation Saves:  Inaccessible
    Access info:            00000000000000
    Other attributes:      00
    Mapping static address: 0x1FF50000 (RW)
    Mapping static address: 0x1FF58000 (RW)
    Mapping static address: 0x1FF70000 (RW)
    Mapping static address: 0x1FF78000 (RW)
    Mapping static address: 0x1F000000 (RO)
    Mapping static address: 0x1F600000 (RO)
    Kernel flags:         
    > Allow debug:        YES
    > Force debug:        NO
    > Allow non-alphanum:  NO
    > Shared page writing: NO
    > Privilege priority:  NO
    > Allow main() args:  NO
    > Shared device mem:  NO
    > Runnable on sleep:  NO
    > Special memory:      NO
    > Memory type:        APPLICATION
    Handle table size:      0x200
    Kernel release version: 2.33
    Allowed systemcalls:    0x01, 0x02, 0x03, 0x06, 0x08, 0x09, 0x0A, 0x0B
                            0x0C, 0x0F, 0x11, 0x13, 0x14, 0x15, 0x16, 0x17
                            0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F
                            0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x27, 0x28
                            0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E, 0x2F, 0x30
                            0x31, 0x32, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3A
                            0x3B, 0x3C, 0x3D
    Allowed interrupts:    none
    ARM9 Desc. version:    0x2
    Mount NAND fs:          NO
    Mount NAND RO write fs: NO
    Mount NAND TWL fs:      NO
    Mount NAND W fs:        NO
    Mount CARD SPI fs:      NO
    Use SDIF3:              NO
    Create seed:            NO
    Use CARD SPI:          NO
    SD Application:        NO
    Use Direct SDMC:        NO
    Service access:        APT:U
    Service access:        $hioFIO
    Service access:        $hostio0
    Service access:        $hostio1
    Service access:        ac:u
    Service access:        boss:U
    Service access:        cam:u
    Service access:        cecd:u
    Service access:        cfg:u
    Service access:        dlp:FKCL
    Service access:        dlp:SRVR
    Service access:        dsp::DSP
    Service access:        frd:u
    Service access:        fs:USER
    Service access:        gsp::Gpu
    Service access:        hid:USER
    Service access:        http:C
    Service access:        mic:u
    Service access:        ndm:u
    Service access:        news:u
    Service access:        nwm::UDS
    Service access:        ptm:u
    Service access:        pxi:dev
    Service access:        soc:U
    Service access:        ssl:C
    Service access:        y2r:u
    Service access:        ldr:ro
    Service access:        ir:USER
    Reslimit category:      00
    
    Ultimately I am recompiling my CCI using this RSF, desc app:7 (tried 2 and 4 because i thought it corresponded to the kernel minor/major), used target g (for GW keys) and fed it my decrypted icon.bin, banner.bin, code.bin and my exheader.bin (I gave it the decrypted exheader.bin)

    Exheader.txt came from the decrypted exheader (which gave me the odd title I thought, CtrApp is strange since it is Dragon Quest VII).

    Can anyone give me a hand? I've been trying to figure this whole process out for 2 days.
    I should note that I've been editting game files (they are just text files) as well, as we are working on a translation. BUT..... I have just been trying to rebuild the initial uneditted dump.

    Thanks in advance.
     
  2. Helmax
    OP

    Helmax GBAtemp Regular

    Member
    188
    276
    Feb 17, 2011
    United States
    Anyone? Im bumping this back up.
     
  3. liomajor

    liomajor GBAtemp Maniac

    Member
    1,463
    1,065
    Jun 10, 2008
    United States
  4. Helmax
    OP

    Helmax GBAtemp Regular

    Member
    188
    276
    Feb 17, 2011
    United States
    Thanks Lio, I'll check it out
     
  5. Helmax
    OP

    Helmax GBAtemp Regular

    Member
    188
    276
    Feb 17, 2011
    United States
    So I checked out the tool, and it still requires me to create an RSF, which I've tried multiple variations of.
    Is the Rsfgen.py script what's being used for the AUTO RSF? And it looks like that is probably only being used for the CIA file generation, since you need a 1:1 rsf for a 3ds file.

    Everytime this 3DS file gets repacked, and i drop it on my gateway, it has a white icon, no title underneath, and doesnt load (even before and after using your tool).
    The original 3DS pack I found worked fine, but decrypted with a smaller code.bin file.
    The CIA i found unpacks and has what I would expect for a code.bin file, and I can actually see a ton of function references.

    I would love to write a tool using your knowledge to auto generate 1:1 RSF for 3DS files.
    There has got to be a good way, seeing as we can extract this information using ROM_TOOL, CTRTOOL and 3DSEXPLORER.

    Thoughts? Would you like to help with make something like this? Or are you thinking it's not possible yet with the scenes knowledge.
    I've been reading your posts on the subject, and reading about every type of file format on 3dsbrew, which still hasnt helped me make the correct RSF file for this.
     
  6. liomajor

    liomajor GBAtemp Maniac

    Member
    1,463
    1,065
    Jun 10, 2008
    United States
    Of course you need an .rsf

    Maybe you didn't see my hint for what needs to be changed if you use my template for .3ds

    It should be:
    Code:
    BasicInfo:
      Title                   : "CtrApp" #CHANGE ME
      CompanyCode             : "GD" #CHANGE ME
      ProductCode             : "CTR-P-AD7J" #CHANGE ME
      ContentType             : Application # Application / SystemUpdate / Manual / Child / Trial
      Logo                    : Nintendo # Nintendo / Licensed / Distributed / iQue / iQueForSystem
    
    TitleInfo:
      UniqueId                : 0x0065e #CHANGE ME
      Category                : Application # Application / SystemApplication / Applet / Firmware / Base / DlpChild / Demo / Contents / SystemContents / SharedContents / AddOnContents / Patch / AutoUpdateContents
    
    CardInfo:
      MediaSize               : 2GB # 128MB / 256MB / 512MB / 1GB / 2GB / 4GB / 8GB / 16GB / 32GB #CHANGE ME
      MediaType               : Card1 # Card1 / Card2 #CHANGE ME
      CardDevice              : NorFlash # NorFlash(Pick this if you use savedata) / None (Choose None if it's a card2 game)
      
    
    Option:
      UseOnSD                 : false # true if App is to be installed to SD #CHANGE ME
      EnableCompress          : true # Compresses exefs code #CHANGE ME
      FreeProductCode         : true # Removes limitations on ProductCode #CHANGE ME
      EnableCrypt             : true # Enables encryption for NCCH and CIA #CHANGE ME
      MediaFootPadding        : true # If true CCI files are created with padding #CHANGE ME
    
    ExeFs: # these are the program segments from the ELF, check your elf for the appropriate segment names
      ReadOnly: 
       - .rodata
       - RO
      ReadWrite: 
       - .data
       - RO
      Text: 
       - .init
       - .text
       - STUP_ENTRY
       
    PlainRegion: # only used with SDK ELFs 
     - .module_id
       
    AccessControlInfo:
      ExtSaveDataId: 0x0000065e
      SystemSaveDataId1: 0x00000000
      SystemSaveDataId2: 0x00000000
      OtherUserSaveDataId1: 0x00000
      OtherUserSaveDataId2: 0x00000
      OtherUserSaveDataId3: 0x00000
      #UseOtherVariationSaveData : true
      #UseExtendedSaveDataAccessControl: true
      #AccessibleSaveDataIds: [0x101, 0x202, 0x303, 0x404, 0x505, 0x606]
      FileSystemAccess:
       #- Boss
       #- CardBoard
       #- CategoryFileSystemTool
       #- CategoryHardwareCheck
       #- CategoryHomeMenu
       #- CategorySystemApplication
       #- CategorySystemSettings
       #- Core
       #- CtrNandRo
       #- CtrNandRoWrite
       #- CtrNandRw
        - Debug
        - DirectSdmc
       #- DirectSdmcWrite
       #- ExportImportIvs
       #- SaveDataMove
       #- Shell
       #- Shop
       #- SwitchCleanup
       #- TwlCardBackup
       #- TwlNandData
       
    SystemControlInfo:
      SaveDataSize: 128KB #CHANGE ME
      RemasterVersion: 5
      StackSize: 0x40000
      JumpId: 0x0004000000065e00
     
  7. Helmax
    OP

    Helmax GBAtemp Regular

    Member
    188
    276
    Feb 17, 2011
    United States
    I did miss that! You should definately update your signature to include this link.
    I really like to the tool, I was actually making one myself, but you beat me to it!

    Ill give this a shot when i have a chance and let you know how it worked out for me.

    Thanks again Lio.