This is usually a twofold question when it is asked so I will assume it is so here.
GBA on the DS- as far as running GBA code as a GBA goes nothing will allow you to change the buttons the X and Y buttons other than a hardmod which you will have to design and do yourself (there was a chip to add rapid fire on GBA to the DS X and Y buttons once but good luck finding it).
If you are running an emulator like those seen on the iplayer, ismart MM/ISMM and DSTwo you can remap buttons as you see fit, the emulator (they more or less share one) is good and can get a lot done but not as a good as the real thing.
Anywhere that runs GBA roms on hardware- you can hack the rom to do it and indeed several people have hacked DS roms which work in more or less the same way to change the controls. You can often get it down to slightly advanced cheat level as well rather than anything fun with assembly and hex editing roms. http://nocash.emubase.de/gbatek.htm#gbakeypadinput and http://crackerscrap.com/docs/sfchacktut.html as well as the zelda and guitar hero control hacks should tell you most of what you want to know here (general idea is you figure out if and where it stores the data read from the register/memory section noted and change the thing from flipping a bit for A to making it flip the bit for B instead unless you want to get really crazy and hack the rom to read different things (you do not)).
You can also rewire buttons on a GBA or DS as well I guess.
Nothing will allow you to change the X and Y buttons other than a hardmod, which you will have to design, and do yourself. There was once a chip to add rapid fire for GBA games, to the DS's X and Y buttons, but good luck finding it.
Like Fast says, any emulator allows you to map buttons as you see fit, and cheats are the way to go if you're using a flashcart to run DS ROMs. As for actual carts, you'd have to mess with the hardware of your DS, which I don't recommend even if you know what you're doing.
Any flashcart with a built-in cheat function (that is, every one I know of) can be used to remap DS ROM controls. You just have to ask on the cheat forums, or learn how to design cheat codes yourself. I know of a couple of control remaps (most of them allow the use of the face buttons in touchscreen-only games); the original Scribblenauts has one, and so does Phantom Hourglass.
As for GBA games, you need a flashcart capable of running a GBA emulator, and from what I've heard most people seem to like the Supercard DSTwo the best. At least, it's the one I hear mentioned the most.
Well that is a shock- divineo actually good for something.
The logic behind the DS control tweaking cheats is not any different to the GBA control mapping cheats (indeed I probably should have pointed out something like the tilt games (yoshi tilt and tumble and warioware twisted) that did more or less the same thing). It might be harder to do on the GBA if you are trying to patch the binary in ram (it more or less runs from the ROM section aka game genie territory rather than the ram like the DS which is fair game for cheats) to do the swap for you (again I would not even consider trying to get the game to change how it reads and interprets controls to read a instead of b unless they have a remapping option in there already you want to try adapting a bit) but that is the hard way when you can probably just get the cheat engine to do a bit of boolean logic on the section it is debounced to (it is pretty similar to http://gbatemp.net/topic/322718-screen-swap-see-touch-screen-on-top-screen-vise-versa/page__view__findpost__p__4137208 if I think about it).
As each year passes, retro games become harder and harder to play, as the physical media begins to fall apart and becomes more difficult and expensive to obtain. The...
While rumors had been floating about rampantly as to the future plans of Nintendo, the President of the company, Shuntaro Furukawa, made a brief statement confirming...
TheFlow has done it again--a new kernel exploit has been released for PlayStation 4 consoles. This latest exploit is called PPPwn, and works on PlayStation 4 systems...
Nintendo has officially announced that a successor to the beloved Switch console is on the horizon. As we eagerly anticipate what innovations this new device will...
Another video game prototype has been found and preserved, and this time, it's none other than the game that spawned an entire franchise beloved by many, the very...
DOOM is well-known for being ported to basically every device with some kind of input, and that list now includes the old retro game console in Persona 5 Royal...
Earlier this year, AYANEO revealed details of its next Android-based gaming handheld, the AYANEO Pocket S. However, the actual launch of the device was unknown; that...
With just a couple weeks after its initial release in the App Store, the Delta emulator for iOS was received with great success, after Apple loosened up its rules in...
With the vast success of Super Mario Maker and its Switch sequel Super Mario Maker 2, Nintendo fans have long been calling for "Maker" titles for other iconic genres...
Retro handheld manufacturer Anbernic has revealed its first clamshell device: the Anbernic RG35XXSP. As the suffix indicates, this handheld's design is inspired by...
Nintendo has officially announced that a successor to the beloved Switch console is on the horizon. As we eagerly anticipate what innovations this new device will...
While rumors had been floating about rampantly as to the future plans of Nintendo, the President of the company, Shuntaro Furukawa, made a brief statement confirming...
As each year passes, retro games become harder and harder to play, as the physical media begins to fall apart and becomes more difficult and expensive to obtain. The...
Ubisoft has today officially revealed the next installment in the Assassin's Creed franchise: Assassin's Creed Shadows. This entry is set in late Sengoku-era Japan...
After a little more than three years of exclusivity with the Epic Games Store, Square Enix has decided to bring their beloved Kingdom Hearts franchise to Steam. The...
TheFlow has done it again--a new kernel exploit has been released for PlayStation 4 consoles. This latest exploit is called PPPwn, and works on PlayStation 4 systems...
After rumour got out about an upcoming NES Edition release for the famed Nintendo World Championships, Nintendo has officially unveiled the new game, titled "Nintendo...
DOOM is well-known for being ported to basically every device with some kind of input, and that list now includes the old retro game console in Persona 5 Royal...
The number of layoffs and cuts in the videogame industry sadly continue to grow, with the latest huge layoffs coming from Microsoft, due to what MIcrosoft calls a...
With the vast success of Super Mario Maker and its Switch sequel Super Mario Maker 2, Nintendo fans have long been calling for "Maker" titles for other iconic genres...
without pubg popping off, fortnite wouldn't add battle royale, and call of duty wouldn't go even shittier than it did before because of blackout, warzone and dmz