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
Make 4K EEPROM default save type; support carts with no EEPROM #878
Conversation
I'll test this in a bit, I think it would be cleaner to just leave the type as a uint16_t and do
(Just repeat the first byte, which is 0 when present and 0xff when absent) |
The other thing I'll say: the way this is written, it defaults to "no eeprom". This means that any ROM not in the INI won't support eeprom saves. This might be a problem for ROM hacks/new ROMs (like a new version of Smash Remix or something). I think it would be better to retain the default of 4k eeprom. I don't think we've run across a game that failed because it said it had eeprom when it shouldn't. EDIT: Or maybe we just set it to "no eeprom" if the INI says it uses another save type like flash or sram |
I have an updated EEPROM test ROM that exercises a variety of EEPROM probe command formats: eepromtest.zip This branch has been updated to reflect a more-accurate understanding of how the real hardware handles EEPROM checking: If there is no EEPROM, the |
As for the "user-experience question" of whether it's actually a good idea to make this change: it's subjective. According to this list of save types, 4K EEPROM is the second-most popular save format for N64 titles. There is a lot of sense in the argument that a user-friendly emulator should assume 4K EEPROM if no other save type is specified, since it (almost always) won't hurt and has a decent chance of helping. My only argument against is that homebrew/mods that want other save types (such as Smash Remix which uses SRAM) will still be a broken experience that requires the user to select the right save type. So it will "just work" some of the time, but silently fail other times. |
Did you mean to flip the order of these bytes? I don't think that's right. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DK64 demos look better (less sped up), but now doesn't initialize the save file.
Based on EEPROM test ROM run on real hardware.
Sorry, I definitely messed up by flipping the bytes of the EEPROM identifiers. Let me try to figure out how to get my libdragon ROMs running on this branch so I can run the test ROM and verify these changes myself. |
I have attached the libdragon test suite, which includes EEPROM Joybus command tests: testrom_emu.zip Line numbers for There are several other failures unrelated to EEPROM that are out of scope for this PR. Without the changes in this PR, it is not possible to exercise the "EEPROM not detected" code-path since Mupen64Plus will always have a 4K EEPROM (unless 16K EEPROM is specified) |
Here are the results with the PR applied (default settings):
When I add an entry for the ROM to the INI and set the SaveType to None:
The results (for eeprom) look good to me, PR looks good to me in the state it's in currently. |
src/api/m64p_types.h
Outdated
SAVETYPE_SRAM, | ||
SAVETYPE_FLASH_RAM, | ||
SAVETYPE_CONTROLLER_PACK, | ||
SAVETYPE_CONTROLLER_PAK, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Correct" spelling is "Pak": https://en.wikipedia.org/wiki/Nintendo_64_accessories#Controller_Pak
src/api/m64p_types.h
Outdated
@@ -224,11 +224,11 @@ typedef enum | |||
|
|||
typedef enum | |||
{ | |||
SAVETYPE_EEPROM_4KB = 0, | |||
SAVETYPE_EEPROM_16KB, | |||
SAVETYPE_EEPROM_4K = 0, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
KB is not accurate; the EEPROM sizes are in kilobits: http://n64devkit.square7.ch/pro-man/pro26/26-06.htm
There are two types of EEPROM according to their capacities. One is the 4k-EEPROM. The capacity of this type is 4 kilobits (64 words * 64 bits = 512 bytes). The other is the 16k-EEPROM. The capacity of this type is 16 kilobits (256 words * 64 bits = 2048 bytes).
rx_buf[0] = (uint8_t)(cart->eeprom.type >> 0); | ||
rx_buf[1] = (uint8_t)(cart->eeprom.type >> 8); | ||
rx_buf[2] = 0x00; | ||
if (cart->eeprom.type) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This behavior has been tested on real hardware; if there is no EEPROM, the receive buffer is untouched.
This LGTM, we've got a lot of pending PRs, if we don't start merging things we'll end up with conflicts soon enough |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have been using this PR as a patch and have not experienced any noticeable issues.
Here we go. |
Proper fix for workaround in DragonMinded/libdragon#125 (review)
@rasky @sp1187 @loganmc10
The Joybus response values have been confirmed on real hardware using the following test ROM which dumps the EEPROM status input and output data: eepromtest.zip
I was not able to run this test ROM on Mupen64Plus; all of my libdragon example ROMs get stuck at "Mupen64Plus Started...":
I'd appreciate some assistance on getting this to run. I was able to test this ROM successfully with cen64.