PDA

View Full Version : Daedalus News - Media Engine



wraggster
November 11th, 2007, 14:51
StrmnNrmn (http://strmnnrmn.blogspot.com/2007/11/media-engine.html) has posted another update about his work on his N64 Emu for PSP:


Earlier I discussed my plans for getting Daedalus's audio processing working on the PSP's Media Engine.

As I mentioned in that post, it's not just a case of changing some compiler setting to get this working. I've not spent much time investigating the ME so I may be wrong on a few of these points, but here are the current issues that I think need solving.

Firstly in order to access the ME I need to be running in kernel mode. This requires either running Daedalus in kernel mode, or (preferably) creating a kernel mode PRX that encapsulates the required functionality. I think kernel mode rules out anyone running with v1.50 firmware (hence my earlier post - please respond to the poll if you haven't already done so!) Maybe one of the more savvy psp developers out there can correct me on this? If no-one is using v1.50 any more then maybe it isn't even an issue.

Another problem is that although the ME is essentially the same processor as the main core, it has a different memory map. This means that things like the VRAM is invisible to the ME, so any code ported to run on the ME would have to be written to operate on main memory. This isn't an issue for Daedalus's audio list processing, but it would cause problems if I wanted to move display list processing to the ME too.

Touching on the memory map issue, another problem is the lack of cache coherency between the two cores. I need to be careful when accessing the same areas of memory with both cores to correctly flush and invalidate the data caches. Ideally any shared memory should be kept to a minimum, but this is easier said than done when porting existing code, rather than writing new code.

For a similar reason, any code which needs to run on the ME should avoid making any calls to the runtime library, including doing any system memory allocation. System calls are also ruled out. This is fairly easy to guarantee if you're writing new code, but again, it's a lot harder if you're porting existing code.

I think that's most of the issues from the hardware side. There are also a number of issues to be solved to do with the way that Daedalus handles audio and display list processing.

On the N64, the audio and display lists are processed asynchronously by the RSP coprocessor. In Daedalus, I can identify when these tasks are queued up for the RSP, intercept them, and process them synchronously (using high-level emulation rather than simulating the RSP execution directly).

The key thing here is that as far as the emulated N64 is concerned, audio and display list processing currently happens instantaneously. As soon as it kicks off the RSP it gets a interrupt to inform it that processing has completed. The whole process is very deterministic and I'm worried that by processing these display lists asynchronously on the ME that a number of intermittent and hard-to-debug issues will crop up. On the other hand, processing these tasks asynchronously is much closer to the behaviour of a real N64, which may fix some timing-related issues. It will also allow Daedalus to exploit the inherent parallelism that N64 roms were designed to take advantage of.

My current plan for ME audio support in R14 is:





Create a kernel mode PRX and get Daedalus successfully loading and invoking functions (under all supported firmwares). I've just about done this.

Add the code to support initialising and running code on the ME to the PRX. Test invoking user mode functions from the main EBOOT.PBP. I'll probably be using J.F.'s great sample code as a reference for this. Thanks J.F.!

Rewrite the audio list processing code so that it can be invoked synchronously or asynchronously as required (via some kind of configuration option). When running asynchronously it can just be run from a separate high-priority thread to start with. I can use this to test for various synchronisation issues without going through the pain of trying to do this on the ME first.

Audit the audio list processing code to minimise any memory accesses or ensure that they are correctly synchronised with the main core/thread. Any crt or system calls need to be eliminated or abstracted away (e.g. printfs NOP when compiled to run on the ME).

Invoke audio list processing code from the ME.

Cross fingers.



So, that's the plan; I'll keep you updated on my progress. If anyone has any experience doing this kind of thing on the ME it would be great to hear your thoughts.

-StrmnNrmn

Baboon
November 11th, 2007, 15:24
Now this is great news! :)

If the Media Engine is used on Daedalus then this emulator will really start to take off. To eventually have decent sound will be fantastic! :)

Buddy4point0
November 11th, 2007, 15:51
i cant wait! being able to play n64 with sound will be great! i can see a very good future for this emulator

paintball1119
November 11th, 2007, 16:43
I think kernel mode rules out anyone running with v1.50 firmware
1.5 can run kernal mode just fine, snes 9x with the ME runs on 1.5 so i think you don't need to make the prx

darkness angel 777
November 11th, 2007, 16:59
finally maybe we'll get good sound.I was wondering when he would get to the sound.

xg917
November 11th, 2007, 19:21
the only thing that media engine will do is help sound not affect the framerate?

