User avatar
Aloshi
Posts: 359
Joined: Sat Jun 23, 2012 6:42 pm
Contact: Website

Re: [Tutorial] gpSP - Full Speed GBA Emulator with Sound and

Fri Apr 19, 2013 1:30 pm

Looking at the code, it would seem that the joystick mapping is hard-coded: https://github.com/DPRCZ/gpsp/blob/master/input.c#L643

After writing EmulationStation and ES-config, I'm pretty confident in my SDL joystick skills...perhaps this weekend I can take a closer look at the source code, perhaps link those settings with a config file. It would make sense for this not to already exist, since gpSP is mainly targeted at portable consoles that all have the same inputs (GP2X, PSP, Pandora). I see references to a "gpsp.cfg" in the README, but I can't seem to find a mention of it in the source code.

EDIT: Aha, found it, gui.c. Looks like it *should* exist already...hm.
Last edited by Aloshi on Fri Apr 19, 2013 9:36 pm, edited 1 time in total.

Vanfanel
Posts: 433
Joined: Sat Aug 18, 2012 5:58 pm

Re: [Tutorial] gpSP - Full Speed GBA Emulator with Sound and

Fri Apr 19, 2013 9:33 pm

@Aloshi: Thanks for the pointer to the hardcoded settings. I'm manually adjusting it to my likes for now. :)

BrianXP7
Posts: 21
Joined: Sat Mar 30, 2013 6:35 am

Re: [Tutorial] gpSP - Full Speed GBA Emulator with Sound and

Sun Apr 21, 2013 7:46 pm

Does anyone know how I can remap the controls for the keyboard? The pre-built binary doesn't have an option for this so I'm assuming it's somewhere in the source. I tried looking for it in "input.c" but I quickly got confused.

User avatar
Aloshi
Posts: 359
Joined: Sat Jun 23, 2012 6:42 pm
Contact: Website

Re: [Tutorial] gpSP - Full Speed GBA Emulator with Sound and

Sun Apr 21, 2013 8:49 pm

I believe around line 560 is where you need to change: https://github.com/DPRCZ/gpsp/blob/master/input.c#L560

BrianXP7
Posts: 21
Joined: Sat Mar 30, 2013 6:35 am

Re: [Tutorial] gpSP - Full Speed GBA Emulator with Sound and

Sun Apr 21, 2013 9:55 pm

Thanks! I kind of got the hang of it now. I'm only used to a lot of scripts with short lines of code. *derp* So how do I map the SELECT button with right Ctrl? Is it like this:

Code: Select all

 
   case SDLK_CTRL:
      return BUTTON_SELECT;

BrianXP7
Posts: 21
Joined: Sat Mar 30, 2013 6:35 am

Re: [Tutorial] gpSP - Full Speed GBA Emulator with Sound and

Sun Apr 21, 2013 10:07 pm

I have a problem with compilation. Here's what I did: (I moved the downloaded tar.gz archive to the downloads folder and renamed the old "gui.c" to "gui.c.bak".)

Code: Select all

[email protected] ~ $ wget https://dl.dropbox.com/u/24838026/gpsp-ffa573f.tar.gz
--2013-04-21 14:44:53--  https://dl.dropbox.com/u/24838026/gpsp-ffa573f.tar.gz
Resolving dl.dropbox.com (dl.dropbox.com)... 107.20.135.62
Connecting to dl.dropbox.com (dl.dropbox.com)|107.20.135.62|:443... connected.
HTTP request sent, awaiting response... 302 FOUND
Location: https://dl.dropboxusercontent.com/u/24838026/gpsp-ffa573f.tar.gz [following]
--2013-04-21 14:45:02--  https://dl.dropboxusercontent.com/u/24838026/gpsp-ffa573f.tar.gz
Resolving dl.dropboxusercontent.com (dl.dropboxusercontent.com)... 54.243.249.124
Connecting to dl.dropboxusercontent.com (dl.dropboxusercontent.com)|54.243.249.124|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 315762 (308K) [application/x-tar]
Saving to: `gpsp-ffa573f.tar.gz'

100%[======================================>] 315,762      338K/s   in 0.9s    

2013-04-21 14:45:10 (338 KB/s) - `gpsp-ffa573f.tar.gz' saved [315762/315762]

