Skip to content

Commit

Permalink
Main now in Kotlin
Browse files Browse the repository at this point in the history
  • Loading branch information
Amrsatrio committed Aug 24, 2021
1 parent fd0b593 commit af99221
Show file tree
Hide file tree
Showing 3 changed files with 337 additions and 485 deletions.
13 changes: 7 additions & 6 deletions src/main/java/com/tb24/blenderumap/AssetUtils.kt
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package com.tb24.blenderumap

import me.fungames.jfortniteparse.ue4.assets.exports.UObject
import me.fungames.jfortniteparse.ue4.assets.objects.FPropertyTag
import me.fungames.jfortniteparse.ue4.assets.objects.IPropertyHolder
import java.lang.reflect.ParameterizedType
import java.lang.reflect.Type
import kotlin.math.max

fun <T> getProp(properties: List<FPropertyTag>, name: String, type: Type): T? {
fun <T> IPropertyHolder.getProp(name: String, type: Type): T? {
for (prop in properties) {
if (name == prop.name.text) {
val clazz = (if (type is ParameterizedType) type.rawType else type) as Class<T>
Expand All @@ -16,7 +16,10 @@ fun <T> getProp(properties: List<FPropertyTag>, name: String, type: Type): T? {
return null
}

fun <T> getProps(properties: List<FPropertyTag>, name: String, clazz: Class<T>): Array<T?> {
inline fun <T> IPropertyHolder.getProp(name: String, clazz: Class<T>): T? = getProp(name, clazz as Type)
inline fun <reified T> IPropertyHolder.getProp(name: String): T? = getProp(name, T::class.java as Type)

fun <T> IPropertyHolder.getProps(name: String, clazz: Class<T>): Array<T?> {
val collected = mutableListOf<FPropertyTag>()
var maxIndex = -1
for (prop in properties) {
Expand All @@ -32,6 +35,4 @@ fun <T> getProps(properties: List<FPropertyTag>, name: String, clazz: Class<T>):
return out
}

fun <T> UObject.getProp(name: String, clazz: Class<T>) = getProp<T>(properties, name, clazz)
fun <T> UObject.getProp(name: String, type: Type): T? = getProp(properties, name, type)
inline fun <reified T> UObject.get(name: String): T? = getProp(name, T::class.java)
inline fun <reified T> IPropertyHolder.getProps(name: String) = getProps(name, T::class.java)
18 changes: 18 additions & 0 deletions src/main/java/com/tb24/blenderumap/Config.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package com.tb24.blenderumap;

import me.fungames.jfortniteparse.ue4.versions.Ue4Version;

import java.util.Collections;
import java.util.List;

public class Config {
public String PaksDirectory = "C:\\Program Files\\Epic Games\\Fortnite\\FortniteGame\\Content\\Paks";
public Ue4Version UEVersion = Ue4Version.GAME_UE4_LATEST;
public List<MyFileProvider.EncryptionKey> EncryptionKeys = Collections.emptyList();
public boolean bDumpAssets = false;
public int ObjectCacheSize = 100;
public boolean bReadMaterials = true;
public boolean bExportToDDSWhenPossible = true;
public boolean bExportBuildingFoundations = true;
public String ExportPackage;
}
Loading

0 comments on commit af99221

Please sign in to comment.