PSP Coding


 
HomeCalendarFAQSearchMemberlistUsergroupsRegisterLog in

Share | 
 

 Whats wrong with this sub?

Go down 
Go to page : 1, 2, 3  Next
AuthorMessage
GunstarBlue



Posts : 37
Points : 41
Reputation : 0
Join date : 2010-09-29

PostSubject: Whats wrong with this sub?   Thu Sep 30, 2010 11:40 am

Ok, sooo been bugging leet with this for a while and Im still stuck lol.

The problem is that I can't get the code to activate when the value reaches the value I set aside in the subroutine. Here's the codes and an example of the final sub that I wrote..

Code 1 (the code that points to the address that I want to watch for value change):
Code:

0xFFFFFFFF 0x004DFCB0
0x00000ACC 0x00000000

Code 2 (the code I want to activate when the value on the above code becomes 00000001)
Code:

0x001DE3F0 0x03E00008
0x001DE3F4 0x00000000

And here's the sub I wrote:

Code:
lui t0, $08ce
lw t0, $fcb0(t0)
lw t0, $0aac(t0)
ori t1, zero, $0001
bne t0, t1, $08800734 //obivously 08800734 is where the jr ra is. lol
nop
lui t2, $089e
lui t3, $03e0
ori t3, t3, $0008
sw t3, $e3f0(t2)
lui t2, $089e
lui t3, $0000
ori t3, t3, $0000
sw t3, $e3f4(t2)
jr ra

and if it matters, this is it in code form:

Code:
0x00000104 0x0a2001bf
0x000006fc 0x3c0808ce
0x00000700 0x8d08fcb0
0x00000704 0x8d080aac
0x00000708 0x34090001
0x0000070c 0x15090009
0x00000710 0x00000000
0x00000714 0x3c0a089e
0x00000718 0x3c0b03e0
0x0000071c 0x356b0008
0x00000720 0xad4be3f0
0x00000724 0x3c0a089e
0x00000728 0x3c0b0000
0x0000072c 0x356b0000
0x00000730 0xad4be3f4
0x00000734 0x03e00008

The first line is the hook and it works because I've used it for another code.
The only think I can figure is maybe I should add another nop between the 2nd and 3rd code..

I also tried switching the "bne" code to "beq" but it just activates the code without any trigger.

Any help you guys can give me would be great! Thanks!
Back to top Go down
View user profile
-LeetGamer-
Admin


Posts : 247
Points : 397
Reputation : 4
Join date : 2010-09-29
Age : 25

PostSubject: Re: Whats wrong with this sub?   Thu Sep 30, 2010 11:53 am

Hmm, looks like it will work, what is wrong with it? Like what happens, also you can make it smaller, here is what you have after the branch:

Code:

lui t2, $089e
lui t3, $03e0
ori t3, t3, $0008
sw t3, $e3f0(t2)
lui t2, $089e
lui t3, $0000
ori t3, t3, $0000
sw t3, $e3f4(t2)
jr ra

Here is how I would do it:

Code:

lui t2, $089e
lui t3, $03e0
ori t3, t3, $0008
sw t3, $e3f0(t2)
sw zero, $e3f4(t2)
jr ra

zero is a register that always holds the value 0, also we already loaded 089e into the upper half of t2 so there was no point to do it again. That is just how to make it smaller, but what does the code do right now? Nothing? Freeze?
Back to top Go down
View user profile
GunstarBlue



Posts : 37
Points : 41
Reputation : 0
Join date : 2010-09-29

PostSubject: Re: Whats wrong with this sub?   Thu Sep 30, 2010 12:04 pm

It doesn't do anything, and when I tried to change the "bne" to "beq" just to test it out the code works forever lol. Like I can leave and come back and it still works (most likely bc of the hook), but I can't get it to only work when the address reaches the value of 00000001.

Would it have anything to do with the fact that I found the code using the silo auto hexxer method? It's an actual function that gets nop'd as opposed to being an undma'd code that points to where the function is..
Back to top Go down
View user profile
-LeetGamer-
Admin


