Skip to content

Commit 065fabc

Browse files
author
idealpersona
committed
Add initial pass at mod
1 parent 49d6f48 commit 065fabc

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+6238
-155
lines changed

Assembly-CSharp.csproj

+38
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@
4848
<Reference Include="Assembly-CSharp-firstpass">
4949
<HintPath>DLLs\Assembly-CSharp-firstpass.dll</HintPath>
5050
</Reference>
51+
<Reference Include="UnityEngine.UI">
52+
<HintPath>DLLs\UnityEngine.UI.dll</HintPath>
53+
</Reference>
5154
</ItemGroup>
5255
<ItemGroup>
5356
<Compile Include="ActiveAnimation.cs" />
@@ -218,6 +221,17 @@
218221
<Compile Include="LTRect.cs" />
219222
<Compile Include="LTSpline.cs" />
220223
<Compile Include="MenuUIController.cs" />
224+
<Compile Include="MOD.Scripts.Core.Movie\AVProMovieRenderer.cs" />
225+
<Compile Include="MOD.Scripts.Core.Movie\IMovieRenderer.cs" />
226+
<Compile Include="MOD.Scripts.Core.Movie\MODApplyToMaterial.cs" />
227+
<Compile Include="MOD.Scripts.Core.Movie\MovieInfo.cs" />
228+
<Compile Include="MOD.Scripts.Core.Movie\TextureMovieRenderer.cs" />
229+
<Compile Include="MOD.Scripts.Core.Scene\MODSceneController.cs" />
230+
<Compile Include="MOD.Scripts.Core.Scene\MODTextureController.cs" />
231+
<Compile Include="MOD.Scripts.Core.State\StateMovie.cs" />
232+
<Compile Include="MOD.Scripts.Core.TextWindow\MODTextController.cs" />
233+
<Compile Include="MOD.Scripts.Core\MODSystem.cs" />
234+
<Compile Include="MOD.Scripts.UI\MODMainUIController.cs" />
221235
<Compile Include="Newtonsoft.Json.Bson\BsonArray.cs" />
222236
<Compile Include="Newtonsoft.Json.Bson\BsonBinaryType.cs" />
223237
<Compile Include="Newtonsoft.Json.Bson\BsonBinaryWriter.cs" />
@@ -404,6 +418,30 @@
404418
<Compile Include="Quart.cs" />
405419
<Compile Include="Quint.cs" />
406420
<Compile Include="RealTime.cs" />
421+
<Compile Include="RenderHeads.Media.AVProVideo\AlphaPacking.cs" />
422+
<Compile Include="RenderHeads.Media.AVProVideo\ApplyToMaterial.cs" />
423+
<Compile Include="RenderHeads.Media.AVProVideo\ApplyToMesh.cs" />
424+
<Compile Include="RenderHeads.Media.AVProVideo\AudioOutput.cs" />
425+
<Compile Include="RenderHeads.Media.AVProVideo\BaseMediaPlayer.cs" />
426+
<Compile Include="RenderHeads.Media.AVProVideo\CubemapCube.cs" />
427+
<Compile Include="RenderHeads.Media.AVProVideo\DisplayBackground.cs" />
428+
<Compile Include="RenderHeads.Media.AVProVideo\DisplayIMGUI.cs" />
429+
<Compile Include="RenderHeads.Media.AVProVideo\DisplayUGUI.cs" />
430+
<Compile Include="RenderHeads.Media.AVProVideo\ErrorCode.cs" />
431+
<Compile Include="RenderHeads.Media.AVProVideo\Helper.cs" />
432+
<Compile Include="RenderHeads.Media.AVProVideo\IMediaConsumer.cs" />
433+
<Compile Include="RenderHeads.Media.AVProVideo\IMediaControl.cs" />
434+
<Compile Include="RenderHeads.Media.AVProVideo\IMediaInfo.cs" />
435+
<Compile Include="RenderHeads.Media.AVProVideo\IMediaPlayer.cs" />
436+
<Compile Include="RenderHeads.Media.AVProVideo\IMediaProducer.cs" />
437+
<Compile Include="RenderHeads.Media.AVProVideo\MediaPlayer.cs" />
438+
<Compile Include="RenderHeads.Media.AVProVideo\MediaPlayerEvent.cs" />
439+
<Compile Include="RenderHeads.Media.AVProVideo\NullMediaPlayer.cs" />
440+
<Compile Include="RenderHeads.Media.AVProVideo\Platform.cs" />
441+
<Compile Include="RenderHeads.Media.AVProVideo\StereoPacking.cs" />
442+
<Compile Include="RenderHeads.Media.AVProVideo\UpdateStereoMaterial.cs" />
443+
<Compile Include="RenderHeads.Media.AVProVideo\Windows.cs" />
444+
<Compile Include="RenderHeads.Media.AVProVideo\WindowsMediaPlayer.cs" />
407445
<Compile Include="Rotator.cs" />
408446
<Compile Include="Sine.cs" />
409447
<Compile Include="SpringPanel.cs" />

