cuzebox runs great on my TV box

The Uzebox now have a fully functional emulator! Download and discuss it here.
User avatar
danboid
Posts: 1933
Joined: Sun Jun 14, 2020 12:14 am

cuzebox runs great on my TV box

Post by danboid »

I own a few different, mostly AMLogic S905X3 based TV boxes like the X96 Max+ and the X96 Air Q1000. These are little, dirt cheap (~£35) ARM based set top boxes than come pre-loaded with Android but you can reflash them with Armbian (Debian or Ubuntu) and other flavours of Linux and turn them into low power home servers, emulation/ media playback devices or whatever you'd usually use a RPi for that doesn't require GPIO. They don't have GPIO unfortunately.

Otherwise, the spec of these TV boxes compares well to the RPi 4. Quad core (but pretty weedy) ARM CPU, 4 GB RAM, gigabit ethernet, onboard wifi and BT plus a few USB ports inc. 1x USB 3.0 port that you can boot directly from. They beat the RPi in a few areas like including a case, PSU, HDMI cable and remote, having 32 or 64 GB onboard eMMC storage and coming in at roughly half the price of a new 4 GB RPi 4, in the UK at least. Cuzebox runs 100% full speed with sound on these TV boxes when running Armbian, no problems.

I wrote a guide to reflashing AMLogic TV boxes for the Manjaro wiki. Nearly all of this applies to Armbian on AMLogic TV boxes too:

https://wiki.manjaro.org/index.php/Amlogic_TV_boxes

https://github.com/ophub/amlogic-s9xxx-armbian

I could realistically and quite comfortably use one of these TV boxes for Uzebox development.

I wonder what is the oldest computer that can run cuzebox at or near 100% speed, with sound enabled, is? Would a Pentium or a 486 be fast enough? Has anyone ever tried to run cuzebox on an Amiga or slightly odd by modern standards hardware like PowerPC,anything thats not a PC or ARM based? Cuzebox built under Haiku for me with no modifications so it seems if you've got a modern POSIX OS with SDL2 installed you've got a good chance of getting cuzebox to build and run it seems.
User avatar
Artcfox
Posts: 1382
Joined: Thu Jun 04, 2015 5:35 pm
Contact:

Re: cuzebox runs great on my TV box

Post by Artcfox »

Cool!

I compiled an Android version of Cuzebox, and it ran on my Google Pixel XL back in 2017. I'm not an Android developer, so the touch/tilt controls sucked, but you could plug a keyboard into a USB OTG port, and it played well.

For some reason I still can't run it at 100% on my Acer C740, it shows 97-100%, but it skips frames. I was able to hack the main function to not skip frames though, so when I single-step it, I can see every frame, and see the WDR timer for each frame. That helps a lot for debugging. I don't think it should be skipping frames though, because if I hit F4 it can run at 466% speed, so it should be able to handle 100% just fine.

Code: Select all

@@ -356,16 +356,16 @@ static void main_loop(void)
 #endif
 
 #ifdef ENABLE_VCAP
-  rows = frame_run(fdrop && (!main_isvcap), main_fmerge);
+  rows = frame_run(fdrop && 0 && (!main_isvcap), main_fmerge);
   audio_sendframe(frame_getaudio(), rows);
-  guicore_update(fdrop);
+  guicore_update(fdrop && 0);
   if (main_isvcap){
    avconv_push(frame_getaudio(), rows);
   }
 #else
-  rows = frame_run(fdrop, main_fmerge);
+  rows = frame_run(fdrop && 0, main_fmerge);
   audio_sendframe(frame_getaudio(), rows);
-  guicore_update(fdrop);
+  guicore_update(fdrop && 0);
 #endif
 
  }else{
If you are on a really slow computer, you can speed it up a ton by adding -march=native, and -fprofile-generate, running it, and then changing it to -fprofile-use and then recompiling for profile guided optimization. If I hit a bug 5 minutes into an input recording, it's very helpful to be able to run the replay as fast as possible in order to fast forward to the spot with the bug, and then slow it back down and step frame by frame.

Code: Select all

diff --git a/Make_defines.mk b/Make_defines.mk
index 2bcbe23..2668061 100644
--- a/Make_defines.mk
+++ b/Make_defines.mk
@@ -121,8 +121,8 @@ ifeq ($(TSYS),emscripten)
 CFSPD?=-O3 --llvm-lto 3 -s ASSERTIONS=0 -s AGGRESSIVE_VARIABLE_ELIMINATION=1
 CFSIZ?=-Os --llvm-lto 3 -s ASSERTIONS=0
 else
-CFSPD?=-O3 -s -flto
-CFSIZ?=-Os -s -flto
+CFSPD?=-march=native -O3 -s -flto -fprofile-use=/tmp
+CFSIZ?=-march=native -Os -s -flto -fprofile-use=/tmp
 endif
 #
 #
@@ -130,7 +130,7 @@ endif
 #
 
 LINKB?=
-LINK= $(LINKB)
+LINK= $(LINKB) -fprofile-use=/tmp
User avatar
Artcfox
Posts: 1382
Joined: Thu Jun 04, 2015 5:35 pm
Contact:

Re: cuzebox runs great on my TV box

Post by Artcfox »

It turned out to be the accelerated renderer. Once I switched Cuzebox to use a software renderer, it can do 60fps just fine on my C740. How strange. I wonder if it has something to do with the compositor.
User avatar
danboid
Posts: 1933
Joined: Sun Jun 14, 2020 12:14 am

Re: cuzebox runs great on my TV box

Post by danboid »

I remember seeing you had done an Android port, I'll have to try it on my phone.

The slowest computer I own that might be able to run cuzebox is a Sharp Zaurus C3000 Linux PDA. Its got an old (early 2000's) 400 Mhz ARM CPU, 64 MB RAM and a VGA display. I've not used it in a while but I may have to see if it still works just to try cuzebox on it some time.
User avatar
Artcfox
Posts: 1382
Joined: Thu Jun 04, 2015 5:35 pm
Contact:

Re: cuzebox runs great on my TV box

Post by Artcfox »

I'm pretty sure that will not work. I don't think it ran on my Raspberry Pi model 2B, and that was a quad core clocked at 900 MHz.
User avatar
danboid
Posts: 1933
Joined: Sun Jun 14, 2020 12:14 am

Re: cuzebox runs great on my TV box

Post by danboid »

When you say it didn't run on your Rpi 2, you mean it ran too slow to be playable? I presume it built OK.

I've got some older (older than the Rpi 4) ARM SBC's like the Pandaboard and BananaPi. If cuzebox won't run well on the Pandaboard it absolutely won't run on ye olde Zaurus.

So maybe the RPi 3 was the first RPi model fast enough to run cuzebox at full speed? The RPi 4 8 GB is the only RPi I've got.
User avatar
Artcfox
Posts: 1382
Joined: Thu Jun 04, 2015 5:35 pm
Contact:

Re: cuzebox runs great on my TV box

Post by Artcfox »

It built fine, it just couldn't keep up. I don't have an Raspberry Pi 3 or 4 so I don't know.
User avatar
danboid
Posts: 1933
Joined: Sun Jun 14, 2020 12:14 am

Re: cuzebox runs great on my TV box

Post by danboid »

cuzebox runs full speed on the RPi4 and I think it should also run full speed on the RPi 3. One of my friends has an RPi 3 so I might ask if I can borrow it to test it out, unless another forum member can confirm it runs fine.

Today I tried running cuzebox on my almost 10 year old BananaPi SBC running Armbian Bullseye (Debian Linux). The BPi M1 has a Allwinner A20 Dual-core 1.0 GHz CPU and 1 GB DDR3 memory. It only manages to average about 30% under cuzebox so yes, there's no way my ancient 400 Mhz Zaurus PDA is going to run cuzebox at anything close to a playable speed.
User avatar
Artcfox
Posts: 1382
Joined: Thu Jun 04, 2015 5:35 pm
Contact:

Re: cuzebox runs great on my TV box

Post by Artcfox »

danboid wrote: Sat Feb 11, 2023 9:36 pm cuzebox runs full speed on the RPi4 and I think it should also run full speed on the RPi 3. One of my friends has an RPi 3 so I might ask if I can borrow it to test it out, unless another forum member can confirm it runs fine.

Today I tried running cuzebox on my almost 10 year old BananaPi SBC running Armbian Bullseye (Debian Linux). The BPi M1 has a Allwinner A20 Dual-core 1.0 GHz CPU and 1 GB DDR3 memory. It only manages to average about 30% under cuzebox so yes, there's no way my ancient 400 Mhz Zaurus PDA is going to run cuzebox at anything close to a playable speed.
If you really want to get the absolute best performance on old hardware, you can try with the frame merge and console output disabled (in Make_config.mk), software rendering (in the code, replace SDL_RENDERER_ACCELERATED with SDL_RENDER_SOFTWARE, and comment out the next line of code), small display (hit F2), and add the following to both CFLAGS (size and speed) and LDFLAGS: -march=native -fprofile-generate/-fprofile-use (compile and run your game with -fprofile-generate, then after you've gathered profile data for a while, change it to -fprofile-use and recompile).
User avatar
danboid
Posts: 1933
Joined: Sun Jun 14, 2020 12:14 am

Re: cuzebox runs great on my TV box

Post by danboid »

Thanks Artcfox!

I wasn't plannng on running it on my BananaPi, I was just trying to validate what you told me about an RPi 2 being too slow. I think my BPi is a bit faster than the Rpi 2 so I wanted to see if it was fast enough for cuzebox, nope.

Have you uploaded any .apk files for Android cuzebox? We should update https://uzebox.org/wiki/Emulator with a link to your port and the apk file, if there is one, and maybe add something like "Cuzebox requires an RPi 3 or faster machine to run full speed". If we could work out the x86 minimum spec CPU to run Cuzebox well that'd be good info to add too.
Post Reply