Kodewerx

Our culture has advanced beyond all that you could possibly comprehend with one hundred percent of your brain.
It is currently Tue Jul 29, 2025 10:51 am

All times are UTC - 8 hours [ DST ]


Forum rules


Discussion of illegal hacking/cracking is prohibited. (No virus/trojans/cracks/warez/etc allowed.)



Post new topic Reply to topic  [ 38 posts ]  Go to page 1, 2  Next
Author Message
PostPosted: Fri Apr 20, 2007 9:38 pm 
Offline
Kommunist
Kommunist

Joined: Wed Feb 28, 2007 5:52 pm
Posts: 79
Yesterday, while playing Metroid Prime: Hunters, I was in a crucial part of the game, but it was hard to see with the screen's backlight on a low level. Frustrated by the inability to change the brightness without rebooting, I created this code.

This code allows you to change the backlight level within any game at any time (provided you can get the code to run of course). To use it you hold L+R+SELECT then press either UP to increase the brightness or DOWN to decrease the brightness.

Code:
<cheat>
   <name>Backlight control</name>
   <note>Hold L+R+SELECT then press UP to increase brightness or DOWN to decrease brightness</note>
   <codes>94000130 FCFB0000 C2000001 000000a0 a21ab5f0 88234c24 80138811 d02a428b 25803490 f0002000 1c06f82a f0002004 2703f826 21404007 d003420b 420b2180 e018d00c 4231210c 2f03d006 1c79d013 f0002004 e00ef816 e0094331 438e210c 2f001c31 1e79d004 f0002004 e002f80a f0002000 bcf0f806 4718bc08 30800000 88222100 d1fc422a 80224a08 88208060 d1fc4228 80220c12 88228061 d1fc422a 21ff8860 47704008 04000130 80028802 d2000000 00000000 </codes>
</cheat>


This code uses the Nitro Hax cheat engine's custom code type C2 (execute custom function), so it won't work on the Action Replay in this form. It also needs to run on the ARM7, so if the cheat engine is hooked into the ARM9 instead, it won't work.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Fri Apr 20, 2007 9:43 pm 
Offline
Kommunist
Kommunist

Joined: Wed Feb 28, 2007 5:52 pm
Posts: 79
Here is the source code for it.

brightness.s:
Code:
.thumb

@ all of the following are 16 bit
.equ   REG_SPICNT,  0x040001C0
.equ   REG_SPIDATA,    0x040001C2
.equ   REG_KEYINPUT,   0x04000130

.equ   KEYS_L_R_SELECT, ((1<<9) | (1<<8) | (1<<2))
.equ   KEYS_UP,   (1<<6)
.equ   KEYS_DOWN,   (1<<7)

.equ   PM_CONTROL_REG, 0
.equ   PM_LITE_BRIGHT_REG, 4
.equ   PM_BACKLIGHTS, ((1<<2) | (1<<3))
.equ   SPI_BUSY, 0x80


cheat_header:
   .word   0x94000130, ((~KEYS_L_R_SELECT & 0xFFFF) << 16)   @ Button activator
   .word   0xC2000001, (brightnessHandler_end - brightnessHandler)   @ Execute custom function in thumb mode

brightnessHandler:
   push   {r4-r7, lr}
   
   adr   r2, old_key_state
   ldr   r4, =REG_KEYINPUT
   ldrh   r3, [r4]   @ Current key state
   ldrh    r1, [r2]   @ Old key state
   strh   r3,   [r2]   @ Save current key state for next time
   cmp      r3, r1      @ if keys in same state as before
   beq   brightnessHandler_exit

   @ must be done before calling readPowerMangement or writePowerManagement
   add      r4, #(REG_SPICNT - REG_KEYINPUT)
   mov      r5, #SPI_BUSY

   @ Old power management setting
   mov   r0, #PM_CONTROL_REG
   bl   readPowerMangement
   mov   r6, r0      @ r6 = old power management setting

   @ Old backlight level setting
   mov   r0, #PM_LITE_BRIGHT_REG
   bl   readPowerMangement
   mov   r7, #0x03
   and   r7, r0      @ r7 = old backlight level setting

   mov   r1, #KEYS_UP
   tst   r3, r1
   beq   brightnessHandler_keyUp
   mov   r1, #KEYS_DOWN
   tst   r3, r1
   beq   brightnessHandler_keyDown
   b   brightnessHandler_exit
   
brightnessHandler_keyUp:
   @ enable backlights if off
   mov   r1, #PM_BACKLIGHTS
   tst   r1,   r6
   beq   brightnessHandler_turnOnScreens

   @ increase brightness
   cmp      r7, #0x03
   beq      brightnessHandler_exit
   add      r1, r7, #1
   
   mov   r0, #PM_LITE_BRIGHT_REG
   bl   writePowerManagement
   b   brightnessHandler_exit

brightnessHandler_turnOnScreens:
   @ enable backlights
   orr   r1,   r6
   b   brightnessHandler_setScreenStatus
   
brightnessHandler_keyDown:
   @ get ready to disable backlights if needed
   mov   r1, #PM_BACKLIGHTS
   bic   r6, r1
   mov   r1, r6
   @ turn off screens if already on lowest level
   cmp      r7, #0x00
   beq      brightnessHandler_setScreenStatus
   
   @ reduce brightness
   sub      r1, r7, #1
   mov   r0, #PM_LITE_BRIGHT_REG
   bl   writePowerManagement
   b   brightnessHandler_exit

brightnessHandler_setScreenStatus:
   @ set new power management control
   mov   r0, #PM_CONTROL_REG
   bl   writePowerManagement
      
brightnessHandler_exit:
   pop      {r4-r7}
   pop   {r3}
   bx   r3
   
old_key_state:
   .hword 0x0000
   
readPowerMangement:
   add      r0, #(1<<7)
   mov      r1, #0
   @ fall through to _writePowerManagement


writePowerManagement:   @ (reg, command)
   
   @ while (REG_SPICNT & SPI_BUSY);
