Author Topic: Nerd's Corner  (Read 109253 times)

Offline mousEtopher

  • Administrator
  • Ogre Mage
  • *****
  • Posts: 2065
    • View Profile
    • War2.me
Re: Nerd's Corner
« Reply #90 on: March 15, 2017, 02:39:51 PM »
Yes that's right. I went and pulled all the original .bmp screenshots I took from the trash and they're all bugged, so as far as I can tell the .bmp one bugs 100% of the time for me. It does that whether 2nd monitor is plugged or unplugged. (The other pc has a 2nd monitor too though actually, did not try it unplugged.) The newer version saves empty .pngs every time on both pcs. I also have another laptop laying around w/ I think a different version of windows (7 pro or home or something) which I can try if it will be useful for you. Also Nedro said he is having the same glitch with the .bmp version
« Last Edit: March 15, 2017, 02:43:07 PM by mousEtopher »
squeak!

Offline Lambchops

  • Ogre Mage
  • ********
  • Posts: 1541
    • View Profile
Re: Nerd's Corner
« Reply #91 on: March 16, 2017, 03:58:38 AM »
OK have updated it again HERE

Hopefully it should work Ok on all systems now, hard to tell "flying blind" because it works here when I test it...

Should save to PNG but will check for correct GDI+ behavior and switch to BMP if there's a problem.

Have added a check to ensure that the screen offset is being set correctly, which should stop "glitchy" images being saved. If this is still happening I will just have to slow down the capture loop until it is stable. This will allow time for WC2 to have the screen updated. IDK why this is happening as in theory that function should not return until the screen has been updated - and that is how it works on my computer, but it's hard to guess how another version of Windows is behaving.

Another thing I thought could *MAYBE* be a problem is the cpusavior program, so I tried it with that running and on my system all it did was make the image capture take 10x as long - but it still worked properly, however if you are still having problems and you are using the "cpusavior" app please also test without that.

Please let me know how it goes.

Thanks for your help.  :)
its gooder to hax hard and NEVER get caught!

Offline mousEtopher

  • Administrator
  • Ogre Mage
  • *****
  • Posts: 2065
    • View Profile
    • War2.me
Re: Nerd's Corner
« Reply #92 on: March 16, 2017, 01:06:00 PM »
it's glorious, ty lamby!!! Now when I take the ss I can see that it's scrolling across the minimap in neat rows left/right & top/bottom which it wasn't doing before. Saving as .bmp which is fine, 16MB of pure pudy goodness! :D thank you for your effort! c:



(Beetle Island people, great chaotic map!)
squeak!

Offline Lambchops

  • Ogre Mage
  • ********
  • Posts: 1541
    • View Profile
Re: Nerd's Corner
« Reply #93 on: March 17, 2017, 06:17:02 AM »
it's glorious, ty lamby!!!

Cool bananas  :D  ... and thank YOU for your testing and reports - that stuff is invaluable. Wish I knew why the GDI+ stuff isn't working though  :-\  oh well... another day.

What sort of image capture / save times is it reporting?

(Beetle Island people, great chaotic map!)

Yeah, fun map. I think we've done that one once or twice  :)
its gooder to hax hard and NEVER get caught!

Offline Lambchops

  • Ogre Mage
  • ********
  • Posts: 1541
    • View Profile
Re: Nerd's Corner
« Reply #94 on: March 17, 2017, 06:25:15 AM »
   ... and damnit there's still a glitch at 3 o'clock  grrrrr.

I'm going to have to inject this thing aren't I? ..... at least the anti-virus software will finally be right calling it a worm  ;D

its gooder to hax hard and NEVER get caught!

Offline mousEtopher

  • Administrator
  • Ogre Mage
  • *****
  • Posts: 2065
    • View Profile
    • War2.me
Re: Nerd's Corner
« Reply #95 on: March 17, 2017, 10:57:23 AM »
oh yeah, so there is, my attention to detail is so bad. :< Here are outputs from ant trails, nwtr, and river kwai:



nwtr looks perfect to me but I might be overlooking again. Others have similar 3oclockish bugs https://i.imgur.com/cI58POt.png https://i.imgur.com/8gVm9S9.png
squeak!

Offline Lambchops

  • Ogre Mage
  • ********
  • Posts: 1541
    • View Profile
Re: Nerd's Corner
« Reply #96 on: March 20, 2017, 09:41:50 AM »
Hey  :)
Sorry I've been MIA for a few days, thanks for posting that output.
Have made a self checking version.

It takes a SS then goes back through every screen in reverse order and gets it again, then checks if it's the same as the one from the first pass. If anything doesn't match it gets that screen again taking extra time/precautions and hopefully making sure that it has the right image. It's hard to tell because it just never fails on my machine.

Please try it out. It will also produce a small text file called "SSgrab.txt" that will look something like this:
Code: [Select]
Assuming single player mode.
Map Dimensions 128x128
Image aquired in 0.09 seconds
Check/re-aquire in 0.06 seconds
GdiplusStartup returned Ok
GdipGetImageEncodersSize returned Ok
GdipGetImageEncoders returned Ok
GdipCreateBitmapFromGdiDib returned Ok
GdipSaveImageToFile returned Ok
GdipDisposeImage returned Ok
GdiplusShutdown returned Ok

Checking GDI+ output
GDI+ confirmed OK

GDI+ check/Save (png) 0.36 sec
Complete. Total Time 0.52 seconds

Assuming single player mode.
Map Dimensions 128x128
Image aquired in 0.09 seconds
Check/re-aquire in 0.06 seconds
GdiplusStartup returned Ok
GdipCreateBitmapFromGdiDib returned Ok
GdipSaveImageToFile returned Ok
GdipDisposeImage returned Ok
GdiplusShutdown returned Ok
Save (png) 0.16 sec
Complete. Total Time 0.31 seconds

Which should help me track down why the PNG save is failing, if you can please post the results.



its gooder to hax hard and NEVER get caught!

Offline Lambchops

  • Ogre Mage
  • ********
  • Posts: 1541
    • View Profile
Re: Nerd's Corner
« Reply #97 on: March 20, 2017, 12:46:36 PM »
RE-PURPOSING COMMON PORTS FOR WC2
Maybe some programmer should change the ports in the files from war2 : instead 6112-6119 make it on a port range which are usually open.
That could help a lot for all !!!

This is a nice idea, but I'm pretty sure it wouldn't work in most cases. There MAY be a solution here for some people, depending on their gear/connection, IMHO it's unlikely, but if you want to try....

The first thing I should point out is that you can already select your game port via the CE installer.

This is the only port you need to worry about (6112 by default).

The 6112-6119 thing is a misnomer which was probably introduced into some docs that were being written at the same time BNE was being written and before they had the final IPX --> UDP conversion sorted out. When you are in a game you may be getting WC2 game packets on a variety of ports, depending on whether any of the other players have changed their default port. THIS DOES NOT MATTER for hosting, it is all taken care of by hole punching. It's only that single game port that is the issue.


RELEVANT STUFF
1) “open” is an over-simplification. Ports are not “open” or “closed”.

2) Routing tables aren't made to assume that there is only one end user connected to them, even if that is all there is. The job they are doing is to try to find the right place to send each packet.

3) What we tend to refer to as “opening” a port is adding a rule to the routing table to tell it to send traffic on that port to a particular place (our WC2 computer).

4) If we can't do that then we need to give the router some kind of hint to let it know we want those packets.

5) Even for common ports, packets are not just forwarded without the router having more information, as per (2) above they still don't know where to send it. The only ports for which this is done are called “Multicast” ports.



MULTICAST:
In theory a router receiving a packet on a multicast port will re-transmit it to all nodes downstream. I'm sure you can all guess what these ports were used for 99% of the time – yes, either spam or hacking. As a result most servers do not re-transmit multicast traffic, they just ditch it without a second thought. So apart from all the other logistical issues there would be with using one of these ports, you can bet if your provider is not letting you add a simple routing rule for one port, there's no way they will be sending you multicast traffic.

SO, USING COMMON “OPEN” PORTS:
Let's use the example of a very common port that handles UDP traffic, port 53, which is the port for DNS. Anything accessing the network using domain names needs to use DNS to translate the name (i.e. server.war2.ru)  into an IP address (i.e. 145.233.94.234), which is what the network protocol actually uses.

So a router has 3 computers attached to it, with people using web-browsers. Every time one of the 3 users loads a page, the address of the page (i.e. Forum.war2.ru) will be looked up using a DNS, then the HTML for that page is loaded which might include another 10 embedded items, like images, youtube vids or whatever, that are all hosted on different sites, and the HTML has named addresses in it so an additional DNS lookup may be required for each one of these. But even if the 3 computers are all using the same DNS server, they will all get the correct responses to their queries returned to them (and only them).

