Beispiel #1
0
        async void ReadClientValues(string ClientName)
        {
            try
            {
                string clientpath = HelperStructs.GlobalVars.ClientFolder + "/" + ClientName + '/' + HelperStructs.GlobalVars.ClientInfoFile;

                if (!File.Exists(clientpath))
                {
                    ConsolePrint("Error - " + clientpath + " not detected with '" + ClientBox.SelectedItem + "'. '" + ClientBox.SelectedItem + "' either cannot be loaded, or it is not available.");
                    await this.ShowMessageAsync("Error", "No clientinfo file detected with '" + ClientBox.SelectedItem + "'. '" + ClientBox.SelectedItem + "' either cannot be loaded, or it is not available.");

                    HelperStructs.GlobalVars.LauncherConfig.SelectedClient = HelperStructs.GlobalVars.LauncherInfo.DefaultSelectedClient;
                }

                HelperStructs.LauncherFuncs.ReadClientValues(clientpath);
                ClientDescription.Document.Blocks.Clear();
                ClientDescription.AppendText(HelperStructs.GlobalVars.SelectedClient.Desc, "White");
                HelperStructs.GlobalVars.LauncherConfig.SelectedClient = ClientBox.SelectedItem.ToString();
                CurrentClient.Content = HelperStructs.GlobalVars.LauncherConfig.SelectedClient;
                ConsolePrint("Client '" + HelperStructs.GlobalVars.LauncherConfig.SelectedClient + "' successfully loaded.");
            }
            catch (Exception)
            {
                ConsolePrint("Error - '" + ClientBox.SelectedItem + "' cannot be loaded.");
                await this.ShowMessageAsync("Error", "'" + ClientBox.SelectedItem + "' cannot be loaded.");

                HelperStructs.GlobalVars.LauncherConfig.SelectedClient = HelperStructs.GlobalVars.LauncherInfo.DefaultSelectedClient;
            }
        }
Beispiel #2
0
        private void resetInternal(ClientDescription sender, byte[] buffer)
        {
            byte rulesByte = buffer[0];

            rules.sync_Keys     = (rulesByte & 0x1) > 0;
            rules.sync_Switches = (rulesByte & 0x2) > 0;
            rules.sync_Cannons  = (rulesByte & 0x4) > 0;

            stars       = new byte[0x70];
            stars[0x37] = 0x44;
            stars[0x36] = 0x41;
            synchronizeGame(null, stars);
            myStars = (byte[])stars.Clone();
            started = true;
            //NetworkClient.started = true;
        }
Beispiel #3
0
        public void synchronizeGame(ClientDescription sender, byte[] newStars)
        {
            if (newStars.Length == 0)
            {
                return;
            }

            newStars[0xA] &= 0xF;
            if (!rules.sync_Keys)
            {
                newStars[8] &= 0xF0;
            }
            if (!rules.sync_Switches)
            {
                newStars[8] &= 0x8F;
            }

            if (!rules.sync_Cannons)
            {
                for (int i = 0xC; i < 0x24; i++)
                {
                    newStars[i] &= 0x7F;
                }
            }

            if (mode == 0)
            {
                for (int i = 0; i < newStars.Length; i++)
                {
                    stars[i] |= newStars[i];
                }
            }
            else
            {
                stars = newStars;
            }

            updateStarAnimations(newStars);
            if (!validateState())
            {
                return;
            }
            memory.WriteMemory(0x207690 + saveFile * 0x70, stars);
            UpdateStarGeoLayouts(newStars);
        }
Beispiel #4
0
 public void synchronizeGameStart(ClientDescription sender, byte[] newStars)
 {
     started = true;
     synchronizeGame(null, newStars);
 }