Assets.Scripts.Core.AssetManagement/AssetManager.cs

+56-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using Assets.Scripts.Core.Audio;
2+
using Assets.Scripts.Core.Buriko;
23
using BGICompiler.Compiler;
34
using System;
45
using System.Collections.Generic;
@@ -232,8 +233,61 @@ public Texture2D LoadTexture(string textureName)
232233
public byte[] GetAudioFile(string filename, Assets.Scripts.Core.Audio.AudioType type)
233234
{
234235
string archiveNameByAudioType = GetArchiveNameByAudioType(type);
235-
string path = Path.Combine(assetPath, archiveNameByAudioType + "/" + filename.ToLower());
236-
return File.ReadAllBytes(path);
236+
string text = null;
237+
string text2 = Path.Combine(assetPath, archiveNameByAudioType + "/" + filename.ToLower());
238+
string text3 = Path.Combine(assetPath, archiveNameByAudioType + "Alt/" + filename.ToLower());
239+
switch (archiveNameByAudioType)
240+
{
241+
case "BGM":
242+
if (BurikoMemory.Instance.GetGlobalFlag("GAltBGM").IntValue() == 0)
243+
{
244+
goto default;
245+
}
246+
if (File.Exists(text3))
247+
{
248+
text = text3;
249+
break;
250+
}
251+
goto IL_00f5;
252+
case "SE":
253+
if (BurikoMemory.Instance.GetGlobalFlag("GAltSE").IntValue() == 0)
254+
{
255+
goto default;
256+
}
257+
if (File.Exists(text3))
258+
{
259+
text = text3;
260+
break;
261+
}
262+
goto IL_00f5;
263+
case "voice":
264+
if (BurikoMemory.Instance.GetGlobalFlag("GAltVoice").IntValue() != 0)
265+
{
266+
if (BurikoMemory.Instance.GetGlobalFlag("GAltVoicePriority").IntValue() == 0)
267+
{
268+
goto default;
269+
}
270+
if (File.Exists(text3))
271+
{
272+
text = text3;
273+
break;
274+
}
275+
}
276+
goto IL_00f5;
277+
default:
278+
{
279+
if (!File.Exists(text2))
280+
{
281+
text = text3;
282+
break;
283+
}
284+
goto IL_00f5;
285+
}
286+
IL_00f5:
287+
text = text2;
288+
break;
289+
}
290+
return File.ReadAllBytes(text);
237291
}
238292

239293
public byte[] GetScriptData(string filename)

Assets.Scripts.Core.Audio/AudioController.cs

+53-59
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using Assets.Scripts.Core.Buriko;
1+
using MOD.Scripts.Core;
2+
using MOD.Scripts.Core.TextWindow;
23
using Newtonsoft.Json;
34
using Newtonsoft.Json.Bson;
45
using System.Collections.Generic;
@@ -283,67 +284,24 @@ public void FadeOutSE(int channel, float time, bool waitForFade)
283284

