Region free analog stick fix

Started by dcx2, July 05, 2011, 05:30:06 AM

Previous topic - Next topic

dcx2

So my GameCube controller sucks.  The analog stick almost goes far enough to make me run in Wind Waker.  Frustrated by this, I made a code which makes the analog stick appear to be pressed harder.  So instead of maxing out at e.g. 0x50, it now maxes out at 0x7F.  Now my character can run without me trying to break my thumb.

I made the code region free.  If you have a GameCube loader that supports F6 codes then this should work for you, I hope.  It works for Wind Waker and Tales of Symphonia, which use two different pad functions.

Universal region free analog stick fix for GameCube [dcx2]
F6000001 80008133
2C000400 41820198
D2000218 0000000A
98040005 39800004
7D8903A6 39840001
880C0001 7C000774
2C000010 4181000C
2C00FFF0 41810020
1C000002 2C00FF81
40800008 3800FF81
2C00007F 40810008
3800007F 9C0C0001
4200FFC8 00000000
E0000000 80008000



[spoiler=source]# F6 Z values - 2C000400 41820198
# should find this instruction     cmpwi   r0,1024
# which needs +0x218 to get to hook address

stb r0,5(r4)

li r12,4
mtctr r12
addi r12,r4,1   # prime r12 with a pointer

_TOP_OF_LOOP:

lbz r0,1(r12)
extsb r0,r0

cmpwi r0,16   # don't change if too shallow
bgt- _DO_HACK
cmpwi r0,-16
bgt- _NO_HACK

_DO_HACK:
mulli r0,r0,2

cmpwi r0,-127   # don't roll over 8-bits
bge- 0f
li r0,-127
0:

cmpwi r0,127
ble- 0f
li r0,127
0:

_NO_HACK:
stbu r0,1(r12)

bdnz+ _TOP_OF_LOOP
[/spoiler]

biolizard89

Nice job, I assume this is hooking the PadRead function?

Bully@Wiiplaza

#2
Quote from: biolizard89 on July 05, 2011, 07:50:10 AM
Nice job, I assume this is hooking the PadRead function?
I guess it´s hooking the store instruction.
*Thoughts bolded*
For me, it´s also reasonable to use the store one, because you want the code to be executed if the control stick is pushed.
Btw. nice work dcx2 ;D

[spoiler=source]# F6 Z values - 2C000400 41820198
# should find this instruction     cmpwi   r0,1024
# which needs +0x218 to get to hook address

stb r0,5(r4)

li r12,4
mtctr r12
addi r12,r4,1   # prime r12 with a pointer

_TOP_OF_LOOP:

lbz r0,1(r12)
extsb r0,r0

cmpwi r0,16   # don't change if too shallow
bgt- _DO_HACK
cmpwi r0,-16
bgt- _NO_HACK

_DO_HACK:
mulli r0,r0,2

cmpwi r0,-127   # don't roll over 8-bits
bge- 0f
li r0,-127
0:

cmpwi r0,127
ble- 0f
li r0,127
0:

_NO_HACK:
stbu r0,1(r12)

bdnz+ _TOP_OF_LOOP
[/spoiler]
My Wii hacking site...
http://bullywiihacks.com/

My youtube account with a lot of hacking videos...
http://www.youtube.com/user/BullyWiiPlaza

~Bully

dcx2

I'm not quite sure this hooks PadRead.  It looks like this function only does analog stick stuff.  I probably hooked a function which PadRead calls to format the analog stick data.

Deathwolf

I'm not sure but is it possible to make a code like "using gamecube controler instand of wiimote"? I heard it's DVAR and it's called "Bind_Wii"
or something like this in ASCII. However, please remove it if it's offtopic.

Good work.
lolz

Bully@Wiiplaza

#5
Quote from: Deathwolf on July 05, 2011, 03:59:16 PM
I'm not sure but is it possible to make a code like "using gamecube controler instand of wiimote"? I heard it's DVAR and it's called "Bind_Wii"
or something like this in ASCII. However, please remove it if it's offtopic.

Good work.
no, that´s completely false. It´s not called "dvars" either.
Only Call of Duty games use those "key bindings" and you can´t allow the usage of another controller with them.
They are used to make button activated "command" hacks.
Here´s an example:

twistbind WII_B "give ammo"

this will refill our ammo count, if the wiimote is twisted and the b button is pressed. ;D
My Wii hacking site...
http://bullywiihacks.com/

My youtube account with a lot of hacking videos...
http://www.youtube.com/user/BullyWiiPlaza

~Bully

Deathwolf

lolz

hetoan2

dvar = direct variable
cvar = console variable

._.

those only apply to call of duty on the wii (well really quake engine games)

Call of duty never hooks a GCN controller afaik, so it's not possible.

And controllers aren't monitored by dvars or .gsc/.ff files anyways. that'd be the main.dol


