Diff for /np2/statsave.c between versions 1.14 and 1.16

version 1.14, 2003/10/29 10:09:37 version 1.16, 2003/11/14 07:37:28
Line 12 Line 12
 #include        "pc9861k.h"  #include        "pc9861k.h"
 #include        "mpu98ii.h"  #include        "mpu98ii.h"
 #include        "board14.h"  #include        "board14.h"
   #include        "amd98.h"
 #include        "bios.h"  #include        "bios.h"
 #include        "vram.h"  #include        "vram.h"
 #include        "palettes.h"  #include        "palettes.h"
Line 28 Line 29
 #include        "keydisp.h"  #include        "keydisp.h"
   
   
   #if defined(MACOS)
   #define CRLITERAL       "\r"
   #define CRCONST         str_cr
   #elif defined(WIN32) || defined(X11) || defined(SLZAURUS)
   #define CRLITERAL       "\n"
   #define CRCONST         str_lf
   #else
   #define CRLITERAL       "\r\n"
   #define CRCONST         str_crlf
   #endif
   
   
 typedef struct {  typedef struct {
         char    name[16];          char    name[16];
         char    vername[28];          char    vername[28];
Line 89  typedef struct { Line 102  typedef struct {
   
 static void err_append(ERR_BUF *e, char *buf) {  static void err_append(ERR_BUF *e, char *buf) {
   
           int             len;
   
         if ((e) && (buf)) {          if ((e) && (buf)) {
                 if (e->buf) {                  if (e->buf) {
                         int len;  
                         len = strlen(buf);                          len = strlen(buf);
                         if (e->remain >= len) {                          if (e->remain >= len) {
                                 CopyMemory(e->buf, buf, len);                                  CopyMemory(e->buf, buf, len);
Line 654  enum { Line 668  enum {
         FLAG_FM2B               = 0x0010,          FLAG_FM2B               = 0x0010,
         FLAG_PSG1               = 0x0020,          FLAG_PSG1               = 0x0020,
         FLAG_PSG2               = 0x0040,          FLAG_PSG2               = 0x0040,
         FLAG_RHYTHM             = 0x0080,          FLAG_PSG3               = 0x0080,
         FLAG_ADPCM              = 0x0100,          FLAG_RHYTHM             = 0x0100,
         FLAG_PCM86              = 0x0200,          FLAG_ADPCM              = 0x0200,
         FLAG_CS4231             = 0x0400          FLAG_PCM86              = 0x0400,
           FLAG_CS4231             = 0x0800
 };  };
   
 typedef struct {  typedef struct {
Line 710  static int flagsave_fm(NP2FFILE f, const Line 725  static int flagsave_fm(NP2FFILE f, const
                                                                                 FLAG_PSG1 | FLAG_RHYTHM | FLAG_ADPCM;                                                                                  FLAG_PSG1 | FLAG_RHYTHM | FLAG_ADPCM;
                         break;                          break;
   
                   case 0x80:
                           saveflg = FLAG_PSG1 | FLAG_PSG2 | FLAG_PSG3;
                           break;
   
                 default:                  default:
                         saveflg = 0;                          saveflg = 0;
                         break;                          break;
Line 738  static int flagsave_fm(NP2FFILE f, const Line 757  static int flagsave_fm(NP2FFILE f, const
                 if (saveflg & FLAG_PSG2) {                  if (saveflg & FLAG_PSG2) {
                         ret |= flagsave_save(f, &psg2.reg, sizeof(PSGREG));                          ret |= flagsave_save(f, &psg2.reg, sizeof(PSGREG));
                 }                  }
                   if (saveflg & FLAG_PSG3) {
                           ret |= flagsave_save(f, &psg3.reg, sizeof(PSGREG));
                   }
                 if (saveflg & FLAG_ADPCM) {                  if (saveflg & FLAG_ADPCM) {
                         ret |= flagsave_save(f, &adpcm, sizeof(adpcm));                          ret |= flagsave_save(f, &adpcm, sizeof(adpcm));
                 }                  }
Line 846  static int flagload_fm(NP2FFILE f, const Line 868  static int flagload_fm(NP2FFILE f, const
                                                                                 FLAG_PSG1 | FLAG_RHYTHM | FLAG_ADPCM;                                                                                  FLAG_PSG1 | FLAG_RHYTHM | FLAG_ADPCM;
                         break;                          break;
   
                   case 0x80:
                           saveflg = FLAG_PSG1 | FLAG_PSG2 | FLAG_PSG3;
                           break;
   
                 default:                  default:
                         saveflg = 0;                          saveflg = 0;
                         break;                          break;
Line 872  static int flagload_fm(NP2FFILE f, const Line 898  static int flagload_fm(NP2FFILE f, const
         if (saveflg & FLAG_PSG2) {          if (saveflg & FLAG_PSG2) {
                 ret |= flagload_load(f, &psg2.reg, sizeof(PSGREG));                  ret |= flagload_load(f, &psg2.reg, sizeof(PSGREG));
         }          }
           if (saveflg & FLAG_PSG3) {
                   ret |= flagload_load(f, &psg3.reg, sizeof(PSGREG));
           }
         if (saveflg & FLAG_ADPCM) {          if (saveflg & FLAG_ADPCM) {
                 ret |= flagload_load(f, &adpcm, sizeof(adpcm));                  ret |= flagload_load(f, &adpcm, sizeof(adpcm));
         }          }
Line 912  static int flagload_fm(NP2FFILE f, const Line 941  static int flagload_fm(NP2FFILE f, const
         if (saveflg & FLAG_PSG2) {          if (saveflg & FLAG_PSG2) {
                 play_psgreg(&psg2);                  play_psgreg(&psg2);
         }          }
           if (saveflg & FLAG_PSG3) {
                   play_psgreg(&psg3);
           }
         (void)t;          (void)t;
         return(ret);          return(ret);
 }  }
Line 926  typedef struct { Line 958  typedef struct {
         DOSTIME time;          DOSTIME time;
 } STATDISK;  } STATDISK;
   
   static const char str_fddx[] = "FDD%u";
   static const char str_sasix[] = "SASI%u";
   static const char str_scsix[] = "SCSI%u";
   static const char str_updated[] = "%s: updated" CRLITERAL;
   static const char str_notfound[] = "%s: not found" CRLITERAL;
   
 static int disksave(NP2FFILE f, const char *path, int readonly) {  static int disksave(NP2FFILE f, const char *path, int readonly) {
   
         STATDISK        st;          STATDISK        st;
Line 984  static int diskcheck(NP2FFILE f, const c Line 1022  static int diskcheck(NP2FFILE f, const c
                         if ((memcmp(&st.date, &date, sizeof(date))) ||                          if ((memcmp(&st.date, &date, sizeof(date))) ||
                                 (memcmp(&st.time, &time, sizeof(time)))) {                                  (memcmp(&st.time, &time, sizeof(time)))) {
                                 ret |= NP2FLAG_DISKCHG;                                  ret |= NP2FLAG_DISKCHG;
                                 SPRINTF(buf, "%s: updated\n", name);                                  SPRINTF(buf, str_updated, name);
                                 err_append(e, buf);                                  err_append(e, buf);
                         }                          }
                 }                  }
                 else {                  else {
                         ret |= NP2FLAG_DISKCHG;                          ret |= NP2FLAG_DISKCHG;
                         SPRINTF(buf, "%s: not found\n", name);                          SPRINTF(buf, str_notfound, name);
                         err_append(e, buf);                          err_append(e, buf);
                 }                  }
         }          }
Line 1005  static int flagcheck_disk(NP2FFILE f, co Line 1043  static int flagcheck_disk(NP2FFILE f, co
   
         ret = 0;          ret = 0;
         for (i=0; i<4; i++) {          for (i=0; i<4; i++) {
                 SPRINTF(buf, "FDD%d", i+1);                  SPRINTF(buf, str_fddx, i+1);
                 ret |= diskcheck(f, buf, e);                  ret |= diskcheck(f, buf, e);
         }          }
         sxsi_flash();          sxsi_flash();
         for (i=0; i<2; i++) {          for (i=0; i<2; i++) {
                 SPRINTF(buf, "SASI%u", i+1);                  SPRINTF(buf, str_sasix, i+1);
                 ret |= diskcheck(f, buf, e);                  ret |= diskcheck(f, buf, e);
         }          }
         for (i=0; i<2; i++) {          for (i=0; i<2; i++) {
                 SPRINTF(buf, "SCSI%d", i+1);                  SPRINTF(buf, str_scsix, i+1);
                 ret |= diskcheck(f, buf, e);                  ret |= diskcheck(f, buf, e);
         }          }
         (void)t;          (void)t;

Removed from v.1.14  
changed lines
  Added in v.1.16


RetroPC.NET-CVS <cvs@retropc.net>