dsync89 / neokobe-retro-japanese-computer-collection-set-ahk-gen-toolkit

Scripts to generate one-click playable AHK script for Neo Kobe collection set from archive.org
2 stars 0 forks source link

Neo Kobe Japanese Retro Computer Collection AHK Gen Toolkit

Update (2023-Dec-24): This repo used to generate AHK for just NEC PC-9801, I then refactored it to also generate for other Neo Kobe sets.

This toolkit generate a one-click AHK files to run various Neo Kobe Collections from archive.org. It is recommended to consolidate the Neo Kobe set using the DAT that I created in dat\1g1r\ using your favorite rom manager like RomUltra (my personal favorite), RomCenter, or clrmamepro among the others.

Currently supporting the following Neo Kobe collection set:

Motivation

Many multi-disks game, or even multi-media types games require a certain type of boot media or boot order to setup in the emulator to properly boot. This makes it a pain when you are trying to pick a random game from such a huge library collection.

The ideal way to run this game is then to have a one-click way to run. As such, I've written scripts here that generate AHK (v2) files per game title which will lookup the right media type and boot order to launch for each game. Read How the boot media type is decided for the game for more details.

Not only that these AHK files can be running independently of any frontend or launcher, you can even import them to your favorite frontends like Launchbox or RocketLauncher. Just set the emulator to AHK v2 launcher!

Quick Setup

  1. Extract downloaded zip files from Neo Kobe - NEC PC-9801 (2017-11-17) set while preserving the folder structure. DO NOT FLATTEN THE FOLDER STRUCTURE!

  2. Organize the extracted sets using RomManager so that the folder is in Game Title tree hierarchy, instead of per publisher. Use the DAT from dat/1g1r to create a 1G1R Set.

  3. Modify config.json for the following fields:

    romdir
    enable

Setting enable: true will process the set

  1. Modify the EmuPath in templates/<platform>/.config.ini that the AHK script will find the emulator to run the game for that platform.

  2. Run run.py.

The batch script will call the following python scripts:

  1. gen_gamedb.py: Generate a .gamedb.txt file which contains all the boot source media types for each game titles.
  2. gen_gamedb_with_overrides.py: Override .gamedb.txt with the entry in gamedb/gamedb_overwrite.txt to override the default boot order.
  3. gen_ahk_files.py: Generate AHK files for each game to run it.
  4. add_keymapper_to_ahk.py: Apply global keymap from keymapping\<media_type>\global.ahk and game specific keymap from the same folder to each game AHK script generated by gen_ahk_files.py.

Features

  1. AHK file for each game title that you can simply double click to play the game, without having to use any front end such as LaunchBox or RocketLauncher. You can also easily integrate these AHK files to LB by simply importing the .ahk files, then configure them to launch these files using AutoHotKey program.
  2. User defined keybindings per game to the game AHK files

There exist other method that only has a single AHK file which will use the rom file as input, such as this AHK script written by a LaunchBox forum member @xiron here . But I still decided to generate AHK files individually for each game title to make it easier to use, and to decouple with other front end launcher.


Media Type Supported by AHK Script

Notes:

Platform CT FD HD CD Emulator Rom Extensions Notes
NEC - PC-8801 X O N/A O pc8801ma .ccd, .d88, .t88 CT not supported in emulator. The only CD game 'Mirror' failed to load even after specify FD.
NEC - PC-9801 N/A O O O np21w .ccd, .d88, .hdi, .hdm, .nfd
Sharp - X1 O O N/A N/A x1twin .2d, .d88, .tap
Sharp - X68000 N/A O O X xm6g .d88, .hdf, .hdm CD load is disable in emulator, so no way to run it

FAQ

How AHK script works?

The script first find a matching row for the game in .gamedb.txt. If the match is found by game title (first element of |, it will parse the boot sources and categorize them according to their file extension. E.g. .hdm will be categorized as HDM, .ccd as CCD, and .hdi as HD.

For AHK scripts in FD media type, passing the argument is very straightforward since np2w.exe support passing FDD files as argument

AHK script in HD and CD media type is a bit tricky as the emulator doesn't support argument passing for HDI and CCD files, so the script will copy the np2w.ini file from the emulator folder, then make a copy of it and named it as np2w_lb.ini, then replace HDD1FILE= with the detected HDD file, and CD3_FILE= line with the detected CCD file. The FDD files is still passed as argument.

Update: AHKv1 scripts are now updated to AHKv2 to fix an issue where the emulator would not show up but the script is actually running when launching AHKv1 script via the command line (e.g. Launchbox). Strangely double clicking on AHKv1 script will run the emulator just fine. It's still better to use v2 for various reasons though, so here it is!

How do you select which media type to keep for a title?

For a game that has multiple media type, i.e. FD, HD, and CD:

To make these selection systematic and easy to manage, I manually created a Retool 1G1R Clonelist in dat/retool-clonelist to tell Retool which titles to select for each game. I manually created the clonelist and to make sure the game, especially CD game titles can run properly.

How the boot media type is decided for the game?

The AHK script will first find the boot media type for each game. It does this by looking up the matching game title in a row in .gamedb file at the root of the media type folder. Each row in .gamedb.txt consist of Game Title | boot source 1 | boot source 2 | ... Some game title require media type to be inserted in a certain order, espeically for FD game where FDD1 is usually the boot disk, and FDD2 is the data disk. So some manual entry is still needed. I welcome user contribution to modify this .gamedb.txt file if you find the boot source need to be swapped.


Contribution

Contribution are welcomed in two aspects.

Game Boot Order

Since the total games is vast and I only randomly test some titles, there bound to be some game titles requiring modified boot source. If you find any games require manual overwrite, submit a pull request for the gamedb\overwrite.txt file.

Keymap

Add any game specific keymapping to keymapping\<media_type>\<game_folder>. For example, to add a game mapping for HD game Rusty, create Rusty.ahk under keymapping\hd\. Any ahk files read here will then be appended by the add_keymapper_to_ahk script.


Credits

Huge credits goes to the following heroes to make this possible:

@kobushi from http://fullmotionvideo.free.fr/phpBB3/viewtopic.php?f=6&t=1621 for consolidating and sharing this amazing romset!

1G1R DAT is generated using Retool https://github.com/unexpectedpanda/retool.

DAT is generated using clrmamepro dir2dat against Neo Kobe set.