/// <summary>
        /// Toggles party mode status, adds/removes an overlay covering the screen which will rotate all of the colours.
        /// </summary>
        public void Toggle_Party_Mode()
        {
            if (PartyModeEnabled)
            {
                // Remove the additional function pointer assigned to the delegate to render the box during the game menu editing.
                Program.Sonic_Heroes_Overlay.direct2DRenderMethod -= Draw_Overlay;
                PartyModeEnabled = false;
            }
            else
            {
                // Add a function pointer to the delegate delegate to render the box during the game menu editing.
                Program.Sonic_Heroes_Overlay.direct2DRenderMethod += Draw_Overlay;

                // Play the song "Diamond in The Sky"
                Invoke_External_Class.Play_Song(Pointer_DiamondInTheSky);

                // Disable The Character voices if they are enabled.
                if (Program.Feature_Toggle_Character_Chatter_X.Get_CharacterChatter())
                {
                    Program.Feature_Toggle_Character_Chatter_X.Toggle_CharacterChatter();
                }
                if (Program.Feature_Toggle_Character_Chatter_X.Get_VoiceComments())
                {
                    Program.Feature_Toggle_Character_Chatter_X.Toggle_CharacterCommentChatter();
                }

                // Go Go Go RGB
                Program.Feature_Cycle_RGB_Colours_X.Toggle_HUE_Cycle_All_Combined();
                PartyModeEnabled = true;
            }
        }
        /// <summary>
        /// Loads the AFS file, effectively swapping the voices.
        /// </summary>
        private void Load_AFS_File(int AFS_Pointer)
        {
            // Backup the conditional jump preventing from reloading of AFS file.
            byte[] OriginalCheck = Program.Sonic_Heroes_Process.ReadMemory((IntPtr)AFS_NO_RELOAD_JUMP_STATEMENT, 2);

            // NOP the jump which checks/verifies the AFS reloading.
            Program.Sonic_Heroes_Process.WriteMemory((IntPtr)AFS_NO_RELOAD_JUMP_STATEMENT, new byte[] { 0x90, 0x90 });

            // Writes the current offset to the new AFS file name into memory.
            Program.Sonic_Heroes_Process.WriteMemory((IntPtr)AFS_FILE_NAME_OFFSET_LOCATION_MEMORY, BitConverter.GetBytes(AFS_Pointer));

            // Reads the current song name string for backup purposes.
            int String_Length = 0;

            while ((Program.Sonic_Heroes_Process.ReadMemory <byte>((IntPtr)ADX_CURRENT_SONG_NAME_MEMORY + String_Length, 1)) != 0)
            {
                String_Length += 1;
            }
            string Original_Song_Name = Encoding.ASCII.GetString(Program.Sonic_Heroes_Process.ReadMemory((IntPtr)0xA6DB8A, String_Length));

            // Load the currently set AFS File.
            Invoke_External_Class.Load_AFS_Language_File();

            // Rewrite the song name string in memory after it being wiped by the AFS loading function.
            List <byte> Original_Song_Bytes = Encoding.ASCII.GetBytes(Original_Song_Name).ToList();

            Original_Song_Bytes.Add(0x00); // Just in case, add additional null terminator.
            Program.Sonic_Heroes_Process.WriteMemory((IntPtr)ADX_CURRENT_SONG_NAME_MEMORY, Original_Song_Bytes.ToArray());

            // Restart the last playing music track.
            Invoke_External_Class.Play_Song(ADX_CURRENT_SONG_NAME_MEMORY);

            // Restore the original check if an AFS file is already loaded.
            Program.Sonic_Heroes_Process.WriteMemory((IntPtr)AFS_NO_RELOAD_JUMP_STATEMENT, OriginalCheck);
        }
Exemplo n.º 3
0
 /// <summary>
 /// Plays ADX which contains in its name the passed in string. Calls C++ Function with our own pointer to the music track.
 /// </summary>
 public void Play_ADX_Track(string ADXName)
 {
     for (int x = 0; x < BGM_List.Count; x++)
     {
         if (BGM_List[x].Song_Name.Contains(ADXName))
         {
             Invoke_External_Class.Play_Song(BGM_List[x].Song_Pointer); break;
         }
     }
 }
        /// <summary>
        /// Draws the overlay if necessary, i.e. if character is in a level.
        /// </summary>
        /// <param name="DirectX_Graphics_Window"></param>
        private void Draw_Overlay(WindowRenderTarget DirectX_Graphics_Window)
        {
            // Get Information of whether the overlay should be shown.
            byte Is_Currently_In_Level = Program.Sonic_Heroes_Process.ReadMemory <byte>((IntPtr)SonicHeroesVariables.Game_CurrentState.CurrentlyInLevel, 1);

            // If the player is in a stage.
            if (Is_Currently_In_Level == 1)
            {
                Draw_Window(DirectX_Graphics_Window); Invoke_External_Class.Play_Song(Pointer_DiamondInTheSky);
            }
        }
Exemplo n.º 5
0
 /// <summary>
 /// Plays the currently selected ADX track. Calls C++ Function with our own pointer to the music track.
 /// </summary>
 public void Play_ADX_Track()
 {
     Invoke_External_Class.Play_Song(BGM_List[Current_ADX_Track].Song_Pointer);
 }