Check out my site with codes obviously...
http://hetoan2.com/

and youtube...
http://youtube.com/hetoan2

XeR

Quote from: Deathwolf on July 05, 2011, 03:59:16 PM
I'm not sure but is it possible to make a code like "using gamecube controler instand of wiimote"? I heard it's DVAR and it's called "Bind_Wii"
or something like this in ASCII. However, please remove it if it's offtopic.

Good work.
You can if PAD_Init() has been called. It may be possible to emulate PAD_Init() now with the extended code list.
Edit: Yes, it seems off-topic.

dcx2

I don't really consider the idea of using the GameCube controller to be off-topic.

The DVAR stuff, yeah.  That's OT.

---

So, if the GCN controller wasn't "activated", all we have to do is call an init function and then we can start using it?  Where would the pad data go?

XeR

We need Pad_Init() and PAD_ButtonsDown(), but I think we just need Pad_Init() and that PAD_ButtonsDown will read the 'button activator address' and the 'last frame button activator address' and make the difference.
I don't really know where it will put those values tho.
I debugged the PAD_Init() value a while ago (27 september 2010), so libogc may have changed

        0x80016aac    <PAD_Init>:        mflr    r0
    -    0x80016ab0    <PAD_Init+4>:        stwu    r1,-16(r1)
    -    0x80016ab4    <PAD_Init+8>:        stw     r31,12(r1)
    -    0x80016ab8    <PAD_Init+12>:        stw     r0,20(r1)
        0x80016abc    <PAD_Init+16>:        lwz     r0,564(r13)
    -    0x80016ac0    <PAD_Init+20>:        cmpwi   cr7,r0,0
    -    0x80016ac4    <PAD_Init+24>:        bne-    cr7,0x80016b84 <PAD_Init+216>
    -    0x80016ac8    <PAD_Init+28>:        lwz     r0,96(r13)
    -    0x80016acc    <PAD_Init+32>:        cmpwi   cr7,r0,0
    -    0x80016ad0    <PAD_Init+36>:        beq-    cr7,0x80016af4 <PAD_Init+72>
    -    0x80016ad4    <PAD_Init+40>:        cmpwi   cr7,r0,1
    -    0x80016ad8    <PAD_Init+44>:        beq-    cr7,0x80016b9c <PAD_Init+240>
    -    0x80016adc    <PAD_Init+48>:        cmplwi  cr7,r0,5
    -    0x80016ae0    <PAD_Init+52>:        bgt-    cr7,0x80016af0 <PAD_Init+68>
    -    0x80016ae4    <PAD_Init+56>:        lis     r9,-32767
    -    0x80016ae8    <PAD_Init+60>:        addi    r9,r9,23592
    -    0x80016aec    <PAD_Init+64>:        stw     r9,532(r13)
    -    0x80016af0    <PAD_Init+68>:        stw     r0,96(r13)
    -    0x80016af4    <PAD_Init+72>:        lis     r31,-32763
    -    0x80016af8    <PAD_Init+76>:        li      r4,0
    -    0x80016afc    <PAD_Init+80>:        addi    r31,r31,-23680
    -    0x80016b00    <PAD_Init+84>:        li      r5,64
    -    0x80016b04    <PAD_Init+88>:        mr      r3,r31
    -    0x80016b08    <PAD_Init+92>:        bl      0x8002517c <memset>
    -    0x80016b0c    <PAD_Init+96>:        lis     r0,-4096
    -    0x80016b10    <PAD_Init+100>:        stw     r0,540(r13)
    -    0x80016b14    <PAD_Init+104>:        li      r0,4
    -    0x80016b18    <PAD_Init+108>:        lis     r7,-32763
    -    0x80016b1c    <PAD_Init+112>:        mtctr   r0
    -    0x80016b20    <PAD_Init+116>:        addi    r7,r7,-23696
    -    0x80016b24    <PAD_Init+120>:        li      r9,0
    -    0x80016b28    <PAD_Init+124>:        li      r8,-1
    -    0x80016b2c    <PAD_Init+128>:        rlwinm  r10,r9,22,0,9
    -    0x80016b30    <PAD_Init+132>:        oris    r10,r10,19712
    -    0x80016b34    <PAD_Init+136>:        rlwinm  r11,r9,4,0,27
    -    0x80016b38    <PAD_Init+140>:        ori     r10,r10,1536
    -    0x80016b3c    <PAD_Init+144>:        add     r11,r31,r11
    -    0x80016b40    <PAD_Init+148>:        rlwinm  r0,r9,2,0,29
    -    0x80016b44    <PAD_Init+152>:        stwx    r10,r7,r0
    -    0x80016b48    <PAD_Init+156>:        stw     r8,12(r11)
    -    0x80016b4c    <PAD_Init+160>:        addi    r9,r9,1
    -    0x80016b50    <PAD_Init+164>:        bdnz+   0x80016b2c <PAD_Init+128>
    -    0x80016b54    <PAD_Init+168>:        bl      0x8001c1a4 <SI_RefreshSamplingRate>
    -    0x80016b58    <PAD_Init+172>:        lis     r3,-32765
    -    0x80016b5c    <PAD_Init+176>:        addi    r3,r3,-6612
    -    0x80016b60    <PAD_Init+180>:        bl      0x80018510 <SYS_RegisterResetFunc>
    -    0x80016b64    <PAD_Init+184>:        li      r0,1
    -    0x80016b68    <PAD_Init+188>:        stw     r0,564(r13)
    -    0x80016b6c    <PAD_Init+192>:        lis     r3,-4096
    -    0x80016b70    <PAD_Init+196>:        lwz     r0,20(r1)
    -    0x80016b74    <PAD_Init+200>:        lwz     r31,12(r1)
    -    0x80016b78    <PAD_Init+204>:        addi    r1,r1,16
    -    0x80016b7c    <PAD_Init+208>:        mtlr    r0
    -    0x80016b80    <PAD_Init+212>:        b       0x8001613c <PAD_Reset>
    -    0x80016b84    <PAD_Init+216>:        lwz     r0,20(r1)
    -    0x80016b88    <PAD_Init+220>:        li      r3,1
    -    0x80016b8c    <PAD_Init+224>:        lwz     r31,12(r1)
    -    0x80016b90    <PAD_Init+228>:        addi    r1,r1,16
    -    0x80016b94    <PAD_Init+232>:        mtlr    r0
    -    0x80016b98    <PAD_Init+236>:        blr
    -    0x80016b9c    <PAD_Init+240>:        lis     r9,-32767
    -    0x80016ba0    <PAD_Init+244>:        stw     r0,96(r13)
    -    0x80016ba4    <PAD_Init+248>:        addi    r9,r9,23312
    -    0x80016ba8    <PAD_Init+252>:        stw     r9,532(r13)
    -    0x80016bac    <PAD_Init+256>:        b       0x80016af4 <PAD_Init+72>


