n64 pixel format

This commit is contained in:
lif 2023-12-12 22:47:11 -08:00
parent 6218568cc5
commit 7813578631
5 changed files with 13 additions and 4 deletions

View File

@ -441,9 +441,9 @@ else ifeq ($(platform), n64)
CXX = $(N64_INST)/bin/mips64-elf-g++$(EXE_EXT)
AR = $(N64_INST)/bin/mips64-elf-ar$(EXE_EXT)
CFLAGS += -fomit-frame-pointer -ffast-math
CFLAGS += -DNINTENDO64 -DUSE_XBGR1555_FORMAT -DSMALL_TRANSLATION_CACHE -DROM_BUFFER_SIZE=4
CFLAGS += -DNINTENDO64 -DUSE_RGBA5551_FORMAT -DSMALL_TRANSLATION_CACHE -DROM_BUFFER_SIZE=4
CFLAGS += -I$(N64_INST)/include/
HAVE_DYNAREC = 1
HAVE_DYNAREC = 0
CPU_ARCH := mips
STATIC_LINKING = 1
FRONTEND_SUPPORTS_RGB565 = 0

View File

@ -81,6 +81,9 @@
#if defined(USE_XBGR1555_FORMAT)
#define convert_palette(value) \
(value & 0x7FFF)
#elif defined(USE_RGBA5551_FORMAT)
#define convert_palette(value) \
(((value & 0x1F) << 11) | ((value & 0x03E0) << 1) | ((value & 0x7C00) >> 9) | 1)
#else
#define convert_palette(value) \
(((value & 0x1F) << 11) | ((value & 0x03E0) << 1) | ((value >> 10) & 0x1F))

View File

@ -2364,6 +2364,12 @@ static void emit_pmemst_stub(
/* PS2's native format */
#define palette_convert() \
mips_emit_andi(reg_temp, reg_a1, 0x7FFF);
#elif defined(USE_RGBA5551_FORMAT)
/* N64's native format */
//#error "TODO"
#define palette_convert() \
mips_emit_sll(reg_temp, reg_a1, 1); \
mips_emit_ori(reg_temp, reg_temp, 1);
#else
/* 0BGR to RGB565 (clobbers a0) */
#ifdef MIPS_HAS_R2_INSTS

View File

@ -615,7 +615,7 @@ fnptrs:
# Make this section executable!
.text
#if defined(PSP) || defined(PS2)
#if defined(PSP) || defined(PS2) || defined(NINTENDO64)
.section .bss
#else
# Need to mark the section as awx (for Linux)

View File

@ -1655,7 +1655,7 @@ static void order_layers(u32 layer_flags, u32 vcnt)
#define BLND_MSK (SATR_MSK | SATG_MSK | SATB_MSK)
#ifdef USE_XBGR1555_FORMAT
#if defined(USE_XBGR1555_FORMAT) || defined(USE_RGBA5551_FORMAT)
#define OVFG_MSK 0x04000000
#define OVFR_MSK 0x00008000
#define OVFB_MSK 0x00000020