Clone of src/main.c that modified gridx/gridy in memory.