...

View Full Version : Need to write a BSP decompiler



JxcelDoghmQ
04-26-2009, 06:40 PM
I need to write a D3DBSP decompiler. Specifically, one that can decompile BSPs that are type 4. Someone on another forum was able to successfully decompile a type 4 BSP file using a program he wrote, but he doesn't want to release it. All he told me was that the decompiler was coded using C++, and that before he built it, he investigated several D3DBSP files (with a hex editor, I'm assuming) and ASM sources of a D3DBSP compiler.
My question is, how would be able to write a decompiler like that? As far as I know, a D3DBSP file is just a BSP file that has been modified to support DirectX 9 graphics. I need to reverse this process:


@ECHO OFF

set bsppath=%~1
set mapsourcepath=%~2
set treepath=%~3
set mapname=%4
set platform=%5
set parmBSPOptions=%~6
set parmLightOptions=%~7
set compileBSP=%8
set compileLight=%9
shift
set compilePaths=%9
shift
set runmap=%9
shift
set mpmap=%9
shift
set compileVis=%9

if "%parmBSPoptions%" == "-" (
set parmBSPoptions=
)

if "%parmLightOptions%" == "-" (
set parmLightOptions=
)

mkdir "%treepath%main\maps\"
mkdir "%treepath%main\maps\mp"

if "%compileBSP%" == "1" (
copy "%mapsourcepath%%mapname%.map" "%bsppath%%mapname%.map"
chdir "%treepath%bin"
cod2map -platform %platform% %parmBSPOptions% "%bsppath%%mapname%"
)

if "%compileVis%" == "1" (
chdir "%treepath%bin"
cod2map -vis -platform %platform% "%bsppath%%mapname%"
)

if "%compileLight%" == "1" (
IF EXIST "%mapsourcepath%%mapname%.grid" copy "%mapsourcepath%%mapname%.grid" "%bsppath%%mapname%.grid"
IF EXIST "%mapsourcepath%%mapname%.vclog" copy "%mapsourcepath%%mapname%.vclog" "%bsppath%%mapname%.vclog"
IF EXIST "%bsppath%%mapname%.map" del "%bsppath%%mapname%.map"
chdir "%treepath%bin"
cod2rad -platform %platform% %parmLightOptions% "%bsppath%%mapname%"
)

IF EXIST "%bsppath%%mapname%.map" del "%bsppath%%mapname%.map"
IF EXIST "%bsppath%%mapname%.d3dpoly" del "%bsppath%%mapname%.d3dpoly"
IF EXIST "%bsppath%%mapname%.vclog" del "%bsppath%%mapname%.vclog"
IF EXIST "%bsppath%%mapname%.grid" del "%bsppath%%mapname%.grid"
IF EXIST "%bsppath%%mapname%.lin" move "%bsppath%%mapname%.lin" "%mapsourcepath%%mapname%.lin"

chdir "%treepath%bin"

if "%compilePaths%" == "1" (
goto CONNECTPATHS
) else (
goto RUNMAP
)

:CONNECTPATHS
echo Connecting Paths on %mapname%...
echo runmap value: %runmap%
echo compilePaths value: %compilePaths%
if "%runmap%" == "1" (
call cod2compiletools_runmap.bat %platform% "%treepath%" %mapname% "+set g_connectpaths 1"
goto END
) else (
call cod2compiletools_runmap.bat %platform% "%treepath%" %mapname% "+set g_connectpaths 2"
goto END
)

:RUNMAP
if "%runmap%" == "1" (
echo Starting %mapname%...
call cod2compiletools_runmap.bat %platform% "%treepath%" %mapname% %mpmap%
goto END
)

:END
pause
::cls

If someone could help, it would be greatly appreciated.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum