I had this problem too, together with some other problems, the thing is that Mastermind_X used the direct palette RAM at 0x05000000, but as you know maybe Pokémon backstores the Palettes in the WRAM. The data is copied in the DMA3 line and you want to turn that off. I can only give you the adresses for the german ROMs and what you want to change, it might be similar to the english ones:
Disable: 0x02037AC0 = 0x80
Able: 0x02037AC0 = 0x40
Disable: 0x02037FDC = 0x80
Able: 0x02037FDC = 0x40
The Firered ones were researched by driver and published in his research note files.
You want to find the offset in the routine and change it.
As I tried that I had some problems with the OAM stuff. The sprites were all bugged and I wasnt able to end the code correctly, I think some layers and also the OAM was bugged, I wasn't able to solve that though.
Hope I could help and maybe I also find an answer to my problems