QuasarDonkey wrote:If you tried to patch code in a running program, it would crash out. This is because the memory is protected from being overwritten. But we can change the properties in Trek.exe to make the code writable, so we can patch it while it's running. Basically, all we need to do is patch a single byte in Trek.exe. You could use special tools, like CFF Explorer, but I'll just tell you which byte to set in trek.exe:
You meant to change 60 to E0 (20 = executable, 40 = readable, 80 = writable), but CFF Explorer is a great tool, thx!
I now interated this with the mpr++
Extension Adapter I'm working on and it works perfect!
Beside "Monkey Patching" (funny term) the way described, which is great to completely replace a function, I also added to patch the actual call or jmp statement so other references to same old code location aren't affected.
I just hope all this won't result in troubles with anti-virus software or such.
Added your example for galaxy generation and it works fine.
Once, with UDM at max tech many races, it freezed on galaxy generation. But that's the usual trouble with not finding enough room for all starting systems I guess. Maybe some anomalies were placed aside home system or whatever.
QuasarDonkey wrote:This should allow for some interesting patches, with no need to modify Trek.exe.
Indeed, and it allows to switch features on and off again without fiddling with trek.exe all the time.
Any chance to see you back on this?