- Ensure you have mGBA
- Download both mGBA-http and
mGBASocketServer.lua
from the Releases section.- Which mGBA-http?
- If you have .NET installed download the smaller file type for your system. That is, the one without "self-contained" in the filename.
- If you do not have .NET installed, or are unsure, download the larger file type for your system. That is, the one with "self-contained" in the filename.
- Which mGBA-http?
- Run mGBA-http
- Open mGBA and click Tools > Scripting to open the Scripting window.
- In the scripting window click File > Load script to bring up the file picker dialog.
- Select the
mGBASocketServer.lua
file you downloaded earlier - Load up a ROM in mGBA
- Done. mGBA is now ready to accept commands from mGBA-http.
When running, mGBA-http presents as a mostly non-interactiable console, with the default start information of:
- The bound address. This is the root for the commands. Default:
http://localhost:5000
- The SwaggerUI address. Default:
http://localhost:5000/index.html
- The Swagger JSON address. Default:
http://localhost:5000/swagger/v1/swagger.json
Log entries of what commands are being sent as well as errors will show up in this console.
A quick way to begin to sending commands is heading to the SwaggerUI address and reqesting the ROM title as it requires no parameters:
See below for more examples, and the mGBA scripting documentation.
- To see what mGBA scripting APIs are implemented, see the implemented APIs document.
- To see an overview of the swagger.json file, see the API documentation.
- Finally, the full swagger.json file.
If needed, there are minimal configuration points
This file is not required for running mGBA-http normally.
However, if you need to configure ports or logging, download this file from the releases page and put it in the same directory as mGBA-http. mGBA-http will pick up on these settings when run. See the ASP.NET Core logging documentation for more.
See below how the HTTP port has changed from the 5000
to 6969
and there is now an HTTPS endpoint as well at 6970
. Harder to picture is the log levels are now mostly set to warning, from the in-build defaults of error.
At the top, there is the enableLogging
flag. This will output timestamped logs to the scripting console if set to true
. Otherwise set to false
for no logging.
- Make sure not to load the script twice. This causes issues with recieving data. If you need to reload the script, close and reopen mGBA then load up the script again. Closing and reopening the scripting window is not enough.
- Most commands require a ROM being loaded into mGBA.
- Unless you change the ports in both appsettings.json and in mGBASocketServer.lua, you cannot run more than one instance of mGBA-http.
- See the examples page.
- There is a test console project where you can send keys to mGBA.