Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //ProdMods
- PlayerSquared - 2019
- uint findInfo(uint startOfs, int lenForIp, int lenForVerify, byte[] findIp, byte[] verifyIp)
- {
- byte[] search = PS3.Extension.ReadBytes(startOfs, lenForIp);
- int findIpPos = 0;
- while (true)
- {
- findIpPos = findBytes(search, findIp, findIpPos);
- if (findIpPos != -1)
- {
- byte[] searchVerify = PS3.Extension.ReadBytes(startOfs + (uint)findIpPos, lenForVerify);
- int findVerifyIpPos = findBytes(searchVerify, verifyIp, 0);
- if (findVerifyIpPos != -1)
- {
- return startOfs + (uint)findIpPos;
- }
- else
- {
- findIpPos += findIp.Length;
- }
- }
- else
- {
- return 0x00;
- }
- }
- }
- int findBytes(byte[] haystack, byte[] needle, int start_index)
- {
- int len = needle.Length;
- int limit = haystack.Length - len;
- for (int i = start_index; i <= limit; i++)
- {
- int k = 0;
- for (; k < len; k++)
- {
- if (needle[k] != haystack[i + k]) break;
- }
- if (k == len) return i;
- }
- return -1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement