Joystick compare problem

Started by Deathwolf, November 02, 2011, 01:13:47 AM

Previous topic - Next topic

Deathwolf

ATM I'm working on a GameCube Controler code which allows you to play with the Joystick.
The problem is now that only the last code gets activated.

Here are these 4 codes:

82000000 CD006404
82000001 CD006408
82000002 CD00640C
4A000000 CD006406 # right
3C000000 00008100  # if greather than 00008100
C206B07C 00000004
9421FFB0 BDC10008
60000004 90030000
B9C10008 38210050
60000000 00000000
E0000000 80008000
4A000000 CD006406
38000000 00008080 # if equal with 00008080
C206B07C 00000004
9421FFB0 BDC10008
60000000 90030000´# write nothing
B9C10008 38210050
60000000 00000000
E0000000 80008000

82000000 CD006404
82000001 CD006408
82000002 CD00640C
4A000000 CD006406 # up
3C000000 00008080 # if greather than 00008080
C206B07C 00000004
9421FFB0 BDC10008
60000002 90030000
B9C10008 38210050
60000000 00000000
E0000000 80008000
4A000000 CD006406
38000000 00008080 # if equal with 00008080
C206B07C 00000004
9421FFB0 BDC10008
60000000 90030000 # write nothing
B9C10008 38210050
60000000 00000000
E0000000 80008000



82000000 CD006404
82000001 CD006408
82000002 CD00640C
4A000000 CD006406 # left
3E000000 0000800B # if less than 0000800B
C206B07C 00000004
9421FFB0 BDC10008
60000008 90030000
B9C10008 38210050
60000000 00000000
E0000000 80008000
4A000000 CD006406
38000000 00008080 # if equal with 00008080
C206B07C 00000004
9421FFB0 BDC10008
60000000 90030000 # write nothing
B9C10008 38210050
60000000 00000000
E0000000 80008000

82000000 CD006404
82000001 CD006408
82000002 CD00640C
4A000000 CD006406 # down
3E000000 00008080 # if less than 00008080
C206B07C 00000004
9421FFB0 BDC10008
60000001 90030000
B9C10008 38210050
60000000 00000000
E0000000 80008000
4A000000 CD006406
38000000 00008080 # if equal with 00008080
C206B07C 00000004
9421FFB0 BDC10008
60000000 90030000 # write nothing
B9C10008 38210050
60000000 00000000
E0000000 80008000

any ideas how to do this?

Thanks
lolz

dcx2

C2 codes execute in the context of the game, not the code handler.  It's not like it writes some stuff to the gecko registers and then executes the C2 codes.  If multiple C2 codes hook the same address and execute in the same frame, the last C2 code will win; the game runs after the code handler has finished with all the codes for a frame, so the game only sees the last C2 that executed that frame.

The best approach is to make one primary C2 code that does the work for all four players.  Since this requires 12 Gecko Registers you should use a bl trick instead.

Deathwolf

Ah okay the bl trick. how would you write this code then? It would be really helpful to know.

Thanks

BTW here's the code which uses the same hook address and only the D-PAD of the GCC.

GameCube Controler
82000000 CD006404
82000001 CD006408
82000002 CD00640C
C206B07C 00000015
9421FFB0 BDC10008
3EA00000 62B50000
3DC0CD00 A18E6404
71950002 2C150000
41820008 60000004
71950001 2C150000
41820008 60000008
71950004 2C150000
41820008 60000001
71950100 2C150000
41820008 60000100
71950200 2C150000
41820008 60000200
71950008 2C150000
41820008 60000002
71951000 2C150000
41820008 60000010
71951000 2C150000
41820008 60001000
90030000 B9C10008
38210050 00000000
lolz