27 June 2021, 20:46 | #61 |
Registered User
Join Date: Dec 2010
Location: Athens/Greece
Age: 53
Posts: 722
|
|
27 June 2021, 20:58 | #62 |
Registered User
Join Date: May 2017
Location: Belgium
Age: 50
Posts: 334
|
|
27 June 2021, 21:13 | #63 |
Registered User
Join Date: Dec 2010
Location: Athens/Greece
Age: 53
Posts: 722
|
Ok, can you try these suggestions on your plugin.
First somewhere on top: Code:
struct Library *SysBase; struct Library *UtilityBase=NULL; struct Library *TextFieldBase=NULL; Code:
int openLibs(void) { SysBase = (*((struct Library **) 4)); if (! (UtilityBase = OpenLibrary("utility.library",47))) return 0; if (! (TextFieldBase = OpenLibrary("gadgets/texteditor.gadget",47))) return 0; return 1; } Code:
static void init(APTR userData) { struct Filetype *fType = (struct Filetype *)userData; if (!openLibs()) { terminate(fType); return; } struct Hook *hook = (struct Hook *)AllocVec(sizeof(struct Hook), MEMF_CLEAR); .... .... |
27 June 2021, 21:36 | #64 |
Registered User
Join Date: Jan 2021
Location: Germany
Posts: 18
|
|
27 June 2021, 22:07 | #65 |
bye
Join Date: Jun 2016
Location: Some / Where
Posts: 681
|
and some thoughts on topic:
- such plugins IMHO must not use any global data. baserel or not is irrelevant. - all data include *Base must be kept inside the plugins userdata, here it's ft->pluginData. Code:
struct MyData { struct XyBase * xyBase; int aValue; ... }; Code:
XYBase * xyBase = ((struct MyData *)ft->pluginData)->xyBase; // call xyBase fx now... |
27 June 2021, 22:09 | #66 |
bye
Join Date: Jun 2016
Location: Some / Where
Posts: 681
|
|
27 June 2021, 22:21 | #67 | |
Registered User
Join Date: May 2017
Location: Belgium
Age: 50
Posts: 334
|
Quote:
Thanks for your input, that's good to know. It doesn't solve the problem, unfortunately; the system still freezes when I start TextEdit. |
|
27 June 2021, 22:26 | #68 | |
Registered User
Join Date: May 2017
Location: Belgium
Age: 50
Posts: 334
|
Quote:
|
|
27 June 2021, 22:38 | #69 |
Registered User
Join Date: Dec 2010
Location: Athens/Greece
Age: 53
Posts: 722
|
|
28 June 2021, 00:13 | #70 | |
Registered User
Join Date: May 2017
Location: Belgium
Age: 50
Posts: 334
|
Quote:
highlightBlock()) returns a ULONG, so it cannot be empty. I have tried just having it return 1L, but the system still freezes when I do that. I have also tried leaving that function definition as it is, but not assigning it to the Hookin the init()function (which is probably what you meant). Here is that init()function: Code:
static void init(APTR userData) { //__asm("\ttrap\t#0"); struct Filetype *fType = (struct Filetype *)userData; if(!openLibs()) { terminate(fType); return; } //struct Hook *hook = (struct Hook *)AllocVec(sizeof(struct Hook), MEMF_CLEAR); fType->pluginData = (ULONG)1234567; // any number or pointer of our choosing fType->highlighterHook = NULL; fType->typeName = "example"; fType->autoFileTypes = "example"; fType->terminate = terminate; fType->settingsTitle = settingsTitle; fType->settingsGadget = settingsGadget; fType->processGadgetUp = processGadgetUp; fType->setSettingsFromGUI = setSettingsFromGUI; fType->setGUIFromSettings = setGUIFromSettings; fType->applySettings = applySettings; fType->saveSettings = saveHighlightSettings; fType->loadSettings = loadHighlightSettings; fType->disposeGadgets = disposeGadgets; fType->name = "Example"; //hook->h_Entry = (ULONG (*)()) highlightBlock; //hook->h_SubEntry = NULL; //hook->h_Data = 1234567; } AllocVec()line) and set fType->highlighterHook = NULL, and finally I also commented out the highlightBlock()definition completely. All 3 of those scenarios also resulted in a frozen system. I then reverted back to the complete, uncommented init()function and tried putting the trap lower. If I put it after the AllocVec()line, I got Software Failure #80000020, which implies the allocation works. Last thing I tried was putting the trap at the very bottom of the init()function. That gave a somewhat strange result: the dialog of the Software Failure #80000020started to appear, but the system froze before it could be rendered completely. So I ended up with frozen system showing a gray rectangle (without any text or other content) where the trap error would normally appear. This suggests to me that the end of the init()function was reached, but the system froze before it could finish rendering the Software Failure #80000020. I think I'm gonna have to sleep on that one.. |
|
28 June 2021, 01:00 | #71 |
Registered User
Join Date: Dec 2010
Location: Athens/Greece
Age: 53
Posts: 722
|
Ok, lets try logging.
Add -log -serlog to the winuae icon (i have a shortcut to my desktop, right click, properties, my target now reads "D:\winuae\winuae64.exe -log -serlog" Now on your plugin code, somewhere near the top, define this prototype Code:
int KPrintF(const char *, ...); Now, place right after the if of openlibs Code:
KPrintF("Libraries opened ok\n"); Code:
KPrintF("Init's end reached\n"); Code:
KPrintF("Hook called\n"); //fist line in your hook ... ... KPrintF("Hook end reached\n"); //last line in your hook |
28 June 2021, 01:13 | #72 |
Registered User
Join Date: Dec 2010
Location: Athens/Greece
Age: 53
Posts: 722
|
Also add this as last line in terminate
Code:
TextFieldBase = UtilityBase = NULL; |
28 June 2021, 11:45 | #73 | |
Natteravn
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,539
|
Quote:
Software Failure #80000020? This is very strange, and it implies that the init()function probably never returned without freezing the system. So you can forget about the hook for now. If we assume that the system was stable before entering init(), and that TextEdit didn't already corrupt the system while loading the executable or processing the plugin header, there are only two possibilies for more system corruptions:
init()? Does TextEdit allow that? Maybe test that first with an SAS/C compilation. BTW, was anybody successful to make such a plugin work with a different compiler, like gcc? Somehow I get the feeling that there might even be a problem in TextEdit (like the don't-change-a4 dependency) which is hidden when compiling the plugin with SAS/C... Otherwise, this is probably the point where you have to start some serious debugging, with a real AmigaOS debugger or by using UAE. Also Enforcer or MuForce would help to catch some illegal accesses early. But AFAIK that doesn't work with your Vampire? |
|
28 June 2021, 22:49 | #74 | ||
Registered User
Join Date: May 2017
Location: Belgium
Age: 50
Posts: 334
|
You're right, I cannot be sure of that. It's just that I had seen 17 such Software Failure's just before that, so I assumed it would have been the same error. But it may indeed have been something else entirely; no way to be sure.
Quote:
Quote:
init()function back in, and this is how far I got: Code:
static void init(APTR userData) { struct Filetype *fType = (struct Filetype *)userData; fType->name = "Example"; fType->typeName = "example"; //!! the next line makes the system freeze when starting TextEdit //fType->autoFileTypes = "example"; } userDatais indeed bad. I don't know if there's anything I can do to make that pointer good? That seems to be pretty much out of my control, doesn't it? You're right, the devs on the Discord server just told me neither Enforcer nor MuForce will work on the current Vampire Core. The next Core should contain similar functionality, though: 'Apollo Shield'. Cores normally get released on a bimonthly basis, so I expect this tool to be available somewhere in July. |
||
29 June 2021, 00:06 | #75 | |
Camilla, AmigaOS Dev.
Join Date: Mar 2020
Location: Frederiksberg
Posts: 330
|
Quote:
|
|
29 June 2021, 00:10 | #76 |
Camilla, AmigaOS Dev.
Join Date: Mar 2020
Location: Frederiksberg
Posts: 330
|
Try and use the full example but just comment out that autoFileTypes assignment
|
29 June 2021, 01:03 | #77 |
Camilla, AmigaOS Dev.
Join Date: Mar 2020
Location: Frederiksberg
Posts: 330
|
Hmm can it be that because init is static and thus vbcc pass arguments differently ? so it interprets userData in a wrong way ?vbcc
I've tried loading the plugin you provided in a zip, and what I see is that the pluginheaders seems to be correct, the pointer to init function seems correct too, and it does return. The string pointers are still null after the return though which doesn't correspond to the source files in the zip. That is why I think the init might misinterpret the argument |
29 June 2021, 09:55 | #78 |
bye
Join Date: Jun 2016
Location: Some / Where
Posts: 681
|
try this:
Code:
void init(APTR userData asm("a0")) { ... } |
29 June 2021, 10:01 | #79 |
Camilla, AmigaOS Dev.
Join Date: Mar 2020
Location: Frederiksberg
Posts: 330
|
|
29 June 2021, 10:50 | #80 |
bye
Join Date: Jun 2016
Location: Some / Where
Posts: 681
|
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
AmigaOS 3.2 TextEdit - black text on black background? | Warty | support.Apps | 7 | 08 June 2021 17:30 |
gedit asm syntax highlighting plugin? | grond | Coders. Asm / Hardware | 0 | 19 May 2020 13:06 |
VBCC assembler linking syntax? | NovaCoder | Coders. General | 2 | 20 May 2011 03:04 |
CLI Syntax | Greaser | New to Emulation or Amiga scene | 1 | 08 October 2006 10:14 |
SynTax Disks (old) | andreas | request.Old Rare Games | 1 | 19 July 2003 04:02 |
|
|