Thursday, May 10, 2007

Goldeneye Update!

Ok, I know the last thing I said yesterday was:


Anyway, given the work involved Goldeneye isn't an immediate priority, but I am thinking about it.


I couldn't quite resist having a quick hack to see if I could get Goldeneye working using the third method I outlined. It turned out to be relatively painless to crowbar in the required changes, and I'm pleased to say that I've managed to get Goldeneye booting again! :)

With the changes, Daedalus now dynamically pages the Goldeneye ROM into the PSP's RAM so that it no longer requires a free 12 MiB. I now check the instruction pointer on every instruction fetch in the interpretive core*, and raise a TLB Read Miss exception if required. If this happens, it causes Goldeneye's exception handler to realise that the required code isn't in memory, and to load it in from ROM before continuing execution.

So here are the first screenshots of Goldeneye running under Daedalus R12 - you can see there are a handful of graphical glitches to sort out, particularly on the main menu:







Not bad for an hour's work!

There's still quite a long way to go though. Firstly, I can still only get the rom running with dynarec disabled on the PSP, so the framerate is currently just 6-7 fps. Interestingly it runs fine with dynarec on the PC with the same set of changes, so this indicates a bug somewhere in the PSP dynarec implementation. Secondly, I've not been able to get in-game yet - it just seems to hang with a black screen shortly after starting to load the level. I've not figured out whether this is just running very slowly without dynarec and taking its time, or if there's another bug to be fixed somewhere.

Getting the rom booting is a great first step though - it can only continue to improve from here :)

-StrmnNrmn

*I probably want to tidy things up to avoid doing this for most other roms as it can be quite expensive - especially if dynarec is disabled.

24 comments:

taco said...

This is a good start for Goldeneye!
Any release date for R12?

Ole Fossbakk said...

Fantastic work ...! What more can I say? The greatest wishes of luck from me to you.

Morgan said...

Wow wonderful work for only an hour, please StrmnNrmn look into fixing the DKR graphical issues, thanks and R12 looks so good I want it so bad now.

Exophase said...

I think that your method of faking a large TLB will work with recompiled code. Here is what I propose:

- Make the recompiler check for TLB faults every time the page region changes. You don't have to check at every instruction. You can determine this statically for instruction fetches and direct branches because the destination PC is known at compiletime.

- On a TLB miss allow the exception handler to map a page normally, without evicting the one it's replacing in any sense. Basically, exactly what you were doing. Load the page in from ROM, to memory.

- You will find that even though the ROM is 12MB there is no way anything close to that is being used for actual code. So in the end you end up loading much less, and it ends up going straight to the translation buffer(s) as well.

There are of course methods of doing it right (with the real TLB size) as well, but they're tricky. It would involve segmenting translation cache buffers per physical RAM page in order to be able to flush one without taking the rest with you. I've done things like this and it isn't really pretty, but it's probably doable.

Gm said...

Dude, I love having your RSS feed on my FireFox, I can easily check for updates just like this :D

Sounds good though, I love Goldeneye. Although it is cool, I still think Perfect Dark is better :D


PS: Keep the technical posts coming, i'll read them every time I get an RSS update!

Thierry said...

Man you are so good in what you're doing, asking for nothing in return and giving so much time of yours.
I can only thank you very loudly for your work, you wouldn't believe how many people are like me amazed by your Daedalus.
Thanks

Jody said...

Already a new update? whow, I may be the first one commenting this. really good for an hours work!

xSaVaGe said...

Yo, I want everything everybody else wants, but there is still a graphical bug i want u to fix in the in game of the roms. Most backgrounds in Mario are off such as the clouds which annoys me wen i look up. I also want the ground fixed as well Example, i walk in the castle and the carpet (whatever it is)graphically flickers wen walking wit mario. Another exmple is marios shadow which flickers as well. I know it is way off of what your doing but hopfully you can fix the small bug. Another thing the background of Mario Kart is messed up as well as other logos in other games is messed up. P.S. i cheat glitched in mario wit 16 stars all the way to the Final Bowser ^^ did you ever try that?

StrmnNrmn said...

@exophase.

I'd not thought of just checking for TLB faults at page boundaries. The R4300 supports variable size pages (4KiB up to 16MiB), but I can get away with checking anytime I transfer between 4KiB regions, which should be substantially faster.

Thanks for the suggestions- I'll have to spend some time this weekend exploring them in a bit more detail.

Cheers!

Jody said...

How come Road Rash 64 only shows half of the screen in game? Oh and in Rush2049, there is the bug that keeps freezing up after going past 9 mph. Is the PSP running out of memory when the faster I go?

Exophase said...

strmnnrmn:

I don't think the page region is likely to change much (or at all) in a game. When it is, you can flush translation cache and treat it as a compiletime constant. This might not be worth much, especially if games stick to 4KB regions, but if they use larger ones it would cut down additional overhead.

Likewise, if a game doesn't change the TLB much you can also use the mappings as compile time constants, if that wins you anything. This is less likely to be as useful.

(note: when I say compiletime constants, I mean during recompilation time, not when the program is compiled)

iwantanimac said...

Alright, this looks pretty damn good.

Did Perfect Dark still work? If i remember correctly, the two use the same engine, does that mean this might make perfect dark work (If it didn't already) too?

Swaa said...

You'r God!!!

Thanks from Barcelona, Spain!!

AgentSmith said...

Thank You very much strmnnrmn - this is great news - I do have a small request, respectfully, I would like to see banjo tooie maybe bootable as well - i have tried it and it doesn't load but i notice that expansion pack for the game is listed as unknown - I think that it is required for this game to work - but i could be wrong - Anyway thanks again for your efforts - this emulator is highly anticipated and I am certainly a fan of yours!

Malcolm said...

Wow! Nice work man, I love your emulator and its great to see you posting updates so frequently, especially this!

JuanMan said...

I admire your work...

But I have a question:

¿Why don't you focus on Zelda Ocarine of Time?

I think there's more fans of that game than GoldenEye or SSB...

iamagamesadict said...

Thx, ive always wanted to have goldeneye on my PSP. Plz keep trying to improve it. :)

philip said...

thanks a million for your hard work on this strmnNrmn, i read each update and test each release with most of my games. just to add that banjo kazooie runs pretty good, somthing akin to mario64, even the writing for the characters dialogue is spot on. I remember how much trouble this caused for surreal on the xbox. one strange thing is though, when you pause the game the backround is badly garbled but when i go back into the game its fine. Dosnt require fixing as it does not effect the main game, just wanted to let you know. Best of luck in the future with it. If you accepted paypal i would gladly donate for your time and efforts or if i could help you in some way i would gladly but sadly im no programmer :(

Miles said...

Question, so now that goldeneye is booting, does that mean that in the future the ROM size limit wont be around anymore? The reason I ask is because I know that ROM size is one thing thats keeping us from running games like StarCraft 64 and Pokemon Stadium. Will the changes you are making for goldeneye effect other larger ROMs?

roelandb said...

how about revolt, turok, or indiana jones??

Mike said...

I'm amazed at how you do this i can't believe it's Evan possible to run n64 on psp.

michaelp said...

hey strmnnrmn, what's daedalus coded in?
also, great work on the emulator :D

Jody said...

Hey, Strminator, could you try to fix the letters in THPS2 in your future releases? The letters are blocks. And could you fix the glitchy textures on the levels?

jorge said...

Once again good work,in the past i have a great times playing goldeneye at 100%,in the future playing again in the psp... perfect!!! continous your work,spain sends good luck to you ;).