plXX.udas memory increase
Got a request on residentevilmodding forum about increasing memory size for the plXX.udas files, which might be needed to let people use higher-poly models, apparently the other dll has something for increasing this, so should be possible for us to fix it too.
Haven't looked into it yet but hopefully it's just something related to the addrs setup by SystemMemInit, like ss_pzzl was, or maybe it's something polygon/Prim related again.
Asked them if they can send a plXX.udas that game doesn't work with atm, I'll edit this if I get hold of one.
E: seems ReadPlayerData does try to read into a PL00_ADDR ptr (name from VR symbols), which gets setup by SystemMemInit as somePool+0x2A8D000, seems that area only has 0x1E8000 bytes until it enters the next addr setup by SystemMemInit (DRTEMP_ADDR), so I'd guess this might be the problem with it (for reference, largest plXX.udas in vanilla game seems to be 0x1B9EA0)
E2: I think hooking the DvdReadN call inside ReadPlayerData might let us change the ptr & size of PL00_ADDR dynamically, looks like filename is passed over to DvdReadN, so we could check size of the file being read in first, then could probably overwrite PL00_ADDR ptr with a new malloc'd array.
There is another function Event::ExeBeginEvt that does something with PL00_ADDR though, either reading some tpl files into it, or maybe just reading some value from inside it instead, not sure, hopefully just the latter.
Hmm, might not be PL00_ADDR, tried hooking the ReadPlayerData call I mentioned but seems game crashed before hook was even called.
Before it crashed ReadPlayerData was being ran though, and looks like there's another ref to PLAYER_ADDR pointer inside it, maybe that's the cause, looks like SystemMemInit also sets that pointer up with a limited size (or maybe it's both PL00 & that)
There's a bunch of stuff making use of PLAYER_ADDR before the DvdReadN call to it though, (and also looks like gameRoomMemInit creates a heap inside it or something), might be pretty difficult to adjust it properly...
http://residentevilmodding.boards.net/thread/15223/re4uhd-2b-kaine-replace-leon is a mod that crashes without having the other dll installed (afaik you also need to install the female models mod from https://residentevilmodding.boards.net/thread/5217/ashley-claire-main-female-models before installing the 2B mod)
E: huh, seems main crash happens inside MakeWeightPaletteExt function, the PSMTXReorder call there ends up accessing some OOB memory.
Looks like it's using addr returned from LCGetBase - tracking that shows the addr for that is malloc'd inside MemAlloc func - only 0x4000 bytes though.
Extending that to 0x100000 bytes did fix the crash, but game would only run at 1FPS, and the model polygons had exploded everywhere.. no idea what's going on there :/
E: huh, seems main crash happens inside MakeWeightPaletteExt function, the PSMTXReorder call there ends up accessing some OOB memory.
Could be another problem, then. Not plXX.udas size limitation?
There is a limitation of vertex weights when rigging models. I've ran into this in the past when making a mod. Your rigging just can't be very "detailed". But this sounds like it should be a different issue, not related to the .udas physical size?
To properly test this we'd need a .udas file that just bigger, but with no other changes.
嗯,可能不是
PL00_ADDR,尝试ReadPlayerData挂断我提到的调用,但似乎游戏甚至在调用挂断之前就崩溃了。在它崩溃之前
ReadPlayerData正在运行,看起来它里面还有另一个PLAYER_ADDR指向指针的引用,也许这就是原因,看起来SystemMemInit还设置了一个有限大小的指针(或者可能是 PL00 和那个)虽然在 DvdReadN 调用它之前有一堆东西在使用
PLAYER_ADDR,(并且看起来也在它gameRoomMemInit里面创建了一个堆或其他东西),可能很难正确调整它......http://residentevilmodding.boards.net/thread/15223/re4uhd-2b-kaine-replace-leon是一个在没有安装其他 dll 的情况下崩溃的 mod(afaik 你还需要从https://安装女性模型 mod residentevilmodding.boards.net/thread/5217/ashley-claire-main-female-models在安装 2B mod 之前)
E:嗯,似乎主要崩溃发生在
MakeWeightPaletteExt函数内部,PSMTXReorder那里的调用最终访问了一些 OOB 内存。 看起来它正在使用从返回的地址LCGetBase- 跟踪显示在MemAllocfunc 内部 malloc 的地址 - 虽然只有 0x4000 字节。 将其扩展到 0x100000 字节确实修复了崩溃,但游戏只能以 1FPS 运行,模型多边形到处都爆炸了。不知道那里发生了什么:/
In version 1.0.6 you can fix it like this。Then 2Bmod can run normally