Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
Finn Vos committed Mar 18, 2018
2 parents a5260fb + 042553b commit c0d8ce0
Show file tree
Hide file tree
Showing 11 changed files with 538 additions and 1 deletion.
Binary file added EDMCOverlay/EDMCOverlay.exe
Binary file not shown.
11 changes: 11 additions & 0 deletions EDMCOverlay/EDMCOverlay.exe.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="DeltaCompressionDotNet.MsDelta" publicKeyToken="46b2138a390abf55" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.0.0.0" newVersion="1.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
Binary file added EDMCOverlay/Newtonsoft.Json.dll
Binary file not shown.
74 changes: 74 additions & 0 deletions EDMCOverlay/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# EDMC Overlay (c) 2017 Ian Norton
## About

EDMC Overlay is a helper program for Elite:Dangerous, It provides a means for
a program such as EDMC to display simple messages in the game's DirectX window.

## Compatibility

* Currently supports 64Bit Elite:Dangerous (Horizons) on Windows Only.
* 64bit Non-Horizons may work. YMMV.
* Apple support is not likley (I don't have a Mac)
* "Windowed" or "Bordless Fullscreen" mode only.

## Installation

This is released as a standard EDMC Plugin, simple unpack the archive into the EDMC
plugin folder. Releases of EDMC Overlay are in part inspired by the Overlay.NET
library from https://github.com/lolp1/Overlay.NET. Though it no longer contains this
library.

## MIT License

Copyright 2017 Ian Norton

Permission is hereby granted, free of charge, to any person obtaining a copy of this
software and associated documentation files (the "Software"), to deal in the Software
without restriction, including without limitation the rights to use, copy, modify,
merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to the following
conditions:

The above copyright notice and this permission notice shall be included in all copies
or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

# Protocol

EDMC Overlay offers a very very simple line-json based network protocol.

The service when started will listen on TCP 127.0.0.1:5010. If EDMCOverlay cannot
detect EliteDangerous64.exe it will exit silently.

Assuming EliteDangerous64.exe is running, you may send a single JSON message (on one line)
Like so:

```
{"id": "test1", "text": "You are low on fuel!", "size", "normal", color": "red", "x": 200, "y": 100, "ttl": 8}
```
Supported colors values are:
"red", "green", "yellow", "blue" or "#rrggbb".

Supported size values are:
"normal" and "large"

Additionally, you may draw rectanles by setting the "shap" to "rect" and setting the "color" and/or "fill" values.

```
{"id": "fred", "shape": "rect", "x": 100, "y": 10, "w": 30:, "h": 5, "fill": "red", "color", "#ccff00"}
```

The server will process this as an instruction to display the message "You are low on fuel!"
in red text at 200,100 for 8 seconds.

Be sure to send a newline ("\n") character after your message. You may need to flush the
socket.

There are (currently) no response values from the service.

Empty file added EDMCOverlay/__init__.py
Empty file.
187 changes: 187 additions & 0 deletions EDMCOverlay/edmcoverlay.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,187 @@
"""
Client library for EDMCOverlay
"""

import sys
import socket
import json
import os
import subprocess
import time


SERVER_ADDRESS = "127.0.0.1"
SERVER_PORT = 5010

HERE = os.path.dirname(os.path.abspath(__file__))
PROG = "EDMCOverlay.exe"


def find_server_program():
"""
Look for EDMCOverlay.exe
:return:
"""

locations = [
os.path.join(HERE, PROG),
os.path.join(HERE, "EDMCOverlay", PROG),
os.path.join(HERE, "EDMCOverlay", "EDMCOverlay", "bin", "Release", PROG),
os.path.join(HERE, "EDMCOverlay", "EDMCOverlay", "bin", "Debug", PROG),
]
for item in locations:
if os.path.isfile(item):
print "found {}...".format(item)
return item
return None

_service = None


def ensure_service():
"""
Start the overlay service program
:return:
"""
if HERE not in sys.path:
sys.path.append(HERE)

global _service
program = find_server_program()

if program:
# if it isnt running, start it
try:
if _service:
if _service.poll() is not None:
_service = None
if not _service:
print "starting {}".format(program)
exedir = os.path.abspath(os.path.dirname(program))
_service = subprocess.Popen([program], cwd=exedir)

time.sleep(2)
if _service.poll() is not None:
subprocess.check_call([program], cwd=exedir)
raise Exception("{} exited".format(program))
except Exception as err:
print "error in ensure_service: {}".format(err)

def shutdown():
"""
Stop the overlay service program
"""
global _service

try:
if _service:
if _service.poll() is None:
_service.terminate()
except Exception as e:
print "error in shutdown: {}".format(e)

class Overlay(object):
"""
Client for EDMCOverlay
"""

def __init__(self, server=SERVER_ADDRESS, port=SERVER_PORT):
self.server = server
self.port = port
self.connection = None

def connect(self):
"""
open the connection
:return:
"""
connection = socket.socket()
connection.connect((self.server, self.port))
self.connection = connection

def send_shape(self, shapeid, shape, color, fill, x, y, w, h, ttl):
"""
Send a message
:param shapeid:
:param shape:
:param color:
:param fill:
:param x:
:param y:
:param w:
:param h:
:param ttl:
:return:
"""
if not self.connection:
ensure_service()
self.connect()

msg = {"id": shapeid,
"shape": shape,
"color": color,
"fill": fill,
"x": x, "y": y,
"w": w, "h": h,
"ttl": ttl
}
try:
print json.dumps(msg)
self.connection.send(json.dumps(msg))
self.connection.send("\n")
except Exception as err:
print "error in send_message: {}".format(err)
self.connection = None
raise

def send_message(self, msgid, text, color, x, y, ttl=4, size="normal"):
"""
Send a message
:param msgid:
:param text:
:param color:
:param x:
:param y:
:param ttl:
:param size:
:return:
"""
if not self.connection:
ensure_service()
self.connect()

msg = {"id": msgid,
"color": color,
"text": text,
"size": size,
"x": x, "y": y,
"ttl": ttl}
try:
self.connection.send(json.dumps(msg))
self.connection.send("\n")
except Exception as err:
print "error in send_message: {}".format(err)
self.connection = None
raise


def debugconsole():
"""
Print stuff
"""
import load as loader

print >> sys.stderr, "Loading..\n"
loader.plugin_start()

cl = Overlay()

print >> sys.stderr, "Reading..\n"
while True:
line = sys.stdin.readline().strip()
print >> sys.stderr, "sending... {}".format(line)
cl.send_message("msg", line, "red", 100, 100)


if __name__ == "__main__":
debugconsole()
35 changes: 35 additions & 0 deletions EDMCOverlay/load.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
"""
Plugin for EDMCOverlay
"""
import time

from edmcoverlay import ensure_service, Overlay

client = Overlay()


def plugin_start():
"""
Start our plugin, add this dir to the search path so others can use our module
:return:
"""
ensure_service()
time.sleep(2)
try:
client.send_message("edmcintro", "EDMC Ready", "yellow", 30, 165, ttl=6)
except Exception:
pass
return "EDMCOverlay"


def journal_entry(cmdr, system, station, entry, state):
"""
Make sure the service is up and running
:param cmdr:
:param system:
:param station:
:param entry:
:param state:
:return:
"""
ensure_service()
33 changes: 32 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,33 @@
# EliteHIS
Target heading plugin for EDMC
Elite Heading Information System

Also known as Help I'm Stuck

This is an EDMC plugin that lets you set target coordinates and will show you the heading you need to fly to reach your target.
If you set the radius of the planet in the settings menu it will also show the estimated distance to the target.

NOTE: The distance is only an estimate to give you an idea when to start your descent, it's not completely accurate.

## Video
[![EliteHIS demo](https://img.youtube.com/vi/WTL6xmgp5Tk/0.jpg)](https://www.youtube.com/watch?v=WTL6xmgp5Tk)

## Installation
- Download the latest release from the [releases page](https://github.com/FInnvos123/EliteHIS/releases)
- Press the "Open" button on the plugins settings tab in EDMC
- Open EliteHIS.zip and move the directory contained inside into the plugins directory

## Usage
To use EliteHIS simply open the settings menu in EDMC and click the EliteHIS tab.
There you can enter the target latitude and longitude.
To get the estimated target distance you need to enter the planet radius as well.
This can be found in the system map.
Keep in mind that Elite displays the radius in km and EliteHIS expects the radius in m.

## Uninstall
To uninstall the plugin simply remove the EliteHIS directory from the EDMC plugins directory.
If you only want to temporarily disable the plugin, simply rename the folder to `EliteHIS.disabled`

## Acknowledgements
- Thanks to Marginal for [EDMarketConnector](https://github.com/Marginal/EDMarketConnector)
- Uses [EDMCOverlay](https://github.com/inorton/EDMCOverlay) by Ian Norton
- Thanks to CMDR Hersilia for the name
Loading

0 comments on commit c0d8ce0

Please sign in to comment.