Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
edad91b
Ormin's skyblivion customizations. Updated boost search to vc140
aerisarn Jan 3, 2018
b405b48
Ormin's file additions in a separate commit.
aerisarn Jan 3, 2018
18e325b
Add ACHR and REFR records to copy constructor
azakhi Jan 7, 2018
6caea59
Add findRecordByEDID method
azakhi Jan 7, 2018
9578db5
Merge pull request #1 from azakhi/master
aerisarn Jan 7, 2018
cf43130
Convert actor value indices
azakhi Jan 9, 2018
611debc
Merge pull request #2 from azakhi/master
aerisarn Jan 10, 2018
2eef9ab
Implement simple logging system
azakhi Jan 16, 2018
9862925
Use unordered array instead to prevent sorting
azakhi Jan 17, 2018
fb9a43b
Add new record classes
azakhi Jan 19, 2018
9f50c79
Separate script property bindings
azakhi Jan 21, 2018
b1f8a9d
Add TES4 prefix to converted PACK records
azakhi Jan 22, 2018
6a7d68e
Add records to read EDID infos
azakhi Jan 22, 2018
275d7e5
Merge pull request #3 from azakhi/master
aerisarn Jan 24, 2018
b36b50b
Fix setting speaker incorrectly
azakhi Jan 25, 2018
1860281
Fix file load
azakhi Feb 4, 2018
278e01b
Fix file load bugs
azakhi Feb 6, 2018
d14f375
Fix float value comparison
azakhi Feb 7, 2018
97abb6a
Skip only subrecord instead
azakhi Feb 7, 2018
643b854
Merge pull request #4 from azakhi/master
aerisarn Feb 7, 2018
db5c1bc
Improve pack conversion
azakhi Feb 10, 2018
789d9d6
Merge pull request #5 from azakhi/master
aerisarn Feb 21, 2018
1f80cf9
Updated Boost for MSVC 2017. Fixed INGR parsing
aerisarn Jul 8, 2018
393ec1f
TIF now execute onBegin. Fixed FollowTo package conversion when origi…
aerisarn Mar 16, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,12 @@ local.properties
*.suo
*.user
*.sln.docstates
*.vcxproj

# Build results

[Dd]ebug*/
[Rr]elease*/
[Dd]ebug/
[Rr]elease/
x64/
build/
[Bb]in/
Expand Down
92 changes: 32 additions & 60 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,77 +16,54 @@ option(PROJECT_STATIC_RUNTIME "Build with static runtime libs (/MT)" ON)
option(CBASH_NO_BOOST_ZLIB "Build with external Zlib" OFF)

set (Boost_USE_STATIC_LIBS ON)
set (Boost_DEBUG ON)
set (Boost_USE_MULTITHREADED ON)
set (Boost_USE_STATIC_RUNTIME PROJECT_STATIC_RUNTIME)

file (GLOB_RECURSE CBASH_GEN_HDRS "${CMAKE_SOURCE_DIR}/src/*.h" )

file (GLOB_RECURSE CBASH_FONV "${CMAKE_SOURCE_DIR}/src/FalloutNewVegas/*.cpp")
file (GLOB_RECURSE CBASH_OBLIVION "${CMAKE_SOURCE_DIR}/src/Oblivion/*.cpp")
file (GLOB_RECURSE CBASH_SKYRIM "${CMAKE_SOURCE_DIR}/src/Skyrim/*.cpp")

set (CBASH_SRC "${CMAKE_SOURCE_DIR}/src/CBash.cpp"
"${CMAKE_SOURCE_DIR}/src/Collection.cpp"
"${CMAKE_SOURCE_DIR}/src/Common.cpp"
"${CMAKE_SOURCE_DIR}/src/GenericChunks.cpp"
"${CMAKE_SOURCE_DIR}/src/GenericRecord.cpp"
"${CMAKE_SOURCE_DIR}/src/ModFile.cpp"
"${CMAKE_SOURCE_DIR}/src/TES4Record.cpp"
"${CMAKE_SOURCE_DIR}/src/TES4RecordAPI.cpp"
"${CMAKE_SOURCE_DIR}/src/Visitors.cpp"
"${CMAKE_SOURCE_DIR}/src/CBash.rc"
IF (MSVC)
set (Boost_COMPILER "-vc140")
ENDIF ()


file (GLOB_RECURSE CBASH_FONV "${CMAKE_CURRENT_SOURCE_DIR}/src/FalloutNewVegas/*.cpp")
file (GLOB_RECURSE CBASH_OBLIVION "${CMAKE_CURRENT_SOURCE_DIR}/src/Oblivion/*.cpp")
file (GLOB_RECURSE CBASH_SKYRIM "${CMAKE_CURRENT_SOURCE_DIR}/src/Skyrim/*.cpp")
file (GLOB_RECURSE CBASH_SKYBLIVION "${CMAKE_CURRENT_SOURCE_DIR}/src/Skyblivion/*.cpp")

set (CBASH_SRC "${CMAKE_CURRENT_SOURCE_DIR}/src/CBash.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/Collection.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/Common.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/GenericChunks.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/GenericRecord.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/ModFile.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/TES4Record.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/TES4RecordAPI.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/Logger.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/Visitors.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/CBash.rc"
${CBASH_FONV}
${CBASH_OBLIVION}
${CBASH_SKYRIM}
${CBASH_SKYBLIVION}
)


file(GLOB_RECURSE TMP_FILES_HDRS
"${CMAKE_SOURCE_DIR}/src/*.h"
)

foreach(f ${TMP_FILES_HDRS})
# Get the path of the file relative to ${DIRECTORY},
# then alter it (not compulsory)
file(RELATIVE_PATH SRCGR "${CMAKE_SOURCE_DIR}/src/" ${f})
set(SRCGR "Headers/${SRCGR}")

# Extract the folder, ie remove the filename part
string(REGEX REPLACE "(.*)(/[^/]*)$" "\\1" SRCGR ${SRCGR})

# Source_group expects \\ (double antislash), not / (slash)
string(REPLACE / \\ SRCGR ${SRCGR})
source_group("${SRCGR}" FILES ${f})
endforeach()

file(GLOB_RECURSE TMP_FILES
"${CMAKE_SOURCE_DIR}/src/*.cpp"
)
foreach(f ${TMP_FILES})
# Get the path of the file relative to ${DIRECTORY},
# then alter it (not compulsory)
file(RELATIVE_PATH SRCGR "${CMAKE_SOURCE_DIR}/src/" ${f})
set(SRCGR "Source Files/${SRCGR}")
# Extract the folder, ie remove the filename part
string(REGEX REPLACE "(.*)(/[^/]*)$" "\\1" SRCGR ${SRCGR})
# Source_group expects \\ (double antislash), not / (slash)
string(REPLACE / \\ SRCGR ${SRCGR})
source_group("${SRCGR}" FILES ${f})
endforeach()

IF (CBASH_NO_BOOST_ZLIB)
add_definitions(-DCBASH_NO_BOOST_ZLIB)
find_package(Boost REQUIRED COMPONENTS iostreams)
find_package(Boost REQUIRED COMPONENTS iostreams regex)
find_package(ZLIB REQUIRED)
set (CBASH_LIBS ${ZLIB_LIBRARY})
ELSE ()
find_package(Boost REQUIRED COMPONENTS iostreams zlib)
find_package(Boost REQUIRED COMPONENTS iostreams zlib regex)
find_package(ZLIB)
set (CBASH_LIBS "")
ENDIF ()

IF (NOT ${ZLIB_FOUND})
message(FATAL_ERROR "ZLIB was not found, target correct ZLIB_ROOT or use a common path")
ENDIF ()

# Include source and library directories.
include_directories ("${CMAKE_SOURCE_DIR}/include/cbash"
include_directories ("${CMAKE_CURRENT_SOURCE_DIR}/include/cbash"
${Boost_INCLUDE_DIRS}
${ZLIB_INCLUDE_DIR})

Expand All @@ -106,12 +83,7 @@ IF (CMAKE_SYSTEM_NAME MATCHES "Windows")
ENDIF ()

IF (MSVC)
IF (MSVC_VERSION EQUAL 1800)
set (CMAKE_GENERATOR_TOOLSET "v120_xp" CACHE STRING "Platform Toolset" FORCE)
ELSEIF (MSVC_VERSION EQUAL 1700)
set (CMAKE_GENERATOR_TOOLSET "v110_xp" CACHE STRING "Platform Toolset" FORCE)
ENDIF ()

# set (CMAKE_GENERATOR_TOOLSET "v141" CACHE STRING "Platform Toolset" FORCE)
# Force static C++ runtime linkage.
IF (PROJECT_STATIC_RUNTIME)
FOREACH(flag
Expand All @@ -133,5 +105,5 @@ ENDIF ()
##############################

# Build CBash.
add_library (CBash ${CBASH_SRC} ${CBASH_GEN_HDRS} )
add_library (CBash STATIC ${CBASH_SRC})
target_link_libraries (CBash ${Boost_LIBRARIES} ${CBASH_LIBS})
8 changes: 3 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
# CBash

CBash is a C/C++ library for reading and writing TES IV: Oblivion, TES V: Skyrim and Fallout: New Vegas plugin files. It's used by the [Wrye Bash](https://github.com/wrye-bash/wrye-bash) modding utility to build its Bashed Patch plugins.
CBash is a library for reading and writing TES IV: Oblivion, TES V: Skyrim and Fallout: New Vegas plugin files. It's used by the [Wrye Bash](https://github.com/wrye-bash/wrye-bash) modding utility to build its Bashed Patch plugins.

For bugs and feature request, feel free to open a new Issue in the Issue tracker. For other discussions, open a new thread [here](http://ost.io/@lojack5/CBash "ost.io"), for example asking questions about what specific parts of the code do, etc.

Instructions on how to build CBash can be found [here](docs/BUILD.md). If linking to a static build of CBash, be sure to define `CBASH_STATIC`. Otherwise, if linking to a dynamic build, define `CBASH_DLL`.
Instructions on how to build CBash can be found [here](docs/BUILD.md).

The plugin file formats are documented at the following locations:

* Oblivion: [UESP.net](http://www.uesp.net/wiki/Tes4Mod:Mod_File_Format)
* Skyrim: [UESP.net](http://www.uesp.net/wiki/Tes5Mod:Mod_File_Format)
* Fallout: New Vegas: [FOPDoc](https://github.com/WrinklyNinja/fopdoc)

The CBash API is currently sparsely documented. There is some Doxygen-style documentation of the API in the [include headers](include/cbash).
The CBash API is currently sparsely documented. There is some Doxygen-style documentation of the API functions exposed in [CBash.h](CBash.h), but some details of the field-related functions' arguments can only be found by reading the source of the `.cpp` files for the record type you are trying to access the fields of.

CBash's record and field support is incomplete. For information on what has and has not ben implemented, see the [wiki](https://github.com/lojack5/CBash/wiki).
31 changes: 5 additions & 26 deletions docs/BUILD.MANUAL.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,47 +4,26 @@ These instructions are for building CBash on Windows by manually creating a Micr

An example of the end result can be found [here](https://drive.google.com/file/d/0B1ddaVyxNcp-ZmpyUENiRFkyUEE/edit?usp=sharing "Google Drive"), though these files are out-of-date compared to the current code, so it's best to create your own solution.

### Create the Project File
1. Create a new Win32 Application project. In the creation wizard be sure to select DLL, and tick the Empty Project option.
2. Now add all the CBash source files to the project. Personally I make the source layout look mostly identical to the actual file layout on disk. So I have a `Skyrim`, `Fallout New Vegas`, and `Oblivion` sub-filters for each of the `Source Files` and `Header Files`. Then under those a sub-filter called `Records`, and under that one called `API`. Just throw every `*.h` and `*.cpp` file into their appropriate filters in the solution explorer. Make sure to include the header files in the `include/cbash` folder too. Finally add `CBash.rc` into the `Resource Files` section.

Alternatively, you can try running [this](https://github.com/lojack5/utilities/blob/master/project_update.py) Python script, which should correctly add all required files to the project. **Note:** That script is written only for Visual Studio 2013, I don't know how or if it will work for other versions.


### Configuration for Building as a Dynamic Library (DLL):
The following steps are actually common to both configuring to build a CBash statically and dynamically, but this guide is assuming you'll setup the dynamic build first, then copy the configurations and edit them to setup the static builds.

1. Change Project settings for `All Configurations`. The next few steps will all be changing settings under the following section:
3. Change Project settings for `All Configurations`. The next few steps will all be changing settings under the following section:
* Right Click on your project in Visual Studio, select Properties.
* In the Property Pages window that pops up, select `All Configurations` from the Configuration drop down.
* All changes will be made under the `Configuration Properties` sub tree on the left.
2. Additional Directories:
4. Additional Directories:
* Go to `VC++ Directories`.
* Edit `Include Directories` so that it includes the path to Boost, zlib and the `include/cbash` directory.
* Edit `Library Directories` so that it includes the path to Boost.
* If you built the zlib binaries and are going to use those instead of Boost's, add that of course.
3. Output Files:
4. Output Files:
* Go to `C/C++ -> Output Files`.
* Edit both `ASM List Location` and `Object File Name` to `$(IntDir)\%(RelativeDir)`. Note there is no backslash at the end. This setting is so files with the same name won't end up making object files that overwrite each other.
4. Preprocessor:
5. Preprocessor:
* Go to `C/C++ -> Preprocessor`
* Edit `Preprocessor Definitions` to include `_CRT_SECURE_NO_WARNINGS`. This will stop the compiler from throwing errors for using things like `strncat`.


### Configuration for Building as a Static Library (LIB):
After following the above steps, copy the existing configurations and edit them to build as static libraries. To do this, go to the `Configuration Manager`, and from the `Active solution configuration:` drop down, select `<New...>`, give it a new name (for example: Release Static), and copy from the applicable configuration. From there, make the following changes to both new configurations, under `Configuration Properties`. In this case, you do *not* want to have `All Configurations` selected when you're doing this, otherwise you will also be editing the DLL configurations.

1. Under `General`, change `Configuration Type` to `Static library (.lib)`.
2. Under `C/C++ -> Preprocessor`, remove `_USRDLL` from `Preprocessor Definitions` if it is there. This will ensure `CBashConfig.h` will properly detect that you're building a static library. Optionally, you could define `CBASH_STATIC` here instead.

**NOTE:** As of Visual Studio 2010, the resulting library (CBash.lib) will not include it's dependencies from other static libraries. This would be Boost's `iostreams`, and `zlib`, depending on how you have CBash setup to link to zlib. There are a few options to deal with this:
1. Just build it as is, and remember that your project that links statically to CBash will need to have the directories for `iostreams` and `zlib` in the `Additional Library Directories` section of your project, otherwise it will not be able to find these libraries.
2. Configure CBash to include these two libraries when building:
* Add the file names for `iostreams` and `zlib` to the `Librarian -> General -> Additional Dependencies` section of your config. To aid in determining the exact file names used by the Boost libraries, define `BOOST_LIB_DIAGNOSTIC` somewhere before `CBashConfig.h` is included. This will cause Boost to output which library file names are being pulled in.
* In your project that is linking to CBash, add both of these file names under `Linker -> Input -> Ignore Specific Default Libraries`. This is needed because your project will *still* try to link to these libraries, even though the symbols will now be contained in `CBash.lib`.


### Additional Configuration (Optional):
6. Additional Configuration (Optional):
* CBash uses boost's `auto_link.hpp` to automatically link to the correct boost zlib binary. If you don't want CBash to use boost's binaries and want to specify your own instead, you need to disable this. Go to `C/C++ -> Preprocessor -> Preprocessor Definitions` and add `CBASH_NO_BOOST_ZLIB` to the list of definitions. Then you will need to add your zlib binary under `Linker -> Input -> Additional Dependencies`.
* CBash automatically detects how you are using it by looking for the `_USRDLL` preprocessor definition in your project file. This definition is added by the MSVC project wizard when making a new DLL project, so if CBash isn't detecting this correctly, you have two options:
* Add/remove `_USRDLL` from the preprocessor definitions as applicable.
Expand Down
Loading