Posts : 247
Points : 397
Reputation : 4
Join date : 2010-09-29
Age : 25

PostSubject: Re: Whats wrong with this sub?   Thu Sep 30, 2010 12:08 pm

How you found it shouldn't change it, are you sure that the value is 1 when you are testing, turn this one with the subroutine and see what happens:

Code:

#Test
0xFFFFFFFF 0x004DFCB0
0x00000ACC 0x00000001
Back to top Go down
View user profile
GunstarBlue



Posts : 37
Points : 41
Reputation : 0
Join date : 2010-09-29

PostSubject: Re: Whats wrong with this sub?   Thu Sep 30, 2010 12:34 pm

Tried it with the test code and its not working which means that I definitely got the wrong code undma'd for the subroutine.

The thing is there are 2 codes that change to the same exact value at the same exact time and I might have set the wrong one into the sub. Im gonna try with the other code and report back back here.

Thanks leet!


Last edited by GunstarBlue on Thu Sep 30, 2010 12:40 pm; edited 2 times in total
Back to top Go down
View user profile
-LeetGamer-
Admin


Posts : 247
Points : 397
Reputation : 4
Join date : 2010-09-29
Age : 25

PostSubject: Re: Whats wrong with this sub?   Thu Sep 30, 2010 12:36 pm

No problem, also try unDMAing the code again to make sure you did it right Wink
Back to top Go down
View user profile
GunstarBlue



Posts : 37
Points : 41
Reputation : 0
Join date : 2010-09-29

PostSubject: Re: Whats wrong with this sub?   Thu Sep 30, 2010 12:42 pm

-Edit- I just realized it should work either way.. if both of them switch to 1 then it doesn't matter which one I put in the sub as they both switch to 1 at the same time during the game... but something must be wrong either way, otherwise it would work..

Crap, I really have no idea how to fix this. I'll still try the other code anyways.

And I'm pretty sure it works because I used cheatcw's changes finder to watch the address (the dma address) and when I've activated the undma'd code to make it constant write 1 it turned to that in the changes finder..

I'm gonna keep trying though. I'll let you know
Back to top Go down
View user profile
GunstarBlue



Posts : 37
Points : 41
Reputation : 0
Join date : 2010-09-29

PostSubject: Re: Whats wrong with this sub?   Thu Sep 30, 2010 2:26 pm

Ok, good news and bad news..

Good news is.. I GOT IT TO WORK!!!

Bad news is, once the code activates, it stays activated lol. Instead of it only working when the value changes =/ .

Any ideas on what I could do to get it to only work when that address reaches the correct value??

Back to top Go down
View user profile
-LeetGamer-
Admin


Posts : 247
Points : 397
Reputation : 4
Join date : 2010-09-29
Age : 25

PostSubject: Re: Whats wrong with this sub?   Thu Sep 30, 2010 2:38 pm

Add this:

Code:

ori t0 0 1
lui t1 $pointer
lw t1 $pointer(t1)
lw t1 $offset(t1)
bne t0 t1 $to "//here"
nop
jr ra
nop
//here
//now turn code off
jr ra
nop
Back to top Go down
View user profile
GunstarBlue



Posts : 37
Points : 41
Reputation : 0
Join date : 2010-09-29

PostSubject: Re: Whats wrong with this sub?   Thu Sep 30, 2010 2:42 pm

huh? Im super confused by everything there.

Do I put that at the end of the original sub but before the jr ra? Or do I put that where you put "//here" ?

Sorry, Im still very very much a beginner at this lol
Back to top Go down
View user profile
-LeetGamer-
Admin


Posts : 247
Points : 397
Reputation : 4
Join date : 2010-09-29
Age : 25

PostSubject: Re: Whats wrong with this sub?   Thu Sep 30, 2010 3:01 pm

