mirror of
https://github.com/pspdev/pspsdk.git
synced 2025-12-16 00:47:22 +00:00
Improving SCE GU readability
This commit is contained in:
@@ -17,113 +17,623 @@ typedef struct
|
||||
{
|
||||
GuCallback sig;
|
||||
GuCallback fin;
|
||||
short signal_history[16];
|
||||
int signal_offset;
|
||||
int kernel_event_flag;
|
||||
int ge_callback_id;
|
||||
short signal_history[16];
|
||||
int signal_offset;
|
||||
int kernel_event_flag;
|
||||
int ge_callback_id;
|
||||
|
||||
GuSwapBuffersCallback swapBuffersCallback;
|
||||
int swapBuffersBehaviour;
|
||||
int swapBuffersBehaviour;
|
||||
} GuSettings;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
unsigned int* start;
|
||||
unsigned int* current;
|
||||
int parent_context;
|
||||
unsigned int *start;
|
||||
unsigned int *current;
|
||||
int parent_context;
|
||||
} GuDisplayList;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
GuDisplayList list;
|
||||
int scissor_enable;
|
||||
int scissor_start[2];
|
||||
int scissor_end[2];
|
||||
int near_plane;
|
||||
int far_plane;
|
||||
int depth_offset;
|
||||
int fragment_2x;
|
||||
int texture_function;
|
||||
int texture_proj_map_mode;
|
||||
int texture_map_mode;
|
||||
int sprite_mode[4];
|
||||
unsigned int clear_color;
|
||||
unsigned int clear_stencil;
|
||||
unsigned int clear_depth;
|
||||
int texture_mode;
|
||||
int scissor_enable;
|
||||
int scissor_start[2];
|
||||
int scissor_end[2];
|
||||
int near_plane;
|
||||
int far_plane;
|
||||
int depth_offset;
|
||||
int fragment_2x;
|
||||
int texture_function;
|
||||
int texture_proj_map_mode;
|
||||
int texture_map_mode;
|
||||
int sprite_mode[4];
|
||||
unsigned int clear_color;
|
||||
unsigned int clear_stencil;
|
||||
unsigned int clear_depth;
|
||||
int texture_mode;
|
||||
} GuContext;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int pixel_size;
|
||||
int frame_width;
|
||||
void* frame_buffer;
|
||||
void* disp_buffer;
|
||||
void* depth_buffer;
|
||||
int depth_width;
|
||||
int width;
|
||||
int height;
|
||||
int pixel_size;
|
||||
int frame_width;
|
||||
void *frame_buffer;
|
||||
void *disp_buffer;
|
||||
void *depth_buffer;
|
||||
int depth_width;
|
||||
int width;
|
||||
int height;
|
||||
} GuDrawBuffer;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
/* row 0 */
|
||||
|
||||
unsigned char enable; // Light enable
|
||||
unsigned char type; // Light type
|
||||
unsigned char xpos; // X position
|
||||
unsigned char ypos; // Y position
|
||||
unsigned char enable; // Light enable
|
||||
unsigned char type; // Light type
|
||||
unsigned char xpos; // X position
|
||||
unsigned char ypos; // Y position
|
||||
|
||||
/* row 1 */
|
||||
|
||||
unsigned char zpos; // Z position
|
||||
unsigned char xdir; // X direction
|
||||
unsigned char ydir; // Y direction
|
||||
unsigned char zdir; // Z direction
|
||||
unsigned char zpos; // Z position
|
||||
unsigned char xdir; // X direction
|
||||
unsigned char ydir; // Y direction
|
||||
unsigned char zdir; // Z direction
|
||||
|
||||
/* row 2 */
|
||||
|
||||
unsigned char ambient; // Ambient color
|
||||
unsigned char diffuse; // Diffuse color
|
||||
unsigned char ambient; // Ambient color
|
||||
unsigned char diffuse; // Diffuse color
|
||||
unsigned char specular; // Specular color
|
||||
unsigned char constant; // Constant attenuation
|
||||
|
||||
/* row 3 */
|
||||
|
||||
unsigned char linear; // Linear attenuation
|
||||
unsigned char quadratic;// Quadratic attenuation
|
||||
unsigned char exponent; // Light exponent
|
||||
unsigned char cutoff; // Light cutoff
|
||||
unsigned char linear; // Linear attenuation
|
||||
unsigned char quadratic; // Quadratic attenuation
|
||||
unsigned char exponent; // Light exponent
|
||||
unsigned char cutoff; // Light cutoff
|
||||
} GuLightSettings;
|
||||
|
||||
extern unsigned int gu_current_frame;
|
||||
extern GuContext gu_contexts[3];
|
||||
extern int ge_list_executed[2];
|
||||
extern void* ge_edram_address;
|
||||
extern GuSettings gu_settings;
|
||||
extern GuDisplayList* gu_list;
|
||||
extern int gu_curr_context;
|
||||
extern int gu_init;
|
||||
extern int gu_display_on;
|
||||
extern int gu_call_mode;
|
||||
extern int gu_states;
|
||||
extern GuDrawBuffer gu_draw_buffer;
|
||||
extern unsigned int gu_current_frame;
|
||||
extern GuContext gu_contexts[3];
|
||||
extern int ge_list_executed[2];
|
||||
extern void *ge_edram_address;
|
||||
extern GuSettings gu_settings;
|
||||
extern GuDisplayList *gu_list;
|
||||
extern int gu_curr_context;
|
||||
extern int gu_init;
|
||||
extern int gu_display_on;
|
||||
extern int gu_call_mode;
|
||||
extern int gu_states;
|
||||
extern GuDrawBuffer gu_draw_buffer;
|
||||
|
||||
extern unsigned int* gu_object_stack[];
|
||||
extern int gu_object_stack_depth;
|
||||
extern unsigned int *gu_object_stack[];
|
||||
extern int gu_object_stack_depth;
|
||||
|
||||
extern GuLightSettings light_settings[4];
|
||||
|
||||
void callbackSig(int id, void* arg);
|
||||
void callbackFin(int id, void* arg);
|
||||
void callbackSig(int id, void *arg);
|
||||
void callbackFin(int id, void *arg);
|
||||
void resetValues();
|
||||
|
||||
static __inline__ void sendCommandi(int cmd, int argument)
|
||||
typedef enum GECommand
|
||||
{
|
||||
/* No operation */
|
||||
NOP = 0x0,
|
||||
/* Vertex data */
|
||||
VADDR = 0x1,
|
||||
/* Index data */
|
||||
IADDR = 0x2,
|
||||
/* Draw Primitive */
|
||||
PRIM = 0x4,
|
||||
/* Draw Bezier surface */
|
||||
BEZIER = 0x5,
|
||||
/* Draw Spline surface */
|
||||
SPLINE = 0x6,
|
||||
/* Bounding Box */
|
||||
BOUNDING_BOX = 0x7,
|
||||
/* Jump */
|
||||
JUMP = 0x8,
|
||||
/* Conditional Jump */
|
||||
BJUMP = 0x9,
|
||||
/* List Call */
|
||||
CALL = 0xa,
|
||||
/* List Return */
|
||||
RET = 0xb,
|
||||
/* End reading */
|
||||
END = 0xc,
|
||||
/* Signal interrupt */
|
||||
SIGNAL = 0xe,
|
||||
/* Finish drawing */
|
||||
FINISH = 0xf,
|
||||
/* Address base */
|
||||
BASE = 0x10,
|
||||
/* Vertex type */
|
||||
VERTEX_TYPE = 0x12,
|
||||
/* Offset address */
|
||||
OFFSET_ADDR = 0x13,
|
||||
/* Origin address */
|
||||
ORIGIN = 0x14,
|
||||
/* Drawing region 1, origin */
|
||||
REGION1 = 0x15,
|
||||
/* Drawing region 2, end */
|
||||
REGION2 = 0x16,
|
||||
|
||||
/* Lighting enable */
|
||||
LIGHTING_ENABLE = 0x17,
|
||||
/* Light 0 enable */
|
||||
LIGHT_ENABLE0 = 0x18,
|
||||
/* Light 1 enable */
|
||||
LIGHT_ENABLE1 = 0x19,
|
||||
/* Light 2 enable */
|
||||
LIGHT_ENABLE2 = 0x1a,
|
||||
/* Light 3 enable */
|
||||
LIGHT_ENABLE3 = 0x1b,
|
||||
/* Clipping enable */
|
||||
DEPTH_CLIP_ENABLE = 0x1c,
|
||||
/* Culling enable */
|
||||
CULL_FACE_ENABLE = 0x1d,
|
||||
/* Texture mapping enable */
|
||||
TEXTURE_ENABLE = 0x1e,
|
||||
/* Fog enable */
|
||||
FOG_ENABLE = 0x1f,
|
||||
/* Dithering enable */
|
||||
DITHER_ENABLE = 0x20,
|
||||
/* Alpha blending enable */
|
||||
ALPHA_BLEND_ENABLE = 0x21,
|
||||
/* Alpha testing enable */
|
||||
ALPHA_TEST_ENABLE = 0x22,
|
||||
/* Z testing enable */
|
||||
Z_TEST_ENABLE = 0x23,
|
||||
/* Stencil testing enable */
|
||||
STENCIL_TEST_ENABLE = 0x24,
|
||||
/* Anti-aliasing enable */
|
||||
ANTI_ALIAS_ENABLE = 0x25,
|
||||
/* Patch culling enable */
|
||||
PATCH_CULL_ENABLE = 0x26,
|
||||
/* Color testing enable */
|
||||
COLOR_TEST_ENABLE = 0x27,
|
||||
/* Logical operation enable */
|
||||
LOGIC_OP_ENABLE = 0x28,
|
||||
|
||||
/* Bone matrix number */
|
||||
BONE_MATRIX_NUMBER = 0x2a,
|
||||
/* Bone matrix data */
|
||||
BONE_MATRIX_DATA = 0x2b,
|
||||
/* Morph weight 0 */
|
||||
MORPH_WEIGHT0 = 0x2c,
|
||||
/* Morph weight 1 */
|
||||
MORPH_WEIGHT1 = 0x2d,
|
||||
/* Morph weight 2 */
|
||||
MORPH_WEIGHT2 = 0x2e,
|
||||
/* Morph weight 3 */
|
||||
MORPH_WEIGHT3 = 0x2f,
|
||||
/* Morph weight 4 */
|
||||
MORPH_WEIGHT4 = 0x30,
|
||||
/* Morph weight 5 */
|
||||
MORPH_WEIGHT5 = 0x31,
|
||||
/* Morph weight 6 */
|
||||
MORPH_WEIGHT6 = 0x32,
|
||||
/* Morph weight 7 */
|
||||
MORPH_WEIGHT7 = 0x33,
|
||||
|
||||
/* Patch division count */
|
||||
PATCH_DIVISION = 0x36,
|
||||
/* Patch primitive type */
|
||||
PATCH_PRIMITIVE = 0x37,
|
||||
/* Patch facing */
|
||||
PATCH_FACING = 0x38,
|
||||
/* World matrix number */
|
||||
WORLD_MATRIX_NUMBER = 0x3a,
|
||||
/* World matrix data */
|
||||
WORLD_MATRIX_DATA = 0x3b,
|
||||
/* View matrix number */
|
||||
VIEW_MATRIX_NUMBER = 0x3c,
|
||||
/* View matrix data */
|
||||
VIEW_MATRIX_DATA = 0x3d,
|
||||
/* Projection matrix number */
|
||||
PROJ_MATRIX_NUMBER = 0x3e,
|
||||
/* Projection matrix data */
|
||||
PROJ_MATRIX_DATA = 0x3f,
|
||||
/* Texture generation matrix number */
|
||||
TGEN_MATRIX_NUMBER = 0x40,
|
||||
/* Texture generation matrix data */
|
||||
TGEN_MATRIX_DATA = 0x41,
|
||||
|
||||
/* Viewport X scale */
|
||||
VIEWPORT_X_SCALE = 0x42,
|
||||
/* Viewport Y scale */
|
||||
VIEWPORT_Y_SCALE = 0x43,
|
||||
/* Viewport Z scale */
|
||||
VIEWPORT_Z_SCALE = 0x44,
|
||||
/* Viewport X center */
|
||||
VIEWPORT_X_CENTER = 0x45,
|
||||
/* Viewport Y center */
|
||||
VIEWPORT_Y_CENTER = 0x46,
|
||||
/* Viewport Z center */
|
||||
VIEWPORT_Z_CENTER = 0x47,
|
||||
/* Texture scale U */
|
||||
TEX_SCALE_U = 0x48,
|
||||
/* Texture scale V */
|
||||
TEX_SCALE_V = 0x49,
|
||||
/* Texture offset U */
|
||||
TEX_OFFSET_U = 0x4a,
|
||||
/* Texture offset V */
|
||||
TEX_OFFSET_V = 0x4b,
|
||||
/* Screen Offset X */
|
||||
OFFSET_X = 0x4c,
|
||||
/* Screen Offset Y */
|
||||
OFFSET_Y = 0x4d,
|
||||
|
||||
/* Shade mode */
|
||||
SHADE_MODE = 0x50,
|
||||
/* Normal reverse */
|
||||
NORMAL_REVERSE = 0x51,
|
||||
/* Material color */
|
||||
MATERIAL_COLOR = 0x53,
|
||||
/* Material emissive */
|
||||
MATERIAL_EMISSIVE = 0x54,
|
||||
/* Ambient color */
|
||||
AMBIENT_COLOR = 0x55,
|
||||
/* Material diffuse */
|
||||
MATERIAL_DIFFUSE = 0x56,
|
||||
/* Material specular */
|
||||
MATERIAL_SPECULAR = 0x57,
|
||||
/* Ambient alpha */
|
||||
AMBIENT_ALPHA = 0x58,
|
||||
/* Material specular coefficient */
|
||||
MATERIAL_SPECULAR_COEF = 0x5b,
|
||||
/* Ambient light color */
|
||||
AMBIENT_LIGHT_COLOR = 0x5c,
|
||||
/* Ambient light alpha */
|
||||
AMBIENT_LIGHT_ALPHA = 0x5d,
|
||||
/* Light mode */
|
||||
LIGHT_MODE = 0x5e,
|
||||
|
||||
/* Light type 0 */
|
||||
LIGHT_TYPE0 = 0x5f,
|
||||
/* Light type 1 */
|
||||
LIGHT_TYPE1 = 0x60,
|
||||
/* Light type 2 */
|
||||
LIGHT_TYPE2 = 0x61,
|
||||
/* Light type 3 */
|
||||
LIGHT_TYPE3 = 0x62,
|
||||
/* Light 0 X */
|
||||
LIGHT0_X = 0x63,
|
||||
/* Light 0 Y */
|
||||
LIGHT0_Y = 0x64,
|
||||
/* Light 0 Z */
|
||||
LIGHT0_Z = 0x65,
|
||||
/* Light 1 X */
|
||||
LIGHT1_X = 0x66,
|
||||
/* Light 1 Y */
|
||||
LIGHT1_Y = 0x67,
|
||||
/* Light 1 Z */
|
||||
LIGHT1_Z = 0x68,
|
||||
/* Light 2 X */
|
||||
LIGHT2_X = 0x69,
|
||||
/* Light 2 Y */
|
||||
LIGHT2_Y = 0x6a,
|
||||
/* Light 2 Z */
|
||||
LIGHT2_Z = 0x6b,
|
||||
/* Light 3 X */
|
||||
LIGHT3_X = 0x6c,
|
||||
/* Light 3 Y */
|
||||
LIGHT3_Y = 0x6d,
|
||||
/* Light 3 Z */
|
||||
LIGHT3_Z = 0x6e,
|
||||
|
||||
/* Light 0 direction X */
|
||||
LIGHT0_DIRECTION_X = 0x6f,
|
||||
/* Light 0 direction Y */
|
||||
LIGHT0_DIRECTION_Y = 0x70,
|
||||
/* Light 0 direction Z */
|
||||
LIGHT0_DIRECTION_Z = 0x71,
|
||||
/* Light 1 direction X */
|
||||
LIGHT1_DIRECTION_X = 0x72,
|
||||
/* Light 1 direction Y */
|
||||
LIGHT1_DIRECTION_Y = 0x73,
|
||||
/* Light 1 direction Z */
|
||||
LIGHT1_DIRECTION_Z = 0x74,
|
||||
/* Light 2 direction X */
|
||||
LIGHT2_DIRECTION_X = 0x75,
|
||||
/* Light 2 direction Y */
|
||||
LIGHT2_DIRECTION_Y = 0x76,
|
||||
/* Light 2 direction Z */
|
||||
LIGHT2_DIRECTION_Z = 0x77,
|
||||
/* Light 3 direction X */
|
||||
LIGHT3_DIRECTION_X = 0x78,
|
||||
/* Light 3 direction Y */
|
||||
LIGHT3_DIRECTION_Y = 0x79,
|
||||
/* Light 3 direction Z */
|
||||
LIGHT3_DIRECTION_Z = 0x7a,
|
||||
|
||||
/* Light 0 constant attenuation */
|
||||
LIGHT0_CONSTANT_ATTEN = 0x7b,
|
||||
/* Light 0 linear attenuation */
|
||||
LIGHT0_LINEAR_ATTEN = 0x7c,
|
||||
/* Light 0 quadratic attenuation */
|
||||
LIGHT0_QUADRATIC_ATTEN = 0x7d,
|
||||
/* Light 1 constant attenuation */
|
||||
LIGHT1_CONSTANT_ATTEN = 0x7e,
|
||||
/* Light 1 linear attenuation */
|
||||
LIGHT1_LINEAR_ATTEN = 0x7f,
|
||||
/* Light 1 quadratic attenuation */
|
||||
LIGHT1_QUADRATIC_ATTEN = 0x80,
|
||||
/* Light 2 constant attenuation */
|
||||
LIGHT2_CONSTANT_ATTEN = 0x81,
|
||||
/* Light 2 linear attenuation */
|
||||
LIGHT2_LINEAR_ATTEN = 0x82,
|
||||
/* Light 2 quadratic attenuation */
|
||||
LIGHT2_QUADRATIC_ATTEN = 0x83,
|
||||
/* Light 3 constant attenuation */
|
||||
LIGHT3_CONSTANT_ATTEN = 0x84,
|
||||
/* Light 3 linear attenuation */
|
||||
LIGHT3_LINEAR_ATTEN = 0x85,
|
||||
/* Light 3 quadratic attenuation */
|
||||
LIGHT3_QUADRATIC_ATTEN = 0x86,
|
||||
|
||||
/* Light 0 exponent attenuation */
|
||||
LIGHT0_EXPONENT_ATTEN = 0x87,
|
||||
/* Light 1 exponent attenuation */
|
||||
LIGHT1_EXPONENT_ATTEN = 0x88,
|
||||
/* Light 2 exponent attenuation */
|
||||
LIGHT2_EXPONENT_ATTEN = 0x89,
|
||||
/* Light 3 exponent attenuation */
|
||||
LIGHT3_EXPONENT_ATTEN = 0x8a,
|
||||
|
||||
/* Light 0 cutoff attenuation */
|
||||
LIGHT0_CUTOFF_ATTEN = 0x8b,
|
||||
/* Light 1 cutoff attenuation */
|
||||
LIGHT1_CUTOFF_ATTEN = 0x8c,
|
||||
/* Light 2 cutoff attenuation */
|
||||
LIGHT2_CUTOFF_ATTEN = 0x8d,
|
||||
/* Light 3 cutoff attenuation */
|
||||
LIGHT3_CUTOFF_ATTEN = 0x8e,
|
||||
|
||||
/* Light 0 ambient */
|
||||
LIGHT0_AMBIENT = 0x8f,
|
||||
/* Light 0 diffuse */
|
||||
LIGHT0_DIFFUSE = 0x90,
|
||||
/* Light 0 specular */
|
||||
LIGHT0_SPECULAR = 0x91,
|
||||
/* Light 1 ambient */
|
||||
LIGHT1_AMBIENT = 0x92,
|
||||
/* Light 1 diffuse */
|
||||
LIGHT1_DIFFUSE = 0x93,
|
||||
/* Light 1 specular */
|
||||
LIGHT1_SPECULAR = 0x94,
|
||||
/* Light 2 ambient */
|
||||
LIGHT2_AMBIENT = 0x95,
|
||||
/* Light 2 diffuse */
|
||||
LIGHT2_DIFFUSE = 0x96,
|
||||
/* Light 2 specular */
|
||||
LIGHT2_SPECULAR = 0x97,
|
||||
/* Light 3 ambient */
|
||||
LIGHT3_AMBIENT = 0x98,
|
||||
/* Light 3 diffuse */
|
||||
LIGHT3_DIFFUSE = 0x99,
|
||||
/* Light 3 specular */
|
||||
LIGHT3_SPECULAR = 0x9a,
|
||||
|
||||
/* Culling */
|
||||
CULL = 0x9b,
|
||||
|
||||
/* Frame buffer pointer */
|
||||
FRAME_BUF_PTR = 0x9c,
|
||||
/* Frame buffer width */
|
||||
FRAME_BUF_WIDTH = 0x9d,
|
||||
/* Z buffer pointer */
|
||||
Z_BUF_PTR = 0x9e,
|
||||
/* Z buffer width */
|
||||
Z_BUF_WIDTH = 0x9f,
|
||||
|
||||
/* Texture address 0 */
|
||||
TEX_ADDR0 = 0xa0,
|
||||
/* Texture address 1 */
|
||||
TEX_ADDR1 = 0xa1,
|
||||
/* Texture address 2 */
|
||||
TEX_ADDR2 = 0xa2,
|
||||
/* Texture address 3 */
|
||||
TEX_ADDR3 = 0xa3,
|
||||
/* Texture address 4 */
|
||||
TEX_ADDR4 = 0xa4,
|
||||
/* Texture address 5 */
|
||||
TEX_ADDR5 = 0xa5,
|
||||
/* Texture address 6 */
|
||||
TEX_ADDR6 = 0xa6,
|
||||
/* Texture address 7 */
|
||||
TEX_ADDR7 = 0xa7,
|
||||
/* Texture buffer width 0 */
|
||||
TEX_BUF_WIDTH0 = 0xa8,
|
||||
/* Texture buffer width 1 */
|
||||
TEX_BUF_WIDTH1 = 0xa9,
|
||||
/* Texture buffer width 2 */
|
||||
TEX_BUF_WIDTH2 = 0xaa,
|
||||
/* Texture buffer width 3 */
|
||||
TEX_BUF_WIDTH3 = 0xab,
|
||||
/* Texture buffer width 4 */
|
||||
TEX_BUF_WIDTH4 = 0xac,
|
||||
/* Texture buffer width 5 */
|
||||
TEX_BUF_WIDTH5 = 0xad,
|
||||
/* Texture buffer width 6 */
|
||||
TEX_BUF_WIDTH6 = 0xae,
|
||||
/* Texture buffer width 7 */
|
||||
TEX_BUF_WIDTH7 = 0xaf,
|
||||
|
||||
/* CLUT address */
|
||||
CLUT_ADDR = 0xb0,
|
||||
/* CLUT address upper */
|
||||
CLUT_ADDR_UPPER = 0xb1,
|
||||
|
||||
/* Transfer source */
|
||||
TRANSFER_SRC = 0xb2,
|
||||
/* Transfer source width */
|
||||
TRANSFER_SRC_W = 0xb3,
|
||||
/* Transfer destination */
|
||||
TRANSFER_DST = 0xb4,
|
||||
/* Transfer destination width */
|
||||
TRANSFER_DST_W = 0xb5,
|
||||
|
||||
/* Texture size 0 */
|
||||
TEX_SIZE0 = 0xb8,
|
||||
/* Texture size 1 */
|
||||
TEX_SIZE1 = 0xb9,
|
||||
/* Texture size 2 */
|
||||
TEX_SIZE2 = 0xba,
|
||||
/* Texture size 3 */
|
||||
TEX_SIZE3 = 0xbb,
|
||||
/* Texture size 4 */
|
||||
TEX_SIZE4 = 0xbc,
|
||||
/* Texture size 5 */
|
||||
TEX_SIZE5 = 0xbd,
|
||||
/* Texture size 6 */
|
||||
TEX_SIZE6 = 0xbe,
|
||||
/* Texture size 7 */
|
||||
TEX_SIZE7 = 0xbf,
|
||||
|
||||
/* Texture map mode */
|
||||
TEX_MAP_MODE = 0xc0,
|
||||
/* Texture shade mapping */
|
||||
TEX_SHADE_MAPPING = 0xc1,
|
||||
/* Texture mode */
|
||||
TEX_MODE = 0xc2,
|
||||
/* Texture format */
|
||||
TEX_FORMAT = 0xc3,
|
||||
/* Load CLUT */
|
||||
LOAD_CLUT = 0xc4,
|
||||
/* CLUT format */
|
||||
CLUT_FORMAT = 0xc5,
|
||||
/* Texture filter */
|
||||
TEX_FILTER = 0xc6,
|
||||
/* Texture wrap */
|
||||
TEX_WRAP = 0xc7,
|
||||
/* Texture level */
|
||||
TEX_LEVEL = 0xc8,
|
||||
/* Texture function */
|
||||
TEX_FUNC = 0xc9,
|
||||
/* Texture environment color */
|
||||
TEX_ENV_COLOR = 0xca,
|
||||
/* Texture flush */
|
||||
TEX_FLUSH = 0xcb,
|
||||
/* Texture sync */
|
||||
TEX_SYNC = 0xcc,
|
||||
|
||||
/* Fog 1 */
|
||||
FOG1 = 0xcd,
|
||||
/* Fog 2 */
|
||||
FOG2 = 0xce,
|
||||
/* Fog color */
|
||||
FOG_COLOR = 0xcf,
|
||||
/* Texture LOD slope */
|
||||
TEX_LOD_SLOPE = 0xd0,
|
||||
|
||||
/* Frame buffer pixel format */
|
||||
FRAMEBUF_PIX_FORMAT = 0xd2,
|
||||
/* Clear mode */
|
||||
CLEAR_MODE = 0xd3,
|
||||
/* Scissor 1 */
|
||||
SCISSOR1 = 0xd4,
|
||||
/* Scissor 2 */
|
||||
SCISSOR2 = 0xd5,
|
||||
|
||||
/* Minimum Z */
|
||||
MIN_Z = 0xd6,
|
||||
/* Maximum Z */
|
||||
MAX_Z = 0xd7,
|
||||
/* Color test */
|
||||
COLOR_TEST = 0xd8,
|
||||
/* Color reference */
|
||||
COLOR_REF = 0xd9,
|
||||
/* Color test mask */
|
||||
COLOR_TESTMASK = 0xda,
|
||||
/* Alpha test */
|
||||
ALPHA_TEST = 0xdb,
|
||||
/* Stencil test */
|
||||
STENCIL_TEST = 0xdc,
|
||||
/* Stencil operation */
|
||||
STENCIL_OP = 0xdd,
|
||||
/* Z test */
|
||||
Z_TEST = 0xde,
|
||||
/* Blend mode */
|
||||
BLEND_MODE = 0xdf,
|
||||
/* Blend fixed A */
|
||||
BLEND_FIXED_A = 0xe0,
|
||||
/* Blend fixed B */
|
||||
BLEND_FIXED_B = 0xe1,
|
||||
/* Dither 0 */
|
||||
DITH0 = 0xe2,
|
||||
/* Dither 1 */
|
||||
DITH1 = 0xe3,
|
||||
/* Dither 2 */
|
||||
DITH2 = 0xe4,
|
||||
/* Dither 3 */
|
||||
DITH3 = 0xe5,
|
||||
|
||||
/* Logical operation */
|
||||
LOGIC_OP = 0xe6,
|
||||
/* Z mask */
|
||||
Z_MASK = 0xe7,
|
||||
/* Mask color */
|
||||
MASK_COLOR = 0xe8,
|
||||
/* Mask alpha */
|
||||
MASK_ALPHA = 0xe9,
|
||||
|
||||
/* Transfer start */
|
||||
TRANSFER_START = 0xea,
|
||||
/* Transfer source offset */
|
||||
TRANSFER_SRC_OFFSET = 0xeb,
|
||||
/* Transfer destination offset */
|
||||
TRANSFER_DST_OFFSET = 0xec,
|
||||
/* Transfer format */
|
||||
TRANSFER_FORMAT = 0xed,
|
||||
/* Transfer size */
|
||||
TRANSFER_SIZE = 0xee,
|
||||
|
||||
/* Transfer flip */
|
||||
TRANSFER_FLIP = 0xef,
|
||||
/* Transfer out size */
|
||||
TRANSFER_OUT_SIZE = 0xf0,
|
||||
/* Transfer out format */
|
||||
TRANSFER_OUT_FORMAT = 0xf1,
|
||||
/* Vertex weight */
|
||||
VERTEX_WEIGHT = 0xf2,
|
||||
/* Vertex weight address */
|
||||
VERTEX_WEIGHT_ADDR = 0xf3,
|
||||
/* Vertex weight size */
|
||||
VERTEX_WEIGHT_SIZE = 0xf4,
|
||||
/* Vertex weight type */
|
||||
VERTEX_WEIGHT_TYPE = 0xf5,
|
||||
/* Vertex weight model */
|
||||
VERTEX_WEIGHT_MODEL = 0xf6,
|
||||
/* Vertex weight normalize */
|
||||
VERTEX_WEIGHT_NORMALIZE = 0xf7,
|
||||
/* Vertex weight offset */
|
||||
VERTEX_WEIGHT_OFFSET = 0xf8,
|
||||
/* Vertex weight scale */
|
||||
VERTEX_WEIGHT_SCALE = 0xf9,
|
||||
/* Vertex weight matrix */
|
||||
VERTEX_WEIGHT_MATRIX = 0xfa,
|
||||
/* Vertex weight matrix address */
|
||||
VERTEX_WEIGHT_MATRIX_ADDR = 0xfb,
|
||||
/* Vertex weight matrix size */
|
||||
VERTEX_WEIGHT_MATRIX_SIZE = 0xfc,
|
||||
/* Vertex weight matrix type */
|
||||
VERTEX_WEIGHT_MATRIX_TYPE = 0xfd,
|
||||
/* Vertex weight matrix model */
|
||||
VERTEX_WEIGHT_MATRIX_MODEL = 0xfe,
|
||||
/* Vertex weight matrix normalize */
|
||||
VERTEX_WEIGHT_MATRIX_NORMALIZE = 0xff,
|
||||
} GECommand;
|
||||
|
||||
static inline void sendCommandi(GECommand cmd, int argument)
|
||||
{
|
||||
*(gu_list->current++) = (cmd << 24) | (argument & 0xffffff);
|
||||
}
|
||||
|
||||
static __inline__ void sendCommandf(int cmd, float argument)
|
||||
static inline void sendCommandf(GECommand cmd, float argument)
|
||||
{
|
||||
union
|
||||
{
|
||||
@@ -132,15 +642,15 @@ static __inline__ void sendCommandf(int cmd, float argument)
|
||||
} t;
|
||||
t.f = argument;
|
||||
|
||||
sendCommandi(cmd,t.i >> 8);
|
||||
sendCommandi(cmd, t.i >> 8);
|
||||
}
|
||||
|
||||
static __inline__ void sendCommandiStall(int cmd, int argument)
|
||||
static inline void sendCommandiStall(GECommand cmd, int argument)
|
||||
{
|
||||
sendCommandi(cmd,argument);
|
||||
sendCommandi(cmd, argument);
|
||||
|
||||
if (!gu_object_stack_depth && !gu_curr_context)
|
||||
sceGeListUpdateStallAddr(ge_list_executed[0],gu_list->current);
|
||||
sceGeListUpdateStallAddr(ge_list_executed[0], gu_list->current);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -11,5 +11,5 @@
|
||||
void sceGuAlphaFunc(int a0, int a1, int a2)
|
||||
{
|
||||
int arg = a0 | ((a1 & 0xff) << 8) | ((a2 & 0xff) << 16);
|
||||
sendCommandi(219,arg);
|
||||
sendCommandi(ALPHA_TEST, arg);
|
||||
}
|
||||
|
||||
@@ -10,6 +10,6 @@
|
||||
|
||||
void sceGuAmbient(unsigned int color)
|
||||
{
|
||||
sendCommandi(92,(color & 0xffffff));
|
||||
sendCommandi(93,(color >> 24));
|
||||
sendCommandi(AMBIENT_LIGHT_COLOR,(color & 0xffffff));
|
||||
sendCommandi(AMBIENT_LIGHT_ALPHA,(color >> 24));
|
||||
}
|
||||
|
||||
@@ -10,6 +10,6 @@
|
||||
|
||||
void sceGuAmbientColor(unsigned int color)
|
||||
{
|
||||
sendCommandi(85,color & 0xffffff);
|
||||
sendCommandi(88,color >> 24);
|
||||
sendCommandi(AMBIENT_COLOR, color & 0xffffff);
|
||||
sendCommandi(AMBIENT_ALPHA, color >> 24);
|
||||
}
|
||||
|
||||
@@ -8,30 +8,30 @@
|
||||
|
||||
#include "guInternal.h"
|
||||
|
||||
void sceGuBeginObject(int vertex_type, int a1, const void* indices, const void* vertices)
|
||||
void sceGuBeginObject(int vertex_type, int a1, const void *indices, const void *vertices)
|
||||
{
|
||||
if (vertex_type)
|
||||
sendCommandi(18,vertex_type);
|
||||
sendCommandi(VERTEX_TYPE, vertex_type);
|
||||
|
||||
if (indices)
|
||||
{
|
||||
sendCommandi(16,(((unsigned int)indices) >> 8) & 0xf0000);
|
||||
sendCommandi(2,((unsigned int)indices) & 0xffffff);
|
||||
sendCommandi(BASE, (((unsigned int)indices) >> 8) & 0xf0000);
|
||||
sendCommandi(IADDR, ((unsigned int)indices) & 0xffffff);
|
||||
}
|
||||
|
||||
if (vertices)
|
||||
{
|
||||
sendCommandi(16,(((unsigned int)vertices) >> 8) & 0x0f0000);
|
||||
sendCommandi(1,((unsigned int)vertices) & 0xffffff);
|
||||
sendCommandi(BASE, (((unsigned int)vertices) >> 8) & 0x0f0000);
|
||||
sendCommandi(VADDR, ((unsigned int)vertices) & 0xffffff);
|
||||
}
|
||||
|
||||
sendCommandi(7,a1);
|
||||
sendCommandi(BOUNDING_BOX, a1);
|
||||
|
||||
// store start to new object
|
||||
|
||||
gu_object_stack[gu_object_stack_depth++] = gu_list->current;
|
||||
|
||||
// dummy commands, overwritten in sceGuEndObject()
|
||||
sendCommandi(16,0);
|
||||
sendCommandi(9,0);
|
||||
sendCommandi(BASE, 0);
|
||||
sendCommandi(BJUMP, 0);
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
void sceGuBlendFunc(int op, int src, int dest, unsigned int srcfix, unsigned int destfix)
|
||||
{
|
||||
sendCommandi(223,src | (dest << 4) | (op << 8));
|
||||
sendCommandi(224,srcfix & 0xffffff);
|
||||
sendCommandi(225,destfix & 0xffffff);
|
||||
sendCommandi(BLEND_MODE, src | (dest << 4) | (op << 8));
|
||||
sendCommandi(BLEND_FIXED_A, srcfix & 0xffffff);
|
||||
sendCommandi(BLEND_FIXED_B, destfix & 0xffffff);
|
||||
}
|
||||
|
||||
@@ -8,18 +8,18 @@
|
||||
|
||||
#include "guInternal.h"
|
||||
|
||||
void sceGuBoneMatrix(unsigned int index, const ScePspFMatrix4* matrix)
|
||||
void sceGuBoneMatrix(unsigned int index, const ScePspFMatrix4 *matrix)
|
||||
{
|
||||
unsigned int offset = ((index << 1)+index) << 2; // 3*4 matrix
|
||||
unsigned int i,j;
|
||||
const float* fmatrix = (const float*)matrix;
|
||||
unsigned int offset = ((index << 1) + index) << 2; // 3*4 matrix
|
||||
unsigned int i, j;
|
||||
const float *fmatrix = (const float *)matrix;
|
||||
|
||||
sendCommandi(42,offset);
|
||||
sendCommandi(BONE_MATRIX_NUMBER, offset);
|
||||
for (i = 0; i < 4; ++i)
|
||||
{
|
||||
for (j = 0; j < 3; ++j)
|
||||
{
|
||||
sendCommandf(43,fmatrix[j+(i << 2)]);
|
||||
sendCommandf(BONE_MATRIX_DATA, fmatrix[j + (i << 2)]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,19 +8,19 @@
|
||||
|
||||
#include "guInternal.h"
|
||||
|
||||
void sceGuCallList(const void* list)
|
||||
void sceGuCallList(const void *list)
|
||||
{
|
||||
unsigned int list_addr = (unsigned int)list;
|
||||
|
||||
if (gu_call_mode == 1)
|
||||
{
|
||||
sendCommandi(14,(list_addr >> 16) | 0x110000);
|
||||
sendCommandi(12,list_addr & 0xffff);
|
||||
sendCommandiStall(0,0);
|
||||
sendCommandi(SIGNAL, (list_addr >> 16) | 0x110000);
|
||||
sendCommandi(END, list_addr & 0xffff);
|
||||
sendCommandiStall(NOP, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
sendCommandi(16,(list_addr >> 8) & 0xf0000);
|
||||
sendCommandiStall(10,list_addr & 0xffffff);
|
||||
sendCommandi(BASE, (list_addr >> 8) & 0xf0000);
|
||||
sendCommandiStall(CALL, list_addr & 0xffffff);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,30 +10,40 @@
|
||||
|
||||
void sceGuClear(int flags)
|
||||
{
|
||||
GuContext* context = &gu_contexts[gu_curr_context];
|
||||
GuContext *context = &gu_contexts[gu_curr_context];
|
||||
unsigned int filter;
|
||||
struct Vertex
|
||||
{
|
||||
u32 color;
|
||||
u16 x,y,z;
|
||||
u16 x, y, z;
|
||||
u16 pad;
|
||||
};
|
||||
|
||||
switch (gu_draw_buffer.pixel_size)
|
||||
{
|
||||
case 0: filter = context->clear_color & 0xffffff; break;
|
||||
case 1: filter = (context->clear_color & 0xffffff) | (context->clear_stencil << 31); break;
|
||||
case 2: filter = (context->clear_color & 0xffffff) | (context->clear_stencil << 28); break;
|
||||
case 3: filter = (context->clear_color & 0xffffff) | (context->clear_stencil << 24); break;
|
||||
default: filter = 0; break;
|
||||
case 0:
|
||||
filter = context->clear_color & 0xffffff;
|
||||
break;
|
||||
case 1:
|
||||
filter = (context->clear_color & 0xffffff) | (context->clear_stencil << 31);
|
||||
break;
|
||||
case 2:
|
||||
filter = (context->clear_color & 0xffffff) | (context->clear_stencil << 28);
|
||||
break;
|
||||
case 3:
|
||||
filter = (context->clear_color & 0xffffff) | (context->clear_stencil << 24);
|
||||
break;
|
||||
default:
|
||||
filter = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
struct Vertex* vertices;
|
||||
struct Vertex *vertices;
|
||||
int count;
|
||||
|
||||
if (!(flags & GU_FAST_CLEAR_BIT))
|
||||
{
|
||||
vertices = (struct Vertex*)sceGuGetMemory(2 * sizeof(struct Vertex));
|
||||
vertices = (struct Vertex *)sceGuGetMemory(2 * sizeof(struct Vertex));
|
||||
count = 2;
|
||||
|
||||
vertices[0].color = 0;
|
||||
@@ -48,27 +58,27 @@ void sceGuClear(int flags)
|
||||
}
|
||||
else
|
||||
{
|
||||
struct Vertex* curr;
|
||||
struct Vertex *curr;
|
||||
unsigned int i;
|
||||
count = ((gu_draw_buffer.width+63)/64)*2;
|
||||
vertices = (struct Vertex*)sceGuGetMemory(count * sizeof(struct Vertex));
|
||||
count = ((gu_draw_buffer.width + 63) / 64) * 2;
|
||||
vertices = (struct Vertex *)sceGuGetMemory(count * sizeof(struct Vertex));
|
||||
curr = vertices;
|
||||
|
||||
for (i = 0; i < count; ++i, ++curr)
|
||||
{
|
||||
unsigned int j,k;
|
||||
unsigned int j, k;
|
||||
|
||||
j = i >> 1;
|
||||
k = (i & 1);
|
||||
|
||||
curr->color = filter;
|
||||
curr->x = (j+k) * 64;
|
||||
curr->x = (j + k) * 64;
|
||||
curr->y = k * gu_draw_buffer.height;
|
||||
curr->z = context->clear_depth;
|
||||
}
|
||||
}
|
||||
|
||||
sendCommandi(211,((flags & (GU_COLOR_BUFFER_BIT|GU_STENCIL_BUFFER_BIT|GU_DEPTH_BUFFER_BIT)) << 8) | 0x01);
|
||||
sceGuDrawArray(GU_SPRITES,GU_COLOR_8888|GU_VERTEX_16BIT|GU_TRANSFORM_2D,count,0,vertices);
|
||||
sendCommandi(211,0);
|
||||
sendCommandi(CLEAR_MODE, ((flags & (GU_COLOR_BUFFER_BIT | GU_STENCIL_BUFFER_BIT | GU_DEPTH_BUFFER_BIT)) << 8) | 0x01);
|
||||
sceGuDrawArray(GU_SPRITES, GU_COLOR_8888 | GU_VERTEX_16BIT | GU_TRANSFORM_2D, count, 0, vertices);
|
||||
sendCommandi(CLEAR_MODE, 0);
|
||||
}
|
||||
|
||||
@@ -8,9 +8,9 @@
|
||||
|
||||
#include "guInternal.h"
|
||||
|
||||
void sceGuClutLoad(int num_blocks, const void* cbp)
|
||||
void sceGuClutLoad(int num_blocks, const void *cbp)
|
||||
{
|
||||
sendCommandi(176,((unsigned int)cbp) & 0xffffff);
|
||||
sendCommandi(177,(((unsigned int)cbp) >> 8) & 0xf0000);
|
||||
sendCommandi(196,num_blocks);
|
||||
sendCommandi(CLUT_ADDR, ((unsigned int)cbp) & 0xffffff);
|
||||
sendCommandi(CLUT_ADDR_UPPER, (((unsigned int)cbp) >> 8) & 0xf0000);
|
||||
sendCommandi(LOAD_CLUT, num_blocks);
|
||||
}
|
||||
|
||||
@@ -11,5 +11,5 @@
|
||||
void sceGuClutMode(unsigned int cpsm, unsigned int shift, unsigned int mask, unsigned int a3)
|
||||
{
|
||||
unsigned int argument = (cpsm) | (shift << 2) | (mask << 8) | (a3 << 16);
|
||||
sendCommandi(197,argument);
|
||||
sendCommandi(CLUT_FORMAT, argument);
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
void sceGuColorFunc(int func, unsigned int color, unsigned int mask)
|
||||
{
|
||||
sendCommandi(216,func & 0x03);
|
||||
sendCommandi(217,color & 0xffffff);
|
||||
sendCommandi(218,mask);
|
||||
sendCommandi(COLOR_TEST, func & 0x03);
|
||||
sendCommandi(COLOR_REF, color & 0xffffff);
|
||||
sendCommandi(COLOR_TESTMASK, mask);
|
||||
}
|
||||
|
||||
@@ -10,5 +10,5 @@
|
||||
|
||||
void sceGuColorMaterial(int a0)
|
||||
{
|
||||
sendCommandi(83,a0);
|
||||
sendCommandi(MATERIAL_COLOR, a0);
|
||||
}
|
||||
|
||||
@@ -8,14 +8,14 @@
|
||||
|
||||
#include "guInternal.h"
|
||||
|
||||
void sceGuCopyImage(int psm, int sx, int sy, int width, int height, int srcw, void* src, int dx, int dy, int destw, void* dest)
|
||||
void sceGuCopyImage(int psm, int sx, int sy, int width, int height, int srcw, void *src, int dx, int dy, int destw, void *dest)
|
||||
{
|
||||
sendCommandi(178,((unsigned int)src) & 0xffffff);
|
||||
sendCommandi(179,((((unsigned int)src) & 0xff000000) >> 8)|srcw);
|
||||
sendCommandi(235,(sy << 10)|sx);
|
||||
sendCommandi(180,((unsigned int)dest) & 0xffffff);
|
||||
sendCommandi(181,((((unsigned int)dest) & 0xff000000) >> 8)|destw);
|
||||
sendCommandi(236,(dy << 10)|dx);
|
||||
sendCommandi(238,((height-1) << 10)|(width-1));
|
||||
sendCommandi(234,(psm ^ 0x03) ? 0 : 1);
|
||||
sendCommandi(TRANSFER_SRC, ((unsigned int)src) & 0xffffff);
|
||||
sendCommandi(TRANSFER_SRC_W, ((((unsigned int)src) & 0xff000000) >> 8) | srcw);
|
||||
sendCommandi(TRANSFER_SRC_OFFSET, (sy << 10) | sx);
|
||||
sendCommandi(TRANSFER_DST, ((unsigned int)dest) & 0xffffff);
|
||||
sendCommandi(TRANSFER_DST_W, ((((unsigned int)dest) & 0xff000000) >> 8) | destw);
|
||||
sendCommandi(TRANSFER_DST_OFFSET, (dy << 10) | dx);
|
||||
sendCommandi(TRANSFER_SIZE, ((height - 1) << 10) | (width - 1));
|
||||
sendCommandi(TRANSFER_START, (psm ^ 0x03) ? 0 : 1);
|
||||
}
|
||||
|
||||
@@ -8,13 +8,13 @@
|
||||
|
||||
#include "guInternal.h"
|
||||
|
||||
void sceGuDepthBuffer(void* zbp, int zbw)
|
||||
void sceGuDepthBuffer(void *zbp, int zbw)
|
||||
{
|
||||
gu_draw_buffer.depth_buffer = zbp;
|
||||
|
||||
if (!gu_draw_buffer.depth_width || (gu_draw_buffer.depth_width != zbw))
|
||||
gu_draw_buffer.depth_width = zbw;
|
||||
|
||||
sendCommandi(158,((unsigned int)zbp) & 0xffffff);
|
||||
sendCommandi(159,((((unsigned int)zbp) & 0xff000000) >> 8)|zbw);
|
||||
sendCommandi(Z_BUF_PTR, ((unsigned int)zbp) & 0xffffff);
|
||||
sendCommandi(Z_BUF_WIDTH, ((((unsigned int)zbp) & 0xff000000) >> 8) | zbw);
|
||||
}
|
||||
|
||||
@@ -10,5 +10,5 @@
|
||||
|
||||
void sceGuDepthFunc(int function)
|
||||
{
|
||||
sendCommandi(222,function);
|
||||
sendCommandi(Z_TEST, function);
|
||||
}
|
||||
|
||||
@@ -10,5 +10,5 @@
|
||||
|
||||
void sceGuDepthMask(int mask)
|
||||
{
|
||||
sendCommandi(231,mask);
|
||||
sendCommandi(Z_MASK, mask);
|
||||
}
|
||||
|
||||
@@ -10,25 +10,25 @@
|
||||
|
||||
void sceGuDepthRange(int near, int far)
|
||||
{
|
||||
GuContext* context = &gu_contexts[gu_curr_context];
|
||||
GuContext *context = &gu_contexts[gu_curr_context];
|
||||
|
||||
unsigned int max = (unsigned int)near + (unsigned int)far;
|
||||
int val = (int)((max >> 31) + max);
|
||||
float z = (float)(val >> 1);
|
||||
unsigned int max = (unsigned int)near + (unsigned int)far;
|
||||
int val = (int)((max >> 31) + max);
|
||||
float z = (float)(val >> 1);
|
||||
|
||||
context->near_plane = near;
|
||||
context->near_plane = near;
|
||||
context->far_plane = far;
|
||||
|
||||
sendCommandf(68,z - ((float)near));
|
||||
sendCommandf(71,z + ((float)context->depth_offset));
|
||||
sendCommandf(VIEWPORT_Z_SCALE, z - ((float)near));
|
||||
sendCommandf(VIEWPORT_Z_CENTER, z + ((float)context->depth_offset));
|
||||
|
||||
if (near > far)
|
||||
if (near > far)
|
||||
{
|
||||
int temp = near;
|
||||
near = far;
|
||||
far = temp;
|
||||
int temp = near;
|
||||
near = far;
|
||||
far = temp;
|
||||
}
|
||||
|
||||
sendCommandi(214,near);
|
||||
sendCommandi(215,far);
|
||||
sendCommandi(MIN_Z, near);
|
||||
sendCommandi(MAX_Z, far);
|
||||
}
|
||||
|
||||
@@ -10,43 +10,83 @@
|
||||
|
||||
void sceGuDisable(int state)
|
||||
{
|
||||
switch(state)
|
||||
switch (state)
|
||||
{
|
||||
case GU_ALPHA_TEST: sendCommandi(34,0); break;
|
||||
case GU_DEPTH_TEST: sendCommandi(35,0); break;
|
||||
case GU_SCISSOR_TEST:
|
||||
{
|
||||
GuContext* context = &gu_contexts[gu_curr_context];
|
||||
context->scissor_enable = 0;
|
||||
sendCommandi(212,0);
|
||||
sendCommandi(213,((gu_draw_buffer.height-1) << 10)|(gu_draw_buffer.width-1));
|
||||
}
|
||||
case GU_ALPHA_TEST:
|
||||
sendCommandi(ALPHA_TEST_ENABLE, 0);
|
||||
break;
|
||||
case GU_STENCIL_TEST: sendCommandi(36,0); break;
|
||||
case GU_BLEND: sendCommandi(33,0); break;
|
||||
case GU_CULL_FACE: sendCommandi(29,0); break;
|
||||
case GU_DITHER: sendCommandi(32,0); break;
|
||||
case GU_FOG: sendCommandi(31,0); break;
|
||||
case GU_CLIP_PLANES: sendCommandi(28,0); break;
|
||||
case GU_TEXTURE_2D: sendCommandi(30,0); break;
|
||||
case GU_LIGHTING: sendCommandi(23,0); break;
|
||||
case GU_LIGHT0: sendCommandi(24,0); break;
|
||||
case GU_LIGHT1: sendCommandi(25,0); break;
|
||||
case GU_LIGHT2: sendCommandi(26,0); break;
|
||||
case GU_LIGHT3: sendCommandi(27,0); break;
|
||||
case GU_LINE_SMOOTH: sendCommandi(37,0); break;
|
||||
case GU_PATCH_CULL_FACE:sendCommandi(38,0); break;
|
||||
case GU_COLOR_TEST: sendCommandi(39,0); break;
|
||||
case GU_COLOR_LOGIC_OP: sendCommandi(40,0); break;
|
||||
case GU_FACE_NORMAL_REVERSE:sendCommandi(81,0); break;
|
||||
case GU_PATCH_FACE: sendCommandi(56,0); break;
|
||||
case GU_FRAGMENT_2X:
|
||||
{
|
||||
GuContext* context = &gu_contexts[gu_curr_context];
|
||||
context->fragment_2x = 0;
|
||||
sendCommandi(201,context->texture_function);
|
||||
}
|
||||
case GU_DEPTH_TEST:
|
||||
sendCommandi(Z_TEST_ENABLE, 0);
|
||||
break;
|
||||
case GU_SCISSOR_TEST:
|
||||
{
|
||||
GuContext *context = &gu_contexts[gu_curr_context];
|
||||
context->scissor_enable = 0;
|
||||
sendCommandi(SCISSOR1, 0);
|
||||
sendCommandi(SCISSOR2, ((gu_draw_buffer.height - 1) << 10) | (gu_draw_buffer.width - 1));
|
||||
}
|
||||
break;
|
||||
case GU_STENCIL_TEST:
|
||||
sendCommandi(STENCIL_TEST_ENABLE, 0);
|
||||
break;
|
||||
case GU_BLEND:
|
||||
sendCommandi(ALPHA_BLEND_ENABLE, 0);
|
||||
break;
|
||||
case GU_CULL_FACE:
|
||||
sendCommandi(CULL_FACE_ENABLE, 0);
|
||||
break;
|
||||
case GU_DITHER:
|
||||
sendCommandi(DITHER_ENABLE, 0);
|
||||
break;
|
||||
case GU_FOG:
|
||||
sendCommandi(FOG_ENABLE, 0);
|
||||
break;
|
||||
case GU_CLIP_PLANES:
|
||||
sendCommandi(DEPTH_CLIP_ENABLE, 0);
|
||||
break;
|
||||
case GU_TEXTURE_2D:
|
||||
sendCommandi(TEXTURE_ENABLE, 0);
|
||||
break;
|
||||
case GU_LIGHTING:
|
||||
sendCommandi(LIGHTING_ENABLE, 0);
|
||||
break;
|
||||
case GU_LIGHT0:
|
||||
sendCommandi(LIGHT_ENABLE0, 0);
|
||||
break;
|
||||
case GU_LIGHT1:
|
||||
sendCommandi(LIGHT_ENABLE1, 0);
|
||||
break;
|
||||
case GU_LIGHT2:
|
||||
sendCommandi(LIGHT_ENABLE2, 0);
|
||||
break;
|
||||
case GU_LIGHT3:
|
||||
sendCommandi(LIGHT_ENABLE3, 0);
|
||||
break;
|
||||
case GU_LINE_SMOOTH:
|
||||
sendCommandi(ANTI_ALIAS_ENABLE, 0);
|
||||
break;
|
||||
case GU_PATCH_CULL_FACE:
|
||||
sendCommandi(PATCH_CULL_ENABLE, 0);
|
||||
break;
|
||||
case GU_COLOR_TEST:
|
||||
sendCommandi(COLOR_TEST_ENABLE, 0);
|
||||
break;
|
||||
case GU_COLOR_LOGIC_OP:
|
||||
sendCommandi(LOGIC_OP_ENABLE, 0);
|
||||
break;
|
||||
case GU_FACE_NORMAL_REVERSE:
|
||||
sendCommandi(NORMAL_REVERSE, 0);
|
||||
break;
|
||||
case GU_PATCH_FACE:
|
||||
sendCommandi(PATCH_FACING, 0);
|
||||
break;
|
||||
case GU_FRAGMENT_2X:
|
||||
{
|
||||
GuContext *context = &gu_contexts[gu_curr_context];
|
||||
context->fragment_2x = 0;
|
||||
sendCommandi(TEX_FUNC, context->texture_function);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (state < 22)
|
||||
|
||||
@@ -13,11 +13,11 @@
|
||||
|
||||
void drawRegion(int x, int y, int width, int height)
|
||||
{
|
||||
sendCommandi(21,(y << 10) | x);
|
||||
sendCommandi(22,(((y + height)-1) << 10) | ((x + width)-1));
|
||||
sendCommandi(REGION1, (y << 10) | x);
|
||||
sendCommandi(REGION2, (((y + height) - 1) << 10) | ((x + width) - 1));
|
||||
}
|
||||
|
||||
void sceGuDispBuffer(int width, int height, void* dispbp, int dispbw)
|
||||
void sceGuDispBuffer(int width, int height, void *dispbp, int dispbw)
|
||||
{
|
||||
gu_draw_buffer.width = width;
|
||||
gu_draw_buffer.height = height;
|
||||
@@ -26,9 +26,9 @@ void sceGuDispBuffer(int width, int height, void* dispbp, int dispbw)
|
||||
if (!gu_draw_buffer.frame_width || (gu_draw_buffer.frame_width != dispbw))
|
||||
gu_draw_buffer.frame_width = dispbw;
|
||||
|
||||
drawRegion(0,0,gu_draw_buffer.width,gu_draw_buffer.height);
|
||||
sceDisplaySetMode(0,gu_draw_buffer.width,gu_draw_buffer.height);
|
||||
drawRegion(0, 0, gu_draw_buffer.width, gu_draw_buffer.height);
|
||||
sceDisplaySetMode(0, gu_draw_buffer.width, gu_draw_buffer.height);
|
||||
|
||||
if (gu_display_on)
|
||||
sceDisplaySetFrameBuf((void*)(((unsigned int)ge_edram_address) + ((unsigned int)gu_draw_buffer.disp_buffer)), dispbw, gu_draw_buffer.pixel_size, PSP_DISPLAY_SETBUF_NEXTFRAME);
|
||||
sceDisplaySetFrameBuf((void *)(((unsigned int)ge_edram_address) + ((unsigned int)gu_draw_buffer.disp_buffer)), dispbw, gu_draw_buffer.pixel_size, PSP_DISPLAY_SETBUF_NEXTFRAME);
|
||||
}
|
||||
|
||||
@@ -8,22 +8,22 @@
|
||||
|
||||
#include "guInternal.h"
|
||||
|
||||
void sceGuDrawArray(int prim, int vtype, int count, const void* indices, const void* vertices)
|
||||
void sceGuDrawArray(int prim, int vtype, int count, const void *indices, const void *vertices)
|
||||
{
|
||||
if (vtype)
|
||||
sendCommandi(18,vtype);
|
||||
sendCommandi(VERTEX_TYPE, vtype);
|
||||
|
||||
if (indices)
|
||||
{
|
||||
sendCommandi(16,(((unsigned int)indices) >> 8) & 0xf0000);
|
||||
sendCommandi(2,((unsigned int)indices) & 0xffffff);
|
||||
sendCommandi(BASE, (((unsigned int)indices) >> 8) & 0xf0000);
|
||||
sendCommandi(IADDR, ((unsigned int)indices) & 0xffffff);
|
||||
}
|
||||
|
||||
if (vertices)
|
||||
{
|
||||
sendCommandi(16,(((unsigned int)vertices) >> 8) & 0xf0000);
|
||||
sendCommandi(1,((unsigned int)vertices) & 0xffffff);
|
||||
}
|
||||
sendCommandi(BASE, (((unsigned int)vertices) >> 8) & 0xf0000);
|
||||
sendCommandi(VADDR, ((unsigned int)vertices) & 0xffffff);
|
||||
}
|
||||
|
||||
sendCommandiStall(4,(prim << 16)|count);
|
||||
sendCommandiStall(PRIM, (prim << 16) | count);
|
||||
}
|
||||
|
||||
@@ -8,29 +8,29 @@
|
||||
|
||||
#include "guInternal.h"
|
||||
|
||||
void sceGuDrawArrayN(int primitive_type, int vertex_type, int count, int a3, const void* indices, const void* vertices)
|
||||
void sceGuDrawArrayN(int primitive_type, int vertex_type, int count, int a3, const void *indices, const void *vertices)
|
||||
{
|
||||
if (vertex_type)
|
||||
sendCommandi(18,vertex_type);
|
||||
sendCommandi(VERTEX_TYPE, vertex_type);
|
||||
|
||||
if (indices)
|
||||
{
|
||||
sendCommandi(16,(((unsigned int)indices) >> 8) & 0xf0000);
|
||||
sendCommandi(2,((unsigned int)indices) & 0xffffff);
|
||||
sendCommandi(BASE, (((unsigned int)indices) >> 8) & 0xf0000);
|
||||
sendCommandi(IADDR, ((unsigned int)indices) & 0xffffff);
|
||||
}
|
||||
|
||||
if (vertices)
|
||||
{
|
||||
sendCommandi(16,(((unsigned int)vertices) >> 8) & 0xf0000);
|
||||
sendCommandi(1,((unsigned int)vertices) & 0xffffff);
|
||||
sendCommandi(BASE, (((unsigned int)vertices) >> 8) & 0xf0000);
|
||||
sendCommandi(VADDR, ((unsigned int)vertices) & 0xffffff);
|
||||
}
|
||||
|
||||
if (a3 > 0)
|
||||
{
|
||||
// TODO: not sure about this loop, might be off. review
|
||||
int i;
|
||||
for (i = a3-1; i > 0; --i)
|
||||
sendCommandi(4,(primitive_type << 16)|count);
|
||||
sendCommandiStall(4,(primitive_type << 16)|count);
|
||||
for (i = a3 - 1; i > 0; --i)
|
||||
sendCommandi(PRIM, (primitive_type << 16) | count);
|
||||
sendCommandiStall(PRIM, (primitive_type << 16) | count);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,22 +8,22 @@
|
||||
|
||||
#include "guInternal.h"
|
||||
|
||||
void sceGuDrawBezier(int vertex_type, int ucount, int vcount, const void* indices, const void* vertices)
|
||||
void sceGuDrawBezier(int vertex_type, int ucount, int vcount, const void *indices, const void *vertices)
|
||||
{
|
||||
if (vertex_type)
|
||||
sendCommandi(18,vertex_type);
|
||||
sendCommandi(VERTEX_TYPE, vertex_type);
|
||||
|
||||
if (indices)
|
||||
{
|
||||
sendCommandi(16,(((unsigned int)indices) >> 8) & 0xf0000);
|
||||
sendCommandi(2,((unsigned int)indices) & 0xffffff);
|
||||
sendCommandi(BASE, (((unsigned int)indices) >> 8) & 0xf0000);
|
||||
sendCommandi(IADDR, ((unsigned int)indices) & 0xffffff);
|
||||
}
|
||||
|
||||
if (vertices)
|
||||
{
|
||||
sendCommandi(16,(((unsigned int)vertices) >> 8) & 0xf0000);
|
||||
sendCommandi(1,((unsigned int)vertices) & 0xffffff);
|
||||
sendCommandi(BASE, (((unsigned int)vertices) >> 8) & 0xf0000);
|
||||
sendCommandi(VADDR, ((unsigned int)vertices) & 0xffffff);
|
||||
}
|
||||
|
||||
sendCommandi(5,(vcount << 8)|ucount);
|
||||
sendCommandi(BEZIER, (vcount << 8) | ucount);
|
||||
}
|
||||
|
||||
@@ -8,21 +8,21 @@
|
||||
|
||||
#include "guInternal.h"
|
||||
|
||||
void sceGuDrawBuffer(int psm, void* fbp, int frame_width)
|
||||
void sceGuDrawBuffer(int psm, void *fbp, int frame_width)
|
||||
{
|
||||
gu_draw_buffer.pixel_size = psm;
|
||||
gu_draw_buffer.frame_width = frame_width;
|
||||
gu_draw_buffer.frame_buffer = fbp;
|
||||
|
||||
if (!gu_draw_buffer.depth_buffer && gu_draw_buffer.height)
|
||||
gu_draw_buffer.depth_buffer = (void*)(((unsigned int)fbp) + (unsigned int)((gu_draw_buffer.height * frame_width) << 2));
|
||||
gu_draw_buffer.depth_buffer = (void *)(((unsigned int)fbp) + (unsigned int)((gu_draw_buffer.height * frame_width) << 2));
|
||||
|
||||
if (!gu_draw_buffer.depth_width)
|
||||
gu_draw_buffer.depth_width = frame_width;
|
||||
|
||||
sendCommandi(210,psm);
|
||||
sendCommandi(156,((unsigned int)gu_draw_buffer.frame_buffer) & 0xffffff);
|
||||
sendCommandi(157,((((unsigned int)gu_draw_buffer.frame_buffer) & 0xff000000) >> 8)|gu_draw_buffer.frame_width);
|
||||
sendCommandi(158,((unsigned int)gu_draw_buffer.depth_buffer) & 0xffffff);
|
||||
sendCommandi(159,((((unsigned int)gu_draw_buffer.depth_buffer) & 0xff000000) >> 8)|gu_draw_buffer.depth_width);
|
||||
sendCommandi(FRAMEBUF_PIX_FORMAT, psm);
|
||||
sendCommandi(FRAME_BUF_PTR, ((unsigned int)gu_draw_buffer.frame_buffer) & 0xffffff);
|
||||
sendCommandi(FRAME_BUF_WIDTH, ((((unsigned int)gu_draw_buffer.frame_buffer) & 0xff000000) >> 8) | gu_draw_buffer.frame_width);
|
||||
sendCommandi(Z_BUF_PTR, ((unsigned int)gu_draw_buffer.depth_buffer) & 0xffffff);
|
||||
sendCommandi(Z_BUF_WIDTH, ((((unsigned int)gu_draw_buffer.depth_buffer) & 0xff000000) >> 8) | gu_draw_buffer.depth_width);
|
||||
}
|
||||
|
||||
@@ -8,9 +8,9 @@
|
||||
|
||||
#include "guInternal.h"
|
||||
|
||||
void sceGuDrawBufferList(int psm, void* fbp, int fbw)
|
||||
void sceGuDrawBufferList(int psm, void *fbp, int fbw)
|
||||
{
|
||||
sendCommandi(210,psm);
|
||||
sendCommandi(156,((unsigned int)fbp) & 0xffffff);
|
||||
sendCommandi(157,((((unsigned int)fbp) & 0xff000000) >> 8) | fbw);
|
||||
sendCommandi(FRAMEBUF_PIX_FORMAT, psm);
|
||||
sendCommandi(FRAME_BUF_PTR, ((unsigned int)fbp) & 0xffffff);
|
||||
sendCommandi(FRAME_BUF_WIDTH, ((((unsigned int)fbp) & 0xff000000) >> 8) | fbw);
|
||||
}
|
||||
|
||||
@@ -8,22 +8,22 @@
|
||||
|
||||
#include "guInternal.h"
|
||||
|
||||
void sceGuDrawSpline(int vertex_type, int ucount, int vcount, int uedge, int vedge, const void* indices, const void* vertices)
|
||||
void sceGuDrawSpline(int vertex_type, int ucount, int vcount, int uedge, int vedge, const void *indices, const void *vertices)
|
||||
{
|
||||
if (vertex_type)
|
||||
sendCommandi(18,vertex_type);
|
||||
sendCommandi(VERTEX_TYPE, vertex_type);
|
||||
|
||||
if (indices)
|
||||
{
|
||||
sendCommandi(16,(((unsigned int)indices) >> 8) & 0xf0000);
|
||||
sendCommandi(2,((unsigned int)indices) & 0xffffff);
|
||||
sendCommandi(BASE, (((unsigned int)indices) >> 8) & 0xf0000);
|
||||
sendCommandi(IADDR, ((unsigned int)indices) & 0xffffff);
|
||||
}
|
||||
|
||||
if (vertices)
|
||||
{
|
||||
sendCommandi(16,(((unsigned int)vertices) >> 8) & 0xf0000);
|
||||
sendCommandi(1,((unsigned int)vertices) & 0xffffff);
|
||||
sendCommandi(BASE, (((unsigned int)vertices) >> 8) & 0xf0000);
|
||||
sendCommandi(VADDR, ((unsigned int)vertices) & 0xffffff);
|
||||
}
|
||||
|
||||
sendCommandi(6,(vedge << 18)|(uedge << 16)|(vcount << 8)|ucount);
|
||||
sendCommandi(SPLINE, (vedge << 18) | (uedge << 16) | (vcount << 8) | ucount);
|
||||
}
|
||||
|
||||
@@ -10,43 +10,83 @@
|
||||
|
||||
void sceGuEnable(int state)
|
||||
{
|
||||
switch(state)
|
||||
switch (state)
|
||||
{
|
||||
case GU_ALPHA_TEST: sendCommandi(34,1); break;
|
||||
case GU_DEPTH_TEST: sendCommandi(35,1); break;
|
||||
case GU_SCISSOR_TEST:
|
||||
{
|
||||
GuContext* context = &gu_contexts[gu_curr_context];
|
||||
context->scissor_enable = 1;
|
||||
sendCommandi(212,(context->scissor_start[1]<<10)|context->scissor_start[0]);
|
||||
sendCommandi(213,(context->scissor_end[1]<<10)|context->scissor_end[0]);
|
||||
}
|
||||
case GU_ALPHA_TEST:
|
||||
sendCommandi(ALPHA_TEST_ENABLE, 1);
|
||||
break;
|
||||
case GU_STENCIL_TEST: sendCommandi(36,1); break;
|
||||
case GU_BLEND: sendCommandi(33,1); break;
|
||||
case GU_CULL_FACE: sendCommandi(29,1); break;
|
||||
case GU_DITHER: sendCommandi(32,1); break;
|
||||
case GU_FOG: sendCommandi(31,1); break;
|
||||
case GU_CLIP_PLANES: sendCommandi(28,1); break;
|
||||
case GU_TEXTURE_2D: sendCommandi(30,1); break;
|
||||
case GU_LIGHTING: sendCommandi(23,1); break;
|
||||
case GU_LIGHT0: sendCommandi(24,1); break;
|
||||
case GU_LIGHT1: sendCommandi(25,1); break;
|
||||
case GU_LIGHT2: sendCommandi(26,1); break;
|
||||
case GU_LIGHT3: sendCommandi(27,1); break;
|
||||
case GU_LINE_SMOOTH: sendCommandi(37,1); break;
|
||||
case GU_PATCH_CULL_FACE:sendCommandi(38,1); break;
|
||||
case GU_COLOR_TEST: sendCommandi(39,1); break;
|
||||
case GU_COLOR_LOGIC_OP: sendCommandi(40,1); break;
|
||||
case GU_FACE_NORMAL_REVERSE: sendCommandi(81,1); break;
|
||||
case GU_PATCH_FACE: sendCommandi(56,1); break;
|
||||
case GU_FRAGMENT_2X:
|
||||
{
|
||||
GuContext* context = &gu_contexts[gu_curr_context];
|
||||
context->fragment_2x = 0x10000;
|
||||
sendCommandi(201,0x10000|context->texture_function);
|
||||
}
|
||||
case GU_DEPTH_TEST:
|
||||
sendCommandi(Z_TEST_ENABLE, 1);
|
||||
break;
|
||||
case GU_SCISSOR_TEST:
|
||||
{
|
||||
GuContext *context = &gu_contexts[gu_curr_context];
|
||||
context->scissor_enable = 1;
|
||||
sendCommandi(SCISSOR1, (context->scissor_start[1] << 10) | context->scissor_start[0]);
|
||||
sendCommandi(SCISSOR2, (context->scissor_end[1] << 10) | context->scissor_end[0]);
|
||||
}
|
||||
break;
|
||||
case GU_STENCIL_TEST:
|
||||
sendCommandi(STENCIL_TEST_ENABLE, 1);
|
||||
break;
|
||||
case GU_BLEND:
|
||||
sendCommandi(ALPHA_BLEND_ENABLE, 1);
|
||||
break;
|
||||
case GU_CULL_FACE:
|
||||
sendCommandi(CULL_FACE_ENABLE, 1);
|
||||
break;
|
||||
case GU_DITHER:
|
||||
sendCommandi(DITHER_ENABLE, 1);
|
||||
break;
|
||||
case GU_FOG:
|
||||
sendCommandi(FOG_ENABLE, 1);
|
||||
break;
|
||||
case GU_CLIP_PLANES:
|
||||
sendCommandi(DEPTH_CLIP_ENABLE, 1);
|
||||
break;
|
||||
case GU_TEXTURE_2D:
|
||||
sendCommandi(TEXTURE_ENABLE, 1);
|
||||
break;
|
||||
case GU_LIGHTING:
|
||||
sendCommandi(LIGHTING_ENABLE, 1);
|
||||
break;
|
||||
case GU_LIGHT0:
|
||||
sendCommandi(LIGHT_ENABLE0, 1);
|
||||
break;
|
||||
case GU_LIGHT1:
|
||||
sendCommandi(LIGHT_ENABLE1, 1);
|
||||
break;
|
||||
case GU_LIGHT2:
|
||||
sendCommandi(LIGHT_ENABLE2, 1);
|
||||
break;
|
||||
case GU_LIGHT3:
|
||||
sendCommandi(LIGHT_ENABLE3, 1);
|
||||
break;
|
||||
case GU_LINE_SMOOTH:
|
||||
sendCommandi(ANTI_ALIAS_ENABLE, 1);
|
||||
break;
|
||||
case GU_PATCH_CULL_FACE:
|
||||
sendCommandi(PATCH_CULL_ENABLE, 1);
|
||||
break;
|
||||
case GU_COLOR_TEST:
|
||||
sendCommandi(COLOR_TEST_ENABLE, 1);
|
||||
break;
|
||||
case GU_COLOR_LOGIC_OP:
|
||||
sendCommandi(LOGIC_OP_ENABLE, 1);
|
||||
break;
|
||||
case GU_FACE_NORMAL_REVERSE:
|
||||
sendCommandi(NORMAL_REVERSE, 1);
|
||||
break;
|
||||
case GU_PATCH_FACE:
|
||||
sendCommandi(PATCH_FACING, 1);
|
||||
break;
|
||||
case GU_FRAGMENT_2X:
|
||||
{
|
||||
GuContext *context = &gu_contexts[gu_curr_context];
|
||||
context->fragment_2x = 0x10000;
|
||||
sendCommandi(TEX_FUNC, 0x10000 | context->texture_function);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (state < 22)
|
||||
|
||||
@@ -12,11 +12,11 @@ void sceGuEndObject(void)
|
||||
{
|
||||
// rewrite commands from sceGuBeginObject()
|
||||
|
||||
unsigned int* current = gu_list->current;
|
||||
gu_list->current = gu_object_stack[gu_object_stack_depth-1];
|
||||
unsigned int *current = gu_list->current;
|
||||
gu_list->current = gu_object_stack[gu_object_stack_depth - 1];
|
||||
|
||||
sendCommandi(16, (((unsigned int)current) >> 8) & 0xf0000);
|
||||
sendCommandi(9, ((unsigned int)current) & 0xffffff);
|
||||
sendCommandi(BASE, (((unsigned int)current) >> 8) & 0xf0000);
|
||||
sendCommandi(BJUMP, ((unsigned int)current) & 0xffffff);
|
||||
gu_list->current = current;
|
||||
|
||||
gu_object_stack_depth--;
|
||||
|
||||
@@ -12,28 +12,28 @@ int sceGuFinish(void)
|
||||
{
|
||||
switch (gu_curr_context)
|
||||
{
|
||||
case GU_DIRECT:
|
||||
case GU_SEND:
|
||||
{
|
||||
sendCommandi(15,0);
|
||||
sendCommandiStall(12,0);
|
||||
}
|
||||
break;
|
||||
case GU_DIRECT:
|
||||
case GU_SEND:
|
||||
{
|
||||
sendCommandi(FINISH, 0);
|
||||
sendCommandiStall(END, 0);
|
||||
}
|
||||
break;
|
||||
|
||||
case GU_CALL:
|
||||
case GU_CALL:
|
||||
{
|
||||
if (gu_call_mode == 1)
|
||||
{
|
||||
if (gu_call_mode == 1)
|
||||
{
|
||||
sendCommandi(14,0x120000);
|
||||
sendCommandi(12,0);
|
||||
sendCommandiStall(0,0);
|
||||
}
|
||||
else
|
||||
{
|
||||
sendCommandi(11,0);
|
||||
}
|
||||
sendCommandi(SIGNAL, 0x120000);
|
||||
sendCommandi(END, 0);
|
||||
sendCommandiStall(NOP, 0);
|
||||
}
|
||||
break;
|
||||
else
|
||||
{
|
||||
sendCommandi(RET, 0);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
unsigned int size = ((unsigned int)gu_list->current) - ((unsigned int)gu_list->start);
|
||||
@@ -48,28 +48,28 @@ int sceGuFinishId(unsigned int id)
|
||||
{
|
||||
switch (gu_curr_context)
|
||||
{
|
||||
case GU_DIRECT:
|
||||
case GU_SEND:
|
||||
{
|
||||
sendCommandi(15,id & 0xffff);
|
||||
sendCommandiStall(12,0);
|
||||
}
|
||||
break;
|
||||
case GU_DIRECT:
|
||||
case GU_SEND:
|
||||
{
|
||||
sendCommandi(FINISH, id & 0xffff);
|
||||
sendCommandiStall(END, 0);
|
||||
}
|
||||
break;
|
||||
|
||||
case GU_CALL:
|
||||
case GU_CALL:
|
||||
{
|
||||
if (gu_call_mode == 1)
|
||||
{
|
||||
if (gu_call_mode == 1)
|
||||
{
|
||||
sendCommandi(14,0x120000);
|
||||
sendCommandi(12,0);
|
||||
sendCommandiStall(0,0);
|
||||
}
|
||||
else
|
||||
{
|
||||
sendCommandi(11,0);
|
||||
}
|
||||
sendCommandi(SIGNAL, 0x120000);
|
||||
sendCommandi(END, 0);
|
||||
sendCommandiStall(NOP, 0);
|
||||
}
|
||||
break;
|
||||
else
|
||||
{
|
||||
sendCommandi(RET, 0);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
unsigned int size = ((unsigned int)gu_list->current) - ((unsigned int)gu_list->start);
|
||||
|
||||
@@ -10,12 +10,12 @@
|
||||
|
||||
void sceGuFog(float near, float far, unsigned int color)
|
||||
{
|
||||
float distance = far-near;
|
||||
float distance = far - near;
|
||||
|
||||
if (distance)
|
||||
distance = 1.0f / distance;
|
||||
|
||||
sendCommandi(207,color & 0xffffff);
|
||||
sendCommandf(205,far);
|
||||
sendCommandf(206,distance);
|
||||
sendCommandi(FOG_COLOR, color & 0xffffff);
|
||||
sendCommandf(FOG1, far);
|
||||
sendCommandf(FOG2, distance);
|
||||
}
|
||||
|
||||
@@ -10,8 +10,5 @@
|
||||
|
||||
void sceGuFrontFace(int order)
|
||||
{
|
||||
if (order)
|
||||
sendCommandi(155,0);
|
||||
else
|
||||
sendCommandi(155,1);
|
||||
sendCommandi(CULL, order ? 0 : 1);
|
||||
}
|
||||
|
||||
@@ -12,39 +12,266 @@
|
||||
#include <pspge.h>
|
||||
#include <pspdisplay.h>
|
||||
|
||||
unsigned int __attribute__((aligned(16))) ge_init_list[] =
|
||||
{
|
||||
0x01000000, 0x02000000, 0x10000000, 0x12000000, 0x13000000, 0x15000000, 0x16000000, 0x17000000,
|
||||
0x18000000, 0x19000000, 0x1a000000, 0x1b000000, 0x1c000000, 0x1d000000, 0x1e000000, 0x1f000000,
|
||||
0x20000000, 0x21000000, 0x22000000, 0x23000000, 0x24000000, 0x25000000, 0x26000000, 0x27000000,
|
||||
0x28000000, 0x2a000000, 0x2b000000, 0x2c000000, 0x2d000000, 0x2e000000, 0x2f000000, 0x30000000,
|
||||
0x31000000, 0x32000000, 0x33000000, 0x36000000, 0x37000000, 0x38000000, 0x3a000000, 0x3b000000,
|
||||
0x3c000000, 0x3d000000, 0x3e000000, 0x3f000000, 0x40000000, 0x41000000, 0x42000000, 0x43000000,
|
||||
0x44000000, 0x45000000, 0x46000000, 0x47000000, 0x48000000, 0x49000000, 0x4a000000, 0x4b000000,
|
||||
0x4c000000, 0x4d000000, 0x50000000, 0x51000000, 0x53000000, 0x54000000, 0x55000000, 0x56000000,
|
||||
0x57000000, 0x58000000, 0x5b000000, 0x5c000000, 0x5d000000, 0x5e000000, 0x5f000000, 0x60000000,
|
||||
0x61000000, 0x62000000, 0x63000000, 0x64000000, 0x65000000, 0x66000000, 0x67000000, 0x68000000,
|
||||
0x69000000, 0x6a000000, 0x6b000000, 0x6c000000, 0x6d000000, 0x6e000000, 0x6f000000, 0x70000000,
|
||||
0x71000000, 0x72000000, 0x73000000, 0x74000000, 0x75000000, 0x76000000, 0x77000000, 0x78000000,
|
||||
0x79000000, 0x7a000000, 0x7b000000, 0x7c000000, 0x7d000000, 0x7e000000, 0x7f000000, 0x80000000,
|
||||
0x81000000, 0x82000000, 0x83000000, 0x84000000, 0x85000000, 0x86000000, 0x87000000, 0x88000000,
|
||||
0x89000000, 0x8a000000, 0x8b000000, 0x8c000000, 0x8d000000, 0x8e000000, 0x8f000000, 0x90000000,
|
||||
0x91000000, 0x92000000, 0x93000000, 0x94000000, 0x95000000, 0x96000000, 0x97000000, 0x98000000,
|
||||
0x99000000, 0x9a000000, 0x9b000000, 0x9c000000, 0x9d000000, 0x9e000000, 0x9f000000, 0xa0000000,
|
||||
0xa1000000, 0xa2000000, 0xa3000000, 0xa4000000, 0xa5000000, 0xa6000000, 0xa7000000, 0xa8040004,
|
||||
0xa9000000, 0xaa000000, 0xab000000, 0xac000000, 0xad000000, 0xae000000, 0xaf000000, 0xb0000000,
|
||||
0xb1000000, 0xb2000000, 0xb3000000, 0xb4000000, 0xb5000000, 0xb8000101, 0xb9000000, 0xba000000,
|
||||
0xbb000000, 0xbc000000, 0xbd000000, 0xbe000000, 0xbf000000, 0xc0000000, 0xc1000000, 0xc2000000,
|
||||
0xc3000000, 0xc4000000, 0xc5000000, 0xc6000000, 0xc7000000, 0xc8000000, 0xc9000000, 0xca000000,
|
||||
0xcb000000, 0xcc000000, 0xcd000000, 0xce000000, 0xcf000000, 0xd0000000, 0xd2000000, 0xd3000000,
|
||||
0xd4000000, 0xd5000000, 0xd6000000, 0xd7000000, 0xd8000000, 0xd9000000, 0xda000000, 0xdb000000,
|
||||
0xdc000000, 0xdd000000, 0xde000000, 0xdf000000, 0xe0000000, 0xe1000000, 0xe2000000, 0xe3000000,
|
||||
0xe4000000, 0xe5000000, 0xe6000000, 0xe7000000, 0xe8000000, 0xe9000000, 0xeb000000, 0xec000000,
|
||||
0xee000000, 0xf0000000, 0xf1000000, 0xf2000000, 0xf3000000, 0xf4000000, 0xf5000000, 0xf6000000,
|
||||
0xf7000000, 0xf8000000, 0xf9000000,
|
||||
0x0f000000, 0x0c000000, 0, 0
|
||||
};
|
||||
// Zero value
|
||||
#define ZV(command) (uint32_t)(command << 24 | 0x00000000)
|
||||
|
||||
// Concrete value
|
||||
#define CV(command, value) (uint32_t)(command << 24 | value)
|
||||
|
||||
unsigned int __attribute__((aligned(16))) ge_init_list[] =
|
||||
{
|
||||
ZV(VADDR),
|
||||
ZV(IADDR),
|
||||
ZV(BASE),
|
||||
ZV(VERTEX_TYPE),
|
||||
ZV(OFFSET_ADDR),
|
||||
ZV(REGION1),
|
||||
ZV(REGION2),
|
||||
ZV(LIGHTING_ENABLE),
|
||||
|
||||
ZV(LIGHT_ENABLE0),
|
||||
ZV(LIGHT_ENABLE1),
|
||||
ZV(LIGHT_ENABLE2),
|
||||
ZV(LIGHT_ENABLE3),
|
||||
ZV(DEPTH_CLIP_ENABLE),
|
||||
ZV(CULL_FACE_ENABLE),
|
||||
ZV(TEXTURE_ENABLE),
|
||||
ZV(FOG_ENABLE),
|
||||
|
||||
ZV(DITHER_ENABLE),
|
||||
ZV(ALPHA_BLEND_ENABLE),
|
||||
ZV(ALPHA_TEST_ENABLE),
|
||||
ZV(Z_TEST_ENABLE),
|
||||
ZV(STENCIL_TEST_ENABLE),
|
||||
ZV(ANTI_ALIAS_ENABLE),
|
||||
ZV(PATCH_CULL_ENABLE),
|
||||
ZV(COLOR_TEST_ENABLE),
|
||||
|
||||
ZV(LOGIC_OP_ENABLE),
|
||||
ZV(BONE_MATRIX_NUMBER),
|
||||
ZV(BONE_MATRIX_DATA),
|
||||
ZV(MORPH_WEIGHT0),
|
||||
ZV(MORPH_WEIGHT1),
|
||||
ZV(MORPH_WEIGHT2),
|
||||
ZV(MORPH_WEIGHT3),
|
||||
ZV(MORPH_WEIGHT4),
|
||||
|
||||
ZV(MORPH_WEIGHT5),
|
||||
ZV(MORPH_WEIGHT6),
|
||||
ZV(MORPH_WEIGHT7),
|
||||
ZV(PATCH_DIVISION),
|
||||
ZV(PATCH_PRIMITIVE),
|
||||
ZV(PATCH_FACING),
|
||||
ZV(WORLD_MATRIX_NUMBER),
|
||||
ZV(WORLD_MATRIX_DATA),
|
||||
|
||||
ZV(VIEW_MATRIX_NUMBER),
|
||||
ZV(VIEW_MATRIX_DATA),
|
||||
ZV(PROJ_MATRIX_NUMBER),
|
||||
ZV(PROJ_MATRIX_DATA),
|
||||
ZV(TGEN_MATRIX_NUMBER),
|
||||
ZV(TGEN_MATRIX_DATA),
|
||||
ZV(VIEWPORT_X_SCALE),
|
||||
ZV(VIEWPORT_Y_SCALE),
|
||||
|
||||
ZV(VIEWPORT_Z_SCALE),
|
||||
ZV(VIEWPORT_X_CENTER),
|
||||
ZV(VIEWPORT_Y_CENTER),
|
||||
ZV(VIEWPORT_Z_CENTER),
|
||||
ZV(TEX_SCALE_U),
|
||||
ZV(TEX_SCALE_V),
|
||||
ZV(TEX_OFFSET_U),
|
||||
ZV(TEX_OFFSET_V),
|
||||
|
||||
ZV(OFFSET_X),
|
||||
ZV(OFFSET_Y),
|
||||
ZV(SHADE_MODE),
|
||||
ZV(NORMAL_REVERSE),
|
||||
ZV(MATERIAL_COLOR),
|
||||
ZV(MATERIAL_EMISSIVE),
|
||||
ZV(AMBIENT_COLOR),
|
||||
ZV(MATERIAL_DIFFUSE),
|
||||
|
||||
ZV(MATERIAL_SPECULAR),
|
||||
ZV(AMBIENT_ALPHA),
|
||||
ZV(MATERIAL_SPECULAR_COEF),
|
||||
ZV(AMBIENT_LIGHT_COLOR),
|
||||
ZV(AMBIENT_LIGHT_ALPHA),
|
||||
ZV(LIGHT_MODE),
|
||||
ZV(LIGHT_TYPE0),
|
||||
ZV(LIGHT_TYPE1),
|
||||
|
||||
ZV(LIGHT_TYPE2),
|
||||
ZV(LIGHT_TYPE3),
|
||||
ZV(LIGHT0_X),
|
||||
ZV(LIGHT0_Y),
|
||||
ZV(LIGHT0_Z),
|
||||
ZV(LIGHT1_X),
|
||||
ZV(LIGHT1_Y),
|
||||
ZV(LIGHT1_Z),
|
||||
|
||||
ZV(LIGHT2_X),
|
||||
ZV(LIGHT2_Y),
|
||||
ZV(LIGHT2_Z),
|
||||
ZV(LIGHT3_X),
|
||||
ZV(LIGHT3_Y),
|
||||
ZV(LIGHT3_Z),
|
||||
ZV(LIGHT0_DIRECTION_X),
|
||||
ZV(LIGHT0_DIRECTION_Y),
|
||||
|
||||
ZV(LIGHT0_DIRECTION_Z),
|
||||
ZV(LIGHT1_DIRECTION_X),
|
||||
ZV(LIGHT1_DIRECTION_Y),
|
||||
ZV(LIGHT1_DIRECTION_Z),
|
||||
ZV(LIGHT2_DIRECTION_X),
|
||||
ZV(LIGHT2_DIRECTION_Y),
|
||||
ZV(LIGHT2_DIRECTION_Z),
|
||||
ZV(LIGHT3_DIRECTION_X),
|
||||
|
||||
ZV(LIGHT3_DIRECTION_Y),
|
||||
ZV(LIGHT3_DIRECTION_Z),
|
||||
ZV(LIGHT0_CONSTANT_ATTEN),
|
||||
ZV(LIGHT0_LINEAR_ATTEN),
|
||||
ZV(LIGHT0_QUADRATIC_ATTEN),
|
||||
ZV(LIGHT1_CONSTANT_ATTEN),
|
||||
ZV(LIGHT1_LINEAR_ATTEN),
|
||||
ZV(LIGHT1_QUADRATIC_ATTEN),
|
||||
|
||||
ZV(LIGHT2_CONSTANT_ATTEN),
|
||||
ZV(LIGHT2_LINEAR_ATTEN),
|
||||
ZV(LIGHT2_QUADRATIC_ATTEN),
|
||||
ZV(LIGHT3_CONSTANT_ATTEN),
|
||||
ZV(LIGHT3_LINEAR_ATTEN),
|
||||
ZV(LIGHT3_QUADRATIC_ATTEN),
|
||||
ZV(LIGHT0_EXPONENT_ATTEN),
|
||||
ZV(LIGHT1_EXPONENT_ATTEN),
|
||||
|
||||
ZV(LIGHT2_EXPONENT_ATTEN),
|
||||
ZV(LIGHT3_EXPONENT_ATTEN),
|
||||
ZV(LIGHT0_CUTOFF_ATTEN),
|
||||
ZV(LIGHT1_CUTOFF_ATTEN),
|
||||
ZV(LIGHT2_CUTOFF_ATTEN),
|
||||
ZV(LIGHT3_CUTOFF_ATTEN),
|
||||
ZV(LIGHT0_AMBIENT),
|
||||
ZV(LIGHT0_DIFFUSE),
|
||||
|
||||
ZV(LIGHT0_SPECULAR),
|
||||
ZV(LIGHT1_AMBIENT),
|
||||
ZV(LIGHT1_DIFFUSE),
|
||||
ZV(LIGHT1_SPECULAR),
|
||||
ZV(LIGHT2_AMBIENT),
|
||||
ZV(LIGHT2_DIFFUSE),
|
||||
ZV(LIGHT2_SPECULAR),
|
||||
ZV(LIGHT3_AMBIENT),
|
||||
|
||||
ZV(LIGHT3_DIFFUSE),
|
||||
ZV(LIGHT3_SPECULAR),
|
||||
ZV(CULL),
|
||||
ZV(FRAME_BUF_PTR),
|
||||
ZV(FRAME_BUF_WIDTH),
|
||||
ZV(Z_BUF_PTR),
|
||||
ZV(Z_BUF_WIDTH),
|
||||
ZV(TEX_ADDR0),
|
||||
|
||||
ZV(TEX_ADDR1),
|
||||
ZV(TEX_ADDR2),
|
||||
ZV(TEX_ADDR3),
|
||||
ZV(TEX_ADDR4),
|
||||
ZV(TEX_ADDR5),
|
||||
ZV(TEX_ADDR6),
|
||||
ZV(TEX_ADDR7),
|
||||
CV(TEX_BUF_WIDTH0, ((512 * 512) + 4)),
|
||||
|
||||
ZV(TEX_BUF_WIDTH1),
|
||||
ZV(TEX_BUF_WIDTH2),
|
||||
ZV(TEX_BUF_WIDTH3),
|
||||
ZV(TEX_BUF_WIDTH4),
|
||||
ZV(TEX_BUF_WIDTH5),
|
||||
ZV(TEX_BUF_WIDTH6),
|
||||
ZV(TEX_BUF_WIDTH7),
|
||||
ZV(CLUT_ADDR),
|
||||
|
||||
ZV(CLUT_ADDR_UPPER),
|
||||
ZV(TRANSFER_SRC),
|
||||
ZV(TRANSFER_SRC_W),
|
||||
ZV(TRANSFER_DST),
|
||||
ZV(TRANSFER_DST_W),
|
||||
CV(TEX_SIZE0, 257),
|
||||
ZV(TEX_SIZE1),
|
||||
ZV(TEX_SIZE2),
|
||||
|
||||
ZV(TEX_SIZE3),
|
||||
ZV(TEX_SIZE4),
|
||||
ZV(TEX_SIZE5),
|
||||
ZV(TEX_SIZE6),
|
||||
ZV(TEX_SIZE7),
|
||||
ZV(TEX_MAP_MODE),
|
||||
ZV(TEX_SHADE_MAPPING),
|
||||
ZV(TEX_MODE),
|
||||
|
||||
ZV(TEX_FORMAT),
|
||||
ZV(LOAD_CLUT),
|
||||
ZV(CLUT_FORMAT),
|
||||
ZV(TEX_FILTER),
|
||||
ZV(TEX_WRAP),
|
||||
ZV(TEX_LEVEL),
|
||||
ZV(TEX_FUNC),
|
||||
ZV(TEX_ENV_COLOR),
|
||||
|
||||
ZV(TEX_FLUSH),
|
||||
ZV(TEX_SYNC),
|
||||
ZV(FOG1),
|
||||
ZV(FOG2),
|
||||
ZV(FOG_COLOR),
|
||||
ZV(TEX_LOD_SLOPE),
|
||||
ZV(FRAMEBUF_PIX_FORMAT),
|
||||
ZV(CLEAR_MODE),
|
||||
|
||||
ZV(SCISSOR1),
|
||||
ZV(SCISSOR2),
|
||||
ZV(MIN_Z),
|
||||
ZV(MAX_Z),
|
||||
ZV(COLOR_TEST),
|
||||
ZV(COLOR_REF),
|
||||
ZV(COLOR_TESTMASK),
|
||||
ZV(ALPHA_TEST),
|
||||
|
||||
ZV(STENCIL_TEST),
|
||||
ZV(STENCIL_OP),
|
||||
ZV(Z_TEST),
|
||||
ZV(BLEND_MODE),
|
||||
ZV(BLEND_FIXED_A),
|
||||
ZV(BLEND_FIXED_B),
|
||||
ZV(DITH0),
|
||||
ZV(DITH1),
|
||||
|
||||
ZV(DITH2),
|
||||
ZV(DITH3),
|
||||
ZV(LOGIC_OP),
|
||||
ZV(Z_MASK),
|
||||
ZV(MASK_COLOR),
|
||||
ZV(MASK_ALPHA),
|
||||
ZV(TRANSFER_SRC_OFFSET),
|
||||
ZV(TRANSFER_DST_OFFSET),
|
||||
|
||||
ZV(TRANSFER_SIZE),
|
||||
ZV(TRANSFER_OUT_SIZE),
|
||||
ZV(TRANSFER_OUT_FORMAT),
|
||||
ZV(VERTEX_WEIGHT),
|
||||
ZV(VERTEX_WEIGHT_ADDR),
|
||||
ZV(VERTEX_WEIGHT_SIZE),
|
||||
ZV(VERTEX_WEIGHT_TYPE),
|
||||
ZV(VERTEX_WEIGHT_MODEL),
|
||||
|
||||
ZV(VERTEX_WEIGHT_NORMALIZE),
|
||||
ZV(VERTEX_WEIGHT_OFFSET),
|
||||
ZV(VERTEX_WEIGHT_SCALE),
|
||||
|
||||
ZV(FINISH),
|
||||
ZV(END),
|
||||
ZV(NOP),
|
||||
ZV(NOP),
|
||||
};
|
||||
|
||||
void sceGuInit(void)
|
||||
{
|
||||
@@ -61,12 +288,12 @@ void sceGuInit(void)
|
||||
ge_edram_address = sceGeEdramGetAddr();
|
||||
|
||||
// initialize graphics hardware
|
||||
ge_list_executed[0] = sceGeListEnQueue((void*)((unsigned int)ge_init_list & 0x1fffffff),0,gu_settings.ge_callback_id,0);
|
||||
ge_list_executed[0] = sceGeListEnQueue((void *)((unsigned int)ge_init_list & 0x1fffffff), 0, gu_settings.ge_callback_id, 0);
|
||||
|
||||
resetValues();
|
||||
|
||||
gu_settings.kernel_event_flag = sceKernelCreateEventFlag("SceGuSignal",512,3,0);
|
||||
gu_settings.kernel_event_flag = sceKernelCreateEventFlag("SceGuSignal", 512, 3, 0);
|
||||
|
||||
// wait for init to complete
|
||||
sceGeListSync(ge_list_executed[0],0);
|
||||
sceGeListSync(ge_list_executed[0], 0);
|
||||
}
|
||||
|
||||
@@ -10,5 +10,5 @@
|
||||
|
||||
void sceGuLightMode(int mode)
|
||||
{
|
||||
sendCommandi(94,mode);
|
||||
sendCommandi(LIGHT_MODE, mode);
|
||||
}
|
||||
|
||||
@@ -10,5 +10,5 @@
|
||||
|
||||
void sceGuLogicalOp(int op)
|
||||
{
|
||||
sendCommandi(230,op & 0x0f);
|
||||
sendCommandi(LOGIC_OP, op & 0x0f);
|
||||
}
|
||||
|
||||
@@ -12,13 +12,13 @@ void sceGuMaterial(int mode, int color)
|
||||
{
|
||||
if (mode & 0x01)
|
||||
{
|
||||
sendCommandi(85, color & 0xffffff);
|
||||
sendCommandi(88, color >> 24);
|
||||
sendCommandi(AMBIENT_COLOR, color & 0xffffff);
|
||||
sendCommandi(AMBIENT_ALPHA, color >> 24);
|
||||
}
|
||||
|
||||
if (mode & 0x02)
|
||||
sendCommandi(86, color & 0xffffff);
|
||||
sendCommandi(MATERIAL_DIFFUSE, color & 0xffffff);
|
||||
|
||||
if (mode & 0x04)
|
||||
sendCommandi(87, color & 0xffffff);
|
||||
sendCommandi(MATERIAL_SPECULAR, color & 0xffffff);
|
||||
}
|
||||
|
||||
@@ -10,8 +10,8 @@
|
||||
|
||||
void sceGuModelColor(unsigned int emissive, unsigned int ambient, unsigned int diffuse, unsigned int specular)
|
||||
{
|
||||
sendCommandi(84, emissive & 0xffffff);
|
||||
sendCommandi(86, diffuse & 0xffffff);
|
||||
sendCommandi(85, ambient & 0xffffff);
|
||||
sendCommandi(87, specular & 0xffffff);
|
||||
sendCommandi(MATERIAL_EMISSIVE, emissive & 0xffffff);
|
||||
sendCommandi(MATERIAL_DIFFUSE, diffuse & 0xffffff);
|
||||
sendCommandi(AMBIENT_COLOR, ambient & 0xffffff);
|
||||
sendCommandi(MATERIAL_SPECULAR, specular & 0xffffff);
|
||||
}
|
||||
|
||||
@@ -10,6 +10,6 @@
|
||||
|
||||
void sceGuOffset(unsigned int x, unsigned int y)
|
||||
{
|
||||
sendCommandi(76,x << 4);
|
||||
sendCommandi(77,y << 4);
|
||||
sendCommandi(OFFSET_X, x << 4);
|
||||
sendCommandi(OFFSET_Y, y << 4);
|
||||
}
|
||||
|
||||
@@ -10,5 +10,5 @@
|
||||
|
||||
void sceGuPatchDivide(unsigned int a0, unsigned int a1)
|
||||
{
|
||||
sendCommandi(54,(a1 << 8)|a0);
|
||||
sendCommandi(PATCH_DIVISION, (a1 << 8) | a0);
|
||||
}
|
||||
|
||||
@@ -10,5 +10,5 @@
|
||||
|
||||
void sceGuPatchFrontFace(unsigned int a0)
|
||||
{
|
||||
sendCommandi(56,a0);
|
||||
sendCommandi(PATCH_FACING, a0);
|
||||
}
|
||||
|
||||
@@ -10,10 +10,16 @@
|
||||
|
||||
void sceGuPatchPrim(int prim)
|
||||
{
|
||||
switch(prim)
|
||||
switch (prim)
|
||||
{
|
||||
case GU_POINTS: sendCommandi(55,2); break;
|
||||
case GU_LINE_STRIP: sendCommandi(55,1); break;
|
||||
case GU_TRIANGLE_STRIP: sendCommandi(55,0); break;
|
||||
case GU_POINTS:
|
||||
sendCommandi(PATCH_PRIMITIVE, 2);
|
||||
break;
|
||||
case GU_LINE_STRIP:
|
||||
sendCommandi(PATCH_PRIMITIVE, 1);
|
||||
break;
|
||||
case GU_TRIANGLE_STRIP:
|
||||
sendCommandi(PATCH_PRIMITIVE, 0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,6 +10,6 @@
|
||||
|
||||
void sceGuPixelMask(unsigned int mask)
|
||||
{
|
||||
sendCommandi(232,mask & 0xffffff);
|
||||
sendCommandi(233,mask >> 24);
|
||||
sendCommandi(MASK_COLOR, mask & 0xffffff);
|
||||
sendCommandi(MASK_ALPHA, mask >> 24);
|
||||
}
|
||||
|
||||
@@ -10,16 +10,16 @@
|
||||
|
||||
void sceGuScissor(int x, int y, int w, int h)
|
||||
{
|
||||
GuContext* context = &gu_contexts[gu_curr_context];
|
||||
GuContext *context = &gu_contexts[gu_curr_context];
|
||||
|
||||
context->scissor_start[0] = x;
|
||||
context->scissor_start[1] = y;
|
||||
context->scissor_end[0] = w-1;
|
||||
context->scissor_end[1] = h-1;
|
||||
context->scissor_end[0] = w - 1;
|
||||
context->scissor_end[1] = h - 1;
|
||||
|
||||
if (context->scissor_enable)
|
||||
{
|
||||
sendCommandi(212,(context->scissor_start[1] << 10)|context->scissor_start[0]);
|
||||
sendCommandi(213,(context->scissor_end[1] << 10)|context->scissor_end[0]);
|
||||
sendCommandi(SCISSOR1, (context->scissor_start[1] << 10) | context->scissor_start[0]);
|
||||
sendCommandi(SCISSOR2, (context->scissor_end[1] << 10) | context->scissor_end[0]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,5 +10,5 @@
|
||||
|
||||
void sceGuSendCommandi(int cmd, int argument)
|
||||
{
|
||||
sendCommandi(cmd,argument);
|
||||
sendCommandi(cmd, argument);
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
#include <pspkernel.h>
|
||||
#include <pspge.h>
|
||||
|
||||
void sceGuSendList(int mode, const void* list, PspGeContext* context)
|
||||
void sceGuSendList(int mode, const void *list, PspGeContext *context)
|
||||
{
|
||||
gu_settings.signal_offset = 0;
|
||||
|
||||
@@ -25,8 +25,12 @@ void sceGuSendList(int mode, const void* list, PspGeContext* context)
|
||||
|
||||
switch (mode)
|
||||
{
|
||||
case GU_HEAD: list_id = sceGeListEnQueueHead(list,0,callback,&args); break;
|
||||
case GU_TAIL: list_id = sceGeListEnQueue(list,0,callback,&args); break;
|
||||
case GU_HEAD:
|
||||
list_id = sceGeListEnQueueHead(list, 0, callback, &args);
|
||||
break;
|
||||
case GU_TAIL:
|
||||
list_id = sceGeListEnQueue(list, 0, callback, &args);
|
||||
break;
|
||||
}
|
||||
|
||||
ge_list_executed[1] = list_id;
|
||||
|
||||
@@ -8,10 +8,10 @@
|
||||
|
||||
#include "guInternal.h"
|
||||
|
||||
void sceGuSetDither(const ScePspIMatrix4* matrix)
|
||||
void sceGuSetDither(const ScePspIMatrix4 *matrix)
|
||||
{
|
||||
sendCommandi(226,(matrix->x.x & 0x0f)|((matrix->x.y & 0x0f) << 4)|((matrix->x.z & 0x0f) << 8)|((matrix->x.w & 0x0f) << 12));
|
||||
sendCommandi(227,(matrix->y.x & 0x0f)|((matrix->y.y & 0x0f) << 4)|((matrix->y.z & 0x0f) << 8)|((matrix->y.w & 0x0f) << 12));
|
||||
sendCommandi(228,(matrix->z.x & 0x0f)|((matrix->z.y & 0x0f) << 4)|((matrix->z.z & 0x0f) << 8)|((matrix->z.w & 0x0f) << 12));
|
||||
sendCommandi(229,(matrix->w.x & 0x0f)|((matrix->w.y & 0x0f) << 4)|((matrix->w.z & 0x0f) << 8)|((matrix->w.w & 0x0f) << 12));
|
||||
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));
|
||||
sendCommandi(DITH3, (matrix->w.x & 0x0f) | ((matrix->w.y & 0x0f) << 4) | ((matrix->w.z & 0x0f) << 8) | ((matrix->w.w & 0x0f) << 12));
|
||||
}
|
||||
|
||||
@@ -8,60 +8,60 @@
|
||||
|
||||
#include "guInternal.h"
|
||||
|
||||
void sceGuSetMatrix(int type, const ScePspFMatrix4* matrix)
|
||||
void sceGuSetMatrix(int type, const ScePspFMatrix4 *matrix)
|
||||
{
|
||||
unsigned int i,j;
|
||||
const float* fmatrix = (const float*)matrix;
|
||||
unsigned int i, j;
|
||||
const float *fmatrix = (const float *)matrix;
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case 0:
|
||||
case 0:
|
||||
{
|
||||
sendCommandf(PROJ_MATRIX_NUMBER, 0);
|
||||
|
||||
// 4*4 - most probably projection
|
||||
for (i = 0; i < 16; ++i)
|
||||
sendCommandf(PROJ_MATRIX_DATA, fmatrix[i]);
|
||||
}
|
||||
break;
|
||||
|
||||
case 1:
|
||||
{
|
||||
sendCommandf(VIEW_MATRIX_NUMBER, 0);
|
||||
|
||||
// 4*4 -> 3*4 - view matrix?
|
||||
for (i = 0; i < 4; ++i)
|
||||
{
|
||||
sendCommandf(62,0);
|
||||
|
||||
// 4*4 - most probably projection
|
||||
for (i = 0; i < 16; ++i)
|
||||
sendCommandf(63,fmatrix[i]);
|
||||
for (j = 0; j < 3; ++j)
|
||||
sendCommandf(VIEW_MATRIX_DATA, fmatrix[j + i * 4]);
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case 1:
|
||||
case 2:
|
||||
{
|
||||
sendCommandf(WORLD_MATRIX_NUMBER, 0);
|
||||
|
||||
// 4*4 -> 3*4 - ???
|
||||
for (i = 0; i < 4; ++i)
|
||||
{
|
||||
sendCommandf(60,0);
|
||||
|
||||
// 4*4 -> 3*4 - view matrix?
|
||||
for (i = 0; i < 4; ++i)
|
||||
{
|
||||
for (j = 0; j < 3; ++j)
|
||||
sendCommandf(61,fmatrix[j+i*4]);
|
||||
}
|
||||
for (j = 0; j < 3; ++j)
|
||||
sendCommandf(WORLD_MATRIX_DATA, fmatrix[j + i * 4]);
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case 2:
|
||||
case 3:
|
||||
{
|
||||
sendCommandf(TGEN_MATRIX_NUMBER, 0);
|
||||
|
||||
// 4*4 -> 3*4 - ???
|
||||
for (i = 0; i < 4; ++i)
|
||||
{
|
||||
sendCommandf(58,0);
|
||||
|
||||
// 4*4 -> 3*4 - ???
|
||||
for (i = 0; i < 4; ++i)
|
||||
{
|
||||
for (j = 0; j < 3; ++j)
|
||||
sendCommandf(59,fmatrix[j+i*4]);
|
||||
}
|
||||
for (j = 0; j < 3; ++j)
|
||||
sendCommandf(TGEN_MATRIX_DATA, fmatrix[j + i * 4]);
|
||||
}
|
||||
break;
|
||||
|
||||
case 3:
|
||||
{
|
||||
sendCommandf(64,0);
|
||||
|
||||
// 4*4 -> 3*4 - ???
|
||||
for (i = 0; i < 4; ++i)
|
||||
{
|
||||
for (j = 0; j < 3; ++j)
|
||||
sendCommandf(65,fmatrix[j+i*4]);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,9 +10,5 @@
|
||||
|
||||
void sceGuShadeModel(int mode)
|
||||
{
|
||||
switch (mode)
|
||||
{
|
||||
case 1: sendCommandi(80,1); break;
|
||||
default: sendCommandi(80,0); break;
|
||||
}
|
||||
sendCommandi(SHADE_MODE, mode ? 1 : 0);
|
||||
}
|
||||
|
||||
@@ -10,14 +10,14 @@
|
||||
|
||||
void sceGuSignal(int signal, int argument)
|
||||
{
|
||||
sendCommandi(14,((signal & 0xff) << 16) | (argument & 0xffff));
|
||||
sendCommandi(12,0);
|
||||
sendCommandi(SIGNAL, ((signal & 0xff) << 16) | (argument & 0xffff));
|
||||
sendCommandi(END, 0);
|
||||
|
||||
if (signal == 3)
|
||||
{
|
||||
sendCommandi(15,0);
|
||||
sendCommandi(12,0);
|
||||
sendCommandi(FINISH, 0);
|
||||
sendCommandi(END, 0);
|
||||
}
|
||||
|
||||
sendCommandiStall(0,0);
|
||||
sendCommandiStall(NOP, 0);
|
||||
}
|
||||
|
||||
@@ -10,5 +10,5 @@
|
||||
|
||||
void sceGuSpecular(float power) // specular power
|
||||
{
|
||||
sendCommandf(91,power);
|
||||
sendCommandf(MATERIAL_SPECULAR_COEF, power);
|
||||
}
|
||||
|
||||
@@ -11,10 +11,10 @@
|
||||
#include <pspkernel.h>
|
||||
#include <pspge.h>
|
||||
|
||||
void sceGuStart(int cid, void* list)
|
||||
void sceGuStart(int cid, void *list)
|
||||
{
|
||||
GuContext* context = &gu_contexts[cid];
|
||||
unsigned int* local_list = (unsigned int*)(((unsigned int)list) | 0x40000000);
|
||||
GuContext *context = &gu_contexts[cid];
|
||||
unsigned int *local_list = (unsigned int *)(((unsigned int)list) | 0x40000000);
|
||||
|
||||
// setup display list
|
||||
|
||||
@@ -29,27 +29,27 @@ void sceGuStart(int cid, void* list)
|
||||
|
||||
if (!cid)
|
||||
{
|
||||
ge_list_executed[0] = sceGeListEnQueue(local_list,local_list,gu_settings.ge_callback_id,0);
|
||||
ge_list_executed[0] = sceGeListEnQueue(local_list, local_list, gu_settings.ge_callback_id, 0);
|
||||
gu_settings.signal_offset = 0;
|
||||
}
|
||||
|
||||
if (!gu_init)
|
||||
{
|
||||
static int dither_matrix[16] =
|
||||
{
|
||||
-4, 0,-3, 1,
|
||||
2,-2, 3,-1,
|
||||
-3, 1,-4, 0,
|
||||
3,-1, 2,-2
|
||||
};
|
||||
{
|
||||
-4, 0, -3, 1,
|
||||
2, -2, 3, -1,
|
||||
-3, 1, -4, 0,
|
||||
3, -1, 2, -2
|
||||
};
|
||||
|
||||
sceGuSetDither((ScePspIMatrix4*)dither_matrix);
|
||||
sceGuPatchDivide(16,16);
|
||||
sceGuColorMaterial(GU_AMBIENT|GU_DIFFUSE|GU_SPECULAR);
|
||||
sceGuSetDither((ScePspIMatrix4 *)dither_matrix);
|
||||
sceGuPatchDivide(16, 16);
|
||||
sceGuColorMaterial(GU_AMBIENT | GU_DIFFUSE | GU_SPECULAR);
|
||||
|
||||
sceGuSpecular(1.0f);
|
||||
sceGuTexScale(1.0f,1.0f);
|
||||
|
||||
sceGuTexScale(1.0f, 1.0f);
|
||||
|
||||
gu_init = 1;
|
||||
}
|
||||
|
||||
@@ -57,8 +57,8 @@ void sceGuStart(int cid, void* list)
|
||||
{
|
||||
if (gu_draw_buffer.frame_width)
|
||||
{
|
||||
sendCommandi(156, ((unsigned int)gu_draw_buffer.frame_buffer) & 0xffffff);
|
||||
sendCommandi(157, ((((unsigned int)gu_draw_buffer.frame_buffer) & 0xff000000) >> 8) | gu_draw_buffer.frame_width);
|
||||
sendCommandi(FRAME_BUF_PTR, ((unsigned int)gu_draw_buffer.frame_buffer) & 0xffffff);
|
||||
sendCommandi(FRAME_BUF_WIDTH, ((((unsigned int)gu_draw_buffer.frame_buffer) & 0xff000000) >> 8) | gu_draw_buffer.frame_width);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,5 +10,5 @@
|
||||
|
||||
void sceGuStencilFunc(int func, int ref, int mask)
|
||||
{
|
||||
sendCommandi(220,func | ((ref & 0xff) << 8) | ((mask & 0xff) << 16));
|
||||
sendCommandi(STENCIL_TEST, func | ((ref & 0xff) << 8) | ((mask & 0xff) << 16));
|
||||
}
|
||||
|
||||
@@ -10,5 +10,5 @@
|
||||
|
||||
void sceGuStencilOp(int fail, int zfail, int zpass)
|
||||
{
|
||||
sendCommandi(221,fail | (zfail << 8) | (zpass << 16));
|
||||
sendCommandi(STENCIL_OP, fail | (zfail << 8) | (zpass << 16));
|
||||
}
|
||||
|
||||
@@ -10,5 +10,5 @@
|
||||
|
||||
void sceGuTexEnvColor(unsigned int color)
|
||||
{
|
||||
sendCommandi(202,color & 0xffffff);
|
||||
sendCommandi(TEX_ENV_COLOR, color & 0xffffff);
|
||||
}
|
||||
|
||||
@@ -10,5 +10,5 @@
|
||||
|
||||
void sceGuTexFilter(int min, int mag)
|
||||
{
|
||||
sendCommandi(198,(mag << 8)|min);
|
||||
sendCommandi(TEX_FILTER, (mag << 8) | min);
|
||||
}
|
||||
|
||||
@@ -10,5 +10,5 @@
|
||||
|
||||
void sceGuTexFlush(void)
|
||||
{
|
||||
sendCommandf(203,0.0f);
|
||||
sendCommandf(TEX_FLUSH, 0.0f);
|
||||
}
|
||||
|
||||
@@ -10,8 +10,8 @@
|
||||
|
||||
void sceGuTexFunc(int tfx, int tcc)
|
||||
{
|
||||
GuContext* context = &gu_contexts[gu_curr_context];
|
||||
GuContext *context = &gu_contexts[gu_curr_context];
|
||||
context->texture_function = (tcc << 8) | tfx;
|
||||
|
||||
sendCommandi(201,((tcc << 8)|tfx)|context->fragment_2x);
|
||||
sendCommandi(TEX_FUNC, ((tcc << 8) | tfx) | context->fragment_2x);
|
||||
}
|
||||
|
||||
@@ -20,5 +20,5 @@ void sceGuTexLevelMode(unsigned int mode, float bias)
|
||||
else if (offset < -128)
|
||||
offset = -128;
|
||||
|
||||
sendCommandi(200,(((unsigned int)(offset)) << 16) | mode);
|
||||
sendCommandi(TEX_LEVEL, (((unsigned int)(offset)) << 16) | mode);
|
||||
}
|
||||
|
||||
@@ -10,10 +10,10 @@
|
||||
|
||||
void sceGuTexMapMode(int mode, unsigned int a1, unsigned int a2)
|
||||
{
|
||||
GuContext* context = &gu_contexts[gu_curr_context];
|
||||
GuContext *context = &gu_contexts[gu_curr_context];
|
||||
|
||||
context->texture_map_mode = mode & 0x03;
|
||||
|
||||
sendCommandi(192,context->texture_proj_map_mode | (mode & 0x03));
|
||||
sendCommandi(193,(a2 << 8)|(a1 & 0x03));
|
||||
sendCommandi(TEX_MAP_MODE, context->texture_proj_map_mode | (mode & 0x03));
|
||||
sendCommandi(TEX_SHADE_MAPPING, (a2 << 8) | (a1 & 0x03));
|
||||
}
|
||||
|
||||
@@ -10,11 +10,11 @@
|
||||
|
||||
void sceGuTexMode(int tpsm, int maxmips, int a2, int swizzle)
|
||||
{
|
||||
GuContext* context = &gu_contexts[gu_curr_context];
|
||||
GuContext *context = &gu_contexts[gu_curr_context];
|
||||
context->texture_mode = tpsm;
|
||||
|
||||
sendCommandi(194,(maxmips << 16) | (a2 << 8) | (swizzle));
|
||||
sendCommandi(195,tpsm);
|
||||
sendCommandi(TEX_MODE, (maxmips << 16) | (a2 << 8) | (swizzle));
|
||||
sendCommandi(TEX_FORMAT, tpsm);
|
||||
|
||||
sceGuTexFlush();
|
||||
}
|
||||
|
||||
@@ -10,6 +10,6 @@
|
||||
|
||||
void sceGuTexOffset(float u, float v)
|
||||
{
|
||||
sendCommandf(74,u);
|
||||
sendCommandf(75,v);
|
||||
sendCommandf(TEX_OFFSET_U, u);
|
||||
sendCommandf(TEX_OFFSET_V, v);
|
||||
}
|
||||
|
||||
@@ -10,8 +10,8 @@
|
||||
|
||||
void sceGuTexProjMapMode(int mode)
|
||||
{
|
||||
GuContext* context = &gu_contexts[gu_curr_context];
|
||||
GuContext *context = &gu_contexts[gu_curr_context];
|
||||
|
||||
context->texture_proj_map_mode = ((mode & 0x03) << 8);
|
||||
sendCommandi(192,((mode & 0x03) << 8) | context->texture_map_mode);
|
||||
sendCommandi(TEX_MAP_MODE, ((mode & 0x03) << 8) | context->texture_map_mode);
|
||||
}
|
||||
|
||||
@@ -10,6 +10,6 @@
|
||||
|
||||
void sceGuTexScale(float u, float v)
|
||||
{
|
||||
sendCommandf(72,u);
|
||||
sendCommandf(73,v);
|
||||
sendCommandf(TEX_SCALE_U, u);
|
||||
sendCommandf(TEX_SCALE_V, v);
|
||||
}
|
||||
|
||||
@@ -10,5 +10,5 @@
|
||||
|
||||
void sceGuTexSlope(float slope)
|
||||
{
|
||||
sendCommandf(208,slope);
|
||||
sendCommandf(TEX_LOD_SLOPE, slope);
|
||||
}
|
||||
|
||||
@@ -10,5 +10,5 @@
|
||||
|
||||
void sceGuTexSync()
|
||||
{
|
||||
sendCommandi(204,0);
|
||||
sendCommandi(TEX_SYNC, 0);
|
||||
}
|
||||
|
||||
@@ -10,5 +10,5 @@
|
||||
|
||||
void sceGuTexWrap(int u, int v)
|
||||
{
|
||||
sendCommandi(199,(v << 8)|(u));
|
||||
sendCommandi(TEX_WRAP, (v << 8) | (u));
|
||||
}
|
||||
|
||||
@@ -10,8 +10,8 @@
|
||||
|
||||
void sceGuViewport(int cx, int cy, int width, int height)
|
||||
{
|
||||
sendCommandf(66,(float)(width>>1));
|
||||
sendCommandf(67,(float)((-height)>>1));
|
||||
sendCommandf(69,(float)cx);
|
||||
sendCommandf(70,(float)cy);
|
||||
sendCommandf(VIEWPORT_X_SCALE, (float)(width >> 1));
|
||||
sendCommandf(VIEWPORT_Y_SCALE, (float)((-height) >> 1));
|
||||
sendCommandf(VIEWPORT_X_CENTER, (float)cx);
|
||||
sendCommandf(VIEWPORT_Y_CENTER, (float)cy);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user