Openmsx

De wikijoan
Salta a la navegació Salta a la cerca

Introducció

Món MSX

Associació d'Amics del MSX:

Instal.lació

NOTA: oblidar-se de tot lo de la bios, no cal (maig 2016)

$ ./configure

Found libraries:
  GLEW:                 no
  libao:                no
  libogg:               no
  libpng:               version 1.2.49
  libtheora:            no
  libvorbis:            no
  libxml2:              no
  OpenGL:               version 4.2
  SDL:                  version 1.2.15
  SDL_ttf:              version 2.0.11
  Tcl:                  no
  zlib:                 version 1.2.7

Components overview:
  Emulation core:       no
  GL renderer:          no
  Laserdisc:            no
  Libao sound driver:   no

Customisable options:
  Install to            /opt/openMSX
  (you can edit these in build/custom.mk)

Please install missing libraries and headers and rerun "configure".

Hem d'instal.lar les llibreries que falten:

$ sudo apt-get update
$ sudo apt-get install libglew-dev libao-dev libogg-dev libtheora-dev libxml2-dev libvorbis-dev tcl-dev
./configure
make

L'executable queda instal.lat a: /home/joan/openmsx-0.10.0/derived/arm-linux-opt/bin

~/openmsx-0.10.0/derived/arm-linux-opt/bin $ ./openmsx 
Couldn't load software database.
This may cause incorrect ROM mapper types to be used.
info: Failed to initialize default machine: Error in "C-BIOS_MSX2+" machine: machines/C-BIOS_MSX2+.xml not found in this context
info: Using fallback machine: C-BIOS_MSX2+
Fatal error: Error in "C-BIOS_MSX2+" machine: machines/C-BIOS_MSX2+.xml not found in this context

NOTA: no funciona perquè falta fer sudo make install per tal de què es creïn els directoris on espera trobar les coses.

Existeix el directori /home/pi/.openMSX/share/, on hi ha el fitxer settings.xml.

He d'instal.lar la bios c-bios.

Bios

It use as bios the C-Bios which is royalty-free, but you can use a bios dumped from an original MSX as I teach you in this post.

Notice: if you want to emulate real MSX systems and not only the free C-BIOS machines, put the system ROMs in one of the following directories: /opt/openMSX/share/systemroms or ~/.openMSX/share/systemroms

Les bios les puc trobar aquí:

Required ROM images:

File 	Description
MSX.ROM	MSX BIOS and BASIC
MSX2.ROM	MSX2 BIOS and BASIC
MSX2EXT.ROM	MSX2 ExtROM
MSX2P.ROM	MSX2+ BIOS and BASIC
MSX2PEXT.ROM	MSX2+ ExtROM
FMPAC.ROM	FMPAC BIOS
DISK.ROM	DiskROM (BDOS)
MSXDOS2.ROM	MSX-DOS 2
PAINTER.ROM	Yamaha Painter
KANJI.ROM	Kanji Font

Configuració

Instal.lem la C-Bios.

NOTA: és realment necessari fer-ho? (TBD)

$ cd ~/cbios-0.27
$ make
...
make: pasmo: Command not found
pasmo és el emulador de Z80

$ sudo apt-get install pasmo

He intal.lat pasmo per tal de compilar la bios c-bios, però realment no sé si cal fer-ho, això. Ja puc continuar la compilació:

$ make

pi@raspberrypi ~/cbios-0.27/roms $ ls -la
total 408
drwxr-xr-x 2 pi pi  4096 Apr 15 07:38 .
drwxr-xr-x 8 pi pi  4096 Apr 15 07:38 ..
-rw-r--r-- 1 pi pi 16384 Nov  5  2014 cbios_basic.rom
-rw-r--r-- 1 pi pi 16384 Nov  5  2014 cbios_disk.rom
...

pi@raspberrypi ~/cbios-0.27/derived/bin $ ls -la
total 408
drwxr-xr-x 2 pi pi  4096 Apr 15 07:42 .
drwxr-xr-x 6 pi pi  4096 Apr 15 07:38 ..
-rw-r--r-- 1 pi pi 16384 Apr 15 07:42 cbios_basic.rom
-rw-r--r-- 1 pi pi 16384 Apr 15 07:42 cbios_disk.rom
...

Els fitxers que acabo de compilar són els del 15 d'abril, però aparentment són els mateixos que ja existien en la carpeta roms/.

Copio aquestes roms a systemroms/ (però realment cal fer-ho, això?)

$ mkdir /home/pi/.openMSX/share/systemroms
pi@raspberrypi ~/cbios-0.27/derived/bin $ cp * /home/pi/.openMSX/share/systemroms

El openmsx continua sense funcionar, i el tema és que a més de fer el make, és millor fer el sudo make install per tal de què creï els fitxers que manquen:

$ sudo make install
Using Python: python
Build configuration:
  Platform: arm-linux
  Flavour:  opt
  Compiler: g++
  Subset:   full build
Up to date: derived/arm-linux-opt/config/Version.ii
Installing openMSX:
  Executable...
  Data files...
  Documentation...
  C-BIOS...
  Creating symlinks...
Installation complete... have fun!
Notice: if you want to emulate real MSX systems and not only the free C-BIOS machines, put the system ROMs in one of the following directories: /opt/openMSX/share/systemroms or ~/.openMSX/share/systemroms
If you want openMSX to find MSX software referred to from replays or savestates you get from your friends, copy that MSX software to /opt/openMSX/share/software or ~/.openMSX/share/software

Per tant, sembla que el projecte openmsx ja ve preparat per treballaramb C-Bios i no m'he de preocupar d'això.

i ara ja funciona:

~/openmsx-0.10.0/derived/arm-linux-opt/bin $ ./openmsx

 $ ./openmsx --help
openMSX 0.10.0
==============

usage: openmsx [arguments]
  an argument is either an option or a filename
...

i ja puc provar les roms

$ ./openmsx /home/pi/roms/openmsx/Galaxian.rom
$ ./openmsx /home/pi/roms/openmsx/Penguin_Adventure.rom
$ ./openmsx /home/pi/roms/openmsx/Gradius_2.rom

El Galaxian no funciona, mentre que el Penguin_Adventure i el Gradius 2 sí que funcionen.

El problema del MSX és el mateix que el del Spectrum: el mapejat de les tecles depèn de cada joc. (TBD)

Coses a mirar:

El fitxer ~/.openMSX/share/settings.xml és el que guarda la configuració. Per exemple,

<!DOCTYPE settings SYSTEM 'settings.dtd'>
<settings>
  <settings>
    <setting id="scale_factor">1</setting>
    <setting id="invalid_psg_directions_callback">psgdirectioncallback</setting>
    <setting id="di_halt_callback">dihaltcallback</setting>
    <setting id="fullscreen">true</setting>
  </settings>
  <bindings/>
</settings>

Però en aquest cas fullscreen=true no vol dir que es vegi a pantalla completa.

He eliminat la carpeta /home/pi/.openMSX/share/systemroms, on hi havia les bios que havia copiat, i funciona igualment. La carpeta correcta és /home/pi/.openMSX/share/systemroms, perquè si l'elimino, es torna a crear amb un fitxer README a dins.

Vaig a intentar millorar la velocitat (de fet, no és que vagi lent, però els jocs que estic provant, Penguin Adventure i Gradius 2, trobo que no van prou fluids, però potser ja eren així en el sistema real...).

6.3 Scalers

Most MSX screen modes are only 256×212 pixels big. This is quite small for PC screen resolutions of today. That's why you have the possibility to scale up the image. Normally, there are three possible scaling factors: 1, 2 and 3. If you select 1, all MSX pixels are mapped to a 320×240 pixels PC window, for 2 to a 640×480 pixels window and for 3 to a (surprise!) 960×720 window. The setting which determines this is called scale_factor. In general, the higher the factor, the better the output image is; the downside: it takes a lot more CPU processing power. 

Ara bé, clarament utilitzar scale_factor=2 fa que augmenti el consum de CPU i això es tradueix en què el joc va més lent, i la música pitjor. Les proves les estic fent amb la RPi B+, i les hauria de fer amb la RPi 2.

throttle

Sets throttle mode. In throttle mode the emulator tries to run at the specified speed relative to a real MSX (see speed command). When throttling is turned off the emulator runs as fast as possible.
usage:
set throttle 	Shows the current setting
set throttle on 	Turn throttle mode on (normal operation)
set throttle off 	Turn throttle mode off (fast forward)

Ara bé, set throttle off no soluciona l'experiència de joc. Va més ràpid, però el joc encara no és fluid. L'opció de fullscreen ja està activa, el que passa és que el mode per defecte de MSX és 256x212 pixels. El que s'ha de fer és jugar amb el scale_factor. El valor correcte per veure fullscreen és scale_factor = 2.

He jugat amb el minframeskip i maxframeskip i no aconsegueixo una millor experiència d'usuari.

Recordar que per accedir a la consola és F10. He jugat amb el set accuracy i tampoc no hi ha diferència entre els 3 valors (pixel-per defecte, screen i line).

speed

Sets the emulation speed relative to the speed of a real MSX. Speed 100 means as fast as a real MSX, lower values are slower than real MSX, higher values are faster than real MSX.
usage:
set speed 	Shows current emulation speed
set speed <num> 	Sets new emulation speed

per defecte, screen=100. Si poso screen=120, el joc va més ràpid, i millora l'experiència d'usuari.

En els comentaris d'aquest fil:

openmsx on Raspberry Pi is very slow, I know. I'm searching a solution or another MSX emulator. You have news about that in this blog. Obrigado.
contestació: I got an acceptable perfomance for almost all games without effects like scanline and blur, no bordes, simple scale, vdp in line mode. It is necessary to delete previous settings. I almost forgot the more important: reverse off

valors per defecte

  • scanline = 20
  • blur = 50

Els poso a 0. No millora sustancialment.

set auto_enable_reverse = off (per defecte, gui).

He estat jugant amb tots els canvis i tampoc trobo que varïi molt. Però això no vol dir que vagi malament, en realitat l'emulador va molt bé, la única cosa que el joc que estava provant, el Gradius_2, en realitat la manera com es mou la nau és una mica lenta.

Configuració 2. Millorant...

Mirar la secció Optimize. Fins ara he estat provant la C-Bios per defecte, però puc provar altres bios:

Best machine to emulate and with the best compatibility are: Philips NMS 8250 (MSX2, 50 fps), Panasonic FS-A1WSX (MSX2+, 60 fps) o Panasonic FS-A1GT (MSXturboR, 60 fps).

Provar aquesta configuració de settings.xml:

<!DOCTYPE settings SYSTEM 'settings.dtd'>
<settings>
  <settings>
    <setting id="scanline">0</setting>
    <setting id="blur">0</setting>
    <setting id="scale_factor">2</setting>
    <setting id="glow">0</setting>
    <setting id="horizontal_stretch">320</setting>
    <setting id="auto_enable_reverse">off</setting>
    <setting id="load_icons">none</setting>
    <setting id="minframeskip">0</setting>
    <setting id="maxframeskip">2</setting>
    <setting id="resampler">blip</setting>
    <setting id="fullspeedwhenloading">true</setting>
    <setting id="fast_cas_load_hack_enabled">true</setting>
  </settings>
  <bindings>
    <bind key="keyb F1">main_menu_toggle</bind>
    <bind key="keyb F8">exit</bind>
    <bind key="joy1 button0 up">keymatrixup 7 0x01</bind>
    <bind key="joy1 button3 up">keymatrixup 7 0x80</bind>
...
  </bindings>
</settings>

L'he provat i perfecte. Estic a fullscreen (scale_factor=2), i la música sona bé, que vol dir que la CPU està tranquila.

Configuració de les tecles

Les tecles usuals que s'utilitzen en el MSX original:

openMSX itself allows remapping of key bindings, by the way, but there is no GUI for it. You can script it by placing Tcl scripts in ~/.openMSX/share/scripts. This document describes all the scripting commands that are available. You can find the code that sets the default key bindings here. If you want to script openMSX, it's probably easier to test with the desktop version, which has a Quake-style OSD console (open it with F10 on PC or Cmd-L on Mac) on which you can enter commands, then move your scripts to the Zero when they work.

A MSX els controls usuals són:

"1" = P1 start or choose joystick
"2" = P1 choose keyboard
"3" = P2 choose joystick
"4" = P2 choose keyboard

"O" = left
"P"= right
"Q"= up
"A"= down
"Space" = fire (Fire1)

Per a Fire2, alguns jocs fan servir [SHIFT]. Altres utilitzen [GRAPH] (which is [ALT-LEFT] on your PC keyboard).

Cursor keys = up, down, left, right

"Return" = start for some games (release ball in some pinball games)
"ESC" = used in some games

"F1 - F4" = used in some games

"Z" = left trigger in pinball games
"RCTRL" = right trigger in pinball games

