engine-psx/include/util.h

28 lines
867 B
C
Raw Normal View History

2024-07-12 20:48:23 -03:00
#ifndef UTIL_H
#define UTIL_H
2024-07-15 03:37:57 -03:00
#include <psxgpu.h>
2024-07-12 20:48:23 -03:00
#include <psxgte.h>
#define BCD_TO_DEC(x) (((x & 0xF0) >> 4) * 10 + (x & 0x0F))
2024-08-12 23:33:34 -03:00
#define SIGNUM(x) (x < 0 ? -1 : 1)
2024-07-16 18:25:18 -03:00
int RotTransPers(SVECTOR *v, uint32_t *xy0);
2024-07-12 20:48:23 -03:00
int RotAverageNclip4(SVECTOR *a, SVECTOR *b, SVECTOR *c, SVECTOR *d,
2024-07-16 18:25:18 -03:00
uint32_t *xy0, uint32_t *xy1, uint32_t *xy2, uint32_t *xy3,
2024-07-12 20:48:23 -03:00
int *otz);
void CrossProduct0(VECTOR *v0, VECTOR *v1, VECTOR *out);
void CrossProduct12(VECTOR *v0, VECTOR *v1, VECTOR *out);
2024-07-12 20:48:23 -03:00
2024-07-15 17:53:40 -03:00
uint8_t *file_read(const char *filename, uint32_t *length);
void load_texture(uint8_t *data, TIM_IMAGE *tim);
2024-07-15 03:37:57 -03:00
2024-07-15 17:53:40 -03:00
uint8_t get_byte(uint8_t *bytes, uint32_t *b);
uint16_t get_short_be(uint8_t *bytes, uint32_t *b);
uint16_t get_short_le(uint8_t *bytes, uint32_t *b);
uint32_t get_long_be(uint8_t *bytes, uint32_t *b);
2024-07-15 03:37:57 -03:00
2024-07-21 19:43:49 -03:00
uint32_t adler32(const char *s);
2024-07-12 20:48:23 -03:00
#endif