Results 1 to 7 of 7

Thread: Animal Crossing City Folk Search/Teleport

  1. #1
    Member
    Join Date
    Aug 2008
    Location
    Arizona
    Posts
    1,073
    Blog Entries
    2

    Default Animal Crossing City Folk Search/Teleport

    I know this isn't really "Handheld hacking" but there isnt an amateur coding section in Console Hacking

    I'll probably have this finished by tomorrow, I've been busy and stuff

    Anyway, here's what I have so far
    Code:
    item slots:
    25 acres 
    6400 slots
    5x5 acres
    16x16 per acre
    
    coordinates:
    x and y
     the part we're using starts at (?) and goes up to (?)+ 4F or (?)+9E (anyone care to help me out here?)
    
    
    
    formulation:
    *set two registers to the coordinate value in the top left item slot (X and Y)
    *search the map for an item, adding to a counter(A) for each slot searched
    *once the item is found...use the counter for the following
    *divide (A) by 256 to get acres, remainder=X quotient=Y 
    *add to coordinates
    *divide (A) by 5 to get rows and columns, remainder=X quotient=Y
    *add to coordinates
    *finally, divide (A) by 16 to get individual item slots, remainder=X quotient=Y
    *add to coordinates to get final coordinates
    * ?
    *profit!
    
    (I actually understand everything, I just don't know how the coordinates are structured, I probably made mistakes here cause I'm half asleep, but I know how it works...)
    pretty hard doing all of this without a USBGecko or any way to view the game's code...but I just kinda guessed all of it, so sorry if I'm wrong about anything

    oh and I forgot this game uses the z coordinate...would that affect anything? for example if you teleport from a lower area to a higher area, will you get stuck underground?
    Always willing to help with anything, code-related or not. :]

  2. #2
    Member
    Join Date
    Aug 2008
    Location
    Arizona
    Posts
    1,073
    Blog Entries
    2

    Default

    Here, I made the formulation easier to understand..I'll edit this post with the code once i've made it

    Code:
    @sets a counter to 0
    @searches the map, adding to the counter for each slot
    @once an item is found, 
    @divide by 256 to determine which acre it is in
    @quotient is acre (A), remainder is the slot in that acre(B)
    @divide (A) by 5 to determine which acre row/column that acre is in
    @quotient is Y acre row (the rows going left to right), remainder is X acre row (rows going up and down), multiply by 32 and add to x/y coords
    @divide (B) by 16 to determine which slot row it is in
    @quotient is Y slot row, remainder is X slot row, multiply by 2 and add to coords
    Code:
    li r5,0 //set a counter to 0
    lis r14, 0x90E8
    ori r14,r14,0xF052 // r14 holds slot before first mapslot 90E8F052
    addi r17,r14,0x3202 // r17 holds 90E92254
    
    maploop: 
    lhzu r27,2(r14) //load the item stored in each slot
    cmpwi r27,0x57 //check if that item is a weed
    blt notreplace
    cmpwi r27,0x5A
    ble Move
    notreplace: //if not, add to the counter, and search the next slot
    addi r5,r5,0x1
    cmpw r14,r17 //until we reach the last slot of the map
    ble maploop
    blr
    
    Move:
    li r17,0x11 //set r17 to the value of the top left corner's coordinates? 
    mr r14,r17 //set r14 to this value too (so now we have x and y)
    
    andi. r9,r5,0xFF //get the slot number the item is on for the remainder
    srwi r5,r5,0x8  // and the acre we are in, for the quotient
    li r30,0
    
    div: //i got lazy and used this stupid divide routine,even thought there is a divide instruction in PPC...once i get this code working ill change it
    cmpwi r5,0x5 //r5 will hold remainder, which is the acre row
    blt Next
    subi r5,r5,0x5
    addi r30,r30,0x1  //r30 will hold acre column
    b div
    
    Next:
    
    slwi r30,r30,0x5 //multiply by 32 but im not sure how the coordinates are structured on this game
    add r14,r14,r30 //add to y coordinates
    slwi r5,r5,0x5
    add r17,r17,r5 //add to x coordinates
    
    andi. r5,r9,0xF //get the remainder, which will be the row slot 
    srwi r9,r9,0x4 //quotient, which is the column slot
    
    slwi r5,r5,0x1 //multiply by 2
    add r17,r17,r5 //add to x coordinate
    slwi r9,r9,0x1
    add r14,r14,r9 //add to y coordinate
    
    lis r30,0x80E6
    stbu r17,0x38D7(r30)  //store x coordinate in 80E638D7
    stb r14,0x8(r30)      //store y coordinate in 80E638DB
    blr
    I just used the Real-Time World Edit source to come up with this, and I'm guessing the address where the X and Y values are stored is "read only" because I can't write to it....So I guess I'll just keep this here, until I get it to work
    Always willing to help with anything, code-related or not. :]

  3. #3
    Member
    Join Date
    Aug 2008
    Location
    Arizona
    Posts
    1,073
    Blog Entries
    2

    Default

    I found where the x coordinate is stored, but I can't seem to make sense of it (I know I'm trying too hard >_>)

    I had to make a hacky routine to actually see the x coordinate though

    In the top left corner, it would probably actually be read as 03448010, not 80100344

    and in the top right corner, it would probably be read as 3F45F508, not F5083F45
    but thats just my guess.

    I know it's the x coordinate, cause when i use my routine to store it on my text, it changes in real time if i move left or right, and doesnt change if i stand still. but why it changes the way it does, i have no idea.

    -sigh- i wish i just got a USBGecko when I still could have
    XD
    Attached Thumbnails Attached Thumbnails Click image for larger version. 

