| Whats wrong with this sub? | |
|
|
|
Author | Message |
---|
-LeetGamer- Admin
Posts : 247 Points : 397 Reputation : 4 Join date : 2010-09-29 Age : 30
| Subject: Re: Whats wrong with this sub? Sun Oct 03, 2010 9:20 am | |
| I said it looks like your pointer was dynamic as in it's in the normal dma area (0x01.....) a dma pointer = multi dma Try the mips I posted and let me know if they work. | |
|
| |
GunstarBlue
Posts : 37 Points : 41 Reputation : 0 Join date : 2010-09-29
| Subject: Re: Whats wrong with this sub? Sun Oct 03, 2010 10:53 am | |
| Ok tried the code and it actually freezes when the address reaches 160 (the trigger value for the branch) =( .
Any ideas why?
Edit: Oh and here's my ps2dis screen if it helps any:
https://2img.net/r/ihimizer/img687/5152/ps2disnew.png | |
|
| |
-LeetGamer- Admin
Posts : 247 Points : 397 Reputation : 4 Join date : 2010-09-29 Age : 30
| Subject: Re: Whats wrong with this sub? Sun Oct 03, 2010 11:03 am | |
| - GunstarBlue wrote:
- Ok tried the code and it actually freezes when the address reaches 160 (the trigger value for the branch) =( .
Any ideas why?
Edit: Oh and here's my ps2dis screen if it helps any:
https://2img.net/r/ihimizer/img687/5152/ps2disnew.png - Code:
-
Lui t0 $Upper pointer + 0x0880 Lw t0 $Lower pointer(t0) Lw t0 $Offset(t0) //t0 now holds the current value of your dma address Ori t1 0 $160 //0 is the same as saying 0 //t1 = 0x160 now Lui t2 $Upper code address + 0x0880 Bne t0 t1 $To address of line "here" Nop Lui t3 $03e0 Ori t3 t3 $8 Sw t3 $Lower address of first line(t2) Sw 0 $Lower address of second line(t2) Beq 0 0 $To jr ra nop "here" Lui t3 $Upper off value for first line Ori t3 t4 $Lower off value for first line Lui t4 $Upper off value for second line Ori t4 t4 $Lower off value for second line Sw t3 $Second half of first line(t2) Sw t4 $Second half of second line(t2) Jr ra Nop
Last edited by -LeetGamer- on Sun Oct 03, 2010 11:44 am; edited 1 time in total | |
|
| |
GunstarBlue
Posts : 37 Points : 41 Reputation : 0 Join date : 2010-09-29
| Subject: Re: Whats wrong with this sub? Sun Oct 03, 2010 11:24 am | |
| Ok so should I change all instances of t5 to t3? Or just the ones after the branch? | |
|
| |
-LeetGamer- Admin
Posts : 247 Points : 397 Reputation : 4 Join date : 2010-09-29 Age : 30
| Subject: Re: Whats wrong with this sub? Sun Oct 03, 2010 11:44 am | |
| - GunstarBlue wrote:
- Ok so should I change all instances of t5 to t3? Or just the ones after the branch?
Forget I said that just try the MIPS I showed you. | |
|
| |
GunstarBlue
Posts : 37 Points : 41 Reputation : 0 Join date : 2010-09-29
| Subject: Re: Whats wrong with this sub? Sun Oct 03, 2010 1:11 pm | |
| Arggh, still freezing after the dash/trigger.. I'm wondering if I'm entering the info right.
Everything look good to you in my last pictures in terms of putting in the right info? Because I was confused at first by these 2 lines:
Sw t3 $Second half of first line(t2) Sw t4 $Second half of second line(t2)
But I used the two lines from the code I'm trying to have it branch to, so I'm pretty sure thats right... | |
|
| |
-LeetGamer- Admin
Posts : 247 Points : 397 Reputation : 4 Join date : 2010-09-29 Age : 30
| Subject: Re: Whats wrong with this sub? Sun Oct 03, 2010 2:16 pm | |
| - GunstarBlue wrote:
- Arggh, still freezing after the dash/trigger.. I'm wondering if I'm entering the info right.
Everything look good to you in my last pictures in terms of putting in the right info? Because I was confused at first by these 2 lines:
Sw t3 $Second half of first line(t2) Sw t4 $Second half of second line(t2)
But I used the two lines from the code I'm trying to have it branch to, so I'm pretty sure thats right... Yeah everything looked right D: this code hates us lol, try storing the values to address 3f00 and 3f04 to see if that works. If it does then there is an error in how you put the values in the code, if not then there is an error with, most likely, your dma information, as I said your pointer looks dynamic and most pointers that are not in a sma range usually have bugs. | |
|
| |
GunstarBlue
Posts : 37 Points : 41 Reputation : 0 Join date : 2010-09-29
| Subject: Re: Whats wrong with this sub? Sun Oct 03, 2010 5:01 pm | |
| You know what? Screw it... its not gonna work with that address that I undma'd and it's a shame too as it's the only thing that changes values at just to right time to make this code truly functional, but I guess you cant have everything =( . To be honest it doesn't compromise gameplay any and it still does what Im trying to do, which is re-balance the game. Though of course I do have one more question and then I'm gonna try my best to write my first complete subroutine that I've done myself. Buuut, for now my question is, can I make it so that in one subroutine more then one value can trigger a branch? Basically I want to use this code: - Code:
-
0xFFFFFFFF 0x004DFB90 0x00000AC4 0x00000000 In this subroutine: - Code:
-
lui t0, $08ce lw t0, $fcb0(t0) lw t0, $0ac4(t0) ori t1, zero, $0001 lui t2, $089e lui t3, $03e0 ori t3, t3, $0008 lui t4 $Upper off value ori t4 t4 $Lower off value lui t5 $Upper off value for the next line ori t5 t5 $Lower off value for the next line bne t0, t1, $To "//here" nop sw t3, $e3f0(t2) sw zero, $e3f4(t2) beq zero zero $To jr ra nop //here sw t4 $e3f0(t2) sw t5 $e3f4(t2) jr ra nop
and I want the branch to trigger when either the code that I've already put in there to watch, or the code that I just posted above gets the value of 1. After this though I'm gonna try and write my first sub on my own... lol wish me luck! | |
|
| |
-LeetGamer- Admin
Posts : 247 Points : 397 Reputation : 4 Join date : 2010-09-29 Age : 30
| Subject: Re: Whats wrong with this sub? Mon Oct 04, 2010 12:10 am | |
| - Code:
-
1) Lui t0 $Upper pointer 2) Lw t0 $Lower pointer(t0) 3) Lw t0 $Offset(t0) //t0 now holds the current value at are DMA address 4) Lui t1 $Upper value to check, only needed if the value to check is > 16bits 5) Ori t1 t1 $Lower value to check 6) Lui t2 $Upper 2nd value to check, only needed if the 2nd value to check is > 16bits 7) Ori t2 t2 $Lower 2nd value to check 8] Lui t3 $Upper code address that you want to turn on 9) Lui t4 $Upper code value that you want to turn on 10) Ori t4 t4 $Upper code value that you want to turn on 11) Bne t0 t1 $Branch to next bne 12) Nop 13) Sw t3 $Lower code address that you want to turn on(t3) 14) Bne t0 t2 $Branch to jr ra 15) Nop 16) Sw t3 $Lower code address that you want to turn on(t3) 17) Jr ra
Lines 1 - 3: Get the value of your dma address so we can check it against other values Lines 4 - 5: Loading the first value you want to check, only use line 4 if the value is > 16bits Lines 6 - 7: Loading the second value you want to check, only use line 6 if the value is > 16bits Lines 8: Upper code address to store to, I put it outside of the branch so we only have to write it one time and not two times right before each sw Lines 9 - 10: Loads the on (hex) value for the code you are wanting to activate, again this is so we only have to write it one time, because of scope (Let me know if you want to know what that means) Lines 11: Checks if are dma value equals are checking value 1, if it does then continue onto line 12, if not branch to the next branch command Lines 12: Delay slot for branch (Let me know if you want some information on this) Lines 13: Turn on the code Lines 14: Another check for the second value, you should get the idea now... Lines 15: Delay soot Lines 16: Turn on the code Lines 17: Jump to ra | |
|
| |
GunstarBlue
Posts : 37 Points : 41 Reputation : 0 Join date : 2010-09-29
| Subject: Re: Whats wrong with this sub? Mon Oct 04, 2010 5:57 am | |
| I know I usually try it first before I report back but I had a question that would keep me from potentially doing extra work lol. My question is, does this code check for 2 different values from the same pointer? Or two different pointers? Because that's actually what I was trying to ask, sorry if I typed it too confusing. Basically I want the sub to check these two dma addresses for the value of 1: - Code:
-
DMA 1 0xFFFFFFFF 0x004DFB90 0x00000AC4 0x00000000
DMA 2 0xFFFFFFFF 0x004DFCB0 0x00000ACC 0x00000000
that way if either one gets the value of 1 the code activates. The only reason I'm asking/questioning is because I looked over the sub and I've only seen places where I should point one dma pointer and not two. Either way that was an AMAZING breakdown of how the registers work. I appreciate all the help you've been giving me. That breakdown is gonna be really useful when I write my next sub from scratch! | |
|
| |
-LeetGamer- Admin
Posts : 247 Points : 397 Reputation : 4 Join date : 2010-09-29 Age : 30
| Subject: Re: Whats wrong with this sub? Mon Oct 04, 2010 6:22 am | |
| lol thx and how about this, if you want to try and make a code from scratch then send me a try at the mips in this thread and I will go over it we have gone over checking values and my last post was on checking two values, now try to check two dma address with one value | |
|
| |
GunstarBlue
Posts : 37 Points : 41 Reputation : 0 Join date : 2010-09-29
| Subject: Re: Whats wrong with this sub? Mon Oct 04, 2010 9:21 am | |
| Alright I think I can do this...
But one last question, which is what always confused me about these subs, how do I go about using the t registers?? (for example t1,t2, etc.) . I've been over them and I cant really decipher how it works or when/where I should use certain t numbers.
You know what? I'm gonna try it anyways and I'll just post it. You can help me with the T's then. | |
|
| |
-LeetGamer- Admin
Posts : 247 Points : 397 Reputation : 4 Join date : 2010-09-29 Age : 30
| Subject: Re: Whats wrong with this sub? Mon Oct 04, 2010 9:31 am | |
| - GunstarBlue wrote:
- Alright I think I can do this...
But one last question, which is what always confused me about these subs, how do I go about using the t registers?? (for example t1,t2, etc.) . I've been over them and I cant really decipher how it works or when/where I should use certain t numbers.
You know what? I'm gonna try it anyways and I'll just post it. You can help me with the T's then. Just start from 0, then use t0, then go to 1 and use t1 | |
|
| |
GunstarBlue
Posts : 37 Points : 41 Reputation : 0 Join date : 2010-09-29
| Subject: Re: Whats wrong with this sub? Mon Oct 04, 2010 7:27 pm | |
| Confused about the very last sub that you wrote for me, on line 9 & 10 you wrote "upper code value that you want to turn on" is that right? or is line 10 supposed to be "lower code value that you want to turn on"?
I'm wondering because I'm trying to decipher parts of it to use in the sub that you're trying to have me write on my own.
Thanks. | |
|
| |
-LeetGamer- Admin
Posts : 247 Points : 397 Reputation : 4 Join date : 2010-09-29 Age : 30
| Subject: Re: Whats wrong with this sub? Mon Oct 04, 2010 7:31 pm | |
| yeah you are right, 10 = lower code value | |
|
| |
GunstarBlue
Posts : 37 Points : 41 Reputation : 0 Join date : 2010-09-29
| Subject: Re: Whats wrong with this sub? Mon Oct 04, 2010 8:11 pm | |
| Here's the sub I wrote that attempts to make it so that these 2 dma codes: - Code:
-
DMA 1 0xFFFFFFFF 0x004DFB90 0x00000AC4 0x00000000
DMA 2 0xFFFFFFFF 0x004DFCB0 0x00000ACC 0x00000000 those 2 codes are watched for the value to become 1 (hex) before executing this code: - Code:
-
0x001DE3F0 0x03E00008 0x001DE3F4 0x00000000
Here's a link to a picture of my ps2 dis. The code starts at 008806fc. I would have wrote it out in mips but I did all my work straight in ps2dis first. In the future I'll write out the mips code as I'm sure it's easier to look over. My bad. https://2img.net/r/ihimizer/img135/7083/testsub.png Either way, I feel like there's more to it then that as the code we had before needed some fancy extra tricks to make it so that the code worked correctly.. but one step at a time lol | |
|
| |
-LeetGamer- Admin
Posts : 247 Points : 397 Reputation : 4 Join date : 2010-09-29 Age : 30
| Subject: Re: Whats wrong with this sub? Mon Oct 04, 2010 8:32 pm | |
| Looks good but the second branch is checking the first value still, change it to t1 to check the second value. | |
|
| |
GunstarBlue
Posts : 37 Points : 41 Reputation : 0 Join date : 2010-09-29
| Subject: Re: Whats wrong with this sub? Mon Oct 04, 2010 8:51 pm | |
| welp, crashed the game when I tried it =/ . So far only this subroutine has worked without fail for me - Code:
-
lui t0, $08ce lw t0, $fcb0(t0) lw t0, $0ac4(t0) ori t1, zero, $0001 lui t2, $089e lui t3, $03e0 ori t3, t3, $0008 lui t4 $Upper off value ori t4 t4 $Lower off value lui t5 $Upper off value for the next line ori t5 t5 $Lower off value for the next line bne t0, t1, $To "//here" nop sw t3, $e3f0(t2) sw zero, $e3f4(t2) beq zero zero $To jr ra nop //here sw t4 $e3f0(t2) sw t5 $e3f4(t2) jr ra nop If I were to add the other dma code to the top before the branch and change the t's accordingly do you think that it would work? Because I've tried to just duplicate the same code and add in the other dma value' of course switching the hook and the spots in the code cave where I wrote the subroutine so it didn't conflict with the code above and both wouldn't work at the same time =( . What was weird too was that the code which used the different dma address was activated, once I left the game to go to the main menu it would freeze, but that could be a hook issue. Either way, I know I always posts like walls of text lol, but either way like I asked above: If I were to add the other dma code to the top before the branch and change the t's accordingly do you think that it would work? | |
|
| |
Emu
Posts : 21 Points : 29 Reputation : 0 Join date : 2010-10-04
| Subject: Re: Whats wrong with this sub? Tue Oct 05, 2010 5:10 am | |
| If you want I'll hold your hand once and write your sub for you... Just give me everything I will need and give specific instructions. What I use to make my codes uses pesudo opcode so when I compile it it will be a tad longer.
google pesudo code if you don't know it. | |
|
| |
GunstarBlue
Posts : 37 Points : 41 Reputation : 0 Join date : 2010-09-29
| Subject: Re: Whats wrong with this sub? Tue Oct 05, 2010 5:37 am | |
| Thanks but no thanks Emu.
I've kind of been having my hand held this whole time and even if it's happening now step by step I'd rather do it this way so I can learn from my mistakes one move at a time and not just have somebody write it for me.
I've written a few already just nothing this complicated (yes, this is complicated for me, I'm just starting out). Leet's been a good teacher so far so I'll keep doing it this way.
If someone "holds my hand" and writes it for me how can I learn?
Again, Thanks but no thanks. | |
|
| |
-LeetGamer- Admin
Posts : 247 Points : 397 Reputation : 4 Join date : 2010-09-29 Age : 30
| Subject: Re: Whats wrong with this sub? Tue Oct 05, 2010 7:07 am | |
| - GunstarBlue wrote:
- welp, crashed the game when I tried it =/ .
So far only this subroutine has worked without fail for me
- Code:
-
lui t0, $08ce lw t0, $fcb0(t0) lw t0, $0ac4(t0) ori t1, zero, $0001 lui t2, $089e lui t3, $03e0 ori t3, t3, $0008 lui t4 $Upper off value ori t4 t4 $Lower off value lui t5 $Upper off value for the next line ori t5 t5 $Lower off value for the next line bne t0, t1, $To "//here" nop sw t3, $e3f0(t2) sw zero, $e3f4(t2) beq zero zero $To jr ra nop //here sw t4 $e3f0(t2) sw t5 $e3f4(t2) jr ra nop If I were to add the other dma code to the top before the branch and change the t's accordingly do you think that it would work?
Because I've tried to just duplicate the same code and add in the other dma value' of course switching the hook and the spots in the code cave where I wrote the subroutine so it didn't conflict with the code above and both wouldn't work at the same time =( . What was weird too was that the code which used the different dma address was activated, once I left the game to go to the main menu it would freeze, but that could be a hook issue.
Either way, I know I always posts like walls of text lol, but either way like I asked above: If I were to add the other dma code to the top before the branch and change the t's accordingly do you think that it would work? Did you try changing the branch like I said in my last post? And does it freeze when you turn it on or when? | |
|
| |
GunstarBlue
Posts : 37 Points : 41 Reputation : 0 Join date : 2010-09-29
| Subject: Re: Whats wrong with this sub? Tue Oct 05, 2010 8:05 am | |
| I definitely changed the branch before I tried it. I do pay attention you know =p lol.
It freezes when the code activates and I attempt to do the move that the code is supposed to nop. | |
|
| |
-LeetGamer- Admin
Posts : 247 Points : 397 Reputation : 4 Join date : 2010-09-29 Age : 30
| Subject: Re: Whats wrong with this sub? Tue Oct 05, 2010 8:35 am | |
| - GunstarBlue wrote:
- I definitely changed the branch before I tried it. I do pay attention you know =p lol.
It freezes when the code activates and I attempt to do the move that the code is supposed to nop. If the code freezes right when you turn it on: - Quote :
- Change both branches to
beq 0 0 ${{Address or jr ra}
Then try, if it still freezes then the problem is before the first branch. Else: - Quote :
- Triple check that the values are right and that you used the negative rule correctly.
| |
|
| |
GunstarBlue
Posts : 37 Points : 41 Reputation : 0 Join date : 2010-09-29
| Subject: Re: Whats wrong with this sub? Tue Oct 05, 2010 9:42 am | |
| I did, the negative rule = "if the beginning of the lw address is over 8 then you have to put the lui address+1" right? I definitely did that, it's one of the fist things I look for if that is the rule. I'll try the beq 0 0 ${{Address or jr ra} string in a bit and let you know how that goes. I'm at work and I can't really start writing subroutines till my lunch break lol. -EDIT- Ok, I finally got a chance to try what you suggested and this time nothing worked at all. I went over the routine again just to make sure and everything seems to be in order. This code man lol... I mean I think it's me messing it up but then when you look over my work and it looks decent, I can't call it =(. I really wonder where Im screwing up -EDIT 2- Ok, I took the sub that was working for me with the check for the one dma address and tried to add a 2nd one. Here's the mips for it: - Code:
-
lui t0, $08ce lw t0, $fcb0(t0) lw t0, $0ac4(t0) lui t1, $08ce lw t1, $fb90(t1) lw t1, $0ac4(t1) ori t2, zero, $0001 lui t3, $089e lui t4, $03e0 ori t4, t4, $0008 lui t5 $Upper off value ori t5 t5 $Lower off value lui t6 $Upper off value for the next line ori t6 t6 $Lower off value for the next line bne t0, t2, $To "//here" nop sw t4, $e3f0(t3) sw zero, $e3f4(t3) beq zero zero $To jr ra nop //here sw t5 $e3f0(t3) sw t6 $e3f4(t3) jr ra nop like I was saying before, this also freezes as soon as I try to do anything that has to do with the code itself, even before the address goes to what it needs to be on to activate the code. i.e. The code cancels the dash move, but only when you're getting hit (which makes the value go to 1). BUT the game freeze if I try to dash at all whether I being hit or not... I think the mips before the branch may be screwed up.. any ideas leet? | |
|
| |
-LeetGamer- Admin
Posts : 247 Points : 397 Reputation : 4 Join date : 2010-09-29 Age : 30
| Subject: Re: Whats wrong with this sub? Tue Oct 05, 2010 8:22 pm | |
| | |
|
| |
Sponsored content
| Subject: Re: Whats wrong with this sub? | |
| |
|
| |
| Whats wrong with this sub? | |
|