TAGlobalParameter/TAVertexParameter: replace nested classes with static methods
This commit is contained in:
parent
99b2e6c0f1
commit
f08610d494
@ -76,9 +76,6 @@
|
||||
#include "classes/sega/dreamcast/holly/TABits.class.h"
|
||||
#include "classes/sega/dreamcast/holly/TAFIFOPolygonConverter.class.h"
|
||||
#include "classes/sega/dreamcast/holly/TAGlobalParameter.class.h"
|
||||
#include "classes/sega/dreamcast/holly/TAGlobalParameter_end_of_list.class.h"
|
||||
#include "classes/sega/dreamcast/holly/TAGlobalParameter_polygon_type_0.class.h"
|
||||
#include "classes/sega/dreamcast/holly/TAVertexParameter.class.h"
|
||||
#include "classes/sega/dreamcast/holly/TAVertexParameter_polygon_type_3.class.h"
|
||||
#include "classes/sega/dreamcast/holly/TextureMemoryAllocation.class.h"
|
||||
#include "classes/sega/dreamcast/sh7091/StoreQueueBuffer.class.h"
|
||||
|
@ -76,9 +76,6 @@
|
||||
(const uint8_t *)&_binary_classes_sega_dreamcast_holly_TABits_class_start,
|
||||
(const uint8_t *)&_binary_classes_sega_dreamcast_holly_TAFIFOPolygonConverter_class_start,
|
||||
(const uint8_t *)&_binary_classes_sega_dreamcast_holly_TAGlobalParameter_class_start,
|
||||
(const uint8_t *)&_binary_classes_sega_dreamcast_holly_TAGlobalParameter_end_of_list_class_start,
|
||||
(const uint8_t *)&_binary_classes_sega_dreamcast_holly_TAGlobalParameter_polygon_type_0_class_start,
|
||||
(const uint8_t *)&_binary_classes_sega_dreamcast_holly_TAVertexParameter_class_start,
|
||||
(const uint8_t *)&_binary_classes_sega_dreamcast_holly_TAVertexParameter_polygon_type_3_class_start,
|
||||
(const uint8_t *)&_binary_classes_sega_dreamcast_holly_TextureMemoryAllocation_class_start,
|
||||
(const uint8_t *)&_binary_classes_sega_dreamcast_sh7091_StoreQueueBuffer_class_start,
|
||||
|
12
c/native.c
12
c/native.c
@ -50,6 +50,12 @@ const static struct native_method native_method[] = {
|
||||
.method_descriptor = "(II)V",
|
||||
.func = native_jvm_internal_memory_putU4_2,
|
||||
},
|
||||
{
|
||||
.class_name = "jvm/internal/Memory",
|
||||
.method_name = "putF4",
|
||||
.method_descriptor = "(IF)V",
|
||||
.func = native_jvm_internal_memory_putU4_2,
|
||||
},
|
||||
{
|
||||
.class_name = "jvm/internal/Memory",
|
||||
.method_name = "putU2",
|
||||
@ -68,6 +74,12 @@ const static struct native_method native_method[] = {
|
||||
.method_descriptor = "(I)I",
|
||||
.func = native_jvm_internal_memory_getU4_1,
|
||||
},
|
||||
{
|
||||
.class_name = "jvm/internal/Memory",
|
||||
.method_name = "getF4",
|
||||
.method_descriptor = "(I)F",
|
||||
.func = native_jvm_internal_memory_getU4_1,
|
||||
},
|
||||
{
|
||||
.class_name = "jvm/internal/Memory",
|
||||
.method_name = "getU2",
|
||||
|
@ -82,22 +82,11 @@ public class JavaCube {
|
||||
static final int framebuffer_width = 640;
|
||||
static final int framebuffer_height = 480;
|
||||
|
||||
static TAGlobalParameter.polygon_type_0[] gt0;
|
||||
static TAVertexParameter.polygon_type_3 vt0;
|
||||
static TAGlobalParameter.end_of_list eol;
|
||||
|
||||
static Vec2[] quad;
|
||||
static Vec2[] quad_uv;
|
||||
|
||||
static float theta;
|
||||
|
||||
static int colors[] = {
|
||||
5156825, 14787722, 9529551,
|
||||
4729017, 10213073, 15956866,
|
||||
5362273, 8377157, 9797796,
|
||||
11479204, 4042586, 16676239
|
||||
};
|
||||
|
||||
public static int[] texture_extents;
|
||||
|
||||
static String[] texture_filenames = {
|
||||
@ -105,89 +94,38 @@ public class JavaCube {
|
||||
"JAVA_TEX.DAT;1",
|
||||
};
|
||||
|
||||
static {
|
||||
texture_extents = new int[texture_filenames.length];
|
||||
for (int i = 0; i < texture_filenames.length; i++) {
|
||||
texture_extents[i] = -1;
|
||||
}
|
||||
|
||||
int parameter_control_word = TAParameter.para_control__para_type__polygon_or_modifier_volume
|
||||
static final int parameter_control_word = TAParameter.para_control__para_type__polygon_or_modifier_volume
|
||||
| TAParameter.para_control__list_type__translucent
|
||||
| TAParameter.obj_control__col_type__packed_color
|
||||
| TAParameter.obj_control__texture;
|
||||
|
||||
int isp_tsp_instruction_word = ISPTSP.isp_tsp_instruction_word__depth_compare_mode__greater
|
||||
static final int isp_tsp_instruction_word = ISPTSP.isp_tsp_instruction_word__depth_compare_mode__greater
|
||||
| ISPTSP.isp_tsp_instruction_word__culling_mode__no_culling;
|
||||
|
||||
int tsp_instruction_word = ISPTSP.tsp_instruction_word__src_alpha_instr__src_alpha
|
||||
static final int tsp_instruction_word = ISPTSP.tsp_instruction_word__src_alpha_instr__src_alpha
|
||||
| ISPTSP.tsp_instruction_word__dst_alpha_instr__inverse_src_alpha
|
||||
| ISPTSP.tsp_instruction_word__fog_control__no_fog
|
||||
| ISPTSP.tsp_instruction_word__texture_u_size__512
|
||||
| ISPTSP.tsp_instruction_word__texture_v_size__1024
|
||||
| ISPTSP.tsp_instruction_word__use_alpha;
|
||||
|
||||
int texture_address = TextureMemoryAllocation.texture_regions[1][0] + 512;
|
||||
int texture_control_word = ISPTSP.texture_control_word__pixel_format__4444
|
||||
static final int texture_address = TextureMemoryAllocation.texture_regions[1][0] + 512;
|
||||
static final int texture_control_word = ISPTSP.texture_control_word__pixel_format__4444
|
||||
| ISPTSP.texture_control_word__scan_order__non_twiddled
|
||||
| ISPTSP.texture_control_word__texture_address(texture_address / 8);
|
||||
|
||||
int data_size_for_sort_dma = 0;
|
||||
int next_address_for_sort_dma = 0;
|
||||
|
||||
gt0 = new TAGlobalParameter.polygon_type_0[2];
|
||||
gt0[0] = new TAGlobalParameter.polygon_type_0(parameter_control_word,
|
||||
isp_tsp_instruction_word,
|
||||
tsp_instruction_word,
|
||||
texture_control_word,
|
||||
data_size_for_sort_dma,
|
||||
next_address_for_sort_dma);
|
||||
|
||||
tsp_instruction_word = ISPTSP.tsp_instruction_word__src_alpha_instr__src_alpha
|
||||
| ISPTSP.tsp_instruction_word__dst_alpha_instr__inverse_src_alpha
|
||||
| ISPTSP.tsp_instruction_word__fog_control__no_fog
|
||||
| ISPTSP.tsp_instruction_word__texture_u_size__128
|
||||
| ISPTSP.tsp_instruction_word__texture_v_size__64
|
||||
| ISPTSP.tsp_instruction_word__use_alpha;
|
||||
|
||||
texture_address = TextureMemoryAllocation.texture_regions[1][0] + 512 + (512 * 512 * 2 * 2);
|
||||
texture_control_word = ISPTSP.texture_control_word__pixel_format__4444
|
||||
| ISPTSP.texture_control_word__scan_order__non_twiddled
|
||||
| ISPTSP.texture_control_word__texture_address(texture_address / 8);
|
||||
|
||||
gt0[1] = new TAGlobalParameter.polygon_type_0(parameter_control_word,
|
||||
isp_tsp_instruction_word,
|
||||
tsp_instruction_word,
|
||||
texture_control_word,
|
||||
data_size_for_sort_dma,
|
||||
next_address_for_sort_dma);
|
||||
|
||||
vt0 = new TAVertexParameter.polygon_type_3(0, // parameter_control_word
|
||||
0.0f, // x
|
||||
0.0f, // y
|
||||
0.0f, // z
|
||||
0.0f, // u
|
||||
0.0f, // v
|
||||
0, // color
|
||||
0); // offset_color
|
||||
|
||||
eol = new TAGlobalParameter.end_of_list(TAParameter.para_control__para_type__end_of_list);
|
||||
|
||||
float x = 256.0f;
|
||||
float y = 208.0f;
|
||||
quad = new Vec2[4];
|
||||
quad[0] = new Vec2(x + 0.0f, y + 0.0f);
|
||||
quad[1] = new Vec2(x + 128.0f, y + 0.0f);
|
||||
quad[2] = new Vec2(x + 128.0f, y + 64.0f);
|
||||
quad[3] = new Vec2(x + 0.0f, y + 64.0f);
|
||||
|
||||
quad_uv = new Vec2[4];
|
||||
quad_uv[0] = new Vec2(0.0f, 0.0f);
|
||||
quad_uv[1] = new Vec2(1.0f, 0.0f);
|
||||
quad_uv[2] = new Vec2(1.0f, 1.0f);
|
||||
quad_uv[3] = new Vec2(0.0f, 1.0f);
|
||||
static {
|
||||
texture_extents = new int[texture_filenames.length];
|
||||
for (int i = 0; i < texture_filenames.length; i++) {
|
||||
texture_extents[i] = -1;
|
||||
}
|
||||
}
|
||||
|
||||
public static void transform_vertex(Vec3[] position, Vec2[] texture, FacePTN ptn) {
|
||||
public static void transform_vertex(int parameter_control_word,
|
||||
Vec3[] position,
|
||||
Vec2[] texture,
|
||||
FacePTN ptn) {
|
||||
|
||||
float px = position[ptn.position].x;
|
||||
float py = position[ptn.position].y;
|
||||
float pz = position[ptn.position].z;
|
||||
@ -221,64 +159,33 @@ public class JavaCube {
|
||||
float y = -y2 * 240f + 240f;
|
||||
float z = 1.0f / z2;
|
||||
|
||||
vt0.x = x;
|
||||
vt0.y = y;
|
||||
vt0.z = z;
|
||||
vt0.u = texture[ptn.texture].x;
|
||||
vt0.v = texture[ptn.texture].y;
|
||||
TAVertexParameter.polygon_type_3(parameter_control_word,
|
||||
x,
|
||||
y,
|
||||
z,
|
||||
texture[ptn.texture].x, // u
|
||||
texture[ptn.texture].y, // v
|
||||
0xff000000, // base_color
|
||||
0); // offset_color
|
||||
}
|
||||
|
||||
public static void transform_triangle(int n, Vec3[] position, Vec2[] texture, FacePTN[] face) {
|
||||
for (int i = 0; i < 3; i++) {
|
||||
vt0.parameter_control_word = TAParameter.para_control__para_type__vertex_parameter;
|
||||
int parameter_control_word = TAParameter.para_control__para_type__vertex_parameter;
|
||||
if (i == 2)
|
||||
vt0.parameter_control_word |= TAParameter.para_control__end_of_strip;
|
||||
transform_vertex(position, texture, face[i]);
|
||||
vt0.base_color = colors[n];
|
||||
|
||||
vt0.submit();
|
||||
parameter_control_word |= TAParameter.para_control__end_of_strip;
|
||||
transform_vertex(parameter_control_word, position, texture, face[i]);
|
||||
}
|
||||
}
|
||||
|
||||
public static void transform_quad() {
|
||||
// strip order:
|
||||
// 0 1 3 2
|
||||
|
||||
vt0.z = 0.1f;
|
||||
|
||||
vt0.parameter_control_word = TAParameter.para_control__para_type__vertex_parameter;
|
||||
vt0.x = quad[0].x;
|
||||
vt0.y = quad[0].y;
|
||||
vt0.u = quad_uv[0].x;
|
||||
vt0.v = quad_uv[0].y;
|
||||
vt0.submit();
|
||||
|
||||
vt0.parameter_control_word = TAParameter.para_control__para_type__vertex_parameter;
|
||||
vt0.x = quad[1].x;
|
||||
vt0.y = quad[1].y;
|
||||
vt0.u = quad_uv[1].x;
|
||||
vt0.v = quad_uv[1].y;
|
||||
vt0.submit();
|
||||
|
||||
vt0.parameter_control_word = TAParameter.para_control__para_type__vertex_parameter;
|
||||
vt0.x = quad[3].x;
|
||||
vt0.y = quad[3].y;
|
||||
vt0.u = quad_uv[3].x;
|
||||
vt0.v = quad_uv[3].y;
|
||||
vt0.submit();
|
||||
|
||||
vt0.parameter_control_word = TAParameter.para_control__para_type__vertex_parameter
|
||||
| TAParameter.para_control__end_of_strip;
|
||||
vt0.x = quad[2].x;
|
||||
vt0.y = quad[2].y;
|
||||
vt0.u = quad_uv[2].x;
|
||||
vt0.v = quad_uv[2].y;
|
||||
vt0.submit();
|
||||
}
|
||||
|
||||
public static void transfer_cube_scene() {
|
||||
// global parameters
|
||||
gt0[0].submit();
|
||||
TAGlobalParameter.polygon_type_0(parameter_control_word,
|
||||
isp_tsp_instruction_word,
|
||||
tsp_instruction_word,
|
||||
texture_control_word,
|
||||
0, // data_size_for_sort_dma
|
||||
0); // next_address_for_sort_dma
|
||||
|
||||
// triangle parameters
|
||||
ModelObject obj = CubeModel.objects[0];
|
||||
@ -287,18 +194,7 @@ public class JavaCube {
|
||||
}
|
||||
|
||||
// end of list
|
||||
eol.submit();
|
||||
}
|
||||
|
||||
public static void transfer_splash_scene() {
|
||||
// global parameters
|
||||
gt0[1].submit();
|
||||
|
||||
// quad parameters
|
||||
transform_quad();
|
||||
|
||||
// end of list
|
||||
eol.submit();
|
||||
TAGlobalParameter.end_of_list(TAParameter.para_control__para_type__end_of_list);
|
||||
}
|
||||
|
||||
public static void transfer_textures() {
|
||||
@ -333,52 +229,6 @@ public class JavaCube {
|
||||
}
|
||||
}
|
||||
|
||||
public static void transfer_java_powered() {
|
||||
int texture = TextureMemoryAllocation.texture_regions[1][0] + 512 + (512 * 512 * 2 * 2);
|
||||
|
||||
// java_powered
|
||||
//int[] java_powered = Resource.getResource("images/java_powered");
|
||||
//int java_powered_length = (java_powered == null) ? 0 : java_powered.length;
|
||||
//System.out.print("images/java_powered length: ");
|
||||
//System.out.println(java_powered_length);
|
||||
|
||||
//for (int i = 0; i < java_powered_length; i++) {
|
||||
for (int i = 0; i < 128 * 128; i++) {
|
||||
//Memory.putU4(MemoryMap.texture_memory64 + texture, java_powered[i]);
|
||||
Memory.putU4(MemoryMap.texture_memory64 + texture, 0);
|
||||
texture += 4;
|
||||
}
|
||||
}
|
||||
|
||||
public static void boot_splash(int ta_alloc, int opb_size_total) {
|
||||
// unpipelined render loop
|
||||
TAFIFOPolygonConverter.init(TextureMemoryAllocation.isp_tsp_parameters_start[0],
|
||||
TextureMemoryAllocation.isp_tsp_parameters_end[0],
|
||||
TextureMemoryAllocation.object_list_start[0],
|
||||
TextureMemoryAllocation.object_list_end[0],
|
||||
opb_size_total,
|
||||
ta_alloc,
|
||||
framebuffer_width / 32,
|
||||
framebuffer_height / 32);
|
||||
transfer_splash_scene();
|
||||
System.out.println("wait_tl");
|
||||
TAFIFOPolygonConverter.wait_translucent_list();
|
||||
System.out.println("wait_tl_end");
|
||||
|
||||
Core.start_render(TextureMemoryAllocation.region_array_start[0],
|
||||
TextureMemoryAllocation.isp_tsp_parameters_start[0],
|
||||
TextureMemoryAllocation.background_start[0],
|
||||
TextureMemoryAllocation.framebuffer_start[0],
|
||||
framebuffer_width);
|
||||
Core.wait_end_of_render_tsp();
|
||||
|
||||
while ((CoreBits.spg_status__vsync(Memory.getU4(Holly.SPG_STATUS)) == 0));
|
||||
while (!(CoreBits.spg_status__vsync(Memory.getU4(Holly.SPG_STATUS)) == 0));
|
||||
VideoOutput.set_framebuffer_resolution(640, 480);
|
||||
VideoOutput.set_mode(VideoOutputMode.vga);
|
||||
Memory.putU4(Holly.FB_R_SOF1, TextureMemoryAllocation.framebuffer_start[0]);
|
||||
}
|
||||
|
||||
public static void main() {
|
||||
int ta_alloc =
|
||||
TABits.ta_alloc_ctrl__opb_mode__increasing_addresses
|
||||
@ -398,13 +248,14 @@ public class JavaCube {
|
||||
};
|
||||
int opb_size_total = opb_size[0].total();
|
||||
|
||||
transfer_java_powered();
|
||||
|
||||
System.out.println("background");
|
||||
int background_color = 0xff100a00;
|
||||
Background.background(TextureMemoryAllocation.background_start[0],
|
||||
0x00c0c0c0); // sega white
|
||||
Background.background(TextureMemoryAllocation.background_start[1],
|
||||
0x00c0c0c0);//background_color); // dark black
|
||||
|
||||
Memory.putU4(Holly.VO_BORDER_COL, background_color);
|
||||
|
||||
System.out.println("region_array");
|
||||
int num_render_passes = opb_size.length;
|
||||
RegionArray.region_array(framebuffer_width / 32,
|
||||
framebuffer_height / 32,
|
||||
@ -412,23 +263,6 @@ public class JavaCube {
|
||||
num_render_passes,
|
||||
TextureMemoryAllocation.region_array_start[0],
|
||||
TextureMemoryAllocation.object_list_start[0]);
|
||||
|
||||
System.out.println("core_init");
|
||||
Core.init();
|
||||
|
||||
for (int i = 0; i < 2; i++) {
|
||||
boot_splash(ta_alloc, opb_size_total);
|
||||
}
|
||||
|
||||
System.out.println("transfer_textures");
|
||||
transfer_textures();
|
||||
|
||||
int background_color = 0xff100a00;
|
||||
Background.background(TextureMemoryAllocation.background_start[1],
|
||||
background_color);
|
||||
|
||||
Memory.putU4(Holly.VO_BORDER_COL, background_color);
|
||||
|
||||
RegionArray.region_array(framebuffer_width / 32,
|
||||
framebuffer_height / 32,
|
||||
opb_size,
|
||||
@ -436,7 +270,13 @@ public class JavaCube {
|
||||
TextureMemoryAllocation.region_array_start[1],
|
||||
TextureMemoryAllocation.object_list_start[1]);
|
||||
|
||||
System.out.println("main");
|
||||
Core.init();
|
||||
|
||||
transfer_textures();
|
||||
|
||||
VideoOutput.set_framebuffer_resolution(640, 480);
|
||||
VideoOutput.set_mode(VideoOutputMode.vga);
|
||||
|
||||
int core = 0;
|
||||
int ta = 0;
|
||||
while (true) {
|
||||
|
@ -2,10 +2,12 @@ package jvm.internal;
|
||||
|
||||
public class Memory {
|
||||
public static native void putU4(int address, int value);
|
||||
public static native void putF4(int address, float value);
|
||||
public static native void putU2(int address, short value);
|
||||
public static native void putU1(int address, byte value);
|
||||
|
||||
public static native int getU4(int address);
|
||||
public static native float getF4(int address);
|
||||
public static native short getU2(int address);
|
||||
public static native byte getU1(int address);
|
||||
|
||||
|
@ -1,158 +1,81 @@
|
||||
package sega.dreamcast.holly;
|
||||
|
||||
import sega.dreamcast.MemoryMap;
|
||||
import sega.dreamcast.sh7091.StoreQueueBuffer;
|
||||
import jvm.internal.SH4Intrinsic;
|
||||
import jvm.internal.Memory;
|
||||
|
||||
public class TAGlobalParameter {
|
||||
public static class end_of_list
|
||||
extends StoreQueueBuffer
|
||||
{
|
||||
|
||||
public int parameter_control_word;
|
||||
public end_of_list(int parameter_control_word
|
||||
public static void end_of_list(int parameter_control_word
|
||||
) {
|
||||
super();
|
||||
this.parameter_control_word = parameter_control_word;
|
||||
int store_queue = MemoryMap.store_queue;
|
||||
Memory.putU4(store_queue + 0, parameter_control_word);
|
||||
Memory.putU4(store_queue + 4, 0);
|
||||
Memory.putU4(store_queue + 8, 0);
|
||||
Memory.putU4(store_queue + 12, 0);
|
||||
Memory.putU4(store_queue + 16, 0);
|
||||
Memory.putU4(store_queue + 20, 0);
|
||||
Memory.putU4(store_queue + 24, 0);
|
||||
Memory.putU4(store_queue + 28, 0);
|
||||
Memory.putU4(0xff000038, ((MemoryMap.ta_fifo_polygon_converter >> 26) & 0b111) << 2); // QACR0
|
||||
SH4Intrinsic.pref1(store_queue);
|
||||
}
|
||||
public void submit() {
|
||||
putInt(0, parameter_control_word);
|
||||
putInt(4, 0);
|
||||
putInt(8, 0);
|
||||
putInt(12, 0);
|
||||
putInt(16, 0);
|
||||
putInt(20, 0);
|
||||
putInt(24, 0);
|
||||
putInt(28, 0);
|
||||
Memory.putU4(0xff000038, MemoryMap.ta_fifo_polygon_converter); // QACR0
|
||||
SH4Intrinsic.pref1(MemoryMap.store_queue);
|
||||
}
|
||||
}
|
||||
public static class user_tile_clip
|
||||
extends StoreQueueBuffer
|
||||
{
|
||||
|
||||
public int parameter_control_word;
|
||||
public int user_clip_x_min;
|
||||
public int user_clip_y_min;
|
||||
public int user_clip_x_max;
|
||||
public int user_clip_y_max;
|
||||
public user_tile_clip(int parameter_control_word,
|
||||
public static void user_tile_clip(int parameter_control_word,
|
||||
int user_clip_x_min,
|
||||
int user_clip_y_min,
|
||||
int user_clip_x_max,
|
||||
int user_clip_y_max
|
||||
) {
|
||||
super();
|
||||
this.parameter_control_word = parameter_control_word;
|
||||
this.user_clip_x_min = user_clip_x_min;
|
||||
this.user_clip_y_min = user_clip_y_min;
|
||||
this.user_clip_x_max = user_clip_x_max;
|
||||
this.user_clip_y_max = user_clip_y_max;
|
||||
int store_queue = MemoryMap.store_queue;
|
||||
Memory.putU4(store_queue + 0, parameter_control_word);
|
||||
Memory.putU4(store_queue + 4, 0);
|
||||
Memory.putU4(store_queue + 8, 0);
|
||||
Memory.putU4(store_queue + 12, 0);
|
||||
Memory.putU4(store_queue + 16, user_clip_x_min);
|
||||
Memory.putU4(store_queue + 20, user_clip_y_min);
|
||||
Memory.putU4(store_queue + 24, user_clip_x_max);
|
||||
Memory.putU4(store_queue + 28, user_clip_y_max);
|
||||
Memory.putU4(0xff000038, ((MemoryMap.ta_fifo_polygon_converter >> 26) & 0b111) << 2); // QACR0
|
||||
SH4Intrinsic.pref1(store_queue);
|
||||
}
|
||||
public void submit() {
|
||||
putInt(0, parameter_control_word);
|
||||
putInt(4, 0);
|
||||
putInt(8, 0);
|
||||
putInt(12, 0);
|
||||
putInt(16, user_clip_x_min);
|
||||
putInt(20, user_clip_y_min);
|
||||
putInt(24, user_clip_x_max);
|
||||
putInt(28, user_clip_y_max);
|
||||
Memory.putU4(0xff000038, MemoryMap.ta_fifo_polygon_converter); // QACR0
|
||||
SH4Intrinsic.pref1(MemoryMap.store_queue);
|
||||
}
|
||||
}
|
||||
public static class object_list_set
|
||||
extends StoreQueueBuffer
|
||||
{
|
||||
|
||||
public int parameter_control_word;
|
||||
public int object_pointer;
|
||||
public int bounding_box_x_min;
|
||||
public int bounding_box_y_min;
|
||||
public int bounding_box_x_max;
|
||||
public int bounding_box_y_max;
|
||||
public object_list_set(int parameter_control_word,
|
||||
public static void object_list_set(int parameter_control_word,
|
||||
int object_pointer,
|
||||
int bounding_box_x_min,
|
||||
int bounding_box_y_min,
|
||||
int bounding_box_x_max,
|
||||
int bounding_box_y_max
|
||||
) {
|
||||
super();
|
||||
this.parameter_control_word = parameter_control_word;
|
||||
this.object_pointer = object_pointer;
|
||||
this.bounding_box_x_min = bounding_box_x_min;
|
||||
this.bounding_box_y_min = bounding_box_y_min;
|
||||
this.bounding_box_x_max = bounding_box_x_max;
|
||||
this.bounding_box_y_max = bounding_box_y_max;
|
||||
int store_queue = MemoryMap.store_queue;
|
||||
Memory.putU4(store_queue + 0, parameter_control_word);
|
||||
Memory.putU4(store_queue + 4, object_pointer);
|
||||
Memory.putU4(store_queue + 8, 0);
|
||||
Memory.putU4(store_queue + 12, 0);
|
||||
Memory.putU4(store_queue + 16, bounding_box_x_min);
|
||||
Memory.putU4(store_queue + 20, bounding_box_y_min);
|
||||
Memory.putU4(store_queue + 24, bounding_box_x_max);
|
||||
Memory.putU4(store_queue + 28, bounding_box_y_max);
|
||||
Memory.putU4(0xff000038, ((MemoryMap.ta_fifo_polygon_converter >> 26) & 0b111) << 2); // QACR0
|
||||
SH4Intrinsic.pref1(store_queue);
|
||||
}
|
||||
public void submit() {
|
||||
putInt(0, parameter_control_word);
|
||||
putInt(4, object_pointer);
|
||||
putInt(8, 0);
|
||||
putInt(12, 0);
|
||||
putInt(16, bounding_box_x_min);
|
||||
putInt(20, bounding_box_y_min);
|
||||
putInt(24, bounding_box_x_max);
|
||||
putInt(28, bounding_box_y_max);
|
||||
Memory.putU4(0xff000038, MemoryMap.ta_fifo_polygon_converter); // QACR0
|
||||
SH4Intrinsic.pref1(MemoryMap.store_queue);
|
||||
}
|
||||
}
|
||||
public static class polygon_type_0
|
||||
extends StoreQueueBuffer
|
||||
{
|
||||
|
||||
public int parameter_control_word;
|
||||
public int isp_tsp_instruction_word;
|
||||
public int tsp_instruction_word;
|
||||
public int texture_control_word;
|
||||
public int data_size_for_sort_dma;
|
||||
public int next_address_for_sort_dma;
|
||||
public polygon_type_0(int parameter_control_word,
|
||||
public static void polygon_type_0(int parameter_control_word,
|
||||
int isp_tsp_instruction_word,
|
||||
int tsp_instruction_word,
|
||||
int texture_control_word,
|
||||
int data_size_for_sort_dma,
|
||||
int next_address_for_sort_dma
|
||||
) {
|
||||
super();
|
||||
this.parameter_control_word = parameter_control_word;
|
||||
this.isp_tsp_instruction_word = isp_tsp_instruction_word;
|
||||
this.tsp_instruction_word = tsp_instruction_word;
|
||||
this.texture_control_word = texture_control_word;
|
||||
this.data_size_for_sort_dma = data_size_for_sort_dma;
|
||||
this.next_address_for_sort_dma = next_address_for_sort_dma;
|
||||
int store_queue = MemoryMap.store_queue;
|
||||
Memory.putU4(store_queue + 0, parameter_control_word);
|
||||
Memory.putU4(store_queue + 4, isp_tsp_instruction_word);
|
||||
Memory.putU4(store_queue + 8, tsp_instruction_word);
|
||||
Memory.putU4(store_queue + 12, texture_control_word);
|
||||
Memory.putU4(store_queue + 16, 0);
|
||||
Memory.putU4(store_queue + 20, 0);
|
||||
Memory.putU4(store_queue + 24, data_size_for_sort_dma);
|
||||
Memory.putU4(store_queue + 28, next_address_for_sort_dma);
|
||||
Memory.putU4(0xff000038, ((MemoryMap.ta_fifo_polygon_converter >> 26) & 0b111) << 2); // QACR0
|
||||
SH4Intrinsic.pref1(store_queue);
|
||||
}
|
||||
public void submit() {
|
||||
putInt(0, parameter_control_word);
|
||||
putInt(4, isp_tsp_instruction_word);
|
||||
putInt(8, tsp_instruction_word);
|
||||
putInt(12, texture_control_word);
|
||||
putInt(16, 0);
|
||||
putInt(20, 0);
|
||||
putInt(24, data_size_for_sort_dma);
|
||||
putInt(28, next_address_for_sort_dma);
|
||||
Memory.putU4(0xff000038, MemoryMap.ta_fifo_polygon_converter); // QACR0
|
||||
SH4Intrinsic.pref1(MemoryMap.store_queue);
|
||||
}
|
||||
}
|
||||
public static class polygon_type_1
|
||||
extends StoreQueueBuffer
|
||||
{
|
||||
|
||||
public int parameter_control_word;
|
||||
public int isp_tsp_instruction_word;
|
||||
public int tsp_instruction_word;
|
||||
public int texture_control_word;
|
||||
public float face_color_alpha;
|
||||
public float face_color_r;
|
||||
public float face_color_g;
|
||||
public float face_color_b;
|
||||
public polygon_type_1(int parameter_control_word,
|
||||
public static void polygon_type_1(int parameter_control_word,
|
||||
int isp_tsp_instruction_word,
|
||||
int tsp_instruction_word,
|
||||
int texture_control_word,
|
||||
@ -161,48 +84,19 @@ public class TAGlobalParameter {
|
||||
float face_color_g,
|
||||
float face_color_b
|
||||
) {
|
||||
super();
|
||||
this.parameter_control_word = parameter_control_word;
|
||||
this.isp_tsp_instruction_word = isp_tsp_instruction_word;
|
||||
this.tsp_instruction_word = tsp_instruction_word;
|
||||
this.texture_control_word = texture_control_word;
|
||||
this.face_color_alpha = face_color_alpha;
|
||||
this.face_color_r = face_color_r;
|
||||
this.face_color_g = face_color_g;
|
||||
this.face_color_b = face_color_b;
|
||||
int store_queue = MemoryMap.store_queue;
|
||||
Memory.putU4(store_queue + 0, parameter_control_word);
|
||||
Memory.putU4(store_queue + 4, isp_tsp_instruction_word);
|
||||
Memory.putU4(store_queue + 8, tsp_instruction_word);
|
||||
Memory.putU4(store_queue + 12, texture_control_word);
|
||||
Memory.putF4(store_queue + 16, face_color_alpha);
|
||||
Memory.putF4(store_queue + 20, face_color_r);
|
||||
Memory.putF4(store_queue + 24, face_color_g);
|
||||
Memory.putF4(store_queue + 28, face_color_b);
|
||||
Memory.putU4(0xff000038, ((MemoryMap.ta_fifo_polygon_converter >> 26) & 0b111) << 2); // QACR0
|
||||
SH4Intrinsic.pref1(store_queue);
|
||||
}
|
||||
public void submit() {
|
||||
putInt(0, parameter_control_word);
|
||||
putInt(4, isp_tsp_instruction_word);
|
||||
putInt(8, tsp_instruction_word);
|
||||
putInt(12, texture_control_word);
|
||||
putFloat(16, face_color_alpha);
|
||||
putFloat(20, face_color_r);
|
||||
putFloat(24, face_color_g);
|
||||
putFloat(28, face_color_b);
|
||||
Memory.putU4(0xff000038, MemoryMap.ta_fifo_polygon_converter); // QACR0
|
||||
SH4Intrinsic.pref1(MemoryMap.store_queue);
|
||||
}
|
||||
}
|
||||
public static class polygon_type_2
|
||||
extends StoreQueueBuffer
|
||||
{
|
||||
|
||||
public int parameter_control_word;
|
||||
public int isp_tsp_instruction_word;
|
||||
public int tsp_instruction_word;
|
||||
public int texture_control_word;
|
||||
public int data_size_for_sort_dma;
|
||||
public int next_address_for_sort_dma;
|
||||
public float face_color_alpha;
|
||||
public float face_color_r;
|
||||
public float face_color_g;
|
||||
public float face_color_b;
|
||||
public float face_offset_color_alpha;
|
||||
public float face_offset_color_r;
|
||||
public float face_offset_color_g;
|
||||
public float face_offset_color_b;
|
||||
public polygon_type_2(int parameter_control_word,
|
||||
public static void polygon_type_2(int parameter_control_word,
|
||||
int isp_tsp_instruction_word,
|
||||
int tsp_instruction_word,
|
||||
int texture_control_word,
|
||||
@ -217,57 +111,28 @@ public class TAGlobalParameter {
|
||||
float face_offset_color_g,
|
||||
float face_offset_color_b
|
||||
) {
|
||||
super();
|
||||
this.parameter_control_word = parameter_control_word;
|
||||
this.isp_tsp_instruction_word = isp_tsp_instruction_word;
|
||||
this.tsp_instruction_word = tsp_instruction_word;
|
||||
this.texture_control_word = texture_control_word;
|
||||
this.data_size_for_sort_dma = data_size_for_sort_dma;
|
||||
this.next_address_for_sort_dma = next_address_for_sort_dma;
|
||||
this.face_color_alpha = face_color_alpha;
|
||||
this.face_color_r = face_color_r;
|
||||
this.face_color_g = face_color_g;
|
||||
this.face_color_b = face_color_b;
|
||||
this.face_offset_color_alpha = face_offset_color_alpha;
|
||||
this.face_offset_color_r = face_offset_color_r;
|
||||
this.face_offset_color_g = face_offset_color_g;
|
||||
this.face_offset_color_b = face_offset_color_b;
|
||||
int store_queue = MemoryMap.store_queue;
|
||||
Memory.putU4(store_queue + 0, parameter_control_word);
|
||||
Memory.putU4(store_queue + 4, isp_tsp_instruction_word);
|
||||
Memory.putU4(store_queue + 8, tsp_instruction_word);
|
||||
Memory.putU4(store_queue + 12, texture_control_word);
|
||||
Memory.putU4(store_queue + 16, 0);
|
||||
Memory.putU4(store_queue + 20, 0);
|
||||
Memory.putU4(store_queue + 24, data_size_for_sort_dma);
|
||||
Memory.putU4(store_queue + 28, next_address_for_sort_dma);
|
||||
Memory.putF4(store_queue + 32, face_color_alpha);
|
||||
Memory.putF4(store_queue + 36, face_color_r);
|
||||
Memory.putF4(store_queue + 40, face_color_g);
|
||||
Memory.putF4(store_queue + 44, face_color_b);
|
||||
Memory.putF4(store_queue + 48, face_offset_color_alpha);
|
||||
Memory.putF4(store_queue + 52, face_offset_color_r);
|
||||
Memory.putF4(store_queue + 56, face_offset_color_g);
|
||||
Memory.putF4(store_queue + 60, face_offset_color_b);
|
||||
Memory.putU4(0xff000038, ((MemoryMap.ta_fifo_polygon_converter >> 26) & 0b111) << 2); // QACR0
|
||||
Memory.putU4(0xff00003c, ((MemoryMap.ta_fifo_polygon_converter >> 26) & 0b111) << 2); // QACR1
|
||||
SH4Intrinsic.pref2(store_queue);
|
||||
}
|
||||
public void submit() {
|
||||
putInt(0, parameter_control_word);
|
||||
putInt(4, isp_tsp_instruction_word);
|
||||
putInt(8, tsp_instruction_word);
|
||||
putInt(12, texture_control_word);
|
||||
putInt(16, 0);
|
||||
putInt(20, 0);
|
||||
putInt(24, data_size_for_sort_dma);
|
||||
putInt(28, next_address_for_sort_dma);
|
||||
putFloat(32, face_color_alpha);
|
||||
putFloat(36, face_color_r);
|
||||
putFloat(40, face_color_g);
|
||||
putFloat(44, face_color_b);
|
||||
putFloat(48, face_offset_color_alpha);
|
||||
putFloat(52, face_offset_color_r);
|
||||
putFloat(56, face_offset_color_g);
|
||||
putFloat(60, face_offset_color_b);
|
||||
Memory.putU4(0xff000038, MemoryMap.ta_fifo_polygon_converter); // QACR0
|
||||
Memory.putU4(0xff00003c, MemoryMap.ta_fifo_polygon_converter); // QACR1
|
||||
SH4Intrinsic.pref2(MemoryMap.store_queue);
|
||||
}
|
||||
}
|
||||
public static class polygon_type_3
|
||||
extends StoreQueueBuffer
|
||||
{
|
||||
|
||||
public int parameter_control_word;
|
||||
public int isp_tsp_instruction_word;
|
||||
public int tsp_instruction_word_0;
|
||||
public int texture_control_word_0;
|
||||
public int tsp_instruction_word_1;
|
||||
public int texture_control_word_1;
|
||||
public int data_size_for_sort_dma;
|
||||
public int next_address_for_sort_dma;
|
||||
public polygon_type_3(int parameter_control_word,
|
||||
public static void polygon_type_3(int parameter_control_word,
|
||||
int isp_tsp_instruction_word,
|
||||
int tsp_instruction_word_0,
|
||||
int texture_control_word_0,
|
||||
@ -276,50 +141,19 @@ public class TAGlobalParameter {
|
||||
int data_size_for_sort_dma,
|
||||
int next_address_for_sort_dma
|
||||
) {
|
||||
super();
|
||||
this.parameter_control_word = parameter_control_word;
|
||||
this.isp_tsp_instruction_word = isp_tsp_instruction_word;
|
||||
this.tsp_instruction_word_0 = tsp_instruction_word_0;
|
||||
this.texture_control_word_0 = texture_control_word_0;
|
||||
this.tsp_instruction_word_1 = tsp_instruction_word_1;
|
||||
this.texture_control_word_1 = texture_control_word_1;
|
||||
this.data_size_for_sort_dma = data_size_for_sort_dma;
|
||||
this.next_address_for_sort_dma = next_address_for_sort_dma;
|
||||
int store_queue = MemoryMap.store_queue;
|
||||
Memory.putU4(store_queue + 0, parameter_control_word);
|
||||
Memory.putU4(store_queue + 4, isp_tsp_instruction_word);
|
||||
Memory.putU4(store_queue + 8, tsp_instruction_word_0);
|
||||
Memory.putU4(store_queue + 12, texture_control_word_0);
|
||||
Memory.putU4(store_queue + 16, tsp_instruction_word_1);
|
||||
Memory.putU4(store_queue + 20, texture_control_word_1);
|
||||
Memory.putU4(store_queue + 24, data_size_for_sort_dma);
|
||||
Memory.putU4(store_queue + 28, next_address_for_sort_dma);
|
||||
Memory.putU4(0xff000038, ((MemoryMap.ta_fifo_polygon_converter >> 26) & 0b111) << 2); // QACR0
|
||||
SH4Intrinsic.pref1(store_queue);
|
||||
}
|
||||
public void submit() {
|
||||
putInt(0, parameter_control_word);
|
||||
putInt(4, isp_tsp_instruction_word);
|
||||
putInt(8, tsp_instruction_word_0);
|
||||
putInt(12, texture_control_word_0);
|
||||
putInt(16, tsp_instruction_word_1);
|
||||
putInt(20, texture_control_word_1);
|
||||
putInt(24, data_size_for_sort_dma);
|
||||
putInt(28, next_address_for_sort_dma);
|
||||
Memory.putU4(0xff000038, MemoryMap.ta_fifo_polygon_converter); // QACR0
|
||||
SH4Intrinsic.pref1(MemoryMap.store_queue);
|
||||
}
|
||||
}
|
||||
public static class polygon_type_4
|
||||
extends StoreQueueBuffer
|
||||
{
|
||||
|
||||
public int parameter_control_word;
|
||||
public int isp_tsp_instruction_word;
|
||||
public int tsp_instruction_word_0;
|
||||
public int texture_control_word_0;
|
||||
public int tsp_instruction_word_1;
|
||||
public int texture_control_word_1;
|
||||
public int data_size_for_sort_dma;
|
||||
public int next_address_for_sort_dma;
|
||||
public float face_color_alpha_0;
|
||||
public float face_color_r_0;
|
||||
public float face_color_g_0;
|
||||
public float face_color_b_0;
|
||||
public float face_color_alpha_1;
|
||||
public float face_color_r_1;
|
||||
public float face_color_g_1;
|
||||
public float face_color_b_1;
|
||||
public polygon_type_4(int parameter_control_word,
|
||||
public static void polygon_type_4(int parameter_control_word,
|
||||
int isp_tsp_instruction_word,
|
||||
int tsp_instruction_word_0,
|
||||
int texture_control_word_0,
|
||||
@ -336,59 +170,28 @@ public class TAGlobalParameter {
|
||||
float face_color_g_1,
|
||||
float face_color_b_1
|
||||
) {
|
||||
super();
|
||||
this.parameter_control_word = parameter_control_word;
|
||||
this.isp_tsp_instruction_word = isp_tsp_instruction_word;
|
||||
this.tsp_instruction_word_0 = tsp_instruction_word_0;
|
||||
this.texture_control_word_0 = texture_control_word_0;
|
||||
this.tsp_instruction_word_1 = tsp_instruction_word_1;
|
||||
this.texture_control_word_1 = texture_control_word_1;
|
||||
this.data_size_for_sort_dma = data_size_for_sort_dma;
|
||||
this.next_address_for_sort_dma = next_address_for_sort_dma;
|
||||
this.face_color_alpha_0 = face_color_alpha_0;
|
||||
this.face_color_r_0 = face_color_r_0;
|
||||
this.face_color_g_0 = face_color_g_0;
|
||||
this.face_color_b_0 = face_color_b_0;
|
||||
this.face_color_alpha_1 = face_color_alpha_1;
|
||||
this.face_color_r_1 = face_color_r_1;
|
||||
this.face_color_g_1 = face_color_g_1;
|
||||
this.face_color_b_1 = face_color_b_1;
|
||||
int store_queue = MemoryMap.store_queue;
|
||||
Memory.putU4(store_queue + 0, parameter_control_word);
|
||||
Memory.putU4(store_queue + 4, isp_tsp_instruction_word);
|
||||
Memory.putU4(store_queue + 8, tsp_instruction_word_0);
|
||||
Memory.putU4(store_queue + 12, texture_control_word_0);
|
||||
Memory.putU4(store_queue + 16, tsp_instruction_word_1);
|
||||
Memory.putU4(store_queue + 20, texture_control_word_1);
|
||||
Memory.putU4(store_queue + 24, data_size_for_sort_dma);
|
||||
Memory.putU4(store_queue + 28, next_address_for_sort_dma);
|
||||
Memory.putF4(store_queue + 32, face_color_alpha_0);
|
||||
Memory.putF4(store_queue + 36, face_color_r_0);
|
||||
Memory.putF4(store_queue + 40, face_color_g_0);
|
||||
Memory.putF4(store_queue + 44, face_color_b_0);
|
||||
Memory.putF4(store_queue + 48, face_color_alpha_1);
|
||||
Memory.putF4(store_queue + 52, face_color_r_1);
|
||||
Memory.putF4(store_queue + 56, face_color_g_1);
|
||||
Memory.putF4(store_queue + 60, face_color_b_1);
|
||||
Memory.putU4(0xff000038, ((MemoryMap.ta_fifo_polygon_converter >> 26) & 0b111) << 2); // QACR0
|
||||
Memory.putU4(0xff00003c, ((MemoryMap.ta_fifo_polygon_converter >> 26) & 0b111) << 2); // QACR1
|
||||
SH4Intrinsic.pref2(store_queue);
|
||||
}
|
||||
public void submit() {
|
||||
putInt(0, parameter_control_word);
|
||||
putInt(4, isp_tsp_instruction_word);
|
||||
putInt(8, tsp_instruction_word_0);
|
||||
putInt(12, texture_control_word_0);
|
||||
putInt(16, tsp_instruction_word_1);
|
||||
putInt(20, texture_control_word_1);
|
||||
putInt(24, data_size_for_sort_dma);
|
||||
putInt(28, next_address_for_sort_dma);
|
||||
putFloat(32, face_color_alpha_0);
|
||||
putFloat(36, face_color_r_0);
|
||||
putFloat(40, face_color_g_0);
|
||||
putFloat(44, face_color_b_0);
|
||||
putFloat(48, face_color_alpha_1);
|
||||
putFloat(52, face_color_r_1);
|
||||
putFloat(56, face_color_g_1);
|
||||
putFloat(60, face_color_b_1);
|
||||
Memory.putU4(0xff000038, MemoryMap.ta_fifo_polygon_converter); // QACR0
|
||||
Memory.putU4(0xff00003c, MemoryMap.ta_fifo_polygon_converter); // QACR1
|
||||
SH4Intrinsic.pref2(MemoryMap.store_queue);
|
||||
}
|
||||
}
|
||||
public static class sprite
|
||||
extends StoreQueueBuffer
|
||||
{
|
||||
|
||||
public int parameter_control_word;
|
||||
public int isp_tsp_instruction_word;
|
||||
public int tsp_instruction_word;
|
||||
public int texture_control_word;
|
||||
public int base_color;
|
||||
public int offset_color;
|
||||
public int data_size_for_sort_dma;
|
||||
public int next_address_for_sort_dma;
|
||||
public sprite(int parameter_control_word,
|
||||
public static void sprite(int parameter_control_word,
|
||||
int isp_tsp_instruction_word,
|
||||
int tsp_instruction_word,
|
||||
int texture_control_word,
|
||||
@ -397,53 +200,31 @@ public class TAGlobalParameter {
|
||||
int data_size_for_sort_dma,
|
||||
int next_address_for_sort_dma
|
||||
) {
|
||||
super();
|
||||
this.parameter_control_word = parameter_control_word;
|
||||
this.isp_tsp_instruction_word = isp_tsp_instruction_word;
|
||||
this.tsp_instruction_word = tsp_instruction_word;
|
||||
this.texture_control_word = texture_control_word;
|
||||
this.base_color = base_color;
|
||||
this.offset_color = offset_color;
|
||||
this.data_size_for_sort_dma = data_size_for_sort_dma;
|
||||
this.next_address_for_sort_dma = next_address_for_sort_dma;
|
||||
int store_queue = MemoryMap.store_queue;
|
||||
Memory.putU4(store_queue + 0, parameter_control_word);
|
||||
Memory.putU4(store_queue + 4, isp_tsp_instruction_word);
|
||||
Memory.putU4(store_queue + 8, tsp_instruction_word);
|
||||
Memory.putU4(store_queue + 12, texture_control_word);
|
||||
Memory.putU4(store_queue + 16, base_color);
|
||||
Memory.putU4(store_queue + 20, offset_color);
|
||||
Memory.putU4(store_queue + 24, data_size_for_sort_dma);
|
||||
Memory.putU4(store_queue + 28, next_address_for_sort_dma);
|
||||
Memory.putU4(0xff000038, ((MemoryMap.ta_fifo_polygon_converter >> 26) & 0b111) << 2); // QACR0
|
||||
SH4Intrinsic.pref1(store_queue);
|
||||
}
|
||||
public void submit() {
|
||||
putInt(0, parameter_control_word);
|
||||
putInt(4, isp_tsp_instruction_word);
|
||||
putInt(8, tsp_instruction_word);
|
||||
putInt(12, texture_control_word);
|
||||
putInt(16, base_color);
|
||||
putInt(20, offset_color);
|
||||
putInt(24, data_size_for_sort_dma);
|
||||
putInt(28, next_address_for_sort_dma);
|
||||
Memory.putU4(0xff000038, MemoryMap.ta_fifo_polygon_converter); // QACR0
|
||||
SH4Intrinsic.pref1(MemoryMap.store_queue);
|
||||
}
|
||||
}
|
||||
public static class modifier_volume
|
||||
extends StoreQueueBuffer
|
||||
{
|
||||
|
||||
public int parameter_control_word;
|
||||
public int isp_tsp_instruction_word;
|
||||
public modifier_volume(int parameter_control_word,
|
||||
public static void modifier_volume(int parameter_control_word,
|
||||
int isp_tsp_instruction_word
|
||||
) {
|
||||
super();
|
||||
this.parameter_control_word = parameter_control_word;
|
||||
this.isp_tsp_instruction_word = isp_tsp_instruction_word;
|
||||
}
|
||||
public void submit() {
|
||||
putInt(0, parameter_control_word);
|
||||
putInt(4, isp_tsp_instruction_word);
|
||||
putInt(8, 0);
|
||||
putInt(12, 0);
|
||||
putInt(16, 0);
|
||||
putInt(20, 0);
|
||||
putInt(24, 0);
|
||||
putInt(28, 0);
|
||||
Memory.putU4(0xff000038, MemoryMap.ta_fifo_polygon_converter); // QACR0
|
||||
SH4Intrinsic.pref1(MemoryMap.store_queue);
|
||||
}
|
||||
int store_queue = MemoryMap.store_queue;
|
||||
Memory.putU4(store_queue + 0, parameter_control_word);
|
||||
Memory.putU4(store_queue + 4, isp_tsp_instruction_word);
|
||||
Memory.putU4(store_queue + 8, 0);
|
||||
Memory.putU4(store_queue + 12, 0);
|
||||
Memory.putU4(store_queue + 16, 0);
|
||||
Memory.putU4(store_queue + 20, 0);
|
||||
Memory.putU4(store_queue + 24, 0);
|
||||
Memory.putU4(store_queue + 28, 0);
|
||||
Memory.putU4(0xff000038, ((MemoryMap.ta_fifo_polygon_converter >> 26) & 0b111) << 2); // QACR0
|
||||
SH4Intrinsic.pref1(store_queue);
|
||||
}
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -77,9 +77,6 @@ CLASS_PATH = \
|
||||
classes/sega/dreamcast/holly/TABits.class.o \
|
||||
classes/sega/dreamcast/holly/TAFIFOPolygonConverter.class.o \
|
||||
classes/sega/dreamcast/holly/TAGlobalParameter.class.o \
|
||||
classes/sega/dreamcast/holly/TAGlobalParameter_end_of_list.class.o \
|
||||
classes/sega/dreamcast/holly/TAGlobalParameter_polygon_type_0.class.o \
|
||||
classes/sega/dreamcast/holly/TAVertexParameter.class.o \
|
||||
classes/sega/dreamcast/holly/TAVertexParameter_polygon_type_3.class.o \
|
||||
classes/sega/dreamcast/holly/TextureMemoryAllocation.class.o \
|
||||
classes/sega/dreamcast/sh7091/StoreQueueBuffer.class.o
|
||||
|
@ -155,10 +155,7 @@ declare -a boot_classes=(
|
||||
sega/dreamcast/holly/TABits.class
|
||||
sega/dreamcast/holly/TAFIFOPolygonConverter.class
|
||||
sega/dreamcast/holly/TAGlobalParameter.class
|
||||
sega/dreamcast/holly/TAGlobalParameter_end_of_list.class
|
||||
sega/dreamcast/holly/TAGlobalParameter_polygon_type_0.class
|
||||
sega/dreamcast/holly/TAVertexParameter.class
|
||||
sega/dreamcast/holly/TAVertexParameter_polygon_type_3.class
|
||||
sega/dreamcast/holly/TextureMemoryAllocation.class
|
||||
sega/dreamcast/sh7091/StoreQueueBuffer.class
|
||||
)
|
||||
|
@ -1,127 +1,59 @@
|
||||
def render_fields(get_type, fields):
|
||||
for field in fields:
|
||||
if field.name.startswith("_res"):
|
||||
continue
|
||||
|
||||
def render_method_definition(get_type, declaration):
|
||||
yield "int store_queue = MemoryMap.store_queue;"
|
||||
for i, field in enumerate(declaration.fields):
|
||||
index = i * 4
|
||||
value = "0" if "_res" in field.name else field.name
|
||||
field_type = get_type(field.name)
|
||||
if field.array_length == 1:
|
||||
yield f"public {field_type} {field.name};"
|
||||
if field_type == "int":
|
||||
yield f"Memory.putU4(store_queue + {index}, {value});"
|
||||
elif field_type == "float":
|
||||
yield f"Memory.putF4(store_queue + {index}, {value});"
|
||||
else:
|
||||
for i in range(field.array_length):
|
||||
yield f"public {field_type} {field.name}{i};"
|
||||
assert False, field_type
|
||||
yield "Memory.putU4(0xff000038, ((MemoryMap.ta_fifo_polygon_converter >> 26) & 0b111) << 2); // QACR0";
|
||||
if len(declaration.fields) == 16:
|
||||
yield "Memory.putU4(0xff00003c, ((MemoryMap.ta_fifo_polygon_converter >> 26) & 0b111) << 2); // QACR1";
|
||||
if len(declaration.fields) == 8:
|
||||
yield "SH4Intrinsic.pref1(store_queue);"
|
||||
else:
|
||||
yield "SH4Intrinsic.pref2(store_queue);"
|
||||
|
||||
def render_constructor(get_type, declaration, store_queue_buffer):
|
||||
initializer = f"public {declaration.name}("
|
||||
def render_method_declaration(get_type, declaration):
|
||||
initializer = f"public static void {declaration.name}("
|
||||
padding = " " * len(initializer)
|
||||
def start(i):
|
||||
if i == 0:
|
||||
return initializer
|
||||
else:
|
||||
return padding
|
||||
constructor_fields = [f for f in declaration.fields
|
||||
declaration_fields = [f for f in declaration.fields
|
||||
if (not f.name.startswith('_res')
|
||||
and f.default is None
|
||||
)]
|
||||
for i, field in enumerate(constructor_fields):
|
||||
for i, field in enumerate(declaration_fields):
|
||||
s = start(i)
|
||||
assert field.array_length <= 4, field
|
||||
type = get_type(field.name) if field.array_length == 1 else "int"
|
||||
comma = ',' if i + 1 < len(constructor_fields) else ''
|
||||
comma = ',' if i + 1 < len(declaration_fields) else ''
|
||||
yield s + f"{type} {field.name}" + comma
|
||||
|
||||
if constructor_fields:
|
||||
if declaration_fields:
|
||||
yield padding + ') {'
|
||||
else:
|
||||
yield initializer + ') {'
|
||||
|
||||
yield "super();"
|
||||
|
||||
for i, field in enumerate(declaration.fields):
|
||||
if field.name.startswith("_res"):
|
||||
continue
|
||||
|
||||
value = field.name if not field.name.startswith('_res') else '0'
|
||||
value = hex(field.default) if field.default is not None else value
|
||||
s = ':' if i == 0 else ','
|
||||
if field.array_length == 1:
|
||||
yield f"this.{field.name} = {value};"
|
||||
else:
|
||||
max_shift = 8 * (field.array_length - 1)
|
||||
for i in range(field.array_length):
|
||||
shift = max_shift - (i * 8)
|
||||
yield f"this.{field.name}{i} = ({field.name} >> {shift}) & 0xff;"
|
||||
yield from render_method_definition(get_type, declaration)
|
||||
|
||||
yield "}"
|
||||
|
||||
array_fields = [f for f in declaration.fields
|
||||
if f.array_length > 1]
|
||||
|
||||
def render_get_byte(fields):
|
||||
ix = 0
|
||||
yield "public int getByte(int ix) {"
|
||||
yield "switch (ix) {"
|
||||
for field in fields:
|
||||
if "_res" in field.name:
|
||||
continue
|
||||
if field.array_length == 1:
|
||||
yield f"case {ix}: return {field.name};"
|
||||
else:
|
||||
for i in range(field.array_length):
|
||||
yield f"case {ix + i}: return {field.name}{i};"
|
||||
ix += field.array_length
|
||||
yield "default: return 0;"
|
||||
yield "}"
|
||||
yield "}"
|
||||
|
||||
def render_submit(get_type, fields):
|
||||
yield "public void submit() {"
|
||||
for i, field in enumerate(fields):
|
||||
index = i * 4
|
||||
value = "0" if "_res" in field.name else field.name
|
||||
field_type = get_type(field.name)
|
||||
if field_type == "int":
|
||||
yield f"putInt({index}, {value});"
|
||||
elif field_type == "float":
|
||||
yield f"putFloat({index}, {value});"
|
||||
else:
|
||||
assert False, field_type
|
||||
yield "Memory.putU4(0xff000038, MemoryMap.ta_fifo_polygon_converter); // QACR0";
|
||||
if len(fields) == 16:
|
||||
yield "Memory.putU4(0xff00003c, MemoryMap.ta_fifo_polygon_converter); // QACR1";
|
||||
if len(fields) == 8:
|
||||
yield "SH4Intrinsic.pref1(MemoryMap.store_queue);"
|
||||
else:
|
||||
yield "SH4Intrinsic.pref2(MemoryMap.store_queue);"
|
||||
|
||||
yield "}"
|
||||
|
||||
def render_declaration(get_type, declaration, store_queue_buffer, get_byte):
|
||||
yield f"public static class {declaration.name}"
|
||||
if store_queue_buffer:
|
||||
assert len(declaration.fields) in {8, 16}, len(declaration.fields)
|
||||
yield " extends StoreQueueBuffer"
|
||||
if get_byte: # FIXME: hack?
|
||||
yield " implements GdromCommandPacketInterface"
|
||||
yield "{"
|
||||
yield ""
|
||||
yield from render_fields(get_type, declaration.fields)
|
||||
yield from render_constructor(get_type, declaration, store_queue_buffer)
|
||||
if get_byte:
|
||||
yield from render_get_byte(declaration.fields)
|
||||
if store_queue_buffer:
|
||||
yield from render_submit(get_type, declaration.fields)
|
||||
yield "}"
|
||||
|
||||
def render_declarations(get_type, package_name, class_name, declarations, *, store_queue_buffer, get_byte):
|
||||
def render_declarations(get_type, package_name, class_name, declarations):
|
||||
yield f"package sega.dreamcast.{package_name};"
|
||||
yield ""
|
||||
if store_queue_buffer:
|
||||
yield "import sega.dreamcast.MemoryMap;"
|
||||
yield "import sega.dreamcast.sh7091.StoreQueueBuffer;"
|
||||
yield "import jvm.internal.SH4Intrinsic;"
|
||||
yield "import jvm.internal.Memory;"
|
||||
yield ""
|
||||
yield f"public class {class_name} {{"
|
||||
for declaration in declarations:
|
||||
yield from render_declaration(get_type, declaration, store_queue_buffer, get_byte)
|
||||
yield from render_method_declaration(get_type, declaration)
|
||||
yield "}"
|
||||
|
@ -65,7 +65,5 @@ if __name__ == "__main__":
|
||||
expected_offset=4,
|
||||
expected_sizes={32, 64})
|
||||
render, out = renderer(indent_length=4)
|
||||
render(render_declarations(get_type, package_name, class_name, declarations,
|
||||
store_queue_buffer=True,
|
||||
get_byte=False))
|
||||
render(render_declarations(get_type, package_name, class_name, declarations))
|
||||
sys.stdout.write(out.getvalue())
|
||||
|
Loading…
x
Reference in New Issue
Block a user