Skip to content

Commit

Permalink
hello wld
Browse files Browse the repository at this point in the history
  • Loading branch information
nickgal committed Jun 1, 2021
0 parents commit 7bb8eb4
Show file tree
Hide file tree
Showing 47 changed files with 13,859 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@

# Create one with no scope selected on https://github.com/settings/tokens/new
GITHUB_TOKEN=
11 changes: 11 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
node_modules
*.iml
.idea
*.log*
.nuxt
.vscode
.DS_Store
coverage
dist
sw.*
.env
27 changes: 27 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# wld-doc

## Setup

Install dependencies:

```bash
yarn install
```

## Development

```bash
yarn dev
```

## Static Generation

This will create the `dist/` directory for publishing to static hosting:

```bash
yarn generate
```

To preview the static generated app, run `yarn start`

For detailed explanation on how things work, checkout [nuxt/content](https://content.nuxtjs.org) and [@nuxt/content theme docs](https://content.nuxtjs.org/themes-docs).
1 change: 1 addition & 0 deletions assets/css/main.css
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.container { max-width: 100% !important; }
75 changes: 75 additions & 0 deletions components/T3dFile.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
<template>
<div>

<input type="file" @change="parseT3dFile($event.target.files[0])">

<div v-if="t3d">
<div class="grid grid-cols-3 gap-4">
<div v-for="file in t3d.files" :key="file.i">
<strong>{{ file.filename }}</strong> {{ file.filesize }}B
<img v-if="file.filename.toLowerCase().endsWith('.bmp')" :src="objectUrl(file)">
<a :href="objectUrl(file)" :download="file.filename">Download</a>
</div>
</div>
</div>
</div>
</template>

<script>
import Fastfile from '../static/files/lib/Fastfile'
import TanarusT3d from '../static/files//lib/TanarusT3d'
import KaitaiStream from 'kaitai-struct/KaitaiStream'
export default {
props: {
t3dType: {
type: String,
default: 'tanarus'
}
},
data() {
return {
t3d: null,
objectUrls: {}
}
},
computed: {
parser() {
let parser;
switch (this.t3dType) {
case 'tanarus':
parser = TanarusT3d;
break;
case 'fastfile':
parser = Fastfile;
break;
default:
parser = Fastfile;
}
return parser;
}
},
methods: {
async parseT3dFile(file) {
const arrayBuffer = await file.arrayBuffer();
this.parseT3d(arrayBuffer);
},
parseT3d(buffer) {
const stream = new KaitaiStream(buffer);
this.t3d = new this.parser(stream);
console.dir(this.t3d)
},
objectUrl(file) {
// return URL.createObjectURL(new Blob([file.body]));
this.objectUrls[file.filename] = this.objectUrls[file.filename] || URL.createObjectURL(new Blob([file.body]));
return this.objectUrls[file.filename];
}
}
}
</script>

<style>
</style>
52 changes: 52 additions & 0 deletions components/WldFile.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<template>
<div>

<input type="file" @change="parseWldFile($event.target.files[0])">

<div v-if="wld">
<p>
JSON below excludes lazy evaluated properties.
Use browser console or the <a href="https://ide.kaitai.io">Kaitai WebIDE</a> to further explore.
</p>

<!-- ugh this doesnt parse the object correctly -->
<!-- <tree-view :data="wldDump" :options="{maxDepth: 32}"></tree-view> -->
<pre>{{ JSON.stringify(wldDump, undefined, 2) }}</pre>
</div>
</div>
</template>

<script>
import SonyWld from '../static/files/lib/SonyWld'
import KaitaiStream from 'kaitai-struct/KaitaiStream'
export default {
data() {
return {
wld: null,
}
},
computed: {
wldDump() {
return JSON.parse(JSON.stringify(this.wld, function replacer(key, value) {
if (key.startsWith('_io') || key.startsWith('_parent') || key.startsWith('_root'))
return undefined;
return value;
}));
}
},
methods: {
async parseWldFile(file) {
const arrayBuffer = await file.arrayBuffer();
this.parseWld(arrayBuffer)
},
parseWld(buffer) {
this.wld = new SonyWld(new KaitaiStream(buffer))
console.dir(this.wld)
}
}
}
</script>

<style>
</style>
15 changes: 15 additions & 0 deletions content/en/games/return-to-krondor.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
title: 'Return to Krondor'
description: ''
position: 15
category: games
---

<alert type="warning">
Pending
</alert>

- Game uses True3d
- Includes `t3dll.dll` with a `1998` copyright string
- Contains various `.t3d` files
- Other files contain the same and similar magic bytes as compressed `wld` files.
52 changes: 52 additions & 0 deletions content/en/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
---
title: Introduction
description: ''
position: 1
category: ''
---

<alert type="warning">
This is very much a WIP.
</alert>

# True3d Engine / Sony `.wld` file format

While quite a bit is already known \(see Windcatcher's [WLD File Reference](https://eqemu.gitbook.io/server/categories/zones/customizing-zones/wld-file-reference)\), I
wanted to document my attempts at leveraging other games and files to further define the format and share some interesting things I found along the way.


## Topics

- Games and programs that utilize variants of the `.wld` file format
- Small `.wld` file snippets that can be processed by [WLDCOM.EXE](wldcom/overview)
- [Kaitai Structs](kaitai/structs) to document the formats and generate parsers

## Reminders

Various things I need to add or have come across but havn't documented yet:

- Create section for ascii files found in `global4_chr.s3d`
- `*.mdf`
- `*.sps`

- ASCII source file exts found
- `.mdf` - material definition (file?)
- `.sps` - sprite simple
- `.sph` - sprite hierarchical
- `.adf` - actor definition file?
- `.ant` - (unk - included instead of a .sps)
- `.dep` - file dependency

- MapEdit function `FUN_0041a810` generates an ascii "TANARUS3D Preview World" `.wld`

- GameGen
- MapEdit string: `// Source File Type: GameGen`
- https://www.bloomberg.com/press-releases/1996-05-15/pyrotechnix-and-viacom-new-media-sign-development-and-licensing [(mirror)](https://archive.today/knfE3)
- > True3D is a Windows 95, real-time, 3-D game development system with data import support for 3D Studio(TM), Alias(TM) and GameGen(TM).
- > "This is our second major development deal using the True3D technology," said PyroTechnix President, Sinjin Bain, referring to last week's announcement regarding a development and licensing deal with Sony Interactive.
- Ascii `.wld` snippets w/ hexdump of corresponding bin. Something like [this](/wldcom/overview#compress)

## TL;DR

I've found that [WLDCOM.EXE](wldcom/overview) and other files could be used to expand the public understanding of binary `.wld` files and the ascii format they were generated from.
31 changes: 31 additions & 0 deletions content/en/kaitai/js-parsers.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
title: JS Parsers
description: ''
position: 21
category: Kaitai
---

### Fastfile.js

Generated from [fastfile.ksy](structs#fastfileksy). Click [here](/oldeq/t3d-files#js-parser) to try in your browser.

```js[Fastfile.js]
source:lib/Fastfile.js
```

### TanarusT3d.js

Generated from [tanarus_t3d.ksy](structs#tanarus_t3dksy). Click [here](/tanarus/t3d-files#js-parser) to try in your browser.

```js[TanarusT3d.js]
source:lib/TanarusT3d.js
```


### SonyWld.js

Generated from [sony_wld.ksy](structs#sony_wldksy). Visit [Parser Demo](parser-demo) to try in your browser.

```js[SonyWld.js]
source:lib/SonyWld.js
```
42 changes: 42 additions & 0 deletions content/en/kaitai/structs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
---
title: Structs
description: ''
position: 25
category: Kaitai
---


<alert type="warning">
TODO: Describe kaitai structs
</alert>


Load the definitions into the [Kaitai WebIDE](https://ide.kaitai.io/) to interactively explore binaries and generate parsers.

## fastfile.ksy

<a href="/files/fastfile.ksy" target="_blank" download="fastfile.ksy">Download</a>

```yml[fastfile.ksy]
source:fastfile.ksy
```

## tanarus_t3d.ksy

<a href="/files/tanarus_t3d.ksy" target="_blank" download="tanarus_t3d.ksy">Download</a>

```yml[tanarus_t3d.ksy]
source:tanarus_t3d.ksy
```

## sony_wld.ksy

<alert type="warning">
Incomplete.
</alert>

<a href="/files/sony_wld.ksy" target="_blank" download="sony_wld.ksy">Download</a>

```yml[sony_wld.ksy]
source:sony_wld.ksy
```
Loading

0 comments on commit 7bb8eb4

Please sign in to comment.