• Stars
    star
    1,535
  • Rank 30,483 (Top 0.7 %)
  • Language
    PHP
  • Created almost 9 years ago
  • Updated about 4 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A PHP Terminal GameBoy Emulator

PHP Terminal GameBoy Emulator

Build Status Software License Packagist

Want to play Dr Mario or Pokémon on your server terminal? That's for you!

Table of Contents

Why

Some people will ask me: "Why you did that?"

Well, a friend asked me "What PHP can do?". I thought about that awhile and the idea came up. With PHP7's performance improvement now it's possible to emulate some systems 😄 and, come on, that's funny! 👯

It's based on the GameBoy JS Emulator.

Requirements

The following PHP versions are supported:

  • PHP 5.6
  • PHP 7
  • HHVM

You will need a good terminal! I've tested only on MacOSX and Linux. I'm sorry about that Windows guys 😞

Installation

Using composer:

$ composer g require gabrielrcouto/php-terminal-gameboy-emulator:dev-master

Using PHAR:

$ wget https://raw.githubusercontent.com/gabrielrcouto/php-terminal-gameboy-emulator/master/bin/php-gameboy.phar
$ chmod +x php-gameboy.phar
$ mv php-gameboy.phar /usr/local/bin/php-gameboy

Running

Your roms are loaded from the directory you are running the php-gameboy command.

$ php-gameboy drmario.gb
$ php-gameboy pokemon.gbc

If you like to run this emulator locally, simple clone the repository:

$ git clone https://github.com/gabrielrcouto/php-terminal-gameboy-emulator.git
$ cd php-terminal-gameboy-emulator
$ composer install -o

For running roms, pass the full path to your rom or put then in the php-terminal-gameboy-emulator folder:

$ bin/php-gameboy pokemon.gbc
$ bin/php-gameboy /full/path/to/your/rom/drmario.gb

Controls

_n_________________
|_|_______________|_|
|  ,-------------.  |
| |  .---------.  | |
| |  |         |  | |
| |  |         |  | |
| |  |         |  | |
| |  |         |  | |
| |  `---------'  | |
| `---------------' |
|   _               |
| _|W|_         ,-. |
||A   D|   ,-. "._,"|
|  |S|    "._," Dot |
|    _  _ Comma     |
|   // //           |
|  // //    \\\\\\  |
|  N  M      \\\\\\ ,
|________...______,"
  • Left = A
  • Up = W
  • Down = S
  • Right = D
  • A = Comma (,)
  • B = Dot (.)
  • Select = N
  • Start = M

Tests

You can use the following command to run the most common checks, such as php -l, phpcs:

$ ant check

TO-DO

Converting from the JS paradigm was a lot of work, and I still need to adapt somethings like:

  • Code standard - PSRs, please!
  • Array of functions - Maybe in PHP it's not the best approach
  • Pixel auxiliary array - Very CPU intensive to convert RGBA every time
  • Classes - Core is too big!
  • Profiling and otimizing - XHProf to find the most intensive functions
  • Save/Restore - I need to save my Pokémon, please!

Credits

@gabrielrcouto

Legal

The purpose of this project was to study all the capabilities of PHP.

It does not have any commercial or profitable intentions.

The user is responsible to use this code and its content in the terms of the law.

The author is completely against piracy and respects all the copyrights, trademarks and patents of Nintendo.

More Repositories

1

php-gui

Extensionless PHP Graphic User Interface library
PHP
2,243
star
2

awesome-php-ffi

PHP FFI examples and use cases
C
275
star
3

reaver-wps

Brute force attack against Wifi Protected Setup
C
198
star
4

phplata

PHP made cryptocurrency
PHP
132
star
5

php-itaucripto

Versão em PHP da classe Itaucripto, originalmente escrita em Java
Java
61
star
6

php-simple-neural-network

PHP Simple Neural Network
PHP
43
star
7

presentation-from-docker-to-kubernetes

How can we deploy PHP applications using Docker containers? How can we scale PHP applications using Kubernetes? This presentation will make an overview over these questions, mixing the pratical and theory.
CSS
36
star
8

palestra-async

ASYNC E WEBSOCKETS COM PHP - Palestra interativa com vários exemplos
JavaScript
28
star
9

php-computer-vision

PHP Computer Vision
PHP
27
star
10

php-convnet

Pure PHP Convolutional Neural Network
PHP
24
star
11

php-svm

Pure PHP Support Vector Machine
PHP
22
star
12

nexus7-ubuntu-12-04

Ubuntu 12.04 for Nexus 7 (2012)
15
star
13

docker-lazarus

Debian based Docker environment for building Lazarus (FPC) applications.
10
star
14

palestra-ratchet

Usando WebSockets com PHP para jogos multiplayer
JavaScript
8
star
15

presentation-from-rest-to-graphql

What is GraphQL? How can it be compared to REST? What is the pros and cons? This presentation will make an overview over these questions, mixing the pratical and theory.
CSS
7
star
16

cordova-bugsnag-plugin

Plugin that includes the native bugsnag into your project
Objective-C
6
star
17

php-metaphone-br

Versão em PHP da biblioteca Metaphone adaptada para o Português do Brasil
PHP
5
star
18

avr-sha1

SHA1 for AVR Microcontrollers
C
3
star
19

palestra-web3

CSS
2
star
20

srch

A graph based search engine built in PHP
PHP
1
star
21

palestra-webbr-2016

JavaScript
1
star