Any-Yes: A Cycle-Accurate Java NES emulator

I present Any-Yes, my attempt at a cycle-accurate NES emulator. I’ve been spending a lot of my free time lately working on this project, and I think it’s good enough for an initial release.
Any-Yes 0.1.0

I have some cool plans for Any-Yes, I plan to carve out some unexplored niches in NES emulation with it.

I’ll let some screenshots and the readme text do the rest of the talking:

Some features of note include NTSC simulation, gameplay recording, mid-instruction cycle-accuracy, game genie support.
Currently Supported Mappers: 0, 1, 2, 3, 4, 5, 7, 9, 10, 11, 13, 16, 19, 28, 66, 69, 71, 118, 119, 140, 163, 228, 232

Many difficult to emulate games work correctly, such as BattleToads, Bee-52, Mig 29 Soviet Fighter, and Crystalis to name a few.

> Operating Any-Yes
To run: You must have Java installed. Simply double click the .jar file if you are in Windows.
If that doesn’t work, or you are in Linux, run this command:
java -jar any-yes.jar

Put ROMs in the included ROMS folder, which is the easiest method of accessing them.
You can also navigate to whereever they are using the built-in file browser, but it’s still somewhat of a work in prgress.

The file browser is simply a frontend. To set key mappings and other options, you must launch a game.
To navigate, click files or directories. To go up to a previous directory, click the folder name in the top bar.
If you need to change the start-up directory, edit last_dir.txt, which is in the loader/config/all/ subdirectory of the config location (see below)

You can make the window large by double clicking the title bar, or dragging the edges to resize. True fullscreen support will come soon.

Zip support is very temperamental, some zip files refuse to open currently. If you run into this problem, please unzip the rom and try again.

> Configuration
To map controller controls:
Press Escape while in a game
Click “Map Controls”
Currently cannot remap keyboard controls.

All config data currently is put in:
Windows: :/vnand/
Linux: ~/vnand/
(VNAnd is the name of a larger multi-emulator platform I am working on, of which Any-Yes is a module)
Any-Yes specific data and configs are in the engine_data/any-yes subdirectory.

> Recordings

Some notes about the recording system:
Press R or click “Create” in the menu to begin recording.
Press R again or click “Finish” to complete the recording.
Press T to play the recording. Currently you can only have one recording at a time per game, to have more, move the recording file for that game.
You can make a recording over multiple play sessions by saving the state (F5) while recording. If you load the save state later, it will continue recording.

> Key list

Escape: Toggle Pause / Menu

Q – toggle NTSC simulation
W – toggle linear screen filter
S – toggle scanline overlay

` – hold for fast forward

R – toggle recording
T – play recording

F1 – quick save state
F2 – quick load state

F5 – save state file
F6 – Load state file

Arrow key – D-Pad
Z – B
X – A
Tab – Select
Enter – Start

> Upcoming Features

Some lofty and not-so-lofty upcoming features I plan on supporting:

– Rewind
– Game Manual / Cover archival
– Better frontend
– Android (Mostly working)
– Neural Network to learn to play games (via reinforcement learning, think Mar I/O)
– Javascript plugins
– External hardware simulation (plug and unplug virtual controllers, TVs, etc in a visual way)
– Fast cycle-innacurate core

Set Sprite Origin Without It Moving in LibGDX

In LibGDX when you change the origin of a sprite (via setOrigin), it will actually make the sprite jump to a different location if it has been scaled!

This is because when you change the origin, the scaling is reapplied at the new origin, making it appear to move. To counter this, we calculate just how much the re-scaling moves the sprite, and counter it.

The distance between the position at scale 1, and at scale S is, intuitively:

width – (scale * sprite_width)) * ((sprite_width – origin) / sprite_width)

That is, The width of the sprite, minus the scaled width, multiplied by position of the origin as a fraction of the width.

Take the difference between this value at the old origin and the new origin, and you have your correction distance!

Via algebra magic, we can simplify this greatly down, (and even cancel out the sprite width). Here is some Java code to set the origin of a scaled sprite without it moving Simply call setOrigin with the sprite and the intended new origin position.

public void setOrigin(Sprite s, float x, float y)
    float mx = calcDist(s.getScaleX(), s.getOriginX(), x);
    float my = calcDist(s.getScaleY(), s.getOriginY(), y);
    s.translate(-mx, -my);
    s.setOrigin(x, y);

private float calcDist(float scale, float o, float no)
    return -o + no + scale*o - scale*no;

Learning to Blend

One of the things I have been doing recently is learning to use Blender, the popular open source 3d modelling software. I’ve been interested in 3D modelling for a long time now, and have gained enough skill to do basic tasks needed for my work. But now it’s time to level-up my skills.

As I work through tutorials and play around, I’ll be sure to post links and art here!

VNAnd release 0.1.0

Here is the initial release of VNAnd, my multi-game interpreter! This version comes with support for a few different game engines, namely VNDS, ZZT, Chip-8, and Knytt Stories.

I included some free games with it, and details for where to find other games are included in the manual.

Download VNAnd 0.1.0 for Windows, Linux, Mac

Android version soon to follow.

To play it, just unzip the downloaded file and run the included .jar file! For more details check the included readme.txt and files.

I’ll open source it before long, too.

Here are some screenshots of VNDS in action, click on them to check them out:


VNDS is collection of game interpreters I’ve been working on for a few years. It started life as an Android interpreter for the visual novel format VNDS. As time went on I added interpreters for other formats I was interested in hacking around with.

There is a universal loading menu that recognizes games in compatible formats, and launches the proper interpreter for the game:

VNAnd menu

The list of formats currently recognized (in varying levels of completion):

I’ll be writing more about the different capabilities of VNAnd, as well as posting downloads soon.

Hello World

I suck at writing. It’s not that writing is something I hate, but I have never really done it enough to gain any kind of skill in it. Which is fine, since my real interests lie in software development, Japanese study, and video games.

Then why am I sitting here writing in my free time, instead of doing one of the aforementioned things? I have been looking over some of the projects I have worked on over the last few years, and realized how ridiculous and selfish it is to keep these things to myself. If even one of the pieces of code, hobby projects, etc can help or bring amusement to others, then it’s a shame to keep it locked away in my proverbial attic!

And so here is my first (of hopefully) many posts. I will post about some of the things I do, write tutorials and helpful information for different game engines / programming languages, and other things like that! I know this post is probably a bit rambling, and so I also hope that my mastery of writing can increase as I make posts, too!