Skip to content

Commit

Permalink
Match more files
Browse files Browse the repository at this point in the history
  • Loading branch information
sozud committed Jan 28, 2024
1 parent dbb4a07 commit c4a6783
Show file tree
Hide file tree
Showing 9 changed files with 145 additions and 60 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
libsnd_linked/build
src
asm
15 changes: 14 additions & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,19 @@ export BUILD_DIR=$(pwd)/build

# build
cd $BUILD_DIR && dosemu -quiet -dumb -f ./dosemurc -K . -E "ccpsx.exe -v -O2 -g0 -G0 -funsigned-char -c -I. next.c -onext.obj"
cd $BUILD_DIR && dosemu -quiet -dumb -f ./dosemurc -K . -E "ccpsx.exe -v -O2 -g0 -G0 -funsigned-char -c -I. play.c -oplay.obj"
cd $BUILD_DIR && dosemu -quiet -dumb -f ./dosemurc -K . -E "ccpsx.exe -v -O2 -g0 -G0 -funsigned-char -c -I. scsmvol.c -oscsmvol.obj"
cd $BUILD_DIR && dosemu -quiet -dumb -f ./dosemurc -K . -E "ccpsx.exe -v -O2 -g0 -G0 -funsigned-char -c -I. scssattr.c -oscssattr.obj"
cd $BUILD_DIR && dosemu -quiet -dumb -f ./dosemurc -K . -E "ccpsx.exe -v -O2 -g0 -G0 -funsigned-char -c -I. scssvol.c -oscssvol.obj"
cd $BUILD_DIR && dosemu -quiet -dumb -f ./dosemurc -K . -E "ccpsx.exe -v -O2 -g0 -G0 -funsigned-char -c -I. sscall.c -osscall.obj"

# build splitter
cd $HOME_DIR && cargo run --release --manifest-path ./tools/psy-q-splitter/splitter/Cargo.toml

# check
cd $HOME_DIR && cargo run --release --manifest-path ./tools/psy-q-splitter/splitter/Cargo.toml diff_obj_with_lib ./psy-q/3.5/PSX/LIB/LIBSND.LIB NEXT ./build/next.obj
cd $HOME_DIR && ./tools/psy-q-splitter/splitter/target/release/splitter diff_obj_with_lib ./psy-q/3.5/PSX/LIB/LIBSND.LIB NEXT ./build/next.obj &&
cd $HOME_DIR && ./tools/psy-q-splitter/splitter/target/release/splitter diff_obj_with_lib ./psy-q/3.5/PSX/LIB/LIBSND.LIB PLAY ./build/play.obj &&
cd $HOME_DIR && ./tools/psy-q-splitter/splitter/target/release/splitter diff_obj_with_lib ./psy-q/3.5/PSX/LIB/LIBSND.LIB SCSMVOL ./build/scsmvol.obj &&
cd $HOME_DIR && ./tools/psy-q-splitter/splitter/target/release/splitter diff_obj_with_lib ./psy-q/3.5/PSX/LIB/LIBSND.LIB SCSSATTR ./build/scssattr.obj &&
cd $HOME_DIR && ./tools/psy-q-splitter/splitter/target/release/splitter diff_obj_with_lib ./psy-q/3.5/PSX/LIB/LIBSND.LIB SCSSVOL ./build/scssvol.obj &&
cd $HOME_DIR && ./tools/psy-q-splitter/splitter/target/release/splitter diff_obj_with_lib ./psy-q/3.5/PSX/LIB/LIBSND.LIB SSCALL ./build/sscall.obj
60 changes: 2 additions & 58 deletions src/snd/libsnd_i.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
#define LIBSND_INTERNAL_H

#include <libspu.h>
#include <libsnd.h>
#include <types.h>

struct Unk {
u16 unk0;
Expand Down Expand Up @@ -53,22 +55,6 @@ s16 SsVabOpenHeadWithMode(u8* addr, s16 vabid, s32 arg2, u32 sbaddr);

extern u16 _svm_vab_count;

typedef struct VabHdr {
s32 form;
s32 ver;
s32 id;
u32 fsize;
u16 reserved0;
u16 ps;
u16 ts;
u16 vs;
u8 mvol;
u8 pan;
u8 attr1;
u8 attr2;
u32 reserved1;
} VabHdr;

s16 SsVabOpenHead(u8*, s16);
s16 SsVabTransBody(u8*, s16);
extern s32 D_80098854[];
Expand Down Expand Up @@ -174,20 +160,6 @@ extern struct SeqStruct* _ss_score[32];
extern s16 _snd_seq_s_max;
extern s16 _snd_seq_t_max;

typedef struct ProgAtr { /* Program Headdings */

unsigned char tones; /* # of tones */
unsigned char mvol; /* program volume */
unsigned char prior; /* program priority */
unsigned char mode; /* program mode */
unsigned char mpan; /* program pan */
char reserved0; /* system reserved */
short attr; /* program attribute */
unsigned long reserved1;
unsigned short reserved2;
unsigned short reserved3;
} ProgAtr; /* 16 byte */

extern ProgAtr* D_8006C3B4;
extern u8 svm_vab_used[];

Expand Down Expand Up @@ -220,32 +192,6 @@ struct SpuVoice {
extern struct SpuVoice _svm_voice[24];
u32 SpuVmVSetUp(s16, s16);

typedef struct VagAtr { /* VAG Tone Headdings */

unsigned char prior; /* tone priority */
unsigned char mode; /* play mode */
unsigned char vol; /* tone volume*/
unsigned char pan; /* tone panning */
unsigned char center; /* center note */
unsigned char shift; /* center note fine tune */
unsigned char min; /* minimam note limit */
unsigned char max; /* maximam note limit */
unsigned char vibW; /* vibrate depth */
unsigned char vibT; /* vibrate duration */
unsigned char porW; /* portamento depth */
unsigned char porT; /* portamento duration */
unsigned char pbmin; /* under pitch bend max */
unsigned char pbmax; /* upper pitch bend max */
unsigned char reserved1; /* system reserved */
unsigned char reserved2; /* system reserved */
unsigned short adsr1; /* adsr1 */
unsigned short adsr2; /* adsr2 */
short prog; /* parent program*/
short vag; /* vag reference */
short reserved[4]; /* system reserved */

} VagAtr; /* 32 byte */

extern VagAtr* _svm_tn;

void SpuVmFlush();
Expand All @@ -264,8 +210,6 @@ short SsUtGetVagAtr(
short SsUtSetVagAtr(
short vabId, short progNum, short toneNum, VagAtr* vagatrptr);

s16 SsVabTransBodyPartly(u8* addr, u32 bufsize, s16 vabid);

extern s32 D_80032F08;
extern s16 D_80032F0C;

Expand Down
3 changes: 3 additions & 0 deletions src/snd/play.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#include "libsnd_i.h"

void _SsSndPlay(s16 arg0, s16 arg1) { _SsSeqPlay(arg0, arg1); }
9 changes: 9 additions & 0 deletions src/snd/scsmvol.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#include "libsnd_i.h"

void SsSetMVol(short voll, short volr) {
SpuCommonAttr attr;
attr.mask = SPU_COMMON_MVOLL | SPU_COMMON_MVOLR;
attr.mvol.left = 129 * voll;
attr.mvol.right = 129 * volr;
SpuSetCommonAttr(&attr);
}
33 changes: 33 additions & 0 deletions src/snd/scssattr.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#include "libsnd_i.h"

void SsSetSerialAttr(char arg0, char arg1, char arg2) {
SpuCommonAttr attr;
s32 temp_a0;
s32 temp_a1;
s32 temp_v1;

if (!(arg0 & 0xFF)) {
temp_v1 = arg1 & 0xFF;
if (temp_v1 == 0) {
attr.mask = 0x200;
attr.cd.mix = arg2 & 0xFF;
}
if (temp_v1 == 1) {
attr.mask = 0x100;
attr.cd.reverb = arg2 & 0xFF;
}
}
temp_a0 = arg0 & 0xFF;
temp_a1 = arg1 & 0xFF;
if (temp_a0 == 1) {
if (temp_a1 == 0) {
attr.mask = 0x2000;
attr.ext.mix = arg2 & 0xFF;
}
if (temp_a1 == temp_a0) {
attr.mask = 0x1000;
attr.ext.reverb = arg2 & 0xFF;
}
}
SpuSetCommonAttr(&attr);
}
28 changes: 28 additions & 0 deletions src/snd/scssvol.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#include "libsnd_i.h"

void SsSetSerialVol(char s_num, short voll, short volr) {
SpuCommonAttr attr;
if (s_num == 0) {
attr.mask = 0xC0;
if (voll >= 128) {
voll = 127;
}
if (volr >= 128) {
volr = 127;
}
attr.cd.volume.left = voll * 258;
attr.cd.volume.right = volr * 258;
}
if (s_num == 1) {
attr.mask = 0xC00;
if (voll >= 128) {
voll = 127;
}
if (volr >= 128) {
volr = 127;
}
attr.ext.volume.left = voll * 258;
attr.ext.volume.right = volr * 258;
}
SpuSetCommonAttr(&attr);
}
54 changes: 54 additions & 0 deletions src/snd/sscall.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#include "libsnd_i.h"

void SsSeqCalledTbyT(void) {
int i;
int j;
if (_snd_ev_flag != 1) {
_snd_ev_flag = 1;

SpuVmFlush();

/* For each SEP block */
for (i = 0; i < _snd_seq_s_max; i++) {
/* Is it on? */
if ((1 << i) & _snd_openflag) {
/* Go through each SEQ track */
for (j = 0; j < _snd_seq_t_max; j++) {
if (_ss_score[i][j].unk90 & 1) {
_SsSndPlay(i, j);

if (_ss_score[i][j].unk90 & 0x10) {
_SsSndCrescendo(i, j);
}

if (_ss_score[i][j].unk90 & 0x20) {
_SsSndDecrescendo(i, j);
}

if (_ss_score[i][j].unk90 & 0x40) {
_SsSndTempo(i, j);
}

if (_ss_score[i][j].unk90 & 0x80) {
_SsSndTempo(i, j);
}
}

if (_ss_score[i][j].unk90 & 2) {
_SsSndPause(i, j);
}

if (_ss_score[i][j].unk90 & 8) {
_SsSndReplay(i, j);
}

if (_ss_score[i][j].unk90 & 4) {
_SsSndStop(i, j);
_ss_score[i][j].unk90 = 0;
}
}
}
}
_snd_ev_flag = 0;
}
}
2 changes: 2 additions & 0 deletions src/snd/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@ typedef unsigned char uint8_t;
typedef unsigned short uint16_t;
typedef unsigned int uint32_t;
typedef unsigned long long uint64_t;
/*
typedef unsigned char u_char;
typedef unsigned short u_short;
typedef unsigned long u_long;
typedef unsigned int size_t;
*/
#else
#include <sys/types.h>
#endif
Expand Down

0 comments on commit c4a6783

Please sign in to comment.