Uae4arm: Amiga emulator with JIT and DispmanX


542 posts   Page 1 of 22   1, 2, 3, 4, 5 ... 22
by Chips » Thu May 14, 2015 3:32 pm
Uae4arm is a new Amiga emulator with JIT, which enable faster CPU emulation by compiling piece of code just in time instead of emulating each byte code independently.
It has been tuned for Raspberry Pi, especially on display side by using Dispmanx for smooth framerate.

You will get best result with a Rpi set to a 50 Hz mode, in /boot/config.txt following lines do the trick (1080p 50Hz):

hdmi_group=1
hdmi_mode=31

Or you can use tvservice to switch to 1080p 50hz:
tvservice -e "CEA 31 HDMI"

uae4arm needs libguichan and libguichansdl library, in order to install them launch the following in command line:

sudo apt-get install libguichan-sdl-0.8.1-1
sudo apt-get install libguichan-0.8.1-1


v0.5:
Merge of latest TomB version for Pandora.
Picasso fully working.
Keyboard management improved.
Add deadzone for joystick.

v0.4:
Merge of latest TomB version for Pandora.
Keep position between file selection
Joystick management improved.

v0.3:
Rework of dispmanX management (huge picasso improvement).
Add 4/3 shrink for 16/9 screen.
Alt key can now be used to switch between mouse and 2nd joystick.

v0.2:
Merge latest TomB improvements (Zorro3 memory, picasso...).

v0.1:
Use dispmanX for fast scaling and double buffering.
Enable hat usage on joystick.
Add Sony 6axis joystick workaround.

Binary for Raspberry Pi 2 and source code:
http://fdarcel.free.fr/uae4arm-rpi-chips-0_5.bz2

Git hub with source code only:
https://github.com/Chips-fr/uae4arm-rpi
Last edited by Chips on Sat May 14, 2016 9:12 am, edited 11 times in total.
Posts: 177
Joined: Sat Aug 18, 2012 8:21 pm
by rSl » Thu May 14, 2015 6:01 pm
verry cool!! thanks a lot for this new beauty!
:)
User avatar
Posts: 65
Joined: Tue Jun 24, 2014 1:16 am
Location: computer
by Trixster » Thu May 14, 2015 9:13 pm
Nice work Chips, this is brilliant. It's the best Amiga emulation I've tried on the rpi so far, by a long way.

First Sanurai finally works properly. IK+ sound works correctly too.

Alien Breed 3D II is incredibly smooth, probably 060 speed at least.
Controls are great in this release too, plus the scaling looks spot on.

Great work, thanks!
User avatar
Posts: 259
Joined: Sat Jul 07, 2012 3:53 pm
by Chips » Fri May 15, 2015 9:43 am
There is quite some code which aren't activated, like Zorro memory upgrade and picasso video card.
I just succeed to get 64MB of Zorro memory, and tried the best AGA demo: Starstruck.

It loads and works :shock: ... but quite slow even with JIT :lol: moreover Fastest clock lead to few frame displayed... so i was stuck with 25Mhz.

Image

Don't expect to see theses options soon, it's too buggy at the moment... except if another dev look at them.
Last edited by Chips on Fri May 15, 2015 11:09 am, edited 1 time in total.
Posts: 177
Joined: Sat Aug 18, 2012 8:21 pm
by Vanfanel » Fri May 15, 2015 10:17 am
Wow, chips, this is just incredible! Any chance for a Rpi1 binary? Most people will be happy with A500 speeds on the old Pi1 to play some Lemmings or Prince Of Persia, or even have SOTB title screen on display :D
Of course I've taken a look at the sources before asking, and the Makefile seems to be using neon assembler optimizations, so maybe Rpi1 is left out in the cold this time?
Posts: 403
Joined: Sat Aug 18, 2012 5:58 pm
by windale » Fri May 15, 2015 3:49 pm
Hi, great work. I'm not sure that the preset joypad buttons work properly. I selected the preset 'A =fire, B=fire2' but it keeps using X to fire. (I'm using a iBuffalo SNES controller).

Are there any other keyboard keys that we need to know ? I noticed CTRL enters the GUI. I also had to create a directory called 'conf' otherwise the configs wont save. Keep up the good work.
Posts: 47
Joined: Fri May 15, 2015 3:41 pm
by AmigaGamer » Fri May 15, 2015 6:16 pm
Chips thank you for porting this so quickly.

