Introduction
Parts
This project is divided in 4 parts.
Patching your Boktai ROM: As mGBA has already an in-emualtor UV sensor, we'll need the patch to disable that and by-pass a "sensor broken" screen.
Microcontroller code: To capture UV light and send information over to the server.
Python Client: The user will have to run a python3 client, for windows users there is a .exe available.
Lua Server: mGBA's script that runs a server and converts UV signal to in-game sun level.
You'll need
Don't know which microcontroller to get? I'd recommend either an arduino nano or an esp32.
The jumper wires will be male-to-male, male-to-female or female-to-female depending on your needs, make sure you get ones that will suit you.
Don't know which UV light sensor to get? I used a GUVA-S12SD, it works fine.
The total price for all these together shouldn't go over 5$.
Step 1: Patch the ROM
- Download boktai's patch here: https://github.com/Prof9/Boktai-Solar-Sensor-Patches
- Apply patch, you can do that here: https://www.romhacking.net/patch/
Step 2: Microcontroller
- Download the source code here
- Have the microcontroller, jumper wires and UV sensor at hand.
- Connect them with jumper wires, GND to GND, VCC to power supply, and SIG to your GPIO with analog read of choice.
- Connect it to your PC via a USB cable.
- Open Arduino IDE.
- Open the Source code.
- Under "Tools" make sure your Board and Serial port are correct, if you your board is not there you'll need to download them on "Board Manager".
- Check for your pinout and change the value of UV_SIGNAL_READ to that GPIO number.
- Flash the code to the microcontroller.
Step 3: Lua server
- Download the source code here
- Open mGBA
- Start emulating the patched rom.
- Under "tools" go to "scripting...".
- File and load script.
- Select the lua script.
Step 4: Python client
Download the source code here
This one might differ a bit if you're on linux or windows
Windows:
- Download the .exe.
- double click it.
- Select the COM port the microcontroller is connected to.
Linux:
- Install requirements on requirements.txt.
- run
python3 main.py.
- select the TTY port the microcontroller is connected to.
Step 5: Enjoy the game
:)