Corrupted .lib issue?

Chalace

Dedicated Member
Dedicated Member
Jan 18, 2014
1,823
275
125
I have been building the objects from Shanda & mir3 without any real issues so far. however I'm getting this error when trying to place the last few tiles in this .lib

ShandaMir2 > SMTiles4 > 32767 onward... (Every tile before this point worked fine)
Really frustrating as its the last few tiles to complete a scene.

ut36r.png


I have replaced the lib with various different versions, both fresh and from random clients etc, all give the same error.

Any ideas on this one?

---------- Post Merged at 04:58 PM ---------- Previous Post was at 04:55 PM ----------

Edit: Tried with different editors, same result.
Also tried exporting/importing the images.
 
Last edited:

Far

tsniffer
Staff member
Developer
May 19, 2003
20,172
30
2,767
540
it's because Int16 can only hold 32767 values.

the reader will need changing to an Int32
 

Chalace

Dedicated Member
Dedicated Member
Jan 18, 2014
1,823
275
125
Ah, thanks Far. Ill see what the source looks like.
 

Far

tsniffer
Staff member
Developer
May 19, 2003
20,172
30
2,767
540
Ah, thanks Far. Ill see what the source looks like.
Its a simple change but if you cant find where ill check when im at a computer

Sent from my SM-G930F using Tapatalk
 

Chalace

Dedicated Member
Dedicated Member
Jan 18, 2014
1,823
275
125
If you could that would be great.
Just had a look and i have no real idea, any changes would just be 'best guess' at this point.

Ill continue on with the next .lib meanwhile. only a million more puzzle pieces to go!
 

Chalace

Dedicated Member
Dedicated Member
Jan 18, 2014
1,823
275
125
If that was meant for me, no viewer, its the C# Map Editor.
 

Far

tsniffer
Staff member
Developer
May 19, 2003
20,172
30
2,767
540
i dont want to commit this in, as i don't have any shanda object/tiles to test i've changed the correct one. but he's what you need to do

MapCode.cs

find

Code:
public short BackIndex;

change to

Code:
public int BackIndex;

right click on "BackIndex" and find all references.

wherever you see that bytes are being cast to a short "(short)"

eg

Code:
MapCells[x, y].BackIndex = (short)(Bytes[offset++] + 100);

this needs changing to

Code:
MapCells[x, y].BackIndex = (int)(Bytes[offset++] + 100);

Only changing the "short" to "int" part for each line you find.

I found 7 references.

I'm guessing the issue is with the "BackIndex" and not the Middle/Front variables as you stated SMTiles (which should be backindex only)

-

If this works for you this will also need changing in the main source, so the client can read the correct length too (though i've never seen any broken shanda maps, so i'm wondering what is on these SMTiles)
 

Chalace

Dedicated Member
Dedicated Member
Jan 18, 2014
1,823
275
125
Thanks Far.

This is the image that is finished off at the end of the lib. No idea what it's from but there is a whole temple in there.

Unless i'm misunderstanding what you mean, a lot of the SMTiles are actually used as middle images not back.

Edit: Thinking about it, the rest of the tiles may be in one of the object .Lib, as is the case with some other building's I've done so far. Does seem rather strange, it is a pretty big chunk missing.

If someone knows what map this is from so i can check, that would be even better.

350tlyt.png
 
Last edited:

Far

tsniffer
Staff member
Developer
May 19, 2003
20,172
30
2,767
540
if you place the SMTiles as middle then i think you'll need to change the 2 middle variables to int then instead.

The error is showing because you are placing an image on a map, and the map can only store up to a certain index. So which ever layer that's being placed on needs increasing.

it's good practice to only change the one variable required and not every one - as it's wasted storage space on the map.
 

Chalace

Dedicated Member
Dedicated Member
Jan 18, 2014
1,823
275
125
Great help as always.

Ill give it a go once i finish off the rest of the .lib, assuming the rest of it doesn't show up somewhere else.
 

Far

tsniffer
Staff member
Developer
May 19, 2003
20,172
30
2,767
540
As an update to this - it will be the "MiddleImage" variable you need to change to an INT.

The MiddleIndex holds which lib number it uses, The MiddleImage holds which image within that lib it is - so this will be the only one which can go higher than an int16
 

Chalace

Dedicated Member
Dedicated Member
Jan 18, 2014
1,823
275
125
OK, makes absolutely no logical sense, but i found the missing 'SMTiles4' tiles repeated at the end of SMTiles3. Yes i made 4 before 3~
So no need to make the code changes. Why they are there i have no idea! Sorry Far, maybe it will be of use one day.

The Shanda .lib's seem so random at times, found multiple places where the same object is repeated 50~ times in a row for no apparent reason what so ever, taking up thousands of tiles. As well as scenes split between SMTiles and Objects.
 

Far

tsniffer
Staff member
Developer
May 19, 2003
20,172
30
2,767
540
OK, makes absolutely no logical sense, but i found the missing 'SMTiles4' tiles repeated at the end of SMTiles3. Yes i made 4 before 3~
So no need to make the code changes. Why they are there i have no idea! Sorry Far, maybe it will be of use one day.

The Shanda .lib's seem so random at times, found multiple places where the same object is repeated 50~ times in a row for no apparent reason what so ever, taking up thousands of tiles. As well as scenes split between SMTiles and Objects.
There is no logic to what these companies do. I recently opened mir3 armour libs and found the exact same frames repeated after another

Sent from my SM-G930F using Tapatalk
 

Chalace

Dedicated Member
Dedicated Member
Jan 18, 2014
1,823
275
125
It's worth it tho. there is so much cool stuff in here.

o79a2b.png