//#define CLIP_DEBUG #include #include #include typedef u_long128 uint128; typedef union QWord QWord; union QWord { u_long128 q_u128; u_long q_u64[2]; u_int q_u32[4]; float q_f[4]; }; #define MAKE128(RES,MSB,LSB) \ __asm__ ( "pcpyld %0, %1, %2" : "=r" (RES) : "r" ((uint64)MSB), "r" ((uint64)LSB)) #define UINT64(HIGH,LOW) (((uint64)(uint32)HIGH)<<32 | ((uint64)(uint32)LOW)) #define MAKEQ(RES,W3,W2,W1,W0) MAKE128(RES,UINT64(W3,W2),UINT64(W1,W0)) enum { IntFlg = 0x80000000, DMAcnt = 0x10000000, DMAref = 0x30000000, DMAcall = 0x50000000, DMAret = 0x60000000, DMAend = 0x70000000, VIFnop = 0, VIFoffset = 0x02000000, VIFbase = 0x03000000, VIFitop = 0x04000000, VIFstmod = 0x05000000, VIFmskpath3 = 0x06008000, VIFunmskpath3 = 0x06000000, VIFmark = 0x07000000, VIFflushe = 0x10000000, VIFflush = 0x11000000, VIFflusha = 0x13000000, VIFmscal = 0x14000000, VIFmscalf = 0x15000000, VIFmscnt = 0x17000000, VIFstmask = 0x20000000, VIFstrow = 0x30000000, VIFstcol = 0x31000000, VIFdirect = 0x50000000, V4_32 = 0x6C }; #define UNPACK(type, nq, offset) ((type)<<24 | (nq)<<16 | (offset)) #define STCYCL(WL,CL) (0x01000000 | (WL)<<8 | (CL)) #include using rw::uint8; using rw::int8; using rw::uint16; using rw::int16; using rw::uint32; using rw::int32; using rw::uint64; using rw::int64; using rw::float32; using rw::bool32; extern uint gifPacksz, gifBufSize; extern uint vifPacksz, vifBufSize; extern QWord *gifPacket, *vifPacket; #include "rwinc.h" //#define PAL #define SCREEN_WIDTH 640 #ifdef PAL #define SCREEN_HEIGHT 512 #define VIDEOMODE SCE_GS_PAL #else #define SCREEN_HEIGHT 448 #define VIDEOMODE SCE_GS_NTSC #endif void *ps2fopen(const char *path, const char *mode); int ps2fclose(void *fp); int ps2fseek(void *fp, long offset, int whence); long ps2ftell(void *fp); size_t ps2fread(void *ptr, size_t size, size_t nmemb, void *fp); size_t ps2fwrite(const void *ptr, size_t size, size_t nmemb, void *fp); int ps2feof(void *fp); void StartTime(void); int GetTime(void); float GetTimeF(void); struct PadData { union { ushort bits; struct { ushort l2 : 1; ushort r2 : 1; ushort l1 : 1; ushort r1 : 1; ushort triangle : 1; ushort circle : 1; ushort cross : 1; ushort square : 1; ushort select : 1; ushort l3 : 1; ushort r3 : 1; ushort start : 1; ushort Dup : 1; ushort Dright : 1; ushort Ddown : 1; ushort Dleft : 1; }; }; /* down/right is positive */ float rX, rY; float lX, lY; }; struct Pad { PadData prev, now; PadData rising, falling; }; float PadAnalog(int x); void ReadPad(PadData *pad); void UpdatePad(Pad *pad); void InitPad(void); extern bool gotPadirx; extern Pad pad; struct SceneStruct { rw::World *world; rw::Camera *camera; rw::Clump *clump; rw::Clump *backgroundClump; rw::Light *ambient; rw::Light *direct; rw::Texture *tex; }; extern SceneStruct Scene; namespace rw { namespace gta { enum { VEND_ROCKSTAR = 0x0253F2, ID_NODENAME = MAKEPLUGINID(VEND_ROCKSTAR, 0xFE) }; void registerNodeNamePlugin(void); char *getNodeName(rw::Frame *f); } }