From 34d29bd02361074ee594d1d02282e09a1900e9a0 Mon Sep 17 00:00:00 2001 From: luboslenco Date: Tue, 17 Jun 2025 00:03:00 +0200 Subject: [PATCH] Build fixes --- base/sources/libs/kong/dir.c | 5 ++- base/tools/make.js | 64 ++-------------------------------- base/tools/pad/project.js | 2 +- base/tools/pad/sources/main.ts | 4 +-- 4 files changed, 9 insertions(+), 66 deletions(-) diff --git a/base/sources/libs/kong/dir.c b/base/sources/libs/kong/dir.c index 9e89d64e..b84c3984 100644 --- a/base/sources/libs/kong/dir.c +++ b/base/sources/libs/kong/dir.c @@ -18,7 +18,10 @@ directory open_dir(const char *dirname) { directory dir; dir.handle = FindFirstFileA(pattern, &data); if (dir.handle == INVALID_HANDLE_VALUE) { - kong_log(LOG_LEVEL_ERROR, "FindFirstFile failed (%d)\n", GetLastError()); + //// + // kong_log(LOG_LEVEL_ERROR, "FindFirstFile failed (%d)\n", GetLastError()); + printf("FindFirstFile failed (%d)\n", GetLastError()); + //// exit(1); } FindNextFileA(dir.handle, &data); diff --git a/base/tools/make.js b/base/tools/make.js index 70d7b3ce..08517d18 100644 --- a/base/tools/make.js +++ b/base/tools/make.js @@ -669,66 +669,6 @@ class VisualStudioExporter extends Exporter { this.p('', indent); } - windowsSDKs() { - // Environment* env = Environment::GetCurrent(args); - // Isolate* isolate = env->isolate(); - // std::vector> result; - // HKEY key; - // LSTATUS status = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows Kits\\Installed Roots", 0, KEY_READ | KEY_QUERY_VALUE, &key); - // char name[256]; - // DWORD nameLength; - // for (DWORD i = 0;; ++i) { - // nameLength = sizeof(name); - // status = RegEnumKeyExA(key, i, &name[0], &nameLength, NULL, NULL, NULL, NULL); - // if (status != ERROR_SUCCESS) { - // break; - // } - // result.emplace_back(String::NewFromUtf8(isolate, name).ToLocalChecked()); - // } - // RegCloseKey(key); - // args.GetReturnValue().Set(Array::New(isolate, result.data(), result.size())); - } - - findWindowsSdk() { - let sdks = windowsSDKs(); - let best = [0, 0, 0, 0]; - for (let key of sdks) { - let elements = key.split('\\'); - let last = elements[elements.length - 1]; - if (last.indexOf('.') >= 0) { - let numstrings = last.split('.'); - let nums = []; - for (let str of numstrings) { - nums.push(parseInt(str)); - } - if (nums[0] > best[0]) { - best = nums; - } - else if (nums[0] === best[0]) { - if (nums[1] > best[1]) { - best = nums; - } - else if (nums[1] === best[1]) { - if (nums[2] > best[2]) { - best = nums; - } - else if (nums[2] === best[2]) { - if (nums[3] > best[3]) { - best = nums; - } - } - } - } - } - } - if (best[0] > 0) { - return best[0] + '.' + best[1] + '.' + best[2] + '.' + best[3]; - } - else { - return null; - } - } - globals(indent) { if (goptions.visualstudio === 'vs2022') { this.p('16.0', indent); @@ -2672,8 +2612,8 @@ function write_ts_project(projectdir, options) { let files = fs_readdir(src); if (src.endsWith(".ts")) { // Add file instead of dir - files = [src.substring(src.lastIndexOf("/") + 1, src.length)]; - src = src.substring(0, src.lastIndexOf("/")); + files = [src.substring(src.lastIndexOf(path_sep) + 1, src.length)]; + src = src.substring(0, src.lastIndexOf(path_sep)); } for (let file of files) { if (file.endsWith(".ts")) { diff --git a/base/tools/pad/project.js b/base/tools/pad/project.js index e44bd3b7..863fe8a2 100644 --- a/base/tools/pad/project.js +++ b/base/tools/pad/project.js @@ -9,7 +9,7 @@ flags.lite = true; let project = new Project("ArmorPad"); project.add_tsfiles("sources"); -project.add_shaders("../../shaders/draw/*.kong",); +project.add_shaders("../../shaders/draw/*.kong"); project.add_assets("../../assets/font_mono.ttf", { destination: "data/{name}" }); project.add_assets("../../assets/text_coloring.json", { destination: "data/{name}" }); project.add_tsfiles("../../sources/ts/iron"); diff --git a/base/tools/pad/sources/main.ts b/base/tools/pad/sources/main.ts index 1112d3a6..a0a51e1d 100644 --- a/base/tools/pad/sources/main.ts +++ b/base/tools/pad/sources/main.ts @@ -48,7 +48,7 @@ function encode_storage(): string { return config_json; } -function shutdown() { +function on_shutdown() { let storage_string: string = sys_string_to_buffer(encode_storage()); iron_file_save_bytes(iron_internal_save_path() + "/config.json", storage_string, 0); } @@ -118,7 +118,7 @@ function main() { sys_notify_on_frames(render); _iron_set_drop_files_callback(drop_files); - iron_set_application_state_callback(null, null, null, null, shutdown); + iron_set_application_state_callback(null, null, null, null, on_shutdown); } function armpack_to_string(bytes: buffer_t): string {