How? Well for UDP traffic in general ( DNS is UDP ) the router just keeps track of which computer was the last one to send a packet OUT to a given address on a given port, then when any traffic arrives from that address on that port, it sends it back to that computer – this is where the “hole punching” thing comes in...... but for the case where our 3 users are all simultaneously loading pages with 10-20 DNS lookups each, things would still get messed up.

So, in addition to that, for commonly used ports that are reserved for known protocols  like 53, 80 ,443 etc. the LAN router, and/or the relevant local client service will often also be doing some amount of port translation. i.e. The to:/from: port numbers on the packets will be different. DNS servers are usually dedicated to just that single job and will accept requests on a broad range of ports, not just 53. They just check if any incoming traffic on any port is a valid DNS request, then if so, respond to it. So computer A will be talking to the DNS server on port 53:100 and computer B will be using 53:1987 or whatever. i.e. 'A' sends requests with “To Port: 100” and “From Port: 53” then the DNS server will respond with  “To Port: 53” and “From Port: 100” so the LAN router will send it back to the correct node, where it will end up on port 53 and go to the correct service (DNS).

So you can see that even for the most commonly used UDP service port: the DNS port #53, in some cases NONE of the external traffic will actually be on port 53, and regardless of that, when some random packet turns up from an unknown address on port 53, even if the local router accepts it as being valid DNS traffic, it still doesn't know if it should be sent to computer 'A', 'B' or 'C', and as I have said, the fact that there may be only one computer connected locally usually does not change this. If the router can't find a valid reason to send a packet to a node, it won't. That's its job.

TRY IF YOU WANT:
So if you want, you can try changing you game port to 21, 25, 53, 80, 123, or 443. Perhaps even 37, 43,  67, 68, 137, 143 or 8080, and just hope that there is some kind of exception built into the upstream routing.

However this approach also requires all other players in a game to be able to reliably send you WC2 data over these ports, and the chances of NOBODY having these ports either A) blocked, B) running on stateful or app-layer firewalls, or C) being controlled by protocol specific daemons, seem fairly remote.

BEST BET:
For the people who are having issues because they are using some kind of mobile service that reduces it's bandwidth by tracking its routing upstream of the end-user, I think your best bet for something that is might possibly “sneak through” and not get butchered by everyone else's firewalls might be one of these: 


    2195 - Apple Push Notification Service
    3689 - iTunes, AirPlay
    4488 - Apple WACS
    5223 - Apple Push Notification Service
    5228 - Google play store,  Android cloud messaging

As a wild stab-in-the-dark, I'd try 4488 first.

But this is just if you want to try and hope, I don't really think there is much chance of it working.

**and using an Apple port definitely wouldn't work through an Apple phone, or probably not even if there was an Apple phone connected anywhere on the network.**
« Last Edit: March 20, 2017, 12:58:57 PM by Lambchops »
its gooder to hax hard and NEVER get caught!

Offline shesycompany

  • Death Knight
  • *********
  • Posts: 3587
  • retired, be in music section
    • View Profile
Re: Nerd's Corner
« Reply #98 on: March 20, 2017, 03:50:02 PM »
lamb your back! :-*

Offline Lambchops

  • Ogre Mage
  • ********
  • Posts: 1541
    • View Profile
Re: Nerd's Corner
« Reply #99 on: March 21, 2017, 09:39:44 AM »
lamb your back! :-*
Hehe :) ya I'm around, just stupid RL cramping my style a bit.
its gooder to hax hard and NEVER get caught!

Offline mousEtopher

  • Administrator
  • Ogre Mage
  • *****
  • Posts: 2065
    • View Profile
    • War2.me
Re: Nerd's Corner
« Reply #100 on: March 21, 2017, 01:03:04 PM »
Hey  :)
Sorry I've been MIA for a few days, thanks for posting that output.
Have made a self checking version.

It takes a SS then goes back through every screen in reverse order and gets it again, then checks if it's the same as the one from the first pass. If anything doesn't match it gets that screen again taking extra time/precautions and hopefully making sure that it has the right image. It's hard to tell because it just never fails on my machine.