I did not expect much as its the first release/alpha but im really impressed upto now. Got this running with a HDF from my old amiga no problems. This really looks like the way forward for amiga emulation on ARM
Posts: 90
Joined: Sat Feb 01, 2014 9:02 pm
by rSl » Fri May 15, 2015 10:36 pm
somehow it segfaults at start for me.
does it run on console without using x?
User avatar
Posts: 65
Joined: Tue Jun 24, 2014 1:16 am
Location: computer
by Chips » Sat May 16, 2015 8:23 am
Vanfanel wrote:Wow, chips, this is just incredible! Any chance for a Rpi1 binary? Most people will be happy with A500 speeds on the old Pi1 to play some Lemmings or Prince Of Persia, or even have SOTB title screen on display :D
Of course I've taken a look at the sources before asking, and the Makefile seems to be using neon assembler optimizations, so maybe Rpi1 is left out in the cold this time?


The only things that could prevent to make it works on rpi1 is the JIT, I have no idea for which Arm core the code is generated... except this nothing would be a blocking point.

rSl wrote:somehow it segfaults at start for me.
does it run on console without using x?


You're on Rpi2 ? I tested both X and console and basic A500 games were working. I got some segfault lately but not before I activated zorry memory expansion... but the problem could be more general...

EDIT:
found one bug, if you change resolution while emulation was already started, the dispmanX layer will stay forever even if you go back to menu... this is due to update_display function called 2 times when resolution is change...
Correction is available in github :P
Posts: 177
Joined: Sat Aug 18, 2012 8:21 pm
by windale » Sat May 16, 2015 12:59 pm
TomB posted a new version ! :)
Posts: 47
Joined: Fri May 15, 2015 3:41 pm
by windale » Sat May 16, 2015 3:23 pm
I can't seem to get the preset joypad controls to change buttons. Whatever preset I choose it always uses the same button. I also tried setting Custom joypad buttons, I set my joypad buttons for Fire 1 and Fire 2 but then only the D-Pad works.

I also can't get savestates to work. I think I might have to create a directory for them to save (like I had to to save the configurations) but I don't know what the directory should be called.

Any chance you could take a look at these two problems please ? Thanks for your hard work.
Posts: 47
Joined: Fri May 15, 2015 3:41 pm
by rSl » Sat May 16, 2015 8:22 pm
Chips wrote:You're on Rpi2 ? I tested both X and console and basic A500 games were working.


yep on rpi2 using composite out, running wheezy fully apt & rpi-update'ed.

rebuilding from your source did the same segfault right
after startup even before opening the gui.
strange, as my testbuild of the vanilla pandora source
using retropie's sdl did run ok.

whatever, alpha2 is out and it runs fine here, only
issue i have is, that after starting emulation and going
back to gui the fonts are missing. ;)
but it looks more smooth on cracktro scrollers! :)
User avatar
Posts: 65
Joined: Tue Jun 24, 2014 1:16 am
Location: computer
by Trixster » Sat May 16, 2015 8:49 pm
X and console work fine for me with the first build Chips linked.
User avatar
Posts: 259
Joined: Sat Jul 07, 2012 3:53 pm
by Chips » Sun May 17, 2015 8:10 am
New V0.2 with latest TomB improvement available.
I didn't try picasso though... Zorro3 memory enable starstruck to execute and framerate is ok.
Posts: 177
Joined: Sat Aug 18, 2012 8:21 pm
by windale » Sun May 17, 2015 11:00 am
I'm not sure if my posts are showing up. I'm using UAE4Arm 0.2 on RetroPie 3.

I can't seem to get the preset joypad controls to change buttons. Whatever preset I choose it always uses the same button. I also tried setting Custom joypad buttons, I set my joypad buttons for Fire 1 and Fire 2 but then only the D-Pad works. It used to work fine on your version of UAE4All.

I also can't get savestates to work. I think I might have to create a directory for them to save (like I had to to save the configurations) but I don't know what the directory should be called.

Any chance someone could check please ?

P.S. Is there only a drive light for DF0: ? I wasn't sure if external drives were working because they dont show a drive light.

EDIT.
It seems that these problems are the same as when UAE4All was first ported to the Pi (from the Pandora).
https://www.raspberrypi.org/forums/view ... 78&t=80602

EDIT2.
I got save states to work by creating the required directory but it doesn't display a screenshot in the savestate screen (like it should).
Posts: 47
Joined: Fri May 15, 2015 3:41 pm
by Chips » Sun May 17, 2015 5:32 pm
As I could expect, picasso wasn't working :lol: ... I just push in github the needed modifications to make it works... now it kinda works but with quite some garbage... which looks like common to what is achieved on pandora :(

Image

windale wrote:I'm not sure if my posts are showing up. I'm using UAE4Arm 0.2 on RetroPie 3.


Yes, you're not alone and we are able to read you ;)
For your controller problem, I haven't check myself...

For the screenshoot in savestate, yes it should be bad since it's based on SDL renderer whereas this version use DispmanX renderer... this could be sorted in future...

For the drive light, go to "miscellaneous", and check "status line"
Posts: 177
Joined: Sat Aug 18, 2012 8:21 pm
by windale » Sun May 17, 2015 5:52 pm
I get a drive light for DF0: but are there supposed to be drive lights for the external drives as well (DF1: to DF3:, when enabled) ?

Also, i'm new to this JIT thing. What CPU are you supposed to use it with ? I tried some WHDLoad Demos with 68020, fastest possible and JIT. All I got was crackling sound. It went away when I turned JIT Off. I suppose that you're not supposed to use it with games either ? Thanks.
Posts: 47
Joined: Fri May 15, 2015 3:41 pm
by rSl » Sun May 17, 2015 7:42 pm
hey chips,
thanks for the new v0.2 based on alpha2 with all your
lovely handcrafted fixes & features!

i got it running fine now, had to change the sdlvideodriver
environment variable (from retropie's sdl) to default
"fbcon" first, stupid me. ;)
even my missing fonts issue is gone now, awesome!

i noticed that the gui is scaled somehow widescreen on
my 4:3 composite out connected pal crt, so i get black
borders in the gui top and below.

also we might get even better performance when you could
have a look at the makefile's neon_helper section and
change the mcpu/mtune values to cortex-a7.

i'm really stunned seeing the big performance boost from
your native dispmanx integration vs. dispmanx-sdl!

really nice work! :)
User avatar
Posts: 65
Joined: Tue Jun 24, 2014 1:16 am
Location: computer
by Chips » Mon May 18, 2015 9:19 am
windale wrote:I get a drive light for DF0: but are there supposed to be drive lights for the external drives as well (DF1: to DF3:, when enabled) ?


If I remember well, using "status line" give me track ID and activity of both DF0: and DF1:... they are the two at the most bottom right. The other at left are HDD and CPU % activity (CPU% activity seems not correct on Rpi). DF2 and DF3 activity looks like to be not displayed.

windale wrote:Also, i'm new to this JIT thing. What CPU are you supposed to use it with ? I tried some WHDLoad Demos with 68020, fastest possible and JIT. All I got was crackling sound. It went away when I turned JIT Off. I suppose that you're not supposed to use it with games either ? Thanks.


Don't use fastest if demos/games are meant to be used on plain 1200 or 500. Use correct clock value instead. Fatest seems jerky anyway... it should be mainly used for performances measurement purpose.
JIT should be activated always.


rSl wrote:i noticed that the gui is scaled somehow widescreen on
my 4:3 composite out connected pal crt, so i get black
borders in the gui top and below.


Gui is based on SDL, and I don't change resolution for SDL (nothing change compared with uae4all) since SDL resolution change is broken on Rpi. Even on hdmi I get black border due to this constraint.

rSl wrote:also we might get even better performance when you could
have a look at the makefile's neon_helper section and
change the mcpu/mtune values to cortex-a7.


neon helper is purely ASM, so setting CPU profile should not change anything...
Posts: 177
Joined: Sat Aug 18, 2012 8:21 pm
by AmigaGamer » Mon May 18, 2015 7:22 pm
Im putting together a retropie build script for this, but its exiting after compile.
I Think its due to the fact the makefile doesnt exit cleanly. Strange error since the uae4arm binary compiles(and works) fine.
Can someone cast their eyes over the makefile and see whats up? thanks!

Code: Select all
make: uae4arm: Command not found
Makefile:150: recipe for target 'uae4arm' failed
make: *** [uae4arm] Error 127


Edit - nevermind this was not the issue- my bad spelling was!
Posts: 90
Joined: Sat Feb 01, 2014 9:02 pm
by Flausch » Tue May 19, 2015 7:19 am
This might not be on a high priority list, but is there any chance we see a better joystick integration someday?

As long as joystick port mapping is automatic and therefore quite random, there is no way to play seriously - esp. multiplayer games with more than one controller.

It would be enough for the beginning to have something like a config file with
Code: Select all
uaeport0 = /dev/input/js2
uaeport0 _type = joystick
uaeport1 = /dev/input/js1
uaeport1_type = mouse

A further step would be to implement parallel port joysticks for four player games like dynablaster and great courts 2.

I did check several emulators the last days, but only the raspberry ones seem broken.

I think FS-UAE has a perfect joystick integration:
fsuae_joy.jpg
fsuae_joy.jpg (30.56 KiB) Viewed 17879 times

This would be my desired solution.

I reached a level of desperation, I even started unraveling the source code of a lot of emulators during the last days. But my c++ skills got quite rusty. :?
Maybe I am wrong with this request here and this should be requested a level higher in the uae hierarchy? But where/who is this?

