Please login or register.

Login with username, password and session length
Darkholme's ASM Hacks  (Read 1429 times)
Pages: [1]
Darkholme [Posts: 142]
  • View Profile
  • share
  • [September 06, 2016, 10:31:51 AM]
Darkholme's ASM Hacks
« on: September 06, 2016, 10:31:51 AM »
So far it's just the one.

It's a change-up of Glain's "Gear-Level Bugfix/More Selective Equipment" Very small change to his code, but one that makes it do the exact opposite of his hack.

The idea is that I want to have more tightly balanced weapons, and as a result, the weapons you have access to at level 1 should still be viable (though not optimal) even at level 99. As such, I want the NPCs to make use of it. Each job will also have access to a wider variety of weapon types that still make sense for the job.


Basically, Glain's hack fixes an error in the existing gear selection function, which was making the game think all items after the first category were whole new categories, rather than choosing from the best level-appropriate item out of each category.

My change to the main check in his hack should make it consider each allowable item individually, such that a level 40 character has the same odds of having an ice-brand as he does of having a broadsword, for projects such as Mine where the old items don't become worthless as you level up.

If you're looking to test it yourself, I also attached a .fftpatch that should let you see it in action quickly and easily.

Most of the time it works perfectly, but once in a while I'm getting items in invalid slots, like you can see in the attachments. Anybody have any idea what's causing this behavior?
« Last Edit: September 07, 2016, 07:02:27 AM by Darkholme »
    • Modding version: PSX
  • The Puppet ---Master---
    Elric (Overseer) [Posts: 3928]
    • View Profile
    • Youtube Channel
    • http://steamcommunity.com/id/Bones42
    • share
    • [September 06, 2016, 11:23:16 AM]
    Re: Darkholme's ASM Hacks
    « Reply #1 on: September 06, 2016, 11:23:16 AM »
    What's the PA on that leather helmet? Sounds painful.

    • Modding version: PSX
  • <@Angel> Teach a man to fish and he'll open up a fishery to compete against yours.
    Journey of the Five Youtube ChannelThe Lion War Current Status
       
    Jot5 Leader :: Eventer :: OtherTLW Leader :: Eventer :: Other
    Glain [Posts: 456]
    • View Profile
    • share
    • [September 25, 2016, 03:51:27 AM]
    Re: Darkholme's ASM Hacks
    « Reply #2 on: September 25, 2016, 03:51:27 AM »
    Okay, so I finally figured this out by trying it in the pSX debugger.  The first entry of the found item array is your problem.  It always goes uninitialized here, so if it gets picked then you're getting some arbitrary value for the ID of the item to be equipped.

    It basically comes down to this:
     * The "previous item level" starts at zero.
     * The current index of the found item array also starts at zero.
     * When adding a new entry to the found item array, the routine increments the current index of the array before saving using that index (i.e., it saves to the next element of the array, not the current)
     * This means overwriting the current item entry, as opposed to adding a new entry, is the only way for the first entry to be initialized.
     * That's normally okay, though, because the routine will normally never add a new entry to the array before overwriting the current entry at least once. There is a branch that will skip incrementing the list index if the "previous item level" (initialized to zero) is less than the current item level, which it always will be on the first found item.
     * ...And, the kicker: you overwrote that branch with a nop.

    Essentially, you need a way to skip incrementing the list index for the first entry, but not any other time.  Fortunately, we have the "item found" variable in t7, and you can check if that's zero.  If, instead of overwriting that branch with a nop, you replace it with:

    Code: [Select]
    beq t7,zero,SKP

    Then everything seems to work.

    Alternatively, I also suspect you may be able to fix this by initializing the current item index (t1/r9) to -1 instead of 0 at 0x5cd24 (i.e. addiu t1, zero, -1).  That way, it would increment the list index every time but that would actually be correct since -1 would become 0 for the first entry.  I haven't actually tested that though.
    Pages: [1]