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

Memory Inspector show nothing on GB or GBC games #40

Closed
Altomar79 opened this issue Aug 8, 2018 · 8 comments
Closed

Memory Inspector show nothing on GB or GBC games #40

Altomar79 opened this issue Aug 8, 2018 · 8 comments
Labels
bug Something isn't working

Comments

@Altomar79
Copy link

I tried to load a few different titles and so far i was able to view the memory for one of them. Memory inspector show nothing. The only think that i've notice
compared to RAVBA is that RALibretro is aware for 8192 RAM Locations for gameboy and 32768 for gameboy color unlike VBA who detect 65536 RAM locations.
Used RALibRetro 1.0.7.180501 with Gambatte core.

lufia gba

@rzumer
Copy link
Contributor

rzumer commented Aug 8, 2018

The Memory Inspector defaults to displaying the first address in a Note. I assume that most Notes are based on offset memory (based on VBA?). Clear the value being watched or compensate for the 0x00c000? offset to view the correct ones.

In any case, that's a UI issue for RAIntegration.

@Altomar79
Copy link
Author

Seems like this happen when the displaying note is trying to locate an address outside of the 0x7FFF.
Though GB/GBC have a range up to 0xFFFF

@Jamiras
Copy link
Member

Jamiras commented Aug 11, 2018

I'm guessing this is a duplicate of #19, which was supposedly fixed in 1.0.5. What version shows up when you click "About"?

@Jamiras
Copy link
Member

Jamiras commented Aug 11, 2018

nm, you said 1.0.7 in your first post.

@Altomar79
Copy link
Author

Also RALibretro commit hash is 7584575 in case this help.
Its the latest build we have in our download page.

@Jamiras
Copy link
Member

Jamiras commented Aug 25, 2018

I took a look at this, and while I understand what's happening, I'm not sure how to fix it. Someone more familiar with the libretro cores will have to address this.

The basic problem is that the GB/GBC cores only map the System RAM to the integration DLL as $0000-$7FFF.

This is wrong. RAVBA-M actually registers the full address space for GB/GBC, so the System RAM should be mapped from $C000-$DFFF and echoed at $E000-$FDFF. I'm not sure why _core.GetMemorySize(RETRO_MEMORY_SYSTEM_RAM) is returning 32K, I think it should only be 8K.

Additionally, the Save RAM is completely ignored by RALibRetro and needs to be mapped to $A000-$BFFF. And I have no idea what needs to be mapped from $0000-$9FFF.

The solution to this seems to be to replace the mapping with a raw read for GB/GBC:

      RA_InstallMemoryBank(0, (void*)::memoryReadRaw, (void*)::memoryWriteRaw, 0x10000);
unsigned char Application::memoryReadRaw(unsigned addr)
{
  const struct retro_memory_map* mmap = _core.getMemoryMap();
  const retro_memory_descriptor *desc = mmap->descriptors;
  const retro_memory_descriptor *end = desc + mmap->num_descriptors;
  while (desc < end)
  {
    if (desc->start <= addr && desc->start + desc->len > addr)
    {
      unsigned char* memory = (unsigned char*)desc->ptr + desc->offset;
      return memory[addr - desc->start];
    }

    ++desc;
  }

  return 0;
}

This seems to mostly work with the Gambatte core, but reads between $E000 and $FDFF fail because the echo ram isn't registered in the mmap.

The mGBA core doesn't provide a mmap, so fails miserably (does it only support GBA?).

@meleu
Copy link
Contributor

meleu commented Aug 28, 2018

The mGBA core doesn't provide a mmap, so fails miserably (does it only support GBA?).

Yes.

https://docs.libretro.com/guides/retroachievements/#game-boy-game-boy-color

@leiradel leiradel added the bug Something isn't working label Sep 29, 2018
@meleu
Copy link
Contributor

meleu commented Oct 15, 2018

solved in eee25ff

@meleu meleu closed this as completed Oct 15, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants