seb
seb
SMSatisfactory Modding
Created by seb on 12/11/2024 in #help-developing-mods
Issues with AccessTransformer.ini. Cannot access protected member declared in class
Hey guys, I want to build my first mod in satisfactory. I have created some mods in other games and work as a software engineer. Just for you to assess my skills. I followed the modding tutorial on docs.ficsit.app. First of: The documentation is fantastic. I have learned a lot from this well-structured tutorial. Well done! However, I faced some issues on the c++ modding part. My goal is to hook on some function. For that, I used the source code from InfiniteZoop from @SirDigby {Mod Name} (Thank you!). In particular, I have problems with Hooking on a private/protected method (For now i'm using AFGFactoryBuildingHologram::SetZoopAmount just to try things out.)
DocModModule.cpp
#include "DocModModule.h"
#include "Patching/NativeHookManager.h"
#include "Hologram/FGFactoryBuildingHologram.h"


void FDocModModule::StartupModule() {
UE_LOG(LogDocMod, Verbose, TEXT("Hello World!!!"));

if (!WITH_EDITOR) {
SUBSCRIBE_METHOD(AFGFactoryBuildingHologram::SetZoopAmount, [](auto& scope, AFGFactoryBuildingHologram* self, const FIntVector& Zoop) {
UE_LOG(LogDocMod, Verbose, TEXT("Hello from SUBSCRIBE_METHOD SetZoopAmount!!!"));
scope.Cancel();
});
}
}

void FDocModModule::SetZoopAmount(AFGFactoryBuildingHologram* self, const FIntVector& Zoop){
UE_LOG(LogDocMod, Verbose, TEXT("Hello from FDocModModule::SetZoopAmount!!!"));
}

IMPLEMENT_GAME_MODULE(FDocModModule, DocMod);

DEFINE_LOG_CATEGORY(LogDocMod);
#include "DocModModule.h"
#include "Patching/NativeHookManager.h"
#include "Hologram/FGFactoryBuildingHologram.h"


void FDocModModule::StartupModule() {
UE_LOG(LogDocMod, Verbose, TEXT("Hello World!!!"));

if (!WITH_EDITOR) {
SUBSCRIBE_METHOD(AFGFactoryBuildingHologram::SetZoopAmount, [](auto& scope, AFGFactoryBuildingHologram* self, const FIntVector& Zoop) {
UE_LOG(LogDocMod, Verbose, TEXT("Hello from SUBSCRIBE_METHOD SetZoopAmount!!!"));
scope.Cancel();
});
}
}

void FDocModModule::SetZoopAmount(AFGFactoryBuildingHologram* self, const FIntVector& Zoop){
UE_LOG(LogDocMod, Verbose, TEXT("Hello from FDocModModule::SetZoopAmount!!!"));
}

IMPLEMENT_GAME_MODULE(FDocModModule, DocMod);

DEFINE_LOG_CATEGORY(LogDocMod);
AccessTransformers.ini
[AccessTransformers]
FRIEND=(Class="AFGFactoryBuildingHologram", FriendClass="FDocModModule")
[AccessTransformers]
FRIEND=(Class="AFGFactoryBuildingHologram", FriendClass="FDocModModule")
At compile time, i receive the following error error C2248: 'AFGFactoryBuildingHologram::SetZoopAmount': cannot access protected member declared in class 'AFGFactoryBuildingHologram' Do i need to declare somewhere that the .ini file should be used to hook on some protected method? Without SUBSCRIBE_METHOD I see the log statement from UE_LOG. I hope someone can help me out.
9 replies
SMSatisfactory Modding
Created by seb on 12/11/2024 in #help-using-mods
Issues with AccessTransformer.ini. Cannot access protected member declared in class
Hey guys, I want to build my first mod in satisfactory. I have created some mods in other games and work as a software engineer. Just for you to assess my skills. I followed the modding tutorial on docs.ficsit.app. First of: The documentation is fantastic. I have learned a lot from this well-structured tutorial. Well done! However, I faced some issues on the c++ modding part. My goal is to hook on some function. For that, I used the source code from InfiniteZoop from @SirDigby {Mod Name} (Thank you!). In particular, I have problems with Hooking on a private/protected method (For now i'm using AFGFactoryBuildingHologram::SetZoopAmount just to try things out.)
DocModModule.cpp
#include "DocModModule.h"
#include "Patching/NativeHookManager.h"
#include "Hologram/FGFactoryBuildingHologram.h"


void FDocModModule::StartupModule() {
UE_LOG(LogDocMod, Verbose, TEXT("Hello World!!!"));

if (!WITH_EDITOR) {
SUBSCRIBE_METHOD(AFGFactoryBuildingHologram::SetZoopAmount, [](auto& scope, AFGFactoryBuildingHologram* self, const FIntVector& Zoop) {
UE_LOG(LogDocMod, Verbose, TEXT("Hello from SUBSCRIBE_METHOD SetZoopAmount!!!"));
scope.Cancel();
});
}
}

void FDocModModule::SetZoopAmount(AFGFactoryBuildingHologram* self, const FIntVector& Zoop){
UE_LOG(LogDocMod, Verbose, TEXT("Hello from FDocModModule::SetZoopAmount!!!"));
}

IMPLEMENT_GAME_MODULE(FDocModModule, DocMod);

DEFINE_LOG_CATEGORY(LogDocMod);
#include "DocModModule.h"
#include "Patching/NativeHookManager.h"
#include "Hologram/FGFactoryBuildingHologram.h"


void FDocModModule::StartupModule() {
UE_LOG(LogDocMod, Verbose, TEXT("Hello World!!!"));

if (!WITH_EDITOR) {
SUBSCRIBE_METHOD(AFGFactoryBuildingHologram::SetZoopAmount, [](auto& scope, AFGFactoryBuildingHologram* self, const FIntVector& Zoop) {
UE_LOG(LogDocMod, Verbose, TEXT("Hello from SUBSCRIBE_METHOD SetZoopAmount!!!"));
scope.Cancel();
});
}
}

void FDocModModule::SetZoopAmount(AFGFactoryBuildingHologram* self, const FIntVector& Zoop){
UE_LOG(LogDocMod, Verbose, TEXT("Hello from FDocModModule::SetZoopAmount!!!"));
}

IMPLEMENT_GAME_MODULE(FDocModModule, DocMod);

DEFINE_LOG_CATEGORY(LogDocMod);
AccessTransformer.ini
[AccessTransformers]
FRIEND=(Class="AFGFactoryBuildingHologram", FriendClass="FDocModModule")
[AccessTransformers]
FRIEND=(Class="AFGFactoryBuildingHologram", FriendClass="FDocModModule")
At compile time, i receive the following error error C2248: 'AFGFactoryBuildingHologram::SetZoopAmount': cannot access protected member declared in class 'AFGFactoryBuildingHologram' Do i need to declare somewhere that the .ini file should be used to hook on some protected method? Without SUBSCRIBE_METHOD I see the log statement from UE_LOG. I hope someone can help me out.
5 replies