More work on emu64

This commit is contained in:
Cuyler36
2025-04-08 11:07:06 -04:00
parent fe68a87a77
commit 1d8860ab1d
9 changed files with 156 additions and 89 deletions
+6 -6
View File
@@ -250,7 +250,7 @@ typedef union GXTexFmts {
u32 raw;
} GXTexFmts;
static inline void get_blk_wd_ht(unsigned int siz, unsigned int* blk_wd, unsigned int* blk_ht) {
inline void get_blk_wd_ht(unsigned int siz, unsigned int* blk_wd, unsigned int* blk_ht) {
static u8 blk_tbl[4][2] = {
{ 8, 8 }, // G_IM_SIZ_4b
{ 8, 4 }, // G_IM_SIZ_8b
@@ -264,7 +264,7 @@ static inline void get_blk_wd_ht(unsigned int siz, unsigned int* blk_wd, unsigne
extern void get_dol_wd_ht(unsigned int siz, unsigned int in_wd, unsigned int in_ht, unsigned int* wd, unsigned int* ht);
static inline unsigned int rgba5551_to_rgb5a3(unsigned int rgba5551) {
inline unsigned int rgba5551_to_rgb5a3(unsigned int rgba5551) {
unsigned int rgb5a3;
switch (rgba5551 & 1) {
@@ -279,7 +279,7 @@ static inline unsigned int rgba5551_to_rgb5a3(unsigned int rgba5551) {
return rgb5a3;
}
static inline unsigned int get_dol_tex_siz(unsigned int siz, unsigned int in_wd, unsigned int in_ht) {
inline unsigned int get_dol_tex_siz(unsigned int siz, unsigned int in_wd, unsigned int in_ht) {
unsigned int wd;
unsigned int ht;
@@ -287,7 +287,7 @@ static inline unsigned int get_dol_tex_siz(unsigned int siz, unsigned int in_wd,
return ((wd * ht) << siz) / 2;
}
static inline unsigned int get_dol_tlut_siz(unsigned int count) {
inline unsigned int get_dol_tlut_siz(unsigned int count) {
unsigned int siz = count * sizeof(u16);
return ALIGN_NEXT(siz, 32);
}
@@ -489,7 +489,7 @@ class emu64_print {
};
#define EMU64_ASSERTLINE(cond, line) \
if (!cond) { \
if (!(cond)) { \
this->panic(#cond, __FILE__, line); \
}
@@ -579,7 +579,7 @@ class emu64 : public emu64_print {
unsigned int start_wd, unsigned int start_ht, unsigned int end_wd, unsigned int end_ht,
unsigned int line_siz);
unsigned int tmem_swap(unsigned int ofs, unsigned int blk_siz) {
return ofs ^ ((ofs / blk_siz) & 4);
return ofs ^ (((ofs / blk_siz) >> 1) & 4);
}
void tlutconv_rgba5551(u16* rgba5551_p, u16* rgb5a3_p, unsigned int count);
void tlutconv_ia16(u16* src_ia16_p, u16* dst_ia16_p, unsigned int count);
+1 -1
View File
@@ -17,7 +17,7 @@ extern void emu64_init();
extern void emu64_refresh();
extern void emu64_cleanup();
extern void emu64_texture_cache_data_entry_set(u8* cache_start, u8* cache_end);
extern void emu64_texture_cache_data_entry_set(void* begin, void* end);
#ifdef __cplusplus
}
+2 -8
View File
@@ -6,6 +6,7 @@
#ifdef __cplusplus
extern "C" {
#endif
#define TEX_CACHE_ALIGNMENT (32 - 1) /* 32 byte alignment */
#define NUM_TEXTURE_CACHE_DATA 10
@@ -61,17 +62,10 @@ typedef struct texture_cache_s {
/* TMEM map */
// static tmem_t tmem_map[TMEM_ENTRIES];
/* Shared alloc function */
void* texture_cache_alloc(texture_cache_t* cache, u32 size);
/* .data cache functions */
void* texture_cache_data_search(void* addr);
int texture_cache_data_entry(void* original, void* converted);
#define TEX_BUFFER_DATA_SIZE 0xC000
#define TEX_BUFFER_BSS_SIZE 0x1000
extern texture_cache_t* texture_cache_select(void* address);
#ifdef __cplusplus
}
#endif
+9
View File
@@ -262,6 +262,15 @@ typedef struct {
unsigned int d1:4;
} Gsetcombine_tev;
typedef struct {
int cmd:8;
unsigned int upper0:8;
unsigned int lower0:16;
unsigned int upper1:16;
unsigned int lower1:16;
} Gsetcombine_raw;
typedef struct {
unsigned int cmd:8;
unsigned int xl:12; /* Top-left x coord */
+4
View File
@@ -43,7 +43,11 @@ typedef u32 unknown;
#define FALSE 0
#ifndef NULL
#ifndef __cplusplus
#define NULL ((void*)0)
#else
#define NULL 0
#endif
#endif
#define nullptr 0