Giter VIP home page Giter VIP logo

garrysmod_common's People

Contributors

danielga avatar deinferno avatar doridian avatar handsomematt avatar king-dave avatar kingofbeast avatar leystryku avatar magnalunar avatar python1320 avatar raphaelit7 avatar swadicalrag avatar zekirax 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

garrysmod_common's Issues

Mathlib cannot be built. Tried under 32 bit aswell

This is when using the x86-64 version I have tried including everything in the sourcesdk its only mathlib that doesnt work.
==== Building mathlib (release_x86_64) ==== box_buoyancy.cpp ../../../mathlib/box_buoyancy.cpp:329:106: error: narrowing conversion of ‘2147483648’ from ‘unsigned int’ to ‘int32’ {aka ‘int’} [-Wnarrowing] 329 | const int32 ALIGN16 g_SIMD_signmask_W[4] ALIGN16_POST = { 0x80000000, 0x80000000, 0x80000000, 0xFFFFFFFF }; | ^ ../../../mathlib/box_buoyancy.cpp:329:106: error: narrowing conversion of ‘2147483648’ from ‘unsigned int’ to ‘int32’ {aka ‘int’} [-Wnarrowing] ../../../mathlib/box_buoyancy.cpp:329:106: error: narrowing conversion of ‘2147483648’ from ‘unsigned int’ to ‘int32’ {aka ‘int’} [-Wnarrowing] ../../../mathlib/box_buoyancy.cpp:329:106: error: narrowing conversion of ‘4294967295’ from ‘unsigned int’ to ‘int32’ {aka ‘int’} [-Wnarrowing] ../../../mathlib/box_buoyancy.cpp:330:99: error: narrowing conversion of ‘2147483648’ from ‘unsigned int’ to ‘int32’ {aka ‘int’} [-Wnarrowing] 330 | const int32 ALIGN16 g_SIMD_signmask_NoW[4] ALIGN16_POST = { 0x80000000, 0x80000000, 0x80000000, 0 }; | ^ ../../../mathlib/box_buoyancy.cpp:330:99: error: narrowing conversion of ‘2147483648’ from ‘unsigned int’ to ‘int32’ {aka ‘int’} [-Wnarrowing] ../../../mathlib/box_buoyancy.cpp:330:99: error: narrowing conversion of ‘2147483648’ from ‘unsigned int’ to ‘int32’ {aka ‘int’} [-Wnarrowing] make[1]: *** [mathlib.make:257: x86_64/Release/intermediate/mathlib/box_buoyancy.o] Error 1 make: *** [Makefile:111: mathlib] Error 2
Im compiling it on ubuntu server 20.04

[ERROR] Couldn't load module library! (The specified module could not be found.)

[ERROR] lua/test.lua:49: Couldn't load module library! (The specified module could not be found.)

  1. require - [C]:-1
  2. unknown - lua/test.lua:49

When a require the module. It happens when I use a function from another lib. I tested with D++, curl and Discord game SDK. My project is to create a module that interacts with discord.

No beta branch
Multiplayer
Windows 11

I don't know why this error occurs. Thanks for the help :).

InterfacePointers::Cvar() returns nothing in x86-64-support-sourcesdk

it works well on master, but it returns nullptr on x86-64-support-sourcesdk

reproduce:

#include <GarrysMod/Lua/Interface.h>
#include <GarrysMod/Interfaces.hpp>
#include <GarrysMod/InterfacePointers.hpp>
#include <icvar.h>

GMOD_MODULE_OPEN() {
    ICvar* icvar = InterfacePointers::Cvar();
    if (!icvar) {
        LUA->PushSpecial(GarrysMod::Lua::SPECIAL_GLOB);
        LUA->GetField(-1, "print");
        LUA->PushString("Failed to get ICvar interface!");
        LUA->Call(1, 0);
    	LUA->Pop();
    }
    
    return 0;
}

Remove lua_resume quirks

Looking at the lua_shared export table, I found that you're defining non-existing lua_resume function,
which is actually named lua_resume_real (which you already defined).
In other words, remove this line and then also remove this line too cuz it is not exported (and never was).

Catch up with the latest LuaJIT updates in GMod

This is still on even older version of LuaJIT 2.0.4, damn Daniel, this is outdated by two luashared updates...
(i don't remember the changes between 2.0.4 and 2.0.5, so you're on your own for updating that.)

The following is the set of changes I have noticed between LuaJIT 2.0.5 (previous luashared version) and LuaJIT 2.1.0-beta3 (current luashared version).

tldr

lauxlib.h (click meee)
  • Remove macros: luaL_getn, luaL_setn, lua_ref, lua_unref,lua_getref and luaL_reg
  • Add functions (new exports): luaL_setfuncs, luaL_pushmodule, luaL_testudata and luaL_setmetatable
  • Add macros: luaL_newlibtable and luaL_newlib
lua.h (click meee)
  • Add macro: LUA_OK (0) for thread status
  • Add macro: LUA_GCISRUNNING (9) option for gc
  • Add functions (new exports): lua_version, lua_copy, lua_tonumberx, lua_tointegerx and lua_isyieldable
luaconf.h (click meee)
  • Remove macros: LUA_COMPAT_MOD and LUA_COMPAT_GFIND
luajit.h (click meee)
  • Update macros: LUAJIT_VERSION, LUAJIT_VERSION_NUM and LUAJIT_VERSION_SYM
  • Add typedef: luaJIT_profile_callback
  • Add functions (new exports): luaJIT_profile_start, luaJIT_profile_stop and luaJIT_profile_dumpstack

os.target() is apparently a nil value when trying to use premake5

Currently trying to use premake5 on WSL with Ubuntu 16.04. when I run premake5 --os=linux gmake under the serversecure folder it runs into an issue with garrysmod_common

vaas_net@VAASNET:/mnt/c/linux_compiles/serversecure/gmsv_serversecure$ premake5 --os=linux gmake
Error: ...ecure/garrysmod_common/premake/config.v2.default.lua:4: attempt to call field 'target' (a nil value)

I have tried with and without the --os=linux in the command but the same issue occurs

Premake5 /usr/bin/bitmap:1: unexpected symbol near '<\127>'

Enviroment

OS - Debian GNU/Linux 10 (buster)
Premake5 - premake5 (Premake Build Script Generator) 5.0.0-beta1
garrysmod_common - master branch 72f62b4

Premake script

-- premake5.lua
PROJECT_GENERATOR_VERSION = 3

newoption {
	trigger = "gmcommon",
	description = "Sets the path to the garrysmod_common (https://github.com/danielga/garrysmod_common) directory",
	value = "path to garrysmod_common directory"
} 

gmcommon = _OPTIONS.gmcommon or os.getenv "GARRYSMOD_COMMON"
assert(gmcommon, "You didn't provide a path to your garrysmod_common (https://github.com/danielga/garrysmod_common) directory.")

include(gmcommon)

CreateWorkspace { name = "network" }
	CreateProject { serverside = true }
		IncludeHelpersExtended()
		IncludeSDKTier0()
		IncludeSDKTier1()
		IncludeSDKCommon()
		IncludeDetouring()

		includedirs "third-party/lua_threading"

Output

runner@runner-1:~/gmsv_network$ premake5 gmake --gmcommon="$HOME/garrysmod_common"
Selected version 3 of the project generator
Error: /usr/bin/bitmap:1: unexpected symbol near '<\127>'

How to fix

Delete or move /usr/bin/bitmap, so premake5 can't find it:

runner@runner-1:~/gmsv_network$ premake5 gmake --gmcommon="$HOME/garrysmod_common"
Selected version 3 of the project generator
Error: /usr/bin/bitmap:1: unexpected symbol near '<\127>'
runner@runner-1:~/gmsv_network$ sudo mv /usr/bin/bitmap /usr/bin/bitmap.old
runner@runner-1:~/gmsv_network$ premake5 gmake --gmcommon="$HOME/garrysmod_common"
Selected version 3 of the project generator
Building configurations...
Running action 'gmake'...
Generated projects/linux/gmake/Makefile...
Generated projects/linux/gmake/gmsv_network.make...
Generated ../garrysmod_common/projects/linux/gmake/helpers.make...
Generated ../garrysmod_common/projects/linux/gmake/helpers_extended.make...
Generated ../garrysmod_common/scanning/projects/linux/gmake/Makefile...
Generated ../garrysmod_common/sourcesdk-minimal/projects/linux/gmake/tier1.make...
Generated ../garrysmod_common/sourcesdk-minimal/projects/linux/gmake/LZMA.make...
Generated ../garrysmod_common/detouring/projects/linux/gmake/detouring.make...
Generated ../garrysmod_common/detouring/projects/linux/gmake/hde.make...
Generated ../garrysmod_common/detouring/projects/linux/gmake/minhook.make...
Done (684ms).

Also found simillar issue: hoelzro/linotify#18
Alternatively, change the package.cpath (maybe works, not tested)

Current package.path

/usr/local/share/lua/5.3/?.lua;/usr/local/share/lua/5.3/?/init.lua;/usr/local/lib/lua/5.3/?.lua;/usr/local/lib/lua/5.3/?/init.lua;./?.lua;./?/init.lua

Current package.cpath

/usr/local/lib/lua/5.3/?.so;/usr/local/lib/lua/5.3/loadall.so;./?.so;/usr/bin/?.so

But there must be another way. These options are a little hacky, maybe something in garrysmod_common is the problem? (exactly in it, but where?)

Issue compiling on release_x86_64

Linux

When executing make config=release_x86_64 all I receive this error and the compilation is terminated

../../../tier1/KeyValues.cpp: In member function ‘bool KeyValues::WriteAsBinary(CUtlBuffer&)’:
../../../tier1/KeyValues.cpp:2669:56: error: cast from ‘void*’ to ‘int’ loses precision [-fpermissive]
 2669 |                                 buffer.PutUnsignedInt( (int)dat->m_pValue );
      |                                                        ^~~~~~~~~~~~~~~~~~
../../../tier1/KeyValues.cpp: In member function ‘bool KeyValues::ReadAsBinary(CUtlBuffer&, int)’:
../../../tier1/KeyValues.cpp:2773:49: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
 2773 |                                 dat->m_pValue = (void*)buffer.GetUnsignedInt();
      |                                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ../../../public/tier0/platform.h:42,
                 from ../../../public/tier1/utlvector.h:20,
                 from ../../../public/tier1/KeyValues.h:25,
                 from ../../../tier1/KeyValues.cpp:18:
../../../public/tier0/threadtools.h: In instantiation of ‘CInterlockedIntT<T>::CInterlockedIntT() [with T = int]’:
../../../public/tier0/threadtools.h:1130:22:   required from here
../../../public/tier0/threadtools.h:446:75: error: narrowing conversion of ‘-1’ from ‘int’ to ‘long unsigned int’ [-Wnarrowing]
  446 |         CInterlockedIntT() : m_value( 0 )                               { COMPILE_TIME_ASSERT( sizeof(T) == sizeof(long) ); }
      |                                                                           ^~~~~~~~~~~~~~~~~~~
In file included from ../../../public/tier1/utlvector.h:21:
../../../public/tier0/threadtools.h:446:75: error: size ‘-1’ of array is negative
  446 |         CInterlockedIntT() : m_value( 0 )                               { COMPILE_TIME_ASSERT( sizeof(T) == sizeof(long) ); }
      |                                                                           ^~~~~~~~~~~~~~~~~~~
make[1]: *** [tier1.make:232: x86_64/Release/intermediate/tier1/KeyValues.o] Error 1
make: *** [Makefile:106: tier1] Error 2

I triple checked that I am using the x86-64 branch of garrysmod_common and I also manually inserted the x86-64 branch of sourcesdk-minimal into my garrysmod_common directory (and renamed each to garrysmod_common/sourcesdk-minimal)

Premake config was executed with ./premake5 --os=linux --gmcommon=../garrysmod_common gmake2

PROJECT_GENERATOR_VERSION = 3
defines "_M_X64"

newoption({
    trigger = "gmcommon",
    description = "Sets the path to the garrysmod_common (https://github.com/danielga/garrysmod_common) directory",
    value = "../garrysmod_common"
})

local gmcommon = assert(_OPTIONS.gmcommon or os.getenv("GARRYSMOD_COMMON"),
    "you didn't provide a path to your garrysmod_common (https://github.com/danielga/garrysmod_common) directory")
include(gmcommon)

CreateWorkspace({name = "rustyprops", abi_compatible = false, path = "projects/" .. os.target() .. "/" .. _ACTION})
    CreateProject({serverside = true, source_path = "source", manual_files = false})
        IncludeLuaShared()
        IncludeHelpersExtended()
        IncludeSDKCommon()
        IncludeSDKTier0()
        IncludeSDKTier1()
        IncludeSDKLZMA()
        IncludeScanning()
        IncludeDetouring()

Windows

When compiling on x64 I get the following errors (Using the same premake config and premake5.exe --os=windows --gmcommon=../garrysmod_common vs2022)

os.get() is deprecated in premake5

** Warning: os.get() is deprecated, use 'os.target()' or 'os.host()'.
   @C:/Users/Swadical/Data/garrysmod_common/config.lua(4)

** Warning: os.is() is deprecated, use 'os.istarget()' or 'os.ishost()'.
   @...wadical/Data/garrysmod_common/premake/pkg_config.lua(1)

Invalid lua_State* from ILuaBase*

Hi there, I was wondering if there was an issue with the internal state within the module? I'm trying to use some internal lua functions (i.e: lua_gettop) which I pass in the state from (LUA->GetState()) but the server instantly crashes when it's executed. I'm using the x64 branch along with the x64 github branch. Example code is below which will cause a crash:

GMOD_MODULE_OPEN()
{	
	std::cout << "lua_gettop = " << lua_gettop(LUA->GetState()) << std::endl;

	return 0;
}

Not sure if it's something I'm doing wrong or if there's an issue currently but feel free to correct me if I'm doing something wrong, thanks.

x64 Support and CMake

Is the x64 support support finished for this?

Also, it seems that gmod-module-base has switched to CMake. Seeing as CMake is basically the defacto build tool for C++ (especially because of nice CMake is as of 3.13),.

Do you have any plans to switch this library to use CMake?

Grabbing IClientEntityList pointer

I've been trying to get the IClientEntityList pointer following the examples inside of InterfacePointers.cpp
but it seems that it cannot find it for some reason (I am compiling this in 32-bit and as a server module).

here's how I'm doing it:
image

is there any guide on how to grab such interfaces? it would be nice to have a wiki section with this kind of information.

(question) x64 Tier2+ libs

How come tier2 and tier3 libs aren't supported, and are there any future plans to support it?
If there aren't any future plans, is there a way to hack in the IMaterial system for x64?

Build errors on Windows in newest version

It seems for some reason the ValueIsFalsy function does not get imported correctly?

https://github.com/SpaceAgeMP/gm_luaerror/actions/runs/8515194689/job/23537569583

Just yields

ValueIsFalsy: D:\a\gm_luaerror\gm_luaerror\dependencies\garrysmod_common\build\build.ps1:17
Line |
  17 |  if (ValueIsFalsy $DISABLE_32BIT) {
     |      ~~~~~~~~~~~~
     | The term 'ValueIsFalsy' is not recognized as a name of a cmdlet, function, script file, or executable program.
     | Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

The build code is effectively

Invoke-Expression ((New-Object System.Net.WebClient).DownloadString("$env:BOOTSTRAP_URL")) # bootstrap.ps1
& "$env:BUILD_SCRIPT" # build.ps1

Powershell config DISABLE_32/64BIT does not work

PowerShell (unlike bash) separates environment from other variables.
So setting DISABLE_64BIT = "true" as an environment variable does in fact not propagate into $DISABLE_64BIT but only into $env:DISABLE_64BIT.
Or are those variables supposed to be set in another way?

In my PR I had the $env: because I intended this to work with env vars initially.

Premake 5.0.0-alpha12 and staticruntime

edit: the enter key auto-posted this issue before I could write out the issue text...

staticruntime("On")
throws an error about how staticruntime isn't a thing anymore and then googling it leads to the change of using StaticRuntime in the flags table...
it seems like my own outdated fork of this repo has StaticRuntime in the flags table still so just going to see what the github master of premake uses...

edit2: yeah, premake master seems to use staticruntime()
I wish hitting enter in an issues title didn't post...

invalid value 'C++11' for language

I get this error when trying to compile serversecure:

Error: garrysmod_common-master/premake5.lua:197: invalid value 'C++11' for language

I've tried to use premake5 alpha 10 and premake5 alpha 11.

Issue in IntefacePointers.cpp

I'm running this with gm_8bit and on x64 sourcesdk support
rider64_RxU9iR0lME
This double dereference on windows path is giving me exception
I replaced it to the same behavior as in linux path and everything works fine

'Symbols::Steam3Server': redefinition; different basic types

Platform: Windows x64
Configuration: ReleaseWithSymbols
Error (active) E0147 declaration is incompatible with "const Symbol Symbols::Steam3Server" (declared at line 72 of "..\garrysmod_common\helpers_extended\source\Symbols.cpp") helpers_extended ..\garrysmod_common\helpers_extended\include\GarrysMod\Symbols.hpp 25

64bit?

Can this be used to make 64 bit binaries and if so, am I missing something?

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.