All maps duplicate certain functions between them, best guess is that devs probably shared common .c files between the maps, eg. maps that include Lisa & Cheryl would probably include chara/lisa.c & chara/cheryl.c in their build.
The shared code is mostly identical between maps, but some funcs do get customized in certain ones, likely they included #ifdef checks in their .c files that would change code depending on map, in decomp we can handle that by doing similar kind of #ifdef MAP0_S00 to change the code (ideally we can change this to #ifdef HAS_XYZ_FEATURE later on)
Right now the repo handles code sharing on a function-by-function basis, instead of pulling in a whole .c for some chara/feature we're pulling in separate .h files of each function that belongs to it.
Eventually once more has been decomped/shared we should be able to group these sharedFunc_*.h files into single header files, similar to how the devs likely had them as separate single .c files (and maybe we can make them actual .c files at some point, depending on whether splat actually supports that)
There's two stages to sharing funcs between maps, first stage is to identify the funcs/data that are shared between them & rename the symbol name in each map to also match between maps (allowing other funcs to reference it by the same name), and second stage is to actually get a code-match for that function and insert the code into each map.
We usually opt to do these stages in reverse, since there's a good chance of false-positives we don't really want to do symbol renaming all in one go, so we usually only start renaming func symbols to sharedFunc after we have the code matched for one.
Once we know the code itself matches then any other shared funcs/data used by that code are likely fine to rename too.
maptool can handle both name & code sharing for you, a short guide can be found here (any issues feel free to @ on discord):
#74 (comment)
A table of likely-shared functions, maps they're shared on, expected % from matching them, can be found here:
https://docs.google.com/spreadsheets/d/1FkOURT4nvGIL8qTCTNMzEobDkONMWg7aznmi1DP-t9A/edit?usp=sharing
Old post:
Mentioned this on discord before but probably good to keep an issue tracking it too, maps seem to have some funcs shared between them, all related to SubCharacter:
Some matching map .s files (expand)
$ python compare.py map0_s01 map0_s02 0
Distances:
map0_s01/func_800CFFB8.s and map0_s02/func_800CCE24.s: 0
map0_s01/func_800D1B00.s and map0_s02/func_800CE1C8.s: 0
map0_s01/func_800D1B3C.s and map0_s02/func_800CE204.s: 0
map0_s01/func_800D1E5C.s and map0_s02/func_800CE548.s: 0
map0_s01/func_800D1E5C.s and map0_s02/func_800CE768.s: 0
map0_s01/func_800D1F14.s and map0_s02/func_800CE600.s: 0
map0_s01/func_800D1F2C.s and map0_s02/func_800CE618.s: 0
map0_s01/func_800D1F54.s and map0_s02/func_800CE640.s: 0
map0_s01/func_800D1F6C.s and map0_s02/func_800CE658.s: 0
map0_s01/func_800D2038.s and map0_s02/func_800CE724.s: 0
map0_s01/func_800D2048.s and map0_s02/func_800CE734.s: 0
map0_s01/func_800D20FC.s and map0_s02/func_800CE548.s: 0
map0_s01/func_800D20FC.s and map0_s02/func_800CE768.s: 0
map0_s01/func_800D210C.s and map0_s02/func_800CE778.s: 0
map0_s01/func_800D211C.s and map0_s02/func_800CE788.s: 0
map0_s01/func_800D215C.s and map0_s02/func_800CE7C8.s: 0
map0_s01/func_800DA51C.s and map0_s02/func_800CE7DC.s: 0
$ python compare.py map0_s01 map4_s02 0
Distances:
map0_s01/func_800CFFB8.s and map4_s02/func_800CECFC.s: 0
map0_s01/func_800D1B00.s and map4_s02/func_800D00A0.s: 0
map0_s01/func_800D1B3C.s and map4_s02/func_800D00DC.s: 0
map0_s01/func_800D1E5C.s and map4_s02/func_800D0420.s: 0
map0_s01/func_800D1E5C.s and map4_s02/func_800D0640.s: 0
map0_s01/func_800D1F14.s and map4_s02/func_800D04D8.s: 0
map0_s01/func_800D1F2C.s and map4_s02/func_800D04F0.s: 0
map0_s01/func_800D1F54.s and map4_s02/func_800D0518.s: 0
map0_s01/func_800D1F6C.s and map4_s02/func_800D0530.s: 0
map0_s01/func_800D2038.s and map4_s02/func_800D05FC.s: 0
map0_s01/func_800D2048.s and map4_s02/func_800D060C.s: 0
map0_s01/func_800D20FC.s and map4_s02/func_800D0420.s: 0
map0_s01/func_800D20FC.s and map4_s02/func_800D0640.s: 0
map0_s01/func_800D210C.s and map4_s02/func_800D0AC0.s: 0
map0_s01/func_800D211C.s and map4_s02/func_800D0AD0.s: 0
map0_s01/func_800D215C.s and map4_s02/func_800D0B10.s: 0
map0_s01/func_800D2170.s and map4_s02/func_800D0B24.s: 0
map0_s01/func_800D21E4.s and map4_s02/func_800D0B98.s: 0
map0_s01/func_800D2364.s and map4_s02/func_800D0D18.s: 0
map0_s01/func_800D2B00.s and map4_s02/func_800D14B4.s: 0
map0_s01/func_800D2B10.s and map4_s02/func_800D14C4.s: 0
map0_s01/func_800D2B28.s and map4_s02/func_800D14DC.s: 0
map0_s01/func_800D2B4C.s and map4_s02/func_800D1500.s: 0
map0_s01/func_800D2BB0.s and map4_s02/func_800D1564.s: 0
map0_s01/func_800D2BE4.s and map4_s02/func_800D1598.s: 0
map0_s01/func_800D2BF4.s and map4_s02/func_800D15A8.s: 0
map0_s01/func_800D5638.s and map4_s02/func_800DDE50.s: 0
map0_s01/func_800D5E14.s and map4_s02/func_800DECAC.s: 0
map0_s01/func_800D7AB0.s and map4_s02/func_800E0E2C.s: 0
map0_s01/func_800D81B0.s and map4_s02/func_800E14F8.s: 0
map0_s01/func_800D81D0.s and map4_s02/func_800E1518.s: 0
map0_s01/func_800D8244.s and map4_s02/func_800E158C.s: 0
map0_s01/func_800D8804.s and map4_s02/func_800E1B4C.s: 0
map0_s01/func_800DA51C.s and map4_s02/func_800E9D28.s: 0
That's just a few of the maps that match, posted script to compare them here: https://gist.github.com/emoose/904c1660dd966dbcdf42b17f73da5ff8
Not sure what the best way to handle these is, maybe these are from some separate split .c file that they all include, but seems some funcs aren't included in all maps, would compiler have removed ones that aren't used? 🤔
(or in worst case, they might have just copy-pasted them across all the map files...)
Did add a couple of these to map0_s00.c before, wouldn't be too hard to copy them to other maps too for some extra %, but wonder if there's a better way to handle it.
All maps duplicate certain functions between them, best guess is that devs probably shared common
.cfiles between the maps, eg. maps that include Lisa & Cheryl would probably includechara/lisa.c&chara/cheryl.cin their build.The shared code is mostly identical between maps, but some funcs do get customized in certain ones, likely they included
#ifdefchecks in their .c files that would change code depending on map, in decomp we can handle that by doing similar kind of#ifdef MAP0_S00to change the code (ideally we can change this to#ifdef HAS_XYZ_FEATURElater on)Right now the repo handles code sharing on a function-by-function basis, instead of pulling in a whole .c for some chara/feature we're pulling in separate .h files of each function that belongs to it.
Eventually once more has been decomped/shared we should be able to group these
sharedFunc_*.hfiles into single header files, similar to how the devs likely had them as separate single .c files (and maybe we can make them actual .c files at some point, depending on whether splat actually supports that)There's two stages to sharing funcs between maps, first stage is to identify the funcs/data that are shared between them & rename the symbol name in each map to also match between maps (allowing other funcs to reference it by the same name), and second stage is to actually get a code-match for that function and insert the code into each map.
We usually opt to do these stages in reverse, since there's a good chance of false-positives we don't really want to do symbol renaming all in one go, so we usually only start renaming func symbols to
sharedFuncafter we have the code matched for one.Once we know the code itself matches then any other shared funcs/data used by that code are likely fine to rename too.
maptool can handle both name & code sharing for you, a short guide can be found here (any issues feel free to @ on discord):
#74 (comment)
A table of likely-shared functions, maps they're shared on, expected % from matching them, can be found here:
https://docs.google.com/spreadsheets/d/1FkOURT4nvGIL8qTCTNMzEobDkONMWg7aznmi1DP-t9A/edit?usp=sharing
Old post:
Mentioned this on discord before but probably good to keep an issue tracking it too, maps seem to have some funcs shared between them, all related to
SubCharacter:Some matching map .s files (expand)
That's just a few of the maps that match, posted script to compare them here: https://gist.github.com/emoose/904c1660dd966dbcdf42b17f73da5ff8
Not sure what the best way to handle these is, maybe these are from some separate split
.cfile that they all include, but seems some funcs aren't included in all maps, would compiler have removed ones that aren't used? 🤔(or in worst case, they might have just copy-pasted them across all the map files...)
Did add a couple of these to map0_s00.c before, wouldn't be too hard to copy them to other maps too for some extra %, but wonder if there's a better way to handle it.