example/q3bsp: add textures

This commit is contained in:
Zack Buhman 2025-04-22 22:43:54 -05:00
parent 534ffb60af
commit 670ce0710d
52 changed files with 2257 additions and 113 deletions

View File

@ -1019,6 +1019,27 @@ Q3BSP_OBJ = \
printf/parse.o \ printf/parse.o \
pk/maps/20kdm2.bsp.o \ pk/maps/20kdm2.bsp.o \
interrupt.o \ interrupt.o \
pk/textures/e7/e7walldesign01b.data.o \
pk/textures/e7/e7steptop2.data.o \
pk/textures/e7/e7dimfloor.data.o \
pk/textures/e7/e7brickfloor01.data.o \
pk/textures/e7/e7bmtrim.data.o \
pk/textures/e7/e7sbrickfloor.data.o \
pk/textures/e7/e7brnmetal.data.o \
pk/textures/e7/e7beam02_red.data.o \
pk/textures/e7/e7swindow.data.o \
pk/textures/e7/e7bigwall.data.o \
pk/textures/e7/e7panelwood.data.o \
pk/textures/e7/e7beam01.data.o \
pk/textures/gothic_floor/xstepborder5.data.o \
pk/textures/liquids/lavahell.data.o \
pk/textures/e7/e7steptop.data.o \
pk/textures/gothic_trim/metalblackwave01.data.o \
pk/textures/stone/pjrock1.data.o \
pk/models/mapobjects/timlamp/timlamp.data.o \
pk/textures/sfx/flame2.data.o \
pk/models/mapobjects/gratelamp/gratetorch2.data.o \
pk/models/mapobjects/gratelamp/gratetorch2b.data.o \
$(LIBGCC) $(LIBGCC)
example/q3bsp.elf: LDSCRIPT = $(LIB)/main.lds example/q3bsp.elf: LDSCRIPT = $(LIB)/main.lds

View File

