TAGlobalParameter/TAVertexParameter: use ByteBuffer

This commit is contained in:
Zack Buhman 2025-01-20 19:53:23 -06:00
parent 8974ea0654
commit f2675e937d
20 changed files with 772 additions and 227 deletions

View File

@ -11,6 +11,7 @@
#include "native/object.h"
#include "native/printstream.h"
#include "native/runtime.h"
#include "native/sh4intrinsic.h"
#include "native/system.h"
typedef void (* native_func_t)(struct vm * vm, uint32_t * args);
@ -231,6 +232,20 @@ const static struct native_method native_method[] = {
.func = native_jvm_internal_libcinputstream_read_1,
},
#endif
#if defined(__dreamcast__)
{
.class_name = "jvm/internal/SH4Intrinsic",
.method_name = "pref1",
.method_descriptor = "(I)V",
.func = native_jvm_internal_sh4intrinsic_pref1_1,
},
{
.class_name = "jvm/internal/SH4Intrinsic",
.method_name = "pref2",
.method_descriptor = "(I)V",
.func = native_jvm_internal_sh4intrinsic_pref2_1,
},
#endif
};
struct hash_table_entry * native_init_hash_table(int * hash_table_length)

29
c/native/sh4intrinsic.c Normal file
View File

@ -0,0 +1,29 @@
#include "sh4intrinsic.h"
void native_jvm_internal_sh4intrinsic_pref1_1(struct vm * vm, uint32_t * args)
{
uint32_t address = (uint32_t)args[0];
// start 32-byte transfer from store queue 0 (SQ0) to QACR0
asm volatile ("pref @%0"
: // output
: "r" (address) // input
: "memory");
}
void native_jvm_internal_sh4intrinsic_pref2_1(struct vm * vm, uint32_t * args)
{
uint32_t address = (uint32_t)args[0];
// start 32-byte transfer from store queue 0 (SQ0) to QACR0
asm volatile ("pref @%0"
: // output
: "r" (address) // input
: "memory");
// start 32-byte transfer from store queue 1 (SQ1) to QACR1
asm volatile ("pref @%0"
: // output
: "r" (address + 32) // input
: "memory");
}

8
c/native/sh4intrinsic.h Normal file
View File

@ -0,0 +1,8 @@
#pragma once
#include <stdint.h>
#include "vm.h"
void native_jvm_internal_sh4intrinsic_pref1_1(struct vm * vm, uint32_t * args);
void native_jvm_internal_sh4intrinsic_pref2_1(struct vm * vm, uint32_t * args);

View File

