Skip to content

AdrianCassar/Xenia-WebServices

 
 

Repository files navigation

hero

Xenia Web Services

This is a Web API designed to support the Xenia Xbox 360 emulator in providing Online and Multiplayer functionality. A fork of Xenia-Canary has been created for use with this Web API. It has been designed and developed specifically for Xenia, and does not represent or resemble any first-party Xbox API.

If you'd like to help improve this project, you may report issues or contribute by submitting PRs.

Project architecture

This project uses NestJS a Node.js framework using Typescript which follows the CQRS model. In addition, MongoDB a document-oriented database (NoSQL database).

Preparing the project

  1. Install dependencies with the npm install command.
  2. Create a .env file in the project root, following this structure.
  3. What is an .env file?
  API_PORT=36000
  MONGO_URI=mongodb://127.0.0.1:27017/
  SWAGGER_API=true
  SSL=true

MongoDB Compass

This Xenia Web API is dependant on a MongoDB database.

  1. Install MongoDB Community Server to manage your database (tutorial).
  2. If you plan to create a local database using MongoDB Compass it must be installed as a network service or use MongoDB Atlas a cloud database for free.
  3. The following database structure will be created upon starting the server.

Database Structure

└─── test
    │  leaderboards
    |  players
    |  sessions
  1. Copy the database connection string and set it in the .env file.
MONGO_URI=mongodb://127.0.0.1:27017/
  1. Toggle Upgrade-Insecure-Requests header. (default true)
SSL=true
  1. During production you may want to disable Swagger's API.
SWAGGER_API=false

Running the app

Build the web service with the npm run build command.

# development
$ npm run start

# watch mode
$ npm run start:dev

# production mode
$ npm run start:prod

You can check everything is setup and working by accessing the frontend at http://127.0.0.1:36000/.

Hosting

Heroku
You can easily setup and host this REST API on Heroku, however they do not offer a free tier.

Vercel
Vercel is another option and it offers a free tier. However, i don't know how easy it will be to setup and configure.

Adding Title Support

If you would like to add a title to this API, check out the titles folder for examples!

Titles can provide a 'title server' address, which is basically an IP address the game will try to connect to and use as a game-server. Not all games use the 'title server' system.

Titles can also provide 'port mappings', wherein you can reroute game ports for title servers or player communication. We recommend using ports 3600X for players and 3601X for title servers. If a title uses a random port, this can be captured as port 0, and mapped accordingly.

Port mappings are not a requirement it's an optional feature. It may be useful to map ports which conflict with Windows or Linux. Some titles may fail to work if ports are changed for example Source Engine games.

To find the ports the title opens you can use cports and filter by process or you can search through xenia.log with logging = true.

Titles must provide leaderboard configuration to push statistics to the API. This is more complicated and takes trial and error. I'd recommend self-hosting the API to debug this.

Finally, you can also throw any title-specific netplay related patches in the patches folder!

About

Xenia Web Services is a REST API designed to support the Xenia Xbox 360 emulator in providing online and multiplayer functionality.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Languages

  • TypeScript 84.8%
  • HTML 6.5%
  • JavaScript 4.1%
  • PowerShell 2.8%
  • CSS 1.8%