This Trainer is for the 1998 GoG re-release of Star Wars: X-Wing by LucasArts.
It has three different options...
Infinite Mission Clock
Infinite Torpedoes
Infinite Shields
The trainer, as well as my CT file and a txt with the memory locations used are available at my github page below [Link]
I wasn't setting out to build my own, but I couldn't find any additional trainers for this game. This is my first trainer, so please be gentle with me.
On second look, some of the memory addresses seem to be changing randomly from mission to mission, and setting the wrong address can result in unexpected behavior. I'm working on a fix, but it may take me a few days.
Hey, so posting this here as much for my info as anyone else.
As OP mentioned, the game changes what addresses are used for stuff each time you restart the game. The good news is that I've done some digging, and I've determined a surefire way to get the addresses for your ship's shields each time:
1) Start the game as normal, then enter any mission
2) As soon as the 3-D mode starts, run a scan for the following 4-byte starting shield values, depending on which ship you're flying (you can do this as you're hyperspacing in):
Y-Wing: 245763750
B-Wing: 327685000
A-Wing -OR- X-Wing: 163842500
Done. There will be only ONE address shown, and that's your target. You can now add the address to your list and change it as desired, set it to overcharged (up to twice the posted values), or set it to infinite and ram all the enemy fighters to death for fun and profit. And so long as you search for those specific values at the start of a mission, you will find the correct address every time. Only real bug I've seen in-mission with infinite shields is sometimes the shield will remain white if you take too many hits at once, but it always self-corrected after 4-5 seconds of no more hits, and it's purely graphical anyway; I was still able to kamikaze the TIEs to my heart's content (though you'll have to find hull values to prevent "heavy" stuff like shuttles and gunboats from kamikaziing you like they like to!) The value doesn't change when the game's paused, either, so you have that leeway to set it, too.
If you accidentally change the shield value in-game before getting the address, just overcharge your shields to max, then search for double the value posted above, and you should be fine.
I imagine you could do similar for missile counts if you wanted, though I'm fine with pretending to *be* a missile, myself, so haven't bothered looking.
That's the good news. There is bad news, however, is that scripting it is WAY trickier then manually messing with stuff:
I suspect it's possible to write a "ship blind" script that just searches for all 3 values on game startup and just have it constantly check until it finds all 3; I've yet to see any of those values appear in the code outside of combat, and only 1 ever appears in the mission itself.
However, because of the way the game was designed, the shield's address is often used for other things when not in an actual mission. And quite often, if you've "frozen" it to give yourself infinite shields in the mission, this causes the game to lock up since it tries to assign a new value to the address for the after-mission cutscenes and can't.
So if you freeze the value for infinite shields during a mission, you MUST turn it back off before the mission ends, either via timer or hyperspace. So whatever script you make needs to constantly check if the timer is about to hit 0:00 AND if the player hits the H key during a mission and disable Infinite Shields if it's set. That last one is especially tricky since the game can abort a hyperspace if crap's in the way, leaving the player a sitting duck without infinite shields if not careful.
I imagine someone wanting to code up a script for this could make it so that, when the script disables the infinite shields portion for the mission ending, it also sets shields to 200% as a precaution in case hyperspace is aborted. Then just create a hot-key and make a tone any time Infinite Shields are turned off to remind the player to turn it back on after the abort. A bit finicky for the user, but the easiest bit to code that's the most reliable, I think.
As far as making it fully self-automated...that's gonna require digging into the code and figuring out in-mission values for the "Hyperspace" sequence (star stretch, shot of the given ship zooming away, etc), and considering that the addresses change each startup, you'd have to search for values instead of specific addresses, which entails knowing what the values would be in the first place...yeah, not a pleasant prospect, but good luck to whoever wants to try.
Unfortunately, sadly, this doesn't grant you Invulnerability. For one, colliding with "big" stuff - capital ships, cruisers, transports, shuttles, etc - will still lead to instant death (makes sense when you consider that the in-game Collision Damage "cheat" is separate from Invulnerability). Further, due to Cheat Engine's polling delay and the fact this game calculates damage in near-real-time, you can still take hull damage if the game calculates that your shields would've been overwhelmed by the damage you just took.
Fortunately, I've discovered that you can "ober-boost" your shields beyond the game's intended max value as added insurance: after finding the right address, just replace the 4-byte value of the given ship's shield address with 819212500 (5x the starting X-wing/A-wing shield value) in addition to "locking" it with CE, and your shields will be way tougher then normal, and possibly enough that CE can refill them faster then the game can knock them down, granting you true invulnerability! And yes, this value is universal to all 4 fighters, and was thoroughly tested: I went to a mission that had 20 enemy fighters at a time vs my X-wing (Tour 2, Mission 8 if you're curious) and let them just tattoo my ass, and they couldn't break through faster then CE could restore them to the new max. I actually ran the timer down without a single scratch to my hull's paint.
I wouldn't recommend experimenting further with this value, though: putting all 9s - or even 1 or 2 less - results in losing all your shields, and certain values are used to calculate your shields at different "uneven" states (0 shields in front, 200% in back, for example), so you'll get the opposite of progress if you try to go further then what I've posted.
SIDE NOTE ON HULL:
I've discovered what I think is the faint start of the thread that can lead to infinite hull strength: if you go into Historic Training mission "X-Wing Mission 3" and search for and lock 4-byte value 19662, you'll then find that you're almost invulnerable even without shields (the above rules for collision and overwhelming damage still apply, and you'll still receive sub-system/cockpit damage).
Unfortunately, the value changes from mission to mission, even between the same ship types, so this is not the "true" hull value like the shields I posted previously. Further the way the game calculates hull damage is unintuitive - if you test the value in the mission, you'll see that it actually increases! This most likely is part of the game's way of randomly calculating whether each hull hit damages a sub-system, makes your R2 unit scream, etc.
Due to these factors, it's nearly impossible to find the value for other ships or in other missions. Someone more skilled will have to go in and backtrace from the value I found if we want to have infinite hull values.