Skip to content

Commit a2640fe

Browse files
committed
Merge branch 'master' into libretro
2 parents e217308 + 5d8bdd1 commit a2640fe

File tree

17 files changed

+165
-172
lines changed

17 files changed

+165
-172
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -497,7 +497,7 @@ frontend/libpicofe/%.c:
497497
@exit 1
498498

499499
libpcsxcore/gte_nf.o: libpcsxcore/gte.c
500-
$(CC) -c -o $@ $^ $(CFLAGS) $(AUTODEPFLAGS) -DFLAGLESS
500+
$(CC) -c -o $@ $< $(CFLAGS) $(AUTODEPFLAGS) -DFLAGLESS
501501

502502
include/revision.h: FORCE
503503
@(git describe --always || echo) | sed -e 's/.*/#define REV "\0"/' > $@_

include/psemu_plugin_defs.h

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,34 @@ typedef struct PadDataS
241241
unsigned char reserved[22];
242242
} PadDataS;
243243

244+
typedef struct {
245+
int y0, y1;
246+
} ADPCM_Decode_t;
247+
248+
typedef struct xa_decode {
249+
int freq;
250+
int nbits;
251+
int stereo;
252+
int nsamples;
253+
ADPCM_Decode_t left, right;
254+
short pcm[16384];
255+
} xa_decode_t;
256+
257+
typedef struct {
258+
char PluginName[8];
259+
unsigned int PluginVersion;
260+
unsigned int Size;
261+
} SPUFreezeHdr_t;
262+
263+
typedef struct SPUFreeze {
264+
char PluginName[8];
265+
unsigned int PluginVersion;
266+
unsigned int Size;
267+
unsigned char SPUPorts[0x200];
268+
unsigned char SPURam[0x80000];
269+
xa_decode_t xa;
270+
} SPUFreeze_t;
271+
244272
/* NET PlugIn v2 */
245273
/* Added by [email protected] */
246274

libpcsxcore/decode_xa.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
*/
2323

2424
#include "decode_xa.h"
25+
#include "psemu_plugin_defs.h"
2526

2627
#define FIXED
2728

libpcsxcore/decode_xa.h

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -26,20 +26,9 @@ extern "C" {
2626

2727
#include "psxcommon.h"
2828

29-
typedef struct {
30-
s32 y0, y1;
31-
} ADPCM_Decode_t;
29+
struct xa_decode;
3230

33-
typedef struct xa_decode {
34-
int freq;
35-
int nbits;
36-
int stereo;
37-
int nsamples;
38-
ADPCM_Decode_t left, right;
39-
short pcm[16384];
40-
} xa_decode_t;
41-
42-
s32 xa_decode_sector( xa_decode_t *xdp,
31+
s32 xa_decode_sector( struct xa_decode *xdp,
4332
const unsigned char *sectorp,
4433
int is_first_sector );
4534

libpcsxcore/misc.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -767,6 +767,7 @@ int SaveState(const char *file) {
767767
gpufP = (GPUFreeze_t *)malloc(sizeof(GPUFreeze_t));
768768
if (gpufP == NULL) goto cleanup;
769769
gpufP->ulFreezeVersion = 1;
770+
memset(gpufP->ulControl, 0, sizeof(gpufP->ulControl));
770771
GPU_freeze(1, gpufP);
771772
SaveFuncs.write(f, gpufP, sizeof(GPUFreeze_t));
772773
free(gpufP); gpufP = NULL;

libpcsxcore/plugins.h

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -100,20 +100,6 @@ typedef void (CALLBACK* SPUreadDMAMem)(unsigned short *, int, unsigned int);
100100
typedef void (CALLBACK* SPUplayADPCMchannel)(xa_decode_t *, unsigned int, int);
101101
typedef void (CALLBACK* SPUregisterCallback)(void (CALLBACK *callback)(int));
102102
typedef void (CALLBACK* SPUregisterScheduleCb)(void (CALLBACK *callback)(unsigned int cycles_after));
103-
typedef struct {
104-
unsigned char PluginName[8];
105-
uint32_t PluginVersion;
106-
uint32_t Size;
107-
} SPUFreezeHdr_t;
108-
typedef struct SPUFreeze {
109-
unsigned char PluginName[8];
110-
uint32_t PluginVersion;
111-
uint32_t Size;
112-
unsigned char SPUPorts[0x200];
113-
unsigned char SPURam[0x80000];
114-
xa_decode_t xa;
115-
unsigned char *unused;
116-
} SPUFreeze_t;
117103
typedef long (CALLBACK* SPUfreeze)(unsigned int, struct SPUFreeze *, unsigned int);
118104
typedef void (CALLBACK* SPUasync)(unsigned int, unsigned int);
119105
typedef int (CALLBACK* SPUplayCDDAchannel)(short *, int, unsigned int, int);

plugins/dfsound/externals.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,8 @@ typedef struct
9090
int StepCounter; // 0 -> 32k
9191
} ADSRInfoEx;
9292

93+
struct xa_decode;
94+
9395
///////////////////////////////////////////////////////////
9496

9597
// MAIN CHANNEL STRUCT
@@ -244,7 +246,7 @@ typedef struct
244246
//void (CALLBACK *cddavCallback)(short, short);
245247
void (CALLBACK *scheduleCallback)(unsigned int);
246248

247-
const xa_decode_t * xapGlobal;
249+
const struct xa_decode * xapGlobal;
248250
unsigned int * XAFeed;
249251
unsigned int * XAPlay;
250252
unsigned int * XAStart;
@@ -294,7 +296,7 @@ void do_irq_io(int cycles_after);
294296

295297
#endif
296298

297-
void FeedXA(const xa_decode_t *xap);
299+
void FeedXA(const struct xa_decode *xap);
298300
void FeedCDDA(unsigned char *pcm, int nBytes);
299301

300302
#endif /* __P_SOUND_EXTERNALS_H__ */

plugins/dfsound/freeze.c

Lines changed: 22 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#include "externals.h"
2525
#include "registers.h"
2626
#include "spu.h"
27+
#include "psemu_plugin_defs.h"
2728

2829
////////////////////////////////////////////////////////////////////////
2930
// freeze structs
@@ -108,16 +109,6 @@ typedef struct
108109
ADSRInfoEx_orig ADSRX; // next ADSR settings (will be moved to active on sample start)
109110
} SPUCHAN_orig;
110111

111-
typedef struct SPUFreeze
112-
{
113-
char szSPUName[8];
114-
uint32_t ulFreezeVersion;
115-
uint32_t ulFreezeSize;
116-
unsigned char cSPUPort[0x200];
117-
unsigned char cSPURam[0x80000];
118-
xa_decode_t xaS;
119-
} SPUFreeze_t;
120-
121112
typedef struct
122113
{
123114
unsigned short spuIrq;
@@ -261,23 +252,23 @@ long DoFreeze(unsigned int ulFreezeMode, SPUFreeze_t * pF,
261252
if(ulFreezeMode==1)
262253
memset(pF,0,sizeof(SPUFreeze_t)+sizeof(SPUOSSFreeze_t));
263254

264-
strcpy(pF->szSPUName,"PBOSS");
265-
pF->ulFreezeVersion=5;
266-
pF->ulFreezeSize=sizeof(SPUFreeze_t)+sizeof(SPUOSSFreeze_t);
255+
strcpy(pF->PluginName, "PBOSS");
256+
pF->PluginVersion = 5;
257+
pF->Size = sizeof(SPUFreeze_t)+sizeof(SPUOSSFreeze_t);
267258

268259
if(ulFreezeMode==2) return 1; // info mode? ok, bye
269260
// save mode:
270261
regAreaGet(H_SPUctrl) = spu.spuCtrl;
271262
regAreaGet(H_SPUstat) = spu.spuStat;
272-
memcpy(pF->cSPURam,spu.spuMem,0x80000); // copy common infos
273-
memcpy(pF->cSPUPort,spu.regArea,0x200);
263+
memcpy(pF->SPURam, spu.spuMem, 0x80000); // copy common infos
264+
memcpy(pF->SPUPorts, spu.regArea, 0x200);
274265

275266
if(spu.xapGlobal && spu.XAPlay!=spu.XAFeed) // some xa
276267
{
277268
xa_left = spu.XAFeed - spu.XAPlay;
278269
if (xa_left < 0)
279270
xa_left = spu.XAEnd - spu.XAPlay + spu.XAFeed - spu.XAStart;
280-
pF->xaS = *spu.xapGlobal;
271+
pF->xa = *spu.xapGlobal;
281272
}
282273
else if (spu.CDDAPlay != spu.CDDAFeed)
283274
{
@@ -286,19 +277,19 @@ long DoFreeze(unsigned int ulFreezeMode, SPUFreeze_t * pF,
286277
cdda_left = spu.CDDAFeed - spu.CDDAPlay;
287278
if (cdda_left < 0)
288279
cdda_left = spu.CDDAEnd - spu.CDDAPlay + spu.CDDAFeed - spu.CDDAStart;
289-
if (cdda_left > sizeof(pF->xaS.pcm) / 4)
290-
cdda_left = sizeof(pF->xaS.pcm) / 4;
280+
if (cdda_left > sizeof(pF->xa.pcm) / 4)
281+
cdda_left = sizeof(pF->xa.pcm) / 4;
291282
if (p + cdda_left <= spu.CDDAEnd)
292-
memcpy(pF->xaS.pcm, p, cdda_left * 4);
283+
memcpy(pF->xa.pcm, p, cdda_left * 4);
293284
else {
294-
memcpy(pF->xaS.pcm, p, (spu.CDDAEnd - p) * 4);
295-
memcpy((char *)pF->xaS.pcm + (spu.CDDAEnd - p) * 4, spu.CDDAStart,
285+
memcpy(pF->xa.pcm, p, (spu.CDDAEnd - p) * 4);
286+
memcpy((char *)pF->xa.pcm + (spu.CDDAEnd - p) * 4, spu.CDDAStart,
296287
(cdda_left - (spu.CDDAEnd - p)) * 4);
297288
}
298-
pF->xaS.nsamples = 0;
289+
pF->xa.nsamples = 0;
299290
}
300291
else
301-
memset(&pF->xaS,0,sizeof(xa_decode_t)); // or clean xa
292+
memset(&pF->xa, 0, sizeof(xa_decode_t)); // or clean xa
302293

303294
pFO=(SPUOSSFreeze_t *)(pF+1); // store special stuff
304295

@@ -338,27 +329,27 @@ long DoFreeze(unsigned int ulFreezeMode, SPUFreeze_t * pF,
338329

339330
if(ulFreezeMode!=0) return 0; // bad mode? bye
340331

341-
memcpy(spu.spuMem,pF->cSPURam,0x80000); // get ram
342-
memcpy(spu.regArea,pF->cSPUPort,0x200);
332+
memcpy(spu.spuMem, pF->SPURam, 0x80000); // get ram
333+
memcpy(spu.regArea, pF->SPUPorts, 0x200);
343334
spu.bMemDirty = 1;
344335
spu.spuCtrl = regAreaGet(H_SPUctrl);
345336
spu.spuStat = regAreaGet(H_SPUstat);
346337

347-
if (!strcmp(pF->szSPUName,"PBOSS") && pF->ulFreezeVersion==5)
338+
if (!strcmp(pF->PluginName, "PBOSS") && pF->PluginVersion == 5)
348339
pFO = LoadStateV5(pF, cycles);
349340
else LoadStateUnknown(pF, cycles);
350341

351342
spu.XAPlay = spu.XAFeed = spu.XAStart;
352343
spu.CDDAPlay = spu.CDDAFeed = spu.CDDAStart;
353344
spu.cdClearSamples = 512;
354-
if (pFO && pFO->xa_left && pF->xaS.nsamples) { // start xa again
355-
FeedXA(&pF->xaS);
345+
if (pFO && pFO->xa_left && pF->xa.nsamples) { // start xa again
346+
FeedXA(&pF->xa);
356347
spu.XAPlay = spu.XAFeed - pFO->xa_left;
357348
if (spu.XAPlay < spu.XAStart)
358349
spu.XAPlay = spu.XAStart;
359350
}
360351
else if (pFO && pFO->cdda_left) { // start cdda again
361-
FeedCDDA((void *)pF->xaS.pcm, pFO->cdda_left * 4);
352+
FeedCDDA((void *)pF->xa.pcm, pFO->cdda_left * 4);
362353
}
363354

364355
// not in old savestates
@@ -370,7 +361,7 @@ long DoFreeze(unsigned int ulFreezeMode, SPUFreeze_t * pF,
370361
spu.XALastVal = 0;
371362
spu.last_keyon_cycles = cycles - 16*786u;
372363
spu.interpolation = -1;
373-
if (pFO && pF->ulFreezeSize >= sizeof(*pF) + offsetof(SPUOSSFreeze_t, rvb_sb)) {
364+
if (pFO && pF->Size >= sizeof(*pF) + offsetof(SPUOSSFreeze_t, rvb_sb)) {
374365
spu.cycles_dma_end = pFO->cycles_dma_end;
375366
spu.decode_dirty_ch = pFO->decode_dirty_ch;
376367
spu.dwNoiseVal = pFO->dwNoiseVal;
@@ -379,7 +370,7 @@ long DoFreeze(unsigned int ulFreezeMode, SPUFreeze_t * pF,
379370
spu.XALastVal = pFO->XALastVal;
380371
spu.last_keyon_cycles = pFO->last_keyon_cycles;
381372
}
382-
if (pFO && pF->ulFreezeSize >= sizeof(*pF) + sizeof(*pFO)) {
373+
if (pFO && pF->Size >= sizeof(*pF) + sizeof(*pFO)) {
383374
for (i = 0; i < 2; i++)
384375
for (j = 0; j < 2; j++)
385376
memcpy(&sb_rvb->SB_rvb[i][j*4], pFO->rvb_sb[i], 4 * sizeof(sb_rvb->SB_rvb[i][0]));

plugins/dfsound/psemuxa.h

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,9 @@
66
#ifndef DECODEXA_H
77
#define DECODEXA_H
88

9-
typedef struct
10-
{
11-
int y0, y1;
12-
} ADPCM_Decode_t;
9+
struct xa_decode;
1310

14-
typedef struct xa_decode
15-
{
16-
int freq;
17-
int nbits;
18-
int stereo;
19-
int nsamples;
20-
ADPCM_Decode_t left, right;
21-
short pcm[16384];
22-
} xa_decode_t;
23-
24-
int xa_decode_sector( xa_decode_t *xdp,
11+
int xa_decode_sector( struct xa_decode *xdp,
2512
unsigned char *sectorp,
2613
int is_first_sector );
2714

plugins/dfsound/xa.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include "spu.h"
2020
#define _IN_XA
2121
#include <stdint.h>
22+
#include "psemu_plugin_defs.h"
2223

2324
// will be included from spu.c
2425
#ifdef _IN_SPU

0 commit comments

Comments
 (0)