(EDIT: I learned that this is based on the Pandora version by TomB. This explains why joystick support is so poor, since there is no need for more controllers on Pandora. So this means, it has to be improved inside a raspberry fork.)

While I searched for solutions, I found many threads in different forums asking the same question. I think there is some demand for a working controller solution for amiga gaming on raspberry pi out there... ;)
User avatar
Posts: 12
Joined: Wed May 13, 2015 9:15 am
Location: Würzburg, Germany
by rSl » Tue May 19, 2015 9:10 pm
thanks for the quick answers!

@ chips
regarding the neon_helper:
indeed it looks like pure asm so no tuning options
needed here i guess.

the unscaled gui:
no biggie! can live with that widescreen cinema
look for now. :)

how do you get the binaryfile that small?
i guess it's somehow compressed, right?

@ amigagamer
the strip command is commented in the makefile,
defining it strips the binary correctly instead of
trying to run it.
User avatar
Posts: 65
Joined: Tue Jun 24, 2014 1:16 am
Location: computer
by Flausch » Wed May 20, 2015 7:09 am
I did some further joystick testing yesterday:

I unplugged my wireless keyboard-mouse combination and used a single wired keyboard. I also unplugged my xbox-gamepad and left only the two GPIO-Joysticks.

Because it is not possible to use these joysticks inside Retropie (not enough buttons), I quit to console and started UAE4ALL2 manually.

And guess what? I could start Great Courts II and play a two player game with both joysticks.

This was my expected behaviour after looking at the source code of the init function for joysticks:
Code: Select all
if (nr_joysticks > 0)
    {
      uae4all_joy0 = SDL_JoystickOpen (0);
    }
    if (nr_joysticks > 1)
    {
      uae4all_joy1 = SDL_JoystickOpen (1);
    }

No matter what, port 0 is mapped hard to /dev/input/js0 and port 1 is mapped to /dev/input/js1.

In tests before, js0 was my xbox pad and there was some strange behaviour when a mouse was conntected, which got mapped to port 0 too somehow, but also blocked port 1. So my GPIO joysticks got ignored, because they were not the first two devices.

In yesterdays test one GPIO-Joystick was js0, the other was js1 and no other devices were conntected. Et voilà... working!
But this is a terrible workaround.

The solution is to change the joystick init function and map it by the configuration gui. All that has to be done there, is to list every connected device (getting number of devices by SDL_NumJoysticks () and list names by SDL_JoystickName(joystick)). Then let the user choose which devices to use for each port.

My test was done using chips UAE4ALL2 version 5. I had some problems with UAE4ARM (no button click), which needs some further testing.
But the more I get into the source code, the more I get the impression this will not be too hard to fix. No magic needed... ;)
User avatar
Posts: 12
Joined: Wed May 13, 2015 9:15 am
Location: Würzburg, Germany
by windale » Wed May 20, 2015 9:39 am
Hi, here are some things that I hope will get fixed in future (that used to work on UAE4All2) but i'm not sure who to ask, Chips, TomB, or Lubomyr ?

1) Joypad presets and custom joypad buttons, these don't seem to do anything or don't work properly. It keeps using the same button for fire on my joypad.

2) Savestate screenshots. It would be good if we could see if we saved a state for the game and where it was saved visually.

3) It no longer saves the scrolled position in the file requester. This was very useful when having to change disks because it was positioned in the list at the last disk that was inserted. Now it just starts from the top of the list all the time and you have to scroll down to find the next disk.

I still don't understand JIT. Sometimes in a demo for example, it runs great but in the next part of the demo it just crackles the sound. I don't see any difference. Fastest possible CPU seems to make a difference but JIT doesn't.

Otherwise awesome, thanks.
Posts: 47
Joined: Fri May 15, 2015 3:41 pm
by Chips » Wed May 20, 2015 9:53 am
rSl wrote:how do you get the binaryfile that small?
i guess it's somehow compressed, right?


I strip it and compress it using upx... old habits from Amiga days ;)

Flausch wrote:But the more I get into the source code, the more I get the impression this will not be too hard to fix. No magic needed... ;)


Adding a panel to select joystick should not be too much effort, it just needs some time.
I'm still improving the SDL surface management on Rpi code. I'm now using specific surface set to the emulation size instead of using the one from screen which isn't set to emulation size on raspiberry pi (due to broken resolution change).
It should enable proper screenshot for save state, proper blit from SDL (so switching from mouse to joystick using alt key can be displayed), and even improve picasso since it was still quite broken on Rpi (more than pandora case).
Posts: 177
Joined: Sat Aug 18, 2012 8:21 pm