This is my WIP private server for Shin Megami Tensei:Dx2
Follow along on my dev journey at https://www.youtube.com/watch?v=yyznmOjwHMI&list=PLV4ay6xrx8nRm06QnXDBUYqTn3Xk_-wdr
The completed server will aim to have the game fully operational, including multiplayer components
It should be noted that this is a rewrite of my first attempt
The uploaded code will NOT have game assets from Sega's servers. There is an asset scraper however.
Make sure you have nodejs installed (https://nodejs.org/en/download/).
Also make sure you have ADB installed if you are using an android emulator.
Run git clone https://github.com/skompc/FreeLiberatorDx2.git
to copy this repo to your pc.
Run npm install
to install dependencies.
Install the modded APK onto your phone The Server now supports the original APK with mitm patches. Install that instead! (Check the FAQ for a video on YouTube on how to mod it).
Make sure your phone is on the same network as your pc (or whatever is hosting the proxy and servers).
Set your phones proxy settings to [pc's IP]:[whatever port the proxy server is running on].
Visit http://dx2.local
and click download.
Install the certificate through your phone's settings as a CA certificate (google it if you need help).
Done!
Install the modded apk onto the emulator The Server now supports the original APK with mitm patches. Install that instead! (methods vary)
Run "adb devices"
It should return something like:
List of devices attached
127.0.0.1:58526 device
Run the following:
adb -s [device_to_connect_to] shell settings put global http_proxy [PC_IP_on_network]:[proxy_port]"
For example, if my PC is on IP 192.168.0.136 and my proxy is on port 8001, then I would run:
adb -s 127.0.0.1:58526 shell settings put global http_proxy 192.168.0.136:8001
Visit cert.pem/certs/index.html
and click download.
Install the certificate through your emulator's settings as a CA certificate (google it).
Done!
Make sure to go through both the First Steps and the app installation steps.
Run npm run game
.
Launch the game on your phone/emulator
After the game loads there should be a line like CHECK_CODE: 6.2.10.dMCnif3QPwuS
. Copy the line starting with the numbers.
Close the app and open scraper.js inside the main directory
Paste the line into the quotes after const check_code =
Start scraping!
Run npm run scraper
to fetch assets.
copy everything from ./contents/Android/(asset_bundle_version)
to a new folder called ./contents/Android/custom
edit the first line of ./contents/Android/custom/en/ab_list.txt
from whatever it is to custom
Run npm run game
to run the main server. This has the main game logic.
Run npm run asset
to run the asset server. This hosts the static assets for the game, as well as the certificate page.
Run npm run proxy
to run the proxy. This will allow the app to connect with this server.
Run npm run mod-servers
to run only the game and asset servers. This is useful if you are using a different proxy (e.g. mitmProxy) for development. Note that both servers will open in their own window.
Run npm run mitm-servers
to run only the asset and proxy servers. This is useful if you want to play the "official (read mitm)" version of the game but have a slow internet connection. Note that you need to have the correct assets scraped for the version of the app you are using!
Run npm run all
to run all three servers. Note that all three servers will open in their own window.
By default the Game server will run on port 8000, the Asset server will run on port 3000, and the proxy will run on port 8080. If you wish to change the ports the servers will use, the lines to do so are in the top of gameServer.js, assetServer.js, and proxyServer.js for the game, asset, and proxy commands respectively. Make sure that the game and asset ports are the same in both their respective files AND proxyServer.js if you plan on using the proxy command!
- The results of a battle will ALWAYS softlock the game! Simply restart the app to get around this... this does NOT apply to the tutorial battle thankfully.
- Any unimplemented endpoints will softlock the game. Again simply restart the app.
- Battles are disabled until I finish the game's campaign.
Q: My android emulator isn't showing up in adb!
A: The solution to that one varies, but as I personally use Windows Subsystem for Android, the command to fix that would be to run "adb connect 127.0.0.1:58526"
Q: The modded version of the app isn't fetching the assets I downloaded
A: Make sure to do all the steps in Scrape The Assets
Q: The official (read mitm) version of the app isn't fetching the assets I downloaded
A: Rerun the scraper with an after following the instructions in Update The Scraper
Q: I want to run the server on my phone/tablet alongside my game
A: While this isn't officially supported yet, it is on the list of things to acomplish with this project.
Q: How do I patch the game!
A: There is a video on my YouTube channel on how to do this here The Server now supports the original APK with mitm patches. You no longer have to do that pesky .so patching!
Q: I don't have a computer that I can do this with! Can I still patch the app myself?
A: Not yet, but soon I will have a patcher that will do this on an Android device.
Q: Will iOS devices be supported?
A: While I don't have an iOS device to test with, if I do get one and time allows it, I will add iOS device support to both the scraper and servers eventually. Do note that running the server on an iOS device will NOT be officially supported.
Youtube - https://www.youtube.com/@SquirrelDevDiaries Github - https://github.com/skompc
Extra credit to @lukefz on Discord for helping me finally crack the decryption function! Their github is https://github.com/LukeFZ