pleonex / tinke

Viewer and editor for files of NDS games
GNU General Public License v3.0
356 stars 57 forks source link

RawImage NOT Writing last segment from orig_data #8

Closed MetLob closed 8 years ago

MetLob commented 9 years ago

In RawData.cs, method: override void Write(string fileOut, PaletteBase palette) line 224:

for (int i = image_size + StartByte; i < ori_data.Length; i++)

This is never be to write last data from ori_data Maybe???:

for (int i = Tiles.Length + StartByte; i < ori_data.Length; i++)
MetLob commented 9 years ago

For images (tiles only) image_size = Tiles.Length But if this image is tiles for compressed map, image_size > Tiles.Length

This situation initialized by incorrect Width and Height, which equals to Width and Height for MAP. But width and height of tiles for compressed map must be < W x H of map image.

PS: sorry for my very bad english...

pleonex commented 9 years ago

Thanks for the report :+1: I will look into it as soon as I have some free time

pleonex commented 9 years ago

I see what you mean. The problem is that we don't know when the last segment of data from the original source starts, so I was guessing with image_size. The last segment of data should be after the tiles you are current viewing with the image editor. In this way, the user can choose it.

In the case of importing with map compression we don't know where the tile section ends. If I replace image_size with Tiles.Length then:

I am not sure what to do here :worried:

MetLob commented 9 years ago
pleonex commented 9 years ago

Mm, good idea. Maybe we should add a warning message in the console too, just in case it doesn't work as expected in some games.

pleonex commented 8 years ago

Fixed in #21 by @MetLob.