SLAM Hook

A Forum dedicated to the Suggestion, Creation and Editing of XWA Dynamic Link Library Files

Moderators: Darksaber, General_Trageton, Forceflow, JeremyaFr, DTM

SLAM Hook

Justagai
Cadet 1st Class
Posts: 206
Joined: Mon Dec 08, 2014 10:59 pm

Post by Justagai » Fri Jan 18, 2019 12:13 am

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.
Last edited by Justagai on Sat Jan 19, 2019 12:34 am, edited 3 times in total.

User avatar
Phoenix Leader
Ensign
Rebel Alliance
Posts: 294
Joined: Wed Aug 08, 2018 2:20 pm

Post by Phoenix Leader » Fri Jan 18, 2019 12:20 am

Missile Boats reaching 426 MGLT?
That would be awesome!

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

Bman
Lieutenant JG
Posts: 672
Joined: Mon Apr 05, 2004 11:01 pm

Post by Bman » Fri Jan 18, 2019 4:22 am

Awesome! We need this for TFTC. :-)
W-I-P: ISD-II, XQ-1 Platform1, (Imp) Escort Carrier, Misc, & TFTC.

User avatar
Darksaber

Fleet Admiral (Administrator)
Posts: 10168
Joined: Mon Jan 10, 2000 12:01 am
Contact:

Post by Darksaber » Fri Jan 18, 2019 3:34 pm

Hmm.... Nice find, I hope it works, and it's not just a remanent from the older Tie Fighter engine
“You can please some of the people all of the time, you can please all of the people some of the time, but you can’t please all of the people all of the time”.”
- John Lydgate

Good Things Come To Those Who Wait....
Darksaber's X-Wing Station

Rookie_One1
Lieutenant Commander
Rebel Alliance
Posts: 1296
Joined: Thu Feb 26, 2004 12:01 am

Post by Rookie_One1 » Fri Jan 18, 2019 4:23 pm

What if it's remnant that works ? :p
Rookie One, is that you?? - Ru Merleen, Rebel Spy at Imdaar Alpha
Current Holder of the Frying Pan of Death

User avatar
DTM
Lieutenant Commander
XWAU Member
Posts: 1278
Joined: Tue Apr 22, 2003 11:01 pm
Contact:

Post by DTM » Fri Jan 18, 2019 5:56 pm

...what is "SLAMS"?

MTD industries
WIPs: Fixing missions and new editing for the REBCP, Resistance Mon Calamari Cruiser, New advanced base OPT files for all playable XWAUP crafts.

User avatar
Phoenix Leader
Ensign
Rebel Alliance
Posts: 294
Joined: Wed Aug 08, 2018 2:20 pm

Post by Phoenix Leader » Fri Jan 18, 2019 6:10 pm

SLAM=SubLight Acceleration Motor (https://starwars.wikia.com/wiki/SubLigh ... tion_Motor )

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

JeremyaFr
Lieutenant Commander
XWAU Member
Posts: 1470
Joined: Mon Jan 18, 2010 5:52 pm
Contact:

Post by JeremyaFr » 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.
Done
Last edited by JeremyaFr on Sat Jan 19, 2019 4:53 pm, edited 2 times in total.

User avatar
Darksaber

Fleet Admiral (Administrator)
Posts: 10168
Joined: Mon Jan 10, 2000 12:01 am
Contact:

Post by Darksaber » Fri Jan 18, 2019 8:21 pm

Wow it actually works lol :D
“You can please some of the people all of the time, you can please all of the people some of the time, but you can’t please all of the people all of the time”.”
- John Lydgate

Good Things Come To Those Who Wait....
Darksaber's X-Wing Station

User avatar
Phoenix Leader
Ensign
Rebel Alliance
Posts: 294
Joined: Wed Aug 08, 2018 2:20 pm

Post by Phoenix Leader » Fri Jan 18, 2019 9:48 pm

All fighters SLAM capable would be awesome!

User avatar
Jaeven
Ensign
Galactic Empire
Posts: 353
Joined: Mon Mar 30, 2015 3:18 am

Post by Jaeven » Fri Jan 18, 2019 10:29 pm

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.

User avatar
Driftwood
Lieutenant Commander
XWAU Member
Posts: 1598
Joined: Wed Oct 22, 2003 11:01 pm
Contact:

Post by Driftwood » Fri Jan 18, 2019 11:02 pm

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.

Justagai
Cadet 1st Class
Posts: 206
Joined: Mon Dec 08, 2014 10:59 pm

Post by Justagai » Sat Jan 19, 2019 12:17 am

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).

JeremyaFr
Lieutenant Commander
XWAU Member
Posts: 1470
Joined: Mon Jan 18, 2010 5:52 pm
Contact:

Post by JeremyaFr » Sat Jan 19, 2019 5:03 pm

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.

Fek'LeyrTarg
Cadet 1st Class
Posts: 220
Joined: Mon Mar 03, 2008 12:01 am

Post by Fek'LeyrTarg » Sat Jan 19, 2019 5:30 pm

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. :)
Last edited by Fek'LeyrTarg on Sat Jan 19, 2019 9:23 pm, edited 1 time in total.

JeremyaFr
Lieutenant Commander
XWAU Member
Posts: 1470
Joined: Mon Jan 18, 2010 5:52 pm
Contact:

Post by JeremyaFr » Sat Jan 19, 2019 9:19 pm

I've updated the hook.
Now, a second press on K will disengage the SLAM system.

Bman
Lieutenant JG
Posts: 672
Joined: Mon Apr 05, 2004 11:01 pm

Post by Bman » Sun Jan 20, 2019 12:18 am

Thanks! :-)
W-I-P: ISD-II, XQ-1 Platform1, (Imp) Escort Carrier, Misc, & TFTC.

User avatar
Darksaber

Fleet Admiral (Administrator)
Posts: 10168
Joined: Mon Jan 10, 2000 12:01 am
Contact:

Post by Darksaber » Sun Jan 20, 2019 9:44 am

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 :)
“You can please some of the people all of the time, you can please all of the people some of the time, but you can’t please all of the people all of the time”.”
- John Lydgate

Good Things Come To Those Who Wait....
Darksaber's X-Wing Station

JeremyaFr
Lieutenant Commander
XWAU Member
Posts: 1470
Joined: Mon Jan 18, 2010 5:52 pm
Contact:

Post by JeremyaFr » Sun Jan 20, 2019 1:00 pm

You're right.
I've added Justagai to the readme's credits section.

User avatar
Darksaber

Fleet Admiral (Administrator)
Posts: 10168
Joined: Mon Jan 10, 2000 12:01 am
Contact:

Post by Darksaber » Sun Jan 20, 2019 1:27 pm

:D :2thumbs:
“You can please some of the people all of the time, you can please all of the people some of the time, but you can’t please all of the people all of the time”.”
- John Lydgate

Good Things Come To Those Who Wait....
Darksaber's X-Wing Station

User avatar
ual002
Ensign
Galactic Empire
Posts: 404
Joined: Wed Sep 24, 2008 2:23 am

Post by ual002 » Fri Jan 25, 2019 10:46 pm

SWEET MOTHER OF GOD.

[Happy Cries in Imperial]
For the glory of his majesty Emperor Palpatine! Image Image

User avatar
ual002
Ensign
Galactic Empire
Posts: 404
Joined: Wed Sep 24, 2008 2:23 am

Post by ual002 » Fri Jan 25, 2019 10:50 pm

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.
For the glory of his majesty Emperor Palpatine! Image Image

Justagai
Cadet 1st Class
Posts: 206
Joined: Mon Dec 08, 2014 10:59 pm

Post by Justagai » Sun Jan 27, 2019 8:08 am

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.

User avatar
Darksaber

Fleet Admiral (Administrator)
Posts: 10168
Joined: Mon Jan 10, 2000 12:01 am
Contact:

Post by Darksaber » Sun Jan 27, 2019 8:36 am

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
“You can please some of the people all of the time, you can please all of the people some of the time, but you can’t please all of the people all of the time”.”
- John Lydgate

Good Things Come To Those Who Wait....
Darksaber's X-Wing Station

Justagai
Cadet 1st Class
Posts: 206
Joined: Mon Dec 08, 2014 10:59 pm

Post by Justagai » Sun Jan 27, 2019 9:04 am

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

Post Reply