//----------------------------------------------------------------------------- extern void InitCommands(); extern void ClearAllCommands(); extern PLUGIN_RESULT DispatchClientCommand(edict_t *pEntity, const CCommand &command); //----------------------------------------------------------------------------- // The plugin is a static singleton that is exported as an interface //----------------------------------------------------------------------------- CSourcePython g_SourcePythonPlugin; EXPOSE_SINGLE_INTERFACE_GLOBALVAR(CSourcePython, IServerPluginCallbacks, INTERFACEVERSION_ISERVERPLUGINCALLBACKS, g_SourcePythonPlugin ); //----------------------------------------------------------------------------- // Helper console variable to tell scripters what engine version we are running // on. //----------------------------------------------------------------------------- ConVar sp_engine_ver("sp_engine_ver", XSTRINGIFY(SOURCE_ENGINE), 0, "Version of the engine SP is running on"); //----------------------------------------------------------------------------- // Interface helper class. //----------------------------------------------------------------------------- struct InterfaceHelper_t { const char* szInterface; void** pGlobal; }; //----------------------------------------------------------------------------- // We need all of these interfaces in order to function. //----------------------------------------------------------------------------- InterfaceHelper_t gEngineInterfaces[] = { {INTERFACEVERSION_VENGINESERVER, (void **)&engine},
//----------------------------------------------------------------------------- // Expose constants. //----------------------------------------------------------------------------- void export_constants(scope _core) { _core.attr("SOURCE_ENGINE") = XSTRINGIFY(SOURCE_ENGINE); _core.attr("SOURCE_ENGINE_BRANCH") = XSTRINGIFY(SOURCE_ENGINE_BRANCH); }
IXGBE_PARAM(RSS, "Number of Receive-Side Scaling Descriptor Queues, " "default 0=number of cpus"); /* VMDQ - Virtual Machine Device Queues (VMDQ) * * Valid Range: 1-16 * - 1 Disables VMDQ by allocating only a single queue. * - 2-16 - enables VMDQ and sets the Desc. Q's to the specified value. * * Default Value: 1 */ #define IXGBE_DEFAULT_NUM_VMDQ 8 IXGBE_PARAM(VMDQ, "Number of Virtual Machine Device Queues: 0/1 = disable, " "2-16 enable (default=" XSTRINGIFY(IXGBE_DEFAULT_NUM_VMDQ) ")"); #ifdef CONFIG_PCI_IOV /* max_vfs - SR I/O Virtualization * * Valid Range: 0-63 * - 0 Disables SR-IOV * - 1-63 - enables SR-IOV and sets the number of VFs enabled * * Default Value: 0 */ #define MAX_SRIOV_VFS 63 IXGBE_PARAM(max_vfs, "Number of Virtual Functions: 0 = disable (default), " "1-" XSTRINGIFY(MAX_SRIOV_VFS) " = enable "
IXGBE_PARAM(RSS, "Number of Receive-Side Scaling Descriptor Queues, default 1=number of cpus"); #endif /* DEV_HPCAP */ /* VMDQ - Virtual Machine Device Queues (VMDQ) * * Valid Range: 1-16 * - 1 Disables VMDQ by allocating only a single queue. * - 2-16 - enables VMDQ and sets the Desc. Q's to the specified value. * * Default Value: 1 */ #define IXGBE_DEFAULT_NUM_VMDQ 8 IXGBE_PARAM(VMDQ, "Number of Virtual Machine Device Queues: 0/1 = disable, 2-16 enable (default=" XSTRINGIFY(IXGBE_DEFAULT_NUM_VMDQ) ")"); #ifdef CONFIG_PCI_IOV /* max_vfs - SR I/O Virtualization * * Valid Range: 0-63 * - 0 Disables SR-IOV * - 1 Enables SR-IOV to default number of VFs enabled * - 2-63 - enables SR-IOV and sets the number of VFs enabled * * Default Value: 0 */ #define MAX_SRIOV_VFS 63 IXGBE_PARAM(max_vfs, "Number of Virtual Functions: 0 = disable (default), 1 = default settings, 2-" XSTRINGIFY(MAX_SRIOV_VFS) " = enable this many VFs");
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "dict_private.h" #define XSTRINGIFY(x) STRINGIFY(x) #define STRINGIFY(x) #x const char* const kDictVersionString = XSTRINGIFY(DICT_VERSION_MAJOR) "." XSTRINGIFY(DICT_VERSION_MINOR) "." XSTRINGIFY(DICT_VERSION_PATCH); void* (*dict_malloc_func)(size_t) = malloc; void (*dict_free_func)(void*) = free; int dict_int_cmp(const void* k1, const void* k2) { const int a = *(const int*)k1; const int b = *(const int*)k2; return (a > b) - (a < b); } int
void images_install(void* newData, size_t newDataLen, uint32_t newFourcc, uint32_t replaceFourcc) { ImageDataList* list = NULL; ImageDataList* cur = NULL; ImageDataList* toReplace = NULL; ImageDataList* verify = NULL; int isReplace = (replaceFourcc != newFourcc) ? TRUE : FALSE; int isUpgrade = FALSE; Image* curImage = imageList; while(curImage != NULL) { if(cur == NULL) { list = cur = verify = malloc(sizeof(ImageDataList)); } else { cur->next = malloc(sizeof(ImageDataList)); cur = cur->next; } bufferPrintf("Reading: "); print_fourcc(curImage->type); bufferPrintf(" (%d bytes)\r\n", curImage->padded); cur->type = curImage->type; cur->next = NULL; cur->data = malloc(curImage->padded); nor_read(cur->data, curImage->offset, curImage->padded); if(isReplace && cur->type == replaceFourcc) { isUpgrade = TRUE; } else if(cur->type == newFourcc) { toReplace = cur; } curImage = curImage->next; } if(!isUpgrade) { bufferPrintf("Performing installation... (%d bytes)\r\n", newDataLen); ImageDataList* ibox = malloc(sizeof(ImageDataList)); ibox->type = replaceFourcc; ibox->data = toReplace->data; ibox->next = toReplace->next; toReplace->next = ibox; toReplace->data = images_inject_img3(toReplace->data, newData, newDataLen); images_change_type(ibox->data, ibox->type); } else { bufferPrintf("Performing upgrade... (%d bytes)\r\n", newDataLen); void* newIBoot = images_inject_img3(toReplace->data, newData, newDataLen); free(toReplace->data); toReplace->data = newIBoot; } //check for size and availability size_t newPaddedDataLen=0; size_t totalBytes=0; //if somebody can find how to get padded length for new ibot maybe this loop not needed while(verify != NULL) { cur = verify; verify = verify->next; AppleImg3RootHeader* header = (AppleImg3RootHeader*) cur->data; totalBytes += header->base.size; if(cur->type == newFourcc) { newPaddedDataLen = header->base.size; } } bufferPrintf("Total size to be written %d\r\n",totalBytes); if((ImagesStart + totalBytes) >= 0xfc000) { bufferPrintf("**ABORTED** Writing total image size: 0x%x, new ibot size: 0x%x at 0x%x would overflow NOR!\r\n", totalBytes, newPaddedDataLen,ImagesStart); images_rewind(); images_release(); images_setup(); return; } bufferPrintf("Flashing...\r\n"); images_rewind(); while(list != NULL) { cur = list; list = list->next; AppleImg3RootHeader* header = (AppleImg3RootHeader*) cur->data; bufferPrintf("Flashing: "); print_fourcc(cur->type); bufferPrintf(" (%x, %d bytes)\r\n", cur->data, header->base.size); images_append(cur->data, header->base.size); free(cur->data); free(cur); } bufferPrintf("Flashing Complete, Free space after flashing %d\r\n",0xfc000-MaxOffset); images_release(); images_setup(); bufferPrintf("Configuring openiBoot settings...\r\n"); Volume* volume; io_func* io; io = bdev_open(0); volume = openVolume(io); char buffer [sizeof(XSTRINGIFY(OPENIBOOT_VERSION))]; strcpy(buffer, XSTRINGIFY(OPENIBOOT_VERSION)); add_hfs(volume, (uint8_t*)buffer, sizeof(buffer), "/openiboot"); closeVolume(volume); CLOSE(io); ftl_sync(); if(!nvram_getvar("opib-temp-os")) { nvram_setvar("opib-temp-os", "0"); } if(!nvram_getvar("opib-default-os")) { nvram_setvar("opib-default-os", "1"); } if(!nvram_getvar("opib-menu-timeout")) { nvram_setvar("opib-menu-timeout", "10000"); } nvram_save(); bufferPrintf("openiBoot installation complete.\r\n"); }