|
|
| version 1.1, 2003/10/16 17:57:09 | version 1.12, 2003/10/24 10:58:47 |
|---|---|
| Line 12 | Line 12 |
| #include "pc9861k.h" | #include "pc9861k.h" |
| #include "mpu98ii.h" | #include "mpu98ii.h" |
| #include "board14.h" | #include "board14.h" |
| #include "bios.h" | |
| #include "vram.h" | #include "vram.h" |
| #include "maketext.h" | |
| #include "palettes.h" | #include "palettes.h" |
| #include "font.h" | #include "maketext.h" |
| #include "sound.h" | #include "sound.h" |
| #include "bios.h" | |
| #include "fmboard.h" | #include "fmboard.h" |
| #include "beep.h" | #include "beep.h" |
| #include "font.h" | |
| #include "fddfile.h" | #include "fddfile.h" |
| #include "fdd_mtr.h" | #include "fdd_mtr.h" |
| #include "sxsi.h" | #include "sxsi.h" |
| Line 38 typedef struct { | Line 38 typedef struct { |
| char index[10]; | char index[10]; |
| UINT16 ver; | UINT16 ver; |
| UINT32 size; | UINT32 size; |
| } NP2FLAGPART_T; | } NP2FENT; |
| enum { | enum { |
| NP2FLAG_BIN = 0, | NP2FLAG_BIN = 0, |
| NP2FLAG_TERM, | NP2FLAG_TERM, |
| NP2FLAG_286, | NP2FLAG_CLOCK, |
| NP2FLAG_CORE, | |
| NP2FLAG_DMA, | NP2FLAG_DMA, |
| NP2FLAG_EGC, | NP2FLAG_EGC, |
| NP2FLAG_EXT, | NP2FLAG_EXT, |
| NP2FLAG_EVT, | NP2FLAG_EVT, |
| NP2FLAG_GIJ, | NP2FLAG_GIJ, |
| NP2FLAG_FM, | NP2FLAG_FM, |
| NP2FLAG_BEEP, | |
| NP2FLAG_MIDI, | NP2FLAG_MIDI, |
| NP2FLAG_DISK | NP2FLAG_DISK |
| }; | }; |
| Line 74 typedef struct { | Line 72 typedef struct { |
| int num; | int num; |
| } ENUMTBL; | } ENUMTBL; |
| #define PROCID(a, b, c, d) (((d) << 24) | ((c) << 16) | ((b) << 8) | (a)) | #define PROCID(a, b, c, d) (((d) << 24) + ((c) << 16) + ((b) << 8) + (a)) |
| #define PROC2NUM(a, b) proc2num(&(a), b, sizeof(b)/sizeof(PROCTBL)) | #define PROC2NUM(a, b) proc2num(&(a), (b), sizeof(b)/sizeof(PROCTBL)) |
| #define NUM2PROC(a, b) num2proc(&(a), b, sizeof(b)/sizeof(PROCTBL)) | #define NUM2PROC(a, b) num2proc(&(a), (b), sizeof(b)/sizeof(PROCTBL)) |
| #include "statsave.tbl" | #include "statsave.tbl" |
| Line 140 static BOOL num2proc(void *func, const P | Line 138 static BOOL num2proc(void *func, const P |
| // ---- | // ---- |
| typedef struct { | typedef struct { |
| FILEH fh; | FILEH fh; |
| long pos; | long pos; |
| long bak; | long bak; |
| long next; | long next; |
| NP2FHDR f; | NP2FHDR f; |
| NP2FLAGPART_T p; | NP2FENT p; |
| } NP2FFILE; | } _NP2FFILE, *NP2FFILE; |
| static int flagopen(NP2FFILE *f, const char *filename, ERR_BUF *e) { | static int flagopen(NP2FFILE f, const char *filename, ERR_BUF *e) { |
| if (f) { | if (f) { |
| f->fh = file_open(filename); | f->fh = file_open(filename); |
| Line 187 static int flagopen(NP2FFILE *f, const c | Line 185 static int flagopen(NP2FFILE *f, const c |
| return(NP2FLAG_FAILURE); | return(NP2FLAG_FAILURE); |
| } | } |
| static int flagcreate(NP2FFILE *f, const char *filename) { | static int flagcreate(NP2FFILE f, const char *filename) { |
| if (f) { | if (f) { |
| f->fh = file_create(filename); | f->fh = file_create(filename); |
| Line 205 static int flagcreate(NP2FFILE *f, const | Line 203 static int flagcreate(NP2FFILE *f, const |
| return(NP2FLAG_FAILURE); | return(NP2FLAG_FAILURE); |
| } | } |
| static int flagload_create(NP2FFILE *f) { | static int flagload_create(NP2FFILE f) { |
| if (f) { | if (f) { |
| ZeroMemory(&f->p, sizeof(NP2FLAGPART_T)); | ZeroMemory(&f->p, sizeof(NP2FENT)); |
| if (f->pos & 15) { | if (f->pos & 15) { |
| f->pos += 15; | f->pos += 15; |
| f->pos &= ~0xf; | f->pos &= ~0xf; |
| Line 216 static int flagload_create(NP2FFILE *f) | Line 214 static int flagload_create(NP2FFILE *f) |
| return(NP2FLAG_FAILURE); | return(NP2FLAG_FAILURE); |
| } | } |
| } | } |
| if (file_read(f->fh, &f->p, sizeof(NP2FLAGPART_T)) | if (file_read(f->fh, &f->p, sizeof(NP2FENT)) != sizeof(NP2FENT)) { |
| != sizeof(NP2FLAGPART_T)) { | |
| return(NP2FLAG_FAILURE); | return(NP2FLAG_FAILURE); |
| } | } |
| f->pos += sizeof(NP2FLAGPART_T); | f->pos += sizeof(NP2FENT); |
| f->next = f->pos + f->p.size; | f->next = f->pos + f->p.size; |
| return(NP2FLAG_SUCCESS); | return(NP2FLAG_SUCCESS); |
| } | } |
| return(NP2FLAG_FAILURE); | return(NP2FLAG_FAILURE); |
| } | } |
| static int flagload_load(NP2FFILE *f, void *buf, UINT size) { | static int flagload_load(NP2FFILE f, void *buf, UINT size) { |
| if (f && buf && size && (file_read(f->fh, buf, size) == size)) { | if (f && buf && size && (file_read(f->fh, buf, size) == size)) { |
| f->pos += size; | f->pos += size; |
| Line 236 static int flagload_load(NP2FFILE *f, vo | Line 233 static int flagload_load(NP2FFILE *f, vo |
| return(NP2FLAG_FAILURE); | return(NP2FLAG_FAILURE); |
| } | } |
| static int flagload_close(NP2FFILE *f) { | static int flagload_close(NP2FFILE f) { |
| if (file_seek(f->fh, f->next, 0) != f->next) { | if (file_seek(f->fh, f->next, 0) != f->next) { |
| return(NP2FLAG_FAILURE); | return(NP2FLAG_FAILURE); |
| Line 245 static int flagload_close(NP2FFILE *f) { | Line 242 static int flagload_close(NP2FFILE *f) { |
| return(NP2FLAG_SUCCESS); | return(NP2FLAG_SUCCESS); |
| } | } |
| static int flagsave_create(NP2FFILE *f, const STENTRY *t) { | static int flagsave_create(NP2FFILE f, const STENTRY *t) { |
| if (f && t) { | if (f && t) { |
| int len; | int len; |
| ZeroMemory(&f->p, sizeof(NP2FLAGPART_T)); | ZeroMemory(&f->p, sizeof(NP2FENT)); |
| if (f->pos & 15) { | if (f->pos & 15) { |
| UINT rem; | UINT rem; |
| rem = 16 - (f->pos & 15); | rem = 16 - (f->pos & 15); |
| Line 268 static int flagsave_create(NP2FFILE *f, | Line 265 static int flagsave_create(NP2FFILE *f, |
| CopyMemory(f->p.index, t->index, len); | CopyMemory(f->p.index, t->index, len); |
| } | } |
| f->p.ver = t->ver; | f->p.ver = t->ver; |
| if (file_write(f->fh, &f->p, sizeof(NP2FLAGPART_T)) | if (file_write(f->fh, &f->p, sizeof(NP2FENT)) != sizeof(NP2FENT)) { |
| != sizeof(NP2FLAGPART_T)) { | |
| return(NP2FLAG_FAILURE); | return(NP2FLAG_FAILURE); |
| } | } |
| f->pos += sizeof(NP2FLAGPART_T); | f->pos += sizeof(NP2FENT); |
| return(NP2FLAG_SUCCESS); | return(NP2FLAG_SUCCESS); |
| } | } |
| return(NP2FLAG_FAILURE); | return(NP2FLAG_FAILURE); |
| } | } |
| static int flagsave_save(NP2FFILE *f, void *buf, UINT size) { | static int flagsave_save(NP2FFILE f, void *buf, UINT size) { |
| if (f && buf && size && (file_write(f->fh, buf, size) == size)) { | if (f && buf && size && (file_write(f->fh, buf, size) == size)) { |
| f->pos += size; | f->pos += size; |
| Line 288 static int flagsave_save(NP2FFILE *f, vo | Line 284 static int flagsave_save(NP2FFILE *f, vo |
| return(NP2FLAG_FAILURE); | return(NP2FLAG_FAILURE); |
| } | } |
| static int flagsave_close(NP2FFILE *f) { | static int flagsave_close(NP2FFILE f) { |
| if (!f) { | if (!f) { |
| goto fs_closeerr; | goto fs_closeerr; |
| Line 296 static int flagsave_close(NP2FFILE *f) { | Line 292 static int flagsave_close(NP2FFILE *f) { |
| if (file_seek(f->fh, f->bak, 0) != f->bak) { | if (file_seek(f->fh, f->bak, 0) != f->bak) { |
| goto fs_closeerr; | goto fs_closeerr; |
| } | } |
| if (file_write(f->fh, &f->p, sizeof(NP2FLAGPART_T)) | if (file_write(f->fh, &f->p, sizeof(NP2FENT)) != sizeof(NP2FENT)) { |
| != sizeof(NP2FLAGPART_T)) { | |
| goto fs_closeerr; | goto fs_closeerr; |
| } | } |
| if (file_seek(f->fh, f->pos, 0) == f->pos) { | if (file_seek(f->fh, f->pos, 0) == f->pos) { |
| Line 308 fs_closeerr: | Line 303 fs_closeerr: |
| return(NP2FLAG_FAILURE); | return(NP2FLAG_FAILURE); |
| } | } |
| static void flagclose(NP2FFILE *f) { | static void flagclose(NP2FFILE f) { |
| if (f) { | if (f) { |
| file_close(f->fh); | file_close(f->fh); |
| Line 318 static void flagclose(NP2FFILE *f) { | Line 313 static void flagclose(NP2FFILE *f) { |
| // ---- | // ---- |
| static int flagsave_term(NP2FFILE *f, const STENTRY *t) { | static int flagsave_term(NP2FFILE f, const STENTRY *t) { |
| int ret; | int ret; |
| Line 330 static int flagsave_term(NP2FFILE *f, co | Line 325 static int flagsave_term(NP2FFILE *f, co |
| // ---- | // ---- |
| static int flagsave_common(NP2FFILE *f, const STENTRY *t) { | static int flagsave_common(NP2FFILE f, const STENTRY *t) { |
| int ret; | int ret; |
| Line 342 static int flagsave_common(NP2FFILE *f, | Line 337 static int flagsave_common(NP2FFILE *f, |
| return(ret); | return(ret); |
| } | } |
| static int flagload_common(NP2FFILE *f, const STENTRY *t) { | static int flagload_common(NP2FFILE f, const STENTRY *t) { |
| return(flagload_load(f, t->arg1, t->arg2)); | return(flagload_load(f, t->arg1, t->arg2)); |
| } | } |
| Line 350 static int flagload_common(NP2FFILE *f, | Line 345 static int flagload_common(NP2FFILE *f, |
| // ----- | // ----- |
| static int flagsave_286(NP2FFILE *f, const STENTRY *t) { | static int flagload_clock(NP2FFILE f, const STENTRY *t) { |
| int ret; | |
| ret = flagsave_create(f, t); | |
| if (ret != NP2FLAG_FAILURE) { | |
| ret |= flagsave_save(f, &i286r, sizeof(I286REGS)); | |
| ret |= flagsave_save(f, &i286s, sizeof(I286STAT)); | |
| ret |= flagsave_close(f); | |
| } | |
| return(ret); | |
| } | |
| static int flagload_286(NP2FFILE *f, const STENTRY *t) { | |
| int ret; | |
| ret = flagload_load(f, &i286r, sizeof(I286REGS)); | |
| ret |= flagload_load(f, &i286s, sizeof(I286STAT)); | |
| (void)t; | |
| return(ret); | |
| } | |
| // ----- | |
| static int flagload_core(NP2FFILE *f, const STENTRY *t) { | |
| int ret; | int ret; |
| ret = flagload_common(f, t); | ret = flagload_common(f, t); |
| if (opna_rate) { | sound_changeclock(); |
| pc.sampleclock = (pc.realclock / opna_rate) + 1; | beep_changeclock(); |
| } | |
| else { | |
| pc.sampleclock = 0; | |
| } | |
| return(ret); | return(ret); |
| } | } |
| // ----- | // ----- |
| static int flagsave_dma(NP2FFILE *f, const STENTRY *t) { | static int flagsave_dma(NP2FFILE f, const STENTRY *t) { |
| int ret; | int ret; |
| int i; | int i; |
| Line 415 static int flagsave_dma(NP2FFILE *f, con | Line 380 static int flagsave_dma(NP2FFILE *f, con |
| return(ret); | return(ret); |
| } | } |
| static int flagload_dma(NP2FFILE *f, const STENTRY *t) { | static int flagload_dma(NP2FFILE f, const STENTRY *t) { |
| int ret; | int ret; |
| int i; | int i; |
| Line 443 static int flagload_dma(NP2FFILE *f, con | Line 408 static int flagload_dma(NP2FFILE *f, con |
| // ----- | // ----- |
| static int flagsave_egc(NP2FFILE *f, const STENTRY *t) { | static int flagsave_egc(NP2FFILE f, const STENTRY *t) { |
| int ret; | int ret; |
| _EGC egcbak; | _EGC egcbak; |
| Line 460 static int flagsave_egc(NP2FFILE *f, con | Line 425 static int flagsave_egc(NP2FFILE *f, con |
| return(ret); | return(ret); |
| } | } |
| static int flagload_egc(NP2FFILE *f, const STENTRY *t) { | static int flagload_egc(NP2FFILE f, const STENTRY *t) { |
| int ret; | int ret; |
| Line 474 static int flagload_egc(NP2FFILE *f, con | Line 439 static int flagload_egc(NP2FFILE *f, con |
| // ----- | // ----- |
| static int flagsave_ext(NP2FFILE *f, const STENTRY *t) { | static int flagsave_ext(NP2FFILE f, const STENTRY *t) { |
| int ret; | int ret; |
| Line 489 static int flagsave_ext(NP2FFILE *f, con | Line 454 static int flagsave_ext(NP2FFILE *f, con |
| return(ret); | return(ret); |
| } | } |
| static int flagload_ext(NP2FFILE *f, const STENTRY *t) { | static int flagload_ext(NP2FFILE f, const STENTRY *t) { |
| int ret; | int ret; |
| int i; | int i; |
| Line 526 static int flagload_ext(NP2FFILE *f, con | Line 491 static int flagload_ext(NP2FFILE *f, con |
| // ----- | // ----- |
| typedef struct { | typedef struct { |
| SINT32 remainclock; | |
| SINT32 baseclock; | |
| UINT32 clock; | |
| UINT readyevents; | UINT readyevents; |
| UINT waitevents; | UINT waitevents; |
| } NEVTSAVE; | } NEVTSAVE; |
| Line 540 typedef struct { | Line 502 typedef struct { |
| NEVENTCB proc; | NEVENTCB proc; |
| } NEVTITEM; | } NEVTITEM; |
| static int nevent_save(NP2FFILE *f, int num) { | static int nevent_save(NP2FFILE f, int num) { |
| NEVTITEM nit; | NEVTITEM nit; |
| int i; | UINT i; |
| ZeroMemory(&nit, sizeof(nit)); | ZeroMemory(&nit, sizeof(nit)); |
| for (i=0; i<sizeof(evtnum)/sizeof(ENUMTBL); i++) { | for (i=0; i<sizeof(evtnum)/sizeof(ENUMTBL); i++) { |
| Line 561 static int nevent_save(NP2FFILE *f, int | Line 523 static int nevent_save(NP2FFILE *f, int |
| return(flagsave_save(f, &nit, sizeof(nit))); | return(flagsave_save(f, &nit, sizeof(nit))); |
| } | } |
| static int flagsave_evt(NP2FFILE *f, const STENTRY *t) { | static int flagsave_evt(NP2FFILE f, const STENTRY *t) { |
| NEVTSAVE nevt; | NEVTSAVE nevt; |
| int ret; | int ret; |
| UINT i; | UINT i; |
| nevt.remainclock = nevent.remainclock; | |
| nevt.baseclock = nevent.baseclock; | |
| nevt.clock = nevent.clock; | |
| nevt.readyevents = nevent.readyevents; | nevt.readyevents = nevent.readyevents; |
| nevt.waitevents = nevent.waitevents; | nevt.waitevents = nevent.waitevents; |
| Line 587 static int flagsave_evt(NP2FFILE *f, con | Line 546 static int flagsave_evt(NP2FFILE *f, con |
| return(ret); | return(ret); |
| } | } |
| static int nevent_load(NP2FFILE *f, UINT *tbl, UINT *pos) { | static int nevent_load(NP2FFILE f, UINT *tbl, UINT *pos) { |
| int ret; | int ret; |
| NEVTITEM nit; | NEVTITEM nit; |
| Line 620 static int nevent_load(NP2FFILE *f, UINT | Line 579 static int nevent_load(NP2FFILE *f, UINT |
| return(ret); | return(ret); |
| } | } |
| static int flagload_evt(NP2FFILE *f, const STENTRY *t) { | static int flagload_evt(NP2FFILE f, const STENTRY *t) { |
| int ret; | int ret; |
| NEVTSAVE nevt; | NEVTSAVE nevt; |
| Line 628 static int flagload_evt(NP2FFILE *f, con | Line 587 static int flagload_evt(NP2FFILE *f, con |
| ret = flagload_load(f, &nevt, sizeof(nevt)); | ret = flagload_load(f, &nevt, sizeof(nevt)); |
| nevent.remainclock = nevt.remainclock; | |
| nevent.baseclock = nevt.baseclock; | |
| nevent.clock = nevt.clock; | |
| nevent.readyevents = 0; | nevent.readyevents = 0; |
| nevent.waitevents = 0; | nevent.waitevents = 0; |
| Line 647 static int flagload_evt(NP2FFILE *f, con | Line 603 static int flagload_evt(NP2FFILE *f, con |
| // ---- | // ---- |
| static int flagsave_gij(NP2FFILE *f, const STENTRY *t) { | static int flagsave_gij(NP2FFILE f, const STENTRY *t) { |
| int ret; | int ret; |
| int i; | int i; |
| Line 668 static int flagsave_gij(NP2FFILE *f, con | Line 624 static int flagsave_gij(NP2FFILE *f, con |
| return(ret); | return(ret); |
| } | } |
| static int flagload_gij(NP2FFILE *f, const STENTRY *t) { | static int flagload_gij(NP2FFILE f, const STENTRY *t) { |
| int ret; | int ret; |
| int i; | int i; |
| Line 709 typedef struct { | Line 665 typedef struct { |
| BYTE extop[4]; | BYTE extop[4]; |
| } OPNKEY; | } OPNKEY; |
| static int flagsave_fm(NP2FFILE *f, const STENTRY *t) { | static int flagsave_fm(NP2FFILE f, const STENTRY *t) { |
| int ret; | int ret; |
| UINT saveflg; | UINT saveflg; |
| Line 769 static int flagsave_fm(NP2FFILE *f, cons | Line 725 static int flagsave_fm(NP2FFILE *f, cons |
| if (saveflg & FLAG_FM1A) { | if (saveflg & FLAG_FM1A) { |
| ret |= flagsave_save(f, &fmtimer, sizeof(fmtimer)); | ret |= flagsave_save(f, &fmtimer, sizeof(fmtimer)); |
| ret |= flagsave_save(f, &opn, sizeof(opn)); | ret |= flagsave_save(f, &opn, sizeof(opn)); |
| CopyMemory(opnkey.keyreg, fm_keyreg, sizeof(fm_keyreg)); | CopyMemory(opnkey.keyreg, opngen.keyreg, sizeof(opngen.keyreg)); |
| opnkey.extop[0] = opnch[2].extop; | opnkey.extop[0] = opnch[2].extop; |
| opnkey.extop[1] = opnch[5].extop; | opnkey.extop[1] = opnch[5].extop; |
| opnkey.extop[2] = opnch[8].extop; | opnkey.extop[2] = opnch[8].extop; |
| Line 811 static void play_fmreg(BYTE num) { | Line 767 static void play_fmreg(BYTE num) { |
| opngen_setreg((BYTE)chbase, (BYTE)i, opn.reg[reg + i]); | opngen_setreg((BYTE)chbase, (BYTE)i, opn.reg[reg + i]); |
| } | } |
| for (i=0; i<3; i++) { | for (i=0; i<3; i++) { |
| opngen_keyon(chbase + i, fm_keyreg[chbase + i]); | opngen_keyon(chbase + i, opngen.keyreg[chbase + i]); |
| } | } |
| } | } |
| Line 824 static void play_psgreg(PSGGEN psg) { | Line 780 static void play_psgreg(PSGGEN psg) { |
| } | } |
| } | } |
| static int flagload_fm(NP2FFILE *f, const STENTRY *t) { | static int flagload_fm(NP2FFILE f, const STENTRY *t) { |
| int ret; | int ret; |
| UINT saveflg; | UINT saveflg; |
| Line 882 static int flagload_fm(NP2FFILE *f, cons | Line 838 static int flagload_fm(NP2FFILE *f, cons |
| break; | break; |
| default: | default: |
| saveflg = 0; | |
| break; | break; |
| } | } |
| Line 894 static int flagload_fm(NP2FFILE *f, cons | Line 851 static int flagload_fm(NP2FFILE *f, cons |
| ret |= flagload_load(f, &fmtimer, sizeof(fmtimer)); | ret |= flagload_load(f, &fmtimer, sizeof(fmtimer)); |
| ret |= flagload_load(f, &opn, sizeof(opn)); | ret |= flagload_load(f, &opn, sizeof(opn)); |
| ret |= flagload_load(f, &opnkey, sizeof(opnkey)); | ret |= flagload_load(f, &opnkey, sizeof(opnkey)); |
| CopyMemory(fm_keyreg, &opnkey.keyreg, sizeof(fm_keyreg)); | CopyMemory(opngen.keyreg, &opnkey.keyreg, sizeof(opngen.keyreg)); |
| opnch[2].extop = opnkey.extop[0]; | opnch[2].extop = opnkey.extop[0]; |
| opnch[5].extop = opnkey.extop[1]; | opnch[5].extop = opnkey.extop[1]; |
| opnch[8].extop = opnkey.extop[2]; | opnch[8].extop = opnkey.extop[2]; |
| Line 960 typedef struct { | Line 917 typedef struct { |
| DOSTIME time; | DOSTIME time; |
| } STATDISK; | } STATDISK; |
| static int disksave(NP2FFILE *f, const char *path, int readonly) { | static int disksave(NP2FFILE f, const char *path, int readonly) { |
| STATDISK st; | STATDISK st; |
| FILEH fh; | FILEH fh; |
| Line 978 static int disksave(NP2FFILE *f, const c | Line 935 static int disksave(NP2FFILE *f, const c |
| return(flagsave_save(f, &st, sizeof(st))); | return(flagsave_save(f, &st, sizeof(st))); |
| } | } |
| static int flagsave_disk(NP2FFILE *f, const STENTRY *t) { | static int flagsave_disk(NP2FFILE f, const STENTRY *t) { |
| int ret; | int ret; |
| BYTE i; | BYTE i; |
| Line 1000 static int flagsave_disk(NP2FFILE *f, co | Line 957 static int flagsave_disk(NP2FFILE *f, co |
| return(ret); | return(ret); |
| } | } |
| static int diskcheck(NP2FFILE *f, const char *name, ERR_BUF *e) { | static int diskcheck(NP2FFILE f, const char *name, ERR_BUF *e) { |
| int ret; | int ret; |
| FILEH fh; | FILEH fh; |
| Line 1031 static int diskcheck(NP2FFILE *f, const | Line 988 static int diskcheck(NP2FFILE *f, const |
| return(ret); | return(ret); |
| } | } |
| static int flagcheck_disk(NP2FFILE *f, const STENTRY *t, ERR_BUF *e) { | static int flagcheck_disk(NP2FFILE f, const STENTRY *t, ERR_BUF *e) { |
| int ret; | int ret; |
| int i; | int i; |
| Line 1055 static int flagcheck_disk(NP2FFILE *f, c | Line 1012 static int flagcheck_disk(NP2FFILE *f, c |
| return(ret); | return(ret); |
| } | } |
| static int flagload_disk(NP2FFILE *f, const STENTRY *t) { | static int flagload_disk(NP2FFILE f, const STENTRY *t) { |
| int ret; | int ret; |
| BYTE i; | BYTE i; |
| Line 1091 static int flagload_disk(NP2FFILE *f, co | Line 1048 static int flagload_disk(NP2FFILE *f, co |
| // ----- | // ----- |
| #ifdef _MIDICH | #ifdef _MIDICH |
| static int flagsave_midi(NP2FFILE *f, const STENTRY *t) { | static int flagsave_midi(NP2FFILE f, const STENTRY *t) { |
| UINT device; | UINT device; |
| COMMNG cm; | COMMNG cm; |
| Line 1123 static int flagsave_midi(NP2FFILE *f, co | Line 1080 static int flagsave_midi(NP2FFILE *f, co |
| return(ret); | return(ret); |
| } | } |
| static int flagload_midi(NP2FFILE *f, const STENTRY *t) { | static int flagload_midi(NP2FFILE f, const STENTRY *t) { |
| _MIDICH mch[16]; | _MIDICH mch[16]; |
| UINT device; | UINT device; |
| Line 1161 static int flagload_midi(NP2FFILE *f, co | Line 1118 static int flagload_midi(NP2FFILE *f, co |
| // ---- | // ---- |
| static int flagcheck_versize(NP2FFILE *f, const STENTRY *t, ERR_BUF *e) { | static int flagcheck_versize(NP2FFILE f, const STENTRY *t, ERR_BUF *e) { |
| if ((f) && (t)) { | if ((f) && (t)) { |
| if ((f->p.ver == t->ver) && (f->p.size == t->arg2)) { | if ((f->p.ver == t->ver) && (f->p.size == t->arg2)) { |
| Line 1173 static int flagcheck_versize(NP2FFILE *f | Line 1130 static int flagcheck_versize(NP2FFILE *f |
| return(NP2FLAG_FAILURE); | return(NP2FLAG_FAILURE); |
| } | } |
| static int flagcheck_veronly(NP2FFILE *f, const STENTRY *t, ERR_BUF *e) { | static int flagcheck_veronly(NP2FFILE f, const STENTRY *t, ERR_BUF *e) { |
| if ((f) && (t)) { | if ((f) && (t)) { |
| if (f->p.ver == t->ver) { | if (f->p.ver == t->ver) { |
| Line 1190 static int flagcheck_veronly(NP2FFILE *f | Line 1147 static int flagcheck_veronly(NP2FFILE *f |
| int statsave_save(const char *filename) { | int statsave_save(const char *filename) { |
| NP2FFILE f; | _NP2FFILE f; |
| int ret; | int ret; |
| int i; | UINT i; |
| ret = flagcreate(&f, filename); | ret = flagcreate(&f, filename); |
| if (ret == NP2FLAG_FAILURE) { | if (ret == NP2FLAG_FAILURE) { |
| Line 1201 int statsave_save(const char *filename) | Line 1158 int statsave_save(const char *filename) |
| for (i=0; i<sizeof(np2tbl)/sizeof(STENTRY); i++) { | for (i=0; i<sizeof(np2tbl)/sizeof(STENTRY); i++) { |
| switch(np2tbl[i].type) { | switch(np2tbl[i].type) { |
| case NP2FLAG_BIN: | case NP2FLAG_BIN: |
| case NP2FLAG_CORE: | case NP2FLAG_CLOCK: |
| case NP2FLAG_BEEP: | |
| ret |= flagsave_common(&f, &np2tbl[i]); | ret |= flagsave_common(&f, &np2tbl[i]); |
| break; | break; |
| Line 1210 int statsave_save(const char *filename) | Line 1166 int statsave_save(const char *filename) |
| ret |= flagsave_term(&f, &np2tbl[i]); | ret |= flagsave_term(&f, &np2tbl[i]); |
| break; | break; |
| case NP2FLAG_286: | |
| ret |= flagsave_286(&f, &np2tbl[i]); | |
| break; | |
| case NP2FLAG_DMA: | case NP2FLAG_DMA: |
| ret |= flagsave_dma(&f, &np2tbl[i]); | ret |= flagsave_dma(&f, &np2tbl[i]); |
| break; | break; |
| Line 1255 int statsave_save(const char *filename) | Line 1207 int statsave_save(const char *filename) |
| int statsave_check(const char *filename, char *buf, int size) { | int statsave_check(const char *filename, char *buf, int size) { |
| NP2FFILE f; | _NP2FFILE f; |
| int ret; | int ret; |
| int i; | UINT i; |
| BOOL done; | BOOL done; |
| ERR_BUF e; | ERR_BUF e; |
| Line 1289 int statsave_check(const char *filename, | Line 1241 int statsave_check(const char *filename, |
| if (i < (sizeof(np2tbl)/sizeof(STENTRY))) { | if (i < (sizeof(np2tbl)/sizeof(STENTRY))) { |
| switch(np2tbl[i].type) { | switch(np2tbl[i].type) { |
| case NP2FLAG_BIN: | case NP2FLAG_BIN: |
| case NP2FLAG_CLOCK: | |
| ret |= flagcheck_versize(&f, &np2tbl[i], &e); | ret |= flagcheck_versize(&f, &np2tbl[i], &e); |
| break; | break; |
| Line 1296 int statsave_check(const char *filename, | Line 1249 int statsave_check(const char *filename, |
| done = TRUE; | done = TRUE; |
| break; | break; |
| case NP2FLAG_286: | |
| case NP2FLAG_CORE: | |
| case NP2FLAG_DMA: | case NP2FLAG_DMA: |
| case NP2FLAG_EGC: | case NP2FLAG_EGC: |
| case NP2FLAG_EXT: | case NP2FLAG_EXT: |
| case NP2FLAG_EVT: | case NP2FLAG_EVT: |
| case NP2FLAG_GIJ: | case NP2FLAG_GIJ: |
| case NP2FLAG_BEEP: | |
| #if defined(MIDICH) | #if defined(MIDICH) |
| case NP2FLAG_MIDI: | case NP2FLAG_MIDI: |
| #endif | #endif |
| Line 1337 int statsave_check(const char *filename, | Line 1287 int statsave_check(const char *filename, |
| int statsave_load(const char *filename) { | int statsave_load(const char *filename) { |
| NP2FFILE f; | _NP2FFILE f; |
| int ret; | int ret; |
| int i; | UINT i; |
| BOOL done; | BOOL done; |
| ret = flagopen(&f, filename, NULL); | ret = flagopen(&f, filename, NULL); |
| Line 1368 int statsave_load(const char *filename) | Line 1318 int statsave_load(const char *filename) |
| if (i < (sizeof(np2tbl)/sizeof(STENTRY))) { | if (i < (sizeof(np2tbl)/sizeof(STENTRY))) { |
| switch(np2tbl[i].type) { | switch(np2tbl[i].type) { |
| case NP2FLAG_BIN: | case NP2FLAG_BIN: |
| case NP2FLAG_BEEP: | |
| ret |= flagload_common(&f, &np2tbl[i]); | ret |= flagload_common(&f, &np2tbl[i]); |
| break; | break; |
| Line 1376 int statsave_load(const char *filename) | Line 1325 int statsave_load(const char *filename) |
| done = TRUE; | done = TRUE; |
| break; | break; |
| case NP2FLAG_286: | case NP2FLAG_CLOCK: |
| ret |= flagload_286(&f, &np2tbl[i]); | ret |= flagload_clock(&f, &np2tbl[i]); |
| break; | |
| case NP2FLAG_CORE: | |
| ret |= flagload_core(&f, &np2tbl[i]); | |
| break; | break; |
| case NP2FLAG_DMA: | case NP2FLAG_DMA: |