@ -17,6 +17,8 @@
#include "memorymap.hpp" #include "memorymap.hpp"
#include "sh7091/sh7091.hpp"
#include "sh7091/sh7091_bits.hpp"
#include "sh7091/serial.hpp" #include "sh7091/serial.hpp"
#include "printf/printf.h" #include "printf/printf.h"
@ -31,6 +33,30 @@
#include "interrupt.hpp" #include "interrupt.hpp"
#include "pk/textures/e7/e7walldesign01b.data.h"
#include "pk/textures/e7/e7steptop2.data.h"
#include "pk/textures/e7/e7dimfloor.data.h"
#include "pk/textures/e7/e7brickfloor01.data.h"
#include "pk/textures/e7/e7bmtrim.data.h"
#include "pk/textures/e7/e7sbrickfloor.data.h"
#include "pk/textures/e7/e7brnmetal.data.h"
#include "pk/textures/e7/e7beam02_red.data.h"
#include "pk/textures/e7/e7swindow.data.h"
#include "pk/textures/e7/e7bigwall.data.h"
#include "pk/textures/e7/e7panelwood.data.h"
#include "pk/textures/e7/e7beam01.data.h"
#include "pk/textures/gothic_floor/xstepborder5.data.h"
#include "pk/textures/liquids/lavahell.data.h"
#include "pk/textures/e7/e7steptop.data.h"
#include "pk/textures/gothic_trim/metalblackwave01.data.h"
#include "pk/textures/stone/pjrock1.data.h"
#include "pk/models/mapobjects/timlamp/timlamp.data.h"
#include "pk/textures/sfx/flame2.data.h"
#include "pk/models/mapobjects/gratelamp/gratetorch2.data.h"
#include "pk/models/mapobjects/gratelamp/gratetorch2b.data.h"
#include "pk/texture.h"
using vec2 = vec<2, float>; using vec2 = vec<2, float>;
using vec3 = vec<3, float>; using vec3 = vec<3, float>;
using vec4 = vec<4, float>; using vec4 = vec<4, float>;
@ -169,14 +195,18 @@ static inline vec3 screen_transform(vec3 v)
}; };
} }
void global_polygon_type_1(ta_parameter_writer& writer) void global_polygon_type_1(ta_parameter_writer& writer,
uint32_t obj_control_texture,
uint32_t texture_u_v_size,
uint32_t texture_control_word)
{ {
const uint32_t parameter_control_word = para_control::para_type::polygon_or_modifier_volume const uint32_t parameter_control_word = para_control::para_type::polygon_or_modifier_volume
| para_control::list_type::opaque | para_control::list_type::opaque
| obj_control::col_type::intensity_mode_1 | obj_control::col_type::intensity_mode_1
| obj_control::gouraud | obj_control::gouraud
| obj_control::shadow | obj_control_texture
; ;
const uint32_t isp_tsp_instruction_word = isp_tsp_instruction_word::depth_compare_mode::greater const uint32_t isp_tsp_instruction_word = isp_tsp_instruction_word::depth_compare_mode::greater
| isp_tsp_instruction_word::culling_mode::no_culling | isp_tsp_instruction_word::culling_mode::no_culling
; ;
@ -184,10 +214,11 @@ void global_polygon_type_1(ta_parameter_writer& writer)
const uint32_t tsp_instruction_word = tsp_instruction_word::fog_control::no_fog const uint32_t tsp_instruction_word = tsp_instruction_word::fog_control::no_fog
| tsp_instruction_word::src_alpha_instr::one | tsp_instruction_word::src_alpha_instr::one
| tsp_instruction_word::dst_alpha_instr::zero | tsp_instruction_word::dst_alpha_instr::zero
| tsp_instruction_word::filter_mode::bilinear_filter
| tsp_instruction_word::texture_shading_instruction::modulate
| texture_u_v_size
; ;
const uint32_t texture_control_word = 0;
const float a = 1.0f; const float a = 1.0f;
const float r = 1.0f; const float r = 1.0f;
const float g = 1.0f; const float g = 1.0f;
@ -205,6 +236,26 @@ void global_polygon_type_1(ta_parameter_writer& writer)
); );
} }
void global_texture(ta_parameter_writer& writer, int ix)
{
struct pk_texture * texture = &textures[ix];
uint32_t texture_u_v_size = tsp_instruction_word::texture_u_size::from_int(texture->width)
| tsp_instruction_word::texture_v_size::from_int(texture->height)
;
uint32_t texture_address = texture_memory_alloc.texture.start + texture->offset * 2;
uint32_t texture_control_word = texture_control_word::pixel_format::_565
| texture_control_word::scan_order::non_twiddled
| texture_control_word::texture_address(texture_address / 8)
;
global_polygon_type_1(writer,
obj_control::texture,
texture_u_v_size,
texture_control_word);
}
void transform_vertices(uint8_t * buf, int length, mat4x4& trans) void transform_vertices(uint8_t * buf, int length, mat4x4& trans)
{ {
q3bsp_vertex_t * vert = reinterpret_cast<q3bsp_vertex_t *>(buf); q3bsp_vertex_t * vert = reinterpret_cast<q3bsp_vertex_t *>(buf);
@ -222,7 +273,7 @@ void transform_vertices(uint8_t * buf, int length, mat4x4& trans)
} }
} }
static inline void render_tri(ta_parameter_writer& writer, static inline void render_tri_type_2(ta_parameter_writer& writer,
vec3 ap, vec3 ap,
vec3 bp, vec3 bp,
vec3 cp, vec3 cp,
@ -246,6 +297,39 @@ static inline void render_tri(ta_parameter_writer& writer,
ci); ci);
} }
static inline void render_tri_type_7(ta_parameter_writer& writer,
vec3 ap,
vec3 bp,
vec3 cp,
vec2 at,
vec2 bt,
vec2 ct,
float ai,
float bi,
float ci)
{
writer.append<ta_vertex_parameter::polygon_type_7>() =
ta_vertex_parameter::polygon_type_7(polygon_vertex_parameter_control_word(false),
ap.x, ap.y, ap.z,
at.x, at.y,
ai,
0);
writer.append<ta_vertex_parameter::polygon_type_7>() =
ta_vertex_parameter::polygon_type_7(polygon_vertex_parameter_control_word(false),
bp.x, bp.y, bp.z,
bt.x, bt.y,
bi,
0);
writer.append<ta_vertex_parameter::polygon_type_7>() =
ta_vertex_parameter::polygon_type_7(polygon_vertex_parameter_control_word(true),
cp.x, cp.y, cp.z,
ct.x, ct.y,
ci,
0);
}
static inline float inverse_length(vec3 v) static inline float inverse_length(vec3 v)
{ {
float f = dot(v, v); float f = dot(v, v);
@ -267,21 +351,41 @@ float light_intensity(vec3 light_vec, vec3 n)
void transfer_faces(uint8_t * buf, q3bsp_header_t * header, ta_parameter_writer& writer) void transfer_faces(uint8_t * buf, q3bsp_header_t * header, ta_parameter_writer& writer)
{ {
q3bsp_direntry * ve = &header->direntries[LUMP_VERTEXES];
q3bsp_direntry * me = &header->direntries[LUMP_MESHVERTS]; q3bsp_direntry * me = &header->direntries[LUMP_MESHVERTS];
q3bsp_direntry * fe = &header->direntries[LUMP_FACES]; q3bsp_direntry * fe = &header->direntries[LUMP_FACES];
q3bsp_vertex_t * vert = reinterpret_cast<q3bsp_vertex_t *>(&buf[ve->offset]);
q3bsp_meshvert_t * meshvert = reinterpret_cast<q3bsp_meshvert_t *>(&buf[me->offset]); q3bsp_meshvert_t * meshvert = reinterpret_cast<q3bsp_meshvert_t *>(&buf[me->offset]);
q3bsp_face_t * face = reinterpret_cast<q3bsp_face_t *>(&buf[fe->offset]); q3bsp_face_t * face = reinterpret_cast<q3bsp_face_t *>(&buf[fe->offset]);
int face_count = fe->length / (sizeof (struct q3bsp_face)); int face_count = fe->length / (sizeof (struct q3bsp_face));
const vec3 light_vec = {20, 20, 200}; const vec3 light_vec = {20, 20, 20};
int textures_length = (sizeof (textures)) / (sizeof (textures[0]));
int last_texture = -1;
for (int i = 0; i < face_count; i++) { for (int i = 0; i < face_count; i++) {
int meshvert_ix = face[i].meshvert; int meshvert_ix = face[i].meshvert;
q3bsp_meshvert_t * mv = &meshvert[meshvert_ix]; q3bsp_meshvert_t * mv = &meshvert[meshvert_ix];
int triangles = face[i].n_meshverts / 3; int triangles = face[i].n_meshverts / 3;
bool has_texture = 1 &&
(face[i].texture >= 0) &&
(face[i].texture < textures_length) &&
(textures[face[i].texture].size != 0);
if (face[i].texture != last_texture) {
last_texture = face[i].texture;
if (has_texture) {
global_texture(writer, face[i].texture);
} else {
global_polygon_type_1(writer, 0, 0, 0);
}
}
for (int j = 0; j < triangles; j++) { for (int j = 0; j < triangles; j++) {
int aix = mv[j * 3 + 0].offset + face[i].vertex; int aix = mv[j * 3 + 0].offset + face[i].vertex;
@ -297,7 +401,7 @@ void transfer_faces(uint8_t * buf, q3bsp_header_t * header, ta_parameter_writer&
} }
vec3 n = vertex_cache[aix].normal; vec3 n = vertex_cache[aix].normal;
float i = light_intensity(light_vec, n); float li = light_intensity(light_vec, n);
/* /*
printf("{%f %f %f} {%f %f %f} {%f %f %f}\n", printf("{%f %f %f} {%f %f %f} {%f %f %f}\n",
@ -306,62 +410,51 @@ void transfer_faces(uint8_t * buf, q3bsp_header_t * header, ta_parameter_writer&
cp.x, cp.y, cp.z); cp.x, cp.y, cp.z);
*/ */
render_tri(writer,
if (has_texture) {
float v_mul = textures[face[i].texture].v_mul;
vec2 at = {vert[aix].texcoord[0], vert[aix].texcoord[1] * v_mul};
vec2 bt = {vert[bix].texcoord[0], vert[bix].texcoord[1] * v_mul};
vec2 ct = {vert[cix].texcoord[0], vert[cix].texcoord[1] * v_mul};
//printf("{%f %f} {%f %f} {%f %f}\n", at.x, at.y, bt.x, bt.y, ct.x, ct.y);
render_tri_type_7(writer,
ap, ap,
bp, bp,
cp, cp,
i, at,
i, bt,
i); ct,
li,
li,
li);
} else {
render_tri_type_2(writer,
ap,
bp,
cp,
li,
li,
li);
}
} }
} }
} }
/*
name=textures/common/caulk
name=textures/e7/e7walldesign01b
name=textures/e7/e7steptop2
name=noshader
name=textures/e7/e7dimfloor
name=textures/e7/e7brickfloor01
name=textures/e7/e7bmtrim
name=textures/e7/e7sbrickfloor
name=textures/e7/e7brnmetal
name=textures/common/clip
name=textures/e7/e7beam02_red
name=textures/e7/e7swindow
name=textures/e7/e7bigwall
name=textures/e7/e7panelwood
name=textures/e7/e7beam01
name=textures/gothic_floor/xstepborder5
name=textures/liquids/lavahell
name=textures/e7/e7steptop
name=textures/gothic_trim/metalblackwave01
name=textures/stone/pjrock1
name=textures/skies/tim_hell
name=textures/common/hint
name=models/mapobjects/timlamp/timlamp
name=textures/sfx/flame1side
name=textures/sfx/flame2
name=models/mapobjects/gratelamp/gratetorch2
name=models/mapobjects/gratelamp/gratetorch2b
*/
void transfer_scene(ta_parameter_writer& writer, const mat4x4& screen_trans) void transfer_scene(ta_parameter_writer& writer, const mat4x4& screen_trans)
{ {
uint8_t * buf = reinterpret_cast<uint8_t *>(&_binary_pk_maps_20kdm2_bsp_start); uint8_t * buf = reinterpret_cast<uint8_t *>(&_binary_pk_maps_20kdm2_bsp_start);
q3bsp_header_t * header = reinterpret_cast<q3bsp_header_t *>(buf); q3bsp_header_t * header = reinterpret_cast<q3bsp_header_t *>(buf);
debug_print_q3bsp(buf, header); //debug_print_q3bsp(buf, header);
while(1); //while(1);
mat4x4 trans = screen_trans; mat4x4 trans = screen_trans;
q3bsp_direntry * ve = &header->direntries[LUMP_VERTEXES]; q3bsp_direntry * ve = &header->direntries[LUMP_VERTEXES];
transform_vertices(&buf[ve->offset], ve->length, trans); transform_vertices(&buf[ve->offset], ve->length, trans);
global_polygon_type_1(writer);
transfer_faces(buf, header, writer); transfer_faces(buf, header, writer);
writer.append<ta_global_parameter::end_of_list>() = writer.append<ta_global_parameter::end_of_list>() =
@ -403,11 +496,56 @@ constexpr inline mat4x4 rotate_z(float t)
return r; return r;
} }
void transfer_ta_fifo_texture_memory_32byte(void * dst, void * src, int length)
{
uint32_t out_addr = (uint32_t)dst;
sh7091.CCN.QACR0 = ((reinterpret_cast<uint32_t>(out_addr) >> 24) & 0b11100);
sh7091.CCN.QACR1 = ((reinterpret_cast<uint32_t>(out_addr) >> 24) & 0b11100);
volatile uint32_t * base = &store_queue[(out_addr & 0x03ffffc0) / 4];
uint32_t * src32 = reinterpret_cast<uint32_t *>(src);
length = (length + 31) & ~31; // round up to nearest multiple of 32
while (length > 0) {
base[0] = src32[0];
base[1] = src32[1];
base[2] = src32[2];
base[3] = src32[3];
base[4] = src32[4];
base[5] = src32[5];
base[6] = src32[6];
base[7] = src32[7];
asm volatile ("pref @%0"
: // output
: "r" (&base[0]) // input
: "memory");
length -= 32;
base += 8;
src32 += 8;
}
}
void transfer_textures()
{
system.LMMODE0 = 0; // 64-bit address space
system.LMMODE1 = 0; // 64-bit address space
int textures_length = (sizeof (textures)) / (sizeof (textures[0]));
for (int i = 0; i < textures_length; i++) {
uint32_t offset = texture_memory_alloc.texture.start + textures[i].offset * 2;
void * dst = reinterpret_cast<void *>(&ta_fifo_texture_memory[offset / 4]);
void * src = textures[i].start;
uint32_t size = textures[i].size;
transfer_ta_fifo_texture_memory_32byte(dst, src, size);
}
}
int main() int main()
{ {
serial::init(0); serial::init(0);
interrupt_init(); interrupt_init();
transfer_textures();
constexpr uint32_t ta_alloc = 0 constexpr uint32_t ta_alloc = 0
| ta_alloc_ctrl::pt_opb::no_list | ta_alloc_ctrl::pt_opb::no_list

42
pk/gen.sh Normal file
View File

@ -0,0 +1,42 @@
declare -a textures=(
"textures/common/caulk"
"textures/e7/e7walldesign01b"
"textures/e7/e7steptop2"
"noshader"
"textures/e7/e7dimfloor"
"textures/e7/e7brickfloor01"
"textures/e7/e7bmtrim"
"textures/e7/e7sbrickfloor"
"textures/e7/e7brnmetal"
"textures/common/clip"
"textures/e7/e7beam02_red"
"textures/e7/e7swindow"
"textures/e7/e7bigwall"
"textures/e7/e7panelwood"
"textures/e7/e7beam01"
"textures/gothic_floor/xstepborder5"
"textures/liquids/lavahell"
"textures/e7/e7steptop"
"textures/gothic_trim/metalblackwave01"
"textures/stone/pjrock1"
"textures/skies/tim_hell"
"textures/common/hint"
"models/mapobjects/timlamp/timlamp"
"textures/sfx/flame1side"
"textures/sfx/flame2"
"models/mapobjects/gratelamp/gratetorch2"
"models/mapobjects/gratelamp/gratetorch2b"
)
for t in "${textures[@]}"
do
filename=$(ls "$t".{tga,jpg} 2>/dev/null)
if [ -z $filename ]; then
continue;
fi
name="${filename%.*}"
data_name="${name}.data"
echo $data_name
python ~/model_generator/color_convert.py $filename rgb565 non_twiddled $data_name
(cd .. ; make pk/${data_name}.h)
done

1
pk/generate.py Symbolic link
View File

@ -0,0 +1 @@
../regs/gen/generate.py

Binary file not shown.

View File

@ -0,0 +1,15 @@
#pragma once
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
extern uint32_t _binary_pk_models_mapobjects_gratelamp_gratetorch2_data_start __asm("_binary_pk_models_mapobjects_gratelamp_gratetorch2_data_start");
extern uint32_t _binary_pk_models_mapobjects_gratelamp_gratetorch2_data_end __asm("_binary_pk_models_mapobjects_gratelamp_gratetorch2_data_end");
extern uint32_t _binary_pk_models_mapobjects_gratelamp_gratetorch2_data_size __asm("_binary_pk_models_mapobjects_gratelamp_gratetorch2_data_size");
#ifdef __cplusplus
}
#endif

Binary file not shown.

View File

@ -0,0 +1,15 @@
#pragma once
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
extern uint32_t _binary_pk_models_mapobjects_gratelamp_gratetorch2b_data_start __asm("_binary_pk_models_mapobjects_gratelamp_gratetorch2b_data_start");
extern uint32_t _binary_pk_models_mapobjects_gratelamp_gratetorch2b_data_end __asm("_binary_pk_models_mapobjects_gratelamp_gratetorch2b_data_end");
extern uint32_t _binary_pk_models_mapobjects_gratelamp_gratetorch2b_data_size __asm("_binary_pk_models_mapobjects_gratelamp_gratetorch2b_data_size");
#ifdef __cplusplus
}
#endif

Binary file not shown.

View File

@ -0,0 +1,15 @@
#pragma once
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
extern uint32_t _binary_pk_models_mapobjects_timlamp_timlamp_data_start __asm("_binary_pk_models_mapobjects_timlamp_timlamp_data_start");
extern uint32_t _binary_pk_models_mapobjects_timlamp_timlamp_data_end __asm("_binary_pk_models_mapobjects_timlamp_timlamp_data_end");
extern uint32_t _binary_pk_models_mapobjects_timlamp_timlamp_data_size __asm("_binary_pk_models_mapobjects_timlamp_timlamp_data_size");
#ifdef __cplusplus
}
#endif

17
pk/texture.h Normal file
View File

@ -0,0 +1,17 @@
#pragma once
#include <stdint.h>
struct pk_texture {
void * start;
uint32_t size;
uint32_t offset;
int16_t width;
int16_t height;
//float u_mul;
float v_mul;
};
struct pk_texture textures[] = {
#include "texture.inc"
};

216
pk/texture.inc Normal file
View File

@ -0,0 +1,216 @@
{
.start = (void *)0,
.size = (uint32_t)0,
.offset = 0,
.width = 0,
.height = 0,
.v_mul = 0, // 0
},
{
.start = (void *)&_binary_pk_textures_e7_e7walldesign01b_data_start,
.size = (uint32_t)&_binary_pk_textures_e7_e7walldesign01b_data_size,
.offset = 0,
.width = 256,
.height = 1024,
.v_mul = 0.625, // 640
},
{
.start = (void *)&_binary_pk_textures_e7_e7steptop2_data_start,
.size = (uint32_t)&_binary_pk_textures_e7_e7steptop2_data_size,
.offset = 163840,
.width = 256,
.height = 32,
.v_mul = 1.0, // 32
},
{
.start = (void *)0,
.size = (uint32_t)0,
.offset = 172032,
.width = 0,
.height = 0,
.v_mul = 0, // 0
},
{
.start = (void *)&_binary_pk_textures_e7_e7dimfloor_data_start,
.size = (uint32_t)&_binary_pk_textures_e7_e7dimfloor_data_size,
.offset = 172032,
.width = 128,
.height = 128,
.v_mul = 1.0, // 128
},
{
.start = (void *)&_binary_pk_textures_e7_e7brickfloor01_data_start,
.size = (uint32_t)&_binary_pk_textures_e7_e7brickfloor01_data_size,
.offset = 188416,
.width = 256,
.height = 256,
.v_mul = 1.0, // 256
},
{
.start = (void *)&_binary_pk_textures_e7_e7bmtrim_data_start,
.size = (uint32_t)&_binary_pk_textures_e7_e7bmtrim_data_size,
.offset = 253952,
.width = 256,
.height = 64,
.v_mul = 1.0, // 64
},
{
.start = (void *)&_binary_pk_textures_e7_e7sbrickfloor_data_start,
.size = (uint32_t)&_binary_pk_textures_e7_e7sbrickfloor_data_size,
.offset = 270336,
.width = 256,
.height = 256,
.v_mul = 1.0, // 256
},
{
.start = (void *)&_binary_pk_textures_e7_e7brnmetal_data_start,
.size = (uint32_t)&_binary_pk_textures_e7_e7brnmetal_data_size,
.offset = 335872,
.width = 256,
.height = 256,
.v_mul = 1.0, // 256
},
{
.start = (void *)0,
.size = (uint32_t)0,
.offset = 401408,
.width = 0,
.height = 0,
.v_mul = 0, // 0
},
{
.start = (void *)&_binary_pk_textures_e7_e7beam02_red_data_start,
.size = (uint32_t)&_binary_pk_textures_e7_e7beam02_red_data_size,
.offset = 401408,
.width = 64,
.height = 128,
.v_mul = 1.0, // 128
},
{
.start = (void *)&_binary_pk_textures_e7_e7swindow_data_start,
.size = (uint32_t)&_binary_pk_textures_e7_e7swindow_data_size,
.offset = 409600,
.width = 256,
.height = 256,
.v_mul = 1.0, // 256
},
{
.start = (void *)&_binary_pk_textures_e7_e7bigwall_data_start,
.size = (uint32_t)&_binary_pk_textures_e7_e7bigwall_data_size,
.offset = 475136,
.width = 256,
.height = 1024,
.v_mul = 0.75, // 768
},
{
.start = (void *)&_binary_pk_textures_e7_e7panelwood_data_start,
.size = (uint32_t)&_binary_pk_textures_e7_e7panelwood_data_size,
.offset = 671744,
.width = 256,
.height = 256,
.v_mul = 1.0, // 256
},
{
.start = (void *)&_binary_pk_textures_e7_e7beam01_data_start,
.size = (uint32_t)&_binary_pk_textures_e7_e7beam01_data_size,
.offset = 737280,
.width = 64,
.height = 256,
.v_mul = 1.0, // 256
},
{
.start = (void *)&_binary_pk_textures_gothic_floor_xstepborder5_data_start,
.size = (uint32_t)&_binary_pk_textures_gothic_floor_xstepborder5_data_size,
.offset = 753664,
.width = 256,
.height = 64,
.v_mul = 0.78125, // 50
},
{
.start = (void *)&_binary_pk_textures_liquids_lavahell_data_start,
.size = (uint32_t)&_binary_pk_textures_liquids_lavahell_data_size,
.offset = 766464,
.width = 128,
.height = 128,
.v_mul = 1.0, // 128
},
{
.start = (void *)&_binary_pk_textures_e7_e7steptop_data_start,
.size = (uint32_t)&_binary_pk_textures_e7_e7steptop_data_size,
.offset = 782848,
.width = 256,
.height = 32,
.v_mul = 1.0, // 32
},
{
.start = (void *)&_binary_pk_textures_gothic_trim_metalblackwave01_data_start,
.size = (uint32_t)&_binary_pk_textures_gothic_trim_metalblackwave01_data_size,
.offset = 791040,
.width = 256,
.height = 256,
.v_mul = 1.0, // 256
},
{
.start = (void *)&_binary_pk_textures_stone_pjrock1_data_start,
.size = (uint32_t)&_binary_pk_textures_stone_pjrock1_data_size,
.offset = 856576,
.width = 256,
.height = 256,
.v_mul = 1.0, // 256
},
{
.start = (void *)0,
.size = (uint32_t)0,
.offset = 922112,
.width = 0,
.height = 0,
.v_mul = 0, // 0
},
{
.start = (void *)0,
.size = (uint32_t)0,
.offset = 922112,
.width = 0,
.height = 0,
.v_mul = 0, // 0
},
{
.start = (void *)&_binary_pk_models_mapobjects_timlamp_timlamp_data_start,
.size = (uint32_t)&_binary_pk_models_mapobjects_timlamp_timlamp_data_size,
.offset = 922112,
.width = 128,
.height = 128,
.v_mul = 1.0, // 128
},
{
.start = (void *)0,
.size = (uint32_t)0,
.offset = 938496,
.width = 0,
.height = 0,
.v_mul = 0, // 0
},
{
.start = (void *)&_binary_pk_textures_sfx_flame2_data_start,
.size = (uint32_t)&_binary_pk_textures_sfx_flame2_data_size,
.offset = 938496,
.width = 128,
.height = 256,
.v_mul = 1.0, // 256
},
{
.start = (void *)&_binary_pk_models_mapobjects_gratelamp_gratetorch2_data_start,
.size = (uint32_t)&_binary_pk_models_mapobjects_gratelamp_gratetorch2_data_size,
.offset = 971264,
.width = 32,
.height = 64,
.v_mul = 1.0, // 64
},
{
.start = (void *)&_binary_pk_models_mapobjects_gratelamp_gratetorch2b_data_start,
.size = (uint32_t)&_binary_pk_models_mapobjects_gratelamp_gratetorch2b_data_size,
.offset = 973312,
.width = 32,
.height = 64,
.v_mul = 1.0, // 64
},

