Example #1
0
        private static DynValue MemGetLoadedTags(ScriptExecutionContext context, CallbackArguments args)
        {
            var script = context.GetScript();

            try
            {
                var table   = DynValue.NewTable(script);
                var process = GetGameProcess();
                if (process == null)
                {
                    return(table);
                }
                using (var memoryReader = new BinaryReader(new ProcessMemoryStream(process)))
                {
                    var tags = V7475GlobalIdMap.Read(process, memoryReader);
                    foreach (var pair in tags.Enumerate(memoryReader))
                    {
                        table.Table.Set(DynValue.NewNumber(pair.Key), DynValue.NewNumber(pair.Value.LocalHandle));
                    }
                }
                return(table);
            }
            catch (Exception ex)
            {
#if DEBUG
                Debug.WriteLine(ex);
#endif
                return(DynValue.NewTable(script));
            }
        }
Example #2
0
        private static long MemGetLocalTagHandle(uint globalId)
        {
            try
            {
                var process = GetGameProcess();
                if (process == null)
                {
                    return(-1);
                }
                using (var memoryReader = new BinaryReader(new ProcessMemoryStream(process)))
                {
                    var           tags = V7475GlobalIdMap.Read(process, memoryReader);
                    MemoryTagInfo info;
                    if (!tags.TryGetTagInfo(globalId, memoryReader, out info))
                    {
                        return(-1);
                    }
                    return(info.LocalHandle);
                }
            }
            catch (Exception ex)
            {
#if DEBUG
                Debug.WriteLine(ex);
#endif
                return(-1);
            }
        }