[email protected] ~ $ tar xzf gpsp-ffa573f.tar.gz
[email protected] ~ $ cd gpsp-ffa573f
[email protected] ~/gpsp-ffa573f $ wget https://dl.dropbox.com/u/24838026/gui.c
--2013-04-21 14:45:59--  https://dl.dropbox.com/u/24838026/gui.c
Resolving dl.dropbox.com (dl.dropbox.com)... 107.21.94.227
Connecting to dl.dropbox.com (dl.dropbox.com)|107.21.94.227|:443... connected.
HTTP request sent, awaiting response... 302 FOUND
Location: https://dl.dropboxusercontent.com/u/24838026/gui.c [following]
--2013-04-21 14:46:06--  https://dl.dropboxusercontent.com/u/24838026/gui.c
Resolving dl.dropboxusercontent.com (dl.dropboxusercontent.com)... 54.225.247.129
Connecting to dl.dropboxusercontent.com (dl.dropboxusercontent.com)|54.225.247.129|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 56179 (55K) [text/x-csrc]
Saving to: `gui.c'

100%[======================================>] 56,179      --.-K/s   in 0.04s   

2013-04-21 14:46:13 (1.30 MB/s) - `gui.c' saved [56179/56179]

[email protected] ~/gpsp-ffa573f $ cd raspberrypi
[email protected] ~/gpsp-ffa573f/raspberrypi $ make -i
gcc -DARM_ARCH -DRPI_BUILD -Wall -O3 -mfpu=vfp `sdl-config --cflags` -I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads   -c -o rpi.o rpi.c
In file included from /opt/vc/include/bcm_host.h:50:0,
                 from rpi.c:25:
/opt/vc/include/interface/vmcs_host/vcgencmd.h:33:27: fatal error: vchost_config.h: No such file or directory
compilation terminated.
make: [rpi.o] Error 1 (ignored)
gcc -DARM_ARCH -DRPI_BUILD -Wall -O3 -mfpu=vfp `sdl-config --cflags` -I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads   -c -o main.o ../main.c
gcc -DARM_ARCH -DRPI_BUILD -Wall -O3 -mfpu=vfp `sdl-config --cflags` -I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads -Wno-unused-variable -Wno-unused-label   -c -o cpu.o ../cpu.c
../cpu.c: In function ‘execute_arm’:
../cpu.c:4371:7: warning: variable ‘old_pc’ set but not used [-Wunused-but-set-variable]
What did I do wrong?

User avatar
Aloshi
Posts: 359
Joined: Sat Jun 23, 2012 6:42 pm
Contact: Website

Re: [Tutorial] gpSP - Full Speed GBA Emulator with Sound and

Sun Apr 21, 2013 11:20 pm

I believe the Makefile is missing an include directory. You can run this sed command (from RetroPie) to insert it into the Makefile (it just pastes the string into line 23):

Code: Select all

sed -i '23iCFLAGS     += -I/opt/vc/include/interface/vmcs_host/linux' Makefile

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

Re: [Tutorial] gpSP - Full Speed GBA Emulator with Sound and

Mon Apr 22, 2013 1:02 pm

Wow))) Cool work!
Nice to see that my GLESv2 rendering adopted to other emulators.
But what about GPL license?) Why did you removed some copyrights at the beginning of https://github.com/notaz/gpsp/blob/mast ... es_video.c ?

You can add something like this in file header:
http://atari800.cvs.sourceforge.net/vie ... iew=markup

DPR
Posts: 21
Joined: Mon Mar 18, 2013 12:45 pm

Re: [Tutorial] gpSP - Full Speed GBA Emulator with Sound and

Mon Apr 22, 2013 2:16 pm

To: Andrey
I used as source http://ax86.patrickaalto.com/gles_video.c and kept all copyrights and credits from this source code.

Vanfanel
Posts: 433
Joined: Sat Aug 18, 2012 5:58 pm

Re: [Tutorial] gpSP - Full Speed GBA Emulator with Sound and

Mon Apr 22, 2013 2:28 pm

To: DPR

Now that I know you're reading this thread: thanks for this awesome emulator! Fullspeed GBA on the Pi is incredible.

