commit 3486e8ea449c6540fb81bebe8e230495fb3a1224 Author: 4aiman Date: Thu Jan 11 14:31:18 2024 +0300 Created the project, added some rooms diff --git a/README.md b/README.md new file mode 100644 index 0000000..5b35f17 --- /dev/null +++ b/README.md @@ -0,0 +1,47 @@ +# Megaman Battle Network 5 Mini Map App + +This app is a Windows only tool that reads MMBN Legacy Collection 2's memory and grabs current map ID from that. + +Then it displays an image of the current room if that's present in the [images](/images/) folder. + +The images were taken from [Dr. Cossack's Lab](https://www.interordi.com/mega_man_pc/games/mmbn5/) without anyone's consent. + + +# How to use + +- Open the legacy collection 2 +- Load up MMBN 5 (tested with Team Protoman) +- Open this app +- 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. + +The app should work under a regular user ***do not*** give this app (and 99.9% of all the other apps) admin privs + + +# Usecases + +I dunno, having a map ready? Maybe for a stream? Does the reason have to exist? + + +# Legal Stuff + +One word: **WTFPL**. + +Assets are *not* included. Because... + +***- Wait, did you *steal* the images? ~ The User*** + +> As stated above, the images were obtained from the internet w/o anyone's consent. +> +> We can argue all day about whether coding something means I can tell you what to do. Especially when the app in question uses assets made by other people and is useless without those. +> +> The same goes for the images. Yes, [Mega Boy](megaboy@sympatico.ca) did create the images used in this app, but does he own them? Can he (or Dr. Cossack's for that sake) grant *any* persmissions regading Capcom's assets? +> +> Don't think so. +> +> It's not hard to ask, but I don't feel like there's any reason to. +> +> Dumping something from a game sure requires an investment of time - just as crating this app and writing this readme does. But neither act magically makes any of use the owner of those assets. At best it's a derivative work akin fan art. +> +> If there's anyone to ask that would be Capcom themselves. And we all know what they think (see [III. IMPERMISSIBLE USES](https://www.capcomusa.com/video-policy/)). Be happy Capcom doesn't enforce its rights and allows us to to what we do diff --git a/images/ACDC Area 1.png b/images/ACDC Area 1.png new file mode 100644 index 0000000..97ec842 Binary files /dev/null and b/images/ACDC Area 1.png differ diff --git a/images/ACDC Area 2.png b/images/ACDC Area 2.png new file mode 100644 index 0000000..6de4d6a Binary files /dev/null and b/images/ACDC Area 2.png differ diff --git a/images/ACDC Area 3.png b/images/ACDC Area 3.png new file mode 100644 index 0000000..bd58927 Binary files /dev/null and b/images/ACDC Area 3.png differ diff --git a/images/Drill Comp 1.png b/images/Drill Comp 1.png new file mode 100644 index 0000000..d994fc3 Binary files /dev/null and b/images/Drill Comp 1.png differ diff --git a/images/Drill Comp 2.png b/images/Drill Comp 2.png new file mode 100644 index 0000000..078802e Binary files /dev/null and b/images/Drill Comp 2.png differ diff --git a/images/Drill Comp 3.png b/images/Drill Comp 3.png new file mode 100644 index 0000000..3181c19 Binary files /dev/null and b/images/Drill Comp 3.png differ diff --git a/images/Drill Comp 4.png b/images/Drill Comp 4.png new file mode 100644 index 0000000..4183290 Binary files /dev/null and b/images/Drill Comp 4.png differ diff --git a/images/End Area 1.png b/images/End Area 1.png new file mode 100644 index 0000000..7642b51 Binary files /dev/null and b/images/End Area 1.png differ diff --git a/images/End Area 2.png b/images/End Area 2.png new file mode 100644 index 0000000..2783e44 Binary files /dev/null and b/images/End Area 2.png differ diff --git a/images/End Area 3.png b/images/End Area 3.png new file mode 100644 index 0000000..3d20dfe Binary files /dev/null and b/images/End Area 3.png differ diff --git a/images/End Area 4.png b/images/End Area 4.png new file mode 100644 index 0000000..f9efa12 Binary files /dev/null and b/images/End Area 4.png differ diff --git a/images/End Area 5.png b/images/End Area 5.png new file mode 100644 index 0000000..fa436b4 Binary files /dev/null and b/images/End Area 5.png differ diff --git a/images/Factory Comp 1.png b/images/Factory Comp 1.png new file mode 100644 index 0000000..eda8449 Binary files /dev/null and b/images/Factory Comp 1.png differ diff --git a/images/Factory Comp 2.png b/images/Factory Comp 2.png new file mode 100644 index 0000000..5be4785 Binary files /dev/null and b/images/Factory Comp 2.png differ diff --git a/images/Factory Comp 3.png b/images/Factory Comp 3.png new file mode 100644 index 0000000..03d92e5 Binary files /dev/null and b/images/Factory Comp 3.png differ diff --git a/images/Factory Comp 4.png b/images/Factory Comp 4.png new file mode 100644 index 0000000..007c944 Binary files /dev/null and b/images/Factory Comp 4.png differ diff --git a/images/Gargoil Comp 1.png b/images/Gargoil Comp 1.png new file mode 100644 index 0000000..6a31ac1 Binary files /dev/null and b/images/Gargoil Comp 1.png differ diff --git a/images/Gargoil Comp 2.png b/images/Gargoil Comp 2.png new file mode 100644 index 0000000..7a68aa5 Binary files /dev/null and b/images/Gargoil Comp 2.png differ diff --git a/images/Gargoil Comp 3.png b/images/Gargoil Comp 3.png new file mode 100644 index 0000000..8d044c6 Binary files /dev/null and b/images/Gargoil Comp 3.png differ diff --git a/images/Gargoil Comp 4.png b/images/Gargoil Comp 4.png new file mode 100644 index 0000000..ecf9694 Binary files /dev/null and b/images/Gargoil Comp 4.png differ diff --git a/images/Main System 1.png b/images/Main System 1.png new file mode 100644 index 0000000..946b31d Binary files /dev/null and b/images/Main System 1.png differ diff --git a/images/Main System 2.png b/images/Main System 2.png new file mode 100644 index 0000000..abd908d Binary files /dev/null and b/images/Main System 2.png differ diff --git a/images/Nebula 1.png b/images/Nebula 1.png new file mode 100644 index 0000000..ee01057 Binary files /dev/null and b/images/Nebula 1.png differ diff --git a/images/Nebula 2.png b/images/Nebula 2.png new file mode 100644 index 0000000..dcacdbd Binary files /dev/null and b/images/Nebula 2.png differ diff --git a/images/Nebula 3.png b/images/Nebula 3.png new file mode 100644 index 0000000..e54969e Binary files /dev/null and b/images/Nebula 3.png differ diff --git a/images/Nebula 4.png b/images/Nebula 4.png new file mode 100644 index 0000000..bfe2cf4 Binary files /dev/null and b/images/Nebula 4.png differ diff --git a/images/Nebula 5.png b/images/Nebula 5.png new file mode 100644 index 0000000..c50a7bd Binary files /dev/null and b/images/Nebula 5.png differ diff --git a/images/Nebula 6.png b/images/Nebula 6.png new file mode 100644 index 0000000..2c52d38 Binary files /dev/null and b/images/Nebula 6.png differ diff --git a/images/Oran Area 1.png b/images/Oran Area 1.png new file mode 100644 index 0000000..37f5213 Binary files /dev/null and b/images/Oran Area 1.png differ diff --git a/images/Oran Area 2.png b/images/Oran Area 2.png new file mode 100644 index 0000000..4f29595 Binary files /dev/null and b/images/Oran Area 2.png differ diff --git a/images/Oran Area 3.png b/images/Oran Area 3.png new file mode 100644 index 0000000..ea7840e Binary files /dev/null and b/images/Oran Area 3.png differ diff --git a/images/SciLab Area 1.png b/images/SciLab Area 1.png new file mode 100644 index 0000000..0af34eb Binary files /dev/null and b/images/SciLab Area 1.png differ diff --git a/images/SciLab Area 2.png b/images/SciLab Area 2.png new file mode 100644 index 0000000..c7589c9 Binary files /dev/null and b/images/SciLab Area 2.png differ diff --git a/images/SciLab Area 3.png b/images/SciLab Area 3.png new file mode 100644 index 0000000..29110a5 Binary files /dev/null and b/images/SciLab Area 3.png differ diff --git a/images/SciLab Area 4.png b/images/SciLab Area 4.png new file mode 100644 index 0000000..84d32e3 Binary files /dev/null and b/images/SciLab Area 4.png differ diff --git a/images/Ship Comp 1.png b/images/Ship Comp 1.png new file mode 100644 index 0000000..f6b8b1e Binary files /dev/null and b/images/Ship Comp 1.png differ diff --git a/images/Ship Comp 2.png b/images/Ship Comp 2.png new file mode 100644 index 0000000..0cf5171 Binary files /dev/null and b/images/Ship Comp 2.png differ diff --git a/images/Ship Comp 3.png b/images/Ship Comp 3.png new file mode 100644 index 0000000..32584ce Binary files /dev/null and b/images/Ship Comp 3.png differ diff --git a/images/Ship Comp 4.png b/images/Ship Comp 4.png new file mode 100644 index 0000000..45019ca Binary files /dev/null and b/images/Ship Comp 4.png differ diff --git a/images/Undernet 1.png b/images/Undernet 1.png new file mode 100644 index 0000000..3f89b5c Binary files /dev/null and b/images/Undernet 1.png differ diff --git a/images/Undernet 2.png b/images/Undernet 2.png new file mode 100644 index 0000000..61557c4 Binary files /dev/null and b/images/Undernet 2.png differ diff --git a/images/Undernet 3.png b/images/Undernet 3.png new file mode 100644 index 0000000..0a40109 Binary files /dev/null and b/images/Undernet 3.png differ diff --git a/images/Undernet 4.png b/images/Undernet 4.png new file mode 100644 index 0000000..ec81a51 Binary files /dev/null and b/images/Undernet 4.png differ diff --git a/mmbn5m.lpi b/mmbn5m.lpi new file mode 100644 index 0000000..22f4515 --- /dev/null +++ b/mmbn5m.lpi @@ -0,0 +1,92 @@ + + + + + + + + + <Scaled Value="True"/> + <ResourceType Value="res"/> + <UseXPManifest Value="True"/> + <XPManifest> + <DpiAware Value="True"/> + </XPManifest> + <Icon Value="0"/> + </General> + <BuildModes> + <Item Name="Debug" Default="True"/> + </BuildModes> + <PublishOptions> + <Version Value="2"/> + <UseFileFilters Value="True"/> + </PublishOptions> + <RunParams> + <FormatVersion Value="2"/> + </RunParams> + <RequiredPackages> + <Item> + <PackageName Value="LCL"/> + </Item> + </RequiredPackages> + <Units> + <Unit> + <Filename Value="mmbn5m.lpr"/> + <IsPartOfProject Value="True"/> + </Unit> + <Unit> + <Filename Value="unit1.pas"/> + <IsPartOfProject Value="True"/> + <ComponentName Value="Form1"/> + <HasResources Value="True"/> + <ResourceBaseClass Value="Form"/> + <UnitName Value="Unit1"/> + </Unit> + </Units> + </ProjectOptions> + <CompilerOptions> + <Version Value="11"/> + <PathDelim Value="\"/> + <Target> + <Filename Value="mmbn5m"/> + </Target> + <SearchPaths> + <IncludeFiles Value="$(ProjOutDir)"/> + <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/> + </SearchPaths> + <CodeGeneration> + <SmartLinkUnit Value="True"/> + <RelocatableUnit Value="True"/> + <Optimizations> + <OptimizationLevel Value="4"/> + </Optimizations> + <SmallerCode Value="True"/> + </CodeGeneration> + <Linking> + <Debugging> + <DebugInfoType Value="dsDwarf2Set"/> + <StripSymbols Value="True"/> + <UseExternalDbgSyms Value="True"/> + </Debugging> + <LinkSmart Value="True"/> + <Options> + <Win32> + <GraphicApplication Value="True"/> + </Win32> + </Options> + </Linking> + </CompilerOptions> + <Debugging> + <Exceptions> + <Item> + <Name Value="EAbort"/> + </Item> + <Item> + <Name Value="ECodetoolError"/> + </Item> + <Item> + <Name Value="EFOpenError"/> + </Item> + </Exceptions> + </Debugging> +</CONFIG> diff --git a/mmbn5m.lpr b/mmbn5m.lpr new file mode 100644 index 0000000..d73f6e2 --- /dev/null +++ b/mmbn5m.lpr @@ -0,0 +1,25 @@ +program mmbn5m; + +{$mode objfpc}{$H+} + +uses + {$IFDEF UNIX} + cthreads, + {$ENDIF} + {$IFDEF HASAMIGA} + athreads, + {$ENDIF} + Interfaces, // this includes the LCL widgetset + Forms, Unit1 + { you can add units after this }; + +{$R *.res} + +begin + RequireDerivedFormResource:=True; + Application.Scaled:=True; + Application.Initialize; + Application.CreateForm(TForm1, Form1); + Application.Run; +end. + diff --git a/mmbn5m.lps b/mmbn5m.lps new file mode 100644 index 0000000..2abe8e8 --- /dev/null +++ b/mmbn5m.lps @@ -0,0 +1,204 @@ +<?xml version="1.0" encoding="UTF-8"?> +<CONFIG> + <ProjectSession> + <PathDelim Value="\"/> + <Version Value="12"/> + <BuildModes Active="Release"> + <Item Name="Release"> + <CompilerOptions> + <Version Value="11"/> + <PathDelim Value="\"/> + <Target> + <Filename Value="mmbn5m"/> + </Target> + <SearchPaths> + <IncludeFiles Value="$(ProjOutDir)"/> + <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/> + </SearchPaths> + <CodeGeneration> + <SmartLinkUnit Value="True"/> + <RelocatableUnit Value="True"/> + <TargetCPU Value="x86_64"/> + <TargetOS Value="win64"/> + <Optimizations> + <OptimizationLevel Value="4"/> + </Optimizations> + <SmallerCode Value="True"/> + </CodeGeneration> + <Linking> + <Debugging> + <DebugInfoType Value="dsDwarf2Set"/> + <TrashVariables Value="True"/> + <StripSymbols Value="True"/> + <UseExternalDbgSyms Value="True"/> + </Debugging> + <LinkSmart Value="True"/> + <Options> + <Win32> + <GraphicApplication Value="True"/> + </Win32> + </Options> + </Linking> + </CompilerOptions> + </Item> + </BuildModes> + <Units> + <Unit> + <Filename Value="mmbn5m.lpr"/> + <IsPartOfProject Value="True"/> + <EditorIndex Value="1"/> + <CursorPos X="69" Y="19"/> + <UsageCount Value="29"/> + <Loaded Value="True"/> + </Unit> + <Unit> + <Filename Value="unit1.pas"/> + <IsPartOfProject Value="True"/> + <ComponentName Value="Form1"/> + <HasResources Value="True"/> + <ResourceBaseClass Value="Form"/> + <UnitName Value="Unit1"/> + <IsVisibleTab Value="True"/> + <TopLine Value="144"/> + <CursorPos X="41" Y="175"/> + <UsageCount Value="29"/> + <Loaded Value="True"/> + <LoadedDesigner Value="True"/> + </Unit> + <Unit> + <Filename Value="C:\lazarus\lcl\interfaces\win32\win32listsl.inc"/> + <EditorIndex Value="2"/> + <TopLine Value="128"/> + <CursorPos Y="152"/> + <UsageCount Value="12"/> + <Loaded Value="True"/> + </Unit> + </Units> + <JumpHistory HistoryIndex="29"> + <Position> + <Filename Value="unit1.pas"/> + <Caret Line="200" Column="35" TopLine="142"/> + </Position> + <Position> + <Filename Value="unit1.pas"/> + <Caret Line="108" Column="17" TopLine="82"/> + </Position> + <Position> + <Filename Value="unit1.pas"/> + <Caret Line="116" TopLine="84"/> + </Position> + <Position> + <Filename Value="unit1.pas"/> + <Caret Line="108" Column="33" TopLine="84"/> + </Position> + <Position> + <Filename Value="unit1.pas"/> + <Caret Line="192" Column="11" TopLine="182"/> + </Position> + <Position> + <Filename Value="unit1.pas"/> + <Caret Line="199" Column="11" TopLine="174"/> + </Position> + <Position> + <Filename Value="unit1.pas"/> + <Caret Line="200" Column="25" TopLine="176"/> + </Position> + <Position> + <Filename Value="unit1.pas"/> + <Caret Line="117" TopLine="93"/> + </Position> + <Position> + <Filename Value="unit1.pas"/> + <Caret Line="132" Column="12" TopLine="122"/> + </Position> + <Position> + <Filename Value="unit1.pas"/> + <Caret Line="175" TopLine="144"/> + </Position> + <Position> + <Filename Value="unit1.pas"/> + <Caret Line="118" Column="41" TopLine="94"/> + </Position> + <Position> + <Filename Value="unit1.pas"/> + <Caret Line="170" Column="55" TopLine="146"/> + </Position> + <Position> + <Filename Value="unit1.pas"/> + <Caret Line="117" Column="13" TopLine="117"/> + </Position> + <Position> + <Filename Value="unit1.pas"/> + <Caret Line="136" Column="25" TopLine="116"/> + </Position> + <Position> + <Filename Value="unit1.pas"/> + <Caret Line="135" Column="25" TopLine="115"/> + </Position> + <Position> + <Filename Value="unit1.pas"/> + <Caret Line="134" Column="25" TopLine="114"/> + </Position> + <Position> + <Filename Value="unit1.pas"/> + <Caret Line="133" Column="25" TopLine="113"/> + </Position> + <Position> + <Filename Value="unit1.pas"/> + <Caret Line="132" Column="25" TopLine="112"/> + </Position> + <Position> + <Filename Value="unit1.pas"/> + <Caret Line="210" Column="6" TopLine="208"/> + </Position> + <Position> + <Filename Value="unit1.pas"/> + <Caret Line="209" Column="6" TopLine="207"/> + </Position> + <Position> + <Filename Value="unit1.pas"/> + <Caret Line="199" Column="38" TopLine="181"/> + </Position> + <Position> + <Filename Value="unit1.pas"/> + <Caret Line="166" Column="7" TopLine="153"/> + </Position> + <Position> + <Filename Value="unit1.pas"/> + <Caret Line="182" Column="91" TopLine="156"/> + </Position> + <Position> + <Filename Value="unit1.pas"/> + <Caret Line="145" Column="63" TopLine="113"/> + </Position> + <Position> + <Filename Value="unit1.pas"/> + <Caret Line="141" Column="58" TopLine="113"/> + </Position> + <Position> + <Filename Value="unit1.pas"/> + <Caret Line="140" Column="41" TopLine="118"/> + </Position> + <Position> + <Filename Value="unit1.pas"/> + <Caret Line="171" Column="61" TopLine="155"/> + </Position> + <Position> + <Filename Value="unit1.pas"/> + <Caret Line="130" Column="37" TopLine="106"/> + </Position> + <Position> + <Filename Value="unit1.pas"/> + <Caret Line="129" Column="22" TopLine="106"/> + </Position> + <Position> + <Filename Value="unit1.pas"/> + <Caret Line="174" Column="38" TopLine="155"/> + </Position> + </JumpHistory> + <RunParams> + <FormatVersion Value="2"/> + <Modes ActiveMode=""/> + </RunParams> + </ProjectSession> +</CONFIG> diff --git a/mmbn5m.res b/mmbn5m.res new file mode 100644 index 0000000..09ecee6 Binary files /dev/null and b/mmbn5m.res differ diff --git a/rooms.ini b/rooms.ini new file mode 100644 index 0000000..b50efb0 --- /dev/null +++ b/rooms.ini @@ -0,0 +1,31 @@ +[Rooms] +144=ACDC Area 1 +145=Oran Area 1 +146=SciLab Area 1 +147=End Area 1 +148=Undernet 1 +400=ACDC Area 2 +401=Oran Area 2 +402=SciLab Area 2 +902=End Area 2 +404=Undernet 2 +134=ACDC Area 3 +390=Oran Area 3 +646=SciLab Area 3 +403=End Area 3 +660=Undernet 3 +658=SciLab Area 4 +659=End Area 4 +661=Undernet 4 +897=Drill Comp 4 +898=Ship Comp 4 +899=Gargoil Comp 4 +900=Factory Comp 4 +256=Lan's House +512=Lan's Room +0=ACDC Town +768=Mayl's Room +1024=Dex's Room +1280=Yai's Room +136=Lan's Home Page +392=Mayl's Home Page diff --git a/unit1.lfm b/unit1.lfm new file mode 100644 index 0000000..e571616 --- /dev/null +++ b/unit1.lfm @@ -0,0 +1,61 @@ +object Form1: TForm1 + Left = 802 + Height = 461 + Top = 496 + Width = 548 + BorderStyle = bsSingle + Caption = 'MMBN5M' + ClientHeight = 461 + ClientWidth = 548 + Font.CharSet = ANSI_CHARSET + Font.Height = -16 + Font.Pitch = fpVariable + Font.Quality = fqDraft + OnCreate = FormCreate + OnDestroy = FormDestroy + LCLVersion = '2.2.6.0' + object room_name_label: TLabel + Left = 120 + Height = 21 + Top = 8 + Width = 157 + Caption = 'Room #0: Lan''s Room ' + ParentColor = False + end + object map_image: TImage + Left = 120 + Height = 400 + Top = 40 + Width = 400 + Center = True + OnPaint = map_imagePaint + Proportional = True + Stretch = True + end + object start_stop_button: TSpeedButton + Left = 8 + Height = 30 + Top = 8 + Width = 100 + AllowAllUp = True + Caption = 'Start' + GroupIndex = 1 + Transparent = False + OnClick = start_stop_buttonClick + end + object edit_room_button: TButton + Left = 8 + Height = 30 + Top = 40 + Width = 100 + Caption = 'Edit Room' + OnClick = edit_room_buttonClick + TabOrder = 0 + end + object Timer1: TTimer + Enabled = False + OnTimer = Timer1Timer + Left = 24 + Top = 192 + end +end diff --git a/unit1.pas b/unit1.pas new file mode 100644 index 0000000..b628b5e --- /dev/null +++ b/unit1.pas @@ -0,0 +1,204 @@ +unit Unit1; + +{$mode objfpc}{$H+} + +interface + +uses + Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls, ExtCtrls, + Buttons, IniFiles ; + +type + + { TForm1 } + + TForm1 = class(TForm) + edit_room_button: TButton; + map_image: TImage; + room_name_label: TLabel; + start_stop_button: TSpeedButton; + Timer1: TTimer; + procedure edit_room_buttonClick(Sender: TObject); + procedure FormCreate(Sender: TObject); + procedure FormDestroy(Sender: TObject); + procedure map_imagePaint(Sender: TObject); + procedure start_stop_buttonClick(Sender: TObject); + procedure Timer1Timer(Sender: TObject); + private + + public + + end; + +var + Form1: TForm1; + +implementation + + +uses Windows, JwaTlHelp32; + + + +function FindProcessID(const ExeFileName: string): DWORD; +var + ContinueLoop: BOOL; + FSnapshotHandle: THandle; + FProcessEntry32: TProcessEntry32; +begin + Result := 0; + + FSnapshotHandle := CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0); + FProcessEntry32.dwSize := SizeOf(FProcessEntry32); + ContinueLoop := Process32First(FSnapshotHandle, FProcessEntry32); + + while Integer(ContinueLoop) <> 0 do + begin + if ((UpperCase(ExtractFileName(FProcessEntry32.szExeFile)) = UpperCase(ExeFileName)) or + (UpperCase(FProcessEntry32.szExeFile) = UpperCase(ExeFileName))) then + begin + Result := FProcessEntry32.th32ProcessID; + Break; + end; + ContinueLoop := Process32Next(FSnapshotHandle, FProcessEntry32); + end; + + CloseHandle(FSnapshotHandle); +end; + + + +function ReadMemory(hProcess: THandle; Address: Pointer; var Buffer; Size: DWORD): Boolean; +var + NumberOfBytesRead: SIZE_T; +begin + Result := ReadProcessMemory(hProcess, Address, @Buffer, Size, NumberOfBytesRead) and (NumberOfBytesRead = Size); +end; + +procedure ListRunningProcesses(ProcList: TStrings); +var + pProc: TProcessEntry32; + pSnap: THandle; + pBool: BOOL; +begin + ProcList.Clear; + pProc.dwSize := SizeOf(pProc); + pSnap := CreateToolhelp32Snapshot(TH32CS_SNAPALL, 0); + pBool := Process32First(pSnap, pProc); + while Integer(pBool) <> 0 do + begin + ProcList.Add(pProc.szExeFile); + pBool := Process32Next(pSnap, pProc); + end; + CloseHandle(pSnap); +end; + + + +var +hProcess: THandle; +ROOMS : TIniFile; // contains room labels +process_list : TStrings; +room: SmallInt = -1; // contains current room 16-bit value + +{$R *.lfm} + +{ TForm1 } + +procedure TForm1.FormCreate(Sender: TObject); +begin + // open ini file and create a list to hold processes + ROOMS := TIniFile.Create('rooms.ini'); + process_list := TStringList.Create(); +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; +end; + +procedure TForm1.map_imagePaint(Sender: TObject); +begin + map_image.Canvas.Brush.Style:=bsClear; + map_image.Canvas.Rectangle(0,0,400,400); +end; + +procedure TForm1.start_stop_buttonClick(Sender: TObject); +var i:integer; + ProcID: DWORD; + +begin + if start_stop_button.Down = false then begin + start_stop_button.Caption:='Start'; + Timer1.Enabled:=false; + CloseHandle(hProcess); + end else begin + start_stop_button.Caption:='Stop'; + ListRunningProcesses(process_list); + for i:=0 to process_list.Count-1 do begin + if (process_list[i] = 'MMBN_LC2.exe') then begin + ProcID := FindProcessID(process_list[i]); + hProcess := OpenProcess(PROCESS_VM_READ, False, ProcID); + Caption:= 'MMBN5M: Reading from process ID '+ IntToStr(ProcID); + Timer1.Enabled:=true; + break; + end; + end; + end; + +end; + +procedure TForm1.Timer1Timer(Sender: TObject); +var + room_name: string; +begin + + if hProcess <> 0 then + begin + try + if ReadMemory(hProcess, Pointer($80205FF4), room, SizeOf(room)) then + begin + room_name := ROOMS.ReadString('Rooms', inttostr(room), 'Unknown'); + room_name_label.Caption := 'Room #'+ inttostr(room)+ ': '+ room_name; + if FileExists('images/'+room_name+'.png') then begin + map_image.Picture.LoadFromFile('images/'+room_name+'.png'); + end else begin + map_image.Picture.Clear; + end; + end + else + begin + room_name_label.Caption := 'error'; + end; + except + on edit_room_button: Exception do + room_name_label.Caption:='error'; + end; + end; + +end; + +procedure TForm1.edit_room_buttonClick(Sender: TObject); +var new_room_name:string; +begin// + if InputQuery('Editing Room # '+inttostr(room), 'Enter this Room''s name', new_room_name) then begin + ROOMS.WriteString('Rooms', inttostr(room), new_room_name); + end; +end; + +end. + + + + + + + +