Disable the button ok in vs mode
#11
(11-21-2021, 03:13 PM)Vega Wrote: Considering Stebler is from Europe, and all the documentation of MKW is mostly in PAL, it's safe to say that pointer/address is PAL.
oh ok thanks
Reply
#12
I made a version in python but is doesn't work i think the error can be I don't understand @ha and @l maybe

the code:
import dolphin_memory_engine as dolphin_memory

dolphin_memory.hook()

def lwz(a,b):
    return dolphin_memory.read_word(a+b)
def stw(a,b,c):
    dolphin_memory.write_word(a+b,c)
def lhz(a,b):
    v = hex(lwz(a, b))[2:]
    return int(v[:4],16)
def ori(a,b):
    a = hex(a)[2:]
    b= hex(b)[2:]
    return int(a[:-len(b)]+b,16)
def sth(a,b,c):
    dolphin_memory.write_word(a+b,c)
   
def press_a():
    r3 = 0x809c0000
    r3 = lwz(r3, -0x28f4)
    r3 = lwz(r3, 0x8)
    r4 = lhz(r3, 0x20)
    r4 = ori(r4,0x1)
    r4 = lhz(r3, 0x20)

press_a()
Reply
#13
@ha and @l are tools in an ASM compiler to help with applying values of statements, variables, and macros to various instructions

.set InputManager_s_instance, 0x809bd70c

lis r3, InputManager_s_instance@ha
lwz r3, InputManager_s_instance@l (r3)

With the address of 0x809bd70c. If you split it in 'half' and try to execute the following instructions...
lis r3, 0x809B
lwz r3, 0xD70C (r3)

The compiler will reject it. The 0xD70C is not within the proper 16-bit signed range.

What @ha will do is adjust the value during compilation to comply with the 16-bit signed range. Thus the instructions end up like this...

lis r3, 0x809C #809B + 1
lwz r3, 0xFFFFD70C (r3) #Sign extend 0xD70C to comply with range

Now this will compile and load the r3 value from the correct spot originally specified in r3.

When using any instructions that treat its values as signed you wanna use @ha and @l. If you are using instructions that treat its values as logical you would instead use @h and @l.

@ha = Upper Half (+1 if necessary)
@h = Upper Half
@l = Lower Half (will be sign extended if used with @ha only when its necessary)
Reply
#14
(11-21-2021, 05:42 PM)Vega Wrote: @ha and @l are tools in an ASM compiler to help with applying values of statements, variables, and macros to various instructions

.set InputManager_s_instance, 0x809bd70c

lis r3, InputManager_s_instance@ha
lwz r3, InputManager_s_instance@l (r3)

With the address of 0x809bd70c. If you split it in 'half' and try to execute the following instructions...
lis r3, 0x809B
lwz r3, 0xD70C (r3)

The compiler will reject it. The 0xD70C is not within the proper 16-bit signed range.

What @ha will do is adjust the value during compilation to comply with the 16-bit signed range. Thus the instructions end up like this...

lis r3, 0x809C #809B + 1
lwz r3, 0xFFFFD70C (r3) #Sign extend 0xD70C to comply with range

Now this will compile and load the r3 value from the correct spot originally specified in r3.

When using any instructions that treat its values as signed you wanna use @ha and @l. If you are using instructions that treat its values as logical you would instead use @h and @l.

@ha = Upper Half (+1 if necessary)
@h = Upper Half
@l = Lower Half (will be sign extended if used with @ha only when its necessary)
ok i fix this in my code and doesn't work

the code:
import dolphin_memory_engine as dolphin_memory

dolphin_memory.hook()

def lwz(a,b):
    i = hex(a+b)[2:]
    i = i[-8:]
    i = int(i,16)
    return dolphin_memory.read_word(i)
def stw(a,b,c):
    dolphin_memory.write_word(a+b,c)
def lhz(a,b):
    v = hex(lwz(a, b))[2:]
    return int(v[:4],16)
def ori(a,b):
    a = hex(a)[2:]
    b= hex(b)[2:]
    return int(a[:-len(b)]+b,16)
def sth(a,b,c):
    dolphin_memory.write_word(a+b,c)
   
