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

Cannot transform the design to my own #27

Open
willing1234 opened this issue Jun 7, 2021 · 2 comments
Open

Cannot transform the design to my own #27

willing1234 opened this issue Jun 7, 2021 · 2 comments

Comments

@willing1234
Copy link

I tried several time, but it is not works. After import and export a design code, it suppose to be edit on you switch, but no matter what I do, it is not working, However, my friend create a file for me, and import the code I upload in community, it is works. Do anyone know what's the problem?

@FluffyFishGames
Copy link
Owner

I answered this issue in #30. Will continue commenting there.

@lottehime
Copy link

lottehime commented Oct 27, 2023

Issue #30 was closed by opener, so continuing conversation here (years later).

Issue #27 & #30 are related.

The ACNH file format needs to include the players PlayerID and TownID from main.dat or personal.dat being written to the pattern data and then written back to main.dat at each pattern index.

public ACNHFileFormat(byte[] bytes)
{
Version = bytes[0];
Name = System.Text.Encoding.Unicode.GetString(bytes, 1, 0x29).Replace(" ", "").Trim();
Palette = new DesignPattern.Color[15];
this.Type = (DesignPattern.TypeEnum) bytes[0x2B];
for (int i = 0; i < 15; i++)
Palette[i] = new DesignPattern.Color() { R = bytes[0x2C + i * 3 + 0], G = bytes[0x2C + i * 3 + 1], B = bytes[0x2C + i * 3 + 2] };
this.Pixels = new byte[Width / 2 * Height];
Array.Copy(bytes, 0x59, this.Pixels, 0, this.Pixels.Length);
}

Similarly to the way that the ACNL file format reads/writes those bytes:

Username = System.Text.Encoding.Unicode.GetString(bytes, 0x2c, 20).Replace(" ", "").Trim();
TownName = System.Text.Encoding.Unicode.GetString(bytes, 0x42, 20).Replace(" ", "").Trim();

But read from the *.dats and written to the pattern byte arrays would be best (not relying on pattern dumps that originate from the user).

Without those IDs written to the start of each pattern array the game marks them as not owned by the player and thus unable to be edited within the game (marked with 🚫).

Refer here for details on the data side.

If I get time I might look over the codebase and implement, but it might be quicker for @FluffyFishGames to action it due to familiarity with the codebase.

I would also recommend not using a trimmed file format for the pattern exports to increase interoperability.

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

3 participants