ROM Hack MH4U DLC and savefile encryption

yakuma

Well-Known Member
Newcomer
Joined
Dec 27, 2007
Messages
75
Trophies
0
XP
572
Country
Indonesia
@monghedien.
i already install python 3.4 and crypto 2.6.1 for python 3.4 and install setup.py from u site.
but i still get error

C:\Python34>python exsample\n3ds\savedata.py
Traceback (most recent call last):
File "exsample\n3ds\savedata.py", line 20, in <module>
import mhef.n3ds
File "C:\Python34\lib\site-packages\mhef-1.0.0b4-py3.4.egg\mhef\n3ds.py", line
20, in <module>
from Crypto.Cipher import Blowfish
File "C:\Python34\lib\site-packages\Crypto\Cipher\Blowfish.py", line 56, in <m
odule>
from Crypto.Cipher import _Blowfish
ImportError: DLL load failed: %1 is not a valid Win32 application.

even with dlc i still get error.

can u explain how to fix this
 

moghedien

Well-Known Member
OP
Member
Joined
Mar 9, 2015
Messages
411
Trophies
0
XP
317
Country
United States
@monghedien.
i already install python 3.4 and crypto 2.6.1 for python 3.4 and install setup.py from u site.
but i still get error

C:\Python34>python exsample\n3ds\savedata.py
Traceback (most recent call last):
File "exsample\n3ds\savedata.py", line 20, in <module>
import mhef.n3ds
File "C:\Python34\lib\site-packages\mhef-1.0.0b4-py3.4.egg\mhef\n3ds.py", line
20, in <module>
from Crypto.Cipher import Blowfish
File "C:\Python34\lib\site-packages\Crypto\Cipher\Blowfish.py", line 56, in <m
odule>
from Crypto.Cipher import _Blowfish
ImportError: DLL load failed: %1 is not a valid Win32 application.

even with dlc i still get error.

can u explain how to fix this
Based on that error message it looks like you installed Python and mhef correctly. I think the issue is that you may have installed the 32bit version of Python but the 64bit version of PyCrypto (or maybe the other way around).
 

yakuma

Well-Known Member
Newcomer
Joined
Dec 27, 2007
Messages
75
Trophies
0
XP
572
Country
Indonesia
Based on that error message it looks like you installed Python and mhef correctly. I think the issue is that you may have installed the 32bit version of Python but the 64bit version of PyCrypto (or maybe the other way around).

u right hehhehe.
it fix now. thanks.
do you have tutorial to modif dlc
 

AzuraLove

