Skip to content

Commit 13c783a

Browse files
committed
Fix for SaXAudio (WIP)
1 parent 40dbbae commit 13c783a

5 files changed

Lines changed: 30 additions & 6 deletions

File tree

‎Assembly-CSharp/Global/Sound/SaXAudio/SaXAudio.cs‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using System;
22
using System.Runtime.InteropServices;
3+
using UnityEngine;
34

45
namespace Global.Sound.SaXAudio
56
{
@@ -203,6 +204,9 @@ public static Boolean Init()
203204
[DllImport("SaXAudio")]
204205
public static extern UInt32 GetBankCount();
205206

207+
[DllImport("SaXAudio")]
208+
public static extern void FlushGarbage();
209+
206210
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
207211
public delegate void OnDecodedDelegate(Int32 bankID, IntPtr buffer);
208212

@@ -216,5 +220,13 @@ private static void TriggerOnFinished(Int32 voiceID)
216220
{
217221
OnVoiceFinished?.Invoke(voiceID);
218222
}
223+
224+
public class SaXAudioUpdater : MonoBehaviour
225+
{
226+
void Update()
227+
{
228+
SaXAudio.FlushGarbage();
229+
}
230+
}
219231
}
220232
}

‎Assembly-CSharp/Global/Sound/SaXAudio/SdLibAPIWithSaXAudio.cs‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
using Memoria.Prime;
22
using Memoria.Prime.AKB2;
3-
using SoLoud;
43
using System;
54
using System.Collections.Generic;
6-
using System.IO;
75
using System.Runtime.InteropServices;
6+
using UnityEngine;
87

98
namespace Global.Sound.SaXAudio
109
{
@@ -45,7 +44,10 @@ public override Int32 SdSoundSystem_Create(String config)
4544
BusSoundEffect = SaXAudio.CreateBus();
4645
BusVoice = SaXAudio.CreateBus();
4746
AudioEffectManager.Initialize();
48-
Log.Message($"[SaXAudio] Initialized");
47+
GameObject go = new GameObject("SaXAudioUpdater");
48+
go.AddComponent<SaXAudio.SaXAudioUpdater>();
49+
GameObject.DontDestroyOnLoad(go);
50+
Log.Message($"[SaXAudio] Initialized === BUILD TEST V4.2 FROM DV !");
4951
return 0;
5052
}
5153

474 KB
Binary file not shown.
499 KB
Binary file not shown.

‎Assembly-CSharp/NCalc/Evaluant.Calculator/Expression.cs‎

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using Antlr.Runtime;
2+
using Memoria;
23
using NCalc.Domain;
34
using System;
45
using System.Collections;
@@ -10,6 +11,15 @@
1011
// Original author: sebastienros https://archive.codeplex.com/?p=ncalc
1112
// Author of this version: pitermarx https://github.com/pitermarx/NCalc-Edge
1213

14+
/* Crash with mono.dll if too much log ?
15+
0x00000000064589BF(Mono JIT Code)(wrapper managed - to - native) System.Reflection.Assembly:GetCallingAssembly()
16+
0x00000000064588FD(Mono JIT Code) System.Diagnostics.Trace:TraceInformation(string)
17+
0x0000000006457A03(Mono JIT Code) NCalc.Expression:CleanCache()
18+
0x000000000643DD99(Mono JIT Code) NCalc.Expression:Compile(string, bool)
19+
0x000000000643D734(Mono JIT Code) NCalc.Expression:HasErrors()
20+
0x000000000643C8CF(Mono JIT Code) NCalc.Expression:Evaluate()
21+
*/
22+
1323
namespace NCalc
1424
{
1525
public class Expression
@@ -79,7 +89,7 @@ private static void CleanCache()
7989
foreach (string key in keysToRemove)
8090
{
8191
compiledExpressions.Remove(key);
82-
Trace.TraceInformation("Cache entry released: " + key);
92+
//Trace.TraceInformation("Cache entry released: " + key);
8393
}
8494
}
8595
finally
@@ -102,7 +112,7 @@ public static LogicalExpression Compile(string expression, bool nocache)
102112

103113
if (compiledExpressions.ContainsKey(expression))
104114
{
105-
Trace.TraceInformation("Expression retrieved from cache: " + expression);
115+
//Trace.TraceInformation("Expression retrieved from cache: " + expression);
106116
var wr = compiledExpressions[expression];
107117
logicalExpression = wr.Target as LogicalExpression;
108118

@@ -144,7 +154,7 @@ public static LogicalExpression Compile(string expression, bool nocache)
144154

145155
CleanCache();
146156

147-
Trace.TraceInformation("Expression added to cache: " + expression);
157+
//Trace.TraceInformation("Expression added to cache: " + expression);
148158
}
149159
}
150160

0 commit comments

Comments
 (0)