All posts by Krayzar

Ogre Battle: MotBQ – RNG Research

I recently started doing deep dives into all versions of the games, initially focusing on differences, but my goal is to gain a complete understanding of RNG across all versions.

Currently I’m working on: Mapping initial Tarot RNG

DONE – Preliminary search for time counters.
DONE – Found Tarot locations in Memory for ALL versions.
DONE – Find Leader Name Memory locations.
NEXT – Scripting a bot to play through and find all possible card sets per version.

I’ll update this with information as I confirm more. For now, the high level stuff is:

SNES USA and JPN

Both versions use a 256 counter for initial card RNG. @Dragondarch ‘s RNG manipulations for the name “!” will work well on all original versions of SNES. The documented card sets may be off by a single digit compared to hardware perhaps due to recent accuracy improvements in emulation or issues with the BSNES core in recent bizhawk versions that make replicating accurate to hardware results impossible, but in practice it doesn’t change how anything works. I’ll probably need to test with save states on real hardware to figure what the discrepancy really is with the SD2SNES, assuming I can get save states working on my older model.

Time Counter stored at WRAM:
0x51

Tarot Cards stored at WRAM:
0xDBE – 0xDCC

Leader name stored at WRAM:
0x7A4 – 0x7AB
0x87B – 0x882

Nintendo Power Kiosk version

Nintendo Power SNES ROM uses a 256 counter for initial card RNG but has a vastly different algorithm that seems very similar to the PSX version. Current Manipulations for “!” do not work. 0x52 is a secondary time counter that resets to 0 once it gets to FF (255). Not quite PSX, but close. Hopefully scripting the card RNG will illuminate just how close it is.

Time Counter stored at WRAM:
0x51

Secondary Time Counter stored at WRAM:
0x52

Tarot Cards stored at WRAM:
0xDBE – 0xDCC

Leader name stored at WRAM:
0x7A4 – 0x7AB
0x87B – 0x882

PS1

Seem to have RNG based on program start – there is a main counter that counts up indefinitely and initial card RNG seems entirely based on it. That appears to be a full 32bit counter and does reset to 0 once it reaches the limit. There are semi frequent areas of lag frames on PS1. This essentially means that there are small 2 to 4 frame windows where it’s very likely you will get a specific set of cards, but the card sets are based solely on the timer and algorithm and the periods of lag being inconsistent can make things tricky. There is also a 0 to 64 counter I’m aware of that doesn’t seem involved in card RNG, but may have a role in other types of RNG.

Tarot Cards stored at PSX MainRAM:
1C6B85 – 1C6B93

Leader name stored at PSX MainRAM:
1C6C14 – 1C6C1B

Time Counters stored at PSX MainRAM:
00E20C
13C910
13C8FC
135104
14188C

Unknow why there’s so many on slightly different offsets/starting positions.

Saturn

Seems to have RNG based on program start – there is a main counter that counts up indefinitely and initial card RNG seems entirely based on it. That appears to be a full 32bit counter and could take over a year to figure out if there’s any interesting effects if it maxes out. Tarot cards are stored odd/even in the address range – only version that does this.

Time Counter stored at SAT work ram high:
0F9670

Secondary Time Counter stored at SAT work ram high:
0F9671

Another time counter (Realtime) stored at SAT work ram high:
0C63F8

Tarot Cards stored at SAT work ram high:
0CD46C – 0CD479

Slot 01 = 0CD46D
Slot 02 = 0CD46C
Slot 03 = 0CD46F
Slot 04 = 0CD46E
Slot 05 = 0CD471
Slot 06 = 0CD470
Slot 07 = 0CD473
Slot 08 = 0CD472
Slot 09 = 0CD475
Slot 10 = 0CD474
Slot 11 = 0CD477
Slot 12 = 0CD476
Slot 13 = 0CD479
Slot 14 = 0CD478

No idea why Saturn does this. Cards are reordered shortly after final pick too.

Leader Name stored at SAT work ram high:
0F9674 – 0F967B

Same odd/even storage pattern.

Playstaion Memory cards and you – A guide to Save hacking on the PS1

I was recently extremely disappointed to find that most of the sites I used to reference for info on how PlayStation memory cards worked back in the 90s and early 00s are now defunct. A lot is still available on Archive.org but that’s relatively inaccessible to a lot of folks unless they know exactly what to look for.

So let’s fix that, and have some fun while doing it! I’ll try to point out my original sources for info where still available, and of course I’ll share some of my own methods, both old and new!

Running 16-bit Apps on a modern Windows OS with NTVDM!

So, I have no idea why, but this is by far my most popular YouTube video.

Objectively, this video is awful. What was I recording off of… a Yak Bak? But apparently it’s helping folks so… let’s make a full article on it!

Or maybe you already know all this and are just here for an easy command line option:

dism /online /enable-feature /all /featurename:NTVDM /quiet /norestart

Bah you’re no fun then, I want to wax poetically about Windows components!

If not, or the above command failed, read on!

So you want to run 16-bit apps on modern Windows eh?

Maybe you need to run some older industrial automation or security software. Or maybe, like me, you speedrun or simply play Windows 3.1 games.

What you want is NTVDM!

NTVDM or NT Virtual DOS Machine is a particularly ancient (1993) virtual subsystem that allows 16-bit Windows and 16 and 32-bit DOS programs to run inside a more modern Windows OS. Think of it as a seamless built in virtual machine. It used to be automatically enabled on Windows XP and below, but Microsoft rightly reasoned it was a security concern and started keeping it disabled by default starting with Vista.

Now let’s be up front about this, there’s a major caveat to using this feature – you have to be running a version of Windows that’s 32-bit. There are unofficial alternatives that skirt around this requirement that I’ll discuss later in the article, but if you want native Microsoft endorsed 16-bit application support, you simply must be running a 32-bit version.

That means giving up all but 4 gigabytes of ram – even that in practice is much closer to 3.1 to 3.5gbs after the OS and hardware addresses things on a modern system. This generally relegates this kind of OS install to virtual machines and dedicated specific use machines, because make no mistake, a modern OS does not run well with sub 4gbs of RAM for general use.

Don’t get me started on security concerns either. While it should be comparatively safer to run on modern systems than it was on older Windows versions due to more robust security features, that doesn’t mean it still isn’t risky! Use NTVDM with caution, and preferably in a virtual machine unless you’re absolutely sure you know what you’re doing!

That being said, all modern versions of Windows – that means Windows Vista, 7, 8, 8.1, and 10 – have a 32bit version, and thus have the NTVDM feature available. So yes, you can run Castle of the Winds and other early 16-bit windows programs on Windows 10! Feel free to crack out that boxed retail copy of Vista you have lying around – it’ll finally be good for something. Earlier versions of Windows, like XP and 2000, have NTVDM enabled by default and may in general be more compatible due to better color settings options, but if you simply must have a modern OS running 16-bit stuff here’s how!

Checking your OS version

If you right click on your Start menu (that little Windows symbol in the left corner) and click System near the top of the menu that appears, you’ll be taken to the Windows About page. If it says 32-bit operating system under System type, you’re in luck. You’ve hopefully intentionally installed a 32-bit version. Even if it mentions you have an x64-based processor you’re still good so long as the operating system is 32-bit.

If you see 64-bit operating system, x64-based processor there, you’re out of luck. I’ll list some alternatives later in the article – but keep in mind, these are for advanced folks. If you needed this section of the article you might not be ready for them. I mean no disrespect by this – a few of them could reduce OS security significantly or damage your current OS if used incorrectly, so they’re not for beginners. Looking into Virtual Machines and older OSes might be a safer way to go.

Enabling NTVDM

Okay, so you have the right version to be able to use NTVDM – so let’s enable it!

  1. Press both the Windows key and the R key to pull up the Run utility.
  2. Type optionalfeatures.exe in the Open field and press enter.
  3. In the Windows Features menu that pops up, scroll down to Legacy Components and select NTVDM and select OK.
  4. NTVDM will install, and once it’s finished, you can click Close.

And that’s it, you’re all set! Go run some ancient programs.

NTVDM Alternatives

So you want to have 16-bit programs running on your modern 64-bit Windows. I like you, you’re that spicy type of crazy. Assuming you’re technical enough, you could try the following options, but keep in mind, neither are perfect, and both are open source enthusiast creations. If you’re looking for better compatibility than these can offer, consider running Windows XP in a virtual machine.

WineVDM by otya128 (formerly OTVDM)

If you’re looking to run full graphical 16-bit programs, like those meant for Windows 3.1 and 95, this is likely what you’re looking for. It’s essentially a Wine for Windows fork based solely in porting Wine’s compatibility for 16-bit programs. The compatibility is generally good, but there are a few games I’ve tried that haven’t worked correctly. Looks like there’s many more updates than when I last tried it, so perhaps your mileage may vary. I would recommend trying this one first. If you’re looking for a prebuilt installer, take a look here, near the bottom of the page.

NTVDM x64 by leecher1337

Basically it’s a port from leaked source code, originally using the NT4 code as a starting point. There’s a few different builds, and the new MINNT branch seems to support graphical DOS modes and early windows programs, albeit somewhat slowly. For a pretty detailed write up on this version, look here.

Be aware that NTVDM x64 may require you to turn driver signing off, which is something that can only be done safely on a machine that does not have Secure Boot enabled. That should only be done if you know what you’re doing and understand the risks. It could make your OS significantly less secure if you are a novice, and at worst could make it so that Windows can’t boot!

And that’s it!

Feel free to comment on that Youtube video if you have any questions.