Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is it possible to do the reverse? From a .png to a .data? #1

Open
PerryTute opened this issue Apr 7, 2022 · 3 comments
Open

Is it possible to do the reverse? From a .png to a .data? #1

PerryTute opened this issue Apr 7, 2022 · 3 comments

Comments

@PerryTute
Copy link

No description provided.

@TeWu
Copy link
Owner

TeWu commented Apr 15, 2022

It should be possible to convert from .png to .data. I'm not up for it, but if you want to try implementing it yourself, here are few directions on how to approach this:

  • Most importantly, DataFileConverter.convert method must be modified to do the opposite, of what it's doing.
  • DATA_FILES_GLOB_PATTERN must be changed to "**/*.png", so that PNG files are what FileProcessor is looking for.
  • In line defining targetFilePath, ".png" must be replaced with ".data", so that output file names end with .data extension.

@PerryTute
Copy link
Author

It should be possible to convert from .png to .data. I'm not up for it, but if you want to try implementing it yourself, here are few directions on how to approach this:

* Most importantly, [DataFileConverter.convert](https://github.com/TeWu/CelesteExtractor/blob/master/src/pl/geek/tewu/celeste_extractor/DataFileConverter.java#L14) method must be modified to do the opposite, of what it's doing.

* [`DATA_FILES_GLOB_PATTERN`](https://github.com/TeWu/CelesteExtractor/blob/master/src/pl/geek/tewu/celeste_extractor/FileProcessor.java#L15) must be changed to `"**/*.png"`, so that PNG files are what `FileProcessor` is looking for.

* In line defining [`targetFilePath`](https://github.com/TeWu/CelesteExtractor/blob/master/src/pl/geek/tewu/celeste_extractor/FileProcessor.java#L25), `".png"` must be replaced with `".data"`, so that output file names end with `.data` extension.

Hey so I was fairly busy but getting back to having a looksie at doing this, how did you figure out what the run-length encoding algorithim was? I built a solution for the only result I got for "RunLengthEncoding" when de-compiling the executable with ILSpy

{ List<byte> list = new List<byte>(); for (int i = 0; i < str.Length; i++) { byte b = 1; char c; for (c = str[i]; i + 1 < str.Length && str[i + 1] == c; i++) { if (b >= byte.MaxValue) { break; } b = (byte)(b + 1); } list.Add(b); list.Add((byte)c); } return list.ToArray(); }

And this specific algorithim works fine, but after encoding and then decoding with your tool its obvious this isn't the one used for the .data assets.

@ghost
Copy link

ghost commented Jun 29, 2023

You discover how? I want to do it too

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants