public static void Main(string[] args) { using (ProcessEdit shaiya = new ProcessEdit()) { do { Console.WriteLine("Please start Shaiya.."); System.Threading.Thread.Sleep(1000); } while(shaiya.OpenProcessAndThread("game") == false); Console.Clear(); Console.WriteLine("Shaiya successful attached!"); Console.WriteLine("\nPlease enter your desired Charname (the full length!)"); Console.Write("Charname: "); string charname = Console.ReadLine(); if (charname.Length <= 13) { Console.WriteLine("\n\nCharname only contains " + charname.Length + " (max is 13) and is already valid!"); } else { string validCharname = charname.Substring(0, 13); string patternMask = new string( 'x', 13 ); // all chars must match! byte[] baCharname = System.Text.ASCIIEncoding.Default.GetBytes(validCharname); uint patLoc = shaiya.FindPattern(baCharname, patternMask); if (patLoc != 0) { string patData = ""; if (patLoc > 0) { patData = shaiya.ReadASCIIString(patLoc, 13); } #if DEBUG Console.WriteLine("[Debug] Pattern Location: 0x{0:X08}", patLoc); Console.WriteLine("[Debug] Pattern Data (13 chars): {0}", patData); #endif Console.Write("\ntry to update Memory with real name.."); if (shaiya.WriteASCIIString(patLoc, charname) == true) { Console.WriteLine(" success!"); } else { Console.WriteLine(" failed.."); } } else { Console.WriteLine("FAILED to find Namestring?"); } } Console.WriteLine("\n\nPress any Key to exit"); Console.ReadKey(); } }
public static void Inject() { int procId = ProcessHelper.GetProcessFromProcessName("game"); ProcessEdit proc = new ProcessEdit(procId); if (proc.IsProcessOpen == false) { Console.WriteLine("failed to open Shaiya Process"); Console.Read(); return; } byte[] pat1 = new byte[] { 0x8B, 0xCB, 0x8B, 0xD1, 0xC1, 0xE9, 0x02, 0x8D, 0x43, 0x02, 0x66, 0x89, 0x44, 0x24, 0x20 }; byte[] pat2 = new byte[] { 0xB8, 0x8C, 0x60, 0x00, 0x00, 0xE8 }; byte[] pat3 = new byte[] { 0x8B, 0x54, 0x24, 0x04, 0x0F, 0xB7, 0xC2, 0x3D }; uint Address = proc.FindPattern(pat1, "xxxxxxxxxxxxxxx") - 0x38; uint ReturnAddress = Address + 6; uint Address2 = proc.FindPattern(pat2, "xxxxxx"); uint ReturnAddress2 = Address2 + 5; uint Address3 = proc.FindPattern(pat3, "xxxxxxxx"); Console.WriteLine("Address: " + Address + " / " + Address.ToString("X8")); Console.WriteLine("ReturnAddress: " + ReturnAddress + " / " + ReturnAddress.ToString("X8")); Console.WriteLine("Address2: " + Address2 + " / " + Address2.ToString("X8")); Console.WriteLine("ReturnAddress2: " + ReturnAddress2 + " / " + ReturnAddress2.ToString("X8")); Console.WriteLine("Address3: " + Address3 + " / " + Address3.ToString("X8")); proc.Dispose(); mInject = new ProcessInject(Address, procId); //mInject.WriteBytes( Address2, new byte[] { 0xE9 } ); // *(BYTE *)(Address2) = 0xE9; IntPtr endSceneAddr = mInject.GetObjectVtableFunction(mInject.Read <IntPtr>(Address), 0); mInject.Detours.CreateAndApply(mInject.RegisterDelegate <EndSceneDelegate>(endSceneAddr), EndSceneHandler, "EndScene"); Console.WriteLine("alle done, moep o.o"); Console.ReadKey(); }
public static void Inject() { int procId = ProcessHelper.GetProcessFromProcessName( "game" ); ProcessEdit proc = new ProcessEdit( procId ); if( proc.IsProcessOpen == false ) { Console.WriteLine( "failed to open Shaiya Process" ); Console.Read(); return; } byte[] pat1 = new byte[] { 0x8B, 0xCB, 0x8B, 0xD1, 0xC1, 0xE9, 0x02, 0x8D, 0x43, 0x02, 0x66, 0x89, 0x44, 0x24, 0x20 }; byte[] pat2 = new byte[] { 0xB8, 0x8C, 0x60, 0x00, 0x00, 0xE8 }; byte[] pat3 = new byte[] { 0x8B, 0x54, 0x24, 0x04, 0x0F, 0xB7, 0xC2, 0x3D }; uint Address = proc.FindPattern( pat1, "xxxxxxxxxxxxxxx" ) - 0x38; uint ReturnAddress = Address + 6; uint Address2 = proc.FindPattern( pat2, "xxxxxx" ); uint ReturnAddress2 = Address2 + 5; uint Address3 = proc.FindPattern( pat3, "xxxxxxxx" ); Console.WriteLine( "Address: " + Address + " / " + Address.ToString( "X8" ) ); Console.WriteLine( "ReturnAddress: " + ReturnAddress + " / " + ReturnAddress.ToString( "X8" ) ); Console.WriteLine( "Address2: " + Address2 + " / " + Address2.ToString( "X8" ) ); Console.WriteLine( "ReturnAddress2: " + ReturnAddress2 + " / " + ReturnAddress2.ToString( "X8" ) ); Console.WriteLine( "Address3: " + Address3 + " / " + Address3.ToString( "X8" ) ); proc.Dispose(); mInject = new ProcessInject( Address, procId ); //mInject.WriteBytes( Address2, new byte[] { 0xE9 } ); // *(BYTE *)(Address2) = 0xE9; IntPtr endSceneAddr = mInject.GetObjectVtableFunction( mInject.Read<IntPtr>( Address ), 0 ); mInject.Detours.CreateAndApply( mInject.RegisterDelegate<EndSceneDelegate>( endSceneAddr ), EndSceneHandler, "EndScene" ); Console.WriteLine( "alle done, moep o.o" ); Console.ReadKey(); }
public static void Main( string[] args ) { using( ProcessEdit shaiya = new ProcessEdit() ) { do { Console.WriteLine( "Please start Shaiya.." ); System.Threading.Thread.Sleep( 1000 ); } while( shaiya.OpenProcessAndThread( "game" ) == false ); Console.Clear(); Console.WriteLine( "Shaiya successful attached!" ); Console.WriteLine( "\nPlease enter your desired Charname (the full length!)" ); Console.Write( "Charname: " ); string charname = Console.ReadLine(); if( charname.Length <= 13 ) { Console.WriteLine( "\n\nCharname only contains " + charname.Length + " (max is 13) and is already valid!" ); } else { string validCharname = charname.Substring( 0, 13 ); string patternMask = new string( 'x', 13 ); // all chars must match! byte[] baCharname = System.Text.ASCIIEncoding.Default.GetBytes( validCharname ); uint patLoc = shaiya.FindPattern( baCharname, patternMask ); if( patLoc != 0 ) { string patData = ""; if( patLoc > 0 ) patData = shaiya.ReadASCIIString( patLoc, 13 ); #if DEBUG Console.WriteLine( "[Debug] Pattern Location: 0x{0:X08}", patLoc ); Console.WriteLine( "[Debug] Pattern Data (13 chars): {0}", patData ); #endif Console.Write( "\ntry to update Memory with real name.." ); if( shaiya.WriteASCIIString( patLoc, charname ) == true ) Console.WriteLine( " success!" ); else Console.WriteLine( " failed.." ); } else { Console.WriteLine( "FAILED to find Namestring?" ); } } Console.WriteLine( "\n\nPress any Key to exit" ); Console.ReadKey(); } }