Diff for /np2/statsave.c between versions 1.38 and 1.43

version 1.38, 2004/02/21 00:25:33 version 1.43, 2005/02/07 14:46:07
Line 10 Line 10
 #include        "iocore.h"  #include        "iocore.h"
 #include        "gdc_sub.h"  #include        "gdc_sub.h"
 #include        "cbuscore.h"  #include        "cbuscore.h"
   #include        "ideio.h"
 #include        "sasiio.h"  #include        "sasiio.h"
 #include        "scsiio.h"  #include        "scsiio.h"
 #include        "pc9861k.h"  #include        "pc9861k.h"
Line 30 Line 31
 #include        "keydisp.h"  #include        "keydisp.h"
 #include        "hostdrv.h"  #include        "hostdrv.h"
 #include        "calendar.h"  #include        "calendar.h"
   #include        "keystat.h"
   
 #if defined(MACOS)  #if defined(MACOS)
 #define CRCONST         str_cr  #define CRCONST         str_cr
Line 184  sfo_err1: Line 186  sfo_err1:
 static int statflag_closesection(SFFILEH sffh) {  static int statflag_closesection(SFFILEH sffh) {
   
         UINT    leng;          UINT    leng;
         BYTE    zero[16];          UINT8   zero[16];
   
         if (sffh == NULL) {          if (sffh == NULL) {
                 goto sfcs_err1;                  goto sfcs_err1;
Line 545  static int nevent_write(STFLAGH sfh, int Line 547  static int nevent_write(STFLAGH sfh, int
         UINT            i;          UINT            i;
   
         ZeroMemory(&nit, sizeof(nit));          ZeroMemory(&nit, sizeof(nit));
         for (i=0; i<sizeof(evtnum)/sizeof(ENUMTBL); i++) {          for (i=0; i<NELEMENTS(evtnum); i++) {
                 if (evtnum[i].num == num) {                  if (evtnum[i].num == num) {
                         nit.id = evtnum[i].id;                          nit.id = evtnum[i].id;
                         break;                          break;
Line 589  static int nevent_read(STFLAGH sfh, UINT Line 591  static int nevent_read(STFLAGH sfh, UINT
   
         ret = statflag_read(sfh, &nit, sizeof(nit));          ret = statflag_read(sfh, &nit, sizeof(nit));
   
         for (i=0; i<sizeof(evtnum)/sizeof(ENUMTBL); i++) {          for (i=0; i<NELEMENTS(evtnum); i++) {
                 if (nit.id == evtnum[i].id) {                  if (nit.id == evtnum[i].id) {
                         break;                          break;
                 }                  }
         }          }
         if (i < (sizeof(evtnum)/sizeof(ENUMTBL))) {          if (i < NELEMENTS(evtnum)) {
                 num = evtnum[i].num;                  num = evtnum[i].num;
                 nevent.item[num].clock = nit.clock;                  nevent.item[num].clock = nit.clock;
                 nevent.item[num].flag = nit.flag;                  nevent.item[num].flag = nit.flag;
Line 669  static int flagsave_gij(STFLAGH sfh, con Line 671  static int flagsave_gij(STFLAGH sfh, con
         int             ret;          int             ret;
         int             i;          int             i;
         int             j;          int             j;
 const BYTE      *fnt;  const UINT8     *fnt;
   
         ret = STATFLAG_SUCCESS;          ret = STATFLAG_SUCCESS;
         for (i=0; i<2; i++) {          for (i=0; i<2; i++) {
Line 688  static int flagload_gij(STFLAGH sfh, con Line 690  static int flagload_gij(STFLAGH sfh, con
         int             ret;          int             ret;
         int             i;          int             i;
         int             j;          int             j;
         BYTE    *fnt;          UINT8   *fnt;
   
         ret = 0;          ret = 0;
         for (i=0; i<2; i++) {          for (i=0; i<2; i++) {
Line 705  static int flagload_gij(STFLAGH sfh, con Line 707  static int flagload_gij(STFLAGH sfh, con
   
 // ---- FM  // ---- FM
   
   #if !defined(DISABLE_SOUND)
   
 enum {  enum {
         FLAG_MG                 = 0x0001,          FLAG_MG                 = 0x0001,
         FLAG_FM1A               = 0x0002,          FLAG_FM1A               = 0x0002,
Line 721  enum { Line 725  enum {
 };  };
   
 typedef struct {  typedef struct {
         BYTE    keyreg[OPNCH_MAX];          UINT8   keyreg[OPNCH_MAX];
         BYTE    extop[4];          UINT8   extop[4];
 } OPNKEY;  } OPNKEY;
   
 static int flagsave_fm(STFLAGH sfh, const SFENTRY *tbl) {  static int flagsave_fm(STFLAGH sfh, const SFENTRY *tbl) {
Line 904  static int flagload_fm(STFLAGH sfh, cons Line 908  static int flagload_fm(STFLAGH sfh, cons
         }          }
         if (saveflg & FLAG_CS4231) {          if (saveflg & FLAG_CS4231) {
                 ret |= statflag_read(sfh, &cs4231, sizeof(cs4231));                  ret |= statflag_read(sfh, &cs4231, sizeof(cs4231));
                 cs4231.proc = cs4231dec[cs4231.reg.datafmt >> 4];  
         }          }
   
         // 復元。 これ移動すること!          // 復元。 これ移動すること!
Line 919  static int flagload_fm(STFLAGH sfh, cons Line 922  static int flagload_fm(STFLAGH sfh, cons
         (void)t;          (void)t;
         return(ret);          return(ret);
 }  }
   #endif
   
   
 // ---- disk  // ---- disk
Line 957  static int disksave(STFLAGH sfh, const c Line 961  static int disksave(STFLAGH sfh, const c
 static int flagsave_disk(STFLAGH sfh, const SFENTRY *tbl) {  static int flagsave_disk(STFLAGH sfh, const SFENTRY *tbl) {
   
         int             ret;          int             ret;
         BYTE    i;          UINT8   i;
   
         sxsi_flash();          sxsi_flash();
         ret = STATFLAG_SUCCESS;          ret = STATFLAG_SUCCESS;
Line 1183  const SFENTRY *tblterm; Line 1187  const SFENTRY *tblterm;
   
         ret = STATFLAG_SUCCESS;          ret = STATFLAG_SUCCESS;
         tbl = np2tbl;          tbl = np2tbl;
         tblterm = tbl + (sizeof(np2tbl)/sizeof(SFENTRY));          tblterm = tbl + NELEMENTS(np2tbl);
         while(tbl < tblterm) {          while(tbl < tblterm) {
                 ret |= statflag_createsection(sffh, tbl);                  ret |= statflag_createsection(sffh, tbl);
                 switch(tbl->type) {                  switch(tbl->type) {
Line 1226  const SFENTRY *tblterm; Line 1230  const SFENTRY *tblterm;
                                 ret |= flagsave_ext(&sffh->sfh, tbl);                                  ret |= flagsave_ext(&sffh->sfh, tbl);
                                 break;                                  break;
   
   #if !defined(DISABLE_SOUND)
                         case STATFLAG_FM:                          case STATFLAG_FM:
                                 ret |= flagsave_fm(&sffh->sfh, tbl);                                  ret |= flagsave_fm(&sffh->sfh, tbl);
                                 break;                                  break;
   #endif
   
                         case STATFLAG_GIJ:                          case STATFLAG_GIJ:
                                 ret |= flagsave_gij(&sffh->sfh, tbl);                                  ret |= flagsave_gij(&sffh->sfh, tbl);
Line 1268  const SFENTRY *tblterm; Line 1274  const SFENTRY *tblterm;
         while((!done) && (ret != STATFLAG_FAILURE)) {          while((!done) && (ret != STATFLAG_FAILURE)) {
                 ret |= statflag_readsection(sffh);                  ret |= statflag_readsection(sffh);
                 tbl = np2tbl;                  tbl = np2tbl;
                 tblterm = tbl + (sizeof(np2tbl)/sizeof(SFENTRY));                  tblterm = tbl + NELEMENTS(np2tbl);
                 while(tbl < tblterm) {                  while(tbl < tblterm) {
                         if (!memcmp(sffh->sfh.hdr.index, tbl->index, 10)) {                          if (!memcmp(sffh->sfh.hdr.index, tbl->index, 10)) {
                                 break;                                  break;
Line 1296  const SFENTRY *tblterm; Line 1302  const SFENTRY *tblterm;
                                 case STATFLAG_EVT:                                  case STATFLAG_EVT:
                                 case STATFLAG_EXT:                                  case STATFLAG_EXT:
                                 case STATFLAG_GIJ:                                  case STATFLAG_GIJ:
   #if !defined(DISABLE_SOUND)
                                 case STATFLAG_FM:                                  case STATFLAG_FM:
   #endif
 #if defined(SUPPORT_HOSTDRV)  #if defined(SUPPORT_HOSTDRV)
                                 case STATFLAG_HDRV:                                  case STATFLAG_HDRV:
 #endif  #endif
Line 1366  const SFENTRY *tblterm; Line 1374  const SFENTRY *tblterm;
         while((!done) && (ret != STATFLAG_FAILURE)) {          while((!done) && (ret != STATFLAG_FAILURE)) {
                 ret |= statflag_readsection(sffh);                  ret |= statflag_readsection(sffh);
                 tbl = np2tbl + 1;                  tbl = np2tbl + 1;
                 tblterm = np2tbl + (sizeof(np2tbl)/sizeof(SFENTRY));                  tblterm = np2tbl + NELEMENTS(np2tbl);
                 while(tbl < tblterm) {                  while(tbl < tblterm) {
                         if (!memcmp(sffh->sfh.hdr.index, tbl->index, 10)) {                          if (!memcmp(sffh->sfh.hdr.index, tbl->index, 10)) {
                                 break;                                  break;
Line 1417  const SFENTRY *tblterm; Line 1425  const SFENTRY *tblterm;
                                         ret |= flagload_ext(&sffh->sfh, tbl);                                          ret |= flagload_ext(&sffh->sfh, tbl);
                                         break;                                          break;
   
   #if !defined(DISABLE_SOUND)
                                 case STATFLAG_FM:                                  case STATFLAG_FM:
                                         ret |= flagload_fm(&sffh->sfh, tbl);                                          ret |= flagload_fm(&sffh->sfh, tbl);
                                         break;                                          break;
   #endif
   
                                 case STATFLAG_GIJ:                                  case STATFLAG_GIJ:
                                         ret |= flagload_gij(&sffh->sfh, tbl);                                          ret |= flagload_gij(&sffh->sfh, tbl);

Removed from v.1.38  
changed lines
  Added in v.1.43


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