103
pk/texture_gen.py Normal file
View File

@ -0,0 +1,103 @@
from PIL import Image
import sys
from glob import glob
from generate import renderer
from dataclasses import dataclass
from os import path
def read_texture_names():
buf = sys.stdin.read()
lines = buf.strip().split('\n')
return lines
def glob_and_filter(name):
filenames = glob(f"{name}.tga") + glob(f"{name}.jpg")
assert len(filenames) in {0, 1}
filename = filenames[0] if filenames else None
return filename
def image_size(filename):
if filename is None:
return (0, 0)
with Image.open(filename) as im:
return im.size
def npot(v):
v -= 1
v |= v >> 1
v |= v >> 2
v |= v >> 4
v |= v >> 8
v |= v >> 16
v += 1
return v
@dataclass
class Size:
w: int
h: int
@dataclass
class Texture:
name: str
filename: str
real_size: Size
npot_size: Size
offset: int
def texture_metadata():
names = read_texture_names()
acc = 0
for name in names:
filename = glob_and_filter(name)
w, h = image_size(filename)
nw, nh = npot(w), npot(h)
yield Texture(
name,
filename,
Size(w, h),
Size(nw, nh),
acc
)
acc += nw * h
def name_to_bin(filename):
if filename is None:
return None
else:
name, ext = path.splitext(filename)
return "_binary_pk_" + name.replace('/', '_').replace('.', '_') + "_data"
def uv_mul(texture):
u = 0 if texture.npot_size.w == 0 else texture.real_size.w / texture.npot_size.w
v = 0 if texture.npot_size.h == 0 else texture.real_size.h / texture.npot_size.h
return u, v
def render_texture_metadata(texture):
name = name_to_bin(texture.filename)
u, v = uv_mul(texture)
assert u == 1.0 or u == 0.0
start = "0" if name is None else f"&{name}_start"
size = "0" if name is None else f"&{name}_size"
yield "{"
yield f".start = (void *){start},"
yield f".size = (uint32_t){size},"
yield f".offset = {texture.offset},"
yield f".width = {texture.npot_size.w},"
yield f".height = {texture.npot_size.h},"
#yield f".u_mul = {u}, // {texture.real_size.w}"
yield f".v_mul = {v}, // {texture.real_size.h}"
yield "},"
def render_texture_metadatas():
for texture in texture_metadata():
yield from render_texture_metadata(texture)
def main():
render, out = renderer()
render(render_texture_metadatas())
sys.stdout.write(out.getvalue())
main()

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,15 @@
#pragma once
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
extern uint32_t _binary_pk_textures_e7_e7beam01_data_start __asm("_binary_pk_textures_e7_e7beam01_data_start");
extern uint32_t _binary_pk_textures_e7_e7beam01_data_end __asm("_binary_pk_textures_e7_e7beam01_data_end");
extern uint32_t _binary_pk_textures_e7_e7beam01_data_size __asm("_binary_pk_textures_e7_e7beam01_data_size");
#ifdef __cplusplus
}
#endif

Binary file not shown.

View File

@ -0,0 +1,15 @@
#pragma once
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
extern uint32_t _binary_pk_textures_e7_e7beam02_red_data_start __asm("_binary_pk_textures_e7_e7beam02_red_data_start");
extern uint32_t _binary_pk_textures_e7_e7beam02_red_data_end __asm("_binary_pk_textures_e7_e7beam02_red_data_end");
extern uint32_t _binary_pk_textures_e7_e7beam02_red_data_size __asm("_binary_pk_textures_e7_e7beam02_red_data_size");
#ifdef __cplusplus
}
#endif

Binary file not shown.

View File

@ -0,0 +1,15 @@
#pragma once
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
extern uint32_t _binary_pk_textures_e7_e7bigwall_data_start __asm("_binary_pk_textures_e7_e7bigwall_data_start");
extern uint32_t _binary_pk_textures_e7_e7bigwall_data_end __asm("_binary_pk_textures_e7_e7bigwall_data_end");
extern uint32_t _binary_pk_textures_e7_e7bigwall_data_size __asm("_binary_pk_textures_e7_e7bigwall_data_size");
#ifdef __cplusplus
}
#endif

Binary file not shown.

View File

@ -0,0 +1,15 @@
#pragma once
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
extern uint32_t _binary_pk_textures_e7_e7bmtrim_data_start __asm("_binary_pk_textures_e7_e7bmtrim_data_start");
extern uint32_t _binary_pk_textures_e7_e7bmtrim_data_end __asm("_binary_pk_textures_e7_e7bmtrim_data_end");
extern uint32_t _binary_pk_textures_e7_e7bmtrim_data_size __asm("_binary_pk_textures_e7_e7bmtrim_data_size");
#ifdef __cplusplus
}
#endif

Binary file not shown.

View File

@ -0,0 +1,15 @@
#pragma once
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
extern uint32_t _binary_pk_textures_e7_e7brickfloor01_data_start __asm("_binary_pk_textures_e7_e7brickfloor01_data_start");
extern uint32_t _binary_pk_textures_e7_e7brickfloor01_data_end __asm("_binary_pk_textures_e7_e7brickfloor01_data_end");
extern uint32_t _binary_pk_textures_e7_e7brickfloor01_data_size __asm("_binary_pk_textures_e7_e7brickfloor01_data_size");
#ifdef __cplusplus
}
#endif

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,15 @@
#pragma once
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
extern uint32_t _binary_pk_textures_e7_e7brnmetal_data_start __asm("_binary_pk_textures_e7_e7brnmetal_data_start");
extern uint32_t _binary_pk_textures_e7_e7brnmetal_data_end __asm("_binary_pk_textures_e7_e7brnmetal_data_end");
extern uint32_t _binary_pk_textures_e7_e7brnmetal_data_size __asm("_binary_pk_textures_e7_e7brnmetal_data_size");
#ifdef __cplusplus
}
#endif

Binary file not shown.

View File

@ -0,0 +1,15 @@
#pragma once
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
extern uint32_t _binary_pk_textures_e7_e7dimfloor_data_start __asm("_binary_pk_textures_e7_e7dimfloor_data_start");
extern uint32_t _binary_pk_textures_e7_e7dimfloor_data_end __asm("_binary_pk_textures_e7_e7dimfloor_data_end");
extern uint32_t _binary_pk_textures_e7_e7dimfloor_data_size __asm("_binary_pk_textures_e7_e7dimfloor_data_size");
#ifdef __cplusplus
}
#endif

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,15 @@
#pragma once
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
extern uint32_t _binary_pk_textures_e7_e7panelwood_data_start __asm("_binary_pk_textures_e7_e7panelwood_data_start");
extern uint32_t _binary_pk_textures_e7_e7panelwood_data_end __asm("_binary_pk_textures_e7_e7panelwood_data_end");
extern uint32_t _binary_pk_textures_e7_e7panelwood_data_size __asm("_binary_pk_textures_e7_e7panelwood_data_size");
#ifdef __cplusplus
}
#endif

Binary file not shown.

View File

@ -0,0 +1,15 @@
#pragma once
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
extern uint32_t _binary_pk_textures_e7_e7sbrickfloor_data_start __asm("_binary_pk_textures_e7_e7sbrickfloor_data_start");
extern uint32_t _binary_pk_textures_e7_e7sbrickfloor_data_end __asm("_binary_pk_textures_e7_e7sbrickfloor_data_end");
extern uint32_t _binary_pk_textures_e7_e7sbrickfloor_data_size __asm("_binary_pk_textures_e7_e7sbrickfloor_data_size");
#ifdef __cplusplus
}
#endif

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,15 @@
#pragma once
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
extern uint32_t _binary_pk_textures_e7_e7steptop_data_start __asm("_binary_pk_textures_e7_e7steptop_data_start");
extern uint32_t _binary_pk_textures_e7_e7steptop_data_end __asm("_binary_pk_textures_e7_e7steptop_data_end");
extern uint32_t _binary_pk_textures_e7_e7steptop_data_size __asm("_binary_pk_textures_e7_e7steptop_data_size");
#ifdef __cplusplus
}
#endif

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,15 @@
#pragma once
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
extern uint32_t _binary_pk_textures_e7_e7steptop2_data_start __asm("_binary_pk_textures_e7_e7steptop2_data_start");
extern uint32_t _binary_pk_textures_e7_e7steptop2_data_end __asm("_binary_pk_textures_e7_e7steptop2_data_end");
extern uint32_t _binary_pk_textures_e7_e7steptop2_data_size __asm("_binary_pk_textures_e7_e7steptop2_data_size");
#ifdef __cplusplus
}
#endif

Binary file not shown.

View File

@ -0,0 +1,15 @@
#pragma once
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
extern uint32_t _binary_pk_textures_e7_e7swindow_data_start __asm("_binary_pk_textures_e7_e7swindow_data_start");
extern uint32_t _binary_pk_textures_e7_e7swindow_data_end __asm("_binary_pk_textures_e7_e7swindow_data_end");
extern uint32_t _binary_pk_textures_e7_e7swindow_data_size __asm("_binary_pk_textures_e7_e7swindow_data_size");
#ifdef __cplusplus
}
#endif

Binary file not shown.

View File

@ -0,0 +1,15 @@
#pragma once
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
extern uint32_t _binary_pk_textures_e7_e7walldesign01b_data_start __asm("_binary_pk_textures_e7_e7walldesign01b_data_start");
extern uint32_t _binary_pk_textures_e7_e7walldesign01b_data_end __asm("_binary_pk_textures_e7_e7walldesign01b_data_end");
extern uint32_t _binary_pk_textures_e7_e7walldesign01b_data_size __asm("_binary_pk_textures_e7_e7walldesign01b_data_size");
#ifdef __cplusplus
}
#endif

Binary file not shown.

View File

