- Notifications
You must be signed in to change notification settings - Fork0
Android library for parsing and converting RenderWare dff and txd models of Grand Theft Auto.
License
Lime-blur/rwparser
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
rwparser is an android library for parsing and converting RenderWare dff and txd models of Grand Theft Auto.
Add this dependency to your module'sbuild.gradle
file:
dependencies {.. implementation'com.github.Lime-blur:rwparser:latest_version'}
Add it in your root build.gradle at the end of repositories (or in settings.gradle):
dependencyResolutionManagement { repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) repositories { mavenCentral() maven { url'https://jitpack.io' } }}
In order to parse a.dff
file, you simply need to create aModelParser()
object and call the appropriate method:
val modelParser=ModelParser()val parseResult= modelParser.putDffDumpIntoFile(inFilePath, outFilePath,/* optional*/true)
For asynchronous parsing, you need to call the appropriate function and bind ModelParser to the component's lifecycle:
classMainActivity :AppCompatActivity() {privatevar modelParser:ModelParser?=nulloverridefunonCreate(savedInstanceState:Bundle?) {super.onCreate(savedInstanceState).. modelParser=ModelParser() }overridefunonDestroy() { modelParser?.destroy()super.onDestroy() }privatefunparse() { modelParser?.putDffDumpIntoFileAsync(inFilePath, outFilePath,/* optional*/true) { parseResult->// Handling the callback } }}
Same for.txd
file:
val modelParser=ModelParser()val parseResult= modelParser.putTxdDumpIntoFile(inFilePath, outFilePath)
For asynchronous.txd
's parsing:
classMainActivity :AppCompatActivity() {privatevar modelParser:ModelParser?=nulloverridefunonCreate(savedInstanceState:Bundle?) {super.onCreate(savedInstanceState).. modelParser=ModelParser() }overridefunonDestroy() { modelParser?.destroy()super.onDestroy() }privatefunparse() { modelParser?.putTxdDumpIntoFileAsync(inFilePath, outFilePath) { parseResult->// Handling the callback } }}
The library can also convert.dff
to.gltf
format. To convert you need:
val modelParser=ModelParser()val parseResult= modelParser.convertDffToGltf(inDffFilePath, outFilePath,/* optional*/ inTxdFilePath,/* optional*/ viewType)
For asynchronous.dff
's converting:
classMainActivity :AppCompatActivity() {privatevar modelParser:ModelParser?=nulloverridefunonCreate(savedInstanceState:Bundle?) {super.onCreate(savedInstanceState).. modelParser=ModelParser() }overridefunonDestroy() { modelParser?.destroy()super.onDestroy() }privatefunconvert() { modelParser?.convertDffToGltfAsync(dffFilePath, gltfFilePath,/* optional*/ txdFilePath,/* optional*/ viewType) { parseResult->// Handling the callback } }}
See the sample application, where an example of using the library is implemented:https://github.com/Lime-blur/rwparser/tree/main/sample
- rwtools:https://github.com/aap/rwtools
- dff_converter:https://github.com/SimoSbara/dff_converter
About
Android library for parsing and converting RenderWare dff and txd models of Grand Theft Auto.