The cave depends on how you want to approach it, do you want to just patch the exe? Do you want to create a loader that does the patch for you leaving the original exe untouched? Do you want to inject a DLL that makes the patches, again leaving the original exe untouched?
The idea is that you need to find some area in the games exe that is either just 00's, 90's or CC's in a big enough chunk that you can make your cave inside of it, have the code you need to add, then jump back to the original code. You also need to make sure that the area of memory you use is not used for anything else at some point in the game. Generally, this is why creating your own block of memory for a cave is generally better if possible. (ie. using VirtualAlloc within the process, or VirtualAllocEx remotely.)
You will want to jump from the original code, anywhere you feel is best be it at the start of that if/else or the end of it, or even in the middle of it, up to you really. Restore any code you altered within the cave, do your new code, then jump back to the original.
I wouldn't suggest editing the code as-is, and instead do what you need within the cave only since you want to add new ranges for the game to look for new things.
I would really like to have a DLL that make the patches because it's flexible but with my skill set and knowledge as of now I think I will just do the patches in the exe.
Yes, I understand now. There is a huge space at the end of the exe there I could make the cave and jump back to the target block.
What I dont know yet is how to make 2 set of range of ID like the "PCTMD" tab, it uses two range.
I want to make the "PCMesh" to add new set of ID instead of changing the old one.
If I will copy the code of "PCTMD" second range of ID, I dont know what I will edit so that I can connect it to PCMesh to establish new set of ID.
I think I will try to do some trial and error for now and get back here with the codes.