mirror of
https://github.com/thunderbrewhq/bc.git
synced 2025-12-12 01:52:30 +00:00
chore: initial commit
This commit is contained in:
commit
d5300e4723
19 changed files with 18365 additions and 0 deletions
54
.clang-format
Normal file
54
.clang-format
Normal file
|
|
@ -0,0 +1,54 @@
|
||||||
|
---
|
||||||
|
AccessModifierOffset: 0
|
||||||
|
AlignConsecutiveAssignments: false
|
||||||
|
AlignConsecutiveDeclarations: false
|
||||||
|
AllowShortBlocksOnASingleLine: Never
|
||||||
|
AllowShortCaseLabelsOnASingleLine: false
|
||||||
|
AllowShortIfStatementsOnASingleLine: Never
|
||||||
|
AlwaysBreakTemplateDeclarations: Yes
|
||||||
|
BreakBeforeBraces: Attach
|
||||||
|
BreakBeforeTernaryOperators: true
|
||||||
|
BreakConstructorInitializers: BeforeComma
|
||||||
|
ColumnLimit: 0
|
||||||
|
CompactNamespaces: false
|
||||||
|
ContinuationIndentWidth: 4
|
||||||
|
Cpp11BracedListStyle: false
|
||||||
|
DeriveLineEnding: false
|
||||||
|
DerivePointerAlignment: false
|
||||||
|
IncludeBlocks: Merge
|
||||||
|
IncludeCategories:
|
||||||
|
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
|
||||||
|
Priority: 2
|
||||||
|
SortPriority: 2
|
||||||
|
- Regex: '^(<|"(gtest|gmock|isl|json)/)'
|
||||||
|
Priority: 3
|
||||||
|
- Regex: "<[[:alnum:].]+>"
|
||||||
|
Priority: 4
|
||||||
|
- Regex: ".*"
|
||||||
|
Priority: 1
|
||||||
|
SortPriority: 0
|
||||||
|
IndentGotoLabels: false
|
||||||
|
IndentWidth: 4
|
||||||
|
MaxEmptyLinesToKeep: 1
|
||||||
|
ObjCBlockIndentWidth: 4
|
||||||
|
ObjCSpaceAfterProperty: false
|
||||||
|
ObjCSpaceBeforeProtocolList: false
|
||||||
|
PointerAlignment: Left
|
||||||
|
SortIncludes: true
|
||||||
|
SpaceAfterCStyleCast: false
|
||||||
|
SpaceAfterLogicalNot: false
|
||||||
|
SpaceAfterTemplateKeyword: true
|
||||||
|
SpaceBeforeAssignmentOperators: true
|
||||||
|
SpaceBeforeCpp11BracedList: true
|
||||||
|
SpaceBeforeCtorInitializerColon: true
|
||||||
|
SpaceBeforeInheritanceColon: true
|
||||||
|
SpaceBeforeParens: ControlStatements
|
||||||
|
SpaceBeforeSquareBrackets: false
|
||||||
|
SpaceInEmptyBlock: false
|
||||||
|
SpacesInAngles: false
|
||||||
|
SpacesInCStyleCastParentheses: false
|
||||||
|
SpacesInConditionalStatement: false
|
||||||
|
Standard: c++11
|
||||||
|
TabWidth: 4
|
||||||
|
UseCRLF: false
|
||||||
|
UseTab: Never
|
||||||
1
.clang-format-ignore
Normal file
1
.clang-format-ignore
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
/vendor
|
||||||
15
.editorconfig
Normal file
15
.editorconfig
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
root = true
|
||||||
|
|
||||||
|
[*]
|
||||||
|
charset = utf-8
|
||||||
|
end_of_line = lf
|
||||||
|
insert_final_newline = true
|
||||||
|
trim_trailing_whitespace = true
|
||||||
|
|
||||||
|
[bc/**/*]
|
||||||
|
indent_size = 4
|
||||||
|
indent_style = space
|
||||||
|
|
||||||
|
[test/**/*]
|
||||||
|
indent_size = 4
|
||||||
|
indent_style = space
|
||||||
50
.github/workflows/pr.yml
vendored
Normal file
50
.github/workflows/pr.yml
vendored
Normal file
|
|
@ -0,0 +1,50 @@
|
||||||
|
name: PR
|
||||||
|
|
||||||
|
on: pull_request
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
name: ${{ matrix.config.name }}
|
||||||
|
runs-on: ${{ matrix.config.os }}
|
||||||
|
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
config:
|
||||||
|
- name: Ubuntu Latest (GCC)
|
||||||
|
os: ubuntu-latest
|
||||||
|
build_type: Release
|
||||||
|
test_path: BcTest
|
||||||
|
cc: gcc
|
||||||
|
cxx: g++
|
||||||
|
|
||||||
|
- name: macOS Latest (Clang)
|
||||||
|
os: macos-latest
|
||||||
|
build_type: Release
|
||||||
|
test_path: BcTest
|
||||||
|
cc: clang
|
||||||
|
cxx: clang++
|
||||||
|
|
||||||
|
- name: Windows Latest (MSVC)
|
||||||
|
os: windows-latest
|
||||||
|
build_type: Release
|
||||||
|
test_path: Release/BcTest
|
||||||
|
cc: cl
|
||||||
|
cxx: cl
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
with:
|
||||||
|
submodules: recursive
|
||||||
|
|
||||||
|
- name: Prepare
|
||||||
|
run: mkdir build
|
||||||
|
|
||||||
|
- name: Configure
|
||||||
|
run: cd build && cmake .. -DCMAKE_BUILD_TYPE=${{ matrix.config.build_type }}
|
||||||
|
|
||||||
|
- name: Build
|
||||||
|
run: cmake --build build --config ${{ matrix.config.build_type }}
|
||||||
|
|
||||||
|
- name: Test
|
||||||
|
run: ./build/test/${{ matrix.config.test_path }}
|
||||||
53
.github/workflows/push.yml
vendored
Normal file
53
.github/workflows/push.yml
vendored
Normal file
|
|
@ -0,0 +1,53 @@
|
||||||
|
name: Push
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
name: ${{ matrix.config.name }}
|
||||||
|
runs-on: ${{ matrix.config.os }}
|
||||||
|
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
config:
|
||||||
|
- name: Ubuntu Latest (GCC)
|
||||||
|
os: ubuntu-latest
|
||||||
|
build_type: Release
|
||||||
|
test_path: BcTest
|
||||||
|
cc: gcc
|
||||||
|
cxx: g++
|
||||||
|
|
||||||
|
- name: macOS Latest (Clang)
|
||||||
|
os: macos-latest
|
||||||
|
build_type: Release
|
||||||
|
test_path: BcTest
|
||||||
|
cc: clang
|
||||||
|
cxx: clang++
|
||||||
|
|
||||||
|
- name: Windows Latest (MSVC)
|
||||||
|
os: windows-latest
|
||||||
|
build_type: Release
|
||||||
|
test_path: Release/BcTest
|
||||||
|
cc: cl
|
||||||
|
cxx: cl
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
with:
|
||||||
|
submodules: recursive
|
||||||
|
|
||||||
|
- name: Prepare
|
||||||
|
run: mkdir build
|
||||||
|
|
||||||
|
- name: Configure
|
||||||
|
run: cd build && cmake .. -DCMAKE_BUILD_TYPE=${{ matrix.config.build_type }}
|
||||||
|
|
||||||
|
- name: Build
|
||||||
|
run: cmake --build build --config ${{ matrix.config.build_type }}
|
||||||
|
|
||||||
|
- name: Test
|
||||||
|
run: ./build/test/${{ matrix.config.test_path }}
|
||||||
6
.gitignore
vendored
Normal file
6
.gitignore
vendored
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
.DS_Store
|
||||||
|
.idea
|
||||||
|
.vscode
|
||||||
|
|
||||||
|
/build
|
||||||
|
/cmake-build-*
|
||||||
26
CMakeLists.txt
Normal file
26
CMakeLists.txt
Normal file
|
|
@ -0,0 +1,26 @@
|
||||||
|
cmake_minimum_required(VERSION 3.1)
|
||||||
|
|
||||||
|
if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
|
||||||
|
message(FATAL_ERROR
|
||||||
|
"In-source builds not allowed.
|
||||||
|
Please make a new directory (called a build directory) and run CMake from there.
|
||||||
|
You may need to remove CMakeCache.txt."
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(TARGET bc)
|
||||||
|
# Guard for use as transitive dependency
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Project
|
||||||
|
project(bc)
|
||||||
|
|
||||||
|
set(CMAKE_CXX_STANDARD 11)
|
||||||
|
|
||||||
|
include(lib/system/cmake/system.cmake)
|
||||||
|
|
||||||
|
add_subdirectory(lib)
|
||||||
|
add_subdirectory(bc)
|
||||||
|
add_subdirectory(test)
|
||||||
|
add_subdirectory(vendor)
|
||||||
24
LICENSE
Normal file
24
LICENSE
Normal file
|
|
@ -0,0 +1,24 @@
|
||||||
|
This is free and unencumbered software released into the public domain.
|
||||||
|
|
||||||
|
Anyone is free to copy, modify, publish, use, compile, sell, or
|
||||||
|
distribute this software, either in source code form or as a compiled
|
||||||
|
binary, for any purpose, commercial or non-commercial, and by any
|
||||||
|
means.
|
||||||
|
|
||||||
|
In jurisdictions that recognize copyright laws, the author or authors
|
||||||
|
of this software dedicate any and all copyright interest in the
|
||||||
|
software to the public domain. We make this dedication for the benefit
|
||||||
|
of the public at large and to the detriment of our heirs and
|
||||||
|
successors. We intend this dedication to be an overt act of
|
||||||
|
relinquishment in perpetuity of all present and future rights to this
|
||||||
|
software under copyright law.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||||
|
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||||
|
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||||
|
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||||
|
OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
|
For more information, please refer to <https://unlicense.org>
|
||||||
52
README.md
Normal file
52
README.md
Normal file
|
|
@ -0,0 +1,52 @@
|
||||||
|
# BC
|
||||||
|
|
||||||
|
[](https://github.com/whoahq/bc/actions/workflows/push.yml)
|
||||||
|
|
||||||
|
BC is an unofficial open source implementation of the Blizzard Core standard
|
||||||
|
library circa 2010.
|
||||||
|
|
||||||
|
The Blizzard Core standard library is a collection of data structures and
|
||||||
|
functions created by the talented folks at Blizzard Entertainment for use in
|
||||||
|
their games.
|
||||||
|
|
||||||
|
This project attempts to provide a version of Blizzard Core compatible with
|
||||||
|
the version used in the final release build of World of Warcraft: Wrath of
|
||||||
|
the Lich King in 2010: 3.3.5a (12340).
|
||||||
|
|
||||||
|
In the spirit of documenting what is presumed to have existed at the time,
|
||||||
|
this project makes every attempt to maintain the canonical names, layouts, and
|
||||||
|
side effects of the original implementation of Blizzard Core. At the same
|
||||||
|
time, it attempts to ensure portability and compatibility with modern 64-bit
|
||||||
|
systems.
|
||||||
|
|
||||||
|
## FAQ
|
||||||
|
|
||||||
|
**Why?**
|
||||||
|
|
||||||
|
It's fascinating to explore the development practices used to build a modern
|
||||||
|
major video game.
|
||||||
|
|
||||||
|
**Why 3.3.5a?**
|
||||||
|
|
||||||
|
The game and its libraries have become significantly more complex in the
|
||||||
|
intervening 10+ years. By picking 3.3.5a, it's possible to imagine this
|
||||||
|
implementation will eventually be complete.
|
||||||
|
|
||||||
|
**Will this let me cheat in the game?**
|
||||||
|
|
||||||
|
No. BC is a standard library, and none of its routines are particularly
|
||||||
|
relevant to the anti-cheat measures found in the game.
|
||||||
|
|
||||||
|
**Can I use this in my own development projects?**
|
||||||
|
|
||||||
|
It's probably a bad idea. The original utility classes and routines remain
|
||||||
|
closed source, and this project is in no way official.
|
||||||
|
|
||||||
|
## Legal
|
||||||
|
|
||||||
|
This project is released into the public domain.
|
||||||
|
|
||||||
|
World of Warcraft: Wrath of the Lich King ©2008 Blizzard Entertainment, Inc.
|
||||||
|
All rights reserved. Wrath of the Lich King is a trademark, and World of
|
||||||
|
Warcraft, Warcraft and Blizzard Entertainment are trademarks or registered
|
||||||
|
trademarks of Blizzard Entertainment, Inc. in the U.S. and/or other countries.
|
||||||
17
bc/CMakeLists.txt
Normal file
17
bc/CMakeLists.txt
Normal file
|
|
@ -0,0 +1,17 @@
|
||||||
|
file(GLOB BC_SOURCES
|
||||||
|
"*.cpp"
|
||||||
|
)
|
||||||
|
|
||||||
|
add_library(bc STATIC
|
||||||
|
${BC_SOURCES}
|
||||||
|
)
|
||||||
|
|
||||||
|
target_include_directories(bc
|
||||||
|
PUBLIC
|
||||||
|
${PROJECT_SOURCE_DIR}
|
||||||
|
)
|
||||||
|
|
||||||
|
target_link_libraries(bc
|
||||||
|
PUBLIC
|
||||||
|
storm
|
||||||
|
)
|
||||||
18
bc/Memory.cpp
Normal file
18
bc/Memory.cpp
Normal file
|
|
@ -0,0 +1,18 @@
|
||||||
|
#include "bc/Memory.hpp"
|
||||||
|
#include <storm/Memory.hpp>
|
||||||
|
|
||||||
|
void* Blizzard::Memory::Allocate(uint32_t bytes) {
|
||||||
|
return SMemAlloc(bytes, __FILE__, __LINE__, 0x0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void* Blizzard::Memory::Allocate(uint32_t bytes, uint32_t flags, const char* filename, uint32_t linenumber, const char* a5) {
|
||||||
|
// TODO
|
||||||
|
// - determine purpose of a5
|
||||||
|
// - flags manipulation
|
||||||
|
|
||||||
|
return SMemAlloc(bytes, filename, linenumber, flags);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Blizzard::Memory::Free(void* ptr) {
|
||||||
|
SMemFree(ptr);
|
||||||
|
}
|
||||||
17
bc/Memory.hpp
Normal file
17
bc/Memory.hpp
Normal file
|
|
@ -0,0 +1,17 @@
|
||||||
|
#ifndef BC_MEMORY_HPP
|
||||||
|
#define BC_MEMORY_HPP
|
||||||
|
|
||||||
|
#include <cstdint>
|
||||||
|
|
||||||
|
namespace Blizzard {
|
||||||
|
namespace Memory {
|
||||||
|
|
||||||
|
// Functions
|
||||||
|
void* Allocate(uint32_t bytes);
|
||||||
|
void* Allocate(uint32_t bytes, uint32_t flags, const char* filename, uint32_t linenumber, const char* a5);
|
||||||
|
void Free(void* ptr);
|
||||||
|
|
||||||
|
} // namespace Memory
|
||||||
|
} // namespace Blizzard
|
||||||
|
|
||||||
|
#endif
|
||||||
2
lib/CMakeLists.txt
Normal file
2
lib/CMakeLists.txt
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
add_subdirectory(squall)
|
||||||
|
add_subdirectory(system)
|
||||||
31
test/CMakeLists.txt
Normal file
31
test/CMakeLists.txt
Normal file
|
|
@ -0,0 +1,31 @@
|
||||||
|
file(GLOB_RECURSE TEST_SOURCES "*.cpp")
|
||||||
|
|
||||||
|
if(WHOA_SYSTEM_MAC)
|
||||||
|
set_source_files_properties(${TEST_SOURCES}
|
||||||
|
PROPERTIES COMPILE_FLAGS "-x objective-c++"
|
||||||
|
)
|
||||||
|
|
||||||
|
add_executable(BcTest ${TEST_SOURCES})
|
||||||
|
|
||||||
|
target_link_libraries(BcTest
|
||||||
|
PRIVATE
|
||||||
|
bc
|
||||||
|
"-framework AppKit"
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(WHOA_SYSTEM_LINUX OR WHOA_SYSTEM_WIN)
|
||||||
|
add_executable(BcTest ${TEST_SOURCES})
|
||||||
|
|
||||||
|
target_link_libraries(BcTest
|
||||||
|
PRIVATE
|
||||||
|
bc
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
target_include_directories(BcTest
|
||||||
|
PRIVATE
|
||||||
|
${PROJECT_SOURCE_DIR}
|
||||||
|
)
|
||||||
|
|
||||||
|
install(TARGETS BcTest DESTINATION "bin")
|
||||||
20
test/Memory.cpp
Normal file
20
test/Memory.cpp
Normal file
|
|
@ -0,0 +1,20 @@
|
||||||
|
#include "bc/Memory.hpp"
|
||||||
|
#include "test/Test.hpp"
|
||||||
|
|
||||||
|
TEST_CASE("Blizzard::Memory::Allocate", "[memory]") {
|
||||||
|
SECTION("allocates memory and returns pointer") {
|
||||||
|
auto ptr = Blizzard::Memory::Allocate(100);
|
||||||
|
|
||||||
|
REQUIRE(ptr);
|
||||||
|
|
||||||
|
Blizzard::Memory::Free(ptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
SECTION("allocates memory and returns pointer using overload with flags") {
|
||||||
|
auto ptr = Blizzard::Memory::Allocate(100, 0x0, __FILE__, __LINE__, nullptr);
|
||||||
|
|
||||||
|
REQUIRE(ptr);
|
||||||
|
|
||||||
|
Blizzard::Memory::Free(ptr);
|
||||||
|
}
|
||||||
|
}
|
||||||
2
test/Test.cpp
Normal file
2
test/Test.cpp
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
#define CATCH_CONFIG_MAIN
|
||||||
|
#include "test/Test.hpp"
|
||||||
1
test/Test.hpp
Normal file
1
test/Test.hpp
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
#include "vendor/catch-2.13.10/catch.hpp"
|
||||||
0
vendor/CMakeLists.txt
vendored
Normal file
0
vendor/CMakeLists.txt
vendored
Normal file
17976
vendor/catch-2.13.10/catch.hpp
vendored
Normal file
17976
vendor/catch-2.13.10/catch.hpp
vendored
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue