| version 1.24, 2011/01/15 16:08:26 | version 1.26, 2012/01/23 04:20:24 | 
| Line 1 | Line 1 | 
 | /*      $Id$    */ |  | 
 |  |  | 
 | #include "compiler.h" | #include "compiler.h" | 
 |  |  | 
 | #include "np2.h" | #include "np2.h" | 
| Line 17 | Line 15 | 
 |  |  | 
 | typedef struct { | typedef struct { | 
 | const char      *title; | const char      *title; | 
| const INITBL    *tbl; | INITBL          *tbl; | 
| const INITBL    *tblterm; | INITBL          *tblterm; | 
 | UINT            count; | UINT            count; | 
 | } _INIARG, *INIARG; | } _INIARG, *INIARG; | 
 |  |  | 
| Line 45  inisetbmp(BYTE *ptr, UINT pos, BOOL set) | Line 43  inisetbmp(BYTE *ptr, UINT pos, BOOL set) | 
 | } | } | 
 |  |  | 
 | static void | static void | 
| inirdargs16(const char *src, const INITBL *ini) | inirdargs16(const char *src, INITBL *ini) | 
 | { | { | 
 | SINT16 *dst; | SINT16 *dst; | 
 | int dsize; | int dsize; | 
| Line 73  inirdargs16(const char *src, const INITB | Line 71  inirdargs16(const char *src, const INITB | 
 | } | } | 
 |  |  | 
 | static void | static void | 
| inirdargh8(const char *src, const INITBL *ini) | inirdargh8(const char *src, INITBL *ini) | 
 | { | { | 
 | BYTE *dst; | BYTE *dst; | 
 | int dsize; | int dsize; | 
| Line 119  inirdargh8(const char *src, const INITBL | Line 117  inirdargh8(const char *src, const INITBL | 
 | } | } | 
 |  |  | 
 | static void | static void | 
| iniwrsetargh8(char *work, int size, const INITBL *ini) | iniwrsetargh8(char *work, int size, INITBL *ini) | 
 | { | { | 
 | char tmp[8]; | char tmp[8]; | 
 | const BYTE *ptr; | const BYTE *ptr; | 
| Line 141  iniwrsetargh8(char *work, int size, cons | Line 139  iniwrsetargh8(char *work, int size, cons | 
 | /* ----- user */ | /* ----- user */ | 
 |  |  | 
 | static void | static void | 
| inirdbyte3(const char *src, const INITBL *ini) | inirdbyte3(const char *src, INITBL *ini) | 
 | { | { | 
 | UINT i; | UINT i; | 
 |  |  | 
| Line 157  inirdbyte3(const char *src, const INITBL | Line 155  inirdbyte3(const char *src, const INITBL | 
 | } | } | 
 |  |  | 
 | static void | static void | 
| inirdkb(const char *src, const INITBL *ini) | inirdkb(const char *src, INITBL *ini) | 
 | { | { | 
 |  |  | 
 | if ((!milstr_extendcmp(src, "DOS")) | if ((!milstr_extendcmp(src, "DOS")) | 
| Line 177  inirdkb(const char *src, const INITBL *i | Line 175  inirdkb(const char *src, const INITBL *i | 
 | } | } | 
 |  |  | 
 | static void | static void | 
| inirdsnddrv(const char *src, const INITBL *ini) | inirdsnddrv(const char *src, INITBL *ini) | 
 | { | { | 
 |  |  | 
 | *(UINT8 *)ini->value = snddrv_drv2num(src); | *(UINT8 *)ini->value = snddrv_drv2num(src); | 
 | } | } | 
 |  |  | 
 | static void | static void | 
| inirdinterp(const char *src, const INITBL *ini) | inirdinterp(const char *src, INITBL *ini) | 
 | { | { | 
 |  |  | 
 | if (!milstr_cmp(src, "NEAREST")) { | if (!milstr_cmp(src, "NEAREST")) { | 
| Line 204  static BOOL | Line 202  static BOOL | 
 | inireadcb(void *arg, const char *para, const char *key, const char *data) | inireadcb(void *arg, const char *para, const char *key, const char *data) | 
 | { | { | 
 | char work[512]; | char work[512]; | 
| const INITBL *p; | INITBL *p; | 
 | BOOL rv; | BOOL rv; | 
 |  |  | 
 | if (arg == NULL) { | if (arg == NULL) { | 
| Line 301  inireadcb(void *arg, const char *para, c | Line 299  inireadcb(void *arg, const char *para, c | 
 | } | } | 
 |  |  | 
 | void | void | 
| ini_read(const char *path, const char *title, const INITBL *tbl, UINT count) | ini_read(const char *path, const char *title, INITBL *tbl, UINT count) | 
 | { | { | 
 | _INIARG iniarg; | _INIARG iniarg; | 
 |  |  | 
| Line 378  iniwrinterp(UINT8 interp) | Line 376  iniwrinterp(UINT8 interp) | 
 | static BOOL read_iniread_flag(const INITBL *p); | static BOOL read_iniread_flag(const INITBL *p); | 
 |  |  | 
 | void | void | 
| ini_write(const char *path, const char *title, const INITBL *tbl, UINT count, BOOL create) | ini_write(const char *path, const char *title, INITBL *tbl, UINT count, BOOL create) | 
 | { | { | 
| char            work[512]; | char    work[512]; | 
| const INITBL    *p; | INITBL  *p; | 
| const INITBL    *pterm; | INITBL  *pterm; | 
| FILEH           fh; | FILEH   fh; | 
| BOOL            set; | BOOL    set; | 
 |  |  | 
 | fh = FILEH_INVALID; | fh = FILEH_INVALID; | 
 | if (!create) { | if (!create) { | 
| Line 514  enum { | Line 512  enum { | 
 | INIRO_KB        = INIFLAG_RO | INITYPE_KB | INIRO_KB        = INIFLAG_RO | INITYPE_KB | 
 | }; | }; | 
 |  |  | 
| static const INITBL iniitem[] = { | static INITBL iniitem[] = { | 
 | {"np2title", INIRO_STR,         np2oscfg.titles,        sizeof(np2oscfg.titles)}, | {"np2title", INIRO_STR,         np2oscfg.titles,        sizeof(np2oscfg.titles)}, | 
 | {"paddingx", INIROMAX_SINT32,   &np2oscfg.paddingx,     32}, | {"paddingx", INIROMAX_SINT32,   &np2oscfg.paddingx,     32}, | 
 | {"paddingy", INIROMAX_SINT32,   &np2oscfg.paddingy,     32}, | {"paddingy", INIROMAX_SINT32,   &np2oscfg.paddingy,     32}, | 
| Line 671  calc_index(const INITBL *p) | Line 669  calc_index(const INITBL *p) | 
 | UINT idx; | UINT idx; | 
 |  |  | 
 | if (p) { | if (p) { | 
| offset = (char *)p - (char *)iniitem; | offset = (const char *)p - (const char *)iniitem; | 
 | if ((offset % sizeof(iniitem[0])) == 0) { | if ((offset % sizeof(iniitem[0])) == 0) { | 
 | idx = offset / sizeof(iniitem[0]); | idx = offset / sizeof(iniitem[0]); | 
 | if (idx < INIITEMS) { | if (idx < INIITEMS) { |