@ -0,0 +1,15 @@
#pragma once
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
extern uint32_t _binary_pk_textures_gothic_floor_xstepborder5_data_start __asm("_binary_pk_textures_gothic_floor_xstepborder5_data_start");
extern uint32_t _binary_pk_textures_gothic_floor_xstepborder5_data_end __asm("_binary_pk_textures_gothic_floor_xstepborder5_data_end");
extern uint32_t _binary_pk_textures_gothic_floor_xstepborder5_data_size __asm("_binary_pk_textures_gothic_floor_xstepborder5_data_size");
#ifdef __cplusplus
}
#endif

Binary file not shown.

View File

@ -0,0 +1,15 @@
#pragma once
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
extern uint32_t _binary_pk_textures_gothic_trim_metalblackwave01_data_start __asm("_binary_pk_textures_gothic_trim_metalblackwave01_data_start");
extern uint32_t _binary_pk_textures_gothic_trim_metalblackwave01_data_end __asm("_binary_pk_textures_gothic_trim_metalblackwave01_data_end");
extern uint32_t _binary_pk_textures_gothic_trim_metalblackwave01_data_size __asm("_binary_pk_textures_gothic_trim_metalblackwave01_data_size");
#ifdef __cplusplus
}
#endif

Binary file not shown.

View File

@ -0,0 +1,15 @@
#pragma once
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
extern uint32_t _binary_pk_textures_liquids_lavahell_data_start __asm("_binary_pk_textures_liquids_lavahell_data_start");
extern uint32_t _binary_pk_textures_liquids_lavahell_data_end __asm("_binary_pk_textures_liquids_lavahell_data_end");
extern uint32_t _binary_pk_textures_liquids_lavahell_data_size __asm("_binary_pk_textures_liquids_lavahell_data_size");
#ifdef __cplusplus
}
#endif

BIN
pk/textures/sfx/flame2.data Normal file

Binary file not shown.

View File

@ -0,0 +1,15 @@
#pragma once
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
extern uint32_t _binary_pk_textures_sfx_flame2_data_start __asm("_binary_pk_textures_sfx_flame2_data_start");
extern uint32_t _binary_pk_textures_sfx_flame2_data_end __asm("_binary_pk_textures_sfx_flame2_data_end");
extern uint32_t _binary_pk_textures_sfx_flame2_data_size __asm("_binary_pk_textures_sfx_flame2_data_size");
#ifdef __cplusplus
}
#endif

Binary file not shown.

View File

@ -0,0 +1,15 @@
#pragma once
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
extern uint32_t _binary_pk_textures_stone_pjrock1_data_start __asm("_binary_pk_textures_stone_pjrock1_data_start");
extern uint32_t _binary_pk_textures_stone_pjrock1_data_end __asm("_binary_pk_textures_stone_pjrock1_data_end");
extern uint32_t _binary_pk_textures_stone_pjrock1_data_size __asm("_binary_pk_textures_stone_pjrock1_data_size");
#ifdef __cplusplus
}
#endif

View File

