diff options
author | pixel <pixel> | 2004-11-27 21:44:44 +0000 |
---|---|---|
committer | pixel <pixel> | 2004-11-27 21:44:44 +0000 |
commit | d38e80ee04afe582e70150d3884e56c05f3fd7a8 (patch) | |
tree | f2627c50fa22aea89447e8406ac418eb68650d3d /PcsxSrc/Linux/Config.c | |
parent | 50f0dd331f8168fb5b2cd60c70178fad627b7fb6 (diff) |
Large dos2unix commit...
Diffstat (limited to 'PcsxSrc/Linux/Config.c')
-rw-r--r-- | PcsxSrc/Linux/Config.c | 254 |
1 files changed, 127 insertions, 127 deletions
diff --git a/PcsxSrc/Linux/Config.c b/PcsxSrc/Linux/Config.c index ef526db..feecefa 100644 --- a/PcsxSrc/Linux/Config.c +++ b/PcsxSrc/Linux/Config.c @@ -1,127 +1,127 @@ -/* Pcsx - Pc Psx Emulator
- * Copyright (C) 1999-2002 Pcsx Team
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/stat.h>
-#include <unistd.h>
-
-#include "Linux.h"
-
-#define GetValue(name, var) \
- tmp = strstr(data, name); \
- if (tmp != NULL) { \
- tmp+=strlen(name); \
- while ((*tmp == ' ') || (*tmp == '=')) tmp++; \
- if (*tmp != '\n') sscanf(tmp, "%s", var); \
- }
-
-#define GetValuel(name, var) \
- tmp = strstr(data, name); \
- if (tmp != NULL) { \
- tmp+=strlen(name); \
- while ((*tmp == ' ') || (*tmp == '=')) tmp++; \
- if (*tmp != '\n') sscanf(tmp, "%lx", &var); \
- }
-
-#define SetValue(name, var) \
- fprintf (f,"%s = %s\n", name, var);
-
-#define SetValuel(name, var) \
- fprintf (f,"%s = %lx\n", name, var);
-
-int LoadConfig(PcsxConfig *Conf) {
- struct stat buf;
- FILE *f;
- int size;
- char *data,*tmp;
-
- if (stat(cfgfile, &buf) == -1) return -1;
- size = buf.st_size;
-
- f = fopen(cfgfile,"r");
- if (f == NULL) return -1;
-
- data = (char*)malloc(size);
- if (data == NULL) return -1;
-
- fread(data, 1, size, f);
- fclose(f);
-
- GetValue("Bios", Config.Bios);
- GetValue("Gpu", Config.Gpu);
- GetValue("Spu", Config.Spu);
- GetValue("Cdr", Config.Cdr);
- GetValue("Pad1", Config.Pad1);
- GetValue("Pad2", Config.Pad2);
- GetValue("Mcd1", Config.Mcd1);
- GetValue("Mcd2", Config.Mcd2);
- GetValue("PluginsDir", Config.PluginsDir);
- GetValue("BiosDir", Config.BiosDir);
- GetValuel("Xa", Config.Xa);
- GetValuel("Sio", Config.Sio);
- GetValuel("Mdec", Config.Mdec);
- GetValuel("PsxAuto", Config.PsxAuto);
- GetValuel("PsxType", Config.PsxType);
- GetValuel("Cdda", Config.Cdda);
- GetValuel("Cpu", Config.Cpu);
- GetValuel("Log", Config.Log);
- GetValuel("PsxOut", Config.PsxOut);
- GetValuel("SpuIrq", Config.SpuIrq);
- GetValuel("CdTiming",Config.CdTiming);
-
- free(data);
-
- return 0;
-}
-
-/////////////////////////////////////////////////////////
-
-void SaveConfig() {
- FILE *f;
-
- f = fopen(cfgfile,"w");
- if (f == NULL) return;
-
- SetValue("Bios", Config.Bios);
- SetValue("Gpu", Config.Gpu);
- SetValue("Spu", Config.Spu);
- SetValue("Cdr", Config.Cdr);
- SetValue("Pad1", Config.Pad1);
- SetValue("Pad2", Config.Pad2);
- SetValue("Mcd1", Config.Mcd1);
- SetValue("Mcd2", Config.Mcd2);
- SetValue("PluginsDir", Config.PluginsDir);
- SetValue("BiosDir", Config.BiosDir);
- SetValuel("Xa", Config.Xa);
- SetValuel("Sio", Config.Sio);
- SetValuel("Mdec", Config.Mdec);
- SetValuel("PsxAuto", Config.PsxAuto);
- SetValuel("PsxType", Config.PsxType);
- SetValuel("Cdda", Config.Cdda);
- SetValuel("Cpu", Config.Cpu);
- SetValuel("Log", Config.Log);
- SetValuel("PsxOut", Config.PsxOut);
- SetValuel("SpuIrq", Config.SpuIrq);
- SetValuel("CdTiming",Config.CdTiming);
-
- fclose(f);
-
- return;
-}
+/* Pcsx - Pc Psx Emulator + * Copyright (C) 1999-2002 Pcsx Team + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <sys/stat.h> +#include <unistd.h> + +#include "Linux.h" + +#define GetValue(name, var) \ + tmp = strstr(data, name); \ + if (tmp != NULL) { \ + tmp+=strlen(name); \ + while ((*tmp == ' ') || (*tmp == '=')) tmp++; \ + if (*tmp != '\n') sscanf(tmp, "%s", var); \ + } + +#define GetValuel(name, var) \ + tmp = strstr(data, name); \ + if (tmp != NULL) { \ + tmp+=strlen(name); \ + while ((*tmp == ' ') || (*tmp == '=')) tmp++; \ + if (*tmp != '\n') sscanf(tmp, "%lx", &var); \ + } + +#define SetValue(name, var) \ + fprintf (f,"%s = %s\n", name, var); + +#define SetValuel(name, var) \ + fprintf (f,"%s = %lx\n", name, var); + +int LoadConfig(PcsxConfig *Conf) { + struct stat buf; + FILE *f; + int size; + char *data,*tmp; + + if (stat(cfgfile, &buf) == -1) return -1; + size = buf.st_size; + + f = fopen(cfgfile,"r"); + if (f == NULL) return -1; + + data = (char*)malloc(size); + if (data == NULL) return -1; + + fread(data, 1, size, f); + fclose(f); + + GetValue("Bios", Config.Bios); + GetValue("Gpu", Config.Gpu); + GetValue("Spu", Config.Spu); + GetValue("Cdr", Config.Cdr); + GetValue("Pad1", Config.Pad1); + GetValue("Pad2", Config.Pad2); + GetValue("Mcd1", Config.Mcd1); + GetValue("Mcd2", Config.Mcd2); + GetValue("PluginsDir", Config.PluginsDir); + GetValue("BiosDir", Config.BiosDir); + GetValuel("Xa", Config.Xa); + GetValuel("Sio", Config.Sio); + GetValuel("Mdec", Config.Mdec); + GetValuel("PsxAuto", Config.PsxAuto); + GetValuel("PsxType", Config.PsxType); + GetValuel("Cdda", Config.Cdda); + GetValuel("Cpu", Config.Cpu); + GetValuel("Log", Config.Log); + GetValuel("PsxOut", Config.PsxOut); + GetValuel("SpuIrq", Config.SpuIrq); + GetValuel("CdTiming",Config.CdTiming); + + free(data); + + return 0; +} + +///////////////////////////////////////////////////////// + +void SaveConfig() { + FILE *f; + + f = fopen(cfgfile,"w"); + if (f == NULL) return; + + SetValue("Bios", Config.Bios); + SetValue("Gpu", Config.Gpu); + SetValue("Spu", Config.Spu); + SetValue("Cdr", Config.Cdr); + SetValue("Pad1", Config.Pad1); + SetValue("Pad2", Config.Pad2); + SetValue("Mcd1", Config.Mcd1); + SetValue("Mcd2", Config.Mcd2); + SetValue("PluginsDir", Config.PluginsDir); + SetValue("BiosDir", Config.BiosDir); + SetValuel("Xa", Config.Xa); + SetValuel("Sio", Config.Sio); + SetValuel("Mdec", Config.Mdec); + SetValuel("PsxAuto", Config.PsxAuto); + SetValuel("PsxType", Config.PsxType); + SetValuel("Cdda", Config.Cdda); + SetValuel("Cpu", Config.Cpu); + SetValuel("Log", Config.Log); + SetValuel("PsxOut", Config.PsxOut); + SetValuel("SpuIrq", Config.SpuIrq); + SetValuel("CdTiming",Config.CdTiming); + + fclose(f); + + return; +} |