Commit Graph

31 Commits

Author SHA1 Message Date
Aaron Kimbrell
08020cd86d
chore: cleanup LU(W)string writing (#1188)
* chore: cleanup LU(W)string writing
and add methods for reading
remove redunent "packet" from packet reading helpers
move write header to bitstreamutils since it's not packet related
add tests for reading/writing LU(W)Strings

* remove un-needed function defintions in header

* make reading and writing more efficient

* p

p

* quotes

* remove unneeded default

---------

Co-authored-by: David Markowitz <39972741+EmosewaMC@users.noreply.github.com>
2023-09-20 20:06:28 -05:00
David Markowitz
2cc13c6499
chore: Make serialize actually virtual (#1156)
* Make serialize actually virtual

* fix serialize and make update virutal

* Update VendorComponent.h

* Remove flag var

* Update SoundTriggerComponent.h

---------

Co-authored-by: Aaron Kimbrell <aronwk.aaron@gmail.com>
2023-08-10 14:33:15 -07:00
Aaron Kimbrell
a22ecf385f
feature: add full known GM list (#1171)
* feature: add full GM list

* Fix compiling

* add tests
Fix more issues
2023-08-03 21:27:40 -05:00
David Markowitz
0d48cfe8c0
fix: Nipoint3 Operator+= (#1172)
* fix operator +=

* fix operator +=
2023-07-31 00:22:56 -07:00
David Markowitz
455f9470a5
Move EntityManager to Game namespace (#1140)
* Move EntityManager to Game namespace

* move initialization to later

Need to wait for dZoneManager to be initialized.

* Fix bugs

- Cannot delete from a RandomAccessIterator while in a range based for loop.

Touchup zone manager initialize

replace magic numbers with better named constants
replace magic zonecontrol id with a more readable hex alternative
condense stack variables
move initializers closer to their use
initialize entity manager with zone control

change initialize timings

If zone is not zero we expect to initialize the entity manager during zone manager initialization

Add constexpr for zone control LOT

* Add proper error handling

* revert vanity changes

* Update WorldServer.cpp

* Update dZoneManager.cpp
2023-07-15 13:56:33 -07:00
David Markowitz
4fe335cc66
Refactor: Amf3 implementation (#998)
* Update AMFDeserializeTests.cpp

Redo Amf3 functionality

Overhaul the whole thing due to it being outdated and clunky to use

Sometimes you want to keep the value

Update AMFDeserializeTests.cpp

* Fix enum and constructors

Correct enum to a class and simplify names.
Add a proper default constructor

* Update MasterServer.cpp

* Fix bugs and add more tests

* Refactor: AMF with templates in mind

- Remove hard coded bodge
- Use templates and generics to allow for much looser typing and strengthened implementation
- Move code into header only implementation for portability

Refactor: Convert AMF implementation to templates

- Rip out previous implementation
- Remove all extraneous terminology
- Add proper overloads for all types of inserts
- Fix up tests and codebase

* Fix compiler errors

* Check for null first

* Add specialization for const char*

* Update tests for new template specialization

* Switch BitStream to use references

* Rename files

* Check enum bounds on deserialize

I did this on a phone
2023-05-13 17:22:00 -05:00
David Markowitz
7aad6e4bc2
Make header skips more obvious (#1074)
* Make header skips more obvious

seeing inStream.Read(LWOOBJID) is much less clear than a macro which very clearly skips the header.

* Formatting pass
2023-05-08 06:31:10 -05:00
Aaron Kimbrell
6aa90ad5b2
Breakout rest of the enums from dCommonVars and clean it up (#1061)
* Breakout rest of the enums from dcommonvars
so we don't have to deal with merge conflicts
ePlayerFlags is not a scoped enum, yet, due to it's complexity

* address feedback

* make player flag types consistent

* fix typo
2023-05-02 17:39:21 -05:00
David Markowitz
e8590a5853
Add tests for LDF parsing and serialization. Cleanup LDF (#1062)
* Add tests and cleanup LDF header

Also implements a speedup by using overloaded operators to put numbers directly to a stream as opposed to doing to_string first.

Stage 2 of re-write

Reduce scoping
Add further optimizations
Fix more edge cases
Split out tests to many smaller ones

Use EXPECT_NO_THROW

Add edge cases to test

Added these first with the before to confirm they failed, and now will be adding the remaining fixes needed to make the tests pass.

Add edge case testing for LDF strings

Add further tests

Use characters instead of char*

Update AMFDeserializeTests.cpp

Add null tests

* Add Test Fixture for dCommon

* Add speed test

* Convert to using string_view

* Add explanation on early return

* Remove "testing" code
2023-05-02 17:19:20 -05:00
David Markowitz
4734996c7c
Resolve most compiler warnings (#1053) 2023-04-12 11:48:20 -05:00
Aaron Kimbrell
e524b86e12
breakout the component types into a scoped enum (#1002)
* breakout the component types into a scoped enum

tested that things are the same as they were before

* fix missed rename

* fix brick-by-brick name to be crafting
because that's what it is
2023-03-04 01:16:37 -06:00
David Markowitz
d138b7b878
Make ControlBehavior messages far more modular (#991)
* Make case consistent

* How modular can you go?

Holy modular

* Add comments

* Initialize values
2023-02-16 11:30:33 -06:00
David Markowitz
72c93c8913
Further implement Property Behavior parsing (#936)
Further implements the ControlBehavior processing and adds preparations for cheat detection
2023-02-13 18:55:44 -08:00
David Markowitz
7bca43ffc1
Fix tests (#953) 2023-01-11 22:36:03 -08:00
Aaron Kimbrell
80f8dd8003
Imminuty updates (#925)
* WIP Immunities

* Immunity getters

* remove redundent variable
replace it use with it's equivalent

* remove unused lookups, fix typos

* fix tests

* added imunity test

* address feedback

* more immunity tests

* explicit this
2023-01-06 23:59:19 -06:00
David Markowitz
fc75d6048f
dGame Precompiled header improvements (#876)
* moving branch

* Add deleteinven slash command

* Change name of BRICKS_IN_BBB

* Use string_view instead of strcmp

* Clean up include tree

* Remove unneeded headers from PCH files

Removes unneeded headers from pre-compiled headers.  This increases compile time, however reduces development time for most files.

* Update Entity.h

* Update EntityManager.h

* Update GameMessages.cpp

* There it compiles now

Co-authored-by: Aaron Kimbrell <aronwk.aaron@gmail.com>
2023-01-06 23:17:05 -06:00
David Markowitz
b7341c8106
Resolve warnings, change config init order and remove unused Game variables for all servers (#877)
* Resolve warnings and change init order

Initialize dConfig first, before logger so we know whether or not to log to console
Initialize namespace Game variables to nullptr so they are a known value if accessed before initialization.
Removed unused Game variables
Replaced config with a pointer instead of referencing something on the stack.
Assign return values to system calls to silence warnings.

Tested that the server still compiles, runs and allows me to load into the game.

* Only start Master of config files exist

Also default the logging to console to on on the off chance the files exist but are wrong / corrupted.
2022-12-15 08:13:49 -06:00
David Markowitz
56da3f8543
Remove Locale (#808)
* Remove Locale (finally)
2022-11-27 16:56:55 -08:00
David Markowitz
3222e78815
Implement undo action for pre-built models (#830)
Brick building as of right now does not implement the undo action properly.  This commit addresses the issue with undoing button being non-functional server side and implements the GM needed for addressing further issues.

Implement GameMessage UnUseModel which is called when a model in BrickBuilding is UnUsed.  Important for UGC content down the line.  Final code has been tested as follows:
1. Placed a model in brick build
2. saved placed a brick
3. repeat 2 and 3 twice more for 6 total models
4. Place a new model in brick mode and then edit all 7 models into one brick model instance
5. Pressing undo returns the converted model to the inventory and properly discards the other 6 without crashing.  Intended live behavior is to store this in the inventory instead however behind the scenes work is needed to implement UGC models properly.

Implement enum

Implement the BlueprintSaveResponseType enum so there are less magic numbers sent via packets.
Correct int sizes from unsigned int to uint32_t

Add deserialize test

Add a test for de-serializing a GM that is sent to the client.  Assertions verify the data is in the correct order and has no extra information.
2022-11-27 16:48:46 -08:00
David Markowitz
1464762bcd
Implement GTest and change windows output path
Implement GTest as a testing infrastructure.
Make windows output binaries to the build folder instead of the release type folder (potentially issue further down the line)
Add a simple unit test for DestroyableComponent
2022-11-07 00:12:35 -08:00
David Markowitz
89fb66c4a9
Change AMFArray getters to use Templates and fix CI halting when one matrix fails (#796)
* Change AMFArray getters to use Templates

Move Template definition to header

* Add more tests

Add tests for casting to wrong template type
Add tests for going out of bounds in the array.

* Try continue-on-error

* Update build-and-test.yml

* Try continue-on-error

Update build-and-test.yml

* change version

* Update CMakeMariaDBLists.txt

Update CMakeMariaDBLists.txt
2022-10-30 13:06:05 -07:00
Aaron Kimbre
9e4ce24fd2 add semi-colons to macros consistently 2022-08-05 08:40:12 -05:00
aronwk-aaron
19e77a38d8 format codebase 2022-07-28 08:39:57 -05:00
Daniel Seiler
9813c3ed2c
Better Unicode support in GeneralUtils (#658)
* ASCIIToUTF16: output replacement character instead of failing assert

* Add GeneralUtils::_NextUTF8Char

* Implement GeneralUtils::UTF8ToUTF16

* use string_view everywhere

* use string_view::front instead of begin

* Add PushUTF16CodePoint
2022-07-25 21:11:30 -07:00
David Markowitz
6a38b67ed5
General AMF cleanup (#663)
* General AMF cleanup

Proper memory management as well as style cleanup

* General optimizations

Fix AMFArray so values are properly deleted when you leave the scope it was created in.
Add bounds check for deletion so you don't double delete.
Remove all AMFdeletions that are contained in an array since the array now manages its own memory and deletes it when it is no longer needed.

* Better tests and fix de-serialize

Fix de-serialize to be correct and implement a test to check this

* Update AMFDeserializeTests.cpp

* Update AMFFormat.cpp
2022-07-21 22:26:09 -07:00
David Markowitz
835cf2b794
Add an AMF Deserializer as well as corresponding Unit Tests (#599)
* Add AMFDeserializer

Add an AMFDeserializer

Reverted unrelated changes

Add unit tests for AMFDeserializer

Added unit tests for the AMFDeserializer

Finish tests

Finish the AMF deserializer tests.  This commit finishes the positive test case and implements a load test case that is expected to take less than 1.5 seconds to process.

Modularized tests

Made tests a bit modular and split into more methods

Specified binary read from file

Specified that on the IO stream we are reading a binary file otherwise windows will terminate reading the binary file on seeing a 1A byte.

Added more tests

Added tests for unimplemented values and edited a test file to be more modular

Updated test text

Fix spacing

Update AMFDeserializeTests.cpp

* Update CMakeLists.txt

* Update AMFDeserializeTests.cpp

f

Actually follow the AMF spec

Update AMFDeserializeTests.cpp

tabs

Add in commented tests

* Follow spec

formatting

Add Integer Tests

Follow Spec more

Follow spec

* Use unique_ptr

* Update AMFDeserialize.cpp

Semantics

Update AMFDeserialize.cpp

Add new lines to EOF

CMake fix

* Add better std string read

Co-authored-by: Daniel Seiler <xiphoseer@mailbox.org>

* make not static

Co-authored-by: Daniel Seiler <xiphoseer@mailbox.org>
2022-07-19 21:51:05 -07:00
Jett
df0f11c95b
Update CMake configuration for easier maintenance (#642)
* Update CMake configuration for easier maintenance

* Incorrect casing fix

* Move package requirement

* Update CTest linking

* Add logs to the CMake

* Add linking for common libraries

Added linking for common libraries in tests subdirectory.

* Move test subdirectory higher up for some reason

* Whitespace a log removal

Missed new line

* Add dCommon to dChatFilter

* Update library output dir

* Correct libBcrypt

* Further refactor CMake behaviour

* Repair bad comments and update library defines

* Revert to old include directory method

* Implement platform defines

* Add missing include

Mac needs a specific include for defining platform.  Does not compile without this.

Co-authored-by: EmosewaMC <39972741+EmosewaMC@users.noreply.github.com>
2022-07-17 00:24:16 +01:00
jumpy-badger
eaa962f265
Add Aarch64 support (#231)
* added mariadb-connector-cpp submodule

* raknet aarch64 support

* fix compile errors

* mariadb connector swap (in progress)

* update CMakeLists, add preprocessor definition to switch between mysql and mariadb connectors

* update types with missing aarch64 check

* corrected adding extra flag to properly compile mariadbconn in CMakeLists

* updated readme with arm builds section

* fix build failure if test folder does not exist

* Remove mysql connector from all builds, add mariadbconnector to windows build

* readd Linux check for backtrace lib to CMakeLists.txt

* Separate system specific mariadbconncpp extra compile flags

* Copy dlls to exes directory once built

* fetch prebuilt binaries on windows so that ClangCL can be used

* Delay load dll so that plugin directory is set correctly

* Fixed typo in glibcxx compile flag

* whitespacing, spaces -> tabs

* Updated README.md, included instructions to update

* Updated README.md

added libssl-dev requirement and removed mysql connector references from macOS builds section

* apple compile fixes for zlib and shared library name

* add windows arm64 checks to raknet

* remove extra . in shared library location

* Setup plugins directory for the connector to search in, pass openssl_root_dir on for apple

* Fix copy paths for single config generators and non windows

* change plugin folder location, another single config generator fix

* GENERATOR_IS_MULTI_CONFIG is a property not a variable

* Fixed a few errors after merge

* Fix plugin directory path, force windows to look at the right folder

* fixed directory name for make_directory command

* Update README.md

Updated MacOS, Windows build instructions.

* set INSTALL_PLUGINDIR so that the right directory is used

* Support for relative rpath for docker build

* added mariadb-connector-cpp submodule

* raknet aarch64 support

* fix compile errors

* mariadb connector swap (in progress)

* update CMakeLists, add preprocessor definition to switch between mysql and mariadb connectors

* update types with missing aarch64 check

* corrected adding extra flag to properly compile mariadbconn in CMakeLists

* updated readme with arm builds section

* fix build failure if test folder does not exist

* Remove mysql connector from all builds, add mariadbconnector to windows build

* readd Linux check for backtrace lib to CMakeLists.txt

* Separate system specific mariadbconncpp extra compile flags

* Copy dlls to exes directory once built

* fetch prebuilt binaries on windows so that ClangCL can be used

* Delay load dll so that plugin directory is set correctly

* Fixed typo in glibcxx compile flag

* whitespacing, spaces -> tabs

* Updated README.md, included instructions to update

* Updated README.md

added libssl-dev requirement and removed mysql connector references from macOS builds section

* apple compile fixes for zlib and shared library name

* add windows arm64 checks to raknet

* Setup plugins directory for the connector to search in, pass openssl_root_dir on for apple

* Fix copy paths for single config generators and non windows

* change plugin folder location, another single config generator fix

* GENERATOR_IS_MULTI_CONFIG is a property not a variable

* Fixed a few errors after merge

* Fix plugin directory path, force windows to look at the right folder

* fixed directory name for make_directory command

* Update README.md

Updated MacOS, Windows build instructions.

* set INSTALL_PLUGINDIR so that the right directory is used

* Support for relative rpath for docker build

* Rebase on main

* Remove extra git submodule

* Update CMakeLists.txt

* Remove CMakeLists.txt file from mariadb

Remove the CMakeLists.txt file from the mariaDBConnector so we dont build the tests.  Also add a config option to the CMakeVariables.txt so you can build the connector with multiple jobs

* Compile on windows

Specify the mariadbcpp.dll file location with a defined absolute path so windows knows it actually exists.

* default to 1 job

Default mariadb jobs running in parallel to 1 instead of 4

* Move mariadbcpp.dll file to the expected directory on windows

* Changed plugin

Updated the plugin location from the project binary directory to the expected location, the mariadb binary directory.

* Addressed windows dll issues by moving files to the expected directory instead of a directory that wouldnt get created

* Update README

Co-authored-by: Aaron Kimbrell <aronwk.aaron@gmail.com>
Co-authored-by: EmosewaMC <39972741+EmosewaMC@users.noreply.github.com>
2022-07-03 21:33:05 -07:00
Xiphoseer
adab6cf96f Add windows CI 2022-01-05 14:12:28 +01:00
Xiphoseer
a06fa39a5d Add newline at EOF; re-merge cmake steps 2022-01-03 16:36:15 +01:00
Xiphoseer
a591dbfe9c Basic tests infrastructure 2022-01-03 16:00:21 +01:00