eterniti / xv2patcher

A dll that patches Xenoverse 2 to improve modding functionalities
12 stars 5 forks source link

[Feature Request] Remove limit and add support for ki-blast types on Super Souls #6

Open Dee-Ayy opened 8 months ago

Dee-Ayy commented 8 months ago

So the game has a hard limit of what it accepts as ki blast types that can be assigned on super souls. As of 1.21.02 this limit is 11/0xB.

The patch to remove this limit is pretty simple

<Patch name="ExtendSSKiBlastTypes" type="write" search_start="0x5D0000">
    <Instruction code="83 FB XX" comment="cmp ebx,XX (XX changes each update that adds new types. currently is 0B)" />
    <Instruction code="77 0C" comment="ja DBXV2.exe+XXXXXXXX" />
    <Instruction code="85 DB" comment="test ebx,ebx" />
    <Instruction code="74 08" comment="je DBXV2.exe+XXXXXXXX" />
    <Instruction code="81 C3 37040000" comment="add ebx,00000437" />
    <Instruction code="EB 10" comment="jmp DBXV2.exe+XXXXXXXX" />
    <Instruction code="48 8D 0D XXXXXXXX" comment="" />
    <Instruction code="8B 1C B9" comment="lea rcx,[DBXV2.exe+XXXXXXXX]" />
    <Instruction code="81 C3 38040000" comment="add ebx,00000438" />
    <Write value="83 FB 00 74 0C" />>
</Patch>

I just change the first two opcodes to be a compare for 00 and to jump if equal. This seems to retain the default race ki blast loading (When no super soul is loaded or when ki blast type is 00) and allows for any value to be accepted as a ki blast type from a super soul.

Super soul ki blasts are loaded like so: If the value is greater than 0, add 1079 to it then load that new value from the ID2 in the CUS ki blast section. So as an example, if a ki blast was installed to id 3090 and I wanted to assign it as a super soul ki blast type, I would just subtract 1079 from it to find the value I should use in the super soul, in this case it would be 2011.

One important note about loading a ki blast skill this way is that they need the Race Lock value in the CUS set to accept all races. The game will refuse to let the character use the custom ki blast otherwise.

The only other thing about loading custom ki blasts this way is the ki blast type name in the menu. The names for each type are loaded from the menu_shop_text_xx.msg and the game uses the ITEMLIST_DETAILS.iggy to define what strings to load for each ki blast type. For example Gamma Beam (Blue) is ki blast type 11/0xB and the iggy assigns it to load the string with the name ITM_STR_02_031 from the msg file mentioned earlier. So to be able to add and customize custom ki blast type names the iggy will need to be modified to load new strings. Another user, Atsu, provided a iggy edit that can do this if you would like to look at it https://cdn.discordapp.com/attachments/406727448307433472/1188326711826325534/ITEMLIST_DETAILS.iggy?ex=659a1e7e&is=6587a97e&hm=7f2111818666501a39afa1061cfc601f14016c8624f82a656c05b750fd9e79cb&

The modification makes it so any ki type above the vanilla value of 11 with load the message names following this example ITM_MODBLT_xx Where xx = the ki blast type id. so in the above example were we wanted to use ID 2011, the msg name we would add to the menu_shop_text msg would be ITM_MODBLT_2011. if I wanted to use the already existing Ultra Instinct Soaring Fist Ki blast added with the UI official awoken skill, that skill is conveniently right after Gamma Beam (Blue) and would be ki blast type 12/0xC and as such would use the message name ITM_MODBLT_12 if using the above iggy.

I hope this wasn't too confusing to follow.

eterniti commented 2 months ago

Implemented in 4.3. It seems to work fine, but I will leave this open until more test is done. I couldn't access the iggy by Atsu on the link you put, so I implemented my own using the logic described. The modified ITEMLIST_DETAILS.iggy will now be installed by installer.

Also, implemented support for this for x2m blast skills. The skill creator will now have an optional checkbox "This blast skill will be used by a Super Soul". When checked, the skill name, which is usually grayed for blast skills, will become available and will be used instead for the blast type. On the installer side, when these x2m are detected, besides installing the text into menu_shop_text, the installer will try to ensure that the assigned skill id2 is big enough for the logic id2-1079, and will also enforce racelock=0xFF at install time, overriding whatever value the modder used.

Remaining part, linking one or more supersouls to the blast skill, still needs to be done by the user with other tools.