Just put it right before the jr ra and you will only need one jr ra so cut the jr ra nop on the thing I just posted off.
Back to top Go down
View user profile
GunstarBlue



Posts : 37
Points : 41
Reputation : 0
Join date : 2010-09-29

PostSubject: Re: Whats wrong with this sub?   Thu Sep 30, 2010 3:46 pm

Well Im convinced that I just don't know what the #$%@ I'm doing and it's really frustrating. I just want you to know that I have been trying things because I know theres nothing more annoying then somebody just leaching a forum for answers without trying things themselves. So hes what I tried as I was still a bit confused at the instructions. I think where I messed up was here:

bne t0 t1 $to "//here"

First I set "here" to be the address that was 2 nops after the jr ra (as thats how I read what you wrote, but it's probably wrong). At first it was freezing the game straight out, but then I realized I probably had to change the first bne command so that the jr ra in that string reflected the one I just changed.

So I did that and it didn't freeze, but Im right back where I started as the code activates and just stays on the whole time without turning off. Whats more annoying is that if I use the code itself (the one thats supposed to activate when I reach that certain value), it works and when I hit the music note to turn it off it stops working no problem.

If you haven't been driven crazy by me yet, I can screen cap my work in ps2dis if you want to see what I did, but I'm at a dead end and it's honestly making me upset as I know you're giving me more then enough info, but I just can't put it to use the right way.
Back to top Go down
View user profile
-LeetGamer-
Admin


Posts : 247
Points : 397
Reputation : 4
Join date : 2010-09-29
Age : 25

PostSubject: Re: Whats wrong with this sub?   Thu Sep 30, 2010 3:52 pm

GunstarBlue wrote:
Well Im convinced that I just don't know what the #$%@ I'm doing and it's really frustrating. I just want you to know that I have been trying things because I know theres nothing more annoying then somebody just leaching a forum for answers without trying things themselves. So hes what I tried as I was still a bit confused at the instructions. I think where I messed up was here:

bne t0 t1 $to "//here"

First I set "here" to be the address that was 2 nops after the jr ra (as thats how I read what you wrote, but it's probably wrong). At first it was freezing the game straight out, but then I realized I probably had to change the first bne command so that the jr ra in that string reflected the one I just changed.

So I did that and it didn't freeze, but Im right back where I started as the code activates and just stays on the whole time without turning off. Whats more annoying is that if I use the code itself (the one thats supposed to activate when I reach that certain value), it works and when I hit the music note to turn it off it stops working no problem.

If you haven't been driven crazy by me yet, I can screen cap my work in ps2dis if you want to see what I did, but I'm at a dead end and it's honestly making me upset as I know you're giving me more then enough info, but I just can't put it to use the right way.

Well this is why I made this site, to try and help people Wink

yeah
Back to top Go down
View user profile
GunstarBlue



Posts : 37
Points : 41
Reputation : 0
Join date : 2010-09-29

PostSubject: Re: Whats wrong with this sub?   Thu Sep 30, 2010 4:06 pm

Im working on my netbook right now so I had to split it into 2 pictures because of the resolution.

The first one shows my code from 008806fc - 00880738 and the second one finishes it from 0088073c - 0088074c

008806fc - 00880738 https://redcdn.net/ihimizer/img84/3531/ps2dis1.png

0088073c - 0088074c https://redcdn.net/ihimizer/img138/599/ps2dis2.png

There it is
Back to top Go down
View user profile
-LeetGamer-
Admin


Posts : 247
Points : 397
Reputation : 4
Join date : 2010-09-29
Age : 25

PostSubject: Re: Whats wrong with this sub?   Thu Sep 30, 2010 4:17 pm

After reading over what I suggested last time I've noticed that we can do it better than that, much better.

Here is a way to do this: Keep the value off with the first two lines, then the subroutine will check the value and if it is 1 then turn the code on, if at any time the value is not 1 then the subroutine shouldn't store and the two lines will take over and keep the hack off.

Code:
0x001EE3F0 0x//Off value
0x001EE3F4 0x//Off value
lui t0, $08ce
lw t0, $fcb0(t0)
lw t0, $0aac(t0)
ori t1, zero, $0001
bne t0, t1, $08800734 //obivously 08800734 is where the jr ra is. lol
nop
lui t2, $089e
lui t3, $03e0
ori t3, t3, $0008
sw t3, $e3f0(t2)
sw zero, $e3f4(t2)
jr ra
nop
Back to top Go down
View user profile
GunstarBlue



Posts : 37
Points : 41
Reputation : 0
Join date : 2010-09-29

PostSubject: Re: Whats wrong with this sub?   Thu Sep 30, 2010 5:35 pm

lol, this code is laughing at us man.. it still didn't work >=( .

Partly though is bc I think we got our wires crossed. The way you have the code set up it makes it so that the function that I want to turn off would be off until I got hit, which is when the value triggers the other code. I guess I'll explain exactly whats happening cuz more details are better lol.

Basically it's a fighting game and all characters have an invincible dash move to get around the stage faster with. The only problem is when you get put into a combo you can do the dash move that allows you to escape the combo. The code that I want to activate is a code that makes it so you cant dash while you're in a combo.

Basically it's supposed to flow like this:

P1 gets attacked (which triggers the value of 1 and also triggers the "non dash" code). When the p1 is finished getting attacked the value goes back to 0 and then you dash again as a regular move. The only problem is that the dash stays nop'd and you can't dash for the rest of the game...

So the code you gave me in theory would do the opposite of what I want and make dash not available until you're getting hit... but even that doesn't work because when you get hit your dash still doesnt work =( .

Like I said before, I can't understand why the sub doesn't work because if you turn on the "non-dash" code manually then the code works and you can't dash, and when you turn it off manually then you're allowed to dash again. But if you do it through the sub, even if you turn it off manually it stays on until you either turn the game off or, and bare with me cuz this gets complicated, you can turn off the sub code, then turn on the regular non-dash code and turn it back off and everything is back to normal again...

I dunno leet, I think this might not be a problem we can solve =(
Back to top Go down
View user profile
-LeetGamer-
Admin


Posts : 247
Points : 397
Reputation : 4
Join date : 2010-09-29
Age : 25

PostSubject: Re: Whats wrong with this sub?   Thu Sep 30, 2010 5:40 pm

One last try LOL, if this doesn't work then I don't know D:

Code:

lui t0, $08ce
lw t0, $fcb0(t0)
lw t0, $0aac(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
Back to top Go down
View user profile
GunstarBlue



Posts : 37
Points : 41
Reputation : 0
Join date : 2010-09-29

PostSubject: Re: Whats wrong with this sub?   Thu Sep 30, 2010 5:47 pm

Alright, gonna try this but I'm gonna post my ps2dis screenshots to make sure I did it right. Also just so you don't think I messed up, the offset is actually ac4 not aac, so if you see it on my ps2dis screens then it's not a mistake lol

-Edit-

K here are the shots, let me know if they're right that way I can kill time with posting it if it's broken lol

1st goes from 088006fc - 08800738
https://redcdn.net/ihimizer/img214/2858/dislast1.png

2nd finishes with 0880073c - 0880074c
https://redcdn.net/ihimizer/img163/1317/dislast2.png

Here goes nothing!
Back to top Go down
View user profile
-LeetGamer-
Admin


Posts : 247
Points : 397
Reputation : 4
Join date : 2010-09-29
Age : 25

PostSubject: Re: Whats wrong with this sub?   Thu Sep 30, 2010 6:35 pm

There are some errors in the first pic:

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

Those are the OFF values, that means the value that they usually are in the game without you changing them, view the addresses in the decoder to find them (With the code off!)
Back to top Go down
View user profile
GunstarBlue



Posts : 37
Points : 41
Reputation : 0
Join date : 2010-09-29

PostSubject: Re: Whats wrong with this sub?   Thu Sep 30, 2010 6:43 pm

Mannnn..... that means the first code with the "off" values probably worked! lmao. I totally thought that you meant the code for the dash being off! lol...

Im gonna check it out now lol
Back to top Go down
View user profile
GunstarBlue



Posts : 37
Points : 41
Reputation : 0
Join date : 2010-09-29

PostSubject: Re: Whats wrong with this sub?   Thu Sep 30, 2010 7:29 pm

The last code did it!!!!!!!!!!!!!!!!!!!!!!!!!1 LEET YOU'RE THE MAN!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

You win 100,000,000 internets!!!!

Once I got the real "off" values it worked like a charm!! Now I just need to see what you did in some of those spots cuz some of it was really over my head lol. But damnit! it got done!!
Back to top Go down
View user profile
-LeetGamer-
Admin


Posts : 247
Points : 397
Reputation : 4
Join date : 2010-09-29
Age : 25

PostSubject: Re: Whats wrong with this sub?   Thu Sep 30, 2010 7:38 pm

w00000t Very Happy If you have a question on a MIPS command then there is a sticky thread in this section for that.
Back to top Go down
View user profile
GunstarBlue



Posts : 37
Points : 41
Reputation : 0
Join date : 2010-09-29

PostSubject: Re: Whats wrong with this sub?   Sun Oct 03, 2010 7:56 am

Return of the code that wouldn't die!!! lol

I recently found a much better address to attack my value to, but it just wont work now =( My question is, do some codes NOT activate values no matter what? Cuz it's the 2nd code I've tried to change and it's not working out... Here's the sub you gave me with the new code plugged in, maybe someone can look over it and let me know if I put in the right info..

Code:

New code that I want to have the sub looking for the value:

0xFFFFFFFF 0x017A3D68
0x000000A4 0x00000000

and this is the sub where I changed it so that the code branches out when the value of the above code becomes 160;

lui t0, $09fa
lw t0, $3d68(t0)
lw t0, $00a4(t0)
ori t1, zero, $00a0
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

The other info comes from earlier in this thread and involves the code branching to this code:

0x001DE3F0 0x03E00008
0x001DE3F4 0x00000000

and the off value for that code as well.

As always man, thanks for your help. Im learning a lot from this whole experience
Back to top Go down
View user profile
-LeetGamer-
Admin


Posts : 247
Points : 397
Reputation : 4
Join date : 2010-09-29
Age : 25

PostSubject: Re: Whats wrong with this sub?   Sun Oct 03, 2010 9:05 am

Well your pointer might be dynamic =/ make sure the code works all the time.

Here is how I would do this, let's hope it works Razz

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
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)
Bne t0 t1 $To address of jr ra
Nop
Lui t3 $03e0
Ori t3 t3 $8
Sw t3 $Lower address of first line(t2)
Sw 0 $Lower address of second line(t2)
Jr ra
Nop
Back to top Go down
View user profile
GunstarBlue



Posts : 37
Points : 41
Reputation : 0
Join date : 2010-09-29

PostSubject: Re: Whats wrong with this sub?   Sun Oct 03, 2010 9:18 am

Ok, I'm gonna go try this, but I'm a tad confused as I thought if you un'dma'd a code it was no longer dynamic...

Is there something else to it besides that in certain situations?
Back to top Go down
View user profile
Sponsored content




PostSubject: Re: Whats wrong with this sub?   

Back to top Go down
 
Whats wrong with this sub?
Back to top 
Page 1 of 3Go to page : 1, 2, 3  Next
 Similar topics
-
» Whats your favourite dessert?
» Theres SOMETHING WRONG With The Way I Sketch?
» How get a wrong sent gift back?
» Reset if you use the wrong energy/strength charm!
» New BVO Furniture

Permissions in this forum:You cannot reply to topics in this forum
PSP Coding :: PSP Section :: PSP Chat :: PSP Coding Help-
Jump to: