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

cfg and nvram not being created [$10] #13

Closed
daweze opened this issue Sep 1, 2015 · 12 comments
Closed

cfg and nvram not being created [$10] #13

daweze opened this issue Sep 1, 2015 · 12 comments
Labels

Comments

@daweze
Copy link

daweze commented Sep 1, 2015

imame4all appears to not write out save games or any data after it is run rendering games that save user statistics broken.

The MAME core is not dumping a cfg file or nvram file for games. Each time the game is launched, you get the legal disclaimer which is only supposed to show when there is no cfg file and you'll see that the nvram is always reset.


There is a $10 open bounty on this issue. Add to the bounty at Bountysource.

@markwkidd
Copy link
Contributor

Presumably this is also the reason why settings in the MAME "tab" menu are not saved between sessions with this core as mentioned here: #29 (comment)

@inactive123 inactive123 changed the title cfg and nvram not being created cfg and nvram not being created [$5] Sep 23, 2017
@markwkidd
Copy link
Contributor

@markwkidd
Copy link
Contributor

@r-type I apologize I keep tagging you, but this issue seems like it could also be a simple path or permissions problem in mame2000

@r-type
Copy link
Contributor

r-type commented Sep 23, 2017

no , it's not directly related.

let me explain why it's not working...

First , //parse_cmdline (argc, argv, game_index); is commented
so it never define the nvdir,hi,cheat,ect path.
so a quick patch will be to done something like this just before this line in libretro.c

   /* parse generic (os-independent) options */
   //parse_cmdline (argc, argv, game_index);
//Set default path
nvdir=(char *) malloc(1024);sprintf(nvdir,"%s%c%s\0",IMAMEBASEPATH,slash,"nvram");
hidir=(char *) malloc(1024);sprintf(hidir,"%s%c%s\0",IMAMEBASEPATH,slash,"hi");
cfgdir=(char *) malloc(1024);sprintf(cfgdir,"%s%c%s\0",IMAMEBASEPATH,slash,"cfg");
screenshotdir=(char *) malloc(1024);sprintf(screenshotdir,"%s%c%s\0",IMAMEBASEPATH,slash,"snap");
memcarddir=(char *) malloc(1024);sprintf(memcarddir,"%s%c%s\0",IMAMEBASEPATH,slash,"memcard");
stadir=(char *) malloc(1024);sprintf(stadir,"%s%c%s\0",IMAMEBASEPATH,slash,"sta");
artworkdir=(char *) malloc(1024);sprintf(artworkdir,"%s%c%s\0",IMAMEBASEPATH,slash,"artwork");
cheatdir=(char *) malloc(1024);sprintf(cheatdir,"%s%c%s\0",IMAMEBASEPATH,slash,"cheat");

Secondly, when you exit game in mame2000 , it exit roughly the core thread.
So it never reach after cpu_run(); (in mame.c) in int run_machine(void)


					cpu_run();      /* run the emulation! */
// here never reached when exited from RA
					if (drv->nvram_handler)
					{
						void *f;
printf("here 1\n");
						if ((f = osd_fopen(Machine->gamedrv->name,0,OSD_FILETYPE_NVRAM,1)) != 0)
						{
							(*drv->nvram_handler)(f,1);
							osd_fclose(f);
						}
					}

					if (options.cheat) StopCheat();

					/* save input ports settings */
					save_input_port_settings();

a quick hack (for WANT_LIBCO) will be to use a variable int libco_quit=0;
and in void retro_unload_game(void)

void retro_unload_game(void)
{
#ifdef WANT_LIBCO
   libco_quit=1; //acknowledge we want to quit in void cpu_run(void) and back to core thread 
   co_switch(core_thread);
// then core thread ending so we can quit .
   co_delete(core_thread);
#else
...

and in void cpu_run(void) (cpuintrf.c)

	/* loop until the user quits */
	usres = 0;
	while (usres == 0)
	{
		int cpunum;
#ifdef WANT_LIBCO
		if(libco_quit==1)usres=1;
#endif

this will lead that the core thread will ending and writing file before RA quit the core.

thirdly, maybe it will remain the WIN32 slash problem in fileio.c ...
so maybe we will have to change all the thing like

            sprintf (name, "%s/%s.nv", nvdir, gamename);

to

extern char slash;
...
            sprintf (name, "%s%c%s.nv", nvdir, slash,gamename);

@r-type
Copy link
Contributor

r-type commented Sep 23, 2017

another problem is that this core does not create the folder , what add to backport something like
static UINT32 create_path_recursive(char *path)
https://github.com/r-type/mame2009-libretro/blob/master/src/osd/retro/retrofile.c#L232

@inactive123 inactive123 changed the title cfg and nvram not being created [$5] cfg and nvram not being created [$10] Sep 23, 2017
@r-type
Copy link
Contributor

r-type commented Sep 23, 2017

#45

@r-type
Copy link
Contributor

r-type commented Sep 24, 2017

#47 should fix build introduce with errno.

@markwkidd
Copy link
Contributor

markwkidd commented Oct 2, 2017

@r-type you should go ahead and claim this bounty, I think! Thank you for your work.

@r-type
Copy link
Contributor

r-type commented Oct 3, 2017

@markwkidd if you have an account.
Could you claim bounty and put the amount in other one of your choice.

@markwkidd
Copy link
Contributor

@r-type that is fine with me.

However I may be tempted to add the money to this bounty -- are you any more interested in it? libretro/mame2015-libretro#54

@markwkidd
Copy link
Contributor

@daweze or @twinaphex would you be willing to close this issue so we can roll the bounty forward to another issue?

@zerojay
Copy link

zerojay commented Nov 9, 2017

In my testing, this does appear to work properly now as openice now will write out nvram and read it in next play session.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants