GdromTest: directory listing
This commit is contained in:
parent
13c11391e0
commit
7e954e060c
@ -1,6 +1,12 @@
|
||||
#include "example/DreamcastVideo2.class.h"
|
||||
#include "example/DreamcastVideo.class.h"
|
||||
#include "example/GdromExtentReader.class.h"
|
||||
#include "example/GdromTest.class.h"
|
||||
#include "filesystem/iso9660/ByteParser.class.h"
|
||||
#include "filesystem/iso9660/DirectoryRecord.class.h"
|
||||
#include "filesystem/iso9660/ExtentReader.class.h"
|
||||
#include "filesystem/iso9660/PrimaryVolumeDescriptor.class.h"
|
||||
#include "filesystem/iso9660/VolumeParser.class.h"
|
||||
#include "java/io/PrintStream.class.h"
|
||||
#include "java/lang/Boolean.class.h"
|
||||
#include "java/lang/Byte.class.h"
|
||||
|
@ -1,6 +1,12 @@
|
||||
(const uint8_t *)&_binary_example_DreamcastVideo2_class_start,
|
||||
(const uint8_t *)&_binary_example_DreamcastVideo_class_start,
|
||||
(const uint8_t *)&_binary_example_GdromExtentReader_class_start,
|
||||
(const uint8_t *)&_binary_example_GdromTest_class_start,
|
||||
(const uint8_t *)&_binary_filesystem_iso9660_ByteParser_class_start,
|
||||
(const uint8_t *)&_binary_filesystem_iso9660_DirectoryRecord_class_start,
|
||||
(const uint8_t *)&_binary_filesystem_iso9660_ExtentReader_class_start,
|
||||
(const uint8_t *)&_binary_filesystem_iso9660_PrimaryVolumeDescriptor_class_start,
|
||||
(const uint8_t *)&_binary_filesystem_iso9660_VolumeParser_class_start,
|
||||
(const uint8_t *)&_binary_java_io_PrintStream_class_start,
|
||||
(const uint8_t *)&_binary_java_lang_Boolean_class_start,
|
||||
(const uint8_t *)&_binary_java_lang_Byte_class_start,
|
||||
|
@ -1,7 +1,13 @@
|
||||
CLASS_PATH = \
|
||||
example/DreamcastVideo2.class.o \
|
||||
example/DreamcastVideo.class.o \
|
||||
example/GdromExtentReader.class.o \
|
||||
example/GdromTest.class.o \
|
||||
filesystem/iso9660/ByteParser.class.o \
|
||||
filesystem/iso9660/DirectoryRecord.class.o \
|
||||
filesystem/iso9660/ExtentReader.class.o \
|
||||
filesystem/iso9660/PrimaryVolumeDescriptor.class.o \
|
||||
filesystem/iso9660/VolumeParser.class.o \
|
||||
java/io/PrintStream.class.o \
|
||||
java/lang/Boolean.class.o \
|
||||
java/lang/Byte.class.o \
|
||||
|
15
example/GdromExtentReader.class.h
Normal file
15
example/GdromExtentReader.class.h
Normal file
@ -0,0 +1,15 @@
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern C {
|
||||
#endif
|
||||
|
||||
extern uint32_t _binary_example_GdromExtentReader_class_start __asm("_binary_example_GdromExtentReader_class_start");
|
||||
extern uint32_t _binary_example_GdromExtentReader_class_end __asm("_binary_example_GdromExtentReader_class_end");
|
||||
extern uint32_t _binary_example_GdromExtentReader_class_size __asm("_binary_example_GdromExtentReader_class_size");
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
@ -3,6 +3,17 @@ package example;
|
||||
import sega.dreamcast.gdrom.GdromProtocol;
|
||||
import sega.dreamcast.gdrom.G1IF;
|
||||
import java.misc.Memory;
|
||||
import filesystem.iso9660.VolumeParser;
|
||||
import filesystem.iso9660.ExtentReader;
|
||||
|
||||
class GdromExtentReader implements ExtentReader {
|
||||
public void readInto(byte[] buf, int extent) {
|
||||
int starting_address = extent + 150;
|
||||
System.out.print("starting_address: ");
|
||||
System.out.println(starting_address);
|
||||
GdromProtocol.cdReadPIO(buf, starting_address, 1);
|
||||
}
|
||||
}
|
||||
|
||||
class GdromTest {
|
||||
static byte[] buf;
|
||||
@ -29,15 +40,20 @@ class GdromTest {
|
||||
|
||||
int data_track_fad = GdromProtocol.tocGetDataTrackFad();
|
||||
|
||||
int primary_volume_descriptor = data_track_fad + 16;
|
||||
|
||||
GdromProtocol.cdReadPIO(buf, primary_volume_descriptor, 1);
|
||||
//GdromProtocol.cdReadPIO(buf, primary_volume_descriptor, 1);
|
||||
|
||||
GdromExtentReader reader = new GdromExtentReader();
|
||||
VolumeParser parser = new VolumeParser(data_track_fad - 150, reader);
|
||||
System.out.println("::parser parse::");
|
||||
parser.parse();
|
||||
/*
|
||||
System.out.println("data:");
|
||||
for (int i = 0; i < 16; i++) {
|
||||
System.out.print(buf[i]);
|
||||
System.out.print(' ');
|
||||
System.out.print(((int)buf[i]) & 0xff);
|
||||
System.out.print(" ");
|
||||
}
|
||||
System.out.println();
|
||||
*/
|
||||
|
||||
}
|
||||
}
|
||||
|
15
filesystem/iso9660/ByteParser.class.h
Normal file
15
filesystem/iso9660/ByteParser.class.h
Normal file
@ -0,0 +1,15 @@
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern C {
|
||||
#endif
|
||||
|
||||
extern uint32_t _binary_filesystem_iso9660_ByteParser_class_start __asm("_binary_filesystem_iso9660_ByteParser_class_start");
|
||||
extern uint32_t _binary_filesystem_iso9660_ByteParser_class_end __asm("_binary_filesystem_iso9660_ByteParser_class_end");
|
||||
extern uint32_t _binary_filesystem_iso9660_ByteParser_class_size __asm("_binary_filesystem_iso9660_ByteParser_class_size");
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
15
filesystem/iso9660/DirectoryRecord.class.h
Normal file
15
filesystem/iso9660/DirectoryRecord.class.h
Normal file
@ -0,0 +1,15 @@
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern C {
|
||||
#endif
|
||||
|
||||
extern uint32_t _binary_filesystem_iso9660_DirectoryRecord_class_start __asm("_binary_filesystem_iso9660_DirectoryRecord_class_start");
|
||||
extern uint32_t _binary_filesystem_iso9660_DirectoryRecord_class_end __asm("_binary_filesystem_iso9660_DirectoryRecord_class_end");
|
||||
extern uint32_t _binary_filesystem_iso9660_DirectoryRecord_class_size __asm("_binary_filesystem_iso9660_DirectoryRecord_class_size");
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
15
filesystem/iso9660/ExtentReader.class.h
Normal file
15
filesystem/iso9660/ExtentReader.class.h
Normal file
@ -0,0 +1,15 @@
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern C {
|
||||
#endif
|
||||
|
||||
extern uint32_t _binary_filesystem_iso9660_ExtentReader_class_start __asm("_binary_filesystem_iso9660_ExtentReader_class_start");
|
||||
extern uint32_t _binary_filesystem_iso9660_ExtentReader_class_end __asm("_binary_filesystem_iso9660_ExtentReader_class_end");
|
||||
extern uint32_t _binary_filesystem_iso9660_ExtentReader_class_size __asm("_binary_filesystem_iso9660_ExtentReader_class_size");
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
@ -1,5 +1,5 @@
|
||||
package filesystem.iso9660;
|
||||
|
||||
interface ExtentReader {
|
||||
public interface ExtentReader {
|
||||
public abstract void readInto(byte[] buf, int extent);
|
||||
}
|
||||
|
15
filesystem/iso9660/PrimaryVolumeDescriptor.class.h
Normal file
15
filesystem/iso9660/PrimaryVolumeDescriptor.class.h
Normal file
@ -0,0 +1,15 @@
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern C {
|
||||
#endif
|
||||
|
||||
extern uint32_t _binary_filesystem_iso9660_PrimaryVolumeDescriptor_class_start __asm("_binary_filesystem_iso9660_PrimaryVolumeDescriptor_class_start");
|
||||
extern uint32_t _binary_filesystem_iso9660_PrimaryVolumeDescriptor_class_end __asm("_binary_filesystem_iso9660_PrimaryVolumeDescriptor_class_end");
|
||||
extern uint32_t _binary_filesystem_iso9660_PrimaryVolumeDescriptor_class_size __asm("_binary_filesystem_iso9660_PrimaryVolumeDescriptor_class_size");
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
@ -6,7 +6,6 @@ import java.io.IOException;
|
||||
|
||||
class TestExtentReader implements ExtentReader {
|
||||
byte[] all_bytes;
|
||||
|
||||
public TestExtentReader() {
|
||||
try {
|
||||
all_bytes = Files.readAllBytes(Paths.get("classes/classes.iso"));
|
||||
|
15
filesystem/iso9660/VolumeParser.class.h
Normal file
15
filesystem/iso9660/VolumeParser.class.h
Normal file
@ -0,0 +1,15 @@
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern C {
|
||||
#endif
|
||||
|
||||
extern uint32_t _binary_filesystem_iso9660_VolumeParser_class_start __asm("_binary_filesystem_iso9660_VolumeParser_class_start");
|
||||
extern uint32_t _binary_filesystem_iso9660_VolumeParser_class_end __asm("_binary_filesystem_iso9660_VolumeParser_class_end");
|
||||
extern uint32_t _binary_filesystem_iso9660_VolumeParser_class_size __asm("_binary_filesystem_iso9660_VolumeParser_class_size");
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
@ -2,9 +2,9 @@ package filesystem.iso9660;
|
||||
|
||||
import filesystem.iso9660.PrimaryVolumeDescriptor;
|
||||
import filesystem.iso9660.DirectoryRecord;
|
||||
import filesystem.iso9660.TestExtentReader;
|
||||
|
||||
public class VolumeParser {
|
||||
int fad;
|
||||
byte[] buf;
|
||||
DirectoryRecord dr;
|
||||
ExtentReader reader;
|
||||
@ -102,8 +102,10 @@ public class VolumeParser {
|
||||
}
|
||||
|
||||
public void parse() {
|
||||
int pvd_extent = 16;
|
||||
int pvd_extent = this.fad + 16;
|
||||
|
||||
System.out.print("pvd_extent: ");
|
||||
System.out.println(pvd_extent);
|
||||
reader.readInto(buf, pvd_extent);
|
||||
|
||||
printStandardIdentifier();
|
||||
@ -119,15 +121,20 @@ public class VolumeParser {
|
||||
walkDirectory(extent, num_extents, 0);
|
||||
}
|
||||
|
||||
public VolumeParser(ExtentReader reader) {
|
||||
public VolumeParser(int fad, ExtentReader reader) {
|
||||
this.fad = fad;
|
||||
this.reader = reader;
|
||||
this.buf = new byte[2048];
|
||||
this.dr = new DirectoryRecord(this.buf, 0);
|
||||
}
|
||||
|
||||
/*
|
||||
import filesystem.iso9660.TestExtentReader;
|
||||
|
||||
public static void main(String[] args) {
|
||||
TestExtentReader reader = new TestExtentReader();
|
||||
VolumeParser parser = new VolumeParser(reader);
|
||||
parser.parse();
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
function make_class () {
|
||||
function java_to_class () {
|
||||
while read line; do
|
||||
echo "${line%.java}.class"
|
||||
done
|
||||
@ -68,10 +68,20 @@ function classpath_h () {
|
||||
|
||||
set -e
|
||||
|
||||
find sega/ java/ -name '*.class' -exec rm -f {} \;
|
||||
make -j$(nproc) -f Makefile.dreamcast.mk $(find model/ example/ sega/ java/ -name '*.java' | make_class)
|
||||
find model/ example/ sega/ java/ -name '*.class' | sort | rename_class_files
|
||||
find model/ example/ sega/ java/ -name '*.class' | sort | classpath_mk
|
||||
find model/ example/ sega/ java/ -name '*.class' | sort | classpath_inc_c
|
||||
find model/ example/ sega/ java/ -name '*.class' | sort | make_header
|
||||
find model/ example/ sega/ java/ -name '*.class' | sort | classpath_h
|
||||
function find_classes () {
|
||||
find model/ example/ sega/ java/ filesystem/ -name '*.class' -not -name 'Test*' | sort
|
||||
}
|
||||
|
||||
function find_sources () {
|
||||
find model/ example/ sega/ java/ filesystem/ -name '*.java' -not -name 'Test*' | sort
|
||||
}
|
||||
|
||||
find sega/ java/ filesystem/ -name '*.class' -exec rm -f {} \;
|
||||
|
||||
make -j$(nproc) -f Makefile.dreamcast.mk $(find_sources | java_to_class)
|
||||
|
||||
find_classes | rename_class_files
|
||||
find_classes | classpath_mk
|
||||
find_classes | classpath_inc_c
|
||||
find_classes | make_header
|
||||
find_classes | classpath_h
|
||||
|
@ -24,6 +24,10 @@ public class PrintStream
|
||||
write(String.valueOf(b));
|
||||
}
|
||||
|
||||
public void print(char c) {
|
||||
write(String.valueOf(c));
|
||||
}
|
||||
|
||||
public void print(int i) {
|
||||
write(String.valueOf(i));
|
||||
}
|
||||
@ -58,6 +62,11 @@ public class PrintStream
|
||||
write(newline);
|
||||
}
|
||||
|
||||
public void println(char c) {
|
||||
write(String.valueOf(c));
|
||||
write(newline);
|
||||
}
|
||||
|
||||
public void println(int i) {
|
||||
write(String.valueOf(i));
|
||||
write(newline);
|
||||
|
@ -31,6 +31,10 @@ public class String {
|
||||
return b ? "true" : "false";
|
||||
}
|
||||
|
||||
public static String valueOf(char c) {
|
||||
return new String(new byte[] { (byte)c });
|
||||
}
|
||||
|
||||
public static String valueOf(int i) {
|
||||
return Integer.toString(i);
|
||||
}
|
||||
|
@ -36,13 +36,13 @@ public class GdromProtocol {
|
||||
|
||||
Memory.putU1(Gdrom.command, GdromBits.command__code__packet_command);
|
||||
|
||||
System.out.println("words:");
|
||||
//System.out.println("words:");
|
||||
for (int i = 0; i < 6; i++) {
|
||||
int i0 = command.getByte(i * 2);
|
||||
int i1 = command.getByte(i * 2 + 1);
|
||||
// little endian
|
||||
int word = ((i1 & 0xff) << 8) | (i0 & 0xff);
|
||||
System.out.println(word);
|
||||
//System.out.println(word);
|
||||
Memory.putU2(Gdrom.data, word);
|
||||
}
|
||||
|
||||
@ -56,18 +56,18 @@ public class GdromProtocol {
|
||||
public static void readData(byte[] buf, int length) {
|
||||
for (int i = 0; i < (length >> 1); i++) {
|
||||
int data = Memory.getU2(Gdrom.data);
|
||||
buf[i * 2] = (byte)((data >> 8) & 0xff);
|
||||
buf[i * 2 + 1] = (byte)(data & 0xff);
|
||||
buf[i * 2] = (byte)(data);
|
||||
buf[i * 2 + 1] = (byte)(data >> 8);
|
||||
}
|
||||
}
|
||||
|
||||
public static int getFad(byte[] buf, int i) {
|
||||
int i0 = buf[0];
|
||||
int i1 = buf[1];
|
||||
int i2 = buf[2];
|
||||
//int i3 = low & 0xff;
|
||||
//int i0 = ((int)buf[i * 4 + 0]) & 0xff;
|
||||
int i1 = ((int)buf[i * 4 + 1]) & 0xff;
|
||||
int i2 = ((int)buf[i * 4 + 2]) & 0xff;
|
||||
int i3 = ((int)buf[i * 4 + 3]) & 0xff;
|
||||
|
||||
return (i2 << 16) | (i1 << 8) | i0;
|
||||
return (i1 << 16) | (i2 << 8) | (i3 << 0);
|
||||
}
|
||||
|
||||
public static int tocGetDataTrackFad() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user