From db0a2a6a12e41e6780b309a711d803f442465ee7 Mon Sep 17 00:00:00 2001 From: minjaesong Date: Thu, 11 May 2023 21:07:32 +0900 Subject: [PATCH] typo fix --- tvdos_app_package.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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:

  • Smaller file size than “everything spilled out”
  • All required libraries are self-contained
  • Has its own bootloader so that minimal extra code is required on DOS-side
  • Bootloader must be versatile enough that DOS code needs no change when more advanced features were added

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:

  • VDISK — Virtual Disk (TVDOS LFS format). Extra libraries must be contained here
  • RODATA — Read-only Data. Typically graphical resources
  • TEXT — The Bootloader (run.com)
  • APPINFO — Desktop Entry text that contains information about the App
  • COPYING — Licence text
  • ENDOFSECTION — Marker for the end of the penultimate section. The offset is identical to the size of the entire App Package if no extra bytes (aka footers) are followed

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