2

I'm making a mod for Age of Empires 2 DE and my goal is to access an old texture file from the new UI's directory. The file structure is as follows:

C:\Program Files (x86)\Steam\steamapps\common\AoE2DE

is the game folder that contains the exe.

AoE2DE/resources/_common/wpfg

is where app.xaml and ResourceDictionary sources reside.

Now I'm trying to access this image (from a .xaml file under wpfg):

AoE2DE/widgetui/textures/backgrounds/wide_default_background.dds

I tried the following, neither worked. The background didn't load.

<Image Source="/../../../widgetui/textures/backgrounds/wide_default_background.dds" />
<Image Source="pack://siteoforigin:,,,../../../widgetui/textures/backgrounds/wide_default_background.dds" />

I also tried to create a SystemResourcesOldTextures.xaml file under widgetui so that I could simply write

<Image Source="textures/backgrounds/wide_default_background.dds" />

and include this file in app.xaml by adding this line to ResourceDictionary.MergedDictionaries

<ResourceDictionary Source="pack://siteoforigin:,,,../../../widgetui/SystemResourcesOldTextures.xaml" />

Didn't work either.

Putting the absolute path in the Source works but it's not practical as everyone's game path could be different. Copying the resource into wpfg is also not ideal as mod size would increase by a lot.

NOTE:

  • Since this is a game I don't have access to the project file, nor any C# code. I can't build/complie. I can only edit the XAML files and restart the game to verify.
  • I have seen similar questions asked but no answer could yet address my issue. The image I want to access has no project/assembly associated.

1 Answers1

0

You may try this post Not able to reference Image source with relative path in xaml

<Image Source="pack://siteoforigin:,,,/../../../widgetui/textures/backgrounds/wide_default_background.dds" />
  • I saw this post earlier. The 3 answers don't solve my issue. They either require Visual Studio settings, or assume the resource file is associated with some assembly. – Yuren Huang Mar 25 '21 at 06:25