Konami games often work with [SPACEBAR] and "M" or "N" key. "M" seria el 2n botó a Konami
Some games use "X" and "C".
Compile shooters work with [SHIFT] and "Z".

It depends on the game.

I've noticed that plenty of Japanese Indie PC games usually start their button layout with Z as the primary fire button, X as the second,
or have combinations like Z,X,C,(V),A,S,D,(F).

Per tant, segurament hauré de tenir vàries versions del fitxer settings.xml, segons sigui el layout del joc.

Screen-Shot-2012-11-27-at-9.56.34-PM-517x200.png

I a mi m'interessa que el botó 3 sigui el Fire1, és a dir el Space en el MSX. Com es fa? Doncs no és fàcil trobar la informació. Finalment l'he trobat aquí:

Per sortir del joc és fàcil:

    <bind key="keyb 0">exit</bind>                   

I associar el 3 al Space:

    <bind key="keyb 3">keymatrixdown 8 1</bind>
    <bind key="keyb 3,RELEASE">keymatrixup 8 1</bind>  

I com es troba el 8 1. Està explicat en l'enllaç. Hi ha una matriu, i el Space es correspon al row8,bit 0:

The code “8 1” is calculated by:
*the bit row number (8 in this case for space) 
*2^columnumber, so 2^0 = 1

És normal que si torno a obrir el fitxer, l'ha ordenat segons el seu criteri:

    <bind key="keyb 3,RELEASE">keymatrixup 8 1</bind>
    <bind key="keyb 0">exit</bind>
    <bind key="keyb 3">keymatrixdown 8 1</bind>

Si disposo de varis settings, la manera de carregar-los serà:

$ ./openmsx -setting /home/pi/.openMSX/share/settings.xml /home/pi/roms/openmsx/Gradius_2.rom

La configuració bàsica-normal del meu fitxer settings.xml és:

<!DOCTYPE settings SYSTEM 'settings.dtd'>
<settings>
  <settings>
    <setting id="scanline">0</setting>
    <setting id="blur">0</setting>
    <setting id="horizontal_stretch">320</setting>
    <setting id="auto_enable_reverse">off</setting>
    <setting id="load_icons">none</setting>
    <setting id="maxframeskip">2</setting>
    <setting id="resampler">blip</setting>
    <setting id="fullspeedwhenloading">true</setting>
    <setting id="fast_cas_load_hack_enabled">true</setting>
    <setting id="invalid_psg_directions_callback">psgdirectioncallback</setting>
    <setting id="di_halt_callback">dihaltcallback</setting>
  </settings>
  <bindings> 
    <bind key="keyb 3,RELEASE">keymatrixup 8 1</bind>
    <bind key="keyb 4,RELEASE">keymatrixup 6 4</bind>
    <bind key="keyb 8,RELEASE">keymatrixup 7 16</bind>
    <bind key="keyb 0">exit</bind>
    <bind key="keyb 3">keymatrixdown 8 1</bind>
    <bind key="keyb 4">keymatrixdown 6 4</bind>
    <bind key="keyb 8">keymatrixdown 7 16</bind>
    <bind key="keyb F1">main_menu_toggle</bind> 
    <bind key="joy1 button0 up">keymatrixup 7 0x01</bind>
    <bind key="joy1 button3 up">keymatrixup 7 0x80</bind>
  </bindings>
</settings>

on hem associat el meu botó 3 (botó de disparo 1) al Space, i el meu botó 4 (botó de disparo 2) al GRAPH (que en l'ordinador és la tecla ALT. Jocs que fan servir aquests dos botons són per exemple el Choplifter i el City Connection.

Instal.lació i configuració. Resum (dec 2016)

$ sudo apt-get update
$ sudo apt-get install libglew-dev libao-dev libogg-dev libtheora-dev libxml2-dev libvorbis-dev tcl-dev
$ ./configure
$ make

Triga 2 o 3 hores

$ sudo make install

Executem per tal de què es creï el directori ~/openMSX

$ cd ~/openmsx-0.10.0/derived/arm-linux-opt/bin
$ ./openmsx 

Creem les carpetes que necessitem:

$ mkdir /home/pi/roms/openmsx
$ mkdir /home/pi/joanillo_arcade_frontend/rom_images_800/openmsx

ja podem copiar les roms, les imatges, i els fitxers de configuració XML (a /home/pi/.openMSX/share/)

ROMs


creat per Joan Quintana Compte, abril 2016