Maidens of the Kaleidoscope

~Hakurei Shrine~ => Help Me, Eirin! => Tech Support => Topic started by: Arcorann on October 22, 2011, 08:12:45 AM

Title: Neko Project II fmgen and PC-98 Touhou (guide now included)
Post by: Arcorann on October 22, 2011, 08:12:45 AM
Neko Project II (http://www.yui.ne.jp/np2/) is an emulator for the PC-98x1 series of computers created by Yui. Although the official np21 variant has been able to play Touhou games since its introduction in 2004, it was only recently that the viability of the emulator was properly investigated, partly due to the appearance of unofficial builds such as the kai and fmgen builds. With better emulation than Anex86 and better performance than T98-Next, it is the recommended emulator for playing all of the PC-98 Touhou games (except possibly HRtP due to minor flickering).

It is also notable for having a native Linux/Mac OS X port in the form of Xnp2 (http://www.nonakap.org/np2/).

Following is a guide to configuring Neko Project II for emulating the PC-98 Touhou games.

Installation (last updated 2019-07-25)
* Download the emulator. The fmgen version is recommended for general use. This link should guarantee that you have the latest build. (http://nenecchi.kirara.st/) Select the first entry in the list labelled np2fmgen.7z. As of 2019-07-25 the latest version is the 2019-05-06 build (http://nenecchi.kirara.st/php/down.php?f=np2fmgen_190506.7z).
* Extract anywhere. If you can't open .7z files, download 7-Zip.
* Download the YM2608 samples from this link (http://nfggames.com/pc98/Uploads/ym2608rl_fmpmd.zip) if you don't already have them, and extract them into the same folder as your np2 install.

Configuration
These are the essentials to get Touhou game emulation to the standard of Anex86 or T98-Next. Optional stuff will be covered later.
* Start np21nt.exe (np21.exe is designed for Windows 9x computers, although it seems to work just as well on later Windows). Do not use the other .exe files, np2sx(nt) results in graphical glitches, while Touhou does not work with np2(nt) at all.
** np21(nt) emulates a 32-bit CPU, while np2sx(nt) emulates a 386SX (32-bit with 16-bit bus) and np2(nt) emulates a PC-9801 with a 286 CPU (16-bit).
* Go to Emulate --> Configure. Change the CPU clock multiplier from x4 to x40 or above (mainly because of MS Extra; if you don't play that you can get away with x32), reduce the sound buffer to 100ms (you can go lower if you want, but I personally leave it at 100), check QFM, and increase the sampling rate to at least 44K.
* Enter the system setup menu by selecting Emulate --> Reset while holding End until the screen appears. Select the second option, then change GDC clock from 5MHz to 2.5MHz. This is required for PoDD to work properly.
** Alternatively, go into the .ini file and change DIPswtch to DIPswtch=3e f3 6b.

Usage
* Harddisk --> IDE #0 (SASI #0 on the official build) --> Open..., select the HDI file, then Emulate --> Reset.

Optional stuff and miscellany

General:
* Savestates: Add STATSAVE=true into np21(nt).ini, making sure that it is in the [NekoProject21] section. This causes a Stat menu to appear. Savestates range from 0 to 9.
* Fullscreen: Screen menu, also Alt+Enter (this key combination can be disabled).
* Font: The emulator generates a usable font automatically from a system font; this should be sufficient for casual purposes (Neko's font handling is much better than Anex's). To replace it with a more accurate font, go to Emulate --> Font and browse for the file (Anex86's .bmp font files and T98-Next's font.rom will both work; downloads for both are here (http://mijet.eludevisibility.org/) for font.bmp and here (http://46okumen.com/files/FONT.ROM) for font.rom), or simply place font.rom (font.bmp) in the same folder as your install.
* Screen size: Click on the cat icon at the top left corner of the window. You will have the option to change between six preset window sizes.
For a slightly more detailed guide on configuring Neko Project II, refer to Tokugawa Corp's FAQ. (http://fullmotionvideo.free.fr/pc98/neko.html) Note that it was written for the official version 0.83 so some info may be out of date relative to the newest builds.

np2fmgen exclusive:
* Alternate FM cores: Full explanation pending (I'll get to it eventually...), see fsvgm777's post. New link is here (http://ux.getuploader.com/emu/download/34/fmdllset%28v1%29.7z) (2013-12-21, password is fmdll) or see the readme in most recent fmgen.
* Keyboard shortcuts: Replace the zeroes in the Function=... with relevant codes (see Function.txt for details). For example, to set Home (0x24) as a shortcut for a screenshot (IDM_BMPSAVE, 40701, 0x9efd) replace a group of 00 00 00 00 with 00 24 fd 9e.
* Running at over 100% speed ("90FPS"): The most recent builds of fmgen have introduced the option to change the emulation speed, with a new menu under Emulate --> Speed. However, by default 150% speed, the most common used by Touhou players, is not included. To fix this, add the line CPUSMENU=25,50,75,100,150,200,400,800 (add other speeds if you want, note that the line should be at most 8 entries) into np21(nt).ini.
* Skipping the boot sequence: Introduced in the 2014-03-13 build, add the line BOOTSKIP=3 to skip the boot sound and memory check.
* Debug features: Add the line I286SAVE=true into np21(nt).ini. Click on the cat icon to access a few debug features, including a memory viewer and disassembler (albeit crappy ones).

Making LLS run faster
For some reason LLS requires expanded memory for the Stage 5 Yuuka boss fight when playing as Reimu, and will freeze if expanded memory is unavailable. Unfortunately, loading an expanded memory manager generally adds significant overhead to processing (software. If you're using Neko Project II, however, this can be circumvented by specially prepared drivers:
* Download this archive (https://app.box.com/s/z0pwyb5yva76tpckb44xf3cs83uqavvn).
* Put the three files in the NP2EMS folder into the root of your hard disk image, replacing the CONFIG.SYS file. If you don't have DiskExplorer to do so, see below.
Note that the setup will only work on Neko Project II and not on any other emulator, so I've provided two alternatives just in case. If anyone has another way to reduce EMS overhead please contact me.

DiskExplorer
http://hp.vector.co.jp/authors/VA013937/editdisk/index_e.html (http://hp.vector.co.jp/authors/VA013937/editdisk/index_e.html) is the link for the most recent English version (1.69 English, 2010-04-10). This program allows you to copy files to and from disk images such as .hdi files, making it a very useful tool for anyone using them.

Other notes (incl. troubleshooting)
* If you're wondering why the game is lagging, first enable Other > Clock disp and Other > Frame disp. If the clock display is significantly below what you set the CPU to it's your computer, otherwise you set the CPU multiplier too low.
* On some systems there may be an issue where the emulated screen doesn't refresh properly. If this happens (assuming you're in windowed mode) try switching the window mode to Window(Hard) or Window(D3D).

Xnp2
There is a port of Neko Project II for Linux and Mac OS X called Xnp2. Last I checked it seems to have some sound problems, requiring a rather large sound buffer to avoid stuttering; should you be annoyed by this, np2fmgen runs perfectly in Wine.

The program needs to be compiled from source. Grab the latest version from here (http://www.nonakap.org/np2/) and extract to a folder. To install dependencies:

Code: [Select]
$ sudo aptitude install build-essential nasm checkinstall libsdl1.2-dev libsdl-mixer1.2-dev libgtk2.0-dev libxxf86vm-dev
replacing aptitude with your package manager if necessary.

To compile, change to the source folder, then:

Code: [Select]
$ ./configure --enable-ia32
$ make

Make sure the --enable-ia32 flag is supplied. Otherwise, the i386 instructions will be missing and the games will not run (same as running np2.exe on fmgen). After this, follow the settings above to configure the system, but you may have to set the sound buffer up to 200ms or more to avoid stuttering; this may result in audio lag.


For archival purposes, below is the original post that I made:
Quote
So I'm trying out the Neko Project II fmgen, a version of Neko Project II that is being worked on by an anonymous poster in 2ch (which I first discovered in this thread (http://fullmotionvideo.free.fr/forum/viewtopic.php?t=954), with the original 2ch thread located  here (http://yuzuru.2ch.net/test/read.cgi/gameurawaza/1306584079/l50)).

The purpose of this thread is twofold: firstly, to spread awareness of this emulator to this site. Secondly, PoDD is utterly broken on this.

Firstly, after the splash screen:

[attach=1]

The solution was to click Emulate->Reset while holding down the End key on the keyboard so that BIOS appears, select the second option and set the GDC to 2.5 MHz. This got the game running.

Then, actual gameplay results in this:

[attach=2]

Thus, I would like to ask that someone look into this further so that we can make the most of this new emulator.
Title: Re: Neko Project II fmgen and PC-98 Touhou
Post by: Momiji on October 22, 2011, 08:58:43 AM
Ohoo, so NekoProject II is finally being extended to support the PC9821?  This should prove interesting.  I'll give this a shot.   ^.^

[Edit]  Oh right, I forgot.  I had come across this thread once before, and I was in the process of writing up a new PC98 how-to, but I lost the text accidentally.  T-T
Title: Re: Neko Project II fmgen and PC-98 Touhou
Post by: Arcorann on October 24, 2011, 06:47:39 AM
OK, so I've done a little bit more testing with both np2sx and np21.

I can now confirm that graphical glitches appear in all five PC-98 Touhou games when using np2sx, and do not appear in np21. As far as I can tell there are no problems whatsoever when running in np21, apart from the aforementioned GDC error, which is easily fixed.
Title: Re: Neko Project II fmgen and PC-98 Touhou
Post by: Momiji on October 24, 2011, 12:05:24 PM
Do I need a BIOS file for NP21?  Hitting End did nothing.
Title: Re: Neko Project II fmgen and PC-98 Touhou
Post by: Arcorann on October 24, 2011, 10:26:01 PM
You have to hold it from clicking Reset until the screen appears (a couple of seconds).
Title: Re: Neko Project II fmgen and PC-98 Touhou
Post by: Momiji on November 01, 2011, 04:07:34 PM
NP21 interprets the keyhit as 1 regardless if Numlock is on or off.  Argh.  I guess I need to try this with a real keyboard.
Title: Re: Neko Project II fmgen and PC-98 Touhou
Post by: Momiji on December 14, 2011, 08:49:51 PM
I did a bunch of load testing of NP21 during NEC.  Worked pretty darn well, didn't get any of the chugging you'd see with T98Next.  And compared to Anex86 the sound was pretty much complete, and the graphics were nice and smooth.  It helps that you can really crank up the CPU speed, plus I have a feeling the older emulators only support a 2.5MHz GDC (NP21 will do 2.5MHz and 5MHz).  We did notice that, after a long period of playing any given game, the emulated machine would lock up but continue to play whatever music was loaded into the sound driver (albeit faster than normal).  Hopefully that gets fixed, because I'm thinking this is probably my PC98 emulator of choice now.

[Edit]  I'm going to unlock/sticky this for the time being, while I gather more data for a new PC98 emulator howto thread.  Please test this out and post your results!
Title: Re: Neko Project II fmgen and PC-98 Touhou
Post by: fsvgm777 on December 15, 2011, 08:35:01 AM
I did some testing with the newest Neko Project II fmgen (which can be found here (http://fullmotionvideo.free.fr/forum/viewtopic.php?p=9400&sid=764a1779ae1aa925ec640e5fa5f9af29#9400)) some days ago. It has some very interesting features, most notably that you can use a different FM engine (for instance MAME's core). However, the rhythm samples (2608_xxx.wav) are still required. Said MAME core can be found in the same link mentioned above, along with the YM2612 core from the Genesis Plus GX. In order to use a different core, you have to add the line "FMGenDll=<name_of_fm_core>.dll" (where <name_of_fm_core> is the name of the core you want to use, for instance mamefm) in np21nt.ini.

Now for the actual testing part:
All PC-98 Touhou games work very well for me, aside from a bit of slowdown during the fight against Alice in MS (probably because I set the multiplier to 32) and LLS using 25% of my CPU (I have a Core i5) and the emulator running slow. Dunno if that's related to the MS-DOS-like boot-up I see when booting up LLS, as it doesn't use much CPU when playing the other games. Lastly, I tested if the MIDI in SoEW works as opposed to T98-Next, and it does work (it uses Microsoft's GS wavetable synth for me).

In conclusion:
With some tweaks, I'm very pleased with Neko Project 21. It's very likely going to be my PC-98 emulator of choice for some time.
Title: Re: Neko Project II fmgen and PC-98 Touhou
Post by: Agent of the BSoD on December 15, 2011, 08:43:42 AM
I just started messing with it about half an hour ago (latest), and the only thing I notice is a little lag from it, which I was able to fix in the config by giving it more power. The font is a little wacky if you ask me (when I tested HRtP) and the percussion in HRtP is missing entirely, as opposed to T98-Next, so it sounds more like Anex86 all over again. I even used the file for Next they put up for NP2's music core into Next and it doesn't have percussion either, though I don't know why I thought it would TBH. The music is pretty good, but I prefer the way Next handles it.

Let's hope the rest of the development goes really well. (also, that one version of Next that Momiji linked me some time way back, I still never got it to run smooth. It lags horribly. Luckily, it looks like NP2 is going to replace it anyway)
Title: Re: Neko Project II fmgen and PC-98 Touhou
Post by: Momiji on December 15, 2011, 12:30:36 PM
You may want to put all the YM2608 rhythm WAVs into the emulator folder.  Then copy over the FONT.ROM from T98Next and use it (Emulate > Font).  Also, for sound emulation, make sure you're using a Speakboard (Device > Sound > Speak board).  Then you can increase the sound quality (Emulate > Configure > Sound section).  First set the sampling rate to either 55khz (or 88khz if your system will handle it), then enable QFM.  I also turned down the sound buffer to ~40ms.  On top of all that, I have the CPU set to ~2.5MHz x32 (~79MHz).  The faster it is, the smoother the game may be.
Title: Re: Neko Project II fmgen and PC-98 Touhou
Post by: Agent of the BSoD on December 17, 2011, 08:20:20 AM
Yep, that all worked for me. Thanks! I've set my sound buffer to 80, because 40 is good, but has faint fuzzing if you listen well, though 80 is a bit lagged. :\ (50 destroys it for some reason)

But on another note, LLS runs exceedingly slow, but runs. (regardless of that 5 or 2.5 GHz change) I'm not sure what the problem with it is. MS runs fine though. (and it seems this computer can't run the games at full speed when lots of stuff is happening, since it slows down, reminiscent of T98-Next all over again. I already plan on getting a new system)
Title: Re: Neko Project II fmgen and PC-98 Touhou
Post by: Momiji on December 17, 2011, 08:24:57 PM
But on another note, LLS runs exceedingly slow, but runs. (regardless of that 5 or 2.5 GHz change) I'm not sure what the problem with it is. MS runs fine though.
Yep, and I figured out what was doing it.  The LLS disk image loads some MS-DOS stuff that it really doesn't need.  I made a new MS-DOS disk that includes all the PC98 Touhou games on it, with updated MS-DOS and no extras on startup (HIMEM, etc.), and LLS worked fine.  In fact if you set the GDC to 2.5MHz you can basically play all the games from the same disk.  Although HRtP has problems but I think it was mis-copied, I think because some of the files were originally corrupted and make copy/xcopy mad.
Title: Re: Neko Project II fmgen and PC-98 Touhou
Post by: Arcorann on December 28, 2011, 01:45:40 AM
I noticed the emulation speed slowdown on LLS as well; simply renaming config.sys fixes it to a similar speed to the other games.

Speaking of emulation speed, does anyone have an idea as to the lowest CPU multiplier setting that would run the games without in-game slowdown? There has to be a certain sweet spot (too low e.g. x20 and there is distinct slowdown in-game; too high and the emulation won't run at full speed).

And a couple of interesting things I've found out:
* It turns out that np21 has existed since version 0.80 (2004). Probably the reason why no-one in the western Touhou community ever found it was because the download link is non-obvious (it's the line below the source code downloads).
* Hourglass r81 seems to work with Neko Project II (the only major problem is that for some reason loading a savestate will cause a desync), which means that should anyone feel like creating a TAS of a PC-98 Touhou game using re-recording, they are now certainly able to.
Title: Re: Neko Project II fmgen and PC-98 Touhou
Post by: Momiji on December 28, 2011, 03:06:15 AM
I run mine at x32 (78MHz), YMMV depending on the speed of your computer.
Title: Re: Neko Project II fmgen and PC-98 Touhou
Post by: Agent of the BSoD on December 28, 2011, 05:49:25 AM
I run mine at x32 (78MHz), YMMV depending on the speed of your computer.
I run mine as well at that same speed. Seems to work well, even with this old hardware computer.
Title: Re: Neko Project II fmgen and PC-98 Touhou
Post by: Goldom on February 25, 2012, 07:39:03 PM
Have there been any more updates to NP21, or has anyone found settings (or a particular older version) to avoid freezes?
Most of the games run decently on Next, but LLS is unusably slow, while too flickery in Anex. I just found NP, and it was running so perfectly, but then total lockup when I reached stage 4 boss  :(
Title: Re: Neko Project II fmgen and PC-98 Touhou
Post by: fsvgm777 on February 25, 2012, 08:26:45 PM
There have been more updates to Neko Project 21:

Here's the latest one I found on 2ch. (http://www1.axfc.net/uploader/File/so/75772)
Password (to be typed in the text box): 9801

This version also lets you choose which sound core you want to use, as shown in this pic (click for full size):

(http://i852.photobucket.com/albums/ab84/fsvgm777/th_np21sound.png) (http://i852.photobucket.com/albums/ab84/fsvgm777/np21sound.png)

In order to use the alternate sound core(s), you need to download this (http://www1.axfc.net/uploader/File/so/74215) (password: 9801), then place the files in the Neko Project folder. After that, you need to add a line in the INI file starting with "FMGenDll=" (without quotes). There, you can specify which alternate sound core to use. I personally use mamefm.dll as alternate sound core.

As for LLS locking up, I have something similar, except it happens just before the boss fight in Stage 5. Oddly enough, it only seems to happen with Reimu... unless the problem fixed by itself on my end? Granted, I changed the CPU multiplier to 48x, but I don't think this is related to the problem I have (had?).
Title: Re: Neko Project II fmgen and PC-98 Touhou
Post by: Goldom on February 25, 2012, 08:46:11 PM
Hm, that version has the same version number as mine, but mine doesn't have that option.

I just went and tried it again, and I actually meant stage 5. I'm on Reimu, and it freezes every time in the pre-boss dialogue, even if I reload from a savestate from stage 4. Did you find any way to get past that point?
Title: Re: Neko Project II fmgen and PC-98 Touhou
Post by: fsvgm777 on February 25, 2012, 09:00:42 PM
Well, in order for the option to appear, you have to download the second link in my previous post, then follow the instructions in my previous post.

For the question:
MarisaB (and possibly MarisaA) doesn't lock up at that point for me for no apparent reason... which is why I only mentioned Reimu in my previous post.
Title: Re: Neko Project II fmgen and PC-98 Touhou
Post by: Arcorann on February 26, 2012, 01:06:24 AM
Same problem happened to me, though I don't remember what I was using apart from it being a December build. We need to check if the problem still exists on current builds (such as the 20120223 linked), as well as on other emulators with the same HDI file.

EDIT: Replicated on 20120223 build with ReimuA.
Title: Re: Neko Project II fmgen and PC-98 Touhou
Post by: Goldom on February 26, 2012, 02:25:54 AM
Well, at least MS worked flawlessly in it. I tried HRTP, and the bullets flickered out of visibility when there were too many, making it impossible. But that one runs fine on Next, so that's ok.
Title: Re: Neko Project II fmgen and PC-98 Touhou
Post by: Goldom on March 02, 2012, 07:41:04 AM
So I just made an interesting discovery. LLS Reimu is now freezing for me at the same place in Anex86 too. I KNOW it didn't used to, which leads me to believe that it's the disabling of DOS loading stuffs (required to remove stutter in NP21) that causes the freeze, not NP's own bug. I'll restore it tomorrow (all I did was rename config.sys > config.bak) and see if that fixes it. If so, I guess the bug NP21 needs to overcome is its slowness with that loaded, not the freezes themselves.

Upthread someone mentioned having rebuilt the whole game file without DOS - wondering if that version freezes too or not. And if not, how you did that exactly.
Title: Re: Neko Project II fmgen and PC-98 Touhou
Post by: Momiji on March 02, 2012, 09:21:07 AM
I used Disk Editor (http://www.distant-mind.com/DiskEditor.zip), and I just reduced the amount of stuff loading via autoexec.bat.  I haven't played LLS long enough to catch the freeze yet.
Title: Re: Neko Project II fmgen and PC-98 Touhou
Post by: Goldom on March 02, 2012, 05:33:47 PM
Well this is strange. My autoexec.bat has nothing in it but
game

So nothing to try there for my copy... So I restored config.sys, confirmed slowdown returned, but then tried around other CPU settings. By turning it lower - down to 24x - it actually fixed the slowdown. I haven't yet made sure the freeze is gone (I'll update in a bit), but don't see why it wouldn't be. The only question is whether 24x is enough to deal with complex sections without lagging. (I tested a couple minutes in Extra without any, but I've never actually played LLS Extra before and so died before long.)

Update: Finished LLS Reimu A on Normal with no freeze! NP21, 24x CPU, config.sys intact. There were a few moments of lag, however - the final attack of boss 5, some fairy shots in stage 6, and Yuka's rotating yellow orbs caused framerate drops, but only for about 1s each. Overall, I'd call it adequate. Of course, it may lag worse on harder difficulties.

Also: I just realized that while 24x gets you 58 MHz and 32x is 78 MHz, if you set the CPU to 1.99 instead and then use 32x, you get in between: 63 MHz. That may be the best compromise - it looks unstuttered trying it out, but I'll have to play a full game with it later to check for the lag spots.
Title: Re: Neko Project II fmgen and PC-98 Touhou
Post by: Tamer Anode/Cathode on March 04, 2012, 04:49:14 PM
Been trying LLS in NP21 0.83k8/fmgen. Game seems to run at full speed, but there seems to be an abnormal slowdown in the music when gameplay is occurring (the music returns to normal when game is paused). Attempting to rename config.sys to config.bak somehow caused sound stutter. Haven't seen if any of the other games have similar sound issues yet.
Title: Re: Neko Project II fmgen and PC-98 Touhou
Post by: Tengukami on March 06, 2012, 01:40:44 AM
I run mine at x32 (78MHz), YMMV depending on the speed of your computer.

Full memory and x32, np21nt runs perfectly well for me. I'm going to need to try the sound idea a little upthread, as sound tends to drop out for me, but this might also be due to other apps running and using - yes - PulseAudio. Apart from that, I'd say it runs very well.

Edit: Had some lag issues at busier stages, but dialing it down to x16 seemed to resolve this almost entirely. Lags are now seldom and very brief.
Title: Re: Neko Project II fmgen and PC-98 Touhou
Post by: Goldom on March 06, 2012, 07:00:35 AM
I tried my above idea about doing 1.99x32. It ran marginally better than 2.4x24, and way better than 2.4x32, but still lagged in those same 3 spots.

Now, if I play in original-size windowed mode, I can run 2.4x32 completely smooth. It only gets choppy when trying to fullscreen (CPU usage shoots from 1-2% to 25% (on a 4-core, so that's 100% to the program), and then the lag happens). Problem is, windowed is unplayably tiny. I'm going to say 1.99x32 is the best I can get for an intact LLS disk. I'd test more, but it takes getting to stage 6 to notice the lag, so it takes a while =\.

I'll just go forward with this:
Playing as Reimu - intact disk, Anex86
Playing as Marisa - take out config.sys, 2.4x32 NP21

Anex flickers badly in fullscreen, but lets me stretch the window to near-full and runs basically fine then, minus some music quality. Actually, that makes me wonder... Huh, nope. I thought maybe a stretched NP21 window would similarly behave better than fullscreen. It actually ran even worse (1.99x32 was stuttery in large window right on stage 1, but fine in fullscreen).
Title: Re: Neko Project II fmgen and PC-98 Touhou
Post by: Goldom on March 15, 2012, 07:35:55 PM
So I figured out a solution, and it was staring me in the face all along - really don't know why I didn't think of this. Change the desktop resolution before fullscreen-ing. Dropping it from 1920x1080 down to 1280x800 cut the CPU use of NP21 by about 80%, allowing me to turn the speed back up to x32 on an intact LLS without any stutter - CPU only hits about 10% (so 40% of one core).

For less of a hassle than changing system settings, you can also just uncheck "No change screen resolution" in NP21's Screen Option > FullScreen, but this leaves the game not using the full vertical space on a widescreen monitor.

After a full game, this is definitely the best so far - went through Hard, ReimuB, and this fixed 2 of 4 lag spots from my previous test. Only ones left are when stage 6 fairies shoot blue aimed lines in unison (it fixed the lag from each single shot), and Yuuka's very final spell. I left Performance Monitor running throughout, and it never went over 20% (80% of one), so these are lags due to insufficient emulation speed, not from hitting the processor limit. Unfortunately, even turning the speed up to the next setting (1.99 x48) shot the usage to max and caused CPU lag everywhere, regardless of screen size - even at 640x480.

This is even better on the other games: I can now turn 03 and 05 up to running at 2.4x56 without the CPU passing 5%, completely removing the 0.5-1% slowdown I was having at 2.4x32. (Full game on 05 now has just 0.03% slowdown). Obviously, specific numbers and lag point will vary by CPU - for reference, I have an i5 760, running at 2.8Ghz - but overall, cutting resolution makes a major impact without any visual difference as long as you maintain the same aspect ratio.

Now, because I'm the sort of person who would spend an hour figuring out how to automate a 10 second task, I created a batch file for running NP21 that changes the screen resolution automatically. It requires this command-line resolution changing program (http://12noon.com/?page_id=80) to work though. Brackets are notes.
Code: [Select]
cd "[directory of that program]"
start dc64.exe -width=1280 -height=800 /wait [change dc64 if you're not using 64bit version]
cd "[directory to NP]"
np21.exe /wait
cd "[first directory again]"
dc64.exe -width=1920 -height=1080 [or whatever your original res was]

Paste into notepad, make adjustments and save as whatever.bat. Make sure to change file type from "text documents" to "all files." Run that file instead of NP21.exe.
Title: Re: Neko Project II fmgen and PC-98 Touhou
Post by: Arcorann on April 09, 2012, 07:41:48 AM
So, I've just tested an alternative resolution of sorts to the problem. Seeing as I play in windowed mode Goldom's method wouldn't help me, so I searched for an alternative memory manager to replace himem.sys and emm386.exe.

With this in mind, this (http://puu.sh/oFLl) link contains 3 files: config.sys, np2hma.sys and np2ems.sys. If you extract all three into the root of your TH04 disk, the game should work properly while running significantly faster (in terms of emulated CPU clock) than with himem.sys and emm386.exe. Given that they were designed specifically for NP21, I have no idea if the files will work with Anex86 or Next, so keep that in mind should you feel the need to switch emulators.
Title: Re: Neko Project II fmgen and PC-98 Touhou
Post by: Goldom on April 14, 2012, 07:56:30 PM
Very good. I tried those files out, and it's definitely an improvement even as-is. When combining both the new files AND the resolution change, it runs the best of anything yet. I'll try it through a game and see if it'll now get past the couple lag spots I had.

Oh, and it does still boot in Next and Anex, though I didn't try playing.

Edit: Yep, it's the best yet in a full game with both fixes at once. I moved up to 1.99x48 now, and the only remaining visible lag is those aimed blue shots. Full game on hard shows a 0.49% slowdown. And CPU was doing totally fine, so I could probably even go up to 2.4x48 and reduce it further. [Edit 2: I did, and it did go down to 0.14%.]
Title: Re: Neko Project II fmgen and PC-98 Touhou
Post by: Arcorann on May 19, 2012, 11:17:25 AM
Has anyone tried Xnp2 yet? I figure that a PC-98 emulator that runs Touhou 1-5 natively on Linux and Mac should be of interest to a decent number of people, and I've seen a YouTube video where the person successfully gets MS working.
Title: Re: Neko Project II fmgen and PC-98 Touhou
Post by: Momiji on May 20, 2012, 02:36:38 AM
I did, but I get STOP errors after the 'ZUN soft' animation no matter what settings I use in it.  I figured this was just a maintained version of the original non-Touhou compatible NP2, but maybe I'm wrong.
Title: Re: Neko Project II fmgen and PC-98 Touhou
Post by: Arcorann on May 20, 2012, 07:08:29 AM
Here's the YouTube video in question (http://www.youtube.com/watch?v=s1ceeWKrXCY) and here's a blog post relating to it in Spanish. (http://eru-cool.blogspot.com.au/2012/02/emulador-pc-98-nativo-para-linux-para.html) Judging from said post the key is enabling IA-32 support before compiling, have a look and see if that works.
Title: Re: Neko Project II fmgen and PC-98 Touhou
Post by: Momiji on May 20, 2012, 08:15:24 AM
Ohoo, that definitely worked.  Only issue is that the sound is atrocious.  =[
Title: Re: Neko Project II fmgen and PC-98 Touhou (guide now included)
Post by: Arcorann on July 06, 2012, 09:08:10 AM
Wrote up a guide for installing np2fmgen in the first post. If anyone has any suggestions for things to add, feel free to point them out.

Also, as it turns out np2hma.sys and np2ems.sys don't work on Anex86 or T98-Next. The place where I got them from also included a file called fdxms.sys, which seems to be used as a replacement when using other emulators (it was called in the original config.sys but was redundant when using Neko), and I will upload that file if anyone wants it.
Title: Re: Neko Project II fmgen and PC-98 Touhou (guide now included)
Post by: touhoumaniac on November 23, 2012, 04:45:49 PM
Thanks for all of this.

For some reason MS is somewhat laggy if there are a lot of bullets on screen. I finished MS extra at midboss with 27% slowdown. The slowdown came from the card monsters.

Got LLS working without lag and PoDD working with the instructions. Sound seems to work perfectly. I can hear stuff that wasn't there with anex.
Title: Re: Neko Project II fmgen and PC-98 Touhou (guide now included)
Post by: Arcorann on November 23, 2012, 11:58:59 PM
Thanks for all of this.

For some reason MS is somewhat laggy if there are a lot of bullets on screen. I finished MS extra at midboss with 27% slowdown. The slowdown came from the card monsters.

Got LLS working without lag and PoDD working with the instructions. Sound seems to work perfectly. I can hear stuff that wasn't there with anex.
If you're finding large in-game slowdown then increase the CPU multiplier. On Windows you should be able to type any value you want into the drop-down box should you wish to experiment.
Title: Re: Neko Project II fmgen and PC-98 Touhou (guide now included)
Post by: Goldom on December 25, 2012, 09:00:49 AM
I am having the weirdest issue getting NP21 to work on my new laptop. Sometimes it simply refuses to go fullscreen. Like, it tries, and shows a small frozen image of the game on an otherwise black screen, but then it pops back into a window.

Here's the really bizarre thing. It seems to be tied to the program's path on the drive. In the folder I want it to be in, it kept doing this over and over. So I copied it to the desktop, thinking maybe it was something wrong in the config file that I just moved over from the other PC. And it ran fine. "Aha," I thought, "it was the config file." But nope. The config file had nothing to do with it ultimately, it came down to the folder name I had the program in. It was "np2" and it wouldn't work. I renamed it "np" and it DID work. I renamed it back, and it continued to work though... It's the weirdest thing. It also seems to be having some lag issues that it shouldn't be, because I'm doing the same thing that got it running fine on my slower CPU computer... Maybe some Windows 8 thing, or who knows what. I'll mess with it more later.

Edit: No idea. I've tried a lot of things. The end result is that this computer just doesn't like going fullscreen with the "no change screen resolution" option checked. Either it doesn't work, or it does so after a few second delay, but then the game lags noticeably. This CPU has double the benchmarks of my other one, so it shouldn't be, and I know even its single-threaded abilities are superior because it can play Marine Benefit and the other one can't. But if I want to play fullscreen, I have to uncheck that, causing the game to not fill the screen vertically. Oh well I guess? Can't figure out why or any way around it.
Title: Re: Neko Project II fmgen and PC-98 Touhou (guide now included)
Post by: ZekeSulastin on December 28, 2012, 10:49:26 PM
What video card do you have?  (Also, are you using the most recent drivers for said video card)
Title: Re: Neko Project II fmgen and PC-98 Touhou (guide now included)
Post by: Goldom on February 05, 2013, 11:22:02 PM
Well this is a bit late reply. But the laptop has a 675M, but it does the same thing whether I force the game to run on the GPU or let Optimus run it on the Intel HD instead. Drivers... are latest certified by the laptop mfgr. Not the latest per Nvidia's site, but I once tried to update from the stock drivers and it messed up some of the laptop's built in stuff, as laptops are want to do, so that's out.
Title: Re: Neko Project II fmgen and PC-98 Touhou (guide now included)
Post by: NintendoNaut on February 13, 2013, 09:34:15 PM
I have NPII running fine on Mountain Lion, but I can't get save states to work no matter what I do. I've tried adding "SAVESTAT=1" into the .ini file but no "stat" drop-down appears.
Title: Re: Neko Project II fmgen and PC-98 Touhou (guide now included)
Post by: Arcorann on February 14, 2013, 02:20:56 AM
Where in the file have you put the line? Ensure that it is within the section labelled [NekoProject21].
Title: Re: Neko Project II fmgen and PC-98 Touhou (guide now included)
Post by: NintendoNaut on February 14, 2013, 10:38:54 PM
(http://i.imgur.com/V8DKIZY.png)

Here's a cap.
Title: Re: Neko Project II fmgen and PC-98 Touhou (guide now included)
Post by: Arcorann on February 14, 2013, 11:04:11 PM
Ah, I made a mistake in the guide. It should be STATSAVE=true. Sorry about that.
Title: Re: Neko Project II fmgen and PC-98 Touhou (guide now included)
Post by: NintendoNaut on February 16, 2013, 08:55:13 PM
Hey thanks! Working now! Great guide by the way--It was a huge help.
Title: Re: Neko Project II fmgen and PC-98 Touhou (guide now included)
Post by: oboewan on May 27, 2013, 01:38:21 AM
Here's some info that may be of use to anyone wishing to play these games:

1. To enable multi-threading (which may or may not help or hinder performance), open up the INI and add the line:
ENHANCED=b00000000000100
to the [NekoProject21] section.

2. If the game seems to stutter slightly, and isn't quite running at 60FPS even though your CPU's not being pegged, this is normal; the PC98 had a native refresh rate of 56.4Hz rather than the 60Hz of nearly all PC displays of today. If by some chance you have a monitor that can display a 56.4Hz signal (mine can't), you can try setting your refresh rate accordingly (you may need to dive deep into your graphics card's settings); otherwise, you're out of luck. I'm pretty sure that Anex and Next get around this by speeding up the game by around 6%, bringing it up to 60Hz.

Title: Re: Neko Project II fmgen and PC-98 Touhou (guide now included)
Post by: [K]KoaMeow on February 25, 2015, 05:39:40 AM
Had to bump this thread because I have problems with the emulator. So far, following the thread did make the games work, but for some odd reason even after setting the CPUSPEED to 2000, the music is oddly lagging and the game remains at the same pace if I were to set CPU Speed to 800%. Any ways to fix this?

As an added plus, it appears the PC98 port of Doom and Doom II works in this emulator, although it suffers from the sound lag problem like the other Touhou games, and I have no idea why, but they still have this weird beeping noises when playing either two. PC98 Wolfenstein 3D on the emulator outright crashed NekoProject II, however.

(http://i.imgur.com/0gec1WC.png)
Title: Re: Neko Project II fmgen and PC-98 Touhou (guide now included)
Post by: Romantique Tp on February 25, 2015, 05:54:29 AM
Emulate > Configure then change the sound buffer. Don't set this too low if you don't have an USB or PCI audio card, something between 17 and 70ms should be good enough. 17ms is about 1 frame of delay in a game that runs at 60 FPS.
Title: Re: Neko Project II fmgen and PC-98 Touhou (guide now included)
Post by: [K]KoaMeow on February 25, 2015, 06:12:55 AM
Yeah, that did the trick on the lag, but the sounds are still playing slowly.
Title: Re: Neko Project II fmgen and PC-98 Touhou (guide now included)
Post by: Arcorann on May 22, 2015, 01:38:45 PM
Posting to remind myself that official v0.84 has been released, and that the thread with updates to fmgen is here (http://jbbs.shitaraba.net/bbs/read.cgi/computer/43774/1368531133/). OP will be edited soon.

While I'm at it, I'll point out that this:
I'm pretty sure that Anex and Next get around this by speeding up the game by around 6%, bringing it up to 60Hz.
is wrong, at least w.r.t. external emulator speed - I checked a while back.

@Koa: (I know this is a bit late, but) Turn on the CPU speed and framerate displays on the title bar, and see whether it's running more slowly than your settings.

Title: Re: Neko Project II fmgen and PC-98 Touhou (guide now included)
Post by: Silent Harmony on May 30, 2015, 01:53:06 AM
EDIT: Sorry for any inconvenience, I ended up just buying xpadder.
Title: Re: Neko Project II fmgen and PC-98 Touhou (guide now included)
Post by: Totalheartsboy on December 10, 2015, 05:23:11 AM
Um i have a minor problem, i want to change the keyboard keys for the Touhous game, for example instead of using the arrows i want to use the numpads(since my arrow keyboards are not working).

And in the page mentioned in the main post doesn't mention how to change the key function. So someone can gimme an explanation?
Title: Re: Neko Project II fmgen and PC-98 Touhou (guide now included)
Post by: shockdude on May 19, 2017, 08:21:30 PM
I recently set up Neko Project II the other day. Great guide btw,
Some notes:
1. The YM2608 samples link is down. I had to get the samples from here (http://nfggames.com/pc98/Uploads/) instead.
2. PC-98 games were meant to be displayed with a 4:3 aspect ratio, not the widescreen 16:10 that NP2 uses by default. For the most accurate display, switch to a 4:3 resolution (I use a custom 1440x1080 resolution, but 1024x768/1280x960 also works), go to Screen > Screen option > FullScreen, check "No change screen resolution", set Zoom = Full, and click OK. I also enabled Screen > Stretch Filter to smooth out the pixels. Enter fullscreen. Chubby character portraits be gone!
3. F12 toggles mouse emulation, which also hides the mouse cursor in fullscreen.
4. On my PC, I was able to use an 80ms audio buffer instead of 100ms.

Also I use AutoHotkey (https://autohotkey.com/) to remap controls, as I do for all Touhou games.
Title: Re: Neko Project II fmgen and PC-98 Touhou (guide now included)
Post by: DeityDiz93 on May 23, 2017, 09:31:41 AM
Out of curiosity, where do you set all these custom options you've set for your emulator? I know about the trick of clicking the icon/hitting the right arrow while in the Emulate options for window specific settings; however, none of the resolution suggestions you put here are available by default, so what do you do to change the resolution?

Also, Stretch Filter did not work for me on Fullscreen, but personally I don't enable it anyway because I prefer the unaltered pixels. At the very least I could use 80ms audio buffer as well, but I'm not sure how changing that is significant. Anyway, while I already had the samples before the link went dead, thank you for providing a place for others to get them. ^^
Title: Re: Neko Project II fmgen and PC-98 Touhou (guide now included)
Post by: shockdude on May 24, 2017, 01:04:09 AM
Out of curiosity, where do you set all these custom options you've set for your emulator? I know about the trick of clicking the icon/hitting the right arrow while in the Emulate options for window specific settings; however, none of the resolution suggestions you put here are available by default, so what do you do to change the resolution?

Also, Stretch Filter did not work for me on Fullscreen, but personally I don't enable it anyway because I prefer the unaltered pixels. At the very least I could use 80ms audio buffer as well, but I'm not sure how changing that is significant. Anyway, while I already had the samples before the link went dead, thank you for providing a place for others to get them. ^^
The lower your audio buffer, the less audio lag (delay between when you do something and the sound effect plays). Too low of a buffer will cause audio crackling and general instability.

By "change resolution", I mean literally change your entire computer's desktop resolution to a 4:3 resolution (e.g. 1024x768, 1280x960).
Modern graphics drivers should let you easily create and use custom resolutions like 1440x1080. Directions should be readily available on Google.

Stretch filter doesn't do anything unless you set "No change screen resolution" in Screen > Screen Option > Fullscreen. Also set Zoom to "Full" so that the game properly fills the screen.
(https://abload.de/img/screenoption02a6u.png)

Here's what PoDD's menu looks like at 1024x768, stretch filter on.
(https://abload.de/img/poddfilterk1ld6.png)

Stretch filter off.
(https://abload.de/img/poddfullw0x71.png)

For comparison, PoDD at 1366x768 (Zoom set to Adjust Aspect to maintain the 16:10 aspect ratio), stretch filter on. Note the stretching in the kanji, the copyright text, and Reimu's head/body.
(https://abload.de/img/poddstretcho9zw1.png)
Title: Re: Neko Project II fmgen and PC-98 Touhou (guide now included)
Post by: DeityDiz93 on May 24, 2017, 01:54:17 PM
Ah, thank you very much for the clarification! In that case my setup is working well for me, I got a resolution that indeed works with my current monitor without any of the visual issues you demonstrated. ^^

Unfortunately, even with the setup you showed for fullscreen, I still could not get Neko Project II to work with the stretch filter on in fullscreen mode, it even crashed at times when trying to enable it, but most of the times it just left me with a black screen, but the stretch filter works just fine in windowed mode. Perhaps there is a specific .exe I should be using as my current one is the np21nt.exe as apposed to the others, but at the same time I much prefer having the stretch filter off anyway, so I'm in no rush to use it. ^^;

Hopefully this helps others though as I ultimately prefer the use of Neko Project II and T98-Next. I'm quite thankful for these setup guides.
Title: Re: Neko Project II fmgen and PC-98 Touhou (guide now included)
Post by: Silent Sinner in Scarlet on July 03, 2019, 10:58:05 PM
Installation
* Download the emulator. There are a few versions that are good for playing Touhou:
** The fmgen version is recommended for general use. This link should guarantee that you have the latest build. (http://nenecchi.html.xdomain.jp/) Select the first entry in the list labelled np2fmgen.7z.
*** As of 2017-10-12 the latest version is the 2017-10-11 build (http://nenecchi.html.xdomain.jp/171010/np2fmgen.7z).
Those links above now return me a 403 Forbidden Access error, thus preventing me from getting np2fmgen. Any alternative links for the latest fmgen build (other than that ridiculously-humongous 2+GB MEGA.NZ upload that has been circulating through Discord)?