Well-Known Member
Newcomer
Joined
Jul 6, 2015
Messages
65
Trophies
0
Age
35
XP
113
Country
Indonesia
Hmm, I just tried it on mine and it worked fine (I even changed my character's name). I just used Pasta to run SaveDataFiler. I don't have a GW so I'm not sure what that switching method is.

This what i do with cmd,
am i wrong or missing something ?

C:\Python34>python setup.py install
running install
running bdist_egg
running egg_info
writing dependency_links to mhef.egg-info\dependency_links.txt
writing requirements to mhef.egg-info\requires.txt
writing mhef.egg-info\PKG-INFO
writing top-level names to mhef.egg-info\top_level.txt
reading manifest file 'mhef.egg-info\SOURCES.txt'
writing manifest file 'mhef.egg-info\SOURCES.txt'
installing library code to build\bdist.win32\egg
running install_lib
running build_py
creating build\bdist.win32\egg
creating build\bdist.win32\egg\mhef
copying build\lib\mhef\n3ds.py -> build\bdist.win32\egg\mhef
copying build\lib\mhef\psp.py -> build\bdist.win32\egg\mhef
copying build\lib\mhef\__init__.py -> build\bdist.win32\egg\mhef
byte-compiling build\bdist.win32\egg\mhef\n3ds.py to n3ds.cpython-34.pyc
byte-compiling build\bdist.win32\egg\mhef\psp.py to psp.cpython-34.pyc
byte-compiling build\bdist.win32\egg\mhef\__init__.py to __init__.cpython-34.pyc

creating build\bdist.win32\egg\EGG-INFO
copying mhef.egg-info\PKG-INFO -> build\bdist.win32\egg\EGG-INFO
copying mhef.egg-info\SOURCES.txt -> build\bdist.win32\egg\EGG-INFO
copying mhef.egg-info\dependency_links.txt -> build\bdist.win32\egg\EGG-INFO
copying mhef.egg-info\requires.txt -> build\bdist.win32\egg\EGG-INFO
copying mhef.egg-info\top_level.txt -> build\bdist.win32\egg\EGG-INFO
zip_safe flag not set; analyzing archive contents...
creating 'dist\mhef-1.0.0b3-py3.4.egg' and adding 'build\bdist.win32\egg' to it
removing 'build\bdist.win32\egg' (and everything under it)
Processing mhef-1.0.0b3-py3.4.egg
Removing c:\python34\lib\site-packages\mhef-1.0.0b3-py3.4.egg
Copying mhef-1.0.0b3-py3.4.egg to c:\python34\lib\site-packages
mhef 1.0.0b3 is already the active version in easy-install.pth

Installed c:\python34\lib\site-packages\mhef-1.0.0b3-py3.4.egg
Processing dependencies for mhef==1.0.0b3
Searching for pycrypto==2.6.1
Best match: pycrypto 2.6.1
Adding pycrypto 2.6.1 to easy-install.pth file

Using c:\python34\lib\site-packages
Finished processing dependencies for mhef==1.0.0b3

C:\Python34>python examples\n3ds\savedata.py d user1 user1x

C:\Python34>python examples\n3ds\savedata.py e user1x user1xe

C:\Python34>

and i try to import it with SDF .. Fail again.....

you use Pasta, so your game must be Cia , and have no header...
maybe, just maybe, the decrypt and encrypt syntax not include the header of the game ?
 
Last edited by AzuraLove,

lys1030

Member
Newcomer
Joined
Jul 8, 2015
Messages
20
Trophies
0
Age
30
XP
86
Country
United States
First of all, huge thanks for the open source!
I encounter a problem with local server setup. I am a JPN version MH4G player. I inspected your code and made a few changes accordingly:

mhef-master/mhef/n3ds.py line 88:
# if game == MH4G_NA or game == MH4G_EU or game == MH4G_JP:

mhqs-master/mh4u_proxy.py line 98-99:
# parser.add_argument('region', choices=('USA', 'EUR', 'JPN'), help='your game region')
# parser.add_argument('language', choices=('eng', 'fre', 'spa', 'ger', 'ita', 'jpn'), help='your game language')

-----------------

Now the problem is as follows:
1. 3DS shows error message 090-2442.
2. logs on shell when I tried to download DLC on 3DS:
V3RfK1h.png

3. I made sure that the file names are correct on the server:
Z3r9bgx.png
Bo5Vwys.png


Any help? It seems the rest of the files are not transmitted.
Thanks in advance!!!
You can use technical terms if you have any advice, since I have a general idea of TCP protocol.
BTW, when you are offline on freenode, I cannot leave a message, which is quite inconvenient. Is there any way I can reach your team?
 
Last edited by lys1030,

moghedien

Well-Known Member
OP
Member
Joined
Mar 9, 2015
Messages
411
Trophies
0
XP
317
Country
United States
This what i do with cmd,
am i wrong or missing something ?

C:\Python34>python setup.py install
running install
running bdist_egg
running egg_info
writing dependency_links to mhef.egg-info\dependency_links.txt
writing requirements to mhef.egg-info\requires.txt
writing mhef.egg-info\PKG-INFO
writing top-level names to mhef.egg-info\top_level.txt
reading manifest file 'mhef.egg-info\SOURCES.txt'
writing manifest file 'mhef.egg-info\SOURCES.txt'
installing library code to build\bdist.win32\egg
running install_lib
running build_py
creating build\bdist.win32\egg
creating build\bdist.win32\egg\mhef
copying build\lib\mhef\n3ds.py -> build\bdist.win32\egg\mhef
copying build\lib\mhef\psp.py -> build\bdist.win32\egg\mhef
copying build\lib\mhef\__init__.py -> build\bdist.win32\egg\mhef
byte-compiling build\bdist.win32\egg\mhef\n3ds.py to n3ds.cpython-34.pyc
byte-compiling build\bdist.win32\egg\mhef\psp.py to psp.cpython-34.pyc
byte-compiling build\bdist.win32\egg\mhef\__init__.py to __init__.cpython-34.pyc

creating build\bdist.win32\egg\EGG-INFO
copying mhef.egg-info\PKG-INFO -> build\bdist.win32\egg\EGG-INFO
copying mhef.egg-info\SOURCES.txt -> build\bdist.win32\egg\EGG-INFO
copying mhef.egg-info\dependency_links.txt -> build\bdist.win32\egg\EGG-INFO
copying mhef.egg-info\requires.txt -> build\bdist.win32\egg\EGG-INFO
copying mhef.egg-info\top_level.txt -> build\bdist.win32\egg\EGG-INFO
zip_safe flag not set; analyzing archive contents...
creating 'dist\mhef-1.0.0b3-py3.4.egg' and adding 'build\bdist.win32\egg' to it
removing 'build\bdist.win32\egg' (and everything under it)
Processing mhef-1.0.0b3-py3.4.egg
Removing c:\python34\lib\site-packages\mhef-1.0.0b3-py3.4.egg
Copying mhef-1.0.0b3-py3.4.egg to c:\python34\lib\site-packages
mhef 1.0.0b3 is already the active version in easy-install.pth

Installed c:\python34\lib\site-packages\mhef-1.0.0b3-py3.4.egg
Processing dependencies for mhef==1.0.0b3
Searching for pycrypto==2.6.1
Best match: pycrypto 2.6.1
Adding pycrypto 2.6.1 to easy-install.pth file

Using c:\python34\lib\site-packages
Finished processing dependencies for mhef==1.0.0b3

C:\Python34>python examples\n3ds\savedata.py d user1 user1x

C:\Python34>python examples\n3ds\savedata.py e user1x user1xe

C:\Python34>

and i try to import it with SDF .. Fail again.....

you use Pasta, so your game must be Cia , and have no header...
maybe, just maybe, the decrypt and encrypt syntax not include the header of the game ?
Yeah, I got the special edition Monster Hunter New 3DS XL so the game came installed on the microSD card. It looks like you're doing everything correctly. I'm sorry but I don't think there's much else I can do to help :(

First of all, huge thanks for the open source!
I encounter a problem with local server setup. I am a JPN version MH4G player. I inspected your code and made a few changes accordingly:

mhef-master/mhef/n3ds.py line 88:
# if game == MH4G_NA or game == MH4G_EU or game == MH4G_JP:

mhqs-master/mh4u_proxy.py line 98-99:
# parser.add_argument('region', choices=('USA', 'EUR', 'JPN'), help='your game region')
# parser.add_argument('language', choices=('eng', 'fre', 'spa', 'ger', 'ita', 'jpn'), help='your game language')

-----------------

Now the problem is as follows:
1. 3DS shows error message 090-2442.
2. logs on shell when I tried to download DLC on 3DS:
V3RfK1h.png

3. I made sure that the file names are correct on the server:
Z3r9bgx.png
Bo5Vwys.png


Any help? It seems the rest of the files are not transmitted.
Thanks in advance!!!
You can use technical terms if you have any advice, since I have a general idea of TCP protocol.
BTW, when you are offline on freenode, I cannot leave a message, which is quite inconvenient. Is there any way I can reach your team?
Making those changes wont help. The reason that it wont work with the Japanese version of the game is that I don't have the encryption key used for the Japanese game. It currently only works with the European and USA versions of the game.

But if you are able to run NTR CFW on your 3DS I can walk you through the process of getting the key and then I can make it work for the Japanese game.

As for not being online on freenode, sorry, I'm in the eastern timezone. But you can leave me a message on there even if I'm offline using MemoServ: https://freenode.net/faq.shtml#memoserv
 

lys1030

Member
Newcomer
Joined
Jul 8, 2015
Messages
20
Trophies
0
Age
30
XP
86
Country
United States
Yeah, I got the special edition Monster Hunter New 3DS XL so the game came installed on the microSD card. It looks like you're doing everything correctly. I'm sorry but I don't think there's much else I can do to help :(


Making those changes wont help. The reason that it wont work with the Japanese version of the game is that I don't have the encryption key used for the Japanese game. It currently only works with the European and USA versions of the game.

But if you are able to run NTR CFW on your 3DS I can walk you through the process of getting the key and then I can make it work for the Japanese game.

As for not being online on freenode, sorry, I'm in the eastern timezone. But you can leave me a message on there even if I'm offline using MemoServ: https://freenode.net/faq.shtml#memoserv
I see. Thanks! However, the 7 quests you served actually can be downloaded on MH4G Japanese version. How does that happen? btw, my ID is lys1030, so you know who i am if I msg u on freenode.
 
Last edited by lys1030,

moghedien

Well-Known Member
OP
Member
Joined
Mar 9, 2015
Messages
411
Trophies
0
XP
317
Country
United States
I see. Thanks! However, the 7 quests you served actually can be downloaded on MH4G Japanese version. How does that happen?
I've never released any quests. I assume you're talking about the ones on Kiranico? That was released by a person named dasding. He figured that out by himself and from talking to him, he doesn't seem interested in sharing his findings.
 

lys1030

Member
Newcomer
Joined
Jul 8, 2015
Messages
20
Trophies
0
Age
30
XP
86
Country
United States
I've never released any quests. I assume you're talking about the ones on Kiranico? That was released by a person named dasding. He figured that out by himself and from talking to him, he doesn't seem interested in sharing his findings.
OK. I thought you work together on it. My apology. I'd love to run a NTR CFW and make a try. I'll msg you if I make the step. Thank you again for the contribution! As a programmer, I do understand how awesome open source is!
 

dervd

New Member
Newbie
Joined
Jul 10, 2015
Messages
1
Trophies
0
Age
30
XP
41
Country
United States
Hello,

I made a really quick guide on using this here: link

I'll post a copy here:

Creating Custom MH4U Quests - A simple? guide v0.1

A image-based guide on how to start creating your own custom DLC quests.

Acknowledgements

Svan - Creator of tools to encrypt/decrypt files
Kyo_100 of GameFAQs for original guide

Installation

Necessary files:
Item Database (data.db)
SQLite Viewer - Portable app recommended
Hex Workshop
svanheulen's mhef files to encrypt/decrypt ("Download as Zip")
SKFU Proxy
Python 2.7
PyCrypto

Download all of these files, put them into a single folder or manage them however you like.

Follow these steps in order, or if you know what you're doing, do whatever you want. :P

Installing Python and PyCrypto
Installing Python is straightforward, we're going to use 2.7 - just run the installer. Afterwards, open up a command prompt and type in python - if it works, you will see a dialogue. Type exit() to quit.

If you get a message stating that python is not a recognized command, go to Start -> Control Panel -> System -> Advanced System Settings -> Environment Variables

Under System Variables, you'll see a Variable called PATH or Path, double click the 'Value' portion, and add ;C:\Python27

After the last entry.

So if it was

C:\System32\

It will now be:

C:\System32;C:\Python27

Afterwards, install the PyCrypto package for Python 2.7, doesn't matter if there's asc or not. It should know where your Python folder is.

Installing the rest of the programs
Fairly straightforward, just install them one by one.
Unzip the mhef files, if should be called mhef-master.

Open a command line in mhef-master (You can shift+right click and select "Open Command Prompt in this Folder")

Copy+paste or type in the following command:
Code:
python setup.py install

Set up your puu.sh account properly.

Downloading your first DLC quest from Capcom servers
For this example, we'll be using the DLC quest Protector of Peace as our initial subject. It is a G1 rank quest - Kill a Tetsucabra and a Frenzied Tetsucabra

1. Open a command line in mhef-master\tools.
2. Enter this command:
Code:
python download_n3ds.py m60239.mib m60239.mib
You'll now see a m60239.mib file in your folder.
3. Copy this file to the mhef-master\examples\n3ds folder, open another command line here.
4. To decrypt this file into something editable, use this command:
Code:
python dlc.py d m60239.mib m60239_d.mib
5. Now, open up SQLite browser, and open up Data.db. Go to Browse Data and select the items table.
51ef0a7a26.png


To find a specific ID of an item, type the EXACT name into the filter. Use Kiranico if you don't know the exact name.

6. Open up the m60239_d.mib with Hex Workshop, you'll see something like this:
127e7a7840.png


So for now, we'll cover how to edit supply box.

Start a search for Hex Values (CTRL + F)
ceddf7d988.jpg


We know from playing the game that this quest's initial supply box has 15 Freeze S.

The item ID in DEC(imal) for Freeze S is 105. We need to convert this to HEX in order to edit our quest.
To do this, use a Dec to Hex webpage, or a notepad++ plugin that converts this stuff automatically.

We see that 105 becomes 69.

These supply box values are in 4 bytes, which means if it ends up being something like 69 we'll add a 0 in front of it. So it becomes 00 69.

However, the way these bytes are in the file are reversed per 2 bytes, so it actually becomes 69 00.

Now, in the supply box there's 15 of these, we convert 15 to hex, to get F. This is also in 4 bytes, so it would be 00 0F. Similarily, inversing this gives us 0F 00.

So if we put this all together, we'll get

69000F00

Searching for this string will bring us to a specific location.

Now, let's say we want to replace this reward with something like a Fatalis Flameshell.

Fatalis Flameshell ID: 1590
->HEX-> 0636 ->INVERSE-> 36 06

So to edit, just click in front of 69 00 and replace with 36 06.

bdb89a6b5e.png


If you want to change that 15 to 99, convert 99 to hex -> 00 63

Invert, 63 00. Replace 0F 00 with 63 00.

You just edited your supply box from 15 Freeze S to 99 Fatalis Flameshells!

So now we have to save our file, then encrypt it back so we can download it onto our 3DS. So let's go to the next step.

7. To encrypt this file into something usable on the 3DS, use this command:
Code:
python dlc.py e m60239_d.mib m60239.mib

This will replace the old m60239.mib with your new one.

8. We want to upload this file to puu.sh for use. Open up the puu.sh window:
ceae42e36b.png


Change it so that you upload a file when you double-click (my preference), but you can just upload via right click. Upload your m60239.mib file.

Puu.sh will automatically copy the link once you do.

9. Now make a file called rules.httprls and put this in there:

Code:
http://goshawk.capcom.co.jp/3ds/mh4g_eu_/m60239.mib
http://puu.sh/iQVUX/c120b9257f.mib << your puu.sh link that was copied
http://goshawk.capcom.co.jp/3ds/mh4g_us_/m60239.mib
http://puu.sh/iQVUX/c120b9257f.mib << your puu.sh link that was copied

Make sure you save it as 'all' and not as a .txt

10. Run SKFUpr0xy.exe
f7188ce13a.png


Import rules into HTTP(s). It should detect automatically your proxy IP. Setup your 3DS to connect through this proxy, there's plenty of guides on that already. Press Start.

11. Go on MH4U and download the quest, it will be called Protector of Peace or something similar (can't remember exactly). If you already have it, check it again and redownload + save.

12. Go to a G-Rank hall, go to event quests, and run it. You should see 99 shells instead of the Freeze S.

Editing Monster data/other stuffs
Coming soon...?

Some questions/answers

Question said:
Hey, when I try to decrypt the quest, it tell me that there's no module named mhef.n3ds. I've been told that it's because I haven't installed Pycrypto but I definitely ran the exe and it recognized my version of python. Any idea what I'm supposed to do?

Make sure you do this step:
Copy+paste or type in the following command:
python setup.py install

Question said:
Hi, can I ask how to download a specific DLC like you did? I mean, how do you know the id of the dlc so you can download it to edit it

You can do this by decrypting this file: http://goshawk.capcom.co.jp/3ds/mh4g_us_/DLC_EventQuestInfo_eng.txt
And matching id's with names.

Here's a decrypted one already: not formatted as well as possible sry
 

moghedien

Well-Known Member
OP
Member
Joined
Mar 9, 2015
Messages
411
Trophies
0
XP
317
Country
United States
Here's the database: https://mega.nz/#!Z15AhLSb!gAFSK5XVyif6o6T7dqp4avNIIkCPiipH-g3DFdL_zxI
I made that so it would be easier for people to analyze the structure of the quest file format by being able to see what some of the numbers mean. I do appreciate any and all contributions. Although there are much more interesting possibilities then just changing the supply box items :) Keep up the good work, experiment and try new things :)

I made a channel on freenode for discussing the file format: ##mhresearch (yes that's two #s)
My nick is svanheulen
 
  • Like
Reactions: AzuraLove

Arimantha

Member
Newcomer
Joined
May 13, 2015
Messages
7
Trophies
0
Age
35
XP
53
Country
United States
svan - did you get the encryption keys with a flashcart? I have one that can run MH4G and download their DLCs; if you want to walk me through how to do it I'm happy to try and work with you on getting it decrypted.
 

Bunyan

Active Member
Newcomer
Joined
Jul 10, 2015
Messages
26
Trophies
0
Age
31
XP
41
Country
United States
When I tried running python setup.py install on the mhef-master folder I got the error Warning: GMP or MPIR Library not found: Not building Crypto.PublicKey._fastmath.
error: Setup scrip exited with error: Microsoft Visual C++10.0 is required <Unable to find vcvarsall.bat>.
I have looked for Microsoft Visual C++10 and it says I have a newer version of this and that my computer does not meet the requirements to download this.
 

lys1030

Member
Newcomer
Joined
Jul 8, 2015
Messages
20
Trophies
0
Age
30
XP
86
Country
United States
When I tried running python setup.py install on the mhef-master folder I got the error Warning: GMP or MPIR Library not found: Not building Crypto.PublicKey._fastmath.
error: Setup scrip exited with error: Microsoft Visual C++10.0 is required <Unable to find vcvarsall.bat>.
I have looked for Microsoft Visual C++10 and it says I have a newer version of this and that my computer does not meet the requirements to download this.
Try this way:
Go to the place you installed python, usually C:\python27. Then, go to a folder called Scripts, usually the path will be C:\python27\Scripts. In this folder you can see a file called easy_install.exe. You can use it to install pycrypto. Open your windows cmd, and go to the Scripts folder. Type the following command without quotation marks:

"easy_install http://www.voidspace.org.uk/downloads/pycrypto26/pycrypto-2.6.win32-py2.7.exe"
 

moghedien

Well-Known Member
OP
Member
Joined
Mar 9, 2015
Messages
411
Trophies
0
XP
317
Country
United States
svan - did you get the encryption keys with a flashcart? I have one that can run MH4G and download their DLCs; if you want to walk me through how to do it I'm happy to try and work with you on getting it decrypted.
You need to be able to run NTR CFW so that you can read/write memory. If you can, find me on freenode so that I can walk you through how to get the key.

When I tried running python setup.py install on the mhef-master folder I got the error Warning: GMP or MPIR Library not found: Not building Crypto.PublicKey._fastmath.
error: Setup scrip exited with error: Microsoft Visual C++10.0 is required <Unable to find vcvarsall.bat>.
I have looked for Microsoft Visual C++10 and it says I have a newer version of this and that my computer does not meet the requirements to download this.
You should install PyCrypto first.
 

Bunyan

Active Member
Newcomer
Joined
Jul 10, 2015
Messages
26
Trophies
0
Age
31
XP
41
Country
United States
Try this way:
Go to the place you installed python, usually C:\python27. Then, go to a folder called Scripts, usually the path will be C:\python27\Scripts. In this folder you can see a file called easy_install.exe. You can use it to install pycrypto. Open your windows cmd, and go to the Scripts folder. Type the following command without quotation marks:

"easy_install http://www.voidspace.org.uk/downloads/pycrypto26/pycrypto-2.6.win32-py2.7.exe"

Everything works now. Thanks! :)
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
    Xdqwerty @ Xdqwerty: @K3Nv2, prove it