def press_a():
    r3 = 0x809c0000
    r3 = lwz(r3, 0xFFFFD70C)
    r3 = lwz(r3, 0x8)
    r4 = lhz(r3, 0x20)
    r4 = ori(r4,0x1)
    r4 = lhz(r3, 0x20)
    print(hex(r3))

press_a()
Reply
#15
I don't know how to program in Python, so I can't be of much help on that. Apologies.
Reply
#16
i make a C0 and doesn't work to maybe is just the code

the code:
lis r12, 0x8035
lhz r12, 0x57E2 (r12)
li r11, 0x0880
and r0, r11, r12
cmpw r0, r11
lis r12, 0x8000
beq- button_pressed

#Nothing Pressed, Reset Button Status, End C0
li r0, 0
stb r0, 0x3FF (r12)
blr


button_pressed:
.set InputManager_s_instance, 0x809bd70c

lis r3, InputManager_s_instance@ha
lwz r3, InputManager_s_instance@l (r3)
lwz r3, 0x8 (r3)
lhz r4, 0x20 (r3)
ori r4, r4, 0x1
sth r4, 0x20 (r3)

blr
Reply
#17
ASM is far far different that higher level languages. You can't just slap together snippets of code into a source and have it work. While you may get away with that from time to time on higher languages, it's impossible on ASM.

Code:
the code:
lis r12, 0x8035
lhz r12, 0x57E2 (r12)

To load current button values from PAL 1st Player wheel/chuck, you need to use 803457E2, not 803557E2

Code:
li r0, 0
stb r0, 0x3FF (r12)
blr

What is this for? I see it's from my XYZ Swapper code. This portion of your code literally serves zero purpose. That was why I said at the beginning that you can't just slap random pieces of code together. When writing Assembly, you should be able to account for every instruction in your source, being able to explain why each instruction is present.

Also, your code as whole (if it did work from it appears you want it to do) does nothing. It's just grabbing button statuses and then doing a one frame hit on the A button. Nothing as far as game mechanics is being changed/modified.
Reply
#18
(11-21-2021, 10:31 PM)Vega Wrote: ASM is far far different that higher level languages. You can't just slap together snippets of code into a source and have it work. While you may get away with that from time to time on higher languages, it's impossible on ASM.

Code:
the code:
lis r12, 0x8035
lhz r12, 0x57E2 (r12)

To load current button values from PAL 1st Player wheel/chuck, you need to use 803457E2, not 803557E2

Code:
li r0, 0
stb r0, 0x3FF (r12)
blr

What is this for? I see it's from my XYZ Swapper code. This portion of your code literally serves zero purpose. That was why I said at the beginning that you can't just slap random pieces of code together. When writing Assembly, you should be able to account for every instruction in your source, being able to explain why each instruction is present.

Also, your code as whole (if it did work from it appears you want it to do) does nothing. It's just grabbing button statuses and then doing a one frame hit on the A button. Nothing as far as game mechanics is being changed/modified.
yes I take this part without understand all. i have the habit to put the code together and see if is work and at the end remove all the part i don't use and i use a gamecube manette(when i compile with code writer i have a error so i put this and change after in the cheat code). i retry and it's change nothing i go to see in memory something change. and i try to change because if is valid so it's this adresse he see the button ok if is not change so it's not this place
Reply
#19
Removed your duplicate posts and fixed the quotes.

(11-22-2021, 12:12 AM)coco Wrote: yes I take this part without understand all. i have the habit to put the code together and see if is work and at the end remove all the part i don't use and i use a gamecube manette(when i compile with code writer i have a error so i put this and change after in the cheat code). i retry and it's change nothing i go to see in memory something change. and i try to change because if is valid so it's this adresse he see the button ok if is not change so it's not this place
  • Don't just add 'code together' to 'see if it works'. That makes no sense.
  • Never heard of Gamecube Manette
  • What errors are you getting on CodeWrite? For me CodeWrite works fine except on detecting some bad branch labeling once in a blue moon (which Pyii will catch, codewrite will compile incorrectly), and codewrite not being able to use 16-bit ASCII strings.
  • Touching on what I said earlier, Assembly isn't tough to learn. But it has to be learned properly, or else you will never understand it. Follow this gigantic thread if you are willing to learn - https://mariokartwii.com/showthread.php?tid=1114
Reply
#20
he made this error. And i forgot to put controller at the place of manette (is in french), sorry.


Attached Files Thumbnail(s)
   
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)