@ -96,7 +96,8 @@ typedef struct q3bsp_brushside {
typedef struct q3bsp_vertex { typedef struct q3bsp_vertex {
float position[3]; float position[3];
float texcoord[2][2]; float texcoord[2];
float lightmapcoord[2];
float normal[3]; float normal[3];
uint8_t color[4]; uint8_t color[4];
} q3bsp_vertex_t; } q3bsp_vertex_t;

View File

@ -3,78 +3,131 @@
#include <cstdint> #include <cstdint>
namespace c2dstat { namespace c2dstat {
constexpr uint32_t texture_memory_start_address(uint32_t num) { return (num & 0x13ffffe0) << 0; } constexpr uint32_t texture_memory_start_address(uint32_t num) { return (num & 0x13ffffe0) << 0; }
} }
namespace c2dlen { namespace c2dlen {
constexpr uint32_t transfer_length(uint32_t num) { return (num & 0xffffe0) << 0; } constexpr uint32_t transfer_length(uint32_t num) { return (num & 0xffffe0) << 0; }
} }
namespace c2dst { namespace c2dst {
constexpr uint32_t start = 1 << 0; constexpr uint32_t start = 1 << 0;
} }
namespace istnrm { namespace istnrm {
constexpr uint32_t end_of_transferring_punch_through_list = 1 << 21; constexpr uint32_t end_of_transferring_punch_through_list = 1 << 21;
constexpr uint32_t end_of_dma_sort_dma = 1 << 20;
constexpr uint32_t end_of_dma_ch2_dma = 1 << 19; constexpr uint32_t end_of_dma_sort_dma = 1 << 20;
constexpr uint32_t end_of_dma_dev_dma = 1 << 18;
constexpr uint32_t end_of_dma_ext_dma2 = 1 << 17; constexpr uint32_t end_of_dma_ch2_dma = 1 << 19;
constexpr uint32_t end_of_dma_ext_dma1 = 1 << 16;
constexpr uint32_t end_of_dma_aica_dma = 1 << 15; constexpr uint32_t end_of_dma_dev_dma = 1 << 18;
constexpr uint32_t end_of_dma_gd_dma = 1 << 14;
constexpr uint32_t maple_v_blank_over_interrupt = 1 << 13; constexpr uint32_t end_of_dma_ext_dma2 = 1 << 17;
constexpr uint32_t end_of_dma_maple_dma = 1 << 12;
constexpr uint32_t end_of_dma_pvr_dma = 1 << 11; constexpr uint32_t end_of_dma_ext_dma1 = 1 << 16;
constexpr uint32_t end_of_transferring_translucent_modifier_volume_list = 1 << 10;
constexpr uint32_t end_of_transferring_translucent_list = 1 << 9; constexpr uint32_t end_of_dma_aica_dma = 1 << 15;
constexpr uint32_t end_of_transferring_opaque_modifier_volume_list = 1 << 8;
constexpr uint32_t end_of_transferring_opaque_list = 1 << 7; constexpr uint32_t end_of_dma_gd_dma = 1 << 14;
constexpr uint32_t end_of_transferring_yuv = 1 << 6;
constexpr uint32_t h_blank_in_interrupt = 1 << 5; constexpr uint32_t maple_v_blank_over_interrupt = 1 << 13;
constexpr uint32_t v_blank_out_interrupt = 1 << 4;
constexpr uint32_t v_blank_in_interrupt = 1 << 3; constexpr uint32_t end_of_dma_maple_dma = 1 << 12;
constexpr uint32_t end_of_render_tsp = 1 << 2;
constexpr uint32_t end_of_render_isp = 1 << 1; constexpr uint32_t end_of_dma_pvr_dma = 1 << 11;
constexpr uint32_t end_of_render_video = 1 << 0;
constexpr uint32_t end_of_transferring_translucent_modifier_volume_list = 1 << 10;
constexpr uint32_t end_of_transferring_translucent_list = 1 << 9;
constexpr uint32_t end_of_transferring_opaque_modifier_volume_list = 1 << 8;
constexpr uint32_t end_of_transferring_opaque_list = 1 << 7;
constexpr uint32_t end_of_transferring_yuv = 1 << 6;
constexpr uint32_t h_blank_in_interrupt = 1 << 5;
constexpr uint32_t v_blank_out_interrupt = 1 << 4;
constexpr uint32_t v_blank_in_interrupt = 1 << 3;
constexpr uint32_t end_of_render_tsp = 1 << 2;
constexpr uint32_t end_of_render_isp = 1 << 1;
constexpr uint32_t end_of_render_video = 1 << 0;
} }
namespace isterr { namespace isterr {
constexpr uint32_t sh4__if_access_inhibited_area = 1 << 31; constexpr uint32_t sh4__if_access_inhibited_area = 1 << 31;
constexpr uint32_t ddt__if_sort_dma_command_error = 1 << 28;
constexpr uint32_t g2__time_out_in_cpu_access = 1 << 27; constexpr uint32_t ddt__if_sort_dma_command_error = 1 << 28;
constexpr uint32_t g2__dev_dma_time_out = 1 << 26;
constexpr uint32_t g2__ext_dma2_time_out = 1 << 25; constexpr uint32_t g2__time_out_in_cpu_access = 1 << 27;
constexpr uint32_t g2__ext_dma1_time_out = 1 << 24;
constexpr uint32_t g2__aica_dma_time_out = 1 << 23; constexpr uint32_t g2__dev_dma_time_out = 1 << 26;
constexpr uint32_t g2__dev_dma_over_run = 1 << 22;
constexpr uint32_t g2__ext_dma2_over_run = 1 << 21; constexpr uint32_t g2__ext_dma2_time_out = 1 << 25;
constexpr uint32_t g2__ext_dma1_over_run = 1 << 20;
constexpr uint32_t g2__aica_dma_over_run = 1 << 19; constexpr uint32_t g2__ext_dma1_time_out = 1 << 24;
constexpr uint32_t g2__dev_dma_illegal_address_set = 1 << 18;
constexpr uint32_t g2__ext_dma2_illegal_address_set = 1 << 17; constexpr uint32_t g2__aica_dma_time_out = 1 << 23;
constexpr uint32_t g2__ext_dma1_illegal_address_set = 1 << 16;
constexpr uint32_t g2__aica_dma_illegal_address_set = 1 << 15; constexpr uint32_t g2__dev_dma_over_run = 1 << 22;
constexpr uint32_t g1__rom_flash_access_at_gd_dma = 1 << 14;
constexpr uint32_t g1__gd_dma_over_run = 1 << 13; constexpr uint32_t g2__ext_dma2_over_run = 1 << 21;
constexpr uint32_t g1__illegal_address_set = 1 << 12;
constexpr uint32_t maple__illegal_command = 1 << 11; constexpr uint32_t g2__ext_dma1_over_run = 1 << 20;
constexpr uint32_t maple__write_fifo_over_flow = 1 << 10;
constexpr uint32_t maple__dma_over_run = 1 << 9; constexpr uint32_t g2__aica_dma_over_run = 1 << 19;
constexpr uint32_t maple__illegal_address_set = 1 << 8;
constexpr uint32_t pvrif__dma_over_run = 1 << 7; constexpr uint32_t g2__dev_dma_illegal_address_set = 1 << 18;
constexpr uint32_t pvrif__illegal_address_set = 1 << 6;
constexpr uint32_t ta__fifo_overflow = 1 << 5; constexpr uint32_t g2__ext_dma2_illegal_address_set = 1 << 17;
constexpr uint32_t ta__illegal_parameter = 1 << 4;
constexpr uint32_t ta__object_list_pointer_overflow = 1 << 3; constexpr uint32_t g2__ext_dma1_illegal_address_set = 1 << 16;
constexpr uint32_t ta__isp_tsp_parameter_overflow = 1 << 2;
constexpr uint32_t render__hazard_processing_of_strip_buffer = 1 << 1; constexpr uint32_t g2__aica_dma_illegal_address_set = 1 << 15;
constexpr uint32_t render__isp_out_of_cache = 1 << 0;
constexpr uint32_t g1__rom_flash_access_at_gd_dma = 1 << 14;
constexpr uint32_t g1__gd_dma_over_run = 1 << 13;
constexpr uint32_t g1__illegal_address_set = 1 << 12;
constexpr uint32_t maple__illegal_command = 1 << 11;
constexpr uint32_t maple__write_fifo_over_flow = 1 << 10;
constexpr uint32_t maple__dma_over_run = 1 << 9;
constexpr uint32_t maple__illegal_address_set = 1 << 8;
constexpr uint32_t pvrif__dma_over_run = 1 << 7;
constexpr uint32_t pvrif__illegal_address_set = 1 << 6;
constexpr uint32_t ta__fifo_overflow = 1 << 5;
constexpr uint32_t ta__illegal_parameter = 1 << 4;
constexpr uint32_t ta__object_list_pointer_overflow = 1 << 3;
constexpr uint32_t ta__isp_tsp_parameter_overflow = 1 << 2;
constexpr uint32_t render__hazard_processing_of_strip_buffer = 1 << 1;
constexpr uint32_t render__isp_out_of_cache = 1 << 0;
} }
namespace ffst { namespace ffst {
constexpr uint32_t holly_cpu_if_block_internal_write_buffer(uint32_t reg) { return (reg >> 5) & 0x1; } constexpr uint32_t holly_cpu_if_block_internal_write_buffer(uint32_t reg) { return (reg >> 5) & 0x1; }
constexpr uint32_t holly_g2_if_block_internal_write_buffer(uint32_t reg) { return (reg >> 4) & 0x1; } constexpr uint32_t holly_g2_if_block_internal_write_buffer(uint32_t reg) { return (reg >> 4) & 0x1; }
constexpr uint32_t aica_internal_write_buffer(uint32_t reg) { return (reg >> 0) & 0x1; } constexpr uint32_t aica_internal_write_buffer(uint32_t reg) { return (reg >> 0) & 0x1; }
} }