Skip to content

Commit

Permalink
Merge branch 'mod' into tsumi-mod
Browse files Browse the repository at this point in the history
  • Loading branch information
drojf committed Sep 10, 2024
2 parents e4a8cfb + 9c14c49 commit cb42c6d
Show file tree
Hide file tree
Showing 8 changed files with 69 additions and 31 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/build_dll.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,8 @@ jobs:
uses: actions/checkout@v3

# Note: This uses the mono bundled with Ubuntu to build the project
- name: Compile project
- name: Compile Mod DLL
run: msbuild /p:Configuration=Release

- name: Compile standalone Higurashi Script Compiler
run: msbuild /p:Configuration=ScriptCompiler
19 changes: 14 additions & 5 deletions Assembly-CSharp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,6 @@
<Reference Include="Antlr3.Runtime">
<HintPath>DLLs\Antlr3.Runtime.dll</HintPath>
</Reference>
<Reference Include="System.Xml">
<HintPath>DLLs\System.Xml.dll</HintPath>
</Reference>
<Compile Include="MOD.Scripts.Core\MODXMLWrapper.cs" />
<Compile Include="MOD.Scripts.AssetManager\MODAssetManager.cs" />
<Compile Include="System.Runtime.Serialization\DataContractAttribute.cs" />
Expand Down Expand Up @@ -67,6 +64,9 @@
<AssemblyName>Assembly-CSharp</AssemblyName>
</PropertyGroup>
<ItemGroup Condition="'$(Configuration)' != 'ScriptCompiler'">
<Reference Include="System.Xml">
<HintPath>DLLs\System.Xml.dll</HintPath>
</Reference>
<Reference Include="UnityEngine">
<HintPath>DLLs\UnityEngine.dll</HintPath>
</Reference>
Expand Down Expand Up @@ -660,8 +660,17 @@
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
</PropertyGroup>
<ItemGroup Condition="'$(Configuration)' == 'ScriptCompiler'">
<!-- Insert DLL or .cs files specific to standalone script compiler here -->

<!-- On Windows, I get a strong name validation error when trying to use the DLL that's meant to be used with Unity, so instead use the system's XML -->
<ItemGroup Condition="'$(Configuration)' == 'ScriptCompiler' And '$(OS)' == 'Windows_NT'">
<Reference Include="System.Xml"/>
</ItemGroup>

<!-- On Mono, I get an error because what I want to use is not supported on this platform. However Unix/Mono doesn't check strong name validation, so we can use the normal XML dll -->
<ItemGroup Condition="'$(Configuration)' == 'ScriptCompiler' And '$(OS)' != 'Windows_NT'">
<Reference Include="System.Xml">
<HintPath>DLLs\System.Xml.dll</HintPath>
</Reference>
</ItemGroup>
<!-- End standalone script compiler items -->

Expand Down
36 changes: 27 additions & 9 deletions Assets.Scripts.Core.AssetManagement/AssetManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ private bool CheckStreamingAssetsPathExists(string subFolder, string relativePat
/// Gets the path to an asset with the given name in the given artset, or null if none are found
/// </summary>
/// <returns>A path to an on-disk asset or null</returns>
public string PathToAssetWithName(string name, PathCascadeList artset)
private string PathToAssetWithName(string name, PathCascadeList artset, out string subFolderUsed)
{
int backgroundSetIndex = BurikoMemory.Instance.GetGlobalFlag("GBackgroundSet").IntValue();

Expand All @@ -232,6 +232,7 @@ public string PathToAssetWithName(string name, PathCascadeList artset)
{
if(CheckStreamingAssetsPathExists("OGBackgrounds", name, out string filePath))
{
subFolderUsed = "OGBackgrounds";
return filePath;
}
}
Expand All @@ -246,10 +247,12 @@ public string PathToAssetWithName(string name, PathCascadeList artset)

if (CheckStreamingAssetsPathExists(artSetPath, name, out string filePath))
{
subFolderUsed = artSetPath;
return filePath;
}
}

subFolderUsed = null;
return null;
}

Expand Down Expand Up @@ -461,25 +464,40 @@ public Texture2D LoadTexture(string textureName)
return LoadTexture(textureName, out _);
}

public Texture2D LoadTexture(string textureName, out string texturePath)
public string PathToAssetFromTextureNameNoExt(string textureNameNoExt) => PathToAssetFromTextureNameNoExt(textureNameNoExt, out _);

