Coder Social home page Coder Social logo

repkg's Introduction

RePKG

Wallpaper engine PKG unpacker/TEX converter, written in C#.

PKG and TEX formats reverse engineered by me.

Feel free to report errors.

Features

  • Extract PKG files
  • Convert PKG into wallpaper engine project
  • Convert TEX to image
  • Dump PKG/TEX info

Commands

  • help - shows those commands, use help "extract" and help "info" to see options for them
  • extract - extracts specified PKG/TEX file, or files from folder
-o, --output          (Default: ./output) Output directory
-i, --ignoreexts      Don't extract files with specified extensions (delimited by comma ",")
-e, --onlyexts        Only extract files with specified extensions (delimited by comma ",")
-d, --debuginfo       Print debug info while extracting/decompiling
-t, --tex             Convert all TEX files into images from specified directory in input
-s, --singledir       Should all extracted files be put in one directory instead of their entry path
-r, --recursive       Recursive search in all subfolders of specified directory
-c, --copyproject     Copy project.json and preview.jpg from beside PKG into output directory
-n, --usename         Use name from project.json as project subfolder name instead of id
--no-tex-convert      Don't convert TEX files into images while extracting PKG
--overwrite           Overwrite all existing files
  • info - Dumps PKG/TEX info
-s, --sort             Sort entries a-z
-b, --sortby           (Default: name) Sort by ... (available options: name, extension, size)
-t, --tex              Dump info about all TEX files from specified directory
-p, --projectinfo      Keys to dump from project.json (delimit using comma) (* for all)
-e, --printentries     Print entries in packages
--title-filter         Title filter

Examples

Simply extract PKG and convert TEX entries into images to output folder created in current directory

repkg extract E:\Games\steamapps\workshop\content\123\scene.pkg

Find PKG files in subfolders of specified directory and make wallpaper engine projects out of them in output directory

repkg extract -c E:\Games\steamapps\workshop\content\123

Find PKG files in subfolders of specified directory and only convert TEX entries to png then put them in ./output omitting their paths from PKG:

repkg extract -e tex -s -o ./output E:\Games\steamapps\workshop\content\123

Convert all TEX files to images from specific folder

repkg extract -t -s E:\path\to\dir\with\tex\files

repkg's People

Contributors

dependabot[bot] avatar notscuffed avatar vitalline avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

repkg's Issues

newbie

do you open this with visual studio, or do you navigate to a specific directory in command prompt?

Mobile WE

Add support mpkg as well as .tex files in it.

Animated wallpapers storing as static JPEG files

I downloaded some animated wallpaper projects but when I extract them, they just get stored as a static JPEG file. I was expecting to see a GIF file instead. There are some also some subfolders with "effects", "masks" that contain some PNG files that seemingly are supposed to form the animated elements but I have no idea how to put together those files. Does repkg natively support doing this with a setting or am I out of options?

Here is the project I am trying to extract btw if it helps - https://steamcommunity.com/sharedfiles/filedetails/?id=2426441418

Console not staying open

I may be very bad at this, but whenever I open the .exe file, it opens the console and immediately closes.

How to extract GIF files

How to extract GIF files
Anyone who has successfully extracted gifs, please give the answer, thank you!

