News: 11 March 2016 - Forum Rules, Mobile Version
Current Moderators - DarkSol, KingMike, MathOnNapkins, Azkadellia

Author Topic: Lufia-Patches by Artemis  (Read 31514 times)

vivify93

  • Hero Member
  • *****
  • Posts: 854
  • White Wizard
    • View Profile
Re: Lufia-Patches by Artemis
« Reply #60 on: October 16, 2016, 10:57:31 pm »
What music glitch? This isn't the Stereo > Mono > Stereo > LV 0 glitch, is it? Because Relnqshd fixed that a long time ago. I think looking into the Ancient Cave armor issue should really be the last thing, judging by your report.

Thanks again for all the hard work, Rainponcho. :)
All my life I've tried to fight what history has given me.

Artemis

  • Full Member
  • ***
  • Posts: 155
    • View Profile
Re: Lufia-Patches by Artemis
« Reply #61 on: October 17, 2016, 11:11:17 am »
This is the music glitch:

https://www.youtube.com/watch?v=RVuiPL_j2cU

And there are also these glitches:

https://www.youtube.com/watch?v=lPOG4X94wQ8
https://www.youtube.com/watch?v=ohBPCIjCnsg
https://www.youtube.com/watch?v=vwra-3rLrpE


As this altogether really is a lot, so let's have a look at what's important.

The remaining boundary issues:
Completely not worth it, especially considering you said these ones are harder to do. I expect to be that Dragon Mountain one also to be somehow tied into the puzzle logic (related to the falling bridge, I guess). So I'd say it's the best to screw these.

Capsule Monsters feeding:
Also not that important because it doesn't do too much harm - aside from making the CMs some snobbish and obnoxious assholes. I'd say, skip it if it makes too much trouble.

Pot glitch:
Looks strange, but doesn't do any real harm. So, especially considering that it looks fixing it has the potential to destroy more than it actually fixes, this one can be skipped as well.

Lufia report glitch:
This one is a bitch because it totally spits on all your effort and invested hours to beat the Ancient Cave. So this should be fixed if possible.

Music glitch:
This one is annoying because it easily happens and doesn't go away unless you reset. So this one also should be fixed if possible.

Inn stay:
Not really a glitch because it just seems like an intentional safety measurement to ensure you always can refill your powers at all. Theoretically, instead of not touching your money at all, the inn keepers at least could take all the remaining money. But that's not really worth it. Let's just call it generosity.

Hook sound glitch:
Somewhat annoying but as it seems easily to cancel, so no real harm. Therefore, this one really isn't important.

Ancient Cave creation glitch:
This one is annoying as it can completely screw over your run. Especially annoying, if you found great stuff, but no Providence yet. However, I don't have any savestate for this one.

Arek intro glitch:
I don't care. If anything, it makes Arek even more mysterious, so it's actually not a bad thing, eh?  ;)
I'd say screw this one.

Ancient Cave chests:
Actually I'm undecided about this one. I say you can look whether you find an error that lets us make conclusions about how actually it was supposed to be. Then we can think about it again. If, however you don't find this kind of error, then let's skip this one, too.

That's all there is about glitches and bugs I think.

vivify93

  • Hero Member
  • *****
  • Posts: 854
  • White Wizard
    • View Profile
Re: Lufia-Patches by Artemis
« Reply #62 on: October 17, 2016, 12:51:32 pm »
Rainponcho already provided two fixes for the Capsule Monster feeding glitch though.

Capsule Monster Feeding fix

Option 1 - 14908h @ fe 00 00
Yum = fussy + 1

Option 2 - 14908h @ ea ea ea
Yum = fussy + 0

Yuck = fussy - 1

(*) fussy = item craving level
All my life I've tried to fight what history has given me.

rainponcho

  • Sr. Member
  • ****
  • Posts: 275
    • View Profile
Re: Lufia-Patches by Artemis
« Reply #63 on: October 17, 2016, 01:01:50 pm »
Quote
Lufia report glitch:
This one is a bitch because it totally spits on all your effort and invested hours to beat the Ancient Cave. So this should be fixed if possible.

Can you explain this one some more? So I understand it better? I know it sounds obvious but my gears aren't clicking.


Quote
Inn stay:
Not really a glitch because it just seems like an intentional safety measurement to ensure you always can refill your powers at all. Theoretically, instead of not touching your money at all, the inn keepers at least could take all the remaining money. But that's not really worth it. Let's just call it generosity.

They take all your money. :)


Quote
Ancient Cave chests:
Actually I'm undecided about this one. I say you can look whether you find an error that lets us make conclusions about how actually it was supposed to be. Then we can think about it again. If, however you don't find this kind of error, then let's skip this one, too.

B10 gives you aprons for armor? O_o

Artemis

  • Full Member
  • ***
  • Posts: 155
    • View Profile
Re: Lufia-Patches by Artemis
« Reply #64 on: October 17, 2016, 02:24:03 pm »
These last two values aren't saved properly. As soon as you go game over or reset and re-upload your save, when you finally get your report it will display zeros in both cases - regardless of whether you were in the AC or even did beat the Master or not.

And so you did already fix the inn stay issue?

rainponcho

  • Sr. Member
  • ****
  • Posts: 275
    • View Profile
Re: Lufia-Patches by Artemis
« Reply #65 on: October 17, 2016, 06:09:24 pm »
Inn stay - take money
4165 @ 9c
416a @ 9c

Artemis

  • Full Member
  • ***
  • Posts: 155
    • View Profile
Re: Lufia-Patches by Artemis
« Reply #66 on: October 17, 2016, 07:28:45 pm »
About the capsule monsters, what's the meaning of the h in 14908h?

And what exactly are the two options doing?

rainponcho

  • Sr. Member
  • ****
  • Posts: 275
    • View Profile
Re: Lufia-Patches by Artemis
« Reply #67 on: October 17, 2016, 07:45:18 pm »
Normally game sets monster diet value to item rating.


Hex editor - go to rom offset 14908 hex.

You have two choices how to fix this (for items it wants to eat):

At 14908h, replace with FE 00 00. This raises monster diet rating by 1 point each time (regardless of item value).

Or replace with EA EA EA. This keeps monster diet rating constant - no affect when eating item, does not go up ever until next level.


Game deducts 1 point from diet rating when it gets a yucky item.



edit2:
Cancel the inn fix. Corrupts something else. Need to proper ips fix this later.


edit3: inn fix.
http://s000.tinyupload.com/index.php?file_id=67679743663245022817

My rom got corrupted somehow. So made clean ips.


edit4: Lufia report fix.
http://s000.tinyupload.com/index.php?file_id=06417180040781528965


note: Very tricky fix to make work. There appears to be 3 "unused" lufia report statistics bytes: 7e0b65, 7e0b66, 7e0b67.

Go to a church and save your game. It will now record the values for later loading.


edit5: Confirmed Ancient Cave armor generation is a programing glitch (from b10 basically).

Fills items at 7f:0000 = weapons, 7f:1000 = armor. Deeper you go, longer list becomes.


ex.
1000-108f - b4
a4-b9
e3-f1
10f-123
143-145 + 147-151


1000-10f5 - b9
a4-c5
e3-fd
10f-131
137
143-145 + 147-156 + 15b
169-16e


1000-1103 - b10
a4-c7
e3-fe
10f-133
137
143-145 + 147-156 + 15b
169-170


Eventually list gets larger than 255 bytes (2 bytes per item). Triggers overflow error (104h => 04h). So you get aprons or dresses. Possible list of items you get is hard-coded per level. I need to check B99 to see how large both lists get and make a hackfix.


upd6: ancient cave - armor generation fix
http://s000.tinyupload.com/index.php?file_id=09475236236981797273

You now get all sorts of stuff. Aprons are still possible on any floor, just very less likely now (B10 in particular).


upd7: Working on new cave fix. They use a multiplication trick that doesn't work perfectly with expanded item list - creates possible glitches.
« Last Edit: October 18, 2016, 05:21:08 pm by rainponcho »

Artemis

  • Full Member
  • ***
  • Posts: 155
    • View Profile
Re: Lufia-Patches by Artemis
« Reply #68 on: October 18, 2016, 06:58:38 pm »
Possible list of items you get is hard-coded per level.

Are you sure? It shouldn't be hard-coded for the red chests, but instead depend on some properties of the items themselves. Like the cheaper the shop price, the earlier they can appaear. Besides, there's one (or two I forgot) byte in the item code that can affect whether an item can appear at all.

Only blue chests should be hard-coded.

Or wait, do you mean the list of blue chest items which makes sure that these items don't appear as red chests?
« Last Edit: October 18, 2016, 07:03:43 pm by Artemis »

rainponcho

  • Sr. Member
  • ****
  • Posts: 275
    • View Profile
Re: Lufia-Patches by Artemis
« Reply #69 on: October 18, 2016, 07:37:45 pm »
v2 cave chest generation fix. Make sure to revert the v1 above fix completely before using this one!
http://s000.tinyupload.com/index.php?file_id=44593571139705240064


Quote
but instead depend on some properties of the items themselves. Like the cheaper the shop price, the earlier they can appaear.

That's what I was aiming for but failed completely to describe. ;)

B50 seems to be nearly full - random selection pool (red chests).

Digitsie

  • Full Member
  • ***
  • Posts: 244
    • View Profile
Re: Lufia-Patches by Artemis
« Reply #70 on: October 18, 2016, 07:39:07 pm »
Ok I've lost track of all the patches and will just wait for one comprehensive one. :D

rainponcho

  • Sr. Member
  • ****
  • Posts: 275
    • View Profile
Re: Lufia-Patches by Artemis
« Reply #71 on: October 18, 2016, 07:50:34 pm »
v17 aio - applied on top of clean frue lufia headered rom. probably works on other ones by Artemis too.
http://s000.tinyupload.com/index.php?file_id=10966831243019290523


all working patches to-date. no experimental ones. there's not much left to work on so that's nice.

Artemis

  • Full Member
  • ***
  • Posts: 155
    • View Profile
Re: Lufia-Patches by Artemis
« Reply #72 on: October 18, 2016, 08:35:09 pm »
That's what I was aiming for but failed completely to describe. ;)

Do you completely understand it? Because there are some items missable which still are questionable.

Like the Fly Ax.
Setting B6078 from 60 to 00 should fix it.
Would that fix the issue without any other negative consequences?

Or the Zircon Armor.
However, the corresponding byte at offset B696E seems fine. So i don't know whether I fully understood it.

rainponcho

  • Sr. Member
  • ****
  • Posts: 275
    • View Profile
Re: Lufia-Patches by Artemis
« Reply #73 on: October 18, 2016, 09:36:27 pm »
Fly Ax = b6077
+0 = 02  (bit 02 must be set!)
+1 = 60 (bit 20 must not be set!)
+5 = 26ac (item value) (early dungeon floors reject based on value)
+7 = 2401 (bit 01 = weapon pool)

These are basic conditions for adding item to rng pool #1. I have no idea what all these other flags, missing values do.


Zircon = B696D
+0 = 02
+1 = 00
+5 = d2f0
+7 = 2502 (no bit 01 = armor, shield, helmet, rings, jewels)

It gets added properly to rng pool #2.


At B98, there are [1]172h bytes in pool #2 (7F:1000-1171). 172/2 = B9 = 185 items.

Glitch would randomly give you {1}72h / 2 = 39h or 57 items.

DE - Zircon plate = given (7F:1070) - max item
DF - Zircon armor = glitch = not given (7F:1072)
E0 - Mirak plate = never given
E1 - Ruse armor = never given
E2 - Pearl Armor = never given



With the new chest fix you get all 185 items.

1CE - Tag Ring - cursed - 7F:116E
1CF - Tag Ring - uncursed - 7F:1170

7F:1172 = list end



Pool #1 @ 7F:0000 = {0}0B2 / 2 = 59h or 89 items.


Max limit is 256 items per pool. I have no idea if the game will punk you if you add more missing items like earrings or catfish jewel.

Considering that other stuff like walls, monsters, map layouts share (??) the space after these lists, it might not be safe. Aka tiny room, no stairs glitch.

But! Comparing B4 vs B50 vs B98, I think game seems to understand how much space was used for the rng lists and adjusts accordingly. So it might be okay.


edit:
Quote
Setting B6078 from 60 to 00 should fix it.
Would that fix the issue without any other negative consequences?

I think so yes.
« Last Edit: October 18, 2016, 09:45:49 pm by rainponcho »

Artemis

  • Full Member
  • ***
  • Posts: 155
    • View Profile
Re: Lufia-Patches by Artemis
« Reply #74 on: October 18, 2016, 10:22:34 pm »
So, the Zircon Armor wasn't given due to the glitch whereas the Fly ax wasn't given due to its item code?
« Last Edit: October 18, 2016, 10:28:56 pm by Artemis »

rainponcho

  • Sr. Member
  • ****
  • Posts: 275
    • View Profile
Re: Lufia-Patches by Artemis
« Reply #75 on: October 18, 2016, 10:28:10 pm »
That looks correct.


Casino glitch - does this happen on real hardware? I checked with bsnes-plus-073.2 (debugger) several times and cannot get music to glitch out.

Dragon Egg Shrine is horrible with snes9x when casino bug happens - very noticeable right at the start with the bell hit.

Artemis

  • Full Member
  • ***
  • Posts: 155
    • View Profile
Re: Lufia-Patches by Artemis
« Reply #76 on: October 18, 2016, 10:29:02 pm »


And with 185 you mean only weapons and armor etc. (but no potions), right?

October 18, 2016, 10:34:10 pm - (Auto Merged - Double Posts are not allowed before 7 days.)
Casino glitch - does this happen on real hardware? I checked with bsnes-plus-073.2 (debugger) several times and cannot get music to glitch out.

Dunno. Might indeed be an Snes9x issue, then.
« Last Edit: October 18, 2016, 10:34:10 pm by Artemis »

rainponcho

  • Sr. Member
  • ****
  • Posts: 275
    • View Profile
Re: Lufia-Patches by Artemis
« Reply #77 on: October 18, 2016, 10:39:54 pm »
weapons (swords, axes, staffs, whips, spears, wrenches, bows?) are in the first list of 85 entries. This is not a hard limit.

armor (body, shields, helmets, rings, jewels, tag ring) are in the second list of 185 entries. This is not a hard limit.


There are assignment categories:
AE-FF = weapons list - variable limit
81-AD = armor list - variable limit

63-80 = spells - 23h items fixed limit
5E-62 = see 94:EEA0 - 29h items fixed limit
24-5D = potions (see 91:FFDC) - 09h items fixed limit
00-23 = items (see 94:F13D) - 1Fh items fixed limit


fixed limits can likely be adjusted, as long as you have space in that particular list.


edit:
These are the snes addresses for the fixed limits
83:915B = items limit (1F)
83:91AE = potions limit (09)
83:9193 = spells limit (23)
83:91C9 = ?? limit (29)


edit2:
By flipping the item's 01 bit, you can redistribute items between weapons / armor lists.
« Last Edit: October 18, 2016, 10:46:04 pm by rainponcho »

Artemis

  • Full Member
  • ***
  • Posts: 155
    • View Profile
Re: Lufia-Patches by Artemis
« Reply #78 on: October 18, 2016, 10:46:22 pm »
So 00-80 is fixed limit and nothing here is changed at all compared to the original?

And which weapons/armor are now on the list of obtainable/unobtainable stuff? Is Dual Blade still unobtainable - as it should - for example?
Or to make that question easier - it's now solely dependent on the item code, right?

rainponcho

  • Sr. Member
  • ****
  • Posts: 275
    • View Profile
Re: Lufia-Patches by Artemis
« Reply #79 on: October 18, 2016, 11:04:05 pm »
Quote
So 00-80 is fixed limit and nothing here is changed at all compared to the original?

Nothing was changed by me for any of the fixed item lists at all.


Here's the process:
1) Game picks a random # between 0-255. Let's say 2F. Or 24. Or 5D.
2) Code says to pick a random item from the potion list. This is currently fixed at 9 items.
3) It picks another rng between 00-08. Say 05.
4) Potion list is looked up for item 05. That is added to the chest list.
Repeat this several times (let's say 10 items total).

5) Game now generates the map. But it only wants to add 4 red chests. So only the first 4 items selected are added to the dungeon floor.


I should mention that you can now have 256 armor items. But only 128 weapon items. Which I can asm hackfix to give 256 weapon choices also.


Quote
Or to make that question easier - it's now solely dependent on the item code, right?

Right. Item code determines when it becomes available.


Quote
And which weapons/armor are now on the list of obtainable/unobtainable stuff? Is Dual Blade still unobtainable - as it should - for example?

Yup. Didn't touch any of that. Only rng bug is fixed - actual rng itself remains exactly the same.


edit:
And I have no usable information on how maps are actually generated. That's a harder mystery. Or blue chests.