NES-Nintendo Entertainment System. Emulador AdvMESS

De wikijoan
Salta a la navegació Salta a la cerca

Introducció

Estava pendent a la llista, i em decideixo a instal.lar-lo perquè em demanen el Super Mario Bros (que està a GBA, però no em funciona). En qualsevol cas, l'original és el de NES, i no està a SNES.

Instal.lació

NOTA: per veure la instal.lació a la RPi3, veure més avall.

Descarrego advancemess-1.4.tar.gz

$ gcc --version
gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3

i s'ha de compilar contra la versió 4.7 per tal de què no doni l'error unrecognizable insn

sudo apt-get install gcc-4.7
export CC=gcc-4.7
export GCC=g++-4.7
$ ./configure
$ make
$ sudo make install (crec que no cal)

Es genera el fitxer

lrwxrwxrwx  1 pi pi     28 Jul 11 11:10 advmess -> obj/mess/linux/blend/advmess

Per executar, és el sistema nes i la rom

advmess nes -cart supermariobros.nes

The BIOS’s get put into the ROM folder. The game roms go into the IMAGES folder under the system’s name. So NES roms go into the images/nes folder. MESS knows what to look for when you call the program.

Per a NES no ens cal una bios. I les roms, com s'indicam han d'anar a la images folder sota la carpeta nes/. Per tant, el que faig és crear la carpeta /home/pi/roms/nes, i dir que el meu system folder sigui /home/pi/roms. Això ho faig en el fitxer

$ joe ~/.advance/advmess.rc

dir_image /home/pi/.advance/image:/home/pi/pimame/roms

canvio a (compte! no ha d'acabar amb roms/nes, sinó amb roms)

dir_image /home/pi/roms:/home/pi/roms 

El dir_rom el deixo igual (a mi m'interessa el dir_image):
dir_rom /home/pi/.advance/rom

For the command line version, type ”mess [system] [device] [game] [options]”, where [system] is the system driver name, [device] is the type of ROM, [game] is the filename of the ROM, and options are command line options.

Fixem-nos que jo vull NES, però que amb advmess puc executar altres consoles (system). El device és el dispositiu que es fa servir. En el cas de NES són cartutxos (-cart).

I ara ja funciona:

/home/pi/advancemess-1.4/advmess nes -cart Super_Mario_Bros.nes

Les roms les descarrego de http://www.freeroms.com

$ ./advmess --help
AdvanceMESS - Copyright (C) 2001-2003 by Andrea Mazzoleni
MESS - Copyright (C) 1998-2003 by the MESS Team
MAME - Copyright (C) 1997-2003 by Nicola Salmoria and the MAME Team

Usage: advmess [options] GAME

Options:
--default add all the default options at the configuration file
--remove remove all the default option from the configuration file
--log create a log of operations
--listxml output the rom XML file
--record FILE record an .inp file
--playback FILE play an .inp file
--version print the version

Example: advmess ti99_4a

To get help type 'man advmess'.
Extensive documentation is located at '/usr/local/share/advance/doc'

Les tecles bàsiques per començar a jugar són:

man advmame
       for player 1 you can use the keys:
           1 Play.
           5 Insert coin.
           ARROW Move.
           CTRL First button.
           ALT Second button.
           SPACE Third button.

       for player 2 you can use the keys:
           2 Play.
           6 Insert coin.
           R, F, D, G Move.
           A First button.
           S Second button.
           Q Third button.

KEYS
       In the game play you can use the following keys:
           ESC Exit.
           F1 Help.
           TAB Main Menu.
           F2 Test/Service Switch.
           F3 Reset the game.
           F7 Load a game state.
           SHIFT + F7 Save a gam state.
           F8 Decrease the frame skip value.
           F9 Increase the frame skip value.
           F10 Speed throttle.
           F11 Display the frame per second.
           F12 Save a snapshot.
           P Pause.

És a dir ESC, 1 (START), fletxes, CRL First button, ALT Second button (tot i que a mi em sembla que és el primer botó. No!, és el segon botó), SPACE Third button.

Instal.lació a la RPi3 (desembre 2016)

A la RPi3

$ gcc --version
gcc (Raspbian 4.9.2-10) 4.9.2
$ ./configure
...
Error in `gcc': double free or corruption

És un bug conegut. Hi ha un parxe si compiléssim els compiladors gcc. Una altra possible solució és compilar el projecte contra gcc-6 i g++-6 (en comptes de gcc-9 i g++-9) per tal de què no doni aquest error.

$ sudo apt-get update
$ sudo joe /etc/apt/sources.list

i canviem jessie per stretch.

$ sudo apt-get update

instal.lem gcc-6:

$ sudo apt-get install gcc-6 g++-6

$ sudo joe /etc/apt/sources.list -> ho tornem a deixar com estava
$ sudo apt-get update

després d'instal.lar gcc-6:

$ gcc --version
gcc (Raspbian 4.9.2-10) 4.9.2

$ gcc-6 --version
gcc-6 (Raspbian 6.2.1-5+rpi1) 6.2.1 20161124

S'ha d'editar el fitxer configure i canviar, a tot arreu on posa gcc, canviar-ho per gcc-6, i on posa g++, canviar-ho per g++-6. El fitxer Makefile que es genera fa referència a gcc-6 i g++-6.

Ara ja podem fer el configure i el make.

nota. Ara bé... quan ho féiem a la RPi B+ donava un error amb gcc-6 i ho havíem de fer amb gcc-7. Veurem...

Configuració. Modificació de .advance/advmess.rc

De fet, la configuració és la mateixa que AdvanceMAME, doncs pertanyen al mateix projecte.

El primer que faig és modificar les tecles segons el meu layout. Ho faig des de l'emulador amb TAB, i canvio totes les tecles. I això té traducció en el fitxer advmess.rc:

$ joe ~/.advance/advmess.rc

input_map[p1_button1] keyboard[0,3]
input_map[p1_button2] keyboard[0,4]
input_map[p1_button3] keyboard[0,5]
input_map[p1_button4] keyboard[0,6]
input_map[p1_button5] keyboard[0,7]
input_map[p1_button6] keyboard[0,8]

input_map[p1_select] keyboard[0,2]
input_map[p1_start] keyboard[0,1]

input_map[p2_up] keyboard[0,i] 
input_map[p2_down] keyboard[0,k]
input_map[p2_left] keyboard[0,j]
input_map[p2_right] keyboard[0,l]
input_map[p2_button1] keyboard[0,a]
input_map[p2_button2] keyboard[0,b]
input_map[p2_button3] keyboard[0,c]
input_map[p2_button4] keyboard[0,d]
input_map[p2_button5] keyboard[0,e]
input_map[p2_button6] keyboard[0,f]

input_map[p2_start] keyboard[0,9]

Millorar el so

$ man advmess
...
   sound_latency
       Sets the minimum audio latency.

       sound_latency TIME
       Options:
           TIME Latency in seconds from 0 to 2.0 (default 0.05).

       If in the game play you hear some sound ticks you can try to increase the latency. Try doubling the value until the ticks go away.

canvio de 0.05 a 0.15, i millora el so

sound_latency 0.15

Que no demani confirmació a la sortida

Per tal de què no surti el pop-up empipador de confirmar que volem sortir, en el fitxer de configuració principal canviem en el fitxer de configuració advmess.rc:

misc_safequit no 

Problemes amb el teclat

Però m'he trobat que funciona amb el teclat normal, i desprès quan estic a la màquina els mandos no responen. Això es soluciona fent:

device_keyboard sdl
device_video sdl

I també pot ser que no es vegi res a la pantalla. Aleshores:

device_video_clock 5-50/15.62/50;5-50/15.73/60

Sortir amb el '0'. Eliminar pantalles de presentació

Com sempre, m'interessa el 0 per sortir del joc i de l'emulador, sense cap pregunta. I tampoc no vull cap pantalla de presentació.

$ find . -type f -print | xargs egrep -i ENTITLED | more
./srcmess/ui_text.c:	"IF YOU ARE NOT LEGALLY ENTITLED TO PLAY \"%s\" ON THIS EMULATOR, PRESS ESC.",

Per sortir amb el 0 és igual que advancemame.

Per tant, els canvis que s'han de fer al fitxer inptport.c són:

//INPUT_PORT_DIGITAL_DEF( 0, IPG_UI,      UI_CANCEL,			"UI Cancel",			SEQ_DEF_1(KEYCODE_ESC) )
INPUT_PORT_DIGITAL_DEF( 0, IPG_UI,      UI_CANCEL,			"UI Cancel",			SEQ_DEF_1(KEYCODE_0) )

Però el keycode 0 ja s'està utilitzant:

//INPUT_PORT_DIGITAL_DEF( 0, IPG_OTHER,   SERVICE2,			"Service 2",    		SEQ_DEF_1(KEYCODE_0) )
INPUT_PORT_DIGITAL_DEF( 0, IPG_OTHER,   SERVICE2,			"Service 2",    		SEQ_DEF_1(KEYCODE_MINUS) )

Per tal de què no surti el missatge IF YOU ARE NOT LEGALLY ENTITLED TO PLAY... i les dues pantalles següents d'informació sobre la ROM, he de comentar les següents línies:

usrintrf.c
        /* if we didn't find a settings file, show the disclaimer */
        //if (show_disclaimer && ui_display_copyright(artwork_get_ui_bitmap()) != 0)
        //      return 1;

        /* show info about the game */
        //if (show_gameinfo && ui_display_game_info(artwork_get_ui_bitmap()) != 0)
        //        return 1;

ROMs

Les millors ROMs



creat per Joan Quintana Compte, juliol 2016