diff --git a/README.md b/README.md index ac5227a..0fbfa30 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/mmbn5m.lpi b/mmbn5m.lpi index de35cc9..07689a1 100644 --- a/mmbn5m.lpi +++ b/mmbn5m.lpi @@ -18,7 +18,7 @@ - + @@ -27,6 +27,7 @@ + diff --git a/mmbn5m.lps b/mmbn5m.lps index 425fa01..63957db 100644 --- a/mmbn5m.lps +++ b/mmbn5m.lps @@ -48,7 +48,7 @@ - + @@ -59,9 +59,9 @@ - - - + + + @@ -70,7 +70,7 @@ - + @@ -78,71 +78,11 @@ - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -203,6 +143,66 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/mmbn5m.res b/mmbn5m.res index 994e6c6..b7b63f4 100644 Binary files a/mmbn5m.res and b/mmbn5m.res differ diff --git a/unit1.lfm b/unit1.lfm index 8c10ea0..52df579 100644 --- a/unit1.lfm +++ b/unit1.lfm @@ -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 diff --git a/unit1.pas b/unit1.pas index ce4618c..a7bd40c 100644 --- a/unit1.pas +++ b/unit1.pas @@ -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.