Skip to content

Commit

Permalink
What the hail
Browse files Browse the repository at this point in the history
  • Loading branch information
XyperCode committed Aug 9, 2024
1 parent b328a91 commit b64f6be
Show file tree
Hide file tree
Showing 225 changed files with 956 additions and 222 deletions.
9 changes: 8 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,14 @@ gradle-app.setting
# Cache of project
.gradletasknamecache

**/build/
/*/build/
/build/
/*/.gradle/
/.gradle/

/.idea/
/.vscode/
/.fleet/

# Common working directory
run/
Expand Down
3 changes: 0 additions & 3 deletions api/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@ repositories {
}

dependencies {
testImplementation(platform("org.junit:junit-bom:5.10.0"))
testImplementation("org.junit.jupiter:junit-jupiter")

implementation("org.jetbrains:annotations:23.0.0")

implementation("io.github.ultreon:ubo:1.3.0")
Expand Down
10 changes: 10 additions & 0 deletions api/src/main/java/dev/ultreon/devices/api/TextureLoader.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package dev.ultreon.devices.api;

import java.io.IOException;
import java.io.InputStream;

public interface TextureLoader {
int load(InputStream stream) throws IOException;

void destroy(int textureID);
}
3 changes: 3 additions & 0 deletions api/src/main/java/module-info.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module devices.api {
requires java.base;
}
26 changes: 26 additions & 0 deletions bios/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
plugins {
id 'java'
}

group = 'dev.ultreon.mods'
version = '0.9.0'

base {
archivesName = "devices-bios"
}

java {
toolchain {
languageVersion = JavaLanguageVersion.of(17)
}
}

repositories {
mavenCentral()
}

dependencies {
implementation 'org.jetbrains:annotations:24.0.0'

implementation project(':api')
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package dev.ultreon.devices.api.bios;
package dev.ultreon.vbios;

import dev.ultreon.devices.api.bios.efi.VEFI_System;
import dev.ultreon.vbios.efi.VEFI_System;

public interface Bios {
void registerInterrupt(BiosInterruptType interrupt, InterruptHandler handler);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package dev.ultreon.devices.api.bios;
package dev.ultreon.vbios;

import dev.ultreon.devices.api.bios.efi.*;
import dev.ultreon.vbios.efi.*;

public enum BiosCallType {
POWER_OFF(void.class),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package dev.ultreon.devices.api.bios;
package dev.ultreon.vbios;

public enum BiosInterruptType {
DOUBLE_FAULT,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package dev.ultreon.devices.api.bios;
package dev.ultreon.vbios;

import java.nio.ByteBuffer;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package dev.ultreon.devices.api.bios;
package dev.ultreon.vbios;

public record FrameBufferInfo(
int width,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package dev.ultreon.devices.api.bios;
package dev.ultreon.vbios;

public interface InterruptData {
<T> T getField(String name);

void setField(String name, Object value);

BiosInterruptType interruptType();
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package dev.ultreon.devices.api.bios;
package dev.ultreon.vbios;

@FunctionalInterface
public interface InterruptHandler {
Expand Down
7 changes: 7 additions & 0 deletions bios/src/main/java/dev/ultreon/vbios/boot/BootSector.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package dev.ultreon.vbios.boot;

import dev.ultreon.vbios.Bios;

public interface BootSector {
void boot(Bios bios);
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package dev.ultreon.devices.api.bios.efi;
package dev.ultreon.vbios.efi;

import java.util.UUID;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package dev.ultreon.devices.api.bios.efi;
package dev.ultreon.vbios.efi;

public record VEFI_DeviceInfo(VEFI_DeviceID[] ids) {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package dev.ultreon.devices.api.bios.efi;
package dev.ultreon.vbios.efi;

public record VEFI_DiskInfo(VEFI_DeviceID deviceID, VEFI_DriveType driveType) {
public VEFI_DiskInfo(VEFI_DeviceID deviceID, byte b) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package dev.ultreon.devices.api.bios.efi;
package dev.ultreon.vbios.efi;

public enum VEFI_DriveType {
HDD,
Expand Down
7 changes: 7 additions & 0 deletions bios/src/main/java/dev/ultreon/vbios/efi/VEFI_Executable.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package dev.ultreon.vbios.efi;

import dev.ultreon.vbios.Bios;

public interface VEFI_Executable {
void execute(Bios bios, VEFI_System system);
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package dev.ultreon.devices.api.bios.efi;
package dev.ultreon.vbios.efi;

public record VEFI_File(int handle) {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package dev.ultreon.devices.api.bios.efi;
package dev.ultreon.vbios.efi;

public record VEFI_FileInfo(VEFI_DeviceID id, String path) {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package dev.ultreon.devices.api.bios;
package dev.ultreon.vbios.efi;

public record VEFI_Handle(
int handle
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package dev.ultreon.devices.api.bios.efi;
package dev.ultreon.vbios.efi;

public enum VEFI_IconType {
VEFI_Error,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package dev.ultreon.devices.api.bios.efi;
package dev.ultreon.vbios.efi;

public record VEFI_Notification(VEFI_IconType type, String header, String message) {
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
package dev.ultreon.devices.api.bios.efi;
package dev.ultreon.vbios.efi;

import dev.ultreon.devices.api.bios.Bios;
import dev.ultreon.devices.api.TextureLoader;
import dev.ultreon.vbios.Bios;
import dev.ultreon.devices.api.device.VEFI_Disk;
import org.intellij.lang.annotations.Language;

import java.io.IOException;

public interface VEFI_System {
public interface VEFI_System extends TextureLoader {
int F_READ = 0;
int F_WRITE = 1;
int F_EXEC = 2;
Expand Down Expand Up @@ -74,11 +75,44 @@ public interface VEFI_System {
void readFileB(VEFI_File file, byte[] data, int offset, int length);
void readFileT(VEFI_File file, char[] data, int offset, int length);

/**
* Closes a file handle
*
* @param file the file to close
*/
void closeFile(VEFI_File file);

/**
* Get the vBIOS instance.
*
* @return the vBIOS
*/
Bios getBios();

Object runIsolated(Class<?> contex, @Language("jvm-class-name") String className, String packageName, Object... args);

/**
* Run a class in an isolated context.
*
* @param context the context class, this is used to find the location in the classpath
* @param className the class name of the class to run in the context
* @param packageName the allowed package name that can be loaded.
* @param args the arguments to pass to the class.
* @return the instance of the class in the isolated context
*/
Object runIsolated(Class<?> context, @Language("jvm-class-name") String className, String packageName, Object... args);

/**
* Closes a disk after it is no longer in use.
*
* @param vefiDisk the vEFI disk to close
* @throws IOException if an I/O error occurs or if the disk is already closed
*/
void closeDisk(VEFI_Disk vefiDisk) throws IOException;

/**
* Offloads code to the vGPU thread.
* This is basically the Minecraft render thread.
*
* @param call the code to offload
*/
void offload(Runnable call);
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package dev.ultreon.devices.api.bios;
package dev.ultreon.vbios.efi;

public record VEFI_VideoSize(
int width,
Expand Down
4 changes: 4 additions & 0 deletions bios/src/main/java/module-info.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module devices.bios {
requires devices.api;
requires java.base;
}
1 change: 0 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ subprojects {
url 'https://maven.quiltmc.org/repository/release/'
}


maven {
url "https://cursemaven.com"
content {
Expand Down
63 changes: 18 additions & 45 deletions common/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,37 +4,12 @@ architectury {
}

sourceSets {
api {
java {
srcDirs += [
"src/api/java"
]
}
}

mineos {
java {
srcDirs += [
"src/mineos/java"
]
}

runtimeClasspath += sourceSets.api.output
compileClasspath += sourceSets.api.output
}

main {
resources {
srcDirs += [
"src/main/generated/resources"
]
}

runtimeClasspath += sourceSets.api.output
compileClasspath += sourceSets.api.output

runtimeClasspath += sourceSets.mineos.output
compileClasspath += sourceSets.mineos.output
}
}

Expand All @@ -46,10 +21,17 @@ repositories {
maven { url = "https://cursemaven.com" }
}

configurations {
osInstaller {
canBeConsumed = true
canBeResolved = true
}
}

dependencies {
apiImplementation 'org.jetbrains:annotations:24.0.0'
mineosImplementation 'org.jetbrains:annotations:24.0.0'
mineosImplementation "org.apache.commons:commons-compress:1.26.1"
implementation project(":api")
implementation project(":bios")
osInstaller project(":mineos:installer")

// We depend on fabric loader here to use the fabric @Environment annotations and get the mixin dependencies
// Do NOT use other classes from fabric loader
Expand All @@ -67,7 +49,14 @@ dependencies {
modCompileOnly 'com.electronwill.night-config:core:3.6.3'
modCompileOnly 'com.electronwill.night-config:toml:3.6.3'

implementation("de.waldheinz:fat32-lib:0.6.5")
implementation "de.waldheinz:fat32-lib:0.6.5"
}

processResources {
from {
configurations.osInstaller
into "assets/devices/device_installers"
}
}

sourceSets {
Expand All @@ -85,22 +74,6 @@ jar {
from("LICENSE") {
rename { "${it}_${archivesBaseName}" }
}

from(sourceSets.api.output)
}

tasks.register("mineosJar", Jar) {
archiveBaseName = "MineOS"
archiveVersion = "1.0.0"
archiveClassifier = null

duplicatesStrategy = DuplicatesStrategy.EXCLUDE

from("LICENSE") {
rename { "${it}_MineOS" }
}

from(sourceSets.mineos.output)
}

publishing {
Expand Down

This file was deleted.

This file was deleted.

Loading

0 comments on commit b64f6be

Please sign in to comment.