Jump to content

Expanding function size in UPK


wghost81

Recommended 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
Link to comment
Share on other sites

  • Replies 61
  • Created
  • Last Reply

Top Posters In This Topic

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! ^_^

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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!

Link to comment
Share on other sites

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.
Link to comment
Share on other sites

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
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.

×
×
  • Create New...