Hacking Action Replay code to switch screens

cracker

Nyah!
Member
Joined
Aug 24, 2005
Messages
3,597
Trophies
0
XP
2,087
Country
United States
It was a pain in the ass to find a good 'flag' to test for so it would only switch the screen while in the race but I finally got it! Because of the way I had to make it it will only work on MKDS [EU].

SWAP LCD
5203809C E1D100B0
0203809C E51FF004
020380A0 02000000
D0000000 00000000
52000000 E7FFDEFF
E2000000 00000034
E92D5FFF E5910000
E3800902 E59F3014
E1530004 1A000000
E3C00902 E5810000
E8BD5FFF E59FF004
022CC594 04000304
020380A8 00000000
D2000000 00000000
 

_V1qY

Well-Known Member
OP
Member
Joined
May 31, 2012
Messages
138
Trophies
0
XP
166
Country
Wow, you went above and beyond what I expected! I would have been fine with the screens being always switched but this is just perfect. Thanks!
 

cracker

Nyah!
Member
Joined
Aug 24, 2005
Messages
3,597
Trophies
0
XP
2,087
Country
United States
No problem. It was fun getting back into code hacking (even though it showed me how rusty I had gotten). It actually would get trapped in a few loops if I didn't make it so it was only swapped during the race so it would have been more work to do the screen swap during the full game. I tested different racers and tracks that were unlocked so hopefully nothing in other tracks breaks it. Let me know how it goes.
 

_V1qY

Well-Known Member
OP
Member
Joined
May 31, 2012
Messages
138
Trophies
0
XP
166
Country
No problem. It was fun getting back into code hacking (even though it showed me how rusty I had gotten). It actually would get trapped in a few loops if I didn't make it so it was only swapped during the race so it would have been more work to do the screen swap during the full game. I tested different racers and tracks that were unlocked so hopefully nothing in other tracks breaks it. Let me know how it goes.
The code works fine as an Action Replay code, but I can't apply it with DSATM. White screen on hardware.
 

Coto

-
Member
Joined
Jun 4, 2010
Messages
2,916
Trophies
1
XP
2,258
Country
Chile
It was a pain in the ass to find a good 'flag' to test for so it would only switch the screen while in the race but I finally got it! Because of the way I had to make it it will only work on MKDS [EU].

SWAP LCD
5203809C E1D100B0
0203809C E51FF004
020380A0 02000000
D0000000 00000000
52000000 E7FFDEFF
E2000000 00000034
E92D5FFF E5910000
E3800902 E59F3014
E1530004 1A000000
E3C00902 E5810000
E8BD5FFF E59FF004
022CC594 04000304
020380A8 00000000
D2000000 00000000

nice work! 8)

are those compressed 4 byte instructions + ram offsets?
 

cracker

Nyah!
Member
Joined
Aug 24, 2005
Messages
3,597
Trophies
0
XP
2,087
Country
United States
Yeah, it's raw ARM code that gets loaded to 0x2000000. The game's display handling function @ 0x203809C gets patched to jump to it.
 

Vague Rant

Deceptively cute
Member
Joined
Aug 7, 2008
Messages
2,389
Trophies
0
Location
Melbourne
Website
vaguerant.tumblr.com
XP
2,433
Country
How hard would it be to generalize this code to other games? Is there an easy way to locate the display handler, e.g. by finding the same code in another game (presumably the handler is similar/the same and comes from the SDK?).
 

cracker

Nyah!
Member
Joined
Aug 24, 2005
Messages
3,597
Trophies
0
XP
2,087
Country
United States
The problem is it would probably require manually touching up the code from one game to the next anyway because of bugs created by improperly switching the lcd states. I had to search quite a while with no$gba to find some good areas of memory to test that would always have the same value duing the race and only then. I think the same thing would happen in many games.
 

Elru

