libretro / bsnes-mercury

Fork of bsnes with various performance improvements.
GNU General Public License v3.0
47 stars 39 forks source link

wrong retro_memory_descriptor on NPOT mappings #26

Open Alcaro opened 7 years ago

Alcaro commented 7 years ago
[info: cartridge region=NTSC]
[info:   rom name=program.rom size=0x300000]
[info:   ram name=save.ram size=0x2000]
[info:   map id=rom address=00-3f,80-bf:8000-ffff]
[info:   map id=rom address=40-7f,c0-ff:0000-ffff]
[info:   map id=ram address=10-3f,90-bf:6000-7fff mask=0xe000]

RetroArch [INFO] ::    ndx flags  ptr  offset   start    select   disconn  len      addrspace
RetroArch [INFO] ::    005 M1A1bc WRAM 00000000 007E0000 00FE0000 00000000 00020000
RetroArch [INFO] ::    006 M1A1bc WRAM 00000000 00800000 00C0E000 00000000 00002000
RetroArch [INFO] ::    007 M1A1bc WRAM 00000000 00000000 00C0E000 00000000 00002000
RetroArch [INFO] ::    014 M1A1bc SRAM 00000000 00906000 00D0E000 00000000 00002000
RetroArch [INFO] ::    015 M1A1bc SRAM 00000000 00106000 00D0E000 00000000 00002000
RetroArch [INFO] ::    016 M1A1bC  ROM 00000000 00C00000 00C00000 00000000 00300000
RetroArch [INFO] ::    017 M1A1bC  ROM 00000000 00400000 00C00000 00000000 00300000
RetroArch [INFO] ::    018 M1A1bC  ROM 00000000 00808000 00C08000 00000000 00300000
RetroArch [INFO] ::    019 M1A1bC  ROM 00000000 00008000 00C08000 00000000 00300000

20-2f:6000-7fff is mapped in the core, but not in the published maps. sfc/memory/memory.cpp needs to split the map if start->end isn't an aligned power of two. I'd do it myself, but it's past midnight and I can't deal with the required bitbang magic this late.

Note that there's a single mapping for 00-3f:2140-2183, which should only become two mappings. Creating a mapping for every four bytes would be irritating. Possibly useful: There's a mapping merger here. License can be ignored for that function, copy freely; I wrote it myself.