Higgy
Posts: 91
Joined: Sun Jun 29, 2014 7:12 pm

Re: Unreal Speccy Portable - ZX Spectrum emulator

Wed Apr 15, 2015 7:00 am

Thanks.
The ZX Spectrum emulators seem to be having a new spurt of development which is great. 8-)

AmigaGamer
Posts: 90
Joined: Sat Feb 01, 2014 9:02 pm

Re: Unreal Speccy Portable - ZX Spectrum emulator

Fri Apr 17, 2015 9:40 am

Thanks for this update. Its a great emulator i use it on my android tablet as well.

The joypad support is a welcome improvement.
Is there a way to define which joypad button operates as Fire?
An option to assign a button to Open the menu would be good too , perhaps in a future version? :)

barrybarryk
Posts: 20
Joined: Thu Jul 19, 2012 12:11 pm

Re: Unreal Speccy Portable - ZX Spectrum emulator

Sun Dec 13, 2015 5:15 pm

I had a problem with my Joystick not working properly (button worked but the stick was non-responsive) turned out SDL sees my stick as a POV Hat and the emu doesn't support it. I managed to get it sorted by making a few changes and recompiling.

In sdl_joystick.cpp:
I added a new function 'ProcessHat':

Code: Select all

static void ProcessHat(bool state, bool state_prev, byte key)
{
	if(state == state_prev) // state not changed
		return;
	if(state) // pressed
		Handler()->OnKey(key, KF_DOWN|OpJoyKeyFlags());
	else // released
		Handler()->OnKey(key, OpJoyKeyFlags());
}
And changed ProcessJoy:

Code: Select all

void ProcessJoy(SDL_Event& e)
{
	static bool north, east, south, west, pre_north, pre_east, pre_south, pre_west;
	static ePadState pad, pad_prev;
	switch(e.type)
	{
	//HAT Hack
	case SDL_JOYHATMOTION:
		{
		pre_north = north;
		pre_east = east;
		pre_south = south;
		pre_west = west;
			
		north = false;
		east = false;
		south = false;
		west = false;
			
		if (e.jhat.value & SDL_HAT_UP)
			north = true;
		if (e.jhat.value & SDL_HAT_RIGHT)
			east = true;
		if (e.jhat.value & SDL_HAT_DOWN)
			south = true;
		if (e.jhat.value & SDL_HAT_LEFT)
			west = true;
		}
		break;
	case SDL_JOYBUTTONDOWN:
		{
			if(e.jbutton.button < PB_COUNT)
				pad.buttons[e.jbutton.button] = true;
		}
		break;
	case SDL_JOYBUTTONUP:
		{
			if(e.jbutton.button < PB_COUNT)
				pad.buttons[e.jbutton.button] = false;
		}
		break;
	case SDL_JOYAXISMOTION:
		{
			if(e.jaxis.axis < AXES_COUNT)
				pad.axes[e.jaxis.axis] = float(e.jaxis.value)/32768;
		}
		break;
	default:
		break;
	}
	
	ProcessHat(north, pre_north, 'u');
	ProcessHat(east, pre_east, 'r');
	ProcessHat(south, pre_south, 'd');
	ProcessHat(west, pre_west, 'l');
	
	ProcessButton(PB_UP, pad, pad_prev, 'u');
	ProcessButton(PB_DOWN, pad, pad_prev, 'd');
	ProcessButton(PB_LEFT, pad, pad_prev, 'l');
	ProcessButton(PB_RIGHT, pad, pad_prev, 'r');
	ProcessButton(PB_A, pad, pad_prev, 'f');
	ProcessButton(PB_B, pad, pad_prev, 'e');
	ProcessButton(PB_X, pad, pad_prev, '1');
	ProcessButton(PB_Y, pad, pad_prev, ' ');
	ProcessButton(PB_SELECT, pad, pad_prev, 'm');
	ProcessButton(PB_START, pad, pad_prev, 'k');

	ProcessAxis(0, pad, pad_prev, 'r', 'l');
	ProcessAxis(1, pad, pad_prev, 'd', 'u');
	ProcessAxis(3, pad, pad_prev, 'r', 'l');
	ProcessAxis(4, pad, pad_prev, 'd', 'u');
	ProcessAxis(6, pad, pad_prev, 'r', 'l');
	ProcessAxis(7, pad, pad_prev, 'd', 'u');

	if(ButtonPressed(PB_LSHIFT, pad, pad_prev) || ButtonPressed(PB_LTRIGGER, pad, pad_prev))
		Handler()->OnAction(A_RESET);
	if(ButtonPressed(PB_RSHIFT, pad, pad_prev) || ButtonPressed(PB_RTRIGGER, pad, pad_prev))
	{
		using namespace xOptions;
		eOptionB* o = eOptionB::Find("pause");
		SAFE_CALL(o)->Change();
	}
	if(ButtonState(PB_SELECT, pad) && ButtonState(PB_START, pad))
		OpQuit(true);
	pad_prev = pad;
}
In sdl.cpp I added the SDL_JOYHATMOTION to the events polled:

Code: Select all

#ifdef SDL_USE_JOYSTICK
			case SDL_JOYBUTTONDOWN:
			case SDL_JOYBUTTONUP:
			case SDL_JOYAXISMOTION:
			case SDL_JOYHATMOTION:
				ProcessJoy(e);
				break;
#endif
And the only other change was adding "-lbcm_host" to the RPi makefile to get it to compile correctly for the pi

Code: Select all

LFLAGS = -s -L$(SDKSTAGE)/opt/vc/lib -lbcm_host -lGLESv2 -lEGL `sdl-config --libs` -lz
After that, it's perfectly fine and now I can enjoy my speccy games with my Zipstick :D

Edit: I got the source for the version I edited from here this afternoon btw

jfroco
Posts: 4
Joined: Wed Aug 22, 2012 6:22 am

Re: Unreal Speccy Portable - ZX Spectrum emulator

Sun Apr 03, 2016 2:43 am

Hello

I've been using USP for a long time, however I noticed it runs faster than a real Spectrum in my Raspberry Pi Model B

This is obvious when playing Manic Miner (the music and the sprites move faster)

I've tested using HDMI (most modes) and analog video output in both NTSC and PAL.

My Raspberry PI is not overclocked

Do you have the same issue?

Thank you!!

Andrey
Posts: 78
Joined: Sat Sep 01, 2012 9:52 am

Re: Unreal Speccy Portable - ZX Spectrum emulator

Thu Jul 14, 2016 1:29 pm

jfroco wrote:I've been using USP for a long time, however I noticed it runs faster than a real Spectrum in my Raspberry Pi Model B
This is obvious when playing Manic Miner (the music and the sprites move faster)
Hi!
It's because of emulating russian clone Pentagon 128K, it have a little speedup over standard ZX Spectrum 48/128K.

BTW, new version for Raspberry Pi is released.
Implemented web sources, now you can open files directly from web (VTRDOS/RZXARCHIVE).
https://bitbucket.org/djdron/unrealspeccyp/downloads

Andrey
Posts: 78
Joined: Sat Sep 01, 2012 9:52 am

Re: Unreal Speccy Portable - ZX Spectrum emulator

Thu Jul 14, 2016 1:32 pm

barrybarryk wrote:I had a problem with my Joystick not working properly (button worked but the stick was non-responsive) turned out SDL sees my stick as a POV Hat and the emu doesn't support it. I managed to get it sorted by making a few changes and recompiling.
Hello!)
Can you submit a patch with your improvements?

Andrey
Posts: 78
Joined: Sat Sep 01, 2012 9:52 am

Re: Unreal Speccy Portable - ZX Spectrum emulator

Sun Sep 04, 2016 3:10 pm

Small update 0.0.69.1.
  1. http://bbb.retroscene.org/ web source added
  2. press section from vtrdos web source added

Andrey
Posts: 78
Joined: Sat Sep 01, 2012 9:52 am

Re: Unreal Speccy Portable - ZX Spectrum emulator

Thu May 10, 2018 11:06 pm

There is new experimental version for raspbian stretch with ATM TURBO 2+ support.
Also Mr. Gluk reset service used instead of MadRom.
https://bitbucket.org/fyrex/unrealspecc ... downloads/
Last edited by Andrey on Fri May 18, 2018 4:49 pm, edited 1 time in total.

Andrey
Posts: 78
Joined: Sat Sep 01, 2012 9:52 am

Re: Unreal Speccy Portable - ZX Spectrum emulator

Fri May 18, 2018 4:48 pm

barrybarryk wrote:
Sun Dec 13, 2015 5:15 pm
I had a problem with my Joystick not working properly (button worked but the stick was non-responsive) turned out SDL sees my stick as a POV Hat and the emu doesn't support it. I managed to get it sorted by making a few changes and recompiling.
Just added joystick hat motion processing.

Return to “Gaming”

Who is online

Users browsing this forum: Ger_Pa and 6 guests