I've been experimenting with Felk's WIP Python scripting build. Normally you would use CodeWrite to make gecko codes to create a complex mod for a game, such as rewriting the camera behavior. The downsides to gecko are that you have to create the mod using ASM, which can become extremely complex, and it doesn't lend itself to easy editing. You also have to load variables for ASM into dolphin's memory somewhere.
To recreate the capabilities of Gecko ASM mods using Felk's build, I had to add code breakpoint events and register read/writes, which was rather simple to do. Sidenote: I had to remove PowerPC::CheckBreakPoints from JitAsm.cpp, because it's also in Jit.cpp and they both get called, which causes double triggering. It didn't seem to break anything. Not sure on what the proper fix is.
So a mod would look like:
I had some worries that the game would keep running as the python code was executing or that it would lag. Fortunately,
I'm not sure how many people are interested in this? Gecko codes are usable outside of dolphin, but python codes aren't.
To recreate the capabilities of Gecko ASM mods using Felk's build, I had to add code breakpoint events and register read/writes, which was rather simple to do. Sidenote: I had to remove PowerPC::CheckBreakPoints from JitAsm.cpp, because it's also in Jit.cpp and they both get called, which causes double triggering. It didn't seem to break anything. Not sure on what the proper fix is.
So a mod would look like:
Code:
Declare Variables/Constants
Create code breakpoint event listener with 'while True:' loop to inject the mod every time the breakpoint is hit (once per frame)
If breakpoint == code address
Read needed registers
Read needed memory
Edit values using standard python code rather than ASM.
Write registers you want to edit
Write memory you want to edit
Repeat if-statements for other code breakpoints.
I had some worries that the game would keep running as the python code was executing or that it would lag. Fortunately,
- The breakpoints can be log-on-hit, but don't break. So the game never actually stops.
- The async event listener will execute the code before letting the game continue running. So you can be sure your values are injected on the breakpoint
- It doesn't appear to increase lag by a noticeable amount.
I'm not sure how many people are interested in this? Gecko codes are usable outside of dolphin, but python codes aren't.