wghost81 Posted October 18, 2014 Share Posted October 18, 2014 tracktwo, understood. Yes, I was concerned about an order of dialogs, but since it turns out that devs already messed it up, your fix is the perfect solution here. Link to comment Share on other sites More sharing options...
tracktwo Posted October 18, 2014 Share Posted October 18, 2014 Yeah I was a little worried about the order too, but it turns out that it's exactly the same (wrong) order as before. It doesn't really matter too much, I don't think, because they aren't strictly ordered anyway - does it really matter if you see the Gauss Carbine before or after the Rifle? Next up on my annoying list is the very loud overwatch-all command. Fixing that is going to be tedious, I think. The cue is actually played from the ridiculously enormous switch statement in XGAbilityTree.ApplyEffectsToTarget(). The number of jump offsets in that function is just crazy. The only real way I can see to fix this is to set a flag in ForceOverwatch() that ApplyEffectsToTarget queries and will not play the sound if it's set. But I may not get around to that one for a while because it's going to be such a pain. I can probably just snip out the existing case for overwatch and move it to a new function, then overwrite the first few bytes of the case with a call to that function and a jump, and leave the rest as-is so I don't have to touch any offsets in that function. Or do you know if anyone else has already looked into this? Link to comment Share on other sites More sharing options...
wghost81 Posted October 18, 2014 Share Posted October 18, 2014 No, I haven't yet looked into this myself and I doubt anyone else did. Link to comment Share on other sites More sharing options...
TRekNexus Posted October 18, 2014 Author Share Posted October 18, 2014 (edited) Wow, I never imagined this thread would take off like it did. I don't have much constructive to add except say great job all youse :smile: Edited October 18, 2014 by TRekNexus Link to comment Share on other sites More sharing options...
tracktwo Posted October 18, 2014 Share Posted October 18, 2014 LiQuiD911: I missed your post earlier. I believe the resize value needs to be the full size of the object. Exactly how big this will be depends on the size of the default parameters you put in the object. If you don't add any, and I don't think they are needed, the full size will be 4 (link) + 8 (name "none" to end the empty default list) + ogg size + 0x50 bytes for the native data structure. The object data itself needs to be: the 4 byte link (skip it with rel + 4), name <none>, 12 bytes of 0, the absolute offset, 4 bytes of 0, size of ogg as 4 byte little endian value, size of ogg as 4 byte little endian value again, absolute offset, ogg data, 12 bytes of 0, absolute offset, 12 bytes of 0, absolute offset, 12 bytes of 0, absolute offset. The absolute offset can be written by patchupk. I forget the key to use in the file and can't easily look it up on my phone, but it should be back in a much earlier post in this thread. Link to comment Share on other sites More sharing options...
tracktwo Posted October 19, 2014 Share Posted October 19, 2014 OK, I started work on the overwatch fix. I made it so it played only one copy of the "overwatch" sound effect, but kept the voice announcements as they were. The overlapping sounds of everyone saying their cue doesn't seem to increase the volume significantly, I guess because it's a bunch of different cues playing instead of the same one repeatedly. But the trouble is, now the overwatch sound effect is too quiet. You can't really hear it over the sound of everyone playing their "on overwatch" sounds :smile: For a long time I thought it was bugged and wasn't working, but I put my headphones on and cranked the volume up and I could hear it underneath everything else. I'll experiment with playing maybe 2 or 3 copies of the sound to see if I can get it at a decent level compared to the audio cues. This was pretty tricky to implement. Setting a flag in ForceOverwatch() for ApplyEffectsToTarget() was not that easy because I can't just add a new flag instance variable to XComTacticalCheatManager. Doing so crashes the game, perhaps because its size has changed but other scripts aren't aware of this? I ended up stealing one of the existing ones for temporary use, there are a bunch of debugging flags there. The other issue was how to add all my new code without having to entirely rewrite the enormous ApplyEffectsToTarget() or having to manually update dozens of jump offsets. Originally I thought about making an entirely new function to hold my new code, but I couldn't figure out how to do this with PatchUPK. I ended up resizing the function and putting all my new code at the end, after the return. Then at the point where I need to make my patch I overwrite it with a jump beyond the return, execute the new code, and then jump back to where I jumped out. It's still a huge pain to do manually, but it avoids having to recalculate any jump offsets. Link to comment Share on other sites More sharing options...
wghost81 Posted October 19, 2014 Share Posted October 19, 2014 (edited) tracktwo, technically, you can add a new functions with Patcher, but they won't work. :smile: Haven't yet found out why, needs more R&D. New variables and new name table entries are working, but new functions and new import entries are crashing the game when called. Edited October 19, 2014 by wghost81 Link to comment Share on other sites More sharing options...
tracktwo Posted October 19, 2014 Share Posted October 19, 2014 Yes, I noticed the crashes :smile: It was interesting because it also failed to figure out the size correctly. PatchUPK claimed the new size of the function was roughly negative 10GB. Not being able to add new instance variables is a pain. I can borrow the debug variables from XComTacticalCheatManager but I'd rather use fresh ones if possible so they won't interfere with any existing functions in case people are using them. Has anyone managed to add new ones yet? It seems funny that changing the object size would matter since so much of unrealscript seems to be dynamic, so I'm hopeful that I just did something wrong and this should work. But, there is a lot that I don't yet understand about the execution model. Link to comment Share on other sites More sharing options...
wghost81 Posted October 19, 2014 Share Posted October 19, 2014 (edited) That's probably because you haven't edited object properties after creating it. Patcher won't do this for you, it'll just link an object to parent and add an empty default properties list. I can make a new function and game loads it correctly, but when I try to actually call the new function, the game crashes. Don't know why yet. But new variables do work, both local and members. See mutator enabler upk patch for working examples. It adds a new dynamic configurable member array and a couple of local variables. There is one problem, though. New vars are not working under Linux. New names do, but new vars cause a CTD on loading package. Edited October 19, 2014 by wghost81 Link to comment Share on other sites More sharing options...
tracktwo Posted October 19, 2014 Share Posted October 19, 2014 (edited) Thanks WGhost, that fixed it. I'm a little torn because I find playing two copies slightly too loud (but not nearly as loud as playing all the copies) but one is not quite loud enough. It is very easy to adjust to taste, so I put a comment in the description with a pointer to the value to change. Here's the script to reduce overwatch-all loudness (EDIT: attached so it doesn't eat the special characters) (EDIT2: Updated to use WGhost's alias suggestion. Change the number in the ALIAS line near the top of the file from 2 to the desired value to adjust the volume) Edited October 20, 2014 by tracktwo Link to comment Share on other sites More sharing options...
Recommended Posts