@ -55,9 +55,6 @@ class JavaCubeDirectoryRecordHandler implements DirectoryRecordHandler {
byte[] buf = dr.array;
int offset = dr.offset + DirectoryRecord.FILE_IDENTIFIER_START;
if (buf[offset] != (byte)'J')
return -1;
for (int i = 0; i < texture_filenames.length; i++) {
byte[] texture_filename = texture_filenames[i].getBytes();
if (bytesEqual(buf, offset, texture_filename, length))

View File

@ -1,10 +1,10 @@
package java.nio;
public abstract class Buffer {
private final int address;
private int position;
private int limit;
private final int capacity;
protected final int address;
protected int position;
protected int limit;
protected final int capacity;
protected Buffer(int address, int position, int limit, int capacity) {
this.address = address;
@ -53,6 +53,7 @@ public abstract class Buffer {
if (newPosition < 0 || newPosition > limit)
throw new IllegalArgumentException();
position = newPosition;
return this;
}
public final int remaining() {

View File

@ -0,0 +1,9 @@
package java.nio;
public class BufferOverflowException
extends RuntimeException {
public BufferUnderflowException() {
super();
}
}

View File

@ -0,0 +1,9 @@
package java.nio;
public class BufferUnderflowException
extends RuntimeException {
public BufferUnderflowException() {
super();
}
}

View File

@ -8,7 +8,7 @@ public class ByteBuffer
private boolean bigEndian;
private ByteBuffer(int address, int position, int limit, int capacity, int bigEndian) {
protected ByteBuffer(int address, int position, int limit, int capacity, boolean bigEndian) {
super(address, position, limit, capacity);
bigEndian = bigEndian;
}
@ -124,7 +124,7 @@ public class ByteBuffer
public int getInt(int index) {
if (index < 0 || index >= (limit - 3))
throw new IndexOutOfBoundsException();
in i = Memory.getUnalignedU4(address + index, bigEndian);
int i = Memory.getUnalignedU4(address + index, bigEndian);
return i;
}
@ -139,7 +139,7 @@ public class ByteBuffer
public short getShort(short index) {
if (index < 0 || index >= (limit - 1))
throw new IndexOutOfBoundsException();
in i = Memory.getUnalignedU2(address + index, bigEndian);
short i = Memory.getUnalignedU2(address + index, bigEndian);
return i;
}
@ -153,6 +153,7 @@ public class ByteBuffer
for (int i = position; i < limit; i++) {
h = 31 * h + (int)get(i);
}
return h;
}
public boolean isDirect() {
@ -171,7 +172,7 @@ public class ByteBuffer
public ByteBuffer put(byte b) {
if (position >= limit)
throw new IndexOutOfBoundsException();
Memory.putU1(address + position);
Memory.putU1(address + position, b);
position += 1;
return this;
}
@ -197,7 +198,8 @@ public class ByteBuffer
public ByteBuffer put(ByteBuffer src) {
int rem = limit - position;
if (rem < src.length) {
int srcRem = src.limit - src.position;
if (rem < srcRem) {
throw new BufferUnderflowException();
}
if (src == this) {
@ -206,6 +208,7 @@ public class ByteBuffer
for (int i = src.position; i < src.limit; i++) {
put(src.get(i));
}
return this;
}
public ByteBuffer put(int index,
@ -274,9 +277,9 @@ public class ByteBuffer
public String toString() {
return getClass().getName()
+ "[pos=" + position
+ " lim=" + limit
+ " cap=" + capacity
+ "[pos=" + Integer.toString(position)
+ " lim=" + Integer.toString(limit)
+ " cap=" + Integer.toString(capacity)
+ "]";
}

View File

@ -17,8 +17,6 @@ public class Memory {
public static native short getUnalignedU2(int address, boolean bigEndian);
public static native float getUnalignedF4(int address, boolean bigEndian);
public static native void putSQ1(Object object, int address);
public static native boolean isBigEndian();
public static native int allocate(int size);

View File

@ -0,0 +1,6 @@
package jvm.internal;
public class SH4Intrinsic {
public static native void pref1(int address);
public static native void pref2(int address);
}

View File

@ -28,13 +28,13 @@ public class GdromProtocol {
}
int features = enable_dma ? GdromBits.features__dma__enable : GdromBits.features__dma__disable;
Memory.putU1(Gdrom.features, features);
Memory.putU1(Gdrom.features, (byte)features);
int drive_select = GdromBits.drive_select__drive_select
| GdromBits.drive_select__lun(0);
Memory.putU1(Gdrom.drive_select, drive_select);
Memory.putU1(Gdrom.drive_select, (byte)drive_select);
Memory.putU1(Gdrom.command, GdromBits.command__code__packet_command);
Memory.putU1(Gdrom.command, (byte)GdromBits.command__code__packet_command);
//System.out.println("words:");
for (int i = 0; i < 6; i++) {
@ -43,7 +43,7 @@ public class GdromProtocol {
// little endian
int word = ((i1 & 0xff) << 8) | (i0 & 0xff);
//System.out.println(word);
Memory.putU2(Gdrom.data, word);
Memory.putU2(Gdrom.data, (byte)word);
}
/*

View File

@ -1,33 +1,39 @@
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 {
public static class end_of_list
extends StoreQueueBuffer
{
public int parameter_control_word;
public int _res0;
public int _res1;
public int _res2;
public int _res3;
public int _res4;
public int _res5;
public int _res6;
public end_of_list(int parameter_control_word
) {
super();
this.parameter_control_word = parameter_control_word;
this._res0 = 0;
this._res1 = 0;
this._res2 = 0;
this._res3 = 0;
this._res4 = 0;
this._res5 = 0;
this._res6 = 0;
}
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 {
public static class user_tile_clip
extends StoreQueueBuffer
{
public int parameter_control_word;
public int _res0;
public int _res1;
public int _res2;
public int user_clip_x_min;
public int user_clip_y_min;
public int user_clip_x_max;
@ -38,21 +44,32 @@ public class TAGlobalParameter {
int user_clip_x_max,
int user_clip_y_max
) {
super();
this.parameter_control_word = parameter_control_word;
this._res0 = 0;
this._res1 = 0;
this._res2 = 0;
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 class object_list_set {
public static class object_list_set
extends StoreQueueBuffer
{
public int parameter_control_word;
public int object_pointer;
public int _res0;
public int _res1;
public int bounding_box_x_min;
public int bounding_box_y_min;
public int bounding_box_x_max;
@ -64,23 +81,35 @@ public class TAGlobalParameter {
int bounding_box_x_max,
int bounding_box_y_max
) {
super();
this.parameter_control_word = parameter_control_word;
this.object_pointer = object_pointer;
this._res0 = 0;
this._res1 = 0;
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 class polygon_type_0 {
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 _res0;
public int _res1;
public int data_size_for_sort_dma;
public int next_address_for_sort_dma;
public polygon_type_0(int parameter_control_word,
@ -90,17 +119,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._res0 = 0;
this._res1 = 0;
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);
}
}
public static class polygon_type_1 {
public static class polygon_type_1
extends StoreQueueBuffer
{
public int parameter_control_word;
public int isp_tsp_instruction_word;
public int tsp_instruction_word;
@ -118,6 +161,7 @@ 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;
@ -127,14 +171,27 @@ public class TAGlobalParameter {
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 {
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 _res0;
public int _res1;
public int data_size_for_sort_dma;
public int next_address_for_sort_dma;
public float face_color_alpha;
@ -160,12 +217,11 @@ 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._res0 = 0;
this._res1 = 0;
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;
@ -177,8 +233,32 @@ public class TAGlobalParameter {
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 {
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;
@ -196,6 +276,7 @@ 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;
@ -205,8 +286,23 @@ public class TAGlobalParameter {
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 {
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;
@ -240,6 +336,7 @@ 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;
@ -257,8 +354,32 @@ public class TAGlobalParameter {
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 {
public static class sprite
extends StoreQueueBuffer
{
public int parameter_control_word;
public int isp_tsp_instruction_word;
public int tsp_instruction_word;
@ -276,6 +397,7 @@ 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;
@ -285,27 +407,43 @@ public class TAGlobalParameter {
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 {
public static class modifier_volume
extends StoreQueueBuffer
{
public int parameter_control_word;
public int isp_tsp_instruction_word;
public int _res0;
public int _res1;
public int _res2;
public int _res3;
public int _res4;
public int _res5;
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;
this._res0 = 0;
this._res1 = 0;
this._res2 = 0;
this._res3 = 0;
this._res4 = 0;
this._res5 = 0;
}
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);
}
}
}

View File

@ -1,33 +1,50 @@
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 {
public static class polygon_type_0
extends StoreQueueBuffer
{
public int parameter_control_word;
public float x;
public float y;
public float z;
public int _res0;
public int _res1;
public int base_color;
public int _res2;
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._res0 = 0;
this._res1 = 0;
this.base_color = base_color;
this._res2 = 0;
}
public void submit() {
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 class polygon_type_1 {
public static class polygon_type_1
extends StoreQueueBuffer
{
public int parameter_control_word;
public float x;
public float y;
@ -45,6 +62,7 @@ public class TAVertexParameter {
float base_color_g,
float base_color_b
) {
super();
this.parameter_control_word = parameter_control_word;
this.x = x;
this.y = y;
@ -54,33 +72,58 @@ public class TAVertexParameter {
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 class polygon_type_2 {
public static class polygon_type_2
extends StoreQueueBuffer
{
public int parameter_control_word;
public float x;
public float y;
public float z;
public int _res0;
public int _res1;
public float base_intensity;
public int _res2;
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._res0 = 0;
this._res1 = 0;
this.base_intensity = base_intensity;
this._res2 = 0;
}
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 class polygon_type_3 {
public static class polygon_type_3
extends StoreQueueBuffer
{
public int parameter_control_word;
public float x;
public float y;
@ -98,6 +141,7 @@ public class TAVertexParameter {
int base_color,
int offset_color
) {
super();
this.parameter_control_word = parameter_control_word;
this.x = x;
this.y = y;
@ -107,14 +151,28 @@ public class TAVertexParameter {
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 class polygon_type_4 {
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 _res0;
public int base_color;
public int offset_color;
public polygon_type_4(int parameter_control_word,
@ -125,25 +183,38 @@ public class TAVertexParameter {
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._res0 = 0;
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 class polygon_type_5 {
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 int _res0;
public int _res1;
public float base_color_alpha;
public float base_color_r;
public float base_color_g;
@ -167,14 +238,13 @@ public class TAVertexParameter {
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._res0 = 0;
this._res1 = 0;
this.base_color_alpha = base_color_alpha;
this.base_color_r = base_color_r;
this.base_color_g = base_color_g;
@ -184,16 +254,37 @@ public class TAVertexParameter {
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 class polygon_type_6 {
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 int _res0;
public int _res1;
public int _res2;
public float base_color_alpha;
public float base_color_r;
public float base_color_g;
@ -216,14 +307,12 @@ public class TAVertexParameter {
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._res0 = 0;
this._res1 = 0;
this._res2 = 0;
this.base_color_alpha = base_color_alpha;
this.base_color_r = base_color_r;
this.base_color_g = base_color_g;
@ -233,8 +322,32 @@ public class TAVertexParameter {
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 class polygon_type_7 {
public static class polygon_type_7
extends StoreQueueBuffer
{
public int parameter_control_word;
public float x;
public float y;
@ -252,6 +365,7 @@ public class TAVertexParameter {
float base_intensity,
float offset_intensity
) {
super();
this.parameter_control_word = parameter_control_word;
this.x = x;
this.y = y;
@ -261,14 +375,28 @@ public class TAVertexParameter {
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 class polygon_type_8 {
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 int _res0;
public float base_intensity;
public float offset_intensity;
public polygon_type_8(int parameter_control_word,
@ -279,25 +407,38 @@ public class TAVertexParameter {
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._res0 = 0;
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 class polygon_type_9 {
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 int _res0;
public int _res1;
public polygon_type_9(int parameter_control_word,
float x,
float y,
@ -305,25 +446,37 @@ public class TAVertexParameter {
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;
this._res0 = 0;
this._res1 = 0;
}
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 class polygon_type_10 {
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 int _res0;
public int _res1;
public polygon_type_10(int parameter_control_word,
float x,
float y,
@ -331,17 +484,31 @@ public class TAVertexParameter {
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;
this._res0 = 0;
this._res1 = 0;
}
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 class polygon_type_11 {
public static class polygon_type_11
extends StoreQueueBuffer
{
public int parameter_control_word;
public float x;
public float y;
@ -354,10 +521,6 @@ public class TAVertexParameter {
public float v_1;
public int base_color_1;
public int offset_color_1;
public int _res0;
public int _res1;
public int _res2;
public int _res3;
public polygon_type_11(int parameter_control_word,
float x,
float y,
@ -371,6 +534,7 @@ public class TAVertexParameter {
int base_color_1,
int offset_color_1
) {
super();
this.parameter_control_word = parameter_control_word;
this.x = x;
this.y = y;
@ -383,29 +547,43 @@ public class TAVertexParameter {
this.v_1 = v_1;
this.base_color_1 = base_color_1;
this.offset_color_1 = offset_color_1;
this._res0 = 0;
this._res1 = 0;
this._res2 = 0;
this._res3 = 0;
}
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 class polygon_type_12 {
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 _res0;
public int base_color_0;
public int offset_color_0;
public int u_v_1;
public int _res1;
public int base_color_1;
public int offset_color_1;
public int _res2;
public int _res3;
public int _res4;
public int _res5;
public polygon_type_12(int parameter_control_word,
float x,
float y,
@ -417,25 +595,44 @@ public class TAVertexParameter {
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._res0 = 0;
this.base_color_0 = base_color_0;
this.offset_color_0 = offset_color_0;
this.u_v_1 = u_v_1;
this._res1 = 0;
this.base_color_1 = base_color_1;
this.offset_color_1 = offset_color_1;
this._res2 = 0;
this._res3 = 0;
this._res4 = 0;
this._res5 = 0;
}
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 class polygon_type_13 {
public static class polygon_type_13
extends StoreQueueBuffer
{
public int parameter_control_word;
public float x;
public float y;
@ -448,10 +645,6 @@ public class TAVertexParameter {
public float v_1;
public int base_intensity_1;
public float offset_intensity_1;
public int _res0;
public int _res1;
public int _res2;
public int _res3;
public polygon_type_13(int parameter_control_word,
float x,
float y,
@ -465,6 +658,7 @@ public class TAVertexParameter {
int base_intensity_1,
float offset_intensity_1
) {
super();
this.parameter_control_word = parameter_control_word;
this.x = x;
this.y = y;
@ -477,29 +671,43 @@ public class TAVertexParameter {
this.v_1 = v_1;
this.base_intensity_1 = base_intensity_1;
this.offset_intensity_1 = offset_intensity_1;
this._res0 = 0;
this._res1 = 0;
this._res2 = 0;
this._res3 = 0;
}
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 class polygon_type_14 {
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 _res0;
public int base_intensity_0;
public float offset_intensity_0;
public int u_v_1;
public int _res1;
public int base_intensity_1;
public float offset_intensity_1;
public int _res2;
public int _res3;
public int _res4;
public int _res5;
public polygon_type_14(int parameter_control_word,
float x,
float y,
@ -511,25 +719,44 @@ public class TAVertexParameter {
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._res0 = 0;
this.base_intensity_0 = base_intensity_0;
this.offset_intensity_0 = offset_intensity_0;
this.u_v_1 = u_v_1;
this._res1 = 0;
this.base_intensity_1 = base_intensity_1;
this.offset_intensity_1 = offset_intensity_1;
this._res2 = 0;
this._res3 = 0;
this._res4 = 0;
this._res5 = 0;
}
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 class sprite_type_0 {
public static class sprite_type_0
extends StoreQueueBuffer
{
public int parameter_control_word;
public float a_x;
public float a_y;
@ -542,10 +769,6 @@ public class TAVertexParameter {
public float c_z;
public float d_x;
public float d_y;
public int _res0;
public int _res1;
public int _res2;
public int _res3;
public sprite_type_0(int parameter_control_word,
float a_x,
float a_y,
@ -559,6 +782,7 @@ public class TAVertexParameter {
float d_x,
float d_y
) {
super();
this.parameter_control_word = parameter_control_word;
this.a_x = a_x;
this.a_y = a_y;
@ -571,13 +795,33 @@ public class TAVertexParameter {
this.c_z = c_z;
this.d_x = d_x;
this.d_y = d_y;
this._res0 = 0;
this._res1 = 0;
this._res2 = 0;
this._res3 = 0;
}
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 class sprite_type_1 {
public static class sprite_type_1
extends StoreQueueBuffer
{
public int parameter_control_word;
public float a_x;
public float a_y;
@ -590,7 +834,6 @@ public class TAVertexParameter {
public float c_z;
public float d_x;
public float d_y;
public int _res0;
public int a_u_a_v;
public int b_u_b_v;
public int c_u_c_v;
@ -610,6 +853,7 @@ public class TAVertexParameter {
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;
@ -622,13 +866,36 @@ public class TAVertexParameter {
this.c_z = c_z;
this.d_x = d_x;
this.d_y = d_y;
this._res0 = 0;
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 class modifier_volume {
public static class modifier_volume
extends StoreQueueBuffer
{
public int parameter_control_word;
public float a_x;
public float a_y;
@ -639,12 +906,6 @@ public class TAVertexParameter {
public float c_x;
public float c_y;
public float c_z;
public int _res0;
public int _res1;
public int _res2;
public int _res3;
public int _res4;
public int _res5;
public modifier_volume(int parameter_control_word,
float a_x,
float a_y,
@ -656,6 +917,7 @@ public class TAVertexParameter {
float c_y,
float c_z
) {
super();
this.parameter_control_word = parameter_control_word;
this.a_x = a_x;
this.a_y = a_y;
@ -666,12 +928,27 @@ public class TAVertexParameter {
this.c_x = c_x;
this.c_y = c_y;
this.c_z = c_z;
this._res0 = 0;
this._res1 = 0;
this._res2 = 0;
this._res3 = 0;
this._res4 = 0;
this._res5 = 0;
}
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);
}
}
}

View File

@ -0,0 +1,13 @@
package sega.dreamcast.sh7091;
import java.nio.ByteBuffer;
import sega.dreamcast.MemoryMap;
public abstract class StoreQueueBuffer extends ByteBuffer {
public StoreQueueBuffer() {
super(MemoryMap.store_queue, 0, 64, 64, true);
}
public abstract void submit();
}

View File

@ -1,29 +1,32 @@
python gen_decoder.py > c/decode.inc.c
CLASS_DIRECTORY=./classes
LIB=./dreamcast
python gen_decoder.py > "${CLASS_DIRECTORY}"/c/decode.inc.c
# [block name] [package name] [class_name] [base_address]
python regs/register_gen.py ../dreamcast/regs/holly.csv holly holly Holly 0xa05f8000 > sega/dreamcast/holly/Holly.java
python regs/register_gen.py ../dreamcast/regs/systembus.csv systembus systembus Systembus 0xa05f6800 > sega/dreamcast/systembus/Systembus.java
python regs/register_gen.py ../dreamcast/regs/systembus.csv maple_if maple MapleIF 0xa05f6c00 > sega/dreamcast/maple/MapleIF.java
python regs/register_gen.py ../dreamcast/regs/gdrom.csv gdrom gdrom Gdrom 0xa05f7000 > sega/dreamcast/gdrom/Gdrom.java
python regs/register_gen.py ../dreamcast/regs/systembus.csv g1_if gdrom G1IF 0xa05f7400 > sega/dreamcast/gdrom/G1IF.java
python regs/register_gen.py ../dreamcast/regs/systembus.csv g2_if g2_if G2IF 0xa05f7800 > sega/dreamcast/g2_if/G2IF.java
python regs/register_gen.py ../dreamcast/regs/systembus.csv pvr_if pvr_if PVRIF 0xa05f7c00 > sega/dreamcast/pvr_if/PVRIF.java
python regs/register_gen.py "${LIB}"/regs/holly.csv holly holly Holly 0xa05f8000 > "${CLASS_DIRECTORY}"/sega/dreamcast/holly/Holly.java
python regs/register_gen.py "${LIB}"/regs/systembus.csv systembus systembus Systembus 0xa05f6800 > "${CLASS_DIRECTORY}"/sega/dreamcast/systembus/Systembus.java
python regs/register_gen.py "${LIB}"/regs/systembus.csv maple_if maple MapleIF 0xa05f6c00 > "${CLASS_DIRECTORY}"/sega/dreamcast/maple/MapleIF.java
python regs/register_gen.py "${LIB}"/regs/gdrom.csv gdrom gdrom Gdrom 0xa05f7000 > "${CLASS_DIRECTORY}"/sega/dreamcast/gdrom/Gdrom.java
python regs/register_gen.py "${LIB}"/regs/systembus.csv g1_if gdrom G1IF 0xa05f7400 > "${CLASS_DIRECTORY}"/sega/dreamcast/gdrom/G1IF.java
python regs/register_gen.py "${LIB}"/regs/systembus.csv g2_if g2_if G2IF 0xa05f7800 > "${CLASS_DIRECTORY}"/sega/dreamcast/g2_if/G2IF.java
python regs/register_gen.py "${LIB}"/regs/systembus.csv pvr_if pvr_if PVRIF 0xa05f7c00 > "${CLASS_DIRECTORY}"/sega/dreamcast/pvr_if/PVRIF.java
python regs/bits_gen.py ../dreamcast/regs/core_bits.csv holly CoreBits > sega/dreamcast/holly/CoreBits.java
python regs/bits_gen.py ../dreamcast/regs/ta_bits.csv holly TABits > sega/dreamcast/holly/TABits.java
python regs/bits_gen.py ../dreamcast/regs/isp_tsp.csv holly ISPTSP > sega/dreamcast/holly/ISPTSP.java
python regs/bits_gen.py ../dreamcast/regs/ta_parameter.csv holly TAParameter > sega/dreamcast/holly/TAParameter.java
python regs/bits_gen.py ../dreamcast/regs/gdrom_bits.csv gdrom GdromBits > sega/dreamcast/gdrom/GdromBits.java
python regs/bits_gen.py "${LIB}"/regs/core_bits.csv holly CoreBits > "${CLASS_DIRECTORY}"/sega/dreamcast/holly/CoreBits.java
python regs/bits_gen.py "${LIB}"/regs/ta_bits.csv holly TABits > "${CLASS_DIRECTORY}"/sega/dreamcast/holly/TABits.java
python regs/bits_gen.py "${LIB}"/regs/isp_tsp.csv holly ISPTSP > "${CLASS_DIRECTORY}"/sega/dreamcast/holly/ISPTSP.java
python regs/bits_gen.py "${LIB}"/regs/ta_parameter.csv holly TAParameter > "${CLASS_DIRECTORY}"/sega/dreamcast/holly/TAParameter.java
python regs/bits_gen.py "${LIB}"/regs/gdrom_bits.csv gdrom GdromBits > "${CLASS_DIRECTORY}"/sega/dreamcast/gdrom/GdromBits.java
python regs/bits_gen.py ../dreamcast/regs/systembus_bits.csv systembus SystembusBits > sega/dreamcast/systembus/SystembusBits.java
python regs/bits_gen.py "${LIB}"/regs/systembus_bits.csv systembus SystembusBits > "${CLASS_DIRECTORY}"/sega/dreamcast/systembus/SystembusBits.java
python regs/ta_parameters.py ../dreamcast/regs/vertex_parameter_format.csv holly TAVertexParameter > sega/dreamcast/holly/TAVertexParameter.java
python regs/ta_parameters.py ../dreamcast/regs/global_parameter_format.csv holly TAGlobalParameter > sega/dreamcast/holly/TAGlobalParameter.java
python regs/ta_parameters.py "${LIB}"/regs/vertex_parameter_format.csv holly TAVertexParameter > "${CLASS_DIRECTORY}"/sega/dreamcast/holly/TAVertexParameter.java
python regs/ta_parameters.py "${LIB}"/regs/global_parameter_format.csv holly TAGlobalParameter > "${CLASS_DIRECTORY}"/sega/dreamcast/holly/TAGlobalParameter.java
PYTHONPATH=./regs/ python ../model_generator/generate_java.py cube.obj CubeModel > ./model/CubeModel.java
PYTHONPATH=./regs/ python ../model_generator/generate_java.py cube.obj CubeModel > "${CLASS_DIRECTORY}"/./model/CubeModel.java
python images/color_convert.py images/java_cup.png argb4444 images/java_cup.data
python images/color_convert.py images/java_text.png argb4444 images/java_text.data
python images/color_convert.py images/java_powered.png argb4444 images/java_powered.data
python regs/gdrom_command_packet_format.py ../dreamcast/regs/gdrom_command_packet_format.csv gdrom GdromCommandPacketFormat > sega/dreamcast/gdrom/GdromCommandPacketFormat.java
python regs/gdrom_command_packet_format.py "${LIB}"/regs/gdrom_command_packet_format.csv gdrom GdromCommandPacketFormat > "${CLASS_DIRECTORY}"/sega/dreamcast/gdrom/GdromCommandPacketFormat.java

View File

@ -38,7 +38,7 @@ OBJ = \
MAIN_DREAMCAST_OBJ = \
c/main_dreamcast.o \
c/sh7091_scif.o \
images/java_powered.data.o
c/native/sh4intrinsic.o
MAIN_HOSTED_OBJ = \
c/file.o \

View File

@ -1,4 +0,0 @@
class Holly {
public static final int
}

View File

@ -30,9 +30,11 @@ def _render(out, lines, indent_length):
else:
level += indent_length
"""
if level == 0 and l and l[-1] == ";":
if should_autonewline(l):
out.write("\n")
"""
return out
def renderer(indent_length=2):

View File

@ -1,6 +1,6 @@
def render_fields(get_type, fields, want_get_byte):
def render_fields(get_type, fields):
for field in fields:
if want_get_byte and field.name.startswith("_res"):
if field.name.startswith("_res"):
continue
field_type = get_type(field.name)
@ -10,7 +10,7 @@ def render_fields(get_type, fields, want_get_byte):
for i in range(field.array_length):
yield f"public {field_type} {field.name}{i};"
def render_constructor(get_type, declaration, want_get_byte):
def render_constructor(get_type, declaration, store_queue_buffer):
initializer = f"public {declaration.name}("
padding = " " * len(initializer)
def start(i):
@ -34,8 +34,10 @@ def render_constructor(get_type, declaration, want_get_byte):
else:
yield initializer + ') {'
yield "super();"
for i, field in enumerate(declaration.fields):
if want_get_byte and field.name.startswith("_res"):
if field.name.startswith("_res"):
continue
value = field.name if not field.name.startswith('_res') else '0'
@ -60,8 +62,8 @@ def render_get_byte(fields):
yield "switch (ix) {"
for field in fields:
if "_res" in field.name:
pass
elif field.array_length == 1:
continue
if field.array_length == 1:
yield f"case {ix}: return {field.name};"
else:
for i in range(field.array_length):
@ -71,18 +73,55 @@ def render_get_byte(fields):
yield "}"
yield "}"
def render_declaration(get_type, declaration, want_get_byte):
yield f"public static class {declaration.name} implements GdromCommandPacketInterface {{"
yield from render_fields(get_type, declaration.fields, want_get_byte)
yield from render_constructor(get_type, declaration, want_get_byte)
if want_get_byte:
yield from render_get_byte(declaration.fields)
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_declarations(get_type, package_name, class_name, declarations, want_get_byte=False):
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):
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, want_get_byte)
yield from render_declaration(get_type, declaration, store_queue_buffer, get_byte)
yield "}"

View File

@ -65,5 +65,7 @@ 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))
render(render_declarations(get_type, package_name, class_name, declarations,
store_queue_buffer=True,
get_byte=False))
sys.stdout.write(out.getvalue())