Author Topic: nwncx webkit  (Read 2027 times)

Legacy__Cyan_

  • Newbie
  • *
  • Posts: 28
  • Karma: +0/-0
nwncx webkit
« on: February 01, 2016, 10:27:03 am »


               

Hi, recently i started to work on a plugin to inject webkit into nwn.The idea is to have a custom html based gui system.I also embededd asp.net web api 2 into nwserver to share informations with gui in a Restful manner.


I attached 2 examples with google frontpage and vault home.

test.png


test.png



               
               

               
            

Legacy_leo_x

  • Sr. Member
  • ****
  • Posts: 403
  • Karma: +0/-0
nwncx webkit
« Reply #1 on: February 02, 2016, 10:48:43 pm »


               

OMG.  Many have dreamed of this and if anyone hasn't they should!  Kudos to you.  Please, please, whatever the outcome share the source code.



               
               

               
            

Legacy_virusman

  • Sr. Member
  • ****
  • Posts: 448
  • Karma: +0/-0
nwncx webkit
« Reply #2 on: February 02, 2016, 10:51:47 pm »


               Looks very interesting! It's something I also wanted to do for a very long time, so I'd be glad to collaborate on it. Can you upload the source code?
               
               

               
            

Legacy__Cyan_

  • Newbie
  • *
  • Posts: 28
  • Karma: +0/-0
nwncx webkit
« Reply #3 on: February 03, 2016, 08:00:54 pm »


               

Hi,  i have learned a lot by your code Virusman, thank you very much for all your efforts.

Atm i am working on it to setup a proper protocol to handle GUI events, i injected asp.net web api 2 to have a restful service, it works but requires framework.net (nadi think most of servers run on linux).

I also injected jersey on the linux version, but i don't like that approach.What i am doing now is custom masking udp packets to bind widgets logic with a js wrapper and kinda jsonp to render the info sent by the server on the webpage.

I'll setup github branch in about 2 weeks (i am too busy now), and of course for me would be a honor to work with you.

Another screen of a wanted poster with custom gui.

test.jpg


               
               

               
            

Legacy_thirdmouse

  • Newbie
  • *
  • Posts: 14
  • Karma: +0/-0
nwncx webkit
« Reply #4 on: February 03, 2016, 08:10:40 pm »


               

I have dreamed SO LONG of doing this. Please pay no attention to the wall of lurkers staring intently, unblinkingly at you.



               
               

               
            

Legacy_virusman

  • Sr. Member
  • ****
  • Posts: 448
  • Karma: +0/-0
nwncx webkit
« Reply #5 on: February 03, 2016, 08:43:54 pm »


               

Hi,  i have learned a lot by your code Virusman, thank you very much for all your efforts.


Atm i am working on it to setup a proper protocol to handle GUI events, i injected asp.net web api 2 to have a restful service, it works but requires framework.net (nadi think most of servers run on linux).


I also injected jersey on the linux version, but i don't like that approach.What i am doing now is custom masking udp packets to bind widgets logic with a js wrapper and kinda jsonp to render the info sent by the server on the webpage.


I'll setup github branch in about 2 weeks (i am too busy now), and of course for me would be a honor to work with you.


Another screen of a wanted poster with custom gui.

test.jpg



Can you just pass the input events as native browser events that can be handled with JS?


Is it an actual browser window (Awesomium/CEF) or something else?


Do you inject OpenGL calls or draw a window on top of nwmain?



               
               

               
            

Legacy__Cyan_

  • Newbie
  • *
  • Posts: 28
  • Karma: +0/-0
nwncx webkit
« Reply #6 on: February 03, 2016, 10:08:29 pm »


               


Can you just pass the input events as native browser events that can be handled with JS?


Is it an actual browser window (Awesomium/CEF) or something else?


Do you inject OpenGL calls or draw a window on top of nwmain?




It's a bitmap surface applied as a texture on a gl quad, hooked wglSwapLayerBuffers to render the quad every frame.On surface (when the dirty flag is true) i swap the dirty area with glSubTexImage.


