godothub/godot-minigame / skills
godot-wechat-minigame-adapter
UnverifiedApply the bundled self-contained Godot WeChat Mini Game adapter kit to an official Godot checkout. Use when the user wants to port official Godot to WeChat Mini Game, refresh a nearby 4.6-based port, or inspect the shipped patch/source bundle for WXMEMFS, `wx.request`, audio cleanup, display/input, WXGLX dual-path rendering, `.wasm.br`, and `wx.exitMiniProgram`. This skill is version-locked to the bundled upstream base and must not be described as a generic “Godot 4.x” patch dump.
assets/min-runtime/godot-sdk.js
View on GitHub(function (global) {
const root = global;
const windowObject = root.window || root;
const gameGlobal = root.GameGlobal || (root.GameGlobal = {});
const wxApi = root.wx;
const nowStart = Date.now();
function nowPolyfill() {
return Date.now() - nowStart;
}
root.nowPolyfill = nowPolyfill;
windowObject.nowPolyfill = nowPolyfill;
gameGlobal.nowPolyfill = nowPolyfill;
const fsUtils = {
localFetch(filePath) {
return new Promise(function (resolve, reject) {
if (!wxApi || !wxApi.getFileSystemManager) {
reject(new Error("wx.getFileSystemManager is not available"));
return;
}
wxApi.getFileSystemManager().readFile({
filePath: filePath,
success: function (res) {
resolve(res.data);
},
fail: function (err) {
reject(new Error(err && err.errMsg ? err.errMsg : "readFile failed"));
},
});
});
},
loadSubpackage(name, onProgress, onComplete) {
if (!wxApi || typeof wxApi.loadSubpackage !== "function") {
const error = new Error("wx.loadSubpackage is not available");
if (typeof onComplete === "function") {
onComplete(error);
}
return null;
}
const task = wxApi.loadSubpackage({
name: name,
success: function () {
if (typeof onComplete === "function") {
onComplete(null);
}
},
fail: function (res) {
const message = res && res.errMsg ? res.errMsg : "loadSubpackage failed";
if (typeof onComplete === "function") {
onComplete(new Error(message));
}
},
});
if (task && typeof onProgress === "function" && typeof task.onProgressUpdate === "function") {
task.onProgressUpdate(onProgress);
}
return task;
},
};
root.fsUtils = fsUtils;
windowObject.fsUtils = fsUtils;
gameGlobal.fsUtils = fsUtils;
const globalAdapter = root.__globalAdapter || {};
root.__globalAdapter = globalAdapter;
windowObject.__globalAdapter = globalAdapter;
[
"showKeyboard",
"hideKeyboard",
"updateKeyboard",
"onKeyboardInput",
"onKeyboardConfirm",
"onKeyboardComplete",
"offKeyboardInput",
"offKeyboardConfirm",
"offKeyboardComplete",
].forEach(function (method) {
if (wxApi && typeof wxApi[method] === "function") {
globalAdapter[method] = wxApi[method].bind(wxApi);
} else if (typeof globalAdapter[method] !== "function") {
globalAdapter[method] = function () {};
}
});
const WEBAudio = {
audioContext: null,
};
function initAudio() {
if (WEBAudio.audioContext || !wxApi || typeof wxApi.createWebAudioContext !== "function") {
return WEBAudio.audioContext;
}
WEBAudio.audioContext = wxApi.createWebAudioContext();
if (typeof wxApi.onHide === "function") {
wxApi.onHide(function () {
if (WEBAudio.audioContext && typeof WEBAudio.audioContext.suspend === "function") {
WEBAudio.audioContext.suspend();
}
});
}
if (typeof wxApi.onShow === "function") {
wxApi.onShow(function () {
if (WEBAudio.audioContext && typeof WEBAudio.audioContext.resume === "function") {
WEBAudio.audioContext.resume();
}
});
}
return WEBAudio.audioContext;
}
const audio = {
WEBAudio: WEBAudio,
init: initAudio,
};
initAudio();
function getCanvas() {
return root.canvas || gameGlobal.canvas || windowObject.canvas;
}
function startGame(executable, pack) {
const loader = gameGlobal.godotLoader;
if (!root.Engine) {
return Promise.reject(new Error("Engine is not available"));
}
if (typeof root.Engine.isWebGLAvailable === "function" && !root.Engine.isWebGLAvailable()) {
if (loader) {
loader.currentText = "WebGL not available!";
}
return Promise.reject(new Error("WebGL not available"));
}
if (loader && loader.config && loader.config.textConfig) {
loader.currentText = loader.config.textConfig.compilingText;
}
const engine = new root.Engine({ canvas: getCanvas() });
gameGlobal.GODOTSDK.engine = engine;
return Promise.all([engine.init(executable), engine.preloadFile(pack)])
.then(function () {
if (loader && loader.config && loader.config.textConfig) {
loader.currentText = loader.config.textConfig.initText;
}
if (loader && typeof loader.cleanup === "function") {
loader.cleanup();
}
return engine.start({
args: ["--main-pack", pack],
onProgress: function (current, total) {
console.log("Loaded " + current + " of " + total + " bytes");
},
});
})
.then(function () {
if (loader && loader.config && loader.config.textConfig) {
loader.currentText = loader.config.textConfig.completeText;
}
});
}
const GODOTSDK = gameGlobal.GODOTSDK || {};
GODOTSDK.audio = audio;
GODOTSDK.startGame = startGame;
GODOTSDK.copy_to_fs = function (path, buffer) {
const engine = GODOTSDK.engine;
if (!engine || !engine.rtenv || typeof engine.rtenv.copyToFS !== "function") {
throw new Error("GODOTSDK.engine.rtenv.copyToFS is not available");
}
engine.rtenv.copyToFS(path, buffer);
};
GODOTSDK.load_pack = function (subpackage, pck, progressCall, onTaskDone) {
fsUtils.loadSubpackage(subpackage, progressCall, function (error) {
if (error) {
if (typeof onTaskDone === "function") {
onTaskDone(error);
}
return;
}
const engine = GODOTSDK.engine;
if (!engine) {
if (typeof onTaskDone === "function") {
onTaskDone(new Error("GODOTSDK.engine is not available"));
}
return;
}
engine.preloadFile(pck).then(function () {
engine.preloader.preloadedFiles.forEach(function (file) {
engine.rtenv.copyToFS(file.path, file.buffer);
});
engine.preloader.preloadedFiles.length = 0;
if (typeof progressCall === "function") {
progressCall(100);
}
if (typeof onTaskDone === "function") {
onTaskDone(null);
}
}).catch(function (loadError) {
if (typeof onTaskDone === "function") {
onTaskDone(loadError);
}
});
});
};
gameGlobal.GODOTSDK = GODOTSDK;
if (gameGlobal.WXWebAssembly) {
root.WebAssembly = gameGlobal.WXWebAssembly;
windowObject.WebAssembly = gameGlobal.WXWebAssembly;
gameGlobal.WebAssembly = gameGlobal.WXWebAssembly;
gameGlobal.CCWebAssembly = gameGlobal.WXWebAssembly;
}
})(typeof globalThis !== "undefined" ? globalThis : this);
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis. | Stars: 472k | Updated | Claude CodeCodex | Verified | Install |
| diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness. | Stars: 323k | Updated | Claude CodeCodex | Verified | Install |
| dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependencies | Stars: 323k | Updated | Claude CodeCodex | Verified | Install |
| executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is available | Stars: 323k | Updated | Claude CodeCodex | Verified | Install |