It’s finally happening for real this time! Working behind the scenes with some community members, I decided to take an honest swing at an in-house PVB emulator at a full-time capacity. This will be my actual day job. So for the first time in history, I’m going to put my skills to work and produce some actual results. (-:
This community has always been amazing, and I have a good feeling about the emulator initiative going forward. The official project page can be found here:
http://perfectkiosk.net/
__________
So why should you care? Aren’t there Virtual Boy emulators out there already? Let’s see what the project page has to say…
The initiative has four primary objectives:
Nintendo 3DS Emulator
I’m sure most of us thought about Virtual Boy when we first heard about the Nintendo 3DS. A custom emulator specifically designed to run on 3DS can take full advantage of the system’s power and capabilities, giving us true stereo Virtual Boy on the go.Reverse Engineering
Any time we want to learn about how a game works or make changes to it, we need the right tools to dig in and take a look around. A cross-platform desktop application is just the ticket for providing the user with the right kit to expose all the deepest secrets buried within Virtual Boy software.TAS
The tool-assisted speedrun is a cornerstone of video game culture, and like reverse engineering, we need the right tools at our disposal in order to get the job done right. The aforementioned desktop application pulls double duty by bringing TAS-focused utilities to the party.Documentation
Comprehensive documentation of the Virtual Boy’s internals will come from emulator research, and it’s a perfect way for homebrew authors and modders to learn about the system’s features. Those who remember the Sacred Tech Scroll document I wrote can look forward to a brand new version of it.
For further reading of what exactly is planned, refer to the technical document trail on the project page.
__________
How exactly are we gonna pull this off? Glad you asked…
I have enough money in savings to begin work immediately (2018-04-18), but within a few weeks, I’m going to need to rely on financial support from the gaming community. We’ll be reaching out to other sites to gather support, since this undertaking spans a broader scope than what solely applies to Planet Virtual Boy.
A conservative estimate of my monthly expenses comes out to around $500 USD, and with enough interest, I’ll be able to keep this up full-time. By “full-time”, what I mean is 40 productive hours every single week, with status reports and a detailed outline of the development requirements. Planet Virtual Boy has its own developer working for it to make this dream come true. (-:
Donations are managed through a Patreon page:
https://patreon.com/GuyPerfect
__________
For now, this thread will be the place to be notified of progress and for general discussion of the initiative. Thanks again for being such a great community, and for giving me a chance to do what I really love. <3
Special thanks to Fire-WSP, STEREO BOY and KR155E for their assistance in getting the ball rolling.
--Guy Perfect
- This topic was modified 5 years, 7 months ago by Guy Perfect.
The 2nd example used on this article explains why the column table is so useful.
For instance, the Wario Land game’s intro cutscene actually uses a fade effect on the sides via the column table. Guy Perfect told me about that on Discord when I was still discussing the VIP with him.
The Sacred Tech Scroll draft just got updated with details of the VB’s hardware timer. http://perfectkiosk.net/stsvb1.html#timer
In the Java program’s update, the bindings for the L and R buttons are “E” and “R” respectively.
- This reply was modified 5 years, 8 months ago by StinkerB06.
- This reply was modified 5 years, 8 months ago by StinkerB06.
StinkerB06 wrote:
There’s just one thing missing here in this update: a column table tab.
Any ideas for how that might be visualized?
StinkerB06 wrote:
For instance, the Wario Land game’s intro cutscene actually uses a fade effect on the sides via the column table.
While testing Wario Land in the emulator, the column table didn’t appear to be updated during the intro cutscene, which seems wrong. The result is a very dark cutscene, which makes sense because the brightness is turned down for the column multiplier to take effect, but it never seems to be written.
I may have screwed something up, but it should be a simple matter of store instructions, so I can’t quite pin down what’s (not) going on.
StinkerB06 wrote:
The Sacred Tech Scroll draft just got updated with details of the VB’s hardware timer. http://perfectkiosk.net/stsvb1.html#timer
Jumping the gun a bit are we? Feel free to post the next software update so I can take a break. (-:
The Next Software Update
… is attached to this post. I adjusted the focus when running the emulated program, so the keyboard keys should correctly apply without intervention.
I also implemented the timer into the emulation core… I think. Everything looks like it checks out, and the timer itself is fairly simple, but I haven’t had a chance to fully test it. I was hoping Galactic Pinball would start working magically once it was implemented, but something else is causing that game to hang on the title screen.
If anyone has a simple test ROM handy that just does timer functions, see if it works correctly in this build of the emulator. Otherwise I’ll draft one up for next week to verify that everything is working as intended.
Attachments:
Guy Perfect wrote:
StinkerB06 wrote:
There’s just one thing missing here in this update: a column table tab.Any ideas for how that might be visualized?
With a list/table with two columns (“repeat” and “time”) that can be edited. The result would be shown on two screen-sized pictures (slightly wider) where each column would be represented by one or more columns of pixels (depending on “time”), their color being determined by the “repeat”. The column currently selected in the table should be highlighted somehow.
If anyone has a simple test ROM handy that just does timer functions, see if it works correctly in this build of the emulator. Otherwise I’ll draft one up for next week to verify that everything is working as intended.
I tested it with a private/work in progress ROM. It doesn’t do just timer functions, but I did notice that despite the timer interrupt being acknowledged (and EIPC set correctly), upon executing RETI, the PC was again set to FFFFFE10. The ROM works in Mednafen and it worked on hardware the last time I tried it, and I don’t think I changed the timer code since then.
And Deathchase, for whatever reason, resets when entering the first level, though it does not use the timer. The source code is available if you want to investigate.
Attached to this post is another classic feature-testing program called Timer Workshop:
The left D-pad moves the cursor around, the right D-pad’s up and down changes the current selection, and pressing A when “Write” is selected will write a value to TCR using the current Clock, Interrupt, Zero Clear and Enable settings. Changing the digits of Reload will immediately write to THR or TLR as appropriate.
As far as I can tell, I’ve worked out all of the errors in the previous implementation and the emulator now correctly simulates the timer. However, none of the broken games have magically fixed, so I won’t put out an update just for this small change.
If you want a quick laugh, go ahead and load Timer Workshop into the current build and watch it break. The moral of the story is that I need to make these “Workshop” programs before I declare something implemented. (-:
The Sacred Tech Scroll has been updated accordingly.
Got a new update attached to this post. It includes a few fixes to floating-point operations and VIP behavior that fix a few games like Bound High!, Galactic Pinball and Vertical Force.
The application was reorganized a bit. The Console window still pops up when you load a ROM, but the other windows are now accessed through a new Windows menu.
When you run the emulation, focus is now correctly given to the Console window, so you no longer have to click on it. A third anaglyph color mode has been added with full intensity red/blue like conventional VB emulators.
Breakpoints
Did you think the timer was kinda small for the last two weeks’ worth of work? It was! Truth to tell, I only did the timer when I did because it was small and I spent the last two weeks working on breakpoints.
It might not look like much, but the new Breakpoints window is one of the most significant features of the entire application. This tool allows you to stop emulation whenever something you’re interested in happens. This is big news for reverse engineering and debugging efforts.
The flexibility of this emulator’s breakpoint system is far and away above anything else I’ve seen (except for MHS). Let’s take a look!
Breakpoints can be configured to trigger on one or more of the following conditions:
• Read – An instruction attempts to read from the bus
• Write – An instruction attempts to write to the bus
• Execute – An instruction is about to execute
• Exception – An exception was raised
Crucially, all breakpoints are captured before their respective events are processed. For example, a write breakpoint will stop the program before the value gets written, letting you see what value is being replaced.
Exceptions include operations errors as well as all interrupts. For the most part, interrupts should be trapped with execute breakpoints on their handler addresses.
Addresses
The address field allows you to specify an arbitrary list of individual addresses and address ranges. All figures are expressed in hexadecimal as follows:
• A value by itself is an individual address.
• Two values separated by a hyphen is a range of addresses, with the start on the left and the end on the right.
• Multiple addresses/ranges can be provided simultaneously by separating them with commas.
For read and write breakpoints, the address specifies the bus address being accessed. For execute and exception breakpoints, the address specifies the address of the instruction to be executed or that raises the exception.
It’s totally valid to mix-and-match addresses and breakpoint types.
Conditions
The condition field is the big kahuna that sets this emulator apart from the rest. It’s a fully-featured expression evaluator that accepts a set of C-like operators in order to determine dynamically when a breakpoint should trigger. This gives breakpoints access to CPU registers, the contents of system memory and operands for the current instruction.
Earlier today, I was helping someone track down Wario’s animation data in Wario Land. We started by looking at object 2 (Wario’s eye), which has an address of [font=Courier New]0003E010[/font]. A write breakpoint on that address stopped the program in the function at [font=Courier New]FFFC1D0C[/font], which is a small function that copies data from a global variable into OAM. Armed with that knowledge, we figured out where object 2 came from by inspecting the CPU state, which allowed the guy to find the data he was looking for.
In the above screenshot, you see a sample breakpoint that stops on all function calls in Wario Land’s crt0. The condition expression is “[font=Courier New]inst == jal || inst == jmp && reg1 != 31[/font]”, which you can see is accessing instruction operands in order to stop on only specific instructions. It also supplies an address range.
The supported features in the condition are so expansive, in fact, that I can’t go over it all here in this forum post. So instead, an HTML file is attached to this post (and included in the .jar) that covers all the specs. I promise it won’t disappoint.
The expression evaluator was also exposed to the Goto prompt in the CPU window (Ctrl+G in the disassembler or hex editor).
No amazing, ground-breaking new developments this time, just a round of fun and profit.
New features:
• The game pad is now properly implemented and the tech scroll updated accordingly
• Added support for .isx debugger ROMs
• Added [font=Courier New]value[/font] breakpoint condition symbol for the actual value being read/written
• Added disassembler comment for when an exception/interrupt is raised
• Added disassembler comment for [font=Courier New]JMP [lp][/font] instructions
Bug fixes:
• Extended duration of [font=Courier New]DPBSY[/font] and [font=Courier New]XPBSY[/font], enabling Mario’s Tennis to function
• Corrected the operation of [font=Courier New]XB[/font], enabling Jack Bros. to function
• The disassembler now displays [font=Courier New]TRAP[/font], [font=Courier New]XB[/font] and [font=Courier New]XH[/font] incorrectly
• Step will now enter an exception handler without also executing its first instruction
• Step Over was previously broken, and was reworked to use a breakpoint
• Read and Write breakpoints now detect if any of the bytes being accessed are in the given ranges, not just the exact byte specified
• The Breakpoints window will no longer erroneously show a star next to Read, Write or Exception breakpoints that don’t match the current emulation state
Just gave it a try and it seems to work quite good. I noticed a few things here and there in the UI that could need improvement but I don’t want to throw more work at you. Just tell me when you are up for it and I will make a short list.
Go for it. Don’t worry about extra work, I do that to myself all the time. (-:
So I’m seeing the jar file, and I just realized this for windows is Java based right?
Historically Java has been a big bullseye for virus makers and other trolls. Has it become more secure to feel safer installing that again to take part in using this program or in the future will it use something other than java?
I’ve not had it installed in years and only then for Micropolis for Windows. This looks like a fantastic program, wholly not the pain in the ass mess that is mednafen.
VmprHntrD wrote:
So I’m seeing the jar file, and I just realized this for windows is Java based right?
.jar is a self-contained Java program, though it doesn’t necessarily need to be used with Windows. Since Java is available for so many operating systems, the idea is that a .jar should be useful just about anywhere.
VmprHntrD wrote:
Historically Java has been a big bullseye for virus makers and other trolls. Has it become more secure to feel safer installing that again to take part in using this program or in the future will it use something other than java?
Any malware will attempt to target as large a user base as possible, so the most popular platforms tend to get targeted. This includes Microsoft Windows, Apple iOS and to an extent Java. However, the vast majority of Java malware has targeted people running Java as a web browser plugin, whereas this emulator project is designed to work as a standalone application.
It’s absolutely possible for a .jar itself to be malicious, so if you’re not comfortable taking that risk, then you shouldn’t. An alternative would be to set up a bare-bones virtual machine running something like Linux where you can load up the Java software in a safe, sandboxed environment.
VmprHntrD wrote:
This looks like a fantastic program, wholly not the pain in the ass mess that is mednafen.
I appreciate the sentiment. (-:
Mednafen does work well enough as an emulator, so I try to refrain from unnecessarily bashing it, but nonetheless it is one of my go-to examples of difficult user interface design. One of my major goals for the PVB emulator was to make sure all of its features were easy to use, even without reading a manual, so it means a lot that you took notice of that.
Thanks for the replies, starting bottom first.
I don’t care to outright bash it either, but as you said, it’s also my example of least user friendly tool ever as it’s so bad even GUIs others make are hair pulling annoyances. Yet a larger reason is I’ve seen multiple stories where it won’t run a homebrewed game correctly that will on actual hardware with a flashboy plus kit. To me that says it’s fundamentally flawed and should kind of be discounted if you want accuracy.
I haven’t run Java on a PC in probably 5-10 years because at a height of it when Java was all over including used to drive mobile phone games and apps it was a huge virus magnet. If you had it running, as you said tied to the browser, it was an insant back door to getting hosed. I didn’t like the liability so I backed off it. I would imagine a lite install with no access to the browsers with manual updates allowed only would be relatively safe.
I’ve just been very interested in this project reading about it, and also wondering if more is covered up in that closed off VUE section too only invited people I imagine have access to.
Show of hands, who expected another “Workshop” test ROM? Ah good, everyone. Glad to see it.
Attached to this post is Bit String Workshop, useful for testing the bit string instructions in new and unusual ways.
The top section is the user-configurable part. Move the cursor around with the left D-pad and use up and down on the right D-pad to change values. When you press the Start button, the selected instruction with the current register settings and RAM contents will be invoked, displaying the result in the bottom section.
In the big list of bits, the bus address [font=Courier New]05000000[/font] is the location of what is visible on-screen. Each line is 32 bits–one full word–with the least-significant bit on the left.
When the Timer field is set to some non-zero value when Start is pressed, it is used as the counter value on the timer with a 20 µs tick interval. When the timer hits zero, it fires an interrupt that will abort any active bit string instruction, then return early so you can see the state of the registers when the interrupt was raised.
The reason there are six rows of bits for what is ostensibly a fairly simple procedure is because of a tricky buffering behavior the CPU exhibits when processing arithmetic strings. The screenshot shows the output that the hardware gives, and I wasn’t able to find any other emulator that produces the correct result. PVB gets to be the first. (-:
The tech scroll document has been updated accordingly.
Maybe I’m missing something, but I did a basic java install from their homepage and then clicked on your latest jar file, selecting any padded or unpadded game and it doesn’t do anything but a black box.
I’m kind of curious about this like if I’m missing some setup or button press that’s needed.
You’re not wrong: the UI needs some work. Emulator operations are controlled with keyboard commands:
Emulation Commands
F5 – Run/Pause
F6 – Frame advance
F10 – Step Over
F11 – Step
When running, only the Pause command will be carried out.
Application Commands
Ctrl+3 – Cycles between color modes
Ctrl+B – In disassembler toggles the bytes column
Ctrl+G – In disassembler or hex editor prompts an address
Ctrl+P – In disassembler or hex editor seeks to PC
Controller Input
F – A button
D – B button
S – Start button
A – Select button
E – L button
R – R button
Up Arrow – Left D-pad up
Left Arrow – Left D-pad left
Down Arrow – Left D-pad down
Right Arrow – Left D-pad right
I – Right D-pad up
J – Right D-pad left
K – Right D-pad down
L – Right D-pad right
- This reply was modified 5 years, 8 months ago by Guy Perfect.
VmprHntrD wrote:
Maybe I’m missing something, but I did a basic java install from their homepage and then clicked on your latest jar file, selecting any padded or unpadded game and it doesn’t do anything but a black box.I’m kind of curious about this like if I’m missing some setup or button press that’s needed.
Press F5 to start the game/ROM.
Ok that explains it. I must have missed that somewhere in this thread or elsewhere about the setup. I know it’s early, but kind of surprised the L and R d-pads are like swapped on the keyboard as that could get weird in a few games.
I’ll have to fire it up again see what happens in a few games.
This beast keeps getting closer and closer to completion. Another update, another attached build:
New Features
• Bit string instructions are now implemented
• The wait controller is now implemented
• Illegal instructions now display in the disassembler as [font=Courier New]—[/font]
• Added disassembler comments for remaining hardware component registers
Code Changes
• Researched and implemented correct timing for DPBSY and SBOUT
• Breakpoints interface moved into Debugger package where it belongs
• Deleting a breakpoint will now select the next available breakpoint in the list
• Tweaked timing code to always refresh between frames
• Tweaked read and write CPU cycle counts
• The Console window now displays images with a one-frame delay, as the hardware does, in order to facilitate slower software rendering
Bug Fixes
• Interrupt handling now correctly sets interrupt masking level
• Corrected a read bit in SCR that prevented Mario Clash from reading input
• Writing into frame buffer memory will now be visible in the Console window
• Corrected disassembler treating illegal opcodes as bit strings
• Clicking in the list of breakpoints now commits any breakpoint edits
• Disassembler comments for interrupts should now appear even without a breakpoint
• Logical Not ([font=Courier New]![/font] operator) in Condition and Goto now works properly when used on boolean and integer values
An edit to the number of CPU cycles taken by bus accesses seems to have improved performance across the board. Apparently Java wasn’t the problem so much as the simulated CPU was too slow, and now most games run full-speed on my workstation. Waterworld, which was previously so choppy as to be unplayable, now runs smoothly, and the mysterious flickering in Mario’s Tennis has stopped as well.
Red Alarm does not boot in this build. It seems to be especially sensitive to system timings, and when I do get it to run, some frames exhibit errors like blank contents or failure to clear the previous frame. It will take some research, as it does depend on WRAM and VRAM bus access latency, so until further notice the emulator will not have 100% compatibility with commercial games.
The sacred tech scroll now documents the display timings, the hardware component memory map, further details on bit string instructions and even the communication port. I wasn’t able to have link support ready to go in time for this update, so I guess you know what to expect next time. (-:
Attachments:
No build this week, but there’s plenty news about updates. Part of what’s taking so long is a management shuffle at work resulting in an unusually heavy workload, and part of it is… well, let’s find out!
For starters, the link implementation is all set up and works just fine. I was able to test it with a truly terrifying hack-n-slash second Console window:
The “Communication Workshop” program in the screenshot can be found attached to yonder post, but since I can probably count on one hand the number of people who can make effective use of it, there’s not much incentive for anyone to go grab it. But it does indeed work correctly, which is the important part.
As may be apparent, the main application window needs to be adjusted in order to properly present two linked simulations to the user. I decided to take the opportunity to redesign the main window entirely, fixing various usability problems along the way and introducing my vision of the final application UI.
__________
Many Hats
The next build introduces a new application paradigm: presentation is split into two modes depending on the user’s preferences. In Game Mode, the top-level window is only the menu bar and video display, and in Debug Mode, the MDI that has been used up until now will be used. Debug mode is toggled on and off in the File menu.
In Game Mode, the File menu has these options. Most should be pretty self-explanatory, though New Window will produce another top-level main window with all the same features. This is what will enable link play, as we’ll see in a bit.
In Debug Mode, the File menu becomes slightly different as it adds options for ROM file management as well as individual control over SRAM (in Game Mode, SRAM is automatic using the ROM filename). Modifications made to ROMs in the hex editor or, eventually, the assembler can be saved as new files for ease of development. ROMs and SRAM can also be resized.
The new Emulation menu brings options that were previously known only to the monks of the mountain who study such things. All of the old keyboard commands will continue to function, but now every command available becomes more accessible thanks to being visible on-screen. Step and Step Over are hidden in Game Mode, since they’re not useful there.
The Link sub-menu brings up a list of additional windows, allowing the user to select one to associate as a communication peer. This is where the New Window option from the File menu comes in handy.
All of the settings will actually be accessible from a single window, but the Settings menu has some common options to help the user get to where they need to go without excessive navigation of the menus. Input, Video and Audio all bring up a new Settings window, but they each automatically select the appropriate tab/page. The Settings item simply shows the Settings window in its most recent state.
Additional settings–such as localization/language, disassembler configuration and the eventual native implementation selector–will also be in the Settings window, but simply not have shortcuts in the Settings drop-down menu itself.
The Debug menu should be familiar, as it’s the same as the Window menu up until this point. The entire menu is hidden in Game mode.
__________
While most of the menu items are right-this-second unimplemented, I was still able to get a decent chunk done over the week despite the activity at work…
Anyone familiar with the source code layout will find that App has been broken free of its connotation with the main application interface, and a new class MainWindow was introduced. App functions mainly as a window manager, but also houses the global configuration accessible through the Settings menu.
The code that drives localization of on-screen control messages has also been updated to add some more flexibility that wasn’t there before. The new features will benefit messages that require substitutions, such as the main window title and the Breakpoints window error message. With the new improvements, 100% of the strings are now fully localized and can be swapped out with a new localization file at runtime. An associate of mine has agreed to do a Japanese translation when the time comes, so it won’t just be US English through the end of time.
What I’m currently working on involves input from the user. All of the keyboard bindings are about to be user-configurable, which includes things like “F5 to run/pause” and “D is the B Button”. It’s being set up to eventually support controller/joystick input as well, although that will require native modules to pull off.
Attachments:
Ah, it’s alive!
I’m really liking the effort put into a clean well thought out design. Keeping it S.O.L.I.D. 🙂
I’m on spring break atm so I can actually dork around with it for fun.
Anyways, Good luck!