Author Topic: Fix for the dynarec memory manager  (Read 2588 times)

Offline Gillou68310

  • Developer
  • long
  • *****
  • Posts: 112
    • View Profile
Fix for the dynarec memory manager
« on: October 21, 2014, 04:21:22 AM »
Hi, I made a fix for the dynarec memory manager part, see here for more explanations:

https://github.com/Gillou68310/mupen64plus-ae/commit/60a12ce73ab644ce56895c116763a33806214144

Offline littleguy

  • Moderator
  • double
  • *****
  • Posts: 1945
    • View Profile
Re: Fix for the dynarec memory manager
« Reply #1 on: October 21, 2014, 06:59:52 AM »
You should just push this upstream to mupen64plus-core.  I don't think any changes to this project will ever see the light of day.
2012 Nexus 7, rooted stock Lollipop
Samsung Galaxy Victory, rooted stock Jelly Bean
Xperia PLAY, stock Gingerbread
OUYA, retail version

Offline Gillou68310

  • Developer
  • long
  • *****
  • Posts: 112
    • View Profile
Re: Fix for the dynarec memory manager
« Reply #2 on: October 21, 2014, 07:53:22 AM »
Good idea ;)

I also created a local branch of the core which allow building with the new dynarec under visual studio 2010 which means some real debugging tools like disassembly 8). It helped me a lot to understand how the new dynarec actually work. Maybe I should push it upstream too, so other people can take a look at it.

Offline littleguy

  • Moderator
  • double
  • *****
  • Posts: 1945
    • View Profile
Re: Fix for the dynarec memory manager
« Reply #3 on: October 21, 2014, 09:10:41 AM »
Definitely :)  There actually seems to be a fair bit of work lately on upstream core and rice.  Cleanup, bugfixes, and platform unification from what I can tell.
2012 Nexus 7, rooted stock Lollipop
Samsung Galaxy Victory, rooted stock Jelly Bean
Xperia PLAY, stock Gingerbread
OUYA, retail version

Offline xperia64

  • Moderator
  • double
  • *****
  • Posts: 591
    • View Profile
    • My Apps
Re: Fix for the dynarec memory manager
« Reply #4 on: October 21, 2014, 09:42:23 AM »
Could this also fix part of the problem with Banjo-Tooie's crashes? Tooie seems pretty CPU intense for an N64 game.

Offline Gillou68310

  • Developer
  • long
  • *****
  • Posts: 112
    • View Profile
Re: Fix for the dynarec memory manager
« Reply #5 on: October 21, 2014, 10:44:53 AM »
If the game do actually reach the 32M cache limit, then yes.
I never played the game so I can't tell for sure.

If you want to check add a log message when the cache is full and check if the game crashes right after the log.

Code: [Select]
if(out > (u_char *)(base_addr+(1<<TARGET_SIZE_2)-MAX_OUTPUT_BLOCK_SIZE-JUMP_TABLE_SIZE))
{
log_message("%dMB cache is full, starting over from the beginning: %.8X ", ((1<<TARGET_SIZE_2)/1048576), (int)base_addr);
out=(u_char *)base_addr;
}

It's easier if you redirect log messages to a file with some timestamp, see here:  ;)

https://github.com/Gillou68310/mupen64plus-ae/commit/6b92d01610a0e1eb40e5466c82d44ba7a303a528

On zelda games it usually take ~30min to reach the cache limit, so you gotta be patient!
Also if the game craches and you didn't get the cache full message then the problem is somewhere else!
« Last Edit: October 21, 2014, 11:04:48 AM by Gillou68310 »

Offline retroben

  • float
  • ****
  • Posts: 432
    • View Profile
Re: Fix for the dynarec memory manager
« Reply #6 on: October 21, 2014, 01:24:45 PM »
Banjo-Tooie's memory handling engine is really complex for the N64 console,as it frequently relocates various branches of data such as all eight player slots (4 players and 4 clockwork eggs in-game=8 player slots).

As one active player,Banjo's status such as model,transparency,size,rotation style (Walk,Trot,Wing Whack),Pad Flags,Controlled/"is active" Flags,Gravity (for a Levitate code),Position,Character Behaviour,Actions,and more!
And there is another seperate thing for current animation plus speed of them and even one more location for eggs shot statuses.

Compare all of these to the simplicity for most of the Banjo-Kazooie equivalent codes.
Many equivalents can be easily used as simple codes since they are in static address locations,unlike Banjo-Tooie.

Edit:When can we get a build with the memory manager fix so I can test it for myself?
« Last Edit: October 21, 2014, 01:29:17 PM by retroben »