ric_rpi
Posts: 206
Joined: Thu Jul 11, 2013 2:33 pm
Location: Bedford, UK

Re: WIP: Playable Nintendo 64 Emulator Available

Mon Nov 11, 2013 2:52 pm

welshy wrote:ric_rpi
Its SLOWER than the Master even with the changes suggested, also the sound is terrible (Princess Toadstool sounds like Barry White!) and it crashes/freezes after a few seconds (tested with Mario 64) both with DEFAULT_MODE=10000 and 1 (ROM Fz).
I am surprised it slowed down significantly though, and crashes.

Maybe the fetching of the audio latency is quite slow then.

ric_rpi
Posts: 206
Joined: Thu Jul 11, 2013 2:33 pm
Location: Bedford, UK

Re: WIP: Playable Nintendo 64 Emulator Available

Mon Nov 11, 2013 3:08 pm

welshy,

The ric_dev stream is slower as all the graphics are done in a separate thread.

welshy
Posts: 1667
Joined: Mon Oct 29, 2012 2:07 pm

Re: WIP: Playable Nintendo 64 Emulator Available

Mon Nov 11, 2013 3:18 pm

ric_rpi
Ah, I thought that may be the case having a quick look at the code! Still, doesn't help with the freeze/crash and as before when I tested the Fz changes it makes little difference in FPS using Digital HDMI output and the audio is still under running significantly. checking the Git again the Dynamic Frequency is dated 11th Nov but its not fetching the latest commit.
"The list of things I have heard now contains everything!"

dcdeadcell
Posts: 2
Joined: Sat Sep 14, 2013 1:50 am

Re: WIP: Playable Nintendo 64 Emulator Available

Wed Nov 13, 2013 12:50 am

Hello all, first I just wanted to thanks for all your work on this project. I got everything setup and running OK, still need to tweak somethings and play around a little. I got my DualShock 3 mapped and working fine in games, the problem I'm running into is trying to map a button on my controller to stop and exit the emulator (what the ESC key does on a keyboard). This is what the line in the config file looks like:

# Joystick event string for stopping the emulator
Joy Mapping Stop = "button(16)"

However I can't get the emulator to stop and exit using the controller, I have tried mapping several buttons to no avail, any info on this would be great.

Thanks again

ric_rpi
Posts: 206
Joined: Thu Jul 11, 2013 2:33 pm
Location: Bedford, UK

Re: WIP: Playable Nintendo 64 Emulator Available

Wed Nov 13, 2013 11:30 am

dcdeadcell

SDL is not complete on the pi so joystick core events and Mouse input do not work.

For the time being you will need to stick to using the keyboard for core events. Note also that the arrow keys do not work correctly (to be invesigated) although you can use the keyboard for controller buttons.

Afraid this won't be fixed by me in quite a while although I will probably look at it eventually.

KitchUK
Posts: 256
Joined: Fri Jul 19, 2013 5:40 pm

Re: WIP: Playable Nintendo 64 Emulator Available

Wed Nov 13, 2013 3:09 pm

How are the optimisations coming along?

ric_rpi
Posts: 206
Joined: Thu Jul 11, 2013 2:33 pm
Location: Bedford, UK

Re: WIP: Playable Nintendo 64 Emulator Available

Wed Nov 13, 2013 4:38 pm

They are going slow unfortunately. I haven't had much time due work and family the last two weeks.

As you are probably aware I'm trying to make it multi threaded to try and remove the linked list in the interrupt handling and to do 'parallel' processing when graphics are waiting on the GPU.

Currently the graphics are drawn and screen updated from a dedicated Graphics thread but I cannot trigger screen updates independently, instead of from the original linked list. The emulation should trigger multiple PI_INTs but I only see 1 then the emulation fails.

Since the time to compile is really slowing me down, I'm going to make the multi-threaded behaviour configurable in the .cfg file and will hopefully get these options and code into ric_dev by the end of the week.