The overlay covers the renderer's window entirely (in order to use percentge, em with css), it handles mouse clicks and notify them to the offscreen webview if the alpha channel is != 0.


I made a global javascript listener with some custom methods to wrap gui logic, for example you call by js : 


<button id="test" onlick="WebUI.SendData(jsonobject)">


The listener intercepts those event and send them to nwserver by its own udp socket.


Server side i made a packet filter (like connect plugin) to fire scripts associated with the calling gui context.The gui widgets are mapped server side by unique ids.


NB: I used berkelium, gecko and awesomium (this is the best one even if it doesn't handle html by string and need to be loaded passing a file path).


I am looking for a way to send gui resource over udp and make it load by a buffer instead of files.


JS run like a native browser and it's fully compatible with html 5 and css3, btw to call underlying gui system with nwserver i export only pre-defined methods.


Windowed mode doesn't work.



               
               

               
            

Legacy_T0r0

  • Sr. Member
  • ****
  • Posts: 380
  • Karma: +0/-0
nwncx webkit
« Reply #7 on: February 04, 2016, 01:48:50 am »


               

This is awesome !! So many possibilities..



               
               

               
            

Baaleos

  • Administrator
  • Hero Member
  • *****
  • Posts: 1916
  • Karma: +0/-0
nwncx webkit
« Reply #8 on: February 04, 2016, 10:18:46 am »


               

It does look sexy



               
               

               
            

Legacy_Zeke

  • Jr. Member
  • **
  • Posts: 86
  • Karma: +0/-0
nwncx webkit
« Reply #9 on: February 04, 2016, 12:16:41 pm »


               

'<img'>  '<img'> .......



               
               

               
            

Legacy_virusman

  • Sr. Member
  • ****
  • Posts: 448
  • Karma: +0/-0
nwncx webkit
« Reply #10 on: February 04, 2016, 01:38:51 pm »


               Awesome!

Maintaining an HTTP server inside nwmain can be avoided altogether by using nwnx_redis with its pubsub capabilities: that way you can set up a separate HTTP backend with a framework you like and communicate with nwserver via redis. A bit more complicated to set up, but much more flexible.
               
               

               
            

Legacy_niv

  • Jr. Member
  • **
  • Posts: 62
  • Karma: +0/-0
nwncx webkit
« Reply #11 on: February 04, 2016, 02:43:29 pm »


               

Count me in too. '<img'>



               
               

               
            

Legacy__Cyan_

  • Newbie
  • *
  • Posts: 28
  • Karma: +0/-0
nwncx webkit
« Reply #12 on: February 05, 2016, 02:02:12 pm »


               

@virusman


do you have address for mouse hook lbuttondown? I tried to search around the addresses you hook on mouse and keyboards input on your gui code but with no luck.


I ended to hook directinput device. 


Ok done myself, i hooked on this address (0042AD70 ) Terra suggested in an old post on nwnx.org to hook on mouse click, i had some issues with naked declaration so i ended with a __thiscall pointer and __fastcall detoured function to hook that and preserve registers.


However ScreenToClient and GetMousePos get strange values, so i ended up hooking mousemove and storing mouse coords globally.


Probably with the commit on github you'll find a better way, but hey, works pretty fine.



               
               

               
            

Legacy__Cyan_

  • Newbie
  • *
  • Posts: 28
  • Karma: +0/-0
nwncx webkit
« Reply #13 on: February 09, 2016, 10:18:26 am »


               

Update : Sword coast map on custom gui (i added close button in the old nwn style).

With area chords is possible to make unexplored regions darkest or highlightsthe fast travel spots.

By clicking on a region the character will be teleported like a fast travel, i also tried to reproduce youtbe videos and it works (even if for ram is a pain due to flash player).

test.jpg


               
               

               
            

Legacy_meaglyn

  • Hero Member
  • *****
  • Posts: 1451
  • Karma: +0/-0
nwncx webkit
« Reply #14 on: February 09, 2016, 01:58:53 pm »


               

That is cool! If only there was nwncx for Linux...