diff --git a/GeneralMods/StardewSymphonyRemastered/StardewSymphonyRemastered/Framework/Music/SongSpecifics.cs b/GeneralMods/StardewSymphonyRemastered/StardewSymphonyRemastered/Framework/Music/SongSpecifics.cs index 2d314b74..52fcf16b 100644 --- a/GeneralMods/StardewSymphonyRemastered/StardewSymphonyRemastered/Framework/Music/SongSpecifics.cs +++ b/GeneralMods/StardewSymphonyRemastered/StardewSymphonyRemastered/Framework/Music/SongSpecifics.cs @@ -174,6 +174,7 @@ namespace StardewSymphonyRemastered.Framework var farm = (Farm)Game1.getLocationFromName("Farm"); foreach(var building in farm.buildings) { + if (String.IsNullOrEmpty(building.nameOfIndoors)) continue; if (locations.Contains(building.nameOfIndoors)) continue; locations.Add(building.nameOfIndoors); if (StardewSymphony.Config.EnableDebugLog) diff --git a/GeneralMods/StardewSymphonyRemastered/StardewSymphonyRemastered/Framework/Music/WavMusicPack.cs b/GeneralMods/StardewSymphonyRemastered/StardewSymphonyRemastered/Framework/Music/WavMusicPack.cs index 5df7df4e..ad3ecbdf 100644 --- a/GeneralMods/StardewSymphonyRemastered/StardewSymphonyRemastered/Framework/Music/WavMusicPack.cs +++ b/GeneralMods/StardewSymphonyRemastered/StardewSymphonyRemastered/Framework/Music/WavMusicPack.cs @@ -118,8 +118,11 @@ namespace StardewSymphonyRemastered.Framework dynamicSound = new DynamicSoundEffectInstance(sampleRate, (AudioChannels)channels); - count = byteArray.Length;//dynamicSound.GetSampleSizeInBytes(TimeSpan.FromMilliseconds(10000)); - + count = dynamicSound.GetSampleSizeInBytes(TimeSpan.FromMilliseconds(10000)); + if (count > byteArray.Length) + { + count = byteArray.Length; + } dynamicSound.BufferNeeded += new EventHandler(DynamicSound_BufferNeeded); this.currentSong = new Song(p); } @@ -131,10 +134,14 @@ namespace StardewSymphonyRemastered.Framework //StardewSymphony.ModMonitor.Log(count.ToString()); try { + dynamicSound.SubmitBuffer(byteArray, position, count); } catch(Exception err) { + StardewSymphony.ModMonitor.Log(byteArray.Length.ToString()); + StardewSymphony.ModMonitor.Log(position.ToString()); + StardewSymphony.ModMonitor.Log(count.ToString()); StardewSymphony.ModMonitor.Log(err.ToString(), StardewModdingAPI.LogLevel.Error); } @@ -150,6 +157,7 @@ namespace StardewSymphonyRemastered.Framework } else { + } } } diff --git a/GeneralMods/StardewSymphonyRemastered/StardewSymphonyRemastered/manifest.json b/GeneralMods/StardewSymphonyRemastered/StardewSymphonyRemastered/manifest.json index 30b1050a..5e6b0b04 100644 --- a/GeneralMods/StardewSymphonyRemastered/StardewSymphonyRemastered/manifest.json +++ b/GeneralMods/StardewSymphonyRemastered/StardewSymphonyRemastered/manifest.json @@ -1,7 +1,7 @@ { "Name": "Stardew Symphony Remastered", "Author": "Alpha_Omegasis", - "Version": "2.1.1", + "Version": "2.1.2", "Description": "Adding more music to the game one beep at a time. Now with streaming!", "UniqueID": "Omegasis.StardewSymphonyRemastered", "EntryDll": "StardewSymphonyRemastered.dll", diff --git a/GeneralMods/StardustCore/ModConfig.cs b/GeneralMods/StardustCore/ModConfig.cs new file mode 100644 index 00000000..7c44a1c5 --- /dev/null +++ b/GeneralMods/StardustCore/ModConfig.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace StardustCore +{ + public class ModConfig + { + public bool enableMultiplayerHack { get; set; } = false; + + public ModConfig() + { + + } + + } +} diff --git a/GeneralMods/StardustCore/ModCore.cs b/GeneralMods/StardustCore/ModCore.cs index 3819000b..2fb081b7 100644 --- a/GeneralMods/StardustCore/ModCore.cs +++ b/GeneralMods/StardustCore/ModCore.cs @@ -36,6 +36,8 @@ namespace StardustCore private Type lastMenuType; + public ModConfig config; + public static string ContentDirectory; public override void Entry(IModHelper helper) { @@ -70,7 +72,8 @@ namespace StardustCore TextureManagers.Add(ModManifest.UniqueID, TextureManager); StardewModdingAPI.Events.ControlEvents.KeyPressed += ControlEvents_KeyPressed; - + config = ModHelper.ReadConfig(); + StardewModdingAPI.Events.GameEvents.UpdateTick += GameEvents_UpdateTick; serverHack = false; @@ -78,7 +81,7 @@ namespace StardustCore private void MenuEvents_MenuClosed(object sender, StardewModdingAPI.Events.EventArgsClickableMenuClosed e) { - if (Game1.IsMasterGame == false) + if (Game1.IsMasterGame == false && config.enableMultiplayerHack) { if (this.lastMenuType == null) { @@ -96,7 +99,7 @@ namespace StardustCore private void MenuEvents_MenuChanged(object sender, StardewModdingAPI.Events.EventArgsClickableMenuChanged e) { - if (Game1.IsMasterGame == false) + if (Game1.IsMasterGame == false && config.enableMultiplayerHack) { if (Game1.activeClickableMenu.GetType() == typeof(StardewValley.Menus.ReadyCheckDialog)) { @@ -147,7 +150,7 @@ namespace StardustCore if (Game1.activeClickableMenu != null) { - if(Game1.activeClickableMenu is StardewValley.Menus.TitleMenu) + if(Game1.activeClickableMenu is StardewValley.Menus.TitleMenu && config.enableMultiplayerHack) { if (TitleMenu.subMenu == null) return; if (TitleMenu.subMenu.GetType() == typeof(FarmhandMenu)) @@ -164,7 +167,7 @@ namespace StardustCore } } - if (Game1.server!=null&& serverHack==false) + if (Game1.server!=null&& serverHack==false && config.enableMultiplayerHack) { ModCore.ModMonitor.Log("OK!"); multiplayer = (Multiplayer)GetInstanceField(typeof(Game1), Program.gamePtr, "multiplayer"); @@ -176,7 +179,7 @@ namespace StardustCore serverHack = true; } - if (Game1.client !=null && serverHack == false) + if (Game1.client !=null && serverHack == false && config.enableMultiplayerHack) { } diff --git a/GeneralMods/StardustCore/NetCode/ModdedGameServer.cs b/GeneralMods/StardustCore/NetCode/ModdedGameServer.cs index 6868e7fd..740c4bc4 100644 --- a/GeneralMods/StardustCore/NetCode/ModdedGameServer.cs +++ b/GeneralMods/StardustCore/NetCode/ModdedGameServer.cs @@ -164,7 +164,6 @@ namespace StardustCore.NetCode ModCore.SerializationManager.cleanUpInventory(); ModCore.SerializationManager.cleanUpWorld(); ModCore.SerializationManager.cleanUpStorageContainers(); - ModCore.ModMonitor.Log("HELLO LOVE!!!"); this.sendMessage(peer, new OutgoingMessage((byte)1, Game1.serverHost.Value, new object[3] { (object)ModCore.multiplayer.writeObjectFullBytes((NetRoot)Game1.serverHost, new long?(peer)), diff --git a/GeneralMods/StardustCore/Serialization/Serialization.cs b/GeneralMods/StardustCore/Serialization/Serialization.cs index 0e289b0e..81382812 100644 --- a/GeneralMods/StardustCore/Serialization/Serialization.cs +++ b/GeneralMods/StardustCore/Serialization/Serialization.cs @@ -239,11 +239,13 @@ namespace StardustCore.Serialization } } } - + if (Game1.getFarm() == null) return; + if (Game1.getFarm().buildings == null) return; //Look through all farm buildings for custom items. foreach (Building building in Game1.getFarm().buildings) { - + if (building == null) continue; + if (String.IsNullOrEmpty(building.nameOfIndoors)) continue; GameLocation loc =Game1.getLocationFromName(building.nameOfIndoors,true); //ModCore.ModMonitor.Log("Cleaning up farm building: "+loc.uniqueName.Value); int i = loc.objects.Pairs.Count(); diff --git a/GeneralMods/StardustCore/StardustCore.csproj b/GeneralMods/StardustCore/StardustCore.csproj index 6c9f7505..2b041fbe 100644 --- a/GeneralMods/StardustCore/StardustCore.csproj +++ b/GeneralMods/StardustCore/StardustCore.csproj @@ -93,6 +93,7 @@ + diff --git a/GeneralMods/StardustCore/manifest.json b/GeneralMods/StardustCore/manifest.json index 9f14a39c..55eb4b79 100644 --- a/GeneralMods/StardustCore/manifest.json +++ b/GeneralMods/StardustCore/manifest.json @@ -1,7 +1,7 @@ { "Name": "StardustCore", "Author": "Alpha_Omegasis", - "Version": "2.0.2", + "Version": "2.0.3", "Description": "A core mod that allows for other mods of mine to be run.", "UniqueID": "Omegasis.StardustCore", "EntryDll": "StardustCore.dll",