From 073a859acf16ccbc0f49364e38126bf2bf03aa3d Mon Sep 17 00:00:00 2001 From: spicyjpeg Date: Sat, 30 Jul 2022 00:53:31 +0200 Subject: Deprecate u_short, u_int and u_long types in libpsn00b --- examples/system/dynlink/library/balls.c | 2 +- examples/system/dynlink/main.c | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'examples/system') 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 */ -- cgit v1.2.3 From edb967394d22420c9aaad529862a670c016cc2c7 Mon Sep 17 00:00:00 2001 From: spicyjpeg Date: Fri, 12 Aug 2022 11:27:55 +0200 Subject: Replace ball16c.h headers in examples with .TIM files --- examples/cdrom/cdbrowse/CMakeLists.txt | 4 +++- examples/cdrom/cdbrowse/ball16c.h | 16 --------------- examples/cdrom/cdbrowse/ball16c.tim | Bin 0 -> 192 bytes examples/cdrom/cdbrowse/main.c | 11 +++++----- examples/cdrom/cdxa/CMakeLists.txt | 4 +++- examples/cdrom/cdxa/ball16c.h | 16 --------------- examples/cdrom/cdxa/ball16c.tim | Bin 0 -> 192 bytes examples/cdrom/cdxa/main.c | 30 +++++++++++++--------------- examples/graphics/balls/CMakeLists.txt | 4 +++- examples/graphics/balls/ball16c.h | 16 --------------- examples/graphics/balls/main.c | 16 +++++++-------- examples/graphics/gte/main.c | 2 +- examples/system/childexec/CMakeLists.txt | 1 + examples/system/childexec/ball16c.h | 16 --------------- examples/system/childexec/ball16c.tim | Bin 0 -> 192 bytes examples/system/childexec/child/child.c | 10 +++++----- examples/system/childexec/parent.c | 10 +++++----- examples/system/console/CMakeLists.txt | 4 +++- examples/system/console/ball16c.h | 16 --------------- examples/system/console/ball16c.tim | Bin 0 -> 192 bytes examples/system/console/main.c | 16 +++++++-------- examples/system/dynlink/CMakeLists.txt | 4 +++- examples/system/dynlink/library/ball16c.h | 16 --------------- examples/system/dynlink/library/ball16c.tim | Bin 0 -> 192 bytes examples/system/dynlink/library/balls.c | 5 +++-- 25 files changed, 65 insertions(+), 152 deletions(-) delete mode 100644 examples/cdrom/cdbrowse/ball16c.h create mode 100644 examples/cdrom/cdbrowse/ball16c.tim delete mode 100644 examples/cdrom/cdxa/ball16c.h create mode 100644 examples/cdrom/cdxa/ball16c.tim delete mode 100644 examples/graphics/balls/ball16c.h delete mode 100644 examples/system/childexec/ball16c.h create mode 100644 examples/system/childexec/ball16c.tim delete mode 100644 examples/system/console/ball16c.h create mode 100644 examples/system/console/ball16c.tim delete mode 100644 examples/system/dynlink/library/ball16c.h create mode 100644 examples/system/dynlink/library/ball16c.tim (limited to 'examples/system') diff --git a/examples/cdrom/cdbrowse/CMakeLists.txt b/examples/cdrom/cdbrowse/CMakeLists.txt index e36407d..c2e93fc 100644 --- a/examples/cdrom/cdbrowse/CMakeLists.txt +++ b/examples/cdrom/cdbrowse/CMakeLists.txt @@ -5,7 +5,7 @@ cmake_minimum_required(VERSION 3.20) project( cdbrowse - LANGUAGES C + LANGUAGES C ASM VERSION 1.0.0 DESCRIPTION "PSn00bSDK CD file browser example" HOMEPAGE_URL "http://lameguy64.net/?page=psn00bsdk" @@ -15,6 +15,8 @@ file(GLOB _sources *.c) psn00bsdk_add_executable(cdbrowse STATIC ${_sources}) psn00bsdk_add_cd_image(cdbrowse_iso cdbrowse iso.xml DEPENDS cdbrowse) +psn00bsdk_target_incbin(cdbrowse PRIVATE ball16c ball16c.tim) + install( FILES ${PROJECT_BINARY_DIR}/cdbrowse.bin diff --git a/examples/cdrom/cdbrowse/ball16c.h b/examples/cdrom/cdbrowse/ball16c.h deleted file mode 100644 index c79f273..0000000 --- a/examples/cdrom/cdbrowse/ball16c.h +++ /dev/null @@ -1,16 +0,0 @@ -unsigned int ball16c_size=192; -unsigned char ball16c[] = { -0x10,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x2c,0x00,0x00,0x00,0xc0,0x03,0x10, -0x01,0x10,0x00,0x01,0x00,0x00,0x00,0x31,0xc6,0x73,0xce,0x94,0xd2,0x07,0x9d, -0xd6,0xda,0x38,0xe3,0xef,0xbd,0x9b,0xef,0x8c,0xb1,0xc6,0x98,0xde,0xfb,0x4a, -0xa9,0xa4,0x90,0xad,0xb5,0x00,0x00,0x8c,0x00,0x00,0x00,0xc0,0x03,0x00,0x01, -0x04,0x00,0x10,0x00,0x00,0x00,0x10,0x22,0x12,0x02,0x00,0x00,0x00,0x10,0x32, -0x33,0x23,0x11,0x04,0x00,0x00,0x23,0x55,0x66,0x35,0x72,0x47,0x00,0x20,0x52, -0x86,0x68,0x36,0x12,0x97,0x0a,0x20,0x65,0xbb,0x8b,0x36,0x12,0x91,0x04,0x31, -0x85,0xbb,0x68,0x35,0x12,0x97,0xdc,0x32,0x86,0x8b,0x56,0x35,0x73,0x97,0xa4, -0x32,0x66,0x68,0x55,0x23,0x71,0x9e,0xac,0x32,0x65,0x56,0x33,0x13,0x71,0xce, -0xa4,0x21,0x33,0x33,0x23,0x11,0xe7,0xc9,0xd4,0x12,0x22,0x22,0x13,0x71,0xe7, -0xc9,0xda,0x10,0x17,0x11,0x77,0x77,0x9e,0x4c,0x0d,0x40,0x77,0x71,0xe7,0x9e, -0xc9,0xd4,0x0d,0x00,0x94,0x99,0x99,0xcc,0x4c,0xda,0x00,0x00,0xa0,0xc4,0xc4, -0x44,0xda,0x0d,0x00,0x00,0x00,0xd0,0xaa,0xda,0x0d,0x00,0x00 -}; diff --git a/examples/cdrom/cdbrowse/ball16c.tim b/examples/cdrom/cdbrowse/ball16c.tim new file mode 100644 index 0000000..e2a5d17 Binary files /dev/null and b/examples/cdrom/cdbrowse/ball16c.tim differ diff --git a/examples/cdrom/cdbrowse/main.c b/examples/cdrom/cdbrowse/main.c index 9a1dbd0..f614f1d 100644 --- a/examples/cdrom/cdbrowse/main.c +++ b/examples/cdrom/cdbrowse/main.c @@ -54,7 +54,7 @@ * July 12, 2020: Updated CD-ROM directory query logic on disc change slightly. */ -#include +#include #include #include #include @@ -67,9 +67,6 @@ #include #include -#include "ball16c.h" - - #define MAX_BALLS 1536 /* Number of balls to display */ #define OT_LEN 8 /* Ordering table length */ @@ -87,7 +84,7 @@ DISPENV disp[2]; DRAWENV draw[2]; char pribuff[2][65536]; /* Primitive packet buffers */ -u_long ot[2][OT_LEN]; /* Ordering tables */ +uint32_t ot[2][OT_LEN]; /* Ordering tables */ char *nextpri; /* Pointer to next packet buffer offset */ int db = 0; /* Double buffer index */ @@ -102,6 +99,8 @@ typedef struct BALL_TYPE BALL_TYPE balls[MAX_BALLS]; +/* Ball texture reference */ +extern const uint32_t ball16c[]; /* TIM image parameters for loading the ball texture and drawing sprites */ TIM_IMAGE tim; @@ -192,7 +191,7 @@ void init() /* Upload the ball texture */ - GetTimInfo((u_long*)ball16c, &tim); /* Get TIM parameters */ + GetTimInfo(ball16c, &tim); /* Get TIM parameters */ LoadImage(tim.prect, tim.paddr); /* Upload texture to VRAM */ if( tim.mode & 0x8 ) { diff --git a/examples/cdrom/cdxa/CMakeLists.txt b/examples/cdrom/cdxa/CMakeLists.txt index 7b90f59..70ef77c 100644 --- a/examples/cdrom/cdxa/CMakeLists.txt +++ b/examples/cdrom/cdxa/CMakeLists.txt @@ -5,7 +5,7 @@ cmake_minimum_required(VERSION 3.20) project( cdxa - LANGUAGES C + LANGUAGES C ASM VERSION 1.0.0 DESCRIPTION "PSn00bSDK CD-XA playback example" HOMEPAGE_URL "http://lameguy64.net/?page=psn00bsdk" @@ -16,6 +16,8 @@ file(GLOB _sources *.c) psn00bsdk_add_executable(cdxa STATIC ${_sources}) #psn00bsdk_add_cd_image(cdxa_iso cdxa iso.xml DEPENDS cdxa) +psn00bsdk_target_incbin(cdxa PRIVATE ball16c ball16c.tim) + install( FILES #${PROJECT_BINARY_DIR}/cdxa.bin diff --git a/examples/cdrom/cdxa/ball16c.h b/examples/cdrom/cdxa/ball16c.h deleted file mode 100644 index c79f273..0000000 --- a/examples/cdrom/cdxa/ball16c.h +++ /dev/null @@ -1,16 +0,0 @@ -unsigned int ball16c_size=192; -unsigned char ball16c[] = { -0x10,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x2c,0x00,0x00,0x00,0xc0,0x03,0x10, -0x01,0x10,0x00,0x01,0x00,0x00,0x00,0x31,0xc6,0x73,0xce,0x94,0xd2,0x07,0x9d, -0xd6,0xda,0x38,0xe3,0xef,0xbd,0x9b,0xef,0x8c,0xb1,0xc6,0x98,0xde,0xfb,0x4a, -0xa9,0xa4,0x90,0xad,0xb5,0x00,0x00,0x8c,0x00,0x00,0x00,0xc0,0x03,0x00,0x01, -0x04,0x00,0x10,0x00,0x00,0x00,0x10,0x22,0x12,0x02,0x00,0x00,0x00,0x10,0x32, -0x33,0x23,0x11,0x04,0x00,0x00,0x23,0x55,0x66,0x35,0x72,0x47,0x00,0x20,0x52, -0x86,0x68,0x36,0x12,0x97,0x0a,0x20,0x65,0xbb,0x8b,0x36,0x12,0x91,0x04,0x31, -0x85,0xbb,0x68,0x35,0x12,0x97,0xdc,0x32,0x86,0x8b,0x56,0x35,0x73,0x97,0xa4, -0x32,0x66,0x68,0x55,0x23,0x71,0x9e,0xac,0x32,0x65,0x56,0x33,0x13,0x71,0xce, -0xa4,0x21,0x33,0x33,0x23,0x11,0xe7,0xc9,0xd4,0x12,0x22,0x22,0x13,0x71,0xe7, -0xc9,0xda,0x10,0x17,0x11,0x77,0x77,0x9e,0x4c,0x0d,0x40,0x77,0x71,0xe7,0x9e, -0xc9,0xd4,0x0d,0x00,0x94,0x99,0x99,0xcc,0x4c,0xda,0x00,0x00,0xa0,0xc4,0xc4, -0x44,0xda,0x0d,0x00,0x00,0x00,0xd0,0xaa,0xda,0x0d,0x00,0x00 -}; diff --git a/examples/cdrom/cdxa/ball16c.tim b/examples/cdrom/cdxa/ball16c.tim new file mode 100644 index 0000000..e2a5d17 Binary files /dev/null and b/examples/cdrom/cdxa/ball16c.tim differ diff --git a/examples/cdrom/cdxa/main.c b/examples/cdrom/cdxa/main.c index 284b92f..4921658 100644 --- a/examples/cdrom/cdxa/main.c +++ b/examples/cdrom/cdxa/main.c @@ -116,7 +116,7 @@ * */ -#include +#include #include #include #include @@ -129,14 +129,10 @@ #include #include -#include "ball16c.h" - - #define MAX_BALLS 1536 /* Number of balls to display */ #define OT_LEN 8 /* Ordering table length */ - /* Screen coordinates */ #define SCREEN_XRES 320 #define SCREEN_YRES 240 @@ -150,7 +146,7 @@ DISPENV disp[2]; DRAWENV draw[2]; char pribuff[2][65536]; /* Primitive packet buffers */ -u_long ot[2][OT_LEN]; /* Ordering tables */ +uint32_t ot[2][OT_LEN]; /* Ordering tables */ char *nextpri; /* Pointer to next packet buffer offset */ int db = 0; /* Double buffer index */ @@ -165,6 +161,8 @@ typedef struct BALL_TYPE BALL_TYPE balls[MAX_BALLS]; +/* Ball texture reference */ +extern const uint32_t ball16c[]; /* TIM image parameters for loading the ball texture and drawing sprites */ TIM_IMAGE tim; @@ -179,9 +177,9 @@ CdlLOC xa_loc; /* XA data start location /* Sector header structure for video sector terminator */ typedef struct SECTOR_HEAD { - u_short id; - u_short chan; - u_char pad[28]; + uint16_t id; + uint16_t chan; + uint8_t pad[28]; } SECTOR_HEAD; @@ -199,7 +197,7 @@ void xa_callback(int intr, unsigned char *result) if (intr == CdlDataReady) { /* Fetch data sector */ - CdGetSector((u_long*)&xa_sector_buff, 512); + CdGetSector(&xa_sector_buff, 512); /* Quirk: This CdGetSector() implementation must fetch 2048 bytes */ /* or more otherwise the following sectors will be read in an */ @@ -224,7 +222,7 @@ void xa_callback(int intr, unsigned char *result) num_loops++; /* Retry playback by seeking to start of XA data and stream */ - CdControlF(CdlReadS, (u_char*)&xa_loc); + CdControlF(CdlReadS, &xa_loc); /* Stop playback */ //CdControlF(CdlPause, 0); @@ -276,7 +274,7 @@ void init() /* Upload the ball texture */ - GetTimInfo((u_long*)ball16c, &tim); /* Get TIM parameters */ + GetTimInfo(ball16c, &tim); /* Get TIM parameters */ LoadImage(tim.prect, tim.paddr); /* Upload texture to VRAM */ if( tim.mode & 0x8 ) { @@ -355,7 +353,7 @@ int main(int argc, const char* argv[]) /* Set CD mode for XA streaming (2x speed, send XA to SPU, enable filter */ i = CdlModeSpeed|CdlModeRT|CdlModeSF; - CdControl(CdlSetmode, (u_char*)&i, 0); + CdControl(CdlSetmode, &i, 0); /* Set file 1 on filter for channels 0-7 */ filter.file = 1; @@ -410,8 +408,8 @@ int main(int argc, const char* argv[]) if( !p_cross ) { filter.chan = sel_channel; - CdControl(CdlSetfilter, (u_char*)&filter, 0); - CdControl(CdlReadS, (u_char*)&xa_loc, 0); + CdControl(CdlSetfilter, &filter, 0); + CdControl(CdlReadS, &xa_loc, 0); xa_play_channel = sel_channel; p_cross = 1; } @@ -441,7 +439,7 @@ int main(int argc, const char* argv[]) if( !p_right ) { filter.chan = sel_channel; - CdControl(CdlSetfilter, (u_char*)&filter, 0); + CdControl(CdlSetfilter, &filter, 0); xa_play_channel = sel_channel; p_right = 1; } diff --git a/examples/graphics/balls/CMakeLists.txt b/examples/graphics/balls/CMakeLists.txt index f5297c3..deee473 100644 --- a/examples/graphics/balls/CMakeLists.txt +++ b/examples/graphics/balls/CMakeLists.txt @@ -5,7 +5,7 @@ cmake_minimum_required(VERSION 3.20) project( balls - LANGUAGES C + LANGUAGES C ASM VERSION 1.0.0 DESCRIPTION "PSn00bSDK sprites example" HOMEPAGE_URL "http://lameguy64.net/?page=psn00bsdk" @@ -15,4 +15,6 @@ file(GLOB _sources *.c) psn00bsdk_add_executable(balls STATIC ${_sources}) #psn00bsdk_add_cd_image(balls_iso balls iso.xml DEPENDS balls) +psn00bsdk_target_incbin(balls PRIVATE ball16c ball16c.tim) + install(FILES ${PROJECT_BINARY_DIR}/balls.exe TYPE BIN) diff --git a/examples/graphics/balls/ball16c.h b/examples/graphics/balls/ball16c.h deleted file mode 100644 index c79f273..0000000 --- a/examples/graphics/balls/ball16c.h +++ /dev/null @@ -1,16 +0,0 @@ -unsigned int ball16c_size=192; -unsigned char ball16c[] = { -0x10,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x2c,0x00,0x00,0x00,0xc0,0x03,0x10, -0x01,0x10,0x00,0x01,0x00,0x00,0x00,0x31,0xc6,0x73,0xce,0x94,0xd2,0x07,0x9d, -0xd6,0xda,0x38,0xe3,0xef,0xbd,0x9b,0xef,0x8c,0xb1,0xc6,0x98,0xde,0xfb,0x4a, -0xa9,0xa4,0x90,0xad,0xb5,0x00,0x00,0x8c,0x00,0x00,0x00,0xc0,0x03,0x00,0x01, -0x04,0x00,0x10,0x00,0x00,0x00,0x10,0x22,0x12,0x02,0x00,0x00,0x00,0x10,0x32, -0x33,0x23,0x11,0x04,0x00,0x00,0x23,0x55,0x66,0x35,0x72,0x47,0x00,0x20,0x52, -0x86,0x68,0x36,0x12,0x97,0x0a,0x20,0x65,0xbb,0x8b,0x36,0x12,0x91,0x04,0x31, -0x85,0xbb,0x68,0x35,0x12,0x97,0xdc,0x32,0x86,0x8b,0x56,0x35,0x73,0x97,0xa4, -0x32,0x66,0x68,0x55,0x23,0x71,0x9e,0xac,0x32,0x65,0x56,0x33,0x13,0x71,0xce, -0xa4,0x21,0x33,0x33,0x23,0x11,0xe7,0xc9,0xd4,0x12,0x22,0x22,0x13,0x71,0xe7, -0xc9,0xda,0x10,0x17,0x11,0x77,0x77,0x9e,0x4c,0x0d,0x40,0x77,0x71,0xe7,0x9e, -0xc9,0xd4,0x0d,0x00,0x94,0x99,0x99,0xcc,0x4c,0xda,0x00,0x00,0xa0,0xc4,0xc4, -0x44,0xda,0x0d,0x00,0x00,0x00,0xd0,0xaa,0xda,0x0d,0x00,0x00 -}; diff --git a/examples/graphics/balls/main.c b/examples/graphics/balls/main.c index e429a4b..5af0bfb 100644 --- a/examples/graphics/balls/main.c +++ b/examples/graphics/balls/main.c @@ -18,14 +18,12 @@ * */ -#include +#include #include #include #include #include #include -#include "ball16c.h" - #define MAX_BALLS 1024 @@ -42,10 +40,10 @@ DISPENV disp; DRAWENV draw; -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 */ +char pribuff[2][65536]; /* Primitive packet buffers */ +uint32_t ot[2][OT_LEN]; /* Ordering tables */ +char *nextpri; /* Pointer to next packet buffer offset */ +int db = 0; /* Double buffer index */ /* Ball struct and array */ @@ -57,6 +55,8 @@ typedef struct { BALL_TYPE balls[MAX_BALLS]; +/* Ball texture reference */ +extern const uint32_t ball16c[]; /* TIM image parameters for loading the ball texture and drawing sprites */ TIM_IMAGE tim; @@ -96,7 +96,7 @@ void init() { /* Upload the ball texture */ printf("Upload texture... "); - GetTimInfo( (u_long*)ball16c, &tim ); /* Get TIM parameters */ + GetTimInfo( ball16c, &tim ); /* Get TIM parameters */ LoadImage( tim.prect, tim.paddr ); /* Upload texture to VRAM */ if( tim.mode & 0x8 ) { diff --git a/examples/graphics/gte/main.c b/examples/graphics/gte/main.c index 1257c88..6907c84 100644 --- a/examples/graphics/gte/main.c +++ b/examples/graphics/gte/main.c @@ -117,7 +117,7 @@ MATRIX light_mtx = { /* Reference texture data */ -extern uint32_t tim_texture[]; +extern const uint32_t tim_texture[]; /* TPage and CLUT values */ uint16_t texture_tpage; /* For the scrolling blending pattern */ diff --git a/examples/system/childexec/CMakeLists.txt b/examples/system/childexec/CMakeLists.txt index b781dea..7e91589 100644 --- a/examples/system/childexec/CMakeLists.txt +++ b/examples/system/childexec/CMakeLists.txt @@ -17,6 +17,7 @@ psn00bsdk_add_executable(parent STATIC ${_sources}) psn00bsdk_add_executable(child STATIC ${_child_sources}) #psn00bsdk_add_cd_image(childexec_iso childexec iso.xml DEPENDS parent) +psn00bsdk_target_incbin(parent PRIVATE ball16c ball16c.tim) psn00bsdk_target_incbin( parent PRIVATE child_exe ${PROJECT_BINARY_DIR}/child.exe diff --git a/examples/system/childexec/ball16c.h b/examples/system/childexec/ball16c.h deleted file mode 100644 index c79f273..0000000 --- a/examples/system/childexec/ball16c.h +++ /dev/null @@ -1,16 +0,0 @@ -unsigned int ball16c_size=192; -unsigned char ball16c[] = { -0x10,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x2c,0x00,0x00,0x00,0xc0,0x03,0x10, -0x01,0x10,0x00,0x01,0x00,0x00,0x00,0x31,0xc6,0x73,0xce,0x94,0xd2,0x07,0x9d, -0xd6,0xda,0x38,0xe3,0xef,0xbd,0x9b,0xef,0x8c,0xb1,0xc6,0x98,0xde,0xfb,0x4a, -0xa9,0xa4,0x90,0xad,0xb5,0x00,0x00,0x8c,0x00,0x00,0x00,0xc0,0x03,0x00,0x01, -0x04,0x00,0x10,0x00,0x00,0x00,0x10,0x22,0x12,0x02,0x00,0x00,0x00,0x10,0x32, -0x33,0x23,0x11,0x04,0x00,0x00,0x23,0x55,0x66,0x35,0x72,0x47,0x00,0x20,0x52, -0x86,0x68,0x36,0x12,0x97,0x0a,0x20,0x65,0xbb,0x8b,0x36,0x12,0x91,0x04,0x31, -0x85,0xbb,0x68,0x35,0x12,0x97,0xdc,0x32,0x86,0x8b,0x56,0x35,0x73,0x97,0xa4, -0x32,0x66,0x68,0x55,0x23,0x71,0x9e,0xac,0x32,0x65,0x56,0x33,0x13,0x71,0xce, -0xa4,0x21,0x33,0x33,0x23,0x11,0xe7,0xc9,0xd4,0x12,0x22,0x22,0x13,0x71,0xe7, -0xc9,0xda,0x10,0x17,0x11,0x77,0x77,0x9e,0x4c,0x0d,0x40,0x77,0x71,0xe7,0x9e, -0xc9,0xd4,0x0d,0x00,0x94,0x99,0x99,0xcc,0x4c,0xda,0x00,0x00,0xa0,0xc4,0xc4, -0x44,0xda,0x0d,0x00,0x00,0x00,0xd0,0xaa,0xda,0x0d,0x00,0x00 -}; diff --git a/examples/system/childexec/ball16c.tim b/examples/system/childexec/ball16c.tim new file mode 100644 index 0000000..e2a5d17 Binary files /dev/null and b/examples/system/childexec/ball16c.tim differ diff --git a/examples/system/childexec/child/child.c b/examples/system/childexec/child/child.c index 2ddfa73..bd17440 100644 --- a/examples/system/childexec/child/child.c +++ b/examples/system/childexec/child/child.c @@ -1,4 +1,4 @@ -#include +#include #include #include #include @@ -21,10 +21,10 @@ /* Double buffer structure */ typedef struct { - DISPENV disp; /* Display environment */ - DRAWENV draw; /* Drawing environment */ - u_long ot[OT_LEN]; /* Ordering table */ - char p[PACKET_LEN]; /* Packet buffer */ + DISPENV disp; /* Display environment */ + DRAWENV draw; /* Drawing environment */ + uint32_t ot[OT_LEN]; /* Ordering table */ + char p[PACKET_LEN]; /* Packet buffer */ } DB; /* Double buffer variables */ diff --git a/examples/system/childexec/parent.c b/examples/system/childexec/parent.c index 58f03f7..3e7d218 100644 --- a/examples/system/childexec/parent.c +++ b/examples/system/childexec/parent.c @@ -20,7 +20,7 @@ * */ -#include +#include #include #include #include @@ -29,8 +29,6 @@ #include #include #include -#include "ball16c.h" - #define MAX_BALLS 1024 @@ -48,7 +46,7 @@ DISPENV disp; DRAWENV draw; char pribuff[2][65536]; /* Primitive packet buffers */ -u_long ot[2][OT_LEN]; /* Ordering tables */ +uint32_t ot[2][OT_LEN]; /* Ordering tables */ char *nextpri; /* Pointer to next packet buffer offset */ int db = 0; /* Double buffer index */ @@ -62,6 +60,8 @@ typedef struct { BALL_TYPE balls[MAX_BALLS]; +/* Ball texture reference */ +extern const uint32_t ball16c[]; /* TIM image parameters for loading the ball texture and drawing sprites */ TIM_IMAGE tim; @@ -103,7 +103,7 @@ void init() { /* Upload the ball texture */ printf("Upload texture... "); - GetTimInfo( (u_long*)ball16c, &tim ); /* Get TIM parameters */ + GetTimInfo( ball16c, &tim ); /* Get TIM parameters */ LoadImage( tim.prect, tim.paddr ); /* Upload texture to VRAM */ if( tim.mode & 0x8 ) { diff --git a/examples/system/console/CMakeLists.txt b/examples/system/console/CMakeLists.txt index d58f212..eeb8e62 100644 --- a/examples/system/console/CMakeLists.txt +++ b/examples/system/console/CMakeLists.txt @@ -5,7 +5,7 @@ cmake_minimum_required(VERSION 3.20) project( console - LANGUAGES C + LANGUAGES C ASM VERSION 1.0.0 DESCRIPTION "PSn00bSDK stdio console example" HOMEPAGE_URL "http://lameguy64.net/?page=psn00bsdk" @@ -15,4 +15,6 @@ file(GLOB _sources *.c) psn00bsdk_add_executable(console STATIC ${_sources}) #psn00bsdk_add_cd_image(console_iso console iso.xml DEPENDS console) +psn00bsdk_target_incbin(console PRIVATE ball16c ball16c.tim) + install(FILES ${PROJECT_BINARY_DIR}/console.exe TYPE BIN) diff --git a/examples/system/console/ball16c.h b/examples/system/console/ball16c.h deleted file mode 100644 index c79f273..0000000 --- a/examples/system/console/ball16c.h +++ /dev/null @@ -1,16 +0,0 @@ -unsigned int ball16c_size=192; -unsigned char ball16c[] = { -0x10,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x2c,0x00,0x00,0x00,0xc0,0x03,0x10, -0x01,0x10,0x00,0x01,0x00,0x00,0x00,0x31,0xc6,0x73,0xce,0x94,0xd2,0x07,0x9d, -0xd6,0xda,0x38,0xe3,0xef,0xbd,0x9b,0xef,0x8c,0xb1,0xc6,0x98,0xde,0xfb,0x4a, -0xa9,0xa4,0x90,0xad,0xb5,0x00,0x00,0x8c,0x00,0x00,0x00,0xc0,0x03,0x00,0x01, -0x04,0x00,0x10,0x00,0x00,0x00,0x10,0x22,0x12,0x02,0x00,0x00,0x00,0x10,0x32, -0x33,0x23,0x11,0x04,0x00,0x00,0x23,0x55,0x66,0x35,0x72,0x47,0x00,0x20,0x52, -0x86,0x68,0x36,0x12,0x97,0x0a,0x20,0x65,0xbb,0x8b,0x36,0x12,0x91,0x04,0x31, -0x85,0xbb,0x68,0x35,0x12,0x97,0xdc,0x32,0x86,0x8b,0x56,0x35,0x73,0x97,0xa4, -0x32,0x66,0x68,0x55,0x23,0x71,0x9e,0xac,0x32,0x65,0x56,0x33,0x13,0x71,0xce, -0xa4,0x21,0x33,0x33,0x23,0x11,0xe7,0xc9,0xd4,0x12,0x22,0x22,0x13,0x71,0xe7, -0xc9,0xda,0x10,0x17,0x11,0x77,0x77,0x9e,0x4c,0x0d,0x40,0x77,0x71,0xe7,0x9e, -0xc9,0xd4,0x0d,0x00,0x94,0x99,0x99,0xcc,0x4c,0xda,0x00,0x00,0xa0,0xc4,0xc4, -0x44,0xda,0x0d,0x00,0x00,0x00,0xd0,0xaa,0xda,0x0d,0x00,0x00 -}; diff --git a/examples/system/console/ball16c.tim b/examples/system/console/ball16c.tim new file mode 100644 index 0000000..e2a5d17 Binary files /dev/null and b/examples/system/console/ball16c.tim differ diff --git a/examples/system/console/main.c b/examples/system/console/main.c index 92df0a8..b4f91b4 100644 --- a/examples/system/console/main.c +++ b/examples/system/console/main.c @@ -21,7 +21,7 @@ * */ -#include +#include #include #include #include @@ -32,8 +32,6 @@ #include #include #include -#include "ball16c.h" - #define MAX_BALLS 1024 @@ -50,10 +48,10 @@ DISPENV disp; DRAWENV draw; -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 */ +char pribuff[2][65536]; /* Primitive packet buffers */ +uint32_t ot[2][OT_LEN]; /* Ordering tables */ +char *nextpri; /* Pointer to next packet buffer offset */ +int db = 0; /* Double buffer index */ /* Ball struct and array */ @@ -65,6 +63,8 @@ typedef struct { BALL_TYPE balls[MAX_BALLS]; +/* Ball texture reference */ +extern const uint32_t ball16c[]; /* TIM image parameters for loading the ball texture and drawing sprites */ TIM_IMAGE tim; @@ -104,7 +104,7 @@ void init() { /* Upload the ball texture */ printf("Upload texture... "); - GetTimInfo( (u_long*)ball16c, &tim ); /* Get TIM parameters */ + GetTimInfo( ball16c, &tim ); /* Get TIM parameters */ LoadImage( tim.prect, tim.paddr ); /* Upload texture to VRAM */ if( tim.mode & 0x8 ) { diff --git a/examples/system/dynlink/CMakeLists.txt b/examples/system/dynlink/CMakeLists.txt index aae3bb3..f5f4ea8 100644 --- a/examples/system/dynlink/CMakeLists.txt +++ b/examples/system/dynlink/CMakeLists.txt @@ -5,7 +5,7 @@ cmake_minimum_required(VERSION 3.20) project( dynlink - LANGUAGES C + LANGUAGES C ASM VERSION 1.0.0 DESCRIPTION "PSn00bSDK dynamic linker example" HOMEPAGE_URL "http://lameguy64.net/?page=psn00bsdk" @@ -20,6 +20,8 @@ psn00bsdk_add_cd_image( DEPENDS dynlink_main dynlink_cube dynlink_balls ) +psn00bsdk_target_incbin(dynlink_balls PRIVATE ball16c library/ball16c.tim) + install( FILES ${PROJECT_BINARY_DIR}/dynlink.bin diff --git a/examples/system/dynlink/library/ball16c.h b/examples/system/dynlink/library/ball16c.h deleted file mode 100644 index c79f273..0000000 --- a/examples/system/dynlink/library/ball16c.h +++ /dev/null @@ -1,16 +0,0 @@ -unsigned int ball16c_size=192; -unsigned char ball16c[] = { -0x10,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x2c,0x00,0x00,0x00,0xc0,0x03,0x10, -0x01,0x10,0x00,0x01,0x00,0x00,0x00,0x31,0xc6,0x73,0xce,0x94,0xd2,0x07,0x9d, -0xd6,0xda,0x38,0xe3,0xef,0xbd,0x9b,0xef,0x8c,0xb1,0xc6,0x98,0xde,0xfb,0x4a, -0xa9,0xa4,0x90,0xad,0xb5,0x00,0x00,0x8c,0x00,0x00,0x00,0xc0,0x03,0x00,0x01, -0x04,0x00,0x10,0x00,0x00,0x00,0x10,0x22,0x12,0x02,0x00,0x00,0x00,0x10,0x32, -0x33,0x23,0x11,0x04,0x00,0x00,0x23,0x55,0x66,0x35,0x72,0x47,0x00,0x20,0x52, -0x86,0x68,0x36,0x12,0x97,0x0a,0x20,0x65,0xbb,0x8b,0x36,0x12,0x91,0x04,0x31, -0x85,0xbb,0x68,0x35,0x12,0x97,0xdc,0x32,0x86,0x8b,0x56,0x35,0x73,0x97,0xa4, -0x32,0x66,0x68,0x55,0x23,0x71,0x9e,0xac,0x32,0x65,0x56,0x33,0x13,0x71,0xce, -0xa4,0x21,0x33,0x33,0x23,0x11,0xe7,0xc9,0xd4,0x12,0x22,0x22,0x13,0x71,0xe7, -0xc9,0xda,0x10,0x17,0x11,0x77,0x77,0x9e,0x4c,0x0d,0x40,0x77,0x71,0xe7,0x9e, -0xc9,0xd4,0x0d,0x00,0x94,0x99,0x99,0xcc,0x4c,0xda,0x00,0x00,0xa0,0xc4,0xc4, -0x44,0xda,0x0d,0x00,0x00,0x00,0xd0,0xaa,0xda,0x0d,0x00,0x00 -}; diff --git a/examples/system/dynlink/library/ball16c.tim b/examples/system/dynlink/library/ball16c.tim new file mode 100644 index 0000000..e2a5d17 Binary files /dev/null and b/examples/system/dynlink/library/ball16c.tim differ diff --git a/examples/system/dynlink/library/balls.c b/examples/system/dynlink/library/balls.c index cfc7f58..c537167 100644 --- a/examples/system/dynlink/library/balls.c +++ b/examples/system/dynlink/library/balls.c @@ -12,7 +12,8 @@ #include #include "dll_common.h" -#include "ball16c.h" + +extern const uint32_t ball16c[]; /* Balls data */ @@ -38,7 +39,7 @@ static BALL_TYPE balls[MAX_BALLS]; static TIM_IMAGE ball_tim; void init(CONTEXT *ctx) { - GetTimInfo((const uint32_t *) ball16c, &ball_tim); + GetTimInfo(ball16c, &ball_tim); LoadImage(ball_tim.prect, ball_tim.paddr); if (ball_tim.mode & 8) -- cgit v1.2.3