diff options
| author | John Wilbert M. Villamor <lameguy64@gmail.com> | 2021-07-01 08:45:46 +0800 |
|---|---|---|
| committer | John Wilbert M. Villamor <lameguy64@gmail.com> | 2021-07-01 08:45:46 +0800 |
| commit | 01fe30bd8bae59ab954751b08bcc1d158eff7edb (patch) | |
| tree | aa83e37f4e59207ec41b3d47796875755462c63f /examples/graphics | |
| parent | da79082d2c5e0dcbc899a359f6f49ec8cca90d66 (diff) | |
| download | psn00bsdk-01fe30bd8bae59ab954751b08bcc1d158eff7edb.tar.gz | |
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.
Diffstat (limited to 'examples/graphics')
| -rw-r--r-- | examples/graphics/balls/main.c | 17 | ||||
| -rw-r--r-- | examples/graphics/billboard/billboard.c | 13 | ||||
| -rw-r--r-- | examples/graphics/fpscam/clip.h | 1 | ||||
| -rw-r--r-- | examples/graphics/fpscam/lookat.h | 1 | ||||
| -rw-r--r-- | examples/graphics/fpscam/main.c | 5 | ||||
| -rw-r--r-- | examples/graphics/gte/main.c | 9 | ||||
| -rw-r--r-- | examples/graphics/hdtv/clip.h | 1 | ||||
| -rw-r--r-- | examples/graphics/hdtv/lookat.h | 1 | ||||
| -rw-r--r-- | examples/graphics/hdtv/main.c | 9 | ||||
| -rw-r--r-- | examples/graphics/render2tex/main.c | 21 | ||||
| -rw-r--r-- | examples/graphics/rgb24/main.c | 7 |
11 files changed, 54 insertions, 31 deletions
diff --git a/examples/graphics/balls/main.c b/examples/graphics/balls/main.c index 89c8063..e429a4b 100644 --- a/examples/graphics/balls/main.c +++ b/examples/graphics/balls/main.c @@ -2,7 +2,7 @@ * LibPSn00b Example Programs * * Balls Example - * 2019 Meido-Tek Productions / PSn00bSDK Project + * 2019 - 2021 Meido-Tek Productions / PSn00bSDK Project * * Draws a bunch of ball sprites that bounce around the screen, * along with a ball snake that might be difficult to see. @@ -12,10 +12,13 @@ * * Changelog: * - * November 20, 2018 - Initial version. + * May 10, 2021 - Variable types updated for psxgpu.h changes. + * + * November 20, 2018 - Initial version. * */ +#include <sys/types.h> #include <stdio.h> #include <stdlib.h> #include <psxetc.h> @@ -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 <sys/types.h> #include <stdio.h> #include <psxgpu.h> #include <psxgte.h> @@ -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 <sys/types.h> #include <psxgte.h> #include <psxgpu.h> 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 <sys/types.h> #include <psxgte.h> #include <psxgpu.h> 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 <sys/types.h> #include <stdio.h> #include <psxgpu.h> #include <psxgte.h> @@ -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 <sys/types.h> #include <stdio.h> #include <psxgpu.h> #include <psxgte.h> @@ -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 <sys/types.h> #include <psxgte.h> #include <psxgpu.h> 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 <sys/types.h> #include <psxgte.h> #include <psxgpu.h> 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 <sys/types.h> #include <stdio.h> #include <psxgpu.h> #include <psxgte.h> @@ -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 <sys/types.h> #include <stdio.h> #include <psxgpu.h> #include <psxgte.h> @@ -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 <sys/types.h> #include <stdio.h> #include <psxgte.h> #include <psxgpu.h> // So data from tim.s can be accessed -extern unsigned int tim_image[]; +extern u_long tim_image[]; int main() { |
