
4D Sports Boxing
Port nativo de 4D Sports Boxing para PC.
4D Sports Boxing
Port nativo basado en toolassisted-run/open4dboxing.
README del repositorio
Open4DBoxing
Open4DBoxing is an unofficial reconstruction of 4D Sports Boxing (Distinctive Software, DOS, 1991).
It is written in C and rebuilt from the original program, the way SDLPoP2 was for Prince of Persia 2 and OpenSamurai for Sword of the Samurai. It plays the original game's data files, so you need your own copy of the game.
State
All four programs of the game (4DBMCGA.EXE for the MCGA/VGA, 4DBEGA.EXE, 4DBCGA.EXE and 4DBTDY.EXE for the
EGA, the CGA and the Tandy 1000) and its five sound drivers are recompiled whole from their machine code into C, on a
runtime that gives them the machine they expect: DOS, the BIOS, the timer chip, the video cards (the VGA's 256
colours, the EGA's planes and latches, the CGA with its wait states, the Tandy's 16 colours) with their timing, the
sound cards, the mouse driver, the game port. The MCGA build is the default; the others are a setting. Checked
against the real game running in DOSBox-X as each machine: the intros and the titles are pixel-identical (a few
frames of a dissolve apart on the EGA and the Tandy), and so is the MCGA build's path through the boxer selection and
the manual's question to the ring (the boxers' animation in the fight differs by its phase, which is being looked at).
F4 opens the in-game menu of the sister projects (settings, cheats, quit); its settings are kept in
Open4DBoxing.cfg next to the program, the defaults in Open4DBoxing.ini.
See docs/FINDINGS.md for what is known about the original program.
How to play
- Download the build for your system from the latest development build:
open4dboxing-windows-x86_64-….ziporopen4dboxing-linux-x86_64-….tar.gz, and unpack it into a folder of its own. - Put the images of the game's two floppies,
disk1.imganddisk2.img, in itsromsfolder (or next to the program). See Getting the game. - Start
open4dboxing.exe(Windows) or./open4dboxing(Linux).
The game's files are read from the images, which are never written: what the game saves (the boxers made in the Gym,
the Hall of Fame, a Main Event saved from the system panel, the panel's defaults) goes to the save folder next to
the program. From a terminal:
open4dboxing [GAMEDIR [ARGS]]
GAMEDIR is a folder with disk1.img and disk2.img, or with the floppies' files copied out of them (the game then
saves there, as the original did). ARGS are the game's own, as BOX.BAT passes them: n pc15.drv d (the default: the PC speaker). The sound driver
can be pc15.drv (PC speaker), ad15.drv (AdLib), sb15.drv (Sound Blaster: FM music and the digitised announcer
and crowd), td15.drv (Tandy) or mt15.drv (Roland MT-32, emulated by Munt; it needs the MT-32's ROMs, see below). Alt+Enter
toggles full screen.
The game asks the manual's question (a boxer's name for a face) before a fight, as the original does; keep the manual at hand.
The MT-32's ROMs
The Roland MT-32 needs its two ROMs, a control ROM and a PCM ROM. They are Roland's and not included, so you provide your own. Put the two files (any names: they are recognized by their contents) in one of these folders, looked at in this order:
- the folder named by the
OPEN4DBOXING_MT32ROMSenvironment variable; - the folder
mt32_romsinOpen4DBoxing.ininames; - the
romsfolder next to the program (where the game's disks go too); - the program's folder.
An original MT-32's ROMs (versions 1.04 to 1.07) are the sound the game was made for; a later MT-32's or a CM-32L's
work too. Without them the sound setting mt32 plays the Sound Blaster's sound and says where it looked.
Screenshots
Keys
The original game's: the menus take the mouse (and Enter on the title's EXHIBITION). In the ring, any key starts the round; the blue boxer's control device is set in the game's GAME OPTIONS panel (reached from the ring's CONTROLS panel). The default is the keyboard's second set: the numeric keypad moves (8 forward, 2 back, 4 and 6 sideways, the corners diagonally), Enter and the right Shift are the two punch buttons, a button with a direction a punch of that kind. The first set is the same on Q W E / A D / Z X C with Tab and the left Shift.
A joystick or game controller plugged in is the game's first joystick: choose it for a boxer in GAME OPTIONS (the title's OPTIONS) and calibrate it there, as the original asks. The game punches with the joystick's second button and uses the first for the other action; a controller's left stick or D-pad moves, its A punches and its B is the first button.
Open4DBoxing adds F4 (the menu: the sound driver and its volume, the video card's build, the window, the cheats) and Alt+Enter (full screen).
The cheats, in the terms of the three bars under your boxer's name in the fight (D its health, P its stamina, O its endurance): Invulnerable (the opponent's punches land but take nothing from you, neither D nor, when you block, P; you are never floored), Untouchable (the opponent's punches never reach you), Inexhaustible (your punches cost you nothing: P and O stay as they were) and One-punch knockouts (any punch of yours that lands floors the opponent). Invulnerable or Untouchable with Inexhaustible keep the three bars full. The cheats change nothing while off, none of them answers the manual's question for you, and they act on the MCGA build only.
The cosmetic camera (a setting, off by default) shows the ring's cameras (F1-F10, but F4) without the game seeing their keys. In the original, a camera key changes the fight: a view takes its own time to draw, and the game's fight reads a value its drawing leaves behind. With the setting on, the game always runs with its own camera, and a second copy of it, given the game's fight at every frame and the camera keys alone, draws what is shown. A fight recorded without the cameras plays the same with them (the MCGA build only).
Building
Open4DBoxing builds with meson. The MT-32 is Munt's
libmt32emu, a git submodule built with CMake (git submodule update --init; without it, or with -Dmt32=disabled,
the program is built without the MT-32):
meson setup build
meson compile -C build
meson test -C build
The frontend needs SDL2 (the system's, or built in from extern/sdl2.wrap). The tests that compare the game with
DOSBox-X's captures are registered with -DgameDir=... -DoracleDir=... (the captures are made with the oracle in the
workspace, outside this repository).
Where things are
| Path | What |
|---|---|
source/box_core.c | the game, recompiled from 4DBMCGA.EXE's machine code (generated; the recompiler lives in the analysis workspace) |
source/drv_pc15.c | the PC speaker driver, recompiled from PC15.DRV |
source/asm2c.h, asm2c.c | the emulated 8086 the recompiled code runs on: registers, flags, memory, interrupts, ports |
source/game.c | the game as DOS runs it: the program loaded at its original segments, the clock, the keys, the frames |
source/dos.c, dosmem.c, exe.c, pit.c | DOS's files and memory, the executable loader (it unpacks EXEPACK's and PKLITE's), the timer chip |
source/disks.c | the game's two floppies' images: their FAT12 file systems read into memory for DOS |
frontend/main.c | the SDL2 window: screen, keyboard, mouse, sound |
tests/boxrun.c | the game headless on a script of inputs and screenshots (the oracle's formats) |
tests/oracle/*.plan, tests/oracletest.sh | the scenarios compared with DOSBox-X's captures |
tools/unpklite.py | unpacks the PKLITE-compressed original executables into files (for analysis; source/exe.c unpacks them the same way as it loads them) |
tools/mkscript.py | a scenario plan into the runner's or the oracle's script |
tests/replay/*.plan, tests/replaycheck.sh, source/replay.c | the lockstep scenarios, their runner, the replay of the oracle's log |
tools/ramcmp.py, tools/vramcmp.py, tools/fightinput.py | the memory and video comparisons, the scenarios' pseudo-random fighters |
tests/callcheck.sh | a lockstep scenario with the memory compared after every BIOS and DOS call as well |
tools/planfor.py, tools/coverage.py | a scenario for the EGA, CGA or Tandy build; how much of each program the replays ran |
docs/FINDINGS.md | everything found about the original program |
Tests
meson test -C build runs the unit tests. With -DgameDir=DIR -DoracleDir=DIR (DIR the game's: its two floppies'
images, or their files) the scenarios in tests/oracle run
the game headless and compare every screenshot with DOSBox-X's capture of the real game at the same frame
(tests/oracletest.sh); both scenarios there (the intro, and the way to a fight through the boxer selection and the
manual's question) are identical pixel for pixel.
The lockstep check goes further: with -Dreplay=true -DgameDir=DIR -DoracleRun=PATH -DoracleHdd=PATH (DOSBox-X's
oracle-run from chimera-core-dosbox-x and a disk with
the game in C:\BOXU), each scenario of tests/replay (tests/replaycheck.sh) is played by the oracle, which logs
every interrupt, port read, BIOS and DOS call and frame end at the program's instruction count, and replayed by
tests/boxreplay on that log: the reconstruction runs the same instructions, and its memory and video memory are
compared with the real game's at every checked frame; tests/callcheck.sh compares the memory right after every
BIOS and DOS call as well. The 34 scenarios (the DEMO's ten rounds, human fights with one and two players and the
joystick, knockdowns and a technical knockout, the fight's panels, every option, the Gym, the Main Event, the copy
protection's wrong answers, the ways out; the EGA, CGA and Tandy builds through the DEMO, a human fight, the panels,
the options, the Gym and the Main Event; the AdLib, Sound Blaster and MT-32 drivers) run in lockstep to their ends,
427 billion instructions, with the memory and the video memory identical at all 113,831 comparisons;
docs/FINDINGS.md lists what the checks found and how much of each program they ran.
License
Open4DBoxing is free software under the GPL-3.0-or-later (see LICENSE). It is an unofficial project, not affiliated with Distinctive Software, Mindscape or Electronic Arts. It contains no game data: you need your own copy of 4D Sports Boxing. The copy protection (the manual's question) is kept as it was.
Credits
- 4D Sports Boxing: Distinctive Software Inc. (Jay MacDonald, Chris Taylor, Rick Friesen and the rest of the team the credits name), published by Mindscape and Electronic Arts.
- The method and the runtime's pieces come from OpenSamurai and SDLPoP2.
- Munt, by the Munt team (LGPL-2.1-or-later), emulates the Roland MT-32.
- The game's data formats are those of Stunts / 4D Sports Driving, documented by the Stunts community (wiki.stunts.hu); dstien's stunpack unpacks them.
- The real game ran in DOSBox-X for every comparison.
Getting the game
4D Sports Boxing is not sold any more; it came on two 720 KB floppies. Open4DBoxing reads the floppies' images,
disk1.img and disk2.img, and was checked with these:
| File | Size | SHA1 |
|---|---|---|
disk1.img | 737,280 bytes | 5b324abec67baa90a44c04bb9cc82ba50f4fb962 |
disk2.img | 737,280 bytes | c63aa4787b3a7860ec07b171ad3b47da1a41e58e |
sha1sum disk1.img disk2.img (Linux) or certutil -hashfile disk1.img SHA1 (Windows) shows an image's SHA1. The
game's programs on the floppies are PKLITE-packed; Open4DBoxing unpacks them as it loads them, as their own start-up
code would.
Comentarios (0)
Inicia sesión para dejar un comentario.
Sé el primero en comentar sobre este juego.
