#Correct way to revert this for loop
22 messages · Page 1 of 1 (latest)
When your question is answered use !solved to mark the question as resolved.
Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question run !howto ask.
I don't think so, basically imagine it is an encrypt process, I need to decrypt this process, I think what your code is doing is just reapply the encryption starting from the bottom
ah got it sorry
I'm guessing you just need to add back * (int * ) (&DAT_0040f060 + local_20 * 4);
Ok thanks, btw do you think you can guide me on the equivalent of c *(int *)(&DAT_0040f060 + i * 4) not sure if it's the same as DAT_0040f060[i]
DAT_0040f060 is unsigned char array filled with bytes
@gloomy crypt Has your question been resolved? If so, run !solved :)
i think DAT_0040f060 is probably actually an int array
because then instead of *(int *)(&DAT_0040f060 + i * 4) it would be DAT_0040f060[i]
Thanks and very last question :
Is
uVar1 = FUN_004016ff(*(byte *)(local_1c + (int)param_1),
(ushort)*(byte *)((int)param_1 + local_1c + 1));
*(char *)((int)param_1 + local_1c) = (char)uVar1;```
equivalent to :
```c
param_1[local_1c] = FUN_004016ff(param_1[local_1c], param_1[local_1c + 1]);
yes but the use of (int) makes me think it would make more sense to say local_1c[param_1]
it might help if you knew what these represented and could give them names
actually local_1c is the for loop iterator lol (i variable basically)
for (local_1c = 0; local_1c < 0x40; local_1c = local_1c + 2) {
uVar1 = FUN_004016ff(*(byte *)(local_1c + (int)param_1),
(ushort)*(byte *)((int)param_1 + local_1c + 1));
*(char *)((int)param_1 + local_1c) = (char)uVar1;
}``` that's the whole loop
hmmmmmmmmmmmmmmm
param_1 is int *
local_1c uint
FUN_004016ff takes (uint8_t param_1, short param_2)
then no (byte *)(local_1c + (int)param_1) isn't equivalent to param_1[local_1c]
it's ((byte*)param_1)[local_1c]
Yeah I've tried it doesn't change anything, i have no idea why it doesn't work