NVR files now stored per-config.
This commit is contained in:
parent
9f2b58b7c4
commit
a44fcb196b
47 changed files with 32 additions and 4 deletions
|
|
@ -5,6 +5,7 @@
|
|||
#include "config.h"
|
||||
|
||||
char config_file_default[256];
|
||||
char config_name[256];
|
||||
|
||||
static char config_file[256];
|
||||
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ void config_dump(int is_global);
|
|||
void config_free(int is_global);
|
||||
|
||||
extern char config_file_default[256];
|
||||
extern char config_name[256];
|
||||
|
||||
#define CFG_MACHINE 0
|
||||
#define CFG_GLOBAL 1
|
||||
|
|
|
|||
25
src/nvr.c
25
src/nvr.c
|
|
@ -23,11 +23,32 @@ static int rtctime;
|
|||
FILE *nvrfopen(char *fn, char *mode)
|
||||
{
|
||||
char s[512];
|
||||
|
||||
FILE *f;
|
||||
|
||||
strcpy(s, nvr_path);
|
||||
put_backslash(s);
|
||||
strcat(s, config_name);
|
||||
strcat(s, ".");
|
||||
strcat(s, fn);
|
||||
return fopen(s, mode);
|
||||
pclog("NVR try opening %s\n", s);
|
||||
f = fopen(s, mode);
|
||||
if (f)
|
||||
return f;
|
||||
|
||||
if (mode[0] == 'r')
|
||||
{
|
||||
strcpy(s, nvr_path);
|
||||
put_backslash(s);
|
||||
strcat(s, "default");
|
||||
put_backslash(s);
|
||||
strcat(s, fn);
|
||||
return fopen(s, mode);
|
||||
}
|
||||
else
|
||||
{
|
||||
pclog("Failed to open file '%s' for write\n", s);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void getnvrtime()
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
#include "ibm.h"
|
||||
#include "nvr.h"
|
||||
#include "vid_ati_eeprom.h"
|
||||
|
||||
enum
|
||||
|
|
@ -33,7 +34,7 @@ void ati_eeprom_load(ati_eeprom_t *eeprom, char *fn, int type)
|
|||
FILE *f;
|
||||
eeprom->type = type;
|
||||
strcpy(eeprom->fn, fn);
|
||||
f = romfopen(eeprom->fn, "rb");
|
||||
f = nvrfopen(eeprom->fn, "rb");
|
||||
if (!f)
|
||||
{
|
||||
memset(eeprom->data, 0, eeprom->type ? 512 : 128);
|
||||
|
|
@ -45,7 +46,7 @@ void ati_eeprom_load(ati_eeprom_t *eeprom, char *fn, int type)
|
|||
|
||||
void ati_eeprom_save(ati_eeprom_t *eeprom)
|
||||
{
|
||||
FILE *f = romfopen(eeprom->fn, "wb");
|
||||
FILE *f = nvrfopen(eeprom->fn, "wb");
|
||||
if (!f) return;
|
||||
fwrite(eeprom->data, 1, eeprom->type ? 512 : 128, f);
|
||||
fclose(f);
|
||||
|
|
|
|||
|
|
@ -98,6 +98,9 @@ static int run(void* hdlg)
|
|||
pclog("Config name %s\n", cfg);
|
||||
|
||||
strcpy(config_file_default, cfg);
|
||||
strcpy(config_name, s);
|
||||
if (config_name[strlen(config_name)-1] == '.')
|
||||
config_name[strlen(config_name)-1] = 0;
|
||||
|
||||
wx_enddialog(hdlg, 1);
|
||||
// pause = 0;
|
||||
|
|
|
|||
Loading…
Reference in a new issue