Skip to content
This repository has been archived by the owner on Nov 26, 2022. It is now read-only.

RawImage NOT Writing last segment from orig_data #8

Closed
MetLob opened this issue May 21, 2015 · 6 comments
Closed

RawImage NOT Writing last segment from orig_data #8

MetLob opened this issue May 21, 2015 · 6 comments
Assignees
Milestone

Comments

@MetLob
Copy link
Contributor

MetLob commented May 21, 2015

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
Copy link
Contributor Author

MetLob commented May 23, 2015

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 pleonex self-assigned this Jun 4, 2015
@pleonex pleonex added the bug label Jun 4, 2015
@pleonex
Copy link
Owner

pleonex commented Jun 4, 2015

Thanks for the report 👍
I will look into it as soon as I have some free time

@pleonex pleonex added the plugin label Aug 12, 2015
@pleonex
Copy link
Owner

pleonex commented Aug 12, 2015

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:

  • If Tiles_new.Length < Tiles_old.Length: We would write tiles from the old original data as last segment data.
  • If Tiles_new.Length > Tiles_old.Length: We would skip data from the original data thinking they were tiles.

I am not sure what to do here 😟

@MetLob
Copy link
Contributor Author

MetLob commented Aug 14, 2015

  • If Tiles_new.Length < Tiles_old.Length: We would write tiles from the old original data as last segment data. - yea, or fill this bytes by nulls or write part of the old data
  • If Tiles_new.Length > Tiles_old.Length: We would skip data from the original data thinking they were tiles. - Sorry, but we must trim new data. We don't know that contains in post data

@pleonex
Copy link
Owner

pleonex commented Aug 14, 2015

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 added a commit that referenced this issue Feb 28, 2016
Pull Request for issues #18, #19, #7, #8
@pleonex pleonex added this to the Version 0.9.1 milestone Feb 28, 2016
@pleonex
Copy link
Owner

pleonex commented Feb 28, 2016

Fixed in #21 by @MetLob.

@pleonex pleonex closed this as completed Feb 28, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants