You are partly right, any cheat/trainers are essentially a virus, since they interfere with the process/memory of the application, but their purpose can be different. Or do you think that "Cheat Engine" and similar programs are viruses (provided that they are downloaded from an official source)?literally says virus
You can decompile and reverse engineer.
Or use the source code (requires Cheat Engine 7.6).