Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

[For Devs] PK2 Writer .NET

Master Summoner
Joined
Nov 9, 2009
Messages
579
Reaction score
238
This is not a ready-to-use program this release is intended for devolopers
Hi!

Ive been working on a way to implement the PK2API functions for importing into PK2's made by Drew Benton (pushedx) into C# and/or VB.net programs and finally i managed to do so! Below you will find a dll that includes those functions and a Class for VB.net or C# you can use in your projects.

Credeits:
- PK2Writer API: Drew Benton (pushedx)
- API Conversion to DLL: LemoniscooL
- VB.Net / C# Class: LemoniscooL

Features:
- Open PK2 files with any blowfish key
- Import files to the pk2

Known bugs:
- none

Available Functions:
- Initialize
Sets up GfxFileManager.DLL for PK2 operations. This function must be called first.

- Deinitialize
Cleans up GfxFileManager.DLL. This function must be called before the program exits and after Close if a PK2 file was opened.

- Open
Opens a PK2 file for writing. Use:
"169841" - For official sro, mysro
"\x32\x30\x30\x39\xC4\xEA" - for zszc, swsro

- Close
Closes an opened PK2 file. This function must be called before the program exits and before Deinitialize is called.

- ImportFile
Imports a file to the PK2.
'entryFilename' should be the full path the file should have in the PK2 (including filename).

Example:
Please note: in C# you have to escape the backslashes (that means use \\ instead of \)
Code:
PK2Writer.Initialize("D:\Silkroad\GFXFileManager.dll")
PK2Writer.Open("D:\Silkroad\Media.pk2", "169841", 6)

PK2Writer.ImportFile("\sv.t", "D:\Silkroad\Patch\sv.t")

PK2Writer.Close()
PK2Writer.Deinitialize()

Downloads:
PK2Writer.dll & Classes:

greetz
LemoniscooL
 
Last edited:
Master Summoner
Joined
Nov 9, 2009
Messages
579
Reaction score
238
If it's able to overwrite pk2 files, it's awesome :O

in case you mean overwriting files inside a pk2 then the answere is yes it can
it can both import files that do not exist already inside the pk2 and also overwrite the file inside the pk2 if it exists already
 
Junior Spellweaver
Joined
Sep 14, 2011
Messages
196
Reaction score
64
Great release, useful for developing anything related to PK2 API ... especially for manual updates or something like that ...

Good job ^^
 
Master Summoner
Joined
Nov 9, 2009
Messages
579
Reaction score
238
Great release, useful for developing anything related to PK2 API ... especially for manual updates or something like that ...

Good job ^^

thats exactly what i wrote it for, my own launcher, with patch download and patching process ^^
 
Newbie Spellweaver
Joined
May 6, 2013
Messages
19
Reaction score
0
so please give me the file in the non-pk2 got an empty lot pk2
 
Initiate Mage
Joined
Feb 14, 2021
Messages
2
Reaction score
0
Can you reupload ? The link is broken.
 
Last edited:
Back
Top