Ah! And I will repeat the question I asked Pate: is the emulated system's vsync using host's vsync? Games seem perfectly smooth even if I look at a scrolling scene for a long while so it must be the case, but I'd like to know for sure :P

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

Re: [Tutorial] gpSP - Full Speed GBA Emulator with Sound and

Mon Apr 22, 2013 6:04 pm

DPR wrote:To: Andrey
I used as source http://ax86.patrickaalto.com/gles_video.c and kept all copyrights and credits from this source code.
LOL))

Pate removed origins of the code.
Look at this thread and make changes later, please.

http://www.raspberrypi.org/phpBB3/viewt ... 58#p336558

DPR
Posts: 21
Joined: Mon Mar 18, 2013 12:45 pm

Re: [Tutorial] gpSP - Full Speed GBA Emulator with Sound and

Mon Apr 22, 2013 6:16 pm

To:Vanfanel
There is no sync of video in emulator - GBA engine is sync by timer. Video overwriting is job of GPU. Emulator is writing screen bitmap to texture memory as fast as can.

aguirrech
Posts: 22
Joined: Sun Sep 02, 2012 11:51 am

Re: [Tutorial] gpSP - Full Speed GBA Emulator with Sound and

Mon Apr 22, 2013 8:17 pm

Hi! some feedback...

I found a 0,5 sg delay between video and sound, is there any way to sync-fix this?

Otherwise, it's a great emulator, good work! :D

BrianXP7
Posts: 21
Joined: Sat Mar 30, 2013 6:35 am

Re: [Tutorial] gpSP - Full Speed GBA Emulator with Sound and

Tue Apr 23, 2013 4:07 am

Aloshi wrote:I believe the Makefile is missing an include directory. You can run this sed command (from RetroPie) to insert it into the Makefile (it just pastes the string into line 23):

Code: Select all

sed -i '23iCFLAGS     += -I/opt/vc/include/interface/vmcs_host/linux' Makefile
I applied the command but I still get the same result.

If it's not too much trouble, can you compile it for me? I all need modified are the controls. I just want to swap the A and B buttons (X=A, Z=B) and change the Select button to right Ctrl.

JBaker1225
Posts: 48
Joined: Wed Apr 17, 2013 10:27 pm

Re: [Tutorial] gpSP - Full Speed GBA Emulator with Sound and

Thu Apr 25, 2013 2:52 am

Has anybody got this working well with a controller yet?
Where exactly do I go to change the button configuration? And is it possible to ode a button combination to exit the emu?

Sorry if this has been asked and answered, I just skimmed through and didn't understand much.

ti84
Posts: 70
Joined: Wed Feb 06, 2013 9:09 pm

Re: [Tutorial] gpSP - Full Speed GBA Emulator with Sound and

Fri Apr 26, 2013 1:20 am

@jbaker1225

What problems are you having...the joystick work okay for me

JBaker1225
Posts: 48
Joined: Wed Apr 17, 2013 10:27 pm

Re: [Tutorial] gpSP - Full Speed GBA Emulator with Sound and

Fri Apr 26, 2013 5:08 am

On my controller, the 'B' button is Start, and the 'X' button is A, off the top of my head.
Start and Select do nothing.
Also, as it's currently set up, there's no way to exit the emulator without a keyboard as far as I can tell.

So I'm trying to get the controls aligned properly, and use the controller the quit back out to EmulationStation.

User avatar
Aloshi
Posts: 359
Joined: Sat Jun 23, 2012 6:42 pm
Contact: Website

Re: [Tutorial] gpSP - Full Speed GBA Emulator with Sound and

Sat Apr 27, 2013 4:24 am

I did stuff: https://github.com/Aloshi/gpsp

Basic support for remapping any axis, button, or key to any input on the GBA. Documentation for writing your input config file in gpsp/raspberrypi/INPUT.md. Written in a 7-hour marathon mostly due to having never used C before, with my time mostly spent debugging silly things (why is char unsigned by default seriously), so there are likely a ton of bugs!

In particular, it *does not* load a default keyboard config if none is defined. I'll try and change that tomorrow. I also would like to get hats working (which I don't think gpSP even does at all right now).

You should be able to try it out with "git pull https://www.github.com/Aloshi/gpsp.git" (if you do it in your current gpsp directory, it should essentially update). To build, run "make" from gpsp/raspberrypi/ as usual.

JBaker1225
Posts: 48
Joined: Wed Apr 17, 2013 10:27 pm

Re: [Tutorial] gpSP - Full Speed GBA Emulator with Sound and

Sat Apr 27, 2013 5:36 am

Thanks a ton for doing this.
However, I still don't know exactly what I'm doing here... :oops:

I pulled it from the git no problem, but I can't quite figure out how to run it. I tried

Code: Select all

sudo ./Makefile
after I pulled it into my current gpsp directory. Then I tried

Code: Select all

sudo ./raspberrypi/Makefile
and still a no go.

(also tried "Make" and "make" in place of "Makefile" above. Obviously I'm not really sure what I'm doing. :lol:

Also, is there any way you can program it so that we can set an emulator exit button or button combination to the joypad? Even if it's just something I'd have to go in and edit manually in the gpsp_input.cfg.

User avatar
Aloshi
Posts: 359
Joined: Sat Jun 23, 2012 6:42 pm
Contact: Website

Re: [Tutorial] gpSP - Full Speed GBA Emulator with Sound and

Sat Apr 27, 2013 2:28 pm

You need to run "make" in the raspberrypi directory to compile the source code. After you do that, you should get a "gpsp" file in the same directory. That's the binary. To run it, use "./gpsp".

(The Makefile is a special file that's used by the program "make" to compile stuff. You can't actually run it directly. Running "make" will automatically look for a file named Makefile in the current working directory, and process it appropriately.)

JBaker1225
Posts: 48
Joined: Wed Apr 17, 2013 10:27 pm

Re: [Tutorial] gpSP - Full Speed GBA Emulator with Sound and

Sat Apr 27, 2013 11:22 pm

When I run "make" I get a message saying:

make: Nothing to be done for 'all'

What does this mean? Am I doing something wrong?

User avatar
Aloshi
Posts: 359
Joined: Sat Jun 23, 2012 6:42 pm
Contact: Website

Re: [Tutorial] gpSP - Full Speed GBA Emulator with Sound and

Sat Apr 27, 2013 11:35 pm

That usually means make thinks the source code hasn't changed since the last time you ran it, so it did nothing. Which means either it didn't update right ("git pull https://www.github.com/Aloshi/gpsp.git" - don't omit the URL), or you ran it before after updating. You can read the "INPUT.md" file for instructions on writing an input config file.

JBaker1225
Posts: 48
Joined: Wed Apr 17, 2013 10:27 pm

Re: [Tutorial] gpSP - Full Speed GBA Emulator with Sound and

Sat Apr 27, 2013 11:53 pm

Yeah, I just had to delete the Makefile and pull again, and then it worked.

Ok so after running "make", I created a gpsp_input.cfg file and put it in the same directory as gpsp (RetroPie/emulators/gpsp/raspberrypi), but the controls I programmed in there don't seem to work. What did I miss? Do I need to update or change some other file The es_systems.cfg file seems to be pointing there correctly.

User avatar
Aloshi
Posts: 359
Joined: Sat Jun 23, 2012 6:42 pm
Contact: Website

Re: [Tutorial] gpSP - Full Speed GBA Emulator with Sound and

Sun Apr 28, 2013 1:02 am

Hm, that should be all you need to do.

Try running gpsp directly, and redirect the output to a file. "cd' into the gpsp/raspberrypi folder and run "./gpsp path/to/a/rom.gba >log.txt". Post the contents of "log.txt", as well as your gpsp_input.cfg.

JBaker1225
Posts: 48
Joined: Wed Apr 17, 2013 10:27 pm

Re: [Tutorial] gpSP - Full Speed GBA Emulator with Sound and

Sun Apr 28, 2013 2:50 am

Thanks, I'll try and do that when I get home later.

In the meantime a couple questions that might help figure it out... Did I need to delete my old gpsp file before pulling your build? Does pulling the git or running the Makefile create a new one? Because I haven't messed with my original gpsp file and don't know if that's the problem.

Also, I created the gpsp_inut.cfg file in LeapPad in X, since I have trouble SSHing in. That shouldn't be a problem, should it?

Return to “Gaming”