mirror of
https://github.com/pspdev/pspsdk.git
synced 2025-10-03 08:41:34 +00:00
Compare commits
50 Commits
prx_strip
...
d46b2b237d
Author | SHA1 | Date | |
---|---|---|---|
|
d46b2b237d | ||
|
1e6560db8f | ||
|
c84807b850 | ||
|
787b593c08 | ||
|
bd7e8509b3 | ||
|
c4df37300e | ||
|
8660800f8c | ||
|
9ba2c9ec4e | ||
|
6f541cfb8d | ||
|
eaf85fb61c | ||
|
bac379ba88 | ||
|
6ba471c7c3 | ||
|
dc71e3de4b | ||
|
464c2dd011 | ||
|
5943f71329 | ||
|
cfb7fc37c5 | ||
|
3611a51e85 | ||
|
96b6851d5a | ||
|
eb2f3969b3 | ||
|
39f2c46b04 | ||
|
cae1806bcf | ||
|
b3f0fb5f50 | ||
|
b1bf44e88a | ||
|
541277ebcc | ||
|
58c2b2a4a5 | ||
|
6a32e2f325 | ||
|
c1debe88e3 | ||
|
658d5bd5cf | ||
|
3cec824246 | ||
|
6dced23b25 | ||
|
e79471103b | ||
|
125772869a | ||
|
6b77137ab5 | ||
|
0d2e9b6507 | ||
|
4ec0eef96f | ||
|
8a74665c16 | ||
|
1e69b7c9cc | ||
|
a26915c69d | ||
|
50557e178d | ||
|
273a9196eb | ||
|
449be35679 | ||
|
ccc4bd65ed | ||
|
1e5d2f1198 | ||
|
55e8d452da | ||
|
88b8257126 | ||
|
31b3734093 | ||
|
485d8d092a | ||
|
13d1faa406 | ||
|
ac445612d4 | ||
|
b5c93d8598 |
@@ -45,8 +45,11 @@ mkdir -p $PSPDEV/share/licenses/PrxEncrypter
|
||||
cp tools/PrxEncrypter/LICENSE $PSPDEV/share/licenses/PrxEncrypter
|
||||
|
||||
## Store build information
|
||||
BUILD_FILE="${PSPDEV}/build.txt"
|
||||
if [[ -f "${BUILD_FILE}" ]]; then
|
||||
sed -i'' '/^pspsdk /d' "${BUILD_FILE}"
|
||||
if [ -d .git ]; then
|
||||
BUILD_FILE="${PSPDEV}/build.txt"
|
||||
if [[ -f "${BUILD_FILE}" ]]; then
|
||||
sed -i'' '/^pspsdk /d' "${BUILD_FILE}"
|
||||
fi
|
||||
git log -1 --format="pspsdk %H %cs %s" >> "${BUILD_FILE}"
|
||||
fi
|
||||
git log -1 --format="pspsdk %H %cs %s" >> "${BUILD_FILE}"
|
||||
|
||||
|
@@ -107,6 +107,7 @@ AC_CONFIG_FILES([Makefile
|
||||
src/gu/Makefile
|
||||
src/gum/Makefile
|
||||
src/hprm/Makefile
|
||||
src/kermit/Makefile
|
||||
src/kernel/Makefile
|
||||
src/libcglue/Makefile
|
||||
src/libpthreadglue/Makefile
|
||||
|
@@ -11,6 +11,7 @@ SUBDIRS = \
|
||||
gu \
|
||||
gum \
|
||||
hprm \
|
||||
kermit \
|
||||
kernel \
|
||||
libcglue \
|
||||
libpthreadglue \
|
||||
|
@@ -16,13 +16,14 @@ function(add_prx_module name)
|
||||
get_filename_component(EXP_FILE_NAME ${FILE} NAME_WE)
|
||||
|
||||
# Define the output .c file path
|
||||
set(GENERATED_C_FILE ${CMAKE_BINARY_DIR}/${EXP_FILE_NAME}.c)
|
||||
set(GENERATED_C_FILE ${CMAKE_CURRENT_BINARY_DIR}/${EXP_FILE_NAME}.c)
|
||||
|
||||
# Add a custom command for each .exp file to generate a .c file
|
||||
add_custom_command(
|
||||
OUTPUT ${GENERATED_C_FILE}
|
||||
COMMAND psp-build-exports -b ${FILE} > ${GENERATED_C_FILE}
|
||||
DEPENDS ${FILE}
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
COMMENT "Generating ${EXP_FILE_NAME}.c from ${EXP_FILE_NAME}.exp for target ${name}"
|
||||
)
|
||||
|
||||
|
@@ -14,6 +14,7 @@ macro(create_pbp_file)
|
||||
TARGET # defined by an add_executable call before calling create_pbp_file
|
||||
TITLE # optional, string, target's name in PSP menu
|
||||
ICON_PATH # optional, absolute path to .png file, 144x82
|
||||
ANIM_PATH # optional, absolute path to .pmf file
|
||||
BACKGROUND_PATH # optional, absolute path to .png file, 480x272
|
||||
PREVIEW_PATH # optional, absolute path to .png file, 480x272
|
||||
MUSIC_PATH # optional, absolute path to .at3 file
|
||||
@@ -149,7 +150,7 @@ macro(create_pbp_file)
|
||||
add_custom_command(
|
||||
TARGET ${ARG_TARGET}
|
||||
POST_BUILD COMMAND
|
||||
"${PSPDEV}/bin/pack-pbp" "${ARG_OUTPUT_DIR}/EBOOT.PBP" "${ARG_OUTPUT_DIR}/PARAM.SFO" "${ARG_ICON_PATH}" "NULL" "${ARG_PREVIEW_PATH}"
|
||||
"${PSPDEV}/bin/pack-pbp" "${ARG_OUTPUT_DIR}/EBOOT.PBP" "${ARG_OUTPUT_DIR}/PARAM.SFO" "${ARG_ICON_PATH}" "${ARG_ANIM_PATH}" "${ARG_PREVIEW_PATH}"
|
||||
"${ARG_BACKGROUND_PATH}" "${ARG_MUSIC_PATH}" "$<TARGET_FILE:${ARG_TARGET}>.prx" "${ARG_PSAR_PATH}"
|
||||
COMMENT "Calling pack-pbp with PRX file for target ${ARG_TARGET}"
|
||||
)
|
||||
@@ -157,7 +158,7 @@ macro(create_pbp_file)
|
||||
add_custom_command(
|
||||
TARGET ${ARG_TARGET}
|
||||
POST_BUILD COMMAND
|
||||
"${PSPDEV}/bin/pack-pbp" "${ARG_OUTPUT_DIR}/EBOOT.PBP" "${ARG_OUTPUT_DIR}/PARAM.SFO" "${ARG_ICON_PATH}" "NULL" "${ARG_PREVIEW_PATH}"
|
||||
"${PSPDEV}/bin/pack-pbp" "${ARG_OUTPUT_DIR}/EBOOT.PBP" "${ARG_OUTPUT_DIR}/PARAM.SFO" "${ARG_ICON_PATH}" "${ARG_ANIM_PATH}" "${ARG_PREVIEW_PATH}"
|
||||
"${ARG_BACKGROUND_PATH}" "${ARG_MUSIC_PATH}" "$<TARGET_FILE:${ARG_TARGET}>" "${ARG_PSAR_PATH}"
|
||||
COMMENT "Calling pack-pbp with ELF file for target ${ARG_TARGET}"
|
||||
)
|
||||
|
@@ -427,6 +427,9 @@ typedef struct ScePspDateTime {
|
||||
unsigned int microsecond;
|
||||
} ScePspDateTime;
|
||||
|
||||
/* Thread entry function type. */
|
||||
typedef int (*SceKernelThreadEntry)(SceSize args, void *argp);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@@ -12,10 +12,11 @@ CFLAGS = @PSPSDK_CFLAGS@
|
||||
libpspguincludedir = @PSPSDK_INCLUDEDIR@
|
||||
libpspguinclude_HEADERS = pspgu.h
|
||||
|
||||
lib_LIBRARIES = libpspgu.a
|
||||
lib_LIBRARIES = libpspgu.a libpspgud.a
|
||||
|
||||
noinst_HEADERS = guInternal.h
|
||||
|
||||
# Regular library (no debug assertions)
|
||||
libpspgu_a_SOURCES = \
|
||||
guInternal.c \
|
||||
sceGuAlphaFunc.c \
|
||||
@@ -112,3 +113,7 @@ libpspgu_a_SOURCES = \
|
||||
sceGuViewport.c \
|
||||
vram.c
|
||||
|
||||
# Debug library (with debug assertions)
|
||||
libpspgud_a_SOURCES = $(libpspgu_a_SOURCES)
|
||||
libpspgud_a_CFLAGS = $(CFLAGS) -DGU_DEBUG
|
||||
|
||||
|
@@ -15,9 +15,10 @@ GuSettings gu_settings;
|
||||
GuDisplayList* gu_list;
|
||||
int gu_curr_context;
|
||||
int gu_init;
|
||||
int gu_first_start;
|
||||
int gu_display_on;
|
||||
int gu_call_mode;
|
||||
int gu_states;
|
||||
GuDrawBuffer gu_draw_buffer;
|
||||
unsigned int* gu_object_stack[32];
|
||||
unsigned int* gu_object_stack[GU_OBJECT_STACK_SIZE];
|
||||
int gu_object_stack_depth;
|
||||
|
@@ -11,6 +11,13 @@
|
||||
|
||||
#include "pspgu.h"
|
||||
|
||||
#ifdef GU_DEBUG
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
|
||||
#define GU_OBJECT_STACK_SIZE 32
|
||||
|
||||
typedef void (*GuCallback)(int);
|
||||
|
||||
typedef struct
|
||||
@@ -72,6 +79,7 @@ extern GuSettings gu_settings;
|
||||
extern GuDisplayList *gu_list;
|
||||
extern int gu_curr_context;
|
||||
extern int gu_init;
|
||||
extern int gu_first_start;
|
||||
extern int gu_display_on;
|
||||
extern int gu_call_mode;
|
||||
extern int gu_states;
|
||||
|
@@ -249,15 +249,21 @@ extern "C" {
|
||||
#define GU_ABS (5)
|
||||
|
||||
/* Blending Factor */
|
||||
#define GU_SRC_COLOR (0)
|
||||
#define GU_ONE_MINUS_SRC_COLOR (1)
|
||||
#define GU_SRC_ALPHA (2)
|
||||
#define GU_ONE_MINUS_SRC_ALPHA (3)
|
||||
#define GU_DST_COLOR (0)
|
||||
#define GU_ONE_MINUS_DST_COLOR (1)
|
||||
#define GU_DST_ALPHA (4)
|
||||
#define GU_ONE_MINUS_DST_ALPHA (5)
|
||||
#define GU_FIX (10)
|
||||
#define GU_OTHER_COLOR (0)
|
||||
#define GU_ONE_MINUS_OTHER_COLOR (1)
|
||||
#define GU_SRC_ALPHA (2)
|
||||
#define GU_ONE_MINUS_SRC_ALPHA (3)
|
||||
#define GU_DST_ALPHA (4)
|
||||
#define GU_ONE_MINUS_DST_ALPHA (5)
|
||||
#define GU_DOUBLE_SRC_ALPHA (6)
|
||||
#define GU_ONE_MINUS_DOUBLE_SRC_ALPHA (7)
|
||||
#define GU_DOUBLE_DST_ALPHA (8)
|
||||
#define GU_ONE_MINUS_DOUBLE_DST_ALPHA (9)
|
||||
#define GU_FIX (10) /* Note: behavior of 11-15 blend factors is identical to GU_FIX */
|
||||
#define GU_SRC_COLOR (0) /* Deprecated */
|
||||
#define GU_ONE_MINUS_SRC_COLOR (1) /* Deprecated */
|
||||
#define GU_DST_COLOR (0) /* Deprecated */
|
||||
#define GU_ONE_MINUS_DST_COLOR (1) /* Deprecated */
|
||||
|
||||
/* Stencil Operations */
|
||||
#define GU_KEEP (0)
|
||||
@@ -324,7 +330,7 @@ extern "C" {
|
||||
#define GU_CALLBACK_SIGNAL (1)
|
||||
#define GU_CALLBACK_FINISH (4)
|
||||
|
||||
/* Signal behavior */
|
||||
/* Signal behavior (deprecated) */
|
||||
#define GU_BEHAVIOR_SUSPEND (1)
|
||||
#define GU_BEHAVIOR_CONTINUE (2)
|
||||
|
||||
@@ -503,19 +509,15 @@ void* sceGuSetCallback(int signal, void (*callback)(int));
|
||||
/**
|
||||
* Trigger signal to call code from the command stream
|
||||
*
|
||||
* Available signals are:
|
||||
* Available signal interrupt modes are:
|
||||
* - GU_SIGNAL_WAIT - Wait for callback to finish
|
||||
* - GU_SIGNAL_NOWAIT - Do not wait for callback to finish
|
||||
* - GU_SIGNAL_PAUSE - Pause execution until callback is finished
|
||||
*
|
||||
* Available behaviors are:
|
||||
* - GU_BEHAVIOR_SUSPEND - Stops display list execution until callback function finished
|
||||
* - GU_BEHAVIOR_CONTINUE - Do not stop display list execution during callback
|
||||
*
|
||||
* @param signal - Signal to trigger
|
||||
* @param behavior - Behavior type
|
||||
* @param mode - Signal interrupt mode
|
||||
* @param id - Signal id
|
||||
**/
|
||||
void sceGuSignal(int signal, int behavior);
|
||||
void sceGuSignal(int mode, int id);
|
||||
|
||||
/**
|
||||
* Send raw float-command to the GE
|
||||
@@ -604,7 +606,7 @@ int sceGuCallList(const void* list);
|
||||
/**
|
||||
* Set wether to use stack-based calls or signals to handle execution of called lists.
|
||||
*
|
||||
* @param mode - GU_TRUE(1) to enable signals, GU_FALSE(0) to disable signals and use
|
||||
* @param mode - GU_CALL_SIGNAL(1) to enable signals, GU_CALL_NORMAL(0) to disable signals and use
|
||||
* normal calls instead.
|
||||
**/
|
||||
void sceGuCallMode(int mode);
|
||||
@@ -962,6 +964,13 @@ void sceGuClearStencil(unsigned int stencil);
|
||||
* Set mask for which bits of the pixels to write
|
||||
*
|
||||
* @param mask - Which bits to filter against writes
|
||||
* @note The representation of the mask is in the format 0xAABBGGRR: 1-bits prevent writes to that bit, 0-bits allow writes.
|
||||
* @note If you have a draw format using less than 8 bits per channel, you need to mask the higher bits as less significant bits aren't used.
|
||||
* @example With a draw format of GU_PSM_5650:
|
||||
* sceGuPixelMask(0x00000000); // All channels writable
|
||||
* sceGuPixelMask(0x0000FCF8); // Only Blue (+Alpha) writable
|
||||
* sceGuPixelMask(0x00F800F8); // Only Green (+Alpha) writable
|
||||
* sceGuPixelMask(0x00F8FC00); // Only Red (+Alpha) writable
|
||||
*
|
||||
**/
|
||||
void sceGuPixelMask(unsigned int mask);
|
||||
@@ -1058,15 +1067,17 @@ void sceGuAmbientColor(unsigned int color);
|
||||
* - GU_ABS - |Cs-Cd|
|
||||
*
|
||||
* Available blending-functions are:
|
||||
* - GU_SRC_COLOR
|
||||
* - GU_ONE_MINUS_SRC_COLOR
|
||||
* - GU_SRC_ALPHA
|
||||
* - GU_ONE_MINUS_SRC_ALPHA
|
||||
* - GU_DST_ALPHA
|
||||
* - GU_ONE_MINUS_DST_ALPHA
|
||||
* - GU_DST_COLOR
|
||||
* - GU_ONE_MINUS_DST_COLOR
|
||||
* - GU_FIX
|
||||
* - GU_OTHER_COLOR - dstColor if used for source operand; srcColor if used for destination operand
|
||||
* - GU_ONE_MINUS_OTHER_COLOR - 1-dstColor if used for source operand; 1-srcColor if used for destination operand
|
||||
* - GU_SRC_ALPHA - srcAlpha
|
||||
* - GU_ONE_MINUS_SRC_ALPHA - 1-srcAlpha
|
||||
* - GU_DST_ALPHA - dstAlpha
|
||||
* - GU_ONE_MINUS_DST_ALPHA - 1-dstAlpha
|
||||
* - GU_DOUBLE_SRC_ALPHA - 2*srcAlpha
|
||||
* - GU_ONE_MINUS_DOUBLE_SRC_ALPHA - 1-2*srcAlpha
|
||||
* - GU_DOUBLE_DST_ALPHA - 2*dstAlpha
|
||||
* - GU_ONE_MINUS_DOUBLE_DST_ALPHA - 1-2*dstAlpha
|
||||
* - GU_FIX - srcFix if used for source operand; dstFix if used for destination operand
|
||||
*
|
||||
* @param op - Blending Operation
|
||||
* @param src - Blending function for source operand
|
||||
@@ -1165,6 +1176,9 @@ void sceGuFrontFace(int order);
|
||||
* - GU_SET
|
||||
*
|
||||
* This operation only has effect if GU_COLOR_LOGIC_OP is enabled.
|
||||
*
|
||||
* @note Unlike OpenGL, GE allows to enable both blending and color logic operations at the same time,
|
||||
* in which case color blending will be computed as usual but stored in framebuffer using specified logical operation
|
||||
*
|
||||
* @param op - Operation to execute
|
||||
**/
|
||||
@@ -1336,7 +1350,7 @@ void sceGuTexMapMode(int mode, unsigned int lu, unsigned int lv);
|
||||
* - GU_PSM_T8 - Indexed, 8-bit
|
||||
*
|
||||
* @param tpsm - Which texture format to use
|
||||
* @param maxmips - Number of mipmaps to use (0-8)
|
||||
* @param maxmips - Index of the maximum mip level to use (NOT THE NUMBER OF MIPS). Range is 0-7.
|
||||
* @param mc - Multiclut on/off (0/1)
|
||||
* @param swizzle - GU_TRUE(1) to swizzle texture-reads
|
||||
**/
|
||||
@@ -1416,11 +1430,13 @@ void sceGuClutLoad(int num_blocks, const void* cbp);
|
||||
* - GU_PSM_5551
|
||||
* - GU_PSM_4444
|
||||
* - GU_PSM_8888
|
||||
*
|
||||
* @note Final color index is computed by GE in the following way: `((pixelValue >> shift) & mask) | (csa << 4)`
|
||||
*
|
||||
* @param cpsm - Which pixel format to use for the palette
|
||||
* @param shift - Shifts color index by that many bits to the right
|
||||
* @param mask - Masks the color index with this bitmask after the shift (0-0xFF)
|
||||
* @param csa - Read-out start location (16-palette units)
|
||||
* @param csa - This value is shifted to the left by 4 bits and bitwise ORed with color index after applying mask
|
||||
**/
|
||||
void sceGuClutMode(unsigned int cpsm, unsigned int shift, unsigned int mask, unsigned int csa);
|
||||
|
||||
|
@@ -10,6 +10,12 @@
|
||||
|
||||
void sceGuAlphaFunc(int func, int value, int mask)
|
||||
{
|
||||
#ifdef GU_DEBUG
|
||||
printf("sceGuAlphaFunc(%d, %d, %d);\n", func, value, mask);
|
||||
assert(gu_init && "GU not initialized");
|
||||
assert(func >= GU_NEVER && func <= GU_GEQUAL && "Invalid alpha function");
|
||||
#endif
|
||||
|
||||
int arg = func | ((value & 0xff) << 8) | ((mask & 0xff) << 16);
|
||||
sendCommandi(ALPHA_TEST, arg);
|
||||
}
|
||||
|
@@ -10,6 +10,11 @@
|
||||
|
||||
void sceGuAmbient(unsigned int color)
|
||||
{
|
||||
#ifdef GU_DEBUG
|
||||
printf("sceGuAmbient(%08X);\n", color);
|
||||
assert(gu_init && "GU not initialized");
|
||||
#endif
|
||||
|
||||
sendCommandi(AMBIENT_LIGHT_COLOR,(color));
|
||||
sendCommandi(AMBIENT_LIGHT_ALPHA,(color >> 24));
|
||||
}
|
||||
|
@@ -10,6 +10,11 @@
|
||||
|
||||
void sceGuAmbientColor(unsigned int color)
|
||||
{
|
||||
#ifdef GU_DEBUG
|
||||
printf("sceGuAmbientColor(0x%08X);\n", color);
|
||||
assert(gu_init && "GU not initialized");
|
||||
#endif
|
||||
|
||||
sendCommandi(AMBIENT_COLOR, color);
|
||||
sendCommandi(AMBIENT_ALPHA, color >> 24);
|
||||
}
|
||||
|
@@ -10,6 +10,13 @@
|
||||
|
||||
void sceGuBeginObject(int vertex_type, int count, const void *indices, const void *vertices)
|
||||
{
|
||||
#ifdef GU_DEBUG
|
||||
printf("sceGuBeginObject(%d, %d, %p, %p);\n", vertex_type, count, indices, vertices);
|
||||
assert(gu_init && "GU not initialized");
|
||||
assert(count > 0 && count <= 255 && (count % 8) == 0 && "Invalid vertex count - must be positive, <= 65535, and multiple of 8");
|
||||
assert(gu_object_stack_depth < GU_OBJECT_STACK_SIZE && "Object stack overflow");
|
||||
#endif
|
||||
|
||||
if (vertex_type)
|
||||
sendCommandi(VERTEX_TYPE, vertex_type);
|
||||
|
||||
|
@@ -10,6 +10,14 @@
|
||||
|
||||
void sceGuBlendFunc(int op, int src, int dest, unsigned int srcfix, unsigned int destfix)
|
||||
{
|
||||
#ifdef GU_DEBUG
|
||||
printf("sceGuBlendFunc(%d, %d, %d, 0x%08X, 0x%08X);\n", op, src, dest, srcfix, destfix);
|
||||
assert(gu_init && "GU not initialized");
|
||||
assert(op >= GU_ADD && op <= GU_ABS && "Invalid blend operation");
|
||||
assert(src >= GU_OTHER_COLOR && src <= GU_FIX && "Invalid source blend factor");
|
||||
assert(dest >= GU_OTHER_COLOR && dest <= GU_FIX && "Invalid destination blend factor");
|
||||
#endif
|
||||
|
||||
sendCommandi(BLEND_MODE, src | (dest << 4) | (op << 8));
|
||||
sendCommandi(BLEND_FIXED_A, srcfix);
|
||||
sendCommandi(BLEND_FIXED_B, destfix);
|
||||
|
@@ -10,6 +10,12 @@
|
||||
|
||||
void sceGuBoneMatrix(unsigned int index, const ScePspFMatrix4 *matrix)
|
||||
{
|
||||
#ifdef GU_DEBUG
|
||||
printf("sceGuBoneMatrix(%d, %p);\n", index, matrix);
|
||||
assert(gu_init && "GU not initialized");
|
||||
assert(index < 8 && "Invalid bone matrix index");
|
||||
#endif
|
||||
|
||||
unsigned int offset = ((index << 1) + index) << 2; // 3*4 matrix
|
||||
unsigned int i, j;
|
||||
const float *fmatrix = (const float *)matrix;
|
||||
|
@@ -10,12 +10,17 @@
|
||||
|
||||
int sceGuCallList(const void *list)
|
||||
{
|
||||
#ifdef GU_DEBUG
|
||||
printf("sceGuCallList(%p);\n", list);
|
||||
assert(gu_init && "GU not initialized");
|
||||
#endif
|
||||
|
||||
int res;
|
||||
unsigned int list_addr = (unsigned int)list;
|
||||
|
||||
if (gu_call_mode == GU_CALL_SIGNAL)
|
||||
{
|
||||
sendCommandi(SIGNAL, (list_addr >> 16) | 0x110000);
|
||||
sendCommandi(SIGNAL, (0x11 << 16) | (list_addr >> 16));
|
||||
sendCommandi(END, list_addr & 0xffff);
|
||||
}
|
||||
else
|
||||
|
@@ -10,5 +10,11 @@
|
||||
|
||||
void sceGuCallMode(int mode)
|
||||
{
|
||||
#ifdef GU_DEBUG
|
||||
printf("sceGuCallMode(%d);\n", mode);
|
||||
assert(gu_init && "GU not initialized");
|
||||
assert(mode >= GU_CALL_NORMAL && mode <= GU_CALL_SIGNAL && "Invalid call mode");
|
||||
#endif
|
||||
|
||||
gu_call_mode = mode;
|
||||
}
|
||||
|
@@ -10,6 +10,13 @@
|
||||
|
||||
void sceGuClear(int flags)
|
||||
{
|
||||
#ifdef GU_DEBUG
|
||||
printf("sceGuClear(%d);\n", flags);
|
||||
assert(gu_init && "GU not initialized");
|
||||
assert(flags >= 0 && "Invalid clear flags");
|
||||
assert((flags & ~(GU_COLOR_BUFFER_BIT | GU_STENCIL_BUFFER_BIT | GU_DEPTH_BUFFER_BIT | GU_FAST_CLEAR_BIT)) == 0 && "Invalid clear flags");
|
||||
#endif
|
||||
|
||||
GuContext *context = &gu_contexts[gu_curr_context];
|
||||
unsigned int filter;
|
||||
struct Vertex
|
||||
|
@@ -10,6 +10,11 @@
|
||||
|
||||
void sceGuClearColor(unsigned int color)
|
||||
{
|
||||
#ifdef GU_DEBUG
|
||||
printf("sceGuClearColor(0x%08X);\n", color);
|
||||
assert(gu_init && "GU not initialized");
|
||||
#endif
|
||||
|
||||
GuContext* context = &gu_contexts[gu_curr_context];
|
||||
context->clear_color = color;
|
||||
}
|
||||
|
@@ -10,6 +10,12 @@
|
||||
|
||||
void sceGuClearDepth(unsigned int depth)
|
||||
{
|
||||
#ifdef GU_DEBUG
|
||||
printf("sceGuClearDepth(%u);\n", depth);
|
||||
assert(gu_init && "GU not initialized");
|
||||
assert(depth <= 65535 && "Invalid depth value");
|
||||
#endif
|
||||
|
||||
GuContext* context = &gu_contexts[gu_curr_context];
|
||||
context->clear_depth = depth;
|
||||
}
|
||||
|
@@ -10,6 +10,29 @@
|
||||
|
||||
void sceGuClearStencil(unsigned int stencil)
|
||||
{
|
||||
#ifdef GU_DEBUG
|
||||
printf("sceGuClearStencil(%u);\n", stencil);
|
||||
assert(gu_init && "GU not initialized");
|
||||
switch (gu_draw_buffer.pixel_size)
|
||||
{
|
||||
case GU_PSM_8888:
|
||||
assert(stencil <= 255 && "Invalid stencil value for GU_PSM_8888");
|
||||
break;
|
||||
case GU_PSM_4444:
|
||||
assert(stencil <= 15 && "Invalid stencil value for GU_PSM_4444");
|
||||
break;
|
||||
case GU_PSM_5551:
|
||||
assert(stencil <= 1 && "Invalid stencil value for GU_PSM_5551");
|
||||
break;
|
||||
case GU_PSM_5650:
|
||||
assert(0 && "Stencil not supported for GU_PSM_5650");
|
||||
break;
|
||||
default:
|
||||
assert(0 && "Invalid pixel format");
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
GuContext* context = &gu_contexts[gu_curr_context];
|
||||
context->clear_stencil = stencil;
|
||||
}
|
||||
|
@@ -10,6 +10,12 @@
|
||||
|
||||
void sceGuClutLoad(int num_blocks, const void *cbp)
|
||||
{
|
||||
#ifdef GU_DEBUG
|
||||
printf("sceGuClutLoad(%d, %p);\n", num_blocks, cbp);
|
||||
assert(gu_init && "GU not initialized");
|
||||
assert(num_blocks > 0 && num_blocks <= 65535 && "Invalid number of CLUT blocks");
|
||||
#endif
|
||||
|
||||
sendCommandi(CLUT_BUF_PTR, ((unsigned int)cbp));
|
||||
sendCommandi(CLUT_BUF_WIDTH, (((unsigned int)cbp) >> 8) & 0xf0000);
|
||||
sendCommandi(CLUT_LOAD, num_blocks);
|
||||
|
@@ -10,6 +10,12 @@
|
||||
|
||||
void sceGuClutMode(unsigned int cpsm, unsigned int shift, unsigned int mask, unsigned int csa)
|
||||
{
|
||||
#ifdef GU_DEBUG
|
||||
printf("sceGuClutMode(%08X, %08X, %08X, %08X);\n", cpsm, shift, mask, csa);
|
||||
assert(gu_init && "GU not initialized");
|
||||
assert(cpsm >= GU_PSM_5650 && cpsm <= GU_PSM_8888 && "Invalid CLUT pixel format");
|
||||
#endif
|
||||
|
||||
unsigned int argument = (cpsm) | (shift << 2) | (mask << 8) | (csa << 16);
|
||||
sendCommandi(CLUT_FORMAT, argument);
|
||||
}
|
||||
|
@@ -10,5 +10,9 @@
|
||||
|
||||
void sceGuColor(unsigned int color)
|
||||
{
|
||||
#ifdef GU_DEBUG
|
||||
assert(gu_init && "GU not initialized");
|
||||
#endif
|
||||
|
||||
sceGuMaterial(GU_AMBIENT | GU_DIFFUSE | GU_SPECULAR, color);
|
||||
}
|
||||
|
@@ -10,6 +10,12 @@
|
||||
|
||||
void sceGuColorFunc(int func, unsigned int color, unsigned int mask)
|
||||
{
|
||||
#ifdef GU_DEBUG
|
||||
printf("sceGuColorFunc(%d, 0x%08X, 0x%08X);\n", func, color, mask);
|
||||
assert(gu_init && "GU not initialized");
|
||||
assert(func >= GU_NEVER && func <= GU_NOTEQUAL && "Invalid color function");
|
||||
#endif
|
||||
|
||||
sendCommandi(COLOR_TEST, func & 0x03);
|
||||
sendCommandi(COLOR_REF, color);
|
||||
sendCommandi(COLOR_TESTMASK, mask);
|
||||
|
@@ -10,5 +10,11 @@
|
||||
|
||||
void sceGuColorMaterial(int components)
|
||||
{
|
||||
#ifdef GU_DEBUG
|
||||
printf("sceGuColorMaterial(%d);\n", components);
|
||||
assert(gu_init && "GU not initialized");
|
||||
assert((components >= 0) && ((components & ~(GU_AMBIENT | GU_DIFFUSE | GU_SPECULAR)) == 0) && "Invalid material components");
|
||||
#endif
|
||||
|
||||
sendCommandi(MATERIAL_COLOR, components);
|
||||
}
|
||||
|
@@ -6,9 +6,13 @@
|
||||
* Copyright (c) 2005 Jesper Svennevid
|
||||
*/
|
||||
|
||||
#include "pspge.h"
|
||||
#include "guInternal.h"
|
||||
|
||||
int sceGuContinue(void)
|
||||
{
|
||||
#ifdef GU_DEBUG
|
||||
printf("sceGuContinue();\n");
|
||||
assert(gu_init && "GU not initialized");
|
||||
#endif
|
||||
return sceGeContinue();
|
||||
}
|
||||
|
@@ -10,6 +10,20 @@
|
||||
|
||||
void sceGuCopyImage(int psm, int sx, int sy, int width, int height, int srcw, void *src, int dx, int dy, int destw, void *dest)
|
||||
{
|
||||
#ifdef GU_DEBUG
|
||||
printf("sceGuCopyImage(%d, %d, %d, %d, %d, %d, %p, %d, %d, %d, %p);\n", psm, sx, sy, width, height, srcw, src, dx, dy, destw, dest);
|
||||
assert(gu_init && "GU not initialized");
|
||||
assert(psm >= GU_PSM_5650 && psm <= GU_PSM_8888 && "Invalid pixel format");
|
||||
assert(width > 0 && width <= 1023 && "Invalid width");
|
||||
assert(height > 0 && height <= 1023 && "Invalid height");
|
||||
assert(srcw > 8 && srcw <= 1024 && (srcw & 0x7) == 0 && "Invalid source width, must be multiple of 8");
|
||||
assert(destw > 8 && destw <= 1024 && (destw & 0x7) == 0 && "Invalid destination width, must be multiple of 8");
|
||||
assert(sx >= 0 && sx < 1023 && "Invalid source X");
|
||||
assert(sy >= 0 && sy < 1023 && "Invalid source Y");
|
||||
assert(dx >= 0 && dx < 1023 && "Invalid destination X");
|
||||
assert(dy >= 0 && dy < 1023 && "Invalid destination Y");
|
||||
#endif
|
||||
|
||||
sendCommandi(TRANSFER_SRC, ((unsigned int)src));
|
||||
sendCommandi(TRANSFER_SRC_W, ((((unsigned int)src) & 0xff000000) >> 8) | srcw);
|
||||
sendCommandi(TRANSFER_SRC_OFFSET, (sy << 10) | sx);
|
||||
|
@@ -10,6 +10,13 @@
|
||||
|
||||
void sceGuDepthBuffer(void *zbp, int zbw)
|
||||
{
|
||||
#ifdef GU_DEBUG
|
||||
printf("sceGuDepthBuffer(%p, %d);\n", zbp, zbw);
|
||||
assert(gu_init && "GU not initialized");
|
||||
assert(((unsigned int)zbp & 0x1FFF) == 0 && "Depth buffer pointer must be 8192-byte aligned");
|
||||
assert(zbw > 64 && zbw <= 1024 && (zbw & 0x3F) == 0 && "Invalid depth buffer width, must be multiple of 64");
|
||||
#endif
|
||||
|
||||
sendCommandi(Z_BUF_PTR, ((unsigned int)zbp));
|
||||
sendCommandi(Z_BUF_WIDTH, ((((unsigned int)zbp) & 0xff000000) >> 8) | zbw);
|
||||
|
||||
|
@@ -10,5 +10,11 @@
|
||||
|
||||
void sceGuDepthFunc(int function)
|
||||
{
|
||||
#ifdef GU_DEBUG
|
||||
printf("sceGuDepthFunc(%d);\n", function);
|
||||
assert(gu_init && "GU not initialized");
|
||||
assert(function >= GU_NEVER && function <= GU_GEQUAL && "Invalid depth function");
|
||||
#endif
|
||||
|
||||
sendCommandi(Z_TEST, function);
|
||||
}
|
||||
|
@@ -10,5 +10,11 @@
|
||||
|
||||
void sceGuDepthMask(int mask)
|
||||
{
|
||||
#ifdef GU_DEBUG
|
||||
printf("sceGuDepthMask(%d);\n", mask);
|
||||
assert(gu_init && "GU not initialized");
|
||||
assert((mask == 0 || mask == 1) && "Invalid depth mask");
|
||||
#endif
|
||||
|
||||
sendCommandi(Z_MASK, mask);
|
||||
}
|
||||
|
@@ -10,6 +10,11 @@
|
||||
|
||||
void sceGuDepthOffset(unsigned int offset)
|
||||
{
|
||||
#ifdef GU_DEBUG
|
||||
printf("sceGuDepthOffset(%08X);\n", offset);
|
||||
assert(gu_init && "GU not initialized");
|
||||
#endif
|
||||
|
||||
GuContext* context = &gu_contexts[gu_curr_context];
|
||||
context->depth_offset = offset;
|
||||
|
||||
|
@@ -10,6 +10,13 @@
|
||||
|
||||
void sceGuDepthRange(int near, int far)
|
||||
{
|
||||
#ifdef GU_DEBUG
|
||||
printf("sceGuDepthRange(%d, %d);\n", near, far);
|
||||
assert(gu_init && "GU not initialized");
|
||||
assert(near >= 0 && near <= 65535 && "Invalid near plane");
|
||||
assert(far >= 0 && far <= 65535 && "Invalid far plane");
|
||||
#endif
|
||||
|
||||
GuContext *context = &gu_contexts[gu_curr_context];
|
||||
|
||||
unsigned int max = (unsigned int)near + (unsigned int)far;
|
||||
|
@@ -10,6 +10,12 @@
|
||||
|
||||
void sceGuDisable(int state)
|
||||
{
|
||||
#ifdef GU_DEBUG
|
||||
printf("sceGuDisable(%d);\n", state);
|
||||
assert(gu_init && "GU not initialized");
|
||||
assert(state >= 0 && state < GU_MAX_STATUS && "Invalid state");
|
||||
#endif
|
||||
|
||||
switch (state)
|
||||
{
|
||||
case GU_ALPHA_TEST:
|
||||
|
@@ -13,6 +13,13 @@
|
||||
|
||||
void sceGuDispBuffer(int width, int height, void *dispbp, int dispbw)
|
||||
{
|
||||
#ifdef GU_DEBUG
|
||||
printf("sceGuDispBuffer(%d, %d, %p, %d);\n", width, height, dispbp, dispbw);
|
||||
assert(gu_init && "GU not initialized");
|
||||
assert(((unsigned int)dispbp & 0x1F) == 0 && "Display buffer pointer must be 32-byte aligned");
|
||||
assert(dispbw >= 64 && dispbw <= 1024 && (dispbw & 0x3F) == 0 && "Display buffer width must be multiple of 64");
|
||||
#endif
|
||||
|
||||
gu_draw_buffer.width = width;
|
||||
gu_draw_buffer.height = height;
|
||||
gu_draw_buffer.disp_buffer = dispbp;
|
||||
|
@@ -13,6 +13,12 @@
|
||||
|
||||
int sceGuDisplay(int state)
|
||||
{
|
||||
#ifdef GU_DEBUG
|
||||
printf("sceGuDisplay(%d);\n", state);
|
||||
assert(gu_init && "GU not initialized");
|
||||
assert((state == GU_TRUE || state == GU_FALSE) && "Invalid display state");
|
||||
#endif
|
||||
|
||||
if (state == GU_TRUE)
|
||||
sceDisplaySetFrameBuf((void *)((unsigned int)ge_edram_address + (unsigned int)gu_draw_buffer.disp_buffer), gu_draw_buffer.frame_width, gu_draw_buffer.pixel_size, PSP_DISPLAY_SETBUF_NEXTVSYNC);
|
||||
else
|
||||
|
@@ -10,6 +10,13 @@
|
||||
|
||||
void sceGuDrawArray(int prim, int vtype, int count, const void *indices, const void *vertices)
|
||||
{
|
||||
#ifdef GU_DEBUG
|
||||
printf("sceGuDrawArray(%d, %d, %d, %p, %p);\n", prim, vtype, count, indices, vertices);
|
||||
assert(gu_init && "GU not initialized");
|
||||
assert(count > 0 && count <= 65535 && "Invalid vertex count");
|
||||
assert(prim >= GU_POINTS && prim <= GU_SPRITES && "Invalid primitive type");
|
||||
#endif
|
||||
|
||||
if (vtype)
|
||||
sendCommandi(VERTEX_TYPE, vtype);
|
||||
|
||||
|
@@ -10,6 +10,14 @@
|
||||
|
||||
void sceGuDrawArrayN(int primitive_type, int vertex_type, int vcount, int primcount, const void *indices, const void *vertices)
|
||||
{
|
||||
#ifdef GU_DEBUG
|
||||
printf("sceGuDrawArrayN(%d, %d, %d, %d, %p, %p);\n", primitive_type, vertex_type, vcount, primcount, indices, vertices);
|
||||
assert(gu_init && "GU not initialized");
|
||||
assert(vcount > 0 && vcount <= 65535 && "Invalid vertex count");
|
||||
assert(primcount > 0 && primcount <= 65535 && "Invalid primitive count");
|
||||
assert(primitive_type >= GU_POINTS && primitive_type <= GU_TRIANGLE_FAN && "Invalid primitive type");
|
||||
#endif
|
||||
|
||||
if (vertex_type)
|
||||
sendCommandi(VERTEX_TYPE, vertex_type);
|
||||
|
||||
|
@@ -10,6 +10,13 @@
|
||||
|
||||
void sceGuDrawBezier(int vertex_type, int ucount, int vcount, const void *indices, const void *vertices)
|
||||
{
|
||||
#ifdef GU_DEBUG
|
||||
printf("sceGuDrawBezier(%d, %d, %d, %p, %p);\n", vertex_type, ucount, vcount, indices, vertices);
|
||||
assert(gu_init && "GU not initialized");
|
||||
assert(ucount > 1 && ucount <= 255 && (ucount % 3) == 1 && "Invalid U count, must be 3*N+1");
|
||||
assert(vcount > 1 && vcount <= 255 && (vcount % 3) == 1 && "Invalid V count, must be 3*N+1");
|
||||
#endif
|
||||
|
||||
if (vertex_type)
|
||||
sendCommandi(VERTEX_TYPE, vertex_type);
|
||||
|
||||
|
@@ -10,6 +10,15 @@
|
||||
|
||||
void sceGuDrawBuffer(int psm, void *fbp, int frame_width)
|
||||
{
|
||||
#ifdef GU_DEBUG
|
||||
printf("sceGuDrawBuffer(%d, %p, %d);\n", psm, fbp, frame_width);
|
||||
assert(gu_init && "GU not initialized");
|
||||
assert(((unsigned int)fbp & 0x1FFF) == 0 && "Frame buffer pointer must be 8192-byte aligned");
|
||||
assert(frame_width >= 64 && frame_width <= 1024 && "Frame width must be between 64 and 1024");
|
||||
assert((frame_width & 63) == 0 && "Frame width must be a multiple of 64");
|
||||
assert(psm >= GU_PSM_5650 && psm <= GU_PSM_8888 && "Invalid pixel format");
|
||||
#endif
|
||||
|
||||
gu_draw_buffer.pixel_size = psm;
|
||||
gu_draw_buffer.frame_width = frame_width;
|
||||
gu_draw_buffer.frame_buffer = fbp;
|
||||
|
@@ -10,6 +10,14 @@
|
||||
|
||||
void sceGuDrawBufferList(int psm, void *fbp, int fbw)
|
||||
{
|
||||
#ifdef GU_DEBUG
|
||||
printf("sceGuDrawBufferList(%d, %p, %d);\n", psm, fbp, fbw);
|
||||
assert(gu_init && "GU not initialized");
|
||||
assert(((unsigned int)fbp & 0x1FFF) == 0 && "Frame buffer pointer must be 8192-byte aligned");
|
||||
assert(fbw >= 64 && fbw <= 1024 && (fbw & 0x3F) == 0 && "Frame buffer width must be multiple of 64");
|
||||
assert(psm >= GU_PSM_5650 && psm <= GU_PSM_8888 && "Invalid pixel format");
|
||||
#endif
|
||||
|
||||
sendCommandi(FRAMEBUF_PIX_FORMAT, psm);
|
||||
sendCommandi(FRAME_BUF_PTR, (unsigned int)fbp);
|
||||
sendCommandi(FRAME_BUF_WIDTH, ((((unsigned int)fbp) & 0xff000000) >> 8) | fbw);
|
||||
|
@@ -10,6 +10,15 @@
|
||||
|
||||
void sceGuDrawSpline(int vertex_type, int ucount, int vcount, int uedge, int vedge, const void *indices, const void *vertices)
|
||||
{
|
||||
#ifdef GU_DEBUG
|
||||
printf("sceGuDrawSpline(%d, %d, %d, %d, %d, %p, %p);\n", vertex_type, ucount, vcount, uedge, vedge, indices, vertices);
|
||||
assert(gu_init && "GU not initialized");
|
||||
assert(ucount >= 4 && ucount <= 255 && "Invalid U count - must be between 4 and 255");
|
||||
assert(vcount >= 4 && vcount <= 255 && "Invalid V count - must be between 4 and 255");
|
||||
assert(uedge >= 0 && uedge <= 3 && "Invalid U edge");
|
||||
assert(vedge >= 0 && vedge <= 3 && "Invalid V edge");
|
||||
#endif
|
||||
|
||||
if (vertex_type)
|
||||
sendCommandi(VERTEX_TYPE, vertex_type);
|
||||
|
||||
|
@@ -10,6 +10,12 @@
|
||||
|
||||
void sceGuEnable(int state)
|
||||
{
|
||||
#ifdef GU_DEBUG
|
||||
printf("sceGuEnable(%d);\n", state);
|
||||
assert(gu_init && "GU not initialized");
|
||||
assert(state >= 0 && state < GU_MAX_STATUS && "Invalid enable state");
|
||||
#endif
|
||||
|
||||
switch (state)
|
||||
{
|
||||
case GU_ALPHA_TEST:
|
||||
@@ -27,7 +33,7 @@ void sceGuEnable(int state)
|
||||
context->scissor_enable = 1;
|
||||
sendCommandi(SCISSOR1, orig);
|
||||
sendCommandi(SCISSOR2, end);
|
||||
sendCommandi(REGION1, orig);
|
||||
sendCommandi(REGION1, 0);
|
||||
sendCommandi(REGION2, end);
|
||||
}
|
||||
break;
|
||||
|
@@ -12,6 +12,12 @@
|
||||
|
||||
int sceGuEndObject(void)
|
||||
{
|
||||
#ifdef GU_DEBUG
|
||||
printf("sceGuEndObject();\n");
|
||||
assert(gu_init && "GU not initialized");
|
||||
assert(gu_object_stack_depth > 0 && "Object stack underflow");
|
||||
#endif
|
||||
|
||||
int res;
|
||||
|
||||
gu_object_stack_depth--;
|
||||
|
@@ -12,6 +12,11 @@
|
||||
|
||||
int sceGuFinishId(unsigned int id)
|
||||
{
|
||||
#ifdef GU_DEBUG
|
||||
printf("sceGuFinishId(%08X);\n", id);
|
||||
assert(gu_init && "GU not initialized");
|
||||
#endif
|
||||
|
||||
int ret;
|
||||
int intr;
|
||||
|
||||
@@ -33,7 +38,7 @@ int sceGuFinishId(unsigned int id)
|
||||
case GU_CALL:
|
||||
if (gu_call_mode == GU_CALL_SIGNAL)
|
||||
{
|
||||
sendCommandi(SIGNAL, 0x120000);
|
||||
sendCommandi(SIGNAL, 0x12 << 16);
|
||||
sendCommandi(END, 0);
|
||||
}
|
||||
else
|
||||
|
@@ -10,6 +10,14 @@
|
||||
|
||||
void sceGuFog(float near, float far, unsigned int color)
|
||||
{
|
||||
#ifdef GU_DEBUG
|
||||
printf("sceGuFog(%f, %f, %08X);\n", near, far, color);
|
||||
assert(gu_init && "GU not initialized");
|
||||
assert(near >= 0.0f && "Invalid fog near value");
|
||||
assert(far > near && "Fog far must be greater than near");
|
||||
assert(far <= 65535.0f && "Fog far value too large");
|
||||
#endif
|
||||
|
||||
float distance = far - near;
|
||||
|
||||
if (distance)
|
||||
|
@@ -10,5 +10,11 @@
|
||||
|
||||
void sceGuFrontFace(int order)
|
||||
{
|
||||
#ifdef GU_DEBUG
|
||||
printf("sceGuFrontFace(%d);\n", order);
|
||||
assert(gu_init && "GU not initialized");
|
||||
assert((order == GU_CW || order == GU_CCW) && "Invalid front face order");
|
||||
#endif
|
||||
|
||||
sendCommandi(CULL, order ? 0 : 1);
|
||||
}
|
||||
|
@@ -239,6 +239,7 @@ static void sceGuResetGlobalVariables(void)
|
||||
unsigned int i;
|
||||
|
||||
gu_init = 0;
|
||||
gu_first_start = 0;
|
||||
|
||||
gu_states = 0;
|
||||
gu_object_stack_depth = 0;
|
||||
@@ -308,15 +309,27 @@ void callbackSig(int id, void *arg)
|
||||
|
||||
int sceGuInit(void)
|
||||
{
|
||||
#ifdef GU_DEBUG
|
||||
printf("sceGuInit();\n");
|
||||
assert(!gu_init && "GU already initialized");
|
||||
#endif
|
||||
|
||||
int res;
|
||||
PspGeCallbackData callback;
|
||||
|
||||
ge_edram_address = sceGeEdramGetAddr();
|
||||
#ifdef GU_DEBUG
|
||||
assert(ge_edram_address != NULL && "Failed to get EDRAM address");
|
||||
#endif
|
||||
|
||||
sceGuResetGlobalVariables();
|
||||
|
||||
res = sceKernelCreateEventFlag("SceGuSignal", PSP_EVENT_WAITMULTIPLE, 3, 0);
|
||||
if (res < 0)
|
||||
{
|
||||
#ifdef GU_DEBUG
|
||||
printf("Failed to create event flag: %d\n", res);
|
||||
#endif
|
||||
return res;
|
||||
}
|
||||
gu_settings.kernel_event_flag = res;
|
||||
@@ -328,6 +341,9 @@ int sceGuInit(void)
|
||||
res = sceGeSetCallback(&callback);
|
||||
if (res < 0)
|
||||
{
|
||||
#ifdef GU_DEBUG
|
||||
printf("Failed to set GE callback: %d\n", res);
|
||||
#endif
|
||||
sceKernelDeleteEventFlag(gu_settings.kernel_event_flag);
|
||||
gu_settings.kernel_event_flag = -1;
|
||||
return res;
|
||||
@@ -338,6 +354,9 @@ int sceGuInit(void)
|
||||
res = sceGeListEnQueue((void *)((unsigned int)ge_init_list & 0x1fffffff), NULL, gu_settings.ge_callback_id, NULL);
|
||||
if (res < 0)
|
||||
{
|
||||
#ifdef GU_DEBUG
|
||||
printf("Failed to enqueue GE list: %d\n", res);
|
||||
#endif
|
||||
sceKernelDeleteEventFlag(gu_settings.kernel_event_flag);
|
||||
sceGeUnsetCallback(gu_settings.ge_callback_id);
|
||||
gu_settings.ge_callback_id = -1;
|
||||
@@ -352,5 +371,7 @@ int sceGuInit(void)
|
||||
gu_settings.swapBuffersCallback = NULL;
|
||||
gu_settings.swapBuffersBehaviour = PSP_DISPLAY_SETBUF_NEXTHSYNC;
|
||||
|
||||
gu_init = 1;
|
||||
gu_first_start = 1;
|
||||
return 0;
|
||||
}
|
||||
|
@@ -14,6 +14,14 @@
|
||||
|
||||
void sceGuLight(int light, int type, int components, const ScePspFVector3 *position)
|
||||
{
|
||||
#ifdef GU_DEBUG
|
||||
printf("sceGuLight(%d, %d, %d, %p);\n", light, type, components, position);
|
||||
assert(gu_init && "GU not initialized");
|
||||
assert(light >= 0 && light <= 3 && "Invalid light index");
|
||||
assert(type >= GU_DIRECTIONAL && type <= GU_SPOTLIGHT && "Invalid light type");
|
||||
assert(components >= GU_AMBIENT && components <= GU_DIFFUSE_AND_SPECULAR && "Invalid light components");
|
||||
#endif
|
||||
|
||||
int offset = light * 3;
|
||||
int ltype;
|
||||
|
||||
|
@@ -10,6 +10,12 @@
|
||||
|
||||
void sceGuLightAtt(int light, float atten0, float atten1, float atten2)
|
||||
{
|
||||
#ifdef GU_DEBUG
|
||||
printf("sceGuLightAtt(%d, %f, %f, %f);\n", light, atten0, atten1, atten2);
|
||||
assert(gu_init && "GU not initialized");
|
||||
assert(light >= 0 && light <= 3 && "Invalid light index");
|
||||
#endif
|
||||
|
||||
int offset = light * 3;
|
||||
|
||||
sendCommandf(LIGHT0_CONSTANT_ATTEN + offset, atten0);
|
||||
|
@@ -10,6 +10,12 @@
|
||||
|
||||
void sceGuLightColor(int light, int component, unsigned int color)
|
||||
{
|
||||
#ifdef GU_DEBUG
|
||||
printf("sceGuLightColor(%d, %d, 0x%08X);\n", light, component, color);
|
||||
assert(gu_init && "GU not initialized");
|
||||
assert(light >= 0 && light <= 3 && "Invalid light index");
|
||||
assert(component >= GU_AMBIENT && component <= GU_DIFFUSE_AND_SPECULAR && "Invalid light component");
|
||||
#endif
|
||||
|
||||
int offset = light * 3;
|
||||
|
||||
|
@@ -10,5 +10,11 @@
|
||||
|
||||
void sceGuLightMode(int mode)
|
||||
{
|
||||
#ifdef GU_DEBUG
|
||||
printf("sceGuLightMode(%d);\n", mode);
|
||||
assert(gu_init && "GU not initialized");
|
||||
assert(mode >= GU_SINGLE_COLOR && mode <= GU_SEPARATE_SPECULAR_COLOR && "Invalid light mode");
|
||||
#endif
|
||||
|
||||
sendCommandi(LIGHT_MODE, mode);
|
||||
}
|
||||
|
@@ -9,7 +9,13 @@
|
||||
#include "guInternal.h"
|
||||
|
||||
void sceGuLightSpot(int light, const ScePspFVector3 *direction, float exponent, float cutoff)
|
||||
{
|
||||
{
|
||||
#ifdef GU_DEBUG
|
||||
printf("sceGuLightSpot(%d, %p, %f, %f);\n", light, direction, exponent, cutoff);
|
||||
assert(gu_init && "GU not initialized");
|
||||
assert(light >= 0 && light <= 3 && "Invalid light index");
|
||||
#endif
|
||||
|
||||
int offset = light * 3;
|
||||
sendCommandf(LIGHT0_EXPONENT_ATTEN + light, exponent);
|
||||
sendCommandf(LIGHT0_CUTOFF_ATTEN + light, cutoff);
|
||||
|
@@ -10,5 +10,11 @@
|
||||
|
||||
void sceGuLogicalOp(int op)
|
||||
{
|
||||
#ifdef GU_DEBUG
|
||||
printf("sceGuLogicalOp(%d);\n", op);
|
||||
assert(gu_init && "GU not initialized");
|
||||
assert(op >= GU_CLEAR && op <= GU_SET && "Invalid logical operation");
|
||||
#endif
|
||||
|
||||
sendCommandi(LOGIC_OP, op & 0x0f);
|
||||
}
|
||||
|
@@ -10,6 +10,13 @@
|
||||
|
||||
void sceGuMaterial(int mode, int color)
|
||||
{
|
||||
#ifdef GU_DEBUG
|
||||
printf("sceGuMaterial(%d, %08X);\n", mode, color);
|
||||
assert(gu_init && "GU not initialized");
|
||||
assert(mode >= 0 && "Invalid material mode");
|
||||
assert((mode & ~(GU_AMBIENT | GU_DIFFUSE | GU_SPECULAR)) == 0 && "Invalid material mode flags");
|
||||
#endif
|
||||
|
||||
if (mode & GU_AMBIENT) {
|
||||
sendCommandi(AMBIENT_COLOR, color);
|
||||
sendCommandi(AMBIENT_ALPHA, color >> 24);
|
||||
|
@@ -10,6 +10,11 @@
|
||||
|
||||
void sceGuModelColor(unsigned int emissive, unsigned int ambient, unsigned int diffuse, unsigned int specular)
|
||||
{
|
||||
#ifdef GU_DEBUG
|
||||
printf("sceGuModelColor(%08X, %08X, %08X, %08X);\n", emissive, ambient, diffuse, specular);
|
||||
assert(gu_init && "GU not initialized");
|
||||
#endif
|
||||
|
||||
sendCommandi(MATERIAL_EMISSIVE, emissive);
|
||||
sendCommandi(MATERIAL_DIFFUSE, diffuse);
|
||||
sendCommandi(AMBIENT_COLOR, ambient);
|
||||
|
@@ -10,5 +10,11 @@
|
||||
|
||||
void sceGuMorphWeight(int index, float weight)
|
||||
{
|
||||
#ifdef GU_DEBUG
|
||||
printf("sceGuMorphWeight(%d, %f);\n", index, weight);
|
||||
assert(gu_init && "GU not initialized");
|
||||
assert(index >= 0 && index <= 7 && "Invalid morph weight index");
|
||||
#endif
|
||||
|
||||
sendCommandf(MORPH_WEIGHT0 + index, weight);
|
||||
}
|
||||
|
@@ -10,6 +10,13 @@
|
||||
|
||||
void sceGuOffset(unsigned int x, unsigned int y)
|
||||
{
|
||||
#ifdef GU_DEBUG
|
||||
printf("sceGuOffset(%08X, %08X);\n", x, y);
|
||||
assert(gu_init && "GU not initialized");
|
||||
assert(x < 4096 && "X offset too large");
|
||||
assert(y < 4096 && "Y offset too large");
|
||||
#endif
|
||||
|
||||
sendCommandi(OFFSET_X, x << 4);
|
||||
sendCommandi(OFFSET_Y, y << 4);
|
||||
}
|
||||
|
@@ -10,5 +10,12 @@
|
||||
|
||||
void sceGuPatchDivide(unsigned int ulevel, unsigned int vlevel)
|
||||
{
|
||||
#ifdef GU_DEBUG
|
||||
printf("sceGuPatchDivide(%08X, %08X);\n", ulevel, vlevel);
|
||||
assert(gu_init && "GU not initialized");
|
||||
assert(ulevel >= 1 && ulevel <= 64 && "Invalid U level - must be between 1 and 64");
|
||||
assert(vlevel >= 1 && vlevel <= 64 && "Invalid V level - must be between 1 and 64");
|
||||
#endif
|
||||
|
||||
sendCommandi(PATCH_DIVISION, (vlevel << 8) | ulevel);
|
||||
}
|
||||
|
@@ -10,5 +10,11 @@
|
||||
|
||||
void sceGuPatchFrontFace(unsigned int mode)
|
||||
{
|
||||
#ifdef GU_DEBUG
|
||||
printf("sceGuPatchFrontFace(%u);\n", mode);
|
||||
assert(gu_init && "GU not initialized");
|
||||
assert((mode == GU_CW || mode == GU_CCW) && "Invalid patch front face mode");
|
||||
#endif
|
||||
|
||||
sendCommandi(PATCH_FACING, mode);
|
||||
}
|
||||
|
@@ -10,6 +10,12 @@
|
||||
|
||||
void sceGuPatchPrim(int prim)
|
||||
{
|
||||
#ifdef GU_DEBUG
|
||||
printf("sceGuPatchPrim(%d);\n", prim);
|
||||
assert(gu_init && "GU not initialized");
|
||||
assert((prim == GU_POINTS || prim == GU_LINE_STRIP || prim == GU_TRIANGLE_STRIP) && "Invalid patch primitive");
|
||||
#endif
|
||||
|
||||
switch (prim)
|
||||
{
|
||||
case GU_POINTS:
|
||||
|
@@ -10,6 +10,11 @@
|
||||
|
||||
void sceGuPixelMask(unsigned int mask)
|
||||
{
|
||||
#ifdef GU_DEBUG
|
||||
printf("sceGuPixelMask(%08X);\n", mask);
|
||||
assert(gu_init && "GU not initialized");
|
||||
#endif
|
||||
|
||||
sendCommandi(MASK_COLOR, mask);
|
||||
sendCommandi(MASK_ALPHA, mask >> 24);
|
||||
}
|
||||
|
@@ -10,6 +10,14 @@
|
||||
|
||||
void sceGuScissor(int x, int y, int w, int h)
|
||||
{
|
||||
#ifdef GU_DEBUG
|
||||
printf("sceGuScissor(%d, %d, %d, %d);\n", x, y, w, h);
|
||||
assert(gu_init && "GU not initialized");
|
||||
assert(w > 0 && h > 0 && "Invalid scissor dimensions");
|
||||
assert(x >= 0 && y >= 0 && "Invalid scissor position");
|
||||
assert(x + w <= 480 && y + h <= 272 && "Scissor region too large");
|
||||
#endif
|
||||
|
||||
GuContext *context = &gu_contexts[gu_curr_context];
|
||||
|
||||
context->scissor_start[0] = x;
|
||||
@@ -24,7 +32,7 @@ void sceGuScissor(int x, int y, int w, int h)
|
||||
|
||||
sendCommandi(SCISSOR1, orig);
|
||||
sendCommandi(SCISSOR2, end);
|
||||
sendCommandi(REGION1, orig);
|
||||
sendCommandi(REGION1, 0);
|
||||
sendCommandi(REGION2, end);
|
||||
}
|
||||
}
|
||||
|
@@ -10,5 +10,9 @@
|
||||
|
||||
void sceGuSendCommandf(int cmd, float argument)
|
||||
{
|
||||
#ifdef GU_DEBUG
|
||||
assert(gu_init && "GU not initialized");
|
||||
#endif
|
||||
|
||||
sendCommandf(cmd,argument);
|
||||
}
|
||||
|
@@ -10,5 +10,9 @@
|
||||
|
||||
void sceGuSendCommandi(int cmd, int argument)
|
||||
{
|
||||
#ifdef GU_DEBUG
|
||||
assert(gu_init && "GU not initialized");
|
||||
#endif
|
||||
|
||||
sendCommandi(cmd, argument);
|
||||
}
|
||||
|
@@ -13,6 +13,12 @@
|
||||
|
||||
int sceGuSendList(int mode, const void *list, PspGeContext *context)
|
||||
{
|
||||
#ifdef GU_DEBUG
|
||||
printf("sceGuSendList(%d, %p, %p);\n", mode, list, context);
|
||||
assert(gu_init && "GU not initialized");
|
||||
assert((mode == GU_HEAD || mode == GU_TAIL) && "Invalid list mode");
|
||||
#endif
|
||||
|
||||
PspGeListArgs args;
|
||||
int list_id;
|
||||
int callback;
|
||||
|
@@ -10,6 +10,11 @@
|
||||
|
||||
void sceGuSetAllStatus(int status)
|
||||
{
|
||||
#ifdef GU_DEBUG
|
||||
printf("sceGuSetAllStatus(%d);\n", status);
|
||||
assert(gu_init && "GU not initialized");
|
||||
#endif
|
||||
|
||||
unsigned int i;
|
||||
for (i = 0; i < GU_MAX_STATUS; ++i)
|
||||
{
|
||||
|
@@ -10,6 +10,12 @@
|
||||
|
||||
void *sceGuSetCallback(int signal, GuCallback callback)
|
||||
{
|
||||
#ifdef GU_DEBUG
|
||||
printf("sceGuSetCallback(%d, %p);\n", signal, callback);
|
||||
assert(gu_init && "GU not initialized");
|
||||
assert((signal == GU_CALLBACK_SIGNAL || signal == GU_CALLBACK_FINISH) && "Invalid signal");
|
||||
#endif
|
||||
|
||||
GuCallback old_callback = NULL;
|
||||
|
||||
switch (signal)
|
||||
|
@@ -10,6 +10,11 @@
|
||||
|
||||
void sceGuSetDither(const ScePspIMatrix4 *matrix)
|
||||
{
|
||||
#ifdef GU_DEBUG
|
||||
printf("sceGuSetDither(%p);\n", matrix);
|
||||
assert(gu_init && "GU not initialized");
|
||||
#endif
|
||||
|
||||
sendCommandi(DITH0, (matrix->x.x & 0x0f) | ((matrix->x.y & 0x0f) << 4) | ((matrix->x.z & 0x0f) << 8) | ((matrix->x.w & 0x0f) << 12));
|
||||
sendCommandi(DITH1, (matrix->y.x & 0x0f) | ((matrix->y.y & 0x0f) << 4) | ((matrix->y.z & 0x0f) << 8) | ((matrix->y.w & 0x0f) << 12));
|
||||
sendCommandi(DITH2, (matrix->z.x & 0x0f) | ((matrix->z.y & 0x0f) << 4) | ((matrix->z.z & 0x0f) << 8) | ((matrix->z.w & 0x0f) << 12));
|
||||
|
@@ -10,6 +10,12 @@
|
||||
|
||||
void sceGuSetMatrix(int type, const ScePspFMatrix4 *matrix)
|
||||
{
|
||||
#ifdef GU_DEBUG
|
||||
printf("sceGuSetMatrix(%d, %p);\n", type, matrix);
|
||||
assert(gu_init && "GU not initialized");
|
||||
assert(type >= GU_PROJECTION && type <= GU_TEXTURE && "Invalid matrix type");
|
||||
#endif
|
||||
|
||||
unsigned int i, j;
|
||||
const float *fmatrix = (const float *)matrix;
|
||||
|
||||
|
@@ -10,6 +10,13 @@
|
||||
|
||||
void sceGuSetStatus(int state, int status)
|
||||
{
|
||||
#ifdef GU_DEBUG
|
||||
printf("sceGuSetStatus(%d, %d);\n", state, status);
|
||||
assert(gu_init && "GU not initialized");
|
||||
assert(state >= 0 && state < GU_MAX_STATUS && "Invalid state");
|
||||
assert((status == 0 || status == 1) && "Invalid status");
|
||||
#endif
|
||||
|
||||
if (status)
|
||||
sceGuEnable(state);
|
||||
else
|
||||
|
@@ -10,5 +10,11 @@
|
||||
|
||||
void sceGuShadeModel(int mode)
|
||||
{
|
||||
#ifdef GU_DEBUG
|
||||
printf("sceGuShadeModel(%d);\n", mode);
|
||||
assert(gu_init && "GU not initialized");
|
||||
assert((mode == GU_FLAT || mode == GU_SMOOTH) && "Invalid shade model");
|
||||
#endif
|
||||
|
||||
sendCommandi(SHADE_MODE, mode);
|
||||
}
|
||||
|
@@ -8,12 +8,19 @@
|
||||
|
||||
#include "guInternal.h"
|
||||
|
||||
void sceGuSignal(int signal, int argument)
|
||||
void sceGuSignal(int mode, int id)
|
||||
{
|
||||
sendCommandi(SIGNAL, ((signal & 0xff) << 16) | (argument & 0xffff));
|
||||
#ifdef GU_DEBUG
|
||||
printf("sceGuSignal(%d, %d);\n", mode, id);
|
||||
assert(gu_init && "GU not initialized");
|
||||
assert(mode >= GU_SIGNAL_WAIT && mode <= GU_SIGNAL_PAUSE && "Invalid signal mode");
|
||||
assert(id >= 0 && id <= 65535 && "Invalid signal ID, must be between 0 and 65535");
|
||||
#endif
|
||||
|
||||
sendCommandi(SIGNAL, ((mode & 0xff) << 16) | (id & 0xffff));
|
||||
sendCommandi(END, 0);
|
||||
|
||||
if (signal == GU_SIGNAL_PAUSE)
|
||||
if (mode == GU_SIGNAL_PAUSE)
|
||||
{
|
||||
sendCommandi(FINISH, 0);
|
||||
sendCommandi(END, 0);
|
||||
|
@@ -10,5 +10,10 @@
|
||||
|
||||
void sceGuSpecular(float power) // specular power
|
||||
{
|
||||
#ifdef GU_DEBUG
|
||||
printf("sceGuSpecular(%f);\n", power);
|
||||
assert(gu_init && "GU not initialized");
|
||||
#endif
|
||||
|
||||
sendCommandf(MATERIAL_SPECULAR_COEF, power);
|
||||
}
|
||||
|
@@ -14,6 +14,12 @@
|
||||
|
||||
int sceGuStart(int ctype, void *list)
|
||||
{
|
||||
#ifdef GU_DEBUG
|
||||
printf("sceGuStart(%d, %p);\n", ctype, list);
|
||||
assert(gu_init && "GU not initialized");
|
||||
assert((ctype == GU_DIRECT || ctype == GU_CALL || ctype == GU_SEND) && "Invalid context type");
|
||||
#endif
|
||||
|
||||
int intr;
|
||||
GuContext *context = &gu_contexts[ctype];
|
||||
unsigned int *local_list = (unsigned int *)(((unsigned int)list) | 0x40000000);
|
||||
@@ -44,7 +50,7 @@ int sceGuStart(int ctype, void *list)
|
||||
gu_settings.signal_offset = 0;
|
||||
}
|
||||
|
||||
if (!gu_init)
|
||||
if (gu_first_start)
|
||||
{
|
||||
static int dither_matrix[16] =
|
||||
{
|
||||
@@ -61,7 +67,7 @@ int sceGuStart(int ctype, void *list)
|
||||
sceGuSpecular(1.0f);
|
||||
sceGuTexScale(1.0f, 1.0f);
|
||||
|
||||
gu_init = 1;
|
||||
gu_first_start = 0;
|
||||
}
|
||||
|
||||
if (ctype == GU_DIRECT && gu_draw_buffer.frame_width != 0)
|
||||
|
@@ -10,5 +10,14 @@
|
||||
|
||||
void sceGuStencilFunc(int func, int ref, int mask)
|
||||
{
|
||||
sendCommandi(STENCIL_TEST, func | ((ref & 0xff) << 8) | ((mask & 0xff) << 16));
|
||||
#ifdef GU_DEBUG
|
||||
printf("sceGuStencilFunc(%d, %d, %d);\n", func, ref, mask);
|
||||
assert(gu_init && "GU not initialized");
|
||||
assert(func >= GU_NEVER && func <= GU_GEQUAL && "Invalid stencil function");
|
||||
assert(ref >= 0 && ref <= 255 && "Invalid stencil reference");
|
||||
assert(mask >= 0 && mask <= 255 && "Invalid stencil mask");
|
||||
#endif
|
||||
|
||||
int arg = func | ((ref & 0xff) << 8) | ((mask & 0xff) << 16);
|
||||
sendCommandi(STENCIL_TEST, arg);
|
||||
}
|
||||
|
@@ -10,5 +10,14 @@
|
||||
|
||||
void sceGuStencilOp(int fail, int zfail, int zpass)
|
||||
{
|
||||
sendCommandi(STENCIL_OP, fail | (zfail << 8) | (zpass << 16));
|
||||
#ifdef GU_DEBUG
|
||||
printf("sceGuStencilOp(%d, %d, %d);\n", fail, zfail, zpass);
|
||||
assert(gu_init && "GU not initialized");
|
||||
assert(fail >= GU_KEEP && fail <= GU_DECR && "Invalid stencil fail operation");
|
||||
assert(zfail >= GU_KEEP && zfail <= GU_DECR && "Invalid stencil zfail operation");
|
||||
assert(zpass >= GU_KEEP && zpass <= GU_DECR && "Invalid stencil zpass operation");
|
||||
#endif
|
||||
|
||||
int arg = fail | (zfail << 8) | (zpass << 16);
|
||||
sendCommandi(STENCIL_OP, arg);
|
||||
}
|
||||
|
@@ -13,6 +13,11 @@
|
||||
|
||||
void *sceGuSwapBuffers(void)
|
||||
{
|
||||
#ifdef GU_DEBUG
|
||||
printf("sceGuSwapBuffers();\n");
|
||||
assert(gu_init && "GU not initialized");
|
||||
#endif
|
||||
|
||||
if (gu_settings.swapBuffersCallback)
|
||||
{
|
||||
gu_settings.swapBuffersCallback(&gu_draw_buffer.disp_buffer, &gu_draw_buffer.frame_buffer);
|
||||
|
@@ -13,6 +13,13 @@
|
||||
|
||||
int sceGuSync(int mode, int what)
|
||||
{
|
||||
#ifdef GU_DEBUG
|
||||
printf("sceGuSync(%d, %d);\n", mode, what);
|
||||
assert(gu_init && "GU not initialized");
|
||||
assert((mode == GU_SYNC_FINISH || mode == GU_SYNC_LIST || mode == GU_SYNC_SEND || mode == GU_SYNC_SIGNAL || mode == GU_SYNC_DONE) && "Invalid sync mode");
|
||||
assert((what == GU_SYNC_WAIT || what == GU_SYNC_NOWAIT) && "Invalid sync what");
|
||||
#endif
|
||||
|
||||
switch (mode)
|
||||
{
|
||||
case GU_SYNC_FINISH:
|
||||
|
@@ -13,6 +13,15 @@
|
||||
|
||||
void sceGuTerm(void)
|
||||
{
|
||||
#ifdef GU_DEBUG
|
||||
printf("sceGuTerm();\n");
|
||||
assert(gu_init && "GU not initialized");
|
||||
assert(gu_settings.kernel_event_flag >= 0 && "Invalid kernel event flag");
|
||||
assert(gu_settings.ge_callback_id >= 0 && "Invalid GE callback ID");
|
||||
#endif
|
||||
|
||||
sceKernelDeleteEventFlag(gu_settings.kernel_event_flag);
|
||||
sceGeUnsetCallback(gu_settings.ge_callback_id);
|
||||
|
||||
gu_init = 0;
|
||||
}
|
||||
|
@@ -10,5 +10,10 @@
|
||||
|
||||
void sceGuTexEnvColor(unsigned int color)
|
||||
{
|
||||
#ifdef GU_DEBUG
|
||||
printf("sceGuTexEnvColor(0x%08X);\n", color);
|
||||
assert(gu_init && "GU not initialized");
|
||||
#endif
|
||||
|
||||
sendCommandi(TEX_ENV_COLOR, color);
|
||||
}
|
||||
|
@@ -10,5 +10,13 @@
|
||||
|
||||
void sceGuTexFilter(int min, int mag)
|
||||
{
|
||||
sendCommandi(TEX_FILTER, (mag << 8) | min);
|
||||
#ifdef GU_DEBUG
|
||||
printf("sceGuTexFilter(%d, %d);\n", min, mag);
|
||||
assert(gu_init && "GU not initialized");
|
||||
assert(min >= GU_NEAREST && min <= GU_LINEAR_MIPMAP_LINEAR && "Invalid minification filter");
|
||||
assert(mag >= GU_NEAREST && mag <= GU_LINEAR && "Invalid magnification filter");
|
||||
#endif
|
||||
|
||||
int arg = min | (mag << 8);
|
||||
sendCommandi(TEX_FILTER, arg);
|
||||
}
|
||||
|
@@ -10,5 +10,10 @@
|
||||
|
||||
void sceGuTexFlush(void)
|
||||
{
|
||||
#ifdef GU_DEBUG
|
||||
printf("sceGuTexFlush();\n");
|
||||
assert(gu_init && "GU not initialized");
|
||||
#endif
|
||||
|
||||
sendCommandi(TEX_FLUSH, 0);
|
||||
}
|
||||
|
@@ -10,8 +10,14 @@
|
||||
|
||||
void sceGuTexFunc(int tfx, int tcc)
|
||||
{
|
||||
GuContext *context = &gu_contexts[gu_curr_context];
|
||||
context->texture_function = (tcc << 8) | tfx;
|
||||
#ifdef GU_DEBUG
|
||||
printf("sceGuTexFunc(%d, %d);\n", tfx, tcc);
|
||||
assert(gu_init && "GU not initialized");
|
||||
assert(tfx >= GU_TFX_MODULATE && tfx <= GU_TFX_ADD && "Invalid texture function");
|
||||
assert(tcc >= GU_TCC_RGB && tcc <= GU_TCC_RGBA && "Invalid texture color component");
|
||||
#endif
|
||||
|
||||
sendCommandi(TEX_FUNC, ((tcc << 8) | tfx) | context->fragment_2x);
|
||||
GuContext *context = &gu_contexts[gu_curr_context];
|
||||
context->texture_function = tfx | (tcc << 8);
|
||||
sendCommandi(TEX_FUNC, context->texture_function | context->fragment_2x);
|
||||
}
|
||||
|
@@ -15,6 +15,18 @@ static inline int getExp(int val)
|
||||
|
||||
void sceGuTexImage(int mipmap, int width, int height, int tbw, const void *tbp)
|
||||
{
|
||||
#ifdef GU_DEBUG
|
||||
printf("sceGuTexImage(%d, %d, %d, %d, %p);\n", mipmap, width, height, tbw, tbp);
|
||||
assert(gu_init && "GU not initialized");
|
||||
assert(((unsigned int)tbp & 0xF) == 0 && "Texture buffer pointer must be 16-byte aligned");
|
||||
assert(mipmap >= 0 && mipmap <= 7 && "Invalid mipmap level");
|
||||
assert(width >= 1 && width <= 512 && "Invalid texture width");
|
||||
assert(height >= 1 && height <= 512 && "Invalid texture height");
|
||||
assert(tbw >= 1 && tbw <= 1024 && "Invalid texture buffer width");
|
||||
assert((width & (width - 1)) == 0 && "Texture width must be power of 2");
|
||||
assert((height & (height - 1)) == 0 && "Texture height must be power of 2");
|
||||
#endif
|
||||
|
||||
GECommand texAddr = (GECommand)(TEX_ADDR0 + mipmap);
|
||||
GECommand texBufWidth = (GECommand)(TEX_BUF_WIDTH0 + mipmap);
|
||||
GECommand texSize = (GECommand)(TEX_SIZE0 + mipmap);
|
||||
|
@@ -12,6 +12,12 @@
|
||||
|
||||
void sceGuTexLevelMode(unsigned int mode, float bias)
|
||||
{
|
||||
#ifdef GU_DEBUG
|
||||
printf("sceGuTexLevelMode(%08X, %f);\n", mode, bias);
|
||||
assert(gu_init && "GU not initialized");
|
||||
assert((mode == GU_TEXTURE_AUTO || mode == GU_TEXTURE_CONST || mode == GU_TEXTURE_SLOPE) && "Invalid texture level mode");
|
||||
#endif
|
||||
|
||||
int offset = (int)truncf(bias * 16.0f);
|
||||
|
||||
// mip map bias?
|
||||
|
@@ -10,6 +10,12 @@
|
||||
|
||||
void sceGuTexMapMode(int mode, unsigned int lu, unsigned int lv)
|
||||
{
|
||||
#ifdef GU_DEBUG
|
||||
printf("sceGuTexMapMode(%d, %08X, %08X);\n", mode, lu, lv);
|
||||
assert(gu_init && "GU not initialized");
|
||||
assert((mode == GU_TEXTURE_COORDS || mode == GU_TEXTURE_MATRIX || mode == GU_ENVIRONMENT_MAP) && "Invalid texture map mode");
|
||||
#endif
|
||||
|
||||
GuContext *context = &gu_contexts[gu_curr_context];
|
||||
|
||||
context->texture_map_mode = mode & 0x03;
|
||||
|
@@ -10,6 +10,16 @@
|
||||
|
||||
void sceGuTexMode(int tpsm, int maxmips, int mc, int swizzle)
|
||||
{
|
||||
#ifdef GU_DEBUG
|
||||
printf("sceGuTexMode(%d, %d, %d, %d);\n", tpsm, maxmips, mc, swizzle);
|
||||
assert(gu_init && "GU not initialized");
|
||||
assert((tpsm == GU_PSM_5650 || tpsm == GU_PSM_5551 || tpsm == GU_PSM_4444 ||
|
||||
tpsm == GU_PSM_8888 || tpsm == GU_PSM_T4 || tpsm == GU_PSM_T8) && "Invalid texture pixel format");
|
||||
assert(maxmips >= 0 && maxmips <= 7 && "Invalid max mipmaps");
|
||||
assert(mc >= 0 && mc <= 1 && "Invalid multiclut value");
|
||||
assert(swizzle >= 0 && swizzle <= 1 && "Invalid texture swizzle");
|
||||
#endif
|
||||
|
||||
GuContext *context = &gu_contexts[gu_curr_context];
|
||||
context->texture_mode = tpsm;
|
||||
|
||||
|
@@ -10,6 +10,11 @@
|
||||
|
||||
void sceGuTexOffset(float u, float v)
|
||||
{
|
||||
#ifdef GU_DEBUG
|
||||
printf("sceGuTexOffset(%f, %f);\n", u, v);
|
||||
assert(gu_init && "GU not initialized");
|
||||
#endif
|
||||
|
||||
sendCommandf(TEX_OFFSET_U, u);
|
||||
sendCommandf(TEX_OFFSET_V, v);
|
||||
}
|
||||
|
@@ -10,6 +10,12 @@
|
||||
|
||||
void sceGuTexProjMapMode(int mode)
|
||||
{
|
||||
#ifdef GU_DEBUG
|
||||
printf("sceGuTexProjMapMode(%d);\n", mode);
|
||||
assert(gu_init && "GU not initialized");
|
||||
assert((mode == GU_POSITION || mode == GU_UV || mode == GU_NORMALIZED_NORMAL || mode == GU_NORMAL) && "Invalid texture projection map mode");
|
||||
#endif
|
||||
|
||||
GuContext *context = &gu_contexts[gu_curr_context];
|
||||
|
||||
context->texture_proj_map_mode = ((mode & 0x03) << 8);
|
||||
|
@@ -10,6 +10,11 @@
|
||||
|
||||
void sceGuTexScale(float u, float v)
|
||||
{
|
||||
#ifdef GU_DEBUG
|
||||
printf("sceGuTexScale(%f, %f);\n", u, v);
|
||||
assert(gu_init && "GU not initialized");
|
||||
#endif
|
||||
|
||||
sendCommandf(TEX_SCALE_U, u);
|
||||
sendCommandf(TEX_SCALE_V, v);
|
||||
}
|
||||
|
@@ -10,5 +10,10 @@
|
||||
|
||||
void sceGuTexSlope(float slope)
|
||||
{
|
||||
#ifdef GU_DEBUG
|
||||
printf("sceGuTexSlope(%f);\n", slope);
|
||||
assert(gu_init && "GU not initialized");
|
||||
#endif
|
||||
|
||||
sendCommandf(TEX_LOD_SLOPE, slope);
|
||||
}
|
||||
|
@@ -10,5 +10,10 @@
|
||||
|
||||
void sceGuTexSync()
|
||||
{
|
||||
#ifdef GU_DEBUG
|
||||
printf("sceGuTexSync();\n");
|
||||
assert(gu_init && "GU not initialized");
|
||||
#endif
|
||||
|
||||
sendCommandi(TEX_SYNC, 0);
|
||||
}
|
||||
|
@@ -10,5 +10,13 @@
|
||||
|
||||
void sceGuTexWrap(int u, int v)
|
||||
{
|
||||
sendCommandi(TEX_WRAP, (v << 8) | (u));
|
||||
#ifdef GU_DEBUG
|
||||
printf("sceGuTexWrap(%d, %d);\n", u, v);
|
||||
assert(gu_init && "GU not initialized");
|
||||
assert((u == GU_CLAMP || u == GU_REPEAT) && "Invalid U wrap mode");
|
||||
assert((v == GU_CLAMP || v == GU_REPEAT) && "Invalid V wrap mode");
|
||||
#endif
|
||||
|
||||
int arg = u | (v << 8);
|
||||
sendCommandi(TEX_WRAP, arg);
|
||||
}
|
||||
|
@@ -10,6 +10,15 @@
|
||||
|
||||
void sceGuViewport(int cx, int cy, int width, int height)
|
||||
{
|
||||
#ifdef GU_DEBUG
|
||||
printf("sceGuViewport(%d, %d, %d, %d);\n", cx, cy, width, height);
|
||||
assert(gu_init && "GU not initialized");
|
||||
assert(width > 0 && height > 0 && "Invalid viewport dimensions");
|
||||
assert(width <= 4096 && height <= 4096 && "Viewport dimensions too large");
|
||||
assert(cx >= 0 && cx <= 4095 && "Invalid viewport X coordinate");
|
||||
assert(cy >= 0 && cy <= 4095 && "Invalid viewport Y coordinate");
|
||||
#endif
|
||||
|
||||
float sx, sy, tx, ty;
|
||||
sx = (float)(width) * 0.5f;
|
||||
sy = (float)(height) * -0.5f;
|
||||
|
58
src/kermit/Makefile.am
Normal file
58
src/kermit/Makefile.am
Normal file
@@ -0,0 +1,58 @@
|
||||
|
||||
libdir = @PSPSDK_LIBDIR@
|
||||
|
||||
CC = @PSP_CC@
|
||||
CCAS = $(CC)
|
||||
AR = @PSP_AR@
|
||||
RANLIB = @PSP_RANLIB@
|
||||
|
||||
CPPFLAGS = -I$(top_srcdir)/src/base -I$(top_srcdir)/src/kernel
|
||||
CFLAGS = @PSPSDK_CFLAGS@
|
||||
CCASFLAGS = $(CFLAGS)
|
||||
|
||||
KERMIT_DRIVER_OBJS = sceKermit_driver_0000.o sceKermit_driver_0001.o sceKermit_driver_0002.o sceKermit_driver_0003.o sceKermit_driver_0004.o sceKermit_driver_0005.o
|
||||
|
||||
KERMIT_FLASHFS_DRIVER_OBJS = sceKermitFlashfs_driver_0000.o sceKermitFlashfs_driver_0001.o
|
||||
|
||||
KERMIT_MSFS_DRIVER_OBJS = sceKermitMsfs_driver_0000.o sceKermitMsfs_driver_0001.o sceKermitMsfs_driver_0002.o sceKermitMsfs_driver_0003.o sceKermitMsfs_driver_0004.o sceKermitMsfs_driver_0005.o sceKermitMsfs_driver_0006.o
|
||||
|
||||
KERMIT_MEMORY_DRIVER_OBJS = sceKermitMemory_driver_0000.o sceKermitMemory_driver_0001.o sceKermitMemory_driver_0002.o sceKermitMemory_driver_0003.o
|
||||
|
||||
KERMIT_PERIPHERAL_OBJS = sceKermitPeripheral_0000.o sceKermitPeripheral_0001.o sceKermitPeripheral_0002.o sceKermitPeripheral_0003.o
|
||||
|
||||
KERMIT_PERIPHERAL_DRIVER_OBJS = sceKermitPeripheral_driver_0000.o sceKermitPeripheral_driver_0001.o sceKermitPeripheral_driver_0002.o sceKermitPeripheral_driver_0003.o sceKermitPeripheral_driver_0004.o sceKermitPeripheral_driver_0005.o sceKermitPeripheral_driver_0006.o sceKermitPeripheral_driver_0007.o sceKermitPeripheral_driver_0008.o sceKermitPeripheral_driver_0009.o sceKermitPeripheral_driver_0010.o sceKermitPeripheral_driver_0011.o sceKermitPeripheral_driver_0012.o sceKermitPeripheral_driver_0013.o sceKermitPeripheral_driver_0014.o sceKermitPeripheral_driver_0015.o sceKermitPeripheral_driver_0016.o sceKermitPeripheral_driver_0017.o sceKermitPeripheral_driver_0018.o
|
||||
|
||||
kermitincludedir = @PSPSDK_INCLUDEDIR@
|
||||
kermitinclude_HEADERS = pspkermit.h
|
||||
|
||||
lib_LIBRARIES = libpspkermit_driver.a libpspkermitflashfs_driver.a libpspkermitmsfs_driver.a libpspkermitmemory_driver.a libpspkermitperipheral.a libpspkermitperipheral_driver.a
|
||||
libpspkermit_driver_a_SOURCES = sceKermit_driver.S
|
||||
libpspkermit_driver_a_LIBADD = $(KERMIT_DRIVER_OBJS)
|
||||
libpspkermitflashfs_driver_a_SOURCES = sceKermitFlashfs_driver.S
|
||||
libpspkermitflashfs_driver_a_LIBADD = $(KERMIT_FALSHFS_DRIVER_OBJS)
|
||||
libpspkermitmsfs_driver_a_SOURCES = sceKermitMsfs_driver.S
|
||||
libpspkermitmsfs_driver_a_LIBADD = $(KERMIT_MSFS_DRIVER_OBJS)
|
||||
libpspkermitmemory_driver_a_SOURCES = sceKermitMemory_driver.S
|
||||
libpspkermitmemory_driver_a_LIBADD = $(KERMIT_MEMORY_DRIVER_OBJS)
|
||||
libpspkermitperipheral_a_SOURCES = sceKermitPeripheral.S
|
||||
libpspkermitperipheral_a_LIBADD = $(KERMIT_PERIPHERAL_OBJS)
|
||||
libpspkermitperipheral_driver_a_SOURCES = sceKermitPeripheral_driver.S
|
||||
libpspkermitperipheral_driver_a_LIBADD = $(KERMIT_PERIPHERAL_DRIVER_OBJS)
|
||||
|
||||
$(KERMIT_DRIVER_OBJS): sceKermit_driver.S
|
||||
$(AM_V_CPPAS)$(CPPASCOMPILE) -DF_$* $< -c -o $@
|
||||
|
||||
$(KERMIT_FLASHFS_DRIVER_OBJS): sceKermitFlashfs_driver.S
|
||||
$(AM_V_CPPAS)$(CPPASCOMPILE) -DF_$* $< -c -o $@
|
||||
|
||||
$(KERMIT_MSFS_DRIVER_OBJS): sceKermitMsfs_driver.S
|
||||
$(AM_V_CPPAS)$(CPPASCOMPILE) -DF_$* $< -c -o $@
|
||||
|
||||
$(KERMIT_MEMORY_DRIVER_OBJS): sceKermitMemory_driver.S
|
||||
$(AM_V_CPPAS)$(CPPASCOMPILE) -DF_$* $< -c -o $@
|
||||
|
||||
$(KERMIT_PERIPHERAL_OBJS): sceKermitPeripheral.S
|
||||
$(AM_V_CPPAS)$(CPPASCOMPILE) -DF_$* $< -c -o $@
|
||||
|
||||
$(KERMIT_PERIPHERAL_DRIVER_OBJS): sceKermitPeripheral_driver.S
|
||||
$(AM_V_CPPAS)$(CPPASCOMPILE) -DF_$* $< -c -o $@
|
264
src/kermit/pspkermit.h
Normal file
264
src/kermit/pspkermit.h
Normal file
@@ -0,0 +1,264 @@
|
||||
#ifndef __KERMIT_H__
|
||||
#define __KERMIT_H__
|
||||
|
||||
#include <pspsdk.h>
|
||||
|
||||
#define KERMIT_MAX_ARGC (14)
|
||||
|
||||
/* kermit KERMIT_MODE_PERIPHERAL commands */
|
||||
#define KERMIT_CMD_RTC_GET_CURRENT_TICK (0x0)
|
||||
#define KERMIT_CMD_ID_STORAGE_LOOKUP (0x1)
|
||||
#define KERMIT_CMD_POWER_FREQUENCY (0x2)
|
||||
#define KERMIT_CMD_AUDIO_ROUTING (0x3)
|
||||
#define KERMIT_CMD_GET_CAMERA_DIRECTION (0x5)
|
||||
#define KERMIT_CMD_GET_IDPSC_ENABLE (0x6)
|
||||
#define KERMIT_CMD_DISABLE_MULTITASKING (0x7)
|
||||
#define KERMIT_CMD_ERROR_EXIT (0x8)
|
||||
#define KERMIT_CMD_ERROR_EXIT_2 (0x422)
|
||||
#define KERMIT_CMD_ENABLE_MULTITASKING (0x9)
|
||||
#define KERMIT_CMD_RESUME_DEVICE (0xA)
|
||||
#define KERMIT_CMD_REQUEST_SUSPEND (0xB)
|
||||
#define KERMIT_CMD_IS_FIRST_BOOT (0xC)
|
||||
#define KERMIT_CMD_GET_PREFIX_SSID (0xD)
|
||||
#define KERMIT_CMD_SET_PS_BUTTON_STATE (0x10)
|
||||
|
||||
/* kermit KERMIT_MODE_MSFS commands */
|
||||
#define KERMIT_CMD_INIT_MS (0x0)
|
||||
#define KERMIT_CMD_EXIT_MS (0x1)
|
||||
#define KERMIT_CMD_OPEN_MS (0x2)
|
||||
#define KERMIT_CMD_CLOSE_MS (0x3)
|
||||
#define KERMIT_CMD_READ_MS (0x4)
|
||||
#define KERMIT_CMD_WRITE_MS (0x5)
|
||||
#define KERMIT_CMD_SEEK_MS (0x6)
|
||||
#define KERMIT_CMD_IOCTL_MS (0x7)
|
||||
#define KERMIT_CMD_REMOVE_MS (0x8)
|
||||
#define KERMIT_CMD_MKDIR_MS (0x9)
|
||||
#define KERMIT_CMD_RMDIR_MS (0xA)
|
||||
#define KERMIT_CMD_DOPEN_MS (0xB)
|
||||
#define KERMIT_CMD_DCLOSE_MS (0xC)
|
||||
#define KERMIT_CMD_DREAD_MS (0xD)
|
||||
#define KERMIT_CMD_GETSTAT_MS (0xE)
|
||||
#define KERMIT_CMD_CHSTAT_MS (0xF)
|
||||
#define KERMIT_CMD_RENAME_MS (0x10)
|
||||
#define KERMIT_CMD_CHDIR_MS (0x11)
|
||||
#define KERMIT_CMD_DEVCTL (0x14)
|
||||
|
||||
/* kermit KERMIT_MODE_AUDIO commands */
|
||||
#define KERMIT_CMD_INIT_AUDIO_IN 0x0
|
||||
#define KERMIT_CMD_OUTPUT_1 0x1
|
||||
#define KERMIT_CMD_OUTPUT_2 0x2
|
||||
#define KERMIT_CMD_SUSPEND_AUDIO 0x3
|
||||
#define KERMIT_CMD_RESUME 0x4
|
||||
|
||||
/* kermit KERMIT_MODE_ME commands */
|
||||
#define KERMIT_CMD_UNK0 0x0
|
||||
#define KERMIT_CMD_SETAVC_TIMESTAMPINTERNAL 0x1
|
||||
#define KERMIT_CMD_BOOT_START 0x2
|
||||
|
||||
/* kermit KERMIT_MODE_LOWIO commands */
|
||||
#define KERMIT_CMD_UNK9 0x9
|
||||
#define KERMIT_CMD_UNKA 0xA
|
||||
#define KERMIT_CMD_UNKB 0xB
|
||||
#define KERMIT_CMD_UNKC 0xC
|
||||
|
||||
/* kermit KERMIT_MODE_WLAN commands */
|
||||
#define KERMIT_CMD_INIT 0x0
|
||||
#define KERMIT_CMD_GET_SWITCH_INTERNAL_STATE 0x2
|
||||
#define KERMIT_CMD_GET_ETHER_ADDR 0x3
|
||||
#define KERMIT_CMD_ADHOC_CTL_INIT 0x6
|
||||
#define KERMIT_CMD_ADHOC_CTL_TERM 0x7
|
||||
#define KERMIT_CMD_ADHOC_SCAN 0x8
|
||||
#define KERMIT_CMD_ADHOC_JOIN 0x9
|
||||
#define KERMIT_CMD_ADHOC_CREATE 0xA
|
||||
#define KERMIT_CMD_ADHOC_LEAVE 0xB
|
||||
#define KERMIT_CMD_ADHOC_TX_DATA 0xC
|
||||
#define KERMIT_CMD_ADHOC_RX_DATA 0xD
|
||||
#define KERMIT_CMD_INET_INIT 0xE
|
||||
#define KERMIT_CMD_INET_START 0xF
|
||||
#define KERMIT_CMD_INET_TERM 0x10
|
||||
#define KERMIT_CMD_INET_SOCKET 0x11
|
||||
#define KERMIT_CMD_INET_CLOSE 0x12
|
||||
#define KERMIT_CMD_INET_BIND 0x13
|
||||
#define KERMIT_CMD_INET_LISTEN 0x14
|
||||
#define KERMIT_CMD_INET_CONNECT 0x15
|
||||
#define KERMIT_CMD_INET_SHUTDOWN 0x16
|
||||
#define KERMIT_CMD_INET_POLL 0x17
|
||||
#define KERMIT_CMD_INET_ACCEPT 0x18
|
||||
#define KERMIT_CMD_INET_GET_PEER_NAME 0x19
|
||||
#define KERMIT_CMD_INET_GET_SOCK_NAME 0x1A
|
||||
#define KERMIT_CMD_INET_GET_OPT 0x1B
|
||||
#define KERMIT_CMD_INET_SET_OPT 0x1C
|
||||
#define KERMIT_CMD_INET_RECV_FROM 0x1D
|
||||
#define KERMIT_CMD_INET_SENDTO_INTERNAL 0x1E
|
||||
#define KERMIT_CMD_INET_SOIOCTL 0x1F
|
||||
#define KERMIT_CMD_SUSPEND_WLAN 0x20
|
||||
#define KERMIT_CMD_SET_WOL_PARAM 0x22
|
||||
#define KERMIT_CMD_GET_WOL_INFO 0x23
|
||||
#define KERMIT_CMD_SET_HOST_DISCOVER 0x24
|
||||
|
||||
/* kermit KERMIT_MODE_UTILITY commands */
|
||||
#define KERMIT_CMD_OSK_START (0x0)
|
||||
#define KERMIT_CMD_OSK_SHUTDOWN (0x1)
|
||||
#define KERMIT_CMD_OSK_UPDATE (0x3)
|
||||
|
||||
/* kermit KERMIT_MODE_USB commands */
|
||||
#define KERMIT_CMD_INIT 0x0
|
||||
#define KERMIT_CMD_ACTIVATE 0x15
|
||||
#define KERMIT_CMD_DEACTIVATE 0x16
|
||||
#define KERMIT_CMD_SET_OP 0x19
|
||||
#define KERMIT_CMD_SET_OP_BIS 0x1A
|
||||
#define KERMIT_CMD_UNK1B 0x1B
|
||||
|
||||
|
||||
/* KERMIT_PACKET address macros */
|
||||
#define KERNEL(x) ((x & 0x80000000)? 1:0)
|
||||
#define KERMIT_PACKET(x) (x | (2-KERNEL(x))*0x20000000)
|
||||
#define ALIGN_64(x) ((x) & -64)
|
||||
#define KERMIT_CALLBACK_DISABLE 0
|
||||
|
||||
enum KermitModes {
|
||||
KERMIT_MODE_NONE,
|
||||
KERMIT_MODE_UNK_1,
|
||||
KERMIT_MODE_UNK_2,
|
||||
KERMIT_MODE_MSFS,
|
||||
KERMIT_MODE_FLASHFS,
|
||||
KERMIT_MODE_AUDIOOUT,
|
||||
KERMIT_MODE_ME,
|
||||
KERMIT_MODE_LOWIO,
|
||||
KERMIT_MODE_POCS_USBPSPCM,
|
||||
KERMIT_MODE_PERIPHERAL,
|
||||
KERMIT_MODE_WLAN,
|
||||
KERMIT_MODE_AUDIOIN,
|
||||
KERMIT_MODE_USB,
|
||||
KERMIT_MODE_UTILITY,
|
||||
KERMIT_MODE_EXTRA_1,
|
||||
KERMIT_MODE_EXTRA_2,
|
||||
};
|
||||
|
||||
enum KermitVirtualInterrupts {
|
||||
KERMIT_VIRTUAL_INTR_NONE,
|
||||
KERMIT_VIRTUAL_INTR_AUDIO_CH1,
|
||||
KERMIT_VIRTUAL_INTR_AUDIO_CH2,
|
||||
KERMIT_VIRTUAL_INTR_AUDIO_CH3,
|
||||
KERMIT_VIRTUAL_INTR_ME_DMA_CH1,
|
||||
KERMIT_VIRTUAL_INTR_ME_DMA_CH2,
|
||||
KERMIT_VIRTUAL_INTR_ME_DMA_CH3,
|
||||
KERMIT_VIRTUAL_INTR_WLAN_CH1,
|
||||
KERMIT_VIRTUAL_INTR_WLAN_CH2,
|
||||
KERMIT_VIRTUAL_INTR_IMPOSE_CH1,
|
||||
KERMIT_VIRTUAL_INTR_POWER_CH1,
|
||||
KERMIT_VIRTUAL_INTR_UNKNOWN_CH1, // <- used after settings
|
||||
KERMIT_VIRTUAL_INTR_USBGPS_CH1,
|
||||
KERMIT_VIRTUAL_INTR_USBPSPCM_CH1,
|
||||
};
|
||||
|
||||
enum KermitArgumentModes {
|
||||
KERMIT_INPUT_MODE = 0x1,
|
||||
KERMIT_OUTPUT_MODE = 0x2,
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
uint32_t cmd; //0x0
|
||||
SceUID sema_id; //0x4
|
||||
uint64_t *response; //0x8
|
||||
uint32_t padding; //0xC
|
||||
uint64_t args[14]; // 0x10
|
||||
} SceKermitRequest; //0x80
|
||||
|
||||
// 0xBFC00800
|
||||
typedef struct {
|
||||
uint32_t cmd; //0x00
|
||||
SceKermitRequest *request; //0x04
|
||||
} SceKermitCommand; //0x8
|
||||
|
||||
// 0xBFC00840
|
||||
typedef struct {
|
||||
uint64_t result; //0x0
|
||||
SceUID sema_id; //0x8
|
||||
int32_t unk_C; //0xC
|
||||
uint64_t *response; //0x10
|
||||
uint64_t unk_1C; //0x1C
|
||||
} SceKermitResponse; //0x24 or 0x30????
|
||||
|
||||
// 0xBFC008C0
|
||||
typedef struct {
|
||||
int32_t unk_0; //0x0
|
||||
int32_t unk_4; //0x4
|
||||
} SceKermitInterrupt; //0x8
|
||||
|
||||
typedef struct KermitPacket_
|
||||
{
|
||||
u32 cmd; //0x0
|
||||
SceUID sema; //0x4
|
||||
struct KermitPacket_ *self; //0x8
|
||||
u32 unk_C; //0xC
|
||||
} KermitPacket;
|
||||
|
||||
|
||||
/*
|
||||
Issue a command to kermit.
|
||||
|
||||
packet: a kermit packet. Header followed by 64 bit words (LE) as arguements.
|
||||
cmd_mode: a valid command mode type.
|
||||
cmd: a valid command subtype of cmd_mode.
|
||||
argc: the number of 64 bit arguements following the header. Max 13 arguements.
|
||||
allow_callback: set non-zero to use callback permitting semaphore wait.
|
||||
resp: 64 bit word returned by the kermit call.
|
||||
|
||||
returns 0 on success, else < 0 on error.
|
||||
*/
|
||||
int sceKermit_driver_4F75AA05(KermitPacket *packet, u32 cmd_mode, u32 cmd, u32 argc, u32 allow_callback, u64 *resp);
|
||||
|
||||
/*
|
||||
Apply IO to kermit packet.
|
||||
|
||||
packet: a kermit packet. Header followed by 64 bit words (LE) as arguements.
|
||||
argc: the number of arguements in the packet. Max 13 arguements.
|
||||
buffer: the input buffer containing the data to be sent or the output buffer to store data.
|
||||
buffer_size: the size of the input data, else the size of the output buffer.
|
||||
io_mode: KERMIT_INPUT_MODE for data input. KERMIT_OUTPUT_MODE for expecting output data.
|
||||
*/
|
||||
void sceKermitMemorySetArgument(KermitPacket *packet, u32 argc, u8 *buffer, u32 buffer_size, u32 io_mode);
|
||||
|
||||
/*
|
||||
Send data to vita host.
|
||||
|
||||
data: pointer to the data to be sent to host.
|
||||
len: the size of the data to be sent.
|
||||
*/
|
||||
void sceKermitMemory_driver_80E1240A(u8 *data, u32 len);
|
||||
|
||||
/*
|
||||
Recieve data from vita host.
|
||||
|
||||
data: pointer to buffer to store output data.
|
||||
len: the size of the expected output data.
|
||||
*/
|
||||
void sceKermitMemory_driver_90B662D0(u8 *data, u32 data_size);
|
||||
|
||||
|
||||
/*
|
||||
Register handler for a kermit virtual interrupt.
|
||||
|
||||
interrupt: ID of the virtual interrupt.
|
||||
handler: function pointer.
|
||||
|
||||
returns 0 on success, else < 0 on error.
|
||||
*/
|
||||
int sceKermitRegisterVirtualIntrHandler(u32 interrupt, void* handler);
|
||||
|
||||
/*
|
||||
Send a request to kermit.
|
||||
|
||||
request: pointer to SceKermitRequest data structure.
|
||||
mode: ID of the request mode (see enum KermitModes).
|
||||
cmd: request command ID.
|
||||
argc: unknown, pass 0.
|
||||
callback: callback mode, pass KERMIT_CALLBACK_DISABLE (0).
|
||||
response: pointer to return value.
|
||||
|
||||
returns 0 on success, else < 0 on error.
|
||||
*/
|
||||
int sceKermitSendRequest(SceKermitRequest* request, u32 mode, u32 cmd, int argc, u32 callback, u64* response);
|
||||
|
||||
#endif /* __KERMIT_H__ */
|
10
src/kermit/sceKermitFlashfs_driver.S
Normal file
10
src/kermit/sceKermitFlashfs_driver.S
Normal file
@@ -0,0 +1,10 @@
|
||||
.set noreorder
|
||||
|
||||
#include "pspimport.s"
|
||||
|
||||
#ifdef F_sceKermitFlashfs_driver_0000
|
||||
IMPORT_START "sceKermitFlashfs_driver",0x00090000
|
||||
#endif
|
||||
#ifdef F_sceKermitFlashfs_driver_0001
|
||||
IMPORT_FUNC "sceKermitFlashfs_driver",0x78D76B63,sceKermitFlashfs_driver_78D76B63
|
||||
#endif
|
16
src/kermit/sceKermitMemory_driver.S
Normal file
16
src/kermit/sceKermitMemory_driver.S
Normal file
@@ -0,0 +1,16 @@
|
||||
.set noreorder
|
||||
|
||||
#include "pspimport.s"
|
||||
|
||||
#ifdef F_sceKermitMemory_driver_0000
|
||||
IMPORT_START "sceKermitMemory_driver",0x00090000
|
||||
#endif
|
||||
#ifdef F_sceKermitMemory_driver_0001
|
||||
IMPORT_FUNC "sceKermitMemory_driver",0x80E1240A,sceKermitMemory_driver_80E1240A
|
||||
#endif
|
||||
#ifdef F_sceKermitMemory_driver_0002
|
||||
IMPORT_FUNC "sceKermitMemory_driver",0x90B662D0,sceKermitMemory_driver_90B662D0
|
||||
#endif
|
||||
#ifdef F_sceKermitMemory_driver_0003
|
||||
IMPORT_FUNC "sceKermitMemory_driver",0xAAF047AC,sceKermitMemorySetArgument
|
||||
#endif
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user