Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
members = ["astro_mod_integrator", "astro_modloader"]

[workspace.package]
version = "0.1.14"
version = "0.1.15"
authors = ["AstroTechies, localcc, konsti219"]
description = "Astroneer Modloader"

[workspace.dependencies]
astro_mod_integrator = { path = "./astro_mod_integrator" }

unreal_mod_manager = { rev = "c636ad4e30c0f048f931d03a803d233c06dbf5d8", git = "https://github.com/AstroTechies/unrealmodding", features = [
"ue4_23",
unreal_mod_manager = { rev = "f4df5d8e75b1e184832384d1865f0b696b90a614", git = "https://github.com/AstroTechies/unrealmodding", features = [
"ue4_27",
"cpp_loader",
] }

Expand Down
Binary file modified astro_mod_integrator/assets/ActorTemplate.uasset
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
"version": "0.1.0",
"author": "AstroTechies",
"integrator": {
"persistent_actors": ["/Game/Integrator/NotificationActor"],
"persistent_actor_maps": [
"Astro/Content/Maps/Staging_T2.umap",
"Astro/Content/Maps/Staging_T2_PackedPlanets_Switch.umap",
Expand Down
5 changes: 3 additions & 2 deletions astro_mod_integrator/src/assets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ pub(crate) const ACTOR_TEMPLATE_ASSET: &[u8] = include_bytes!("../assets/ActorTe

pub(crate) const ACTOR_TEMPLATE_EXPORT: &[u8] = include_bytes!("../assets/ActorTemplate.uexp");

pub(crate) const ALERT_MOD_NOTIFICATION_ACTOR_ASSET: &[u8] =
/*pub(crate) const ALERT_MOD_NOTIFICATION_ACTOR_ASSET: &[u8] =
include_bytes!("../assets/alert_mod/NotificationActor.uasset");

pub(crate) const ALERT_MOD_NOTIFICATION_ACTOR_EXPORT: &[u8] =
include_bytes!("../assets/alert_mod/NotificationActor.uexp");
include_bytes!("../assets/alert_mod/NotificationActor.uexp");*/

Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![allow(clippy::io_other_error)]

use std::collections::HashMap;
use std::fs::File;
use std::io::{self, BufReader, ErrorKind};
Expand Down Expand Up @@ -66,7 +68,7 @@ pub(crate) fn handle_biome_placement_modifiers(
game_paks,
mod_paks,
&map_path.to_string(),
EngineVersion::VER_UE4_23,
EngineVersion::VER_UE4_27,
)?;

let mut voxel_exports = HashMap::new();
Expand Down
38 changes: 37 additions & 1 deletion astro_mod_integrator/src/handlers/item_list_entries.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ pub(crate) fn handle_item_list_entries(
// this provides backwards compatibility for older mods
// this can just be suppressed by specifying an entry for /Game/Items/ItemTypes/BaseGameInitialKnownItemList in metadata
let exists_bgikil = item_list_entries_map.contains_key("/Game/Items/ItemTypes/BaseGameInitialKnownItemList");
let exists_bgikil2 = item_list_entries_map.contains_key("/Game/U32_Expansion/Items/GW_InitialKnownItemList");
let exists_bgikil3 = item_list_entries_map.contains_key("/Game/Items/ItemLists/BackpackPrinterItemList_GW");
let exists_bgikil4 = item_list_entries_map.contains_key("/Game/Items/ItemLists/T1PrinterItemList_GW");
let exists_bgikil5 = item_list_entries_map.contains_key("/Game/Items/ItemLists/T2PrinterItemList_GW");

for (name, item_list_entries) in item_list_entries_map {
let item_list_entries = item_list_entries
Expand Down Expand Up @@ -80,6 +84,38 @@ pub(crate) fn handle_item_list_entries(
.or_insert_with(HashMap::new)
.extend(orig_entry);
}
if name == "/Game/Items/ItemTypes/MasterItemList" && !exists_bgikil2 {
let orig_entry = new_items.entry(name.clone()).or_insert_with(HashMap::new).clone();

new_items
.entry(String::from("/Game/U32_Expansion/Items/GW_InitialKnownItemList"))
.or_insert_with(HashMap::new)
.extend(orig_entry);
}
if name == "/Game/Items/ItemLists/BackpackPrinterItemList" && !exists_bgikil3 {
let orig_entry = new_items.entry(name.clone()).or_insert_with(HashMap::new).clone();

new_items
.entry(String::from("/Game/Items/ItemLists/BackpackPrinterItemList_GW"))
.or_insert_with(HashMap::new)
.extend(orig_entry);
}
if name == "/Game/Items/ItemLists/T1PrinterItemList" && !exists_bgikil4 {
let orig_entry = new_items.entry(name.clone()).or_insert_with(HashMap::new).clone();

new_items
.entry(String::from("/Game/Items/ItemLists/T1PrinterItemList_GW"))
.or_insert_with(HashMap::new)
.extend(orig_entry);
}
if name == "/Game/Items/ItemLists/T2PrinterItemList" && !exists_bgikil5 {
let orig_entry = new_items.entry(name.clone()).or_insert_with(HashMap::new).clone();

new_items
.entry(String::from("/Game/Items/ItemLists/T2PrinterItemList_GW"))
.or_insert_with(HashMap::new)
.extend(orig_entry);
}
}
}

Expand All @@ -91,7 +127,7 @@ pub(crate) fn handle_item_list_entries(
game_paks,
mod_paks,
&asset_name,
EngineVersion::VER_UE4_23,
EngineVersion::VER_UE4_27,
)?;

let mut item_types_property: HashMap<String, Vec<(usize, usize, String)>> = HashMap::new();
Expand Down
64 changes: 51 additions & 13 deletions astro_mod_integrator/src/handlers/linked_actor_components.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![allow(clippy::io_other_error)]

use std::collections::HashMap;
use std::fs::File;
use std::io::{self, BufReader, Cursor, ErrorKind};
Expand All @@ -12,13 +14,14 @@ use unreal_mod_manager::unreal_asset::{
cast,
engine_version::EngineVersion,
exports::{Export, ExportBaseTrait, ExportNormalTrait},
flags::EObjectFlags,
enums::{EArrayDim, ELifetimeCondition},
flags::{EObjectFlags, EPropertyFlags},
properties::{
guid_property::GuidProperty, int_property::BoolProperty, object_property::ObjectProperty,
str_property::NameProperty, struct_property::StructProperty, Property, PropertyDataTrait,
},
types::PackageIndex,
uproperty::UProperty,
fproperty::{FGenericProperty, FObjectProperty},
Asset, Import,
};
use unreal_mod_manager::unreal_helpers::{game_to_absolute, Guid};
Expand All @@ -42,15 +45,15 @@ pub(crate) fn handle_linked_actor_components(
let actor_asset = Asset::new(
Cursor::new(ACTOR_TEMPLATE_ASSET.to_vec()),
Some(Cursor::new(ACTOR_TEMPLATE_EXPORT.to_vec())),
EngineVersion::VER_UE4_23,
EngineVersion::VER_UE4_27,
None,
)
.map_err(|e| io::Error::new(ErrorKind::Other, e.to_string()))?;

let gen_variable = cast!(Export, NormalExport, &actor_asset.asset_data.exports[0])
.expect("Corrupted ActorTemplate");
let component_export = cast!(Export, PropertyExport, &actor_asset.asset_data.exports[1])
.expect("Corrupted ActorTemplate");
//let component_export = cast!(Export, PropertyExport, &actor_asset.asset_data.exports[1])
// .expect("Corrupted ActorTemplate");
let scs_export = cast!(Export, NormalExport, &actor_asset.asset_data.exports[2])
.expect("Corrupted ActorTemplate");

Expand Down Expand Up @@ -83,7 +86,7 @@ pub(crate) fn handle_linked_actor_components(
game_paks,
mod_paks,
&name,
EngineVersion::VER_UE4_23,
EngineVersion::VER_UE4_27,
)?;

for component_path_raw in components {
Expand Down Expand Up @@ -124,13 +127,14 @@ pub(crate) fn handle_linked_actor_components(

let script_core_uobject = asset.add_fname("/Script/CoreUObject");
let name_class = asset.add_fname("Class");
let object_property = asset.add_fname("ObjectProperty");
let default_object_property = asset.add_fname("Default__ObjectProperty");
//let object_property = asset.add_fname("ObjectProperty");
//let default_object_property = asset.add_fname("Default__ObjectProperty");
let name_scs_node = asset.add_fname("SCS_Node");
let script_engine = asset.add_fname("/Script/Engine");
let default_scs_node = asset.add_fname("Default__SCS_Node");

let class_object_property_import = asset
// 4.23
/*let class_object_property_import = asset
.find_import_no_index(&script_core_uobject, &name_class, &object_property)
.expect("No class object property import");

Expand All @@ -140,7 +144,7 @@ pub(crate) fn handle_linked_actor_components(
&object_property,
&default_object_property,
)
.expect("No default objectproperty");
.expect("No default objectproperty");*/

let scs_node_import = asset
.find_import_no_index(&script_core_uobject, &name_class, &name_scs_node)
Expand Down Expand Up @@ -193,12 +197,13 @@ pub(crate) fn handle_linked_actor_components(
};
let default_import = asset.add_import(default_import);

let mut component_export = component_export.clone();
// 4.23
/*let mut component_export = component_export.clone();
let component_object_property =
cast!(UProperty, UObjectProperty, &mut component_export.property)
.ok_or_else(|| io::Error::new(ErrorKind::Other, "Corrupted starter pak"))?;
component_object_property.property_class = blueprint_generated_class_import;

let component_base_export = component_export.get_base_export_mut();
component_base_export.object_name = asset.add_fname(component);
component_base_export.create_before_serialization_dependencies =
Expand All @@ -213,6 +218,7 @@ pub(crate) fn handle_linked_actor_components(
asset.asset_data.exports.push(component_export.into());

let component_export_index = asset.asset_data.exports.len() as i32;

let actor_export = cast!(
Export,
ClassExport,
Expand All @@ -228,7 +234,39 @@ pub(crate) fn handle_linked_actor_components(
.normal_export
.base_export
.serialization_before_serialization_dependencies
.push(PackageIndex::new(component_export_index));
.push(PackageIndex::new(component_export_index));*/

// 4.27
let fname_object_property = asset.add_fname("ObjectProperty");
let fname_none = asset.add_fname("None");
let component_no_c = String::from(component);
let fprop_generic = FGenericProperty {
serialized_type: Some(fname_object_property),
name: asset.add_fname(&component_no_c),
array_dim: EArrayDim::TArray,
element_size: 8,
property_flags: EPropertyFlags::CPF_BLUEPRINT_VISIBLE | EPropertyFlags::CPF_INSTANCED_REFERENCE | EPropertyFlags::CPF_NON_TRANSACTIONAL,
rep_index: 0,
rep_notify_func: fname_none,
blueprint_replication_condition: ELifetimeCondition::CondNone,
flags: EObjectFlags::RF_PUBLIC | EObjectFlags::RF_LOAD_COMPLETED
};
let fprop = FObjectProperty {
property_class: blueprint_generated_class_import,
generic_property: fprop_generic
};

let actor_export = cast!(
Export,
ClassExport,
&mut asset.asset_data.exports[actor_index]
)
.expect("Corrupted memory");

actor_export
.struct_export
.loaded_properties
.push(fprop.into());

let mut component_gen_variable = gen_variable.clone();
let component_gen_variable_base_export = component_gen_variable.get_base_export_mut();
Expand Down
4 changes: 3 additions & 1 deletion astro_mod_integrator/src/handlers/mission_trailheads.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![allow(clippy::io_other_error)]

use std::fs::File;
use std::io::{self, BufReader, ErrorKind};
use std::path::Path;
Expand Down Expand Up @@ -35,7 +37,7 @@ pub(crate) fn handle_mission_trailheads(
game_paks,
mod_paks,
&String::from(map_path),
EngineVersion::VER_UE4_23,
EngineVersion::VER_UE4_27,
)?;

let mut trailheads = Vec::new();
Expand Down
2 changes: 2 additions & 0 deletions astro_mod_integrator/src/handlers/mod.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![allow(clippy::io_other_error)]

use lazy_static::lazy_static;
use regex::Regex;

Expand Down
8 changes: 4 additions & 4 deletions astro_mod_integrator/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::collections::HashMap;
use lazy_static::lazy_static;

use unreal_mod_manager::unreal_asset::engine_version::EngineVersion;
use unreal_mod_manager::unreal_helpers::game_to_absolute;
//use unreal_mod_manager::unreal_helpers::game_to_absolute;
use unreal_mod_manager::unreal_mod_integrator::{
BakedMod, Error, HandlerFn, IntegratorConfig, IntegratorMod,
};
Expand All @@ -20,7 +20,7 @@ pub struct AstroIntegratorConfig;

lazy_static! {
static ref FILE_REFS: HashMap<String, &'static [u8]> = HashMap::from([
(
/*(
game_to_absolute(
AstroIntegratorConfig::GAME_NAME,
"/Game/Integrator/NotificationActor.uasset"
Expand All @@ -35,7 +35,7 @@ lazy_static! {
)
.unwrap(),
assets::ALERT_MOD_NOTIFICATION_ACTOR_EXPORT
),
),*/
]);
}

Expand Down Expand Up @@ -84,5 +84,5 @@ impl<'data> IntegratorConfig<'data, (), Error> for AstroIntegratorConfig {

const GAME_NAME: &'static str = "Astro";
const INTEGRATOR_VERSION: &'static str = env!("CARGO_PKG_VERSION");
const ENGINE_VERSION: EngineVersion = EngineVersion::VER_UE4_23;
const ENGINE_VERSION: EngineVersion = EngineVersion::VER_UE4_27;
}
1 change: 1 addition & 0 deletions astro_modloader/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ where
Box::new(MsStoreInstallManager::new(
"SystemEraSoftworks",
"ASTRONEER",
"AppSystemEraSoftworks29415440E1269Shipping",
"Astro",
)),
);
Expand Down
Loading