Posted: Sat Apr 05, 2025 8:14 pm Post subject: Increase weapon range in Warship Gunner 2 in PCSX2?
I have the goal of increasing the range of weapons such as the Tomahawk missile to a realistic range of 100 kilometers plus regardless of the effect on the game balance because I cannot play the game as is because it feels too arcade.
I first thought I could find a table of weapon values in one of the files on the disc itself. I used Ghidra and searched for strings in several of the files and did not find something like I would have expected with the weapon name and then some values like for instance the configuration files for vehicles/weapons/units in the Arma series of games. I have modded other games too but I thought this was a good example.
I then looked into the built-in memory editor in PCSX2 but it does not have the kind of features that cheat engine has.
Then I started with Cheatengine. Where to begin... I first cleared an area with only my ship with a rocket launcher with default range of 5000 (meters probably).
I then launched a rocket and started searching for numbers counting up from zero and I did find a few but I think that was a false lead.
I am able to find an interesting data structure when I search for rocket ammo/open memory viewer/then dissect data. But none of the numbers pertain to weapon range as far as I can tell. Here is an example:
There are 1025 lines but these are the first few that show an ammo breakdown of some of the weapons on the ship. 290 is rockets/4800 is machine gun/192 is torpedoes/80 is depth charges. 2800 and 300 are fairly random and one of the 4800 is the max and one is the actual. None of the other numbers are 5000 or change in a relevant way when I fire a weapon. Curiously main gun ammo is not shown here but is in another data structure with similar fields (that shows main gun ammo on the first line and others following it) but ultimately nothing that seems to affect range.
Where would I go from here? Is doing this to a PS2 game in fact an impossible task? I understand the PS2 has 32MB memory and there are about 1500 characters on a page so it would require reading over 21000 pages of code to look for the place that weapons are being handled by my calculations.
I wanted to give an update on how far I have come and the problems I have run into. I will classify them into successes and failures. The successes are mainly on my part and the failures have mainly been on the part of Cheatengine and PCSX2.
Successes
1. Verify that savestates cleanly reload variables in Cheatengine within an existing PCSX2 instance thus making analyzing variables easier
2. Find weapon memory structures (as noted in first post)
^This was done with searching for all types and specifying the ammo amount and reducing until found (mem_mapped must be checked)
*I should mention the player viewport coordinates happen to be in here also - editing these should move the camera around and increasing and decreasing ammo does work
3. Find the structure that handles player inventory
^This was done with searching for strings in the in the weapon status display
* I did not try to add things but I am pretty sure it works because I have seen cheats for this game that target this specific area
4. Find structure for player ship coordinates
^This was done with the assumption that grid was an xy so moving east found increasing floats and eventually variable and data structure itself
*locking the coordinates will glitch the ship into place but of course the engine control routines are still trying to modify the variable and thus move the ship
5. Find structure of projectile (rocket in this case)
^Since we know ship coordinates the rocket coordinates can be found the same way with the emulator set to 10% speed
* I have not exerted control over the projectiles but I am quite certain these are the relevant data structures. The launcher fires 2 rockets and I can see groups of addresses in 2 different ranges with each having some structures including coordinates of the items in question. I have even used the "watch for changes" and address isolation features to narrow down some variables which may be related to rocket motor burn time. If I can NOP the routines controlling them I can start editing them to see if I can stop or start the rocket motors which will hopefully eventually control range. Did not think I would get this far did you???
Failures
1. Cheatengine "find out" features broken. This did work, inconsistently, at first. Now it does not work even if I use any of the 4 debuggers with any of the preferred (by the way the word "preferred" is misspelled within the Cheatengine settings) breakpoint method with override existing breakpoints turned on. It does not work if I run ceserver as root or not and does not work if I run Cheatengine as root or not. This problem obviously means I cannot continue with this endeavour if this is not fixed.
2. Cheatengine shows no pointers at all. So no hope for reproducability. I have tried the emurpm.frm/emurpm.lua from the PCSX2 forum, the ones from the Cheatengine github, and none at all. Still no pointers. I am not even quite sure what those files do and if they are required are not. Maybe base addresses or "pseudo-pointers" have something to do with all this? I honestly do not understand pointers beyond knowing that they are like a "hyperlink" for memory addresses. Nonetheless I have used them before with success in cheat engine with regular PC games.
3. Cheatengine speed modification feature broken. Just locks up. Cheatengine desperately needs more integration of progress bars and cancel buttons. Use PCSX2 framerate modification instead.
4. Cheatengine data structure analyzer broken. Accidentally clicking "define new structure from debug data" instead of "define new structure" is devastating and causes all unsaved work to be lost. No progress bar, no cancel.
5. Newer PCSX2 use of ASLR means that restarting PCSX2 scrambles the memory addresses in Cheatengine at least without the use of pointers plus PCSX2 debugger is really crap and makes me feel like I am about to send Neo into the matrix with all the flashing symbols on the screen. The old 1.5 PCSX2 version included with my Linux distribution just locks up when attaching the debugger.
So we can see that failure 1 is the biggest stumbling block right now. In theory if someone was knowledeable enough could they bypass the broken "find out" features and somehow deduce what was accessing the code anyway? When I pause the game I suppose that acts as a "breakpoint" because the code in the memory editor stops moving around and I see for instance a "jump" to another memory address where there used to be a variable but when I look at that one it is clear that it would take forever doing that.
While the cheats I have found so far are interesting I do not care because I want to be able to send Tomahawks with impunity U.S. Navy style and then sail off into the sunset job done. I am not interested in PC naval games either because those tend to be made by people that do not make interesting single player missions. They do not feature bosses or enhanced technology or prototypes like in this game either. Since this may be the last post I make on this topic because of the hangups I wanted to mention that I am no superfan of this game and their Japanese-first game design. Those losers of WWII who are still mad about it to this day. Combine this with how hard this game is to modify and the people that made this game can join those battleships resting on the bottom of the ocean as far as I care.
It seems something like this would actually be easier doing it the Ghidra way and working through every single line of code. I suppose you would have to comment it too... If someone would pay me I would learn all that and eventually get to work on it after a few doctorate degrees and scientific papers published. I do not know how much longer I want to fool around with this though because I have varied interests like sports and engineering (real life mechanical stuff) and it would be quicker to build a real battleship than reverse engineer these battleships.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum