Skip to content

Commit

Permalink
MSVC 7.0 (Visual C/C++ 2002) support, and touhou6 preset (#839)
Browse files Browse the repository at this point in the history
* Introduce MSVC7.0 (Visual Studio 2002) toolchain

This renames the msvc7.0 toolchain to msvc7.1 (as it is based on Visual
Studio 2003, which is msvc7.1), and introduces a new msvc7.0 toolchain
based on Visual Studio 2002.

* Add presets for Touhou 6 decompilation project

* Remove noexec from /sandbox/tmp in docker

The MSVC toolchains store intermediate artifacts in the /sandbox/tmp
folder, and need to be able to mmap them with PROT_EXEC rights, which is
prevented by the noexec flag that docker automatically puts on all
tmpfs. To avoid this, we need to ask docker to remove that flag.
  • Loading branch information
roblabla authored Sep 8, 2023
1 parent d4229ec commit b890a0f
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 3 deletions.
11 changes: 10 additions & 1 deletion backend/compilers/download.py
Original file line number Diff line number Diff line change
Expand Up @@ -973,7 +973,16 @@ def download_win9x():
+ compiler
+ ".tar.gz"
)
download_tar(url=url, dest_name=compiler)
# This is actually msvc 7.1.
if compiler == "msvc7.0":
download_tar(url=url, dest_name="msvc7.1")

# Download Visual C/C++ 2002 (MSVC 7.0). Note that this toolchain, unlike
# the others, also contains the PlatformSDK and DirectX 8
download_tar(
url="https://github.com/roblabla/MSVC-7.0-Portable/releases/download/release/msvc7.0.tar.gz",
dest_name="msvc7.0",
)

# For the repo these compilers are stored in they need a few location adjustments for neatness, and permissions set to executable
download_zip(
Expand Down
9 changes: 9 additions & 0 deletions backend/coreapp/compilers.py
Original file line number Diff line number Diff line change
Expand Up @@ -1033,6 +1033,12 @@ def preset_from_name(name: str) -> Optional[Preset]:
platform=WIN9X,
cc=CL_WIN,
)

MSVC71 = MSVCCompiler(
id="msvc7.1",
platform=WIN9X,
cc=CL_WIN,
)
# Watcom doesn't like '/' in paths passed to it so we need to replace them.
WATCOM_ARGS = ' -zq -i="Z:${COMPILER_DIR}/h" -i="Z:${COMPILER_DIR}/h/nt" ${COMPILER_FLAGS} -fo"Z:${OUTPUT}" "Z:${INPUT}"'
WATCOM_CC = (
Expand Down Expand Up @@ -1243,6 +1249,7 @@ def preset_from_name(name: str) -> Optional[Preset]:
MSVC65PP,
MSVC66,
MSVC70,
MSVC71,
# Watcom, DOS and Win9x
WATCOM_105_C,
WATCOM_105_CPP,
Expand Down Expand Up @@ -1761,6 +1768,8 @@ def preset_from_name(name: str) -> Optional[Preset]:
),
# Windows
Preset("LEGO Island", MSVC42, "/W3 /GX /O2"),
Preset("Touhou 6 (C)", MSVC70, "/MT /G5 /GS /Od /Oi /Ob1"),
Preset("Touhou 6 (C++)", MSVC70, "/MT /G5 /GS /Od /Oi /Ob1 /TP"),
]


Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ services:
tmpfs:
# Use a separate tmpfs to prevent a rogue jailed process
# from filling /tmp on the parent container
- /sandbox/tmp:uid=1000,gid=1000,size=64M,mode=0700
- /sandbox/tmp:exec,uid=1000,gid=1000,size=64M,mode=0700
frontend:
build: frontend
environment:
Expand Down
3 changes: 2 additions & 1 deletion frontend/src/lib/i18n/locales/en/compilers.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@
"msvc6.5": "Microsoft Visual C/C++ 6.0 Service Pack 5",
"msvc6.5pp": "Microsoft Visual C/C++ 6.0 Service Pack 5 with Processor Pack",
"msvc6.6": "Microsoft Visual C/C++ 6.0 Service Pack 6",
"msvc7.0": "Microsoft Visual C/C++ 7.0 .NET 2003",
"msvc7.0": "Microsoft Visual C/C++ 7.0 .NET 2002",
"msvc7.1": "Microsoft Visual C/C++ 7.1 .NET 2003",
"mwcc_20_72": "2.0 build 72 (MW 1.2base)",
"mwcc_20_79": "2.0 build 79 (MW 1.2sp2)",
"mwcc_20_82": "2.0 build 82 (MW 1.2sp2p3)",
Expand Down

0 comments on commit b890a0f

Please sign in to comment.