`* Extracting: materials/Untitled.json

  • Extracting: scene.json
  • Extracting: models/Untitled.json
  • Extracting: materials/Untitled.tex
  • Reading: materials/Untitled.tex
    Failed to write texture
    System.ArgumentOutOfRangeException: Value 1100008 must be greater than or equal to 2073600.
    参数名: data
    在 SixLabors.Guard.ThrowArgumentOutOfRangeException(String parameterName, String message)
    在 SixLabors.ImageSharp.Image.LoadPixelData[TPixel](Configuration config, ReadOnlySpan`1 data, Int32 width, Int32 height)
    在 SixLabors.ImageSharp.Image.LoadPixelData[TPixel](Configuration config, Byte[] data, Int32 width, Int32 height)
    在 RePKG.Application.Texture.TexToImageConverter.ImageFromRawFormat(MipmapFormat format, Byte[] bytes, Int32 width, Int32 height)
    在 RePKG.Application.Texture.TexToImageConverter.ConvertToImage(ITex tex)
    在 RePKG.Command.Extract.ConvertToImageAndSave(ITex tex, String path, Boolean overwrite)
    在 RePKG.Command.Extract.ExtractEntry(PackageEntry entry, String& outputDirectory)
  • Extracting: sounds/Untitled.mp3
    Done`

File scene.pkg
needs to be unzipped
Need a gif of the inside
scene.zip

Compiled Release Link

I don't know why the owner couldn't just put a release on this repo, I had to download the entirety of Visual Studio to compile this as a result of that... But anyway, I uploaded it on MediaFire so you guys don't have to go through the same shit I went through :)

.TEX file will not convert, citing Crop error

The output of the program is this:

System.ArgumentException: Crop rectangle should be smaller than the source bounds.
Parameter name: cropRectangle
    at SixLabors.Guard.ThrowArgumentException(String message, String parameterName)
    at SixLabors.ImageSharp.Processing.Processors.Transforms.CropProcessor..ctor(Rectangle cropRectangle, Size sourceSize)
    at SixLabors.ImageSharp.Processing.CropExtensions.Crop(IImageProcessingContext source, Rectangle cropRectangle)
    at RePKG.Application.Texture.TexToImageConverter.<>c__DisplayClass2_0.<ConvertToGif>b__0(IImageProcessingContext context)
    at SixLabors.ImageSharp.Processing.ProcessingExtensions.ProcessingVisitor.Visit[TPixel](Image1` image)
    at SixLabors.ImageSharp.Processing.ProcessingExtensions.Clone(Image source, Action`1 operation)
    at RePKG.Application.Texture.TexToImageConverter.ConvertToGif(ITex tex)
    at RePKG.Command.Extract.ConvertToImageAndSave(ITex tex, String path, Boolean overwrite)
    at RePKG.Command.Extract.ExtractFile(FileInfo fileInfo)
Done

This happens when trying to convert the leaves1.tex file from the default wallpaper engine assets.

I'm including the file just in case my files are different (github does not support .tex files, so I renamed it to a .txt file).
leaves1.tex.txt

I need help

Not familiar with your programming language and IDE, can you provide a compiled executable file? Thank you very much.

Extracted files do not work correctly

extraction the .pkg gives the files that were in .pkg but does not put them into folders
it should put each of them into his respective folders(like bla.json in folder "models", but hmm.json and hmm.tex in "materials")
like this
image
this is another unpacker which I found online and if you put it new project folder with it's project.json and pkg.scene,it WORKS.

instead, the program (rekpg) does this
image
which if you put into a new project folder with it's project.json and pkg.scene, DOES NOT WORK.
maybe I am missing a command idk but i didn't found one who did this.

Can't run

When I run it, it give me a exception,and can't run. How to solve it?
9249d2b7ee59b0bf34ea0c8102b4176c0eab7669

Failed to read texture (*.tex)

Oh~ I'm in some trouble:
run extract Command
Failed to read texture
RePKG.Application.Exceptions.UnknownMagicException: Unknown magic: '1XET�' in 'TexReader:Magic1'
在 RePKG.Application.Texture.TexReader.ReadFrom(BinaryReader reader)
Position: \TexReader.cs:line 47
in RePKG.Command.Extract.LoadTex(Byte[] bytes, String name) position \RePKG\Command\Extract.cs:line 351

the file

TEX文件不能被正常转换

CMD中的错误输出:
RePKG.Application.Exceptions.UnknownMagicException: Unknown magic: 'TEXS0001' in 'TexFrameInfoContainerReader'
在 RePKG.Application.Texture.TexFrameInfoContainerReader.ReadFrom(BinaryReader reader)
在 RePKG.Application.Texture.TexReader.ReadFrom(BinaryReader reader)
在 RePKG.Command.Extract.LoadTex(Byte[] bytes, String name)
Done

Error: System.NotImplementedException: Format: "8" (8)

Hello,

I was looking for an extractor for the tex files in wallpaper-engine and I found this software.
I tried using it to extracte the .tex files contained by default in wallpaper engine and I ran into this error by running this command:
RePKG.exe extract -t F:\app\Wallpaper-engine-extrator\fileToExtract

And this is the output:

  • Decompiling: F:\app\Wallpaper-engine-extrator\fileToExtract\fog1.tex
    Failed to decompile
    System.NotImplementedException: Format: "9" (9)
    à RePKG.Texture.Tex.Decompile()
    à RePKG.Texture.Tex.DecompileAndSave(String path, Boolean overwrite)
    à RePKG.Command.Extract.ExtractTexDirectory(DirectoryInfo directoryInfo)
  • Decompiling: F:\app\Wallpaper-engine-extrator\fileToExtract\fog2.tex
    Failed to decompile
    System.NotImplementedException: Format: "8" (8)
    à RePKG.Texture.Tex.Decompile()
    à RePKG.Texture.Tex.DecompileAndSave(String path, Boolean overwrite)
    à RePKG.Command.Extract.ExtractTexDirectory(DirectoryInfo directoryInfo)
  • Decompiling: F:\app\Wallpaper-engine-extrator\fileToExtract\fog3.tex
    Failed to decompile
    System.NotImplementedException: Format: "8" (8)
    à RePKG.Texture.Tex.Decompile()
    à RePKG.Texture.Tex.DecompileAndSave(String path, Boolean overwrite)
    à RePKG.Command.Extract.ExtractTexDirectory(DirectoryInfo directoryInfo)
    Done

Does this error has to do with my command or with the software ?

Here are the files in the extract directory:

image

Thanks for your answer and nice work.

Need help with the ETC texture type

Hello, I'm sorry to bother you. My English is not very good, and I am currently using translation software. It's like this, I'm trying to unpack the mpkg file, which is the wallpaper file for Wallpaper mobile version. I encountered some issues while unpacking the tex file. I have only learned a little Python, and C # is a bit difficult to understand. However, I still browsed through your C # source code and found that in the texture type, 0=>ARGB8888, 4=>DXT5, 6=>DXT3, 7=>DXT1, 8=>RG88, 9=>R8. However, the texture type of this file is 05, so the program threw an exception. I don't know which texture format this is, but after researching,** I speculate it's ETC2. But I don't know how this texture format is encoded, **so I would like to ask where you can find relevant information. Look forward to your reply with the least possible delay.

couldn't get it to decompress a .tex file

i tried with the examples(changing the dir ofc) but couldn't make it work, ex:

D:\Downloads\Wallpaper.Engine.Pkg.To.Zip>repkg extract -t -d D:\Downloads\Wallpaper.Engine.Pkg.To.Zip\fondo\materials

  • Decompiling: D:\Downloads\Wallpaper.Engine.Pkg.To.Zip\fondo\materials\v2-85a6dd9256b0167c08a83688c4e54c0a_r.tex
    Format: ARGB8888
    _unkInt_1: 2
    _unkInt_2: 4281805824
    _unkIntCont_0: 1
    ImageFormat: FIF_UNKNOWN
    Failed to decompile
    System.IO.DirectoryNotFoundException: No se puede encontrar una parte de la ruta de acceso 'D:\Downloads\Wallpaper.Engine.Pkg.To.Zip\output\v2-85a6dd9256b0167c08a83688c4e54c0a_r.png'.
    en System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
    en System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
    en System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
    en System.IO.File.InternalWriteAllBytes(String path, Byte[] bytes, Boolean checkHost)
    en System.IO.File.WriteAllBytes(String path, Byte[] bytes)
    en RePKG.Texture.Tex.DecompileAndSave(String path, Boolean overwrite)
    en RePKG.Command.Extract.ExtractTexDirectory(DirectoryInfo directoryInfo)
    Done

used the '-d' tag in that last one hoping it would help solving this.
maybe im forgetting something

Suggestion

Could you add a feature which converts the output back to .tex ? (Recompiling Feature)

Input file not found

so i'm trying to extract around 40 .tex files and after doing everything i could the error keeps popping, i put the command

extract -t -s C:\Users\Dell\Desktop\texconvert
wich is the directory with the tex files.
and it gives the "input file not found". have tried specifying the exact file in the route but nothing. how can i fix this pls.

Output Location

Hi

Instructions on how to set an output location are unclear

Please help

Thanks

How can I use it?

I ran the project but I got a hint "Verb 'repkg' is not recognized."

How to use this application on Windows?

Hello, I found your github page on google because I want to extract images from Scene and TEX files. However, I'm not very well proficient in understand how to use this on windows? I would greatly appreciate if you could tell me how.

Thank you.

Doesn't Open

I didn't have the .exe, but upon checking the other issues, I found the .exe, which probably means I'm missing the page where I'm supposed to find that. I've also checked other issues, and seen I'm supposed to open it with the console, which I assumed was Command Promt, but I've tried using that, Git CMD and Git Bash, as well as just opening the .exe file (Which I've tried placing in both the Desktop and the RePKG Source folder, neither of which make a difference). I'm not sure where I've gone wrong, but would appreciate any help you can give.

Mipmap byte count exceeds maximum size when converting .tex files

Hi there,

When I tried to convert a large .tex file (about 83 MB) using the program, it throws an error and skips that file.

* Extracting: materials/File Nov 08, 17 51 21.tex
* Reading: materials/File Nov 08, 17 51 21.tex
Failed to read texture
RePKG.Application.Exceptions.UnsafeTexException: Unsafe TEX detected, reason: Mipmap byte count exceeds maximum size: 64223148/50000000
   at RePKG.Application.Texture.TexImageReader.ReadBytes(BinaryReader reader)
   at RePKG.Application.Texture.TexImageReader.ReadMipmapV2And3(BinaryReader reader)
   at RePKG.Application.Texture.TexImageReader.ReadFrom(BinaryReader reader, TexImageContainer container, TexFormat texFormat)
   at RePKG.Application.Texture.TexImageContainerReader.ReadFrom(BinaryReader reader, TexFormat texFormat)
   at RePKG.Application.Texture.TexReader.ReadFrom(BinaryReader reader)
   at RePKG.Command.Extract.LoadTex(Byte[] bytes, String name)

Is there a way to avoid this maximum byte detection? Thanks for any response.

NETFramework 4.7.2. required while u can´t rollback to it with the current Windows Update

So i tried using it and can´t find a way to get it to work.
The Windows Update History doesn´t let me uninstall the updates which changed the NETFramework Version and i can´t seem to install 4.7.2 since Windows detects a newer version and cancels the installation.
Is there a way to change / upgrade your tool to the Current version of NETFramework ?
Or maybe another workaround ?

No output

I am running the following code, but no output is being created. I've tried it with the precomplied version you provided and one that I complied myself. Tried it in admin and normal powershell. Also tried all of the examples that you provided in the readme

PS C:\Users\mchad\Desktop\build> .\repkg.exe extract -e tex -s -o "C:\Users\mchad\Desktop\scene (2)\Unpacked" "C:\Users\mchad\Desktop\scene (2)"

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.