Add libgpu

This commit is contained in:
Luciano Ciccariello 2022-01-18 20:16:26 +00:00
parent dd8ffa9d5f
commit 8105db32e4
6 changed files with 134 additions and 17 deletions

View File

@ -857,6 +857,7 @@ c_strShield = 0x800A8408;
c_strMedicine = 0x800A840C;
c_strDarkMethamorphosis = 0x800A8410;
rect = 0x800ACD98;
c_backbufferClear = 0x800ACDA0;
aPbav = 0x800B107C;
aPbav_0 = 0x800B407C;
aPbav_2 = 0x800B607C;

View File

@ -93,6 +93,7 @@ extern const char *c_strSystem;
extern const char *c_strFamiliars;
extern const char *c_strFamiliar;
extern const char *c_strSpecial2;
extern RECT c_backbufferClear;
extern u8 D_80137460;
extern s32 D_801375DC;
extern s32 D_801375FC;

View File

@ -1,22 +1,7 @@
#ifndef MAIN_H
#define MAIN_H
#include <psxsdk/libetc.h>
typedef struct
{
u32 tag;
u8 r0;
u8 g0;
u8 b0;
u8 code;
s16 x0;
s16 y0;
s8 u0;
s8 v0;
u16 clut;
s16 w;
s16 h;
} SPRT;
#include <psxsdk/libgpu.h>
extern s32 D_8003925C;
extern s32 D_8003C734;

121
include/psxsdk/libgpu.h Normal file
View File

@ -0,0 +1,121 @@
#ifndef LIBGPU_H
#define LIBGPU_H
#include <types.h>
typedef struct {
short x, y; /* offset point on VRAM */
short w, h; /* width and height */
} RECT;
typedef struct {
u_long tag;
u_long code[15];
} DR_ENV; /* Packed Drawing Environment */
typedef struct {
u_long tag;
u_char r0, g0, b0, code;
short x0, y0;
u_char u0, v0; u_short clut;
u_char r1, g1, b1, p1;
short x1, y1;
u_char u1, v1; u_short tpage;
u_char r2, g2, b2, p2;
short x2, y2;
u_char u2, v2; u_short pad2;
} POLY_GT3; /* Gouraud Textured Triangle */
typedef struct {
u_long tag;
u_char r0, g0, b0, code;
short x0, y0;
u_char r1, g1, b1, pad1;
short x1, y1;
u_char r2, g2, b2, pad2;
short x2, y2;
u_char r3, g3, b3, pad3;
short x3, y3;
} POLY_G4; /* Gouraud Quadrangle */
typedef struct {
u_long tag;
u_char r0, g0, b0, code;
short x0, y0;
u_char u0, v0; u_short clut;
u_char r1, g1, b1, p1;
short x1, y1;
u_char u1, v1; u_short tpage;
u_char r2, g2, b2, p2;
short x2, y2;
u_char u2, v2; u_short pad2;
u_char r3, g3, b3, p3;
short x3, y3;
u_char u3, v3; u_short pad3;
} POLY_GT4; /* Gouraud Textured Quadrangle */
typedef struct {
u_long tag;
u_char r0, g0, b0, code;
short x0, y0;
u_char u0, v0; u_short clut;
short w, h;
} SPRT; /* free size Sprite */
typedef struct {
u_long tag;
u_char r0, g0, b0, code;
short x0, y0;
u_char u0, v0; u_short clut;
} SPRT_16; /* 16x16 Sprite */
typedef struct {
u_long tag;
u_char r0, g0, b0, code;
short x0, y0;
u_char u0, v0; u_short clut;
} SPRT_8; /* 8x8 Sprite */
typedef struct {
RECT clip; /* clip area */
short ofs[2]; /* drawing offset */
RECT tw; /* texture window */
u_short tpage; /* texture page */
u_char dtd; /* dither flag (0:off, 1:on) */
u_char dfe; /* flag to draw on display area (0:off 1:on) */
u_char isbg; /* enable to auto-clear */
u_char r0, g0, b0; /* initital background color */
DR_ENV dr_env; /* reserved */
} DRAWENV;
typedef struct {
RECT disp; /* display area */
RECT screen; /* display start point */
u_char isinter; /* interlace 0: off 1: on */
u_char isrgb24; /* RGB24 bit mode */
u_char pad0, pad1; /* reserved */
} DISPENV;
extern void SetShadeTex(void *p, int tge);
extern void SetPolyGT3(POLY_GT3 *p);
extern void SetPolyG4(POLY_G4 *p);
extern void SetPolyGT4(POLY_GT4 *p);
extern void SetSprt(SPRT *p);
extern void SetSprt16(SPRT_16 *p);
extern void SetSprt8(SPRT_8 *p);
extern int ResetGraph(int mode);
extern int SetGraphReverse(int mode);
extern int SetGraphQueue(int mode);
extern u_long DrawSyncCallback(void (*func)());
extern void SetDispMask(int mask);
extern int DrawSync(int mode);
extern int ClearImage(RECT *rect, u_char r, u_char g, u_char b);
extern int LoadImage(RECT *rect, u_long *p);
extern int StoreImage(RECT *rect, u_long *p);
extern int MoveImage(RECT *rect, int x, int y);
extern u_long *ClearOTag(u_long *ot, int n);
extern u_long *ClearOTagR(u_long *ot, int n);
extern void DrawOTag(u_long *p);
extern DRAWENV *PutDrawEnv(DRAWENV *env);
extern DISPENV *PutDispEnv(DISPENV *env);
#endif

View File

@ -9,6 +9,9 @@ typedef unsigned char uint8_t;
typedef unsigned short uint16_t;
typedef unsigned int uint32_t;
typedef unsigned long long uint64_t;
typedef unsigned char u_char;
typedef unsigned short u_short;
typedef unsigned int u_long;
typedef signed char s8;
typedef signed short s16;

View File

@ -51,7 +51,13 @@ void func_800E4124(s32 context) {
INCLUDE_ASM("asm/dra/nonmatchings/42398", func_800E414C);
INCLUDE_ASM("asm/dra/nonmatchings/42398", func_800E44EC);
#ifndef NON_MATCHING
INCLUDE_ASM("asm/dra/nonmatchings/42398", func_800E44EC)
#else
void func_800E44EC(void) {
ClearImage(&c_backbufferClear, 0, 0, 0);
}
#endif
INCLUDE_ASM("asm/dra/nonmatchings/42398", func_800E451C);