Skip to content

Commit

Permalink
Correct uge spec, add checks for tracker grid casting
Browse files Browse the repository at this point in the history
  • Loading branch information
SuperDisk committed Apr 20, 2024
1 parent aed1006 commit 97fea04
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 8 deletions.
17 changes: 9 additions & 8 deletions manual/src/hUGETracker/uge-format.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
# hUGETracker .UGE v5/v6 format spec
## Data types

| Name | Byte length | Description |
|---------------|-------------|--------------------------------------------------------------------------|
| `uint8` | 1 | Also known as char, ranges from 0 to 255. |
| `uint32` | 4 | Also known as word, ranges from 0 to 4,294,967,295. |
| `int8` | 1 | Ranges from -127 to 127. |
| `bool` | 1 | If not-zero, then True. |
| `shortstring` | 256 | Consists of a byte defining the readable length and then 255 characters. |
| `string` | - | A stream of characters, with 0x00 being the terminator value. |
| Name | Byte length | Description |
|---------------|-------------|--------------------------------------------------------------------------------------------------------------------------------|
| `uint8` | 1 | Also known as char, ranges from 0 to 255. |
| `uint32` | 4 | Also known as word, ranges from 0 to 4,294,967,295. |
| `int8` | 1 | Ranges from -127 to 127. |
| `bool` | 1 | If not-zero, then True. |
| `shortstring` | 256 | Consists of a byte defining the readable length and then 255 characters. |
| `string` | - | Consists of a uint32 defining the number of characters, and then a stream of characters, with 0x00 being the terminator value. |
| | | |

All types are little endian unless noted otherwise.

Expand Down
20 changes: 20 additions & 0 deletions src/tracker.pas
Original file line number Diff line number Diff line change
Expand Up @@ -2099,6 +2099,7 @@ procedure TfrmTracker.MenuItem55Click(Sender: TObject);

procedure TfrmTracker.MenuItem56Click(Sender: TObject);
begin
if not (ActiveControl is TTrackerGrid) then Exit;
(ActiveControl as TTrackerGrid).ChangeSelectionInstrument;
end;

Expand Down Expand Up @@ -2464,6 +2465,7 @@ procedure TfrmTracker.OptionsMenuItemClick(Sender: TObject);

procedure TfrmTracker.MenuItem31Click(Sender: TObject);
begin
if not (ActiveControl is TTrackerGrid) then Exit;
(ActiveControl as TTrackerGrid).InterpolateSelection;
end;

Expand Down Expand Up @@ -2502,21 +2504,25 @@ procedure TfrmTracker.MenuItem34Click(Sender: TObject);

procedure TfrmTracker.OnIncrementValueBy1Click(Sender: TObject);
begin
if not (ActiveControl is TTrackerGrid) then Exit;
(ActiveControl as TTrackerGrid).IncrementSelection(1, 1, 0, 0, 1);
end;

procedure TfrmTracker.OnDecrementValueBy1Click(Sender: TObject);
begin
if not (ActiveControl is TTrackerGrid) then Exit;
(ActiveControl as TTrackerGrid).IncrementSelection(-1, -1, 0, 0, -1);
end;

procedure TfrmTracker.OnIncrementValueBy10Click(Sender: TObject);
begin
if not (ActiveControl is TTrackerGrid) then Exit;
(ActiveControl as TTrackerGrid).IncrementSelection(12, 10, 0, 0, $10);
end;

procedure TfrmTracker.OnDecrementValueBy10Click(Sender: TObject);
begin
if not (ActiveControl is TTrackerGrid) then Exit;
(ActiveControl as TTrackerGrid).IncrementSelection(-12, -10, 0, 0, -$10);
end;

Expand Down Expand Up @@ -2677,79 +2683,93 @@ procedure TfrmTracker.ExportGBButtonClick(Sender: TObject);

procedure TfrmTracker.TrackerPopupCopyClick(Sender: TObject);
begin
if not (ActiveControl is TTrackerGrid) then Exit;
SendMessage((ActiveControl as TTrackerGrid).Handle, LM_COPY, 0, 0)
end;

procedure TfrmTracker.TrackerPopupCutClick(Sender: TObject);
begin
if not (ActiveControl is TTrackerGrid) then Exit;
SendMessage((ActiveControl as TTrackerGrid).Handle, LM_CUT, 0, 0)
end;

procedure TfrmTracker.TrackerPopupEditEffectClick(Sender: TObject);
begin
if not (ActiveControl is TTrackerGrid) then Exit;
(ActiveControl as TTrackerGrid).OpenEffectEditor;
end;

procedure TfrmTracker.TrackerPopupEraseClick(Sender: TObject);
begin
if not (ActiveControl is TTrackerGrid) then Exit;
(ActiveControl as TTrackerGrid).EraseSelection
end;

procedure TfrmTracker.TrackerPopupFloodPasteClick(Sender: TObject);
begin
if not (ActiveControl is TTrackerGrid) then Exit;
(ActiveControl as TTrackerGrid).DoRepeatPaste;
end;

procedure TfrmTracker.TrackerPopupPasteClick(Sender: TObject);
begin
if not (ActiveControl is TTrackerGrid) then Exit;
SendMessage((ActiveControl as TTrackerGrid).Handle, LM_PASTE, 0, 0)
end;

procedure TfrmTracker.TrackerPopupRedoClick(Sender: TObject);
begin
if not (ActiveControl is TTrackerGrid) then Exit;
(ActiveControl as TTrackerGrid).DoRedo
end;

procedure TfrmTracker.TrackerPopupSelectAllClick(Sender: TObject);
begin
if not (ActiveControl is TTrackerGrid) then Exit;
(ActiveControl as TTrackerGrid).SelectAll
end;

procedure TfrmTracker.TrackerPopupSelectChannelClick(Sender: TObject);
begin
if not (ActiveControl is TTrackerGrid) then Exit;
(ActiveControl as TTrackerGrid).SelectColumn
end;

procedure TfrmTracker.TrackerPopupTransposeOctaveDownClick(Sender: TObject);
begin
if not (ActiveControl is TTrackerGrid) then Exit;
(ActiveControl as TTrackerGrid).TransposeSelection(-12);
if TrackerSettings.PreviewWhenBumping then
PreviewNoteUnderCursor;
end;

procedure TfrmTracker.TrackerPopupTransposeOctaveUpClick(Sender: TObject);
begin
if not (ActiveControl is TTrackerGrid) then Exit;
(ActiveControl as TTrackerGrid).TransposeSelection(12);
if TrackerSettings.PreviewWhenBumping then
PreviewNoteUnderCursor;
end;

procedure TfrmTracker.TrackerPopupTransposeSemiDownClick(Sender: TObject);
begin
if not (ActiveControl is TTrackerGrid) then Exit;
(ActiveControl as TTrackerGrid).TransposeSelection(-1);
if TrackerSettings.PreviewWhenBumping then
PreviewNoteUnderCursor;
end;

procedure TfrmTracker.TrackerPopupTransposeSemiUpClick(Sender: TObject);
begin
if not (ActiveControl is TTrackerGrid) then Exit;
(ActiveControl as TTrackerGrid).TransposeSelection(1);
if TrackerSettings.PreviewWhenBumping then
PreviewNoteUnderCursor;
end;

procedure TfrmTracker.TrackerPopupUndoClick(Sender: TObject);
begin
if not (ActiveControl is TTrackerGrid) then Exit;
(ActiveControl as TTrackerGrid).DoUndo
end;

Expand Down

0 comments on commit 97fea04

Please sign in to comment.