284285
public void PlayVoice(string filename, int channel, float volume)
285286
{
286-
string text = filename.Substring(0, 4);
287-
bool flag = false;
288-
switch (text)
289-
{
290-
case "chie":
291-
flag = BurikoMemory.Instance.GetGlobalFlag("GVChie").BoolValue();
292-
break;
293-
case "eiji":
294-
flag = BurikoMemory.Instance.GetGlobalFlag("GVEiji").BoolValue();
295-
break;
296-
case "kana":
297-
flag = BurikoMemory.Instance.GetGlobalFlag("GVKana").BoolValue();
298-
break;
299-
case "kira":
300-
flag = BurikoMemory.Instance.GetGlobalFlag("GVKira").BoolValue();
301-
break;
302-
case "mast":
303-
flag = BurikoMemory.Instance.GetGlobalFlag("GVMast").BoolValue();
304-
break;
305-
case "mura":
306-
flag = BurikoMemory.Instance.GetGlobalFlag("GVMura").BoolValue();
307-
break;
308-
case "riho":
309-
flag = BurikoMemory.Instance.GetGlobalFlag("GVRiho").BoolValue();
310-
break;
311-
case "rmn_":
312-
flag = BurikoMemory.Instance.GetGlobalFlag("GVRmn_").BoolValue();
313-
break;
314-
case "sari":
315-
flag = BurikoMemory.Instance.GetGlobalFlag("GVSari").BoolValue();
316-
break;
317-
case "tika":
318-
flag = BurikoMemory.Instance.GetGlobalFlag("GVTika").BoolValue();
319-
break;
320-
case "yayo":
321-
flag = BurikoMemory.Instance.GetGlobalFlag("GVYayo").BoolValue();
322-
break;
323-
default:
324-
flag = BurikoMemory.Instance.GetGlobalFlag("GVOther").BoolValue();
325-
break;
287+
MODTextController.MODCurrentVoiceLayerDetect = channel;
288+
AudioLayer audio = channelDictionary[GetChannelByTypeChannel(AudioType.Voice, channel)];
289+
if (currentAudio[AudioType.Voice].ContainsKey(channel))
290+
{
291+
currentAudio[AudioType.Voice].Remove(channel);
326292
}
327-
if (!flag)
293+
currentAudio[AudioType.Voice].Add(channel, new AudioInfo(volume, filename));
294+
if (audio.IsPlaying())
328295
{
329-
AudioLayer audio = channelDictionary[GetChannelByTypeChannel(AudioType.Voice, channel)];
330-
if (currentAudio[AudioType.Voice].ContainsKey(channel))
331-
{
332-
currentAudio[AudioType.Voice].Remove(channel);
333-
}
334-
currentAudio[AudioType.Voice].Add(channel, new AudioInfo(volume, filename));
335-
if (audio.IsPlaying())
336-
{
337-
audio.StopAudio();
338-
}
339-
audio.PlayAudio(filename, AudioType.Voice, volume);
340-
if (GameSystem.Instance.IsAuto)
296+
audio.StopAudio();
297+
}
298+
audio.PlayAudio(filename, AudioType.Voice, volume);
299+
if (GameSystem.Instance.IsAuto)
300+
{
301+
audio.OnLoadCallback(delegate
341302
{
342-
audio.OnLoadCallback(delegate
343-
{
344-
GameSystem.Instance.AddWait(new Wait(audio.GetRemainingPlayTime(), WaitTypes.WaitForVoice, null));
345-
});
346-
}
303+
GameSystem.Instance.AddWait(new Wait(audio.GetRemainingPlayTime(), WaitTypes.WaitForVoice, null));
304+
});
347305
}
348306
}
349307

@@ -510,5 +468,41 @@ public void RefreshLayerVolumes()
510468
audioLayer4.SetBaseVolume(SystemVolume * GlobalVolume);
511469
}
512470
}
471+
472+
public bool IsSEPlaying(int channel)
473+
{
474+
return channelDictionary[GetChannelByTypeChannel(AudioType.SE, channel)].IsPlaying();
475+
}
476+
477+
public void MODOnlyRecompile()
478+
{
479+
}
480+
481+
public void MODPlayVoiceLS(string filename, int channel, float volume, int character)
482+
{
483+
MODTextController.MODCurrentVoiceLayerDetect = channel;
484+
AudioLayer audio = channelDictionary[GetChannelByTypeChannel(AudioType.Voice, channel)];
485+
if (currentAudio[AudioType.Voice].ContainsKey(channel))
486+
{
487+
currentAudio[AudioType.Voice].Remove(channel);
488+
}
489+
currentAudio[AudioType.Voice].Add(channel, new AudioInfo(volume, filename));
490+
if (audio.IsPlaying())
491+
{
492+
audio.StopAudio();
493+
}
494+
audio.PlayAudio(filename, AudioType.Voice, volume);
495+
if (MODSystem.instance.modSceneController.MODLipSyncBoolCheck(character))
496+
{
497+
GameSystem.Instance.SceneController.MODLipSyncStart(character, channel, filename);
498+
}
499+
if (GameSystem.Instance.IsAuto)
500+
{
501+
audio.OnLoadCallback(delegate
502+
{
503+
GameSystem.Instance.AddWait(new Wait(audio.GetRemainingPlayTime(), WaitTypes.WaitForVoice, null));
504+
});
505+
}
506+
}
513507
}
514508
}

Assets.Scripts.Core.Buriko/BurikoMemory.cs

+27-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,30 @@ public BurikoMemory()
7676
variableReference.Add("GVOther", 41);
7777
variableReference.Add("GArtStyle", 50);
7878
variableReference.Add("GHideButtons", 51);
79-
SetGlobalFlag("GMessageSpeed", 50);
79+
variableReference.Add("GADVMode", 52);
80+
variableReference.Add("GLinemodeSp", 53);
81+
variableReference.Add("GCensor", 54);
82+
variableReference.Add("GEffectExtend", 55);
83+
variableReference.Add("GAltBGM", 56);
84+
variableReference.Add("GAltSE", 57);
85+
variableReference.Add("GAltBGMflow", 58);
86+
variableReference.Add("GAltSEflow", 59);
87+
variableReference.Add("GAltVoice", 60);
88+
variableReference.Add("GAltVoicePriority", 61);
89+
variableReference.Add("GCensorMaxNum", 62);
90+
variableReference.Add("GEffectExtendMaxNum", 63);
91+
variableReference.Add("GAltBGMflowMaxNum", 64);
92+
variableReference.Add("GAltSEflowMaxNum", 65);
93+
variableReference.Add("GMOD_SETTING_LOADER", 66);
94+
variableReference.Add("GFlagForTest1", 67);
95+
variableReference.Add("GFlagForTest2", 68);
96+
variableReference.Add("GFlagForTest3", 69);
97+
variableReference.Add("NVL_in_ADV", 70);
98+
variableReference.Add("GFlagMonitor", 71);
99+
variableReference.Add("DisableModHotkey", 72);
100+
variableReference.Add("GMOD_DEBUG_MODE", 73);
101+
variableReference.Add("GLipSync", 74);
102+
SetGlobalFlag("GMessageSpeed", 60);
80103
SetGlobalFlag("GAutoSpeed", 50);
81104
SetGlobalFlag("GAutoAdvSpeed", 50);
82105
SetGlobalFlag("GWindowOpacity", 50);
@@ -105,7 +128,10 @@ public BurikoMemory()
105128
SetGlobalFlag("GVOther", 1);
106129
SetGlobalFlag("GArtStyle", 1);
107130
SetGlobalFlag("GHideButtons", 0);
131+
SetGlobalFlag("GLipSync", 1);
108132
SetFlag("LTextFade", 1);
133+
SetFlag("NVL_in_ADV", 0);
134+
SetFlag("DisableModHotkey", 0);
109135
Instance = this;
110136
LoadGlobals();
111137
}

Assets.Scripts.Core.Buriko/BurikoOperations.cs

+11-1
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,16 @@ public enum BurikoOperations
124124
SetWindowMargins,
125125
SetNameFormat,
126126
SetScreenAspect,
127-
SetGuiPosition
127+
SetGuiPosition,
128+
ModEnableNVLModeInADVMode,
129+
ModDisableNVLModeInADVMode,
130+
ModADVModeSettingLoad,
131+
ModNVLModeSettingLoad,
132+
ModNVLADVModeSettingLoad,
133+
ModCallScriptSection,
134+
ModDrawCharacter,
135+
ModDrawCharacterWithFiltering,
136+
ModPlayVoiceLS,
137+
ModPlayMovie
128138
}
129139
}

Assets.Scripts.Core.Buriko/BurikoSaveManager.cs

+5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using System;
22
using System.Collections.Generic;
33
using System.IO;
4+
using System.Text.RegularExpressions;
45

56
namespace Assets.Scripts.Core.Buriko
67
{
@@ -81,6 +82,10 @@ private void GetSaveData(int slot, string path)
8182
saveEntry2.Time = DateTime.FromBinary(binaryReader.ReadInt64());
8283
string textJp = binaryReader.ReadString();
8384
string text = saveEntry2.Text = binaryReader.ReadString();
85+
string pattern = "[<](size)[=][+](.+)[<][/](size)[>]";
86+
textJp = Regex.Replace(textJp, pattern, string.Empty);
87+
text = Regex.Replace(text, pattern, string.Empty);
88+
saveEntry.Text = text;
8489
saveEntry2.TextJp = textJp;
8590
}
8691
}

0 commit comments

Comments
 (0)