/// <summary>
/// Given the name of a texture (like "white" or "sprite/re2a_okoru_a1_0"), returns the path to the texture like
/// "D:/games/steam/steamapps/common/Higurashi When They Cry Hou - Ch.6 Tsumihoroboshi/HigurashiEp06_Data/StreamingAssets\CG\white.png")
/// The current language and current artset will determine which file extension/which subfolder the image will be taken from.
/// </summary>
public string PathToAssetFromTextureNameNoExt(string textureNameNoExt, out string subFolderUsed)
{
if (textureName == "windo_filter" && windowTexture != null)
{
texturePath = windowTexturePath;
return windowTexture;
}
string path = null;
subFolderUsed = null;

// Load path from current artset
if (path == null && !GameSystem.Instance.UseEnglishText)
{
path = PathToAssetWithName(textureName.ToLower() + "_j.png", CurrentArtset);
path = PathToAssetWithName(textureNameNoExt.ToLower() + "_j.png", CurrentArtset, out subFolderUsed);
}

if (path == null)
{
path = PathToAssetWithName(textureName.ToLower() + ".png", CurrentArtset);
path = PathToAssetWithName(textureNameNoExt.ToLower() + ".png", CurrentArtset,out subFolderUsed);
}

return path;
}

public Texture2D LoadTexture(string textureName, out string texturePath)
{
if (textureName == "windo_filter" && windowTexture != null)
{
texturePath = windowTexturePath;
return windowTexture;
}
string path = PathToAssetFromTextureNameNoExt(textureName);

if (path == null)
{
Expand Down
12 changes: 10 additions & 2 deletions Assets.Scripts.Core.Scene/SceneController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1150,9 +1150,17 @@ public void MODLipSyncStart(int character, int audiolayer, string audiofile, Aud
StartCoroutine(MODLipSyncCoroutine);
}

private bool MODSkipImage(string backgroundfilename)
private bool MODSkipImage(string textureName)
{
if(Buriko.BurikoMemory.Instance.GetGlobalFlag("GHideCG").IntValue() == 1 && backgroundfilename.Contains("scene/"))
// We only want to skip Console CGs (in the "CG" folder), so ignore images not in the "CG" folder.
AssetManager.Instance.PathToAssetFromTextureNameNoExt(textureName, out string subFolderUsed);
if (subFolderUsed == null || subFolderUsed != "CG")
{
return false;
}

// In the game script, Console CG names always start with "scene/" folder, like "scene/303c"
if (Buriko.BurikoMemory.Instance.GetGlobalFlag("GHideCG").IntValue() == 1 && textureName.StartsWith("scene/"))
{
return true;
}
Expand Down
2 changes: 1 addition & 1 deletion BGICompiler.Compiler/LoggerWrapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public static void LogException(Exception exception)

private static void print(string level, object message)
{
Console.WriteLine($"[{level}] {message}", message);
Console.WriteLine($"[{level}] {message}");
}
#else
public static void Log(object message)
Expand Down
10 changes: 5 additions & 5 deletions MOD.Scripts.Core/MODLocalizationData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,11 @@ public partial class Loc
public static string MODMenuNormal_27 => Get("MODMenuNormal_27", "Enables opening videos\n\nNOTE: Once the opening video plays the first time, will automatically switch to 'Launch + In-Game'\n\nWe have setup openings this way to avoid spoilers.");
public static string MODMenuNormal_28 => Get("MODMenuNormal_28", "Launch + In-Game");
public static string MODMenuNormal_29 => Get("MODMenuNormal_29", "WARNING: There is usually no need to set this manually.\n\nIf openings are enabled, the first time you reach an opening while playing the game, this flag will be set automatically\n\nThat is, after the opening is played the first time, from then on openings will play every time the game launches");
public static string MODMenuNormal_30 => Get("MODMenuNormal_30", "Show/Hide CGs");
public static string MODMenuNormal_31 => Get("MODMenuNormal_31", "Show CGs");
public static string MODMenuNormal_32 => Get("MODMenuNormal_32", "Shows CGs (You probably want this enabled for Console ADV/NVL mode)");
public static string MODMenuNormal_33 => Get("MODMenuNormal_33", "Hide CGs");
public static string MODMenuNormal_34 => Get("MODMenuNormal_34", "Disables all CGs (mainly for use with the Original/Ryukishi preset)");
public static string MODMenuNormal_30 => Get("MODMenuNormal_30", "Console CGs");
public static string MODMenuNormal_31 => Get("MODMenuNormal_31", "Show Console CGs");
public static string MODMenuNormal_32 => Get("MODMenuNormal_32", "Shows Console CGs (You want this enabled for Console ADV/NVL mode)\n\nDoes not impact Mangagamer or OG CGs.");
public static string MODMenuNormal_33 => Get("MODMenuNormal_33", "Hide Console CGs");
public static string MODMenuNormal_34 => Get("MODMenuNormal_34", "Disables Console CGs (for use with the Original/Ryukishi preset)\n\nDoes not impact Mangagamer or OG CGs.");
public static string MODMenuNormal_35 => Get("MODMenuNormal_35", "Background Style");
public static string MODMenuNormal_36 => Get("MODMenuNormal_36", "Console BGs");
public static string MODMenuNormal_37 => Get("MODMenuNormal_37", "Use Console backgrounds");
Expand Down
6 changes: 3 additions & 3 deletions MOD.Scripts.UI/MODMenuNormal.cs
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,10 @@ public MODMenuNormal(MODMenu modMenu, MODMenuAudioOptions audioOptionsMenu)
new GUIContent(Loc.MODMenuNormal_28, Loc.MODMenuNormal_29), //Launch + In-Game | WARNING: There is usually no need to set this manually.\n\nIf openings are enabled, the first time you reach an opening while playing the game, this flag will be set automatically\n\nThat is, after the opening is played the first time, from then on openings will play every time the game launches
});

radioHideCG = new MODRadio(Loc.MODMenuNormal_30, new GUIContent[] //Show/Hide CGs
radioHideCG = new MODRadio(Loc.MODMenuNormal_30, new GUIContent[] //Console CGs
{
new GUIContent(Loc.MODMenuNormal_31, Loc.MODMenuNormal_32), //Show CGs | Shows CGs (You probably want this enabled for Console ADV/NVL mode)
new GUIContent(Loc.MODMenuNormal_33, Loc.MODMenuNormal_34), //Hide CGs | Disables all CGs (mainly for use with the Original/Ryukishi preset)
new GUIContent(Loc.MODMenuNormal_31, Loc.MODMenuNormal_32), //Show Console CGs | Shows Console CGs (You want this enabled for Console ADV/NVL mode)\n\nDoes not impact Mangagamer or OG CGs.
new GUIContent(Loc.MODMenuNormal_33, Loc.MODMenuNormal_34), //Hide Console CGs | Disables Console CGs (for use with the Original/Ryukishi preset)\n\nDoes not impact Mangagamer or OG CGs.
});

radioBackgrounds = new MODRadio(Loc.MODMenuNormal_35, new GUIContent[]{ //Background Style
Expand Down
10 changes: 5 additions & 5 deletions tools/localization.json
Original file line number Diff line number Diff line change
Expand Up @@ -163,19 +163,19 @@
"text": "WARNING: There is usually no need to set this manually.\n\nIf openings are enabled, the first time you reach an opening while playing the game, this flag will be set automatically\n\nThat is, after the opening is played the first time, from then on openings will play every time the game launches"
},
"MODMenuNormal_30": {
"text": "Show/Hide CGs"
"text": "Console CGs"
},
"MODMenuNormal_31": {
"text": "Show CGs"
"text": "Show Console CGs"
},
"MODMenuNormal_32": {
"text": "Shows CGs (You probably want this enabled for Console ADV/NVL mode)"
"text": "Shows Console CGs (You want this enabled for Console ADV/NVL mode)\n\nDoes not impact Mangagamer or OG CGs."
},
"MODMenuNormal_33": {
"text": "Hide CGs"
"text": "Hide Console CGs"
},
"MODMenuNormal_34": {
"text": "Disables all CGs (mainly for use with the Original/Ryukishi preset)"
"text": "Disables Console CGs (for use with the Original/Ryukishi preset)\n\nDoes not impact Mangagamer or OG CGs."
},
"MODMenuNormal_35": {
"text": "Background Style"
Expand Down

0 comments on commit cb42c6d

Please sign in to comment.