Skip to content

Instantly share code, notes, and snippets.

@bitgamma
Created August 29, 2022 17:54
Show Gist options
  • Save bitgamma/acb3001732ba722feb4bc0539941e133 to your computer and use it in GitHub Desktop.
Save bitgamma/acb3001732ba722feb4bc0539941e133 to your computer and use it in GitHub Desktop.
AutoHotKey Launcher for Neko Project 21/w
; This script is meant to be used with Neko Project 21/w (64-bit) together with LaunchBox
; and software from the Neo Kobe collection.
;
; Place this script (or compiled exe) in the same folder as the emulator itself and
; import the hdi files in LaunchBox (or hdm for games that don't have a hd).
;
; Configure LaunchBox to use this script as the emulator and leave the default command
; line.
;
; For CD games and/or games with a boot floppy, place all related file, all with the same
; name except for the extension in the same folder as the hdi/hdm file
;
; For games requiring GDC set to 2.5mhz, create an empty file with the same name as the
; hdi file but with the .25 extension
;
; For example, you would have in the same folder Policenauts.hdi, Policenauts.hdm,
; Policenauts.ccd, Policenauts.img, Policenauts.sub and Policenauts.25
;
; The script will automatically edit the .ini file and start the game, allowing you
; seamless interaction with LaunchBox/BigBox.
ROMPath = %1%
SplitPath, ROMPath,, ROMDir,, ROMName
ROMBase := ROMDir . "\" . ROMName
If FileExist(ROMBase . ".hdi")
HDI := ROMBase . ".hdi"
If FileExist(ROMBase . ".ccd")
CCD := ROMBase . ".ccd"
If FileExist(ROMBase . ".hdm")
FDD := ROMBase . ".hdm"
If FileExist(ROMBase . ".25")
GDC := "f3"
Else
GDC := "73"
IniPath := A_ScriptDir . "\np21x64w_lb.ini"
OrigIniPath := A_ScriptDir . "\np21x64w.ini"
FileRead, Ini, %OrigIniPath%
TmpIni := FileOpen(IniPath, "w")
Loop, parse, Ini, `n, `r
{
If InStr(A_LoopField, "HDD1FILE")
TmpIni.WriteLine("HDD1FILE=" . HDI)
Else If InStr(A_LoopField, "CD3_FILE")
TmpIni.WriteLine("CD3_FILE=" . CCD)
Else If InStr(A_LoopField, "FDD1FILE")
TmpIni.WriteLine("FDD1FILE=")
Else If InStr(A_LoopField, "FD1NAME0")
TmpIni.WriteLine("FD1NAME0=")
Else If InStr(A_LoopField, "DIPswtch")
TmpIni.WriteLine("DIPswtch=3e " . GDC . " 7b")
Else If (A_LoopField = "")
Continue
Else
TmpIni.WriteLine(A_LoopField)
}
TmpIni.Close()
RunWait, %A_ScriptDir%\np21x64w.exe /f /i "%IniPath%" "%FDD%", A_ScriptDir
FileMove, %IniPath%, %OrigIniPath%, 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment