diff options
| author | spicyjpeg <thatspicyjpeg@gmail.com> | 2022-07-30 00:53:31 +0200 |
|---|---|---|
| committer | spicyjpeg <thatspicyjpeg@gmail.com> | 2022-07-30 00:53:31 +0200 |
| commit | 073a859acf16ccbc0f49364e38126bf2bf03aa3d (patch) | |
| tree | 90fac6072c5fe3ccee0505c881f89aa262d4eed7 /examples | |
| parent | 0e755e9801a2dcf7b9827c90cc38e9f532d06393 (diff) | |
| download | psn00bsdk-073a859acf16ccbc0f49364e38126bf2bf03aa3d.tar.gz | |
Deprecate u_short, u_int and u_long types in libpsn00b
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/mdec/mdecimage/main.c | 2 | ||||
| -rw-r--r-- | examples/sound/vagsample/main.c | 61 | ||||
| -rw-r--r-- | examples/system/dynlink/library/balls.c | 2 | ||||
| -rw-r--r-- | examples/system/dynlink/main.c | 8 |
4 files changed, 34 insertions, 39 deletions
diff --git a/examples/mdec/mdecimage/main.c b/examples/mdec/mdecimage/main.c index b59fdaf..1ad02d9 100644 --- a/examples/mdec/mdecimage/main.c +++ b/examples/mdec/mdecimage/main.c @@ -71,7 +71,7 @@ int main(int argc, const char* argv[]) { DecDCTout(slice, BLOCK_SIZE * SCREEN_YRES / 2); DecDCToutSync(0); - LoadImage(&rect, (u_long *) slice); + LoadImage(&rect, slice); DrawSync(0); } diff --git a/examples/sound/vagsample/main.c b/examples/sound/vagsample/main.c index 5764541..1ec3b8a 100644 --- a/examples/sound/vagsample/main.c +++ b/examples/sound/vagsample/main.c @@ -39,6 +39,7 @@ #include <psxpad.h> #include <psxapi.h> #include <psxspu.h> +#include <hwregs_c.h> extern const unsigned char proyt[]; extern const int proyt_size; @@ -158,27 +159,17 @@ int main(int argc, const char *argv[]) int counter,nextchan; int cross_pressed; int circle_pressed; - PADTYPE *pad; - SpuVoiceRaw voice; // Init stuff init(); - - // Set common values for the SpuVoiceRaw stuct - // Technically one struct can be used to play all sounds as the - // parameters are copied to the SPU registers - - voice.vol.left = 0x3FFE; // Left voice volume, 3FFEh = max - voice.vol.right = 0x3FFE; // Right voice volume, 3FFEh = max - voice.adsr_param = 0xdff18087; // ADSR parameters - + // Main loop counter = 0; nextchan = 0; cross_pressed = 0; circle_pressed = 0; - + while(1) { pad = (PADTYPE*)&pad_buff[0][0]; @@ -194,22 +185,24 @@ int main(int argc, const char *argv[]) if( !cross_pressed ) { // Voice frequency - // (400h = 11.25KHz, 1000h = 44.1KHz) - voice.freq = 0x800; + // (800h = 22.05KHz) + SPU_CH_FREQ(nextchan) = 0x800; // Voice start playback address // (transfer address / 8) - voice.addr = proyt_addr; + SPU_CH_ADDR(nextchan) = proyt_addr; // Voice loop address // (transfer address / 8) - voice.loop_addr = proyt_addr; - + SPU_CH_LOOP_ADDR(nextchan) = proyt_addr; + // Voice volume and envelope + SPU_CH_VOL_L(nextchan) = 0x3fff; + SPU_CH_VOL_R(nextchan) = 0x3fff; + SPU_CH_ADSR(nextchan) = 0x1fee80ff; + // Set voice to key-off to allow restart - SpuSetKey(0, 1<<nextchan); - // Set voice parameters - SpuSetVoiceRaw(nextchan, &voice); + SPU_KEY_OFF = 1 << nextchan; // Set voice to key-on - SpuSetKey(1, 1<<nextchan); - + SPU_KEY_ON = 1 << nextchan; + // Advance to next voice nextchan++; if( nextchan > 23 ) @@ -229,27 +222,29 @@ int main(int argc, const char *argv[]) if( !circle_pressed ) { // Voice frequency - // (400h = 11.25KHz, 1000h = 44.1KHz) - voice.freq = 0x1000; + // (1000h = 44.1KHz) + SPU_CH_FREQ(nextchan) = 0x1000; // Voice start playback address // (transfer address / 8) - voice.addr = tdfx_addr; + SPU_CH_ADDR(nextchan) = tdfx_addr; // Voice loop address // (transfer address / 8) - voice.loop_addr = tdfx_addr; - + SPU_CH_LOOP_ADDR(nextchan) = tdfx_addr; + // Voice volume and envelope + SPU_CH_VOL_L(nextchan) = 0x3fff; + SPU_CH_VOL_R(nextchan) = 0x3fff; + SPU_CH_ADSR(nextchan) = 0x1fee80ff; + // Set voice to key-off to allow restart - SpuSetKey(0, 1<<nextchan); - // Set voice parameters - SpuSetVoiceRaw(nextchan, &voice); + SPU_KEY_OFF = 1 << nextchan; // Set voice to key-on - SpuSetKey(1, 1<<nextchan); - + SPU_KEY_ON = 1 << nextchan; + // Advance to next voice nextchan++; if( nextchan > 23 ) nextchan = 0; - + circle_pressed = 1; } } diff --git a/examples/system/dynlink/library/balls.c b/examples/system/dynlink/library/balls.c index ef6993e..cfc7f58 100644 --- a/examples/system/dynlink/library/balls.c +++ b/examples/system/dynlink/library/balls.c @@ -38,7 +38,7 @@ static BALL_TYPE balls[MAX_BALLS]; static TIM_IMAGE ball_tim; void init(CONTEXT *ctx) { - GetTimInfo((u_long *) ball16c, &ball_tim); + GetTimInfo((const uint32_t *) ball16c, &ball_tim); LoadImage(ball_tim.prect, ball_tim.paddr); if (ball_tim.mode & 8) diff --git a/examples/system/dynlink/main.c b/examples/system/dynlink/main.c index 9b94b30..fff7aa5 100644 --- a/examples/system/dynlink/main.c +++ b/examples/system/dynlink/main.c @@ -108,13 +108,13 @@ void init_context(CONTEXT *ctx) { // Set up the ordering tables and primitive buffers. db = &(ctx->db[0]); ctx->db_nextpri = db->p; - ClearOTagR((u_long *) db->ot, OT_LEN); + ClearOTagR(db->ot, OT_LEN); PutDrawEnv(&(db->draw)); //PutDispEnv(&(db->disp)); db = &(ctx->db[1]); - ClearOTagR((u_long *) db->ot, OT_LEN); + ClearOTagR(db->ot, OT_LEN); // Create a text stream at the top of the screen. FntLoad(960, 0); @@ -130,14 +130,14 @@ void display(CONTEXT *ctx) { db = &(ctx->db[ctx->db_active]); ctx->db_nextpri = db->p; - ClearOTagR((u_long *) db->ot, OT_LEN); + ClearOTagR(db->ot, OT_LEN); PutDrawEnv(&(db->draw)); PutDispEnv(&(db->disp)); SetDispMask(1); db = &(ctx->db[!ctx->db_active]); - DrawOTag((u_long *) &(db->ot[OT_LEN - 1])); + DrawOTag(&(db->ot[OT_LEN - 1])); } /* Symbol overriding example */ |
