local tCallbackOnInclude = {
    ["ulib/shared/hook.lua"] = function()
        detours:Emit("HookLoaded")
    end,
}
local tCallbackOnRequire = {
    ["hook"] = function()
        if file.Exists("ulib/shared/hook.lua", "LUA") then
            return end

        detours:Emit("HookLoaded")
    end,
    ["concommand"] = function()
        detours:Emit("ConCommandLoaded")
    end
}

_G.include = detours:Add(include, function(filename, ...)
    --G.MsgC({r = 255,g = 0,b = 0}, "[INCLUDE] ", {r = 255,b = 255,g = 255}, filename, "\n")

    local ret = fnOriginal(filename, ...)
    if isfunction(tCallbackOnInclude[filename]) then
        tCallbackOnInclude[filename]()
    end

    return ret
end)
_G.require = detours:Add(require, function(filename, ...)
    --G.MsgC({r = 255,g = 0,b = 0}, "[REQUIRE] ", {r = 255,b = 255,g = 255}, filename, "\n")

    local ret = fnOriginal(filename, ...)
    if isfunction(tCallbackOnRequire[filename]) then
        tCallbackOnRequire[filename]()
    end

    return ret
end)
--_G.AddCSLuaFile = detours:Add(AddCSLuaFile, function(filename)
--    --local cool_filename = getpath(G.debug.getinfo(2).short_src) .. (filename or "")
--
--    --MsgC({r = 255,g = 255,b = 0}, "[ADDCSLUA] ", {r = 255,b = 255,g = 255}, cool_filename, "\n")
--    return fnOriginal(filename)
--end)
