2012-06-19 21:15:56 -03:00
|
|
|
-- this is the first file executed when the application starts
|
|
|
|
|
-- we have to load the first modules form here
|
2023-05-13 19:51:28 -03:00
|
|
|
|
|
|
|
|
-- updater
|
2023-05-11 11:38:24 -03:00
|
|
|
Services = {
|
2024-06-21 18:10:07 -03:00
|
|
|
--updater = "http://localhost/api/updater.php", --./updater
|
2024-11-07 23:37:37 -03:00
|
|
|
--status = "http://localhost/login.php", --./client_entergame | ./client_topmenu
|
2024-06-21 18:10:07 -03:00
|
|
|
--websites = "http://localhost/?subtopic=accountmanagement", --./client_entergame "Forgot password and/or email"
|
2025-04-04 13:41:07 -03:00
|
|
|
--createAccount = "http://localhost/clientcreateaccount.php", --./client_entergame -- createAccount.lua
|
2026-01-06 04:13:52 -08:00
|
|
|
--getCoinsUrl = "http://localhost/?subtopic=shop&step=terms", --./game_market
|
feat(client): add automatic modern asset installation (#1727)
Add automatic client-asset installation for modern Tibia versions in OTC, with the UI and runtime support needed for a safe download-and-install flow.
Main changes:
- Add modules/client_assets to orchestrate descriptor and release resolution, downloads, retries, cancellation, archive extraction, optional LZMA handling, and SHA-256 integrity checks.
- Add richer install logs in the console, including download phases, install phases, and final install paths.
- Add support for packaged runtime files, including large DLLs distributed through archives.
- Make client_entergame depend on client_assets.
- Check required assets during login for modern clients version 1281 and newer.
- Prompt the user to download missing modern assets instead of requiring manual setup.
- Allow the client list and version selection to work with installed modern asset sets.
Install layout:
- Install things assets under data/things/<version>.
- Install sound assets under data/sounds/<version>.
- Keep extra runtime files in the existing client root/bin flow.
- Preserve the existing OTC asset layout as the source of truth instead of introducing a separate permanent path.
UI improvements:
- Improve missing-assets and progress dialog sizing and text wrapping.
- Improve progress behavior for downloads without Content-Length.
- Add indeterminate progress behavior for unknown-length phases.
- Add an hourglass busy indicator for indeterminate phases.
- Reduce the perception that the installer is stuck during long extraction steps.
Runtime and build support:
- Add libarchive usage and linking for archive extraction.
- Add SHA-256 helpers and Lua bindings used by client_assets.
- Add safer extraction and path normalization in ResourceManager.
- Adjust the Emscripten HTTP login path to follow the same HTTP/HTTPS fallback behavior used by native login.
Security and integrity:
- Enable strictManifestSha256 by default.
- Disable raw fallback on hash mismatch by default.
- Key releasesCache per source URL and repository to avoid stale cross-source cache reuse.
- Add an LZMA decompression output cap to reduce memory-exhaustion risk.
Compatibility:
- Keep existing classic asset behavior unchanged.
- Use the new auto-install flow only for modern versions when required assets are missing.
- Keep the scope limited to client-side asset automation and required runtime support.
- No server-side Canary behavior is changed by this PR.
This makes modern client setup safer and more automatic by downloading, validating, extracting, and installing missing assets directly from OTC while preserving the existing classic asset flow.
2026-05-28 16:18:44 -03:00
|
|
|
clientAssets = {
|
|
|
|
|
enabled = true,
|
|
|
|
|
repository = "dudantas/tibia-client",
|
|
|
|
|
installSounds = true,
|
|
|
|
|
strictManifestSha256 = true,
|
|
|
|
|
allowRawFallbackHashMismatch = false,
|
fix: make client asset installation archive-first (#1739)
Restore archive first modern client asset installation
This commit reworks the modern client asset auto installation flow so the normal path is based on downloading and extracting the GitHub release or source ZIP instead of relying on the manifest flow as the primary installer.
The installer now keeps the final runtime files in the same locations already expected by OTClient. Asset files are installed under data things version, sound files are installed under data sounds version, and configured runtime extras are installed into their expected runtime locations such as bin.
The manifest based path is still kept as a compatibility fallback, but it is no longer the preferred installation path for modern client assets. This restores the archive first behavior and makes the install result match the standard runtime loader layout more directly.
For client versions 1281 and newer, OTClient now checks the existing files under data things version before attempting installation. When auto install is enabled and the required files are missing, the client prompts the user, downloads the configured release or source ZIP, extracts the assets folder into data things version, extracts the sounds folder into data sounds version, and installs configured runtime extras into their target runtime paths.
If Services clientAssets enabled is false, OTClient now skips the asset ensure download flow during login. This avoids recursive login attempts caused by the installer prompt and keeps manual or custom asset folders usable. In that mode, OTClient proceeds with the provided local files and lets the normal runtime loader report missing or invalid assets when appropriate.
The archive extraction support was also expanded. ZIP extraction now works through the vendored minizip fallback when libarchive is not available. Visual Studio project configuration was updated to enable libarchive so Windows builds can handle ZIP and RAR archive extraction. Android builds remain safe because unsupported libarchive linkage is not required there.
Main changes included in this commit
• Restores archive first installation for modern client assets
• Keeps the manifest path only as a compatibility fallback
• Downloads the GitHub release or source ZIP as the normal install path
• Extracts assets into data things version
• Extracts sounds into data sounds version
• Installs runtime extras into their expected runtime locations such as bin
• Keeps final installed files in the same OTClient runtime paths already used by the loader
• Adds ZIP extraction support through the vendored minizip fallback
• Enables libarchive in the Visual Studio project for Windows archive extraction
• Allows Windows builds to handle ZIP and RAR extraction through libarchive
• Preserves Android build safety by not requiring unsupported libarchive linkage
• Skips asset ensure and download prompts when Services clientAssets enabled is false
• Avoids recursive login attempts when asset auto install is disabled
• Keeps manual and custom asset folders usable
• Lets the normal runtime loader report actual missing or invalid files when auto install is disabled
• Documents the archive first flow fallback behavior install paths and troubleshooting notes
Runtime behavior
For modern client versions 1281 and newer, OTClient first checks the existing files under data things version. If the files are already present, login continues without triggering the installer.
If files are missing and auto install is enabled, OTClient prompts the user and installs assets from the configured GitHub release or source archive. The archive folders are mapped into the runtime locations expected by the client.
The assets folder is installed into data things version. The sounds folder is installed into data sounds version. Runtime extras such as bin files are installed into their configured runtime destinations.
If auto install is disabled, the installer is not called during login. The client continues with the manually provided files and the regular loader remains responsible for reporting any actual asset problems.
Verification performed
• luac p modules client assets client assets lua init lua
• luac p modules client entergame entergame lua
• git diff check
• Local Windows build using vc18 otclient sln OpenGL x64 Build
• GitHub Actions fast checks passed on the PR branch
• GitHub Actions Lua syntax checks passed on the PR branch
Overall this commit restores the expected archive based installation flow for modern client assets while preserving compatibility fallback behavior. It keeps installed files aligned with the existing OTClient runtime layout improves archive extraction support across build targets and avoids unwanted installer prompts when automatic asset installation is disabled.
2026-06-12 09:11:21 -03:00
|
|
|
allowMissingPackedRawFallback = true,
|
feat(client): add automatic modern asset installation (#1727)
Add automatic client-asset installation for modern Tibia versions in OTC, with the UI and runtime support needed for a safe download-and-install flow.
Main changes:
- Add modules/client_assets to orchestrate descriptor and release resolution, downloads, retries, cancellation, archive extraction, optional LZMA handling, and SHA-256 integrity checks.
- Add richer install logs in the console, including download phases, install phases, and final install paths.
- Add support for packaged runtime files, including large DLLs distributed through archives.
- Make client_entergame depend on client_assets.
- Check required assets during login for modern clients version 1281 and newer.
- Prompt the user to download missing modern assets instead of requiring manual setup.
- Allow the client list and version selection to work with installed modern asset sets.
Install layout:
- Install things assets under data/things/<version>.
- Install sound assets under data/sounds/<version>.
- Keep extra runtime files in the existing client root/bin flow.
- Preserve the existing OTC asset layout as the source of truth instead of introducing a separate permanent path.
UI improvements:
- Improve missing-assets and progress dialog sizing and text wrapping.
- Improve progress behavior for downloads without Content-Length.
- Add indeterminate progress behavior for unknown-length phases.
- Add an hourglass busy indicator for indeterminate phases.
- Reduce the perception that the installer is stuck during long extraction steps.
Runtime and build support:
- Add libarchive usage and linking for archive extraction.
- Add SHA-256 helpers and Lua bindings used by client_assets.
- Add safer extraction and path normalization in ResourceManager.
- Adjust the Emscripten HTTP login path to follow the same HTTP/HTTPS fallback behavior used by native login.
Security and integrity:
- Enable strictManifestSha256 by default.
- Disable raw fallback on hash mismatch by default.
- Key releasesCache per source URL and repository to avoid stale cross-source cache reuse.
- Add an LZMA decompression output cap to reduce memory-exhaustion risk.
Compatibility:
- Keep existing classic asset behavior unchanged.
- Use the new auto-install flow only for modern versions when required assets are missing.
- Keep the scope limited to client-side asset automation and required runtime support.
- No server-side Canary behavior is changed by this PR.
This makes modern client setup safer and more automatic by downloading, validating, extracting, and installing missing assets directly from OTC while preserving the existing classic asset flow.
2026-05-28 16:18:44 -03:00
|
|
|
preferArchive = true,
|
fix: make client asset installation archive-first (#1739)
Restore archive first modern client asset installation
This commit reworks the modern client asset auto installation flow so the normal path is based on downloading and extracting the GitHub release or source ZIP instead of relying on the manifest flow as the primary installer.
The installer now keeps the final runtime files in the same locations already expected by OTClient. Asset files are installed under data things version, sound files are installed under data sounds version, and configured runtime extras are installed into their expected runtime locations such as bin.
The manifest based path is still kept as a compatibility fallback, but it is no longer the preferred installation path for modern client assets. This restores the archive first behavior and makes the install result match the standard runtime loader layout more directly.
For client versions 1281 and newer, OTClient now checks the existing files under data things version before attempting installation. When auto install is enabled and the required files are missing, the client prompts the user, downloads the configured release or source ZIP, extracts the assets folder into data things version, extracts the sounds folder into data sounds version, and installs configured runtime extras into their target runtime paths.
If Services clientAssets enabled is false, OTClient now skips the asset ensure download flow during login. This avoids recursive login attempts caused by the installer prompt and keeps manual or custom asset folders usable. In that mode, OTClient proceeds with the provided local files and lets the normal runtime loader report missing or invalid assets when appropriate.
The archive extraction support was also expanded. ZIP extraction now works through the vendored minizip fallback when libarchive is not available. Visual Studio project configuration was updated to enable libarchive so Windows builds can handle ZIP and RAR archive extraction. Android builds remain safe because unsupported libarchive linkage is not required there.
Main changes included in this commit
• Restores archive first installation for modern client assets
• Keeps the manifest path only as a compatibility fallback
• Downloads the GitHub release or source ZIP as the normal install path
• Extracts assets into data things version
• Extracts sounds into data sounds version
• Installs runtime extras into their expected runtime locations such as bin
• Keeps final installed files in the same OTClient runtime paths already used by the loader
• Adds ZIP extraction support through the vendored minizip fallback
• Enables libarchive in the Visual Studio project for Windows archive extraction
• Allows Windows builds to handle ZIP and RAR extraction through libarchive
• Preserves Android build safety by not requiring unsupported libarchive linkage
• Skips asset ensure and download prompts when Services clientAssets enabled is false
• Avoids recursive login attempts when asset auto install is disabled
• Keeps manual and custom asset folders usable
• Lets the normal runtime loader report actual missing or invalid files when auto install is disabled
• Documents the archive first flow fallback behavior install paths and troubleshooting notes
Runtime behavior
For modern client versions 1281 and newer, OTClient first checks the existing files under data things version. If the files are already present, login continues without triggering the installer.
If files are missing and auto install is enabled, OTClient prompts the user and installs assets from the configured GitHub release or source archive. The archive folders are mapped into the runtime locations expected by the client.
The assets folder is installed into data things version. The sounds folder is installed into data sounds version. Runtime extras such as bin files are installed into their configured runtime destinations.
If auto install is disabled, the installer is not called during login. The client continues with the manually provided files and the regular loader remains responsible for reporting any actual asset problems.
Verification performed
• luac p modules client assets client assets lua init lua
• luac p modules client entergame entergame lua
• git diff check
• Local Windows build using vc18 otclient sln OpenGL x64 Build
• GitHub Actions fast checks passed on the PR branch
• GitHub Actions Lua syntax checks passed on the PR branch
Overall this commit restores the expected archive based installation flow for modern client assets while preserving compatibility fallback behavior. It keeps installed files aligned with the existing OTClient runtime layout improves archive extraction support across build targets and avoids unwanted installer prompts when automatic asset installation is disabled.
2026-06-12 09:11:21 -03:00
|
|
|
fallbackToArchiveOnManifestFailure = false,
|
feat(client): add automatic modern asset installation (#1727)
Add automatic client-asset installation for modern Tibia versions in OTC, with the UI and runtime support needed for a safe download-and-install flow.
Main changes:
- Add modules/client_assets to orchestrate descriptor and release resolution, downloads, retries, cancellation, archive extraction, optional LZMA handling, and SHA-256 integrity checks.
- Add richer install logs in the console, including download phases, install phases, and final install paths.
- Add support for packaged runtime files, including large DLLs distributed through archives.
- Make client_entergame depend on client_assets.
- Check required assets during login for modern clients version 1281 and newer.
- Prompt the user to download missing modern assets instead of requiring manual setup.
- Allow the client list and version selection to work with installed modern asset sets.
Install layout:
- Install things assets under data/things/<version>.
- Install sound assets under data/sounds/<version>.
- Keep extra runtime files in the existing client root/bin flow.
- Preserve the existing OTC asset layout as the source of truth instead of introducing a separate permanent path.
UI improvements:
- Improve missing-assets and progress dialog sizing and text wrapping.
- Improve progress behavior for downloads without Content-Length.
- Add indeterminate progress behavior for unknown-length phases.
- Add an hourglass busy indicator for indeterminate phases.
- Reduce the perception that the installer is stuck during long extraction steps.
Runtime and build support:
- Add libarchive usage and linking for archive extraction.
- Add SHA-256 helpers and Lua bindings used by client_assets.
- Add safer extraction and path normalization in ResourceManager.
- Adjust the Emscripten HTTP login path to follow the same HTTP/HTTPS fallback behavior used by native login.
Security and integrity:
- Enable strictManifestSha256 by default.
- Disable raw fallback on hash mismatch by default.
- Key releasesCache per source URL and repository to avoid stale cross-source cache reuse.
- Add an LZMA decompression output cap to reduce memory-exhaustion risk.
Compatibility:
- Keep existing classic asset behavior unchanged.
- Use the new auto-install flow only for modern versions when required assets are missing.
- Keep the scope limited to client-side asset automation and required runtime support.
- No server-side Canary behavior is changed by this PR.
This makes modern client setup safer and more automatic by downloading, validating, extracting, and installing missing assets directly from OTC while preserving the existing classic asset flow.
2026-05-28 16:18:44 -03:00
|
|
|
installArchiveExtras = true,
|
|
|
|
|
archiveExtraPrefixes = { "bin" },
|
|
|
|
|
installPackagedFiles = true
|
|
|
|
|
}, -- ./client_assets
|
2023-05-11 11:38:24 -03:00
|
|
|
}
|
|
|
|
|
|
2026-01-26 12:39:45 -08:00
|
|
|
--- Enables or disables the entire server configuration block.
|
|
|
|
|
-- Set to `false` to disable all configuration below.
|
|
|
|
|
local ENABLE_SERVERS = true
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
-- @module Servers_init
|
|
|
|
|
-- Configuration table for all servers used by the system.
|
|
|
|
|
--
|
|
|
|
|
-- This entire block is conditionally enabled based on ENABLE_SERVERS.
|
|
|
|
|
-- When ENABLE_SERVERS == false, everything is ignored/disabled.
|
|
|
|
|
--
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
-- Server configuration system for multi-server or multi-world clients.
|
|
|
|
|
--
|
|
|
|
|
-- This structure allows a single client build to connect to multiple servers
|
|
|
|
|
-- without requiring duplicate client folders.
|
|
|
|
|
--
|
|
|
|
|
-- A server that hosts several worlds, or that provides a separate test environment,
|
|
|
|
|
-- can simply define additional entries inside this configuration table.
|
|
|
|
|
--
|
|
|
|
|
-- Instead of maintaining multiple client installations (one per world/server),
|
|
|
|
|
-- the client can switch between servers by selecting the desired configuration entry.
|
|
|
|
|
-- This simplifies testing, avoids redundant directories, and centralizes connection settings.
|
|
|
|
|
--
|
|
|
|
|
-- The ENABLE_SERVERS flag allows the entire configuration block to be enabled or disabled
|
|
|
|
|
-- without deleting or commenting out individual entries.
|
|
|
|
|
--
|
|
|
|
|
|
|
|
|
|
Servers_init = {}
|
|
|
|
|
|
|
|
|
|
if ENABLE_SERVERS then
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
-- List of servers and their configuration parameters.
|
|
|
|
|
-- Each entry defines port, protocol, and authentication options.
|
|
|
|
|
-- @table Servers_init
|
|
|
|
|
--
|
|
|
|
|
Servers_init = {
|
|
|
|
|
|
|
|
|
|
-- Local login server
|
|
|
|
|
---
|
|
|
|
|
-- Configuration for local login server.
|
|
|
|
|
-- @class table
|
|
|
|
|
-- @name local_login
|
|
|
|
|
-- @field port Port used for HTTP connection
|
|
|
|
|
-- @field protocol Protocol identifier used by the application
|
|
|
|
|
-- @field httpLogin Enables HTTP-based login on the server
|
|
|
|
|
-- @field useAuthenticator Enables additional authentication layer
|
|
|
|
|
--
|
|
|
|
|
["http://127.0.0.1/login.php"] = {
|
|
|
|
|
port = 80,
|
2026-05-26 14:36:14 -03:00
|
|
|
protocol = 1511,
|
2026-01-26 12:39:45 -08:00
|
|
|
httpLogin = true,
|
|
|
|
|
useAuthenticator = false
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
-- External server
|
|
|
|
|
---
|
|
|
|
|
-- Configuration for external server ip.net.
|
|
|
|
|
-- @class table
|
|
|
|
|
-- @name ip_net
|
|
|
|
|
-- @field port TCP port used for connection
|
|
|
|
|
-- @field protocol Protocol identifier used by the server
|
|
|
|
|
-- @field httpLogin Indicates if the server allows HTTP login
|
|
|
|
|
--
|
|
|
|
|
["ip.net"] = {
|
|
|
|
|
port = 7171,
|
|
|
|
|
protocol = 860,
|
|
|
|
|
httpLogin = false
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
end
|
2024-06-21 18:10:07 -03:00
|
|
|
|
2023-06-30 20:13:09 -03:00
|
|
|
g_app.setName("OTClient - Redemption");
|
|
|
|
|
g_app.setCompactName("otclient");
|
2023-11-28 13:23:06 -03:00
|
|
|
g_app.setOrganizationName("otcr");
|
2023-06-30 20:13:09 -03:00
|
|
|
|
2023-05-11 11:38:24 -03:00
|
|
|
g_app.hasUpdater = function()
|
|
|
|
|
return (Services.updater and Services.updater ~= "" and g_modules.getModule("updater"))
|
|
|
|
|
end
|
|
|
|
|
|
2012-06-19 21:15:56 -03:00
|
|
|
-- setup logger
|
2022-11-17 15:35:27 -03:00
|
|
|
g_logger.setLogFile(g_resources.getWorkDir() .. g_app.getCompactName() .. '.log')
|
feat: add spdlog backend and centralize logging (#1643)
Add spdlog as the new logging backend and refactor the codebase to use the centralized g_logger interface instead of direct stdout and stderr output.
Main changes:
- Add spdlog-based logger implementation.
- Replace direct std::cout, std::clog, std::cerr, and std::endl usage with g_logger calls.
- Add log level support for debug, warning, error, and related output paths.
- Add consistent console and file logging through spdlog sinks.
- Add custom log formatting and startup timestamp logging.
- Add dynamic sink management for logger output.
- Refactor HTTP and proxy logging to use g_logger with appropriate log levels.
- Add sanitization and redaction for HTTP request and response logs.
- Improve log consistency so output can be filtered and managed from one logging path.
Build changes:
- Add find_package(spdlog CONFIG REQUIRED).
- Link spdlog::spdlog_header_only in the CMake build.
- Ensure the logging dependency is available across supported platforms.
Cleanup:
- Remove unnecessary iostream includes from files that no longer use direct stream logging.
- Remove unused logging-related includes from the precompiled header.
- Adjust output formatting, newline handling, and flush behavior around the centralized logger.
This modernizes the logging infrastructure, reduces ad-hoc console output, and prepares the client for cleaner log filtering, file logging, and safer HTTP diagnostics.
2026-05-29 16:13:55 -03:00
|
|
|
g_logger.info("Operating system: " .. g_platform.getOSName())
|
2012-06-19 21:15:56 -03:00
|
|
|
|
|
|
|
|
-- print first terminal message
|
2022-11-17 15:35:27 -03:00
|
|
|
g_logger.info(g_app.getName() .. ' ' .. g_app.getVersion() .. ' rev ' .. g_app.getBuildRevision() .. ' (' ..
|
2023-05-13 19:51:28 -03:00
|
|
|
g_app.getBuildCommit() .. ') built on ' .. g_app.getBuildDate() .. ' for arch ' ..
|
|
|
|
|
g_app.getBuildArch())
|
2012-06-19 21:15:56 -03:00
|
|
|
|
2023-12-08 16:15:41 -05:00
|
|
|
-- setup lua debugger
|
|
|
|
|
if os.getenv("LOCAL_LUA_DEBUGGER_VSCODE") == "1" then
|
2024-07-12 14:31:39 -03:00
|
|
|
require("lldebugger").start()
|
|
|
|
|
g_logger.debug("Started LUA debugger.")
|
2023-12-08 16:15:41 -05:00
|
|
|
else
|
2024-07-12 14:31:39 -03:00
|
|
|
g_logger.debug("LUA debugger not started (not launched with VSCode local-lua).")
|
2023-12-08 16:15:41 -05:00
|
|
|
end
|
|
|
|
|
|
2013-01-18 20:39:11 -02:00
|
|
|
-- add data directory to the search path
|
2022-11-17 15:35:27 -03:00
|
|
|
if not g_resources.addSearchPath(g_resources.getWorkDir() .. 'data', true) then
|
|
|
|
|
g_logger.fatal('Unable to add data directory to the search path.')
|
2013-01-18 20:39:11 -02:00
|
|
|
end
|
|
|
|
|
|
2012-06-19 21:15:56 -03:00
|
|
|
-- add modules directory to the search path
|
2022-11-17 15:35:27 -03:00
|
|
|
if not g_resources.addSearchPath(g_resources.getWorkDir() .. 'modules', true) then
|
|
|
|
|
g_logger.fatal('Unable to add modules directory to the search path.')
|
2012-06-19 21:15:56 -03:00
|
|
|
end
|
|
|
|
|
|
2025-09-28 14:46:24 -03:00
|
|
|
g_html.addGlobalStyle('/data/styles/html.css')
|
|
|
|
|
g_html.addGlobalStyle('/data/styles/custom.css')
|
|
|
|
|
|
2012-07-16 20:04:45 -03:00
|
|
|
-- try to add mods path too
|
2022-11-17 15:35:27 -03:00
|
|
|
g_resources.addSearchPath(g_resources.getWorkDir() .. 'mods', true)
|
2012-06-19 21:15:56 -03:00
|
|
|
|
|
|
|
|
-- setup directory for saving configurations
|
2018-02-28 21:44:17 +01:00
|
|
|
g_resources.setupUserWriteDir(('%s/'):format(g_app.getCompactName()))
|
2012-07-16 16:35:14 -03:00
|
|
|
|
|
|
|
|
-- search all packages
|
|
|
|
|
g_resources.searchAndAddPackages('/', '.otpkg', true)
|
2012-06-19 21:15:56 -03:00
|
|
|
|
2014-04-02 01:54:13 +13:00
|
|
|
-- load settings
|
2022-11-17 15:35:27 -03:00
|
|
|
g_configs.loadSettings('/config.otml')
|
2012-06-19 21:15:56 -03:00
|
|
|
|
|
|
|
|
g_modules.discoverModules()
|
|
|
|
|
|
2012-07-17 20:49:21 -03:00
|
|
|
-- libraries modules 0-99
|
2012-08-31 20:33:51 -03:00
|
|
|
g_modules.autoLoadModules(99)
|
2022-11-17 15:35:27 -03:00
|
|
|
g_modules.ensureModuleLoaded('corelib')
|
|
|
|
|
g_modules.ensureModuleLoaded('gamelib')
|
2024-07-16 21:36:58 -03:00
|
|
|
g_modules.ensureModuleLoaded('modulelib')
|
2023-05-11 11:38:24 -03:00
|
|
|
g_modules.ensureModuleLoaded("startup")
|
|
|
|
|
|
2024-07-12 14:31:39 -03:00
|
|
|
g_modules.autoLoadModules(999)
|
|
|
|
|
g_modules.ensureModuleLoaded('game_shaders') -- pre load
|
|
|
|
|
|
2023-05-11 11:38:24 -03:00
|
|
|
local function loadModules()
|
|
|
|
|
-- client modules 100-499
|
|
|
|
|
g_modules.autoLoadModules(499)
|
|
|
|
|
g_modules.ensureModuleLoaded('client')
|
2012-06-19 21:15:56 -03:00
|
|
|
|
2023-05-11 11:38:24 -03:00
|
|
|
-- game modules 500-999
|
|
|
|
|
g_modules.autoLoadModules(999)
|
|
|
|
|
g_modules.ensureModuleLoaded('game_interface')
|
2012-06-19 21:15:56 -03:00
|
|
|
|
2023-05-11 11:38:24 -03:00
|
|
|
-- mods 1000-9999
|
|
|
|
|
g_modules.autoLoadModules(9999)
|
2023-11-21 22:27:20 -03:00
|
|
|
g_modules.ensureModuleLoaded('client_mods')
|
|
|
|
|
|
2023-05-11 11:38:24 -03:00
|
|
|
local script = '/' .. g_app.getCompactName() .. 'rc.lua'
|
2013-02-10 02:54:20 -02:00
|
|
|
|
2023-05-11 11:38:24 -03:00
|
|
|
if g_resources.fileExists(script) then
|
|
|
|
|
dofile(script)
|
|
|
|
|
end
|
2024-07-12 14:31:39 -03:00
|
|
|
|
|
|
|
|
-- uncomment the line below so that modules are reloaded when modified. (Note: Use only mod dev)
|
2025-10-25 04:28:51 -03:00
|
|
|
-- g_modules.enableAutoReload()
|
2018-02-28 21:44:17 +01:00
|
|
|
end
|
2023-05-11 11:38:24 -03:00
|
|
|
|
|
|
|
|
-- run updater, must use data.zip
|
|
|
|
|
if g_app.hasUpdater() then
|
2023-05-13 19:51:28 -03:00
|
|
|
g_modules.ensureModuleLoaded("updater")
|
|
|
|
|
return Updater.init(loadModules)
|
2023-05-11 11:38:24 -03:00
|
|
|
end
|
2023-07-28 14:51:00 -03:00
|
|
|
|
|
|
|
|
loadModules()
|