GithubHelp home page GithubHelp logo

modderz's Introduction

Modder2

Mod system using plugins written in Python

Inspiration

There is a program called "Compatibility Telemetry" in Microsoft Windows 10, namely the executable "CompatTelRunner.exe". It will be launched sometimes, to send data back to Microsoft about something related to software compatibility problem (actually I'm not sure about what data it sends).

I'm personally OK to share some data to M$, but this program dramatically slow down my computer by continuously reading large amount of data from disk and occupying at least one CPU core. All my disks are Intel SSDs and yet I cannot even type fluently when this program is running.

So I got this idea that I WILL write a script to kill this process upon its execution. But I don't want to write the script along. I need a framework, or something that notify my script about the events it cares. Basically a sub-pub system for various OS and application events. That way I can write a script that listen on process created events, and kill the newly created process if its executable is CompatTelRunner.exe.

So I started writing Modder2. It's called Modder2 because I have previously named one of my projects "Modder".

Requirements

You'll need wxPython to run the GUI app.

  • On Windows, go to its official site to download proper installer.
  • On macOS, get Homebrew and run brew install wxPython.
  • On Linux, I'm sure you'll find the way by yourself. :P

After installing wxPython, run pip install -r requirements.txt to install other required Python packages.

Usage

GUI is not usable at this time. You can run an instance in terminal:

python -m modder.console_app

Writing mods

A mod is basically a script containing a callale (function / class method). You write this function, register it to some events, and when Modder2 trigger these events, your function get called.

A simple script would be:

from modder import on


@on('Modder.Started')
def test(event):
    print 'Got event', event

If you put it into modder/mods/xxx.py, the function test will be triggered everytime Modder2 starts.

You can also trigger (modder.trigger) and listen on (modder.on) custom events.

Modder2 will eventually support custom mods location, but it currently does not.

Core events

Core events are defined by Modder2 and will only be triggered by Modder2. Currently there are:

  • Modder.Started no event data
  • Modder.BeforeQuit no event data
  • Timer.Interval.Minute event data: timestamp
  • Timer.Interval.Hour event data: timestamp
  • Timer.Interval.Day event data: timestamp

By looking at their name you will be able to tell when they get triggered.

Your registered function will be called in a separate thread. Specially, when Modder.BeforeQuit event is triggered, functions will be called in current thread.

Mod events

Mod events are triggered by mods. Modder2 does not track the event source, it only passes events through the queue.

  • Process.Created triggered by process_watcher.watch_process_creation
    • Availability: Windows platform
    • Event data:
      • caption
      • process_name
      • executable_path
      • pid the process ID
    • Description: triggered when a new process is created.

But...

This is just a stupid event bus

Yes it is. Deal with it.

It sucks

Deal with it, or contribute. Otherwise go away, you are the one who sucks.

modderz's People

Contributors

jokerqyou avatar

Stargazers

 avatar

Watchers

 avatar  avatar

modderz's Issues

Layout engine

We'll need a layout engine or sort of thing if we want to continue developing the diagram graph view. Manually managing the layout is way too complicated.

Mainly this module / package / engine will do the following:

  • Manage layout, which is, to set position of each diagram block so that they don't cover each other;
  • Manage size of each diagram block so their texts fit well;
    • So the engine needs to do all the font / text extent adjusting / text wrapping thing;
    • And also convert coordinates into different systems;

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.