Skip to content

Commit

Permalink
-Can now edit and Ryuse Y6 Auth Pages
Browse files Browse the repository at this point in the history
-Ryuse Convert Motion Blur 1.0 to Motion Blur 2.0
-Ryuse Convert Motion Blur 2.0 to Motion Blur 1.0
-Ryuse Convert DOF 1.0 to DOF 2.0
-Motion Blur 1.0 Editor
-DOF 1.0 Editor
-Motion Blur 2.0 Bugfix
  • Loading branch information
Fronkln committed Apr 12, 2024
1 parent 5aa42c2 commit 9aba8fa
Show file tree
Hide file tree
Showing 24 changed files with 595 additions and 144 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

namespace HActLib
{
public enum ConditionType : uint
public enum AuthPageConditionsGeneric : uint
{
dmy = 0x0,
random = 0x1,
Expand Down Expand Up @@ -85,5 +85,5 @@ public enum ConditionType : uint
damage_reaction = 0x4A,
has_cd = 0x4B,
equip_armor = 0x4C,
};
}
}
16 changes: 16 additions & 0 deletions Enums/AuthPage/AuthPageConditionsY6.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace HActLib
{
public enum AuthPageConditionsY6 : uint
{
dmy = 0,
page_end = 9,
hact_condition_flag = 17,
page_play_count = 27,
}
}
12 changes: 9 additions & 3 deletions Projects/CMNEdit/TreeViewItemCondition.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ public TreeViewItemCondition(Transition trans, Condition cond) : base()

public string GetName()
{
switch((ConditionType)Condition.ConditionID)
switch(ConditionConvert.GetName(Condition.ConditionID, Form1.curGame))
{
case ConditionType.hact_condition_flag:
case "hact_condition_flag":
ConditionHActFlag flag = Condition as ConditionHActFlag;

if (flag.ConditionFlagOn == 1 && flag.ConditionFlagOff == 0)
Expand All @@ -33,7 +33,13 @@ public string GetName()
break;
}

return Thread.CurrentThread.CurrentCulture.TextInfo.ToTitleCase(((ConditionType)Condition.ConditionID).ToString().Replace("_", " "));

string name = ConditionConvert.GetName(Condition.ConditionID, Form1.curGame);

if (string.IsNullOrEmpty(name))
name = "Condition " + Condition.ConditionID.ToString();

return Thread.CurrentThread.CurrentCulture.TextInfo.ToTitleCase(name).ToString().Replace("_", " ");
}
}
}
9 changes: 5 additions & 4 deletions Projects/CMNEdit/TreeViewItemPage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,13 @@

namespace CMNEdit
{
public class TreeViewItemPage: TreeNode
public class TreeViewItemPage : TreeNode
{
public AuthPage Page;

public TreeViewItemPage(AuthPage page) : base()
{
Page = page;
Text = page.PageTitleText + $" ({page.PageIndex})";

Update();

foreach (Transition transition in page.Transitions)
Expand All @@ -23,7 +21,10 @@ public TreeViewItemPage(AuthPage page) : base()

public void Update()
{
Text = Page.PageTitleText + $" ({Page.PageIndex})";
if(Page.Format > 0)
Text = Page.PageTitleText + $" ({Page.PageIndex})";
else
Text = Page.PageTitleText;
}
}
}
48 changes: 48 additions & 0 deletions Projects/CMNEdit/Windows/Common/DE/DEElementDOFWindow.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using HActLib;

namespace CMNEdit.Windows
{
internal static class DEElementDOFWindow
{
public static void Draw(Form1 form, Node element)
{
DEElementDOF dof = element as DEElementDOF;

form.CreateHeader("DOF");
form.CreateInput("Disable", Convert.ToInt32(dof.DisableDof).ToString(), delegate (string val) { dof.DisableDof = int.Parse(val) > 0; });
form.CreateInput("Use Intr", Convert.ToInt32(dof.UseIntr).ToString(), delegate (string val) { dof.UseIntr = int.Parse(val) > 0; });

form.CreateInput("Shape", dof.Shape.ToString(), delegate (string val) { dof.Shape = int.Parse(val); }, NumberBox.NumberMode.Int);
form.CreateInput("Diapharagm Blades", dof.DiaphragmBladesNum.ToString(), delegate (string val) { dof.DiaphragmBladesNum = int.Parse(val); }, NumberBox.NumberMode.Int);
form.CreateInput("Aperture Circularity", dof.ApertureCircularity.ToString(), delegate (string val) { dof.ApertureCircularity = Utils.InvariantParse(val); }, NumberBox.NumberMode.Float);

form.CreateInput("Focus Dist Before", dof.FocusDistBefore.ToString(), delegate (string val) { dof.FocusDistBefore = Utils.InvariantParse(val); }, NumberBox.NumberMode.Float);
form.CreateInput("Focus Dist After", dof.FocusDistAfter.ToString(), delegate (string val) { dof.FocusDistAfter = Utils.InvariantParse(val); }, NumberBox.NumberMode.Float);

form.CreateInput("Edge Type", Convert.ToInt32(dof.EdgeType).ToString(), delegate (string val) { dof.EdgeType = int.Parse(val); }, NumberBox.NumberMode.Int);
form.CreateInput("Focus Threshold", dof.EdgeThreshold.ToString(), delegate (string val) { dof.EdgeThreshold = Utils.InvariantParse(val); }, NumberBox.NumberMode.Float);

form.CreateInput("Quality", Convert.ToInt32(dof.Quality).ToString(), delegate (string val) { dof.Quality = int.Parse(val); }, NumberBox.NumberMode.Int);
form.CreateInput("Focus Local Pos", Convert.ToInt32(dof.FocusLocalPos).ToString(), delegate (string val) { dof.FocusLocalPos = int.Parse(val); }, NumberBox.NumberMode.Int);

form.CreateInput("Alpha To Coverage Depth Threshold", dof.AlphaToCoverageDepthThreshold.ToString(), delegate (string val) { dof.AlphaToCoverageDepthThreshold = Utils.InvariantParse(val); }, NumberBox.NumberMode.Float);

form.CreateInput("Lens Type", dof.LensType.ToString(), delegate (string val) { dof.LensType = int.Parse(val); }, NumberBox.NumberMode.Int);

form.CreateInput("Aberration", dof.Aberration.ToString(), delegate (string val) { dof.Aberration = Utils.InvariantParse(val); }, NumberBox.NumberMode.Float);
form.CreateInput("Aberration FOV", dof.AberrationFOV.ToString(), delegate (string val) { dof.AberrationFOV = Utils.InvariantParse(val); }, NumberBox.NumberMode.Float);

form.CreateInput("Gradient Threshold", dof.GradientThreshold.ToString(), delegate (string val) { dof.GradientThreshold = Utils.InvariantParse(val); }, NumberBox.NumberMode.Float);
form.CreateInput("Gradient Min Threshold", dof.GradientMinThreshold.ToString(), delegate (string val) { dof.GradientMinThreshold = Utils.InvariantParse(val); }, NumberBox.NumberMode.Float);
form.CreateInput("Gradient Max Threshold", dof.GradientMaxThreshold.ToString(), delegate (string val) { dof.GradientMaxThreshold = Utils.InvariantParse(val); }, NumberBox.NumberMode.Float);

form.CreateInput("Near Focus Distance", dof.NearFocusDistance.ToString(), delegate (string val) { dof.NearFocusDistance = int.Parse(val); }, NumberBox.NumberMode.Int);
form.CreateInput("DOF After Disable Dist", dof.DOFAfterDisableDist.ToString(), delegate (string val) { dof.DOFAfterDisableDist = Utils.InvariantParse(val); }, NumberBox.NumberMode.Float);
}
}
}
27 changes: 27 additions & 0 deletions Projects/CMNEdit/Windows/Common/DE/DEElementMotionBlurWindow.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using HActLib;

namespace CMNEdit
{
internal static class DEElementMotionBlurWindow
{
public static void Draw(Form1 form, Node node)
{
DEElementMotionBlur mb = node as DEElementMotionBlur;

form.CreateHeader("Motion Blur");
form.CreateInput("Shutter Speed", mb.ShutterSpeed.ToString(), delegate (string val) { mb.ShutterSpeed = Utils.InvariantParse(val); }, NumberBox.NumberMode.Float);
form.CreateInput("Blur Length", mb.BlurLength.ToString(), delegate (string val) { mb.BlurLength = Utils.InvariantParse(val); }, NumberBox.NumberMode.Float);
form.CreateInput("Sampling Interleave", mb.SamplingInterleave.ToString(), delegate (string val) { mb.SamplingInterleave = Utils.InvariantParse(val); }, NumberBox.NumberMode.Float);
form.CreateInput("Falloff Start Distance", mb.FalloffStartDist.ToString(), delegate (string val) { mb.FalloffStartDist = Utils.InvariantParse(val); }, NumberBox.NumberMode.Float);
form.CreateInput("Falloff End Distance", mb.FalloffEndDist.ToString(), delegate (string val) { mb.FalloffStartDist = Utils.InvariantParse(val); }, NumberBox.NumberMode.Float);
form.CreateInput("Rotation Perspective Threshold", mb.RotationPerspectiveThreshold.ToString(), delegate (string val) { mb.RotationPerspectiveThreshold = Utils.InvariantParse(val); }, NumberBox.NumberMode.Float);
form.CreateInput("Trans Threshold", mb.TransThreshold.ToString(), delegate (string val) { mb.TransThreshold = Utils.InvariantParse(val); }, NumberBox.NumberMode.Float);

}
}
}
10 changes: 5 additions & 5 deletions Projects/CMNEdit/Windows/ConditionWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ public static void Draw(Pager form, TreeViewItemCondition cond)
{
form.CreateHeader("Condition Information");

switch((ConditionType)cond.Condition.ConditionID)
switch(ConditionConvert.GetName(cond.Condition.ConditionID, Form1.curGame))
{
case ConditionType.enemy_num:
case "enemy_num":
ConditionEnemyNum enemyCountCond = cond.Condition as ConditionEnemyNum;


Expand Down Expand Up @@ -42,7 +42,7 @@ public static void Draw(Pager form, TreeViewItemCondition cond)
}, NumberBox.NumberMode.Int);
break;

case ConditionType.page_play_count:
case "page_play_count":
ConditionPagePlayCount playCountCond = cond.Condition as ConditionPagePlayCount;


Expand All @@ -54,7 +54,7 @@ public static void Draw(Pager form, TreeViewItemCondition cond)
break;


case ConditionType.hact_condition_flag:
case "hact_condition_flag":

ConditionHActFlag condHAct = cond.Condition as ConditionHActFlag;

Expand All @@ -72,7 +72,7 @@ public static void Draw(Pager form, TreeViewItemCondition cond)

break;

case ConditionType.program_param:
case "program_param":

ConditionProgramParam condprog = cond.Condition as ConditionProgramParam;

Expand Down
30 changes: 28 additions & 2 deletions Projects/CMNEdit/Windows/Form1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1713,9 +1713,15 @@ public void DrawElementWindow(NodeElement element)
case "e_auth_element_post_effect_gradation":
DEElementGradationWindow.Draw(this, element);
break;
case "e_auth_element_post_effect_dof":
DEElementDOFWindow.Draw(this, element);
break;
case "e_auth_element_post_effect_dof2":
DEElementDOF2Window.Draw(this, element);
break;
case "e_auth_element_post_effect_motion_blur":
DEElementMotionBlurWindow.Draw(this, element);
break;
case "e_auth_element_post_effect_motion_blur2":
DEElementMotionBlur2Window.Draw(this, element);
break;
Expand Down Expand Up @@ -2805,10 +2811,30 @@ private void convertBetweenGamesDEToolStripMenuItem_Click(object sender, EventAr
nodes = genHact.GetNodes();


foreach (AuthPage page in AuthPagesDE)
for(int i = 0; i < AuthPagesDE.Length; i++)
{
page.IsOldDE = targetVer <= GameVersion.DE1;
AuthPage page = AuthPagesDE[i];

//Convert between old and new formats
if ((page.Format == 0 && targetVer > GameVersion.Yakuza6) || (page.Format > 0 && targetVer <= GameVersion.Yakuza6))
{
page.PageIndex = i;

foreach (Transition transition in page.Transitions)
foreach (Condition condition in transition.Conditions)
{
string name = ConditionConvert.GetName(condition.ConditionID, curGame);
uint newID = ConditionConvert.GetID(name, prefixGame);
condition.ConditionID = newID;
}
}

if (targetVer <= GameVersion.Yakuza6)
page.Format = 0;
else if (targetVer == GameVersion.DE1)
page.Format = 1;
else
page.Format = 2;

if (page.IsTalkPage())
{
Expand Down
4 changes: 3 additions & 1 deletion Projects/CMNEdit/Windows/PageWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ public static void Draw(Pager form, TreeViewItemPage page)
{
form.CreateHeader("Page Info");

form.CreateInput("Name", page.Page.PageTitleText, delegate (string newVal) { page.Page.PageTitleText = newVal; page.Update(); });
if(page.Page.Format > 1)
form.CreateInput("Name", page.Page.PageTitleText, delegate (string newVal) { page.Page.PageTitleText = newVal; page.Update(); });

form.CreateInput("Flag", page.Page.Flag.ToString(), delegate (string newVal) { page.Page.Flag = uint.Parse(newVal); page.Update(); }, NumberBox.NumberMode.UInt);

form.CreateInput("Start", page.Page.Start.Frame.ToString(), delegate (string newVal) { page.Page.Start.Frame = Utils.InvariantParse(newVal); }, NumberBox.NumberMode.Float);
Expand Down
26 changes: 18 additions & 8 deletions Types/Converter/DE/RyuseModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -151,14 +151,6 @@ public static ConversionResult ConvertNode(Node node, Game inputGame, Game outpu
}
else
{
if (!element.TryConvert(inputGame, outputGame))
{
element.ElementKind = 0;
element.Name += " (invalid)";

return ConversionResult.Fail;
}

element.ElementKind = outputID;
element.BEPDat.PropertyType = (ushort)outputID;

Expand All @@ -169,6 +161,24 @@ public static ConversionResult ConvertNode(Node node, Game inputGame, Game outpu
}
else
{
NodeElement convertedNode = node.TryConvert(inputGame, outputGame) as NodeElement;

if (convertedNode != null)
{
Node.CopyBaseInfo(node, convertedNode);
Node.CopyBaseElementInfo(element, convertedNode);

if (node.Parent != null)
{
int origIdx = node.Parent.Children.IndexOf(node);
node.Parent.Children.Remove(node);
node.Parent.Children.Insert(origIdx, convertedNode);
convertedNode.Parent = node.Parent;
node.Parent = null;
}
return ConversionResult.Success;
}

element.ElementKind = 0;
element.Name += " (invalid)";

Expand Down
12 changes: 6 additions & 6 deletions Types/Converter/OE/OEToDECmn.cs
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,8 @@ NodeElement GetNearestEndNodeInRange(float start)
else
{
successPage.End.Frame = branchNodes.ElementAt(i + 1).Start - 1;
successPage.Transitions.Add(new Transition(pageIdx + 2, new ConditionHActFlag(1, 0), new ConditionPageEnd()));
successPage.Transitions.Add(new Transition(pageIdx + 3, new ConditionHActFlag(0, 1), new ConditionPageEnd()));
successPage.Transitions.Add(new Transition(pageIdx + 2, new ConditionHActFlag(CMN.LastHActDEGame, 1, 0), new ConditionPageEnd(CMN.LastHActDEGame)));
successPage.Transitions.Add(new Transition(pageIdx + 3, new ConditionHActFlag(CMN.LastHActDEGame, 0, 1), new ConditionPageEnd(CMN.LastHActDEGame)));
}

if (failEnd != null)
Expand All @@ -238,12 +238,12 @@ NodeElement GetNearestEndNodeInRange(float start)
}


startPage.Transitions.Add(new Transition(1, new ConditionPageEnd()));
startPage.Transitions.Add(new Transition(1, new ConditionPageEnd(CMN.LastHActDEGame)));

AuthPage promptPage = new AuthPage("PROMPT START", buttonNodes.ElementAt(0).Start, branchNodes.ElementAt(0).Start - 1);
promptPage.PageIndex = 1;
promptPage.Transitions.Add(new Transition(2, new ConditionHActFlag(1, 0), new ConditionPageEnd()));
promptPage.Transitions.Add(new Transition(3, new ConditionHActFlag(0, 1), new ConditionPageEnd()));
promptPage.Transitions.Add(new Transition(2, new ConditionHActFlag(CMN.LastHActDEGame, 1, 0), new ConditionPageEnd(CMN.LastHActDEGame)));
promptPage.Transitions.Add(new Transition(3, new ConditionHActFlag(CMN.LastHActDEGame, 0, 1), new ConditionPageEnd(CMN.LastHActDEGame)));

pages.Insert(1, promptPage);

Expand All @@ -252,7 +252,7 @@ NodeElement GetNearestEndNodeInRange(float start)
{
if (page.Transitions.Count <= 0)
{
page.Transitions.Add(new Transition(-1, new ConditionPageEnd()));
page.Transitions.Add(new Transition(-1, new ConditionPageEnd(CMN.LastHActDEGame)));
}
}

Expand Down
2 changes: 2 additions & 0 deletions Types/Converter/OE/RyuseOEModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -157,13 +157,15 @@ public static ConversionResult ConvertNode(Node node, Node parent, Game inputGam
return ConversionResult.NoChange;
else
{
/*
if(!element.TryConvert(inputGame, outputGame))
{
element.ElementKind = 0;
element.Name += " (invalid)";
return ConversionResult.Fail;
}
*/

element.ElementKind = outputID;
element.BEPDat.PropertyType = (ushort)outputID;
Expand Down
10 changes: 5 additions & 5 deletions Types/Converter/OOE/OOEToDE.cs
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,8 @@ Set2Element1019 GetNearestEndNodeInRange(float start)
else
{
successPage.End.Frame = branchNodes.ElementAt(i + 1).Start - 1;
successPage.Transitions.Add(new Transition(pageIdx + 2, new ConditionHActFlag(1, 0), new ConditionPageEnd()));
successPage.Transitions.Add(new Transition(pageIdx + 3, new ConditionHActFlag(0, 1), new ConditionPageEnd()));
successPage.Transitions.Add(new Transition(pageIdx + 2, new ConditionHActFlag(CMN.LastHActDEGame, 1, 0), new ConditionPageEnd(CMN.LastHActDEGame)));
successPage.Transitions.Add(new Transition(pageIdx + 3, new ConditionHActFlag(CMN.LastHActDEGame, 0, 1), new ConditionPageEnd(CMN.LastHActDEGame)));
}

if (failEnd != null)
Expand All @@ -192,12 +192,12 @@ Set2Element1019 GetNearestEndNodeInRange(float start)
}


startPage.Transitions.Add(new Transition(1, new ConditionPageEnd()));
startPage.Transitions.Add(new Transition(1, new ConditionPageEnd(CMN.LastHActDEGame)));

AuthPage promptPage = new AuthPage("PROMPT START", buttonNodes.ElementAt(0).Start, branchNodes.ElementAt(0).Start - 1);
promptPage.PageIndex = 1;
promptPage.Transitions.Add(new Transition(2, new ConditionHActFlag(1, 0), new ConditionPageEnd()));
promptPage.Transitions.Add(new Transition(3, new ConditionHActFlag(0, 1), new ConditionPageEnd()));
promptPage.Transitions.Add(new Transition(2, new ConditionHActFlag(CMN.LastHActDEGame, 1, 0), new ConditionPageEnd(CMN.LastHActDEGame)));
promptPage.Transitions.Add(new Transition(3, new ConditionHActFlag(CMN.LastHActDEGame, 0, 1), new ConditionPageEnd(CMN.LastHActDEGame)));

pages.Insert(1, promptPage);

Expand Down
Loading

0 comments on commit 9aba8fa

Please sign in to comment.