Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion src/Core/SuperMemoAssistant.Core/NativeDataCfg.json
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,10 @@
"Queue_GetItem": { // TQueue::GetItem
"Pattern": "E8 ? ? ? ? 89 45 AB",
"Offset": 1
},
"TSMMain_FindElements": {
"Pattern": "E8 ? ? ? ? EB 11 8A 4D FA",
"Offset": 1
}
},
"NativeDataPatterns": {},
Expand Down Expand Up @@ -314,6 +318,10 @@
"Queue_GetItem": { // TQueue::GetItem
"Pattern": "E8 ? ? ? ? 89 45 AB",
"Offset": 1
},
"TSMMain_FindElements": {
"Pattern": "E8 ? ? ? ? EB 11 8A 4D FA",
"Offset": 1
}
},
"NativeDataPatterns": {},
Expand Down Expand Up @@ -478,6 +486,10 @@
"Queue_GetItem": { // TQueue::GetItem
"Pattern": "E8 ? ? ? ? 89 45 AB",
"Offset": 1
},
"TSMMain_FindElements": {
"Pattern": "E8 ? ? ? ? EB 11 8A 4D FA",
"Offset": 1
}
},
"NativeDataPatterns": {},
Expand Down Expand Up @@ -647,7 +659,11 @@
},
"Queue_GetItem": { // TQueue::GetItem
"Pattern": "E8 ? ? ? ? 89 45 AB",
"Offset": 1
"Offset": 1
},
"TSMMain_FindElements": {
"Pattern": "E8 ? ? ? ? EB 11 8A 4D FA",
"Offset": 1
}
},
"NativeDataPatterns": {},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,24 @@ public bool SelectDefaultConcept(IntPtr smMainPtr, int conceptId)
}
}

// TODO:
// I copied these parameters from the IDR dissasembly of the TSMMain.MIFindElementsClick
// Not entirely sure what they mean
// param y I believe represents the search target (registry?)
public bool FindElements(char x, char y, char z)
{
try
{
NativeMethod.TSMMain_FindElements.ExecuteOnMainThread(x, y, z);
return true;
}
catch (Exception ex)
{
LogTo.Error(ex, "Native method call threw an exception.");
return false;
}
}

#endregion
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,24 @@ public bool SetCurrentConcept(int conceptId)
return success && CurrentConceptId == conceptId;
}

public bool OpenFindElementsDialog()
{
try
{
return Core.Natives.SMMain.FindElements((char)3, (char)1, (char)0);
}
catch (Win32Exception ex)
{
LogTo.Warning(ex, "Failed to read SMMainWdwPtr");
return false;
}
catch (Exception ex)
{
LogTo.Error(ex, "SM internal method call threw an exception.");
return false;
}
}

public bool GoToElement(int elementId)
{
try
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ public enum NativeMethod
TCompData_SetTextRegMember,
TCompData_GetImageRegMember,
TCompData_SetImageRegMember,
TSMMain_FindElements,
TSMMain_SelectDefaultConcept,
TRegistry_AddMember,
TRegistry_ImportFile,
Expand Down