no offence but i kinda think this is lame because it only brings down the framerate by a few frames per second and from what ive heard, the sound quality wouldnt make a difference if its being used on the ME or main CPU. i kinda think its a waste of time. id much rather find a way to increase speed for the emulator so that the game itself runs fast, if a game reaches full speed then sound will not be choppy the way we hear it at the moment.

big ups to strmnnrmn though

Axelius
November 11th, 2007, 19:57
Ehm, no offence, but in most games the sound enabled/disabled makes the difference between playable and not playable framerate. I mean some games run quite good with sound disabled, but get rather slow with sound enabled.

Strongbadunit2
November 11th, 2007, 20:36
The quality won't be any different but the fps with the sound will be faster...

The faster he moves it to the ME the better because as the code grows it will become harder to switch it to the ME because there will be more variables that the ME will effect.

I'm no expert on the Media Engine but it does make sense to me that getting the hardest thing out of the way as soon as possible is not only beneficial to stopping people from getting pissy but also is a big step for setting up R15..

R14 will most likely be a release to stop ranting about the ME and also to do some stuff to make it look nicer such as thumbnails & icons..(other little bug fixes)

R15 on the other hand will most likely be purely about speed!!:thumbup: Because thats just about all there is left to do after R14

Safari Al
November 11th, 2007, 20:46
Yes! finally sound is given a chance :thumbup:

Sterist
November 11th, 2007, 20:55
1.5 can run kernal mode just fine, snes 9x with the ME runs on 1.5 so i think you don't need to make the prx

umm....lets leave that for the people who know what they're talkin about ;)
==============

now, could someone plz clarify exactly what kind of performance boost this will yield? from how i see it, this will relieve the CPU of audio, but that isn't necesarily a speed boost is it? (while audio is 'on' compared to 'off' from R13)

mike03$$$
November 11th, 2007, 22:23
sounds good

DarthPaul
November 12th, 2007, 00:35
the only thing that media engine will do is help sound not affect the framerate?

no offence but i kinda think this is lame because it only brings down the framerate by a few frames per second and from what ive heard, the sound quality wouldnt make a difference if its being used on the ME or main CPU. i kinda think its a waste of time. id much rather find a way to increase speed for the emulator so that the game itself runs fast, if a game reaches full speed then sound will not be choppy the way we hear it at the moment.

big ups to strmnnrmn though

Well, that's your way of thinking. My opinion is, that it will be better to have a great improvement in sound than the "improvements" we had on R13, I didn't even download R13.

Also, I think that playing something with good sound can make people more satisfied while they play, and it would make it more playable.

xg917
November 12th, 2007, 00:40
good sound only happens when the game plays full speed

sound from media engine + slow emulation = same choppy sound we get at the moment

thats what i was trying to say in my last post

ab9003
November 12th, 2007, 03:01
Yes but less choppy sound, xg917. A game runs approximately 30 % slower with sound on I'd say, making it virtually useless because it'll sound choppy even on a full speed game! But with this games like super smash bros, aeroguage, super mario 64 and etc can finally be fully experienced with sound on the psp. And once the ME is ported I'm sure he'll get right to the other improvements for speed and compatibility as usual. Perhaps R14 will be seen rather soon with this improvement and we can see it within this month!

kharaboudjan
November 12th, 2007, 16:17
we can be happy if he releases R14 this year. but it is not likely :/

Seker
November 12th, 2007, 18:20
this is SO good keep em coming

preetyforu
January 6th, 2008, 14:08
every time i save on daedalus with super mario 64, it says that it has saved, and when i go to the savegame folder there is a SAV file called super mario, but when i laod the game up again, all the files have no stars.
how do i fix this? ive only just managed to find a .v64 rom that allows me to put it on Eeprom4k, but it still wont laod the files i save, or wont save it properly, im not sure whats going on, any help would be appriciated, thanks

No_one_in_particular
January 7th, 2008, 00:39
Get the newest version and use the save states.

Eviltaco64
January 7th, 2008, 00:42
I hope that Conker is playable by R20

jurkevicz
January 7th, 2008, 01:29
I just can't wait for a new version soon!

Shadowblind
January 7th, 2008, 04:13
Good, I'd like to hear the sound when playing DNZH ;)

I still think that speed and graphics should take top priority over sound anyway, but this is perfectly fine too.

YUNG619
September 30th, 2008, 14:16
yEAH CANT WAIT TOO

Bowser N64
April 28th, 2009, 01:16
I am VERY impressed with this emulator mostly because R12 lets me play my Toad's Tool 64 ROMS.