Skip to content

Commit

Permalink
Add source file reference after import resources
Browse files Browse the repository at this point in the history
Supported resource types:

- Battle Animation
- Battle BG
- BG
- CG
- Item Icon
- Custom Magic Animation
- Vanilla Magic Animation
- Map Action Animation
- Portrait
- Class Card
- Moving Map Sprite
- Standing Map Sprite
- Chapter Map
- World Map
- Song
  • Loading branch information
laqieer committed Sep 8, 2024
1 parent efdd200 commit a8df85b
Show file tree
Hide file tree
Showing 39 changed files with 3,941 additions and 2,849 deletions.
16 changes: 16 additions & 0 deletions FEBuilderGBA/EtcCacheResource.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;

Expand Down Expand Up @@ -80,6 +81,21 @@ public string ListAll(int sortKey = 0, bool reversed = false, string filter = ""
return sb.ToString();
}

public bool CheckFast(string name)
{
return this.Resource.ContainsKey(name);
}

public string At(string name, string def = "")
{
string str;
if (this.Resource.TryGetValue(name, out str))
{
return str;
}
return def;
}

public bool TryGetValue(string name, out string out_data)
{
return Resource.TryGetValue(name, out out_data);
Expand Down
222 changes: 116 additions & 106 deletions FEBuilderGBA/ImageBGForm.Designer.cs

Large diffs are not rendered by default.

51 changes: 51 additions & 0 deletions FEBuilderGBA/ImageBGForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using System.Text;
using System.Windows.Forms;
using System.IO;
using static FEBuilderGBA.EmulatorMemoryUtil;

namespace FEBuilderGBA
{
Expand Down Expand Up @@ -77,6 +78,18 @@ private void AddressList_SelectedIndexChanged(object sender, EventArgs e)
UpdateRef((uint)this.AddressList.SelectedIndex);

ShowWarningMessage();

string filename = Program.ResourceCache.At("BG_" + U.ToHexString(this.AddressList.SelectedIndex), "");
if (filename.Length > 0 && File.Exists(filename))
{
this.OpenSourceButton.Show();
this.SelectSourceButton.Show();
}
else
{
this.OpenSourceButton.Hide();
this.SelectSourceButton.Hide();
}
}

public static string GetComment(uint id)
Expand Down Expand Up @@ -254,6 +267,9 @@ private void ImportButton_Click(object sender, EventArgs e)
this.WriteButton.PerformClick();

Program.ResourceCache.Update("BG_" + U.ToHexString(this.AddressList.SelectedIndex), bitmap.Tag.ToString());
this.OpenSourceButton.Show();
this.SelectSourceButton.Show();

}

//全データの取得
Expand Down Expand Up @@ -467,5 +483,40 @@ bool CheckDangerUpdate()
return true;

}

private void OpenSourceButton_Click(object sender, EventArgs e)
{
string filename = "";
if (Program.ResourceCache.TryGetValue("BG_" + U.ToHexString(this.AddressList.SelectedIndex), out filename))
{
if (!U.CanReadFileRetry(filename))
{
return;
}
U.OpenURLOrFile(filename);
}
else
{
R.ShowStopError("ソースファイルが記録されません");
}
}

private void SelectSourceButton_Click(object sender, EventArgs e)
{
string filename = "";
if (Program.ResourceCache.TryGetValue("BG_" + U.ToHexString(this.AddressList.SelectedIndex), out filename))
{
if (!File.Exists(filename))
{
R.ShowStopError("ファイルが見つかりません");
return;
}
U.SelectFileByExplorer(filename);
}
else
{
R.ShowStopError("ソースファイルが記録されません");
}
}
}
}
Loading

1 comment on commit a8df85b

@laqieer
Copy link
Owner Author

@laqieer laqieer commented on a8df85b Sep 8, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

source file reference

Please sign in to comment.