Jump to content

Photo

Expanding function size in UPK


  • Please log in to reply
61 replies to this topic

#1
wghost81

wghost81

    Wasteland Ghost

  • Premium Member
  • 7,741 posts
Good news: I was able to successfully expand function size by moving it to the end of UPK file and changing corresponding parameters of ExportObjectList in UPK header. No more size limitations! Hooray! :smile:

Right now I have a set of console utilities to work with upk files: extract information, patch upk, move and expand function. I plan on releasing those (with sources) asap after I perform a little more testing to make sure I didn't made some stupid mistakes. :smile: Stay tuned! :wink:

Edited by wghost81, 08 December 2013 - 08:56 AM.


#2
Amineri

Amineri

    Resident poster

  • Premium Member
  • 3,927 posts

That is some awesome news.

 

One issue I'm curious about is how such changes are going to be handled when a patch is released and mods have to be updated. Because of this I'm thinking that it may generally be safer to not change function size.

 

Sometimes I admit that it is a hugely painful limitation. Generally the way I've gotten around it when needed is by finding and taking over unused functions to use as helpers.

 

Definitely very interested in seeing your utilities, though! ^_^



#3
wghost81

wghost81

    Wasteland Ghost

  • Premium Member
  • 7,741 posts
Well, patch will mess things up, sure. But at this point I don't think it's a problem, because mod "sources" are usually a set of changes, applied to set of functions. And if function still exist, there is no problem in moving it to new upk end again. I made an alternative UPK patcher, which is fully compatible with ToolBoks custom mod format, plus supports before/after style, plus allows to patch functions by name with no need to know it's offset. So patching will look like "find name.function, move and expand, apply code changes". No problems. :smile:

PS I was thinking about expanding GetSupportingAlien when I was at it... Just imagine all the new crazy combinations... :smile:

Edited by wghost81, 08 December 2013 - 08:54 AM.


#4
dreadylein

dreadylein

    Enthusiast

  • Members
  • PipPip
  • 226 posts

Nice one ;)



#5
Neonin

Neonin

    Fan

  • Supporter
  • PipPipPip
  • 410 posts

Does that work if you move/expand more than one function to the end of a UPK?

 

Either way that's a pretty amazing discovery, considering the amount of time and effort that normally goes into rewriting functions without messing something up!



#6
wghost81

wghost81

    Wasteland Ghost

  • Premium Member
  • 7,741 posts

Does that work if you move/expand more than one function to the end of a UPK?

Yes. Object data are extracted by offset in UPK file. You leave original data where they are, append new data and change offset in objectlist. You can move any number of functions in this manner, as long as you append new data to the end of file.

#7
Bertilsson

Bertilsson

    Old hand

  • Members
  • PipPipPip
  • 616 posts

Is it working together with UE Explorer?



#8
wghost81

wghost81

    Wasteland Ghost

  • Premium Member
  • 7,741 posts
Yes, UE Explorer reads upk correctly.

#9
Bertilsson

Bertilsson

    Old hand

  • Members
  • PipPipPip
  • 616 posts

Then this is truly good news indeed :)

 

Does this also mean that it is possible to insert completely new objects by moving the very first objects to the end of file and thereby making room available for new declarations?



#10
wghost81

wghost81

    Wasteland Ghost

  • Premium Member
  • 7,741 posts

Does this also mean that it is possible to insert completely new objects by moving the very first objects to the end of file and thereby making room available for new declarations?

Theoretically, yes. But this will require a lot of work with rebuilding headers/lists. And there is something about that list order I don't yet understand: there are some references (?) in function header to objectlist, which could be order-sensitive. The problem is, I don't know a thing about first 0x28 bytes of function header, so I can't tell for sure. :sad:

UPD Didn't read correctly: no, you can't make space in objectlist by moving first object, as first object after objectlist is importtlist, so you have to move importlist too. This is doable, but will require a lot of work (see above).

Edited by wghost81, 08 December 2013 - 12:19 PM.





Page loaded in: 0.886 seconds