From 01fe30bd8bae59ab954751b08bcc1d158eff7edb Mon Sep 17 00:00:00 2001 From: "John Wilbert M. Villamor" Date: Thu, 1 Jul 2021 08:45:46 +0800 Subject: Added int*_t and uint*_t variable types and updated type definitions in psxgpu and psxcd, to improve compatibility with code written for the official SDK. --- examples/beginner/cppdemo/main.cpp | 15 ++++++++++----- examples/cdrom/cdbrowse/main.c | 9 ++++++--- examples/cdrom/cdxa/main.c | 11 +++++++---- examples/demos/n00bdemo/disp.c | 3 ++- examples/demos/n00bdemo/disp.h | 3 ++- examples/demos/n00bdemo/lightdemo.c | 1 + examples/demos/n00bdemo/logo.c | 33 +++++++++++++++++---------------- examples/demos/n00bdemo/main.c | 17 ++++++++++------- examples/demos/n00bdemo/smd.h | 4 ++-- examples/graphics/balls/main.c | 17 ++++++++++------- examples/graphics/billboard/billboard.c | 13 ++++++++----- examples/graphics/fpscam/clip.h | 1 + examples/graphics/fpscam/lookat.h | 1 + examples/graphics/fpscam/main.c | 5 +++-- examples/graphics/gte/main.c | 9 ++++++--- examples/graphics/hdtv/clip.h | 1 + examples/graphics/hdtv/lookat.h | 1 + examples/graphics/hdtv/main.c | 9 ++++++--- examples/graphics/render2tex/main.c | 21 ++++++++++++--------- examples/graphics/rgb24/main.c | 7 +++++-- examples/system/childexec/child.c | 3 ++- examples/system/childexec/parent.c | 11 ++++++++--- examples/system/console/main.c | 13 ++++++++----- examples/system/timer/main.c | 1 + examples/system/tty/main.c | 9 ++++++--- 25 files changed, 136 insertions(+), 82 deletions(-) (limited to 'examples') diff --git a/examples/beginner/cppdemo/main.cpp b/examples/beginner/cppdemo/main.cpp index 1a98cac..58bfcda 100644 --- a/examples/beginner/cppdemo/main.cpp +++ b/examples/beginner/cppdemo/main.cpp @@ -3,7 +3,12 @@ * Basically a quick little example that showcases C++ classes are * functioning in PSn00bSDK. - Lameguy64 * - * Written in December ‎18, ‎2020. + * First written in December ‎18, ‎2020. + * + * Changelog: + * + * May 10, 2021 - Variable types updated for psxgpu.h changes. + * */ #include @@ -14,7 +19,7 @@ class GraphClass { - u_int *_ot[2]; + u_long *_ot[2]; u_char *_pri[2]; u_char *_nextpri; @@ -28,8 +33,8 @@ public: GraphClass( int ot_len = 8, int pri_len = 8192 ) { - _ot[0] = (u_int*)malloc( sizeof(u_int)*ot_len ); - _ot[1] = (u_int*)malloc( sizeof(u_int)*ot_len ); + _ot[0] = (u_long*)malloc( sizeof(u_long)*ot_len ); + _ot[1] = (u_long*)malloc( sizeof(u_long)*ot_len ); _db = 0; _ot_count = ot_len; @@ -96,7 +101,7 @@ public: } /* GetNextPri */ - u_int *GetOt( void ) + u_long *GetOt( void ) { return( _ot[_db] ); diff --git a/examples/cdrom/cdbrowse/main.c b/examples/cdrom/cdbrowse/main.c index 772ddc1..ead2df0 100644 --- a/examples/cdrom/cdbrowse/main.c +++ b/examples/cdrom/cdbrowse/main.c @@ -2,7 +2,7 @@ * LibPSn00b Example Programs * * CD File Browser Example - * 2020 Meido-Tek Productions / PSn00bSDK Project + * 2020 - 2021 Meido-Tek Productions / PSn00bSDK Project * * Demonstrates listing and browsing directory contents of a CD-ROM containing * an ISO9660 file system, using the directory query functions of the libpsxcd @@ -47,11 +47,14 @@ * * Changelog: * + * May 10, 2021: Variable types updated for psxgpu.h changes. + * * February 25, 2020: Initial version. * * July 12, 2020: Updated CD-ROM directory query logic on disc change slightly. */ +#include #include #include #include @@ -85,7 +88,7 @@ DISPENV disp[2]; DRAWENV draw[2]; char pribuff[2][65536]; /* Primitive packet buffers */ -unsigned int ot[2][OT_LEN]; /* Ordering tables */ +u_long ot[2][OT_LEN]; /* Ordering tables */ char *nextpri; /* Pointer to next packet buffer offset */ int db = 0; /* Double buffer index */ @@ -190,7 +193,7 @@ void init() /* Upload the ball texture */ - GetTimInfo((unsigned int*)ball16c, &tim); /* Get TIM parameters */ + GetTimInfo((u_long*)ball16c, &tim); /* Get TIM parameters */ LoadImage(tim.prect, tim.paddr); /* Upload texture to VRAM */ if( tim.mode & 0x8 ) { diff --git a/examples/cdrom/cdxa/main.c b/examples/cdrom/cdxa/main.c index 0112437..16f1c82 100644 --- a/examples/cdrom/cdxa/main.c +++ b/examples/cdrom/cdxa/main.c @@ -2,7 +2,7 @@ * LibPSn00b Example Programs * * CD-XA Audio Example - * 2019 Meido-Tek Productions / PSn00bSDK Project + * 2019 - 2021 Meido-Tek Productions / PSn00bSDK Project * * Demonstrates playback and looping of CD-XA audio using the * new libpsxcd library. @@ -110,10 +110,13 @@ * * Changelog: * - * November 22, 2019 - Initial version + * May 10, 2021 - Variable types updated for psxgpu.h changes. + * + * November 22, 2019 - Initial version * */ +#include #include #include #include @@ -148,7 +151,7 @@ DISPENV disp[2]; DRAWENV draw[2]; char pribuff[2][65536]; /* Primitive packet buffers */ -unsigned int ot[2][OT_LEN]; /* Ordering tables */ +u_long ot[2][OT_LEN]; /* Ordering tables */ char *nextpri; /* Pointer to next packet buffer offset */ int db = 0; /* Double buffer index */ @@ -274,7 +277,7 @@ void init() /* Upload the ball texture */ - GetTimInfo((unsigned int*)ball16c, &tim); /* Get TIM parameters */ + GetTimInfo((u_long*)ball16c, &tim); /* Get TIM parameters */ LoadImage(tim.prect, tim.paddr); /* Upload texture to VRAM */ if( tim.mode & 0x8 ) { diff --git a/examples/demos/n00bdemo/disp.c b/examples/demos/n00bdemo/disp.c index d798ee9..c134163 100644 --- a/examples/demos/n00bdemo/disp.c +++ b/examples/demos/n00bdemo/disp.c @@ -1,3 +1,4 @@ +#include #include #include #include @@ -9,7 +10,7 @@ DISPENV disp; DRAWENV draw; char pribuff[2][131072]; -unsigned int ot[2][OT_LEN]; +u_long ot[2][OT_LEN]; char *nextpri; int db = 0; diff --git a/examples/demos/n00bdemo/disp.h b/examples/demos/n00bdemo/disp.h index ecf6dcf..2c76270 100644 --- a/examples/demos/n00bdemo/disp.h +++ b/examples/demos/n00bdemo/disp.h @@ -1,6 +1,7 @@ #ifndef _DISP_H #define _DISP_H +#include #include #define SCENE_TIME 60*15 @@ -13,7 +14,7 @@ void initDisplay(); void display(); -extern unsigned int ot[2][OT_LEN]; +extern u_long ot[2][OT_LEN]; extern char *nextpri; extern int db; diff --git a/examples/demos/n00bdemo/lightdemo.c b/examples/demos/n00bdemo/lightdemo.c index ff858c0..5afd5c8 100644 --- a/examples/demos/n00bdemo/lightdemo.c +++ b/examples/demos/n00bdemo/lightdemo.c @@ -1,3 +1,4 @@ +#include #include #include #include diff --git a/examples/demos/n00bdemo/logo.c b/examples/demos/n00bdemo/logo.c index 3fdef5e..2cebf6b 100644 --- a/examples/demos/n00bdemo/logo.c +++ b/examples/demos/n00bdemo/logo.c @@ -1,3 +1,4 @@ +#include #include #include #include @@ -22,23 +23,23 @@ typedef struct { } PARTICLE; typedef struct { - unsigned int tag; - unsigned int tpage; - unsigned int mask1; - unsigned char r0,g0,b0,code; - short x0,y0; - short x1,y1; - short x2,y2; - short x3,y3; - unsigned int mask2; + u_long tag; + u_long tpage; + u_long mask1; + u_char r0,g0,b0,code; + short x0,y0; + short x1,y1; + short x2,y2; + short x3,y3; + u_long mask2; } MASKP_F4; typedef struct { - unsigned int tag; - unsigned int tpage; - unsigned char r0,g0,b0,code; - short x0,y0; - short w,h; + u_long tag; + u_long tpage; + u_char r0,g0,b0,code; + short x0,y0; + short w,h; } FADERECT; @@ -46,8 +47,8 @@ SMD *o_psn00b, *o_n00blogo; typedef struct { - unsigned int *prev; - unsigned int *next; + u_long *prev; + u_long *next; int size; } NODE; diff --git a/examples/demos/n00bdemo/main.c b/examples/demos/n00bdemo/main.c index a6eb57e..623d8cc 100644 --- a/examples/demos/n00bdemo/main.c +++ b/examples/demos/n00bdemo/main.c @@ -2,7 +2,7 @@ * LibPSn00b Example Programs * * n00bDEMO Source Code - * 2019 Meido-Tek Productions / PSn00bSDK Project + * 2019 - 2021 Meido-Tek Productions / PSn00bSDK Project * * To build, simply run make. Make sure you have the lzpack tool accessible * through your PATH environment variable. @@ -11,12 +11,15 @@ * * Changelog: * + * May 10, 2021 - Variable types updated for psxgpu.h changes. + * * Apr 4, 2019 - Some code clean-up and added more comments. * * Mar 20, 2019 - Initial completed version. * */ +#include #include #include #include @@ -92,7 +95,7 @@ void loadTextures() { for( j=0; j #include #include #include @@ -39,10 +42,10 @@ DISPENV disp; DRAWENV draw; -char pribuff[2][65536]; /* Primitive packet buffers */ -unsigned int ot[2][OT_LEN]; /* Ordering tables */ -char *nextpri; /* Pointer to next packet buffer offset */ -int db = 0; /* Double buffer index */ +char pribuff[2][65536]; /* Primitive packet buffers */ +u_long ot[2][OT_LEN]; /* Ordering tables */ +char *nextpri; /* Pointer to next packet buffer offset */ +int db = 0; /* Double buffer index */ /* Ball struct and array */ @@ -93,7 +96,7 @@ void init() { /* Upload the ball texture */ printf("Upload texture... "); - GetTimInfo( (unsigned int*)ball16c, &tim ); /* Get TIM parameters */ + GetTimInfo( (u_long*)ball16c, &tim ); /* Get TIM parameters */ LoadImage( tim.prect, tim.paddr ); /* Upload texture to VRAM */ if( tim.mode & 0x8 ) { diff --git a/examples/graphics/billboard/billboard.c b/examples/graphics/billboard/billboard.c index bba5dda..ea98b28 100644 --- a/examples/graphics/billboard/billboard.c +++ b/examples/graphics/billboard/billboard.c @@ -2,7 +2,7 @@ * LibPSn00b Example Programs * * GTE Billboarding Sprites Example - * 2019 Meido-Tek Productions / PSn00bSDK Project + * 2019 - 2021 Meido-Tek Productions / PSn00bSDK Project * * Displays a bunch of sprites placed on the screen using 3D coordinates * that scale according to the distance from the screen. This is a quick @@ -16,10 +16,13 @@ * * Changelog: * + * May 10, 2021 - Variable types updated for psxgpu.h changes. + * * Sep 24, 2019 - Initial version. * */ +#include #include #include #include @@ -42,7 +45,7 @@ typedef struct { DISPENV disp; /* Display environment */ DRAWENV draw; /* Drawing environment */ - int ot[OT_LEN]; /* Ordering table */ + u_long ot[OT_LEN]; /* Ordering table */ char p[PACKET_LEN]; /* Packet buffer */ } DB; @@ -51,8 +54,8 @@ DB db[2]; int db_active = 0; char *db_nextpri; -extern int tim_image[]; -TIM_IMAGE tim; +extern u_long tim_image[]; +TIM_IMAGE tim; /* For easier handling of vertex indices */ typedef struct { @@ -224,7 +227,7 @@ void init() { /* Set screen depth (basically FOV control, W/2 works best) */ gte_SetGeomScreen( CENTERX ); - GetTimInfo(tim_image, &tim); + GetTimInfo( tim_image, &tim); LoadImage(tim.prect, tim.paddr); DrawSync(0); diff --git a/examples/graphics/fpscam/clip.h b/examples/graphics/fpscam/clip.h index 3b428bb..4daf47a 100644 --- a/examples/graphics/fpscam/clip.h +++ b/examples/graphics/fpscam/clip.h @@ -1,6 +1,7 @@ #ifndef _CLIP_H #define _CLIP_H +#include #include #include diff --git a/examples/graphics/fpscam/lookat.h b/examples/graphics/fpscam/lookat.h index c57e50a..4b10596 100644 --- a/examples/graphics/fpscam/lookat.h +++ b/examples/graphics/fpscam/lookat.h @@ -1,6 +1,7 @@ #ifndef _LOOKAT_H #define _LOOKAT_H +#include #include #include diff --git a/examples/graphics/fpscam/main.c b/examples/graphics/fpscam/main.c index 9dedf06..a009a65 100644 --- a/examples/graphics/fpscam/main.c +++ b/examples/graphics/fpscam/main.c @@ -33,7 +33,8 @@ * Sep 24, 2019 - Added camera position display and _boot() exit. * */ - + +#include #include #include #include @@ -62,7 +63,7 @@ typedef struct { DISPENV disp; // Display environment DRAWENV draw; // Drawing environment - int ot[OT_LEN]; // Ordering table + u_long ot[OT_LEN]; // Ordering table char p[PACKET_LEN]; // Packet buffer } DB; diff --git a/examples/graphics/gte/main.c b/examples/graphics/gte/main.c index 432ef95..a7ddb6b 100644 --- a/examples/graphics/gte/main.c +++ b/examples/graphics/gte/main.c @@ -2,7 +2,7 @@ * LibPSn00b Example Programs * * GTE Graphics Example - * 2019 Meido-Tek Productions / PSn00bSDK Project + * 2019 - 2021 Meido-Tek Productions / PSn00bSDK Project * * Renders a spinning 3D cube with light source calculation * using GTE macros. @@ -12,10 +12,13 @@ * * Changelog: * - * Jan 26, 2019 - Initial version. + * May 10, 2021 - Variable types updated for psxgpu.h changes. + * + * Jan 26, 2019 - Initial version. * */ +#include #include #include #include @@ -38,7 +41,7 @@ typedef struct { DISPENV disp; /* Display environment */ DRAWENV draw; /* Drawing environment */ - int ot[OT_LEN]; /* Ordering table */ + u_long ot[OT_LEN]; /* Ordering table */ char p[PACKET_LEN]; /* Packet buffer */ } DB; diff --git a/examples/graphics/hdtv/clip.h b/examples/graphics/hdtv/clip.h index 3b428bb..4daf47a 100644 --- a/examples/graphics/hdtv/clip.h +++ b/examples/graphics/hdtv/clip.h @@ -1,6 +1,7 @@ #ifndef _CLIP_H #define _CLIP_H +#include #include #include diff --git a/examples/graphics/hdtv/lookat.h b/examples/graphics/hdtv/lookat.h index c57e50a..4b10596 100644 --- a/examples/graphics/hdtv/lookat.h +++ b/examples/graphics/hdtv/lookat.h @@ -1,6 +1,7 @@ #ifndef _LOOKAT_H #define _LOOKAT_H +#include #include #include diff --git a/examples/graphics/hdtv/main.c b/examples/graphics/hdtv/main.c index 82911d5..a4dcd79 100644 --- a/examples/graphics/hdtv/main.c +++ b/examples/graphics/hdtv/main.c @@ -2,7 +2,7 @@ * LibPSn00b Example Programs * * Full-resolution, Anamorphic Widescreen 3D Example - * 2020 Meido-Tek Productions / PSn00bSDK Project + * 2020 - 2021 Meido-Tek Productions / PSn00bSDK Project * * This example is a modification of the fpscam example demonstrating * a method for taking advantage of widescreen HDTVs by means of a @@ -51,10 +51,13 @@ * * Changelog: * - * November 27, 2020 - Initial version. + * May 10, 2021 - Variable types updated for psxgpu.h changes. + * + * November 27, 2020 - Initial version. * */ +#include #include #include #include @@ -83,7 +86,7 @@ typedef struct { DISPENV disp; // Display environment DRAWENV draw; // Drawing environment - int ot[OT_LEN]; // Ordering table + u_long ot[OT_LEN]; // Ordering table char p[PACKET_LEN]; // Packet buffer } DB; diff --git a/examples/graphics/render2tex/main.c b/examples/graphics/render2tex/main.c index 6ae450a..37b50d7 100644 --- a/examples/graphics/render2tex/main.c +++ b/examples/graphics/render2tex/main.c @@ -2,7 +2,7 @@ * LibPSn00b Example Programs * * Off-screen Render to Texture Example - * 2019 Meido-Tek Productions / PSn00bSDK Project + * 2019 - 2021 Meido-Tek Productions / PSn00bSDK Project * * Demonstrates quick render to texture for multi-texture style effects, * view screens and more. This example also shows how to use multiple @@ -13,10 +13,13 @@ * * Changelog: * - * Oct 26, 2019 - Initial version. + * May 10, 2021 - Variable types updated for psxgpu.h changes. + * + * Oct 26, 2019 - Initial version. * */ +#include #include #include #include @@ -44,8 +47,8 @@ typedef struct DB { DISPENV disp; /* Display environment */ DRAWENV draw; /* Drawing environment */ - int ot[OT_LEN]; /* Main ordering table */ - int sub_ot[2][4]; /* Second ordering table for r2t stuff */ + u_long ot[OT_LEN]; /* Main ordering table */ + u_long sub_ot[2][4]; /* Second ordering table for r2t stuff */ char p[PACKET_LEN]; /* Packet buffer */ } DB; @@ -113,7 +116,7 @@ MATRIX light_mtx = { /* Reference texture data */ -extern int tim_blendpattern[]; +extern u_long tim_blendpattern[]; /* TPage and CLUT values */ @@ -128,8 +131,8 @@ void display(); /* This function sorts a cube that is drawn * to an offscreen area specified by *area */ -void sort_cube(int *ot, RECT *area); -void sort_multitex(int *ot, RECT *area, int count); +void sort_cube(u_long *ot, RECT *area); +void sort_multitex(u_long *ot, RECT *area, int count); /* Main function */ int main() { @@ -393,7 +396,7 @@ void display() { } -void sort_multitex(int *ot, RECT *area, int count) +void sort_multitex(u_long *ot, RECT *area, int count) { DR_TPAGE *ptpage; FILL *pfill; @@ -526,7 +529,7 @@ void sort_multitex(int *ot, RECT *area, int count) } -void sort_cube(int *ot, RECT *area) +void sort_cube(u_long *ot, RECT *area) { int i,p; POLY_FT4* pol4; diff --git a/examples/graphics/rgb24/main.c b/examples/graphics/rgb24/main.c index 9f1a647..3c0bebf 100644 --- a/examples/graphics/rgb24/main.c +++ b/examples/graphics/rgb24/main.c @@ -12,16 +12,19 @@ * * Changelog: * - * 05-03-2019 - Initial version. + * May 10, 2021 - Variable types updated for psxgpu.h changes. + * + * May 3, 2019 - Initial version. * */ +#include #include #include #include // So data from tim.s can be accessed -extern unsigned int tim_image[]; +extern u_long tim_image[]; int main() { diff --git a/examples/system/childexec/child.c b/examples/system/childexec/child.c index 2ed656b..2ddfa73 100644 --- a/examples/system/childexec/child.c +++ b/examples/system/childexec/child.c @@ -1,3 +1,4 @@ +#include #include #include #include @@ -22,7 +23,7 @@ typedef struct { DISPENV disp; /* Display environment */ DRAWENV draw; /* Drawing environment */ - int ot[OT_LEN]; /* Ordering table */ + u_long ot[OT_LEN]; /* Ordering table */ char p[PACKET_LEN]; /* Packet buffer */ } DB; diff --git a/examples/system/childexec/parent.c b/examples/system/childexec/parent.c index ed5710a..58f03f7 100644 --- a/examples/system/childexec/parent.c +++ b/examples/system/childexec/parent.c @@ -2,7 +2,7 @@ * LibPSn00b Example Programs * * Child Program Execution Example - * 2020 Meido-Tek Productions / PSn00bSDK Project + * 2020 - 2021 Meido-Tek Productions / PSn00bSDK Project * * This example demonstrates how to execute a child PS-EXE from a parent * PS-EXE using the Exec() function, and transferring execution back from @@ -14,8 +14,13 @@ * * Example by Lameguy64 * + * Changelog: + * + * May 10, 2021 - Variable types updated for psxgpu.h changes. + * */ +#include #include #include #include @@ -43,7 +48,7 @@ DISPENV disp; DRAWENV draw; char pribuff[2][65536]; /* Primitive packet buffers */ -unsigned int ot[2][OT_LEN]; /* Ordering tables */ +u_long ot[2][OT_LEN]; /* Ordering tables */ char *nextpri; /* Pointer to next packet buffer offset */ int db = 0; /* Double buffer index */ @@ -98,7 +103,7 @@ void init() { /* Upload the ball texture */ printf("Upload texture... "); - GetTimInfo( (unsigned int*)ball16c, &tim ); /* Get TIM parameters */ + GetTimInfo( (u_long*)ball16c, &tim ); /* Get TIM parameters */ LoadImage( tim.prect, tim.paddr ); /* Upload texture to VRAM */ if( tim.mode & 0x8 ) { diff --git a/examples/system/console/main.c b/examples/system/console/main.c index 405f0d6..92df0a8 100644 --- a/examples/system/console/main.c +++ b/examples/system/console/main.c @@ -2,7 +2,7 @@ * LibPSn00b Example Programs * * Text Console Example - * 2020 Meido-Tek Productions / PSn00bSDK Project + * 2020 - 2021 Meido-Tek Productions / PSn00bSDK Project * * This example demonstrates a tty text console implementation for gameplay * sections, or sections with continuously updating graphics. The console is @@ -15,10 +15,13 @@ * * Changelog: * - * April 23, 2020 - Initial version. + * May 10, 2021 - Variable types updated for psxgpu.h changes. + * + * April 23, 2020 - Initial version. * */ - + +#include #include #include #include @@ -48,7 +51,7 @@ DISPENV disp; DRAWENV draw; char pribuff[2][65536]; /* Primitive packet buffers */ -unsigned int ot[2][OT_LEN]; /* Ordering tables */ +u_long ot[2][OT_LEN]; /* Ordering tables */ char *nextpri; /* Pointer to next packet buffer offset */ int db = 0; /* Double buffer index */ @@ -101,7 +104,7 @@ void init() { /* Upload the ball texture */ printf("Upload texture... "); - GetTimInfo( (unsigned int*)ball16c, &tim ); /* Get TIM parameters */ + GetTimInfo( (u_long*)ball16c, &tim ); /* Get TIM parameters */ LoadImage( tim.prect, tim.paddr ); /* Upload texture to VRAM */ if( tim.mode & 0x8 ) { diff --git a/examples/system/timer/main.c b/examples/system/timer/main.c index 7d9f7b3..8153581 100644 --- a/examples/system/timer/main.c +++ b/examples/system/timer/main.c @@ -1,3 +1,4 @@ +#include #include #include #include diff --git a/examples/system/tty/main.c b/examples/system/tty/main.c index 8333746..dfffdc4 100644 --- a/examples/system/tty/main.c +++ b/examples/system/tty/main.c @@ -2,7 +2,7 @@ * LibPSn00b Example Programs * * Teletype Example - * 2020 Meido-Tek Productions / PSn00bSDK Project + * 2020 - 2021 Meido-Tek Productions / PSn00bSDK Project * * This example showcases the uses of tty through stdio facilities. If you've * written text console applications before, this one is not too dissimilar to @@ -14,10 +14,13 @@ * * Changelog: * - * April 23, 2020 - Initial version. + * May 10, 2021 - Variable types updated for psxgpu.h changes. + * + * April 23, 2020 - Initial version. * */ - + +#include #include #include #include -- cgit v1.2.3