GithubHelp home page GithubHelp logo

gmad's Introduction

gmad

Garry's Mod Addon Creator and Extractor

Usage

gmad <command> <options>

To create a new .gma file

gmad.exe create -folder "C:\path\to\addon\folder\" -out "C:\where\to\save\file\out.gma"

To extract an existing .gma file into its parent folder

gmad.exe extract -file "C:\steam\etc\garrysmod\addons\my_addon_12345.gma"

To extract an existing .gma file into another folder

gmad.exe extract -file "C:\steam\etc\garrysmod\addons\my_addon_12345.gma" -out "C:\this\folder"

Compiling

Compiling requires Bootil and Premake to generate the project files.

You can either add the lib and include folder to your path, or copy all the files in, or set them on the premake command line.

premake4 --outdir="bin/" --bootil_lib="c:/bootil/lib/" --bootil_inc="c:/bootil/include/" vs2010

Or on linux

premake4 --outdir="bin/" --bootil_lib="/whatevs/bootil/lib/" --bootil_inc="/whatevs/bootil/include/" gmake

You will need premake5 for newer Visual Studio versions.

premake5 --outdir="bin/" --bootil_lib="../bootil/lib/windows/vs2017/" --bootil_inc="../bootil/include/" vs2017

gmad's People

Contributors

artfunkel avatar bo98 avatar cyining avatar garrynewman avatar gitspartv avatar raphaelit7 avatar robotboy655 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  avatar  avatar  avatar

gmad's Issues

Fix buffer reallocation every file when creating GMA file

Currently gmad writes the entire GMA file into a ram buffer, before writing it to disk. This is already extremely bad as it means that in the 32 bit version of gmad you cannot reasonably create files bigger than 1GB without running out of ram. There also is no reason to write to ram rather than just writing everything directly to a file.

However, it gets way worse, because the way Bootil's AutoBuffer is used by gmad means that every time a file is written, the buffer has to be reallocated to fit that new file (and the buffer is made no bigger than that). This leads to a quadratic amount of ram being allocated (and free'd directly after) in the number of files in the addon.

This might not sound so bad, so to illustrate I will give some samples, assuming that the average file in an addon is 200KB.

Addon Size in MB Total allocated ram
10 MB 250 MB
50 MB 6.25 GB
100 MB 25 GB
300 MB 225 GB
1 GB 2.5 TB
2 GB 10 TB

Yes you read it right, to create a 2 GB GMA file you need to allocate a total of 10 TERABYTES of buffers, and even for a reasonable 300 MB addon, you have to allocate 225 GB throughout the entire creation of the GMA file.

I propose two possible fixes:

  1. The most sensible solution would be to bypass ram entirely and just write to the file directly, but I don't think this is something easy to do and requires a lot of code changes.
  2. The extremely simple fix would be to just allocate a suitable buffer size. When writing the header to the file, the size of each file is written too. Therefore just sum all of those up, and allocate that much for the buffer.

Can't create file because apparently it doesn't fit the requierments

This is the issue I get when I try to create a gma.file:

Santoss-MacBook-Pro:~ santosbraun$ /Users/santosbraun/Library/Application\ Support/Steam/steamapps/common/GarrysMod/bin/gmad_osx create -folder "/Users/santosbraun/Desktop/frostygamers/terrortown/update/ttt_bomb_station_712675840" -out "/Users/santosbraun/Desktop/newgmadfiles"
Garry's Mod Addon Creator 1.1
Looking in folder "/Users/santosbraun/Desktop/frostygamers/terrortown/update/ttt_bomb_station_712675840/"
.DS_Store
[Not allowed by whitelist]
[Filename contains captial letters]
gamemodes/.DS_Store
[Not allowed by whitelist]
[Filename contains captial letters]
gamemodes/terrortown/entities/entities/ttt_bomb_station/shared.lua
gamemodes/terrortown/entities/weapons/weapon_ttt_bomb_station/shared.lua
materials/.DS_Store
[Not allowed by whitelist]
[Filename contains captial letters]
materials/vgui/ttt/icon_health.png
File list verification failed
-End

My question is, I'm editing a downloaded file from the workshop it makes no sense that I edited one line in the config and when I try to re-create the file this happens.

File size cannot be acquired?

When attempting to create a GMA, I receive this error from one of my files: File 'filepath/file.vmt' seems to be empty, or we couldn't get its size! (errno=132)

I have multiple files that are smaller than this one, I'm not sure what the issue could be.

Build Failure on Ubuntu Xenial

Autobuilding gmad using Travis CI, which defaults to Unbuntu Xenial for the build environment.

It is failing as follows:


The command "cd linux/gmake && make -j4" exited with 0.

0.02s$ cd ../../../../gmad && premake4 --bootil_lib="../bootil/lib/linux/gmake/" --bootil_inc="../bootil/include" gmake

Building configurations...

Running action 'gmake'...

Generating Makefile...

Generating GMad.make...

Done.

The command "cd ../../../../gmad && premake4 --bootil_lib="../bootil/lib/linux/gmake/" --bootil_inc="../bootil/include" gmake" exited with 0.

1.30s$ make -j4

==== Building GMad (release) ====

gmadd.cpp

extract_gmad.cpp

create_gmad.cpp

Creating obj/Release

src/create_gmad.cpp: In function ‘bool CreateAddon::Create(Bootil::Buffer&, Bootil::BString, Bootil::String::List&, Bootil::BString, Bootil::BString)’:

src/create_gmad.cpp:92:124: error: ‘errno’ was not declared in this scope

     Output::Warning( "File '%s' seems to be empty, or we couldn't get its size! (errno=%i)\n", ( strFolder + *f ).c_str(), errno );

                                                                                                                            ^

GMad.make:109: recipe for target 'obj/Release/create_gmad.o' failed

make[1]: *** [obj/Release/create_gmad.o] Error 1

make[1]: *** Waiting for unfinished jobs....

Makefile:16: recipe for target 'GMad' failed

make: *** [GMad] Error 2

The command "make -j4" exited with 2.

Lua file is blank in .gma file

I was having issues creating a .gma file for a recently uploaded addon. When using gmad.exe to pack the addon, it left the .lua file empty. When I used Crowbar to check the contents of the .gma file that had been created, the .lua file was there, but empty. I ended up having to install a program called GMosh which properly included the lua file contents when packing my .gma file. gmad.exe gives me no errors as far as I can tell.

I have a pretty standard file structure, I was making a player model. The .lua file was named possum.lua, and was in the project folder "possum/lua/autorun". Everything else seemed to have been packed normally.

I might just be missing a step here, but I'm more inclined to think it's a bug as GMosh created the .gma file just fine, and it works in-game.

Here's both the working .gma created with gmosh, and the not working gmad created one:
possum_gma.zip

This thing does not work at all on OSX

I compiled this from source following the instructions you outlined for Linux, and sadly, nothing works. Like... at all.

When trying to extract

Segmentation fault: 11

When trying to create

Garry's Addon Creator 1.0
Garry's Addon Creator 1.0
Looking in folder "MY_MOD/"
Looking in folder "MY_MOD/"
No files found, can't continue!
No files found, can't continue!
File list verification failed
File list verification failed

And yeah, there is a folder there.

Please either fix this or at the very least include compiled .exe's in the Garry's Mod /bin/ instead (so I can use it with WINE)! Thanks :D

Build Warning on Ubuntu Bionic / Debian Buster

While testing #35 with Ubuntu Bionic instead, it output this warning, but the build was successful:

/home/travis/build/wiremod/gmad-build/bootil/projects/linux/gmake/../../../src/Bootil/File/File.cpp:242: warning: the use of tmpnam' is dangerous, better use mkstemp'

After December Patch i cant save DamageInfo

i made code like this:

hook.Add("EntityTakeDamage", "Test", function(ent, dmg)
ent.LastDamageInfo = dmg
end)

when im trying to print dmginfo after some time, i got CTakeDamageInfo [NULL], but not damage info. This error did not exist before the patch.

Feature Request: Show ignored files

When creating a gma only chosen files are shown, but ignored ones are not.

The list of chosen files is huge and doesnt really give an overview of the files, that got ignored.
When uploading an addon I made a mistake and ignored ".md"-files which includes mdl-files, just because I copied that star from another file-ending.
Didnt notice until a few days later, when the model wasnt available ingame.

Could be a nice addition to make sure in that list are only the files you wanted to ignore ^^

LzmaLib.h not found

src/Bootil/Utility/CompressionLZMA.cpp:3:26: fatal error: lzma/LzmaLib.h: No such file or directory #include "lzma/LzmaLib.h" ^ compilation terminated. make[1]: **\* [obj/Release/CompressionLZMA.o] Error 1 make: **\* [GMad] Error 2

I was able to get bootil to compile correctly. After that I merged the two folders (gmad-master and bootil-master) then ran the premake and make.

I am running on Ubuntu 14.04 LTS 64 bit. I tried installing the lzma libraries through apt-get and it stated that it was already installed. What have I done wrong?

p.s. - sorry if the format is strange, I've never used MD

GMad.sln compilation with VSCode 2017 throws errors

Global description

Tried to compile GMad using MSBuild, which throws errors.

Steps to reproduce

  1. Download GMad repository files and extract it
  2. Download Bootil repository files and extract it
  3. Premake GMad using the command premake5 --outdir="bin/" --bootil_lib="<path to bootil's parent>/bootil/lib/windows/vs2017/" --bootil_inc="<path to bootil's parent>/bootil/include/" vs2017
  4. Premake Bootil lib in 'projects' using the command premake5 vs2017
  5. Compile the output solution with the command SET VCTargetsPath=C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\Common7\IDE\VC\VCTargets& "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\MSBuild.exe" Bootil.sln /p:Configuration=Release
  6. Put the output lib to 'lib/windows/vs2017'
  7. Compile GMad using SET VCTargetsPath=C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\Common7\IDE\VC\VCTargets& "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\MSBuild.exe" GMad.sln /p:Configuration=Release

Expected output

The final binary 'gmad.exe' should appear in the 'bin' folder at the root of the GMad folder

Obtained result

At step 7: 58 errors when compiling (two samples of these errors:)

bootil_static.lib(Buffer.obj) : error LNK2038: discordance found for 
'_ITERATOR_DEBUG_LEVEL': value '2' doesn't match value '0' in 
create_gmad.obj [...\GMad.vcxproj]
bootil_static.lib(Tree.obj) : error LNK2001: unresolved external 
symbol __CrtDbgReport
 [...\GMad.vcxproj]

Usage Text Missing

A placeholder exists for printing how to use gmad in the case when no arguments are given bit the actual usage information is not present.

Can't create .gma file

I don't understand why I'm unable to create a file out of my folder containing the addon.

Here's my input into the terminal: /Users/santosbraun/Downloads/gmad_osx create -folder "/Users/santosbraun/Desktop/frostygamers/terrortown/update/ttt_advanced_disguiser_606792331" -out "/Users/santosbraun/Desktop/frostygamers/terrortown/update/"

Terminal: Garry's Mod Addon Creator 1.1
Looking in folder "/Users/santosbraun/Desktop/frostygamers/terrortown/update/ttt_advanced_disguiser_606792331/"
/Users/santosbraun/Desktop/frostygamers/terrortown/update/ttt_advanced_disguiser_606792331/addon.json error: Couldn't find file

Add xml, csv files to whitelist of the in-game mounting system

Details

I would like to be able to upload xml and csv files to the workshop.
Even if Lua and Gmod dont have a built-in parser, devs can write one themselves and use these files for their own purposes (defining the user interface, game items and other assets without using Lua).
Why not do this?

I need help...

I need help using this because I'm not familiar with this. Can you please tell me what I need and what I have to do. Please can you help me.

addon.json Not In Whitelist (Linux)

Gmad on Linux will not create an addon, because a required file, addon.json, is not on the whitelist. Confirmed this by observing the list contained in AddonWhiteList.h

/tmp/z2_additionalpoly/addon.json
    [Not allowed by whitelist]

Gmad.exe has stopped working

it keeps saying gmad.exe has stopped working and i dont know how to fix it?

any suggestions im uploading a swep and its not working?

*Only* finds addon.json when other files exist

Gmad on Linux, when listing all files it found, only lists addon.json, even though there are models and materials files filled with textures and models. If issue #15 is bypassed, it will accept addon.json and then proceed to create a very small addon (155 bytes in my test) with only addon.json contained.

Can't create *.gma files over 1.86gb (written 0 bytes! (Can't grow buffer?))

according to the news article we can now upload addons with up to 2gb in size (or even bigger). well i tried it. i was able to make a 1.61gb gma file and upload it to the workshop but never been able to create a bigger one. last test (1.86gb) failed with this error:

Failed to write file 'PATH TO A RANDOM FILE' - written 0 bytes! (Can't grow buffer?)
Failed to create the addon

had the same error before when i tried to make a 1.96gb addon

Visual Studio 2010 Build Tools (v100) required

Hello,
I tried to compile Gmad with the provided toolchain hint, and I now have a Microsoft solution file I struggle to compile.
My problem is: it requires Microsoft Visual Studio 2010 Build Tools (v100) which can't be found anywhere nowadays.
Where am I supposed to find it ? Also, could a more modern version of MSB be used in the future, since it's really difficult to retrieve as it is clearly outdated ?

Weird Issue on Mac (Testing on Linux)

So I've been working on an addon for a while, and I've figured out how to publish it to the workshop, the only problem is the gmad creator is not working properly. So I have my folder located at "~/Desktop/omgamazingaddon/" without addon.json in it. This is what gmad prints out in the terminal:

Logans-Mac-Mini:bin Logan$ ./gmad_osx create -folder ~/Desktop/omgamazingaddon -out ~/Desktop/hi.gma
Garry's Mod Addon Creator 1.1
Looking in folder "/Users/Logan/Desktop/omgamazingaddon/"
/Users/Logan/Desktop/omgamazingaddon/addon.json error: Couldn't find file

So yeah it can't find addon.json. It's not there. Now we get to the problem... If I put addon.json in the folder, it reads it... kinda... This is what it prints out:

Logans-Mac-Mini:bin Logan$ ./gmad_osx create -folder ~/Desktop/omgamazingaddon -out ~/Desktop/hi.gma
Garry's Mod Addon Creator 1.1
Looking in folder "/Users/Logan/Desktop/omgamazingaddon/"
No files found, can't continue!
File list verification failed

That's the problem I'm having. Here is how my folder is set up.

omgamzingaddon - The root folder
omgamazingaddon/addon.json - The addon.json file.
omgamazingaddon/lua Subfolder
omgamazingaddon/sound - Subfolder
omgamazingaddon/lua/autorun -SubSubFolder
omgamazingaddon/sound/addon_music - SubSubFolder
omgamazingaddon/lua/autorun/* - My lua scripts.
omgamazingaddon/sound/addon_music/* - My addon's music

I hope I've explained enough in an understandable way (judging I'm trying to give a lot... O_o)

Gmad is deleated by Kaspersky Internet Security immediately after launch

So basically as it really says. I have Kaspersky IS 2016 installed on my rig and after I try to do anything with gmad.exe, KIS deletes it immediately. To resolve this I've added gmad.exe and gmpublish.exe to KIS2016's whitelist, and it does not do this amymore, However I prefer not to do that in case a virus slips trough KIS.

It will be nice to have a correction for this. Please tell me how can I help further !

Lua: premake4.lua:1: attempt to call a nil value (global 'solution')

Hello,
I tried to run the compiling toolchain for Windows, but when doing so Lua throws this error:

C:\Users\User\dir\gmad-master>..\lua-5.3.5_Win32_bi\lua53.exe premake4.lua --outdir="bin/" --bootil_lib="../bootil-master/lib/" --bootil_inc="../bootil-master/include/" vs2010
..\lua-5.3.5_Win32_bin\lua53.exe: premake4.lua:1: attempt to call a nil value (global 'solution')
stack traceback:
        premake4.lua:1: in main chunk
        [C]: in ?

Any idea of what could be wrong ?

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.