Skip to content

Commit

Permalink
Load screen opened by default.
Browse files Browse the repository at this point in the history
  • Loading branch information
maziac committed Jan 3, 2021
1 parent 331251e commit e3c2763
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 13 deletions.
6 changes: 4 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
# Changelog

# 1.1.0
- Nex file viewer will update automatically if file changes in background.
## 1.1.0
- NEX file viewer will update automatically if file changes in background.
- Load screen now opened by default.

## 1.0.0
- First beta test version.
- Register view.
Expand Down
4 changes: 2 additions & 2 deletions html/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,12 @@ a.tip {

/* Class for the description */
.description {
padding-left: 0.5em;
padding-left: 1.5em;
width: auto;
}


/* Expanded content of a memroy dump. */
/* Expanded content of a memory dump. */
.mem_dump {
display: table-row;
}
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/editorprovider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export class EditorProvider implements vscode.CustomReadonlyEditorProvider {
// Send data
this.sendDataToWebView(filePath, webviewPanel);
// Establish file watcher to check for changes
const fsWatcher = vscode.workspace.createFileSystemWatcher(filePath, false, false, true);
const fsWatcher = vscode.workspace.createFileSystemWatcher(filePath, true, false, true);
fsWatcher.onDidChange(() => {
// Re-read data
this.sendDataToWebView(filePath, webviewPanel);
Expand Down
14 changes: 7 additions & 7 deletions src/html/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ When screens 320x256x8 or 640x256x4 are used, this byte is re-used as palette of
// Layer 2 loading screen
if (loadScreens & 0b0000_0001) {
read(49152);
createNode('LAYER2_LOAD_SCREEN', '', 'Layer 2 loading screen');
createNode('LAYER2_LOAD_SCREEN', '', 'Layer 2 loading screen').open = true;
addDetailsParsing(() => {
createDescription('Palette consists of 512 bytes (256 palette items from index 0), in 9b color format: first byte is RRRG_GGBB, second byte is P000_000B (P is priority flag for Layer 2 colours).');
read(49152);
Expand All @@ -286,7 +286,7 @@ When screens 320x256x8 or 640x256x4 are used, this byte is re-used as palette of
// ULA loading screen
if (loadScreens & 0b0000_0010) {
read(6912);
createNode('ULA_LOAD_SCREEN', '', 'Classic ULA loading screen');
createNode('ULA_LOAD_SCREEN', '', 'Classic ULA loading screen').open = true;
addDetailsParsing(() => {
read(6912);
createUlaScreen();
Expand All @@ -301,7 +301,7 @@ When screens 320x256x8 or 640x256x4 are used, this byte is re-used as palette of
// LoRes loading screen
if (loadScreens & 0b0000_0100) {
read(12288);
createNode('LORES_LOAD_SCREEN', '', 'LoRes (128x96) loading screen');
createNode('LORES_LOAD_SCREEN', '', 'LoRes (128x96) loading screen').open = true;
addDetailsParsing(() => {
createDescription('Palette consists of 512 bytes (256 palette items from index 0), in 9b color format: first byte is RRRG_GGBB, second byte is P000_000B (P is is not used for LoRes).');
read(12288);
Expand All @@ -318,7 +318,7 @@ When screens 320x256x8 or 640x256x4 are used, this byte is re-used as palette of
if (loadScreens & 0b0000_1000) {
const timexInkColor = (hiresColor >> 2) & 0b111;
read(12288);
createNode('HIRES_LOAD_SCREEN', '', 'Timex HiRes (512x192) loading screen');
createNode('HIRES_LOAD_SCREEN', '', 'Timex HiRes (512x192) loading screen').open = true;
addDetailsParsing(() => {
createDescription(`The Timex HiRes mode supports only 2 colors.`);
read(12288);
Expand All @@ -334,7 +334,7 @@ When screens 320x256x8 or 640x256x4 are used, this byte is re-used as palette of
// Timex HiCol loading screen
if (loadScreens & 0b0001_0000) {
read(12288);
createNode('HICOL_LOAD_SCREEN', '', 'Timex HiCol (8x1) loading screen');
createNode('HICOL_LOAD_SCREEN', '', 'Timex HiCol (8x1) loading screen').open = true;
addDetailsParsing(() => {
createDescription(`HiCol modes uses more attributes. I.e. the attribute applies to 1 byte only.`);
read(12288);
Expand All @@ -354,7 +354,7 @@ When screens 320x256x8 or 640x256x4 are used, this byte is re-used as palette of
switch (loadScreens2) {
case 1:
// Layer 2 320x256x8bpp, blocks: [512B palette +] 81920B data
createNode('LAYER2_320_LOAD_SCREEN', '', 'Layer 2 320x256x8bpp, 1 byte per pixel');
createNode('LAYER2_320_LOAD_SCREEN', '', 'Layer 2 320x256x8bpp, 1 byte per pixel').open = true;
addDetailsParsing(() => {
read(81920);
const palOffset = hiresColor & 0x0F;
Expand All @@ -369,7 +369,7 @@ When screens 320x256x8 or 640x256x4 are used, this byte is re-used as palette of
break;
case 2:
// Layer 2 640x256x8bpp, blocks: [512B palette +] 81920B data
createNode('LAYER2_320_LOAD_SCREEN', '', 'Layer 2 640x256x4bpp, 4 bits per pixel');
createNode('LAYER2_320_LOAD_SCREEN', '', 'Layer 2 640x256x4bpp, 4 bits per pixel').open = true;
addDetailsParsing(() => {
read(81920);
const palOffset = hiresColor & 0x0F;
Expand Down
42 changes: 42 additions & 0 deletions src/html/parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,48 @@ function createDescription(descr: string) {
}


/**
* Creates an element with a number of columns.
* Without any index and size columns.
* @param name The name of the value. E.g. "SP".
* @param valString The value to show.
* @param shortDescription A short description of the entry.
*/
function createSimpleRow(name: string, valString = '', shortDescription = '') {
// Create new node
const node = document.createElement("DETAILS");
node.classList.add("nomarker");
const html = `
<summary>
<div class="offset"></div>
<div class="size"></div>
<div class="name">${name}</div>
<div class="value">${valString}</div>
<div class="description">${shortDescription}</div>
</summary>
<div class="indent"></div>
`;
node.innerHTML = html;

// Get child objects
const childrenNode = node.childNodes;
lastContentNode = childrenNode[3];
const summary = childrenNode[1];
const children = summary.childNodes;
lastNameNode = children[5];
lastValueNode = children[7];
lastDescriptionNode = children[9];
const descriptionChildren = lastDescriptionNode.childNodes;
lastLongDescriptionNode = descriptionChildren[3];

// Append it
lastNode.appendChild(node);

// Return
return node;
}


/**
* Adds a hover text to lastValueNode.
* @param hoverValueString String to show on hover for the title. Can be undefined.
Expand Down

0 comments on commit e3c2763

Please sign in to comment.