Conversation
|
@OTArchive |
|
Great job! Edit: damn yes seems so: https://demo.otarchive.com/ |
|
The tibia protocol is a custom binary protocol not compatible with the socket APIs available in javascript (webSocket, XMLHttpRequest, fetch) ... do you have a plan for dealing with that? A websocket<->TCP proxy could work.. (but it will be able to steal all usernames/passwords of tibia 7.6 and older clients, possibly newer protocols too, soooo there's that) |
It's already mentioned in the guide, but in Portuguese: yes, we can use proxies. I've setup my testing server using websockify. |
|
Amazing contribution, here is my short.review Would be better to have the bit implementations to be C++ binds instead of this Lua class, and only fallback to those C++ implementations when not using LuaJit |
why do you care? are you worried about performance? not really sure why we're using the bit library anyway tho, quoting https://www.lua.org/manual/5.3/manual.html#3.4.2 seems lua support the standard bitwise operators, so does that mean return Bit.operation(g_window.getKeyboardModifiers(), KeyboardCtrlModifier, Bit.AND) ~= 0is better than return (g_window.getKeyboardModifiers() & KeyboardCtrlModifier) ~= 0;or local bitsChanged = Bit.operation(now, old, Bit.XOR)is better than local bitsChanged = now & ~old;? is it easier to read? more maintainable? |
|
Some operations are very limited or not possible to implement in LUA only. Moreover the project can only use Lua 5.1 because os the env system that is not present in other Lua versions. So for making the bit operations more reliable it should be implemented as a C++ to Lua bind |
Should we also include Lua 5.1 code and precompiled lib in the repo, as it is not available in vcpkg? |
|
That's look a good solution, we also avoid new contributors to be confused why to not use default lib functions. About including Lua 5.1 what other options we have? Nonetheless I will leave this decision to @mehah and others contributors. |
|
Just another nitpick, but it's something all C/C++ developers should use a little time to think about wrt coding style IMO, While the choice between char* str;and char *str;is technically a personal preference thing, the latter is objectively better. Take a look at this bugged code: char* str1, str2;Do you see the problem? It’s easy to miss. Now, let’s try it with the alternative style: char *str1, str2;See it now? It's easier to see the bug with style 2. Fixing it, following coding style 1, it gets written as char* str1, *str2;that looks... strange, doesn't it? compare that to style 2, char *str1, *str2;looks much better imo, and that is why, imo, we should all default to the style ChatGPT can probably explain it better than me:
(just a nitpick) |
Is this problem related to this MR or whole repository? Can it be configured by In PHP there is well known code-standard PSR-12 ( https://www.php-fig.org/psr/psr-12/ ), which replaces old standards PSR-1 ( https://www.php-fig.org/psr/psr-1/ ) and PSR-2 ( https://www.php-fig.org/psr/psr-2/ ). I've tried multiple C++ 'standards' in CLion: FYI default Anytime I post anything to 2020+ PHP project, I can press CTRL+ALT+L - auto formatting - in PHPStorm to make my PHP code compatible with project (PSR-x). |
- We can now use vcpkg.json with an adapted cmake command (check guide) - Update overlay-ports to the current baseline
|
Compiling is now streamlined and also uses vcpkg.json, so no need to install dependencies with separate vcpkg commands. A proper cmake command is all that is needed. |
Adapt load() calls to lua 5.1
|
I think we can't keep this as PR forever. @OTArchive someday will get bored merging master over and over again and leave this branch unfinished. If OTCR maintainers are not sure, if current version is stable enough/code is clean enough/build process is good enough (what about Lua 5.1/5.4/LuaJIT 2.1 compatibility on desktop version?), then maybe we can merge this branch into official branch Maybe then more people will test it, merge master, refactor code, simplify/document configuration. |
|
* browser support * CMake: WASM should be tested and else left for Linux as before * Remove conflicting vcpkg.json files * Use existing base64 encoder * Check for emscripten before includes and declarations * Improve CMakeLists * Fix case-sensitivity issues * Implement bitlib and restore original .lua files bit operations * Support older protocols and improvements * Set correct numpad keys * Intercept all browser keys * Allow pasting and writing symbols with shift * Improve networking No need to reinvent the wheel * Reload page on client exit * Reduce CPU usage and connection improvements Drop g_ioService to avoid doing work during polling and make the thread sleep a bit if no message ready * Disable Emscripten's text decoder emscripten-core/emscripten#18034 * Basic mobile support - Handle touch events and longpress for right click - Check user agent to determine isMobile - Use VirtualKeyboardAPI to show keyboard (iOS not supported https://developer.mozilla.org/en-US/docs/Web/API/VirtualKeyboard_API) * Improve performance Drop manually swapping buffers to reduce CPU overhead * Case insensitive FS and properly return if websocket fails to be created * Fix Vorbis Linking (7cd3c82) * Allow gameWorld port to be set without rebuilding As servers and login servers are not adapted to send correct information when using the web client, it's necessary to override the world port and ip address that is received. Before, the world port was being forced to what was defined in the WEBPORT variable, not matter what port was informed when connect() was called. Now, you can override the port using lua (characterlist.lua) and avoid rebuilding the client. OBS: Port 7172 will still be overriden to 443 by the client. * Remove unused definition * Remove '&' #894 (comment) * Remove swapBuffers call, we no longer use it 3c6bc5a * Properly encode json #894 (comment) * Update src/framework/net/webconnection.cpp Co-authored-by: divinity76 <divinity76@gmail.com> * Update src/framework/net/webconnection.cpp Co-authored-by: divinity76 <divinity76@gmail.com> * Update src/framework/net/webconnection.cpp Co-authored-by: divinity76 <divinity76@gmail.com> * Update src/framework/platform/browserplatform.cpp Co-authored-by: divinity76 <divinity76@gmail.com> * Update src/framework/platform/browserplatform.cpp Co-authored-by: divinity76 <divinity76@gmail.com> * Update src/framework/platform/browserplatform.cpp Co-authored-by: divinity76 <divinity76@gmail.com> * Update src/framework/platform/browserplatform.cpp Co-authored-by: divinity76 <divinity76@gmail.com> * c++17 remove file * Recommended improvements #894 (comment) #894 (comment) #894 (comment) #894 (comment) * Remove uneeded link libs * remove regex * Cleanup shell.html * Make compiling easier - We can now use vcpkg.json with an adapted cmake command (check guide) - Update overlay-ports to the current baseline * Add baseline to overlay-ports vcpkg.json files * Workflows: ignore overlay-ports vcpkg.json * Bot V8 basic fixes Adapt load() calls to lua 5.1 * Disable UIGraph while the browser building issue is not found * Fix broken regex * Fix broken regex * Fix compiling after include changes --------- Co-authored-by: Ivan Clementino <ivancarlos.clementino@gmail.com> Co-authored-by: Renato Machado <mehahx@gmail.com> Co-authored-by: Rodrigo Paixão <god.rodrigo@hotmail.com> Co-authored-by: Luan Luciano <luanluciano@outlook.com> Co-authored-by: divinity76 <divinity76@gmail.com>
…1046) * browser support * CMake: WASM should be tested and else left for Linux as before * Remove conflicting vcpkg.json files * Use existing base64 encoder * Check for emscripten before includes and declarations * Improve CMakeLists * Fix case-sensitivity issues * Implement bitlib and restore original .lua files bit operations * Support older protocols and improvements * Set correct numpad keys * Intercept all browser keys * Allow pasting and writing symbols with shift * Improve networking No need to reinvent the wheel * Reload page on client exit * Reduce CPU usage and connection improvements Drop g_ioService to avoid doing work during polling and make the thread sleep a bit if no message ready * Disable Emscripten's text decoder emscripten-core/emscripten#18034 * Basic mobile support - Handle touch events and longpress for right click - Check user agent to determine isMobile - Use VirtualKeyboardAPI to show keyboard (iOS not supported https://developer.mozilla.org/en-US/docs/Web/API/VirtualKeyboard_API) * Improve performance Drop manually swapping buffers to reduce CPU overhead * Case insensitive FS and properly return if websocket fails to be created * Fix Vorbis Linking (7cd3c82) * Allow gameWorld port to be set without rebuilding As servers and login servers are not adapted to send correct information when using the web client, it's necessary to override the world port and ip address that is received. Before, the world port was being forced to what was defined in the WEBPORT variable, not matter what port was informed when connect() was called. Now, you can override the port using lua (characterlist.lua) and avoid rebuilding the client. OBS: Port 7172 will still be overriden to 443 by the client. * Remove unused definition * Remove '&' opentibiabr#894 (comment) * Remove swapBuffers call, we no longer use it opentibiabr@3c6bc5a * Properly encode json opentibiabr#894 (comment) * Update src/framework/net/webconnection.cpp Co-authored-by: divinity76 <divinity76@gmail.com> * Update src/framework/net/webconnection.cpp Co-authored-by: divinity76 <divinity76@gmail.com> * Update src/framework/net/webconnection.cpp Co-authored-by: divinity76 <divinity76@gmail.com> * Update src/framework/platform/browserplatform.cpp Co-authored-by: divinity76 <divinity76@gmail.com> * Update src/framework/platform/browserplatform.cpp Co-authored-by: divinity76 <divinity76@gmail.com> * Update src/framework/platform/browserplatform.cpp Co-authored-by: divinity76 <divinity76@gmail.com> * Update src/framework/platform/browserplatform.cpp Co-authored-by: divinity76 <divinity76@gmail.com> * c++17 remove file * Recommended improvements opentibiabr#894 (comment) opentibiabr#894 (comment) opentibiabr#894 (comment) opentibiabr#894 (comment) * Remove uneeded link libs * remove regex * Cleanup shell.html * Make compiling easier - We can now use vcpkg.json with an adapted cmake command (check guide) - Update overlay-ports to the current baseline * Add baseline to overlay-ports vcpkg.json files * Workflows: ignore overlay-ports vcpkg.json * Bot V8 basic fixes Adapt load() calls to lua 5.1 * Disable UIGraph while the browser building issue is not found * Fix broken regex * Fix broken regex * Fix compiling after include changes --------- Co-authored-by: Ivan Clementino <ivancarlos.clementino@gmail.com> Co-authored-by: Renato Machado <mehahx@gmail.com> Co-authored-by: Rodrigo Paixão <god.rodrigo@hotmail.com> Co-authored-by: Luan Luciano <luanluciano@outlook.com> Co-authored-by: divinity76 <divinity76@gmail.com>




Description
Support compiling to javascript and webassembly using Emscripten.
Compiling guide (PT-BR): Guia ‐ OTClient Redemption Web
Notes:
Changed .bit operations to a lua implementation (Lua 5.1 incompatible);Now using bitlib;Currently only works with protocols that use http login servers.Now also supports older protocols.