Skip to content

Commit 0202061

Browse files
author
an0nym0us
committedSep 23, 2011
massive fix and upstream merge
1 parent 206a4e5 commit 0202061

File tree

29 files changed

+1444
-182
lines changed

29 files changed

+1444
-182
lines changed
 

Diff for: ‎README.md

+1
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ install it to, for example...
5252

5353
cd /path/to/psl1ght.git/
5454
export PSL1GHT=/path/to/psl1ght.git/build
55+
make install-ctrl
5556
make
5657
make install
5758

Diff for: ‎doxygen.conf

+1-1
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ EXTRACT_PRIVATE = NO
319319
# If the EXTRACT_STATIC tag is set to YES all static members of a file
320320
# will be included in the documentation.
321321

322-
EXTRACT_STATIC = NO
322+
EXTRACT_STATIC = YES
323323

324324
# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs)
325325
# defined locally in source files will be included in the documentation.

Diff for: ‎ppu/include/rsx/commands.h

+264-1
Large diffs are not rendered by default.

Diff for: ‎ppu/include/rsx/gcm_sys.h

+99-15
Original file line numberDiff line numberDiff line change
@@ -81,26 +81,45 @@
8181
/*! \brief Do not use multiple samples. */
8282
#define GCM_TF_CENTER_1 0
8383

84+
/*! \brief blue color component */
8485
#define GCM_COLOR_MASK_B 0x00000001
86+
/*! \brief green color component */
8587
#define GCM_COLOR_MASK_G 0x00000100
88+
/*! \brief red color component */
8689
#define GCM_COLOR_MASK_R 0x00010000
90+
/*! \brief alpha component */
8791
#define GCM_COLOR_MASK_A 0x01000000
8892

93+
/*! \brief clear the Z buffer (depth buffer) */
8994
#define GCM_CLEAR_Z 0x01
95+
/*! \brief clear the stencil buffer */
9096
#define GCM_CLEAR_S 0x02
97+
/*! \brief clear the red components */
9198
#define GCM_CLEAR_R 0x10
99+
/*! \brief clear the green components */
92100
#define GCM_CLEAR_G 0x20
101+
/*! \brief clear the blue components */
93102
#define GCM_CLEAR_B 0x40
103+
/*! \brief clear the alpha components */
94104
#define GCM_CLEAR_A 0x80
105+
/*! \brief clear all RGBA components, Z buffer and stencil buffer */
95106
#define GCM_CLEAR_M 0xf3
96107

108+
/*! \brief depth test never passes. */
97109
#define GCM_NEVER 0x0200
110+
/*! \brief depth test passes if the incoming depth value is less than the stored depth value. */
98111
#define GCM_LESS 0x0201
112+
/*! \brief depth test passes if the incoming depth value is equal to the stored depth value. */
99113
#define GCM_EQUAL 0x0202
114+
/*! \brief depth test passes if the incoming depth value is less than or equal to the stored depth value. */
100115
#define GCM_LEQUAL 0x0203
116+
/*! \brief depth test passes if the incoming depth value is greater than the stored depth value. */
101117
#define GCM_GREATER 0x0204
118+
/*! \brief depth test passes if the incoming depth value is not equal to the stored depth value. */
102119
#define GCM_NOTEQUAL 0x0205
120+
/*! \brief depth test passes if the incoming depth value is greater than or equal to the stored depth value. */
103121
#define GCM_GEQUAL 0x0206
122+
/*! \brief depth test always passes. */
104123
#define GCM_ALWAYS 0x0207
105124

106125
/*! \brief culling of front face */
@@ -275,67 +294,119 @@
275294
/*! \brief Smooth shading */
276295
#define GCM_SHADE_MODEL_SMOOTH 0x1D01
277296

297+
/*! \brief blend factors are zero */
278298
#define GCM_ZERO 0
299+
/*! \brief blend factors are one */
279300
#define GCM_ONE 1
301+
/*! \brief blend factors are the source color components */
280302
#define GCM_SRC_COLOR 0x0300
303+
/*! \brief blend factors are one minus source color components */
281304
#define GCM_ONE_MINUS_SRC_COLOR 0x0301
305+
/*! \brief blend factors are the source alpha component */
282306
#define GCM_SRC_ALPHA 0x0302
307+
/*! \brief blend factors are one minus the source alpha component */
283308
#define GCM_ONE_MINUS_SRC_ALPHA 0x0303
309+
/*! \brief blend factors are the destination alpha component */
284310
#define GCM_DST_ALPHA 0x0304
311+
/*! \brief blend factors are one minus the destination alpha component */
285312
#define GCM_ONE_MINUS_DST_ALPHA 0x0305
313+
/*! \brief blend factors are the destination color components */
286314
#define GCM_DST_COLOR 0x0306
315+
/*! \brief blend factors are one minus the destination color components */
287316
#define GCM_ONE_MINUS_DST_COLOR 0x0307
317+
/*! \brief blend factors are set to saturate the output */
288318
#define GCM_SRC_ALPHA_SATURATE 0x0308
319+
/*! \brief blend factors are the constant color components */
289320
#define GCM_CONSTANT_COLOR 0x8001
321+
/*! \brief blend factors are one minus the constant color components */
290322
#define GCM_ONE_MINUS_CONSTANT_COLOR 0x8002
323+
/*! \brief blend factors are the constant color alpha component */
291324
#define GCM_CONSTANT_ALPHA 0x8003
325+
/*! \brief blend factors are one minus the constant color alpha component */
292326
#define GCM_ONE_MINUS_CONSTANT_ALPHA 0x8004
293327

328+
/*! \brief use scaled source plus destination */
294329
#define GCM_FUNC_ADD 0x8006
330+
/*! \brief use the minimum of source and destination color components */
295331
#define GCM_MIN 0x8007
332+
/*! \brief use the maximum of source and destination color components */
296333
#define GCM_MAX 0x8008
334+
/*! \brief use scaled source minus destination */
297335
#define GCM_FUNC_SUBTRACT 0x800a
336+
/*! \brief use scaled destination minus source */
298337
#define GCM_FUNC_REVERSE_SUBTRACT 0x800b
338+
/*! \brief use scaled destination minus source (signed) */
299339
#define GCM_FUNC_REVERSE_SUBTRACT_SIGNED 0xf005
340+
/*! \brief use scaled source plus destination (signed) */
300341
#define GCM_FUNC_ADD_SIGNED 0xf006
342+
/*! \brief use scaled destination plus source (signed) */
301343
#define GCM_FUNC_REVERSE_ADD_SIGNED 0xf007
302344

303345
#define GCM_TRANSFER_SURFACE 0
304346
#define GCM_TRANSFER_SWIZZLE 1
305347

348+
/*! \brief Convert pixel component values using dithering. */
306349
#define GCM_TRANSFER_CONVERSION_DITHER 0
350+
/*! \brief Convert pixel component values by truncation (\em ie, ignore lower bits). */
307351
#define GCM_TRANSFER_CONVERSION_TRUNCATE 1
352+
/*! \brief Convert pixel component values by subtraction/truncation. */
308353
#define GCM_TRANSFER_CONVERSION_SUBTRACT_TRUNCATE 2
309354

355+
/*! \brief Pixel format is 1-bit alpha, 5-bit red, 5-bit green, 5-bit blue */
310356
#define GCM_TRANSFER_SCALE_FORMAT_A1R5G5B5 1
357+
/*! \brief Pixel format is 1-bit unused, 5-bit red, 5-bit green, 5-bit blue */
311358
#define GCM_TRANSFER_SCALE_FORMAT_X1R5G5B5 2
359+
/*! \brief Pixel format is 8-bit alpha, 8-bit red, 8-bit green, 8-bit blue */
312360
#define GCM_TRANSFER_SCALE_FORMAT_A8R8G8B8 3
361+
/*! \brief Pixel format is 8-bit unused, 8-bit red, 8-bit green, 8-bit blue */
313362
#define GCM_TRANSFER_SCALE_FORMAT_X8R8G8B8 4
363+
/*! \brief Pixel format is 8-bit red chrominance, 8-bit luminance, 8-bit blue chrominance, 8-bit alpha */
314364
#define GCM_TRANSFER_SCALE_FORMAT_CR8YB8CB8YA8 5
365+
/*! \brief Pixel format is 8-bit luminance, 8-bit red chrominance, 8-bit alpha, 8-bit blue chrominance */
315366
#define GCM_TRANSFER_SCALE_FORMAT_YB8CR8YA8CB8 6
367+
/*! \brief Pixel format is 5-bit red, 6-bit green, 5-bit blue */
316368
#define GCM_TRANSFER_SCALE_FORMAT_R5G6B5 7
369+
/*! \brief Pixel format is 8-bit grayscale */
317370
#define GCM_TRANSFER_SCALE_FORMAT_Y8 8
371+
/*! \brief Pixel format is 8-bit alpha */
318372
#define GCM_TRANSFER_SCALE_FORMAT_AY8 9
373+
/*! \brief Pixel format is EYB8ECR8EYA8ECB8 */
319374
#define GCM_TRANSFER_SCALE_FORMAT_EYB8ECR8EYA8ECB8 0xa
375+
/*! \brief Pixel format is ECR8EYB8ECB8EYA8 */
320376
#define GCM_TRANSFER_SCALE_FORMAT_ECR8EYB8ECB8EYA8 0xb
377+
/*! \brief Pixel format is 8-bit alpha, 8-bit blue, 8-bit green, 8-bit red */
321378
#define GCM_TRANSFER_SCALE_FORMAT_A8B8G8R8 0xc
379+
/*! \brief Pixel format is 8-bit unused, 8-bit blue, 8-bit green, 8-bit red */
322380
#define GCM_TRANSFER_SCALE_FORMAT_X8B8G8R8 0xd
323381

382+
/*! \brief Copy source image, perform logical \c AND with destination. */
324383
#define GCM_TRANSFER_OPERATION_SRCCOPY_AND 0
384+
/*! \brief Perform ROP (raster operation), and logical \c AND with destination. */
325385
#define GCM_TRANSFER_OPERATION_ROP_AND 1
386+
/*! \brief Perform blending, and logical \c AND with destination. */
326387
#define GCM_TRANSFER_OPERATION_BLEND_AND 2
388+
/*! \brief Copy source image. */
327389
#define GCM_TRANSFER_OPERATION_SRCCOPY 3
390+
/*! \brief Copy pre-multiplied source image. */
328391
#define GCM_TRANSFER_OPERATION_SRCCOPY_PREMULT 4
392+
/*! \brief Blend pre-multiplied source image. */
329393
#define GCM_TRANSFER_OPERATION_BLEND_PREMULT 5
330394

395+
/*! \brief Origin is the center of the source image. */
331396
#define GCM_TRANSFER_ORIGIN_CENTER 1
397+
/*! \brief Origin is the topleft cornet of the source image. */
332398
#define GCM_TRANSFER_ORIGIN_CORNER 2
333399

334-
#define GCM_TRANSFER_INTERPOLATOR_NEAREST 0 /* point sampling */
335-
#define GCM_TRANSFER_INTERPOLATOR_LINEAR 1 /* bilinear interpolation */
400+
/*! \brief Use point sampling interpolation. */
401+
#define GCM_TRANSFER_INTERPOLATOR_NEAREST 0
402+
/*! \brief Use point linear interpolation. */
403+
#define GCM_TRANSFER_INTERPOLATOR_LINEAR 1
336404

337-
#define GCM_TRANSFER_SURFACE_FORMAT_R5G5B5 4
405+
/*! \brief Source surface pixel format is 5-bit red, 6-bit green, 5-bit blue. */
406+
#define GCM_TRANSFER_SURFACE_FORMAT_R5G6B5 4
407+
/*! \brief Source surface pixel format is 8-bit alpha, 8-bit red, 8-bit green, 8-bit blue. */
338408
#define GCM_TRANSFER_SURFACE_FORMAT_A8R8G8B8 0xa
409+
/*! \brief Source surface pixel format is Y32. */
339410
#define GCM_TRANSFER_SURFACE_FORMAT_Y32 0xb
340411

341412
#ifdef __cplusplus
@@ -577,17 +648,21 @@ typedef struct _gcmTexture
577648
u32 offset;
578649
} gcmTexture;
579650

580-
/*! \brief Specify scaled image blit geometry and format for rsxSetTransferImage() */
651+
/*! \brief Specify scaled image blit geometry and format for rsxSetTransferScaleSurface(). */
581652
typedef struct _gcmTransferScale
582653
{
583-
/*! \brief Not sure what this dones. Possible values:
654+
/*! \brief Conversion to perform when converting pixels to lower bit precision.
655+
656+
Possible values:
584657
- \ref GCM_TRANSFER_CONVERSION_DITHER
585658
- \ref GCM_TRANSFER_CONVERSION_TRUNCATE
586659
- \ref GCM_TRANSFER_CONVERSION_SUBTRACT_TRUNCATE
587660
*/
588661
u32 conversion;
589662

590-
/*! \brief Format of image data. Possible values:
663+
/*! \brief Format of source image pixels.
664+
665+
Possible values:
591666
- \ref GCM_TRANSFER_SCALE_FORMAT_A1R5G5B5
592667
- \ref GCM_TRANSFER_SCALE_FORMAT_X1R5G5B5
593668
- \ref GCM_TRANSFER_SCALE_FORMAT_A8R8G8B8
@@ -604,7 +679,9 @@ typedef struct _gcmTransferScale
604679
*/
605680
u32 format;
606681

607-
/*! \brief Blit operation. Possible values:
682+
/*! \brief Blit operation.
683+
684+
Possible values:
608685
- \ref GCM_TRANSFER_OPERATION_SRCCOPY_AND
609686
- \ref GCM_TRANSFER_OPERATION_ROP_AND
610687
- \ref GCM_TRANSFER_OPERATION_BLEND_AND
@@ -653,29 +730,36 @@ typedef struct _gcmTransferScale
653730
/*! \brief Pitch size, in bytes, of the source image data (width multiplied by the number of bytes in each pixel). */
654731
u16 pitch;
655732

656-
/*! \brief How the origin of each pixel is determined. Possible values:
733+
/*! \brief How the origin of each pixel is determined.
734+
735+
Possible values:
657736
- \ref GCM_TRANSFER_ORIGIN_CENTER
658737
- \ref GCM_TRANSFER_ORIGIN_CORNER
659738
*/
660739
u8 origin;
661740

662-
/*! \brief Sampling for scaled blits. Possible values:
663-
- \ref GCM_TRANSFER_INTERPOLATOR_NEAREST: no interpolation
664-
- \ref GCM_TRANSFER_INTERPOLATOR_LINEAR: bilinear interpolation
741+
/*! \brief Sampling for scaled blits.
742+
743+
Possible values:
744+
- \ref GCM_TRANSFER_INTERPOLATOR_NEAREST
745+
- \ref GCM_TRANSFER_INTERPOLATOR_LINEAR
665746
*/
666747
u8 interp;
667748

668-
/*! \brief Image data offset, e.g., a value returned by gcmAddressToOffset() or gcmMapMainMemory(). */
749+
/*! \brief Image data offset, e.g., a value returned by gcmAddressToOffset()
750+
or gcmMapMainMemory(). */
669751
u32 offset;
670752

671-
/*! \brief X origin of destination rectangle. */
753+
/*! \brief X origin of the blit rectangle in the source image.
754+
Format is 16-bit fixed point, see rsxGetFixedUint16(). */
672755
u16 inX;
673756

674-
/*! \brief Y origin of destination rectangle. */
757+
/*! \brief Y origin of the blit rectangle in the source image.
758+
Format is 16-bit fixed point, see rsxGetFixedUint16(). */
675759
u16 inY;
676760
} gcmTransferScale;
677761

678-
/*! \brief Specify destination surface characteristics for rsxSetTransferImage(). */
762+
/*! \brief Specify destination surface characteristics for rsxSetTransferScaleSurface(). */
679763
typedef struct _gcmTransferSurface
680764
{
681765
/*! \brief Format of destination surface. Possible values are:

Diff for: ‎ppu/include/rsx/rsx.h

+63-4
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,65 @@ accelerated 3D chip of the PS3.
88

99
/*! \page rsxqk Quick guide to RSX programming
1010
11-
RSX is the 3D accelerated of the PS3. Here are the basic steps to get it handle
12-
your 3D objects in your application.
11+
RSX is the 3D accelerator processor of the PS3. Here are the basic steps to get
12+
it handle your 3D objects in your application.
13+
14+
You may also use basic RSX management for simple frame buffer management with
15+
double buffering .
16+
17+
18+
\section rsxqk_display_management Display management
19+
20+
The basic steps for managing the display are the following.
21+
22+
\subsection rsxqk_init Initialization
23+
24+
- Create a RSX context (see \ref rsxInit).
25+
- Configure the video (video mode, color depth, aspect ratio). See
26+
\ref videoConfigure for doing this. Default values can be obtained using
27+
\ref videoGetState.
28+
- Set flip mode (see \ref gcmSetFlipMode). To prevent unpleasant flickering,
29+
you usually want to synchronize screen flipping with vertical refresh (use
30+
the \ref GCM_FLIP_VSYNC value).
31+
- Allocate buffers in video memory. If you want to perform double buffering,
32+
you need to allocate two buffers. In the most commonly used color depth mode
33+
(32-bit = 4 bytes), each buffer has a size of
34+
<code>screen_width*screen_height*4</code>.
35+
For each buffer, the steps are the following:
36+
- Allocate a 64-byte aligned buffer in RSX memory with \ref rsxMemalign.
37+
- Generate an offset for the buffer address using \ref rsxAddressToOffset.
38+
- Setup the buffer using \ref gcmSetDisplayBuffer, providing the buffer
39+
number (starting from 0) and the buffer offset generated from the previous
40+
step.
41+
- Allocate a depth buffer, aligned to 64-byte boundary, which size can be
42+
<code>screen_width*screen_height*2</code> if using 16-bit depth mode. Use
43+
\ref rsxMemalign for this. Generate an offset to that depth buffer with
44+
\ref rsxAddressToOffset.
45+
- Reset the flip status using \ref gcmResetFlipStatus.
46+
47+
\subsection rsxqk_flip Setting the render target and flipping
48+
49+
For each frame to be drawn, the steps are the following:
50+
51+
- Write the pixel data to the buffer which is not being displayed. For
52+
instance, if buffer 0 is being displayed, write to buffer 1.
53+
- Push a flip command using \ref, gcmSetFlip specifying the buffer to be
54+
displayed (the one you just updated).
55+
- Flush the RSX buffer (\ref rsxFlushBuffer).
56+
- Force the RSX to wait for next flip (\ref gcmSetWaitFlip).
57+
- Set the new render target using \ref rsxSetSurface. You'll have to provide
58+
that function a pointer to a \ref gcmSurface structure you filled with
59+
proper color depth mode, buffer offset, depth buffer mode, etc. You can
60+
borrow proper valid values from the various graphics samples in the samples
61+
directory.
62+
63+
64+
Then, before modifying the next buffer, ensure the flip actually has occurred
65+
by querying for the flip status (\ref gcmGetFlipStatus) in a loop. Add timing
66+
after each negative query in order not to take too much CPU time. For this,
67+
a <code>usleep(200)</code> call should be fine.
1368
14-
\section Initialization
1569
16-
First of all, you need to setup the display.
1770
1871
\todo Finish that page.
1972
@@ -55,6 +108,10 @@ that the buffer is empty when that function returns.
55108
\param context Pointer to the context object.
56109
*/
57110
void rsxFlushBuffer(gcmContextData *context);
111+
112+
/*! \brief Reset the RSX command buffer.
113+
\param context Pointer to the context object.
114+
*/
58115
void rsxResetCommandBuffer(gcmContextData *context);
59116
void rsxFinish(gcmContextData *context,u32 ref_value);
60117
void rsxSetupContextData(gcmContextData *context,const u32 *addr,const u32 size,gcmContextCallback cb);
@@ -69,11 +126,13 @@ static inline s32 rsxAddressToOffset(void *ptr,u32 *offset)
69126
return gcmAddressToOffset(ptr,offset);
70127
}
71128

129+
/*! \brief Convert a floating point coordinate into 32-bit signed fixed point format. */
72130
static inline s32 rsxGetFixedSint32(const f32 f)
73131
{
74132
return (s32)(f*1048576.0f);
75133
}
76134

135+
/*! \brief Convert a floating point coordinate into 16-bit unsigned fixed point format. */
77136
static inline u16 rsxGetFixedUint16(const f32 f)
78137
{
79138
return (u16)(f*16.0f);

Diff for: ‎ppu/include/sys/process.h

+6
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,12 @@
5757
* \param ppc segment
5858
* \param crash dump param addr
5959
*/
60+
/*! \brief Configure process priority and stack size.
61+
62+
Typically call this macro outside function declarations.
63+
\param prio priority (1000 = normal)
64+
\param stacksize stack size
65+
*/
6066
#define SYS_PROCESS_PARAM(prio,stacksize) \
6167
sys_process_param_t __sys_process_param __attribute__((aligned(8), section(".sys_proc_param"), unused)) = { \
6268
sizeof(sys_process_param_t), \

Diff for: ‎ppu/include/sysutil/sysutil.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
/*! \brief Return value */
1111
#define SYSUTIL_OK 0
1212

13-
/*! \brief Event slot 0. */
13+
/*! \brief Event slot 0 */
1414
#define SYSUTIL_EVENT_SLOT0 0
1515
/*! \brief Event slot 1 */
1616
#define SYSUTIL_EVENT_SLOT1 1

Diff for: ‎ppu/librsx/commands.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -819,7 +819,7 @@ void rsxSetBlendEquation(gcmContextData *context,u16 color,u16 alpha)
819819
RSX_CONTEXT_CURRENT_END(2);
820820
}
821821

822-
void rsxSetBlendColor(gcmContextData *context,u16 color0,u16 color1)
822+
void rsxSetBlendColor(gcmContextData *context,u32 color0,u32 color1)
823823
{
824824
RSX_CONTEXT_CURRENT_BEGIN(4);
825825

@@ -944,10 +944,10 @@ void rsxSetTransferImage(gcmContextData *context,const u8 mode,const u32 dstOffs
944944
RSX_CONTEXT_CURRENTP[20] = (16 << 16);
945945

946946
RSX_CONTEXT_CURRENTP[21] = RSX_SUBCHANNEL_METHOD(6,NV03_SCALED_IMAGE_FROM_MEMORY_IMAGE_IN_SIZE,4);
947-
RSX_CONTEXT_CURRENTP[22] = ((height << 16) | width);
947+
RSX_CONTEXT_CURRENTP[22] = (((height + ((srcY+15)>>4)) << 16) | (width + ((srcX+15)>>4)));
948948
RSX_CONTEXT_CURRENTP[23] = (srcPitch | (GCM_TRANSFER_ORIGIN_CORNER << 16) | (GCM_TRANSFER_INTERPOLATOR_NEAREST << 24));
949949
RSX_CONTEXT_CURRENTP[24] = srcOffset;
950-
RSX_CONTEXT_CURRENTP[25] = 0;
950+
RSX_CONTEXT_CURRENTP[25] = ((srcY << 16) | srcX);
951951

952952
RSX_CONTEXT_CURRENT_END(26);
953953
}

Diff for: ‎ppu/sprx/Makefile

+9-6
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ all:
88
@$(MAKE) -C libcamera --no-print-directory
99
@$(MAKE) -C libaudio --no-print-directory
1010
@$(MAKE) -C libpngdec --no-print-directory
11+
@$(MAKE) -C libpngenc --no-print-directory
1112
@$(MAKE) -C libjpgdec --no-print-directory
1213
@$(MAKE) -C libgcm_sys --no-print-directory
1314
@$(MAKE) -C libresc --no-print-directory
@@ -22,8 +23,8 @@ all:
2223
@$(MAKE) -C libnp --no-print-directory
2324
@$(MAKE) -C libspurs --no-print-directory
2425
@$(MAKE) -C libspursjq --no-print-directory
25-
@$(MAKE) -C libfont --no-print-directory
26-
@$(MAKE) -C libfontFT --no-print-directory
26+
# @$(MAKE) -C libfont --no-print-directory
27+
# @$(MAKE) -C libfontFT --no-print-directory
2728
# @$(MAKE) -C libfreetype --no-print-directory
2829

2930
install:
@@ -36,6 +37,7 @@ install:
3637
@$(MAKE) -C libcamera install --no-print-directory
3738
@$(MAKE) -C libaudio install --no-print-directory
3839
@$(MAKE) -C libpngdec install --no-print-directory
40+
@$(MAKE) -C libpngenc install --no-print-directory
3941
@$(MAKE) -C libjpgdec install --no-print-directory
4042
@$(MAKE) -C libgcm_sys install --no-print-directory
4143
@$(MAKE) -C libresc install --no-print-directory
@@ -50,8 +52,8 @@ install:
5052
@$(MAKE) -C libnp install --no-print-directory
5153
@$(MAKE) -C libspurs install --no-print-directory
5254
@$(MAKE) -C libspursjq install --no-print-directory
53-
@$(MAKE) -C libfont install --no-print-directory
54-
@$(MAKE) -C libfontFT install --no-print-directory
55+
# @$(MAKE) -C libfont install --no-print-directory
56+
# @$(MAKE) -C libfontFT install --no-print-directory
5557
# @$(MAKE) -C libfreetype install --no-print-directory
5658

5759
clean:
@@ -64,6 +66,7 @@ clean:
6466
@$(MAKE) -C libcamera clean --no-print-directory
6567
@$(MAKE) -C libaudio clean --no-print-directory
6668
@$(MAKE) -C libpngdec clean --no-print-directory
69+
@$(MAKE) -C libpngenc clean --no-print-directory
6770
@$(MAKE) -C libjpgdec clean --no-print-directory
6871
@$(MAKE) -C libgcm_sys clean --no-print-directory
6972
@$(MAKE) -C libresc clean --no-print-directory
@@ -78,8 +81,8 @@ clean:
7881
@$(MAKE) -C libnp clean --no-print-directory
7982
@$(MAKE) -C libspurs clean --no-print-directory
8083
@$(MAKE) -C libspursjq clean --no-print-directory
81-
@$(MAKE) -C libfont clean --no-print-directory
82-
@$(MAKE) -C libfontFT clean --no-print-directory
84+
# @$(MAKE) -C libfont clean --no-print-directory
85+
# @$(MAKE) -C libfontFT clean --no-print-directory
8386
# @$(MAKE) -C libfreetype clean --no-print-directory
8487

8588
.PHONY: all clean install

Diff for: ‎ppu/sprx/libio/exports.h

+20-14
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,33 @@
11
#ifndef __EXPORTS_H__
22
#define __EXPORTS_H__
33

4-
EXPORT(sys_config_start, 0x068fcbc6);
5-
EXPORT(sys_config_stop, 0x6d367953);
6-
EXPORT(sys_config_add_service_listener, 0x6ae10596);
7-
EXPORT(sys_config_remove_service_listener, 0xf5d9d571);
8-
EXPORT(sys_config_register_service, 0x78f058a2);
9-
EXPORT(sys_config_unregister_service, 0x5f81900c);
104

115
/* Pad */
126
EXPORT(ioPadInit, 0x1cf98800);
137
EXPORT(ioPadEnd, 0x4d9b75d5);
148
EXPORT(ioPadClearBuf, 0x0d5f2c14);
15-
EXPORT(ioPadInfoPressMode, 0x0e2dfaad);
9+
EXPORT(ioPadInfoPressMode, 0x0e2dfaad); /* unknown FNID */
1610
EXPORT(ioPadLddRegisterController, 0x20a97ba2);
17-
EXPORT(ioPadGetInfo, 0x3aaad464);
18-
EXPORT(ioPadGetRawData, 0x3f797dff);
11+
EXPORT(ioPadGetInfo, 0x3aaad464); /* unknown FNID */
12+
EXPORT(ioPadGetRawData, 0x3f797dff); /* unknown FNID */
1913
EXPORT(ioPadGetDataExtra, 0x6bc09c61);
20-
EXPORT(ioPadInfoSensorMode, 0x78200559);
14+
EXPORT(ioPadInfoSensorMode, 0x78200559); /* unknown FNID */
2115
EXPORT(ioPadGetData, 0x8b72cda1);
2216
EXPORT(ioPadLddGetPortNo, 0x8b8231e5);
2317
EXPORT(ioPadLddDataInsert, 0xbafd6409);
24-
EXPORT(ioPadSetSensorMode, 0xbe5be3ba);
25-
EXPORT(ioPadGetCapabilityInfo, 0xdbf4c59c);
18+
EXPORT(ioPadSetSensorMode, 0xbe5be3ba); /* unknown FNID */
19+
EXPORT(ioPadGetCapabilityInfo, 0xdbf4c59c); /* unknown FNID */
2620
EXPORT(ioPadLddUnregisterController, 0xe442faa8);
2721
EXPORT(ioPadSetActDirect, 0xf65544ee);
28-
EXPORT(ioPadSetPressMode, 0xf83f8182);
29-
22+
EXPORT(ioPadSetPressMode, 0xf83f8182); /* unknown FNID */
3023
EXPORT(ioPadPeriphGetInfo, 0x4cc9b68d);
3124
EXPORT(ioPadSetPortSetting, 0x578e3c98);
3225
EXPORT(ioPadPeriphGetData, 0x8a00f264);
3326
EXPORT(ioPadGetInfo2, 0xa703a51d);
27+
EXPORT(ioPadDbgGetData, 0xcf3051f7); /* sys_io */
28+
EXPORT(ioPadDbgLddRegisterController, 0xa74396e5); /* sys_io */
29+
EXPORT(ioPadDbgLddSetDataInsertMode, 0x94b98e39); /* sys_io */
30+
EXPORT(ioPadDbgPeriphRegisterDevice, 0x7c5d5fc1); /* sys_io */
3431

3532
/* Mouse */
3633
EXPORT(ioMouseInit, 0xc9030138);
@@ -56,4 +53,13 @@ EXPORT(ioKbGetInfo, 0x2f1774d5);
5653
EXPORT(ioKbGetConfiguration, 0x1f71ecbe);
5754
EXPORT(ioKbClearBuf, 0x2073b7f6);
5855

56+
/* SysConfig */
57+
EXPORT(ioSysConfigAddServiceListener, 0x6ae10596); /* sys_io */
58+
EXPORT(ioSysConfigRegisterService, 0x78f058a2); /* sys_io */
59+
EXPORT(ioSysConfigRemoveServiceListener, 0xf5d9d571); /* sys_io */
60+
EXPORT(ioSysConfigStart, 0x068fcbc6); /* sys_io */
61+
EXPORT(ioSysConfigStop, 0x6d367953); /* sys_io */
62+
EXPORT(ioSysConfigUnregisterService, 0x5f81900c); /* sys_io */
63+
64+
5965
#endif

Diff for: ‎ppu/sprx/libpngenc/Makefile

+102
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
#---------------------------------------------------------------------------------
2+
.SUFFIXES:
3+
#---------------------------------------------------------------------------------
4+
5+
ifeq ($(strip $(PSL1GHT)),)
6+
$(error "Please set PSL1GHT in your environment. export PSL1GHT=<path>")
7+
endif
8+
9+
include $(PSL1GHT)/ppu_rules
10+
11+
BUILD := build
12+
SOURCES := ../common .
13+
INCLUDES := .
14+
15+
#---------------------------------------------------------------------------------
16+
ifeq ($(strip $(PLATFORM)),)
17+
#---------------------------------------------------------------------------------
18+
export BASEDIR := $(CURDIR)
19+
export DEPS := $(BASEDIR)/deps
20+
export LIBS := $(BASEDIR)/lib
21+
22+
#---------------------------------------------------------------------------------
23+
# automatically build a list of object files for our project
24+
#---------------------------------------------------------------------------------
25+
export CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
26+
export CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
27+
export sFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
28+
export SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.S)))
29+
30+
export OFILES := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) \
31+
$(sFILES:.s=.o) $(SFILES:.S=.o)
32+
33+
export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir))
34+
35+
export INCLUDE := $(foreach dir,$(INCLUDES), -iquote $(CURDIR)/$(dir)) \
36+
-I$(BASEDIR)/../../include
37+
38+
#---------------------------------------------------------------------------------
39+
else
40+
#---------------------------------------------------------------------------------
41+
42+
export LIBDIR := $(LIBS)/$(PLATFORM)
43+
export DEPSDIR := $(DEPS)/$(PLATFORM)
44+
45+
#---------------------------------------------------------------------------------
46+
endif
47+
#---------------------------------------------------------------------------------
48+
49+
50+
LIBRARY := $(LIBDIR)/libpngenc
51+
52+
#---------------------------------------------------------------------------------
53+
LD := $(PREFIX)ld
54+
55+
CFLAGS := -O2 -mregnames -Wall -mcpu=cell $(MACHDEP) $(INCLUDE) -Wa,-mcell
56+
ASFLAGS := $(MACHDEP) -mregnames -mcpu=cell -D__ASSEMBLY__ -Wa,-mcell $(INCLUDE)
57+
58+
#---------------------------------------------------------------------------------
59+
60+
#---------------------------------------------------------------------------------
61+
62+
all: ppu
63+
64+
#---------------------------------------------------------------------------------
65+
ppu:
66+
#---------------------------------------------------------------------------------
67+
@[ -d $(LIBS)/ppu ] || mkdir -p $(LIBS)/ppu
68+
@[ -d $(DEPS)/ppu ] || mkdir -p $(DEPS)/ppu
69+
@[ -d ppu ] || mkdir -p ppu
70+
@$(MAKE) PLATFORM=ppu lib -C ppu -f $(CURDIR)/Makefile
71+
72+
#---------------------------------------------------------------------------------
73+
install: all
74+
#---------------------------------------------------------------------------------
75+
@[ -d $(PSL1GHT)/ppu/lib ] || mkdir -p $(PSL1GHT)/ppu/lib
76+
@cp -frv $(CURDIR)/lib/ppu/*.a $(PSL1GHT)/ppu/lib
77+
78+
#---------------------------------------------------------------------------------
79+
$(LIBRARY).a: sprx.o pngdec.o
80+
#---------------------------------------------------------------------------------
81+
82+
.PHONY: lib ppu install
83+
84+
#---------------------------------------------------------------------------------
85+
lib: $(LIBRARY).a
86+
#---------------------------------------------------------------------------------
87+
88+
libexport.o: libexport.c
89+
@$(CC) $(DEPSOPT) -S -m32 $(INCLUDE) $< -o libexport.S
90+
@$(CC) $(DEPSOPT) -c libexport.S -o $@
91+
92+
sprx.o: exports.o libexport.o
93+
@$(LD) -r exports.o libexport.o -o $@
94+
#---------------------------------------------------------------------------------
95+
clean:
96+
#---------------------------------------------------------------------------------
97+
@echo clean ...
98+
@rm -rf ppu
99+
@rm -rf $(DEPS)
100+
@rm -rf $(LIBS)
101+
102+
-include $(DEPSDIR)/*.d

Diff for: ‎ppu/sprx/libpngenc/config.h

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#define LIBRARY_NAME "cellPngEnc"
2+
#define LIBRARY_SYMBOL cellPngEnc
3+
4+
#define LIBRARY_HEADER_1 0x2c000001
5+
#define LIBRARY_HEADER_2 0x0009

Diff for: ‎ppu/sprx/libpngenc/exports.h

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#ifndef __EXPORTS_H__
2+
#define __EXPORTS_H__
3+
4+
EXPORT(pngEncOpen, 0x19256dc5);
5+
EXPORT(pngEncOpenEx, 0xc82558ce);
6+
EXPORT(pngEncClose, 0x117cd726);
7+
EXPORT(pngEncEncodePicture, 0x5b546ca4);
8+
EXPORT(pngEncGetStreamInfo, 0x585269bc);
9+
EXPORT(pngEncReset, 0x6ac91de3);
10+
EXPORT(pngEncQueryAttr, 0x496cfcd0);
11+
EXPORT(pngEncWaitForInput, 0x662bd637);
12+
EXPORT(pngEncWaitForOutput, 0x90ef2963);
13+
14+
#endif

Diff for: ‎ppu/sprx/libpngenc/pngdec.c

+117
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
/* libpng.c
2+
*/
3+
4+
#include <malloc.h>
5+
#include <string.h>
6+
#include <ppu-asm.h>
7+
8+
#include <pngdec/pngdec.h>
9+
10+
static void* png_malloc(u32 size,void *usrdata)
11+
{
12+
return malloc(size);
13+
}
14+
15+
static void png_free(void *ptr,void *usrdata)
16+
{
17+
return free(ptr);
18+
}
19+
20+
static s32 decodePNG(pngDecSource *src,pngData *out)
21+
{
22+
s32 mHandle,sHandle,ret;
23+
u32 space_allocated;
24+
u64 bytes_per_line;
25+
pngDecInfo DecInfo;
26+
pngDecInParam inParam;
27+
pngDecOutParam outParam;
28+
pngDecDataInfo DecDataInfo;
29+
pngDecThreadInParam InThdParam;
30+
pngDecThreadOutParam OutThdParam;
31+
32+
InThdParam.enable = 0;
33+
InThdParam.ppu_prio = 512;
34+
InThdParam.spu_prio = 200;
35+
InThdParam.malloc_func = __get_addr32(__get_opd32(png_malloc));
36+
InThdParam.malloc_arg = 0; // no args
37+
InThdParam.free_func = __get_addr32(__get_opd32(png_free));
38+
InThdParam.free_arg = 0; // no args
39+
40+
ret= pngDecCreate(&mHandle, &InThdParam, &OutThdParam);
41+
42+
out->bmp_out = NULL;
43+
if(ret==0) {
44+
ret = pngDecOpen(mHandle,&sHandle,src,&space_allocated);
45+
if(ret==0) {
46+
ret = pngDecReadHeader(mHandle,sHandle,&DecInfo);
47+
if(ret==0) {
48+
inParam.cmd_ptr = 0;
49+
inParam.mode = PNGDEC_TOP_TO_BOTTOM;
50+
inParam.space = PNGDEC_ARGB;
51+
inParam.bit_depth = 8;
52+
inParam.pack_flag = 1;
53+
if(DecInfo.space==PNGDEC_GRAYSCALE_ALPHA || DecInfo.space==PNGDEC_RGBA || DecInfo.chunk_info&0x10)
54+
inParam.alpha_select = 0;
55+
else
56+
inParam.alpha_select = 1;
57+
58+
inParam.alpha = 0xff;
59+
60+
ret = pngDecSetParameter(mHandle,sHandle,&inParam,&outParam);
61+
}
62+
63+
if(ret==0) {
64+
out->pitch = bytes_per_line = outParam.width*4;
65+
out->bmp_out = malloc(out->pitch*outParam.height);
66+
if(!out->bmp_out)
67+
ret = -1;
68+
else {
69+
memset(out->bmp_out,0,(bytes_per_line*outParam.height));
70+
71+
ret = pngDecDecodeData(mHandle,sHandle,out->bmp_out,&bytes_per_line,&DecDataInfo);
72+
if(ret==0 && DecDataInfo.status==0) {
73+
out->width = outParam.width;
74+
out->height = outParam.height;
75+
76+
ret = 0;
77+
}
78+
}
79+
}
80+
pngDecClose(mHandle,sHandle);
81+
}
82+
if(ret && out->bmp_out) {
83+
free(out->bmp_out);
84+
out->bmp_out = NULL;
85+
}
86+
87+
pngDecDestroy(mHandle);
88+
}
89+
return ret;
90+
}
91+
92+
s32 pngLoadFromFile(const char *filename,pngData *out)
93+
{
94+
pngDecSource source;
95+
96+
memset(&source,0,sizeof(pngDecSource));
97+
98+
source.stream = PNGDEC_FILE;
99+
source.file_name = __get_addr32(filename);
100+
source.enable = PNGDEC_DISABLE;
101+
102+
return decodePNG(&source,out);
103+
}
104+
105+
s32 pngLoadFromBuffer(const void *buffer,u32 size,pngData *out)
106+
{
107+
pngDecSource source;
108+
109+
memset(&source,0,sizeof(pngDecSource));
110+
111+
source.stream = PNGDEC_BUFFER;
112+
source.stream_ptr = __get_addr32(buffer);
113+
source.stream_size = size;
114+
source.enable = PNGDEC_DISABLE;
115+
116+
return decodePNG(&source,out);
117+
}

