• Login
  • Register
  • Dolphin Forums
  • Home
  • FAQ
  • Download
  • Wiki
  • Code


Dolphin, the GameCube and Wii emulator - Forums › Dolphin Emulator Discussion and Support › Development Discussion v
« Previous 1 ... 15 16 17 18 19 ... 116 Next »

Gecko's codehandler lag fix wip
View New Posts | View Today's Posts

Thread Rating:
  • 2 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Thread Modes
Gecko's codehandler lag fix wip
10-25-2018, 05:18 AM (This post was last modified: 11-03-2018, 04:54 PM by One More Try.)
#1
One More Try Offline
Posting Freak
*****
Posts: 886
Threads: 23
Joined: Dec 2014
The codehandler writes then icbi's (cache invalidates) for each code every frame, and if you have too many codes this will cause lag. Oddly, this lag will sometimes only appears for a few frames every 10-20 seconds.  My fix checks many of the write instructions to see if they are redundant and can be skipped, along with skipping the icbi too. This means many codes will never need to write/icbi more than once, and thus no more lag.

I have very little knowledge of how to correctly build codehandler.bin on windows, so I had to edit the output binary by hand to make it work. It seems to work fine though, but a proper build of it would be nice.

Finally, I don't know when exactly icbi needs to be used and if dcbf ever needs to be used. If someone more knowledgeable would like to discuss that.

If you try it and something breaks, post the gecko code you used with it. To use it, just place codehandler.bin in the dolphin /sys/ folder (backup the existing one). You can ignore the other files in the 7z.

/edit It was built into dolphin. No more need to share it here.
Find
Reply
10-28-2018, 06:20 AM
#2
One More Try Offline
Posting Freak
*****
Posts: 886
Threads: 23
Joined: Dec 2014
I've been rigorously testing it. I'm confident enough to make a pull request for this .bin, but I still didn't compile the bin properly and had to edit the binary a bit. I'd be more comfortable if someone took the source code in the 7z and compiled it. I'd like to make sure the source compiles into the .bin correctly, so there's no issue with other people using the source code.

Updating first post's attachment.
Find
Reply
10-28-2018, 06:26 AM
#3
skid Offline
skidau / skid_au
**********
Developers (Some Administrators and Super Moderators)
Posts: 2,006
Threads: 8
Joined: Aug 2009
This change sounds good.

To compile it, use the assembler in devkitpro PPC.
Find
Reply
10-28-2018, 07:45 AM (This post was last modified: 10-28-2018, 02:46 PM by One More Try.)
#4
One More Try Offline
Posting Freak
*****
Posts: 886
Threads: 23
Joined: Dec 2014
Woo, thanks! I got it. For anyone else trying to compile it, I downloaded the devkitpro installer and chose gamecube and wii. Then I had to copy libwinpthread-1.dll from one folder into the folder with collect2.exe. Then I ran a cmd with the compile line in codehandler.s, replacing powerpc-elf-gcc with powerpc-eabi-gcc-8.1.0.exe and using the full path to that exe and the codehandler files.

I'm a bit surprised dolphin can't compile it, as it's just PPC instructions. Maybe it's a copyright thing?

Anyways, now I just need to figure out how to make a proper pull request with vs2017 (I guess?).

/edit Pull request up.
Find
Reply
11-01-2018, 02:32 PM (This post was last modified: 11-02-2018, 04:11 AM by One More Try.)
#5
One More Try Offline
Posting Freak
*****
Posts: 886
Threads: 23
Joined: Dec 2014
It got put into the latest dev build of dolphin.

I'm wondering if void GeckoCodeHandlerICacheFlush() can be removed. I'm not sure if it was required for loading gecko. If it can be removed, dolphin wouldn't stutter when you activate new codes.

A future Gecko feature could be to save the original address/value when a code is activated, then restore the changes when it's deactivated. You'd have to do that outside the codehandler.
Find
Reply
11-02-2018, 08:09 AM
#6
skid Offline
skidau / skid_au
**********
Developers (Some Administrators and Super Moderators)
Posts: 2,006
Threads: 8
Joined: Aug 2009
Congratulations.

It was mentioned in IRC that r0 should probably be zeroed before icbi is used to ensure that the effective address is calculated correctly.
Find
Reply
11-03-2018, 04:13 AM
#7
One More Try Offline
Posting Freak
*****
Posts: 886
Threads: 23
Joined: Dec 2014
I mentioned that myself in a bug report before fixing codehandler. In my fix, I don't use r0 without setting it to something, so I didn't need to zero it in the end.
Find
Reply
« Next Oldest | Next Newest »


  • View a Printable Version
  • Subscribe to this thread
Forum Jump:


Users browsing this thread: 1 Guest(s)



Powered By MyBB | Theme by Fragma

Linear Mode
Threaded Mode