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

[RFC] Add SaveFilenameFormat = 2 to match original rom filename #1115

Open
YourWishes opened this issue Jan 18, 2025 · 2 comments
Open

[RFC] Add SaveFilenameFormat = 2 to match original rom filename #1115

YourWishes opened this issue Jan 18, 2025 · 2 comments

Comments

@YourWishes
Copy link

YourWishes commented Jan 18, 2025

Requesting a new SaveFilenameFormat to have the save file name match that of the ROM name just with the extension changed (remove .z64 and change to .srm or what have you). Here is my proposed change, would need to check if ROM_PARAMS.goodname needs extension removed but wanted to see if there's any concerns with file name lengths.

    if (format == 0) {
        snprintf(filename, 256, "%s", ROM_PARAMS.headername);
    } else /* if (format == 1) */ {
        if (strstr(ROM_SETTINGS.goodname, "(unknown rom)") == NULL) {
            snprintf(filename, 256, "%.32s-%.8s", ROM_SETTINGS.goodname, ROM_SETTINGS.MD5);
        } else if (ROM_HEADER.Name[0] != 0) {
            snprintf(filename, 256, "%s-%.8s", ROM_PARAMS.headername, ROM_SETTINGS.MD5);
        } else {
            snprintf(filename, 256, "unknown-%.8s", ROM_SETTINGS.MD5);
        }
    }

to

    if (format == 0) {
        snprintf(filename, 256, "%s", ROM_PARAMS.headername);
    } else if (format == 1) {
        if (strstr(ROM_SETTINGS.goodname, "(unknown rom)") == NULL) {
            snprintf(filename, 256, "%.32s-%.8s", ROM_SETTINGS.goodname, ROM_SETTINGS.MD5);
        } else if (ROM_HEADER.Name[0] != 0) {
            snprintf(filename, 256, "%s-%.8s", ROM_PARAMS.headername, ROM_SETTINGS.MD5);
        } else {
            snprintf(filename, 256, "unknown-%.8s", ROM_SETTINGS.MD5);
        }
    } else /* if format( == 2) */ {
        snprintf(filename, 256, "%.256s", ROM_SETTINGS.goodname);
    }

in main.c

@Rosalie241
Copy link
Contributor

What's your end goal with this change? the ROM_SETTINGS.goodname isn't the filename, it's a name retrieved from the ROM database which uses the MD5 to detect which one matches.

@YourWishes
Copy link
Author

I ah thanks for clarifying.
End goal would be to have the save file match the rom basename exactly, so that;
Legend of Zelda, The - Ocarina of Time.z64
would have a save file
Legend of Zelda, The - Ocarina of Time.srm
or whatever save extension the ROM uses.

I know some implementations do this already e.g. libretro, but would like to have a native option.

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