Skip to content

Commit ca923e1

Browse files
committed
- Driver 2 mission tool WIP
1 parent c0ceb49 commit ca923e1

3 files changed

Lines changed: 101 additions & 1 deletion

File tree

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
#include <math.h>
2+
3+
#include <malloc.h>
4+
#include "core/VirtualStream.h"
5+
#include "core/cmdlib.h"
6+
#include "math/dktypes.h"
7+
#include "util/image.h"
8+
#include "util/util.h"
9+
#include <string>
10+
#include <DriverLevelTool/driver_routines/d2_types.h>
11+
12+
//----------------------------------------------------
13+
14+
void CompileMissionBlk(const char* filename)
15+
{
16+
}
17+
18+
void DecompileMissionBlk(const char* filename, int missionNumber)
19+
{
20+
if (missionNumber <= 0) // decompile all
21+
{
22+
23+
}
24+
}
25+
26+
//-----------------------------------------------------
27+
28+
void PrintCommandLineArguments()
29+
{
30+
MsgInfo("Example usage:\n");
31+
MsgInfo("\tDriver2MissionTool -decompile MISSIONS.BLK [mission_number]\n");
32+
MsgInfo("\tDriver2MissionTool -compile <mission_script_name.d2ms>\n");
33+
}
34+
35+
int main(int argc, char** argv)
36+
{
37+
#ifdef _WIN32
38+
Install_ConsoleSpewFunction();
39+
#endif
40+
41+
Msg("---------------\nDriverMissionTool - Driver 2 mission decompiler\n---------------\n\n");
42+
43+
if (argc <= 1)
44+
{
45+
PrintCommandLineArguments();
46+
return -1;
47+
}
48+
49+
for (int i = 0; i < argc; i++)
50+
{
51+
if (!stricmp(argv[i], "-compile"))
52+
{
53+
if (i + 1 <= argc)
54+
CompileMission(argv[i + 1]);
55+
else
56+
MsgWarning("-compile must have an argument!");
57+
}
58+
else if (!stricmp(argv[i], "-decompile"))
59+
{
60+
if (i + 1 <= argc)
61+
DecompileMissionBlk(argv[i + 1], atoi(argv[i + 2]));
62+
else
63+
MsgWarning("-decompile must have at least one argument!");
64+
}
65+
}
66+
67+
return 0;
68+
}

Driver2MissionTool/premake5.lua

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
-- premake5.lua
2+
3+
project "Driver2MissionTool"
4+
kind "ConsoleApp"
5+
language "C++"
6+
compileas "C++"
7+
targetdir "bin/%{cfg.buildcfg}"
8+
9+
files {
10+
"**.cpp",
11+
"**.h",
12+
}
13+
14+
filter "system:linux"
15+
buildoptions {
16+
"-Wno-narrowing",
17+
"-fpermissive",
18+
"-m32"
19+
}
20+
21+
linkoptions {
22+
"-m32"
23+
}
24+
25+
filter "configurations:Debug"
26+
targetsuffix "_dbg"
27+
symbols "On"
28+
29+
filter "configurations:Release"
30+
optimize "Full"
31+

premake5.lua

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,5 @@ workspace "OpenDriver2Tools"
4141
dofile("DriverLevelTool/premake5.lua")
4242
dofile("DriverSoundTool/premake5.lua")
4343
dofile("DriverImageTool/premake5.lua")
44-
dofile("Driver2CutsceneTool/premake5.lua")
44+
dofile("Driver2CutsceneTool/premake5.lua")
45+
dofile("Driver2MissionTool/premake5.lua")

0 commit comments

Comments
 (0)