- H3a : version de reference 2026.10.4 (identique au V1.4 publie), mod d'essai LPHairSample (ModSources/, cuisson DLC contre 2026.10.4), pipeline de coiffures compatible plugins. - Activation des modules alignee sur le jeu (module absent = inactif) ; cle .lpmod MODULE_DEFAULT_ENABLED (lp_Revival). - UI15 : entree Mod Manager sur l'ecran titre, retour au menu titre, choix enregistre sans toucher a la derniere sauvegarde (LPTitleModManager, SaveModSelection). Valide en jeu le 2026-10-03 (CHG-101 a CHG-103, ERR-040, ERR-041). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
36 lines
1.5 KiB
C++
36 lines
1.5 KiB
C++
// Portage UE 5.5 - voir LPModSettingsLibrary.h
|
|
|
|
#include "LPModSettingsLibrary.h"
|
|
|
|
#include "GameFramework/SaveGame.h"
|
|
#include "Kismet/GameplayStatics.h"
|
|
#include "LifePlay.h"
|
|
#include "UObject/UnrealType.h"
|
|
|
|
bool ULPModSettingsLibrary::SaveModSelection(UObject* GameInstance)
|
|
{
|
|
static const TCHAR* Slot = TEXT("GameSettings");
|
|
static const FName ModEnabledsName(TEXT("ModEnableds"));
|
|
if (!GameInstance)
|
|
{
|
|
return false;
|
|
}
|
|
if (!UGameplayStatics::DoesSaveGameExist(Slot, 0))
|
|
{
|
|
UE_LOG(LogLifePlay, Display, TEXT("Modules : pas encore de %s.sav, choix enregistre a la premiere sauvegarde"), Slot);
|
|
return false;
|
|
}
|
|
USaveGame* Settings = UGameplayStatics::LoadGameFromSlot(Slot, 0);
|
|
const FArrayProperty* From = CastField<FArrayProperty>(GameInstance->GetClass()->FindPropertyByName(ModEnabledsName));
|
|
const FArrayProperty* To = Settings ? CastField<FArrayProperty>(Settings->GetClass()->FindPropertyByName(ModEnabledsName)) : nullptr;
|
|
if (!From || !To || !From->SameType(To))
|
|
{
|
|
UE_LOG(LogLifePlay, Warning, TEXT("Modules : %s.sav illisible ou sans ModEnableds compatible, choix non enregistre"), Slot);
|
|
return false;
|
|
}
|
|
To->CopyCompleteValue(To->ContainerPtrToValuePtr<void>(Settings), From->ContainerPtrToValuePtr<void>(GameInstance));
|
|
const bool bSaved = UGameplayStatics::SaveGameToSlot(Settings, Slot, 0);
|
|
FScriptArrayHelper Helper(To, To->ContainerPtrToValuePtr<void>(Settings));
|
|
UE_LOG(LogLifePlay, Display, TEXT("Modules : choix (%d module(s)) %s dans %s.sav"), Helper.Num(), bSaved ? TEXT("enregistre") : TEXT("NON enregistre"), Slot);
|
|
return bSaved;
|
|
}
|