Jump to content

Common Bank Fixed


Choko

Recommended Posts

Yay! Thanks to both Choko and Larva, you deserve some reputation.

I just hope my bank still isnt bugged.

Edit: It still is bugged... Can some wipe/rollback (to like a long time ago) my common bank? I wana use it :P

pso1288677510.png

Edited by SunnyD
Link to comment
Share on other sites

The common bank is back and is now fixed.

Enjoy!

i've seen the code and it's not fixed by a long way choko.

you've only accounted for basically 2 variations of correction, that being the bank count and assuming all items that manage to bug will display the same value and therefore can be skipped over in a loop with no problems, see above for why that's not always the case.

All things considered, trying to correct data that has already corrupted and data that will continue to do so is hardly what i would call a fix. Now if only the root cause could be found and addressed to prevent this in the first place and then you have yourself a fix. Well hopefully at least it stopped crashing the ship.

Before i comment further i need to see some data from a so called corrupted file.

ok after thinking about i have no idea why you did this:

				if (client->character.bankUse > 200)
			{
				client->character.bankUse = 0;
				for(ch=0;ch<200;ch++)
					if (client->character.bankInventory[ch].itemid != 0xFFFFFFFF)
						client->character.bankUse++;

my issue is this, from working on the account editor for his dat version when i had to erase an item, i had to shift the entire list upwards and reduce the overall count

this is a manual erase but you get the idea:

procedure TForm2.DeleteSelectedItem2Click(Sender: TObject);
var
 y: integer;
begin
 for y := ListBox2.ItemIndex to TempCBank.bankUse - 1 do
 begin
   Move(TempCBank.bankInventory[y + 1], TempCBank.bankInventory[y], sizeof
       (tbank_item));
 end;
 TempCBank.bankUse := (TempCBank.bankUse - 1);
 form1.Commonclick.Execute;
end;

now you have a sequence of items in the bank

001200

003400

004500

006700

(idc what they are)

now say the second id get's corrupted and get's ignored in the count by your code

001200

003400 <--- this one

004500

006700

you've reduced the bank count by 1 but you haven't moved the item so the bank now displays:

001200

003400 <--- this one

004500

------------

006700

the last one get's removed and you are still left with the corrupt id, and tbh this will repeat every time it's parsed as far as i can see, which isn't a good thing.

i think instead you have to use memcpy the c++ equivalent of move and shift the items up one in the bank and then reduce the count, it won't fix the problem, but it will remove corrupt items.

unless the active server runs differently from it's stored data obviously then i apologise. the only difference i know of is that item id's are assigned when the game is created so they may actually have to be reallocated when amending items too.

Edited by Atlas
Link to comment
Share on other sites

The example of data I was given didn't have anything wrong with it other than the bankUse stating it was like 30,000 or so - I wasn't sure what was causing the issue but if that value was the only thing that corrupted (of which I had no way of telling from the information I had), this would have resolved the issue pretty well.

The code stops the crash, which is what I was asked to do, even though you were already helping Larva with the issue.

Obviously correcting corrupted data isn't the best way to go about it, but I don't have his whole source code to even begin looking into what the cause of it is -even if I did, it would be no small task.

Thanks for sharing your insights on how to fix it, or at least improve it, after it became evident there are more things wrong than I was initially led to believe.

EDIT: I'll still need the data of further corrupted banks, such as Sunny's, if I'm going to improve this.

Edited by Choko
  • Like 1
Link to comment
Share on other sites

The example of data I was given didn't have anything wrong with it other than the bankUse stating it was like 30,000 or so - I wasn't sure what was causing the issue but if that value was the only thing that corrupted (of which I had no way of telling from the information I had), this would have resolved the issue pretty well.

The code stops the crash, which is what I was asked to do, even though you were already helping Larva with the issue.

Obviously correcting corrupted data isn't the best way to go about it, but I don't have his whole source code to even begin looking into what the cause of it is -even if I did, it would be no small task.

Thanks for sharing your insights on how to fix it, or at least improve it, after it became evident there are more things wrong than I was initially led to believe.

EDIT: I'll still need the data of further corrupted banks, such as Sunny's, if I'm going to improve this.

I was given the same bank data you where and when i checked the entire banks fucked bar the meseta, when i tried to open it using my account reader arrays, which are based on the arrays in the server code just converted to Delphi and modified for displaying, i found that there where supposed to be 30 items in that bank and that all of them seemed to have just gone haywire. tbh your check to try and repair said data is a waste of time and for simplicity would be better off just erasing their common bank and then scroll a message telling them to go get a roll back since the majority of the data cannot be salvaged.

If i could figure out what should be in the bank before a corrupt file, my display code could be modified and converted to recover items, but that's no small task.

Larva asked you because i was busy with something and generally i program in another language, while i understand c and can convert between the 2, it can get pretty alien at times.

Based on these arrays:

  TBank_Item = Record // Modified Record for item Display
   data: array [0 .. 11] of Byte;
   itemid: array [0 .. 1] of SmallInt;
   data2: array [0 .. 3] of Byte;
   bank_count: array [0 .. 1] of SmallInt;
 End;


 TBank_file = Record
   guildcard: Cardinal;
   bankUse: Cardinal;
   bankMeseta: Cardinal;
   bankInventory: array [0 .. 199] of TBank_Item;
 End;

0xCFB1854C // Bank use, obviously fucked

0x2A000000 // meseta value

03000000 AF3DBD4C FD9A504C 00000100 00000000 00000000 // Monomate, second and third argments are fucked
00000000 00000000 00000000 01000100 00000000 00000000 // blank
00000000 00000000 00000000 966F884C 00000000 03000000 // Major fucked id
00000000 03000000 03000000 0C000100 00000000 00000000 // cloned id
00000000 00000000 03000000 04000100 06000000 00000000 // dunno
00000000 03000000 00000000 05000100 00000000 00000000 // again wtf
00000000 00000000 00000000 06000100 00000000 00000000
00000000 00000000 00000000 10000100 00000000 00000000
00000000 00000000 00000000 08000100 00000000 00000000
00000000 00000000 00000000 09000100 00000000 00000000
00000000 00000000 00000000 0A000100 00000000 00000000
00000000 00000000 00000000 0B000100 00000000 00000000
00000000 00000000 00000000 0C000100 00000000 00000000
00000000 00000000 00000000 0D000100 00000000 00000000
00000000 00000000 00000000 0E000100 00000000 00000000
00000000 00000000 00000000 0F000100 00000000 00000000
00000000 00000000 00000000 10000100 00000000 00000000
00000000 00000000 00000000 11000100 00000000 00000000
00000000 00000000 00000000 12000100 00000000 00000000
00000000 00000000 00000000 13000100 00000000 00000000
00000000 00000000 00000000 14000100 00000000 00000000
00000000 00000000 00000000 15000100 00000000 00000000
00000000 00000000 00000000 16000100 00000000 00000000
03000000 00000000 00000000 17000100 00000000 03000000 // 3 monomates
030A0000 00000000 00000000 18000100 00000000 01000100 // Monogrinder
030A0100 00000000 00000000 19000100 00000000 01000100 // Digrinder
030B0000 00000000 00000000 1A000100 00000000 01000100 // Power Material
030B0300 00000000 00000000 1B000100 00000000 01000100 // HP Material
09000000 00000000 00000000 1C000100 00000000 00000000 // Fucked again
ADCE7A4C 00000000 00000000 1D000100 00000000 00000000 // worse

There should be 30 items based on id's and order in this bank, which part of this looked ok choko lol.

based on the id's of the items in the bank this looks like a symptom of the same cleanup routine that kills inventories @.@ and been bugging out.

Edited by Atlas
Link to comment
Share on other sites

yeah the problem is bigger then we tough , but at least ship is'nt going down. now problem is to figure it out how to avoid further bugs.

yes we probably have more then 1 different kind of common bank bugs, like sunnys bug dont toked the ship down thats why i didn't really bother with it.

but i know a few more character that used to took the ship down ill pull his data and c what happen to it with the current code in ship.

atm there not user reporting anomalies in theirs working common, im not saying it wouldn't be in future, hope we can get a solution to this.

Edited by Larva
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...