toy internal adjective hexing tutorial
(cross-posted from rkc, where i originally posted this tutorial!)
i've recently had success with pulling this off, and it's much easier and quicker than i anticipated, so i figured i'd write a small tutorial to help people do so with their own hexed toyz
there's a brief breakdown on
yabiko about the different adjectives toys contain, (and the toyz adjective spreadsheet
here!) and i'm going to put some documentation of the ones determined by one byte and their corresponding values here, based on values listed in reflet's goals spreadsheet (and arranged by flavor in excel by dddisco in the hexing discord (they've posted some of their research on this
here, if anyone wants to reference that as well!), huge thanks to them for both this and listing the programs and steps they used to do this as well):
value
| color |
0
| white
|
1 | black |
2 | red |
3 | green |
4 | yellow |
5 | blue |
6 | purple |
7 | pink |
8 | orange |
9 | brown |
10 | grey |
11 | clear/glossy |
value
| flavor |
0
| chicken (chicken treats, healthy treats)
|
1 | beef (dog food, beef treats, etc.)
|
2 | fish/olives (fish treat, olive treat, green food bowl)
|
3 | turkey (leftovers/red food bowl)
|
4 | creamy things/hot cocoa (milk bottle, hearts, stars, and striped mugs)
|
5 | sweets (cotton candy, candy hearts, and popcorn treats)
|
6 | catnip |
7 | cheese
|
8 | colorful smooth things (easter eggs, circus balls, toy car, cat dancer base, etc.)
|
9 | bouncy balls and squeaky chew toys (most non-circus balls, leprechaun)
|
10 | soft fuzzy things (pillows, cat dancer puff, wool chew doll, yarn ball, etc.)
|
11 | bone (bone, fish bone)
|
12
| wood and cardboard (brushes, picture frames, sticks, surprise box,etc.)
|
13
| metallic/shiny things (jingle ball, music box, doubloons, gemstones)
|
14
| water (water bowls)
|
15
| sandy (seashells, hermit crab, coconut, arrowhead, fossil, etc.)
|
16
| catz (this flavor is not used by any toyz, but is assigned to cat sprites!)
|
17
| bad (hair ball, flea spray)
|
18
| dogz (this flavor is not used by any toyz, but is assigned to dog sprites!)
|
19-22
| unused? (may be used by non-toy objects internally)
|
23
| chemicals (paint, perfume, bug barn, etc.)
|
24
| garbage (coal, message bottles)
|
25
| unused?
|
26
| outside of the flea spray bottle
|
27
| plants (seeds, jack o lantern)
|
notes:
-there aren't officially internal names for these values that we know of, so the flavors have to be extrapolated from which items they're applied to
-flavor value in non-edible toyz is presumably there because most toyz can be chewed. it also affects the sounds the toy makes when chewed.
-the "catnip" flavor causes petz to become catnipped when an item set to it is consumed!
other values are generally ranges, meaning individual toyz taken out of the closet or carrying case can be slightly different from each other, ex. the beach ball has a "bounce" range of 90-100, so some beach balls might be slightly bouncier than others. ranged values start at a minimum value and extend to 10 greater than the minimum, so setting a minimum of 5 for a ranged value would set it to 5-15. some values that could potentially be ranges are in practice usually just set to 100 if the toy is meant to have that trait or -1 if it isn't (though usually a trait the toy isn't meant to have just isn't set in the file).
as an example, here's the first toy i successfully managed to edit this way, the apple cake. junesong wouldn't touch it at first, because it still had the flavor value of the cheese it was based on. however, junesong likes the flavor value of sweet things, such as the cotton candy treats, which is the flavor value i wanted the apple cake to have, so ze was a good subject to test this one on!
first, you want to open a copy of the toy's file in a disassembler. i'll be using
IDA freeware in this tutorial.
load in the copy and just hit "ok" without changing any of the settings. the program may ask you to load a dll file, just hit cancel. you might get a warning message after that as well, but it shouldn't interfere with anything you're doing.
there's a lot of functions to the left, so it can seem a little overwhelming, but what you're looking for is these, the "InitToyExtraCode" functions. as you can see, in cheese-based toyz, there's two of these, due to the toy containing both the cheese and the crumb. it's the same for things like treat boxes, so for those, you'll want to modify them in order.
after you open the function and scroll down a little, there will be a table showing the opcodes and the values they use in order. for single-byte values, it'll just be the first number you want to change (the second number is just the ID of which value it is. don't touch that (unless you're trying to change which adjective the value is for, but that will replace the original adjective with the new one!), but it is useful for locating the value in the code)
for ranged values, there'll be a bit before them that tells the game to produce a random number within the range (you can identify that by the "rand" there), and the value you want to edit seems to be the number following "add edx", which is the minimum. again, ranged values have ranges that go from the minimum number to 10 above that, so for the cheese, this is 5-15. the value of the second "push" for a ranged value (8 here for size) is the ID of the adjective for that ranged value, so if you want to edit which adjective it is, change that.
the adjective IDs go in order from ID, color, flavor, size, mass, friction, tasty, edible, fatty, liquid, drug, medicine, aphrodisiac, discipline, chew, tug, density, thickness, soft, fuzzy, round, bounce, swatty, pretty, vain, paint, groom, badnoisy, nicenoisy, flies, rideable, and mouselike. there's a few of them that only get used for one or two toys (like the "paint" value, which is set to 100 in the Paint Can and its brush so that they can paint petz), and we're not quite sure what every single one of them do, but most of them are relatively self-explanatory from the names. toyz that don't have a certain value set at all usually don't have those values in the list, so some may be skipped (check the value ID with the number of the value on the spreadsheet if you're not sure!)
we want to edit the color and flavor values to make the apple cake red and sweet, so highlight the value for color (adjective ID 6, which is set to 4 here), and then switch to hex view.
this shows us the byte we're looking for, and approximately where to find it (coincidentally, the 6A 07 right below is also the flavor value we're looking for, so it's relatively easy to edit both of these at once!)
now open the toy you're editing in a hex editor, and use "find" to search for this value.
once you've made sure you're in the same spot as you saw in the disassembler (the surrounding values should look the same!), you can go ahead and edit the value. we want to change this from 04 (yellow) to 02 (red). while we're here, since the flavor value is nearby, we can also change 07 (cheese) to 05 (sweet)!
(if you're changing a value to one over 9, remember to convert from decimal to hex, since we're changing a hex value.)
in files with more than one sprite, like the cheese, you'll also want to change this for each of the sprites, so just search again to find the same values lower down for the main cheese sprite now that we've changed them for the crumb, and change them there, too. (in toyz like this besides the cheese, the values may be different for the different parts, so just check in the disassembler for the other sprite's values. for the cheese, they're the same.)
once that's done, you can save the file (you don't need to worry about checksums in toy files), and open up the game to use the edited toy. make sure you take a new instance of the toy out of the closet or case when testing. the game generates new instances of a toy based on the values stored in the file, but instances that have already been generated will still have the old values!
if you've done everything right, petz will now respond to the item's new values accordingly! junesong will now happily snap these up, and, for example, if your pet has color preferences for toyz, and you've changed the toy to a color they like, they may take a liking to the toy now that they can see it as the right color!
have fun!