Raised This Month: $32 Target: $400
 8% 

[ANY] VPK_API (Reader and Writer) (1.2) [28-Jan-2024]


Post New Thread Reply   
 
Thread Tools Display Modes
Author
Silvers
SourceMod Plugin Approver
Join Date: Aug 2010
Location: SpaceX
Plugin ID:
7833
Plugin Version:
1.2
Plugin Category:
General Purpose
Plugin Game:
Any
Plugin Dependencies:
    Servers with this Plugin:
     
    Plugin Description:
    Read and Write files in VPK files.
    Old 10-26-2021 , 05:00   [ANY] VPK_API (Reader and Writer) (1.2) [28-Jan-2024]
    Reply With Quote #1

    About:

    Details:
    • Supports VPK format version 1 and 2.
    • Can read and write files synchronously and asynchronously.
    • The MAX_PROCESS define is 0.3 seconds for asynchronous processing before waiting 0.1 seconds.
    • Does not create archives.
    • Does not write format version 2 footers.
    • Use the test plugin examples as a guide for reading and writing.
    • ToDo: Extract to temp file and rename on completion.
    • ToDo: Tidy up some error handling (mostly for missing files).
    • ToDo: Some natives may return true on error or wrong file count.
    • ToDo: Remove some of the commented out debug code.
    • ToDo: Convert some code to use methodmaps. - Done for v1.1 release.
    • Should not leak handles but have not tested. Please report any issues.


    Related Plugins:

    Thanks:
    • Dragokas - For requesting a method to Read VPK files.
    • Lux - For suggestions and ideas.
    • JoinedSenses - For sending me an example of version 2 format.


    Admin Commands: (requires "z" flag)

    PHP Code:
    // From the "vpk_api_test" plugin.
    // Tests all features of the plugin.
    // Creates a folder named "vpk_api_test" in your servers main directory (where addons etc is located).
    sm_vpk_api_test 


    Example Output:
    Spoiler



    Natives for developers:
    Spoiler



    Changes:
    Code:
    1.2 (28-Jan-2024)
        - Fixed memory leak caused by clearing StringMap/ArrayList data instead of deleting.
    
    1.1 (04-Dec-2021)
        - Changes to fix warnings when compiling on SourceMod 1.11.
        - Converted some code to use MethodMaps.
    
    1.0 (26-Oct-2021)
        - Initial release.

    Installation:
    • Download the .zip and extract the files to their respective folders in your servers \addons\sourcemod\ folder.
    Attached Files
    File Type: zip vpk_api.zip (28.5 KB, 35 views)
    __________________

    Last edited by Silvers; 01-28-2024 at 02:32.
    Silvers is offline
    Dragokas
    Veteran Member
    Join Date: Nov 2017
    Location: Ukraine on fire
    Old 10-26-2021 , 05:09   Re: [ANY] VPK_API (Reader and Writer) (1.0) [26-Oct-2021]
    Reply With Quote #2

    Cool!
    Highly anticipated feature to bypass valve_fs slow read.
    Congratzzz!
    __________________
    Expert of CMD/VBS/VB6. Malware analyst. L4D fun (Bloody Witch & FreeZone)
    [My plugins] [My tools] [GitHub] [Articles] [HiJackThis+] [Donate]
    Dragokas is offline
    NoroHime
    Veteran Member
    Join Date: Aug 2016
    Location: bed
    Old 12-12-2021 , 16:18   Re: [ANY] VPK_API (Reader and Writer) (1.0) [26-Oct-2021]
    Reply With Quote #3

    is this way to solution write stringtable error? like this
    https://github.com/ValveSoftware/Sou...es/issues/3451
    __________________
    NoroHime is offline
    Dragokas
    Veteran Member
    Join Date: Nov 2017
    Location: Ukraine on fire
    Old 12-13-2021 , 13:46   Re: [ANY] VPK_API (Reader and Writer) (1.1) [04-Dec-2021]
    Reply With Quote #4

    NoroHime, it can also help to cook potatoes if they burn.
    __________________
    Expert of CMD/VBS/VB6. Malware analyst. L4D fun (Bloody Witch & FreeZone)
    [My plugins] [My tools] [GitHub] [Articles] [HiJackThis+] [Donate]
    Dragokas is offline
    alasfourom
    Senior Member
    Join Date: Feb 2022
    Location: Saudi Arabia
    Old 03-19-2022 , 02:05   Re: [ANY] VPK_API (Reader and Writer) (1.1) [04-Dec-2021]
    Reply With Quote #5

    Does this mean it can read any vpk file that was installed in the server?
    alasfourom is offline
    Shao
    Senior Member
    Join Date: Jan 2015
    Old 03-19-2022 , 11:39   Re: [ANY] VPK_API (Reader and Writer) (1.0) [26-Oct-2021]
    Reply With Quote #6

    Quote:
    Originally Posted by NoroHime View Post
    is this way to solution write stringtable error? like this
    https://github.com/ValveSoftware/Sou...es/issues/3451
    Afaik this is because map makers don't stringtabledictionary and buildcubemaps before uploading their maps, to fix it you need to re-upload the proper .bsp files with said cvars done and those map makers get rather upset when you do so while they often claim that everything is fine. (P.S. It's not and they are often old uploads that they are too lazy to fix themselves in the end.)

    So I don't see how this plugin could help it since players happen to have different maps anyway, then again I hardly understand how it's supposed to work.
    Shao is offline
    Dragokas
    Veteran Member
    Join Date: Nov 2017
    Location: Ukraine on fire
    Old 03-19-2022 , 12:04   Re: [ANY] VPK_API (Reader and Writer) (1.1) [04-Dec-2021]
    Reply With Quote #7

    alasfourom, you can read any vpk with SM OpenFile .use_valve_fs = true (if vpk is installed).

    This plugin made by my request to bypass Valve slow FS read: Issue #1577
    __________________
    Expert of CMD/VBS/VB6. Malware analyst. L4D fun (Bloody Witch & FreeZone)
    [My plugins] [My tools] [GitHub] [Articles] [HiJackThis+] [Donate]

    Last edited by Dragokas; 03-19-2022 at 12:04.
    Dragokas is offline
    Bacardi
    Veteran Member
    Join Date: Jan 2010
    Location: mom's basement
    Old 01-16-2024 , 17:04   Re: [ANY] VPK_API (Reader and Writer) (1.1) [04-Dec-2021]
    Reply With Quote #8

    ...can this plugin edit files inside game VPKs what are signatured ?
    Counter-Strike: Source sv_pure system relies in these key signatures,
    sv_pure not check files inside VPK, only loosed files.
    Bacardi is offline
    Silvers
    SourceMod Plugin Approver
    Join Date: Aug 2010
    Location: SpaceX
    Old 01-17-2024 , 03:55   Re: [ANY] VPK_API (Reader and Writer) (1.1) [04-Dec-2021]
    Reply With Quote #9

    Quote:
    Originally Posted by Bacardi View Post
    ...can this plugin edit files inside game VPKs what are signatured ?
    Counter-Strike: Source sv_pure system relies in these key signatures,
    sv_pure not check files inside VPK, only loosed files.
    Assuming they are VPK archives, where you have: "pak01_dir.vpk", "pak01_001.vpk" etc then no. If their format is VPK2 the footer is written, not sure how much that is required for the game to read. Maybe one day I'll add support for VPK archives, or whatever they call that style of having multiple VPKs belonging to one, but since this was more of a proof-of-concept and pretty much unused I feel it's more effort and energy I could put elsewhere.
    __________________
    Silvers is offline
    Bacardi
    Veteran Member
    Join Date: Jan 2010
    Location: mom's basement
    Old 01-17-2024 , 06:16   Re: [ANY] VPK_API (Reader and Writer) (1.1) [04-Dec-2021]
    Reply With Quote #10

    yes, cs:s own archives.

    I was thinking, can some people edit materials parameters and still can keep VPK signature untouch,
    then sv_pure system just let them use like normally.

    ...some years ago, I got cs:s VPK files in use, which files were edit inside VPK but it had right (Valve) signature.
    This should not be possible unless someone got both "keys" to recompile cs:s VPK package.

    I don't have those files anymore, those went when I formatted my PC every other year

    *edit
    I have misspell "key" as "signature". Sorry

    Last edited by Bacardi; 01-17-2024 at 06:19.
    Bacardi is offline
    Reply


    Thread Tools
    Display Modes

    Posting Rules
    You may not post new threads
    You may not post replies
    You may not post attachments
    You may not edit your posts

    BB code is On
    Smilies are On
    [IMG] code is On
    HTML code is Off

    Forum Jump


    All times are GMT -4. The time now is 22:18.


    Powered by vBulletin®
    Copyright ©2000 - 2024, vBulletin Solutions, Inc.
    Theme made by Freecode