diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 55a1eb50..668e3a4e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -13,50 +13,51 @@ jobs: steps: - uses: actions/checkout@v3 - - uses: actions/checkout@v3 - with: - repository: 'itsmattkc/msvc420' - path: msvc420 - - - name: Restore cached DX5 SDK - id: cache-dx5 + - name: Restore cached kit + id: cache-kit uses: actions/cache/restore@v3 with: - path: dx5sdk - key: dx5sdk + path: C:\islekit + key: islekit - name: Download DX5 SDK - if: steps.cache-dx5.outputs.cache-hit != 'true' + if: steps.cache-kit.outputs.cache-hit != 'true' run: | cd dx5sdk - C:\msys64\usr\bin\wget.exe https://archive.org/download/idx5sdk/idx5sdk.exe + curl -LO https://archive.org/download/idx5sdk/idx5sdk.exe 7z x .\idx5sdk.exe 7z x .\DX5SDK.EXE cd cdrom + + - name: Setup MSVC 4.20 + if: steps.cache-kit.outputs.cache-hit != 'true' + run: | + git clone --depth 1 https://github.com/itsmattkc/msvc420 c:\islekit\msvc420 - - name: Cache DX5 SDK - if: steps.cache-dx5.outputs.cache-hit != 'true' + - name: Setup DX5 SDK + if: steps.cache-kit.outputs.cache-hit != 'true' + run: | + cd dx5sdk + move cdrom c:\islekit\dx5sdk + + - name: Cache kit + if: steps.cache-kit.outputs.cache-hit != 'true' id: save-dx5 uses: actions/cache/save@v3 with: - path: dx5sdk - key: dx5sdk - - - name: Setup DX5 SDK - run: | - cd dx5sdk - cd cdrom - .\SETUP.EXE /s - + path: C:\islekit + key: islekit + - name: Build shell: cmd run: | - call .\msvc420\bin\VCVARS32.BAT x86 - mkdir Release - .\msvc420\bin\NMAKE.EXE /f isle.mak CFG="ISLE - Win32 Release" + set ISLE_KIT_ROOT=C:/islekit + call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" amd64 + cmake -GNinja -Bbuild --toolchain cmake/Toolchain/msvc42.cmake -DCMAKE_BUILD_TYPE=Release + cmake --build build -j 1 - name: Upload Artifact uses: actions/upload-artifact@master with: name: Win32 - path: Release + path: build/isle/isle.exe diff --git a/.gitignore b/.gitignore index b1838781..567609b1 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1 @@ -Debug/ -Release/ -*.ncb +build/ diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 00000000..8fb84c45 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,14 @@ +cmake_minimum_required(VERSION 3.10) # just for sanity's sake + +project( + isle + LANGUAGES C CXX +) + +include(${PROJECT_SOURCE_DIR}/cmake/dx5sdk.cmake) + +if(ISLE_BUILD_LEGO1) + add_subdirectory(lego1) +endif() + +add_subdirectory(isle) diff --git a/README.md b/README.md index b4d73934..a6839b51 100644 --- a/README.md +++ b/README.md @@ -12,30 +12,21 @@ Currently `ISLE.EXE` is completely decompiled, however there are some known inac ## Building -LEGO Island was compiled with Microsoft Visual C++ 4.20, so that's what this decompilation targets. However it should compile with NMAKE on newer versions of Visual Studio too. +LEGO Island was compiled with Microsoft Visual C++ 4.20, so that's what this decompilation targets. However, building with newer versions of Visual C++ using CMake should also work. -### Recommended Instructions: +### Assembling Kit -These instructions use the development IDE from Visual C++ 4.20. By modern standards, it can be a little clunky to use, especially on newer versions of Windows, however it's still relatively straightforward. If you prefer a command line process that can fit into a modern workflow/IDE, see the instructions below. +Pick a directory without spaces to use as the root of your kit. Set this as the `ISLE_KIT_ROOT` in your preferred shell (on Windows, for instance `set ISLE_KIT_ROOT=X:/path/to/kit`). -1. Install Microsoft Visual C++ 4.20. This can be found on many abandonware sites, but the installer can be a little iffy on modern versions of Windows. For convenience, I made a [portable version](https://github.com/itsmattkc/msvc420) that can be downloaded and used quickly instead. -2. Download and install the DirectX 5 SDK. Similarly, this can be found on many abandonware sites. -3. Open "Microsoft Developer Studio" (`BIN/MSDEV.EXE` for those using the portable). -4. `File` > `Open Workspace` -5. Select `ISLE.MDP` from this repository. -6. Select a build configuration. `ISLE - Win32 Release` is recommended because, at this point in time, you'll almost certainly be pairing it with the retail `LEGO1.DLL`, which is also a release build. -7. `Build` > `Build ISLE.EXE`. This will build `ISLE.EXE` in a folder called `Release`. It will also build `LEGO1.DLL` since it's listed as a dependency, however the `LEGO1.DLL` produced is too incomplete to be usable at this time. +Clone [MSVC420](https://github.com/itsmattkc/msvc420) to your kit root. -### Command Line Instructions +Install the DirectX 5 SDK, changing the location to [kit root]/dx5sdk. -For some users, this may be preferable to using an obsolete graphical IDE. Any modern IDE should support custom command line build steps, making this potentially easier to fit into a familiar contemporary workflow. This guide assumes a general familiarity with the Windows command prompt. +### Configuring CMake -1. Acquire Visual Studio/Visual C++. Any version after 4.20 should work here, but 4.20 is the only one guaranteed to work. If you wish to use 4.20, it can be found on many abandonware sites, but the installer can be a little iffy on modern versions of Windows. For convenience, I made a [portable version](https://github.com/itsmattkc/msvc420) that can be downloaded and used quickly instead. -2. Download and install the DirectX 5 SDK. Similarly, this can be found on many abandonware sites, but later versions of Visual Studio include the DirectX SDK by default, so this step may be skippable (you definitely need it for MSVC 4.20). -3. Open an x86/32-bit developer command prompt. Depending on the version of VS you're using, you may have a start menu item for it already (e.g. `x86 Native Tools Command Prompt`). Alternatively, you can start a normal command prompt (`cmd`) and run `vcvars32.bat` from the Visual Studio folder (run `BIN/VCVARS32.BAT x86` if you're using the portable 4.20). -4. `cd` to the folder you cloned this repository to. -5. `mkdir Release` if the folder doesn't already exist. Some versions of NMAKE may make this folder by itself, but some don't. -6. Run `nmake /f isle.mak CFG="ISLE - Win32 Release"`. This will build `ISLE.EXE` in the `Release` folder you just made. It will also build `LEGO1.DLL` since it's listed as a dependency, however the `LEGO1.DLL` produced is too incomplete to be usable at this time. +`cmake -Bbuild --toolchain cmake/Toolchain/msvc42.cmake -DCMAKE_BUILD_TYPE=Release` + +On Linux, you need to use `scripts/cm420` to configure the build. ## Usage diff --git a/isle.mak b/attic/isle.mak similarity index 100% rename from isle.mak rename to attic/isle.mak diff --git a/isle.mdp b/attic/isle.mdp similarity index 100% rename from isle.mdp rename to attic/isle.mdp diff --git a/cmake/Toolchain/msvc42-common.cmake b/cmake/Toolchain/msvc42-common.cmake new file mode 100644 index 00000000..b5401ede --- /dev/null +++ b/cmake/Toolchain/msvc42-common.cmake @@ -0,0 +1,19 @@ +# Common place for msvc42 toolchain stuff that Doesn't change + +# these don't seem to actually be listened to but in the rare case they are +# set them anyways +set(MSVC_INCREMENTAL_DEFAULT OFF CACHE STRING "") +set(CMAKE_COMPILER_SUPPORTS_PDBTYPE OFF CACHE STRING "") + +foreach(lang C CXX) + set(CMAKE_${lang}_FLAGS "/DWIN32 /D_WINDOWS /W3 /Zm1000 /I$ENV{ISLE_KIT_ROOT}/msvc420/include" CACHE STRING "") + set(CMAKE_${lang}_FLAGS_DEBUG "/MDd /Zi /Ob0 /Od" CACHE STRING "") + + set(CMAKE_${lang}_FLAGS_INIT "/DWIN32 /D_WINDOWS /W3 /Zm1000 /I$ENV{ISLE_KIT_ROOT}/msvc420/include" CACHE STRING "") + set(CMAKE_${lang}_FLAGS_INIT_DEBUG "/MDd /Zi /Ob0 /Od" CACHE STRING "") +endforeach() + +set(CMAKE_EXE_LINKER_FLAGS "/LIBPATH:$ENV{ISLE_KIT_ROOT}/msvc420/lib /incremental:no") +set(CMAKE_EXE_LINKER_FLAGS_DEBUG "/debug /incremental:no") +set(CMAKE_SHARED_LINKER_FLAGS "/LIBPATH:$ENV{ISLE_KIT_ROOT}/msvc420/lib /incremental:no") + diff --git a/cmake/Toolchain/msvc42-linux.cmake b/cmake/Toolchain/msvc42-linux.cmake new file mode 100644 index 00000000..f58b2336 --- /dev/null +++ b/cmake/Toolchain/msvc42-linux.cmake @@ -0,0 +1,14 @@ +set(CMAKE_SYSTEM_NAME Windows) + +include(${CMAKE_CURRENT_LIST_DIR}/msvc42-common.cmake) + +set(CMAKE_C_COMPILER ${CMAKE_SOURCE_DIR}/cmake/Toolchain/wrappers/cl) +set(CMAKE_CXX_COMPILER ${CMAKE_C_COMPILER}) +set(CMAKE_RC_COMPILER ${CMAKE_SOURCE_DIR}/cmake/Toolchain/wrappers/rc) +set(CMAKE_AR ${CMAKE_SOURCE_DIR}/cmake/Toolchain/wrappers/lib) +set(CMAKE_LINKER ${CMAKE_SOURCE_DIR}/cmake/Toolchain/wrappers/link) + +set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) +set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) diff --git a/cmake/Toolchain/msvc42.cmake b/cmake/Toolchain/msvc42.cmake new file mode 100644 index 00000000..d91f807e --- /dev/null +++ b/cmake/Toolchain/msvc42.cmake @@ -0,0 +1,17 @@ +set(CMAKE_SYSTEM_NAME Windows) + +include(${CMAKE_CURRENT_LIST_DIR}/msvc42-common.cmake) + +set(CMAKE_C_COMPILER $ENV{ISLE_KIT_ROOT}/msvc420/bin/cl.exe) +set(CMAKE_CXX_COMPILER ${CMAKE_C_COMPILER}) +set(CMAKE_RC_COMPILER $ENV{ISLE_KIT_ROOT}/msvc420/bin/rc.exe) +set(CMAKE_AR $ENV{ISLE_KIT_ROOT}/msvc420/bin/lib.exe) +set(CMAKE_LINKER $ENV{ISLE_KIT_ROOT}/msvc420/bin/link.exe) + +set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) +set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) + +set(CMAKE_C_COMPILER_WORKS ON) +set(CMAKE_CXX_COMPILER_WORKS ON) diff --git a/cmake/Toolchain/wrappers/build_msvctricks.sh b/cmake/Toolchain/wrappers/build_msvctricks.sh new file mode 100755 index 00000000..56e3645a --- /dev/null +++ b/cmake/Toolchain/wrappers/build_msvctricks.sh @@ -0,0 +1,2 @@ +#!/bin/bash +i686-w64-mingw32-g++ -O3 -fno-ident -fno-stack-protector -static msvctricks.cpp -municode -lshlwapi -o msvctricks.exe diff --git a/cmake/Toolchain/wrappers/cl b/cmake/Toolchain/wrappers/cl new file mode 100755 index 00000000..a8d377bc --- /dev/null +++ b/cmake/Toolchain/wrappers/cl @@ -0,0 +1 @@ +$(dirname $0)/wine-msvc.sh ${ISLE_KIT_ROOT}/msvc420/bin/cl.exe "$@" diff --git a/cmake/Toolchain/wrappers/lib b/cmake/Toolchain/wrappers/lib new file mode 100755 index 00000000..deed170b --- /dev/null +++ b/cmake/Toolchain/wrappers/lib @@ -0,0 +1 @@ +$(dirname $0)/wine-msvc.sh ${ISLE_KIT_ROOT}/msvc420/bin/lib.exe "$@" diff --git a/cmake/Toolchain/wrappers/link b/cmake/Toolchain/wrappers/link new file mode 100755 index 00000000..e1e62370 --- /dev/null +++ b/cmake/Toolchain/wrappers/link @@ -0,0 +1 @@ +$(dirname $0)/wine-msvc.sh ${ISLE_KIT_ROOT}/msvc420/bin/link.exe "$@" diff --git a/cmake/Toolchain/wrappers/msvctricks.cpp b/cmake/Toolchain/wrappers/msvctricks.cpp new file mode 100644 index 00000000..36a2e2ef --- /dev/null +++ b/cmake/Toolchain/wrappers/msvctricks.cpp @@ -0,0 +1,132 @@ +/* + * Copyright (c) 2023 Huang Qinjin + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#include +#include + +//#pragma comment(lib, "shell32.lib") +//#pragma comment(lib, "shlwapi.lib") +//#pragma comment(linker, "/ENTRY:wWinMainCRTStartup") +//#pragma comment(linker, "/SUBSYSTEM:CONSOLE") + + +static HANDLE hStdIn = INVALID_HANDLE_VALUE; +static HANDLE hStdOut = INVALID_HANDLE_VALUE; +static HANDLE hStdErr = INVALID_HANDLE_VALUE; + +static DWORD run(LPWSTR lpCmdLine) +{ + STARTUPINFOW si = {}; + si.cb = sizeof(si); + si.dwFlags = STARTF_USESTDHANDLES; + si.hStdInput = hStdIn; + si.hStdOutput = hStdOut; + si.hStdError = hStdErr; + + PROCESS_INFORMATION pi = {}; + + DWORD dwExitCode; + if (CreateProcessW(nullptr, lpCmdLine, nullptr, nullptr, TRUE, 0, nullptr, nullptr, &si, &pi)) + { + WaitForSingleObject(pi.hProcess, INFINITE); + + if (!GetExitCodeProcess(pi.hProcess, &dwExitCode)) + { + dwExitCode = GetLastError(); + } + + CloseHandle(pi.hProcess); + CloseHandle(pi.hThread); + } + else + { + dwExitCode = GetLastError(); + } + + return dwExitCode; +} + +static DWORD mt(LPWSTR lpCmdLine) +{ + DWORD dwExitCode = run(lpCmdLine); + // https://gitlab.kitware.com/cmake/cmake/-/blob/v3.26.0/Source/cmcmd.cxx#L2405 + if (dwExitCode == 0x41020001) + dwExitCode = 0xbb; + return dwExitCode; +} + +int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nCmdShow) +{ + (void) hInstance; + (void) hPrevInstance; + (void) nCmdShow; + + int argc = 0; + wchar_t** argv = CommandLineToArgvW(lpCmdLine, &argc); + if (argc <= 0) return 0; + + wchar_t buf[32768]; + if (GetEnvironmentVariableW(L"WINE_MSVC_STDIN", buf, ARRAYSIZE(buf))) + { + SECURITY_ATTRIBUTES attr = {}; + attr.nLength = sizeof(attr); + attr.bInheritHandle = TRUE; + + hStdIn = CreateFileW(buf, GENERIC_READ, + FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, + &attr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr); + } + if (GetEnvironmentVariableW(L"WINE_MSVC_STDOUT", buf, ARRAYSIZE(buf))) + { + SECURITY_ATTRIBUTES attr = {}; + attr.nLength = sizeof(attr); + attr.bInheritHandle = TRUE; + + hStdOut = CreateFileW(buf, GENERIC_WRITE, + FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, + &attr, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr); + } + if (GetEnvironmentVariableW(L"WINE_MSVC_STDERR", buf, ARRAYSIZE(buf))) + { + SECURITY_ATTRIBUTES attr = {}; + attr.nLength = sizeof(attr); + attr.bInheritHandle = TRUE; + + hStdErr = CreateFileW(buf, GENERIC_WRITE, + FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, + &attr, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr); + } + + if (hStdIn == INVALID_HANDLE_VALUE) + { + hStdIn = GetStdHandle(STD_INPUT_HANDLE); + } + if (hStdOut == INVALID_HANDLE_VALUE) + { + hStdOut = GetStdHandle(STD_OUTPUT_HANDLE); + } + if (hStdErr == INVALID_HANDLE_VALUE) + { + hStdErr = GetStdHandle(STD_ERROR_HANDLE); + } + + LPCWSTR const exe = PathFindFileNameW(argv[0]); + + if (PathMatchSpecW(exe, L"mt.exe")) + return mt(lpCmdLine); + + return run(lpCmdLine); +} diff --git a/cmake/Toolchain/wrappers/msvctricks.exe b/cmake/Toolchain/wrappers/msvctricks.exe new file mode 100755 index 00000000..c86cf322 Binary files /dev/null and b/cmake/Toolchain/wrappers/msvctricks.exe differ diff --git a/cmake/Toolchain/wrappers/rc b/cmake/Toolchain/wrappers/rc new file mode 100755 index 00000000..80bdde5c --- /dev/null +++ b/cmake/Toolchain/wrappers/rc @@ -0,0 +1 @@ +$(dirname $0)/wine-msvc.sh ${ISLE_KIT_ROOT}/msvc420/bin/rc.exe "$@" diff --git a/cmake/Toolchain/wrappers/wine-msvc.sh b/cmake/Toolchain/wrappers/wine-msvc.sh new file mode 100755 index 00000000..707fc3da --- /dev/null +++ b/cmake/Toolchain/wrappers/wine-msvc.sh @@ -0,0 +1,59 @@ +#!/bin/bash +# +# Copyright (c) 2018 Martin Storsjo +# +# Permission to use, copy, modify, and/or distribute this software for any +# purpose with or without fee is hereby granted, provided that the above +# copyright notice and this permission notice appear in all copies. +# +# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +EXE=$(dirname $0)/msvctricks.exe +HAS_MSVCTRICKS=true + +ARGS=() +while [ $# -gt 0 ]; do + a=$1 + case $a in + [-/][A-Za-z][A-Za-z]/*) + opt=${a:0:3} + path=${a:3} + if [ -d "$(dirname "$path")" ] && [ "$(dirname "$path")" != "/" ]; then + a=${opt}z:$path + fi + ;; + /*) + if [ -d "$(dirname "$a")" ] && [ "$(dirname "$a")" != "/" ]; then + a=z:$a + fi + ;; + *) + ;; + esac + ARGS+=("$a") + shift +done + +unixify_path='s/\r// ; s/z:\([\\/]\)/\1/i ; /^Note:/s,\\,/,g' + +export WINE_MSVC_STDOUT=${TMPDIR:-/tmp}/wine-msvc.stdout.$$ +export WINE_MSVC_STDERR=${TMPDIR:-/tmp}/wine-msvc.stderr.$$ + +cleanup() { + wait + rm -f $WINE_MSVC_STDOUT $WINE_MSVC_STDERR +} + +trap cleanup EXIT + +cleanup && mkfifo $WINE_MSVC_STDOUT $WINE_MSVC_STDERR || exit 1 + +sed -e "$unixify_path" <$WINE_MSVC_STDOUT & +sed -e "$unixify_path" <$WINE_MSVC_STDERR >&2 & +WINEDEBUG=-all wine64 "$EXE" "${ARGS[@]}" &>/dev/null diff --git a/cmake/dx5sdk.cmake b/cmake/dx5sdk.cmake new file mode 100644 index 00000000..d5654f1f --- /dev/null +++ b/cmake/dx5sdk.cmake @@ -0,0 +1,36 @@ +# Make sure the user provided a valid kit root. +if("$ENV{ISLE_KIT_ROOT}" STREQUAL "") + message(FATAL_ERROR "ISLE_KIT_ROOT needs to be set to build") +endif() + + +set(__DX5_SDK_PATH "$ENV{ISLE_KIT_ROOT}/dx5sdk/sdk") + +# There are no seperated includes, so for nicity just define a common interface target +# that nets us includes, that all DX5 targets include from. +# This techinically means a project can do a no-no and use, say D3D apis w/o linking D3D, +# but that's a footgun that requires knowledge of this so I'm not particulary.. worried about it? +add_library(__DX5_Inc INTERFACE) +target_include_directories(__DX5_Inc INTERFACE ${__DX5_SDK_PATH}/inc) + +# Bootstrapping problems are fun. +add_library(DX5::Guid STATIC IMPORTED) +set_property(TARGET DX5::Guid PROPERTY + IMPORTED_LOCATION $ENV{ISLE_KIT_ROOT}/dx5sdk/sdk/lib/dxguid.lib + ) + + +macro(__add_dx5_lib name libname) + add_library(DX5::${name} SHARED IMPORTED) + target_link_libraries(DX5::${name} INTERFACE __DX5_Inc DX5::Guid) + set_property(TARGET DX5::${name} PROPERTY + IMPORTED_IMPLIB ${__DX5_SDK_PATH}/lib/${libname} + ) +endmacro() + + +__add_dx5_lib(D3DRM d3drm.lib) +__add_dx5_lib(DDraw ddraw.lib) +__add_dx5_lib(DInput dinput.lib) +__add_dx5_lib(DSound dsound.lib) + diff --git a/dx5sdk/cdrom/setup.iss b/dx5sdk/cdrom/setup.iss index 65d3f56f..35a44dd8 100644 --- a/dx5sdk/cdrom/setup.iss +++ b/dx5sdk/cdrom/setup.iss @@ -17,7 +17,7 @@ Result=1 [SdSetupTypeEx-0] Result=Compact [SdAskDestPath-0] -szDir=C:\dxsdk +szDir=C:\islekit\dxsdk Result=1 [SdSelectFolder-0] szFolder=Microsoft DirectX 5 SDK diff --git a/isle/CMakeLists.txt b/isle/CMakeLists.txt new file mode 100644 index 00000000..f3aa218b --- /dev/null +++ b/isle/CMakeLists.txt @@ -0,0 +1,28 @@ +add_executable(isle WIN32 + src/define.cpp + src/main.cpp + src/isle.cpp + src/res/isle.rc + + ../lego1/src/mxomnicreateparambase.cpp +) + +# Left for when lego1 is featured enough to be bootstrappable. +#if(ISLE_BUILD_LEGO1) +# target_link_libraries(isle PRIVATE lego1) +#else() + target_include_directories(isle PRIVATE ${PROJECT_SOURCE_DIR}/lego1/include) + target_link_libraries(isle PRIVATE + ${CMAKE_CURRENT_SOURCE_DIR}/ext/lego1.lib + ) +#endif() + + +target_include_directories(isle PRIVATE + ${CMAKE_CURRENT_SOURCE_DIR}/src +) + +target_link_libraries(isle PRIVATE + DX5::DSound + winmm +) diff --git a/ISLE/ext/lego1.def b/isle/ext/lego1.def similarity index 100% rename from ISLE/ext/lego1.def rename to isle/ext/lego1.def diff --git a/ISLE/ext/lego1.exp b/isle/ext/lego1.exp similarity index 100% rename from ISLE/ext/lego1.exp rename to isle/ext/lego1.exp diff --git a/ISLE/ext/lego1.lib b/isle/ext/lego1.lib similarity index 100% rename from ISLE/ext/lego1.lib rename to isle/ext/lego1.lib diff --git a/ISLE/define.cpp b/isle/src/define.cpp similarity index 100% rename from ISLE/define.cpp rename to isle/src/define.cpp diff --git a/ISLE/define.h b/isle/src/define.h similarity index 100% rename from ISLE/define.h rename to isle/src/define.h diff --git a/ISLE/isle.cpp b/isle/src/isle.cpp similarity index 99% rename from ISLE/isle.cpp rename to isle/src/isle.cpp index f4d9cfeb..276a1f8a 100644 --- a/ISLE/isle.cpp +++ b/isle/src/isle.cpp @@ -5,7 +5,7 @@ #include "mxdirectdraw.h" #include "mxdsaction.h" #include "mxomni.h" -#include "res/resource.h" +#include "resource.h" RECT windowRect = {0, 0, 640, 480}; diff --git a/ISLE/isle.h b/isle/src/isle.h similarity index 98% rename from ISLE/isle.h rename to isle/src/isle.h index e23fb8cb..389e8630 100644 --- a/ISLE/isle.h +++ b/isle/src/isle.h @@ -1,7 +1,7 @@ #ifndef ISLE_H #define ISLE_H -#include +#include #include "mxresult.h" #include "mxvideoparam.h" diff --git a/ISLE/main.cpp b/isle/src/main.cpp similarity index 98% rename from ISLE/main.cpp rename to isle/src/main.cpp index 9ef4466e..ba912342 100644 --- a/ISLE/main.cpp +++ b/isle/src/main.cpp @@ -1,5 +1,5 @@ -#include -#include +#include +#include #include "define.h" #include "isle.h" diff --git a/ISLE/res/arrow.cur b/isle/src/res/arrow.cur similarity index 100% rename from ISLE/res/arrow.cur rename to isle/src/res/arrow.cur diff --git a/ISLE/res/busy.cur b/isle/src/res/busy.cur similarity index 100% rename from ISLE/res/busy.cur rename to isle/src/res/busy.cur diff --git a/ISLE/res/isle.ico b/isle/src/res/isle.ico similarity index 100% rename from ISLE/res/isle.ico rename to isle/src/res/isle.ico diff --git a/ISLE/res/isle.rc b/isle/src/res/isle.rc similarity index 80% rename from ISLE/res/isle.rc rename to isle/src/res/isle.rc index 59bd314b..14100e9f 100644 Binary files a/ISLE/res/isle.rc and b/isle/src/res/isle.rc differ diff --git a/ISLE/res/no.cur b/isle/src/res/no.cur similarity index 100% rename from ISLE/res/no.cur rename to isle/src/res/no.cur diff --git a/ISLE/res/resource.h b/isle/src/resource.h similarity index 100% rename from ISLE/res/resource.h rename to isle/src/resource.h diff --git a/lego1/CMakeLists.txt b/lego1/CMakeLists.txt new file mode 100644 index 00000000..ca77f241 --- /dev/null +++ b/lego1/CMakeLists.txt @@ -0,0 +1,24 @@ +add_library(lego1 SHARED + src/dllmain.cpp + + # OMNI source + src/mxcore.cpp + src/mxcriticalsection.cpp + src/mxomnicreateparambase.cpp + + # legoomni source + src/legoomni.cpp +) + +target_include_directories(lego1 PUBLIC + ${CMAKE_CURRENT_SOURCE_DIR}/include +) + +target_include_directories(lego1 PRIVATE + ${CMAKE_CURRENT_SOURCE_DIR}/src +) + +target_link_libraries(lego1 PRIVATE + DX5::DSound + winmm +) diff --git a/LEGO1/legoanimationmanager.h b/lego1/include/legoanimationmanager.h similarity index 100% rename from LEGO1/legoanimationmanager.h rename to lego1/include/legoanimationmanager.h diff --git a/LEGO1/legobackgroundcolor.h b/lego1/include/legobackgroundcolor.h similarity index 100% rename from LEGO1/legobackgroundcolor.h rename to lego1/include/legobackgroundcolor.h diff --git a/LEGO1/legobuildingmanager.h b/lego1/include/legobuildingmanager.h similarity index 100% rename from LEGO1/legobuildingmanager.h rename to lego1/include/legobuildingmanager.h diff --git a/LEGO1/legoentity.h b/lego1/include/legoentity.h similarity index 100% rename from LEGO1/legoentity.h rename to lego1/include/legoentity.h diff --git a/LEGO1/legogamestate.h b/lego1/include/legogamestate.h similarity index 100% rename from LEGO1/legogamestate.h rename to lego1/include/legogamestate.h diff --git a/LEGO1/legoinputmanager.h b/lego1/include/legoinputmanager.h similarity index 100% rename from LEGO1/legoinputmanager.h rename to lego1/include/legoinputmanager.h diff --git a/LEGO1/legomodelpresenter.h b/lego1/include/legomodelpresenter.h similarity index 100% rename from LEGO1/legomodelpresenter.h rename to lego1/include/legomodelpresenter.h diff --git a/LEGO1/legonavcontroller.h b/lego1/include/legonavcontroller.h similarity index 100% rename from LEGO1/legonavcontroller.h rename to lego1/include/legonavcontroller.h diff --git a/LEGO1/legoomni.h b/lego1/include/legoomni.h similarity index 100% rename from LEGO1/legoomni.h rename to lego1/include/legoomni.h diff --git a/LEGO1/legopartpresenter.h b/lego1/include/legopartpresenter.h similarity index 100% rename from LEGO1/legopartpresenter.h rename to lego1/include/legopartpresenter.h diff --git a/LEGO1/legoroi.h b/lego1/include/legoroi.h similarity index 100% rename from LEGO1/legoroi.h rename to lego1/include/legoroi.h diff --git a/LEGO1/legovideomanager.h b/lego1/include/legovideomanager.h similarity index 100% rename from LEGO1/legovideomanager.h rename to lego1/include/legovideomanager.h diff --git a/LEGO1/legoworld.h b/lego1/include/legoworld.h similarity index 100% rename from LEGO1/legoworld.h rename to lego1/include/legoworld.h diff --git a/LEGO1/legoworldpresenter.h b/lego1/include/legoworldpresenter.h similarity index 100% rename from LEGO1/legoworldpresenter.h rename to lego1/include/legoworldpresenter.h diff --git a/LEGO1/mxatomid.h b/lego1/include/mxatomid.h similarity index 100% rename from LEGO1/mxatomid.h rename to lego1/include/mxatomid.h diff --git a/LEGO1/mxbackgroundaudiomanager.h b/lego1/include/mxbackgroundaudiomanager.h similarity index 100% rename from LEGO1/mxbackgroundaudiomanager.h rename to lego1/include/mxbackgroundaudiomanager.h diff --git a/LEGO1/mxbitmap.h b/lego1/include/mxbitmap.h similarity index 100% rename from LEGO1/mxbitmap.h rename to lego1/include/mxbitmap.h diff --git a/LEGO1/mxbool.h b/lego1/include/mxbool.h similarity index 100% rename from LEGO1/mxbool.h rename to lego1/include/mxbool.h diff --git a/LEGO1/mxcore.h b/lego1/include/mxcore.h similarity index 100% rename from LEGO1/mxcore.h rename to lego1/include/mxcore.h diff --git a/LEGO1/mxcriticalsection.h b/lego1/include/mxcriticalsection.h similarity index 100% rename from LEGO1/mxcriticalsection.h rename to lego1/include/mxcriticalsection.h diff --git a/LEGO1/mxdirectdraw.h b/lego1/include/mxdirectdraw.h similarity index 100% rename from LEGO1/mxdirectdraw.h rename to lego1/include/mxdirectdraw.h diff --git a/LEGO1/mxdsaction.h b/lego1/include/mxdsaction.h similarity index 100% rename from LEGO1/mxdsaction.h rename to lego1/include/mxdsaction.h diff --git a/LEGO1/mxdsfile.h b/lego1/include/mxdsfile.h similarity index 100% rename from LEGO1/mxdsfile.h rename to lego1/include/mxdsfile.h diff --git a/LEGO1/mxdsobject.h b/lego1/include/mxdsobject.h similarity index 100% rename from LEGO1/mxdsobject.h rename to lego1/include/mxdsobject.h diff --git a/LEGO1/mxioinfo.h b/lego1/include/mxioinfo.h similarity index 100% rename from LEGO1/mxioinfo.h rename to lego1/include/mxioinfo.h diff --git a/LEGO1/mxomni.h b/lego1/include/mxomni.h similarity index 100% rename from LEGO1/mxomni.h rename to lego1/include/mxomni.h diff --git a/LEGO1/mxomnicreateflags.h b/lego1/include/mxomnicreateflags.h similarity index 100% rename from LEGO1/mxomnicreateflags.h rename to lego1/include/mxomnicreateflags.h diff --git a/LEGO1/mxomnicreateparam.h b/lego1/include/mxomnicreateparam.h similarity index 96% rename from LEGO1/mxomnicreateparam.h rename to lego1/include/mxomnicreateparam.h index f72623aa..cbdf0a34 100644 --- a/LEGO1/mxomnicreateparam.h +++ b/lego1/include/mxomnicreateparam.h @@ -1,7 +1,7 @@ #ifndef MXOMNICREATEPARAM_H #define MXOMNICREATEPARAM_H -#include +#include #include "mxomnicreateflags.h" #include "mxomnicreateparambase.h" diff --git a/LEGO1/mxomnicreateparambase.h b/lego1/include/mxomnicreateparambase.h similarity index 100% rename from LEGO1/mxomnicreateparambase.h rename to lego1/include/mxomnicreateparambase.h diff --git a/LEGO1/mxpalette.h b/lego1/include/mxpalette.h similarity index 100% rename from LEGO1/mxpalette.h rename to lego1/include/mxpalette.h diff --git a/LEGO1/mxpresenter.h b/lego1/include/mxpresenter.h similarity index 100% rename from LEGO1/mxpresenter.h rename to lego1/include/mxpresenter.h diff --git a/LEGO1/mxrect32.h b/lego1/include/mxrect32.h similarity index 100% rename from LEGO1/mxrect32.h rename to lego1/include/mxrect32.h diff --git a/LEGO1/mxresult.h b/lego1/include/mxresult.h similarity index 100% rename from LEGO1/mxresult.h rename to lego1/include/mxresult.h diff --git a/LEGO1/mxscheduler.h b/lego1/include/mxscheduler.h similarity index 100% rename from LEGO1/mxscheduler.h rename to lego1/include/mxscheduler.h diff --git a/LEGO1/mxstreamcontroller.h b/lego1/include/mxstreamcontroller.h similarity index 100% rename from LEGO1/mxstreamcontroller.h rename to lego1/include/mxstreamcontroller.h diff --git a/LEGO1/mxstreamer.h b/lego1/include/mxstreamer.h similarity index 100% rename from LEGO1/mxstreamer.h rename to lego1/include/mxstreamer.h diff --git a/LEGO1/mxstring.h b/lego1/include/mxstring.h similarity index 100% rename from LEGO1/mxstring.h rename to lego1/include/mxstring.h diff --git a/LEGO1/mxticklemanager.h b/lego1/include/mxticklemanager.h similarity index 100% rename from LEGO1/mxticklemanager.h rename to lego1/include/mxticklemanager.h diff --git a/LEGO1/mxtimer.h b/lego1/include/mxtimer.h similarity index 100% rename from LEGO1/mxtimer.h rename to lego1/include/mxtimer.h diff --git a/LEGO1/mxtransitionmanager.h b/lego1/include/mxtransitionmanager.h similarity index 100% rename from LEGO1/mxtransitionmanager.h rename to lego1/include/mxtransitionmanager.h diff --git a/LEGO1/mxvariabletable.h b/lego1/include/mxvariabletable.h similarity index 100% rename from LEGO1/mxvariabletable.h rename to lego1/include/mxvariabletable.h diff --git a/LEGO1/mxvideomanager.h b/lego1/include/mxvideomanager.h similarity index 100% rename from LEGO1/mxvideomanager.h rename to lego1/include/mxvideomanager.h diff --git a/LEGO1/mxvideoparam.h b/lego1/include/mxvideoparam.h similarity index 100% rename from LEGO1/mxvideoparam.h rename to lego1/include/mxvideoparam.h diff --git a/LEGO1/mxvideoparamflags.h b/lego1/include/mxvideoparamflags.h similarity index 100% rename from LEGO1/mxvideoparamflags.h rename to lego1/include/mxvideoparamflags.h diff --git a/LEGO1/realtimeview.h b/lego1/include/realtimeview.h similarity index 100% rename from LEGO1/realtimeview.h rename to lego1/include/realtimeview.h diff --git a/LEGO1/viewmanager.h b/lego1/include/viewmanager.h similarity index 100% rename from LEGO1/viewmanager.h rename to lego1/include/viewmanager.h diff --git a/LEGO1/dllmain.cpp b/lego1/src/dllmain.cpp similarity index 100% rename from LEGO1/dllmain.cpp rename to lego1/src/dllmain.cpp diff --git a/LEGO1/legoomni.cpp b/lego1/src/legoomni.cpp similarity index 100% rename from LEGO1/legoomni.cpp rename to lego1/src/legoomni.cpp diff --git a/LEGO1/mxcore.cpp b/lego1/src/mxcore.cpp similarity index 100% rename from LEGO1/mxcore.cpp rename to lego1/src/mxcore.cpp diff --git a/LEGO1/mxcriticalsection.cpp b/lego1/src/mxcriticalsection.cpp similarity index 100% rename from LEGO1/mxcriticalsection.cpp rename to lego1/src/mxcriticalsection.cpp diff --git a/LEGO1/mxomnicreateparambase.cpp b/lego1/src/mxomnicreateparambase.cpp similarity index 100% rename from LEGO1/mxomnicreateparambase.cpp rename to lego1/src/mxomnicreateparambase.cpp diff --git a/scripts/cm420 b/scripts/cm420 new file mode 100755 index 00000000..4d0ad42b --- /dev/null +++ b/scripts/cm420 @@ -0,0 +1,8 @@ +#!/bin/bash +# Helper wrapper to use the Linux MSVC4.2 toolchain +# This requires ISLE_KIT_ROOT to be set properly. + +cmake \ + --toolchain cmake/Toolchain/msvc42-linux.cmake \ + -DCMAKE_CROSSCOMPILING_EMULATOR=/usr/bin/wine \ + $@