Hacking Action Replay code to switch screens

_V1qY

Well-Known Member
OP
Member
Joined
May 31, 2012
Messages
138
Trophies
0
XP
166
Country
I thought one existed, but I can't find it.

Doesn't matter if screens are swapped when starting the ROM, or if I have to press select or
Something.

Ty
 

FAST6191

Techromancer
Editorial Team
Joined
Nov 21, 2005
Messages
36,798
Trophies
3
XP
28,321
Country
United Kingdom
There were a few made at various points but they were pretty unstable.

The DS actually has a display swap (or more accurately video engine output swap) command built into it
http://nocash.emubase.de/gbatek.htm#dspowermanagement

GBAtek DS power management section said:
Code:
4000304h - NDS9 - POWCNT1 - Graphics Power Control Register (R/W)

  0     Enable Flag for both LCDs (0=Disable) (Prohibited, see notes)
  1     2D Graphics Engine A      (0=Disable) (Ports 008h-05Fh, Pal 5000000h)
  2     3D Rendering Engine       (0=Disable) (Ports 320h-3FFh)
  3     3D Geometry Engine        (0=Disable) (Ports 400h-6FFh)
  4-8   Not used
  9     2D Graphics Engine B      (0=Disable) (Ports 1008h-105Fh, Pal 5000400h)
  10-14 Not used
  15    Display Swap (0=Send Display A to Lower Screen, 1=To Upper Screen)
  16-31 Not used

Use SwapBuffers command once after enabling Rendering/Geometry Engine.
Improper use of Bit0 may damage the hardware?
When disabled, corresponding Ports become Read-only, corresponding (palette-) memory becomes read-only-zero-filled.

You then get to fiddle with bit 15. Some tried with with a simple cheat like 14000304 0000FFFF or 04000304 FFFFFFFF (it might have been 1 to begin with so you may have to change that to get a 0 in bit 15 instead)

However the better cheat would be something like reading the value and doing some boolean operation on the result to get the display swap bits to be the ones you want. However according to http://doc.kodewerx.org/hacking_nds.html the boolean operations are a hack and I am not sure what flash carts do what here.

Either way several people tried and I have not seen a properly successful version yet -- the screens will swap but it tends to come at a serious stability cost.
 

FAST6191

Techromancer
Editorial Team
Joined
Nov 21, 2005
Messages
36,798
Trophies
3
XP
28,321
Country
United Kingdom
It might be that the bit needs to be 0 instead, indeed given that it is engine a and engine a is what usually handles 3d that is likely the case though I still have to mention it is rarely a stable affair and getting it to be stable is likely to be no fun at all.

Try
14000304 00000FFF
It works in Desmume, though the touch screen might trouble things as the data you are supposed to be clicking on is not there but if you are good or you use buttons I guess it works well enough. Desmume is not real hardware though so anything could happen.
screenswapmariokartdemocheat.jpg
 

_V1qY

Well-Known Member
OP
Member
Joined
May 31, 2012
Messages
138
Trophies
0
XP
166
Country
Thanks for your help, I'm using original R4 with YSMenu running Mario Kart (E). Tried all 3 of the suggested codes, but none are working. FAST6191
 

FAST6191

Techromancer
Editorial Team
Joined
Nov 21, 2005
Messages
36,798
Trophies
3
XP
28,321
Country
United Kingdom
I assume you tried them one at a time -- together they would do odd things.

Several options at this point
1) The AR can not reach that memory section. This could be in general, could be because YSMenu's stuff is not so hot (by the way why YSMenu when Wood R4 exists?) or could be something else.
2) The section is being overwritten by something else and the cheat can not keep up. Seen it several times before.
3) The cheat is ineffective on real hardware for some reason other than 1) or in addition to it.

If you can then try applying the cheat with something like DSATM and also try it on Wood R4 unless you have a reason not to use it.

From here my next step would be to instead to apply it as an assembly hack (still possible in cheats mind you), however that is way more effort than I am inclined towards at this time of night. I would probably hook the game and write it rather than find what changed the POWCNT1 register though that is the second choice and probably the better one.
 

FAST6191

Techromancer
Editorial Team
Joined
Nov 21, 2005
Messages
36,798
Trophies
3
XP
28,321
Country
United Kingdom
Err I can... it is just that it is not your basic hack (assembly is usually considered the last thing you learn in hacking and the hardest area depending upon what you are doing) so it could be quite a long response.
I realise now my offhand comment might have been read not how I intended it -- assembly is the more human readable translation of what ends up going through the processor, at this point you have to manage everything though as you are only making a tiny addition to the game or even change within it you do not have to do quite as much. However as the binary is loaded into memory and cheats can edit memory you can apply an assembly hack as cheats, the trick is getting to that point.

For learning assembly the docs from http://crackerscrap.com/index.php , http://www.coranac.com/tonc/text/asm.htm and a general guide to assembly/ROM hacking would be a start.
 

_V1qY

Well-Known Member
OP
Member
Joined
May 31, 2012
Messages
138
Trophies
0
XP
166
Country
I'd love to be able to do this myself. But honestly, it's way out of my league.

I certainly wont be able to do this; and I don't see anyone else posting. So I guess that's it then.

Thanks anyway though.
 

cracker

Nyah!
Member
Joined
Aug 24, 2005
Messages
3,619
Trophies
1
XP
2,213
Country
United States
After doing some research it appears that that code is bad because you are forcing all or the hardware on except the ARM9 that gets turned off! Also it might not work anyway because it is supposed to require halting the hardware briefly to change the settings.

It will require an asm hack code because the value in 0x4000304 needs to be ORed to 0x18000 and the ARDS lacks an OR code type. I will try to create one asap.
 
  • Like
Reactions: cearp

cearp

瓜老外
Developer
Joined
May 26, 2008
Messages
8,724
Trophies
2
XP
8,499
Country
Tuvalu
would the asm hack be 'global' for every game?
if not, could it be made? and if not (ha), why? i would expect the screen 'code' to be in the same place etc, i have no idea though...
 

FAST6191

Techromancer
Editorial Team
Joined
Nov 21, 2005
Messages
36,798
Trophies
3
XP
28,321
Country
United Kingdom
Yeah such a code would be global, or at least as global as the injection method and dodging any game modifications to the areas in question (the number of games that would not work would likely small enough to consider making specific ones for them).
I was fiddling last night with the backlight codes to see if I could change something there but did not really take it anywhere.

"if not, could it be made? and if not (ha), why? i would expect the screen 'code' to be in the same place etc, i have no idea though... "

The screen position is located in a register (as in system register, not cpu register) which is what that code above I suggested attempts to fiddle with. In normal hardware though you kind of have to approach the situation properly it seems (emulators have no such issues for obvious reasons -- why emulate a restriction like that) and speak to it how you are supposed to (not sure of the full protocol, likely nothing too drastic though). http://nocash.emubase.de/gbatek.htm#dspowermanagement has more on that (though seemingly not the protocol).

To answer the other question that I can see being asked. You could turn this into a cheat (maybe even simple three to five line one) but that would quite possibly be unique to the game, you might be able to piggyback it off the likes of DSATM's injection though.
 
  • Like
Reactions: cearp

cracker

Nyah!
Member
Joined
Aug 24, 2005
Messages
3,619
Trophies
1
XP
2,213
Country
United States
I'm going to hace to research this more thoroughly. There is more to the process than I originally thought. Also, I'm not sure if it is really possible to swap them after the initial setup at boot.
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
    Xdqwerty @ Xdqwerty: Slow wifi ack