1
0

doc: update doc for BMap bindings

This commit is contained in:
2026-02-09 22:56:38 +08:00
parent 30f7201a07
commit 1b991dd834
3 changed files with 49 additions and 9 deletions

View File

@@ -1,9 +1,18 @@
# BMapSharp
The core of BMapSharp project is placed within `BMapSharp` subdirectory. This directory also contain a testbench project of `BMapSharp`, called `BMapSharpTest`. You can build it and do basic test for `BMapSharp`.
## Layout
The native BMap library should be placed together with managed `BMapSharp` dynamic library. I use gitignore file to filter all native binary so you need put them manually. The native BMap library must be named as `BMap.dll` (in Windows), `BMap.so` (in Linux or BSD), or `BMap.dylib` (in macOS). If you still can not load BMap or your system is not listed above, you should name it as `BMap.bin`.
This directory contains 2 project.
`BMapSharp` is the binding to BMap and `BMapSharpTest` is the test for `BMapSharp`.
The most content of `VirtoolsTypes.cs` is generated by EnumsMigration, and the most content of `BMap.cs` is generated by BMapBindings. You should watch these file changes if corresponding C++ code or structures are changed.
> [!NOTE]
> `BMapSharpTest` project do not utilize any existing test framework.
> The test should be executed manually by compiling it and running it.
Since BMap 0.3.0, testbench use command line arguments, instead of hardcode variables in code, as the arguments of BMap. It is convenient that debug BMapSharp without any modification of source code. For a brief instruction, you may need to launch BMapSharpTest in following command (just an example. you can modify it as you wished): `dotnet run -- --file-path "LightCameraTest.nmo" --temp-dir "Temp" --texture-dir "F:/Ballance/Ballance/Textures" --encodings cp1252 gb2312`.
## Native BMap Library Location
The native BMap library should be placed together with managed `BMapSharp` dynamic library.
The native BMap library must be named as `BMap.dll` (in Windows), `BMap.so` (in Linux or BSD), `BMap.dylib` (in macOS), or `BMap.bin` (in any other platforms).
If you are building final distributed package file (I have not build them yet), you may need manually put native BMap library file into package file because I have not write this behavior in any place.

View File

@@ -1,7 +1,28 @@
# BMap Bindings
This directory contains bindings for C++ written BMap for interacting with Ballance map.
We now provide following bindings due to different reasons:
* pybmap: The Python bindings for BMap. [Ballance Blender Plugin](https://github.com/yyc12345/BallanceBlenderHelper) require this.
* BMapSharp: The C# bindings for BMap. This can be used in C#-available game engine (Unity, Godot, etc.) for implementing next generation of Ballance with legacy map format support.
* bmap-rs: The Rust bindings for BMap. ZZQ request it for his Ballance launcher.
## Package Principle
In theory, these BMap bindings can be distributed as the package in their corresponding package manager.
However, considering these bindings is specific for a minor territory, Ballance mapping,
and the complexity of building the essential artificate, dynamic library BMap written in C++,
I give up the idea of distributing them as package.
For all users who want to utilize these bindings, you should build them on their own,
according to the build manual provided in respective directory.
## Test
These BMap bindings all have test for testing whether they work correctly.
And these test program following the same pattern for fetching test parameters
indluding where to find the map and etc.
More preciously, you should set environment variables list following before running test programs.
* `BMAP_FILE_NAME`: The path to the map for loading.
* `BMAP_BALLANCE_DIR`:The path to the Ballance directory for finding textures
* `BMAP_ENCODINGS`: The name of encodings used by BMap for loading map. Multiple encodings is supported by separating them with commas, for example: `cp1252,gbk`.

View File

@@ -1,9 +1,19 @@
# PyBMap
# pybmap
The real scripts are placed in sub PyBMap folder. This folder is served for testbench scripts placing. You can run `testbench.py` to do a basic test for PyBMap but you may need some essential files to run this testbench which were written in `testbench.py`.
## Layout
The native BMap library should be placed in sub PyBMap folder, and I have used gitignore file to filter them. The native BMap library must be named as `BMap.dll` (in Windows), `BMap.so` (in Linux or BSD), or `BMap.dylib` (in macOS). If you still can not load BMap or your system is not listed above, you should name it as `BMap.bin`.
This project follow `src` and `test` layout and is managed by Astral UV.
The source code of pybmap is located inside `src`.
And the files located in `test` is used for testing.
Please note the most content of `virtools_types.py` are generated by EnumsMigration sub-project. Additionally the most content of `bmap.py` is generated by BMapBindings. So if some structs are updated, do not forget checking these files.
> [!NOTE]
> The files located in `test` are not prepared for `pytest` framework.
> The test should be executed manually by `uv run test/main.py`.
Since BMap 0.3.0, testbench use command line arguments, instead of hardcode variables in code, as the arguments of BMap. It is convenient that debug BMapSharp without any modification of source code. For a brief instruction, you may need to launch BMapSharpTestbench in following command (just an example. you can modify it as you wished): `py testbench.py --file-path "LightCameraTest.nmo" --temp-dir "Temp" --texture-dir "F:/Ballance/Ballance/Textures" --encodings cp1252 gb2312`.
## Native BMap Library Location
The native BMap library file should be placed with `bmap.py` file.
The native BMap library must be named as `BMap.dll` (in Windows), `BMap.so` (in Linux or BSD), `BMap.dylib` (in macOS), or `BMap.bin` (in any other platforms).
If you are building final distributed package file, such as `.whl` file, you may need manually put native BMap library file into package file because I have not write this behavior in any script.