Coder Social home page Coder Social logo

byuu-web's Introduction

byuu-web

byuu logo

Status: Dark launch (under heavy development)

byuu is a multi-system emulator that aims to combine the accuracy of higan with the simplicity and performance of bsnes.

This repository attempts to bring the goodness of the original project to the Web. We make significant changes to the repository due to WebAssembly's behavior and performance restrictions, but try to stick to accuracy as much as possible. We also make sure to keep up-to-date with upstream, and as much as possible replicate the same internal behaviors when writing alternative implementations.

Usage

Application

Go to https://wizcorp.github.io/byuu-web and enjoy!

Library

See the API documentation to learn how to connect controllers and so on! You can also have a look at the git repository's app code to see a relatively complete implementation example.

Installing the library

npm install byuu

The package contains a TypeScript type definition where the documentation of the available API can be found.

./index.js

import byuu from 'byuu'
const romPath = '/path/to/rom.sfc'
const container = document.body

// Initialization is only needed once
byuu.initialize(container, 800, 600)
  .then(() => byuu.loadURL(romPath))
  .then((romInfo) => {
    console.log(`Loaded ${romPath}`, romInfo)
    if (byuu.start()) {
      console.log('Emulator started successfully!')
    }
  })

When using with Webpack, you will be required to use the file-loader loader to allow this library to properly load its WASM code.

webpack.config.js

module.exports = ( env, options ) => {
  // ...
  module: {
    rules: [
      { 
        test: /byuu-web-lib.wasm$/,
        type: 'javascript/auto',
        loader: 'file-loader',
        options: {
          name: '[name]-[hash].[ext]',         
        }
      }
    ]
  }
}

Here below is an example using Vue.js. Although untested, it should be possible to use this library similarly with other frameworks.

vue.config.js

module.exports = {
  configureWebpack: {
    module: {
      rules: [
        { 
          test: /byuu-web-lib.wasm$/,
          type: 'javascript/auto',
          loader: 'file-loader',
          options: {
            name: '[name]-[hash].[ext]',         
          }
        }
      ]
    }
  }
}

./src/components/HelloByuu.vue

<template>
  <div ref="container"></div>
</template>
<script>
import byuu from 'byuu'

export default {
  async mounted () {
    await byuu.initialize(this.$refs.container, 800, 600)
    await byuu.loadURL('/path/to/rom.sfc')
    byuu.start()
  },
  beforeDestroy() {
    byuu.terminate()
  }
}
</script>
<style scoped></style>

Development

Git is used for the development of new releases, and represents a staging environment. As byuu is rather mature, things should generally be quite stable. However, bugs will exist, regressions will occur, so proceed at your own risk.

Getting started

git clone [...] byuu-web
cd byuu-web
make all debug=true # debug is optional but strongly recommended for development
# You can also build the package and the app individually
make package
make app

To achieve acceptable performances, byuu-web changes by default how the scheduler is implemented and how each Thread's main method behaves. This can be reverted to test against upstream:

Using the standard scheduler

make debug=true synchro=false

Once you have a build, start the HTTP development server.

Serving the emulator

make serve

Cleaning builds

make clean

The emulator will be served at http://localhost:8000.

Links

Acknowledgements

We would like to give our sincere thanks to:

  • byuu for his contributions, help, and support
  • hex-usr, maintainer of the nSide fork (from which we have adapted some of the FC mappers)
  • Andrew Reading, maintainer of bsnes-mcfly (which we've looked into for ideas on optimization)

byuu-web's People

Contributors

almirkadric avatar baptistebrunet avatar stelcheck avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.