Page 1 of 3

SLAM Hook

Posted: Fri Jan 18, 2019 12:13 am
by Justagai
EDIT: Jeremy has created a SLAM hook, see below.

Appears to be in XWA after all, just dormant.

Addresses of where its accessed:

0042C6F9
00473F6E
004908B7
00490941

SLAM input is in field F6 (2 bytes) in the Craft Instance pointer

I will eventually either implement this in the multiplayer hook or a separate hook with using some key to access the SLAMS. But if Jeremy or someone else wants to give it go for it, then this should help.

Re: SLAMS

Posted: Fri Jan 18, 2019 12:20 am
by Phoenix Leader
Missile Boats reaching 426 MGLT?
That would be awesome!

N to target the next buoy.
I'm afraid the only free letter is K.

Re: SLAMS

Posted: Fri Jan 18, 2019 4:22 am
by Bman
Awesome! We need this for TFTC. :-)

Re: SLAMS

Posted: Fri Jan 18, 2019 3:34 pm
by Darksaber
Hmm.... Nice find, I hope it works, and it's not just a remanent from the older Tie Fighter engine

Re: SLAMS

Posted: Fri Jan 18, 2019 4:23 pm
by Rookie_One1
What if it's remnant that works ? :p

Re: SLAMS

Posted: Fri Jan 18, 2019 5:56 pm
by DTM
...what is "SLAMS"?

Re: SLAMS

Posted: Fri Jan 18, 2019 6:10 pm
by Phoenix Leader
SLAM=SubLight Acceleration Motor (https://starwars.wikia.com/wiki/SubLigh ... tion_Motor )

It was a system available for the Missile Boat in TIE Fighter.

Re: SLAMS

Posted: Fri Jan 18, 2019 8:12 pm
by JeremyaFr
Hello,
Here is a hook that enables the SLAM system. Thanks Justagai for the idea.
I've mapped the SLAM command to the K key.

In the current version, all crafts have SLAM. I will add a section in the ini file to define which ships have SLAM.
Done

Re: SLAM Hook

Posted: Fri Jan 18, 2019 8:21 pm
by Darksaber
Wow it actually works lol :D

Re: SLAM Hook

Posted: Fri Jan 18, 2019 9:48 pm
by Phoenix Leader
All fighters SLAM capable would be awesome!

Re: SLAM Hook

Posted: Fri Jan 18, 2019 10:29 pm
by Jaeven
Great work. Makes you wonder what other features are hidden in the game.
Phoenix Leader wrote:
Fri Jan 18, 2019 9:48 pm
All fighters SLAM capable would be awesome!
Not sure that would fit lore wise.

Re: SLAM Hook

Posted: Fri Jan 18, 2019 11:02 pm
by Driftwood
No, it definitely would not work lore wise. Missileboat and k-wing as far as I know are the only ships canonically equipped with it. One possible exception is the assault gunboat since FFGs has the slam action, and disney considers that canon. However the ffg gunboat pretty much retains the missileboat out of existence at this point and fills both rolls depending on the hardpoint modules installed.

If there were variable speed "slams" you could interpret them as booster equipped ships ala SWG, or a modification to the T70 ala TLJ.

I'm glad we finally have this function though since it was one of the only things missing relative to TIE fighter.

As an aside I still wonder what the cluster mine function is supposed to do.

Re: SLAM Hook

Posted: Sat Jan 19, 2019 12:17 am
by Justagai
JeremyaFr wrote:
Fri Jan 18, 2019 8:12 pm
Hello,
Here is a hook that enables the SLAM system. Thanks Justagai for the idea.
I've mapped the SLAM command to the K key.

In the current version, all crafts have SLAM. I will add a section in the ini file to define which ships have SLAM.
xwa_hook_slam.zip
Awesome! :D


It may be possible that the variable that controls what craft have SLAMS is still in the game (although I think I would have seen something like that if that was the case in the code). But it can be controlled by an ini file as well (probably would be better that way as its easier to modify).

Re: SLAM Hook

Posted: Sat Jan 19, 2019 5:03 pm
by JeremyaFr
UPDATE
I've updated the hook.

I've added a section named "[Slam] in the per craft ini file with a value named "HasSlam".
Set HasSlam = 1 to enable the SLAM on a ship.

The hook will also display a message when the player craft has no SLAM system ("Your craft does not have a [SLAM] system") and when the SLAM is activated ("Engine overdrive boosters [engaged]"). The messages come from the "strings.txt" file and are translated is a "XWA.TAB" file exists.

Please redownload xwa_hook_slam.zip
Justagai wrote:
Sat Jan 19, 2019 12:17 am
It may be possible that the variable that controls what craft have SLAMS is still in the game (although I think I would have seen something like that if that was the case in the code).
Nowhere in the exe the SLAM is activated. There is no variable that controls which craft have SLAMS.

Re: SLAM Hook

Posted: Sat Jan 19, 2019 5:30 pm
by Fek'LeyrTarg
First of all, congratulations to both of you for finding and reactivating the code for the SLAM system.
Before the hooks came about 4 years ago, I had never thought it was possible to reintroducde the SLAM system in XWA.
Excellent work.

I guess you're probably aware of this already, but I'd like to report these minor issues anyways.
The first one is that you currently can't deactivate the SLAM system manually, so you have to wait until the laser capacitor has drained out.
The second one is a missing power up sound effect when activating the SLAM system. The shut down one works properly though.

Again, well done. I can't tell you how excited I am to see that feature finally returning to XWA. :)

Re: SLAM Hook

Posted: Sat Jan 19, 2019 9:19 pm
by JeremyaFr
I've updated the hook.
Now, a second press on K will disengage the SLAM system.

Re: SLAM Hook

Posted: Sun Jan 20, 2019 12:18 am
by Bman
Thanks! :-)

Re: SLAM Hook

Posted: Sun Jan 20, 2019 9:44 am
by Darksaber
Thanks Jeremy :) works really great :)

Just looking through in the readme, at the bottom in the Credits, I just see your name shouldn't Justagai's name be on there too, for finding the offsets and the idea?

Sorry if I'm stepping on toes here :)

Re: SLAM Hook

Posted: Sun Jan 20, 2019 1:00 pm
by JeremyaFr
You're right.
I've added Justagai to the readme's credits section.

Re: SLAM Hook

Posted: Sun Jan 20, 2019 1:27 pm
by Darksaber
:D :2thumbs:

Re: SLAM Hook

Posted: Fri Jan 25, 2019 10:46 pm
by ual002
SWEET MOTHER OF GOD.

[Happy Cries in Imperial]

Re: SLAM Hook

Posted: Fri Jan 25, 2019 10:50 pm
by ual002
I would imagine one of those TIE Booster/ TIE Experimental M5 would probably have the SLAM too. Just a guess, I have no evidence to back that up.

Re: SLAM Hook

Posted: Sun Jan 27, 2019 8:08 am
by Justagai
If you want to add sound to the SLAM activation/deactivation:

In slam.cpp:

Code: Select all

int SlamHook(int* params)
{
	params[-1] = 0x004FDBFF;

	const int playerIndex = params[76];
	const int objectIndex = params[69];

	XwaObject* XwaObjects = *(XwaObject**)0x007B33C4;
	const auto ShowMessage = (void(*)(int, int))0x00497D40;
	const auto PlaySoundFromObject = (void(*)(int, int, int))0x0043BF90;		//added

	const unsigned short modelIndex = XwaObjects[objectIndex].ModelIndex;
	int hasSlam = modelIndex == 0 ? 0 : g_modelIndexSlam.HasSlam(modelIndex);

	if (hasSlam == 0)
	{
		XwaObjects[objectIndex].pMobileObject->pCraft->IsSlamEnabled = 0;

		// MSG_NOT_EQUIPPED_SLAM
		ShowMessage(294, playerIndex);
	}
	else
	{
		if (XwaObjects[objectIndex].pMobileObject->pCraft->IsSlamEnabled)
		{
			XwaObjects[objectIndex].pMobileObject->pCraft->IsSlamEnabled = 0;

			// MSG_OVERDRIVE_OFF
			ShowMessage(372, playerIndex);
			PlaySoundFromObject(0x95, 0xFFFF, playerIndex);		//added, play sound 0x95 in player cockpit
		}
		else
		{
			XwaObjects[objectIndex].pMobileObject->pCraft->IsSlamEnabled = 1;

			// MSG_OVERDRIVE_ON
			ShowMessage(371, playerIndex);
			PlaySoundFromObject(0x92, 0xFFFF, playerIndex);		//added, play sound 0x92 in player cockpit
		}
	}

	return 0;
}
In hooks.h:

Code: Select all

static const HookPatchItem g_slamPatch[] =
{
	{ 0x100DB3, "19", "00" },
	{ 0x100D5E, "26", "19" },
	{ 0x100CF8, "AEC14F00", "74185000" },
	{ 0x100C72, "5F5E5B8BE55DC3", "EB10E8A7720A00" },
	{ 0x8FDA1, "82", "95" },		//added, plays sound 0x95 when cannons are empty from SLAMS

};
This will allow sounds to be played from both activation and deactivation of SLAMS, as well as the deactivation sound when cannons are empty.

EDIT: I choose sounds 0x92 and 0x95 for the activation and deactivation as I feel it sounds the best for SLAMS but if you feel there are better sounds for it then feel free to change them.

EDIT 2: Ah the sounds have changed with the darksaber upgrade pack. I'll gather another set.

EDIT 3: I recommend using sounds 0x23 for activation and 0x21 for deactivation for SLAMS in the DSUCP, but up to you folks.

Re: SLAM Hook

Posted: Sun Jan 27, 2019 8:36 am
by Darksaber
I can change them back to the default sounds if that helps, just let me know what the actual names of the sounds are, it doesn't bother me that the sounds will be the default sounds :D :D

Re: SLAM Hook

Posted: Sun Jan 27, 2019 9:04 am
by Justagai
To be honest, I'm not sure of what the exact names are...but here are some videos that can help identify them:

Vanilla SLAM Sounds: https://1drv.ms/v/s!AoEpIrw6LOkUjcdARFgJ8Q_oVRwJAA

DSUCP SLAM Sounds: https://1drv.ms/v/s!AoEpIrw6LOkUjcdBeBSMgw_cH3YjNQ

EDIT: I think I like the DSUCP sounds way more, too bad they aren't in the original :(

EDIT 2: I believe the vanilla sounds are one of the hangar entry in and out, the DSUCP sounds are explosions I think