I have also tried emailing richard42g (mupen64plus lead) with some questions about some global variables but I have not had a response yet.

KitchUK
Posts: 256
Joined: Fri Jul 19, 2013 5:40 pm

Re: WIP: Playable Nintendo 64 Emulator Available

Wed Nov 13, 2013 6:38 pm

I'm not a programmer myself so I'll be honest and say a lot of that kind of went over my head but I get the gist of what your aiming to do. Again, the work you have done so far is fantastic and I really look forward to where this project is heading. :D

ric_rpi
Posts: 206
Joined: Thu Jul 11, 2013 2:33 pm
Location: Bedford, UK

Re: WIP: Playable Nintendo 64 Emulator Available

Wed Nov 13, 2013 8:59 pm

KitchUK wrote:I'm not a programmer myself so I'll be honest and say a lot of that kind of went over my head but I get the gist of what your aiming to do. Again, the work you have done so far is fantastic and I really look forward to where this project is heading. :D
Thank you, I know people want to help so once I've got some options in the cfg file then everyone can experiment with different values and the multi-threading behaviour and maybe someone will get full multi-threading working without having to touch the code...

ric_rpi
Posts: 206
Joined: Thu Jul 11, 2013 2:33 pm
Location: Bedford, UK

Re: WIP: Playable Nintendo 64 Emulator Available

Thu Nov 14, 2013 12:52 pm

I have uploaded a new version into ric_dev where people can change the behaviour of Multi-Threading and help to progress this. I have attached a diagram of the design to show how I would like it to run (if possible).

The standard build would normally add a record to a linked list of 'future' interupts in r4300/interupt.c whereas I want to use a thread to sleep then generate the Required Interrupt so that the linked list code can be removed.

The red arrows are Events/Signals being sent from one thread to another.

The AI, PI, SI, DP, SP and HW2 threads only act as timers to trigger N64 Interrupts. The processing associated with these INTs (such as DMA) are currently done in the Main thread. - There may be the possibility of doing real DMA transfers to save more cycles if multi-threading works.
Attachments
mt_diag1.gif
mt_diag1.gif (41.6 KiB) Viewed 5029 times

ric_rpi
Posts: 206
Joined: Thu Jul 11, 2013 2:33 pm
Location: Bedford, UK

Re: WIP: Playable Nintendo 64 Emulator Available

Fri Nov 15, 2013 3:15 pm

Could people check their favourite games with the following options changed for ric_dev please:
MT_USE_SPECIAL_INT = False
MT_USE_COMPARE_INT = False
MT_USE_CHECK_INT = False

I have tried with Mario 64 and Zelda 64 with no issues and if others are fine then I can simplify a lot of the code in r4300/interupt.c.

Switching on MT_XX_EVENTS for SI / DP / SP INTs slows down the emulation, even when the wait time is set to 2us so I am doubting that multi-threading is going to speed up mupen64plus now.

Other results for interest only:
MT_PI_EVENTS =True Emulation fails after it starts up
MT_VI_EVENTS = True Segmentation fault (it wasn't doing so before I put in the options)
MT_SYSTEM_TIMER_EVENTS = True Emulation fails to start

Running as SUDO makes no measurable difference in performance.

GGuyZ
Posts: 5
Joined: Tue Nov 12, 2013 4:57 am

Re: WIP: Playable Nintendo 64 Emulator Available

Fri Nov 15, 2013 3:36 pm

Hi,

It might just be me, but I can't get any of the keyboard buttons to work, except for 'Enter' and 'Esc' (one for starting the game and the other for exiting the rom).

I tried editing the file '/home/pi/.config/mupen64plus/mupen64plus.cfg' and I set mode=0 for the keyboard (so I can configure it manually). Currently, my input is mapped as follows, but I tried different settings:

Code: Select all

# Digital button configuration mappings
DPad R = ""key(120)" #100"
DPad L = ""key(122)" #97"
DPad D = ""key(32)" #115"
DPad U = ""key(304)" #119"
Start = "key(13)"
Z Trig = ""key(27)" #122"
B Button = "key(306)"
A Button = ""key(308)" #304"
C Button R = "key(108)"
C Button L = "key(106)"
C Button D = "key(107)"
C Button U = "key(105)"
R Trig = "key(99)"
L Trig = "key(120)"
Mempak switch = "key(44)"
Rumblepak switch = "key(46)"
# Analog axis configuration mappings
X Axis = "key(276,275)"
Y Axis = "key(273,274)"
Any idea why it's simply not responding?

welshy
Posts: 1667
Joined: Mon Oct 29, 2012 2:07 pm

Re: WIP: Playable Nintendo 64 Emulator Available

Fri Nov 15, 2013 4:06 pm

GGuyZ
See above post by ric_rpi » Wed Nov 13, 2013 11:30 am in reply to dcdeadcell
"The list of things I have heard now contains everything!"

GGuyZ
Posts: 5
Joined: Tue Nov 12, 2013 4:57 am

Re: WIP: Playable Nintendo 64 Emulator Available

Fri Nov 15, 2013 5:21 pm

According to his reply, the keyboard should work, except for the arrow keys.

Again, I might be missing something here, but with the exception of 'Enter' and 'Esc', no input key is recognized.

welshy
Posts: 1667
Joined: Mon Oct 29, 2012 2:07 pm

Re: WIP: Playable Nintendo 64 Emulator Available

Fri Nov 15, 2013 5:54 pm

GGuyZ
Yes, they are the ONLY ones that work. Because the SDL script isn't working correctly I don't believe they can be changed in the cfg either. That's why I suggested

'Keyboard latency is currently an issue which is being worked on (code is currently missing) so until then it can only be controlled via a joypad'

Remember, this is an 'Alpha' release, i.e. its not completed, but I suggested it was 'made available' as to let users asses it and aid development.
"The list of things I have heard now contains everything!"

ric_rpi
Posts: 206
Joined: Thu Jul 11, 2013 2:33 pm
Location: Bedford, UK

Re: WIP: Playable Nintendo 64 Emulator Available

Fri Nov 15, 2013 8:04 pm

The recommended advice is to use a joystick until further notice.

If you use the ric_dev branch then key presses and releases are printed to the screen which may help if the key codes are wrong. If you get -1 values output then let me know the key and I can change the mapping in mupen64plus-core/src/api/rpiGLES.c (or you can).

GGuyZ
Posts: 5
Joined: Tue Nov 12, 2013 4:57 am

Re: WIP: Playable Nintendo 64 Emulator Available

Sat Nov 16, 2013 12:11 am

Thanks guys.

I was obviously careless in reading the first message of this thread.

ric_rpi - thanks for pointing me in the right direction. I'll look into the key mappings in your branch when I get the time, as I am seeing -1 printed to stdout.

ric_rpi
Posts: 206
Joined: Thu Jul 11, 2013 2:33 pm
Location: Bedford, UK

Re: WIP: Playable Nintendo 64 Emulator Available

Sat Nov 16, 2013 9:44 am

GGuyZ wrote:Thanks guys.

I was obviously careless in reading the first message of this thread.

ric_rpi - thanks for pointing me in the right direction. I'll look into the key mappings in your branch when I get the time, as I am seeing -1 printed to stdout.
As far as I know, no one has gone through all the keys on a keyboard to check the scancode to SDL mapping in rpiGLES.c.

I populated the initial values from various sources online and only did limited testing, particularly with Esc key as the keyboard mode is changed (to get keyup events) and I wanted to make sure people could exit mupen64plus and have the keyboard mode restored.

If you wish to do that testing, then all I need is a list of scancodes to keyboard keys.

ric_rpi
Posts: 206
Joined: Thu Jul 11, 2013 2:33 pm
Location: Bedford, UK

Re: WIP: Playable Nintendo 64 Emulator Available

Tue Nov 19, 2013 12:53 pm

I have reset ric_dev back to master + a new option in the video plug-in and other optimizations.
I have added 'SkipScreenUpdate' in the video-rice section as there is little point in redrawing the screen if nothing has changed.
The video-plugin can be used with the master core to use the new optimizations safely.

If you use the ric_dev core there may be the possibility some games no longer work and saved games may be corrupted but it is measurably faster.

I have gone through every key on the keyboard mapping scan-codes to keys and there were only a few keys that were different in rpiGLES.c I still need to test, by setting keys in the cfg file, to make sure they work in mupen64plus.

welshy
Posts: 1667
Joined: Mon Oct 29, 2012 2:07 pm

Re: WIP: Playable Nintendo 64 Emulator Available

Tue Nov 19, 2013 7:11 pm

ric_rpi
I haven't had time for a major test, but the changes have defiantly improved real 'In Game' performance by a good margin. Playing Mario64 and StarFox64 (@900MHz, HDMI), music/sound effects are less liable to drop out/play slowly. Great Work!
"The list of things I have heard now contains everything!"

ric_rpi
Posts: 206
Joined: Thu Jul 11, 2013 2:33 pm
Location: Bedford, UK

Re: WIP: Playable Nintendo 64 Emulator Available

Tue Nov 19, 2013 9:31 pm

Thanks, as you can guess I have given up on multi-threading now. My assumption is the overhead from Linux and running the scheduler is more 'expensive' than the linked list approach.

I have briefly looked into DMA on the pi but that looks like a minefield to apply to mupen64plus.

I found disabling SPECIAL_INTs in the core sped up Zelda by a good (3-5 fps) on the intro but it breaks Mario 64 sound. Don't know why yet. I suspect SPECIAL_INTs emulate the N64 System Timer so disabling will probably break lots of games.

I have disabled COMPARE_INTs in the ric_dev branch and this gives a nice boost. The code will not propagate these INTs forward which is why saved games could become 'corrupted' if COMPARE_INTs are required by a particular ROM.

I am pretty much out of ideas now so will try porting across some other graphics plugins soon to see if they run any faster.

gilbdeth
Posts: 37
Joined: Fri May 17, 2013 9:49 am

Re: WIP: Playable Nintendo 64 Emulator Available

Wed Nov 20, 2013 5:14 pm

Hi
ive not done anything with my raspberry pi in months so my memory is a little sketchy on bits
so sorry if im doing something really dim here but

when i go to build the software i goto directory
cd/home/pi/RetroPie/mupen64plus-rpi
then do
sudo ./m64p_build.sh
and i get "command not found"
what am i forgetting??

welshy
Posts: 1667
Joined: Mon Oct 29, 2012 2:07 pm

Re: WIP: Playable Nintendo 64 Emulator Available

Wed Nov 20, 2013 5:36 pm

gilbdeth
You don't need the 'sudo' command at the beginning and you must be in the correct folder (I'm assuming you have put the downloaded folder in the home/pi/RetroPie folder?
"The list of things I have heard now contains everything!"

gilbdeth
Posts: 37
Joined: Fri May 17, 2013 9:49 am

Re: WIP: Playable Nintendo 64 Emulator Available

Wed Nov 20, 2013 5:44 pm

welshy wrote:gilbdeth
You don't need the 'sudo' command at the beginning and you must be in the correct folder (I'm assuming you have put the downloaded folder in the home/pi/RetroPie folder?
yeah thats the correct folder and if i just type./m64p_build.sh it says
-bash: ./m64p_build.sh: "permission denied"

welshy
Posts: 1667
Joined: Mon Oct 29, 2012 2:07 pm

Re: WIP: Playable Nintendo 64 Emulator Available

Wed Nov 20, 2013 6:18 pm

gilbdeth
That's odd, you may have changed the permissions when using 'Sudo'

Try - sudo chmod +x m64p_build.sh
Then - ./m64p_build.sh
"The list of things I have heard now contains everything!"

Return to “Gaming”