Name:	RUU_0145.JPG 
Views:	381 
Size:	87.1 KB 
ID:	1893   Click image for larger version. 

Name:	RUU_0147.JPG 
Views:	385 
Size:	90.3 KB 
ID:	1894  
    Always willing to help with anything, code-related or not. :]

  4. #4
    Member
    Join Date
    Aug 2008
    Location
    Arizona
    Posts
    1,073
    Blog Entries
    2

    Default

    Okay, I have determined how the coordinates are structured, and I will begin making my search/teleport code

    turns out my viewing routine was wrong. I fixed it.

    The x coordinate in the middle of the very left slot is 44040000
    with each slot it increases by 8
    so, like 4404, 440C, 4414, 441C

    the last 4 digits dont really matter
    Always willing to help with anything, code-related or not. :]

  5. #5
    Member
    Join Date
    Aug 2008
    Location
    Arizona
    Posts
    1,073
    Blog Entries
    2

    Default

    Okay, NOW I have the coordinates figured out. It's pretty stupid. I guess Nintendo was drunk when structuring them. So anyway

    Start at 4400 at the very left, end at 4540 at very right (or very top and very bottom for y)
    in the first acre, for each slot the coordinates increase by 8
    for the next few acres, up until you reach 4500+ they increase by 4 for each slot
    after that, they increase by 2

    What the heck!? This makes everything so much harder XD
    No wonder why Virus didn't use the actual coordinates in RTWE
    I'll try making real-time world edit using the actual coordinates, and if I can do that, I'll try making my search teleport code.
    Otherwise I'll have to give up.
    Always willing to help with anything, code-related or not. :]

  6. #6
    J.P. (Global Moderator) Maniac's Avatar
    Join Date
    Sep 2007
    Location
    Ohio, USA
    Posts
    2,083
    Blog Entries
    5

    Default

    ....please message me about this when i'm on later

    Say what you mean, mean what you say, and let your actions speak for you.


  7. #7
    Member
    Join Date
    Aug 2008
    Location
    Arizona
    Posts
    1,073
    Blog Entries
    2

    Default

    Sure ^_^

    By the way, here it is....the actual real-time world edit using coordinates (activator c+down)

    I know it's huge, but it works, and it took me forever to think of the math to make it XD (I was about to give up too >_>)
    I'll show you the source when you get my message.
    I'm going to bed right now, my brain hurts...
    Always willing to help with anything, code-related or not. :]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •