[QUOTE=ThePuska;47541441]Have you people ever made use of continuable exceptions? Meaning exception handling where you may continue execution at (or immediately after) the statement where the exception was raised. For example, if the exception was an out-of-bounds, you might correct it immediately, or if it was a socket error, you might set an error flag and return null or something.
I've run into it a few times while programming robots - when then exceptions involved division by zero, or exceeding the robot's motion range, or something similar, and mostly I've found it useful.
But there's no similar mechanism in C++ (due to the quite strict restrictions on the exceptions) and I haven't seen any library which would've made it even possible - and C# is much too inspecific - though I don't think it'd be impossible to adapt to C or C++ if you had some access to the runtime environment.
I've considered adapting it to MSVC's exception handling, since I think it's entirely possible (if you circumvent some of C++'s requirements) but I've no notion of its usefulness to anyone else.
edit: Basically, when a continuable exception is raised, the control is transferred to the handler (wherever in the callstack it may be above the function that raised it). When the handler is done, the control is transferred back to where it was raised from - and here it differs from ordinary exception handling, where control can never be transferred downwards in the stack.[/QUOTE]
I'm pretty sure Common Lisp has something like that called resumable exceptions.
[QUOTE=andrewmcwatters;47541762]i mean that's not even needed, you can write lua wrappers for what he's doing
by the time you're working in lua, and you expose some functions to read memory, you can write modules that work with higher level concepts, like working with entities directly, rather than addresses
switching between abstraction levels is pretty helpful when you want your code to be less duct taped together
for instance, when the process address changes, and the size of entities change, you have to adjust all of your offsets rather than in just one place
[editline]16th April 2015[/editline]
hell it doesn't even matter, it's just a software design nitpick
what i'm more interested in is your process for reverse engineering your shit
like how are you coming up the pointers for the gEntList, and determining the memory address size to iterate over? how about the glow ptr? are you using source sdk 2013 debug binaries for function signature and class size reference?
and down where you have obj.r, .g, .b, .a, how are you handling that and making it work with source? do you have mock-bindings to the color struct?
[editline]16th April 2015[/editline]
tell me your secrets
[editline]16th April 2015[/editline]
[url=https://code.google.com/p/hl2sb-src/source/browse/trunk/src/utils/sourcelua/game/server/baseentity.h]that stuff reminds me of back when i had the most ghetto way of handling sniffing down function signatures for SourceLua[/url]
overv was explaining to me roughly how SourceMod(?) found signatures in the engine to work with and I used a really primitive baked in method for replicating hl2sb's Lua API but for all Source Engine games
[editline]16th April 2015[/editline]
i like to pick at people's brains who dig their hands into memory[/QUOTE]
I actually made something to parse structs in regular lua, which will make a metatable based off the members in a file:
[t]https://a.pomf.se/dptele.png[/t]
This is the input file... it is a pretty basic input file right now, so is the parser (which has some things I just put together quickly and should be redone sometime):
[t]https://a.pomf.se/neuxfr.png[/t]
The reverse engineering part was the easy part, especially with dll injecting test code:
[code]
DllMain()
{
auto module = GetModuleHandleA("client.dll");
CreateInterfaceFn ClientFactory = GetProcAddress(module, "CreateInterface");
auto address = ClientFactory("ClientEntityList000", 0);
log("entlist offset: %p", (char *)(address) - (char *)(module));
}
[/code]
of course this could be done with signature scanning but i just threw this together really quickly for fun...
and also: this is all done from the lua process - nothing is internal; no vtable function hooking can be done (which would be a lot easier to render and stuff with)
[editline][/editline]
for getting structs and members of structs i use the mac dylibs..
[t]https://a.pomf.se/tjofmg.png[/t]
there's this which tells me the size of the glowobject struct (found in RenderGlowModels vfunction)
[QUOTE=MeepDarknessM;47541859]The reverse engineering part was the easy part, especially with dll injecting test code:
[code]
DllMain()
{
auto module = GetModuleHandleA("client.dll");
CreateInterfaceFn ClientFactory = GetProcAddress(module, "CreateInterface");
auto address = ClientFactory("ClientEntityList000", 0);
log("entlist offset: %p", (char *)(address) - (char *)(module));
}
[/code]
of course this could be done with signature scanning but i just threw this together really quickly for fun...
and also: this is all done from the lua process - nothing is internal; no vtable function hooking can be done (which would be a lot easier to render and stuff with)[/QUOTE]
legit af dude
also i really seemed to be over thinking it with the entlist part, but are more parts of the engine not exposed as interfaces than there are actual interfaces, so that was my default mental modus operandi i guess
and you said it's all done from the lua process so i'm guessing you're retrieving the addresses during runtime too? if so, [img]http://i.somethingawful.com/forumsystem/emoticons/emot-krad2.gif[/img]
I'm a bit late, but I [b]SCOFF[/b] at your recursive fibonacci sequence generators. Behold:
[code]
static const double phi = 1.618033988749895;
int fib(int n)
{
return round(pow(phi,n)/sqrt(5));
}
[/code]
[editline]now[/editline]
Waiting for FibonacciSequenceEnterpriseEdition to show up
by any chance do you have any approach for when you want to play around with a class, but you don't know any of it's signatures other than its base classes? or maybe you wanted to play around with stuff in its vtable?
i know that sounds a little convoluted, but for instance, someone in here was working on a dota 2 trainer cheat. i think most of the work done on that was probably just reading network messages (i'm not sure), but when he got into specific stuff like calculating projectile speed and travel distance, i figure he was accessing that information from structs or classes he wouldn't have a way of scanning for.
what do you do at that point? is it possible to use mac dylibs to dump vtables and work from there on windows? do you get method names for free, too?
[editline]16th April 2015[/editline]
i know i sound like a total skid, but i had loads of fun doing that type of stuff years ago.
[editline]16th April 2015[/editline]
now you've got me going actually, could you throw that up on github?
[QUOTE=andrewmcwatters;47542033]by any chance do you have any approach for when you want to play around with a class, but you don't know any of it's signatures other than its base classes? or maybe you wanted to play around with stuff in its vtable?
i know that sounds a little convoluted, but for instance, someone in here was working on a dota 2 trainer cheat. i think most of the work done on that was probably just reading network messages (i'm not sure), but when he got into specific stuff like calculating projectile speed and travel distance, i figure he was accessing that information from structs or classes he wouldn't have a way of scanning for.
what do you do at that point? is it possible to use mac dylibs to dump vtables and work from there on windows? do you get method names for free, too?
[editline]16th April 2015[/editline]
i know i sound like a total skid, but i had loads of fun doing that type of stuff years ago.
[editline]16th April 2015[/editline]
now you've got me going actually, could you throw that up on github?[/QUOTE]
Well usually, I just look for vtables in the dylibs so I can have all the offsets and names/symbols in the windows vtable easily, but that's not always guaranteed to be the same (there's no c++ standard for virtual tables - it doesn't even require vtables to exist)
for offsets, there are usually netvars for entities like that.. you can find them easily since they use RecvProp class (at least in source engine) which contains the actual netvar name:
[t]https://a.pomf.se/htlogb.png[/t]
oh shoot that's right and from there you can just find the recvprop and grab the offset and read, right? then if you have to deal with structs from there you can use that struct work you wrote to write in lua and then push that stuff back to the game in the struct layout it was expecting
dude toss that stuff on github for real man
[QUOTE=andrewmcwatters;47542138]dude toss that stuff on github for real man[/QUOTE]
i might sooner or later, but for now i am working on prettying it up
also it's heavily dependant on windows
[QUOTE=Dr Magnusson;47532126]I feel a bit like a mad scientist. I keep running into problems that I feel would be best solved by some new construct that I haven't seen before. This time I needed something that could store values at arbitrary positions in an integer, sort of like allocating the first 4 bits of a short to describe something, the next 3 to describe something else, etc.
I'm using it for my scene graph, where I'm gonna assign X bits to each state, so I can just sort the integers and get the (hopefully) most efficient render order.
[...][/QUOTE]
Unless you have vastly changing rendering every frame, wouldn't it be far faster to use a persistent tree instead of (partially) sorting a relatively long list?
[editline]17th April 2015[/editline]
[QUOTE=FalconKrunch;47535013]Port forwarding is for receiving and sending packets to a server with a public IP address, [B]but it doesn't work if two people behind a NAT'ed router want to talk to each other[/B].
So what you need is a server that keeps track of the public IP address of the server, if you don't, it's lost in the network because of the NAT stuff.
Afterwards both clients know the public IP addresses of each other, and you can communicate directly, but you need the initial setup to configure the routing tables correctly.
This guy can explain it way better than I can.
[url]https://keithjohnston.wordpress.com/2014/02/17/nat-punch-through-for-multiplayer-games/[/url]
Truth be told I don't really have experience with this as it's all just a huge pain in the ass and I can't be bothered to reinvent the wheel.[/QUOTE][emphasis mine]
(I know this is late, but I have a bit to add.)
This is false.
Let's call the user that has port forwarding enabled the server and the one without the client.
Only the client can initiate the connection (by sending to the forwarded port on the other machine), however doing so will open a reverse port on the client's NAT to listen for the reply.
This automatically opened port can't be determined beforehand though (since it's dynamically allocated to prevent collisions), so the server has to check the IP [I]and port[/I] the packets are coming from and reply to that precise endpoint.
I'm not entirely sure how it works for TCP, but I assume it just uses the same lookup table with timeouts and won't bother to keep track of individual connections.
If it still doesn't work with the server's public IP and port then there must be a firewall issue somewhere.
However that's somewhat unlikely if LAN games already work (except for UDP broadcasts, which usually can't cross NATs).
[editline]17th April 2015[/editline]
[QUOTE=geel9;47539138]I've used it rarely in PHP -- defining a sorting function for usort if it's incredibly simple.
I've used it exactly once in C#.[/QUOTE]
I use lambdas all the time, but I currently create almost exclusively middleware and capturing variables is often the fastest way to defer execution of a piece of code.
I often use async to that end too though.
Named inline functions are fairly rare for me, but I'd still prefer them to cluttering the next-higher namespace with a one-off method.
[editline]17th April 2015[/editline]
[QUOTE=Contron;47539360]After jumping ship from Java as my preferred personal language this January, I can't really imagine going back. I find myself being able to express what I'm trying to do with much fewer lines in C#. Plus, it's very nice to see Microsoft still adding worthwhile improvements to the language.
I also remember running one of my console applications with Mono over SSH on Debian for the first time. Hell, I haven't even mentioned how decent WPF has been for learning and working with. For all intents and purposes this post makes me sound like a fanboy, but if it means being able to write much nicer code - then by all means I'm guilty.[/QUOTE]
I have only a few gripes with the language:
- No covariant return types for method overloads
- No iterators ([I]yield return[/I]) in lambdas (but [I]await[/I] works)
- The type inference hasn't quite kept up, so it won't always resolve variant interfaces.
Everything else is a pretty minor annoyance in my opinion.
Static interfaces would be neat so I could use operators with generics though.
[editline]17th April 2015[/editline]
[QUOTE=Mega1mpact;47539562]looks like lambda != delegate
[img]http://i.imgur.com/o9hYfRZ.png[/img][/QUOTE]
This is because lambdas can be used to define instances of [I]MulticastDelegate[/I] (which is what all [I]Delegate[/I]s are now, effectively) as well as [I]Expression[/I] instances.
They have no inherent type so you have to cast them to one of those options.
[QUOTE=MeepDarknessM;47542166]i might sooner or later, but for now i am working on prettying it up
also it's heavily dependant on windows[/QUOTE]
I've done something similar in LuaJIT but it was rather unstable and liked to crash :v:
[editline]16th April 2015[/editline]
ISP upgraded me fro 30mbps to 50mbps down and 1mbps to 5mbps up for free. Hurrahhh, think of the speed I can upload and download linux distros now!
I just implemented object scaling.
I didn't think that negative sizes would actually work, but I think opengl handles it automatically, or I somehow did something very right.
In any case, I now know how to make an instant room out of an inside out cube.
(Quality is shite because all I have is gifcam for recording)
[vid]http://i.imgur.com/4IvRDAn.webm[/vid]
[QUOTE=Map in a box;47542393]I've done something similar in LuaJIT but it was rather unstable and liked to crash :v:
[editline]16th April 2015[/editline]
ISP upgraded me fro 30mbps to 50mbps down and 1mbps to 5mbps up for free. Hurrahhh, think of the speed I can upload and download linux distros now![/QUOTE]
i chose not to do luajit since there is no luajit 5.3 available :v
5.3 is the best lua yet, it has 64 bit integers by default + all bitwise operators and bitwise operator overloading
I also prettied up the code a ton:
[t]https://a.pomf.se/faymnc.png[/t]
also, almost everything in this picture is a number-type
you know LuaJIT has 64 bit integers right? and numbers of all other types by using FFI?
[lua]
local i = 10ULL
[/lua]
lua 5.3 is a mess
[QUOTE=Darwin226;47539365]A custom compare function sounds like an inline lambda. I don't really see a reason to give it a name.
Unless you're saying you've used lambdas exactly once in C#.[/QUOTE]
Sorry, should clarify that a bit I suppose. With PHP, the custom sorting function as a NAMED function inside of another named php function.
In C#, I've used anonymous methods [b]defined in a method, and only called within that method.[/b] Sort of like some unholy gotos. Or a weird way to separate code.
[editline]17th April 2015[/editline]
I use lambdas all the goddamn time, make no mistake.
[img]http://i.imgur.com/WUOrnK8.png[/img]
I have kidnapped Polkm to become a part of the developer supercollective, Planimeter. I am feeding him nothing but bread and water and breaking him in. He will be the lead maintainer of the Grid Payload project, which separates the networking functionality from Grid into a lightweight solution you can use in your game projects.
[img]http://i.imgur.com/XY7mua9.png[/img]
Our engineers are privately picking apart the pixeltastic creation "The Spooky Cave" and infusing it with the geometronic, game dev frenetic Grid technology to create something totally super cool.
Although we won't be releasing this spooky grid thingawhatsit, it'll give insight into how Grid can be further developed to create a very sweet game dev experience. Also I'll get to mess around with the possibility of TSC being multiplayer. Don't tell Polkm. He's currently being force-intoxicated to silence his cries for fellow developers to help him escape.
[QUOTE=andrewmcwatters;47543210][img]http://i.imgur.com/WUOrnK8.png[/img]
I have kidnapped Polkm to become a part of the developer supercollective, Planimeter. I am feeding him nothing but bread and water and breaking him in. He will be the lead maintainer of the Grid Payload project, which separates the networking functionality from Grid into a lightweight solution you can use in your game projects.
[img]http://i.imgur.com/XY7mua9.png[/img]
Our engineers are privately picking apart the pixeltastic creation "The Spooky Cove" and infusing it with the geometronic, game dev frenetic Grid technology to create something totally super cool.
Although we won't be releasing this spooky grid thingawhatsit, it'll give insight into how Grid can be further developed to create a very sweet game dev experience. Also I'll get to mess around with the possibility of TSC being multiplayer. Don't tell Polkm. He's currently being force-intoxicated to silence his cries for fellow developers to help him escape.[/QUOTE]
jokse on yuo alchohol makssse me ebettr at progmring
[QUOTE=LuaChobo;47543235]nintendo sent me a package gee i wonder what it could be
[t]http://i.imgur.com/iDUQ8Uc.jpg[/t][/QUOTE]
[img]http://i.imgur.com/bsGmt0o.jpg[/img]
Your secrets have been revealed!
[QUOTE=LuaChobo;47543235]nintendo sent me a package gee i wonder what it could be
[t]http://i.imgur.com/iDUQ8Uc.jpg[/t][/QUOTE]
WHAT IS IT PLEASE
[QUOTE=Rocket;47543377]it's a wii u developer kit, you mentioned it last week in the unity thread.[/QUOTE]
oh.
[editline]17th April 2015[/editline]
lol shit
[QUOTE=Tamschi;47542371]Unless you have vastly changing rendering every frame, wouldn't it be far faster to use a persistent tree instead of (partially) sorting a relatively long list?
[/QUOTE]
I actually kinda scrapped the idea, but I still think it's a pretty legit idea, especially for a highly dynamic scene. Think thousands of objects using two different shaders, but being drawn out of order, so you have thousands of shader state changes per frame
Apparently people actually want Rant tutorials... [img]http://i.imgur.com/18TeFSk.png[/img]
This prompted me to start working on my Rant IDE again so that I wouldn't be recording my voice over Command Prompt. I got it working nicely with the new Rant engine:
[vid]https://a.pomf.se/ymsawh.mp4[/vid]
And suddenly it's a lot faster than before. How strange.
[QUOTE=HueyFreeman;47542006]I'm a bit late, but I [b]SCOFF[/b] at your recursive fibonacci sequence generators. Behold:
[code]
static const double phi = 1.618033988749895;
int fib(int n)
{
return round(pow(phi,n)/sqrt(5));
}
[/code]
[editline]now[/editline]
Waiting for FibonacciSequenceEnterpriseEdition to show up[/QUOTE]
Ignoring the floating point precision, that's still linear.
What is linear? Linear time? How, why?
[I]They're coming for you.[/I]
[IMG]http://i.imgur.com/6r43z8E.gif[/IMG]
[QUOTE=Fourier;47544047]What is linear? Linear time? How, why?[/QUOTE]
I was referring to the exponentiation. However it seems that C's pow implementation uses some floating point approximations anyways. So it's constant, just bad for integers.
If it were implemented the usual way for integers, then it would be linear (but I doubt it would be implemented in the usual way).
Yeah I thought so. After all for X^100 you need to do X*X*X*X*...*X, 100 times.
[QUOTE=Fourier;47544132]Yeah I thought so. After all for X^100 you need to do X*X*X*X*...*X, 100 times.[/QUOTE]
That's what I'm hinting at. You only need to do ~7 multiplications for X^100.
[QUOTE=General J;47544064][I]They're coming for you.[/I]
[IMG]http://i.imgur.com/6r43z8E.gif[/IMG][/QUOTE]
[media]http://www.youtube.com/watch?v=4aGDCE6Nrz0[/media]
[QUOTE=General J;47544064][I]They're coming for you.[/I]
[IMG]http://i.imgur.com/6r43z8E.gif[/IMG][/QUOTE]
I like this idea, there's a lot of potential here.