-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ea759e7
commit 5c8a0b9
Showing
9 changed files
with
3,383 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,53 @@ | ||
# UnifiedMT15 | ||
Reverse engineered and C ported 'MT15.DRV' (MT32-Sound-Driver) of Stunts 1.0 and 1.1 in one source | ||
|
||
Reverse engineered and C ported **MT15.DRV** (MT32-Sound-Driver) of [Stunts](https://www.mobygames.com/game/stunts) 1.0 and 1.1 in one source | ||
|
||
Assembler source can be rebuild to 100% binary exact version of the original | ||
Assembler can be partially mixed with C ported functions or all functions can be replaced by C code | ||
|
||
# History: | ||
|
||
Stunts 1.0 MT15.DRV seems to sound better than the 1.1 version (some strange slowdowns happen) | ||
i want to understand what the differences are and how to port that stuff to C | ||
|
||
**Result**: the timing code is different - only some lines of assembler nothing big | ||
|
||
# Structure: | ||
|
||
| File | Info | | ||
| :---------------- | :----------------------------------------------------------------------------------------------------------------------- | | ||
| \org | original driver versions - the pure assembler source builds gets validated agains these files (100% binary exact result) | | ||
| build.cmd | main buid batch | | ||
| build_helper.cmd | to keep the build options under control (original asm, asm with partial C, mostly C, ...) **tools_dir variable in build_helper.cmd needs to be set to suits your environment** | | ||
| clang_test.cmd | using clang/clang-tidy for building (just to find silly bugs in the C port) | | ||
| drv.c | the ported C code | | ||
| MT15.asm | reversed assembler code with version 1.0/1.1, jumper for C ported functions | | ||
| tools_howto.txt | how to get the needed build tools (UASM, ulink, OpenWatcom) very easy to install | | ||
|
||
**tools_dir variable in build_helper.cmd needs to be set to suits your environment** | ||
|
||
build.cmd will create a ..\_build folder (out of source build) with subfolder 10 and 11 for the different versions | ||
|
||
# TODO | ||
|
||
merge MT15.drv versions of other [Distinctive Software, Inc.](https://www.mobygames.com/company/distinctive-software-inc) games | ||
|
||
| Game | Date | Size | MD5 | Info | | ||
| :----- | :--- | :--- | :--- | :--- | | ||
| Stunts 1.0 | 11.10.1990 | 1667 | 7048D28F2A0FE8C8C09141D5C89706DB | UnifiedMT15 | | ||
| 4D Sports Boxing 1.0 | 05.10.1990 | 1667 | 7048D28F2A0FE8C8C09141D5C89706DB | | | ||
| Bill Elliotts Nascar Challenge | ~1991 | 1667 | 7048D28F2A0FE8C8C09141D5C89706DB | | | ||
| Stunts 1.1 | ~1991 | 1750 | ACC5D03D038F1EF0AFA0CF4DCAD72EF9 | UnifiedMT15 | | ||
| 4D Sports Boxing 1.1 | 22.04.1991 | 1788 | B17BBC19ED37C9413DD68E20D4D9848F | | | ||
| Mission Impossible | 22.04.1991 | 1788 | B17BBC19ED37C9413DD68E20D4D9848F | | | ||
| World Tour Tennis | ~1993 | 1789 | 53F6BCAEBC097893868C69CE994A3321 | | | ||
| 4D Sports Tennis | 03.03.1992 | 1789 | 53F6BCAEBC097893868C69CE994A3321 | | | ||
| Michael Jordan in Flight | 21.12.1992 | 1813 | 372ED87FEE4FB0762D2531DC8BB34337 | | | ||
| The Simpsons: Barts House of Weirdness | ~1991 | 1982 | 8326A348DCC756EEB77466AD53F742EA | | | ||
| Top Gun Danger Zone | ? | ? | ? | | | ||
| NFL | ? | ? | ? | | | ||
|
||
and more | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
::@echo off | ||
|
||
:: originals - should always build | ||
call build_helper.cmd 10 1 0 0 | ||
call build_helper.cmd 11 1 0 0 | ||
|
||
:: c port stuff | ||
call build_helper.cmd 10 0 0 1 | ||
call build_helper.cmd 11 0 0 1 | ||
|
||
pause |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
@echo off | ||
|
||
if "%~1" == "" goto error | ||
if "%~2" == "" goto error | ||
if "%~3" == "" goto error | ||
if "%~4" == "" goto error | ||
|
||
rem source folder | ||
set src_dir=%~dp0 | ||
rem out of source build folder | ||
set build_dir=%~dp0\..\_build | ||
mkdir %build_dir% | ||
|
||
set tools_dir=f:\projects\fun\dos_games_rev\tools | ||
|
||
set ulink_exe=%tools_dir%\ulink\ulink.exe | ||
set uasm_exe=%tools_dir%\uasm_x64\uasm64.exe | ||
|
||
set WATCOM=%tools_dir%\open-watcom-2_0-c-win-x64 | ||
set WATCOM_BIN=%watcom%\binnt64 | ||
set INCLUDE=%watcom%\h | ||
set PATH=%WATCOM_BIN%;%PATH% | ||
set wcc_exe=%watcom_bin%\wcc.exe | ||
|
||
:: 10 or 11 | ||
set drv_version=%1 | ||
set equal_binary=%2 | ||
set remove_dead_code=%3 | ||
set replace_with_c_code=%4 | ||
|
||
set output_dir=%build_dir%\%drv_version% | ||
echo output_dir: %output_dir% | ||
|
||
mkdir %output_dir% | ||
pushd %output_dir% | ||
|
||
set src_dir=%~dp0 | ||
|
||
%uasm_exe% -DVERSION=%drv_version% -DEQUAL_BINARY=%equal_binary% -DREMOVE_DEAD_CODE=%remove_dead_code% -DREPLACE_WITH_C_CODE=%replace_with_c_code% %src_dir%\MT15.asm | ||
|
||
pause | ||
|
||
if "%replace_with_c_code%" NEQ "1" goto link_asm_only | ||
|
||
rem -2 only 286 code | ||
rem -zl and -zls no standard-lib dependencie and unused symbols removed from obj | ||
rem -s Removes stack check | ||
|
||
:: optimization flags: http://www.x-hacker.org/ng/wcppug/ng43372.html | ||
:: The recommended options for generating the fastest 16-bit Intel code are | ||
:: for 286: /oneatx /oh /oi+ /ei /zp8 /2 /fpi87 /fp2 | ||
|
||
%wcc_exe% %src_dir%\drv.c -2 -zl -zls -s -DVERSION=%drv_version% | ||
|
||
pause | ||
|
||
set asm_obj_file=%output_dir%\MT15.obj | ||
set cpp_obj_file=%output_dir%\drv.obj | ||
set drv_file=%output_dir%\MT15.drv | ||
set map_file=%output_dir%\MT15.map | ||
echo obj_file: %obj_file% | ||
echo drv_file: %drv_file% | ||
echo map_file: %map_file% | ||
%ulink_exe% -T16 -Tbi %asm_obj_file% %cpp_obj_file%, %drv_file%, %map_file% | ||
|
||
pause | ||
|
||
goto compare | ||
|
||
:link_asm_only | ||
|
||
set obj_file=%output_dir%\MT15.obj | ||
set drv_file=%output_dir%\MT15.drv | ||
set map_file=%output_dir%\MT15.map | ||
echo obj_file: %obj_file% | ||
echo drv_file: %drv_file% | ||
echo map_file: %map_file% | ||
%ulink_exe% -T16 -Tbi %obj_file%, %drv_file%, %map_file% | ||
|
||
pause | ||
|
||
:compare | ||
|
||
popd | ||
|
||
if "%equal_binary%" NEQ "1" goto success | ||
|
||
echo ------ | ||
echo check if result is still binary equal to orginal driver | ||
echo ------ | ||
|
||
set org_dir=%src_dir%\org | ||
echo org_dir: %org_dir% | ||
|
||
fc /B %org_dir%\%drv_version%\MT15.drv %output_dir%\MT15.drv | ||
if %ERRORLEVEL% == 0 goto success | ||
echo !!!! | ||
echo !!!! Resulting DRV is not binary identical to original !!! | ||
echo !!!! | ||
|
||
goto error | ||
|
||
:success | ||
exit /b 0 | ||
|
||
:error | ||
echo first parameter needs to be the driver version: 10 for stunts 1.0, 11 for stunts 1.1 | ||
pause | ||
exit /b 1 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
@echo off | ||
|
||
::just use clangs better error/warning detection to find bugs, the resulting obj file is of no use | ||
|
||
set llvm_bin="C:\Program Files\LLVM\bin" | ||
set clang_exe=%llvm_bin%\clang.exe | ||
set clang_tidy_exe=%llvm_bin%\clang-tidy.exe | ||
|
||
echo =================================================== | ||
|
||
%clang_exe% -c -m32 -pedantic drv.c | ||
pause | ||
|
||
echo =================================================== | ||
|
||
::what does clang-tidy mean | ||
|
||
%clang_tidy_exe% drv.c -checks=*,-cppcoreguidelines-avoid-magic-numbers,-readability-magic-numbers,-google-readability-todo,-altera-struct-pack-align,-hicpp-uppercase-literal-suffix,-readability-uppercase-literal-suffix -- | ||
pause |
Oops, something went wrong.