Active Member
Newcomer
Joined
May 14, 2014
Messages
34
Trophies
0
XP
586
Country
Chile
That is very strange. Do you have v5.1? Did you change any settings?


Hi, i'm really interested in doing this in mario kart (and other games jeje), i tried to use the AR with DSATM v5.1 in wood R4
(i have a modded ds without top screen)
but it didn't work, :( (i dnt change anything) any suggestions?
thx
 

schnurbi

New Member
Newbie
Joined
Jan 30, 2016
Messages
1
Trophies
0
Age
42
XP
32
Country
Angola
DSATM does not have the same effect as using AR in Desmume. even the simple "14000304 00000FFF" works in Desmume for SM64, but with DSATM- no change.
If I start the patched rom and the apply the AR cheat, it works. So DSATM seems to be unable to permanently change this.
 

FAST6191

Techromancer
Editorial Team
Joined
Nov 21, 2005
Messages
35,126
Trophies
2
Website
trastindustries.com
XP
24,663
Country
United Kingdom
DSATM does not have the same effect as using AR in Desmume. even the simple "14000304 00000FFF" works in Desmume for SM64, but with DSATM- no change.
If I start the patched rom and the apply the AR cheat, it works. So DSATM seems to be unable to permanently change this.
Not so much.

The DS has a register that it looks to so as to know what screen to put things on. That is what the simple code tries to change. Desmume is happy enough to write this as it is an emulator and does not have the same restrictions as the hardware, hardware however does not respond quite the same to this. This is why cracker made a far more more complex cheat up above to target Mario Kart EU specifically
http://gbatemp.net/threads/action-replay-code-to-switch-screens.355486/page-2#post-4910138

Here are some links that might help you in analysing the code, however I came unstuck when I tried the second part of it (the part after the D0 code) as I am not sure what it is writing where.
http://doc.kodewerx.org/hacking_nds.html
http://problemkaputt.de/gbatek.htm#dsmemorymaps
and as the link from my opening post is broken you might as well have the new/current one
http://problemkaputt.de/gbatek.htm#dspowermanagement
 

Butterbean

Member
Newcomer
Joined
Jun 13, 2018
Messages
13
Trophies
0
Age
44
XP
59
Country
United States
Are there any codes or known AR codes out there we can apply to Super Princess Peach and New Super Mario Bros. that would accomplish the same thing with flipping the LCD screen, or is it a trial and error pain?

Also, I tried patching the Mario Kart one above using those AR codes, and DSATM crashes when trying to apply them - does anyone have the patch available by chance?
 
Last edited by Butterbean,

Zaphod77

Well-Known Member
Member
Joined
Aug 25, 2015
Messages
661
Trophies
0
Age
47
XP
580
Country
United States
it's pointless to try this with the ds vanias, because they require that the action be on the touch screen.

you need to draw seals, tap to teleport, tap to break ice, etc.
 

FAST6191

Techromancer
Editorial Team
Joined
Nov 21, 2005
Messages
35,126
Trophies
2
Website
trastindustries.com
XP
24,663
Country
United Kingdom
it's pointless to try this with the ds vanias, because they require that the action be on the touch screen.

you need to draw seals, tap to teleport, tap to break ice, etc.
You could probably make it an activator cheat (the effect is mostly just a register wanting to be changed, cracker's stuff beyond the simplistic thing I had in the previous page just being the reassuring platitudes that need to be whispered to the hardware to do it), and beyond that maybe chain it one with the various improvement hacks* that do away with the seals and ice aspect just in case (which might even not need a swap if it instead is more or less "is button pressed?" than "is seal drawn properly?")

*for those unfamiliar with such things
http://www.romhacking.net/?page=hac...e=20&order=&dir=&title=&author=&hacksearch=Go
Has some for all three DS efforts (might need to go on the next page). Various levels of change available for those.
 
  • Like
Reactions: cearp
General chit-chat
Help Users
    Dark_Phoras @ Dark_Phoras: What's the point of your existence?