| 1 | /* FCE Ultra - NES/Famicom Emulator |
| 2 | * |
| 3 | * Copyright notice for this file: |
| 4 | * Copyright (C) 2002 Ben Parnell |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License as published by |
| 8 | * the Free Software Foundation; either version 2 of the License, or |
| 9 | * (at your option) any later version. |
| 10 | * |
| 11 | * This program is distributed in the hope that it will be useful, |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | * GNU General Public License for more details. |
| 15 | * |
| 16 | * You should have received a copy of the GNU General Public License |
| 17 | * along with this program; if not, write to the Free Software |
| 18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 19 | */ |
| 20 | |
| 21 | typedef struct { |
| 22 | char *name; |
| 23 | void *ptr; |
| 24 | int len; |
| 25 | } CFGSTRUCT; |
| 26 | |
| 27 | void SaveFCEUConfig(char *filename, CFGSTRUCT *cfgst); |
| 28 | void LoadFCEUConfig(char *filename, CFGSTRUCT *cfgst); |
| 29 | |
| 30 | /* Macros for building CFGSTRUCT structures. */ |
| 31 | |
| 32 | /* CFGSTRUCT structures must always end with ENDCFGSTRUCT */ |
| 33 | #define ENDCFGSTRUCT { 0,0,0 } |
| 34 | |
| 35 | /* When this macro is used, the config loading/saving code will parse |
| 36 | the new config structure until the end of it is detected, then it |
| 37 | will continue parsing the original config structure. |
| 38 | */ |
| 39 | #define ADDCFGSTRUCT(x) { 0,&x,0 } |
| 40 | |
| 41 | /* Oops. The NAC* macros shouldn't have the # in front of the w, but |
| 42 | fixing this would break configuration files of previous versions and it |
| 43 | isn't really hurting much. |
| 44 | */ |
| 45 | |
| 46 | /* Single piece of data(integer). */ |
| 47 | #define AC(x) { #x,&x,sizeof(x)} |
| 48 | #define NAC(w,x) { #w,&x,sizeof(x)} |
| 49 | |
| 50 | /* Array. */ |
| 51 | #define ACA(x) {#x,x,sizeof(x)} |
| 52 | #define NACA(w,x) {#w,x,sizeof(x)} |
| 53 | |
| 54 | /* String(pointer) with automatic memory allocation. */ |
| 55 | #define ACS(x) {#x,&x,0} |
| 56 | #define NACS(w,x) {#w,&x,0} |
| 57 | |