A lousy night
I woke up at about 2am. I turned over and said "Nope. Just, no.".
Why? Because even in the context of dreams, the one I was currently having was dismal. Terrible characterisation (even Adam Sandler could have been more convincing), more plot holes than the Divergent films, and so many convenient contrivances that it was just a joke.
I don't expect to have Emmy quality dreams, but the one I was having would have shamed Uwe Boll. Hell, it would have shamed Ed Wood.
My brain, however, took umbrage at this critique and decided that sleep was an optional activity.
I told it that it would regret this in the morning.
I'm hoping for a better set of dreams tonight. Hell, if all else fails at least introduce Cthulhu or, you know, just blow shit up. It works for Michael Bay...
Sensible RISC OS shutdown
aka: A nasty hack to work around an annoying bug
Here's the deal. More recent versions of RISC OS (since sorta 5.27ish) have a built in Clipboard service that manages inter-app copy-pasting, and also deals with copy-pasting to/from icons. You know, only three decades late. ☺
There is, unfortunately, a rather annoying flaw in the current implementation. The Wimp (the RISC OS UI) will attempt to start the Clipboard Manager if it is not running. So, essentially, it gets auto-started as the desktop environment begins.
So far so good.
But when doing a system shutdown, that's when things go awry. As expected, everything gets shut down.
Now, if you happen to have some PostDesk scripts, that is to say, a set of commands to execute on successful termination of the user interface, then the final thing the TaskManager will do is issue the following commands:
WimpTask Repeat BootObey Choices:Boot.PostDesk -type Obey
The problem here is that we are using WimpTask in order to set up a sanitised environment for the final scripts.
This is a problem because the Wimp handles it as a task start, notices that Clipboard Manager isn't running, and starts that up...trashing the memory allocation of what was supposed to be happening.
Really, the Wimp should notice that it has shut itself down, and not do something as duh-worthy as trying to restart the clipboard stuff in that state.
But, until then, there are two simple rules for a successful PostDesk script:
- Only have one Obey file. Multiples trigger a Not enough memory error.
- Don't call any BASIC or Absolute programs... Not enough memory.
Doesn't leave you with many choices, does it? Indeed, in a thread on the ROOL forums where somebody is looking for older ROM images, somebody else wondered if it was possible to bodge together a new RISC OS with an older version of the Wimp (building from source) in order to work around this.
I did some experimentation (several dozen resets!) before landing upon an ugly but working solution. I posted it, and the OP whinged that it wasn't on topic. Jeez, try to be helpful...
So I deleted it from there where it might have been a useful place to put it, following the person who was having the issue, and am posting the info here instead.
So, the first step to doing useful things in PostDesk is to have a PostDesk directory. This isn't part of the standard setup.
An empty PostDesk directory.
Into this, you'll want to place one and only one Obey file. Call it whatever you like.
I called mine "Obey". Inspired, huh?
Set it to run something called UtilHack in the same directory.
The Obey file.
Now, UtilHack is a sweet little bit of weaponising things against the Wimp. It is a Utility (file type &FFC) which means it will be loaded into the RMA, given a minimal environment, and then executed in user mode. This is done in order that utilities don't mess with the currently active program. It executed in-situ in the RMA, it doesn't require any application space.
It does just one thing. Can you tell from this?
The UtilHack file.
That's right, it issues the command:
WimpTask Basic -quit <Obey$Dir>.BASICcode
What we are doing here is using this WimpTask method to get the Wimp to invoke our desired program with proper memory handling set up. And since by this point the unwanted clipboard stuff will be running, the Wimp won't bugger up our memory allocation.
There. That's all you need to fix the problem.
Oh, you don't want to copy opcodes from a picture? Well, okay, I suppose I'd better include the source then. ☺
This, which I called "buildutil", can be stuck inside PostDesk in case it is wanted. It isn't an Obey file, so it'll be ignored by the shutdown handler.
The code to build the utility file.
Or, in a more readable form:
DIM code% 63
FOR l% = 0 TO 2 STEP 2
P% = code%
[ OPT l%
ADR R0, command
EQUS "WimpTask Basic -quit <Obey$Dir>.BASICcode" + CHR$(0)
SYS "OS_File", 10, "<Choices$Write>.Boot.PostDesk.UtilHack", &FFC, , code%, P%
The final part of the puzzle is the "BASICcode" program. That's up to you.
The end result will be an Obey file that calls a Utility that tells the Wimp to run a BASIC program.
It's naff and grotty, but then so is the reason why this finagling was necessary in the first place.
The end result.
Please note that while I check this page every so often, I am not able to control what users write; therefore I disclaim all liability for unpleasant and/or infringing and/or defamatory material. Undesired content will be removed as soon as it is noticed. By leaving a comment, you agree not to post material that is illegal or in bad taste, and you should be aware that the time and your IP address are both recorded, should it be necessary to find out who you are. Oh, and don't bother trying to inline HTML. I'm not that stupid! ☺ ADDING COMMENTS DOES NOT WORK IF READING TRANSLATED VERSIONS.
You can now follow comment additions with the comment RSS feed. This is distinct from the b.log RSS feed, so you can subscribe to one or both as you wish.
|David Lamda, 5th July 2022, 13:49|
Your workaround worked first time when I tried it last night. Thanks again Rick. P.S I also enjoy reading your posts on here.
|J.G.Harston, 5th July 2022, 17:30|
Ooo, useful. I have a "wipe contents of scrap directory" command on /startup/ as I couldn't get it working on shutdown, but this will probably sort it.
I'm likely to rename the files to something "tidy" like
PostGo -> PostTask -> PostRun
|Rick, 5th July 2022, 18:00|
Given the reasoning behind why this is necessary, I think the files might best be called "Drink!" (Obey), "Feck!" (Utility), "Arse!" (your program), and "Girls!" (the utility creator).
|Gavin Wraith, 5th July 2022, 23:00|
I did not know that you were a fan of Father Jack, Rick.
(Felicity? Marte? Find out!)
- Alibaba order, Chronopost are arses, Fibre, Right wing hypocrites. (2023/03/28)
- A lovely day, Doing the electrics, Easy listening, Is Anna broken? Class of '07, One more thing. (2023/03/27)
- Hailstorm, ESP32-Cam fiddling. (2023/03/26)
- France is on strike (again), Cute Easter things, Beware the big packs of Quaker Oats, Yet another storm, More raspberries, Power points, Mowing. (2023/03/25)
- USB-MIDI v0.08, ESP32Cam order (AliExpress), Raspberry. (2023/03/19)
List all b.log entries
Return to the site index
PS: Don't try to be clever.
It's a simple substring match.
Last read at 08:42 on 2023/03/29.
© 2022 Rick Murray
This web page is licenced for your personal, private, non-commercial use only. No automated processing by advertising systems is permitted.
RIPA notice: No consent is given for interception of page transmission.