BTW, wouldn't it be better for this to be in "the place we should never talk about"  :-X?

Deathwolf

Classic controler instand of Wiimote:

Classic Controler [Ported from Crediar]
C24A3FC0 00000020
38210050 7C0802A6
80B50060 48000041
80950000 7CA52378
90B50000 80B50064
4800002D 80950004
7CA52378 90B50004
80B50068 48000019
80950008 7CA52378
90B50008 7C0803A6
4E800020 70A40200
2C040000 4182000C
38C0012D B0D50186
38C00000 70A40800
2C040000 41820008
60C68000 70A40020
2C040000 41820008
60C60200 70A40040
2C040000 41820008
60C60100 70A40001
2C040000 41820008
60C60002 70A40002
2C040000 41820008
60C60008 70A48000
2C040000 41820008
60C60004 70A44000
2C040000 41820008
60C60001 70A40400
2C040000 41820008
60C60010 70A41000
2C040000 41820008
60C61000 7CC53378
60000000 00000000
04387CF0 38A00000
0438526C 28000009
lolz

XeR

The Wiimote, once initialised, will initialise every other extensions (Nunchuck, CC, Guitar etc...)

hetoan2

Quote from: Sharkbyte on July 09, 2011, 01:00:27 AM
I have been offline for 5 days and am just now reading this.
-snip-
Your code doesn't work! Link moves as normal as he always does. Nothing changed. What hook did you use or what loader did you use? I tried a bunch of hooks and I load mine through gecko os mod. Whats weird is I was trying to make a similar code for wii nunchuk, but not region free and I got close and could NOT get it to work either! I spent 4 hours on it.  >:( >:( >:(
It does work. It makes the analog stick easier to get to the "max" value. If you're already at max, you won't see speed increases... there's a max speed you know... not ALL controllers are broken in the way dcx2's is.


Check out my site with codes obviously...
http://hetoan2.com/

and youtube...
http://youtube.com/hetoan2

dcx2

#14
What hetoan2 said.  It's for GameCube controllers with old, shitty analog sticks.  If your analog stick is good, you don't need this code.

My analog sticks maxed out at 0x50 or so, which is about 2/3 of the limit, 0x7F.  So if I pushed the analog stick all the way forward, Link walked.  I could not make him run unless I pushed on the analog stick really, really hard.

Rather than buying a brand new controller, I just made a code that fixed my analog stick.

EDIT:

I just saw you're using Gecko OS Mod.  It uses an old code handler which does not support F6 codes.  I asked WiiPower to update Gecko OS Mod to support the new code types.  He says he's working on it, plus he's making room for a 32kB code list.

For now, I use NeoGamma with WiiPower's cMIOS to load my retail GC discs.  It's the only way to use F2/F6 codes on GameCube games.