fix: PCK3, hex values and force slim skins to be wide

This commit is contained in:
neoapps-dev
2026-04-16 17:04:22 +03:00
parent 1a0f51d698
commit afebdffced
2 changed files with 46 additions and 13 deletions

View File

@@ -171,7 +171,7 @@ export default function PckEditorView() {
const handleNewPCK = () => {
playPressSound();
const newPck: PCKFile = {
version: 2,
version: 3,
endianness: "little",
xmlSupport: false,
properties: ["ANIM", "BOX"],
@@ -624,7 +624,7 @@ export default function PckEditorView() {
const newVal = e.target.checked
? currentVal | item.flag
: currentVal & ~item.flag;
handlePropertyEdit(idx, newVal.toString());
handlePropertyEdit(idx, `0x${newVal.toString(16).toUpperCase().padStart(8, "0")}`);
}}
className="hidden"
/>

View File

@@ -2,7 +2,7 @@ import { useState, useEffect } from "react";
import { useLocalStorage } from "./useLocalStorage";
import { PckService } from "../services/PckService";
import { TauriService } from "../services/TauriService";
import { PCKAssetType, PCKProperty } from "../types/pck";
interface Edition {
id: string;
supportsSlimSkins?: boolean;
@@ -25,8 +25,13 @@ export function useSkinSync({ profile, editions }: UseSkinSyncProps) {
img.onload = async () => {
if (cancelled) return;
const cvs = document.createElement("canvas");
cvs.width = img.width;
cvs.height = img.height;
if (skinIsSlim) {
cvs.width = 64;
cvs.height = 64;
} else {
cvs.width = 64;
cvs.height = 32;
}
const ctx = cvs.getContext("2d");
if (ctx) {
ctx.drawImage(img, 0, 0);
@@ -35,25 +40,53 @@ export function useSkinSync({ profile, editions }: UseSkinSyncProps) {
try {
const res = await fetch(b64);
const buf = await res.arrayBuffer();
const animValue = (skinIsSlim) ? (1 << 19) : 0;
const animValue = (skinIsSlim) ? "0x00040000" : "0x00040000"; //neo: forces wide skin, because slim is not even working.
let boxes: PCKProperty[] = [];
/*if (skinIsSlim) {
boxes.push({
key: "BOX",
value: "ARM0 -2 1 -1 3 10 3 40 16 0 0 0"
});
boxes.push({
key: "BOX",
value: "ARM1 -1 1 -1 3 10 3 52 16 0 0 0"
});
}*/
const pckBuf = PckService.serializePCK({
version: 2,
version: 3,
endianness: "little",
xmlSupport: false,
properties: ["ANIM"],
xmlSupport: true,
properties: ["ANIM", "DISPLAYNAME", "THEMENAME", "GAME_FLAGS", "FREE", "BOX"],
files: [{
id: "0",
path: "0",
type: PCKAssetType.INFO,
size: 0,
data: new Uint8Array(0),
properties: [{
key: "PACKID",
value: "9999"
}]
}, {
id: "dlcskin00000001",
path: "dlcskin00000001.png",
type: 0,
type: PCKAssetType.SKIN,
size: buf.byteLength,
data: new Uint8Array(buf),
properties: [{
key: "ANIM",
value: animValue.toString(10)
}, {
key: "DISPLAYNAME",
value: "Custom Skin"
}, {
key: "GAME_FLAGS",
value: "0x18"
}, {
key: "FREE",
value: "1"
},
{
key: "ANIM",
value: animValue
}, ...boxes, {
key: "THEMENAME",
value: "Emerald Launcher"
}]