Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 1.using System;
- 2.using System.Collections.Generic;
- 3.using System.Linq;
- 4.using System.Text;
- 5.
- 6.namespace opcodefinder
- 7.{
- 8. public class Program
- 9. {
- 10. static void Main(string[] args)
- 11. {
- 12. Console.WriteLine("Opcode: ");
- 13. Console.WriteLine(CalcOffsetFromOpcode403(Convert.ToUInt32(Console.ReadLine())));
- 14. Console.WriteLine("Offset: ");
- 15. Console.WriteLine(CalcOpcodeFromOffset403(Convert.ToInt32(Console.ReadLine())));
- 16.
- 17. }
- 18.
- 19. public static uint CalcOffsetFromOpcode403(uint opcode)
- 20. {
- 21. // 4.0.3.13329 (Pseucode)
- 22. // v6 & 3 | ((v6 & 8 | ((v6 & 0x20 | ((v6 & 0x300 | (v6 >> 1) & 0x7C00) >> 2)) >> 1)) >> 1)
- 23. uint offset403a = opcode & 3 | ((opcode & 8 | ((opcode & 0x20 | ((opcode & 0x300 | (opcode >> 1) & 0x7C00) >> 2)) >> 1)) >> 1);
- 24. //return ((offset403a * 4) + 0x560);
- 25.
- 26. return ((offset403a * 4) + 0x560);
- 27. }
- 28.
- 29. public static int CalcOpcodeFromOffset403(uint offset)
- 30. {
- 31. // Count all OFFSETS for OPCODES to 0xFFFF
- 32. for (uint i = 0; i < 0xFFFF; ++i)
- 33. {
- 34. /* Here are additional conditions to calculate the
- 35. * OPCODE from the associated OFFSET.
- 36. */
- 37.
- 38. // Additional condition FROM 4.0.3.13329
- 39. if ((i & 0xCF07) != 0x800)
- 40. {
- 41. if ((i & 0x4D4) == 0x454 && CalcOffsetFromOpcode403(i) == offset)
- 42. return (int)i;
- 43. }
- 44. }
- 45. return -1;
- 46. }
- 47. }
- 48.}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement