diff --git a/tvdos_app_package.html b/tvdos_app_package.html index 653d90e..07bdbd8 100644 --- a/tvdos_app_package.html +++ b/tvdos_app_package.html @@ -669,7 +669,7 @@ blockquote {

TVDOS App Package

TVDOS App Package brings the convenience of the self-packaged executable to TVDOS. Applications containing multiple resources, library dependencies, specific environment variables, etc. are compressed, self-contained, and upon execution, unpacked and presented to your application — all in a single .app file.

TVDOS App Package is built with following goals in mind:

How It Runs

TVDOS will recognise that the file is an App Package, by considering the .app extension and the file header. Once recognised, TVDOS will go through the following steps to present the packed app to the end user:

  1. Internally defines the path named MOUNT (typically under $:\TMP\)
  1. An empty filesystem is then created and mounted to the MOUNT
  1. Optional VDISK is unpacked to Program Memory and then mounted under the MOUNT\
  1. Resources defined in RODATA are loaded into the Scratchpad Memory
  1. Pointers to the loaded resources are injected as an JavaScript Object __RODATA, into the main executable code (format: __RODATA.mylabel = 123456)
  1. Injects patched files.open() which redirects any file references that are defined in the VDISK to the mounted VDISK
  1. Main executable code (“bootloader” for the App Package) is copied as MOUNT\run.com
  1. MOUNT\run.com is then read and called
  1. If any exceptions were caught or quit successfully, undoes any patching, unmounts itself, then returns the Errorlevel of the app to TVDOS

TVDOS App Package Format

Structure

Overview

Header Area
Section Table
VDISK
RODATA
TEXT

Header Area

OffsetTypeDescription
0\x7F A p PMagic (App Package)
4Uint8Endianness. 1 for Big
5Uint8Version. Always 1
6Uint8Section Compression. 0—None, 1—Gzip
7Uint8Number of Sections. Always greater than zero because of the ENDOFSECTION
8Uint8Target OS. 1—TVDOS, 0—Unspecified
9Byte[7]Padding bytes

Section Table

Repetition of:

Section Name
(12 bytes, \x00 padded)
Offset
(Uint32; 4 bytes)

Recognised section names:

The Section Structure (not RODATA)

Uncompressed Size -
(Uint48; 4 bytes)
Compressed Payload +
(Uint32; 4 bytes)
Compressed Payload
(arbitrary size)

RODATA Section Structure

Repetition of:

Label Length
(1—255)
Label
(arbitrary size)
Compressed Size