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

Emscripten support - Save data not working #1212

Open
Buggem opened this issue Nov 19, 2024 · 3 comments
Open

Emscripten support - Save data not working #1212

Buggem opened this issue Nov 19, 2024 · 3 comments

Comments

@Buggem
Copy link

Buggem commented Nov 19, 2024

When compiling with emscripten, save data does not persist. I noticed that there are handlings for this to save it but they are not working properly.

@leo60228
Copy link
Contributor

Are you configuring persistent data storage as described in Emscripten documentation?

@Buggem
Copy link
Author

Buggem commented Nov 20, 2024

@leo60228 Yes I have, this is my rundown code

    
int main() {
    EM_ASM(
        // Make a save directory
        FS.mkdir('/home/web_user/.local/share/VVVVVV/saves');
        FS.chmod('/home/web_user/.local/share/VVVVVV/saves', 777); // with or without, makes no difference, just emulating what the original VVVVVV C++ handling looked like (yes I am aware of bad permissions but this is WASM virtual machinery so I'm fine)
        // Then mount with IDBFS type
        FS.mount(IDBFS, {}, '/home/web_user/.local/share/VVVVVV/saves');

        // Then sync
        FS.syncfs(true, function (err) {
            // Error
        });
    );

    // open and save game
    int off_file = fopen("/home/web_user/.local/share/VVVVVV/saves/qsave1.vvv");
    ...

    // sync to make sure it is stored to IndexedDB
    EM_ASM(
        FS.syncfs(function (err) {
            // Error
        });
    );
}```

@leo60228
Copy link
Contributor

I can't reproduce this issue.

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