games/snes: save more audio state

This commit is contained in:
aiju 2014-11-17 17:00:41 +01:00
parent dbb320ca90
commit 844612fcb8
3 changed files with 56 additions and 0 deletions

View file

@ -535,6 +535,50 @@ dspreset(void)
dsp[FLG] = 0xe0; dsp[FLG] = 0xe0;
} }
void
dspsave(void)
{
vctxt *p;
for(p = vctxts; p < vctxts + nelem(vctxts); p++){
put16(p->hdrp);
put16(p->dp);
put16(p->sp);
put8(p->hdr);
put8(p->bp);
put16(p->brr);
put8(p->envst);
put16(p->env);
put16(p->envbent);
put8(p->init);
put16(p->interp);
put16(p->pitch);
put16(p->modin);
}
}
void
dspload(void)
{
vctxt *p;
for(p = vctxts; p < vctxts + nelem(vctxts); p++){
p->hdrp = get16();
p->dp = get16();
p->sp = get16();
p->hdr = get8();
p->bp = get8();
p->brr = get16();
p->envst = get8();
p->env = get16();
p->envbent = get16();
p->init = get8();
p->interp = get16();
p->pitch = get16();
p->modin = get16();
}
}
u16int gauss[512] = { u16int gauss[512] = {
0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000,
0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000,

View file

@ -20,3 +20,11 @@ int audioout(void);
void flushram(void); void flushram(void);
void loadstate(char *); void loadstate(char *);
void savestate(char *); void savestate(char *);
void dspsave(void);
void dspload(void);
int get8(void);
int get16(void);
int get32(void);
void put8(u8int);
void put16(u16int);
void put32(u32int);

View file

@ -128,6 +128,8 @@ loadstate(char *file)
dspstate = get8(); dspstate = get8();
dspcounter = get16(); dspcounter = get16();
noise = get16(); noise = get16();
Bread(bp, spctimer, sizeof(spctimer));
dspload();
Bterm(bp); Bterm(bp);
} }
@ -186,5 +188,7 @@ savestate(char *file)
put8(dspstate); put8(dspstate);
put16(dspcounter); put16(dspcounter);
put16(noise); put16(noise);
Bwrite(bp, spctimer, sizeof(spctimer));
dspsave();
Bterm(bp); Bterm(bp);
} }