writePowerManagement_loop1:
   ldrh   r2, [r4]
   tst      r2, r5
   bne      writePowerManagement_loop1
   
   @ REG_SPICNT = SPI_ENABLE | SPI_BAUD_1MHZ | SPI_BYTE_MODE | SPI_CONTINUOUS | SPI_DEVICE_POWER;
   ldr      r2, =((1<<15) | 2 | (0<<10) | (1<<11) | (0<<8)) | (((1<<15) | 2 | (0<<10) | (0<<8)) << 16)
   strh   r2, [r4]
   
   @ REG_SPIDATA = reg;
   strh      r0, [r4, #2]
   
   @ while (REG_SPICNT & SPI_BUSY);
writePowerManagement_loop2:
   ldrh   r0, [r4]
   tst      r0, r5
   bne      writePowerManagement_loop2
   
   @ REG_SPICNT = SPI_ENABLE | SPI_BAUD_1MHZ | SPI_BYTE_MODE | SPI_DEVICE_POWER;
   lsr      r2, #16
   strh   r2, [r4]
   
   @ REG_SPIDATA = command;
   strh   r1, [r4, #2]
   
   @ while (REG_SPICNT & SPI_BUSY);
writePowerManagement_loop3:
   ldrh   r2, [r4]
   tst      r2, r5
   bne      writePowerManagement_loop3
   
   @ return REG_SPIDATA & 0xFF;
   ldrh   r0, [r4, #2]
   mov      r1, #0xff
   and      r0, r1
   bx       lr

constant_pool:
.pool

.align 3
brightnessHandler_end:

cheat_footer:
   .word   0xd2000000,   0x00000000   @ End if


Makefile:
Code:
include $(DEVKITARM)/ds_rules

brightness.cht   :   brightness.bin
   @od -A n -t x4 -w8 $< > $@
   @echo Raw cheat codes written to $@

brightness.bin   :   brightness.o
   $(OBJCOPY) -O binary $< $@

brightness.o   :   brightness.s



Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Fri Apr 20, 2007 10:08 pm 
Offline
Komrade
Komrade

Joined: Sat Jan 27, 2007 6:18 pm
Posts: 2070
Location: Dothan, Alabama
Title: Derp
One question, this work on Regular DS?

_________________
Image
WWDD? - What Would Dale Do?


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Fri Apr 20, 2007 10:21 pm 
Offline
Kunt (Banned)
Kunt (Banned)

Joined: Wed Oct 11, 2006 8:19 am
Posts: 549
Location: With your momz
Yeah and I hope it does I love it.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Fri Apr 20, 2007 10:24 pm 
Offline
Komrade
Komrade

Joined: Sat Jan 27, 2007 6:18 pm
Posts: 2070
Location: Dothan, Alabama
Title: Derp
Wait, nvm, didn't see the, dosn't work for AR part
Locks up on meh games

_________________
Image
WWDD? - What Would Dale Do?


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Fri Apr 20, 2007 10:26 pm 
Offline
Kunt (Banned)
Kunt (Banned)

Joined: Wed Oct 11, 2006 8:19 am
Posts: 549
Location: With your momz
Yeah and NVM I know it won't work now XD


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Fri Apr 20, 2007 11:40 pm 
Offline
Kommunist
Kommunist

Joined: Wed Feb 28, 2007 5:52 pm
Posts: 79
Ask kenobi if he can modify it to work with his AR hack that allows custom code execution. The ASM is in THUMB, so his hack might need to be modified.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sat Apr 21, 2007 2:07 am 
Offline
Kommunist
Kommunist

Joined: Tue Oct 10, 2006 9:32 am
Posts: 445
I guess adding something like 'add r0,r15,1 ; bx r0' (ie. E28F0001 E12FFF10) at the very start of your asm codes could be used.
Also I just wanted to point out that this code will only work on the NDS Lite version. On the regular NDS, light just goes on/off when you press Up, and off when you press down (and making some bad noise).

So anyone wanting to use chishm's Backlight control code on the AR should replace the :

...
C2000001 000000A0
A21AB5F0 88234C24
...

with

...
023FE074 012FFF11
E0000000 000000A8
E28F0001 E12FFF10
A21AB5F0 88234C24
...

and the

...
D2000000 00000000
...

with

...
023FE074 E3520003
D2000000 00000000
...


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sat Apr 21, 2007 3:44 am 
Offline
Kommunist
Kommunist

Joined: Wed Feb 28, 2007 5:52 pm
Posts: 79
Thanks kenobi. For those too lazy to make the modifications themselves, here is the code modified by kenobi to work for the official Action Replay (notice how it's longer, Nitro Hax is better :-p):
Code:
<cheat>
   <name>Backlight control</name>
   <note>Hold L+R+SELECT then press UP to increase brightness or DOWN to decrease brightness</note>
   <codes>94000130 FCFB0000 023FE074 012FFF11 E0000000 000000A8 E28F0001 E12FFF10 A21AB5F0 88234C24  80138811 d02a428b 25803490 f0002000 1c06f82a f0002004 2703f826 21404007 d003420b 420b2180 e018d00c 4231210c 2f03d006 1c79d013 f0002004 e00ef816 e0094331 438e210c 2f001c31 1e79d004 f0002004 e002f80a f0002000 bcf0f806 4718bc08 30800000 88222100 d1fc422a 80224a08 88208060 d1fc4228 80220c12 88228061 d1fc422a 21ff8860 47704008 04000130 80028802 023FE074 E3520003 d2000000 00000000 </codes>
</cheat>


I wasn't sure about the DS Phat (forgot to mention that I hadn't tested it) since I don't have my Phat with me. I suppose I could make a cut down code that switches the lights on/off when you press L+R+SELECT + UP/DOWN, even if it isn't as useful with this supported in some games. I just think it's a shame Nintendo didn't add this ability to the Lite, even if it they would have to do it with a hardware button.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sat Apr 21, 2007 11:38 am 
Offline
Komrade
Komrade

Joined: Sat Jan 27, 2007 6:18 pm
Posts: 2070
Location: Dothan, Alabama
Title: Derp
It'll come in handy, especially with the battery

_________________
Image
WWDD? - What Would Dale Do?


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sat Apr 21, 2007 11:45 am 
Offline
Kommunist
Kommunist

Joined: Wed Feb 21, 2007 3:35 pm
Posts: 732
Location: In your house. Under your bed. Taking your stuff.
I don't believe it works with the phat because the phat does not have the ability to adjust the light like the lite does.

_________________
triath wrote:
If we move to the porn industry I may finally become useful with my horse cock. I want to be known as Todd the Brick Railer!


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sat Apr 21, 2007 12:19 pm 
Offline
Kommunist
Kommunist

Joined: Mon Jan 29, 2007 1:49 pm
Posts: 207
Location: Pennsylvania
Title: I'm back.
So, this works with the original Nintendo DS or not?

_________________
If they say no and you do it, it's rape...unless there's confetti, then it's surprise sex


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sat Apr 21, 2007 12:23 pm 
Offline
Kommunist
Kommunist
User avatar

Joined: Tue Feb 06, 2007 11:27 am
Posts: 367
Location: I'm currently looking for myself. Tell me if you find me.
regular ds would just make it turn on/off it did, but still very useful.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sat Apr 21, 2007 12:25 pm 
Offline
Kommunist
Kommunist

Joined: Mon Jan 29, 2007 1:49 pm
Posts: 207
Location: Pennsylvania
Title: I'm back.
I am going to test it right now.

_________________
If they say no and you do it, it's rape...unless there's confetti, then it's surprise sex


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sat Apr 21, 2007 12:30 pm 
Offline
Krew (Admin)
Krew (Admin)
User avatar

Joined: Sun Oct 01, 2006 9:46 pm
Posts: 2331
Location: *poof*
Title: The Mad Hacker
Nice job! :D

_________________
Image


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sat Apr 21, 2007 12:40 pm 
Offline
Komrade
Komrade

Joined: Sat Jan 27, 2007 6:18 pm
Posts: 2070
Location: Dothan, Alabama
Title: Derp
It works on the original DS
Only problem is sound loss, I have to do the buttons correctly

_________________
Image
WWDD? - What Would Dale Do?


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sat Apr 21, 2007 1:04 pm 
Offline
Kommunist
Kommunist

Joined: Mon Jan 29, 2007 1:49 pm
Posts: 207
Location: Pennsylvania
Title: I'm back.
I just tried it and it worked perfectly. No sound loss or anything.

_________________
If they say no and you do it, it's rape...unless there's confetti, then it's surprise sex


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sat Apr 21, 2007 1:05 pm 
Offline
Komrade
Komrade

Joined: Sat Jan 27, 2007 6:18 pm
Posts: 2070
Location: Dothan, Alabama
Title: Derp
What do you have Illusion?, Lite or Regular

**Dosn't work for Animal Crossing**

_________________
Image
WWDD? - What Would Dale Do?


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sat Apr 21, 2007 1:07 pm 
Offline
Kommunist
Kommunist

Joined: Mon Jan 29, 2007 1:49 pm
Posts: 207
Location: Pennsylvania
Title: I'm back.
Regular, just tried it on MPH.

_________________
If they say no and you do it, it's rape...unless there's confetti, then it's surprise sex


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sat Apr 21, 2007 2:11 pm 
Offline
Komrade
Komrade

Joined: Sat Jan 27, 2007 6:18 pm
Posts: 2070
Location: Dothan, Alabama
Title: Derp
Hmm, creepy, Ilose some sound, it turns down the volume to low

_________________
Image
WWDD? - What Would Dale Do?


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sat Apr 21, 2007 8:14 pm 
Offline
Kommunist
Kommunist

Joined: Wed Feb 28, 2007 5:52 pm
Posts: 79
Striker:
You probably started drawing too much power. If the battery light is red, don't go to a higher brightness.

Smalls1652:
Make sure you have a master code enabled for Animal Crossing. Nitro Hax v0.82 and above can use the Action Replay master code.

DS Phat owners:
I'll make a new code specifically for DS Phats when I can get ahold of mine to test on.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sat Apr 21, 2007 8:20 pm 
Offline
Kommunist
Kommunist
User avatar

Joined: Thu Apr 12, 2007 11:10 am
Posts: 140
Location: In front of my computer
Title: Silent Knuckler
i tested it too i have dslite, tried it on MPH, works like a charm, no problems what so ever... its funny how if u turn the backlight down to much u turn the screen black...

_________________
Image
Image
I am a proud NDS hacker.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sun Apr 22, 2007 1:06 am 
Offline
Kommunist
Kommunist

Joined: Wed Feb 28, 2007 5:52 pm
Posts: 79
Here's the code for DS Phats:
Code:
<cheat>
   <name>Backlight control (Phat)</name>
   <note>Hold L+R+SELECT then press UP to turn on screens or DOWN to turn off screens</note>
   <codes>94000130 fcfb0000 c2000001 00000080 a21cb5f0 88234c1c 80138811 d019428b 25803490 f0002000 1c06f818 420b2140 2180d003 d005420b 210ce00c d1094231 e0044331 4231210c 438ed004 20001c31 f805f000 bc08bcf0 30804718 88222100 d1fc422a 80224a09 88208060 d1fc4228 80220c12 88228061 d1fc422a 21ff8860 47704008 00000000 04000130 80028802 d2000000 00000000 </codes>
</cheat>


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Tue Apr 24, 2007 9:07 pm 
Offline
Kommunist
Kommunist

Joined: Sat Mar 17, 2007 3:40 pm
Posts: 31
Very nice work you all.

I cant wait to see what other kind of stuff like this you all might come up with

_________________
Image


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Wed Apr 25, 2007 7:38 am 
Offline
Kommunist
Kommunist
User avatar

Joined: Wed Feb 14, 2007 9:49 am
Posts: 59
uh...for some reason when i use this on mph it freezes the game afer about 10mins...=/
it's for the ds lite btw

_________________
http://www.virtual-community.co.nr/

Image


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Wed Apr 25, 2007 4:32 pm 
Offline
Kommunist
Kommunist
User avatar

Joined: Thu Apr 12, 2007 11:10 am
Posts: 140
Location: In front of my computer
Title: Silent Knuckler
Freezing, eh? Well when i tried the code, have to admit i didnt have it in effect for but a few seconds. ill have to test it again for a longer period of time and see what happens.

_________________
Image
Image
I am a proud NDS hacker.


Top
 Profile  
Reply with quote  
PostPosted: Sun Apr 29, 2007 2:46 pm 
Offline
Kommunist
Kommunist

Joined: Thu Apr 05, 2007 3:38 pm
Posts: 1
So, if I decided to use this code, where would I go about putting it (as in under which game)? Also, does this specific code work for other games other than MPH as well?

_________________
Image
Image
Image
Image
Image


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Mon Apr 30, 2007 10:22 am 
Offline
Komrade
Komrade

Joined: Sat Jan 27, 2007 6:18 pm
Posts: 2070
Location: Dothan, Alabama
Title: Derp
chishm wrote:
Smalls1652:
Make sure you have a master code enabled for Animal Crossing. Nitro Hax v0.82 and above can use the Action Replay master code.


Master code?
AR DS dosn't need a master code lol

_________________
Image
WWDD? - What Would Dale Do?


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 38 posts ]  Go to page 1, 2  Next

All times are UTC - 8 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 567 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group