jiuyhfdj/wdsm_cocos_lua_debug_shell
# WDSM Cocos-Lua Debug Shell 这是从 D:\UU\23707_wdsm_wdsm_3k_20260319_28719_m0.apk 逆向整理出的 Cocos2d-x Lua Win32 调试壳工程,用于继续恢复、修改和预览游戏 UI / 建筑功能。 给 Max 接手先读 D:\UU\wdsm_cocos_lua_debug_shell\MAX_START_HERE.md D:\UU\wdsm_cocos_lua_debug_shell\MAX_RUNBOOK.md D:\UU\wdsm_cocos_lua_debug_shell\MAX_TASK_STATE.md D:\UU\wdsm_cocos_lua_debug_shell\MAX_PROJECT_INDEX.md D:\UU\wdsm_cocos_lua_debug_shell\work\mission-state.md 快速启动… See the full description on the dataset page: https://huggingface.co/datasets/jiuyhfdj/wdsm_cocos_lua_debug_shell.
018
1#!/usr/bin/env bash2set -euo pipefail3 4PROJECT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"5EXE_PATH="${PROJECT_DIR}/simulator/win32/wdsm_cocos_lua_debug_shell.exe"6BOTTLE_NAME="${WDSM_WHISKY_BOTTLE:-wdsm}"7LOG_DIR="${PROJECT_DIR}/work"8WINE_LOG="${LOG_DIR}/mac_wine_preview.log"9LUA_LOG="${PROJECT_DIR}/simulator/win32/wdsm_debug_shell.log"10 11WHISKY_APP="${HOME}/Applications/Whisky.app"12if [[ ! -x "${WHISKY_APP}/Contents/Resources/WhiskyCmd" ]]; then13 WHISKY_APP="/Applications/Whisky.app"14fi15 16WHISKY_CMD="${WHISKY_APP}/Contents/Resources/WhiskyCmd"17if [[ ! -x "${WHISKY_CMD}" ]]; then18 echo "WhiskyCmd not found. Install Whisky first." >&219 exit 120fi21 22if [[ ! -f "${EXE_PATH}" ]]; then23 echo "Preview executable not found: ${EXE_PATH}" >&224 exit 125fi26 27if ! "${WHISKY_CMD}" list | awk 'NR > 3 {print $2}' | grep -qx "${BOTTLE_NAME}"; then28 "${WHISKY_CMD}" create "${BOTTLE_NAME}"29fi30 31eval "$("${WHISKY_CMD}" shellenv "${BOTTLE_NAME}")"32 33if ! command -v wine64 >/dev/null 2>&1; then34 echo "wine64 not found in Whisky runtime. Open Whisky once and finish its Wine setup." >&235 exit 136fi37 38mkdir -p "${LOG_DIR}"39 40RESOURCES_DIR="${PROJECT_DIR}/simulator/win32/Resources"41mkdir -p "${RESOURCES_DIR}"42for name in src res preview_assets jit64 kkk_res; do43 target="${PROJECT_DIR}/${name}"44 link="${RESOURCES_DIR}/${name}"45 if [[ -e "${target}" || -L "${target}" ]]; then46 rm -rf "${link}"47 ln -s "${target}" "${link}"48 fi49done50 51find "${PROJECT_DIR}/simulator/win32" -maxdepth 1 -type f -name '._*' -delete52find "${RESOURCES_DIR}" -maxdepth 1 -type f -name '._*' -delete53 54cd "${PROJECT_DIR}/simulator/win32"55rm -f "${WINE_LOG}" "${LUA_LOG}"56export WINEDEBUG="${WDSM_WINEDEBUG:-+wgl,+opengl,+seh,+macdrv}"57 58echo "Starting WDSM Cocos Win32 preview through Whisky bottle '${BOTTLE_NAME}'..."59echo "Wine log: ${WINE_LOG}"60wine64 ./wdsm_cocos_lua_debug_shell.exe >"${WINE_LOG}" 2>&1 &61launcher_pid=$!62 63for _ in $(seq 1 25); do64 if [[ -s "${LUA_LOG}" ]]; then65 echo "Lua started: ${LUA_LOG}"66 wait "${launcher_pid}" || true67 exit 068 fi69 if ! kill -0 "${launcher_pid}" >/dev/null 2>&1 && ! pgrep -f 'wdsm_cocos_lua_debug_shell.exe' >/dev/null 2>&1; then70 break71 fi72 sleep 173done74 75if [[ ! -s "${LUA_LOG}" ]]; then76 echo77 echo "The preview did not reach Lua startup, so no visible Cocos game window was created."78 if grep -qE 'wglMakeCurrent returned|macdrv_surface_create|experimental wow64' "${WINE_LOG}" 2>/dev/null; then79 echo "Detected Whisky/Wine WGL/OpenGL startup failure for this 32-bit Cocos Win32 executable."80 fi81 echo "Wine log: ${WINE_LOG}"82 echo "Expected Lua log, if startup succeeds: ${LUA_LOG}"83 echo "Use Windows, CrossOver, a Windows VM, or rebuild a native macOS Cocos app from full Cocos sources."84 pkill -f 'wdsm_cocos_lua_debug_shell.exe' >/dev/null 2>&1 || true85 exit 286fi87 