kb1
Forum Regular
Posts: 954
Registered: 11-06 |
Quasar said:
2. You didn't read the readme did you? ;) Demo sync is not quite there yet. -nomonsters demos sync, but one or more functions being called by monsters or NPCs on Tarnhill have at least one line of code wrong amongst them which will have to be found. I've already gone through thousands of lines of code looking for the discrepancy and so far, no luck.
I've got an idea how to find the desyncs, but it requires hacking the original exe (which you're a pro at now...)
1. Modify the P_Random function in the original exe (by jumping to a currently-unused area where your new code resides) to pop the return address off the stack, and write it to a file, along with the current game tic.
2. Make a list of ALL the return addresses and to which function they correspond to.
3. In your new source code, Modify P_Random(void) to be P_Random(int), and, each time it is called, include the corresponding address into the P_Random() statement, like P_Random(2240318).
4. Modify the P_Random (in the new source code) function itself, to make it write a file just like above.
Now, run both the hacked original, and the new game. If both games are in sync, these files should be identical. If not, they will almost invariably be different, and the difference should point you very close to the source of the desync.
It sounds like B.S., but it definitely works. The stub code might look something like this:code: asm
{
P_Random:
; (this overwrites the original P_Random code)
JP DesyncCheck
TempStorage:
DW 0000
DW 0000
...
}
asm
{
DeSyncCheck:
; place this into an unused portion of the exe
POP EAX ; get return address
PUSH EAX ; put it back
MOV (TempStorage), EAX ; store it
}
{
f = fopen("sync.txt", "w")
fprintf(f, "tic %i, addr %i\n", gametic, *TempStorage);
fclose(f);
}
' insert the original P_Random code here
...
return;
By the way, excellent work, guys! This is truly awesome!
|