Added map stretching; Added fullscreen toggle hotkey

This commit is contained in:
4aiman 2024-02-07 12:00:08 +03:00
commit 220de6f6c4
6 changed files with 172 additions and 86 deletions

View file

@ -15,6 +15,10 @@ The images were taken from [Dr. Cossack's Lab](https://www.interordi.com/mega_ma
- Use `Start`/`Stop` button to enable/disable memory reading.
- If you encounter an `Unknown` Room - press `Edit` it and give it a name.
- The name you've given will be used when loading images, e.g. when you're in the `Lan's Room`, the app will try to load `./images/Lan's Room.png` image.
- Use `+`/`-` buttons to add/delete spoils list found in room (blue, gree, purple mystery data, lotto codes etc)
- Double click spoil item to edit it
- Use `Stretch` checkbox if you want your map stretched (usefull for those streaming people)
- Use `Win`+`Y` global hotkey to toggle fullscreen (conflicts with mixed reality shortcut, not configurable atm)
The app should work under a regular user ***do not*** give this app (and 99.9% of all the other apps) admin privs

View file

@ -18,7 +18,7 @@
<UseVersionInfo Value="True"/>
<AutoIncrementBuild Value="True"/>
<MinorVersionNr Value="1"/>
<RevisionNr Value="3"/>
<RevisionNr Value="4"/>
<BuildNr Value="18"/>
<Attributes pvaPrivateBuild="True"/>
</VersionInfo>
@ -27,6 +27,7 @@
</BuildModes>
<PublishOptions>
<Version Value="2"/>
<OpenInFileMan Value="True"/>
<UseFileFilters Value="True"/>
</PublishOptions>
<RunParams>

View file

@ -48,7 +48,7 @@
<IsPartOfProject Value="True"/>
<EditorIndex Value="2"/>
<CursorPos X="69" Y="19"/>
<UsageCount Value="43"/>
<UsageCount Value="44"/>
<Loaded Value="True"/>
</Unit>
<Unit>
@ -59,9 +59,9 @@
<ResourceBaseClass Value="Form"/>
<UnitName Value="Unit1"/>
<IsVisibleTab Value="True"/>
<TopLine Value="147"/>
<CursorPos X="17" Y="161"/>
<UsageCount Value="43"/>
<TopLine Value="352"/>
<CursorPos X="94" Y="363"/>
<UsageCount Value="44"/>
<Loaded Value="True"/>
<LoadedDesigner Value="True"/>
</Unit>
@ -70,7 +70,7 @@
<EditorIndex Value="3"/>
<TopLine Value="128"/>
<CursorPos Y="152"/>
<UsageCount Value="20"/>
<UsageCount Value="21"/>
<Loaded Value="True"/>
</Unit>
<Unit>
@ -78,71 +78,11 @@
<EditorIndex Value="1"/>
<TopLine Value="147"/>
<CursorPos X="16" Y="161"/>
<UsageCount Value="10"/>
<UsageCount Value="11"/>
<Loaded Value="True"/>
</Unit>
</Units>
<JumpHistory HistoryIndex="29">
<Position>
<Filename Value="unit1.pas"/>
<Caret Line="110" Column="9" TopLine="68"/>
</Position>
<Position>
<Filename Value="unit1.pas"/>
<Caret Line="211" Column="14" TopLine="170"/>
</Position>
<Position>
<Filename Value="unit1.pas"/>
<Caret Line="213" Column="49" TopLine="171"/>
</Position>
<Position>
<Filename Value="unit1.pas"/>
<Caret Line="214" Column="49" TopLine="172"/>
</Position>
<Position>
<Filename Value="unit1.pas"/>
<Caret Line="213" Column="49" TopLine="171"/>
</Position>
<Position>
<Filename Value="unit1.pas"/>
<Caret Line="214" Column="49" TopLine="172"/>
</Position>
<Position>
<Filename Value="unit1.pas"/>
<Caret Line="213" Column="49" TopLine="171"/>
</Position>
<Position>
<Filename Value="unit1.pas"/>
<Caret Line="212" Column="49" TopLine="170"/>
</Position>
<Position>
<Filename Value="unit1.pas"/>
<Caret Line="213" Column="49" TopLine="171"/>
</Position>
<Position>
<Filename Value="unit1.pas"/>
<Caret Line="220" Column="49" TopLine="178"/>
</Position>
<Position>
<Filename Value="unit1.pas"/>
<Caret Line="183" Column="17" TopLine="163"/>
</Position>
<Position>
<Filename Value="unit1.pas"/>
<Caret Line="156" Column="47" TopLine="131"/>
</Position>
<Position>
<Filename Value="unit1.pas"/>
<Caret Line="150" Column="20" TopLine="131"/>
</Position>
<Position>
<Filename Value="unit1.pas"/>
<Caret Line="157" Column="86" TopLine="135"/>
</Position>
<Position>
<Filename Value="unit1.pas"/>
<Caret Line="114" Column="23" TopLine="89"/>
</Position>
<Position>
<Filename Value="unit1.pas"/>
<Caret Line="165" Column="36" TopLine="141"/>
@ -203,6 +143,66 @@
<Filename Value="unit1.pas"/>
<Caret Line="212" Column="53" TopLine="180"/>
</Position>
<Position>
<Filename Value="unit1.pas"/>
<Caret Line="163" Column="43" TopLine="147"/>
</Position>
<Position>
<Filename Value="unit1.pas"/>
<Caret Line="174" Column="73" TopLine="149"/>
</Position>
<Position>
<Filename Value="unit1.pas"/>
<Caret Line="167" Column="47" TopLine="149"/>
</Position>
<Position>
<Filename Value="unit1.pas"/>
<Caret Line="140" Column="20" TopLine="106"/>
</Position>
<Position>
<Filename Value="unit1.pas"/>
<Caret Line="141" Column="54" TopLine="116"/>
</Position>
<Position>
<Filename Value="unit1.pas"/>
<Caret Line="9" Column="36"/>
</Position>
<Position>
<Filename Value="unit1.pas"/>
<Caret Line="60" Column="6" TopLine="36"/>
</Position>
<Position>
<Filename Value="unit1.pas"/>
<Caret Line="130" Column="33" TopLine="99"/>
</Position>
<Position>
<Filename Value="unit1.pas"/>
<Caret Line="334" TopLine="293"/>
</Position>
<Position>
<Filename Value="unit1.pas"/>
<Caret Line="301" Column="50" TopLine="266"/>
</Position>
<Position>
<Filename Value="unit1.pas"/>
<Caret Line="352" TopLine="315"/>
</Position>
<Position>
<Filename Value="unit1.pas"/>
<Caret Line="146" TopLine="139"/>
</Position>
<Position>
<Filename Value="unit1.pas"/>
<Caret Line="140" Column="3" TopLine="138"/>
</Position>
<Position>
<Filename Value="unit1.pas"/>
<Caret Line="144" Column="55" TopLine="131"/>
</Position>
<Position>
<Filename Value="unit1.pas"/>
<Caret Line="219" Column="51" TopLine="193"/>
</Position>
</JumpHistory>
<RunParams>
<FormatVersion Value="2"/>

Binary file not shown.

View file

@ -1,7 +1,7 @@
object Form1: TForm1
Left = 1033
Left = 1657
Height = 448
Top = 463
Top = 313
Width = 528
Caption = 'MMBN5M'
ClientHeight = 448
@ -11,8 +11,8 @@ object Form1: TForm1
Font.Name = 'Liberation Mono'
Font.Pitch = fpFixed
Font.Quality = fqDraft
OnClose = FormClose
OnCreate = FormCreate
OnDestroy = FormDestroy
Position = poScreenCenter
LCLVersion = '2.2.6.0'
object room_name_label: TLabel
@ -153,6 +153,25 @@ object Form1: TForm1
OnClick = minus_spoil1Click
TabOrder = 3
end
object map_stretch_checkbox: TCheckBox
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = spoils_listbox
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = map_image
AnchorSideBottom.Control = plus_spoil
Left = 8
Height = 22
Top = 370
Width = 120
Anchors = [akLeft, akRight, akBottom]
BorderSpacing.Left = 8
BorderSpacing.Top = 8
BorderSpacing.Right = 8
BorderSpacing.Bottom = 8
Caption = 'Stretch'
OnChange = map_stretch_checkboxChange
TabOrder = 4
end
object Timer1: TTimer
Enabled = False
OnTimer = Timer1Timer

View file

@ -6,13 +6,23 @@ interface
uses
Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls, ExtCtrls,
Buttons, Grids, IniFiles;
Buttons, Grids, IniFiles, Windows;
type
TWMHotKey = packed record
MSG: cardinal;
HotKey: PtrInt;
Unused: PtrInt;
Result: PtrInt;
end;
type
{ TForm1 }
TForm1 = class(TForm)
map_stretch_checkbox: TCheckBox;
plus_spoil: TButton;
edit_room_button: TButton;
minus_spoil1: TButton;
@ -23,9 +33,10 @@ type
start_stop_button: TSpeedButton;
Timer1: TTimer;
procedure edit_room_buttonClick(Sender: TObject);
procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
procedure map_imagePaint(Sender: TObject);
procedure map_stretch_checkboxChange(Sender: TObject);
procedure minus_spoil1Click(Sender: TObject);
procedure plus_spoilClick(Sender: TObject);
procedure spoils_listboxDblClick(Sender: TObject);
@ -35,6 +46,9 @@ type
public
protected
procedure WMHotKey(var MSG: TWMHotKey); message WM_HOTKEY;
end;
var
@ -43,7 +57,7 @@ var
implementation
uses Windows, JwaTlHelp32;
uses JwaTlHelp32;
function FindProcessID(const ExeFileName: string): DWORD;
var
@ -113,6 +127,11 @@ var
new_room: bool;
spoils_list: string;
spoils: TStringArray;
fullscreen_map: bool = False;
var
x, y, w, h: integer;
state: TWindowState;
{$R *.lfm}
@ -124,19 +143,8 @@ begin
ROOMS := TIniFile.Create('rooms.ini');
process_list := TStringList.Create();
spoils_listbox.Height := 0;
end;
procedure TForm1.FormDestroy(Sender: TObject);
begin
// close the process on exit if it's been opened
if start_stop_button.Down = True then
begin
Timer1.Enabled := False;
CloseHandle(hProcess);
end;
// free additionally created objects
ROOMS.Free;
process_list.Free;
if not RegisterHotKey(Handle, 111000, MOD_WIN, VK_Y) then
ShowMessage('HotKey registration failed. You won''t be able to press Win+Y to temporarily view map in full screen.');
end;
procedure TForm1.map_imagePaint(Sender: TObject);
@ -145,6 +153,11 @@ begin
//map_image.Canvas.Rectangle(0, 0, 400, 400);
end;
procedure TForm1.map_stretch_checkboxChange(Sender: TObject);
begin
map_image.Proportional := not map_stretch_checkbox.Checked;
end;
procedure TForm1.minus_spoil1Click(Sender: TObject);
var
Txt: string;
@ -306,4 +319,53 @@ begin
end;
end;
procedure TForm1.FormClose(Sender: TObject; var CloseAction: TCloseAction);
begin
// close the process on exit if it's been opened
if start_stop_button.Down = True then
begin
Timer1.Enabled := False;
CloseHandle(hProcess);
end;
// free additionally created objects
ROOMS.Free;
process_list.Free;
UnregisterHotKey(Handle, 111000);
end;
procedure TForm1.WMHotKey(var MSG: TWMHotKey);
begin
fullscreen_map := not fullscreen_map;
Form1.Caption := (BoolToStr(fullscreen_map));
Form1.Visible := False;
if (fullscreen_map = True) then
begin
x := Form1.Left;
y := Form1.top;
w := Form1.Width;
h := Form1.Height;
state := Form1.WindowState;
Form1.FormStyle := fsStayOnTop;
Form1.BorderStyle := bsNone;
Form1.Left := 0;
Form1.Top := 0;
form1.Width := Screen.Width;
Form1.Height := Screen.Height;
end
else
begin
Form1.FormStyle := fsNormal;
Form1.BorderStyle := bsSingle;
Form1.Left := x;
Form1.Top := y;
form1.Width := w;
Form1.Height := h;
Form1.WindowState := state;
end;
Form1.Visible := True;
RegisterHotKey(Handle, 111000, MOD_WIN, VK_Y);
end;
end.