You are not logged in.

Read the FAQ and Knowledge Base before posting.
We won't make a 3DS/2DS emulator.



#1 2017-02-02 19:49:48

jimis2001
Member
Registered: 2017-02-02
Posts: 5

Change where desmume stores save files

I am dual booting Windows 10 and Linux Mint 18.1 and I have installed DeSmuME 0.9.11 in both of them. What I want to do is unify the save files of both machines and since Windows can't read ext4 I will have to do it through Mint. The easiest way to go about it is to just make Mint DesMuME save in the same place as Windows DeSmuME but I just can't figure out how to do this. So I came over here to ask help, and in case there is no way I can do what I just asked, I would like you to suggest alternatives. Thank You!

Offline

#2 2017-02-03 02:26:18

zeromus
Radical Ninja
Registered: 2009-01-05
Posts: 6,169

Re: Change where desmume stores save files

since youre on linux, hack the source code. modify line 143-146 of path.h

to something like strncpy(pathToModule, "/path/you/want/battery/to/appear/under")
and you should get /path/you/want/battery/to/appear/under/Battery

Offline

#3 2017-02-03 20:55:40

jimis2001
Member
Registered: 2017-02-02
Posts: 5

Re: Change where desmume stores save files

Didn't work, it seems as though pathToModule is defined somewhere other than path.h but I'm not completely sure maybe I didn't do it quite right. Here are the original lines 135-162:
void LoadModulePath()
    {
#if defined(HOST_WINDOWS)

        char *p;
        ZeroMemory(pathToModule, sizeof(pathToModule));

        GetModuleFileName(NULL, pathToModule, sizeof(pathToModule));
        p = pathToModule + lstrlen(pathToModule);
        while (p >= pathToModule && *p != DIRECTORY_DELIMITER_CHAR) p--;
        if (++p >= pathToModule) *p = 0;

#ifndef DESMUME_QT
        extern char* _hack_alternateModulePath;
        if(_hack_alternateModulePath)
        {
            strcpy(pathToModule,_hack_alternateModulePath);
        }
#endif
#elif defined(DESMUME_COCOA)
        std::string pathStr = Path::GetFileDirectoryPath(path);

        strncpy(pathToModule, pathStr.c_str(), MAX_PATH);
#else
        char *cwd = g_build_filename(g_get_user_config_dir(), "desmume", NULL);
        g_mkdir_with_parents(cwd, 0755);
        strncpy(pathToModule, cwd, MAX_PATH);
        g_free(cwd);
#endif
}
I'm using desmume --cpu-mode=1 in case that helps.

Offline

#4 2017-02-03 23:56:47

zeromus
Radical Ninja
Registered: 2009-01-05
Posts: 6,169

Re: Change where desmume stores save files

You didnt do it right. You should have pasted your attempt.

Look at the linux codepath there. it does (something, something, strncpy, something). You only have to do the strncpy, and instead of cwd, the literal string

Offline

#5 2017-02-04 06:02:29

jimis2001
Member
Registered: 2017-02-02
Posts: 5

Re: Change where desmume stores save files

Didn't work, here is the second attempt:
void LoadModulePath()
    {
#if defined(HOST_WINDOWS)

        char *p;
        ZeroMemory(pathToModule, sizeof(pathToModule));

        GetModuleFileName(NULL, pathToModule, sizeof(pathToModule));
        p = pathToModule + lstrlen(pathToModule);
        while (p >= pathToModule && *p != DIRECTORY_DELIMITER_CHAR) p--;
        if (++p >= pathToModule) *p = 0;

#ifndef DESMUME_QT
        extern char* _hack_alternateModulePath;
        if(_hack_alternateModulePath)
        {
            strcpy(pathToModule,_hack_alternateModulePath);
        }
#endif
#elif defined(DESMUME_COCOA)
        std::string pathStr = Path::GetFileDirectoryPath(path);

        strncpy(pathToModule, pathStr.c_str(), MAX_PATH);
#else
        char *cwd = g_build_filename(g_get_user_config_dir(), "desmume", NULL);
        g_mkdir_with_parents(cwd, 0755);
        strncpy(pathToModule, "/media/jim/Windows/Users/dtrai/Desktop/προγραμματα/DeSmuME");
        g_free(cwd);
#endif
    }
Also desmume didn't create a Battery folder, it just stores the saves in ~/.config/desmume maybe that's the problem

Offline

#6 2017-02-04 07:30:28

zeromus
Radical Ninja
Registered: 2009-01-05
Posts: 6,169

Re: Change where desmume stores save files

you must not use paths with non-english characters, unless you're an expert.
the line above strncpy creates the directory. it uses the old built path. get rid of that code and create the battery directory yourself.
however if it still stores saves in ~/.config/desmume (are you SURE it does that?) then the code hack did not work.
I think it's more likely youre confused, but I'm not 100% sure the code hack is correct.
Please double check your work.

Offline

#7 2017-02-04 07:54:38

jimis2001
Member
Registered: 2017-02-02
Posts: 5

Re: Change where desmume stores save files

It didn't work this time either. It definitely saves in  ~/.config/desmume
Attempt #3:
#elif defined(DESMUME_COCOA)
        std::string pathStr = Path::GetFileDirectoryPath(path);

        strncpy(pathToModule, pathStr.c_str(), MAX_PATH);
#else
        char *cwd = g_build_filename(g_get_user_config_dir(), "desmume", NULL);
        strncpy(pathToModule, "/media/jim/Windows/Users/dtrai/Desktop/Programmes/DeSmuME");
        g_free(cwd);
#endif

Offline

#8 2017-02-04 08:21:06

zeromus
Radical Ninja
Registered: 2009-01-05
Posts: 6,169

Re: Change where desmume stores save files

strncpy takes 3 arguments. I can't believe your code even COMPILES.
use strcpy(pathToModule, "/media/jim/Windows/Users/dtrai/Desktop/Programmes/DeSmuME"); instead
the line above and below it do nothing

Offline

#9 2017-02-04 09:39:48

jimis2001
Member
Registered: 2017-02-02
Posts: 5

Re: Change where desmume stores save files

Well... this is a little awkward... Apparently I had to compile desmume every time I made a change but I didn't know that so I have been kind of wasting you time with that. Worry not though cause I figured it out and finally made it work.
For anyone with the same problem who couldn't follow through:
1. Open desmume*/src/path.h with your favorite text editor

2. Remove line 160 which should look like this:
g_mkdir_with_parents(cwd, 0755);

3.Change line 161 which should look like this:
strncpy(pathToModule, cwd, MAX_PATH);
to something like this
strcpy(pathToModule, "/path/where/you/want/demume/to/save");

4.Save, then open a command line and do:
cd /path/to/desmume*
./configure
make
sudo make install

Now it should save at the location specified, thanks a lot zeromus for the help!

Offline

#10 2017-06-17 08:18:36

m1trix
Member
Registered: 2017-06-17
Posts: 1

Re: Change where desmume stores save files

I store my save files in Dropbox and I have links to them in the ~/.config/desmume directory. Works like a charm.

Offline

Board footer

Powered by FluxBB