+ <div class="title-block">
+ <h3 class="blog-title">Actually doing input this time</h3>
+ <h3 class="datestamp">22/03/2025</h3>
+ </div>
+ <p>
+ OK we're back again baby. And this time I sweart I am going to
+ do input. To show willing I've even already started diving into
+ the firmware to work out how it's done!
+ </p>
+ <a href="../img/projects/pipboy/firmwareInputListener.png">
+ <img class="blog-img-lrg"
+ src="../img/projects/pipboy/firmwareInputListener.png" alt="A
+ screenshot of the dumped firmware. It notably shows a function
+ 'd' and a call Pip.on('knob1', d)")." />
+ </a>
+ <p>
+ So that firmware screenshot tells us all we need to know,
+ really. The Pip object has some events (in this case, 'knob1',
+ which is a) funny and b) the left hand wheel control) one which
+ you can register functions to call.
+ </p>
+ <p>
+ This screenshot is from the portion of the code that handles
+ switching between the different health animations, but this
+ applies anywhere really. So what we need to do is:
+ </p>
+ <ul>
+ <li>Create a listener and register it</li>
+ <li>
+ Make sure we play the knob click audio like the rest of the
+ device does
+ </li>
+ <li>Move our selection up and down the list with each click</li>
+ </ul>
+ <p>Pretty simple! OK, lets go do that.</p>
+ <b>Code Updated. Check the github link to keep up.</b>
+ <p>And look at that! We're done.</p>
+ <video width="672" height="378" class="video-embed" controls>
+ <source
+ src="../img/projects/pipboy/inputWorking.mp4"
+ type="video/mp4"
+ />
+ Your browser does not support the video tag.
+ </video>
+ <p>
+ Nothing really special to talk about here, just some basic
+ increment/decrement handling and looping back to the start of
+ the list when necessary.
+ </p>
+ <p>
+ There is a specific wrinkle of having to deregister the input
+ event. Early on in my testing I hadn't done that and it kept the
+ .js loaded even after removing the SD card, which meant it
+ looked like any edits I made weren't actually working. In order
+ to prevent this I added gracefulClose() which deregisters the
+ handler and shows the main menu again.
+ </p>
+ <p>
+ Last thing here is really to handle what happens when we have
+ more perks than will fit in our available space. Then this
+ screen is basically done!
+ </p>
+ <b>Code Updated. Check the github link to keep up.</b>
+ <p>
+ And now that's done too! Couple of bugs with loading the right
+ files to list (primarily loading too many) but smart use of the
+ modulo operator and we're done! I filled in every perk I think
+ is funny and applicable to me, did some manual edits to some of
+ the icons (new vegas icons seem to generally be less optimised
+ for a real monochrome display, a rare instance where Bethesda's
+ attention to detail is better than Obsidian's) and filled in all
+ their data and, well, that's it!
+ </p>
+ <video width="672" height="378" class="video-embed" controls>
+ <source
+ src="../img/projects/pipboy/fullscreendemo.mp4"
+ type="video/mp4"
+ />
+ Your browser does not support the video tag.
+ </video>
+ <p>
+ I'm pretty happy with it! This was a really enjoyable project
+ and let me flex a lot of the muscles I don't tend to use a lot
+ in my pure software day-to-day.
+ </p>
+ <p>
+ I might come back to this later and make a second screen with
+ stats on it, but that's basically the same layout etc as the
+ perks screen just with a number, so I probably won't write it
+ up.
+ </p>
+ <p>
+ So yeah, for now, I'll leave it here. Thank you for reading and
+ following my thought processes, if you did!
+ </p>