MHX DLC Encryption

Discussion in '3DS - ROM Hacking, Translations and Utilities' started by moghedien, Nov 27, 2015.

  1. moghedien
    OP

    moghedien GBAtemp Fan

    Member
    411
    247
    Mar 9, 2015
    United States
    I added support for MHX DLC encryption to my code: https://github.com/svanheulen/mhef
    Capcom decided to use a non-SSL connection again for transferring DLC files so we can still proxy in replacements (edit: They added signatures to MHGen so it's no longer possible to proxy quests), but they did change the file formats (and encryption algorithm, obviously).
    I'll be adding information about file formats to the wiki here: https://github.com/svanheulen/mhff/wiki

    This code is for developers, not end users.
    Edit: You can get the encryption keys using my MHX Data Manager homebrew appilcation.
     
    Last edited by moghedien, Aug 15, 2016


  2. Talexius

    Talexius Advanced Member

    Newcomer
    83
    16
    Nov 9, 2014
    Mexico
    Wow thank you!
     
  3. SaagiBols

    SaagiBols The AnalSavior

    Member
    319
    101
    Jan 29, 2015
    Serbia, Republic of
    Here, There, and Everywhere!..
    can you also look in to saves? the items box data seems crypted and maybe some other parts!?!
     
    -Xin- likes this.
  4. moghedien
    OP

    moghedien GBAtemp Fan

    Member
    411
    247
    Mar 9, 2015
    United States
    Looking into it right now.
     
    SaagiBols likes this.
  5. SaagiBols

    SaagiBols The AnalSavior

    Member
    319
    101
    Jan 29, 2015
    Serbia, Republic of
    Here, There, and Everywhere!..
    by the way! i forgot to ask: Have you made any custom quests/dlc's 4 yourself yet???
     
    -Xin- likes this.
  6. moghedien
    OP

    moghedien GBAtemp Fan

    Member
    411
    247
    Mar 9, 2015
    United States
    I haven't tried messing with it yet, but I'm sure there's all sorts of checks like MH4U had.
     
  7. imthe666st

    imthe666st Felyne Hunter

    Member
    355
    166
    Aug 16, 2015
    Germany
    ><HFB>
    So the encrypted file in an .arc file. How do you open it?
    I tried opening the arc file with ARCtools, which worked fine on the romfs arc files in mh4u, but if I try to use it on the decrypted dlc arc file it just gives me a file that's empty..
     
  8. moghedien
    OP

    moghedien GBAtemp Fan

    Member
    411
    247
    Mar 9, 2015
    United States
  9. imthe666st

    imthe666st Felyne Hunter

    Member
    355
    166
    Aug 16, 2015
    Germany
    ><HFB>
    Alright, so I downloaded the file, and tried to execute it on my decrypted arc file.
    Now it returns me an error : "ValueError: zero length field name in format ", which is cast by "file_extension = '{:08X}'.format(file_type_code)" in extract_arc

    I have the output set to a valid directory.
     
  10. moghedien
    OP

    moghedien GBAtemp Fan

    Member
    411
    247
    Mar 9, 2015
    United States
    What version of Python are you using? As far as I can tell, that particular error can only happen in pretty old versions but I know it works fine in 3.5.
     
  11. imthe666st

    imthe666st Felyne Hunter

    Member
    355
    166
    Aug 16, 2015
    Germany
    ><HFB>
    I'm still using Python 2.6 , I'll try and update to Python 3.5 now :)

    EDIT: Thank you, seems like it was the python version.

    EDIT2: How can you recompress the ARC file after I decompressed it and made a change? Arc.py only has an extract_arc, or am I missing something ?
     
    Last edited by imthe666st, Nov 29, 2015
  12. moghedien
    OP

    moghedien GBAtemp Fan

    Member
    411
    247
    Mar 9, 2015
    United States
    Yeah, sorry I need to added the ability to create ARCs to that script. I have some code for it, I just need to clean it up a bit first. I'll post here when I have it added.
     
  13. imthe666st

    imthe666st Felyne Hunter

    Member
    355
    166
    Aug 16, 2015
    Germany
    ><HFB>
    Alright, thank you for your awesome work :)
    Take your time
     
  14. moghedien
    OP

    moghedien GBAtemp Fan

    Member
    411
    247
    Mar 9, 2015
    United States
    I added ARC creation support (and just fixed a bug, so get the new version).
    Also I tested it, but all I did was change the text of the quest. I'm sure there's checks that may prevent certain changes like there was in MH4U and I'll do more testing on that later.
    [​IMG]
     
    -Xin-, imthe666st and SaagiBols like this.
  15. imthe666st

    imthe666st Felyne Hunter

    Member
    355
    166
    Aug 16, 2015
    Germany
    ><HFB>
    Does the input_files has to be a list? like ["file1", "file2"].. etc?
     
  16. moghedien
    OP

    moghedien GBAtemp Fan

    Member
    411
    247
    Mar 9, 2015
    United States
    Here's an example:
    Code:
    python arc.py c new.arc quest/questData/questData_1010002_jpn.gmd quest/boss/setEmMain/b_m01em080_02.sem quest/boss/setEmMain/b_m00em000_00.sem quest/zako/emSetList/z_m01d_050.esl quest/zako/emSetList/z_m01d_054.esl quest/zako/emSetList/z_m00d_000.esl quest/rem/rem_610004.rem quest/rem/rem_610005.rem quest/rem/rem_000000.rem quest/rem/rem_610006.rem quest/supp/supp_1010002.sup quest/questData/questData_1010002.mib
    I know it's kind of a pain having to put each individual file name but I'll work on making it easier to use. Also make sure the folder structure is the same as it was in the original.
     
  17. imthe666st

    imthe666st Felyne Hunter

    Member
    355
    166
    Aug 16, 2015
    Germany
    ><HFB>
    Alright, so I tried to make some changes and upload these files on my nginx server so I can download them, after I redirect the request. It downloads the file, but the problem is, that it won't show for me when I try to select the quest.
    I editied /quest/supp/supp_1010002.sup
    Trying to redownload the original DLC file works without any problems and it is shown in the Event Quest Menu.
     
  18. moghedien
    OP

    moghedien GBAtemp Fan

    Member
    411
    247
    Mar 9, 2015
    United States
    Can you upload your ARC so I can look at it?
    I was just about to post that I added info about some of the quest file formats to the wiki and also that I was able to change the supply box items:
    [​IMG]
     
    -Xin- and SaagiBols like this.
  19. imthe666st

    imthe666st Felyne Hunter

    Member
    355
    166
    Aug 16, 2015
    Germany
    ><HFB>
    Sure, here is the dlc arc file.
    I'll take a quick look into the wiki now, maybe you can find an error ^^

    EDIT: The supply box is quest/supp/supp1010002.sup , isn't it?
    I just tried downloading the original dlc I put on the nginx via redirect and it showed up.. so I must have made a mistake, somewhere
     
    Last edited by imthe666st, Dec 1, 2015
  20. moghedien
    OP

    moghedien GBAtemp Fan

    Member
    411
    247
    Mar 9, 2015
    United States
    Ok, I looked at your file and I think I see the problem. In MH4U people said there was an issue where the first item in the supply box (and reward box) couldn't be modified. So try modifying a different item or just add a new item.
    Also, I don't think this makes a difference, but I kept the order of the files in the ARC the same as the original.