Skip to content

Latest commit

 

History

History
34 lines (23 loc) · 1.4 KB

README.md

File metadata and controls

34 lines (23 loc) · 1.4 KB

CPU Plays Pokemon

A fun little proof of concept for mGBA-http where it takes in your CPU usage as what button to press.

cpuplaysshort.mp4

Video is sped up.

How it works

Every second:

  1. The CPU usage is checked
  2. Some maths then the usage is mapped to a key
  3. The key is sent to mGBA-http and onwards to mGBA

How to run

  1. Have mGBA up and running
  2. Get and setup mGBA-http
  3. Get this project
  4. Run this project (either in Visual Studio/your IDE of choice, or with dotnet run)

Interesting bits

  • Uses the new PeriodicTimer object
  • The maths for the value to modulo is a mixture of both the whole and fraction because:
    • If just the whole value is used, then there may not be enough variation in CPU usage to modulo for all the keys
    • If it's just the fraction, the trailing zero is cut off, meaning we never get the A key
  • PerformanceCounter is now a NuGet package

Timelapse

The following is a whole hour of "playing" and "progress":

cpuplayslong.mp4