Diff for: ‎ppu/sprx/libresc/resc_wrapper.c

-1
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,3 @@ void rescSetFlipHandler(void (*handler)(const u32 head))
1717
rescSetFlipHandlerEx((opd32*)__get_opd32(handler));
1818
}
1919

20-

Diff for: ‎ppu/sprx/libspurs/exports.h

+18-17
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,23 @@
22
#define __EXPORTS_H__
33

44

5-
EXPORT(spursAttributeInitialize, 0x95180230); /* cellSpurs */
6-
EXPORT(spursEventFlagInitialize, 0x5ef96465); /* cellSpurs */
7-
EXPORT(spursJobChainAttributeInitialize, 0x3548f483); /* cellSpurs */
8-
EXPORT(spursLFQueueInitialize, 0x011ee38b); /* cellSpurs */
9-
EXPORT(spursLFQueuePopBody, 0x35dae22b); /* cellSpurs */
10-
EXPORT(spursLFQueuePushBody, 0x8a85674d); /* cellSpurs */
11-
EXPORT(spursQueueInitialize, 0x082bfb09); /* cellSpurs */
12-
EXPORT(spursSemaphoreInitialize, 0x77cdac0c); /* cellSpurs */
13-
EXPORT(spursSendSignal, 0xe0a6dbe4); /* cellSpurs */
14-
EXPORT(spursTaskAttribute2Initialize, 0x8adadf65); /* cellSpurs */
15-
EXPORT(spursTaskAttributeInitialize, 0xb8474eff); /* cellSpurs */
16-
EXPORT(spursTasksetAttribute2Initialize, 0xc2acdf43); /* cellSpurs */
17-
EXPORT(spursTasksetAttributeInitialize, 0x16394a4e); /* cellSpurs */
18-
EXPORT(spursWorkloadAttributeInitialize, 0xefeb2679); /* cellSpurs */
19-
EXPORT(spursWorkloadFlagReceiver, 0xa73bf47e); /* cellSpurs */
20-
EXPORT(spursWorkloadFlagReceiver2, 0x2ddbcc0a); /* cellSpurs */
5+
EXPORT(_spursAttributeInitialize, 0x95180230); /* cellSpurs */
6+
EXPORT(_spursEventFlagInitialize, 0x5ef96465); /* cellSpurs */
7+
EXPORT(_spursJobChainAttributeInitialize, 0x3548f483); /* cellSpurs */
8+
EXPORT(_spursLFQueueInitialize, 0x011ee38b); /* cellSpurs */
9+
EXPORT(_spursLFQueuePopBody, 0x35dae22b); /* cellSpurs */
10+
EXPORT(_spursLFQueuePushBody, 0x8a85674d); /* cellSpurs */
11+
EXPORT(_spursQueueInitialize, 0x082bfb09); /* cellSpurs */
12+
EXPORT(_spursSemaphoreInitialize, 0x77cdac0c); /* cellSpurs */
13+
EXPORT(_spursSendSignal, 0xe0a6dbe4); /* cellSpurs */
14+
EXPORT(_spursTaskAttribute2Initialize, 0x8adadf65); /* cellSpurs */
15+
EXPORT(_spursTaskAttributeInitialize, 0xb8474eff); /* cellSpurs */
16+
EXPORT(_spursTasksetAttribute2Initialize, 0xc2acdf43); /* cellSpurs */
17+
EXPORT(_spursTasksetAttributeInitialize, 0x16394a4e); /* cellSpurs */
18+
EXPORT(_spursWorkloadAttributeInitialize, 0xefeb2679); /* cellSpurs */
19+
EXPORT(_spursWorkloadFlagReceiver, 0xa73bf47e); /* cellSpurs */
20+
EXPORT(_spursWorkloadFlagReceiver2, 0x2ddbcc0a); /* cellSpurs */
21+
2122
EXPORT(spursAddUrgentCall, 0x8fdf50b2); /* cellSpurs */
2223
EXPORT(spursAddUrgentCommand, 0x17001000); /* cellSpurs */
2324
EXPORT(spursAddWorkload, 0x69726aa2); /* cellSpurs */
@@ -34,10 +35,10 @@ EXPORT(spursCreateJobChainWithAttribute, 0x303c19cd); /* cellSpurs */
3435
EXPORT(spursCreateTask, 0xbeb600ac); /* cellSpurs */
3536
EXPORT(spursCreateTask2, 0xe14ca62d); /* cellSpurs */
3637
EXPORT(spursCreateTask2WithBinInfo, 0xe4944a1c); /* cellSpurs */
37-
EXPORT(spursCreateTaskWithAttribute, 0x1d46fedf); /* cellSpurs */
3838
EXPORT(spursCreateTaskset, 0x52cc6c82); /* cellSpurs */
3939
EXPORT(spursCreateTaskset2, 0x4a6465e3); /* cellSpurs */
4040
EXPORT(spursCreateTasksetWithAttribute, 0xc10931cb); /* cellSpurs */
41+
EXPORT(spursCreateTaskWithAttribute, 0x1d46fedf); /* cellSpurs */
4142
EXPORT(spursDestroyTaskset2, 0x1ebcf459); /* cellSpurs */
4243
EXPORT(spursDetachLv2EventQueue, 0x4e66d483); /* cellSpurs */
4344
EXPORT(spursEnableExceptionEventHandler, 0x32b94add); /* cellSpurs */

Diff for: ‎ppu/sprx/libspursjq/exports.h

+25-24
Original file line numberDiff line numberDiff line change
@@ -2,30 +2,31 @@
22
#define __EXPORTS_H__
33

44

5-
EXPORT(spursCreateJobQueue, 0xf244e799); /* cellSpursJq */
6-
EXPORT(spursCreateJobQueueWithJobDescriptorPool, 0x983be7fc); /* cellSpursJq */
7-
EXPORT(spursJobQueueAllocateJobDescriptorBody, 0x0d69929e); /* cellSpursJq */
8-
EXPORT(spursJobQueuePort2CopyPushJobBody, 0xc39173a4); /* cellSpursJq */
9-
EXPORT(spursJobQueuePort2PushAndReleaseJobBody, 0xe1731df3); /* cellSpursJq */
10-
EXPORT(spursJobQueuePort2PushJobBody, 0xcf89f218); /* cellSpursJq */
11-
EXPORT(spursJobQueuePort2PushJobListBody, 0xb53436e7); /* cellSpursJq */
12-
EXPORT(spursJobQueuePortCopyPushBody, 0x46c3fb5a); /* cellSpursJq */
13-
EXPORT(spursJobQueuePortCopyPushJobBody, 0x1917359d); /* cellSpursJq */
14-
EXPORT(spursJobQueuePortCopyPushJobBody2, 0xef66c4b7); /* cellSpursJq */
15-
EXPORT(spursJobQueuePortPushBody, 0x4e1a17a6); /* cellSpursJq */
16-
EXPORT(spursJobQueuePortPushFlush, 0xbd1c5d6b); /* cellSpursJq */
17-
EXPORT(spursJobQueuePortPushJobBody, 0x85cd04cd); /* cellSpursJq */
18-
EXPORT(spursJobQueuePortPushJobBody2, 0x90e392cf); /* cellSpursJq */
19-
EXPORT(spursJobQueuePortPushJobListBody, 0x1b6eea7e); /* cellSpursJq */
20-
EXPORT(spursJobQueuePortPushSync, 0x9396be1d); /* cellSpursJq */
21-
EXPORT(spursJobQueuePushAndReleaseJobBody, 0x1da890c7); /* cellSpursJq */
22-
EXPORT(spursJobQueuePushBody, 0x99316997); /* cellSpursJq */
23-
EXPORT(spursJobQueuePushFlush, 0xdf0120c2); /* cellSpursJq */
24-
EXPORT(spursJobQueuePushJob2Body, 0x36d0a53c); /* cellSpursJq */
25-
EXPORT(spursJobQueuePushJobBody, 0xc4843b74); /* cellSpursJq */
26-
EXPORT(spursJobQueuePushJobBody2, 0x98203e3c); /* cellSpursJq */
27-
EXPORT(spursJobQueuePushJobListBody, 0xaf1c7a1d); /* cellSpursJq */
28-
EXPORT(spursJobQueuePushSync, 0x701fd8a9); /* cellSpursJq */
5+
EXPORT(_spursCreateJobQueue, 0xf244e799); /* cellSpursJq */
6+
EXPORT(_spursCreateJobQueueWithJobDescriptorPool, 0x983be7fc); /* cellSpursJq */
7+
EXPORT(_spursJobQueueAllocateJobDescriptorBody, 0x0d69929e); /* cellSpursJq */
8+
EXPORT(_spursJobQueuePort2CopyPushJobBody, 0xc39173a4); /* cellSpursJq */
9+
EXPORT(_spursJobQueuePort2PushAndReleaseJobBody, 0xe1731df3); /* cellSpursJq */
10+
EXPORT(_spursJobQueuePort2PushJobBody, 0xcf89f218); /* cellSpursJq */
11+
EXPORT(_spursJobQueuePort2PushJobListBody, 0xb53436e7); /* cellSpursJq */
12+
EXPORT(_spursJobQueuePortCopyPushBody, 0x46c3fb5a); /* cellSpursJq */
13+
EXPORT(_spursJobQueuePortCopyPushJobBody, 0x1917359d); /* cellSpursJq */
14+
EXPORT(_spursJobQueuePortCopyPushJobBody2, 0xef66c4b7); /* cellSpursJq */
15+
EXPORT(_spursJobQueuePortPushBody, 0x4e1a17a6); /* cellSpursJq */
16+
EXPORT(_spursJobQueuePortPushFlush, 0xbd1c5d6b); /* cellSpursJq */
17+
EXPORT(_spursJobQueuePortPushJobBody, 0x85cd04cd); /* cellSpursJq */
18+
EXPORT(_spursJobQueuePortPushJobBody2, 0x90e392cf); /* cellSpursJq */
19+
EXPORT(_spursJobQueuePortPushJobListBody, 0x1b6eea7e); /* cellSpursJq */
20+
EXPORT(_spursJobQueuePortPushSync, 0x9396be1d); /* cellSpursJq */
21+
EXPORT(_spursJobQueuePushAndReleaseJobBody, 0x1da890c7); /* cellSpursJq */
22+
EXPORT(_spursJobQueuePushBody, 0x99316997); /* cellSpursJq */
23+
EXPORT(_spursJobQueuePushFlush, 0xdf0120c2); /* cellSpursJq */
24+
EXPORT(_spursJobQueuePushJob2Body, 0x36d0a53c); /* cellSpursJq */
25+
EXPORT(_spursJobQueuePushJobBody, 0xc4843b74); /* cellSpursJq */
26+
EXPORT(_spursJobQueuePushJobBody2, 0x98203e3c); /* cellSpursJq */
27+
EXPORT(_spursJobQueuePushJobListBody, 0xaf1c7a1d); /* cellSpursJq */
28+
EXPORT(_spursJobQueuePushSync, 0x701fd8a9); /* cellSpursJq */
29+
2930
EXPORT(spursGetJobQueueId, 0xc343ee10); /* cellSpursJq */
3031
EXPORT(spursJobQueueAttributeInitialize, 0x43ddab4f); /* cellSpursJq */
3132
EXPORT(spursJobQueueAttributeSetDoBusyWaiting, 0x0582338a); /* cellSpursJq */

Diff for: ‎ppu/sprx/todo/libio.exports.h

+50-40
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,58 @@
11
#ifndef __EXPORTS_H__
22
#define __EXPORTS_H__
33

4+
/* Pad */
5+
EXPORT(ioPadInit, 0x1cf98800); /* sys_io */
6+
EXPORT(ioPadEnd, 0x4d9b75d5); /* sys_io */
7+
EXPORT(ioPadClearBuf, 0x0d5f2c14); /* sys_io */
48

5-
EXPORT(kbClearBuf, 0x2073b7f6); /* sys_io */
6-
EXPORT(kbCnvRawCode, 0x4ab1fa77); /* sys_io */
7-
EXPORT(kbEnd, 0xbfce3285); /* sys_io */
8-
EXPORT(kbGetConfiguration, 0x1f71ecbe); /* sys_io */
9-
EXPORT(kbGetInfo, 0x2f1774d5); /* sys_io */
10-
EXPORT(kbInit, 0x433f6ec0); /* sys_io */
11-
EXPORT(kbRead, 0xff0a21b7); /* sys_io */
12-
EXPORT(kbSetCodeType, 0xa5f85e4d); /* sys_io */
13-
EXPORT(kbSetLEDStatus, 0x3f72c56e); /* sys_io */
14-
EXPORT(kbSetReadMode, 0xdeefdfa7); /* sys_io */
15-
16-
EXPORT(mouseClearBuf, 0x3ef66b95); /* sys_io */
17-
EXPORT(mouseEnd, 0xe10183ce); /* sys_io */
18-
EXPORT(mouseGetData, 0x3138e632); /* sys_io */
19-
EXPORT(mouseGetDataList, 0x6bd131f0); /* sys_io */
20-
EXPORT(mouseGetInfo, 0x5baf30fb); /* sys_io */
21-
EXPORT(mouseGetRawData, 0xa328cc35); /* sys_io */
22-
EXPORT(mouseGetTabletDataList, 0x21a62e9b); /* sys_io */
23-
EXPORT(mouseInfoTabletMode, 0x4d0b3b1f); /* sys_io */
24-
EXPORT(mouseInit, 0xc9030138); /* sys_io */
25-
EXPORT(mouseSetTabletMode, 0x2d16da4f); /* sys_io */
26-
27-
EXPORT(padClearBuf, 0x0d5f2c14); /* sys_io */
28-
EXPORT(padDbgGetData, 0xcf3051f7); /* sys_io */
29-
EXPORT(padDbgLddRegisterController, 0xa74396e5); /* sys_io */
30-
EXPORT(padDbgLddSetDataInsertMode, 0x94b98e39); /* sys_io */
31-
EXPORT(padDbgPeriphRegisterDevice, 0x7c5d5fc1); /* sys_io */
32-
EXPORT(padEnd, 0x4d9b75d5); /* sys_io */
33-
EXPORT(padGetData, 0x8b72cda1); /* sys_io */
34-
EXPORT(padGetDataExtra, 0x6bc09c61); /* sys_io */
35-
EXPORT(padGetInfo2, 0xa703a51d); /* sys_io */
36-
EXPORT(padInit, 0x1cf98800); /* sys_io */
37-
EXPORT(padLddDataInsert, 0xbafd6409); /* sys_io */
38-
EXPORT(padLddGetPortNo, 0x8b8231e5); /* sys_io */
39-
EXPORT(padLddRegisterController, 0x20a97ba2); /* sys_io */
40-
EXPORT(padLddUnregisterController, 0xe442faa8); /* sys_io */
41-
EXPORT(padPeriphGetData, 0x8a00f264); /* sys_io */
42-
EXPORT(padPeriphGetInfo, 0x4cc9b68d); /* sys_io */
43-
EXPORT(padSetActDirect, 0xf65544ee); /* sys_io */
44-
EXPORT(padSetPortSetting, 0x578e3c98); /* sys_io */
9+
EXPORT(ioPadLddRegisterController, 0x20a97ba2); /* sys_io */
4510

11+
12+
EXPORT(ioPadGetDataExtra, 0x6bc09c61); /* sys_io */
13+
14+
EXPORT(ioPadGetData, 0x8b72cda1); /* sys_io */
15+
EXPORT(ioPadLddGetPortNo, 0x8b8231e5); /* sys_io */
16+
EXPORT(ioPadLddDataInsert, 0xbafd6409); /* sys_io */
17+
18+
19+
EXPORT(ioPadLddUnregisterController, 0xe442faa8); /* sys_io */
20+
EXPORT(ioPadSetActDirect, 0xf65544ee); /* sys_io */
21+
22+
EXPORT(ioPadPeriphGetInfo, 0x4cc9b68d); /* sys_io */
23+
EXPORT(ioPadSetPortSetting, 0x578e3c98); /* sys_io */
24+
EXPORT(ioPadPeriphGetData, 0x8a00f264); /* sys_io */
25+
EXPORT(ioPadGetInfo2, 0xa703a51d); /* sys_io */
26+
EXPORT(ioPadDbgGetData, 0xcf3051f7); /* sys_io */
27+
EXPORT(ioPadDbgLddRegisterController, 0xa74396e5); /* sys_io */
28+
EXPORT(ioPadDbgLddSetDataInsertMode, 0x94b98e39); /* sys_io */
29+
EXPORT(ioPadDbgPeriphRegisterDevice, 0x7c5d5fc1); /* sys_io */
30+
31+
/* Mouse */
32+
EXPORT(ioMouseInit, 0xc9030138); /* sys_io */
33+
EXPORT(ioMouseEnd, 0xe10183ce); /* sys_io */
34+
EXPORT(ioMouseClearBuf, 0x3ef66b95); /* sys_io */
35+
EXPORT(ioMouseGetInfo, 0x5baf30fb); /* sys_io */
36+
EXPORT(ioMouseGetTabletDataList, 0x21a62e9b); /* sys_io */
37+
EXPORT(ioMouseSetTabletMode, 0x2d16da4f); /* sys_io */
38+
EXPORT(ioMouseGetData, 0x3138e632); /* sys_io */
39+
EXPORT(ioMouseInfoTabletMode, 0x4d0b3b1f); /* sys_io */
40+
EXPORT(ioMouseGetRawData, 0xa328cc35); /* sys_io */
41+
EXPORT(ioMouseGetDataList, 0x6bd131f0); /* sys_io */
42+
43+
/* Keyboard */
44+
EXPORT(ioKbInit, 0x433f6ec0); /* sys_io */
45+
EXPORT(ioKbEnd, 0xbfce3285); /* sys_io */
46+
EXPORT(ioKbRead, 0xff0a21b7); /* sys_io */
47+
EXPORT(ioKbSetReadMode, 0xdeefdfa7); /* sys_io */
48+
EXPORT(ioKbSetCodeType, 0xa5f85e4d); /* sys_io */
49+
EXPORT(ioKbCnvRawCode, 0x4ab1fa77); /* sys_io */
50+
EXPORT(ioKbSetLEDStatus, 0x3f72c56e); /* sys_io */
51+
EXPORT(ioKbGetInfo, 0x2f1774d5); /* sys_io */
52+
EXPORT(ioKbGetConfiguration, 0x1f71ecbe); /* sys_io */
53+
EXPORT(ioKbClearBuf, 0x2073b7f6); /* sys_io */
54+
55+
/* SysConfig */
4656
EXPORT(ioSysConfigAddServiceListener, 0x6ae10596); /* sys_io */
4757
EXPORT(ioSysConfigRegisterService, 0x78f058a2); /* sys_io */
4858
EXPORT(ioSysConfigRemoveServiceListener, 0xf5d9d571); /* sys_io */

Diff for: ‎ppu_rules

+14-6
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ include $(PSL1GHT)/base_rules
2121
include $(PSL1GHT)/data_rules
2222

2323
PKG := pkg.py
24-
SFOPY := sfo.py
2524
SFO := make_sfo$(POSTFIX)
25+
SFOPY := sfo.py
2626

2727
SPRX := sprxlinker$(POSTFIX)
2828
CGCOMP := cgcomp$(POSTFIX)
@@ -34,9 +34,15 @@ FSELF_NPDRM := $(FSELF) -n
3434
DEX_FSELF := make_fself$(POSTFIX)
3535
DEX_FSELF_NPDRM := make_fself_npdrm$(POSTFIX)
3636

37-
#FW 3.55 Tools
37+
# fake SELF type4 / type8 tools
38+
FSELF := fself.py
39+
FSELF_NPDRM := $(FSELF) -n
40+
41+
# signed SELF type4 / type8 tools
3842
SELF := make_self
3943
SELF_NPDRM := make_self_npdrm
44+
45+
# NPDRM pkg tool
4046
PACKAGE_FINALIZE := package_finalize
4147

4248
# Package settings - allow for user override
@@ -68,23 +74,25 @@ BUILDDIR ?= $(CURDIR)/build
6874

6975
#---------------------------------------------------------------------------------
7076
%.self: %.elf
71-
$(VERB) echo CEX self .. $(notdir $@)
77+
$(VERB) echo CEX self ... $(notdir $@)
7278
$(VERB) mkdir -p $(BUILDDIR)
7379
$(VERB) $(STRIP) $< -o $(BUILDDIR)/$(notdir $<)
7480
$(VERB) $(SPRX) $(BUILDDIR)/$(notdir $<)
75-
$(VERB) $(FSELF) $(BUILDDIR)/$(notdir $<) $@
81+
$(VERB) $(SELF) $(BUILDDIR)/$(notdir $<) $@
82+
$(VERB) $(FSELF) $(BUILDDIR)/$(notdir $<) $(basename $@).fake.self
7683

7784
%.pkg: %.self
7885
$(VERB) echo building pkg ... $(notdir $@)
7986
$(VERB) mkdir -p $(BUILDDIR)/pkg/USRDIR
80-
$(VERB) cp $(ICON0) $(BUILDDIR)/pkg/
87+
$(VERB) cp $(ICON0) $(BUILDDIR)/pkg/ICON0.PNG
8188
$(VERB) $(SELF_NPDRM) $(BUILDDIR)/$(basename $(notdir $<)).elf $(BUILDDIR)/pkg/USRDIR/EBOOT.BIN $(CONTENTID) >> /dev/null
8289
$(VERB) $(SFO) --title "$(TITLE)" --appid "$(APPID)" -f $(SFOXML) $(BUILDDIR)/pkg/PARAM.SFO
83-
$(VERB) if [ -n "$(PKGFILES)" -a -d "$(PKGFILES)" ]; then cp -fr $(PKGFILES)/* $(BUILDDIR)/pkg/; fi
90+
$(VERB) if [ -n "$(PKGFILES)" -a -d "$(PKGFILES)" ]; then cp -rf $(PKGFILES)/* $(BUILDDIR)/pkg/; fi
8491
$(VERB) $(PKG) --contentid $(CONTENTID) $(BUILDDIR)/pkg/ $@ >> /dev/null
8592
$(VERB) cp $@ $(basename $@).gnpdrm.pkg
8693
$(VERB) $(PACKAGE_FINALIZE) $(basename $@).gnpdrm.pkg
8794

95+
#---------------------------------------------------------------------------------
8896
%.vpo: %.vcg
8997
$(VERB) echo $(notdir $<)
9098
$(VERB) $(CGCOMP) -v $^ $@

Diff for: ‎samples/graphics/blitting/Makefile

+137
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,137 @@
1+
#---------------------------------------------------------------------------------
2+
# Clear the implicit built in rules
3+
#---------------------------------------------------------------------------------
4+
.SUFFIXES:
5+
#---------------------------------------------------------------------------------
6+
ifeq ($(strip $(PSL1GHT)),)
7+
$(error "Please set PSL1GHT in your environment. export PSL1GHT=<path>")
8+
endif
9+
10+
include $(PSL1GHT)/ppu_rules
11+
12+
#---------------------------------------------------------------------------------
13+
# TARGET is the name of the output
14+
# BUILD is the directory where object files & intermediate files will be placed
15+
# SOURCES is a list of directories containing source code
16+
# INCLUDES is a list of directories containing extra header files
17+
#---------------------------------------------------------------------------------
18+
TARGET := $(notdir $(CURDIR))
19+
BUILD := build
20+
SOURCES := source
21+
DATA := data
22+
INCLUDES := include
23+
24+
#---------------------------------------------------------------------------------
25+
# options for code generation
26+
#---------------------------------------------------------------------------------
27+
28+
CFLAGS = -O2 -Wall -mcpu=cell $(MACHDEP) $(INCLUDE)
29+
CXXFLAGS = $(CFLAGS)
30+
31+
LDFLAGS = $(MACHDEP) -Wl,-Map,$(notdir $@).map
32+
33+
#---------------------------------------------------------------------------------
34+
# any extra libraries we wish to link with the project
35+
#---------------------------------------------------------------------------------
36+
LIBS := -lrsx -lgcm_sys -lio -lsysutil -lrt -llv2 -lm
37+
38+
#---------------------------------------------------------------------------------
39+
# list of directories containing libraries, this must be the top level containing
40+
# include and lib
41+
#---------------------------------------------------------------------------------
42+
LIBDIRS :=
43+
44+
#---------------------------------------------------------------------------------
45+
# no real need to edit anything past this point unless you need to add additional
46+
# rules for different file extensions
47+
#---------------------------------------------------------------------------------
48+
ifneq ($(BUILD),$(notdir $(CURDIR)))
49+
#---------------------------------------------------------------------------------
50+
51+
export OUTPUT := $(CURDIR)/$(TARGET)
52+
53+
export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \
54+
$(foreach dir,$(DATA),$(CURDIR)/$(dir))
55+
56+
export DEPSDIR := $(CURDIR)/$(BUILD)
57+
58+
export BUILDDIR := $(CURDIR)/$(BUILD)
59+
60+
#---------------------------------------------------------------------------------
61+
# automatically build a list of object files for our project
62+
#---------------------------------------------------------------------------------
63+
CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
64+
CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
65+
sFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
66+
SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.S)))
67+
BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))
68+
69+
#---------------------------------------------------------------------------------
70+
# use CXX for linking C++ projects, CC for standard C
71+
#---------------------------------------------------------------------------------
72+
ifeq ($(strip $(CPPFILES)),)
73+
export LD := $(CC)
74+
else
75+
export LD := $(CXX)
76+
endif
77+
78+
export OFILES := $(addsuffix .o,$(BINFILES)) \
79+
$(CPPFILES:.cpp=.o) $(CFILES:.c=.o) \
80+
$(sFILES:.s=.o) $(SFILES:.S=.o)
81+
82+
#---------------------------------------------------------------------------------
83+
# build a list of include paths
84+
#---------------------------------------------------------------------------------
85+
export INCLUDE := $(foreach dir,$(INCLUDES), -I$(CURDIR)/$(dir)) \
86+
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
87+
$(LIBPSL1GHT_INC) \
88+
-I$(CURDIR)/$(BUILD)
89+
90+
#---------------------------------------------------------------------------------
91+
# build a list of library paths
92+
#---------------------------------------------------------------------------------
93+
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib) \
94+
$(LIBPSL1GHT_LIB)
95+
96+
export OUTPUT := $(CURDIR)/$(TARGET)
97+
.PHONY: $(BUILD) clean bin
98+
99+
#---------------------------------------------------------------------------------
100+
$(BUILD):
101+
@[ -d $@ ] || mkdir -p $@
102+
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
103+
104+
#---------------------------------------------------------------------------------
105+
clean:
106+
@echo clean ...
107+
@rm -fr $(BUILD) $(OUTPUT).elf $(OUTPUT).self
108+
109+
#---------------------------------------------------------------------------------
110+
run:
111+
ps3load $(OUTPUT).self
112+
113+
114+
#---------------------------------------------------------------------------------
115+
else
116+
117+
DEPENDS := $(OFILES:.o=.d)
118+
119+
#---------------------------------------------------------------------------------
120+
# main targets
121+
#---------------------------------------------------------------------------------
122+
$(OUTPUT).self: $(OUTPUT).elf
123+
$(OUTPUT).elf: $(OFILES)
124+
125+
#---------------------------------------------------------------------------------
126+
# This rule links in binary data with the .bin extension
127+
#---------------------------------------------------------------------------------
128+
%.bin.o : %.bin
129+
#---------------------------------------------------------------------------------
130+
@echo $(notdir $<)
131+
@$(bin2o)
132+
133+
-include $(DEPENDS)
134+
135+
#---------------------------------------------------------------------------------
136+
endif
137+
#---------------------------------------------------------------------------------

Diff for: ‎samples/graphics/blitting/include/bitmap.h

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
2+
3+
4+
typedef struct {
5+
u32 width;
6+
u32 height;
7+
u32 *pixels;
8+
u32 offset;
9+
} Bitmap;
10+
11+
void bitmapInit(Bitmap *bitmap, u32 width, u32 height);
12+
13+
void bitmapDestroy(Bitmap *bitmap);
14+
15+
void bitmapSetXpm(Bitmap *bitmap, char * xpm[]);

Diff for: ‎samples/graphics/blitting/include/psl1ght.xpm

+59
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
/* XPM */
2+
static char * psl1ght_xpm[] = {
3+
"224 40 16 1",
4+
" c #000000",
5+
". c #210000",
6+
"+ c #420000",
7+
"@ c #212142",
8+
"# c #632121",
9+
"$ c #424263",
10+
"% c #9C4242",
11+
"& c #63639C",
12+
"* c #BD6363",
13+
"= c #9C9CBD",
14+
"- c #DE9C9C",
15+
"; c #BDBDDE",
16+
"> c #FFBDBD",
17+
", c #FFD6D6",
18+
"' c #DEDEFF",
19+
") c #DEFFFF",
20+
" @$$$&&&&&&&&&&&&&$@ @@$&&&&&&&==========$@ @$$$@ @$$$@ @@$$&&&==========$@ @$$$@ @$$$@ @$$&&&&=====;=;;;;;;=====$@ ",
21+
" $&&&&;;;;;;;;;;;;;==&$@ @$&&;;;;;;&&&&&&&&&='';&$ $$&&&$$ $$&&&$$ @$&&&&&&&&&&&&&&='';&$ $$&&&$$ $$&&&$$ $&===;;;;;;;;;;;;;==&&&='';&$ ",
22+
"@&&&=='))))))))))))'';=&$ $&==;;;''))))))))))))))'&$@ @$&&==&&@ $$&&==&&@ $&&===;'''))))))))))'&$@ @$&&==&&@ @$&&==&&@ @&==;;;;;''))))))))))))))))'&&@ ",
23+
"$&&=;'))))))))))))))))';=&@ &==;;;''))))))))))))))))'=&$ $$&=;'';$ $&&==;'';$ &&====;;;''')))))))))'=&$ $$&=;'';$ $$&=;'';$ $==;;;;;;;'')))))))))))))))'=&$ ",
24+
"$&=;;))';;;;;;;;;;''))))'=&@ $==;;;''''';;;;;;;;;;;;'';=&& $&=;'))'= &&==;;'))'= &&==;;;;;;;;;;;;;;;;'';=&& $&=;'))'= $&=;'))'= %=$@@$&=;;;;;;;;;;;;;;;;;'';=&& ",
25+
"$&=;;));;;;;;;;;;;;;;;'))'=&@ @&=;;;'';;;;;;;;;;;;;=&$@@@&@* $&=;'))'= &&=;;;;'))'= &&==;'';;;;;;;;;;;=&$@@@&@* $&=;'))'= $&=;'))'= %*+...@@$&=;;;;;'''';;=&$@@@&@* ",
26+
"$==;;));;&@&;;;;;;;;;;;;');=$ $=;;;;;;;;;=&$@$&=&=&$@.+#%->+ $=;;;))== &=;;;;;;;))== $&==;'';=$@.@$&===&$@.+#%->+ $=;;;))== $=;;;))== +*%##.@$$&&;;;;'))';;&$@.+#%->+ ",
27+
"$==;;));@..%******&&;;;;;'';&@ @&=;;;;;;$++#**#++....+#%**->% $=;;;))&= $=;;;;';;;))&= @&==;'';=@..........+#%**->% $=;;;))&= $=;;;))&= #**%##+++..;;;'))'...+#%**->% ",
28+
"$==;;))@*-----------*&;;;'';=$ @&=;;';;@#*-->>>>>,,,,,,>>-%+ $=;;;))$= @&;;;'';;;;))$= $&=;;';=@.#--,,,,,,,,,>>-%+ $=;;;))$= $=;;;))$= +%***-----.;;;)).;;,,,>>-%+ ",
29+
"$==;;))@- +*;;;;')=&@ @&;;;''$#- $=;;;))&= $=;'')';;;;))&= @&==;;;;$.*--#. $=;;;))&= $=;;;))&= -.;;;))@; ",
30+
"&==;;))$> +&;;;');&@ $&;;;)'@- &=;;;))&= &;'))';;;;;))&= $&=;;;;=@*-# &=;;;))&= &=;;;))&= &@;;;))@= ",
31+
"&==;;')&= &;;;');=$ $&;;;)'$> $=;;;')&= $;'))';;;;;')&= &$=;;;'&.-# &&;;;))&= $=;;;')&= $@;;;')&= ",
32+
"&==;;''&= &;;;');=$ $&;;;))&; &=;;;''&= @&;'';;=;;;''&= @&$=;;''$*- &&;;;))&= &=;;;''&= &@;;;''&= ",
33+
"&&=;;''&= &;;;');=$ $&;;;))=; &&;;;''&= $&;;;=&;;;''&= $&$;;;'';,# &$;;;))&= &;;;;''&= &@;;;''&= ",
34+
"&&;;;;'&= &;;;');=$ @&;;;''';$ &&;;;;'&= @&&&&&;;;;'&= $$$;;;'''$. &$;;;))&= ;;;;;''&= &@;;;;'&= ",
35+
"&$;;;;;&= ;;;;));=$ @&;;;;'';==&&&&&&&&&&&@@ &$;;;;;&= &$;;;;;&= @$@&;;''')@ @$=========$@ &@&;'));&;;;;;;;;;;;;;;;;''&= &@;;;;;&= ",
36+
"&$;;;;;&= @;;;')';&@ @&;;;;'';;==;;;;;;;;;;;;$@ &$;;;;;&= &$;;;;;&= @$.&;;'';)@ $&;;;;;====;;;$ &@&''));;========;;;''';;''&= &.;;;;;&= ",
37+
";@;;;;;$; @&;;;')';&@ $&;;;;''''''')))))))'';;;$ ;@;;;;;$; ;@=;;;;$; @$.&;;;';; @$&;;;''))))))'=@ ;@&;'))'''''''))))))))'';';$; ;.;;;;;$; ",
38+
";@====&@; @$$=;;;;;;;;'));=$ @*;;;;;;;;;;''))))))))))';$ ;@====&@; ;@====&@; @$.$=;;;&; $&=;;;;''))))));$ ;.$=;')))''''''))))))'''==&@; ;.====&@; ",
39+
",@$==&@@; $&===;;;;;;''))';&@ #@&=;;;;;;;;;;;;;'')))));;- ,@$==&@@; ,@$==&@@; @$.@&=;;$, &&=;;;;;;;;;'))'= ,.@&=;''';;;;;;;;;;;;;;==&@@; ,.$==&@@; ",
40+
",.@$$&$., @&==;;;''')))))';=$ *%@$&=;;;;;;;;;;;;;;'))';-# ,.@$$&$., ,.@$$&$., @$..@$&;@>. *@$&=;;;;;;;'));= ,..@$&=;;;;;;;;;;;;;;;;$$&$., ,.@$$&$., ",
41+
",......., $==;;;;;;''))'';$& %-%..@$&==;;;;;;;;;;;');@- ,......., ,......., @$....@@.-+ +>-%#+.@&=;;;))== ,....@$&$@@@$$&===&$@$@..@.., ,......., ",
42+
",.....++, %=$@@$&=;;;;;;&@&@ %-*.............@$&&$@.-+ >.....++, ,.....++, @*.......*% %>-*%%#+$;;;))&= ,.............+#*#+.......++, ,.....++, ",
43+
",...++##, %*+..@@@$&==&$@.@ %>>>>>>>>>>>>*.......-# ,...++##, ,...++##, @*+......#* +%*----.;;;))&= ,+...++#*-->>,,,,,,>*...++##, ,...++##, ",
44+
",..+##%*, +*%##.@$&$@.+%*@ -*.++++#*- >..+##%*, ,..+##%*, *%......+- -.;;;))&= ,..+##%*, >..+##%*, ,..+##%*, ",
45+
",.+#%%*-, #**%##+++%**#+ >++###%*- >.+#%%*-, ,.+#%%*-, #*......+-+ -.;;;))&= ,.+#%%*-, >.+#%%*-, ,.+#%%*-, ",
46+
">.#%%*->, +%******#+ >+#%****- -.#%%*->, >.#%%*->, +*+...++#** -@;;;')&= >.#%%*->, >.#%%*->, >.#%%*->, ",
47+
",.#%*->>> >#%*----- *.#%*->>> ,.#%*->>> *#..+##%%-@ -$;;;''&= ,.#%*->>> >.#%*->>> ,.#%*->>> ",
48+
">.%*->>,> >%*-->>>* %.%*->>,> >.%*->>,> *%.+##%**-&@ -&;;;''&= >.%*->>,> >.%*->>,> >.%*->>,> ",
49+
">.%*->,,> $>*->>>>>& #+%*->,,,- >.%*->,,> +*.+#%**-->;&@ -=;;;''&= >.%*->,,> >.%*->,,> >.%*->,,> ",
50+
">.*->>,,> @$$===;;;&&&&&&&&&&&,>>>,,,'& +%+->,,,'==&&========$@ >.*->>,,> *#+#%*->>,>>;;;=;;;;;;;;'''$= >.*->>,,> >.*->>,,> >.*->>,,> ",
51+
"-.*->,,,> $&===;;;;;;;;;;;;;;'',,,,,)''$ %+->,,,''==$&&&&&='';&$ -.*->,,,> +*.+%*->,,,,',';;;;;;;;'')'$; -.*->,,,> -.*->,,,> -.*->,,,> ",
52+
"-.*>>,,>> @&==;;;'''')))))))))))))))))'=@ %+*>,,',''''))))))))'&$@ -.*>>,,>> *%.#%*->,,',',''''''))))))@; -.*>>,,>> -.*>>,,>> -.*>>,,>> ",
53+
"-.*>,,,-> $==;;;;;;;')))))))))))))))'';$ +%+>,','''''')))))))'=&$ -.*>,,,-> *%.+%-->,,',''''''''))))'@, -.*>,,,-> -.*>,,,-> -.*>,,,-> ",
54+
"*.*>>,>*> %=$@@$&=;;;;;;;;;;;;''''''';=@ %+%*->,'';;;;;;;;'';=&& *.*>>,>*> *%..+%*->,',';;;;;;;;''@@- *.*>>,>*> *.*>>,>*> *.*>>,>*> ",
55+
"*%+%*-*** %*+...@@$&=;;;;;;;;;;;;;=&@+# %++-,''';;;;;=&$@@@&@* **+%*-*** *%+......@@$&==&$@@@&;$.* **+%*-*** **+%*-*** **+%*-*** ",
56+
"+-++###-+ +*%##.@$$&&&&$@$$&&$@.+##++# %%+++@$@$&=&$@.+#%->+ +-++###-+ **%+.+#%*--*%#+.+#%*%*-+ +-++###-+ +-++###-+ +-++###-+ ",
57+
" %-%++-% #**%##+++...%**#+#+###%%#+ +%*%.......+#%**->% %-%++-% +**%+.......+#%**----% %-%++-% %-%++-% %-%++-% ",
58+
" +*-*+ +%***---------***%*%%#+ +#*->,>-*->>-%+ @$@ +%**************-*+ +*-*+ +*-*+ +*-*+ ",
59+
" "};

Diff for: ‎samples/graphics/blitting/source/bitmap.c

+58
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
2+
#include <sysutil/sysutil.h>
3+
#include <sysutil/video.h>
4+
#include <rsx/rsx.h>
5+
#include <rsx/gcm_sys.h>
6+
7+
#include <stdio.h>
8+
#include <string.h>
9+
#include <stdlib.h>
10+
#include <assert.h>
11+
12+
#include "bitmap.h"
13+
14+
void bitmapInit(Bitmap *bitmap, u32 width, u32 height) {
15+
s32 status;
16+
bitmap->pixels = rsxMemalign(64, width * height * 4);
17+
status = rsxAddressToOffset(bitmap->pixels, &bitmap->offset);
18+
assert(status==0);
19+
bitmap->width = width;
20+
bitmap->height = height;
21+
}
22+
23+
void bitmapDestroy(Bitmap *bitmap) {
24+
rsxFree(bitmap->pixels);
25+
bitmap->pixels = NULL;
26+
}
27+
28+
void bitmapSetXpm(Bitmap *bitmap, char * xpm[]) {
29+
u32 palette[256];
30+
u32 width, height, ncolors, depth;
31+
char *p;
32+
int ln;
33+
u32 x, y, *pix;
34+
35+
width = atoi(xpm[0]);
36+
height = atoi(p = strchr(xpm[0], ' ') + 1);
37+
ncolors = atoi(p = strchr(p, ' ') + 1);
38+
depth = atoi(p = strchr(p, ' ') + 1);
39+
assert(depth == 1);
40+
41+
bitmapInit(bitmap, width, height);
42+
43+
/* read palette */
44+
memset(palette, 0, sizeof(palette));
45+
for (ln = 1; ln <= ncolors; ++ln) {
46+
u32 color = strtol(&xpm[ln][5], NULL, 16);
47+
/* black color is transparent, others are opaque */
48+
if (color != 0)
49+
color |= 0xff000000;
50+
palette[(unsigned char)xpm[ln][0]] = color;
51+
}
52+
53+
/* convert image */
54+
pix = bitmap->pixels;
55+
for (y = 0; y < height; ++y, ++ln)
56+
for (x = 0; x < width; ++x)
57+
*pix++ = palette[(unsigned char)xpm[ln][x]];
58+
}

Diff for: ‎samples/graphics/blitting/source/main.c

+313
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,313 @@
1+
/*
2+
* Usage of the blit functions.
3+
*/
4+
5+
#include <io/pad.h>
6+
7+
#include <stdio.h>
8+
#include <stdlib.h>
9+
#include <string.h>
10+
#include <malloc.h>
11+
#include <assert.h>
12+
#include <math.h>
13+
#include <unistd.h>
14+
15+
#include <sysutil/sysutil.h>
16+
#include <sysutil/video.h>
17+
#include <rsx/rsx.h>
18+
#include <rsx/gcm_sys.h>
19+
20+
#include "bitmap.h"
21+
#include "psl1ght.xpm"
22+
23+
typedef struct {
24+
gcmContextData *context;
25+
u32 curr_fb;
26+
u32 framecnt;
27+
u32 pitch;
28+
u32 *buffer[2];
29+
u32 offset[2];
30+
u32 depth_pitch;
31+
u16 *depth_buffer;
32+
u32 depth_offset;
33+
videoResolution res;
34+
} displayData;
35+
36+
void setRenderTarget(displayData *vdat)
37+
{
38+
gcmSurface sf;
39+
40+
sf.colorFormat = GCM_TF_COLOR_X8R8G8B8;
41+
sf.colorTarget = GCM_TF_TARGET_0;
42+
sf.colorLocation[0] = GCM_LOCATION_RSX;
43+
sf.colorOffset[0] = vdat->offset[vdat->curr_fb];
44+
sf.colorPitch[0] = vdat->pitch;
45+
46+
sf.colorLocation[1] = GCM_LOCATION_RSX;
47+
sf.colorLocation[2] = GCM_LOCATION_RSX;
48+
sf.colorLocation[3] = GCM_LOCATION_RSX;
49+
sf.colorOffset[1] = 0;
50+
sf.colorOffset[2] = 0;
51+
sf.colorOffset[3] = 0;
52+
sf.colorPitch[1] = 64;
53+
sf.colorPitch[2] = 64;
54+
sf.colorPitch[3] = 64;
55+
56+
sf.depthFormat = GCM_TF_ZETA_Z16;
57+
sf.depthLocation = GCM_LOCATION_RSX;
58+
sf.depthOffset = vdat->depth_offset;
59+
sf.depthPitch = vdat->depth_pitch;
60+
61+
sf.type = GCM_TF_TYPE_LINEAR;
62+
sf.antiAlias = GCM_TF_CENTER_1;
63+
64+
sf.width = vdat->res.width;
65+
sf.height = vdat->res.height;
66+
sf.x = 0;
67+
sf.y = 0;
68+
69+
rsxSetSurface(vdat->context, &sf);
70+
}
71+
72+
static void eventHandle(u64 status, u64 param, void * userdata) {
73+
(void)param;
74+
(void)userdata;
75+
if(status == SYSUTIL_EXIT_GAME){
76+
printf("Quit game requested\n");
77+
exit(0);
78+
}else if(status == SYSUTIL_MENU_OPEN){
79+
//xmb opened, should prob pause game or something :P
80+
printf("XMB opened\n");
81+
}else if(status == SYSUTIL_MENU_CLOSE){
82+
//xmb closed, and then resume
83+
printf("XMB closed\n");
84+
}else if(status == SYSUTIL_DRAW_BEGIN){
85+
}else if(status == SYSUTIL_DRAW_END){
86+
}else{
87+
printf("Unhandled event: %08llX\n", (unsigned long long int)status);
88+
}
89+
}
90+
91+
void appCleanup(){
92+
sysUtilUnregisterCallback(SYSUTIL_EVENT_SLOT0);
93+
printf("Exiting for real.\n");
94+
}
95+
96+
/* Block the PPU thread untill the previous flip operation has finished. */
97+
void waitFlip() {
98+
while(gcmGetFlipStatus() != 0)
99+
usleep(200);
100+
gcmResetFlipStatus();
101+
}
102+
103+
/* Enqueue a flip command in RSX command buffer.
104+
Setup next screen to be drawn to. */
105+
void flip(displayData *vdat) {
106+
s32 status = gcmSetFlip(vdat->context, vdat->curr_fb);
107+
assert(status == 0);
108+
rsxFlushBuffer(vdat->context);
109+
gcmSetWaitFlip(vdat->context);
110+
vdat->curr_fb = !vdat->curr_fb;
111+
++vdat->framecnt;
112+
setRenderTarget(vdat);
113+
}
114+
115+
/* Initilize everything. */
116+
void init_screen(displayData *vdat) {
117+
int i;
118+
119+
/* Allocate a 1Mb buffer, alligned to a 1Mb boundary to be our shared IO memory with the RSX. */
120+
void *host_addr = memalign(1024*1024, 1024*1024);
121+
assert(host_addr != NULL);
122+
123+
/* Initilise libRSX, which sets up the command buffer and shared IO memory */
124+
vdat->context = rsxInit(0x10000, 1024*1024, host_addr);
125+
assert(vdat->context != NULL);
126+
127+
videoState state;
128+
s32 status = videoGetState(0, 0, &state); // Get the state of the display
129+
assert(status == 0);
130+
assert(state.state == 0); // Make sure display is enabled
131+
132+
/* Get the current resolution */
133+
status = videoGetResolution(state.displayMode.resolution, &vdat->res);
134+
assert(status == 0);
135+
136+
/* Configure the buffer format to xRGB */
137+
videoConfiguration vconfig;
138+
memset(&vconfig, 0, sizeof(videoConfiguration));
139+
vconfig.resolution = state.displayMode.resolution;
140+
vconfig.format = VIDEO_BUFFER_FORMAT_XRGB;
141+
vconfig.pitch = vdat->res.width * 4;
142+
vconfig.aspect=state.displayMode.aspect;
143+
144+
status = videoConfigure(0, &vconfig, NULL, 0);
145+
assert(status == 0);
146+
status = videoGetState(0, 0, &state);
147+
assert(status == 0);
148+
149+
gcmSetFlipMode(GCM_FLIP_VSYNC); /* Wait for VSYNC to flip */
150+
151+
/* Allocate and setup two buffers for the RSX to draw to the screen (double buffering) */
152+
vdat->pitch = vdat->res.width*sizeof(u32);
153+
for (i=0; i<2; ++i) {
154+
vdat->buffer[i] = (u32*)rsxMemalign(64, vdat->pitch * vdat->res.height);
155+
assert(vdat->buffer[i] != NULL);
156+
status = rsxAddressToOffset(vdat->buffer[i], &vdat->offset[i]);
157+
assert(status==0);
158+
status = gcmSetDisplayBuffer(i, vdat->offset[i], vdat->pitch, vdat->res.width, vdat->res.height);
159+
assert(status==0);
160+
}
161+
162+
/* Allocate the depth buffer */
163+
vdat->depth_pitch = vdat->res.width * sizeof(u16);
164+
vdat->depth_buffer = (u16*)rsxMemalign(64, vdat->depth_pitch * vdat->res.height);
165+
assert(vdat->depth_buffer != NULL);
166+
status = rsxAddressToOffset(vdat->depth_buffer, &vdat->depth_offset);
167+
assert(status==0);
168+
169+
gcmResetFlipStatus();
170+
vdat->curr_fb = 0;
171+
vdat->framecnt = 0;
172+
flip(vdat);
173+
}
174+
175+
void blit_simple(displayData *vdat, Bitmap *bitmap,
176+
u32 dstX, u32 dstY, u32 srcX, u32 srcY, u32 w, u32 h)
177+
{
178+
rsxSetTransferImage(vdat->context, GCM_TRANSFER_LOCAL_TO_LOCAL,
179+
vdat->offset[vdat->curr_fb], vdat->pitch, dstX-w/2, dstY-h/2,
180+
bitmap->offset, bitmap->width*4, rsxGetFixedUint16((float)srcX),
181+
rsxGetFixedUint16((float)srcY), w, h, 4);
182+
}
183+
184+
void blit_data(displayData *vdat, Bitmap *bitmap,
185+
u32 dstX, u32 dstY, u32 srcX, u32 srcY, u32 w, u32 h)
186+
{
187+
rsxSetTransferData(vdat->context, GCM_TRANSFER_LOCAL_TO_LOCAL,
188+
vdat->offset[vdat->curr_fb], vdat->pitch, bitmap->offset, bitmap->width*4,
189+
w*4, h);
190+
}
191+
192+
void blit_scale(displayData *vdat, Bitmap *bitmap,
193+
u32 dstX, u32 dstY, u32 srcX, u32 srcY, u32 w, u32 h, float zoom)
194+
{
195+
gcmTransferScale scale;
196+
gcmTransferSurface surface;
197+
198+
scale.conversion = GCM_TRANSFER_CONVERSION_TRUNCATE;
199+
scale.format = GCM_TRANSFER_SCALE_FORMAT_A8R8G8B8;
200+
scale.origin = GCM_TRANSFER_ORIGIN_CORNER;
201+
scale.operation = GCM_TRANSFER_OPERATION_SRCCOPY_AND;
202+
scale.interp = GCM_TRANSFER_INTERPOLATOR_NEAREST;
203+
scale.clipX = 0;
204+
scale.clipY = 0;
205+
scale.clipW = vdat->res.width;
206+
scale.clipH = vdat->res.height;
207+
scale.outX = dstX - w*zoom*.5f;
208+
scale.outY = dstY - h*zoom*.5f;
209+
scale.outW = w * zoom;
210+
scale.outH = h * zoom;
211+
scale.ratioX = rsxGetFixedSint32(1.f / zoom);
212+
scale.ratioY = rsxGetFixedSint32(1.f / zoom);
213+
scale.inX = rsxGetFixedUint16(srcX);
214+
scale.inY = rsxGetFixedUint16(srcY);
215+
scale.inW = bitmap->width;
216+
scale.inH = bitmap->height;
217+
scale.offset = bitmap->offset;
218+
scale.pitch = sizeof(u32) * bitmap->width;
219+
220+
surface.format = GCM_TRANSFER_SURFACE_FORMAT_A8R8G8B8;
221+
surface.pitch = vdat->pitch;
222+
surface.offset = vdat->offset[vdat->curr_fb];
223+
224+
rsxSetTransferScaleMode(vdat->context, GCM_TRANSFER_LOCAL_TO_LOCAL,
225+
GCM_TRANSFER_SURFACE);
226+
227+
rsxSetTransferScaleSurface(vdat->context, &scale, &surface);
228+
}
229+
230+
int main(int argc, const char* argv[])
231+
{
232+
padInfo padinfo;
233+
padData paddata;
234+
Bitmap bitmap;
235+
236+
displayData vdat;
237+
int quit = 0;
238+
int i;
239+
int k = 0;
240+
241+
atexit(appCleanup);
242+
sysUtilRegisterCallback(SYSUTIL_EVENT_SLOT0, eventHandle, NULL);
243+
244+
init_screen(&vdat);
245+
printf("screen res: %dx%d buffers: %p %p\n",
246+
vdat.res.width, vdat.res.height, vdat.buffer[0], vdat.buffer[1]);
247+
ioPadInit(7);
248+
249+
bitmapSetXpm(&bitmap, psl1ght_xpm);
250+
251+
while (!quit) {
252+
/* Check the pads. */
253+
ioPadGetInfo(&padinfo);
254+
for (i=0; i<MAX_PADS; i++) {
255+
if (padinfo.status[i]) {
256+
ioPadGetData(i, &paddata);
257+
if (paddata.BTN_CROSS)
258+
quit = 1;
259+
}
260+
}
261+
262+
/* Wait for the last flip to finish, so we can draw to the old buffer */
263+
waitFlip();
264+
265+
/* Display some stuff on the screen */
266+
rsxSetClearColor(vdat.context, 0x200030);
267+
rsxSetClearDepthValue(vdat.context, 0xffff);
268+
rsxClearSurface(vdat.context,GCM_CLEAR_R |
269+
GCM_CLEAR_G |
270+
GCM_CLEAR_B |
271+
GCM_CLEAR_A |
272+
GCM_CLEAR_S |
273+
GCM_CLEAR_Z);
274+
275+
/* Enable blending (for rsxSetTransferScaleSurface) */
276+
rsxSetBlendFunc(vdat.context, GCM_SRC_ALPHA, GCM_ONE_MINUS_SRC_ALPHA, GCM_SRC_ALPHA, GCM_ONE_MINUS_SRC_ALPHA);
277+
rsxSetBlendEquation(vdat.context, GCM_FUNC_ADD, GCM_FUNC_ADD);
278+
rsxSetBlendEnable(vdat.context, GCM_TRUE);
279+
280+
/* Display the whole PSL1GHT image */
281+
blit_simple(&vdat, &bitmap, vdat.res.width/4, 100, 0, 0, bitmap.width, bitmap.height);
282+
283+
/* Distort the PSL1GHT image by displaying lines with different X coords */
284+
for (i=0; i<bitmap.height; ++i) {
285+
int x = vdat.res.width*3/4 + 50.f*sinf(((i+k) & 0x7f) * (2.f*M_PI/0x80));
286+
blit_simple(&vdat, &bitmap, x, 100+i, 0, i, bitmap.width, 1);
287+
}
288+
k = (k+1) & 0x7f;
289+
290+
/* Animate all letters */
291+
for (i=6; i>=0; --i) {
292+
int x = vdat.res.width * (0.1f + 0.8f * (0.5f+0.5f*sinf((vdat.framecnt - 10*i) * .01f)));
293+
int y = 150 + 400 * (0.5f+0.5f*sinf((vdat.framecnt - 10*i) * .02f));
294+
blit_simple(&vdat, &bitmap, x, y, i*32, 0, 32, bitmap.height);
295+
}
296+
297+
/* Animate all letters, with zoom */
298+
for (i=6; i>=0; --i) {
299+
int x = vdat.res.width * (0.1f + 0.8f * (0.5f+0.5f*sinf(M_PI + (vdat.framecnt - 10*i) * .01f)));
300+
int y = 150 + 400 * (0.5f+0.5f*sinf((vdat.framecnt - 10*i) * .02f));
301+
blit_scale(&vdat, &bitmap, x, y, i*32, 0, 32, bitmap.height, 2.f);
302+
}
303+
304+
/* Flip buffer onto screen */
305+
flip(&vdat);
306+
307+
sysUtilCheckCallback();
308+
}
309+
waitFlip();
310+
bitmapDestroy(&bitmap);
311+
312+
return 0;
313+
}

Diff for: ‎samples/network/ps3load/Makefile

+32-29
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@ endif
99

1010
include $(PSL1GHT)/ppu_rules
1111

12+
13+
TITLE := ps3load
14+
APPID := PS3LOAD01
15+
CONTENTID := UP0001-$(APPID)_00-0000000000000000
16+
1217
#---------------------------------------------------------------------------------
1318
# TARGET is the name of the output
1419
# BUILD is the directory where object files & intermediate files will be placed
@@ -18,48 +23,38 @@ include $(PSL1GHT)/ppu_rules
1823
TARGET := $(notdir $(CURDIR))
1924
BUILD := build
2025
SOURCES := source
21-
DATA := data
2226
INCLUDES := include
23-
24-
TITLE := ps3load
25-
APPID := PS3LOAD01
26-
CONTENTID := UP0001-$(APPID)_00-0000000000000000
27+
DATA := data
2728

2829
#---------------------------------------------------------------------------------
2930
# options for code generation
3031
#---------------------------------------------------------------------------------
31-
32-
CFLAGS = -O2 -Wall -mcpu=cell $(MACHDEP) $(INCLUDE)
32+
CFLAGS = -O2 -Wall -mcpu=cell $(MACHDEP) $(LIBPATHS) $(INCLUDE) $(DEBUG) -mminimal-toc -maltivec -funroll-loops -ftree-loop-linear -ftree-vectorize
3333
CXXFLAGS = $(CFLAGS)
34-
3534
LDFLAGS = $(MACHDEP) -Wl,-Map,$(notdir $@).map
3635

3736
#---------------------------------------------------------------------------------
3837
# any extra libraries we wish to link with the project
3938
#---------------------------------------------------------------------------------
40-
LIBS := -lzip -lz -lnet -lrsx -lgcm_sys -lio -lsysmodule -lsysutil -lrt -llv2 -lm
39+
LIBS := -lrsx -lgcm_sys -lsysutil -lsysmodule -lio -lzip -lz -lnet -lrt -llv2 -lm
4140

4241
#---------------------------------------------------------------------------------
4342
# list of directories containing libraries, this must be the top level containing
4443
# include and lib
4544
#---------------------------------------------------------------------------------
46-
LIBDIRS := $(PORTLIBS)
45+
LIBDIRS := $(PORTLIBS)
4746

4847
#---------------------------------------------------------------------------------
4948
# no real need to edit anything past this point unless you need to add additional
5049
# rules for different file extensions
5150
#---------------------------------------------------------------------------------
5251
ifneq ($(BUILD),$(notdir $(CURDIR)))
5352
#---------------------------------------------------------------------------------
54-
5553
export OUTPUT := $(CURDIR)/$(TARGET)
56-
5754
export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \
58-
$(foreach dir,$(DATA),$(CURDIR)/$(dir))
59-
60-
export DEPSDIR := $(CURDIR)/$(BUILD)
61-
55+
$(foreach dir,$(DATA),$(CURDIR)/$(dir))
6256
export BUILDDIR := $(CURDIR)/$(BUILD)
57+
export DEPSDIR := $(BUILDDIR)
6358

6459
#---------------------------------------------------------------------------------
6560
# automatically build a list of object files for our project
@@ -80,51 +75,59 @@ else
8075
endif
8176

8277
export OFILES := $(addsuffix .o,$(BINFILES)) \
83-
$(CPPFILES:.cpp=.o) $(CFILES:.c=.o) \
84-
$(sFILES:.s=.o) $(SFILES:.S=.o)
78+
$(CFILES:.c=.o) \
79+
$(CPPFILES:.cpp=.o) \
80+
$(sFILES:.s=.o) $(SFILES:.S=.o)
8581

8682
#---------------------------------------------------------------------------------
8783
# build a list of include paths
8884
#---------------------------------------------------------------------------------
8985
export INCLUDE := $(foreach dir,$(INCLUDES), -I$(CURDIR)/$(dir)) \
90-
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
91-
$(LIBPSL1GHT_INC) \
92-
-I$(CURDIR)/$(BUILD)
86+
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
87+
$(LIBPSL1GHT_INC) \
88+
-I$(CURDIR)/$(BUILD)
9389

9490
#---------------------------------------------------------------------------------
9591
# build a list of library paths
9692
#---------------------------------------------------------------------------------
9793
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib) \
98-
$(LIBPSL1GHT_LIB)
99-
94+
$(LIBPSL1GHT_LIB)
10095
export OUTPUT := $(CURDIR)/$(TARGET)
96+
97+
#---------------------------------------------------------------------------------
10198
.PHONY: $(BUILD) clean
10299

103100
#---------------------------------------------------------------------------------
104101
$(BUILD):
105102
@[ -d $@ ] || mkdir -p $@
106-
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
103+
@echo compiling ps3load
104+
@$(MAKE) --no-print-directory -C $(BUILDDIR) -f $(CURDIR)/Makefile
105+
106+
#---------------------------------------------------------------------------------
107+
self: $(BUILD) $(OUTPUT).self
107108

108109
#---------------------------------------------------------------------------------
109110
clean:
110111
@echo clean ...
111-
@rm -fr $(BUILD) $(OUTPUT).elf $(OUTPUT).self
112+
@rm -rf $(BUILD) $(OUTPUT).a $(OUTPUT)*.elf $(OUTPUT)*.self $(OUTPUT)*.pkg
112113

113114
#---------------------------------------------------------------------------------
114-
run:
115+
run: self
115116
ps3load $(OUTPUT).self
116117

118+
#---------------------------------------------------------------------------------
119+
pkg: self $(OUTPUT).pkg
117120

118121
#---------------------------------------------------------------------------------
119122
else
120123

121-
DEPENDS := $(OFILES:.o=.d)
124+
DEPENDS := $(OFILES:.o=.d)
122125

123126
#---------------------------------------------------------------------------------
124127
# main targets
125128
#---------------------------------------------------------------------------------
126-
$(OUTPUT).self: $(OUTPUT).elf
127-
$(OUTPUT).elf: $(OFILES)
129+
$(OUTPUT).self: $(OUTPUT).elf
130+
$(OUTPUT).elf: $(OFILES)
128131

129132
#---------------------------------------------------------------------------------
130133
# This rule links in binary data with the .bin extension

Diff for: ‎templates/simple/source/main.c

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
2+
#include <stdio.h>
3+
4+
int
5+
main ( void )
6+
{
7+
printf ( "hello world\n" ) ;
8+
}
9+

Diff for: ‎templates/trivial/Makefile

+6-17
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ LDFLAGS=
2020
# Destination where the .pkg is built
2121
BUILDDIR=build
2222

23+
# Put your user data into this directory - all will be added to the .pkg
24+
# add /dev_hdd0/game/$APPID/ to the relative path of the file inside $PKGFILES
25+
# e.g. $PKGFILES/foo.jpg -> /dev_hdd0/game/MY_APP_ID/foo.jpg
26+
PKGFILES=data
27+
2328
# If you want to use dependancy checking, define a directory for .d files
2429
# DEPSDIR=
2530

@@ -29,7 +34,7 @@ BUILDDIR=build
2934
#TITLE=Sample
3035

3136
# Icon that appears in XMB. Needs to be of certain properties.
32-
#ICON=file.png
37+
#ICON0=file.png
3338

3439
# ID of your application. Also the installation directory
3540
# (/dev_hdd0/game/$APPID/)
@@ -50,19 +55,3 @@ run:
5055
clean:
5156
rm -rf $(TARGET)*.pkg $(TARGET)*.self $(BUILDDIR)
5257

53-
.eboot: $(TARGET).self
54-
echo building EBOOT.BIN ...
55-
mkdir -p $(BUILDDIR)/pkg/USRDIR
56-
$(SELF_NPDRM) $(BUILDDIR)/$(TARGET).elf $(BUILDDIR)/pkg/USRDIR/EBOOT.BIN $(CONTENTID) >> /dev/null
57-
58-
# "ps3load" for FW 3.55.
59-
# build the .self file normally, start a FTP server on the PS3, and
60-
# run 'make push' to update the binary. Run application from XMB.
61-
# You need to install the .pkg only once
62-
# You probably need to modify the settings below
63-
push: .eboot
64-
curlftpfs ftp://root:openbox@10.0.0.5 ~/mount/
65-
cp build/pkg/USRDIR/EBOOT.BIN ~/mount/dev_hdd0/game/$(APPID)/USRDIR/EBOOT.BIN
66-
fusermount -u ~/mount/
67-
68-

Diff for: ‎tools/geohot/Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ endif
3434

3535
ifneq (,$(findstring Darwin,$(UNAME)))
3636
SDK := /Developer/SDKs/MacOSX10.4u.sdk
37-
OSXCFLAGS := -mmacosx-version-min=10.4 -arch i386
37+
OSXCFLAGS := -mmacosx-version-min=10.4 -arch i386
3838
OSXCXXFLAGS := $(OSXCFLAGS)
3939
CXXFLAGS += -fvisibility=hidden
4040
LDFLAGS += -mmacosx-version-min=10.4 -arch i386 -Wl,-syslibroot,$(SDK) -L/opt/local/lib -lgmp -lcrypto -lz

Diff for: ‎tools/geohot/make_self.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,9 @@ void init_Self_Shdr(Self_Shdr* hdr) {
110110
set_u32(&(hdr->s_hdrversion), 2);
111111
#ifdef SPRX
112112
// on 3.41
113-
set_u16(&(hdr->s_flags), 4);
113+
//set_u16(&(hdr->s_flags), 4);
114114
// on 3.55
115-
//set_u16(&(hdr->s_flags), 7);
115+
set_u16(&(hdr->s_flags), 7);
116116
#else
117117
set_u16(&(hdr->s_flags), 1);
118118
#endif

0 commit comments

Comments
 (0)
Please sign in to comment.