Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incompatible banked RAM mapping for achievements in libretro (CGB) #157

Closed
rzumer opened this issue Apr 6, 2019 · 3 comments
Closed

Incompatible banked RAM mapping for achievements in libretro (CGB) #157

rzumer opened this issue Apr 6, 2019 · 3 comments

Comments

@rzumer
Copy link
Contributor

rzumer commented Apr 6, 2019

Please see this issue for reproduction.

It seems like the memory in the banked RAM area (0xD000~0xDFFF) behaves differently from what is expected. Looking at the descriptors being defined in libretro.c they look correct at first glance, but as mentioned in the aforementioned issue the contents in memory do not correspond to the expected state, which results in triggers firing when they should not.

Note that it is the current loaded bank that must be pointed to in the map. From what I can tell, SameBoy is pointing to the first bank at all times. I believe that this is the cause of the compatibility issues. Here is the reference map.

@ghost
Copy link

ghost commented Apr 6, 2019

Was just looking at this also earlier but for RA KDL1.
#48

Above analysis is correct. D000 (RAM bank x) is not being mapped correctly for either DMG / CGB modes. And 4000 (ROM bank x) somtimes also although I guess it's less used.

edit: Misunderstood the part about the bank ptr. I think that's our key. Let me try it out.

@rzumer
Copy link
Contributor Author

rzumer commented Apr 6, 2019

Oh wow, sorry I did not notice that issue and created a duplicate. Glad I could help pin down the cause (assuming it is the one!).

@ghost
Copy link

ghost commented Apr 6, 2019

I think I got it. Unlocked Green Scenery for Kirby's Dream Land in both GB/C modes. I'll test Lucky Luke also to be sure.

Reorganized the descs a bit and using 9 of them atm.

descs[2].ptr   = GB_get_direct_access(&gameboy[i], GB_DIRECT_ACCESS_RAM, &size, &bank);
descs[2].start = 0xC000;
descs[2].len   = 0x1000;

descs[3].ptr   = descs[2].ptr + (bank * 0x1000);
descs[3].start = 0xD000;
descs[3].len   = 0x1000;

..

descs[6].ptr   = GB_get_direct_access(&gameboy[i], GB_DIRECT_ACCESS_ROM, &size, &bank);
descs[6].start = 0x0000;
descs[6].len   = 0x4000;
descs[6].flags = RETRO_MEMDESC_CONST;

descs[7].ptr   = descs[6].ptr + (bank * 0x4000);
descs[7].start = 0x4000;
descs[7].len   = 0x4000;
descs[7].flags = RETRO_MEMDESC_CONST;

edit: Works. I'll send pr.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants