All Projects â†’ macabeus â†’ react-gbajs

macabeus / react-gbajs

Licence: BSD-2-Clause license
🕹 GBA emulator on your React project - easy and powerful to use!

Programming Languages

javascript
184084 projects - #8 most used programming language
typescript
32286 projects
assembly
5116 projects

Projects that are alternatives of or similar to react-gbajs

Mgba
mGBA Game Boy Advance Emulator
Stars: ✭ 3,355 (+9485.71%)
Mutual labels:  gameboy-advance, gameboy-advance-emulator
tilemap-studio
A tilemap editor for Game Boy, Color, Advance, DS, and SNES projects. Written in C++ with FLTK.
Stars: ✭ 247 (+605.71%)
Mutual labels:  gameboy-advance
N-Gage stuff
Some N-Gage stuff for translation and modding
Stars: ✭ 21 (-40%)
Mutual labels:  romhacking
xkas-plus
fork of the xkas (v14) cross assembler
Stars: ✭ 20 (-42.86%)
Mutual labels:  romhacking
epicedit
Epic Edit, Track Editor for Super Mario Kart (SNES)
Stars: ✭ 30 (-14.29%)
Mutual labels:  romhacking
PokemonBattleEngine
A C# library that can emulate Pokémon battles.
Stars: ✭ 92 (+162.86%)
Mutual labels:  romhacking
lips
MIPS R4300i assembler in Lua
Stars: ✭ 20 (-42.86%)
Mutual labels:  romhacking
minishmaker
Level editing suite for The Legend of Zelda: The Minish Cap
Stars: ✭ 58 (+65.71%)
Mutual labels:  romhacking
pokemon-randomizer
A Pokémon Rom randomizer tool written in Zig
Stars: ✭ 12 (-65.71%)
Mutual labels:  romhacking
klo-gba.js
🧢 Reverse engineering tool for the Klonoa's GBA game
Stars: ✭ 124 (+254.29%)
Mutual labels:  romhacking
exhal
Compression and decompression tools for NES, SNES, and Game Boy games by HAL Laboratory
Stars: ✭ 54 (+54.29%)
Mutual labels:  romhacking
skytemple
GUI Application to edit the ROM of Pokémon Mystery Dungeon Explorers of Sky (EU/US)
Stars: ✭ 119 (+240%)
Mutual labels:  romhacking
Ninokuni
Hacks and tools for "Ni no Kuni" games
Stars: ✭ 23 (-34.29%)
Mutual labels:  romhacking
Emblem-Magic
An all-purpose ROMhacking tool for the GBA Fire Emblem games
Stars: ✭ 15 (-57.14%)
Mutual labels:  romhacking
magia
magia is a toy GBA emulator written in golang.
Stars: ✭ 432 (+1134.29%)
Mutual labels:  gameboy-advance
GCFT
GameCube File Tools, a GUI tool for modifying some common file formats used by GameCube games
Stars: ✭ 49 (+40%)
Mutual labels:  romhacking
first nes
Create your own games for the Nintendo Entertainment System! This "starter" game is easily extensible for your own projects. Includes references.
Stars: ✭ 94 (+168.57%)
Mutual labels:  romhacking
kale
Kirby's Adventure Level Editor (C++ / Qt)
Stars: ✭ 31 (-11.43%)
Mutual labels:  romhacking
DSVEdit
Multi-purpose editor for ROM hacking DS and GBA Castlevania games
Stars: ✭ 70 (+100%)
Mutual labels:  romhacking
Yarhl
Yet Another ROM Hacking Library
Stars: ✭ 48 (+37.14%)
Mutual labels:  romhacking

GBA emulator on your React project - easy and powerful to use!

Just three steps to set it up ✨

1 - Apply GbaProvider

import { GbaProvider } from 'react-gbajs'

const App = () => (
  <GbaProvider>
    ...
  </GbaProvider>
)

2 - Get play function from GbaContext and call it with the game ROM

import { useContext } from 'react'
import { GbaContext } from 'react-gbajs'

const ButtonStartEmulator = () => {
  const {
    play,
  } = useContext(GbaContext)

  const startEmulator = () => {
    const gameRom = getGameRom()
    play({ newRomBuffer: gameRom })
  }

  return (
    <button onClick={() => startEmulator()}>
      Start Emulator
    </button>
  )
}

3 - And render the emulator using the default export

import ReactGbaJs from 'react-gbajs'

const Emulator = () => (
  <ReactGbaJs />
)

Done! 🎉
Check a full example in /sample.

How it works

This package is a React wrapper for GBA.js.

GBA.js is vendored, with new features over the original version:

  • save and restore state
  • freeze address with a given value

Who is using


klo-gba.js, level editor for Klonoa: Empire of Dreams
Add your project here

Features

GbaContext

GbaContext exports the following properties:

play({ newRomBuffer, restoreState }): boolean

Use this function to start or restart the emulator.

Pass at newRomBuffer the game's ROM to load it:

play({ newRomBuffer: myGameRom })

You can also fill the property restoreState to restore to a previous state saved using saveState. If both are present, the emulator will be reset loading the ROM, and then restored to the given state:

play({ newRomBuffer: myGameRom, restoreState: someState })

If you pass only restoreState, the previous ROM will be re-loaded and will start on the given state. If there is no ROM previously loaded, it won't work.

play({ restoreState: someState })

saveState()

Return the serializable state of the emulator.

addFreezeAddress({ address: number, size: 8 | 16 | 32, value: number })

Freeze an address with the given value.

removeFreezeAddress(address: number)

Remove the freeze value on the given address.

frozenAddresses()

Return the list of the addresses frozen in the following format:

{
  [address in number]: { size: 8 | 16 | 32, value: number }
}

<ReactGbaJs />

<ReactGbaJs /> has the following props:

volume={number} (optional)

Should be a number between 0 (default, muted) or 1 (max volume).

onFpsReported={((fps: number) => void)} (optional)

Callback called every time that an FPS is reported.

scale={number} (optional)

Set the emulator scale. Default value is 1, which has width 240px and height 160px.

onLogReceived={(level: 'error' | 'warn' | 'stub' | 'info', message: string) => void} (optional)

Callback called every time that a log is received within the levels set as true by the prop watchLogLevels.

watchLogLevels={{ error?: boolean, warn?: boolean, stub?: boolean, info?: boolean }} (optional)

Set when the callback onLogReceived should be called. By default the value is { error: true }.

Contribution

1 - Clone this repository

> git clone [email protected]:macabeus/react-gbajs.git
> cd react-gbajs

2 - Install its dependencies

> npm i

3 - Build and watch the project

> npm run start

4 - In another terminal window, go to the /sample project, install its dependencies, and then build and watch it

> cd sample
> npm i
> npm run start

Finished! Now you can develop the package and test it in real-time 🎉

Thanks

@endrift for GBA.js.
@felix.rodent for the logo.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].