Please try it out. It will also produce a small text file called "SSgrab.txt" that will look something like this:
Code: [Select]
Assuming single player mode.
Map Dimensions 128x128
Image aquired in 0.09 seconds
Check/re-aquire in 0.06 seconds
GdiplusStartup returned Ok
GdipGetImageEncodersSize returned Ok
GdipGetImageEncoders returned Ok
GdipCreateBitmapFromGdiDib returned Ok
GdipSaveImageToFile returned Ok
GdipDisposeImage returned Ok
GdiplusShutdown returned Ok

Checking GDI+ output
GDI+ confirmed OK

GDI+ check/Save (png) 0.36 sec
Complete. Total Time 0.52 seconds

Assuming single player mode.
Map Dimensions 128x128
Image aquired in 0.09 seconds
Check/re-aquire in 0.06 seconds
GdiplusStartup returned Ok
GdipCreateBitmapFromGdiDib returned Ok
GdipSaveImageToFile returned Ok
GdipDisposeImage returned Ok
GdiplusShutdown returned Ok
Save (png) 0.16 sec
Complete. Total Time 0.31 seconds

Which should help me track down why the PNG save is failing, if you can please post the results.


ok done! I think it's perfect this time? *tentatively hopeful*



here is the grab:

Code: [Select]
Assuming single player mode.
Map Dimensions 128x128
Image aquired in 0.87 seconds
Screen check fail (114,114)... reaquiring
Check/re-aquire in 1.25 seconds
GdiplusStartup returned Ok
GdipGetImageEncodersSize returned Ok
GdipGetImageEncoders returned Ok
GdipCreateBitmapFromGdiDib returned Ok
GdipSaveImageToFile returned InvalidParameter
GdipDisposeImage returned Ok
GdiplusShutdown returned Ok

Checking GDI+ output
GDI+ Error - reverting to BMP output.

bitmap saved to SS_Cliffhanger BNE - 20170321-125412.bmp
GDI+ check/Save (png) 0.23 sec
Complete. Total Time 2.37 seconds

Assuming single player mode.
Map Dimensions 128x128
Image aquired in 0.81 seconds
Screen check fail (14,14)... reaquiring
Check/re-aquire in 1.22 seconds
bitmap saved to SS_Cliffhanger BNE - 20170321-125524.bmp
Save (png) 0.00 sec
Complete. Total Time 2.04 seconds

squeak!

Offline Lambchops

  • Ogre Mage
  • ********
  • Posts: 1541
    • View Profile
Re: Nerd's Corner
« Reply #101 on: March 21, 2017, 05:08:46 PM »
ok done! I think it's perfect this time? *tentatively hopeful*

Yay! :) Thanks so much for all your help. You're awesome  :fro:

Yes, at least it's ending up with a correct image. I'm glad the re-checking thing worked cos I've got no way of testing it at the moment. One of these days I'll get my Win7 machine set up again and check it all out.

and now I know where to start looking with the GDI+ thing -->

       "GdipSaveImageToFile returned InvalidParameter"

Hardly the world's most helpful error code, pretty much means "I didn't like one of the numbers", but it's a start. If it would fail on my computer it'd be easy to fix, but no such luck lol.


its gooder to hax hard and NEVER get caught!

Offline Lambchops

  • Ogre Mage
  • ********
  • Posts: 1541
    • View Profile
Re: Nerd's Corner
« Reply #102 on: March 23, 2017, 02:59:41 AM »
"GdipSaveImageToFile returned InvalidParameter"

Oh, BTW:

Given this error, there's a fair chance that the JPG save might work, even if the PNG doesn't.

If you want to try, just put the attached .BAT file in the same folder as WC2FullSSc.exe and double click on it.

its gooder to hax hard and NEVER get caught!

Offline mousEtopher

  • Administrator
  • Ogre Mage
  • *****
  • Posts: 2065
    • View Profile
    • War2.me
Re: Nerd's Corner
« Reply #103 on: March 23, 2017, 08:41:07 AM »
that works great, ty! c:
squeak!

Offline Lambchops

  • Ogre Mage
  • ********
  • Posts: 1541
    • View Profile
Re: Nerd's Corner
« Reply #104 on: March 23, 2017, 02:33:25 PM »
that works great, ty! c:

NP :)



... and for those who are into such things, I've just done a big update to my

                Palette Editor (v1.0.2).




its gooder to hax hard and NEVER get caught!