diff --git a/c/classpath.h b/c/classpath.h index b3beaeb..96028a6 100644 --- a/c/classpath.h +++ b/c/classpath.h @@ -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" diff --git a/c/classpath.inc.c b/c/classpath.inc.c index 64c60d1..a04afe1 100644 --- a/c/classpath.inc.c +++ b/c/classpath.inc.c @@ -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, diff --git a/c/native.c b/c/native.c index 76a866e..ce844bb 100644 --- a/c/native.c +++ b/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", diff --git a/classes/example/JavaCube.java b/classes/example/JavaCube.java index 9889269..9f993b2 100644 --- a/classes/example/JavaCube.java +++ b/classes/example/JavaCube.java @@ -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 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; + + 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; + + 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; + + 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); + 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 - | 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 - | ISPTSP.isp_tsp_instruction_word__culling_mode__no_culling; - - 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 - | 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); } - 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) { diff --git a/classes/jvm/internal/Memory.java b/classes/jvm/internal/Memory.java index 6dd5f8a..ff68d82 100644 --- a/classes/jvm/internal/Memory.java +++ b/classes/jvm/internal/Memory.java @@ -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); diff --git a/classes/sega/dreamcast/holly/TAGlobalParameter.java b/classes/sega/dreamcast/holly/TAGlobalParameter.java index 2c19354..cc4a599 100644 --- a/classes/sega/dreamcast/holly/TAGlobalParameter.java +++ b/classes/sega/dreamcast/holly/TAGlobalParameter.java @@ -1,449 +1,230 @@ 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 - ) { - super(); - this.parameter_control_word = parameter_control_word; - } - 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 void end_of_list(int 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 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, - 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; - } - 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 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 + ) { + 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 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, - 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; - } - 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 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 + ) { + 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 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 + ) { + 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 static void polygon_type_1(int parameter_control_word, + int isp_tsp_instruction_word, + int tsp_instruction_word, + int texture_control_word, + float face_color_alpha, + float face_color_r, + float face_color_g, + float 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 static void polygon_type_2(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, + float face_color_alpha, + float face_color_r, + float face_color_g, + float face_color_b, + float face_offset_color_alpha, + float face_offset_color_r, + float face_offset_color_g, + float 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 static void polygon_type_3(int parameter_control_word, + int isp_tsp_instruction_word, + int tsp_instruction_word_0, + int texture_control_word_0, + int tsp_instruction_word_1, + int texture_control_word_1, + int data_size_for_sort_dma, + int 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 static void polygon_type_4(int parameter_control_word, + int isp_tsp_instruction_word, + int tsp_instruction_word_0, + int texture_control_word_0, + int tsp_instruction_word_1, + int texture_control_word_1, + int data_size_for_sort_dma, + int next_address_for_sort_dma, + float face_color_alpha_0, + float face_color_r_0, + float face_color_g_0, + float face_color_b_0, + float face_color_alpha_1, + float face_color_r_1, + float face_color_g_1, + float 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 static void sprite(int parameter_control_word, int isp_tsp_instruction_word, int tsp_instruction_word, int texture_control_word, + int base_color, + int offset_color, 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; - } - 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); - } + 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 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, - int isp_tsp_instruction_word, - int tsp_instruction_word, - int texture_control_word, - float face_color_alpha, - float face_color_r, - 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; - } - 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, - 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, - float face_color_alpha, - float face_color_r, - float face_color_g, - float face_color_b, - float face_offset_color_alpha, - float face_offset_color_r, - 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; - } - 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, - int isp_tsp_instruction_word, - int tsp_instruction_word_0, - int texture_control_word_0, - int tsp_instruction_word_1, - int texture_control_word_1, - 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; - } - 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, - int isp_tsp_instruction_word, - int tsp_instruction_word_0, - int texture_control_word_0, - int tsp_instruction_word_1, - int texture_control_word_1, - int data_size_for_sort_dma, - int next_address_for_sort_dma, - float face_color_alpha_0, - float face_color_r_0, - float face_color_g_0, - float face_color_b_0, - float face_color_alpha_1, - float face_color_r_1, - 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; - } - 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, - int isp_tsp_instruction_word, - int tsp_instruction_word, - int texture_control_word, - int base_color, - int offset_color, - 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; - } - 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, - 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); - } + public static void modifier_volume(int parameter_control_word, + int isp_tsp_instruction_word + ) { + 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); } } diff --git a/classes/sega/dreamcast/holly/TAVertexParameter.java b/classes/sega/dreamcast/holly/TAVertexParameter.java index 1ba1965..1a82c7a 100644 --- a/classes/sega/dreamcast/holly/TAVertexParameter.java +++ b/classes/sega/dreamcast/holly/TAVertexParameter.java @@ -1,955 +1,491 @@ package sega.dreamcast.holly; import sega.dreamcast.MemoryMap; -import sega.dreamcast.sh7091.StoreQueueBuffer; import jvm.internal.SH4Intrinsic; import jvm.internal.Memory; public class TAVertexParameter { - public static class polygon_type_0 - extends StoreQueueBuffer - { - - public int parameter_control_word; - public float x; - public float y; - public float z; - public int base_color; - public polygon_type_0(int parameter_control_word, - float x, - float y, - float z, - int base_color - ) { - super(); - this.parameter_control_word = parameter_control_word; - this.x = x; - this.y = y; - this.z = z; - this.base_color = base_color; - } - public void submit() { - System.out.println(this.address); - putInt(0, parameter_control_word); - putFloat(4, x); - putFloat(8, y); - putFloat(12, z); - putInt(16, 0); - putInt(20, 0); - putInt(24, base_color); - putInt(28, 0); - Memory.putU4(0xff000038, MemoryMap.ta_fifo_polygon_converter); // QACR0 - SH4Intrinsic.pref1(MemoryMap.store_queue); - } + public static void polygon_type_0(int parameter_control_word, + float x, + float y, + float z, + int base_color + ) { + int store_queue = MemoryMap.store_queue; + Memory.putU4(store_queue + 0, parameter_control_word); + Memory.putF4(store_queue + 4, x); + Memory.putF4(store_queue + 8, y); + Memory.putF4(store_queue + 12, z); + Memory.putU4(store_queue + 16, 0); + Memory.putU4(store_queue + 20, 0); + Memory.putU4(store_queue + 24, base_color); + Memory.putU4(store_queue + 28, 0); + Memory.putU4(0xff000038, ((MemoryMap.ta_fifo_polygon_converter >> 26) & 0b111) << 2); // QACR0 + SH4Intrinsic.pref1(store_queue); } - public static class polygon_type_1 - extends StoreQueueBuffer - { - - public int parameter_control_word; - public float x; - public float y; - public float z; - public float base_color_alpha; - public float base_color_r; - public float base_color_g; - public float base_color_b; - public polygon_type_1(int parameter_control_word, - float x, - float y, - float z, - float base_color_alpha, - float base_color_r, - float base_color_g, - float base_color_b - ) { - super(); - this.parameter_control_word = parameter_control_word; - this.x = x; - this.y = y; - this.z = z; - this.base_color_alpha = base_color_alpha; - this.base_color_r = base_color_r; - this.base_color_g = base_color_g; - this.base_color_b = base_color_b; - } - public void submit() { - putInt(0, parameter_control_word); - putFloat(4, x); - putFloat(8, y); - putFloat(12, z); - putFloat(16, base_color_alpha); - putFloat(20, base_color_r); - putFloat(24, base_color_g); - putFloat(28, base_color_b); - Memory.putU4(0xff000038, MemoryMap.ta_fifo_polygon_converter); // QACR0 - SH4Intrinsic.pref1(MemoryMap.store_queue); - } + public static void polygon_type_1(int parameter_control_word, + float x, + float y, + float z, + float base_color_alpha, + float base_color_r, + float base_color_g, + float base_color_b + ) { + int store_queue = MemoryMap.store_queue; + Memory.putU4(store_queue + 0, parameter_control_word); + Memory.putF4(store_queue + 4, x); + Memory.putF4(store_queue + 8, y); + Memory.putF4(store_queue + 12, z); + Memory.putF4(store_queue + 16, base_color_alpha); + Memory.putF4(store_queue + 20, base_color_r); + Memory.putF4(store_queue + 24, base_color_g); + Memory.putF4(store_queue + 28, base_color_b); + Memory.putU4(0xff000038, ((MemoryMap.ta_fifo_polygon_converter >> 26) & 0b111) << 2); // QACR0 + SH4Intrinsic.pref1(store_queue); } - public static class polygon_type_2 - extends StoreQueueBuffer - { - - public int parameter_control_word; - public float x; - public float y; - public float z; - public float base_intensity; - public polygon_type_2(int parameter_control_word, - float x, - float y, - float z, - float base_intensity - ) { - super(); - this.parameter_control_word = parameter_control_word; - this.x = x; - this.y = y; - this.z = z; - this.base_intensity = base_intensity; - } - public void submit() { - putInt(0, parameter_control_word); - putFloat(4, x); - putFloat(8, y); - putFloat(12, z); - putInt(16, 0); - putInt(20, 0); - putFloat(24, base_intensity); - putInt(28, 0); - Memory.putU4(0xff000038, MemoryMap.ta_fifo_polygon_converter); // QACR0 - SH4Intrinsic.pref1(MemoryMap.store_queue); - } + public static void polygon_type_2(int parameter_control_word, + float x, + float y, + float z, + float base_intensity + ) { + int store_queue = MemoryMap.store_queue; + Memory.putU4(store_queue + 0, parameter_control_word); + Memory.putF4(store_queue + 4, x); + Memory.putF4(store_queue + 8, y); + Memory.putF4(store_queue + 12, z); + Memory.putU4(store_queue + 16, 0); + Memory.putU4(store_queue + 20, 0); + Memory.putF4(store_queue + 24, base_intensity); + Memory.putU4(store_queue + 28, 0); + Memory.putU4(0xff000038, ((MemoryMap.ta_fifo_polygon_converter >> 26) & 0b111) << 2); // QACR0 + SH4Intrinsic.pref1(store_queue); } - public static class polygon_type_3 - extends StoreQueueBuffer - { - - public int parameter_control_word; - public float x; - public float y; - public float z; - public float u; - public float v; - public int base_color; - public int offset_color; - public polygon_type_3(int parameter_control_word, - float x, - float y, - float z, - float u, - float v, - int base_color, - int offset_color - ) { - super(); - this.parameter_control_word = parameter_control_word; - this.x = x; - this.y = y; - this.z = z; - this.u = u; - this.v = v; - this.base_color = base_color; - this.offset_color = offset_color; - } - public void submit() { - putInt(0, parameter_control_word); - putFloat(4, x); - putFloat(8, y); - putFloat(12, z); - putFloat(16, u); - putFloat(20, v); - putInt(24, base_color); - putInt(28, offset_color); - Memory.putU4(0xff000038, MemoryMap.ta_fifo_polygon_converter); // QACR0 - SH4Intrinsic.pref1(MemoryMap.store_queue); - } + public static void polygon_type_3(int parameter_control_word, + float x, + float y, + float z, + float u, + float v, + int base_color, + int offset_color + ) { + int store_queue = MemoryMap.store_queue; + Memory.putU4(store_queue + 0, parameter_control_word); + Memory.putF4(store_queue + 4, x); + Memory.putF4(store_queue + 8, y); + Memory.putF4(store_queue + 12, z); + Memory.putF4(store_queue + 16, u); + Memory.putF4(store_queue + 20, v); + Memory.putU4(store_queue + 24, base_color); + Memory.putU4(store_queue + 28, offset_color); + Memory.putU4(0xff000038, ((MemoryMap.ta_fifo_polygon_converter >> 26) & 0b111) << 2); // QACR0 + SH4Intrinsic.pref1(store_queue); } - public static class polygon_type_4 - extends StoreQueueBuffer - { - - public int parameter_control_word; - public float x; - public float y; - public float z; - public int u_v; - public int base_color; - public int offset_color; - public polygon_type_4(int parameter_control_word, - float x, - float y, - float z, - int u_v, - int base_color, - int offset_color - ) { - super(); - this.parameter_control_word = parameter_control_word; - this.x = x; - this.y = y; - this.z = z; - this.u_v = u_v; - this.base_color = base_color; - this.offset_color = offset_color; - } - public void submit() { - putInt(0, parameter_control_word); - putFloat(4, x); - putFloat(8, y); - putFloat(12, z); - putInt(16, u_v); - putInt(20, 0); - putInt(24, base_color); - putInt(28, offset_color); - Memory.putU4(0xff000038, MemoryMap.ta_fifo_polygon_converter); // QACR0 - SH4Intrinsic.pref1(MemoryMap.store_queue); - } + public static void polygon_type_4(int parameter_control_word, + float x, + float y, + float z, + int u_v, + int base_color, + int offset_color + ) { + int store_queue = MemoryMap.store_queue; + Memory.putU4(store_queue + 0, parameter_control_word); + Memory.putF4(store_queue + 4, x); + Memory.putF4(store_queue + 8, y); + Memory.putF4(store_queue + 12, z); + Memory.putU4(store_queue + 16, u_v); + Memory.putU4(store_queue + 20, 0); + Memory.putU4(store_queue + 24, base_color); + Memory.putU4(store_queue + 28, offset_color); + Memory.putU4(0xff000038, ((MemoryMap.ta_fifo_polygon_converter >> 26) & 0b111) << 2); // QACR0 + SH4Intrinsic.pref1(store_queue); } - public static class polygon_type_5 - extends StoreQueueBuffer - { - - public int parameter_control_word; - public float x; - public float y; - public float z; - public float u; - public float v; - public float base_color_alpha; - public float base_color_r; - public float base_color_g; - public float base_color_b; - public float offset_color_alpha; - public float offset_color_r; - public float offset_color_g; - public float offset_color_b; - public polygon_type_5(int parameter_control_word, - float x, - float y, - float z, - float u, - float v, - float base_color_alpha, - float base_color_r, - float base_color_g, - float base_color_b, - float offset_color_alpha, - float offset_color_r, - float offset_color_g, - float offset_color_b - ) { - super(); - this.parameter_control_word = parameter_control_word; - this.x = x; - this.y = y; - this.z = z; - this.u = u; - this.v = v; - this.base_color_alpha = base_color_alpha; - this.base_color_r = base_color_r; - this.base_color_g = base_color_g; - this.base_color_b = base_color_b; - this.offset_color_alpha = offset_color_alpha; - this.offset_color_r = offset_color_r; - this.offset_color_g = offset_color_g; - this.offset_color_b = offset_color_b; - } - public void submit() { - putInt(0, parameter_control_word); - putFloat(4, x); - putFloat(8, y); - putFloat(12, z); - putFloat(16, u); - putFloat(20, v); - putInt(24, 0); - putInt(28, 0); - putFloat(32, base_color_alpha); - putFloat(36, base_color_r); - putFloat(40, base_color_g); - putFloat(44, base_color_b); - putFloat(48, offset_color_alpha); - putFloat(52, offset_color_r); - putFloat(56, offset_color_g); - putFloat(60, 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 void polygon_type_5(int parameter_control_word, + float x, + float y, + float z, + float u, + float v, + float base_color_alpha, + float base_color_r, + float base_color_g, + float base_color_b, + float offset_color_alpha, + float offset_color_r, + float offset_color_g, + float offset_color_b + ) { + int store_queue = MemoryMap.store_queue; + Memory.putU4(store_queue + 0, parameter_control_word); + Memory.putF4(store_queue + 4, x); + Memory.putF4(store_queue + 8, y); + Memory.putF4(store_queue + 12, z); + Memory.putF4(store_queue + 16, u); + Memory.putF4(store_queue + 20, v); + Memory.putU4(store_queue + 24, 0); + Memory.putU4(store_queue + 28, 0); + Memory.putF4(store_queue + 32, base_color_alpha); + Memory.putF4(store_queue + 36, base_color_r); + Memory.putF4(store_queue + 40, base_color_g); + Memory.putF4(store_queue + 44, base_color_b); + Memory.putF4(store_queue + 48, offset_color_alpha); + Memory.putF4(store_queue + 52, offset_color_r); + Memory.putF4(store_queue + 56, offset_color_g); + Memory.putF4(store_queue + 60, 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 static class polygon_type_6 - extends StoreQueueBuffer - { - - public int parameter_control_word; - public float x; - public float y; - public float z; - public int u_v; - public float base_color_alpha; - public float base_color_r; - public float base_color_g; - public float base_color_b; - public float offset_color_alpha; - public float offset_color_r; - public float offset_color_g; - public float offset_color_b; - public polygon_type_6(int parameter_control_word, - float x, - float y, - float z, - int u_v, - float base_color_alpha, - float base_color_r, - float base_color_g, - float base_color_b, - float offset_color_alpha, - float offset_color_r, - float offset_color_g, - float offset_color_b - ) { - super(); - this.parameter_control_word = parameter_control_word; - this.x = x; - this.y = y; - this.z = z; - this.u_v = u_v; - this.base_color_alpha = base_color_alpha; - this.base_color_r = base_color_r; - this.base_color_g = base_color_g; - this.base_color_b = base_color_b; - this.offset_color_alpha = offset_color_alpha; - this.offset_color_r = offset_color_r; - this.offset_color_g = offset_color_g; - this.offset_color_b = offset_color_b; - } - public void submit() { - putInt(0, parameter_control_word); - putFloat(4, x); - putFloat(8, y); - putFloat(12, z); - putInt(16, u_v); - putInt(20, 0); - putInt(24, 0); - putInt(28, 0); - putFloat(32, base_color_alpha); - putFloat(36, base_color_r); - putFloat(40, base_color_g); - putFloat(44, base_color_b); - putFloat(48, offset_color_alpha); - putFloat(52, offset_color_r); - putFloat(56, offset_color_g); - putFloat(60, 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 void polygon_type_6(int parameter_control_word, + float x, + float y, + float z, + int u_v, + float base_color_alpha, + float base_color_r, + float base_color_g, + float base_color_b, + float offset_color_alpha, + float offset_color_r, + float offset_color_g, + float offset_color_b + ) { + int store_queue = MemoryMap.store_queue; + Memory.putU4(store_queue + 0, parameter_control_word); + Memory.putF4(store_queue + 4, x); + Memory.putF4(store_queue + 8, y); + Memory.putF4(store_queue + 12, z); + Memory.putU4(store_queue + 16, u_v); + Memory.putU4(store_queue + 20, 0); + Memory.putU4(store_queue + 24, 0); + Memory.putU4(store_queue + 28, 0); + Memory.putF4(store_queue + 32, base_color_alpha); + Memory.putF4(store_queue + 36, base_color_r); + Memory.putF4(store_queue + 40, base_color_g); + Memory.putF4(store_queue + 44, base_color_b); + Memory.putF4(store_queue + 48, offset_color_alpha); + Memory.putF4(store_queue + 52, offset_color_r); + Memory.putF4(store_queue + 56, offset_color_g); + Memory.putF4(store_queue + 60, 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 static class polygon_type_7 - extends StoreQueueBuffer - { - - public int parameter_control_word; - public float x; - public float y; - public float z; - public float u; - public float v; - public float base_intensity; - public float offset_intensity; - public polygon_type_7(int parameter_control_word, - float x, - float y, - float z, - float u, - float v, - float base_intensity, - float offset_intensity - ) { - super(); - this.parameter_control_word = parameter_control_word; - this.x = x; - this.y = y; - this.z = z; - this.u = u; - this.v = v; - this.base_intensity = base_intensity; - this.offset_intensity = offset_intensity; - } - public void submit() { - putInt(0, parameter_control_word); - putFloat(4, x); - putFloat(8, y); - putFloat(12, z); - putFloat(16, u); - putFloat(20, v); - putFloat(24, base_intensity); - putFloat(28, offset_intensity); - Memory.putU4(0xff000038, MemoryMap.ta_fifo_polygon_converter); // QACR0 - SH4Intrinsic.pref1(MemoryMap.store_queue); - } + public static void polygon_type_7(int parameter_control_word, + float x, + float y, + float z, + float u, + float v, + float base_intensity, + float offset_intensity + ) { + int store_queue = MemoryMap.store_queue; + Memory.putU4(store_queue + 0, parameter_control_word); + Memory.putF4(store_queue + 4, x); + Memory.putF4(store_queue + 8, y); + Memory.putF4(store_queue + 12, z); + Memory.putF4(store_queue + 16, u); + Memory.putF4(store_queue + 20, v); + Memory.putF4(store_queue + 24, base_intensity); + Memory.putF4(store_queue + 28, offset_intensity); + Memory.putU4(0xff000038, ((MemoryMap.ta_fifo_polygon_converter >> 26) & 0b111) << 2); // QACR0 + SH4Intrinsic.pref1(store_queue); } - public static class polygon_type_8 - extends StoreQueueBuffer - { - - public int parameter_control_word; - public float x; - public float y; - public float z; - public int u_v; - public float base_intensity; - public float offset_intensity; - public polygon_type_8(int parameter_control_word, - float x, - float y, - float z, - int u_v, - float base_intensity, - float offset_intensity - ) { - super(); - this.parameter_control_word = parameter_control_word; - this.x = x; - this.y = y; - this.z = z; - this.u_v = u_v; - this.base_intensity = base_intensity; - this.offset_intensity = offset_intensity; - } - public void submit() { - putInt(0, parameter_control_word); - putFloat(4, x); - putFloat(8, y); - putFloat(12, z); - putInt(16, u_v); - putInt(20, 0); - putFloat(24, base_intensity); - putFloat(28, offset_intensity); - Memory.putU4(0xff000038, MemoryMap.ta_fifo_polygon_converter); // QACR0 - SH4Intrinsic.pref1(MemoryMap.store_queue); - } + public static void polygon_type_8(int parameter_control_word, + float x, + float y, + float z, + int u_v, + float base_intensity, + float offset_intensity + ) { + int store_queue = MemoryMap.store_queue; + Memory.putU4(store_queue + 0, parameter_control_word); + Memory.putF4(store_queue + 4, x); + Memory.putF4(store_queue + 8, y); + Memory.putF4(store_queue + 12, z); + Memory.putU4(store_queue + 16, u_v); + Memory.putU4(store_queue + 20, 0); + Memory.putF4(store_queue + 24, base_intensity); + Memory.putF4(store_queue + 28, offset_intensity); + Memory.putU4(0xff000038, ((MemoryMap.ta_fifo_polygon_converter >> 26) & 0b111) << 2); // QACR0 + SH4Intrinsic.pref1(store_queue); } - public static class polygon_type_9 - extends StoreQueueBuffer - { - - public int parameter_control_word; - public float x; - public float y; - public float z; - public int base_color_0; - public int base_color_1; - public polygon_type_9(int parameter_control_word, - float x, - float y, - float z, - int base_color_0, - int base_color_1 - ) { - super(); - this.parameter_control_word = parameter_control_word; - this.x = x; - this.y = y; - this.z = z; - this.base_color_0 = base_color_0; - this.base_color_1 = base_color_1; - } - public void submit() { - putInt(0, parameter_control_word); - putFloat(4, x); - putFloat(8, y); - putFloat(12, z); - putInt(16, base_color_0); - putInt(20, base_color_1); - putInt(24, 0); - putInt(28, 0); - Memory.putU4(0xff000038, MemoryMap.ta_fifo_polygon_converter); // QACR0 - SH4Intrinsic.pref1(MemoryMap.store_queue); - } + public static void polygon_type_9(int parameter_control_word, + float x, + float y, + float z, + int base_color_0, + int base_color_1 + ) { + int store_queue = MemoryMap.store_queue; + Memory.putU4(store_queue + 0, parameter_control_word); + Memory.putF4(store_queue + 4, x); + Memory.putF4(store_queue + 8, y); + Memory.putF4(store_queue + 12, z); + Memory.putU4(store_queue + 16, base_color_0); + Memory.putU4(store_queue + 20, base_color_1); + 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 static class polygon_type_10 - extends StoreQueueBuffer - { - - public int parameter_control_word; - public float x; - public float y; - public float z; - public int base_intensity_0; - public int base_intensity_1; - public polygon_type_10(int parameter_control_word, - float x, - float y, - float z, - int base_intensity_0, - int base_intensity_1 - ) { - super(); - this.parameter_control_word = parameter_control_word; - this.x = x; - this.y = y; - this.z = z; - this.base_intensity_0 = base_intensity_0; - this.base_intensity_1 = base_intensity_1; - } - public void submit() { - putInt(0, parameter_control_word); - putFloat(4, x); - putFloat(8, y); - putFloat(12, z); - putInt(16, base_intensity_0); - putInt(20, base_intensity_1); - putInt(24, 0); - putInt(28, 0); - Memory.putU4(0xff000038, MemoryMap.ta_fifo_polygon_converter); // QACR0 - SH4Intrinsic.pref1(MemoryMap.store_queue); - } + public static void polygon_type_10(int parameter_control_word, + float x, + float y, + float z, + int base_intensity_0, + int base_intensity_1 + ) { + int store_queue = MemoryMap.store_queue; + Memory.putU4(store_queue + 0, parameter_control_word); + Memory.putF4(store_queue + 4, x); + Memory.putF4(store_queue + 8, y); + Memory.putF4(store_queue + 12, z); + Memory.putU4(store_queue + 16, base_intensity_0); + Memory.putU4(store_queue + 20, base_intensity_1); + 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 static class polygon_type_11 - extends StoreQueueBuffer - { - - public int parameter_control_word; - public float x; - public float y; - public float z; - public float u_0; - public float v_0; - public int base_color_0; - public int offset_color_0; - public float u_1; - public float v_1; - public int base_color_1; - public int offset_color_1; - public polygon_type_11(int parameter_control_word, - float x, - float y, - float z, - float u_0, - float v_0, - int base_color_0, - int offset_color_0, - float u_1, - float v_1, - int base_color_1, - int offset_color_1 - ) { - super(); - this.parameter_control_word = parameter_control_word; - this.x = x; - this.y = y; - this.z = z; - this.u_0 = u_0; - this.v_0 = v_0; - this.base_color_0 = base_color_0; - this.offset_color_0 = offset_color_0; - this.u_1 = u_1; - this.v_1 = v_1; - this.base_color_1 = base_color_1; - this.offset_color_1 = offset_color_1; - } - public void submit() { - putInt(0, parameter_control_word); - putFloat(4, x); - putFloat(8, y); - putFloat(12, z); - putFloat(16, u_0); - putFloat(20, v_0); - putInt(24, base_color_0); - putInt(28, offset_color_0); - putFloat(32, u_1); - putFloat(36, v_1); - putInt(40, base_color_1); - putInt(44, offset_color_1); - putInt(48, 0); - putInt(52, 0); - putInt(56, 0); - putInt(60, 0); - 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 void polygon_type_11(int parameter_control_word, + float x, + float y, + float z, + float u_0, + float v_0, + int base_color_0, + int offset_color_0, + float u_1, + float v_1, + int base_color_1, + int offset_color_1 + ) { + int store_queue = MemoryMap.store_queue; + Memory.putU4(store_queue + 0, parameter_control_word); + Memory.putF4(store_queue + 4, x); + Memory.putF4(store_queue + 8, y); + Memory.putF4(store_queue + 12, z); + Memory.putF4(store_queue + 16, u_0); + Memory.putF4(store_queue + 20, v_0); + Memory.putU4(store_queue + 24, base_color_0); + Memory.putU4(store_queue + 28, offset_color_0); + Memory.putF4(store_queue + 32, u_1); + Memory.putF4(store_queue + 36, v_1); + Memory.putU4(store_queue + 40, base_color_1); + Memory.putU4(store_queue + 44, offset_color_1); + Memory.putU4(store_queue + 48, 0); + Memory.putU4(store_queue + 52, 0); + Memory.putU4(store_queue + 56, 0); + Memory.putU4(store_queue + 60, 0); + 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 static class polygon_type_12 - extends StoreQueueBuffer - { - - public int parameter_control_word; - public float x; - public float y; - public float z; - public int u_v_0; - public int base_color_0; - public int offset_color_0; - public int u_v_1; - public int base_color_1; - public int offset_color_1; - public polygon_type_12(int parameter_control_word, - float x, - float y, - float z, - int u_v_0, - int base_color_0, - int offset_color_0, - int u_v_1, - int base_color_1, - int offset_color_1 - ) { - super(); - this.parameter_control_word = parameter_control_word; - this.x = x; - this.y = y; - this.z = z; - this.u_v_0 = u_v_0; - this.base_color_0 = base_color_0; - this.offset_color_0 = offset_color_0; - this.u_v_1 = u_v_1; - this.base_color_1 = base_color_1; - this.offset_color_1 = offset_color_1; - } - public void submit() { - putInt(0, parameter_control_word); - putFloat(4, x); - putFloat(8, y); - putFloat(12, z); - putInt(16, u_v_0); - putInt(20, 0); - putInt(24, base_color_0); - putInt(28, offset_color_0); - putInt(32, u_v_1); - putInt(36, 0); - putInt(40, base_color_1); - putInt(44, offset_color_1); - putInt(48, 0); - putInt(52, 0); - putInt(56, 0); - putInt(60, 0); - 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 void polygon_type_12(int parameter_control_word, + float x, + float y, + float z, + int u_v_0, + int base_color_0, + int offset_color_0, + int u_v_1, + int base_color_1, + int offset_color_1 + ) { + int store_queue = MemoryMap.store_queue; + Memory.putU4(store_queue + 0, parameter_control_word); + Memory.putF4(store_queue + 4, x); + Memory.putF4(store_queue + 8, y); + Memory.putF4(store_queue + 12, z); + Memory.putU4(store_queue + 16, u_v_0); + Memory.putU4(store_queue + 20, 0); + Memory.putU4(store_queue + 24, base_color_0); + Memory.putU4(store_queue + 28, offset_color_0); + Memory.putU4(store_queue + 32, u_v_1); + Memory.putU4(store_queue + 36, 0); + Memory.putU4(store_queue + 40, base_color_1); + Memory.putU4(store_queue + 44, offset_color_1); + Memory.putU4(store_queue + 48, 0); + Memory.putU4(store_queue + 52, 0); + Memory.putU4(store_queue + 56, 0); + Memory.putU4(store_queue + 60, 0); + 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 static class polygon_type_13 - extends StoreQueueBuffer - { - - public int parameter_control_word; - public float x; - public float y; - public float z; - public float u_0; - public float v_0; - public int base_intensity_0; - public float offset_intensity_0; - public float u_1; - public float v_1; - public int base_intensity_1; - public float offset_intensity_1; - public polygon_type_13(int parameter_control_word, - float x, - float y, - float z, - float u_0, - float v_0, - int base_intensity_0, - float offset_intensity_0, - float u_1, - float v_1, - int base_intensity_1, - float offset_intensity_1 - ) { - super(); - this.parameter_control_word = parameter_control_word; - this.x = x; - this.y = y; - this.z = z; - this.u_0 = u_0; - this.v_0 = v_0; - this.base_intensity_0 = base_intensity_0; - this.offset_intensity_0 = offset_intensity_0; - this.u_1 = u_1; - this.v_1 = v_1; - this.base_intensity_1 = base_intensity_1; - this.offset_intensity_1 = offset_intensity_1; - } - public void submit() { - putInt(0, parameter_control_word); - putFloat(4, x); - putFloat(8, y); - putFloat(12, z); - putFloat(16, u_0); - putFloat(20, v_0); - putInt(24, base_intensity_0); - putFloat(28, offset_intensity_0); - putFloat(32, u_1); - putFloat(36, v_1); - putInt(40, base_intensity_1); - putFloat(44, offset_intensity_1); - putInt(48, 0); - putInt(52, 0); - putInt(56, 0); - putInt(60, 0); - 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 void polygon_type_13(int parameter_control_word, + float x, + float y, + float z, + float u_0, + float v_0, + int base_intensity_0, + float offset_intensity_0, + float u_1, + float v_1, + int base_intensity_1, + float offset_intensity_1 + ) { + int store_queue = MemoryMap.store_queue; + Memory.putU4(store_queue + 0, parameter_control_word); + Memory.putF4(store_queue + 4, x); + Memory.putF4(store_queue + 8, y); + Memory.putF4(store_queue + 12, z); + Memory.putF4(store_queue + 16, u_0); + Memory.putF4(store_queue + 20, v_0); + Memory.putU4(store_queue + 24, base_intensity_0); + Memory.putF4(store_queue + 28, offset_intensity_0); + Memory.putF4(store_queue + 32, u_1); + Memory.putF4(store_queue + 36, v_1); + Memory.putU4(store_queue + 40, base_intensity_1); + Memory.putF4(store_queue + 44, offset_intensity_1); + Memory.putU4(store_queue + 48, 0); + Memory.putU4(store_queue + 52, 0); + Memory.putU4(store_queue + 56, 0); + Memory.putU4(store_queue + 60, 0); + 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 static class polygon_type_14 - extends StoreQueueBuffer - { - - public int parameter_control_word; - public float x; - public float y; - public float z; - public int u_v_0; - public int base_intensity_0; - public float offset_intensity_0; - public int u_v_1; - public int base_intensity_1; - public float offset_intensity_1; - public polygon_type_14(int parameter_control_word, - float x, - float y, - float z, - int u_v_0, - int base_intensity_0, - float offset_intensity_0, - int u_v_1, - int base_intensity_1, - float offset_intensity_1 - ) { - super(); - this.parameter_control_word = parameter_control_word; - this.x = x; - this.y = y; - this.z = z; - this.u_v_0 = u_v_0; - this.base_intensity_0 = base_intensity_0; - this.offset_intensity_0 = offset_intensity_0; - this.u_v_1 = u_v_1; - this.base_intensity_1 = base_intensity_1; - this.offset_intensity_1 = offset_intensity_1; - } - public void submit() { - putInt(0, parameter_control_word); - putFloat(4, x); - putFloat(8, y); - putFloat(12, z); - putInt(16, u_v_0); - putInt(20, 0); - putInt(24, base_intensity_0); - putFloat(28, offset_intensity_0); - putInt(32, u_v_1); - putInt(36, 0); - putInt(40, base_intensity_1); - putFloat(44, offset_intensity_1); - putInt(48, 0); - putInt(52, 0); - putInt(56, 0); - putInt(60, 0); - 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 void polygon_type_14(int parameter_control_word, + float x, + float y, + float z, + int u_v_0, + int base_intensity_0, + float offset_intensity_0, + int u_v_1, + int base_intensity_1, + float offset_intensity_1 + ) { + int store_queue = MemoryMap.store_queue; + Memory.putU4(store_queue + 0, parameter_control_word); + Memory.putF4(store_queue + 4, x); + Memory.putF4(store_queue + 8, y); + Memory.putF4(store_queue + 12, z); + Memory.putU4(store_queue + 16, u_v_0); + Memory.putU4(store_queue + 20, 0); + Memory.putU4(store_queue + 24, base_intensity_0); + Memory.putF4(store_queue + 28, offset_intensity_0); + Memory.putU4(store_queue + 32, u_v_1); + Memory.putU4(store_queue + 36, 0); + Memory.putU4(store_queue + 40, base_intensity_1); + Memory.putF4(store_queue + 44, offset_intensity_1); + Memory.putU4(store_queue + 48, 0); + Memory.putU4(store_queue + 52, 0); + Memory.putU4(store_queue + 56, 0); + Memory.putU4(store_queue + 60, 0); + 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 static class sprite_type_0 - extends StoreQueueBuffer - { - - public int parameter_control_word; - public float a_x; - public float a_y; - public float a_z; - public float b_x; - public float b_y; - public float b_z; - public float c_x; - public float c_y; - public float c_z; - public float d_x; - public float d_y; - public sprite_type_0(int parameter_control_word, - float a_x, - float a_y, - float a_z, - float b_x, - float b_y, - float b_z, - float c_x, - float c_y, - float c_z, - float d_x, - float d_y - ) { - super(); - this.parameter_control_word = parameter_control_word; - this.a_x = a_x; - this.a_y = a_y; - this.a_z = a_z; - this.b_x = b_x; - this.b_y = b_y; - this.b_z = b_z; - this.c_x = c_x; - this.c_y = c_y; - this.c_z = c_z; - this.d_x = d_x; - this.d_y = d_y; - } - public void submit() { - putInt(0, parameter_control_word); - putFloat(4, a_x); - putFloat(8, a_y); - putFloat(12, a_z); - putFloat(16, b_x); - putFloat(20, b_y); - putFloat(24, b_z); - putFloat(28, c_x); - putFloat(32, c_y); - putFloat(36, c_z); - putFloat(40, d_x); - putFloat(44, d_y); - putInt(48, 0); - putInt(52, 0); - putInt(56, 0); - putInt(60, 0); - 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 void sprite_type_0(int parameter_control_word, + float a_x, + float a_y, + float a_z, + float b_x, + float b_y, + float b_z, + float c_x, + float c_y, + float c_z, + float d_x, + float d_y + ) { + int store_queue = MemoryMap.store_queue; + Memory.putU4(store_queue + 0, parameter_control_word); + Memory.putF4(store_queue + 4, a_x); + Memory.putF4(store_queue + 8, a_y); + Memory.putF4(store_queue + 12, a_z); + Memory.putF4(store_queue + 16, b_x); + Memory.putF4(store_queue + 20, b_y); + Memory.putF4(store_queue + 24, b_z); + Memory.putF4(store_queue + 28, c_x); + Memory.putF4(store_queue + 32, c_y); + Memory.putF4(store_queue + 36, c_z); + Memory.putF4(store_queue + 40, d_x); + Memory.putF4(store_queue + 44, d_y); + Memory.putU4(store_queue + 48, 0); + Memory.putU4(store_queue + 52, 0); + Memory.putU4(store_queue + 56, 0); + Memory.putU4(store_queue + 60, 0); + 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 static class sprite_type_1 - extends StoreQueueBuffer - { - - public int parameter_control_word; - public float a_x; - public float a_y; - public float a_z; - public float b_x; - public float b_y; - public float b_z; - public float c_x; - public float c_y; - public float c_z; - public float d_x; - public float d_y; - public int a_u_a_v; - public int b_u_b_v; - public int c_u_c_v; - public sprite_type_1(int parameter_control_word, - float a_x, - float a_y, - float a_z, - float b_x, - float b_y, - float b_z, - float c_x, - float c_y, - float c_z, - float d_x, - float d_y, - int a_u_a_v, - int b_u_b_v, - int c_u_c_v - ) { - super(); - this.parameter_control_word = parameter_control_word; - this.a_x = a_x; - this.a_y = a_y; - this.a_z = a_z; - this.b_x = b_x; - this.b_y = b_y; - this.b_z = b_z; - this.c_x = c_x; - this.c_y = c_y; - this.c_z = c_z; - this.d_x = d_x; - this.d_y = d_y; - this.a_u_a_v = a_u_a_v; - this.b_u_b_v = b_u_b_v; - this.c_u_c_v = c_u_c_v; - } - public void submit() { - putInt(0, parameter_control_word); - putFloat(4, a_x); - putFloat(8, a_y); - putFloat(12, a_z); - putFloat(16, b_x); - putFloat(20, b_y); - putFloat(24, b_z); - putFloat(28, c_x); - putFloat(32, c_y); - putFloat(36, c_z); - putFloat(40, d_x); - putFloat(44, d_y); - putInt(48, 0); - putInt(52, a_u_a_v); - putInt(56, b_u_b_v); - putInt(60, c_u_c_v); - 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 void sprite_type_1(int parameter_control_word, + float a_x, + float a_y, + float a_z, + float b_x, + float b_y, + float b_z, + float c_x, + float c_y, + float c_z, + float d_x, + float d_y, + int a_u_a_v, + int b_u_b_v, + int c_u_c_v + ) { + int store_queue = MemoryMap.store_queue; + Memory.putU4(store_queue + 0, parameter_control_word); + Memory.putF4(store_queue + 4, a_x); + Memory.putF4(store_queue + 8, a_y); + Memory.putF4(store_queue + 12, a_z); + Memory.putF4(store_queue + 16, b_x); + Memory.putF4(store_queue + 20, b_y); + Memory.putF4(store_queue + 24, b_z); + Memory.putF4(store_queue + 28, c_x); + Memory.putF4(store_queue + 32, c_y); + Memory.putF4(store_queue + 36, c_z); + Memory.putF4(store_queue + 40, d_x); + Memory.putF4(store_queue + 44, d_y); + Memory.putU4(store_queue + 48, 0); + Memory.putU4(store_queue + 52, a_u_a_v); + Memory.putU4(store_queue + 56, b_u_b_v); + Memory.putU4(store_queue + 60, c_u_c_v); + 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 static class modifier_volume - extends StoreQueueBuffer - { - - public int parameter_control_word; - public float a_x; - public float a_y; - public float a_z; - public float b_x; - public float b_y; - public float b_z; - public float c_x; - public float c_y; - public float c_z; - public modifier_volume(int parameter_control_word, - float a_x, - float a_y, - float a_z, - float b_x, - float b_y, - float b_z, - float c_x, - float c_y, - float c_z - ) { - super(); - this.parameter_control_word = parameter_control_word; - this.a_x = a_x; - this.a_y = a_y; - this.a_z = a_z; - this.b_x = b_x; - this.b_y = b_y; - this.b_z = b_z; - this.c_x = c_x; - this.c_y = c_y; - this.c_z = c_z; - } - public void submit() { - putInt(0, parameter_control_word); - putFloat(4, a_x); - putFloat(8, a_y); - putFloat(12, a_z); - putFloat(16, b_x); - putFloat(20, b_y); - putFloat(24, b_z); - putFloat(28, c_x); - putFloat(32, c_y); - putFloat(36, c_z); - putInt(40, 0); - putInt(44, 0); - putInt(48, 0); - putInt(52, 0); - putInt(56, 0); - putInt(60, 0); - 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 void modifier_volume(int parameter_control_word, + float a_x, + float a_y, + float a_z, + float b_x, + float b_y, + float b_z, + float c_x, + float c_y, + float c_z + ) { + int store_queue = MemoryMap.store_queue; + Memory.putU4(store_queue + 0, parameter_control_word); + Memory.putF4(store_queue + 4, a_x); + Memory.putF4(store_queue + 8, a_y); + Memory.putF4(store_queue + 12, a_z); + Memory.putF4(store_queue + 16, b_x); + Memory.putF4(store_queue + 20, b_y); + Memory.putF4(store_queue + 24, b_z); + Memory.putF4(store_queue + 28, c_x); + Memory.putF4(store_queue + 32, c_y); + Memory.putF4(store_queue + 36, c_z); + Memory.putU4(store_queue + 40, 0); + Memory.putU4(store_queue + 44, 0); + Memory.putU4(store_queue + 48, 0); + Memory.putU4(store_queue + 52, 0); + Memory.putU4(store_queue + 56, 0); + Memory.putU4(store_queue + 60, 0); + 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); } } diff --git a/classpath.mk b/classpath.mk index edb3a22..3c1813f 100644 --- a/classpath.mk +++ b/classpath.mk @@ -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 diff --git a/generate_classpath.sh b/generate_classpath.sh index da2bc3e..e908895 100644 --- a/generate_classpath.sh +++ b/generate_classpath.sh @@ -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 ) diff --git a/regs/sparse_struct_java.py b/regs/sparse_struct_java.py index d62337a..4a0a169 100644 --- a/regs/sparse_struct_java.py +++ b/regs/sparse_struct_java.py @@ -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 "import sega.dreamcast.MemoryMap;" + 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 "}" diff --git a/regs/ta_parameters.py b/regs/ta_parameters.py index 0a26b83..c9dc4c8 100644 --- a/regs/ta_parameters.py +++ b/regs/ta_parameters.py @@ -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())