These are chat archives for ProtoDef-io/node-protodef

11th
Apr 2017
Hans Elias J.
@hansihe
Apr 11 2017 00:03
in what unit though
mhsjlw
@mhsjlw
Apr 11 2017 00:03
bytes i think
Hans Elias J.
@hansihe
Apr 11 2017 00:04
right
Hans Elias J.
@hansihe
Apr 11 2017 00:04
length is 1 bit unit by default
mhsjlw
@mhsjlw
Apr 11 2017 00:04
yeah i used binary-size and the same thing
Hans Elias J.
@hansihe
Apr 11 2017 00:04
i mean size
mhsjlw
@mhsjlw
Apr 11 2017 00:05
yes
Hans Elias J.
@hansihe
Apr 11 2017 00:05
show me your code then
mhsjlw
@mhsjlw
Apr 11 2017 00:05
Got a data_packet! <<0, 0, 0, 64, 0, 144, 0, 0, 0, 9, 0, 5, 47, 132, 141, 1, 88, 73, 132, 0, 0, 0, 0, 0, 0, 0, 0, 0>>
that's the packet
<< buffer :: binary-size(length), rest :: binary >> = rest
and i'll gist the code
woah
502
rip
length was 18 for that btw
mhsjlw
@mhsjlw
Apr 11 2017 00:09
wha
oh
@hansihe that's all the src you need now i think
because it's a data packet not an encapsulated packet
mhsjlw
@mhsjlw
Apr 11 2017 00:15
@hansihe compare it against the ProtoDef from node-raknet and the pmmp implementation if you want to
i honestly can't figure this out
Hans Elias J.
@hansihe
Apr 11 2017 00:15
well, this is not decode logic error, have you compared them?
*well, this is decode logic error, have you compared them?
*+a
mhsjlw
@mhsjlw
Apr 11 2017 00:16
yes
hmm
s + 7
triad + byte + byte + byte
byte prefix for data packet , triad , byte for flags
no that's not 7
that's 5
oh wait
and 2 for the length
but wait no , i don't want to add 7
what even is that
mhsjlw
@mhsjlw
Apr 11 2017 00:21
i mean , why is it there
mhsjlw
@mhsjlw
Apr 11 2017 00:30
// packet id, triad (3), header (1), length (2), something ?!? (3) , sizeof (length) 
// 132 -- 0 , 0 , 0 --   64 -- 0 , 144 - ? , ? , ? -- packet body
var packet = new Buffer([132, 0, 0, 0, 64, 0, 144, 0, 0, 0, 9, 0, 5, 47, 132, 141, 1, 88, 73, 132, 0, 0, 0, 0, 0, 0, 0, 0, 0]);
so the ? ? ? is what i'm figuring out
mhsjlw
@mhsjlw
Apr 11 2017 00:46
ok
so
%{buffer: <<9, 0, 5, 47, 132, 141, 188, 73, 132, 0, 0, 0, 0, 0, 0, 0, 0, 0>>,
  has_split: 0, identifier_ack: nil, length: 18, message_index: 0,
  order_channel: nil, order_index: nil, reliabilty: 2, rest: "",
  split_count: nil, split_id: nil, split_index: nil}
there ya go
that function wasn't the problem
Hans Elias J.
@hansihe
Apr 11 2017 00:51
problem was somewhere else?
i refactored the function for you by the way
try to compare some of the changes I made
mhsjlw
@mhsjlw
Apr 11 2017 00:51
you're awesome
thank you
i don't like having rest first though
Hans Elias J.
@hansihe
Apr 11 2017 00:52
you can change that
just make it consistent
mhsjlw
@mhsjlw
Apr 11 2017 00:52
yes
Hans Elias J.
@hansihe
Apr 11 2017 00:52
don't have it be one thing first, then another after
mhsjlw
@mhsjlw
Apr 11 2017 00:52
def encode_data_packet(%{sequence_number: sequence_number, encapsulated_packets: encapsulated_packets}) do
    data = << sequence_number :: little-size(24) >>
    Enum.map(encapsulated_packets, fn(x) -> data <> x end)
    data
  end
can you help me with that as well ?
:D
Hans Elias J.
@hansihe
Apr 11 2017 00:53
you need to look at and compare all changes I made first
mhsjlw
@mhsjlw
Apr 11 2017 00:53
okay
Hans Elias J.
@hansihe
Apr 11 2017 00:53
paste it into a diff tool or something
mhsjlw
@mhsjlw
Apr 11 2017 00:53
if reliability in [2, 3, 4, 6, 7] do
perfect
Hans Elias J.
@hansihe
Apr 11 2017 00:53
don't just copy+paste it in
mhsjlw
@mhsjlw
Apr 11 2017 00:53
thank you
didn't know you could do that
if !(has_split in [0, 16]), do: throw "fail"
is that safe ?
Hans Elias J.
@hansihe
Apr 11 2017 00:55
the protodef file only handles those two cases?
idk, I don't know anything about this protocol
but if it isn't you will know later, you can fix it easily
mhsjlw
@mhsjlw
Apr 11 2017 00:56
thank you
ok thank you for these changes
any ideas for that encode data packet ?
Hans Elias J.
@hansihe
Apr 11 2017 00:57
did you see the changes I made to the recursion you used?
mhsjlw
@mhsjlw
Apr 11 2017 00:57
i did, yes
Hans Elias J.
@hansihe
Apr 11 2017 00:57
good
what about encode_packet?
why are you not using IO lists?
mhsjlw
@mhsjlw
Apr 11 2017 00:58
because i still don't get it
Hans Elias J.
@hansihe
Apr 11 2017 00:59
iolists?
that's how it would be done with iolists
mhsjlw
@mhsjlw
Apr 11 2017 01:19
thank you
i can io list this
oh
you code snippet is perfect for this as well
mhsjlw
@mhsjlw
Apr 11 2017 01:24
@hansihe how can i get the listening address
for sending my system addresses ?
Hans Elias J.
@hansihe
Apr 11 2017 01:26
what
mhsjlw
@mhsjlw
Apr 11 2017 01:27
i know i am wat as well
i need to send 10 addresses to the client
all 10 will be my listening address and my listening port
Hans Elias J.
@hansihe
Apr 11 2017 01:27
no i don't have any context or anything
mhsjlw
@mhsjlw
Apr 11 2017 01:27
i'm wondering how I can get the listening port and address from gen_udp open
i can't see anything in the docs
Hans Elias J.
@hansihe
Apr 11 2017 01:29
can i have some more context? what do you actually want to do here?
gen_udp will listen on an address, but there is no reason for you to send that
mhsjlw
@mhsjlw
Apr 11 2017 01:30
no, raknet requires me to send my listening address and host
sends it's listening host and port 10 times
Hans Elias J.
@hansihe
Apr 11 2017 01:31
yes
gen_udp selects some random network interface by default, idk how it chooses it
you give it an address instead, then send that
mhsjlw
@mhsjlw
Apr 11 2017 01:32
i see
ok
Hans Elias J.
@hansihe
Apr 11 2017 01:32
since that's what node does
i guess
doesn't make any sense
mhsjlw
@mhsjlw
Apr 11 2017 01:32
so instead i'll give a config for a host
Hans Elias J.
@hansihe
Apr 11 2017 01:32
but okey
mhsjlw
@mhsjlw
Apr 11 2017 01:33
so , system_addresses = [%{version: 4, address: Application.get_env(:rak_net, :host), port: Application.get_env(:rak_net, :port)}]
Hans Elias J.
@hansihe
Apr 11 2017 01:33
why didn't you just look at what the node impl does and just do that?
mhsjlw
@mhsjlw
Apr 11 2017 01:33
{:ok, socket} = :gen_udp.open(Application.get_env(:rak_net, :port), [:binary, {:active, :true}])
that's not my problem
i just want to make gen_udp bind to the host in the config .
Hans Elias J.
@hansihe
Apr 11 2017 01:33
you know way more about the problem domain than me, i have never even worked with raknet or mcpe before
mhsjlw
@mhsjlw
Apr 11 2017 01:34
it's not a raknet problem
it's an elixir question
i can't understand these damn docs
it's telling me i can pass an address to bind to
say i want to bind to 127.0.0.1
Hans Elias J.
@hansihe
Apr 11 2017 01:35
this is like a completely standard thing that's shown in the getting started tutorial even
that's a keyword list
open(port, ip: ip)
mhsjlw
@mhsjlw
Apr 11 2017 01:36
ah
i was passing it wrong
  @port Application.get_env(:rak_net, :port)
  @host Application.get_env(:rak_net, :host)

  def start_link do
    {:ok, socket} = :gen_udp.open(port, [:binary, {:active, :true}, {:ip, :inet.parse_address(@host)}])
    accept(socket)
  end
yeah i ended up getting it like that
Hans Elias J.
@hansihe
Apr 11 2017 01:39
@port Application.get_env(:rak_net, :port) will most likely not do what you think it does
mhsjlw
@mhsjlw
Apr 11 2017 01:46
i've read that beofre ?
*before
i only use it inside the module
so no worries
not outside
tons of progress
Hans Elias J.
@hansihe
Apr 11 2017 01:47
it gets compiled into the module
that's the critical detail
that will fetch the environment variable at compile time and build it into the modile
module
mhsjlw
@mhsjlw
Apr 11 2017 01:51
oh
yeah i don't want that
but when this becomes libraryized it will be removed
William Gaylord
@wgaylord
Apr 11 2017 03:46
So do we have a stable version of protodef I can try to dev for? Considering the changes that seem to be happening will break stuff....
Robin Lambertz
@roblabla
Apr 11 2017 09:50
No, not yet.
If you want to have fun, it's in hansihe/protodefc. But it's not ready afaik
Robin Lambertz
@roblabla
Apr 11 2017 12:29
MFW
1|bullhead:/storage/emulated/0/DCIM # ls -la
total 4
drwxrwxrwx  2 root root         0 2017-04-06 15:28 .
drwxrwx--x 18 root sdcard_rw 4096 2017-04-11 13:19 ..
drwxrwx--x  2 root sdcard_rw    0 2017-04-06 15:28 .thumbnails
drwxrwx--x  2 root sdcard_rw    0 2017-04-06 15:28 .thumbnails
drwxrwx--x  2 root sdcard_rw    0 2017-04-06 15:28 100ANDRO
drwxrwx--x  2 root sdcard_rw    0 2017-04-06 15:28 100ANDRO
drwxrwx--x  2 root sdcard_rw    0 2017-04-06 15:28 Camera
drwxrwx--x  2 root sdcard_rw    0 2017-04-06 15:28 Camera
Android, stop drinking. It's bad for your health
William Gaylord
@wgaylord
Apr 11 2017 12:30
It's seeing double.
mhsjlw
@mhsjlw
Apr 11 2017 12:30
@roblabla r00t?
Robin Lambertz
@roblabla
Apr 11 2017 12:31
No. Just trying to understand what the fuck is wrong with android's FUSE stuff
mhsjlw
@mhsjlw
Apr 11 2017 12:31
what is fuse ?
Robin Lambertz
@roblabla
Apr 11 2017 12:31
I just mounted a FUSE on the DCIM folder (that already contained stuff) and it started seeing double
mhsjlw
@mhsjlw
Apr 11 2017 12:31
storage something I'm guessing
Robin Lambertz
@roblabla
Apr 11 2017 12:32
Filesystem in user-space
so you write some callbacks for read, write, open, close, etc...
And then mount it somewhere
mhsjlw
@mhsjlw
Apr 11 2017 12:32
ah gotya
Robin Lambertz
@roblabla
Apr 11 2017 12:32
You can do lots of fun stuff with it
FTPFS, sshfs, etc...
William Gaylord
@wgaylord
Apr 11 2017 17:12
yep....
Robin Lambertz
@roblabla
Apr 11 2017 18:06
wow. 87 goddamned binary blogs are in the nexus 5x. That's a whole lot more than I expected...
William Gaylord
@wgaylord
Apr 11 2017 22:41
lol.
blobs or blogs??
Robin Lambertz
@roblabla
Apr 11 2017 22:41
blobs. typing mistake :P
William Gaylord
@wgaylord
Apr 11 2017 22:41
I have a Nexus 7 (2013) I am missing out on the new android...
Also an am annoyed by a dev removing a core feature on a python lib I use...
Robin Lambertz
@roblabla
Apr 11 2017 22:44
Did noone make an updated ROM ? Like lineage ?
William Gaylord
@wgaylord
Apr 11 2017 22:47
I don't want to try a random ROM on it... I like my data. :P I have had to re flash that thing many times in its 4 years of life.
Robin Lambertz
@roblabla
Apr 11 2017 22:47
Haha I know that feeling
well lineage is fairly good. It's the new cyanogenmod from the same team
William Gaylord
@wgaylord
Apr 11 2017 22:48
I was rooting it till rooting made the battery meter read like 30123%
mhsjlw
@mhsjlw
Apr 11 2017 23:00
*you meant 0%
root makes my pixel randomly reboot in my pocket sometimes
it's weird
but it works well for everything else anyway
and the battery is just as awesome
William Gaylord
@wgaylord
Apr 11 2017 23:43
Nope. Mine would show a crazy high number.
mhsjlw
@mhsjlw
Apr 11 2017 23:49
i said 0 because root drains battery life a lot more (sometimes) it was a joke :)
William Gaylord
@wgaylord
Apr 11 2017 23:50
I think it was an overflow problem because as I used it the battery went up.
mhsjlw
@mhsjlw
Apr 11 2017 23:51
hmm
yeah I'd guess so then